Commit Graph
723 Commits
Author SHA1 Message Date
Nigel Tao d53f37997f Have std/png decode truncated images
Fixes #71
2022-01-23 22:59:06 +11:00
Nigel Tao 985a756a48 Add test/data/hippopotamus.*.truncated.png 2022-01-23 22:17:59 +11:00
Nigel Tao fa1bf3415e Add std/tga benchmarks
Updates #67
2022-01-21 16:13:07 +11:00
Nigel Tao ed4d556721 Re-create test/data/bricks-gray.tga
We now convert it from the BMP file, not the PNG file:
$ convert bricks-gray.bmp -auto-orient bricks-gray.tga

The bricks-gray.png file has some gamma correction metadata that meant
that the previous TGA file (when converted to NIA) didn't match the
other bricks-gray.* files. After this commit, they all match:

$ grep bricks-gray test/nia-checksums-of-data.txt
c2bce675 test/data/bricks-gray.bmp
c2bce675 test/data/bricks-gray.gif
c2bce675 test/data/bricks-gray.no-ancillary.png
c2bce675 test/data/bricks-gray.png
c2bce675 test/data/bricks-gray.tga

Updates #67
2022-01-15 14:18:36 +11:00
Nigel Tao f4002c5b21 Have std/tga decode RLE images
Updates #67
2022-01-15 14:10:05 +11:00
Nigel Tao fc77dc35ff Have std/tga decode BGRX5551 images
Updates #67
2022-01-15 12:53:24 +11:00
Nigel Tao c997066a2a Have std/tga decode color-mapped images
Updates #67
2022-01-15 12:38:21 +11:00
Nigel Tao 2c10bc32b0 Have std/tga decode non-color-mapped images
Updates #67
2022-01-15 11:37:45 +11:00
Nigel Tao 5aa7a9339f Have std/tga decode width and height
Updates #67
2022-01-15 08:28:53 +11:00
Nigel Tao 4c09c77bb9 Add std/tga package
This is just a placeholder decoder implementation  (and all of the
required plumbing) that produces a 1x1 reddish-purple image. Follow-up
commits will add flesh to the metaphorical bones.

TGA has no magic identifier, so MIME sniffers have to use heuristics.
The test/data/cbor-rfc-7049-examples.cbor file (which is CBOR binary
data, not a TGA image) is mistakenly sniffed as TGA. The /usr/bin/file
program makes the same classification (a false positive).

$ file test/data/cbor-rfc-7049-examples.cbor
test/data/cbor-rfc-7049-examples.cbor: Targa image data - Map 59395 x 26
x 15 +6169 +6500 - 2-bit alpha - interleave "@\033"

Some test/3pdata/tgasuite/*.tga test files, which are invalid TGA
images, are also false positives for now.

Updates #67
2022-01-14 22:53:20 +11:00
Nigel Tao 15c174634e Fix test/data/*.tga orientation
This re-ran imagemagick's convert program, but this time with an
"-auto-orient" option. See
https://issueexplorer.com/issue/ImageMagick/ImageMagick/3844

for i in {color,gray,nodither}; do \
  convert bricks-$i.png -auto-orient bricks-$i.tga; \
  done

The test/data/*.tga files only change in their 18th bytes, from 0x00
(bottom-to-top) to 0x20 (top-to-bottom).

Updates #67
2022-01-14 16:40:05 +11:00
Nigel Tao 510f4581c6 Add test/3pdata/tgasuite
Updates #67
2022-01-14 15:43:28 +11:00
Nigel Tao 546af5a7c3 Let magic_number_guess_fourcc sniff TGA
Updates #67
2022-01-14 14:40:58 +11:00
Nigel Tao c104ae296c Sort degenerate-huffman test Literal/Length table 2022-01-09 10:53:33 +11:00
Nigel Tao 42de49a938 Have make-artificial.go mark incomplete Huffman 2022-01-09 10:49:38 +11:00
Nigel Tao 4aa672af48 Drop "unused" in degenerate-huffman-unused tests 2022-01-08 13:59:53 +11:00
Nigel Tao f86c80e425 Fix std/deflate degenerate H-D Huffman table
RFC 1951 section 3.2.7. "Compression with dynamic Huffman codes
(BTYPE=10)" says, "If only one distance code is used, it is encoded
using one bit, not zero bits; in this case there is a single code length
of one, with one unused code."

I had previously mis-read that excerpt to also require that the sole
distance code was the shortest distance (code 0, a distance of 1).

Fixes #66
2022-01-08 13:57:34 +11:00
Nigel Tao dda01f1a77 Add WUFFS_BASE__FOURCC__QOI definition 2022-01-02 09:10:51 +11:00
Nigel Tao 425eefeb35 Replace "go get" advice with "go install"
Fixes #62
2021-12-30 22:58:12 +11:00
Nigel Tao 8ef4c062d9 Add zlib QUIRK_JUST_RAW_DEFLATE 2021-11-26 23:13:57 +11:00
Nigel Tao 72d4a9e769 Have std/png pass through EXIF data
Fixes #59
2021-11-26 19:14:30 +11:00
Nigel Tao 3a9933f2a0 Canonicalize stills' NIA conversion's loops to 0 2021-11-23 21:39:29 +11:00
Nigel Tao c2eb4f5b93 Have convert-to-nia emit final frame's loop count 2021-11-23 19:30:48 +11:00
Nigel Tao 8397a35a50 Have convert-to-nia emit 'best effort' bad frames 2021-11-23 15:38:35 +11:00
Nigel Tao e53497abe3 Have convert-to-nia output valid NIA on bad frames 2021-11-23 15:24:58 +11:00
Nigel Tao ac4d3e6420 Use 0 (not 1) num_animation_loops for still GIFs
For example, the crc32 checksums in test/nia-checksums-of-data.txt for
test/data/pjw-thumbnail.{bmp,gif,png} now all match.
2021-11-23 15:06:55 +11:00
Nigel Tao 8bd52a8791 Embiggen example/convert-to-nia WORKBUF_ARRAY_SIZE 2021-11-23 13:22:34 +11:00
Nigel Tao 55cad41d6c Have nonpremul SRC_OVER keep transparent red/blue 2021-11-21 21:16:10 +11:00
Nigel Tao f5c68a13cb Fix std/png for depth-16 grayscale interlaced 2021-11-20 22:54:21 +11:00
Nigel Tao 49a431f98d Fix std/deflate decode_huffman_slow suspends
Unlike the other decode_huffman_etc! methods, decode_huffman_slow? (with
a ?) can suspend. The (hlen, hdist) and the remainder (length, distance)
pairs might not be stable across a suspension, as the args.dst io_writer
might change its history length. We have to re-calculate those pairs
after a short write.

The test/3pdata/nia-checksums-of-pngsuite.txt for interlaced and
non-interlaced flavors of the same image now match.
2021-11-20 21:31:40 +11:00
Nigel Tao a684928240 Let std/png allow PLTE for RGB, RGBA color types 2021-11-20 15:39:07 +11:00
Nigel Tao cdf3bbfb26 Add test/3pdata/pngsuite 2021-11-20 14:49:10 +11:00
Nigel Tao e44920d382 Let gif "ignore too much" quirk skip lzw errors
The modified test/data/*/*.gif files differ by only one byte:
 00000000  47 49 46 38 39 61 02 00  02 00 81 00 00 00 00 ff  |GIF89a..........|
 00000010  11 00 ff 22 00 ff 33 00  ff 2c 00 00 00 00 02 00  |..."..3..,......|
-00000020  02 00 00 02 02 84 f1 00  3b                       |........;|
+00000020  02 00 00 02 02 84 5d 00  3b                       |......].;|

The etc-good-lzw.gif bits have changed, even though the
etc-good-lzw.etc.txt file only had comments added, due to a Go standard
library change: "compress/lzw: output a Clear code first, per GIF spec"
https://github.com/golang/go/commit/9c1dbdf60edbffeff10f58af21fa055eb0fdd29f

Updates PR #57
Updates https://crbug.com/1270631
2021-11-19 13:30:23 +11:00
Nigel Tao 3b882be500 Rename test/.../pixel-data-too-much.gif* 2021-11-19 11:54:39 +11:00
Nigel Tao 6a8ee57ac0 Loosen test_wuffs_png_decode_metadata_kvp bound 2021-11-19 09:48:47 +11:00
Nigel Tao 8562375fd9 Update test/nia-checksums-of-data.txt 2021-11-18 08:11:06 +11:00
Nigel Tao bb028ae764 Update tests for artificial/* filename rename 2021-11-18 08:10:12 +11:00
Nigel Tao 29560a336b Convert std/png text from Latin-1 to UTF-8
Fixes #55
2021-11-17 23:04:49 +11:00
Nigel Tao 6737565c20 Let std/png decode iTXt, tEXt and zTXt chunks
Updates #55
2021-11-17 11:56:49 +11:00
Nigel Tao 3642d73714 Factor test/data/artificial into many directories 2021-11-16 15:37:57 +11:00
Nigel Tao 37ac4def8e Move some test/data/artificial files up one dir 2021-11-16 15:12:29 +11:00
Nigel Tao ce9ab13ecd Let std/png decode first fcTL after the last IDAT 2021-11-16 12:55:43 +11:00
Nigel Tao 6c2a591e84 Let script/make-artificial.go generate PNG files 2021-11-16 11:08:04 +11:00
Nigel Tao d40bf000a9 Rename wuffs_base__table_u8__row as etc__row_u32 2021-11-15 17:26:51 +11:00
Nigel Tao 8025bf1bd7 Fix std/png filter benches 2021-11-14 21:20:05 +11:00
Nigel Tao a4fa6a2554 Let std/png decode (animated) APNG
The test/nia-checksums-of-data.txt checksums for the *.apng files now
match the (multiple frame) *.gif files. Previously, they matched the
(single frame) *.000000.nie files.

Fixes #41
2021-11-14 18:20:15 +11:00
Nigel Tao 22eed1fd8d Let example/convert-to-nia decode NIE 2021-11-13 11:21:35 +11:00
Nigel Tao c19e3b1cab Add script/extract-nia-frames.go 2021-11-11 11:47:08 +11:00
Nigel Tao 9af2666aec Move std/png first_frame_io_position earlier 2021-11-10 16:52:59 +11:00
Nigel Tao f4c2d4652e Fix test/data/animated-red-blue.apng loop count
The diff of the "hd" hex dump shows that the acTL chunk's nominal loop
count changed from 2 to 3. The 4-byte CRC-32 checksum was also updated.
 00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
 00000010  00 00 00 40 00 00 00 30  08 02 00 00 00 2e 29 eb  |...@...0......).|
 00000020  48 00 00 00 08 61 63 54  4c 00 00 00 04 00 00 00  |H....acTL.......|
-00000030  02 92 c3 07 fc 00 00 00  06 74 52 4e 53 00 00 00  |.........tRNS...|
+00000030  03 e5 c4 37 6a 00 00 00  06 74 52 4e 53 00 00 00  |...7j....tRNS...|
 00000040  00 00 10 73 11 17 f5 00  00 00 1a 66 63 54 4c 00  |...s.......fcTL.|
 00000050  00 00 00 00 00 00 40 00  00 00 30 00 00 00 00 00  |......@...0.....|
 00000060  00 00 00 00 0a 00 64 00  00 80 50 f1 a2 00 00 03  |......d...P.....|
2021-11-07 10:43:32 +11:00