From 5f84090ab3382792f3b79e36d673f3667fbaf6af Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Wed, 27 Feb 2019 09:28:43 -0800 Subject: [PATCH] vp9-rtc: Modify skip golden mode check for 1 layer For real-time CBR mode: golden reference mode testing is skipped under certain conditons based on sse of zero-last mode. This was done for svc mode. Here we add similar condition for non-svc/1 layer encoding. Reduces flashing block artifacts that can occur in background areas with noise. Change-Id: I93f71ea9507af8c9153fc6c0ba7dcc7a0fa8810d --- vp9/encoder/vp9_pickmode.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 8cd1e6e31..554f605b4 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -1699,6 +1699,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, int svc_mv_row = 0; int no_scaling = 0; unsigned int thresh_svc_skip_golden = 500; + unsigned int thresh_skip_golden = (bsize >= BLOCK_32X32) ? 5000 : 1000; int scene_change_detected = cpi->rc.high_source_sad || (cpi->use_svc && cpi->svc.high_source_sad_superframe); @@ -2018,10 +2019,11 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, if (segfeature_active(seg, mi->segment_id, SEG_LVL_REF_FRAME)) continue; } - // For SVC, skip the golden (spatial) reference search if sse of zeromv_last - // is below threshold. - if (cpi->use_svc && ref_frame == GOLDEN_FRAME && - sse_zeromv_normalized < thresh_svc_skip_golden) + // For CBR mode: skip the golden reference search if sse of zeromv_last is + // below threshold. + if (ref_frame == GOLDEN_FRAME && cpi->oxcf.rc_mode == VPX_CBR && + ((cpi->use_svc && sse_zeromv_normalized < thresh_svc_skip_golden) || + (!cpi->use_svc && sse_zeromv_normalized < thresh_skip_golden))) continue; if (!(cpi->ref_frame_flags & flag_list[ref_frame])) continue; @@ -2240,7 +2242,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, &var_y, &sse_y); } // Save normalized sse (between current and last frame) for (0, 0) motion. - if (cpi->use_svc && ref_frame == LAST_FRAME && + if (ref_frame == LAST_FRAME && frame_mv[this_mode][ref_frame].as_int == 0) { sse_zeromv_normalized = sse_y >> (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]); -- 2.40.0