diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-22 23:33:03 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-08 17:51:48 +0100 |
commit | 86b8c25455d8dfa752e1f2000c775e547b9fa433 (patch) | |
tree | 983817846c40574865fc5f7608809692f178d9f5 | |
parent | fc5d22abe40e0ab5b603b69752288565c92de670 (diff) | |
download | ffmpeg-86b8c25455d8dfa752e1f2000c775e547b9fa433.tar.gz |
avcodec/aac: Share common init code of float decoder and encoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavcodec/aacdec_template.c | 10 | ||||
-rw-r--r-- | libavcodec/aacenc.c | 6 | ||||
-rw-r--r-- | libavcodec/aactab.c | 14 | ||||
-rw-r--r-- | libavcodec/aactab.h | 3 |
4 files changed, 24 insertions, 9 deletions
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 3bf271af54..fbe3074071 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1230,17 +1230,19 @@ static av_cold void aac_static_table_init(void) 352); // window initialization - AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_long_1024), 4.0, 1024); - AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_short_128), 6.0, 128); #if !USE_FIXED 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); -#endif + ff_aac_float_common_init(); +#else + AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_long_1024), 4.0, 1024); + AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_short_128), 6.0, 128); AAC_RENAME(ff_init_ff_sine_windows)(10); - AAC_RENAME(ff_init_ff_sine_windows)( 9); AAC_RENAME(ff_init_ff_sine_windows)( 7); +#endif + AAC_RENAME(ff_init_ff_sine_windows)( 9); AAC_RENAME(ff_cbrt_tableinit)(); } diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 274e5ca294..070a2e706a 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -36,7 +36,6 @@ #include "put_bits.h" #include "internal.h" #include "mpeg4audio.h" -#include "kbdwin.h" #include "sinewin.h" #include "profiles.h" @@ -922,10 +921,7 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s) return AVERROR(ENOMEM); // window init - ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); - ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); - ff_init_ff_sine_windows(10); - ff_init_ff_sine_windows(7); + ff_aac_float_common_init(); if ((ret = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0)) < 0) return ret; diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c index e886642e66..b9d1336d97 100644 --- a/libavcodec/aactab.c +++ b/libavcodec/aactab.c @@ -27,6 +27,7 @@ * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) */ +#include "config.h" #include "libavutil/mem.h" #include "libavutil/thread.h" #include "aac.h" @@ -37,9 +38,22 @@ float ff_aac_pow2sf_tab[428]; float ff_aac_pow34sf_tab[428]; +#if CONFIG_AAC_ENCODER || CONFIG_AAC_DECODER +#include "kbdwin.h" +#include "sinewin.h" + DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128]; +av_cold void ff_aac_float_common_init(void) +{ + ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); + ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); + ff_init_ff_sine_windows(10); + ff_init_ff_sine_windows(7); +} +#endif + const uint8_t ff_aac_num_swb_1024[] = { 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40 }; diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h index ddef8462f0..8a354e8186 100644 --- a/libavcodec/aactab.h +++ b/libavcodec/aactab.h @@ -98,6 +98,9 @@ DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_480)[1800]; DECLARE_ALIGNED(32, extern const int, ff_aac_eld_window_480_fixed)[1800]; // @} +/* Initializes data shared between float decoder and encoder. */ +void ff_aac_float_common_init(void); + /* @name number of scalefactor window bands for long and short transform windows respectively * @{ */ |