rtc: Tuning prefer_large_partition_blocks conservatively

In this CL, we tuned the sf more conservatively for speed 7 midres.
In addition, we disabled (reverted) the sf for speed 8 rtc set due to
reported subjective tests outcome.

The results are below:

cpu  Resolution   Instr. Count           BD-Rate Drop (%)
                  Reduction(%)
				  avg. psnr  ovr. psnr   ssim
 7    rtc            0.588        -0.1987    -0.1759   -0.1568
 7    rtc_derf       2.396        -0.3227    -0.2755   -0.3246
 8    rtc           -2.410         0.3579    -0.0692    0.2848

No changes to speed 8 (rtc_derf), 9, 10.

STATS_CHANGED

Change-Id: I9f45853d23c097d2539f1e82a92174f5a4878f42
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index b43f80f..84df127 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1261,11 +1261,12 @@
     sf->rt_sf.prune_inter_modes_wrt_gf_arf_based_on_sad = 1;
     if (speed >= 6)
       sf->winner_mode_sf.prune_winner_mode_eval_level = boosted ? 0 : 2;
+    if (speed == 7) sf->rt_sf.prefer_large_partition_blocks = 2;
     if (speed >= 7) {
       sf->lpf_sf.cdef_pick_method = CDEF_PICK_FROM_Q;
       sf->rt_sf.check_only_zero_zeromv_on_large_blocks = true;
     }
-    if (speed == 8) sf->rt_sf.prefer_large_partition_blocks = 2;
+    if (speed == 8) sf->rt_sf.prefer_large_partition_blocks = 1;
     if (speed >= 8) {
       sf->rt_sf.use_nonrd_filter_search = 0;
       sf->rt_sf.tx_size_level_based_on_qstep = 1;
@@ -1298,11 +1299,11 @@
     }
     if (speed == 6) sf->part_sf.disable_8x8_part_based_on_qidx = 1;
     if (speed >= 6) sf->rt_sf.skip_newmv_mode_based_on_sse = 2;
+    if (speed == 7) sf->rt_sf.prefer_large_partition_blocks = 1;
     if (speed == 8 && !cpi->ppi->use_svc) {
       sf->rt_sf.short_circuit_low_temp_var = 0;
       sf->rt_sf.use_nonrd_altref_frame = 1;
     }
-    if (speed == 8) sf->rt_sf.prefer_large_partition_blocks = 3;
     if (speed >= 8) sf->rt_sf.tx_size_level_based_on_qstep = 2;
     if (speed >= 9) {
       sf->rt_sf.gf_length_lvl = 1;
@@ -1337,7 +1338,7 @@
     }
   } else {
     if (speed >= 6) sf->rt_sf.skip_newmv_mode_based_on_sse = 3;
-    if (speed == 8) sf->rt_sf.prefer_large_partition_blocks = 1;
+    if (speed == 7) sf->rt_sf.prefer_large_partition_blocks = 0;
     if (speed >= 9) {
       sf->rt_sf.sad_based_adp_altref_lag = 1;
       sf->rt_sf.sad_based_comp_prune = 1;
@@ -1688,7 +1689,7 @@
     sf->rt_sf.sse_early_term_inter_search = EARLY_TERM_IDX_3;
     sf->rt_sf.screen_content_cdef_filter_qindex_thresh = 20;
     sf->rt_sf.estimate_motion_for_var_based_partition = 0;
-    sf->rt_sf.prefer_large_partition_blocks = 4;
+    sf->rt_sf.prefer_large_partition_blocks = 3;
     sf->rt_sf.skip_intra_pred = 2;
     sf->rt_sf.var_part_split_threshold_shift = 9;
     for (int i = 0; i < BLOCK_SIZES; ++i)
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index c55202d..1b285fb 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1459,7 +1459,7 @@
   int check_scene_detection;
 
   // For nonrd mode: Prefer larger partition blks in variance based partitioning
-  // 0: disabled, 1-4: increasing aggressiveness
+  // 0: disabled, 1-3: increasing aggressiveness
   int prefer_large_partition_blocks;
 
   // uses results of temporal noise estimate
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index c5e2edd..f47c81d 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -429,8 +429,7 @@
 }
 
 static AOM_INLINE void tune_thresh_based_on_qindex_window(
-    int qindex, int th, int source_sad, int ag_idx, int64_t thresholds[]) {
-  const int win = 45;
+    int qindex, int th, int win, int fac, int64_t thresholds[]) {
   double weight;
 
   if (qindex < th - win)
@@ -443,7 +442,6 @@
       (int)((1 - weight) * (thresholds[1] << 1) + weight * thresholds[1]);
   thresholds[2] =
       (int)((1 - weight) * (thresholds[2] << 1) + weight * thresholds[2]);
-  const int fac = (!ag_idx && source_sad != kLowSad) ? 1 : 2;
   thresholds[3] =
       (int)((1 - weight) * (thresholds[3] << fac) + weight * thresholds[3]);
 }
@@ -569,7 +567,7 @@
     thresholds[2] = (5 * threshold_base) >> 1;
   }
   // Tune thresholds less or more aggressively to prefer larger partitions
-  if (cpi->sf.rt_sf.prefer_large_partition_blocks >= 4) {
+  if (cpi->sf.rt_sf.prefer_large_partition_blocks >= 3) {
     double weight;
     const int win = 20;
     if (current_qindex < QINDEX_LARGE_BLOCK_THR - win)
@@ -619,13 +617,13 @@
       thresholds[3] = INT32_MAX;
     }
   } else if (cpi->sf.rt_sf.prefer_large_partition_blocks >= 2) {
-    tune_thresh_based_on_qindex_window(
-        current_qindex, QINDEX_LARGE_BLOCK_THR, source_sad_nonrd,
-        cpi->sf.rt_sf.prefer_large_partition_blocks - 2, thresholds);
+    thresholds[1] <<= (source_sad_nonrd == kLowSad) ? 2 : 0;
+    thresholds[2] =
+        (source_sad_nonrd == kLowSad) ? (3 * thresholds[2]) : thresholds[2];
   } else if (cpi->sf.rt_sf.prefer_large_partition_blocks >= 1) {
-    thresholds[3] <<= 2;
-    thresholds[1] <<= (source_sad_nonrd == kLowSad) ? 1 : 0;
-    thresholds[2] <<= (source_sad_nonrd == kLowSad) ? 1 : 0;
+    const int fac = source_sad_nonrd == kLowSad ? 2 : 1;
+    tune_thresh_based_on_qindex_window(current_qindex, QINDEX_LARGE_BLOCK_THR,
+                                       45, fac, thresholds);
   }
   if (cpi->sf.part_sf.disable_8x8_part_based_on_qidx && (current_qindex < 128))
     thresholds[3] = INT64_MAX;