Preparation to move all table init and support windowing functions.
Unified · Split
| @@ -120,6 +120,8 @@ av_cold int ff_aac_decode_init_common(AVCodecContext *avctx) · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp; |
| 122 | 122 | |
| 123 | + ac->dsp.init_tables(); | |
| 124 | + | |
| 123 | 125 | return 0; |
| 124 | 126 | } |
| 125 | 127 | |
| @@ -311,6 +311,8 @@ static void AAC_RENAME(update_ltp)(AACDecContext *ac, SingleChannelElement *sce) · 310 unmodified lines | ||
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | const AACDecDSP AAC_RENAME(aac_dsp) = { |
| 314 | + .init_tables = &AAC_RENAME(init_tables), | |
| 315 | + | |
| 314 | 316 | .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors), |
| 315 | 317 | .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo), |
| 316 | 318 | .apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo), |
| @@ -31,12 +31,34 @@ · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | #define USE_FIXED 1 |
| 33 | 33 | |
| 34 | +#include "libavutil/thread.h" | |
| 35 | + | |
| 34 | 36 | #include "libavcodec/aac_defines.h" |
| 35 | 37 | |
| 36 | 38 | #include "libavcodec/aactab.h" |
| 37 | 39 | #include "libavcodec/sinewin_fixed_tablegen.h" |
| 40 | +#include "libavcodec/kbdwin.h" | |
| 41 | + | |
| 42 | +DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024]; | |
| 43 | +DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128]; | |
| 44 | +DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_long_960))[960]; | |
| 45 | +DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(aac_kbd_short_120))[120]; | |
| 46 | + | |
| 47 | +static void init_tables_fixed_fn(void) | |
| 48 | +{ | |
| 49 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024); | |
| 50 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128); | |
| 51 | + | |
| 52 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960); | |
| 53 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120); | |
| 54 | + | |
| 55 | + init_sine_windows_fixed(); | |
| 56 | +} | |
| 38 | 57 | |
| 39 | −DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_long_1024))[1024]; | |
| 40 | −DECLARE_ALIGNED(32, extern int, AAC_RENAME2(aac_kbd_short_128))[128]; | |
| 58 | +static void init_tables_fixed(void) | |
| 59 | +{ | |
| 60 | + static AVOnce init_fixed_once = AV_ONCE_INIT; | |
| 61 | + ff_thread_once(&init_fixed_once, init_tables_fixed_fn); | |
| 62 | +} | |
| 41 | 63 | |
| 42 | 64 | #include "aacdec_dsp_template.c" |
| @@ -31,9 +31,36 @@ · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | #define USE_FIXED 0 |
| 33 | 33 | |
| 34 | +#include "libavutil/thread.h" | |
| 35 | + | |
| 34 | 36 | #include "libavcodec/aac_defines.h" |
| 35 | 37 | |
| 36 | 38 | #include "libavcodec/aactab.h" |
| 37 | 39 | #include "libavcodec/sinewin.h" |
| 40 | +#include "libavcodec/kbdwin.h" | |
| 41 | + | |
| 42 | +DECLARE_ALIGNED(32, static float, sine_120)[120]; | |
| 43 | +DECLARE_ALIGNED(32, static float, sine_960)[960]; | |
| 44 | +DECLARE_ALIGNED(32, static float, aac_kbd_long_960)[960]; | |
| 45 | +DECLARE_ALIGNED(32, static float, aac_kbd_short_120)[120]; | |
| 46 | + | |
| 47 | +static void init_tables_float_fn(void) | |
| 48 | +{ | |
| 49 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024); | |
| 50 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128); | |
| 51 | + | |
| 52 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960); | |
| 53 | + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120); | |
| 54 | + | |
| 55 | + AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960); | |
| 56 | + AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120); | |
| 57 | + AAC_RENAME(ff_init_ff_sine_windows)(9); | |
| 58 | +} | |
| 59 | + | |
| 60 | +static void init_tables(void) | |
| 61 | +{ | |
| 62 | + static AVOnce init_float_once = AV_ONCE_INIT; | |
| 63 | + ff_thread_once(&init_float_once, init_tables_float_fn); | |
| 64 | +} | |
| 38 | 65 | |
| 39 | 66 | #include "aacdec_dsp_template.c" |
| @@ -204,6 +204,8 @@ typedef struct DynamicRangeControl { · 203 unmodified lines | ||
| 204 | 204 | * DSP-specific primitives |
| 205 | 205 | */ |
| 206 | 206 | typedef struct AACDecDSP { |
| 207 | + void (*init_tables)(void); | |
| 208 | + | |
| 207 | 209 | void (*dequant_scalefactors)(SingleChannelElement *sce); |
| 208 | 210 | |
| 209 | 211 | void (*apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe); |