Browse code

Use coupling band sizes instead of coupling band structure when calculating coupling transform coefficients.

Originally committed as revision 19584 to svn://svn.ffmpeg.org/ffmpeg/trunk

Justin Ruggles authored on 2009/08/05 10:00:41
Showing 2 changed files
... ...
@@ -412,14 +412,11 @@ static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps,
412 412
  */
413 413
 static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
414 414
 {
415
-    int i, j, ch, bnd, subbnd;
415
+    int i, j, ch, bnd;
416 416
 
417
-    subbnd = -1;
418 417
     i = s->start_freq[CPL_CH];
419 418
     for(bnd=0; bnd<s->num_cpl_bands; bnd++) {
420
-        do {
421
-            subbnd++;
422
-            for(j=0; j<12; j++) {
419
+        for (j = 0; j < s->cpl_band_sizes[bnd]; j++,i++) {
423 420
                 for(ch=1; ch<=s->fbw_channels; ch++) {
424 421
                     if(s->channel_in_cpl[ch]) {
425 422
                         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 @@ static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
427 427
                             s->fixed_coeffs[ch][i] = -s->fixed_coeffs[ch][i];
428 428
                     }
429 429
                 }
430
-                i++;
431
-            }
432
-        } while(s->cpl_band_struct[subbnd]);
430
+        }
433 431
     }
434 432
 }
435 433
 
... ...
@@ -884,7 +879,8 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
884 884
             decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband,
885 885
                                   cpl_end_subband,
886 886
                                   ff_eac3_default_cpl_band_struct,
887
-                                  s->cpl_band_struct, &s->num_cpl_bands, NULL);
887
+                                  s->cpl_band_struct, &s->num_cpl_bands,
888
+                                  s->cpl_band_sizes);
888 889
         } else {
889 890
             /* coupling not in use */
890 891
             for (ch = 1; ch <= fbw_channels; ch++) {
... ...
@@ -83,6 +83,7 @@ typedef struct {
83 83
     int phase_flags[18];                    ///< phase flags                            (phsflg)
84 84
     int num_cpl_bands;                      ///< number of coupling bands               (ncplbnd)
85 85
     uint8_t cpl_band_struct[18];            ///< coupling band structure                (cplbndstrc)
86
+    uint8_t cpl_band_sizes[18];             ///< number of coeffs in each coupling band
86 87
     int firstchincpl;                       ///< first channel in coupling
87 88
     int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states      (firstcplcos)
88 89
     int cpl_coords[AC3_MAX_CHANNELS][18];   ///< coupling coordinates                   (cplco)