Originally committed as revision 19585 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -724,32 +724,34 @@ static void ac3_upmix_delay(AC3DecodeContext *s) |
| 724 | 724 |
* @param[in] start_subband subband number for start of range |
| 725 | 725 |
* @param[in] end_subband subband number for end of range |
| 726 | 726 |
* @param[in] default_band_struct default band structure table |
| 727 |
- * @param[out] band_struct decoded band structure |
|
| 728 | 727 |
* @param[out] num_bands number of bands (optionally NULL) |
| 729 | 728 |
* @param[out] band_sizes array containing the number of bins in each band (optionally NULL) |
| 730 | 729 |
*/ |
| 731 | 730 |
static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, |
| 732 | 731 |
int ecpl, int start_subband, int end_subband, |
| 733 | 732 |
const uint8_t *default_band_struct, |
| 734 |
- uint8_t *band_struct, int *num_bands, |
|
| 733 |
+ int *num_bands, |
|
| 735 | 734 |
uint8_t *band_sizes) |
| 736 | 735 |
{
|
| 737 | 736 |
int subbnd, bnd, n_subbands, n_bands=0; |
| 738 | 737 |
uint8_t bnd_sz[22]; |
| 738 |
+ uint8_t coded_band_struct[22]; |
|
| 739 |
+ const uint8_t *band_struct; |
|
| 739 | 740 |
|
| 740 | 741 |
n_subbands = end_subband - start_subband; |
| 741 | 742 |
|
| 742 | 743 |
/* decode band structure from bitstream or use default */ |
| 743 | 744 |
if (!eac3 || get_bits1(gbc)) {
|
| 744 | 745 |
for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
|
| 745 |
- band_struct[subbnd] = get_bits1(gbc); |
|
| 746 |
+ coded_band_struct[subbnd] = get_bits1(gbc); |
|
| 746 | 747 |
} |
| 748 |
+ band_struct = coded_band_struct; |
|
| 747 | 749 |
} else if (!blk) {
|
| 748 |
- memcpy(band_struct, |
|
| 749 |
- &default_band_struct[start_subband+1], |
|
| 750 |
- n_subbands-1); |
|
| 750 |
+ band_struct = &default_band_struct[start_subband+1]; |
|
| 751 |
+ } else {
|
|
| 752 |
+ /* no change in band structure */ |
|
| 753 |
+ return; |
|
| 751 | 754 |
} |
| 752 |
- band_struct[n_subbands-1] = 0; |
|
| 753 | 755 |
|
| 754 | 756 |
/* calculate number of bands and band sizes based on band structure. |
| 755 | 757 |
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 | 879 |
decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband, |
| 880 | 880 |
cpl_end_subband, |
| 881 | 881 |
ff_eac3_default_cpl_band_struct, |
| 882 |
- s->cpl_band_struct, &s->num_cpl_bands, |
|
| 882 |
+ &s->num_cpl_bands, |
|
| 883 | 883 |
s->cpl_band_sizes); |
| 884 | 884 |
} else {
|
| 885 | 885 |
/* coupling not in use */ |
| ... | ... |
@@ -82,7 +82,6 @@ typedef struct {
|
| 82 | 82 |
int phase_flags_in_use; ///< phase flags in use (phsflginu) |
| 83 | 83 |
int phase_flags[18]; ///< phase flags (phsflg) |
| 84 | 84 |
int num_cpl_bands; ///< number of coupling bands (ncplbnd) |
| 85 |
- uint8_t cpl_band_struct[18]; ///< coupling band structure (cplbndstrc) |
|
| 86 | 85 |
uint8_t cpl_band_sizes[18]; ///< number of coeffs in each coupling band |
| 87 | 86 |
int firstchincpl; ///< first channel in coupling |
| 88 | 87 |
int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos) |