Commit a11c16a0 authored by Neil Birkbeck's avatar Neil Birkbeck Committed by Michael Niedermayer

avfilter/vf_psnr: Prevent integer overflow.

The 32-bit integer accumulator in MSE computation can overflow for 8-bit frame data.
(e.g., for 1080p white frame compared to a black frame can give sum of 255*255*1080*1920 > 2^32).
Signed-off-by: 's avatarNeil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 15672e83
......@@ -91,7 +91,7 @@ void compute_images_mse(PSNRContext *s,
const uint8_t *ref_line = ref_data[c];
const int ref_linesize = ref_linesizes[c];
const int main_linesize = main_linesizes[c];
int m = 0;
uint64_t m = 0;
for (i = 0; i < outh; i++) {
for (j = 0; j < outw; j++)
......
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