shithub: libvpx

Download patch

ref: 175495fe738f9bf9b83a412716fade4a2a1898e5
parent: abf1784c313e5882280b1aa3f33098f5679401af
author: Attila Nagy <attilanagy@google.com>
date: Mon Apr 23 11:20:07 EDT 2012

Optimizes precalculated decoder block ptrs&offs

The block pointers and offset do not need to be calculated for every
frame. Block internal predictors can be update once when decoder is
allocated. Destination and previous buffer offsets have to be updated
just when frame size is changing.

Change-Id: I92ca8df0e6aaac4cc35ab890751d446760bf82e2

--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -737,6 +737,8 @@
     int corrupt_tokens = 0;
     int prev_independent_partitions = pbi->independent_partitions;
 
+    int frame_size_change = 0;
+
     /* start with no corruption of current frame */
     xd->corrupted = 0;
     pc->yv12_fb[pc->new_fb_idx].corrupted = 0;
@@ -840,6 +842,7 @@
                 if (pbi->b_multithreaded_rd)
                     vp8mt_alloc_temp_buffers(pbi, pc->Width, prev_mb_rows);
 #endif
+                frame_size_change = 1;
             }
         }
     }
@@ -1103,9 +1106,17 @@
 #endif
         vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]);
 
-    vp8_setup_block_dptrs(xd);
-
-    vp8_build_block_doffsets(xd);
+    if(frame_size_change)
+    {
+#if CONFIG_MULTITHREAD
+        for (i = 0; i < pbi->allocated_decoding_thread_count; i++)
+        {
+            pbi->mb_row_di[i].mbd.dst = pc->yv12_fb[pc->new_fb_idx];
+            vp8_build_block_doffsets(&pbi->mb_row_di[i].mbd);
+        }
+#endif
+        vp8_build_block_doffsets(&pbi->mb);
+    }
 
     /* clear out the coeff buffer */
     vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -99,6 +99,8 @@
      */
     pbi->independent_partitions = 0;
 
+    vp8_setup_block_dptrs(&pbi->mb);
+
     return pbi;
 }
 
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -50,8 +50,6 @@
         mbd->pre = pc->yv12_fb[pc->lst_fb_idx];
         mbd->dst = pc->yv12_fb[pc->new_fb_idx];
 
-        vp8_setup_block_dptrs(mbd);
-        vp8_build_block_doffsets(mbd);
         mbd->segmentation_enabled    = xd->segmentation_enabled;
         mbd->mb_segement_abs_delta     = xd->mb_segement_abs_delta;
         vpx_memcpy(mbd->segment_feature_data, xd->segment_feature_data, sizeof(xd->segment_feature_data));
@@ -693,6 +691,8 @@
         for (ithread = 0; ithread < pbi->decoding_thread_count; ithread++)
         {
             sem_init(&pbi->h_event_start_decoding[ithread], 0, 0);
+
+            vp8_setup_block_dptrs(&pbi->mb_row_di[ithread].mbd);
 
             pbi->de_thread_data[ithread].ithread  = ithread;
             pbi->de_thread_data[ithread].ptr1     = (void *)pbi;
--