diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2012-06-04 08:01:34 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2012-06-05 06:55:57 +0200 |
commit | b56825c40ee1329b33aed34ff8a639fa18d263a0 (patch) | |
tree | 5b8953011844187f891d0b04fcdc8a7eaac219ed /libavcodec/mpc8.c | |
parent | 79c8e29a7e404dbcf670df599fad6894f98ccab2 (diff) | |
download | ffmpeg-b56825c40ee1329b33aed34ff8a639fa18d263a0.tar.gz |
mpc8: fix maximum bands handling
In Musepack SV8 codec property tell the maximum nonzero band, but every
frame codes maximum band as a limit (i.e. strictly less than given value).
Synthesis also expects maximum nonzero band, so there's a need to convert
frame maximum band limit value.
Diffstat (limited to 'libavcodec/mpc8.c')
-rw-r--r-- | libavcodec/mpc8.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index f682edbed7..f2e8342dcb 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -270,7 +270,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2); if(maxband > 32) maxband -= 33; } - if(maxband > c->maxbands) + if(maxband > c->maxbands + 1) return AVERROR_INVALIDDATA; c->last_max_band = maxband; @@ -405,7 +405,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, } } - ff_mpc_dequantize_and_synth(c, maxband, c->frame.data[0], avctx->channels); + ff_mpc_dequantize_and_synth(c, maxband - 1, c->frame.data[0], + avctx->channels); c->cur_frame++; |