s->bit_rate = avctx->bit_rate;
s->block_align = avctx->block_align;
- if (avctx->codec_id == CODEC_ID_WMAV1) {
+ if (avctx->codec->id == CODEC_ID_WMAV1) {
s->version = 1;
} else {
s->version = 2;
}
s->frame_len = 1 << s->frame_len_bits;
if (s->use_variable_block_len) {
- s->nb_block_sizes = s->frame_len_bits - BLOCK_MIN_BITS + 1;
+ int nb_max, nb;
+ nb = ((flags2 >> 3) & 3) + 1;
+ if ((s->bit_rate / s->nb_channels) >= 32000)
+ nb += 2;
+ nb_max = s->frame_len_bits - BLOCK_MIN_BITS;
+ if (nb > nb_max)
+ nb = nb_max;
+ s->nb_block_sizes = nb + 1;
} else {
s->nb_block_sizes = 1;
}
s->block_align);
printf("bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
bps, bps1, high_freq, s->byte_offset_bits);
- printf("use_noise_coding=%d use_exp_vlc=%d\n",
- s->use_noise_coding, s->use_exp_vlc);
+ printf("use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
+ s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes);
#endif
/* compute the scale factor band sizes for each MDCT block size */