1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/atrac1: Avoid indirection when calling float dsp function

Do this by only keeping the only function pointer from
the AVFloatDSPContext that is needed lateron.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-09-13 20:59:11 +02:00
parent ce482266a6
commit 04101222f2

View File

@ -80,7 +80,8 @@ typedef struct AT1Ctx {
DECLARE_ALIGNED(32, float, high)[512];
float* bands[3];
FFTContext mdct_ctx[3];
AVFloatDSPContext *fdsp;
void (*vector_fmul_window)(float *dst, const float *src0,
const float *src1, const float *win, int len);
} AT1Ctx;
/** size of the transform in samples in the long mode for each QMF band */
@ -140,7 +141,7 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q)
at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos + start_pos], nbits, band_num);
/* overlap and window */
q->fdsp->vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
q->vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
&su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16);
prev_buf = &su->spectrum[0][ref_pos+start_pos + 16];
@ -324,8 +325,6 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
ff_mdct_end(&q->mdct_ctx[1]);
ff_mdct_end(&q->mdct_ctx[2]);
av_freep(&q->fdsp);
return 0;
}
@ -333,6 +332,7 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
static av_cold int atrac1_decode_init(AVCodecContext *avctx)
{
AT1Ctx *q = avctx->priv_data;
AVFloatDSPContext *fdsp;
int ret;
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
@ -360,10 +360,11 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
ff_atrac_generate_tables();
q->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!q->fdsp) {
fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!fdsp)
return AVERROR(ENOMEM);
}
q->vector_fmul_window = fdsp->vector_fmul_window;
av_free(fdsp);
q->bands[0] = q->low;
q->bands[1] = q->mid;