[FFmpeg-cvslog] avcodec/imc: Use avpriv_float_dsp_alloc()
Michael Niedermayer
git at videolan.org
Thu Nov 20 23:00:58 CET 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 20 22:46:26 2014 +0100| [21ded9ce67d8a17acfb8cf5b243099b575e09cb0] | committer: Michael Niedermayer
avcodec/imc: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21ded9ce67d8a17acfb8cf5b243099b575e09cb0
---
libavcodec/imc.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index dcedbd6..6c9ffd7 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -96,7 +96,7 @@ typedef struct {
GetBitContext gb;
BswapDSPContext bdsp;
- AVFloatDSPContext fdsp;
+ AVFloatDSPContext *fdsp;
FFTContext fft;
DECLARE_ALIGNED(32, FFTComplex, samples)[COEFFS / 2];
float *out_samples;
@@ -256,7 +256,13 @@ static av_cold int imc_decode_init(AVCodecContext *avctx)
return ret;
}
ff_bswapdsp_init(&q->bdsp);
- avpriv_float_dsp_init(&q->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+ q->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
+ if (!q->fdsp) {
+ ff_fft_end(&q->fft);
+
+ return AVERROR(ENOMEM);
+ }
+
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO
: AV_CH_LAYOUT_STEREO;
@@ -1044,7 +1050,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
}
if (avctx->channels == 2) {
- q->fdsp.butterflies_float((float *)frame->extended_data[0],
+ q->fdsp->butterflies_float((float *)frame->extended_data[0],
(float *)frame->extended_data[1], COEFFS);
}
@@ -1053,12 +1059,12 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
return IMC_BLOCK_SIZE * avctx->channels;
}
-
static av_cold int imc_decode_close(AVCodecContext * avctx)
{
IMCContext *q = avctx->priv_data;
ff_fft_end(&q->fft);
+ av_freep(&q->fdsp);
return 0;
}
More information about the ffmpeg-cvslog
mailing list