mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
gif2webp: force low duration frames to 100ms
this is consistent with web browser behavior as well as various transcoding tools (ffmpeg, gif2apng, etc). also: update anim_diff to account for this new behaviour. BUG=webp:379 Change-Id: I70cc72a6b401ef32b73cd182a3f12d993d495bf4
This commit is contained in:
committed by
Pascal Massimino
parent
b2db361ca6
commit
09333097ed
@ -361,6 +361,14 @@ int main(int argc, const char *argv[]) {
|
||||
GIFDisposeFrame(orig_dispose, &gif_rect, &prev_canvas, &curr_canvas);
|
||||
GIFCopyPixels(&curr_canvas, &prev_canvas);
|
||||
|
||||
// Force frames with a small or no duration to 100ms to be consistent
|
||||
// with web browsers and other transcoding tools. This also avoids
|
||||
// incorrect durations between frames when padding frames are
|
||||
// discarded.
|
||||
if (frame_duration <= 10) {
|
||||
frame_duration = 100;
|
||||
}
|
||||
|
||||
// Update timestamp (for next frame).
|
||||
frame_timestamp += frame_duration;
|
||||
|
||||
|
Reference in New Issue
Block a user