Commit 7d979364 authored by Kostya Shishkov's avatar Kostya Shishkov Committed by Michael Niedermayer
Browse files

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 b56825c4

)

Conflicts:

	libavcodec/mpc8.c
Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent f9fc08de
Showing with 3 additions and 2 deletions
+3 -2
......@@ -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++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment