Commit e278673c authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

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
parent 154f1c22
...@@ -70,7 +70,7 @@ struct vpx_codec_alg_priv ...@@ -70,7 +70,7 @@ struct vpx_codec_alg_priv
#endif #endif
vpx_image_t img; vpx_image_t img;
int img_setup; 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) static unsigned long vp8_priv_sz(const vpx_codec_dec_cfg_t *si, vpx_codec_flags_t flags)
...@@ -345,8 +345,6 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx, ...@@ -345,8 +345,6 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
{ {
vpx_codec_err_t res = VPX_CODEC_OK; vpx_codec_err_t res = VPX_CODEC_OK;
ctx->img_avail = 0;
/* Determine the stream parameters. Note that we rely on peek_si to /* 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 * validate that we have a buffer that does not wrap around the top
* of the heap. * of the heap.
...@@ -428,6 +426,27 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx, ...@@ -428,6 +426,27 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
} }
if (!res && ctx->pbi) 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; YV12_BUFFER_CONFIG sd;
int64_t time_stamp = 0, time_end_stamp = 0; int64_t time_stamp = 0, time_end_stamp = 0;
...@@ -454,34 +473,10 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx, ...@@ -454,34 +473,10 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
#endif #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; yuvconfig2image(&ctx->img, &sd, ctx->user_priv);
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;
}
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; img = &ctx->img;
*iter = img; *iter = img;
} }
......
...@@ -1066,9 +1066,14 @@ int main(int argc, const char **argv_) ...@@ -1066,9 +1066,14 @@ int main(int argc, const char **argv_)
} }
frames_corrupted += corrupted; frames_corrupted += corrupted;
vpx_usec_timer_start(&timer);
if ((img = vpx_codec_get_frame(&decoder, &iter))) if ((img = vpx_codec_get_frame(&decoder, &iter)))
++frame_out; ++frame_out;
vpx_usec_timer_mark(&timer);
dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
if (progress) if (progress)
show_progress(frame_in, frame_out, dx_time); show_progress(frame_in, frame_out, dx_time);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment