Browse code

avcodec/aacenc: Use avpriv_float_dsp_alloc()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/11/30 02:58:13
Showing 2 changed files
... ...
@@ -252,7 +252,7 @@ static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce,
252 252
     int i;
253 253
     float *output = sce->ret_buf;
254 254
 
255
-    apply_window[sce->ics.window_sequence[0]](&s->fdsp, sce, audio);
255
+    apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio);
256 256
 
257 257
     if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE)
258 258
         s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output);
... ...
@@ -682,6 +682,7 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
682 682
         ff_psy_preprocess_end(s->psypp);
683 683
     av_freep(&s->buffer.samples);
684 684
     av_freep(&s->cpe);
685
+    av_freep(&s->fdsp);
685 686
     ff_af_queue_close(&s->afq);
686 687
     return 0;
687 688
 }
... ...
@@ -690,7 +691,9 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
690 690
 {
691 691
     int ret = 0;
692 692
 
693
-    avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
693
+    s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
694
+    if (!s->fdsp)
695
+        return AVERROR(ENOMEM);
694 696
 
695 697
     // window init
696 698
     ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
... ...
@@ -67,7 +67,7 @@ typedef struct AACEncContext {
67 67
     PutBitContext pb;
68 68
     FFTContext mdct1024;                         ///< long (1024 samples) frame transform context
69 69
     FFTContext mdct128;                          ///< short (128 samples) frame transform context
70
-    AVFloatDSPContext fdsp;
70
+    AVFloatDSPContext *fdsp;
71 71
     float *planar_samples[6];                    ///< saved preprocessed input
72 72
 
73 73
     int samplerate_index;                        ///< MPEG-4 samplerate index