shithub: libvpx

Download patch

ref: bf59fb119eef062e35b01121d63f9eb94f6cd7eb
parent: dd08a110931097d9245b5534e6c821120c718f13
author: Marco Paniconi <marpan@google.com>
date: Tue Jan 29 12:19:02 EST 2019

vp9-svc: Modify early breakout for non-rd pickmode

Modify early breakout condition for non-rd pickmode
for quality layers: when lower layer has lower QP force
test of zeromv on golden (lower layer reference) before
breakout due to skip.

Reduce artifacts, observed in cases of scrolling content.

Change-Id: Id834b1eb024a4c97f0e74d8b7f7a0351459e088f

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1683,6 +1683,7 @@
   unsigned int sse_zeromv_normalized = UINT_MAX;
   unsigned int best_sse_sofar = UINT_MAX;
   int gf_temporal_ref = 0;
+  int force_test_gf_zeromv = 0;
 #if CONFIG_VP9_TEMPORAL_DENOISING
   VP9_PICKMODE_CTX_DEN ctx_den;
   int64_t zero_last_cost_orig = INT64_MAX;
@@ -1939,6 +1940,13 @@
     flag_svc_subpel = 1;
   }
 
+  // For SVC with quality layers, when QP of lower layer is lower
+  // than current layer: force check of GF-ZEROMV before early exit
+  // due to skip flag.
+  if (svc->spatial_layer_id > 0 && usable_ref_frame == GOLDEN_FRAME &&
+      no_scaling && cm->base_qindex > svc->lower_layer_qindex + 10)
+    force_test_gf_zeromv = 1;
+
   for (idx = 0; idx < num_inter_modes + comp_modes; ++idx) {
     int rate_mv = 0;
     int mode_rd_thresh;
@@ -2349,11 +2357,14 @@
       if (reuse_inter_pred) free_pred_buffer(this_mode_pred);
     }
 
-    if (x->skip) break;
+    if (x->skip &&
+        (!force_test_gf_zeromv || mode_checked[ZEROMV][GOLDEN_FRAME]))
+      break;
 
     // If early termination flag is 1 and at least 2 modes are checked,
     // the mode search is terminated.
-    if (best_early_term && idx > 0 && !scene_change_detected) {
+    if (best_early_term && idx > 0 && !scene_change_detected &&
+        (!force_test_gf_zeromv || mode_checked[ZEROMV][GOLDEN_FRAME])) {
       x->skip = 1;
       break;
     }