Commit Graph
28 Commits
Author SHA1 Message Date
Nigel Tao 59176bb0c7 base: fix color_u64_argb_nonpremul for 64-bit 2026-08-07 09:09:42 +10:00
Nigel Tao 7b71d6840a base: rename color_u32_at color_u32_argb_premul_at 2026-08-06 11:53:49 +10:00
Nigel Tao d9cf0751ca std/vp8: blend VP8X ALPH chunk 2026-08-06 11:05:26 +10:00
Nigel Tao 752993e3a9 base: publicize color_swap_uxx_argb_abgr 2026-04-14 09:59:35 +10:00
Nigel Tao b9145634fd cgen: tweak STB "desired_channels == 0" support 2026-03-02 12:45:56 +11:00
Nigel Tao eec7d22ea3 pixconv: swizzle PIXEL_FORMAT__BGRA_PREMUL_4X16LE
Binary size, before:
145472 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
145472 gen/lib/c/clang-static/wuffs-base-pixconv.o
247720 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
247688 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
155120 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
155120 gen/lib/c/clang-static/wuffs-base-pixconv.o
266992 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
266896 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2025-07-15 15:34:48 +10:00
Nigel Tao 5ec14737f3 pixconv: allow swizzle from PIXEL_FORMAT__Y_16LE
Binary size, before:
142648 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
142648 gen/lib/c/clang-static/wuffs-base-pixconv.o
243368 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
243240 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
145472 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
145472 gen/lib/c/clang-static/wuffs-base-pixconv.o
247720 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
247688 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2025-06-10 11:33:08 +10:00
Nigel Tao 72ae58b76e base: add pixel_buffer.is_opaque 2024-09-18 12:09:52 +09:30
Nigel Tao 42ba720d4e pixconv: allow swizzling to Y (gray) more often
Binary size, before:
124816 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
124816 gen/lib/c/clang-static/wuffs-base-pixconv.o
196736 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
196672 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
142032 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
142032 gen/lib/c/clang-static/wuffs-base-pixconv.o
242712 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
242584 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2024-09-08 22:54:35 +10:00
Nigel Tao 96eda2ec0d std/etc2: support transparency 2024-08-18 15:09:51 +10:00
Nigel Tao affa1e02d4 base: add WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V2
Updates #148
2024-07-09 09:17:09 +10:00
Nigel Tao 37a3c3ce9b base: rename WUFFS_BASE__CPU_ARCH__ETC
See
https://github.com/google/wuffs/issues/148#issuecomment-2130535812

Updates #148
2024-07-08 18:14:59 +10:00
Nigel Tao 5654506497 base: allow swizzling WebP Lossless to gray 2024-07-08 12:35:40 +10:00
Nigel Tao a27a7598f0 base: disable SIMD on 32-bit (not 64-bit) x86
Fixes #145
2024-04-06 15:30:25 +11: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
Nigel Tao b2c7c69227 base: add WUFFS_BASE__FORCE_INLINE 2024-03-29 15:49:41 +11:00
Nigel Tao f1a9d34494 pixconv: fix -Werror=conversion 2024-03-27 22:10:13 +11:00
Nigel Tao bdfbdf407e pixconv: add PIXEL_FORMAT__YA_NONPREMUL support
Binary size, before:
115152 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
115152 gen/lib/c/clang-static/wuffs-base-pixconv.o
162280 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
165352 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
123464 gen/lib/c/clang-dynamic/wuffs-base-pixconv.lo
123464 gen/lib/c/clang-static/wuffs-base-pixconv.o
180768 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
180880 gen/lib/c/gcc-static/wuffs-base-pixconv.o

Updates #143
2024-03-27 19:07:03 +11:00
Nigel Tao a6676851e3 pixconv: sse42-optimize swizzling RGB to RGBA
PNG (as a source pixel format) is RGB or RGBA order. Wuffs' std/png
benchmarks, like the other image formats, decode to BGRA order. *If*
those benchmarks are altered to target RGBA instead, we get:

name                                                       old speed     new speed     delta

wuffs_png_decode_image_40k_24bpp/clang14                   279MB/s ± 0%  293MB/s ± 0%  +5.11%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang14                 289MB/s ± 0%  303MB/s ± 0%  +4.89%  (p=0.008 n=5+5)

wuffs_png_decode_image_40k_24bpp/gcc12                     311MB/s ± 0%  332MB/s ± 0%  +6.84%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc12                   325MB/s ± 0%  339MB/s ± 0%  +4.49%  (p=0.008 n=5+5)

When starting from 3-channel RGB, ending with RGBA is now as fast as
ending with BGRA.

Updates #141
2024-03-26 10:07:58 +11:00
Nigel Tao b4e09690a7 pixconv: fix -Werror=sign-conversion
Updates #138
2023-12-15 11:52:18 +11:00
Nigel Tao 9a68ec70c6 base: use wuffs_private_impl__etc names 2023-11-02 22:30:10 +11:00
Nigel Tao 883ad62c2f pixconv: use wuffs_private_impl__etc names 2023-10-30 22:29:59 +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 e2b9566fc5 base: restrict x86_avx2 to 64-bit (not 32-bit) x86
32-bit C/C++ compilers don't always compile the AVX intrinsics. Per the
60773 bug below,
> clang++ -m32 etc etc fuzz/c/std/jpeg_fuzzer.c
> undefined reference to `_mm_cvtsi128_si64'
> undefined reference to `_mm256_extract_epi64'

See also the "#ifdef __x86_64__" guards in
https://github.com/gcc-mirror/gcc/blob/4a3895903c29ed85da6fcb886f31ff23d4c6e935/gcc/config/i386/emmintrin.h#L228-L231
https://github.com/llvm/llvm-project/blob/08fab9ebecf72a682279d75489dc2460121cbeed/clang/lib/Headers/emmintrin.h#L3502-L3515

Note that -m32 is not the same as -mx32
> $ touch empty.c
> $ gcc       -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __x86_64__ 1
> $ gcc -m32  -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __i386__ 1
> $ gcc -mx32 -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __x86_64__ 1

Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60773
2023-07-23 21:20:35 +10:00
Nigel Tao fed3da528c pixconv: add pixel swizzler x86_sse42 prototypes 2023-07-22 13:23:37 +10:00
Nigel Tao 8954281a4e pixconv: allow decoding to PIXEL_FORMAT__RGB
"wuffs genlib" binary size changes:
 77936 clang-static/wuffs-base-pixconv.o  # Before = 1.00x
 79792 clang-static/wuffs-base-pixconv.o  # After  = 1.02x
173784 gcc-static/wuffs-base-pixconv.o    # Before = 1.00x
177112 gcc-static/wuffs-base-pixconv.o    # After  = 1.02x

Some of the benchmark numbers move around even though they don't use the
new WUFFS_BASE__PIXEL_FORMAT__RGB code paths. It's possibly just a code
alignment coincidence per https://news.ycombinator.com/item?id=23633583

name                                                       old speed      new speed      delta

wuffs_jpeg_decode_19k_8bpp/clang11                          249MB/s ± 0%   251MB/s ± 0%   +0.76%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11             222MB/s ± 0%   225MB/s ± 0%   +1.16%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11              405MB/s ± 0%   406MB/s ± 0%     ~     (p=1.000 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11                         357MB/s ± 0%   356MB/s ± 0%   -0.24%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang11                    370MB/s ± 0%   372MB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11                    504MB/s ± 0%   508MB/s ± 0%   +0.83%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11                       375MB/s ± 0%   374MB/s ± 0%     ~     (p=0.095 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                            258MB/s ± 0%   254MB/s ± 0%   -1.68%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10               267MB/s ± 0%   240MB/s ± 0%   -9.95%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10                537MB/s ± 0%   537MB/s ± 0%     ~     (p=0.556 n=4+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                           458MB/s ± 0%   453MB/s ± 0%   -1.18%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10                      482MB/s ± 0%   478MB/s ± 0%   -0.78%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10                      508MB/s ± 0%   511MB/s ± 0%   +0.49%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10                         489MB/s ± 0%   484MB/s ± 0%   -1.11%  (p=0.016 n=4+5)

wuffs_png_decode_image_19k_8bpp/clang11                     269MB/s ± 0%   275MB/s ± 0%   +2.25%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang11                    328MB/s ± 0%   328MB/s ± 0%     ~     (p=0.841 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang11                     949MB/s ± 0%   962MB/s ± 0%   +1.29%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang11   854MB/s ± 0%   859MB/s ± 0%   +0.54%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang11   822MB/s ± 0%   826MB/s ± 0%   +0.52%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang11                  331MB/s ± 0%   332MB/s ± 0%   +0.15%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                       287MB/s ± 0%   277MB/s ± 0%   -3.46%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                      341MB/s ± 0%   346MB/s ± 0%   +1.34%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10                      1.02GB/s ± 0%  1.01GB/s ± 0%   -0.41%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10     939MB/s ± 0%   916MB/s ± 0%   -2.50%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10     895MB/s ± 0%   874MB/s ± 0%   -2.41%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                    352MB/s ± 0%   350MB/s ± 0%   -0.44%  (p=0.008 n=5+5)

Updates #131
2023-07-16 11:17:45 +10:00
Nigel Tao 7514dede23 std/jpeg: decode color images, not just gray
Updates #42
2023-05-14 23:03:33 +10:00