From 43fc0879082e9c010c08c68c6147527f0d859bf9 Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Fri, 1 Mar 2019 11:18:36 -0800 Subject: [PATCH] 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 --- vp9/encoder/vp9_encodeframe.c | 8 +++++--- vp9/encoder/vp9_ratectrl.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 9e71e7a1b..72dbbff42 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1424,14 +1424,16 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, 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; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 9540e218b..152efa7e0 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -2932,7 +2932,7 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) { } 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; } } -- 2.40.0