Closed Bug 1511290 Opened 6 years ago Closed 5 years ago

GIF animation frame delay used for multiple frame instead of next block only

Categories

(Core :: Graphics: ImageLib, defect, P3)

63 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: robert.ancell, Assigned: aosmond)

Details

Attachments

(3 files, 1 obsolete file)

Attached image animation-multi-image.gif (obsolete) —
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0 Steps to reproduce: I have generated a GIF image (attached) that contain the following data: Version: b'GIF89a' Size: 2x2 pixels Original Depth: 8 bits Colors (4): #000000, #ffffff, #ff0000, #00ff00 Background Color: #000000 (0) Netscape Extension: Loop Count: 0 Graphic Control Extension: Delay Time: 50/100 ms Disposal Method: keep User Input: False Image: Size: 2x2 Pixels (4, code-size=3): [1, 0, 0, 0] Image: Position: 1,0 Size: 1x1 Pixels (1, code-size=3): [2] Graphic Control Extension: Delay Time: 50/100 ms Disposal Method: keep User Input: False Image: Position: 1,0 Size: 1x1 Pixels (1, code-size=3): [1] Image: Position: 1,1 Size: 1x1 Pixels (1, code-size=3): [2] Graphic Control Extension: Delay Time: 50/100 ms Disposal Method: keep User Input: False Image: Position: 1,1 Size: 1x1 Pixels (1, code-size=3): [1] Image: Position: 0,1 Size: 1x1 Pixels (1, code-size=3): [2] Graphic Control Extension: Delay Time: 50/100 ms Disposal Method: keep User Input: False Image: Position: 0,1 Size: 1x1 Pixels (1, code-size=3): [1] The GIF specification (https://www.w3.org/Graphics/GIF/spec-gif89a.txt) states for the Graphic Control Extension "The scope of this extension is the first graphic rendering block to follow". The generated GIF has a delay set only on some images, the others should have the default behaviour (no delay). Actual results: The animation shows 7 frames, with the red pixels being shown for the same time as the white pixels (total time 3.5s). Expected results: The animation should show only four frames, with no red visible (total time 2s). Testing in Google Chrome shows that is is correctly applying the 0.5s delay only to the images that follow the Graphic Control Extension, with the other frames showing briefly due to a minimum delay being enforced (Firefox is doing this too).
I found this behaviour due to writing a a GIF test suite [1], please let me know if this might be of use in Firefox or if there are any particular cases that I could add. [1] https://github.com/robert-ancell/pygif/tree/master/test-suite
See bug 1511298 about related issue of non-zero delay.
This is a larger image showing the issue, generated with the following code: #!/usr/bin/python import gif width = 40 height = 40 writer = gif.Writer (open ('animate-delay-not-reset.gif', 'wb')) writer.write_header () writer.write_screen_descriptor (2*width, 2*height, has_color_table = True, depth = 2) writer.write_color_table ([(0, 0, 0), (255, 255, 255), (255, 0, 0), (0, 255, 0)], 2) writer.write_netscape_extension (loop_count = 0) writer.write_graphic_control_extension (gif.DisposalMethod.KEEP, delay_time = 50) writer.write_image (2*width, 2*height, 2, ([ 1 ] * width + [ 0 ] * width) * height + [ 0 ] * (2 * width) * height) writer.write_image (width, height, 2, [ 2 ] * width * height, width, 0) writer.write_graphic_control_extension (gif.DisposalMethod.KEEP, delay_time = 50) writer.write_image (width, height, 2, [ 1 ] * width * height, width, 0) writer.write_image (width, height, 2, [ 2 ] * width * height, width, height) writer.write_graphic_control_extension (gif.DisposalMethod.KEEP, delay_time = 50) writer.write_image (width, height, 2, [ 1 ] * width * height, width, height) writer.write_image (width, height, 2, [ 2 ] * width * height, 0, height) writer.write_graphic_control_extension (gif.DisposalMethod.KEEP, delay_time = 50) writer.write_image (width, height, 2, [ 1 ] * width * height, 0, height) writer.write_trailer ()
Attachment #9028863 - Attachment is obsolete: true
Attachment #9028871 - Attachment description: animate-delay-not-reset.gif → Animation that shows the graphic control extension being applied to images it shouldn't (the red frames in the image).
Flags: needinfo?(aosmond)
Priority: -- → P3

I confirmed the behaviour difference with Chrome. In nsGIFDecoder2::EndImageFrame, we should probably reset mGIFStruct.delay_time to 0.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(aosmond)
Assignee: nobody → aosmond
OS: Unspecified → All
Hardware: Unspecified → All
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d83d88a474ce Reset the GIF frame delay time between frames. r=tnikkel
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
QA Whiteboard: [qa-73b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: