45 Commits
Author SHA1 Message Date
Nigel Tao 072595ae7d example/imageviewer: don't print filename colon 2025-11-11 12:23:37 +11:00
Nigel Tao 43a6814dfe std/handsum: add new package 2025-02-24 11:18:24 +11:00
Nigel Tao 85af5a4bed std/tga: rename to std/targa 2024-09-08 09:00:10 +10:00
Nigel Tao b8740d8881 std/thumbhash: add new package 2024-09-03 20:07:37 +10:00
Nigel Tao 43df015669 std/etc2: add new package 2024-08-17 15:31:29 +10:00
Nigel Tao d06700f00b std/qoi: add new package
Fixes #63
2024-08-08 23:49:17 +10:00
Nigel Tao ffb64df0a0 aux: add QuirkKeyValuePair type 2024-08-05 00:12:15 +10:00
Nigel Tao 8a722790af example/imageviewer: change screen_gamma flag 2024-08-04 23:25:07 +10:00
Nigel Tao c9fff5b207 std/jpeg: add and use WUFFS_BASE__QUIRK_QUALITY 2024-08-04 23:15:58 +10:00
Nigel Tao 09f4500e19 std/webp: add new package (and vp8 placeholder) 2024-05-10 13:52:07 +10:00
Nigel Tao f5bb519320 base: add ETC__DST_PIXEL_FORMAT__ENABLE_ALLOWLIST
Binary size, before:
412128 gen/bin/example-convert-to-nia
 50680 gen/bin/example-gifplayer
449680 gen/bin/example-imageviewer
439000 gen/bin/example-sdl-imageviewer
151848 gen/bin/example-toy-aux-image

After:
302232 gen/bin/example-convert-to-nia
 46144 gen/bin/example-gifplayer
352112 gen/bin/example-imageviewer
329168 gen/bin/example-sdl-imageviewer
138656 gen/bin/example-toy-aux-image

For further data points, if you hard-code define'ing
WUFFS_CONFIG__DST_PIXEL_FORMAT__ENABLE_ALLOWLIST and
WUFFS_CONFIG__DST_PIXEL_FORMAT__ALLOW_BGRA_PREMUL:

Binary size, before:
121368 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
121368 gen/lib/c/clang-static/wuffs-base-pixconv.o
181088 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
181136 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
 54784 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
 54784 gen/lib/c/clang-static/wuffs-base-pixconv.o
 72144 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
 72272 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2024-03-29 22:19:47 +11:00
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 85b244aa49 std/netpbm: add new package 2023-05-16 16:29:58 +10:00
Nigel Tao 0bbc4c0083 std/jpeg: add new 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.

Updates #42
2023-04-21 18:33:00 +10:00
Nigel Tao 5d7b113172 Optimize imageviewer xcb_clear_area calls 2022-06-08 17:22:29 +10:00
Nigel Tao 8feb2709fa Have imageviewer use wuffs_base__i32__{min,max} 2022-06-03 11:28:39 +10:00
Nigel Tao 4c5d313120 Let example/imageviewer scroll 2022-05-31 12:29:05 +10: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 c754f81634 Have wuffs_aux::DecodeImage report ICCP, XMP 2021-10-31 15:09:55 +11:00
Nigel Tao 15b6285d1c Add example/imageviewer -screen_gamma=N.N flag 2021-10-20 15:42:26 +11:00
Nigel Tao b003f9fe65 Let wuffs_aux::DecodeImage handle metadata
Updates #39
2021-10-19 22:09:21 +11:00
Nigel Tao 2b7b6e12ea Add wuffs_aux::DecodeImageArgQuirks 2021-10-18 00:40:11 +11:00
Nigel Tao ca33506c01 Add wuffs_aux::FooArgBar types for optional args
Prior to this commit, with a "wuffs_aux::Foo(x, y, 0, 0, 4, 5)" call,
with arguments after "y" optional, it was not a compile-time error to
give the wrong number of "0"s or to transpose "4" and "5".
2021-10-18 00:25:13 +11:00
Nigel Tao 90d3232eae Let example/imageviewer minify (negative zoom) 2021-10-07 12:59:38 +11:00
Nigel Tao 2945ef2b29 Have example/imageviewer avoid big xcb_image_put's 2021-10-07 12:35:12 +11:00
Nigel Tao 7f9f37ce5a Have examples use WUFFS_CONFIG__STATIC_FUNCTIONS
Compile time:
$ time ./build-example.sh
Before: user 1m15.750s
After:  user 0m50.343s

Binary size (excluding the statically linked example-toy-genlib):
$ ls -l gen/bin/example-* | awk '{print $5 " " $9}'

Before:
212624 gen/bin/example-cbor-to-json
284192 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
184304 gen/bin/example-gifplayer
324952 gen/bin/example-imageviewer
209632 gen/bin/example-json-to-cbor
241432 gen/bin/example-jsonfindptrs
196320 gen/bin/example-jsonptr
309768 gen/bin/example-sdl-imageviewer
200704 gen/bin/example-zcat

After:
 85280 gen/bin/example-cbor-to-json
242216 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
 53328 gen/bin/example-gifplayer
282840 gen/bin/example-imageviewer
 95152 gen/bin/example-json-to-cbor
122720 gen/bin/example-jsonfindptrs
 60448 gen/bin/example-jsonptr
267672 gen/bin/example-sdl-imageviewer
 64792 gen/bin/example-zcat

Before total: 2508672
After  total: 1619192
2021-10-04 12:35:32 +11:00
Nigel Tao 7753368324 Add const to example/imageviewer zooms variable 2021-10-04 09:33:33 +11:00
Nigel Tao 8eaa222592 Add example/imageviewer zoom and filter 2021-10-03 16:42:58 +11:00
Nigel Tao 1cf0df9da4 Tweak example{,sdl-}imageviewer 2021-10-03 15:30:04 +11:00
Nigel Tao 2453a8d52a Run "clang-format-9 -style=Chromium"
Also replace /*...*/ comments with //... comments. The former don't nest
when using /*...*/ to comment out blocks of code.
2021-10-03 13:53:27 +11:00
Přemysl Eric Janouch 550fabd15d Fix the imageviewer demo on DefaultDepth 30
Using Render compositing should make this work reliably
with pratically any root window visual.
2021-09-30 12:14:51 +02:00
Přemysl Eric Janouch a1d9c6a8e6 Make imageviewer not segfault on XCB errors
Fixing the issue properly doesn't seem worth the effort,
shared memory is ugly, and incremental loading is a lot of code.

Xlib - XCB 1:0
2021-09-30 07:31:45 +02:00
Nigel Tao 816475b285 Add "b" (for "binary") to fopen calls
Updates #50
2021-07-07 20:28:35 +10:00
Nigel Tao c86ac5baef Add wuffs_base__table__flattened_length 2021-04-03 11:01:46 +11:00
Nigel Tao 314d265fe8 Spin out wuffs_aux Alloc{Pixbuf,Workbuf}Result 2021-04-02 23:57:18 +11:00
Nigel Tao 3b79564254 Drop redundant DecodeImageCallbacks subclass 2021-04-01 23:12:55 +11:00
Nigel Tao 57ad55355b Have wuffs_aux SelectPixfmt default to BGRA_PREMUL 2021-03-29 22:06:39 +11:00
Nigel Tao 5767f030a3 Add DecodeImageCallbacks::SelectPixfmt 2021-03-11 16:25:16 +11:00
Nigel Tao 441e96a8d4 Add pixel_buffer.set_color_u32_fill_rect 2021-03-11 15:53:09 +11:00
Nigel Tao 1daace6342 Add DecodeImageCallbacks::OnImageFormat def impl 2021-03-11 12:04:00 +11:00
Nigel Tao a21e891e24 Add example/imageviewer OnImageConfig override 2021-03-08 13:25:46 +11:00
Nigel Tao 04f8686989 Add wuffs_aux::DecodeImage 2021-03-03 23:19:58 +11:00
Nigel Tao ccee207661 Change example/imageviewer from C to C++ 2021-02-27 22:40:32 +11:00