diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-16 22:00:34 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-24 11:35:03 +0100 |
commit | b1af617f519cf7bbae1379473c76cff2b0e55659 (patch) | |
tree | a4f2257361566c548e8c784e5e5aa29e5d61fc75 /libavcodec | |
parent | 802baf212d2ab1b9844696589fc6c18ba748194c (diff) | |
download | ffmpeg-b1af617f519cf7bbae1379473c76cff2b0e55659.tar.gz |
avcodec/intrax8: Make ff_intrax8_common_init() thread-safe
In particular, don't reinitialize VLCs every time an IntraX8Context is
initialized.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/intrax8.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index 390c10272e..b85653881d 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -22,6 +22,7 @@ */ #include "libavutil/avassert.h" +#include "libavutil/thread.h" #include "avcodec.h" #include "get_bits.h" #include "idctdsp.h" @@ -725,6 +726,8 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx, int block_last_index[12], int mb_width, int mb_height) { + static AVOnce init_static_once = AV_ONCE_INIT; + w->avctx = avctx; w->idsp = *idsp; w->mb_width = mb_width; @@ -752,7 +755,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx, ff_intrax8dsp_init(&w->dsp); ff_blockdsp_init(&w->bdsp, avctx); - x8_vlc_init(); + ff_thread_once(&init_static_once, x8_vlc_init); return 0; } |