]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpc8.c
MS Screen 1 decoder
[ffmpeg] / libavcodec / mpc8.c
index 6d4547be489cfd39c3868e74a670f7ada17727b5..f2e8342dcb584bd330de4f502347e6b494457aed 100644 (file)
@@ -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++;
 
@@ -427,5 +428,5 @@ AVCodec ff_mpc8_decoder = {
     .init           = mpc8_decode_init,
     .decode         = mpc8_decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV8"),
 };