mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-18 13:35:13 +00:00
aacdec: template LTP windowing separately
The function is called only internally in DSP, so we do not need to expose it. apply_ltp on MIPS uses this function, but due to the function being just a glue function with no real optimizations, duplicate it there.
This commit is contained in:
parent
091d85217d
commit
eef9100a8e
@ -237,6 +237,34 @@ static void AAC_RENAME(apply_tns)(void *_coef_param, TemporalNoiseShaping *tns,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply windowing and MDCT to obtain the spectral
|
||||
* coefficient from the predicted sample by LTP.
|
||||
*/
|
||||
static inline void AAC_RENAME(windowing_and_mdct_ltp)(AACDecContext *ac,
|
||||
INTFLOAT *out, INTFLOAT *in,
|
||||
IndividualChannelStream *ics)
|
||||
{
|
||||
const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
|
||||
const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
|
||||
const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
|
||||
const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
|
||||
|
||||
if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
|
||||
ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
|
||||
} else {
|
||||
memset(in, 0, 448 * sizeof(*in));
|
||||
ac->fdsp->vector_fmul(in + 448, in + 448, swindow_prev, 128);
|
||||
}
|
||||
if (ics->window_sequence[0] != LONG_START_SEQUENCE) {
|
||||
ac->fdsp->vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
|
||||
} else {
|
||||
ac->fdsp->vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
|
||||
memset(in + 1024 + 576, 0, 448 * sizeof(*in));
|
||||
}
|
||||
ac->mdct_ltp_fn(ac->mdct_ltp, out, in, sizeof(INTFLOAT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the long term prediction
|
||||
*/
|
||||
@ -257,7 +285,7 @@ static void AAC_RENAME(apply_ltp)(AACDecContext *ac, SingleChannelElement *sce)
|
||||
predTime[i] = AAC_MUL30(sce->AAC_RENAME(ltp_state)[i + 2048 - ltp->lag], ltp->AAC_RENAME(coef));
|
||||
memset(&predTime[i], 0, (2048 - i) * sizeof(*predTime));
|
||||
|
||||
ac->AAC_RENAME(windowing_and_mdct_ltp)(ac, predFreq, predTime, &sce->ics);
|
||||
AAC_RENAME(windowing_and_mdct_ltp)(ac, predFreq, predTime, &sce->ics);
|
||||
|
||||
if (sce->tns.present)
|
||||
AAC_RENAME(apply_tns)(predFreq, &sce->tns, &sce->ics, 0);
|
||||
|
@ -311,12 +311,6 @@ struct AACDecContext {
|
||||
int is_fixed;
|
||||
|
||||
/* aacdec functions pointers */
|
||||
union {
|
||||
void (*windowing_and_mdct_ltp)(struct AACDecContext *ac, float *out,
|
||||
float *in, IndividualChannelStream *ics);
|
||||
void (*windowing_and_mdct_ltp_fixed)(struct AACDecContext *ac, int *out,
|
||||
int *in, IndividualChannelStream *ics);
|
||||
};
|
||||
void (*vector_pow43)(int *coefs, int len);
|
||||
void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
|
||||
};
|
||||
|
@ -2367,33 +2367,6 @@ static int decode_extension_payload(AACDecContext *ac, GetBitContext *gb, int cn
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply windowing and MDCT to obtain the spectral
|
||||
* coefficient from the predicted sample by LTP.
|
||||
*/
|
||||
static void windowing_and_mdct_ltp(AACDecContext *ac, INTFLOAT *out,
|
||||
INTFLOAT *in, IndividualChannelStream *ics)
|
||||
{
|
||||
const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
|
||||
const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
|
||||
const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
|
||||
const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
|
||||
|
||||
if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
|
||||
ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
|
||||
} else {
|
||||
memset(in, 0, 448 * sizeof(*in));
|
||||
ac->fdsp->vector_fmul(in + 448, in + 448, swindow_prev, 128);
|
||||
}
|
||||
if (ics->window_sequence[0] != LONG_START_SEQUENCE) {
|
||||
ac->fdsp->vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
|
||||
} else {
|
||||
ac->fdsp->vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
|
||||
memset(in + 1024 + 576, 0, 448 * sizeof(*in));
|
||||
}
|
||||
ac->mdct_ltp_fn(ac->mdct_ltp, out, in, sizeof(INTFLOAT));
|
||||
}
|
||||
|
||||
/**
|
||||
* channel coupling transformation interface
|
||||
*
|
||||
@ -2919,7 +2892,6 @@ static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
||||
static void aacdec_init(AACDecContext *c)
|
||||
{
|
||||
c->AAC_RENAME(windowing_and_mdct_ltp) = windowing_and_mdct_ltp;
|
||||
#if USE_FIXED
|
||||
c->vector_pow43 = vector_pow43;
|
||||
c->subband_scale = subband_scale;
|
||||
|
@ -224,6 +224,34 @@ static void imdct_and_windowing_mips(AACDecContext *ac, SingleChannelElement *sc
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply windowing and MDCT to obtain the spectral
|
||||
* coefficient from the predicted sample by LTP.
|
||||
*/
|
||||
static inline void windowing_and_mdct_ltp(AACDecContext *ac,
|
||||
float *out, float *in,
|
||||
IndividualChannelStream *ics)
|
||||
{
|
||||
const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024) : ff_sine_1024;
|
||||
const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128) : ff_sine_128;
|
||||
const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024) : ff_sine_1024;
|
||||
const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128) : ff_sine_128;
|
||||
|
||||
if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
|
||||
ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
|
||||
} else {
|
||||
memset(in, 0, 448 * sizeof(*in));
|
||||
ac->fdsp->vector_fmul(in + 448, in + 448, swindow_prev, 128);
|
||||
}
|
||||
if (ics->window_sequence[0] != LONG_START_SEQUENCE) {
|
||||
ac->fdsp->vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
|
||||
} else {
|
||||
ac->fdsp->vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
|
||||
memset(in + 1024 + 576, 0, 448 * sizeof(*in));
|
||||
}
|
||||
ac->mdct_ltp_fn(ac->mdct_ltp, out, in, sizeof(INTFLOAT));
|
||||
}
|
||||
|
||||
static void apply_ltp_mips(AACDecContext *ac, SingleChannelElement *sce)
|
||||
{
|
||||
const LongTermPrediction *ltp = &sce->ics.ltp;
|
||||
@ -272,7 +300,7 @@ static void apply_ltp_mips(AACDecContext *ac, SingleChannelElement *sce)
|
||||
);
|
||||
}
|
||||
|
||||
ac->windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics);
|
||||
windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics);
|
||||
|
||||
if (sce->tns.present)
|
||||
ac->dsp.apply_tns(predFreq, &sce->tns, &sce->ics, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user