rtc: Remove num_col/row_blscroll_last_tl0

These parameters are causing the tsan race condition
in the issue below.

Removing them for now. This may cause some slowdown in
some cases of webrtc usage, so we may add them back in
later.

Add screen 2TL test with 4 threads to catch the
issue below.

Bug: b:394563983
Change-Id: I9d1abc58ecc57921ddbbd79fb1da1dc114f974ac
(cherry picked from commit 2454213a72f194522c98610ef17057c226ffe391)
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 5f3b206..ae92471 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -3822,10 +3822,6 @@
     resize_reset_rc(cpi, resize_pending_params->width,
                     resize_pending_params->height, cm->width, cm->height);
   }
-  if (svc->temporal_layer_id == 0) {
-    rc->num_col_blscroll_last_tl0 = 0;
-    rc->num_row_blscroll_last_tl0 = 0;
-  }
   // Set the GF interval and update flag.
   if (!rc->rtc_external_ratectrl)
     set_gf_interval_update_onepass_rt(cpi, *frame_type);
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index 88c048f..0e7ede9 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -200,8 +200,6 @@
   int last_target_size_keyframe;
   int frames_since_scene_change;
   int perc_spatial_flat_blocks;
-  int num_col_blscroll_last_tl0;
-  int num_row_blscroll_last_tl0;
 
   int avg_frame_bandwidth;  // Average frame size target for clip
   int min_frame_bandwidth;  // Minimum allocation used for any frame
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index 37b295d..8876fd6 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -1332,10 +1332,8 @@
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *mi = xd->mi[0];
   const int is_screen = cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN;
-  const int increase_col_sw = source_sad_nonrd > kMedSad &&
-                              !cpi->rc.high_motion_content_screen_rtc &&
-                              (cpi->svc.temporal_layer_id == 0 ||
-                               cpi->rc.num_col_blscroll_last_tl0 > 2);
+  const int increase_col_sw =
+      source_sad_nonrd > kMedSad && !cpi->rc.high_motion_content_screen_rtc;
   int me_search_size_col = is_screen
                                ? increase_col_sw ? 512 : 96
                                : block_size_wide[cm->seq_params->sb_size] >> 1;
@@ -1357,12 +1355,6 @@
     if (*y_sad < (y_sad_zero >> 1) && *y_sad < thresh_sad) {
       x->sb_me_partition = 1;
       x->sb_me_mv.as_int = mi->mv[0].as_int;
-      if (cpi->svc.temporal_layer_id == 0) {
-        if (abs(mi->mv[0].as_mv.col) > 16 && abs(mi->mv[0].as_mv.row) == 0)
-          cpi->rc.num_col_blscroll_last_tl0++;
-        else if (abs(mi->mv[0].as_mv.row) > 16 && abs(mi->mv[0].as_mv.col) == 0)
-          cpi->rc.num_row_blscroll_last_tl0++;
-      }
     } else {
       x->sb_me_partition = 0;
       // Fall back to using zero motion.
diff --git a/test/svc_datarate_test.cc b/test/svc_datarate_test.cc
index 28e235e..35ccd6f 100644
--- a/test/svc_datarate_test.cc
+++ b/test/svc_datarate_test.cc
@@ -1111,6 +1111,43 @@
 #endif
   }
 
+  virtual void
+  BasicRateTargetingSVC2TL1SLScreenDropFrame1920x10804ThreadTest() {
+    cfg_.rc_buf_initial_sz = 50;
+    cfg_.rc_buf_optimal_sz = 50;
+    cfg_.rc_buf_sz = 100;
+    cfg_.rc_dropframe_thresh = 30;
+    cfg_.rc_min_quantizer = 0;
+    cfg_.rc_max_quantizer = 52;
+    cfg_.rc_end_usage = AOM_CBR;
+    cfg_.g_lag_in_frames = 0;
+    cfg_.g_error_resilient = 0;
+    cfg_.g_threads = 4;
+
+    ::libaom_test::Y4mVideoSource video("screendata.1920_1080.y4m", 0, 60);
+
+    const int bitrate_array[2] = { 60, 100 };
+    cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
+    ResetModel();
+    tile_columns_ = 1;
+    tile_rows_ = 1;
+    screen_mode_ = 1;
+    number_temporal_layers_ = 2;
+    number_spatial_layers_ = 1;
+    target_layer_bitrate_[0] = 60 * cfg_.rc_target_bitrate / 100;
+    target_layer_bitrate_[1] = cfg_.rc_target_bitrate;
+    ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+#if CONFIG_AV1_DECODER
+    // Top temporal layers are non_reference, so exclude them from
+    // mismatch count, since loopfilter/cdef is not applied for these on
+    // encoder side, but is always applied on decoder.
+    // This means 150 = #frames(300) - #TL2_frames(150).
+    // We use LE for screen since loopfilter level can become very small
+    // or zero and then the frame is not a mismatch.
+    EXPECT_LE(GetMismatchFrames(), 150u);
+#endif
+  }
+
   virtual void BasicRateTargetingSVC1TL3SLScreenTest() {
     cfg_.rc_buf_initial_sz = 500;
     cfg_.rc_buf_optimal_sz = 500;
@@ -2692,6 +2729,15 @@
   BasicRateTargetingSVC2TL1SLScreenDropFrame1920x1080Test();
 }
 
+// Check basic rate targeting for CBR, for 2 temporal layers, 1 spatial
+// for screen mode, with frame dropper on at low bitrates. Use small
+// values of rc_buf_initial/optimal/sz to trigger postencode frame drop.
+// Use 1920x1080 clip. This tests runs with 4 threads.
+TEST_P(DatarateTestSVC,
+       BasicRateTargetingSVC2TL1SLScreenDropFrame1920x10804Thread) {
+  BasicRateTargetingSVC2TL1SLScreenDropFrame1920x10804ThreadTest();
+}
+
 // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal
 // for screen mode.
 TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLScreen) {