[FFmpeg-soc] [soc]: r2788 - aac/aac.c

superdump subversion at mplayerhq.hu
Tue Jul 15 15:24:25 CEST 2008


Author: superdump
Date: Tue Jul 15 15:24:22 2008
New Revision: 2788

Log:
Dynamically allocate an aligned buffer for interleaved_output rather than
having a mostly redundant large array in the context


Modified:
   aac/aac.c

Modified: aac/aac.c
==============================================================================
--- aac/aac.c	(original)
+++ aac/aac.c	Tue Jul 15 15:24:22 2008
@@ -434,7 +434,7 @@ typedef struct {
      * @defgroup output   Members used for output interleaving and down-mixing.
      * @{
      */
-    DECLARE_ALIGNED_16(float, interleaved_output[MAX_CHANNELS * 1024]); ///< Interim buffer for interleaving PCM samples.
+    float *interleaved_output;                        ///< Interim buffer for interleaving PCM samples.
     float *output_data[MAX_CHANNELS];                 ///< Points to each element's 'ret' buffer (PCM output).
     ChannelElement *mm[3];                            ///< Center/Front/Back channel elements to use for matrix mix-down.
     float add_bias;                                   ///< offset for dsp.float_to_int16
@@ -564,6 +564,14 @@ static int output_configure(AACContext *
         }
     }
 
+    // allocate appropriately aligned buffer for interleaved output
+    if(!ac->interleaved_output)
+        ac->interleaved_output = av_malloc(channels * 1024 * sizeof(float));
+    else if(channels != avctx->channels) {
+        av_free(ac->interleaved_output);
+        ac->interleaved_output = av_malloc(channels * 1024 * sizeof(float));
+    }
+
     ac->mm[MIXDOWN_FRONT] = ac->mm[MIXDOWN_BACK] = ac->mm[MIXDOWN_CENTER] = NULL;
 
     /* Check for matrix mix-down to mono or stereo. */
@@ -2332,6 +2340,7 @@ static av_cold int aac_decode_close(AVCo
         av_free(ac->mdct_ltp);
     }
 #endif /* AAC_LTP */
+    av_freep(&ac->interleaved_output);
     return 0 ;
 }
 



More information about the FFmpeg-soc mailing list