aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-30 19:05:46 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-05-06 06:13:54 +0200
commite10d75610c62fcc42ad8931a09abc73ee82caf82 (patch)
tree659b0ebd2c9ac4bc4c539950622d4ffa909d9d2d
parentbc5e68ea88231ec748946c22c0d1f19eed3d4125 (diff)
downloadffmpeg-e10d75610c62fcc42ad8931a09abc73ee82caf82.tar.gz
avcodec/dvenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/dvenc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 458f39b558..393c8b34e9 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -33,6 +33,7 @@
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/thread.h"
#include "avcodec.h"
#include "dv.h"
@@ -68,8 +69,6 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
return ret;
}
- dv_vlc_map_tableinit();
-
memset(&fdsp,0, sizeof(fdsp));
memset(&mecc,0, sizeof(mecc));
memset(&pdsp,0, sizeof(pdsp));
@@ -84,6 +83,13 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
s->fdct[0] = fdsp.fdct;
s->fdct[1] = fdsp.fdct248;
+#if !CONFIG_HARDCODED_TABLES
+ {
+ static AVOnce init_static_once = AV_ONCE_INIT;
+ ff_thread_once(&init_static_once, dv_vlc_map_tableinit);
+ }
+#endif
+
return ff_dvvideo_init(avctx);
}
@@ -1212,4 +1218,5 @@ const AVCodec ff_dvvideo_encoder = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
},
.priv_class = &dvvideo_encode_class,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};