aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-06-04 08:01:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-07 00:55:26 +0200
commit7d979364953c7c8b2db5083627f6111cbaaf4ac0 (patch)
treefe13f7e264ff9bf97f8f7c1a5cbf28545271f2ab
parentf9fc08de658bd06278a77636a1a5d2c9fbe7d277 (diff)
downloadffmpeg-7d979364953c7c8b2db5083627f6111cbaaf4ac0.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. (cherry picked from commit b56825c40ee1329b33aed34ff8a639fa18d263a0) Conflicts: libavcodec/mpc8.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpc8.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 652e824843..3970761195 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -275,7 +275,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 >= BANDS) {
+ if(maxband > c->maxbands + 1) {
av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband);
return AVERROR_INVALIDDATA;
}
@@ -412,7 +412,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++;