Disable extended partition based on qindex

Extended partitions are disabled for lower quantizers in speed >= 3.

           Instruction Count        BD-Rate Loss
cpu-used     Reduction        avg.psnr  ovr.psnr    ssim
   3          3.443%          0.0893%    0.0874%   0.0474%
   4          5.545%          0.1979%    0.1986%   0.1700%
   5          1.550%          0.0706%    0.0662%   0.0261%

STATS_CHANGED

Change-Id: Ia08674126f2dd372cc6995001c5ccb39a84c5661
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index eb83d7a..59cfd50 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1276,6 +1276,7 @@
 void av1_set_speed_features_qindex_dependent(AV1_COMP *cpi, int speed) {
   AV1_COMMON *const cm = &cpi->common;
   SPEED_FEATURES *const sf = &cpi->sf;
+  const int boosted = frame_is_boosted(cpi);
   const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720;
   if (is_720p_or_larger && cpi->oxcf.mode == GOOD && speed == 0) {
     if (cm->quant_params.base_qindex <= 80) {
@@ -1290,4 +1291,22 @@
       sf->tx_sf.intra_tx_size_search_init_depth_rect = 1;
     }
   }
+
+  if (cpi->oxcf.mode == GOOD && speed >= 3) {
+    // Disable extended partitions for lower quantizers
+    if (cm->quant_params.base_qindex <= 100 &&
+        !cm->features.allow_screen_content_tools && !boosted) {
+      sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128;
+    }
+  }
+
+  if (cpi->oxcf.mode == GOOD && speed >= 4) {
+    // Disable extended partitions for lower quantizers
+    const int qindex_thresh = boosted ? 80 : 120;
+    if (cm->quant_params.base_qindex <= qindex_thresh &&
+        !cm->features.allow_screen_content_tools &&
+        !frame_is_intra_only(&cpi->common)) {
+      sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128;
+    }
+  }
 }