shithub: libvpx

Download patch

ref: f8797a5aac8b7c50646a177d63a273355e209d59
parent: 820201caa803e78c461e05128b87f4d7b24247a7
author: James Zern <jzern@google.com>
date: Mon Oct 21 10:28:40 EDT 2013

vp9/dec: use loop filter worker for all inline cases

- uses vp9_worker_execute() in non-threaded case
+ removes hook reassignment

Change-Id: I305fd55f2be5cd92367373c929cdb9004066f90f

--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -593,14 +593,12 @@
   YV12_BUFFER_CONFIG *const fb = &cm->yv12_fb[cm->new_fb_idx];
 
   if (pbi->do_loopfilter_inline) {
-    if (num_threads > 1) {
-      LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
-      lf_data->frame_buffer = fb;
-      lf_data->cm = cm;
-      lf_data->xd = pbi->mb;
-      lf_data->stop = 0;
-      lf_data->y_only = 0;
-    }
+    LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
+    lf_data->frame_buffer = fb;
+    lf_data->cm = cm;
+    lf_data->xd = pbi->mb;
+    lf_data->stop = 0;
+    lf_data->y_only = 0;
     vp9_loop_filter_frame_init(cm, cm->lf.filter_level);
   }
 
@@ -614,39 +612,33 @@
       decode_modes_sb(pbi, tile_col, mi_row, mi_col, r, BLOCK_64X64);
 
     if (pbi->do_loopfilter_inline) {
-      // delay the loopfilter by 1 macroblock row.
       const int lf_start = mi_row - MI_BLOCK_SIZE;
+      LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
+
+      // delay the loopfilter by 1 macroblock row.
       if (lf_start < 0) continue;
 
-      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 >= cm->cur_tile_mi_row_end) continue;
 
-        // decoding has completed: finish up the loop filter in this thread.
-        if (mi_row + MI_BLOCK_SIZE >= cm->cur_tile_mi_row_end) continue;
-
-        vp9_worker_sync(&pbi->lf_worker);
-        lf_data->start = lf_start;
-        lf_data->stop = mi_row;
-        pbi->lf_worker.hook = vp9_loop_filter_worker;
+      vp9_worker_sync(&pbi->lf_worker);
+      lf_data->start = lf_start;
+      lf_data->stop = mi_row;
+      if (num_threads > 1) {
         vp9_worker_launch(&pbi->lf_worker);
       } else {
-        vp9_loop_filter_rows(fb, cm, &pbi->mb, lf_start, mi_row, 0);
+        vp9_worker_execute(&pbi->lf_worker);
       }
     }
   }
 
   if (pbi->do_loopfilter_inline) {
-    int lf_start;
-    if (num_threads > 1) {
-      LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
+    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, cm, &pbi->mb,
-                         lf_start, cm->mi_rows, 0);
+    vp9_worker_sync(&pbi->lf_worker);
+    lf_data->start = lf_data->stop;
+    lf_data->stop = cm->mi_rows;
+    vp9_worker_execute(&pbi->lf_worker);
   }
 }
 
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_onyxd_if.c
@@ -141,14 +141,13 @@
   cm->error.setjmp = 0;
   pbi->decoded_key_frame = 0;
 
-  if (pbi->oxcf.max_threads > 1) {
-    vp9_worker_init(&pbi->lf_worker);
-    pbi->lf_worker.data1 = vpx_malloc(sizeof(LFWorkerData));
-    pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
-    if (pbi->lf_worker.data1 == NULL || !vp9_worker_reset(&pbi->lf_worker)) {
-      vp9_remove_decompressor(pbi);
-      return NULL;
-    }
+  vp9_worker_init(&pbi->lf_worker);
+  pbi->lf_worker.data1 = vpx_malloc(sizeof(LFWorkerData));
+  pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
+  if (pbi->lf_worker.data1 == NULL ||
+      (pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker))) {
+    vp9_remove_decompressor(pbi);
+    return NULL;
   }
 
   return pbi;