diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2008-11-13 03:17:56 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2008-11-13 03:17:56 +0000 |
commit | 6ee6d068f759aabe10a65ca3f19b636b83930277 (patch) | |
tree | 2c592859ed11aff2373ec11d57c5cf1a95bfea46 | |
parent | 24834c19288017a536bea13b6d9300d18cdbc62b (diff) | |
download | ffmpeg-6ee6d068f759aabe10a65ca3f19b636b83930277.tar.gz |
simplify decoding of coupling frequency range
Originally committed as revision 15809 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/ac3dec.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index b6a6272689..d5011ff7f6 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -802,16 +802,18 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) /* coupling frequency range */ /* TODO: modify coupling end freq if spectral extension is used */ cpl_start_subband = get_bits(gbc, 4); - cpl_end_subband = get_bits(gbc, 4); - if (3 + cpl_end_subband - cpl_start_subband < 0) { - av_log(s->avctx, AV_LOG_ERROR, "3+cplendf = %d < cplbegf = %d\n", 3+cpl_end_subband, cpl_start_subband); + cpl_end_subband = get_bits(gbc, 4) + 3; + s->num_cpl_subbands = cpl_end_subband - cpl_start_subband; + if (s->num_cpl_subbands < 0) { + av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d > %d)\n", + cpl_start_subband, cpl_end_subband); return -1; } - s->num_cpl_bands = s->num_cpl_subbands = 3 + cpl_end_subband - cpl_start_subband; s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37; - s->end_freq[CPL_CH] = cpl_end_subband * 12 + 73; + s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37; /* coupling band structure */ + s->num_cpl_bands = s->num_cpl_subbands; if (!s->eac3 || get_bits1(gbc)) { for (bnd = 0; bnd < s->num_cpl_subbands - 1; bnd++) { s->cpl_band_struct[bnd] = get_bits1(gbc); |