Fix comment in anim_encode for key frame candidate

Change-Id: I12804097a5ea5025cb4a019a247371db761dab66
This commit is contained in:
Yannis Guyon
2025-07-29 12:52:38 +00:00
parent bfea600a5f
commit 3a55b076c9

View File

@@ -1262,13 +1262,16 @@ 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. // Start a new sequence of kmin sub-frames, followed by (kmax-kmin)
enc->best_delta = DELTA_INFINITY; // candidate frames. Exactly one of these candidate frames will end up
// Flush all encoded frames. // as a key-frame in the output encoded animation.
enc->flush_count = enc->count - 1;
enc->count_since_key_frame = 0; enc->count_since_key_frame = 0;
enc->best_delta = DELTA_INFINITY;
// Freeze the previous candidate, whether it is a key-frame or not.
enc->prev_candidate_undecided = 0; enc->prev_candidate_undecided = 0;
enc->keyframe = KEYFRAME_NONE; enc->keyframe = KEYFRAME_NONE;
// Flush all previous frames.
enc->flush_count = enc->count - 1;
} }
if (!enc->prev_candidate_undecided) { if (!enc->prev_candidate_undecided) {
enc->prev_rect = enc->prev_rect =