changeset 10021:f6c433eacc5a libavcodec

Use coupling band sizes instead of coupling band structure when calculating coupling transform coefficients.
author jbr
date Wed, 05 Aug 2009 01:00:41 +0000
parents 617166c76faf
children e60ed9255bf4
files ac3dec.c ac3dec.h
diffstat 2 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.c	Tue Aug 04 21:55:47 2009 +0000
+++ b/ac3dec.c	Wed Aug 05 01:00:41 2009 +0000
@@ -412,14 +412,11 @@
  */
 static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
 {
-    int i, j, ch, bnd, subbnd;
+    int i, j, ch, bnd;
 
-    subbnd = -1;
     i = s->start_freq[CPL_CH];
     for(bnd=0; bnd<s->num_cpl_bands; bnd++) {
-        do {
-            subbnd++;
-            for(j=0; j<12; j++) {
+        for (j = 0; j < s->cpl_band_sizes[bnd]; j++,i++) {
                 for(ch=1; ch<=s->fbw_channels; ch++) {
                     if(s->channel_in_cpl[ch]) {
                         s->fixed_coeffs[ch][i] = ((int64_t)s->fixed_coeffs[CPL_CH][i] * (int64_t)s->cpl_coords[ch][bnd]) >> 23;
@@ -427,9 +424,7 @@
                             s->fixed_coeffs[ch][i] = -s->fixed_coeffs[ch][i];
                     }
                 }
-                i++;
-            }
-        } while(s->cpl_band_struct[subbnd]);
+        }
     }
 }
 
@@ -884,7 +879,8 @@
             decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband,
                                   cpl_end_subband,
                                   ff_eac3_default_cpl_band_struct,
-                                  s->cpl_band_struct, &s->num_cpl_bands, NULL);
+                                  s->cpl_band_struct, &s->num_cpl_bands,
+                                  s->cpl_band_sizes);
         } else {
             /* coupling not in use */
             for (ch = 1; ch <= fbw_channels; ch++) {
--- a/ac3dec.h	Tue Aug 04 21:55:47 2009 +0000
+++ b/ac3dec.h	Wed Aug 05 01:00:41 2009 +0000
@@ -83,6 +83,7 @@
     int phase_flags[18];                    ///< phase flags                            (phsflg)
     int num_cpl_bands;                      ///< number of coupling bands               (ncplbnd)
     uint8_t cpl_band_struct[18];            ///< coupling band structure                (cplbndstrc)
+    uint8_t cpl_band_sizes[18];             ///< number of coeffs in each coupling band
     int firstchincpl;                       ///< first channel in coupling
     int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states      (firstcplcos)
     int cpl_coords[AC3_MAX_CHANNELS][18];   ///< coupling coordinates                   (cplco)