fix infinite loop in case of PARTITION0 overflow

max_i4_header_bits_ could drop to zero for difficult image and trigger
a loop. Surprisingly, StatLoop() didn't have this bug.

Change-Id: Idc0f9eadef30a2b2f02041b994f25def30901e36
(cherry picked from commit 21e7537abe)
This commit is contained in:
Pascal Massimino 2016-09-15 02:38:28 -07:00 committed by James Zern
parent 532215dd29
commit 31fe11a57a

View File

@ -816,7 +816,7 @@ int VP8EncTokenLoop(VP8Encoder* const enc) {
num_pass_left, stats.last_value, stats.value, num_pass_left, stats.last_value, stats.value,
stats.last_q, stats.q, stats.dq); stats.last_q, stats.q, stats.dq);
#endif #endif
if (size_p0 > PARTITION0_SIZE_LIMIT) { if (enc->max_i4_header_bits_ > 0 && size_p0 > PARTITION0_SIZE_LIMIT) {
++num_pass_left; ++num_pass_left;
enc->max_i4_header_bits_ >>= 1; // strengthen header bit limitation... enc->max_i4_header_bits_ >>= 1; // strengthen header bit limitation...
continue; // ...and start over continue; // ...and start over