mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-03 05:10:03 +02:00
aacdec: duplicate table initialization
Preparation to move all table init and support windowing functions.
This commit is contained in:
parent
e9fc7661da
commit
a309aa4127
@ -120,6 +120,8 @@ av_cold int ff_aac_decode_init_common(AVCodecContext *avctx)
|
||||
|
||||
ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp;
|
||||
|
||||
ac->dsp.init_tables();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -311,6 +311,8 @@ static void AAC_RENAME(update_ltp)(AACDecContext *ac, SingleChannelElement *sce)
|
||||
}
|
||||
|
||||
const AACDecDSP AAC_RENAME(aac_dsp) = {
|
||||
.init_tables = &AAC_RENAME(init_tables),
|
||||
|
||||
.dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
|
||||
.apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
|
||||
.apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo),
|
||||
|
@ -31,12 +31,34 @@
|
||||
|
||||
#define USE_FIXED 1
|
||||
|
||||
#include "libavutil/thread.h"
|
||||
|
||||
#include "libavcodec/aac_defines.h"
|
||||
|
||||
#include "libavcodec/aactab.h"
|
||||
#include "libavcodec/sinewin_fixed_tablegen.h"
|
||||
#include "libavcodec/kbdwin.h"
|
||||
|
||||
DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_long_1024))[1024];
|
||||
DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_short_128))[128];
|
||||
DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024];
|
||||
DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128];
|
||||
DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_long_960))[960];
|
||||
DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_short_120))[120];
|
||||
|
||||
static void init_tables_fixed_fn(void)
|
||||
{
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
|
||||
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
|
||||
|
||||
init_sine_windows_fixed();
|
||||
}
|
||||
|
||||
static void init_tables_fixed(void)
|
||||
{
|
||||
static AVOnce init_fixed_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_fixed_once, init_tables_fixed_fn);
|
||||
}
|
||||
|
||||
#include "aacdec_dsp_template.c"
|
||||
|
@ -31,9 +31,36 @@
|
||||
|
||||
#define USE_FIXED 0
|
||||
|
||||
#include "libavutil/thread.h"
|
||||
|
||||
#include "libavcodec/aac_defines.h"
|
||||
|
||||
#include "libavcodec/aactab.h"
|
||||
#include "libavcodec/sinewin.h"
|
||||
#include "libavcodec/kbdwin.h"
|
||||
|
||||
DECLARE_ALIGNED(32, static float, sine_120)[120];
|
||||
DECLARE_ALIGNED(32, static float, sine_960)[960];
|
||||
DECLARE_ALIGNED(32, static float, aac_kbd_long_960)[960];
|
||||
DECLARE_ALIGNED(32, static float, aac_kbd_short_120)[120];
|
||||
|
||||
static void init_tables_float_fn(void)
|
||||
{
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
|
||||
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
|
||||
|
||||
AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960);
|
||||
AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120);
|
||||
AAC_RENAME(ff_init_ff_sine_windows)(9);
|
||||
}
|
||||
|
||||
static void init_tables(void)
|
||||
{
|
||||
static AVOnce init_float_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_float_once, init_tables_float_fn);
|
||||
}
|
||||
|
||||
#include "aacdec_dsp_template.c"
|
||||
|
@ -204,6 +204,8 @@ typedef struct DynamicRangeControl {
|
||||
* DSP-specific primitives
|
||||
*/
|
||||
typedef struct AACDecDSP {
|
||||
void (*init_tables)(void);
|
||||
|
||||
void (*dequant_scalefactors)(SingleChannelElement *sce);
|
||||
|
||||
void (*apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe);
|
||||
|
Loading…
Reference in New Issue
Block a user