aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2017-11-17 14:51:09 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-30 21:11:32 +0100
commitedd0cd21f41e6b0b8b39b5a53891d4a2c61fafff (patch)
tree9a6a6b555ed5edf843475813d2ab7f9bf968e35a /libavcodec
parent362967fec6a4c4772e56b50efba49dab06f49de6 (diff)
downloadffmpeg-edd0cd21f41e6b0b8b39b5a53891d4a2c61fafff.tar.gz
Use ff_thread_once for fixed, float table init.
These tables are static so they should only be initialized once instead of on every call to ff_mpadsp_init(). Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 5eaaffaf64d1854493f0fe9ec822eed1b3cd9fe1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegaudiodsp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodsp.c b/libavcodec/mpegaudiodsp.c
index a5d20df629..3cafca27bf 100644
--- a/libavcodec/mpegaudiodsp.c
+++ b/libavcodec/mpegaudiodsp.c
@@ -20,17 +20,21 @@
#include "config.h"
#include "libavutil/attributes.h"
+#include "libavutil/thread.h"
#include "mpegaudiodsp.h"
#include "dct.h"
#include "dct32.h"
+static AVOnce mpadsp_float_table_init = AV_ONCE_INIT;
+static AVOnce mpadsp_fixed_table_init = AV_ONCE_INIT;
+
av_cold void ff_mpadsp_init(MPADSPContext *s)
{
DCTContext dct;
ff_dct_init(&dct, 5, DCT_II);
- ff_init_mpadsp_tabs_float();
- ff_init_mpadsp_tabs_fixed();
+ ff_thread_once(&mpadsp_float_table_init, &ff_init_mpadsp_tabs_float);
+ ff_thread_once(&mpadsp_fixed_table_init, &ff_init_mpadsp_tabs_fixed);
s->apply_window_float = ff_mpadsp_apply_window_float;
s->apply_window_fixed = ff_mpadsp_apply_window_fixed;