avcodec/indeo3: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
committed by
Andreas Rheinhardt
parent
8b8358f580
commit
8d87e1ef6c
+4
-2
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "libavutil/imgutils.h"
|
#include "libavutil/imgutils.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
|
#include "libavutil/thread.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "copy_block.h"
|
#include "copy_block.h"
|
||||||
#include "bytestream.h"
|
#include "bytestream.h"
|
||||||
@@ -1049,12 +1050,13 @@ static void output_plane(const Plane *plane, int buf_sel, uint8_t *dst,
|
|||||||
|
|
||||||
static av_cold int decode_init(AVCodecContext *avctx)
|
static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
|
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||||
Indeo3DecodeContext *ctx = avctx->priv_data;
|
Indeo3DecodeContext *ctx = avctx->priv_data;
|
||||||
|
|
||||||
ctx->avctx = avctx;
|
ctx->avctx = avctx;
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV410P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV410P;
|
||||||
|
|
||||||
build_requant_tab();
|
ff_thread_once(&init_static_once, build_requant_tab);
|
||||||
|
|
||||||
ff_hpeldsp_init(&ctx->hdsp, avctx->flags);
|
ff_hpeldsp_init(&ctx->hdsp, avctx->flags);
|
||||||
|
|
||||||
@@ -1141,5 +1143,5 @@ const AVCodec ff_indeo3_decoder = {
|
|||||||
.close = decode_close,
|
.close = decode_close,
|
||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.capabilities = AV_CODEC_CAP_DR1,
|
.capabilities = AV_CODEC_CAP_DR1,
|
||||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user