diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-13 00:09:18 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-17 00:09:08 +0200 |
commit | d3737bde639998f5a021e6fc00547ca2a7b28798 (patch) | |
tree | f6d6c66721c5610d19b6b4e28614bdac04221ab3 | |
parent | 8bbd97109c993b50a00a88f2b773252ed1b83fc0 (diff) | |
download | ffmpeg-d3737bde639998f5a021e6fc00547ca2a7b28798.tar.gz |
avcodec/ra288: Avoid indirection when calling float dsp function
Do this by only keeping the only function pointer from the
AVFloatDSPContext that is needed lateron. This also allows to remove the
decoder's close function.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavcodec/ra288.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index aa4bd5d90f..8df17891b1 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -39,7 +39,8 @@ #define RA288_BLOCKS_PER_FRAME 32 typedef struct RA288Context { - AVFloatDSPContext *fdsp; + void (*vector_fmul)(float *dst, const float *src0, const float *src1, + int len); DECLARE_ALIGNED(32, float, sp_lpc)[FFALIGN(36, 16)]; ///< LPC coefficients for speech data (spec: A) DECLARE_ALIGNED(32, float, gain_lpc)[FFALIGN(10, 16)]; ///< LPC coefficients for gain (spec: GB) @@ -60,18 +61,10 @@ typedef struct RA288Context { float gain_rec[11]; } RA288Context; -static av_cold int ra288_decode_close(AVCodecContext *avctx) -{ - RA288Context *ractx = avctx->priv_data; - - av_freep(&ractx->fdsp); - - return 0; -} - static av_cold int ra288_decode_init(AVCodecContext *avctx) { RA288Context *ractx = avctx->priv_data; + AVFloatDSPContext *fdsp; avctx->channels = 1; avctx->channel_layout = AV_CH_LAYOUT_MONO; @@ -82,9 +75,11 @@ static av_cold int ra288_decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } - ractx->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); - if (!ractx->fdsp) + fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); + if (!fdsp) return AVERROR(ENOMEM); + ractx->vector_fmul = fdsp->vector_fmul; + av_free(fdsp); return 0; } @@ -158,7 +153,7 @@ static void do_hybrid_window(RA288Context *ractx, av_assert2(order>=0); - ractx->fdsp->vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16)); + ractx->vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16)); convolve(buffer1, work + order , n , order); convolve(buffer2, work + order + n, non_rec, order); @@ -185,7 +180,7 @@ static void backward_filter(RA288Context *ractx, do_hybrid_window(ractx, order, n, non_rec, temp, hist, rec, window); if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1)) - ractx->fdsp->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16)); + ractx->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16)); memmove(hist, hist + n, move_size*sizeof(*hist)); } @@ -249,6 +244,5 @@ AVCodec ff_ra_288_decoder = { .priv_data_size = sizeof(RA288Context), .init = ra288_decode_init, .decode = ra288_decode_frame, - .close = ra288_decode_close, .capabilities = AV_CODEC_CAP_DR1, }; |