Mercurial > libavcodec.hg
comparison ac3dec.c @ 9607:6d3d3df92a4e libavcodec
ac3dec: Remove unneeded context variable, num_cpl_subbands. It is also
not needed for spectral extension or enhanced coupling since it is
redundant information, so I am removing it from decode_band_structure()
as well.
author | jbr |
---|---|
date | Wed, 06 May 2009 01:47:34 +0000 |
parents | 31090f08314e |
children | f3c6d57a50aa |
comparison
equal
deleted
inserted
replaced
9606:31090f08314e | 9607:6d3d3df92a4e |
---|---|
727 * @param[in] ecpl flag to indicate enhanced coupling | 727 * @param[in] ecpl flag to indicate enhanced coupling |
728 * @param[in] start_subband subband number for start of range | 728 * @param[in] start_subband subband number for start of range |
729 * @param[in] end_subband subband number for end of range | 729 * @param[in] end_subband subband number for end of range |
730 * @param[in] default_band_struct default band structure table | 730 * @param[in] default_band_struct default band structure table |
731 * @param[out] band_struct decoded band structure | 731 * @param[out] band_struct decoded band structure |
732 * @param[out] num_subbands number of subbands (optionally NULL) | |
733 * @param[out] num_bands number of bands (optionally NULL) | 732 * @param[out] num_bands number of bands (optionally NULL) |
734 * @param[out] band_sizes array containing the number of bins in each band (optionally NULL) | 733 * @param[out] band_sizes array containing the number of bins in each band (optionally NULL) |
735 */ | 734 */ |
736 static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, | 735 static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, |
737 int ecpl, int start_subband, int end_subband, | 736 int ecpl, int start_subband, int end_subband, |
738 const uint8_t *default_band_struct, | 737 const uint8_t *default_band_struct, |
739 uint8_t *band_struct, int *num_subbands, | 738 uint8_t *band_struct, |
740 int *num_bands, uint8_t *band_sizes) | 739 int *num_bands, uint8_t *band_sizes) |
741 { | 740 { |
742 int subbnd, bnd, n_subbands, n_bands=0; | 741 int subbnd, bnd, n_subbands, n_bands=0; |
743 uint8_t bnd_sz[22]; | 742 uint8_t bnd_sz[22]; |
744 | 743 |
772 } | 771 } |
773 } | 772 } |
774 } | 773 } |
775 | 774 |
776 /* set optional output params */ | 775 /* set optional output params */ |
777 if (num_subbands) | |
778 *num_subbands = n_subbands; | |
779 if (num_bands) | 776 if (num_bands) |
780 *num_bands = n_bands; | 777 *num_bands = n_bands; |
781 if (band_sizes) | 778 if (band_sizes) |
782 memcpy(band_sizes, bnd_sz, n_bands); | 779 memcpy(band_sizes, bnd_sz, n_bands); |
783 } | 780 } |
873 | 870 |
874 /* coupling frequency range */ | 871 /* coupling frequency range */ |
875 /* TODO: modify coupling end freq if spectral extension is used */ | 872 /* TODO: modify coupling end freq if spectral extension is used */ |
876 cpl_start_subband = get_bits(gbc, 4); | 873 cpl_start_subband = get_bits(gbc, 4); |
877 cpl_end_subband = get_bits(gbc, 4) + 3; | 874 cpl_end_subband = get_bits(gbc, 4) + 3; |
878 s->num_cpl_subbands = cpl_end_subband - cpl_start_subband; | 875 if (cpl_start_subband > cpl_end_subband) { |
879 if (s->num_cpl_subbands < 0) { | |
880 av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d > %d)\n", | 876 av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d > %d)\n", |
881 cpl_start_subband, cpl_end_subband); | 877 cpl_start_subband, cpl_end_subband); |
882 return -1; | 878 return -1; |
883 } | 879 } |
884 s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37; | 880 s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37; |
885 s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37; | 881 s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37; |
886 | 882 |
887 decode_band_structure(gbc, blk, s->eac3, 0, | 883 decode_band_structure(gbc, blk, s->eac3, 0, |
888 cpl_start_subband, cpl_end_subband, | 884 cpl_start_subband, cpl_end_subband, |
889 ff_eac3_default_cpl_band_struct, | 885 ff_eac3_default_cpl_band_struct, |
890 s->cpl_band_struct, &s->num_cpl_subbands, | 886 s->cpl_band_struct, |
891 &s->num_cpl_bands, NULL); | 887 &s->num_cpl_bands, NULL); |
892 } else { | 888 } else { |
893 /* coupling not in use */ | 889 /* coupling not in use */ |
894 for (ch = 1; ch <= fbw_channels; ch++) { | 890 for (ch = 1; ch <= fbw_channels; ch++) { |
895 s->channel_in_cpl[ch] = 0; | 891 s->channel_in_cpl[ch] = 0; |