691 Commits
Author SHA1 Message Date
Nigel Tao 3474af988b std/{cbor,json}: add test for empty input
Updates #96
2023-02-01 21:43:25 +11:00
Nigel Tao 248bddcfd2 std/*image_decoder*: add "#truncated input"
name                                                       old speed      new speed       delta

wuffs_bmp_decode_40k/clang11                               4.36GB/s ± 0%   4.48GB/s ± 0%   +2.74%  (p=0.008 n=5+5)

wuffs_bmp_decode_40k/gcc10                                 4.49GB/s ± 0%   4.50GB/s ± 0%   +0.15%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/clang11                              723MB/s ± 0%    742MB/s ± 0%   +2.64%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang11                 177MB/s ± 0%    177MB/s ± 0%     ~     (p=0.841 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang11                 216MB/s ± 0%    217MB/s ± 0%   +0.66%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang11                           793MB/s ± 0%    785MB/s ± 0%   -1.04%  (p=0.016 n=4+5)
wuffs_gif_decode_10k_indexed/clang11                        210MB/s ± 0%    209MB/s ± 0%   -0.38%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang11                                254MB/s ± 0%    255MB/s ± 0%   +0.37%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang11                    568MB/s ± 0%    569MB/s ± 0%   +0.14%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang11                     221MB/s ± 0%    221MB/s ± 0%     ~     (p=0.222 n=5+5)
wuffs_gif_decode_1000k_full_init/clang11                    224MB/s ± 0%    224MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_gif_decode_1000k_part_init/clang11                    224MB/s ± 0%    224MB/s ± 0%     ~     (p=0.841 n=5+5)
wuffs_gif_decode_anim_screencap/clang11                    1.30GB/s ± 0%   1.30GB/s ± 0%     ~     (p=0.111 n=5+5)

wuffs_gif_decode_1k_bw/gcc10                                638MB/s ± 0%    672MB/s ± 0%   +5.23%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10                   175MB/s ± 0%    181MB/s ± 0%   +3.03%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10                   203MB/s ± 0%    209MB/s ± 0%   +3.38%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10                             798MB/s ± 0%    804MB/s ± 0%   +0.70%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10                          210MB/s ± 0%    212MB/s ± 0%   +0.84%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                                  265MB/s ± 0%    265MB/s ± 0%     ~     (p=0.222 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10                      576MB/s ± 0%    577MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10                       226MB/s ± 0%    227MB/s ± 0%   +0.21%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc10                      230MB/s ± 0%    231MB/s ± 0%   +0.32%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10                      230MB/s ± 0%    231MB/s ± 0%   +0.43%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10                      1.32GB/s ± 0%   1.32GB/s ± 0%   +0.18%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/clang11                     267MB/s ± 0%    273MB/s ± 0%   +2.47%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang11                    326MB/s ± 0%    327MB/s ± 0%   +0.51%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang11                     954MB/s ± 0%    969MB/s ± 0%   +1.58%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang11   865MB/s ± 0%    864MB/s ± 0%   -0.18%  (p=0.016 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang11   832MB/s ± 0%    831MB/s ± 0%   -0.11%  (p=0.016 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang11                  331MB/s ± 0%    332MB/s ± 0%   +0.18%  (p=0.016 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                       298MB/s ± 0%    292MB/s ± 0%   -2.17%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                      352MB/s ± 0%    349MB/s ± 0%   -0.75%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10                      1.05GB/s ± 0%   1.03GB/s ± 0%   -1.56%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10     950MB/s ± 0%    949MB/s ± 0%     ~     (p=0.310 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10     905MB/s ± 0%    902MB/s ± 0%   -0.35%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                    360MB/s ± 0%    358MB/s ± 0%   -0.40%  (p=0.008 n=5+5)

wuffs_tga_decode_19k_8bpp/clang11                          7.81GB/s ± 0%   7.90GB/s ± 0%   +1.22%  (p=0.008 n=5+5)
wuffs_tga_decode_77k_24bpp/clang11                         4.34GB/s ± 0%   4.36GB/s ± 0%   +0.59%  (p=0.008 n=5+5)

wuffs_tga_decode_19k_8bpp/gcc10                            7.10GB/s ± 0%   7.13GB/s ± 0%   +0.33%  (p=0.008 n=5+5)
wuffs_tga_decode_77k_24bpp/gcc10                           4.61GB/s ± 0%   4.60GB/s ± 0%   -0.35%  (p=0.008 n=5+5)

Updates #96
2023-02-01 16:36:56 +11:00
Nigel Tao f01f0859f0 std/*io_transformer*: add "#truncated input"
name                                              old speed      new speed       delta

wuffs_bzip2_decode_10k/clang11                    58.5MB/s ± 0%   59.9MB/s ± 0%   +2.50%  (p=0.008 n=5+5)
wuffs_bzip2_decode_100k/clang11                   45.7MB/s ± 0%   50.5MB/s ± 0%  +10.66%  (p=0.008 n=5+5)

wuffs_bzip2_decode_10k/gcc10                      56.2MB/s ± 0%   61.9MB/s ± 0%  +10.01%  (p=0.008 n=5+5)
wuffs_bzip2_decode_100k/gcc10                     46.5MB/s ± 0%   50.4MB/s ± 0%   +8.41%  (p=0.016 n=4+5)

wuffs_deflate_decode_1k_full_init/clang11          195MB/s ± 0%    191MB/s ± 0%   -1.71%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/clang11          224MB/s ± 0%    225MB/s ± 0%   +0.87%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/clang11         421MB/s ± 0%    401MB/s ± 0%   -4.59%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/clang11         432MB/s ± 0%    413MB/s ± 0%   -4.49%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/clang11    542MB/s ± 0%    518MB/s ± 0%   -4.43%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/clang11   338MB/s ± 0%    325MB/s ± 0%   -3.81%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k_full_init/gcc10            181MB/s ± 0%    185MB/s ± 0%   +1.76%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/gcc10            209MB/s ± 0%    212MB/s ± 0%   +1.79%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/gcc10           410MB/s ± 0%    407MB/s ± 0%   -0.93%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/gcc10           421MB/s ± 0%    418MB/s ± 0%   -0.87%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/gcc10      533MB/s ± 0%    533MB/s ± 0%     ~     (p=0.548 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/gcc10     336MB/s ± 0%    334MB/s ± 1%   -0.67%  (p=0.008 n=5+5)

wuffs_gzip_decode_10k/clang11                      401MB/s ± 0%    398MB/s ± 0%   -0.77%  (p=0.008 n=5+5)
wuffs_gzip_decode_100k/clang11                     505MB/s ± 0%    503MB/s ± 0%   -0.46%  (p=0.008 n=5+5)

wuffs_gzip_decode_10k/gcc10                        403MB/s ± 0%    410MB/s ± 0%   +1.90%  (p=0.008 n=5+5)
wuffs_gzip_decode_100k/gcc10                       522MB/s ± 0%    523MB/s ± 0%   +0.10%  (p=0.032 n=5+5)

wuffs_zlib_decode_10k/clang11                      418MB/s ± 0%    417MB/s ± 1%     ~     (p=0.310 n=5+5)
wuffs_zlib_decode_100k/clang11                     530MB/s ± 0%    529MB/s ± 0%     ~     (p=0.421 n=5+5)

wuffs_zlib_decode_10k/gcc10                        428MB/s ± 0%    434MB/s ± 0%   +1.50%  (p=0.008 n=5+5)
wuffs_zlib_decode_100k/gcc10                       551MB/s ± 0%    551MB/s ± 0%     ~     (p=0.690 n=5+5)

Fixes #96
2023-01-31 23:09:37 +11:00
Nigel Tao 8ad397fc93 std/png: add test for multiple IDAT chunks 2023-01-31 21:37:57 +11:00
Nigel Tao 48e69da5af std/lzw: add "#truncated input" error
name                                         old speed      new speed      delta

wuffs_gif_decode_1k_bw/clang11                659MB/s ± 0%   748MB/s ± 0%  +13.43%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang11   182MB/s ± 0%   178MB/s ± 0%   -2.17%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang11   223MB/s ± 0%   219MB/s ± 0%   -2.00%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang11             799MB/s ± 0%   795MB/s ± 0%   -0.52%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang11          211MB/s ± 0%   210MB/s ± 0%   -0.47%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang11                  250MB/s ± 1%   254MB/s ± 0%   +1.75%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang11      581MB/s ± 0%   568MB/s ± 0%   -2.09%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang11       221MB/s ± 0%   221MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_gif_decode_1000k_full_init/clang11      222MB/s ± 0%   224MB/s ± 0%   +0.65%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang11      223MB/s ± 0%   224MB/s ± 0%   +0.58%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang11      1.28GB/s ± 0%  1.30GB/s ± 0%   +1.45%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc10                  595MB/s ± 0%   642MB/s ± 0%   +7.91%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10     168MB/s ± 0%   169MB/s ± 0%   +0.36%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10     202MB/s ± 0%   203MB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10               790MB/s ± 0%   798MB/s ± 0%   +1.04%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10            208MB/s ± 0%   210MB/s ± 0%   +1.00%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                    258MB/s ± 0%   266MB/s ± 0%   +3.08%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10        566MB/s ± 0%   577MB/s ± 0%   +1.83%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10         220MB/s ± 0%   227MB/s ± 0%   +3.03%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc10        223MB/s ± 0%   231MB/s ± 0%   +3.23%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10        224MB/s ± 0%   231MB/s ± 0%   +3.14%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10        1.30GB/s ± 0%  1.32GB/s ± 0%   +1.70%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/clang11                  294MB/s ± 0%   321MB/s ± 0%   +9.11%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang11                 533MB/s ± 0%   560MB/s ± 0%   +5.13%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc10                    271MB/s ± 0%   272MB/s ± 0%   +0.55%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc10                   527MB/s ± 0%   521MB/s ± 0%   -1.31%  (p=0.008 n=5+5)

Updates #96
2023-01-31 20:18:53 +11:00
Nigel Tao d0f0591f64 Add lib/litonlylzma 2022-06-24 13:22:36 +10:00
Nigel Tao 8c33dd503b Tighten std/bzip2 huffman_trees array size 2022-06-10 14:02:17 +10:00
Nigel Tao 9256fe5e54 Have std/bzip2 check the number of sections
Updates #79
2022-06-08 16:41:46 +10:00
Nigel Tao e1b43cd767 Add test/data/artificial-bzip2/abraca.txt.bz2 2022-06-08 14:04:09 +10:00
Nigel Tao c5e41f0e65 Let std/png report metadata after the first frame
Fixes #58
2022-06-02 16:05:24 +10:00
Nigel Tao fff55bee66 Add std/bzip2 mimic tests and benches 2022-05-19 15:35:13 +10:00
Nigel Tao f1350825cc Fix cgen for an_array[i .. j] 2022-05-16 23:39:44 +10:00
Nigel Tao 68b76a8a56 Implement std/bzip2 2022-05-16 23:35:32 +10:00
Nigel Tao ce8d08598d Add std/bzip2 package
This is just a placeholder decoder implementation.
2022-05-12 23:52:12 +10:00
Nigel Tao d6cece7e32 Add more test/data bzip2 files 2022-05-12 10:15:36 +10:00
Nigel Tao e0afb3dad3 Add test/data/romeo.txt.zst 2022-05-10 11:36:27 +10:00
Nigel Tao a55e0a02a2 Fix test/c/std/json.c -Wunused-but-set-variable 2022-02-08 22:08:14 +11:00
Nigel Tao 9719073707 Fix test/c/testlib 'const char *' vs 'char *'
Prior to this commit, `g++ test/c/std/png.c` failed with:
test/c/std/../testlib/testlib.c:107:14: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
...
test/c/std/../testlib/testlib.c:741:5: note: in expansion of macro ‘RETURN_FAIL’
  741 |     RETURN_FAIL("hex_dump: NULL argument");

Likewise, clang++ also failed with:
test/c/std/../testlib/testlib.c:741:5: error: cannot initialize return object of type 'char *' with an rvalue of type 'const char *'
    RETURN_FAIL("hex_dump: NULL argument");

Also run "clang-format-9 -style=Chromium"
2022-02-06 14:31:28 +11:00
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