ac3dec: Remove unneeded context variable, num_cpl_subbands. It is also
authorJustin Ruggles <justin.ruggles@gmail.com>
Wed, 6 May 2009 01:47:34 +0000 (01:47 +0000)
committerJustin Ruggles <justin.ruggles@gmail.com>
Wed, 6 May 2009 01:47:34 +0000 (01:47 +0000)
not needed for spectral extension or enhanced coupling since it is
redundant information, so I am removing it from decode_band_structure()
as well.

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

libavcodec/ac3dec.c
libavcodec/ac3dec.h

index e2f0ff9..9f0f699 100644 (file)
@@ -729,14 +729,13 @@ static void ac3_upmix_delay(AC3DecodeContext *s)
  * @param[in] end_subband subband number for end of range
  * @param[in] default_band_struct default band structure table
  * @param[out] band_struct decoded band structure
- * @param[out] num_subbands number of subbands (optionally NULL)
  * @param[out] num_bands number of bands (optionally NULL)
  * @param[out] band_sizes array containing the number of bins in each band (optionally NULL)
  */
 static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
                                   int ecpl, int start_subband, int end_subband,
                                   const uint8_t *default_band_struct,
-                                  uint8_t *band_struct, int *num_subbands,
+                                  uint8_t *band_struct,
                                   int *num_bands, uint8_t *band_sizes)
 {
     int subbnd, bnd, n_subbands, n_bands=0;
@@ -774,8 +773,6 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
     }
 
     /* set optional output params */
-    if (num_subbands)
-        *num_subbands = n_subbands;
     if (num_bands)
         *num_bands = n_bands;
     if (band_sizes)
@@ -875,8 +872,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
             /* TODO: modify coupling end freq if spectral extension is used */
             cpl_start_subband = get_bits(gbc, 4);
             cpl_end_subband   = get_bits(gbc, 4) + 3;
-            s->num_cpl_subbands = cpl_end_subband - cpl_start_subband;
-            if (s->num_cpl_subbands < 0) {
+            if (cpl_start_subband > cpl_end_subband) {
                 av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d > %d)\n",
                        cpl_start_subband, cpl_end_subband);
                 return -1;
@@ -887,7 +883,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
            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_subbands,
+                                 s->cpl_band_struct,
                                  &s->num_cpl_bands, NULL);
         } else {
             /* coupling not in use */
index bdee7e7..26c3f81 100644 (file)
@@ -82,7 +82,6 @@ typedef struct {
     int channel_in_cpl[AC3_MAX_CHANNELS];   ///< channel in coupling                    (chincpl)
     int phase_flags_in_use;                 ///< phase flags in use                     (phsflginu)
     int phase_flags[18];                    ///< phase flags                            (phsflg)
-    int num_cpl_subbands;                   ///< number of coupling sub bands           (ncplsubnd)
     int num_cpl_bands;                      ///< number of coupling bands               (ncplbnd)
     uint8_t cpl_band_struct[18];            ///< coupling band structure                (cplbndstrc)
     int firstchincpl;                       ///< first channel in coupling