aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-01-06 20:15:24 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-01-06 20:15:24 +0000
commitb02fbf7536c0f6ed505335e05a65f123adec1ac8 (patch)
treeff68b8bf1ec54e3f8e07cd395065a142698282f7 /libavcodec/ac3dec.c
parent621d7fe936f8f34fff059b2a52f5ab72707e8e95 (diff)
downloadffmpeg-b02fbf7536c0f6ed505335e05a65f123adec1ac8.tar.gz
fix phase flag processing for the case when coupling coordinates are reused
for the right channel, but new for the left channel Originally committed as revision 11436 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 76cf1add0e..438cc65a42 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -133,6 +133,7 @@ typedef struct {
int cpl_in_use; ///< coupling in use
int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling
int phase_flags_in_use; ///< phase flags in use
+ int phase_flags[18]; ///< phase flags
int cpl_band_struct[18]; ///< coupling band structure
int rematrixing_strategy; ///< rematrixing strategy
int num_rematrixing_bands; ///< number of rematrixing bands
@@ -470,8 +471,11 @@ static void uncouple_channels(AC3DecodeContext *s)
subbnd++;
for(j=0; j<12; j++) {
for(ch=1; ch<=s->fbw_channels; ch++) {
- if(s->channel_in_cpl[ch])
+ if(s->channel_in_cpl[ch]) {
s->transform_coeffs[ch][i] = s->transform_coeffs[CPL_CH][i] * s->cpl_coords[ch][bnd] * 8.0f;
+ if (ch == 2 && s->phase_flags[bnd])
+ s->transform_coeffs[ch][i] = -s->transform_coeffs[ch][i];
+ }
}
i++;
}
@@ -866,10 +870,9 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
}
}
/* phase flags */
- if (channel_mode == AC3_CHMODE_STEREO && s->phase_flags_in_use && cpl_coords_exist) {
+ if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) {
for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
- if (get_bits1(gbc))
- s->cpl_coords[2][bnd] = -s->cpl_coords[2][bnd];
+ s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0;
}
}
}