shithub: libvpx

Download patch

ref: 855a71dfda9fb2620ae5567a5bb0897aa4fc0d47
parent: a7b84619926c51a7bb3a8fd77f7fe98f85be50e4
author: Marco Paniconi <marpan@google.com>
date: Fri Mar 8 16:00:48 EST 2019

vp9-screen: Rework the mode skip logic for screen

Don't force skip of zero-golden reference when
zero_temp_sad_source = 0, as it be may the
inter-layer reference. And remove the flatness conditon
when superblock is static.

Change-Id: I6b4b6eac0f6a2abc862c23d0e5467c7cf61995ef

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -2029,16 +2029,24 @@
 
     if (!(cpi->ref_frame_flags & flag_list[ref_frame])) continue;
 
-    // For screen content on flat blocks: skip non-zero motion check for
-    // stationary blocks, only skip zero motion check for non-stationary blocks.
-    if (cpi->oxcf.content == VP9E_CONTENT_SCREEN &&
-        sf->short_circuit_flat_blocks && x->source_variance == 0 &&
-        cpi->compute_source_sad_onepass && cpi->sf.use_source_sad &&
-        ((frame_mv[this_mode][ref_frame].as_int != 0 &&
-          x->zero_temp_sad_source) ||
-         (frame_mv[this_mode][ref_frame].as_int == 0 &&
-          !x->zero_temp_sad_source))) {
-      continue;
+    // For screen content. If zero_temp_sad source is computed: skip
+    // non-zero motion check for stationary blocks. If the superblock is
+    // non-stationary then for flat blocks skip the zero last check (keep golden
+    // as it may be inter-layer reference). Otherwise (if zero_temp_sad_source
+    // is not computed) skip non-zero motion check for flat blocks.
+    // TODO(marpan): Compute zero_temp_sad_source per coding block.
+    if (cpi->oxcf.content == VP9E_CONTENT_SCREEN) {
+      if (cpi->compute_source_sad_onepass && cpi->sf.use_source_sad) {
+        if ((frame_mv[this_mode][ref_frame].as_int != 0 &&
+             x->zero_temp_sad_source) ||
+            (frame_mv[this_mode][ref_frame].as_int == 0 &&
+             x->source_variance == 0 && ref_frame == LAST_FRAME &&
+             !x->zero_temp_sad_source))
+          continue;
+      } else if (frame_mv[this_mode][ref_frame].as_int != 0 &&
+                 x->source_variance == 0) {
+        continue;
+      }
     }
 
     if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) continue;