shithub: libvpx

Download patch

ref: 85640f1c9dd56378e9f86d85843732387731e69e
parent: 3286abd82e1eaf8433522dc63fbd5c430931be38
author: James Zern <jzern@google.com>
date: Wed Aug 21 13:43:44 EDT 2013

vp9: remove unnecessary wait w/threaded loopfilter

the final macroblock rows are scheduled in the main thread. prior to
this change one additional macroblock row would be scheduled in the
worker forcing the main thread to wait before finishing.

Change-Id: I05f3168e5c629b898fcebb0d77eb6d6a90d6105e

--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -586,6 +586,7 @@
       lf_data->frame_buffer = fb;
       lf_data->cm = pc;
       lf_data->xd = pbi->mb;
+      lf_data->stop = 0;
       lf_data->y_only = 0;
     }
     vp9_loop_filter_frame_init(pc, pc->lf.filter_level);
@@ -609,6 +610,9 @@
       if (num_threads > 1) {
         LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
 
+        // decoding has completed: finish up the loop filter in this thread.
+        if (mi_row + MI_BLOCK_SIZE >= pc->cur_tile_mi_row_end) continue;
+
         vp9_worker_sync(&pbi->lf_worker);
         lf_data->start = lf_start;
         lf_data->stop = mi_row;
@@ -621,13 +625,17 @@
   }
 
   if (pbi->do_loopfilter_inline) {
+    int lf_start;
     if (num_threads > 1) {
-      // TODO(jzern): since the loop filter is delayed one mb row, this will be
-      // forced to wait for the last row scheduled in the for loop.
+      LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
+
       vp9_worker_sync(&pbi->lf_worker);
+      lf_start = lf_data->stop;
+    } else {
+      lf_start = mi_row - MI_BLOCK_SIZE;
     }
     vp9_loop_filter_rows(fb, pc, &pbi->mb,
-                         mi_row - MI_BLOCK_SIZE, pc->mi_rows, 0);
+                         lf_start, pc->mi_rows, 0);
   }
 }