[FFmpeg-cvslog] avcodec/dvenc: Make encoder init-threadsafe
Andreas Rheinhardt
git at videolan.org
Thu May 6 07:16:29 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Dec 30 19:05:46 2020 +0100| [e10d75610c62fcc42ad8931a09abc73ee82caf82] | committer: Andreas Rheinhardt
avcodec/dvenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e10d75610c62fcc42ad8931a09abc73ee82caf82
---
libavcodec/dvenc.c | 11 +++++++++--
1 file 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,
};
More information about the ffmpeg-cvslog
mailing list