Commit 9bec6c9d authored by jbr's avatar jbr

Modify decode_band_structure() so that the actual band structure is only

used within the function.  This removes the need to have the coupling band 
structure stored in the AC3DecodeContext.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19585 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 2d296371
...@@ -724,32 +724,34 @@ static void ac3_upmix_delay(AC3DecodeContext *s) ...@@ -724,32 +724,34 @@ static void ac3_upmix_delay(AC3DecodeContext *s)
* @param[in] start_subband subband number for start of range * @param[in] start_subband subband number for start of range
* @param[in] end_subband subband number for end of range * @param[in] end_subband subband number for end of range
* @param[in] default_band_struct default band structure table * @param[in] default_band_struct default band structure table
* @param[out] band_struct decoded band structure
* @param[out] num_bands number of bands (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) * @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, static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
int ecpl, int start_subband, int end_subband, int ecpl, int start_subband, int end_subband,
const uint8_t *default_band_struct, const uint8_t *default_band_struct,
uint8_t *band_struct, int *num_bands, int *num_bands,
uint8_t *band_sizes) uint8_t *band_sizes)
{ {
int subbnd, bnd, n_subbands, n_bands=0; int subbnd, bnd, n_subbands, n_bands=0;
uint8_t bnd_sz[22]; uint8_t bnd_sz[22];
uint8_t coded_band_struct[22];
const uint8_t *band_struct;
n_subbands = end_subband - start_subband; n_subbands = end_subband - start_subband;
/* decode band structure from bitstream or use default */ /* decode band structure from bitstream or use default */
if (!eac3 || get_bits1(gbc)) { if (!eac3 || get_bits1(gbc)) {
for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) { for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
band_struct[subbnd] = get_bits1(gbc); coded_band_struct[subbnd] = get_bits1(gbc);
} }
band_struct = coded_band_struct;
} else if (!blk) { } else if (!blk) {
memcpy(band_struct, band_struct = &default_band_struct[start_subband+1];
&default_band_struct[start_subband+1], } else {
n_subbands-1); /* no change in band structure */
return;
} }
band_struct[n_subbands-1] = 0;
/* calculate number of bands and band sizes based on band structure. /* calculate number of bands and band sizes based on band structure.
note that the first 4 subbands in enhanced coupling span only 6 bins note that the first 4 subbands in enhanced coupling span only 6 bins
...@@ -879,7 +881,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) ...@@ -879,7 +881,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband, decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband,
cpl_end_subband, cpl_end_subband,
ff_eac3_default_cpl_band_struct, ff_eac3_default_cpl_band_struct,
s->cpl_band_struct, &s->num_cpl_bands, &s->num_cpl_bands,
s->cpl_band_sizes); s->cpl_band_sizes);
} else { } else {
/* coupling not in use */ /* coupling not in use */
......
...@@ -82,7 +82,6 @@ typedef struct { ...@@ -82,7 +82,6 @@ typedef struct {
int phase_flags_in_use; ///< phase flags in use (phsflginu) int phase_flags_in_use; ///< phase flags in use (phsflginu)
int phase_flags[18]; ///< phase flags (phsflg) int phase_flags[18]; ///< phase flags (phsflg)
int num_cpl_bands; ///< number of coupling bands (ncplbnd) 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 uint8_t cpl_band_sizes[18]; ///< number of coeffs in each coupling band
int firstchincpl; ///< first channel in coupling int firstchincpl; ///< first channel in coupling
int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos) int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment