Aggressively skip txfm search based on skip rd for speed 5 and 6

          Instruction Count          BD-Rate Loss(%)
cpu-used    Reduction(%)   	avg.psnr  ovr.psnr  ssim
   5          4.408		0.2644    0.2633    0.2157
   6          3.356		0.2744    0.2759    0.2292

STATS_CHANGED

Change-Id: I53ca8b4b8d98e414688ecf88c44c4100e7fc02b4
diff --git a/av1/encoder/rdopt_utils.h b/av1/encoder/rdopt_utils.h
index be08190..37fbb5b 100644
--- a/av1/encoder/rdopt_utils.h
+++ b/av1/encoder/rdopt_utils.h
@@ -334,15 +334,17 @@
   // Derive aggressiveness factor for gating the transform search
   // Lower value indicates more aggressiveness. Be more conservative (high
   // value) for (i) low quantizers (ii) regions where prediction is poor
-  const int scale[5] = { INT_MAX, 4, 3, 3, 2 };
+  const int scale[6] = { INT_MAX, 4, 3, 3, 2, 2 };
   const int qslope = 2 * (!is_luma_only);
   int aggr_factor = 1;
-  if (!is_luma_only) {
+  const int pred_qindex_thresh = (level >= 5) ? 100 : 0;
+  if (!is_luma_only && level <= 4) {
     aggr_factor = AOMMAX(
         1, ((MAXQ - x->qindex) * qslope + QINDEX_RANGE / 2) >> QINDEX_BITS);
   }
-  if (best_skip_rd >
-      (x->source_variance << (num_pels_log2_lookup[bsize] + RDDIV_BITS)))
+  if ((best_skip_rd >
+       (x->source_variance << (num_pels_log2_lookup[bsize] + RDDIV_BITS))) &&
+      (x->qindex >= pred_qindex_thresh))
     aggr_factor *= scale[level];
   // For level setting 1, be more conservative for luma only case even when
   // prediction is good
@@ -353,7 +355,7 @@
   // since best_skip_rd is computed after and skip_rd is computed (with 8-bit
   // prediction signals blended for WEDGE/DIFFWTD rather than 16-bit) before
   // interpolation filter search
-  const int luma_mul[5] = { INT_MAX, 32, 29, 20, 17 };
+  const int luma_mul[6] = { INT_MAX, 32, 29, 20, 17, 17 };
   int mul_factor = is_luma_only ? luma_mul[level] : 16;
   int64_t rd_thresh =
       (best_skip_rd == INT64_MAX)
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 8340bf3..33b898b 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -608,6 +608,7 @@
 
     sf->inter_sf.disable_interinter_wedge = 1;
     sf->inter_sf.prune_inter_modes_if_skippable = 1;
+    sf->inter_sf.txfm_rd_gate_level = boosted ? 0 : 5;
 
     // TODO(any): Extend multi-winner mode processing support for inter frames
     sf->winner_mode_sf.multi_winner_mode_type =