rtc-screen: Increase scroll detection sw for 4k

For 4K screen: increase the scroll detection
search window. Allow the increase for TL0 for
temporal layers.

This reduces issues of lower quality spikes on
scrolling content webrtc 4k tests.

Bug: b:423804955

Change-Id: I0e89609db8ae31d7178a49ad1f01d7a31a9ef4b4
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 0197487..e752568 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -3336,8 +3336,13 @@
       // to determine if motion is scroll. Only test 3 points (pts) for now.
       // TODO(marpan): Only allow for 8 bit-depth for now.
       if (cm->seq_params->bit_depth == 8) {
-        const int sw_row = (cpi->rc.frame_source_sad > 20000) ? 512 : 192;
-        const int sw_col = (cpi->rc.frame_source_sad > 20000) ? 512 : 160;
+        int sw_row = (cpi->rc.frame_source_sad > 20000) ? 512 : 192;
+        int sw_col = (cpi->rc.frame_source_sad > 20000) ? 512 : 160;
+        if (cm->width * cm->height >= 3840 * 2160 &&
+            cpi->svc.number_temporal_layers > 1) {
+          sw_row = sw_row << 1;
+          sw_col = sw_col << 1;
+        }
         const int num_pts =
             unscaled_src->y_width * unscaled_src->y_height >= 1920 * 1080 ? 3
                                                                           : 1;
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index 460c97d..3027726 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -1348,6 +1348,11 @@
   int me_search_size_row = is_screen
                                ? source_sad_nonrd > kMedSad ? 512 : 192
                                : block_size_high[cm->seq_params->sb_size] >> 1;
+  if (cm->width * cm->height >= 3840 * 2160 &&
+      cpi->svc.temporal_layer_id == 0 && cpi->svc.number_temporal_layers > 1) {
+    me_search_size_row = me_search_size_row << 1;
+    me_search_size_col = me_search_size_col << 1;
+  }
   unsigned int y_sad_zero;
   *y_sad = av1_int_pro_motion_estimation(
       cpi, x, cm->seq_params->sb_size, mi_row, mi_col, &kZeroMv, &y_sad_zero,