aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/atrac3.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-13 21:10:20 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-18 02:51:15 +0200
commit0b7474a5910e6f80cb98857f0d131b13eb2aa2e0 (patch)
tree04efb6bc6c4869ab0bc8ced425ce9c6ba61ccbac /libavcodec/atrac3.c
parentf9ff4b252f993add29e3b020e995b591ba1485e9 (diff)
downloadffmpeg-0b7474a5910e6f80cb98857f0d131b13eb2aa2e0.tar.gz
avcodec/atrac3: 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/atrac3.c')
-rw-r--r--libavcodec/atrac3.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index ef2f8428dc..dc68e507aa 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -111,7 +111,8 @@ typedef struct ATRAC3Context {
AtracGCContext gainc_ctx;
FFTContext mdct_ctx;
- AVFloatDSPContext *fdsp;
+ void (*vector_fmul)(float *dst, const float *src0, const float *src1,
+ int len);
} ATRAC3Context;
static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE];
@@ -144,7 +145,7 @@ static void imlt(ATRAC3Context *q, float *input, float *output, int odd_band)
q->mdct_ctx.imdct_calc(&q->mdct_ctx, output, input);
/* Perform windowing on the output. */
- q->fdsp->vector_fmul(output, output, mdct_window, MDCT_SIZE);
+ q->vector_fmul(output, output, mdct_window, MDCT_SIZE);
}
/*
@@ -194,7 +195,6 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx)
av_freep(&q->units);
av_freep(&q->decoded_bytes_buffer);
- av_freep(&q->fdsp);
ff_mdct_end(&q->mdct_ctx);
@@ -874,6 +874,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
int version, delay, samples_per_frame, frame_factor;
const uint8_t *edata_ptr = avctx->extradata;
ATRAC3Context *q = avctx->priv_data;
+ AVFloatDSPContext *fdsp;
if (avctx->channels < MIN_CHANNELS || avctx->channels > MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Channel configuration error!\n");
@@ -997,12 +998,15 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
}
ff_atrac_init_gain_compensation(&q->gainc_ctx, 4, 3);
- q->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
+ fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
+ if (!fdsp)
+ return AVERROR(ENOMEM);
+ q->vector_fmul = fdsp->vector_fmul;
+ av_free(fdsp);
q->units = av_mallocz_array(avctx->channels, sizeof(*q->units));
- if (!q->units || !q->fdsp) {
+ if (!q->units)
return AVERROR(ENOMEM);
- }
return 0;
}