Add speed feature to disable loop restoration search for chroma

This patch will introduce a speed feature to disable the loop
restoration search for chroma plane for all frames except boosted
frames and when screen content tool is on. This speed feature is
enabled for preset 4 and above.

                Quality drop(AWCY)
Preset        Cb       Cr     Overall    Encode time reduction
   4         0.48%    0.26%    -0.24%      2.14%
Encode time is averaged across multiple test cases

STATS_CHANGED

Change-Id: I2d2dab3a0114179f0fdd49c8d44d69a3b372e9f2
diff --git a/av1/encoder/pickrst.c b/av1/encoder/pickrst.c
index 39db3d2..1b4f26c 100644
--- a/av1/encoder/pickrst.c
+++ b/av1/encoder/pickrst.c
@@ -1413,20 +1413,22 @@
     RestorationType best_rtype = RESTORE_NONE;
 
     const int highbd = rsc.cm->seq_params.use_highbitdepth;
-    extend_frame(rsc.dgd_buffer, rsc.plane_width, rsc.plane_height,
-                 rsc.dgd_stride, RESTORATION_BORDER, RESTORATION_BORDER,
-                 highbd);
+    if (!cpi->sf.disable_loop_restoration_chroma || !plane) {
+      extend_frame(rsc.dgd_buffer, rsc.plane_width, rsc.plane_height,
+                   rsc.dgd_stride, RESTORATION_BORDER, RESTORATION_BORDER,
+                   highbd);
 
-    for (RestorationType r = 0; r < num_rtypes; ++r) {
-      if ((force_restore_type != RESTORE_TYPES) && (r != RESTORE_NONE) &&
-          (r != force_restore_type))
-        continue;
+      for (RestorationType r = 0; r < num_rtypes; ++r) {
+        if ((force_restore_type != RESTORE_TYPES) && (r != RESTORE_NONE) &&
+            (r != force_restore_type))
+          continue;
 
-      double cost = search_rest_type(&rsc, r);
+        double cost = search_rest_type(&rsc, r);
 
-      if (r == 0 || cost < best_cost) {
-        best_cost = cost;
-        best_rtype = r;
+        if (r == 0 || cost < best_cost) {
+          best_cost = cost;
+          best_rtype = r;
+        }
       }
     }
 
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index cad140c..21e299b 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -344,6 +344,8 @@
     sf->tx_type_search.fast_intra_tx_type_search = 1;
     sf->use_square_partition_only_threshold =
         boosted ? BLOCK_128X128 : BLOCK_4X4;
+    sf->disable_loop_restoration_chroma =
+        (boosted || cm->allow_screen_content_tools) ? 0 : 1;
     sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED;
     sf->adaptive_pred_interp_filter = 0;
     sf->adaptive_mode_search = 1;
@@ -708,6 +710,7 @@
   sf->use_accurate_subpel_search = USE_8_TAPS;
   sf->disable_wedge_search_edge_thresh = 0;
   sf->disable_wedge_search_var_thresh = 0;
+  sf->disable_loop_restoration_chroma = 0;
   sf->fast_wedge_sign_estimate = 0;
   sf->prune_wedge_pred_diff_based = 0;
   sf->drop_ref = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index d324763..dc1984f 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -662,6 +662,9 @@
   // Enable/disable interintra wedge search.
   int disable_wedge_interintra_search;
 
+  // Disable loop restoration for Chroma plane
+  int disable_loop_restoration_chroma;
+
   // Flag used to control the extent of coeff R-D optimization
   int perform_coeff_opt;