Factor test/data/artificial into many directories

This commit is contained in:
Nigel Tao committed 2021-11-16 15:37:57 +11:00
1 parent 37ac4def8e
commit 3642d73714
53 files changed
+49 -49

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

@@ -0,0 +1,34 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 4 1
backgroundColorIndex 3
palette {
0x80 0x00 0x00
0x80 0x00 0xC1
0x80 0xC2 0x00
0x80 0xC3 0xC3
}
}
loopCount 1
graphicControl animationDisposalRestoreBackground 100ms
frame {
frameLeftTopWidthHeight 0 0 2 1
}
lzw 2 0x00 0x01
graphicControl animationDisposalRestoreBackground 200ms
frame {
frameLeftTopWidthHeight 2 0 1 1
}
lzw 2 0x02
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

@@ -0,0 +1,33 @@
# Feed this file to script/make-artificial.go
# This GIF image has two frames. There is no global palette, and only the first
# frame has a local palette.
#
# Wuffs implicitly gives the second frame an all-opaque-black palette by
# default. Wuffs can be configured to reject it instead, by enabling a 'quirk'.
make gif
header
image {
imageWidthHeight 1 1
}
frame {
frameLeftTopWidthHeight 0 0 1 1
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
lzw 2 0x00
frame {
frameLeftTopWidthHeight 0 0 1 1
}
lzw 2 0x00
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

@@ -0,0 +1,100 @@
# Feed this file to script/make-artificial.go
# This GIF image contains four frames, each of which are outside the nominal
# image's bounds: (0, 0) - (2, 2):
#
# - frame #0 has bounds (1, 0) - (4, 1).
# - frame #1 has bounds (0, 1) - (2, 3).
# - frame #2 has bounds (0, 4) - (1, 5).
# - frame #3 has bounds (2, 0) - (6, 3).
#
# Here are some (but not all) possible decoding policies:
#
# 0. Reject it.
# 1. Keep the image width×height at 2×2, clip all of the frames.
# 2. Adjust the image width×height to 3×1, the first frame's size, move
# frame #0's top-left to be (0, 0), and clip subsequent frames.
# 3. Adjust the image width×height to 4×1, the first frame's bottom-right
# corner, and clip subsequent frames.
# 4. Expand the image width×height to 4×2, the union of the image and first
# frame's bounds, and clip subsequent frames.
# 5. Expand the image width×height to 4×5, so that no frames are clipped. This
# needs to decode all frames before being able to report the image bounds.
#
# The GIF specification (https://www.w3.org/Graphics/GIF/spec-gif89a.txt) calls
# for policy 0, rejection, as it says that "Each image must fit within the
# boundaries of the Logical Screen, as defined in the Logical Screen
# Descriptor". The spec uses "image" and "screen" for what Wuffs calls "frame"
# and "image".
#
# In practice, real world encoders violate the spec, and real world decoders
# have responded by accepting such files anyway. As of May 2018:
#
# - Chromium chooses policy 4:
# https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/image-decoders/gif/gif_image_reader.cc?rcl=5161173c43324da2b13e1aa45bbe69901daa1279&l=740
#
# - Firefox chooses policy 2:
# https://dxr.mozilla.org/mozilla-central/rev/b75acf9652937ce79a9bf02de843c100db0e5ec7/image/decoders/nsGIFDecoder2.cpp#814
#
# - Go chooses policy 0:
# https://github.com/golang/go/blob/d3beea8c529a20b9eebb5ff8c22684af5ee1c920/src/image/gif/reader.go#L508
# but a surprised user filed https://github.com/golang/go/issues/20856 when
# Go rejected some (off-spec) GIF files that other decoders accept.
#
# - gdk-pixbuf chooses policy 1:
# https://github.com/GNOME/gdk-pixbuf/blob/c1fd9f5d6592c0183c54efc806b3ca6871e1f496/gdk-pixbuf/io-gif.c#L992
#
# - giflib enforces no particular policy. It provides image and frame bounds
# as encoded in the file and leaves it up to the caller how to respond.
#
# Wuffs chooses policy 4 by default, the same as Chromium. Wuffs can be
# configured to choose policy 1, by enabling a 'quirk'.
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
0x44 0x00 0xFF
0x55 0x00 0xFF
0x66 0x00 0xFF
0x77 0x00 0xFF
0x00 0x88 0xFF
0x00 0x99 0xFF
0x00 0xAA 0xFF
0x00 0xBB 0xFF
0x00 0xCC 0xFF
0x00 0xDD 0xFF
0x00 0xEE 0xFF
0x00 0xFF 0xFF
}
}
frame {
frameLeftTopWidthHeight 1 0 3 1
}
lzw 4 0x01 0x02 0x03
frame {
frameLeftTopWidthHeight 0 1 2 2
}
lzw 4 0x08 0x09 0x0A 0x0B
frame {
frameLeftTopWidthHeight 0 4 1 1
}
lzw 4 0x0E
frame {
frameLeftTopWidthHeight 2 0 4 3
}
lzw 4 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

@@ -0,0 +1,46 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
# ICCP metadata.
#
# Extension (Application Extension), 11 bytes for AI and AAC.
bytes 0x21 0xFF 0x0B
# Application Identifier "ICCRGBG1".
bytes 0x49 0x43 0x43 0x52 0x47 0x42 0x47 0x31
# Application Authentication Code "012".
bytes 0x30 0x31 0x32
# Block Terminator.
bytes 0x00
# XMP metadata.
#
# Extension (Application Extension), 11 bytes for AI and AAC.
bytes 0x21 0xFF 0x0B
# Application Identifier "XMP Data".
bytes 0x58 0x4D 0x50 0x20 0x44 0x61 0x74 0x61
# Application Authentication Code "XMP".
bytes 0x58 0x4D 0x50
# Block Terminator.
bytes 0x00
loopCount 2000
frame {
frameLeftTopWidthHeight 1 0 1 1
}
lzw 4 0x01
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

@@ -0,0 +1,54 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
# ICCP metadata.
#
# Extension (Application Extension), 11 bytes for AI and AAC.
bytes 0x21 0xFF 0x0B
# Application Identifier "ICCRGBG1".
bytes 0x49 0x43 0x43 0x52 0x47 0x42 0x47 0x31
# Application Authentication Code "012".
bytes 0x30 0x31 0x32
# A block of arbitrary data.
bytes 0x05 0x16 0x26 0x36 0x46 0x56
# Another block of arbitrary data.
bytes 0x03 0x76 0x86 0x96
# Block Terminator.
bytes 0x00
# XMP metadata.
#
# Extension (Application Extension), 11 bytes for AI and AAC.
bytes 0x21 0xFF 0x0B
# Application Identifier "XMP Data".
bytes 0x58 0x4D 0x50 0x20 0x44 0x61 0x74 0x61
# Application Authentication Code "XMP".
bytes 0x58 0x4D 0x50
# A block of arbitrary data.
bytes 0x05 0x17 0x27 0x37 0x47 0x57
# Another block of arbitrary data.
bytes 0x03 0x77 0x87 0x97
# Block Terminator.
bytes 0x00
loopCount 2000
frame {
frameLeftTopWidthHeight 1 0 1 1
}
lzw 4 0x01
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 B

@@ -0,0 +1,31 @@
# Feed this file to script/make-artificial.go
# This GIF image contains multiple "Graphic Control Extensions" for a frame.
#
# The GIF89a specification says that "at most one Graphic Control Extension may
# precede a graphic rendering block", but in practice, some encoders emit more
# than one, and decoders ignore all but the last one.
make gif
header
image {
imageWidthHeight 1 1
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
graphicControl animationDisposalNone 200ms
graphicControl animationDisposalNone 300ms
frame {
frameLeftTopWidthHeight 0 0 1 1
}
lzw 2 0x00
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1,68 @@
# Feed this file to script/make-artificial.go
# This GIF image contains multiple "loop count" entries.
#
# The GIF89a specification doesn't discuss loop counts: it is an extension to
# the format. Neither the official spec nor unofficial documents (e.g.
# http://www.vurdalakov.net/misc/gif/netscape-looping-application-extension)
# state how to interpret having more than one of them: whether to accept the
# first, accept the last, reject the overall animated image as invalid, etc.
# Different spec-compliant decoders can choose different policies.
#
# Wuffs reports the most recent loop count seen, which may change over the
# course of stepping through the frames. Programs that use Wuffs may enforce
# their own policy (e.g. accept first, accept last, etc.) on top of that.
#
# Note also that the loop count as written in the GIF file format has "excludes"
# semantics: it is the number of times to repeat the animation excluding the
# initial play-through (and 0 means to loop forever). An "excludes" loop count
# of 3 means to play each animation frame 4 times. An absent loop count means to
# play each animation frame exactly once.
#
# Wuffs' API provides "includes" semantics, across all of its supported
# animation file formats. An "includes" loop count of 3 means to play each
# animation frame 3 times. There is no absent option. Wuffs' numbers and GIF's
# numbers will generally differ by 1 (other than the absent case, and both
# using 0 to mean forever).
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
frame {
frameLeftTopWidthHeight 0 0 1 1
}
lzw 2 0x00
frame {
frameLeftTopWidthHeight 0 0 1 1
}
lzw 2 0x00
loopCount 50
frame {
frameLeftTopWidthHeight 0 0 1 1
}
lzw 2 0x00
loopCount 30
frame {
frameLeftTopWidthHeight 0 0 1 1
}
lzw 2 0x00
loopCount 40
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 B

@@ -0,0 +1,17 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 1 1
palette {
0x11 0x11 0x11
0x22 0x22 0x22
0x33 0x33 0x33
0x44 0x44 0x44
}
}
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 B

@@ -0,0 +1,23 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
frame {
frameLeftTopWidthHeight 0 0 2 2
}
# The frame is 4 pixels, but we don't supply any.
lzw 2
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 B

@@ -0,0 +1,23 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
frame {
frameLeftTopWidthHeight 0 0 2 2
}
# The frame is 4 pixels, but we only supply 1.
lzw 2 0x00
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 B

@@ -0,0 +1,23 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
frame {
frameLeftTopWidthHeight 0 0 2 2
}
# The frame is 4 pixels, but we supply 5.
lzw 2 0x00 0x00 0x00 0x00 0x00
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 B

@@ -0,0 +1,27 @@
# Feed this file to script/make-artificial.go
# This GIF image has one frame, whose frame rect is smaller than the image
# rect. The frame is also interlaced, but its frame rect (and dirty rect)
# should still only be 1 row high.
make gif
header
image {
imageWidthHeight 5 5
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
frame {
frameLeftTopWidthHeight 3 2 1 1
interlaced
}
lzw 2 0x00
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

@@ -0,0 +1,67 @@
# Feed this file to script/make-artificial.go
# This GIF image has two frames. The first is 4x2 and contains 8 shades of red.
# The second is 3x1, positioned at (1, 1), and nominally contains 3 shades of
# blue but the middle pixel is transparent.
make gif
header
image {
imageWidthHeight 4 2
# 16 shades of red and then 16 shades of blue.
palette {
0x00 0x00 0x00
0x10 0x00 0x00
0x20 0x00 0x00
0x30 0x00 0x00
0x40 0x00 0x00
0x50 0x00 0x00
0x60 0x00 0x00
0x70 0x00 0x00
0x80 0x00 0x00
0x90 0x00 0x00
0xA0 0x00 0x00
0xB0 0x00 0x00
0xC0 0x00 0x00
0xD0 0x00 0x00
0xE0 0x00 0x00
0xF0 0x00 0x00
0x00 0x00 0x00
0x00 0x00 0x11
0x00 0x00 0x22
0x00 0x00 0x33
0x00 0x00 0x44
0x00 0x00 0x55
0x00 0x00 0x66
0x00 0x00 0x77
0x00 0x00 0x88
0x00 0x00 0x99
0x00 0x00 0xAA
0x00 0x00 0xBB
0x00 0x00 0xCC
0x00 0x00 0xDD
0x00 0x00 0xEE
0x00 0x00 0xFF
}
}
graphicControl animationDisposalNone 100ms
frame {
frameLeftTopWidthHeight 0 0 4 2
}
lzw 7 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
graphicControl animationDisposalNone 200ms transparentIndex=0x1A
frame {
frameLeftTopWidthHeight 1 1 3 1
}
lzw 7 0x1F 0x1A 0x15
trailer
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 B

@@ -0,0 +1,23 @@
# Feed this file to script/make-artificial.go
make gif
header
image {
imageWidthHeight 2 2
palette {
0x00 0x00 0xFF
0x11 0x00 0xFF
0x22 0x00 0xFF
0x33 0x00 0xFF
}
}
frame {
frameLeftTopWidthHeight 0 0 0 0
}
# The frame is 0 pixels, but we supply 1.
lzw 2 0x00
trailer