Mercurial > libavcodec.hg
comparison ac3dec.c @ 6123:8d88831a2777 libavcodec
fix phase flag processing for the case when coupling coordinates are reused
for the right channel, but new for the left channel
author | jbr |
---|---|
date | Sun, 06 Jan 2008 20:15:24 +0000 |
parents | 01b1342e717b |
children | d06c62429572 |
comparison
equal
deleted
inserted
replaced
6122:61f95f3a62e0 | 6123:8d88831a2777 |
---|---|
131 int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags | 131 int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags |
132 int dither_all; ///< true if all channels are dithered | 132 int dither_all; ///< true if all channels are dithered |
133 int cpl_in_use; ///< coupling in use | 133 int cpl_in_use; ///< coupling in use |
134 int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling | 134 int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling |
135 int phase_flags_in_use; ///< phase flags in use | 135 int phase_flags_in_use; ///< phase flags in use |
136 int phase_flags[18]; ///< phase flags | |
136 int cpl_band_struct[18]; ///< coupling band structure | 137 int cpl_band_struct[18]; ///< coupling band structure |
137 int rematrixing_strategy; ///< rematrixing strategy | 138 int rematrixing_strategy; ///< rematrixing strategy |
138 int num_rematrixing_bands; ///< number of rematrixing bands | 139 int num_rematrixing_bands; ///< number of rematrixing bands |
139 int rematrixing_flags[4]; ///< rematrixing flags | 140 int rematrixing_flags[4]; ///< rematrixing flags |
140 int exp_strategy[AC3_MAX_CHANNELS]; ///< exponent strategies | 141 int exp_strategy[AC3_MAX_CHANNELS]; ///< exponent strategies |
468 for(bnd=0; bnd<s->num_cpl_bands; bnd++) { | 469 for(bnd=0; bnd<s->num_cpl_bands; bnd++) { |
469 do { | 470 do { |
470 subbnd++; | 471 subbnd++; |
471 for(j=0; j<12; j++) { | 472 for(j=0; j<12; j++) { |
472 for(ch=1; ch<=s->fbw_channels; ch++) { | 473 for(ch=1; ch<=s->fbw_channels; ch++) { |
473 if(s->channel_in_cpl[ch]) | 474 if(s->channel_in_cpl[ch]) { |
474 s->transform_coeffs[ch][i] = s->transform_coeffs[CPL_CH][i] * s->cpl_coords[ch][bnd] * 8.0f; | 475 s->transform_coeffs[ch][i] = s->transform_coeffs[CPL_CH][i] * s->cpl_coords[ch][bnd] * 8.0f; |
476 if (ch == 2 && s->phase_flags[bnd]) | |
477 s->transform_coeffs[ch][i] = -s->transform_coeffs[ch][i]; | |
478 } | |
475 } | 479 } |
476 i++; | 480 i++; |
477 } | 481 } |
478 } while(s->cpl_band_struct[subbnd]); | 482 } while(s->cpl_band_struct[subbnd]); |
479 } | 483 } |
864 } | 868 } |
865 } | 869 } |
866 } | 870 } |
867 } | 871 } |
868 /* phase flags */ | 872 /* phase flags */ |
869 if (channel_mode == AC3_CHMODE_STEREO && s->phase_flags_in_use && cpl_coords_exist) { | 873 if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) { |
870 for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { | 874 for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { |
871 if (get_bits1(gbc)) | 875 s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0; |
872 s->cpl_coords[2][bnd] = -s->cpl_coords[2][bnd]; | |
873 } | 876 } |
874 } | 877 } |
875 } | 878 } |
876 | 879 |
877 /* stereo rematrixing strategy and band structure */ | 880 /* stereo rematrixing strategy and band structure */ |