/* LPC prediction */
for (j = 0; j < lpc_order; j++)
val += (pred[j] - d) * lpc_coefs[j];
- val = (val + (1 << (lpc_quant - 1))) >> lpc_quant;
+ val = (val + (1LL << (lpc_quant - 1))) >> lpc_quant;
val += d + error_val;
buffer_out[i] = sign_extend(val, bps);
/* adapt LPC coefficients */
error_sign = sign_only(error_val);
if (error_sign) {
- for (j = 0; j < lpc_order && (int)error_val * error_sign > 0; j++) {
+ for (j = 0; j < lpc_order && (int)(error_val * error_sign) > 0; j++) {
int sign;
val = d - pred[j];
sign = sign_only(val) * error_sign;
alac->extra_bits = get_bits(&alac->gb, 2) << 3;
bps = alac->sample_size - alac->extra_bits + channels - 1;
- if (bps > 32U) {
+ if (bps > 32) {
avpriv_report_missing_feature(avctx, "bps %d", bps);
return AVERROR_PATCHWELCOME;
}
+ if (bps < 1)
+ return AVERROR_INVALIDDATA;
/* whether the frame is compressed */
is_compressed = !get_bits1(&alac->gb);
case 20: {
for (ch = 0; ch < channels; ch++) {
for (i = 0; i < alac->nb_samples; i++)
- alac->output_samples_buffer[ch][i] <<= 12;
+ alac->output_samples_buffer[ch][i] *= 1 << 12;
}}
break;
case 24: {
for (ch = 0; ch < channels; ch++) {
for (i = 0; i < alac->nb_samples; i++)
- alac->output_samples_buffer[ch][i] <<= 8;
+ alac->output_samples_buffer[ch][i] *= 1 << 8;
}}
break;
}