diff options
author | Javier Cabezas <jcabgz@gmail.com> | 2012-01-19 05:06:29 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-19 20:12:43 +0400 |
commit | 1406d9ddc62ddb941c71395ae55858e5a33a8012 (patch) | |
tree | adf45a17ac70785b3b9934943605f3b1de823ce2 /libavcodec/dnxhddec.c | |
parent | 1ce8377c78bed79f14be0ec7af4a07e903e7378d (diff) |
DNxHD: frame multithreading
Signed-off-by: Javier Cabezas <jcabgz@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dnxhddec.c')
-rw-r--r-- | libavcodec/dnxhddec.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 2548614e90..0f1ce9e2f1 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -30,6 +30,7 @@ #include "get_bits.h" #include "dnxhddata.h" #include "dsputil.h" +#include "thread.h" typedef struct DNXHDContext { AVCodecContext *avctx; @@ -365,6 +366,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, DNXHDContext *ctx = avctx->priv_data; AVFrame *picture = data; int first_field = 1; + int ret; av_dlog(avctx, "frame size %d\n", buf_size); @@ -385,13 +387,15 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, if (first_field) { if (ctx->picture.data[0]) - avctx->release_buffer(avctx, &ctx->picture); - if (avctx->get_buffer(avctx, &ctx->picture) < 0) { + ff_thread_release_buffer(avctx, &ctx->picture); + if ((ret = ff_thread_get_buffer(avctx, &ctx->picture)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; + return ret; } } + ff_thread_finish_setup(avctx); + dnxhd_decode_macroblocks(ctx, buf + 0x280, buf_size - 0x280); if (first_field && ctx->picture.interlaced_frame) { @@ -411,7 +415,7 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx) DNXHDContext *ctx = avctx->priv_data; if (ctx->picture.data[0]) - avctx->release_buffer(avctx, &ctx->picture); + ff_thread_release_buffer(avctx, &ctx->picture); free_vlc(&ctx->ac_vlc); free_vlc(&ctx->dc_vlc); free_vlc(&ctx->run_vlc); @@ -426,6 +430,6 @@ AVCodec ff_dnxhd_decoder = { .init = dnxhd_decode_init, .close = dnxhd_decode_close, .decode = dnxhd_decode_frame, - .capabilities = CODEC_CAP_DR1, + .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), }; |