faust3 | 1 Jun 2009 13:31
Picon

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

Author: faust3
Date: Mon Jun  1 13:31:20 2009
New Revision: 4364

Log:
simplified wma_inverse_channel_transform

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

Modified: wmapro/wma3.h
==============================================================================
--- wmapro/wma3.h	Sun May 31 18:52:15 2009	(r4363)
+++ wmapro/wma3.h	Mon Jun  1 13:31:20 2009	(r4364)
 <at>  <at>  -78,7 +78,7  <at>  <at>  typedef struct {
     char    transform;                                        ///< controls the type of the transform
     char    transform_band[MAX_BANDS];                        ///< controls if the transform is enabled for a certain band
     float   decorrelation_matrix[MAX_CHANNELS*MAX_CHANNELS];  ///< decorrelation matrix
-    char    use_channel[MAX_CHANNELS];                        ///< channels that are part of the group
+    float*  channel_data[MAX_CHANNELS];                       ///< transformation coefficients
 } WMA3ChannelGroup;

 /**

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Sun May 31 18:52:15 2009	(r4363)
+++ wmapro/wma3dec.c	Mon Jun  1 13:31:20 2009	(r4364)
 <at>  <at>  -671,12 +671,11  <at>  <at>  static int wma_decode_channel_transform(
(Continue reading)

faust3 | 1 Jun 2009 13:37
Picon

[soc]: r4365 - wmapro/wma3dec.c

Author: faust3
Date: Mon Jun  1 13:37:49 2009
New Revision: 4365

Log:
use av_clip to calculate subwoofer cutoffs

Modified:
   wmapro/wma3dec.c

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 13:31:20 2009	(r4364)
+++ wmapro/wma3dec.c	Mon Jun  1 13:37:49 2009	(r4365)
 <at>  <at>  -374,9 +374,7  <at>  <at>  static av_cold int wma_decode_init(AVCod
         int block_size = s->samples_per_frame / (1 << i);
         int cutoff = ceil(block_size * 440.0
                           / (double)s->avctx->sample_rate + 0.5);
-        cutoff = FFMAX(cutoff, 4);
-        cutoff = FFMIN(cutoff, block_size);
-        s->subwoofer_cutoffs[i] = cutoff;
+        s->subwoofer_cutoffs[i] = av_clip(cutoff,4,block_size);
     }

     /** set up decorrelation matrixes */
Sascha Sommer | 1 Jun 2009 13:40
Picon
Favicon

Re: [soc]: r4354 - wmapro/wma3dec.c

Hi,

On Sonntag, 31. Mai 2009, Aurelien Jacobs wrote:
> On Sun, May 31, 2009 at 10:36:44AM +0200, faust3 wrote:
> > Author: faust3
> > Date: Sun May 31 10:36:44 2009
> > New Revision: 4354
> >
> > Log:
> > use FFMIN FFMAX where possible
> >
> > Modified:
> >    wmapro/wma3dec.c
> >
> > Modified: wmapro/wma3dec.c
> > =========================================================================
> >===== --- wmapro/wma3dec.c	Sun May 31 10:00:02 2009	(r4353)
> > +++ wmapro/wma3dec.c	Sun May 31 10:36:44 2009	(r4354)
> >  <at>  <at>  -367,10 +367,8  <at>  <at>  static av_cold int wma_decode_init(AVCod
> >      for(i=0;i< s->num_possible_block_sizes;i++){
> >          int block_size = s->samples_per_frame / (1 << i);
> >          int cutoff = ceil(block_size * 440.0 /
> > (double)s->avctx->sample_rate + 0.5); -        if(cutoff < 4)
> > -            cutoff = 4;
> > -        if(cutoff > block_size)
> > -            cutoff = block_size;
> > +        cutoff = FFMAX(cutoff, 4);
> > +        cutoff = FFMIN(cutoff, block_size);
> >          s->subwoofer_cutoffs[i] = cutoff;
> >      }
(Continue reading)

faust3 | 1 Jun 2009 13:45
Picon

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

Author: faust3
Date: Mon Jun  1 13:45:45 2009
New Revision: 4366

Log:
make sin64 static so that it can be reused for multiple instances

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

Modified: wmapro/wma3.h
==============================================================================
--- wmapro/wma3.h	Mon Jun  1 13:37:49 2009	(r4365)
+++ wmapro/wma3.h	Mon Jun  1 13:45:45 2009	(r4366)
 <at>  <at>  -93,7 +93,6  <at>  <at>  typedef struct WMA3DecodeContext {
     MDCTContext      mdct_ctx[BLOCK_NB_SIZES];      ///< MDCT context per block size
     DECLARE_ALIGNED_16(float, tmp[BLOCK_MAX_SIZE]); ///< imdct output buffer
     float*           windows[BLOCK_NB_SIZES];       ///< window per block size
-    float            sin64[33];                     ///< sinus table for decorrelation
     int              coef_max[2];                   ///< max length of vlc codes

     /** frame size dependent frame information (set during initialization) */

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 13:37:49 2009	(r4365)
+++ wmapro/wma3dec.c	Mon Jun  1 13:45:45 2009	(r4366)
 <at>  <at>  -87,6 +87,7  <at>  <at>  static VLC              vec4_vlc;       
 static VLC              vec2_vlc;         ///< 2 coefficients per symbol
(Continue reading)

Sascha Sommer | 1 Jun 2009 13:48
Picon
Favicon

Re: [soc]: r4346 - in wmapro: wma3.h wma3dec.c

Hi,

On Sonntag, 31. Mai 2009, Benjamin Larsson wrote:
> Sascha Sommer wrote:
> >> Maybe add a static table instead? Then 2 instances would share the
> >> table.
> >
> > Is this a needed requirement? After reading the discussion from r18681,
> > I'm not sure.
> >
> > Regards
> >
> > Sascha
>
> In this case the table isn't that big so it doesn't really matter to me.
> But I'm guessing this will be an issue for the merge.
>

Ok. I made the table static.

Regards

Sascha
faust3 | 1 Jun 2009 15:09
Picon

[soc]: r4367 - wmapro/wma3dec.c

Author: faust3
Date: Mon Jun  1 15:09:24 2009
New Revision: 4367

Log:
factor out the sine window index

Modified:
   wmapro/wma3dec.c

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 13:45:45 2009	(r4366)
+++ wmapro/wma3dec.c	Mon Jun  1 15:09:24 2009	(r4367)
 <at>  <at>  -363,10 +363,10  <at>  <at>  static av_cold int wma_decode_init(AVCod

     /** init MDCT windows: simple sinus window */
     for(i=0 ; i<BLOCK_NB_SIZES ; i++) {
-        int n;
-        n = 1 << (BLOCK_MAX_BITS - i);
-        ff_sine_window_init(ff_sine_windows[BLOCK_MAX_BITS - i - 7], n);
-        s->windows[BLOCK_NB_SIZES-i-1] = ff_sine_windows[BLOCK_MAX_BITS - i - 7];
+        const int n = 1 << (BLOCK_MAX_BITS - i);
+        const int win_idx = BLOCK_MAX_BITS - i - 7;
+        ff_sine_window_init(ff_sine_windows[win_idx], n);
+        s->windows[BLOCK_NB_SIZES-i-1] = ff_sine_windows[win_idx];
     }

     /** calculate subwoofer cutoff values */
(Continue reading)

faust3 | 1 Jun 2009 15:22
Picon

[soc]: r4368 - wmapro/wma3dec.c

Author: faust3
Date: Mon Jun  1 15:22:08 2009
New Revision: 4368

Log:
avoid repeated minimum number of samples calculations during wma_decode_tilehdr

Modified:
   wmapro/wma3dec.c

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 15:09:24 2009	(r4367)
+++ wmapro/wma3dec.c	Mon Jun  1 15:22:08 2009	(r4368)
 <at>  <at>  -474,10 +474,13  <at>  <at>  static int wma_decode_tilehdr(WMA3Decode
             int read_channel_mask = 1;
             int channels_for_cur_subframe = 0;
             int subframe_len;
+            /** minimum number of samples that need to be read */
+            int min_samples = s->min_samples_per_subframe;

             if(fixed_channel_layout){
                 read_channel_mask = 0;
                 channels_for_cur_subframe = s->num_channels;
+                min_samples *= channels_for_cur_subframe;
                 min_channel_len = s->channel[0].channel_len;
             }else{
                 /** find channels with the smallest overall length */
 <at>  <at>  -490,9 +493,10  <at>  <at>  static int wma_decode_tilehdr(WMA3Decode
                         ++channels_for_cur_subframe;
(Continue reading)

faust3 | 1 Jun 2009 16:11
Picon

[soc]: r4369 - wmapro/wma3dec.c

Author: faust3
Date: Mon Jun  1 16:11:10 2009
New Revision: 4369

Log:
reworked wma_decode_scale_factors

Modified:
   wmapro/wma3dec.c

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 15:22:08 2009	(r4368)
+++ wmapro/wma3dec.c	Mon Jun  1 16:11:10 2009	(r4369)
 <at>  <at>  -920,7 +920,6  <at>  <at>  static int wma_decode_coeffs(WMA3DecodeC
 static int wma_decode_scale_factors(WMA3DecodeContext* s)
 {
     int i;
-    const int idx0 = av_log2(s->samples_per_frame/s->subframe_len);

     /** should never consume more than 5344 bits
      *  MAX_CHANNELS * (1 +  MAX_BANDS * 23)
 <at>  <at>  -928,21 +927,31  <at>  <at>  static int wma_decode_scale_factors(WMA3

     for(i=0;i<s->channels_for_cur_subframe;i++){
         int c = s->channel_indexes_for_cur_subframe[i];
+        int* sf;
+        int* sf_end = s->channel[c].scale_factors + s->num_bands;

         /** resample scale factors for the new block size */
(Continue reading)

faust3 | 1 Jun 2009 16:19
Picon

[soc]: r4370 - wmapro/wma3dec.c

Author: faust3
Date: Mon Jun  1 16:19:40 2009
New Revision: 4370

Log:
factor out cur_subframe

Modified:
   wmapro/wma3dec.c

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 16:11:10 2009	(r4369)
+++ wmapro/wma3dec.c	Mon Jun  1 16:19:40 2009	(r4370)
 <at>  <at>  -1165,15 +1165,16  <at>  <at>  static int wma_decode_subframe(WMA3Decod
     /** get a list of all channels that contain the estimated block */
     s->channels_for_cur_subframe = 0;
     for(i=0;i<s->num_channels;i++){
+        const int cur_subframe = s->channel[i].cur_subframe;
         /** substract already processed samples */
         total_samples -= s->channel[i].decoded_samples;

         /** and count if there are multiple subframes that match our profile */
         if(offset == s->channel[i].decoded_samples &&
-           subframe_len == s->channel[i].subframe_len[s->channel[i].cur_subframe]){
-             total_samples -= s->channel[i].subframe_len[s->channel[i].cur_subframe];
+           subframe_len == s->channel[i].subframe_len[cur_subframe]){
+             total_samples -= s->channel[i].subframe_len[cur_subframe];
              s->channel[i].decoded_samples +=
-                s->channel[i].subframe_len[s->channel[i].cur_subframe];
(Continue reading)

faust3 | 1 Jun 2009 16:21
Picon

[soc]: r4371 - wmapro/wma3dec.c

Author: faust3
Date: Mon Jun  1 16:21:34 2009
New Revision: 4371

Log:
fixed indentation

Modified:
   wmapro/wma3dec.c

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Mon Jun  1 16:19:40 2009	(r4370)
+++ wmapro/wma3dec.c	Mon Jun  1 16:21:34 2009	(r4371)
 <at>  <at>  -1172,11 +1172,11  <at>  <at>  static int wma_decode_subframe(WMA3Decod
         /** and count if there are multiple subframes that match our profile */
         if(offset == s->channel[i].decoded_samples &&
            subframe_len == s->channel[i].subframe_len[cur_subframe]){
-             total_samples -= s->channel[i].subframe_len[cur_subframe];
-             s->channel[i].decoded_samples +=
+            total_samples -= s->channel[i].subframe_len[cur_subframe];
+            s->channel[i].decoded_samples +=
                 s->channel[i].subframe_len[cur_subframe];
-             s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;
-             ++s->channels_for_cur_subframe;
+            s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;
+            ++s->channels_for_cur_subframe;
         }
     }
(Continue reading)


Gmane