#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)
{
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.
}
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;
#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);
- }
-
- 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;
-}
+ yuvconfig2image(&ctx->img, &sd, ctx->user_priv);
-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;
}
}
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);