BUG=webm:1653
Unified · Split
| @@ -2072,9 +2072,10 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) { · 2071 unmodified lines | ||
| 2072 | 2072 | * score, otherwise it may be worse off than an "un-boosted" frame |
| 2073 | 2073 | */ |
| 2074 | 2074 | else { |
| 2075 | + // Avoid division by 0 by clamping cpi->twopass.kf_group_error_left to 1 | |
| 2075 | 2076 | int alt_gf_bits = |
| 2076 | 2077 | (int)((double)cpi->twopass.kf_group_bits * mod_frame_err / |
| 2077 | − DOUBLE_DIVIDE_CHECK((double)cpi->twopass.kf_group_error_left)); | |
| 2078 | + (double)VPXMAX(cpi->twopass.kf_group_error_left, 1)); | |
| 2078 | 2079 | |
| 2079 | 2080 | if (alt_gf_bits > gf_bits) { |
| 2080 | 2081 | gf_bits = alt_gf_bits; |