summaryrefslogtreecommitdiff
path: root/libavcodec/imc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-20 22:46:26 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-20 22:46:44 +0100
commit21ded9ce67d8a17acfb8cf5b243099b575e09cb0 (patch)
tree483864beb747bd05f3b655dcf9d4ca2e47b77245 /libavcodec/imc.c
parentb054054c9b8fde3f91d3829b034bd2e9c50de93a (diff)
avcodec/imc: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/imc.c')
-rw-r--r--libavcodec/imc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index dcedbd63b2..6c9ffd7980 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;
}