summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-04-17 12:26:47 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-04-17 12:33:41 -0400
commit4c64c8e95a02b1d69aabb400fa73cba7ef8f41f7 (patch)
tree55cd9f8c552b63a083bd78377f870da358d0be88 /libavcodec/ac3dec.c
parent0b05864eef3d5323ee02515e3b62693230f7e4fb (diff)
ac3dec: fix processing of delta bit allocation information.
The number of dba segments is the coded value + 1. The coupling dba offset starts at the first coupling band, not at zero.
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 396df87fed..015ebaebec 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1173,8 +1173,8 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
/* channel delta offset, len and bit allocation */
for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
if (s->dba_mode[ch] == DBA_NEW) {
- s->dba_nsegs[ch] = get_bits(gbc, 3);
- for (seg = 0; seg <= s->dba_nsegs[ch]; seg++) {
+ s->dba_nsegs[ch] = get_bits(gbc, 3) + 1;
+ for (seg = 0; seg < s->dba_nsegs[ch]; seg++) {
s->dba_offsets[ch][seg] = get_bits(gbc, 5);
s->dba_lengths[ch][seg] = get_bits(gbc, 4);
s->dba_values[ch][seg] = get_bits(gbc, 3);