shithub: libvpx

Download patch

ref: 5f84090ab3382792f3b79e36d673f3667fbaf6af
parent: 2d403737b88f76ce8410237a8eb682cc556ac302
author: Marco Paniconi <marpan@google.com>
date: Wed Feb 27 04:28:43 EST 2019

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

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1699,6 +1699,7 @@
   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 @@
       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 @@
                           &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]);