Commit 0ea099ad authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpegvideo_enc: fix undefined shifts in ff_dct_quantize_c()

Fixes: signal_sigsegv_35eac16_2762_cov_2704249783_missing_frames.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 56fd4705
......@@ -4559,12 +4559,12 @@ int ff_dct_quantize_c(MpegEncContext *s,
start_i = 1;
last_non_zero = 0;
qmat = n < 4 ? s->q_intra_matrix[qscale] : s->q_chroma_intra_matrix[qscale];
bias= s->intra_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT);
bias= s->intra_quant_bias*(1<<(QMAT_SHIFT - QUANT_BIAS_SHIFT));
} else {
start_i = 0;
last_non_zero = -1;
qmat = s->q_inter_matrix[qscale];
bias= s->inter_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT);
bias= s->inter_quant_bias*(1<<(QMAT_SHIFT - QUANT_BIAS_SHIFT));
}
threshold1= (1<<QMAT_SHIFT) - bias - 1;
threshold2= (threshold1<<1);
......
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