Fix unsigned overflow in rd_variance_adjustment.

Found with clang -fsanitize=integer

Change-Id: I2538e7483cb2d5f06bceecbd3326bdd88bfecfa1
This commit is contained in:
Alex Converse 2015-11-19 14:53:51 -08:00
Родитель f3f6b6fe3e
Коммит b1fcd1751e
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -3017,9 +3017,9 @@ static void rd_variance_adjustment(VP10_COMP *cpi,
? (source_variance - recon_variance)
: (recon_variance - source_variance);
var_error = (200 * source_variance * recon_variance) /
((source_variance * source_variance) +
(recon_variance * recon_variance));
var_error = ((int64_t)200 * source_variance * recon_variance) /
(((int64_t)source_variance * source_variance) +
((int64_t)recon_variance * recon_variance));
var_error = 100 - var_error;
}

Просмотреть файл

@ -2831,9 +2831,9 @@ static void rd_variance_adjustment(VP9_COMP *cpi,
? (source_variance - recon_variance)
: (recon_variance - source_variance);
var_error = (200 * source_variance * recon_variance) /
((source_variance * source_variance) +
(recon_variance * recon_variance));
var_error = ((int64_t)200 * source_variance * recon_variance) /
(((int64_t)source_variance * source_variance) +
((int64_t)recon_variance * recon_variance));
var_error = 100 - var_error;
}