Implement Loop restoration multi-threading

Row-based multi-threading of loop-restoration has been added.

Change-Id: I26f96ded4b7b48d5513da1725828043703cd5c00
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index de96409..0f6685c 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -4029,17 +4029,32 @@
 
       if (do_loop_restoration) {
         av1_loop_restoration_save_boundary_lines(&pbi->cur_buf->buf, cm, 1);
-        av1_loop_restoration_filter_frame((YV12_BUFFER_CONFIG *)xd->cur_buf, cm,
-                                          optimized_loop_restoration,
-                                          &pbi->lr_ctxt);
+        if (pbi->num_workers > 1) {
+          av1_loop_restoration_filter_frame_mt(
+              (YV12_BUFFER_CONFIG *)xd->cur_buf, cm, optimized_loop_restoration,
+              pbi->tile_workers, pbi->num_workers, &pbi->lr_row_sync,
+              &pbi->lr_ctxt);
+        } else {
+          av1_loop_restoration_filter_frame((YV12_BUFFER_CONFIG *)xd->cur_buf,
+                                            cm, optimized_loop_restoration,
+                                            &pbi->lr_ctxt);
+        }
       }
     } else {
       // In no cdef and no superres case. Provide an optimized version of
       // loop_restoration_filter.
-      if (do_loop_restoration)
-        av1_loop_restoration_filter_frame((YV12_BUFFER_CONFIG *)xd->cur_buf, cm,
-                                          optimized_loop_restoration,
-                                          &pbi->lr_ctxt);
+      if (do_loop_restoration) {
+        if (pbi->num_workers > 1) {
+          av1_loop_restoration_filter_frame_mt(
+              (YV12_BUFFER_CONFIG *)xd->cur_buf, cm, optimized_loop_restoration,
+              pbi->tile_workers, pbi->num_workers, &pbi->lr_row_sync,
+              &pbi->lr_ctxt);
+        } else {
+          av1_loop_restoration_filter_frame((YV12_BUFFER_CONFIG *)xd->cur_buf,
+                                            cm, optimized_loop_restoration,
+                                            &pbi->lr_ctxt);
+        }
+      }
     }
   }