Skip intra if best inter is txfm skip and non-newmv

In speed 3 and above, intra mode search is skipped if the best inter
mode is both non-newmv and transform skip.

          Instruction Count       BD-Rate Loss(%)
cpu-used    Reduction(%)     avg.psnr  ovr.psnr   ssim
   3          1.421           0.0136    0.0141   0.0060

STATS_CHANGED

Change-Id: If045222ee79222b2590ef4c7d78f2be408b7b3bf
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index e00078a..0c070ec 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5236,7 +5236,13 @@
     InterModeSearchState *search_state, int64_t inter_cost, int64_t intra_cost,
     int skip_intra_in_interframe) {
   MACROBLOCKD *const xd = &x->e_mbd;
-  if (inter_cost >= 0 && intra_cost >= 0) {
+  const int qindex_thresh[2] = { 200, MAXQ };
+  const int ind = (skip_intra_in_interframe >= 3) ? 1 : 0;
+  if ((skip_intra_in_interframe >= 2) && search_state->best_mbmode.skip_txfm &&
+      !have_newmv_in_inter_mode(search_state->best_mbmode.mode) &&
+      (x->qindex <= qindex_thresh[ind])) {
+    search_state->intra_search_state.skip_intra_modes = 1;
+  } else if (inter_cost >= 0 && intra_cost >= 0) {
     aom_clear_system_state();
     const NN_CONFIG *nn_config = (AOMMIN(cm->width, cm->height) <= 480)
                                      ? &av1_intrap_nn_config
@@ -5259,12 +5265,12 @@
     // For two parameters, the max prob returned from av1_nn_softmax equals
     // 1.0 / (1.0 + e^(-|diff_score|)). Here use scores directly to avoid the
     // calling of av1_nn_softmax.
-    const float thresh[2] = { 1.4f, 1.4f };
+    const float thresh[4] = { 1.4f, 1.4f, 1.4f, 1.4f };
     if (scores[1] > scores[0] + thresh[skip_intra_in_interframe - 1]) {
       search_state->intra_search_state.skip_intra_modes = 1;
     }
   } else if ((search_state->best_mbmode.skip_txfm) &&
-             (skip_intra_in_interframe >= 2)) {
+             (skip_intra_in_interframe >= 4)) {
     search_state->intra_search_state.skip_intra_modes = 1;
   }
 }
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index c2c740a..630f29e 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -533,6 +533,7 @@
   const int is_1080p_or_larger = AOMMIN(cm->width, cm->height) >= 1080;
   const int is_4k_or_larger = AOMMIN(cm->width, cm->height) >= 2160;
   const bool use_hbd = cpi->oxcf.use_highbitdepth;
+  const int boosted = frame_is_boosted(cpi);
 
   if (is_480p_or_larger) {
     sf->part_sf.use_square_partition_only_threshold = BLOCK_128X128;
@@ -651,6 +652,11 @@
     if (use_hbd) sf->tx_sf.prune_tx_size_level = 3;
 
     if (is_480p_or_larger) sf->intra_sf.top_intra_model_count_allowed = 2;
+    if (is_720p_or_larger) {
+      sf->intra_sf.skip_intra_in_interframe = boosted ? 1 : 2;
+    } else {
+      sf->intra_sf.skip_intra_in_interframe = boosted ? 1 : 3;
+    }
 
     sf->inter_sf.disable_interintra_wedge_var_thresh = UINT_MAX;
   }
@@ -675,6 +681,7 @@
       sf->hl_sf.recode_tolerance = 55;
 
     sf->intra_sf.top_intra_model_count_allowed = 2;
+    sf->intra_sf.skip_intra_in_interframe = 4;
   }
 
   if (speed >= 5) {
@@ -1005,7 +1012,7 @@
     // sf->intra_sf.intra_y_mode_mask[TX_64X64] = INTRA_DC_H_V;
     // TODO(any): Experiment with this speed feature set to 2 for higher quality
     // presets as well
-    sf->intra_sf.skip_intra_in_interframe = 2;
+    sf->intra_sf.skip_intra_in_interframe = 4;
 
     sf->mv_sf.simple_motion_subpel_force_stop = HALF_PEL;