mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
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>
This commit is contained in:
parent
d073be2291
commit
5eaaffaf64
@ -20,17 +20,21 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
|
#include "libavutil/thread.h"
|
||||||
#include "mpegaudiodsp.h"
|
#include "mpegaudiodsp.h"
|
||||||
#include "dct.h"
|
#include "dct.h"
|
||||||
#include "dct32.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)
|
av_cold void ff_mpadsp_init(MPADSPContext *s)
|
||||||
{
|
{
|
||||||
DCTContext dct;
|
DCTContext dct;
|
||||||
|
|
||||||
ff_dct_init(&dct, 5, DCT_II);
|
ff_dct_init(&dct, 5, DCT_II);
|
||||||
ff_init_mpadsp_tabs_float();
|
ff_thread_once(&mpadsp_float_table_init, &ff_init_mpadsp_tabs_float);
|
||||||
ff_init_mpadsp_tabs_fixed();
|
ff_thread_once(&mpadsp_fixed_table_init, &ff_init_mpadsp_tabs_fixed);
|
||||||
|
|
||||||
s->apply_window_float = ff_mpadsp_apply_window_float;
|
s->apply_window_float = ff_mpadsp_apply_window_float;
|
||||||
s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
|
s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
|
||||||
|
Loading…
Reference in New Issue
Block a user