avcodec/aac: Share common init code of float decoder and encoder

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-11-22 23:33:03 +01:00
parent fc5d22abe4
commit 86b8c25455
4 changed files with 24 additions and 9 deletions

View File

@ -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)();
}

View File

@ -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;

View File

@ -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
};

View File

@ -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
* @{
*/