rtc-screen: Fixes to screen intra mode testing
Adjust the low spatial variance thresholds to allow
for more intra testing, and fix an early exit
to allow H/V intra testing under some conditions.
For low spatial areas that have moved from previous frame,
faint lines can incorectly appear, due to wrong mode
or early exit in intra-testing. This can be seen, for
example, in scroll movement as in the buganizer clip.
The current fix reduces these artfiacts with mimimal
impact on speed.
Stats changed, for speed 10:
avg_psnr/ovr_psnr/ssim, %speedup(IC)
-0.58/-0.67/-1.6, -0.6%
On the screenshare_buganizer clip, where this change
reduce the line artifacts, gain is:
-2.6/-4.6/-9.0, -0.7%
Change-Id: I58a00eabdd83c5fb86685595b194350c1229fd64
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index bf373c6..f85f2f0 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -2253,7 +2253,7 @@
}
if ((x->source_variance < AOMMAX(50, (spatial_var_thresh >> 1)) &&
x->content_state_sb.source_sad_nonrd >= kHighSad) ||
- (is_screen_content && x->source_variance == 0 &&
+ (is_screen_content && x->source_variance < 50 &&
((bsize >= BLOCK_32X32 &&
x->content_state_sb.source_sad_nonrd != kZeroSad) ||
x->color_sensitivity[0] == 1 || x->color_sensitivity[1] == 1)))
@@ -2315,8 +2315,7 @@
const THR_MODES mode_index = mode_idx[INTRA_FRAME][mode_offset(this_mode)];
const int64_t mode_rd_thresh = rd_threshes[mode_index];
- if (i > 2 || !(force_intra_check == 1 &&
- best_pickmode->best_ref_frame != INTRA_FRAME)) {
+ if (i > 2 || force_intra_check == 0) {
if (!((1 << this_mode) &
cpi->sf.rt_sf.intra_y_mode_bsize_mask_nrd[bsize]))
continue;
@@ -2328,8 +2327,8 @@
if (x->content_state_sb.source_sad_nonrd == kZeroSad &&
x->source_variance == 0 && this_mode != DC_PRED)
continue;
- // Only test Intra for big blocks if spatial_variance is 0.
- else if (bsize > BLOCK_32X32 && x->source_variance > 0)
+ // Only test Intra for big blocks if spatial_variance is small.
+ else if (bsize > BLOCK_32X32 && x->source_variance > 50)
continue;
}