ref: 89375f0315cf961493f535e900d35cb67d00d9e1
parent: d2a5e26359bec7fd4137e9cd005ff39375afb41c
parent: 5eeabfffcb9eb03d8f52693f6201380ec7110818
author: Debargha Mukherjee <debargha@google.com>
date: Mon Dec 2 21:29:30 EST 2019
Merge "Avoid dividing by 0 in vp8 gf_group bits compute"
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -2072,9 +2072,10 @@
* score, otherwise it may be worse off than an "un-boosted" frame
*/
else {
+ // Avoid division by 0 by clamping cpi->twopass.kf_group_error_left to 1
int alt_gf_bits =
(int)((double)cpi->twopass.kf_group_bits * mod_frame_err /
- DOUBLE_DIVIDE_CHECK((double)cpi->twopass.kf_group_error_left));
+ (double)VPXMAX(cpi->twopass.kf_group_error_left, 1));
if (alt_gf_bits > gf_bits) {
gf_bits = alt_gf_bits;