Add a speed feature for smooth intra modes

Added a speed feature for smooth intra modes, and disabled the modes
at speed 3 for non-key frames or (cpi->rc.frames_to_key != 1). This
ensures no quality loss for all key frame encoding.

AWCY test result:
79961baser@2019-02-05T16:14:50.238Z -> 79961ps1@2019-02-05T01:26:38.036Z
  PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
0.0258 |  0.0309 | -0.0355 |  -0.0426 | -0.0429 | -0.0234 |     0.0870
Encoder time reductions at speed 3: 2% to 3.8%.

STATS_CHANGED

Change-Id: Ied9ae786f296c4ef22cb06988ebeeabeb57b8d64
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index b847038..2550d7b 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4564,7 +4564,7 @@
     int this_rate, this_rate_tokenonly, s;
     int64_t this_distortion, this_rd, this_model_rd;
     mbmi->mode = intra_rd_search_mode_order[mode_idx];
-    if (!cpi->oxcf.enable_smooth_intra &&
+    if ((!cpi->oxcf.enable_smooth_intra || cpi->sf.disable_smooth_intra) &&
         (mbmi->mode == SMOOTH_PRED || mbmi->mode == SMOOTH_H_PRED ||
          mbmi->mode == SMOOTH_V_PRED))
       continue;
@@ -8980,7 +8980,7 @@
     if (cpi->sf.reuse_inter_intra_mode == 0 ||
         best_interintra_mode == INTERINTRA_MODES) {
       for (j = 0; j < INTERINTRA_MODES; ++j) {
-        if (!cpi->oxcf.enable_smooth_intra &&
+        if ((!cpi->oxcf.enable_smooth_intra || cpi->sf.disable_smooth_intra) &&
             (INTERINTRA_MODE)j == II_SMOOTH_PRED)
           continue;
         mbmi->interintra_mode = (INTERINTRA_MODE)j;
@@ -12468,7 +12468,7 @@
     }
 
     if (ref_frame == INTRA_FRAME) {
-      if (!cpi->oxcf.enable_smooth_intra &&
+      if ((!cpi->oxcf.enable_smooth_intra || sf->disable_smooth_intra) &&
           (mbmi->mode == SMOOTH_PRED || mbmi->mode == SMOOTH_H_PRED ||
            mbmi->mode == SMOOTH_V_PRED))
         continue;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 70a4154..5fb96ab 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -335,6 +335,8 @@
     // it with cpi->sf.disable_wedge_search_var_thresh.
     sf->disable_wedge_interintra_search = 1;
     sf->perform_coeff_opt = is_boosted_arf2_bwd_type ? 2 : 3;
+    sf->disable_smooth_intra =
+        !frame_is_intra_only(&cpi->common) || (cpi->rc.frames_to_key != 1);
   }
 
   if (speed >= 4) {
@@ -783,6 +785,7 @@
   sf->prune_warp_using_wmtype = 0;
   sf->disable_wedge_interintra_search = 0;
   sf->perform_coeff_opt = 0;
+  sf->disable_smooth_intra = 0;
 
   if (oxcf->mode == GOOD)
     set_good_speed_features_framesize_independent(cpi, sf, speed);
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index f0816f8..92e25d4 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -663,6 +663,9 @@
 
   // This flag controls the use of non-RD mode decision.
   int use_nonrd_pick_mode;
+
+  // Enable/disable smooth intra modes.
+  int disable_smooth_intra;
 } SPEED_FEATURES;
 
 struct AV1_COMP;