mirror of https://git.ffmpeg.org/ffmpeg.git
DNxHD: frame multithreading
Signed-off-by: Javier Cabezas <jcabgz@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1ce8377c78
commit
1406d9ddc6
|
@ -30,6 +30,7 @@
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "dnxhddata.h"
|
#include "dnxhddata.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
|
#include "thread.h"
|
||||||
|
|
||||||
typedef struct DNXHDContext {
|
typedef struct DNXHDContext {
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
|
@ -365,6 +366,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||||
DNXHDContext *ctx = avctx->priv_data;
|
DNXHDContext *ctx = avctx->priv_data;
|
||||||
AVFrame *picture = data;
|
AVFrame *picture = data;
|
||||||
int first_field = 1;
|
int first_field = 1;
|
||||||
|
int ret;
|
||||||
|
|
||||||
av_dlog(avctx, "frame size %d\n", buf_size);
|
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 (first_field) {
|
||||||
if (ctx->picture.data[0])
|
if (ctx->picture.data[0])
|
||||||
avctx->release_buffer(avctx, &ctx->picture);
|
ff_thread_release_buffer(avctx, &ctx->picture);
|
||||||
if (avctx->get_buffer(avctx, &ctx->picture) < 0) {
|
if ((ret = ff_thread_get_buffer(avctx, &ctx->picture)) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
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);
|
dnxhd_decode_macroblocks(ctx, buf + 0x280, buf_size - 0x280);
|
||||||
|
|
||||||
if (first_field && ctx->picture.interlaced_frame) {
|
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;
|
DNXHDContext *ctx = avctx->priv_data;
|
||||||
|
|
||||||
if (ctx->picture.data[0])
|
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->ac_vlc);
|
||||||
free_vlc(&ctx->dc_vlc);
|
free_vlc(&ctx->dc_vlc);
|
||||||
free_vlc(&ctx->run_vlc);
|
free_vlc(&ctx->run_vlc);
|
||||||
|
@ -426,6 +430,6 @@ AVCodec ff_dnxhd_decoder = {
|
||||||
.init = dnxhd_decode_init,
|
.init = dnxhd_decode_init,
|
||||||
.close = dnxhd_decode_close,
|
.close = dnxhd_decode_close,
|
||||||
.decode = dnxhd_decode_frame,
|
.decode = dnxhd_decode_frame,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
|
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue