Commit Graph
13 Commits
Author SHA1 Message Date
Nigel Tao 64ef0df550 mimiclib: #include <limits.h> and <stdint.h>
Updates #175
2026-07-11 20:18:00 +10: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 dfab0d2b3d mimiclib: allow jpeg decoding via stb_image 2023-06-12 17:24:49 +10:00
Nigel Tao d5075c7e94 Push "int i" into "for (int i = etc; etc; etc)" 2021-11-02 14:07:58 +11:00
Nigel Tao 5dd7ede975 Add more png benchmarks for alternative mimic libs
On a mid-range x86_64 laptop:

"libpng" (Debian's /usr/lib/x86_64-linux-gnu/libpng16.so) numbers are
used as a 1.00x baseline for the other libraries.

(†): libpng's "simplified API" doesn't provide a way to ignore the
checksum. We copy the "verify_checksum" numbers for a 1.00x baseline.
Some of the other libraries don't have the option to ignore or verify
the checksum, always doing only one or the other.

----

libpng_decode_19k_8bpp                            58.0MB/s ± 0%  1.00x
libpng_decode_40k_24bpp                           73.1MB/s ± 0%  1.00x
libpng_decode_77k_8bpp                             177MB/s ± 0%  1.00x
libpng_decode_552k_32bpp_ignore_checksum           146MB/s ± 0%  (†)
libpng_decode_552k_32bpp_verify_checksum           146MB/s ± 0%  1.00x
libpng_decode_4002k_24bpp                          104MB/s ± 0%  1.00x

----

wuffs_decode_19k_8bpp/clang9                       131MB/s ± 0%  2.26x
wuffs_decode_40k_24bpp/clang9                      153MB/s ± 0%  2.09x
wuffs_decode_77k_8bpp/clang9                       472MB/s ± 0%  2.67x
wuffs_decode_552k_32bpp_ignore_checksum/clang9     370MB/s ± 0%  2.53x
wuffs_decode_552k_32bpp_verify_checksum/clang9     357MB/s ± 0%  2.45x
wuffs_decode_4002k_24bpp/clang9                    156MB/s ± 0%  1.50x

wuffs_decode_19k_8bpp/gcc10                        136MB/s ± 1%  2.34x
wuffs_decode_40k_24bpp/gcc10                       162MB/s ± 0%  2.22x
wuffs_decode_77k_8bpp/gcc10                        486MB/s ± 0%  2.75x
wuffs_decode_552k_32bpp_ignore_checksum/gcc10      388MB/s ± 0%  2.66x
wuffs_decode_552k_32bpp_verify_checksum/gcc10      373MB/s ± 0%  2.55x
wuffs_decode_4002k_24bpp/gcc10                     164MB/s ± 0%  1.58x

----

libspng_decode_19k_8bpp/clang9                    59.3MB/s ± 0%  1.02x
libspng_decode_40k_24bpp/clang9                   78.4MB/s ± 0%  1.07x
libspng_decode_77k_8bpp/clang9                     189MB/s ± 0%  1.07x
libspng_decode_552k_32bpp_ignore_checksum/clang9   236MB/s ± 0%  1.62x
libspng_decode_552k_32bpp_verify_checksum/clang9   203MB/s ± 0%  1.39x
libspng_decode_4002k_24bpp/clang9                  110MB/s ± 0%  1.06x

libspng_decode_19k_8bpp/gcc10                     59.6MB/s ± 0%  1.03x
libspng_decode_40k_24bpp/gcc10                    77.5MB/s ± 0%  1.06x
libspng_decode_77k_8bpp/gcc10                      189MB/s ± 0%  1.07x
libspng_decode_552k_32bpp_ignore_checksum/gcc10    223MB/s ± 0%  1.53x
libspng_decode_552k_32bpp_verify_checksum/gcc10    194MB/s ± 0%  1.33x
libspng_decode_4002k_24bpp/gcc10                   109MB/s ± 0%  1.05x

----

lodepng_decode_19k_8bpp/clang9                    65.1MB/s ± 0%  1.12x
lodepng_decode_40k_24bpp/clang9                   72.1MB/s ± 0%  0.99x
lodepng_decode_77k_8bpp/clang9                     222MB/s ± 0%  1.25x
lodepng_decode_552k_32bpp_ignore_checksum/clang9               skipped
lodepng_decode_552k_32bpp_verify_checksum/clang9   162MB/s ± 0%  1.11x
lodepng_decode_4002k_24bpp/clang9                 70.5MB/s ± 0%  0.68x

lodepng_decode_19k_8bpp/gcc10                     61.1MB/s ± 0%  1.05x
lodepng_decode_40k_24bpp/gcc10                    62.5MB/s ± 1%  0.85x
lodepng_decode_77k_8bpp/gcc10                      176MB/s ± 0%  0.99x
lodepng_decode_552k_32bpp_ignore_checksum/gcc10                skipped
lodepng_decode_552k_32bpp_verify_checksum/gcc10    139MB/s ± 0%  0.95x
lodepng_decode_4002k_24bpp/gcc10                  62.3MB/s ± 0%  0.60x

----

stbimage_decode_19k_8bpp/clang9                   75.1MB/s ± 1%  1.29x
stbimage_decode_40k_24bpp/clang9                  84.6MB/s ± 0%  1.16x
stbimage_decode_77k_8bpp/clang9                    234MB/s ± 0%  1.32x
stbimage_decode_552k_32bpp_ignore_checksum/clang9  162MB/s ± 0%  1.11x
stbimage_decode_552k_32bpp_verify_checksum/clang9              skipped
stbimage_decode_4002k_24bpp/clang9                80.7MB/s ± 0%  0.78x

stbimage_decode_19k_8bpp/gcc10                    73.3MB/s ± 0%  1.26x
stbimage_decode_40k_24bpp/gcc10                   81.8MB/s ± 0%  1.12x
stbimage_decode_77k_8bpp/gcc10                     214MB/s ± 0%  1.21x
stbimage_decode_552k_32bpp_ignore_checksum/gcc10   145MB/s ± 0%  0.99x
stbimage_decode_552k_32bpp_verify_checksum/gcc10               skipped
stbimage_decode_4002k_24bpp/gcc10                 79.7MB/s ± 0%  0.77x

----

go_decode_19k_8bpp/go1.16                         39.3MB/s ± 1%  0.68x
go_decode_40k_24bpp/go1.16                        46.5MB/s ± 1%  0.64x
go_decode_77k_8bpp/go1.16                         78.3MB/s ± 0%  0.44x
go_decode_552k_32bpp_ignore_checksum/go1.16                    skipped
go_decode_552k_32bpp_verify_checksum/go1.16        120MB/s ± 1%  0.82x
go_decode_4002k_24bpp/go1.16                      50.7MB/s ± 0%  0.49x

----

rust_decode_19k_8bpp/rust1.48                     88.3MB/s ± 0%  1.52x
rust_decode_40k_24bpp/rust1.48                     133MB/s ± 0%  1.82x
rust_decode_77k_8bpp/rust1.48                      180MB/s ± 0%  1.02x
rust_decode_552k_32bpp_ignore_checksum/rust1.48                skipped
rust_decode_552k_32bpp_verify_checksum/rust1.48    146MB/s ± 0%  1.00x
rust_decode_4002k_24bpp/rust1.48                   134MB/s ± 0%  1.29x
2021-03-24 23:36:48 +11:00
Nigel Tao fd8025342e Be able to test and bench the libspng library
That's libspng with an 's', instead of libpng without an 's'.

Wuffs' std/png and std/zlib implementations have not been fully
optimized yet, but as a snapshot, here's how it compares with these
"mimic" libraries, libspng and libpng.

On a mid-range x86_64 laptop:

Wuffs/clang9:
wuffs_png_decode_image_19k_8bpp/clang9                    91.9MB/s ± 0%
wuffs_png_decode_image_40k_24bpp/clang9                    128MB/s ± 0%
wuffs_png_decode_image_77k_8bpp/clang9                     342MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   324MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   258MB/s ± 0%
wuffs_png_decode_image_4002k_24bpp/clang9                  127MB/s ± 0%

Wuffs/gcc10:
wuffs_png_decode_image_19k_8bpp/gcc10                     94.3MB/s ± 0%
wuffs_png_decode_image_40k_24bpp/gcc10                     131MB/s ± 0%
wuffs_png_decode_image_77k_8bpp/gcc10                      348MB/s ± 1%
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    319MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    269MB/s ± 0%
wuffs_png_decode_image_4002k_24bpp/gcc10                   131MB/s ± 0%

libspng/clang9:
mimic_png_decode_image_19k_8bpp/clang9                    59.3MB/s ± 1%
mimic_png_decode_image_40k_24bpp/clang9                   78.4MB/s ± 0%
mimic_png_decode_image_77k_8bpp/clang9                     189MB/s ± 0%
mimic_png_decode_image_552k_32bpp_ignore_checksum/clang9   235MB/s ± 0%
mimic_png_decode_image_552k_32bpp_verify_checksum/clang9   203MB/s ± 0%
mimic_png_decode_image_4002k_24bpp/clang9                  110MB/s ± 0%

libspng/gcc10:
mimic_png_decode_image_19k_8bpp/gcc10                     59.5MB/s ± 0%
mimic_png_decode_image_40k_24bpp/gcc10                    77.6MB/s ± 0%
mimic_png_decode_image_77k_8bpp/gcc10                      188MB/s ± 0%
mimic_png_decode_image_552k_32bpp_ignore_checksum/gcc10    223MB/s ± 0%
mimic_png_decode_image_552k_32bpp_verify_checksum/gcc10    193MB/s ± 0%
mimic_png_decode_image_4002k_24bpp/gcc10                   109MB/s ± 0%

libpng (Debian_Testing_Bullseye /usr/lib/x86_64-linux-gnu/libpng.so):
mimic_png_decode_image_19k_8bpp                           58.3MB/s ± 0%
mimic_png_decode_image_40k_24bpp                          73.1MB/s ± 0%
mimic_png_decode_image_77k_8bpp                            177MB/s ± 0%
mimic_png_decode_image_552k_32bpp_ignore_checksum               skipped
mimic_png_decode_image_552k_32bpp_verify_checksum          146MB/s ± 0%
mimic_png_decode_image_4002k_24bpp                         104MB/s ± 0%
2021-01-22 13:15:42 +11:00
Nigel Tao 170a810486 Add std/png benches for ignore/verify checksums
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   324MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   258MB/s ± 0%

wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    319MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    269MB/s ± 0%
2021-01-22 11:34:52 +11:00
Nigel Tao cf4aff9ef0 Have testlib image_decoder helpers take quirks 2021-01-21 22:29:30 +11:00
Nigel Tao aa2d41e0a0 Add a mimiclib scratch buffer 2020-12-29 21:38:52 +11:00
Nigel Tao 10e8ee5e79 Roll back 0c7a8cc0 re do_bench_image_decode
Commit 0c7a8cc029 is "Have
do_bench_image_decode pass a non-NULL dst". Adding a mandatory memcpy to
do_bench_image_decode noticably slowed down the bench numbers. Removing
the memcpy speeds it back up.

wuffs_gif_decode_1k_bw/clang9                278MB/s ± 0%   373MB/s ± 0%  +34.42%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang9  85.0MB/s ± 0%  91.1MB/s ± 0%   +7.27%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang9   104MB/s ± 0%   114MB/s ± 0%   +9.51%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang9             434MB/s ± 0%   449MB/s ± 0%   +3.59%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang9          115MB/s ± 0%   120MB/s ± 0%   +4.63%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang9                  140MB/s ± 1%   145MB/s ± 0%   +3.16%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang9      301MB/s ± 0%   312MB/s ± 0%   +3.62%  (p=0.016 n=5+4)
wuffs_gif_decode_100k_realistic/clang9       125MB/s ± 0%   127MB/s ± 0%   +1.40%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/clang9      128MB/s ± 0%   129MB/s ± 0%   +0.78%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang9      128MB/s ± 0%   128MB/s ± 1%     ~     (p=0.151 n=5+5)
wuffs_gif_decode_anim_screencap/clang9       586MB/s ± 0%   671MB/s ± 0%  +14.60%  (p=0.016 n=5+4)

wuffs_gif_decode_1k_bw/gcc10                 271MB/s ± 0%   322MB/s ± 0%  +18.81%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10   94.8MB/s ± 0%  99.2MB/s ± 1%   +4.64%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10    116MB/s ± 0%   123MB/s ± 0%   +5.90%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10              374MB/s ± 0%   382MB/s ± 1%   +2.12%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10           116MB/s ± 1%   119MB/s ± 0%   +3.09%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                   137MB/s ± 0%   139MB/s ± 0%   +1.46%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10       286MB/s ± 0%   293MB/s ± 0%   +2.49%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10        118MB/s ± 0%   119MB/s ± 0%   +0.80%  (p=0.016 n=5+4)
wuffs_gif_decode_1000k_full_init/gcc10       121MB/s ± 0%   121MB/s ± 0%   +0.33%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10       121MB/s ± 0%   121MB/s ± 0%   +0.28%  (p=0.016 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10        582MB/s ± 0%   659MB/s ± 0%  +13.25%  (p=0.008 n=5+5)

wuffs_png_decode_19k_8bpp/clang9            88.7MB/s ± 0%  94.2MB/s ± 0%   +6.28%  (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/clang9            104MB/s ± 0%   108MB/s ± 0%   +3.96%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/clang9             335MB/s ± 0%   352MB/s ± 0%   +5.29%  (p=0.008 n=5+5)
wuffs_png_decode_552k_32bpp/clang9           118MB/s ± 0%   119MB/s ± 0%   +0.54%  (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/clang9          109MB/s ± 0%   112MB/s ± 0%   +2.36%  (p=0.008 n=5+5)

wuffs_png_decode_19k_8bpp/gcc10             96.7MB/s ± 0%  98.0MB/s ± 0%   +1.36%  (p=0.029 n=4+4)
wuffs_png_decode_40k_24bpp/gcc10             114MB/s ± 0%   115MB/s ± 0%   +0.79%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/gcc10              316MB/s ± 0%   320MB/s ± 0%   +1.18%  (p=0.016 n=5+4)
wuffs_png_decode_552k_32bpp/gcc10            149MB/s ± 0%   149MB/s ± 0%   +0.17%  (p=0.016 n=5+4)
wuffs_png_decode_4002k_24bpp/gcc10           116MB/s ± 0%   116MB/s ± 0%   +0.09%  (p=0.032 n=5+5)
2020-12-29 21:29:32 +11:00
Nigel Tao 0c7a8cc029 Have do_bench_image_decode pass a non-NULL dst 2020-12-28 15:54:15 +11:00
Nigel Tao 88616cc969 Add std/png mimic benches
Wuffs' std/png and std/zlib implementations have not been optimized yet,
but even at this early stage, they are roughly on par with their
"mimics": equivalent production-quality C libraries (libpng and zlib).

On a mid-range x86_64 laptop:

wuffs_png_decode_19k_8bpp/clang9     95.8MB/s ± 0%
wuffs_png_decode_40k_24bpp/clang9     100MB/s ± 1%
wuffs_png_decode_77k_8bpp/clang9      359MB/s ± 0%
wuffs_png_decode_552k_32bpp/clang9    119MB/s ± 0%
wuffs_png_decode_4002k_24bpp/clang9   101MB/s ± 0%

wuffs_png_decode_19k_8bpp/gcc10      97.2MB/s ± 0%
wuffs_png_decode_40k_24bpp/gcc10      111MB/s ± 0%
wuffs_png_decode_77k_8bpp/gcc10       316MB/s ± 0%
wuffs_png_decode_552k_32bpp/gcc10     132MB/s ± 0%
wuffs_png_decode_4002k_24bpp/gcc10    116MB/s ± 0%

mimic_png_decode_19k_8bpp            58.1MB/s ± 0%
mimic_png_decode_40k_24bpp           73.3MB/s ± 0%
mimic_png_decode_77k_8bpp             177MB/s ± 0%
mimic_png_decode_552k_32bpp           147MB/s ± 0%
mimic_png_decode_4002k_24bpp          104MB/s ± 0%

wuffs_zlib_decode_10k/clang9   126MB/s ± 0%
wuffs_zlib_decode_100k/clang9  136MB/s ± 0%

wuffs_zlib_decode_10k/gcc10    131MB/s ± 0%
wuffs_zlib_decode_100k/gcc10   159MB/s ± 0%

mimic_zlib_decode_10k          133MB/s ± 0%
mimic_zlib_decode_100k         160MB/s ± 0%
2020-12-28 15:52:46 +11:00