Commit Graph
250 Commits
Author SHA1 Message Date
Patrick Georgi f563f32f82 Add SPDX identifier to license headers
SPDX is an ISO standard for describing licenses in a computer readable
format, which is useful when applying license compliance tools and the
like to source code.

In addition to ensuring that the Wuffs C distribution is properly
annotated to the benefit of projects using Wuffs and SPDX-supporting
tools, add it everywhere else where there's a license in this repo for
consistency, too.
2023-10-06 20:52:36 +02:00
Nigel Tao 74a6ea2fcd all: relicense from Apache2 to dual Apache2/MIT
The LICENSE has changed from a single license (Apache2) to a dual
license (Apache2 or MIT, at your option).

If you've previously used Wuffs under the Apache2 license, you are able
to keep doing so. No further action required by you.

The two files listed below (previous releases) are exceptions, as they
are older snapshots, frozen in time. Their license has not changed:
release/c/wuffs-v0.2.c
release/c/wuffs-v0.3.c

Every name in the AUTHORS file, other than Google Inc., has signed
Google's CLA (Contributor License Agreement).
2023-10-06 10:00:59 +11:00
Nigel Tao 8e42e01d3c std/gif: remove the std/lzw dependency
name                                         old speed      new speed      delta

wuffs_gif_decode_1k_bw/clang11                683MB/s ± 0%   682MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang11   168MB/s ± 0%   184MB/s ± 0%  +10.01%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang11   204MB/s ± 0%   230MB/s ± 0%  +12.77%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang11             746MB/s ± 0%   819MB/s ± 0%   +9.90%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang11          200MB/s ± 0%   218MB/s ± 0%   +8.97%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang11                  246MB/s ± 0%   257MB/s ± 0%   +4.33%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang11      543MB/s ± 0%   562MB/s ± 0%   +3.44%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang11       210MB/s ± 0%   220MB/s ± 0%   +4.90%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/clang11      214MB/s ± 0%   224MB/s ± 0%   +4.96%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang11      214MB/s ± 0%   224MB/s ± 0%   +4.98%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang11      1.24GB/s ± 0%  1.29GB/s ± 0%   +3.85%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc10                  649MB/s ± 0%   588MB/s ± 0%   -9.42%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10     167MB/s ± 0%   198MB/s ± 0%  +18.57%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10     195MB/s ± 0%   251MB/s ± 0%  +28.64%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10               753MB/s ± 0%   871MB/s ± 0%  +15.64%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10            199MB/s ± 0%   233MB/s ± 0%  +16.86%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                    258MB/s ± 0%   265MB/s ± 0%   +2.93%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10        560MB/s ± 0%   561MB/s ± 0%   +0.19%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10         221MB/s ± 0%   227MB/s ± 0%   +2.65%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc10        227MB/s ± 0%   232MB/s ± 0%   +2.29%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10        227MB/s ± 0%   232MB/s ± 0%   +2.28%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10        1.29GB/s ± 0%  1.28GB/s ± 0%   -0.22%  (p=0.008 n=5+5)
2023-10-04 20:19:25 +11:00
Nigel Tao 6e84987d33 std: change set_quirk_enabled to set_quirk 2023-04-14 21:42:15 +10:00
Nigel Tao 6e8349129c base: remove deprecated names 2023-04-09 16:12:49 +10: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 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 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 3642d73714 Factor test/data/artificial into many directories 2021-11-16 15:37:57 +11:00
Nigel Tao 750df217dd Rename deprecated ETC__FLAVOR__METADATA 2021-11-05 16:48:58 +11:00
Nigel Tao d5075c7e94 Push "int i" into "for (int i = etc; etc; etc)" 2021-11-02 14:07:58 +11:00
Nigel Tao ad40102c5a Change mimic marker symbol from "!!" to "¿" 2021-03-25 22:22:27 +11:00
Nigel Tao ee62582609 Tweak some mimic bench names for benchstat-ratio 2021-03-13 13:31:41 +11:00
Nigel Tao 2f78804e62 Use more inclusive language 2021-01-23 19:50:47 +11:00
Nigel Tao cf4aff9ef0 Have testlib image_decoder helpers take quirks 2021-01-21 22:29:30 +11:00
Nigel Tao 695a6815b1 Remove gif.config_decoder
The original motivation (having a low-featured low-memory decoder just
for counting GIF frames) is obsolete: https://crbug.com/1132828

Binary size, before:
42264 gen/lib/c/clang-9-dynamic/wuffs-std-gif.lo
42392 gen/lib/c/clang-9-static/wuffs-std-gif.o
44824 gen/lib/c/gcc-dynamic/wuffs-std-gif.lo
45624 gen/lib/c/gcc-static/wuffs-std-gif.o

After:
26736 gen/lib/c/clang-9-dynamic/wuffs-std-gif.lo
26712 gen/lib/c/clang-9-static/wuffs-std-gif.o
27976 gen/lib/c/gcc-dynamic/wuffs-std-gif.lo
28392 gen/lib/c/gcc-static/wuffs-std-gif.o
2020-12-18 22:06:08 +11:00
Nigel Tao d6a10dfe8a Add io_buffer.{read,writ}er_slice methods 2020-07-27 11:47:47 +10:00
Nigel Tao f45f01f4f3 Update clang-format from v5 to v9 2020-06-05 14:06:56 +10:00
Nigel Tao d7c9e9bbc9 De-duplicate the wuffs_gif_decode test function 2020-06-01 14:33:19 +10:00
Nigel Tao e6b7c51557 Inline do_bench_gif_decode 2020-06-01 14:23:59 +10:00
Nigel Tao 4b9b971436 Harmonize do_bench_{gif,image}_decode 2020-06-01 13:27:46 +10:00
Nigel Tao 2784613b49 Add n_bytes_out arg to gif bench functions 2020-06-01 13:14:14 +10:00
Nigel Tao f9a90d8ade Loosen what std/gif allows as the trailer byte 2020-05-21 22:06:21 +10:00
Nigel Tao ad1cff3921 Add tell_me_more? mechanism 2020-05-12 11:12:39 +10:00
Nigel Tao b72dd16f9b Have test/* global variable names start with g_ 2020-03-27 17:12:38 +11:00
Nigel Tao c5c10e95b7 Remove some superfluous empty // comments 2020-03-18 21:58:19 +11:00
Nigel Tao 6892095998 Have C programs handle flags consistently 2020-03-03 11:25:18 +11:00
Nigel Tao 2914bae3b2 Re-format C function signatures 2020-02-26 09:40:30 +11:00
Nigel Tao 7b199116b0 Rename s/got/have/ in test/c 2020-02-24 21:23:58 +11:00
Nigel Tao 3fd6aca365 Change gif workbuf_len worst case from 1 to 0 2020-02-05 17:30:51 +11:00
Nigel Tao 555e8eaaa3 Add gif.config_decoder (part 2 of 2)
This runs script/preprocess-wuffs.go as foreshadowed by the previous
commit 1aa50163 "Add gif.config_decoder (part 1 of 2)".

The new gif.config_decoder type is largely a copy/paste (with minor
edits) of the existing decoder type, but it can decode GIF animation
metadata (e.g. frame timings) without the memory requirements of a
complete GIF decoder (which can also decode pixels). As of this commit,
sizeof(config_decoder) and sizeof(decoder) is 1320 and 65024, a
difference of over 62 KiB.

The trade-off is that binary size increased by around 1.5x or 18K for
the GIF package. Future refactorings might be able to claw that back,
but it might not.

"wuffs genlib; ls -l gen/lib/c/*/*gif* | awk etc" output:

Before:
25904 gen/lib/c/clang-5.0-dynamic/wuffs-std-gif.lo
26424 gen/lib/c/clang-5.0-static/wuffs-std-gif.o
30480 gen/lib/c/gcc-dynamic/wuffs-std-gif.lo
30064 gen/lib/c/gcc-static/wuffs-std-gif.o

After:
41168 gen/lib/c/clang-5.0-dynamic/wuffs-std-gif.lo
42328 gen/lib/c/clang-5.0-static/wuffs-std-gif.o
49040 gen/lib/c/gcc-dynamic/wuffs-std-gif.lo
48304 gen/lib/c/gcc-static/wuffs-std-gif.o
2020-02-05 17:25:39 +11:00
Nigel Tao f50e161677 Add image_config_decoder interface test 2020-02-02 20:18:10 +11:00
Nigel Tao 0e833f909a Add WUFFS_BASE__PIXEL_FORMAT__BGR_565 2020-01-28 10:32:40 +11:00
Nigel Tao f5151fa1f9 Remove some obsolete basic tests 2020-01-16 21:21:58 +11:00
Nigel Tao 1a791217de Add wuffs_base__pixel_blend type 2020-01-14 09:27:04 +11:00
Nigel Tao c8e3a94200 Add base.image_decoder 2020-01-12 12:18:02 +11:00
Nigel Tao 9e802a5f84 Have wuffs_base__pixel_config__set take repr args 2020-01-05 15:34:05 +11:00
Nigel Tao b666ab06f7 Make wuffs_base__pixel_subsampling a struct 2020-01-05 15:27:11 +11:00
Nigel Tao 4f53f3101f Make wuffs_base__pixel_format a struct 2020-01-05 14:18:48 +11:00
Nigel Tao 0fa32bd09f Rename warnings to notes 2020-01-05 13:15:00 +11:00
Nigel Tao 0319777cce Have tests print all of status.repr 2020-01-05 12:56:48 +11:00
Nigel Tao 7f1572ca16 Add CHECK_STATUS testlib macro 2020-01-05 12:50:56 +11:00
Nigel Tao 77a5311c4b Add CHECK_STRING testlib macro 2020-01-05 11:19:22 +11:00
Nigel Tao e6db7f6a40 Make wuffs_base__status a struct 2020-01-05 10:48:20 +11:00
Nigel Tao c50f16e58b Separate status and status_msg local variables 2020-01-04 11:57:33 +11:00
Nigel Tao 498b7138f3 Remove "static const uint32_t etc" from cgen
They trigger compiler warnings (-Wunused-const-variable) precisely
because they're unused.
2019-11-02 12:15:01 +11:00
Nigel Tao 745b5c41e0 Give test/c/std/gif error messages more context 2019-10-05 11:57:55 +10:00
Nigel Tao 9089d37578 Clip std/gif replicated rows to the frame rect
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17802
2019-10-05 11:54:03 +10:00
Nigel Tao efb18036cb Add gif-small-frame-interlaced.gif test 2019-10-05 11:40:24 +10:00