[FFmpeg-soc] [soc]: r4017 - in wmapro: wma3.h wma3dec.c

faust3 subversion at mplayerhq.hu
Tue Feb 3 19:24:57 CET 2009


Author: faust3
Date: Tue Feb  3 19:24:57 2009
New Revision: 4017

Log:
reuse per channel output buffer for decoding the coefficients

Modified:
   wmapro/wma3.h
   wmapro/wma3dec.c

Modified: wmapro/wma3.h
==============================================================================
--- wmapro/wma3.h	Tue Feb  3 19:06:34 2009	(r4016)
+++ wmapro/wma3.h	Tue Feb  3 19:24:57 2009	(r4017)
@@ -57,7 +57,7 @@ typedef struct {
     int      scale_factors[MAX_BANDS];           //< scale factor values
     int      resampled_scale_factors[MAX_BANDS]; //< scale factors from a previous block
     int      scale_factor_block_len;             //< sf reference block length
-    DECLARE_ALIGNED_16(float, coeffs[BLOCK_MAX_SIZE]); //< decode buffer
+    float*   coeffs;                             //< pointer to the decode buffer
     DECLARE_ALIGNED_16(float, out[2*BLOCK_MAX_SIZE]);  //< output buffer
 } WMA3ChannelCtx;
 
@@ -83,6 +83,7 @@ typedef struct WMA3DecodeContext {
     AVCodecContext*  avctx;                    //< codec context for av_log
     DSPContext       dsp;
     MDCTContext      mdct_ctx[BLOCK_NB_SIZES]; //< MDCT context per block size
+    DECLARE_ALIGNED_16(float, tmp[BLOCK_MAX_SIZE]); //< imdct working buffer
     float*           windows[BLOCK_NB_SIZES];  //< window per block size
     VLC              sf_vlc;                   //< scale factor DPCM vlc
     VLC              sf_rl_vlc;                //< scale factor run length vlc

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Tue Feb  3 19:06:34 2009	(r4016)
+++ wmapro/wma3dec.c	Tue Feb  3 19:24:57 2009	(r4017)
@@ -1110,7 +1110,6 @@ static int wma_decode_subframe(WMA3Decod
     */
     for(i=0;i<s->nb_channels;i++){
         s->channel[i].grouped = 0;
-        memset(s->channel[i].coeffs,0,sizeof(s->channel[0].coeffs));
         if(offset > s->channel[i].decoded_samples){
             offset = s->channel[i].decoded_samples;
             subframe_len = s->channel[i].subframe_len[s->channel[i].cur_subframe];
@@ -1155,6 +1154,8 @@ static int wma_decode_subframe(WMA3Decod
           s->rgiBarkIndex = &s->sfb_offsets[MAX_BANDS * frame_offset];
           s->subwoofer_cutoff = s->subwoofer_cutoffs[frame_offset];
         }
+        s->channel[c].coeffs = &s->channel[c].out[s->samples_per_frame/2  + offset];
+        memset(s->channel[c].coeffs,0,sizeof(float) * subframe_len);
 
         /** init some things if this is the first subframe */
         if(!s->channel[c].cur_subframe){
@@ -1297,9 +1298,9 @@ static int wma_decode_subframe(WMA3Decod
             }
 
             dst = &s->channel[c].out[s->samples_per_frame/2  + s->channel[c].subframe_offset[s->channel[c].cur_subframe]];
-            ff_imdct_half(&s->mdct_ctx[av_log2(subframe_len)-BLOCK_MIN_BITS], dst, s->channel[c].coeffs); // DCTIV with reverse
+            ff_imdct_half(&s->mdct_ctx[av_log2(subframe_len)-BLOCK_MIN_BITS], s->tmp, s->channel[c].coeffs); // DCTIV with reverse
             for(b=0;b<subframe_len;b++)
-                dst[b] /= subframe_len / 2;     // FIXME: try to remove this scaling
+                dst[b] = s->tmp[b] / (subframe_len / 2);     // FIXME: try to remove this scaling
         }
     }else{
         for(i=0;i<s->channels_for_cur_subframe;i++){



More information about the FFmpeg-soc mailing list