History

Avoid dividing by 0 in vp8 gf_group bits compute

BUG=webm:1653

Debargha Mukherjee committed 6 years ago

Commit 5eeabff1 parent 2ba45e81 file · +2 −1Browse files

Unified · Split

vp8/encoder/firstpass.c+2−1
@@ -2072,9 +2072,10 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) { · 2071 unmodified lines
2072 * score, otherwise it may be worse off than an "un-boosted" frame2072 * score, otherwise it may be worse off than an "un-boosted" frame
2073 */2073 */
2074 else {2074 else {
2075 // Avoid division by 0 by clamping cpi->twopass.kf_group_error_left to 1
2075 int alt_gf_bits =2076 int alt_gf_bits =
2076 (int)((double)cpi->twopass.kf_group_bits * mod_frame_err /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 if (alt_gf_bits > gf_bits) {2080 if (alt_gf_bits > gf_bits) {
2080 gf_bits = alt_gf_bits;2081 gf_bits = alt_gf_bits;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t