summaryrefslogtreecommitdiff
path: root/libavcodec/atrac1.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-13 20:59:11 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-18 02:50:48 +0200
commit04101222f23fef3af57ac2cf1b8835f350fd4e50 (patch)
tree66789f0f903d779660e5b4b5d5ffb666d28b07a0 /libavcodec/atrac1.c
parentce482266a641a2cbd2900c0c2e4afb24f26cc422 (diff)
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>
Diffstat (limited to 'libavcodec/atrac1.c')
-rw-r--r--libavcodec/atrac1.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index 4cfb1061c5..b2a2d5e6a1 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -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,8 +141,8 @@ 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,
- &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16);
+ 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];
start_pos += block_size;
@@ -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;