Commit Graph
957 Commits
Author SHA1 Message Date
Nigel Tao c203818556 Have std/tga ignore X-Origin and Y-Origin fields
Updates #67
2022-01-15 15:10:03 +11:00
Nigel Tao fd69133c5d Fix std/tga opaque-ness
Updates #67
2022-01-15 14:11:56 +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 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 8ef4c062d9 Add zlib QUIRK_JUST_RAW_DEFLATE 2021-11-26 23:13:57 +11:00
Nigel Tao 38b101d170 Push std/png decoder.tell_me_more goto_done later 2021-11-26 19:46:36 +11:00
Nigel Tao 5d1473a2ca Refactor std/png decoder.tell_me_more 2021-11-26 19:45:42 +11:00
Nigel Tao 72d4a9e769 Have std/png pass through EXIF data
Fixes #59
2021-11-26 19:14:30 +11:00
Nigel Tao 5f6a522563 Add a "while.goto_done" no-op to std/png 2021-11-26 17:26:12 +11:00
Nigel Tao 4dedbedbbc Remove unnecessary std/nie struct parentheses 2021-11-26 17:24:57 +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 f5c68a13cb Fix std/png for depth-16 grayscale interlaced 2021-11-20 22:54:21 +11:00
Nigel Tao 5e8b448c12 Drop std/deflate's "Re-purpose the hdist variable" 2021-11-20 22:03:29 +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 ede0590ead Add while label to std/deflate decode_huffman_slow 2021-11-20 20:14:37 +11:00
Nigel Tao bb8623b472 Have deflate slow-Huffman use extended ringbuffer
This is the same optimization as commit e65c8612 "Extend std/deflate
ringbuffer to simplify copies", applied to decoder.decode_huffman_slow.
2021-11-20 20:10:10 +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 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 29560a336b Convert std/png text from Latin-1 to UTF-8
Fixes #55
2021-11-17 23:04:49 +11:00
Nigel Tao e0cdaeb54f Fix std/png tell_me_more minfo with suspensions 2021-11-17 13:04:04 +11:00
Nigel Tao e7ed1dd43e Add std/png tell_me_more while.loop name 2021-11-17 13:01:05 +11:00
Nigel Tao 417b03a0ad Add std/png "#unsupported PNG compression method" 2021-11-17 12:07:44 +11:00
Nigel Tao 7dd0dd264b Delete superfluous "// --------" comment 2021-11-17 12:03:43 +11:00
Nigel Tao 0d37acd6f6 Factor out std/png/common_consts.wuffs 2021-11-17 12:01:37 +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 f0c2a40d66 Resize std/png chunk_length field from u64 to u32 2021-11-16 13:06:30 +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 0045ce49f3 Rename table.row as table.row_u32 2021-11-15 10:49:42 +11:00
Nigel Tao fa56d92410 Clip std/png frame_dirty_rect to frame rect 2021-11-15 10:46:28 +11:00
Nigel Tao 8f1adea523 Hoist subslice out of std/png filter_and_swizzle
On an Intel NUC (Comet Lake, BXNUC10i5FNKPA):

name                                                      old speed      new speed      delta

wuffs_png_decode_image_19k_8bpp/clang9                     274MB/s ± 0%   273MB/s ± 0%  -0.25%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang9                    309MB/s ± 0%   308MB/s ± 0%  -0.22%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9                     985MB/s ± 0%   982MB/s ± 0%  -0.29%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   846MB/s ± 0%   841MB/s ± 0%  -0.56%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   812MB/s ± 0%   808MB/s ± 0%  -0.55%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang9                  320MB/s ± 0%   320MB/s ± 0%  -0.15%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                      263MB/s ± 0%   276MB/s ± 0%  +5.00%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                     328MB/s ± 0%   333MB/s ± 0%  +1.49%  (p=0.016 n=5+4)
wuffs_png_decode_image_77k_8bpp/gcc10                      950MB/s ± 0%   976MB/s ± 0%  +2.78%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    865MB/s ± 0%   912MB/s ± 0%  +5.45%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    825MB/s ± 0%   868MB/s ± 0%  +5.19%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                   336MB/s ± 0%   341MB/s ± 0%  +1.37%  (p=0.008 n=5+5)
2021-11-15 10:43:55 +11:00
Nigel Tao 4d64aff554 Rename std/png/decode_swizzle_fallback.wuffs 2021-11-14 19:58:23 +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 9af2666aec Move std/png first_frame_io_position earlier 2021-11-10 16:52:59 +11:00
Nigel Tao 9c3d27fb43 Fix std/png decode_other_chunk skipping chunks 2021-11-09 22:10:00 +11:00
Nigel Tao 2373340f83 Add base.ANIMATION_DISPOSAL__ETC constants 2021-11-09 09:53:29 +11:00
Nigel Tao e847766b02 Tweak std/png decode_other_chunk if-else chain 2021-11-09 09:05:11 +11:00
Nigel Tao 74c1dfce96 Rename std/gif num_loops field 2021-11-09 08:55:15 +11:00
Nigel Tao ca76a01ac2 Have std/png support remapped transparency 2021-11-07 09:51:04 +11:00
Nigel Tao 00b329872a Tighten png.INTERLACING type refinement 2021-11-06 09:54:56 +11:00
Nigel Tao 744fbdd732 Have std/png decode iCCP chunks
Updates #39
2021-11-05 16:29:11 +11:00
Nigel Tao 8f9a4f40c2 Rename METADATA_RAW as METADATA_RAW_PASSTHROUGH 2021-10-31 15:17:46 +11:00
Nigel Tao db5a407bab Have std/png decode sRGB chunks
Updates #39
2021-10-16 09:27:30 +11:00
Nigel Tao 911049e9f9 Have std/png decode cHRM and gAMA chunks
Updates #39
2021-10-15 15:08:47 +11:00
Nigel Tao d8ad363ef5 Tweak png.decoder.decode_image_config indentation 2021-10-15 13:35:15 +11:00
Nigel Tao ad1d983698 Add ETC__MORE_INFORMATION__FLAVOR__METADATA_PARSED 2021-10-14 17:17:11 +11:00