summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-03 14:43:40 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-03 14:52:38 +0100
commitc5dc8cc03a2953e32bbc4d064fb54aa7b286ad7e (patch)
tree6bc9b8be2f1a467c62ef6f8da0c4d45375d5d88e /libavcodec/mpegaudiodec_template.c
parente316caf712b24fecbc1688c25e858618bca69e02 (diff)
avcodec/mpegaudiodec_float: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegaudiodec_template.c')
-rw-r--r--libavcodec/mpegaudiodec_template.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 1c97d724f4..bbd07c5f0b 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -85,7 +85,7 @@ typedef struct MPADecodeContext {
int err_recognition;
AVCodecContext* avctx;
MPADSPContext mpadsp;
- AVFloatDSPContext fdsp;
+ AVFloatDSPContext *fdsp;
AVFrame *frame;
} MPADecodeContext;
@@ -406,6 +406,16 @@ static av_cold void decode_init_static(void)
}
}
+#if USE_FLOATS
+static av_cold int decode_close(AVCodecContext * avctx)
+{
+ MPADecodeContext *s = avctx->priv_data;
+ av_freep(&s->fdsp);
+
+ return 0;
+}
+#endif
+
static av_cold int decode_init(AVCodecContext * avctx)
{
static int initialized_tables = 0;
@@ -418,7 +428,10 @@ static av_cold int decode_init(AVCodecContext * avctx)
s->avctx = avctx;
- avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+ s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
+ if (!s->fdsp)
+ return AVERROR(ENOMEM);
+
ff_mpadsp_init(&s->mpadsp);
if (avctx->request_sample_fmt == OUT_FMT &&
@@ -1138,7 +1151,7 @@ found2:
/* NOTE: the 1/sqrt(2) normalization factor is included in the
global gain */
#if USE_FLOATS
- s->fdsp.butterflies_float(g0->sb_hybrid, g1->sb_hybrid, 576);
+ s->fdsp->butterflies_float(g0->sb_hybrid, g1->sb_hybrid, 576);
#else
tab0 = g0->sb_hybrid;
tab1 = g1->sb_hybrid;