Disable Loop restoration for multi-thread case

In speeds 5 and 6, enabling of Loop restoration in multi-thread
case results in a higher encode time increase as compared to
single thread. Hence, disabling the same for multi-thread case.
Note that the output of single-thread and multi-thread will not
match after this CL for speed 5 and 6.

STATS_CHANGED for speed 5, 6 with multi-threading enabled

Change-Id: I13485b3d48eb6580f8818329496c8cb3613da950
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 9bef51c..1da70bb 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -2303,6 +2303,21 @@
     sf->winner_mode_sf.tx_size_search_level = 3;
   }
 
+  if (cpi->mt_info.num_workers > 1) {
+    // Loop restoration stage is conditionally disabled for speed 5, 6 when
+    // num_workers > 1. Since av1_pick_filter_restoration() is not
+    // multi-threaded, enabling the Loop restoration stage will cause an
+    // increase in encode time (3% to 7% increase depends on frame
+    // resolution).
+    // TODO(any): Implement multi-threading of av1_pick_filter_restoration()
+    // and enable Wiener filter for speed 5, 6 similar to single thread
+    // encoding path.
+    if (speed >= 5) {
+      sf->lpf_sf.disable_sgr_filter = true;
+      sf->lpf_sf.disable_wiener_filter = true;
+    }
+  }
+
   if (!cpi->ppi->seq_params_locked) {
     cpi->common.seq_params->order_hint_info.enable_dist_wtd_comp &=
         (sf->inter_sf.use_dist_wtd_comp_flag != DIST_WTD_COMP_DISABLED);
diff --git a/test/ethread_test.cc b/test/ethread_test.cc
index 8e1d750..3351b01 100644
--- a/test/ethread_test.cc
+++ b/test/ethread_test.cc
@@ -261,6 +261,17 @@
         encoder->Control(AOME_SET_ARNR_STRENGTH, 5);
         encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 0);
         encoder->Control(AV1E_SET_MAX_GF_INTERVAL, 4);
+        // In row_mt_=0 case, the output of single thread (1 thread) will be
+        // compared with multi thread (4 thread) output (as per line no:340).
+        // Currently, Loop restoration stage is conditionally disabled for speed
+        // 5, 6 when num_workers > 1. Due to this, the match between single
+        // thread and multi thread output can not be achieved. Hence, testing
+        // this case alone with LR disabled.
+        // TODO(any): Remove the constarin on this test case once Loop
+        // restoration state is same in both single and multi thread path.
+        if (set_cpu_used_ >= 5 && row_mt_ == 0)
+          encoder->Control(AV1E_SET_ENABLE_RESTORATION, 0);
+
       } else if (encoding_mode_ == ::libaom_test::kRealTime) {
         encoder->Control(AOME_SET_ENABLEAUTOALTREF, 0);
         encoder->Control(AV1E_SET_AQ_MODE, 3);