Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-10 06:32:17 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-27 01:40:18 +0300
commitd99707b42a55b2fcfc17b8c9bf3f38c1879dbaa7 (patch)
treeeadd12b2001dee25c4accb123d7b881173306645 /libavcodec/mpeg4videodec.c
parentfea1f42e5f82db01ef3eec6ee8b0862944a5e319 (diff)
avcodec/mpeg4video: Make initializing RLTable thread-safe
Up until now the RLTable ff_mpeg4_rl_intra was initialized by both mpeg4 decoder and encoder (except the VLCs that are only used by the decoder). This is an obstacle to making these codecs init-threadsafe, so move initializing this to a single function that is guarded by a dedicated AVOnce. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r--libavcodec/mpeg4videodec.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index de66fe8b83..fc76485dbe 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3378,9 +3378,11 @@ av_cold void ff_mpeg4videodec_static_init(void) {
static int done = 0;
if (!done) {
- ff_rl_init(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
- ff_rl_init(&ff_rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]);
- ff_rl_init(&ff_rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]);
+ static uint8_t mpeg4_rvlc_rl_tables[2][2][2 * MAX_RUN + MAX_LEVEL + 3];
+
+ ff_mpeg4_init_rl_intra();
+ ff_rl_init(&ff_rvlc_rl_inter, mpeg4_rvlc_rl_tables[0]);
+ ff_rl_init(&ff_rvlc_rl_intra, mpeg4_rvlc_rl_tables[1]);
INIT_FIRST_VLC_RL(ff_mpeg4_rl_intra, 554);
INIT_VLC_RL(ff_rvlc_rl_inter, 1072);
INIT_FIRST_VLC_RL(ff_rvlc_rl_intra, 1072);