shithub: libvpx

Download patch

ref: e278673c8eae8993eaec30d50e0dd5b25cbacd4a
parent: 154f1c22349070bba204d94100cf785f14db00da
author: Scott LaVarnway <slavarnway@google.com>
date: Wed Sep 19 08:30:44 EDT 2012

Moved vp8dx_get_raw_frame() call to vp8_get_frame()

This change is necessary for the frame-based multithreading
implementation.
Since the postproc occurs in this call, vpxdec was modified to time around
vpx_codec_get_frame()

Change-Id: I389acf78b6003cd35e41becc16c893f7d3028523

--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -70,7 +70,7 @@
 #endif
     vpx_image_t             img;
     int                     img_setup;
-    int                     img_avail;
+    void                    *user_priv;
 };
 
 static unsigned long vp8_priv_sz(const vpx_codec_dec_cfg_t *si, vpx_codec_flags_t flags)
@@ -345,8 +345,6 @@
 {
     vpx_codec_err_t res = VPX_CODEC_OK;
 
-    ctx->img_avail = 0;
-
     /* Determine the stream parameters. Note that we rely on peek_si to
      * validate that we have a buffer that does not wrap around the top
      * of the heap.
@@ -429,6 +427,27 @@
 
     if (!res && ctx->pbi)
     {
+        ctx->user_priv = user_priv;
+        if (vp8dx_receive_compressed_data(ctx->pbi, data_sz, data, deadline))
+        {
+            VP8D_COMP *pbi = (VP8D_COMP *)ctx->pbi;
+            res = update_error_state(ctx, &pbi->common.error);
+        }
+    }
+
+    return res;
+}
+
+static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t  *ctx,
+                                  vpx_codec_iter_t      *iter)
+{
+    vpx_image_t *img = NULL;
+
+    /* iter acts as a flip flop, so an image is only returned on the first
+     * call to get_frame.
+     */
+    if (!(*iter))
+    {
         YV12_BUFFER_CONFIG sd;
         int64_t time_stamp = 0, time_end_stamp = 0;
         vp8_ppflags_t flags = {0};
@@ -454,34 +473,10 @@
 #endif
         }
 
-        if (vp8dx_receive_compressed_data(ctx->pbi, data_sz, data, deadline))
+        if (0 == vp8dx_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, &flags))
         {
-            VP8D_COMP *pbi = (VP8D_COMP *)ctx->pbi;
-            res = update_error_state(ctx, &pbi->common.error);
-        }
+            yuvconfig2image(&ctx->img, &sd, ctx->user_priv);
 
-        if (!res && 0 == vp8dx_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, &flags))
-        {
-            yuvconfig2image(&ctx->img, &sd, user_priv);
-            ctx->img_avail = 1;
-        }
-    }
-
-    return res;
-}
-
-static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t  *ctx,
-                                  vpx_codec_iter_t      *iter)
-{
-    vpx_image_t *img = NULL;
-
-    if (ctx->img_avail)
-    {
-        /* iter acts as a flip flop, so an image is only returned on the first
-         * call to get_frame.
-         */
-        if (!(*iter))
-        {
             img = &ctx->img;
             *iter = img;
         }
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -1066,8 +1066,13 @@
         }
         frames_corrupted += corrupted;
 
+        vpx_usec_timer_start(&timer);
+
         if ((img = vpx_codec_get_frame(&decoder, &iter)))
             ++frame_out;
+
+        vpx_usec_timer_mark(&timer);
+        dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
 
         if (progress)
             show_progress(frame_in, frame_out, dx_time);