shithub: libvpx

Download patch

ref: 43fc0879082e9c010c08c68c6147527f0d859bf9
parent: 8971779e60c5127d2cf0d74b0b6493a07e3e5132
author: Marco Paniconi <[email protected]>
date: Fri Mar 1 06:18:36 EST 2019

vp9-rtc: Fix for scroll motion for rtc

Increase threshold to detect frames with high
num of motion blocks, and fix conditions to detect
horiz & vert scroll and avoid split below 16x16 blocks
in variance partition.

Reduces artifacts in horizonal scroll screenshare testing.

Change-Id: Icf5b87f69971d7331c660fc2727c9246c6cbf8b5

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1424,14 +1424,16 @@
       x->sb_mvcol_part = mi->mv[0].as_mv.col;
       x->sb_mvrow_part = mi->mv[0].as_mv.row;
       if (cpi->oxcf.content == VP9E_CONTENT_SCREEN &&
-          cpi->svc.spatial_layer_id == 0 &&
+          cpi->svc.spatial_layer_id == cpi->svc.first_spatial_layer_to_encode &&
           cpi->svc.high_num_blocks_with_motion && !x->zero_temp_sad_source &&
           cm->width > 640 && cm->height > 480) {
-        // Disable split below 16x16 block size when scroll motion is detected.
+        // Disable split below 16x16 block size when scroll motion (horz or
+        // vert) is detected.
         // TODO(marpan/jianj): Improve this condition: issue is that search
         // range is hard-coded/limited in vp9_int_pro_motion_estimation() so
         // scroll motion may not be detected here.
-        if ((abs(x->sb_mvrow_part) >= 48 && abs(x->sb_mvcol_part) <= 8) ||
+        if (((abs(x->sb_mvrow_part) >= 48 && abs(x->sb_mvcol_part) <= 8) ||
+             (abs(x->sb_mvcol_part) >= 48 && abs(x->sb_mvrow_part) <= 8)) &&
             y_sad < 100000) {
           compute_minmax_variance = 0;
           thresholds[2] = INT64_MAX;
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2932,7 +2932,7 @@
         } else {
           rc->avg_source_sad[lagframe_idx] = avg_sad;
         }
-        if (num_zero_temp_sad < (num_samples >> 1))
+        if (num_zero_temp_sad < (3 * num_samples >> 2))
           rc->high_num_blocks_with_motion = 1;
       }
     }