Set prev_candidate_undecided in anim_enc

When the next frame is forced to be a keyframe by setting
enc->best_delta to DELTA_INFINITY, setting enc->keyframe to NONE means
the current frame will never be converted from a candidate keyframe to
a subframe. So enc->prev_candidate_undecided should be set to 0.
This is a no-op change because enc->prev_candidate_undecided is only
used to update prev_rect and dispose method, which is of no value when
the next frame is a key frame.

Change-Id: Ie51c7e3b6ba797b75af5e06439e8568d8185693f
This commit is contained in:
Yannis Guyon
2025-07-29 07:48:02 +00:00
parent ab0a07fcf5
commit bfea600a5f

View File

@@ -1262,10 +1262,13 @@ static int CacheFrame(WebPAnimEncoder* const enc,
// Note: We need '>=' below because when kmin and kmax are both zero, // Note: We need '>=' below because when kmin and kmax are both zero,
// count_since_key_frame will always be > kmax. // count_since_key_frame will always be > kmax.
if (enc->count_since_key_frame >= enc->options.kmax) { if (enc->count_since_key_frame >= enc->options.kmax) {
// Force the next frame to be a key frame.
enc->best_delta = DELTA_INFINITY;
// Flush all encoded frames.
enc->flush_count = enc->count - 1; enc->flush_count = enc->count - 1;
enc->count_since_key_frame = 0; enc->count_since_key_frame = 0;
enc->prev_candidate_undecided = 0;
enc->keyframe = KEYFRAME_NONE; enc->keyframe = KEYFRAME_NONE;
enc->best_delta = DELTA_INFINITY;
} }
if (!enc->prev_candidate_undecided) { if (!enc->prev_candidate_undecided) {
enc->prev_rect = enc->prev_rect =