mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
aacdec: initialize float/fixed SBR tables only when either is needed
This commit is contained in:
parent
176c922e4e
commit
e3650886c7
@ -29,6 +29,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* We use several quantization functions here (Q31, Q30),
|
||||
* for which we need this to be defined for them to work as expected. */
|
||||
#define USE_FIXED 1
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
@ -184,8 +188,8 @@ static int frame_configure_elements(AVCodecContext *avctx)
|
||||
for (id = 0; id < MAX_ELEM_ID; id++) {
|
||||
ChannelElement *che = ac->che[type][id];
|
||||
if (che) {
|
||||
che->ch[0].AAC_RENAME(output) = che->ch[0].AAC_RENAME(ret_buf);
|
||||
che->ch[1].AAC_RENAME(output) = che->ch[1].AAC_RENAME(ret_buf);
|
||||
che->ch[0].output = che->ch[0].ret_buf;
|
||||
che->ch[1].output = che->ch[1].ret_buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +206,7 @@ static int frame_configure_elements(AVCodecContext *avctx)
|
||||
/* map output channel pointers to AVFrame data */
|
||||
for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
|
||||
if (ac->output_element[ch])
|
||||
ac->output_element[ch]->AAC_RENAME(output) = (INTFLOAT *)ac->frame->extended_data[ch];
|
||||
ac->output_element[ch]->output = (void *)ac->frame->extended_data[ch];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1107,9 +1111,6 @@ static int sample_rate_idx (int rate)
|
||||
|
||||
static av_cold void aac_static_table_init(void)
|
||||
{
|
||||
ff_aac_sbr_init();
|
||||
ff_aac_sbr_init_fixed();
|
||||
|
||||
ff_aacdec_common_init_once();
|
||||
}
|
||||
static AVOnce aac_table_init = AV_ONCE_INIT;
|
||||
@ -1118,8 +1119,8 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
AACDecContext *ac = avctx->priv_data;
|
||||
int is_fixed = ac->is_fixed;
|
||||
void (*sbr_close)(ChannelElement *che) = is_fixed ? RENAME_FIXED(ff_aac_sbr_ctx_close)
|
||||
: ff_aac_sbr_ctx_close;
|
||||
void (*sbr_close)(ChannelElement *che) = is_fixed ? ff_aac_sbr_ctx_close_fixed :
|
||||
ff_aac_sbr_ctx_close;
|
||||
|
||||
for (int type = 0; type < FF_ARRAY_ELEMS(ac->che); type++) {
|
||||
for (int i = 0; i < MAX_ELEM_ID; i++) {
|
||||
@ -2069,10 +2070,10 @@ static void spectral_to_sample(AACDecContext *ac, int samples)
|
||||
}
|
||||
}
|
||||
if (che->ch[0].tns.present)
|
||||
ac->dsp.apply_tns(che->ch[0].AAC_RENAME(coeffs),
|
||||
ac->dsp.apply_tns(che->ch[0].coeffs,
|
||||
&che->ch[0].tns, &che->ch[0].ics, 1);
|
||||
if (che->ch[1].tns.present)
|
||||
ac->dsp.apply_tns(che->ch[1].AAC_RENAME(coeffs),
|
||||
ac->dsp.apply_tns(che->ch[1].coeffs,
|
||||
&che->ch[1].tns, &che->ch[1].ics, 1);
|
||||
if (type <= TYPE_CPE)
|
||||
apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, ac->dsp.apply_dependent_coupling);
|
||||
@ -2088,12 +2089,12 @@ static void spectral_to_sample(AACDecContext *ac, int samples)
|
||||
if (ac->oc[1].m4ac.sbr > 0) {
|
||||
if (ac->is_fixed)
|
||||
ff_aac_sbr_apply_fixed(ac, che, type,
|
||||
che->ch[0].AAC_RENAME(output),
|
||||
che->ch[1].AAC_RENAME(output));
|
||||
(void *)che->ch[0].output,
|
||||
(void *)che->ch[1].output);
|
||||
else
|
||||
ff_aac_sbr_apply(ac, che, type,
|
||||
che->ch[0].AAC_RENAME(output),
|
||||
che->ch[1].AAC_RENAME(output));
|
||||
(void *)che->ch[0].output,
|
||||
(void *)che->ch[1].output);
|
||||
}
|
||||
}
|
||||
if (type <= TYPE_CCE)
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "libavcodec/sinewin_fixed_tablegen.h"
|
||||
#include "libavcodec/kbdwin.h"
|
||||
#include "libavcodec/cbrt_data.h"
|
||||
#include "libavcodec/aacsbr.h"
|
||||
|
||||
DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024];
|
||||
DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128];
|
||||
@ -57,6 +58,8 @@ static void init_tables_fixed_fn(void)
|
||||
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_aac_sbr_init)();
|
||||
|
||||
init_sine_windows_fixed();
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "libavcodec/kbdwin.h"
|
||||
#include "libavcodec/cbrt_data.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavcodec/aacsbr.h"
|
||||
|
||||
DECLARE_ALIGNED(32, static float, sine_120)[120];
|
||||
DECLARE_ALIGNED(32, static float, sine_960)[960];
|
||||
@ -61,6 +62,8 @@ static void init_tables_float_fn(void)
|
||||
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);
|
||||
|
||||
AAC_RENAME(ff_aac_sbr_init)();
|
||||
}
|
||||
|
||||
static int init(AACDecContext *ac)
|
||||
|
Loading…
x
Reference in New Issue
Block a user