static inline int mpc8_dec_base(GetBitContext *gb, int k, int n)
{
- int code = get_bits(gb, mpc8_cnk_len[k-1][n-1] - 1);
+ int len = mpc8_cnk_len[k-1][n-1] - 1;
+ int code = len ? get_bits_long(gb, len) : 0;
if (code >= mpc8_cnk_lost[k-1][n-1])
code = ((code << 1) | get_bits1(gb)) - mpc8_cnk_lost[k-1][n-1];
return mask;
}
-static int vlc_offsets[13] = {
+static const uint16_t vlc_offsets[13] = {
0, 640, 1184, 1748, 2298, 2426, 2554, 3066, 3578, 4106, 4618, 5196, 5708
};
c->MSS = get_bits1(&gb);
c->frames = 1 << (get_bits(&gb, 3) * 2);
+ avctx->sample_fmt = SAMPLE_FMT_S16;
+ avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+
if(vlc_initialized) return 0;
av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
&mpc8_q8_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
}
vlc_initialized = 1;
- avctx->sample_fmt = SAMPLE_FMT_S16;
- avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
return 0;
}
AVCodec mpc8_decoder = {
"mpc8",
- CODEC_TYPE_AUDIO,
+ AVMEDIA_TYPE_AUDIO,
CODEC_ID_MUSEPACK8,
sizeof(MPCContext),
mpc8_decode_init,