67 Commits
Author SHA1 Message Date
Claude 36a4380062 std/brotli: test encoder dictionaries and document them
Add mimic_brotli_encode_with_dictionaries to the mimic library and
encoder dictionary tests: the add_dictionary API, its workbuf
accounting and rejection cases (matching libbrotlienc's default build),
a parity grid over qualities 0 to 9 with several dictionary sets, stream
offsets, large window, flushes and metadata, and dictionaries of 2 to
33 MiB, each round tripped through both decoders.

Document the encoder's dictionary API, workbuf layout and differences
from the C code.
2026-10-27 05:28:37 +00:00
Claude d74d28bef9 Merge branch 'm1c-decoder-extensions' into claude/project-thread-0izcgq
Combines the encoder (quality 0 and 1) with the decoder's large-window
mode and custom dictionaries. The test and mimic files take both sides'
new sections; the fuzzer gains the std/softfloat module that the
encoder now pulls into std/brotli.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
2026-10-26 23:59:14 +00:00
Claude ca1ba9d134 std/brotli: add an encoder for quality levels 0 and 1
Adds a brotli encoder (std/brotli's encoder struct, a base.io_transformer)
whose output is byte-identical to libbrotlienc v1.2.1 for quality levels 0
and 1, mirroring encode.c's BrotliEncoderCompressStream(Fast),
compress_fragment.c and compress_fragment_two_pass.c, plus the entropy
coding and bit stream helpers they need. Every double operation goes
through std/softfloat, following the C evaluation order exactly.

Parameters are quirks (encode_quirks.wuffs) that mirror
BrotliEncoderSetParameter, sanitized at the first transform_io call.
Each transform_io resumption corresponds to one C call with available_in
equal to the readable src length; a closed src is FINISH; request_flush!
and request_emit_metadata! make the next resumption a FLUSH or
EMIT_METADATA call. Qualities 2 to 11 return "#unsupported encoder
quality" for now. Encoder tables are generated by
script/print-brotli-tables.go -encoder.

Tests: round trips through the Wuffs decoder over the corpus and synthetic
inputs; with -mimic, byte-exact comparisons against libbrotlienc over
quality × window × mode × input chunking × flush schedule × metadata ×
size hint. script/manual-test-brotli-encoder-parity.c runs the full
grid: 86,268 configurations, zero mismatches.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
2026-10-26 23:55:56 +00:00
Claude b9be8feaee std/brotli: large-window mode, custom dictionaries and a fuzzer
Completes the decoder's feature set relative to libbrotlidec v1.2.1:

- QUIRK_LARGE_WINDOW mirrors BROTLI_DECODER_PARAM_LARGE_WINDOW: the
  large-window WBITS escape, window bits up to 30, the 544-symbol distance
  alphabet and 64-bit distance arithmetic, with workbuf_len growing to
  (1 << 30) + 542 when the quirk is set.
- decoder.add_dictionary! mirrors BrotliDecoderAttachDictionary for raw
  (LZ77 prefix) and serialized shared dictionaries: compound-dictionary
  distance mapping, the shared-dictionary parser (custom word lists,
  transform lists including the SHIFT transforms, context-dependent
  dictionary selection, prefix dictionaries) and all of its validation.
  Wuffs structs cannot hold slices, so the dictionary bytes are copied
  into the front of the caller's workbuf; the layout is documented in
  the README. Serialized dictionaries are accepted as in a
  BROTLI_EXPERIMENTAL build of libbrotli.
- fuzz/c/std/brotli_fuzzer.c, exercising the quirk, dictionaries and
  random I/O limits.

Tests: new golden vectors for large windows (including a 17 MiB
far-distance stream generated in the test), raw and serialized
dictionaries, nine more malformed inputs, and mimic comparisons that
attach the same dictionaries to libbrotlidec. Differential runs over
2.7 million mutated large-window and dictionary streams found no
divergence from libbrotlidec.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
2026-10-26 23:45:06 +00:00
Claude 4978207531 std/brotli: add a brotli decoder with parity to libbrotlidec v1.2.1
This is the first milestone of a byte-exact rewrite of brotli (reference
implementation tag v1.2.1) in Wuffs. The decoder mirrors c/dec/decode.c
function by function, including its validation checks: the same output for
valid input and the same verdict, with each BROTLI_DECODER_ERROR_FORMAT_*
code mapped to a Wuffs status (see std/brotli/README.md). The C state
machine is replaced by Wuffs coroutines, so decoding works with arbitrarily
small src and dst buffers.

The history window lives in the caller's workbuf. Huffman table groups,
context maps and the static dictionary scratch space live in the decoder
struct. The static dictionary, transforms, context lookup tables and prefix
code tables in common_tables.wuffs are generated from the brotli source by
script/print-brotli-tables.go.

Tests: golden tests on the upstream tests/testdata vectors and on streams
produced by the v1.2.1 CLI at several qualities and window sizes, 1-byte
I/O limits, truncation at every prefix, malformed inputs per error code,
trailing data and workbuf boundaries. With -mimic, every vector and every
malformed input is also compared against libbrotlidec, including the exact
error code. A differential run over about a million mutated inputs found
no divergence.

Not yet supported (left as TODOs): large-window brotli, custom/shared
dictionaries, metadata callbacks and fast paths.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
2026-10-26 22:46:34 +00:00
Nigel Tao 64ef0df550 mimiclib: #include <limits.h> and <stdint.h>
Updates #175
2026-07-11 20:18:00 +10:00
Nigel Tao b2a2486096 std/vp8: use YCC_UPSAMPLING__FANCY_LIKE_LIBWEBP
Updates PR #168
2026-07-03 21:47:34 +10:00
Nigel Tao b4c8b9c238 test/c/mimiclib/webp: use no_fancy_upsampling
This commit, part of a series, is inspired by pull request PR #168 by
Damian Kaczmarek (with AI assistance), with some modifications.

Updates PR #168
2026-06-22 11:03:14 +10:00
Nigel Tao 6c8a43390b test: add webp mimic tests and benches 2024-07-08 15:54:40 +10:00
Nigel Tao ce0cee444d std/xz: add new package 2023-12-25 13:24:24 +11:00
Nigel Tao 57f01ec3f6 std/lzma: add new package 2023-12-12 23:41:26 +11:00
Nigel Tao b900be0315 mimiclib: use OpenSSL EVP API for sha256
The SHA256_Etc API is deprecated in OpenSSL 3.0.
2023-10-24 22:29:26 +11:00
Nigel Tao 50abf5eb6a std/sha256: add new package 2023-10-14 18:14:36 +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 1304ee6265 std/xxhash64: add new package 2023-10-06 13:10:47 +11: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 bec02d7c31 std/xxhash32: add new package 2023-10-05 19:08:22 +11:00
Nigel Tao dfab0d2b3d mimiclib: allow jpeg decoding via stb_image 2023-06-12 17:24:49 +10:00
Nigel Tao 4751ef4de5 test: add std/jpeg mimic tests and benches 2023-06-04 12:44:17 +10:00
Nigel Tao fff55bee66 Add std/bzip2 mimic tests and benches 2022-05-19 15:35:13 +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 be546c3587 Be able to test and bench the libdeflate library
name                                                               old speed      new speed       delta

wuffs_adler32_10k/clang9                                           11.4GB/s ± 2%   11.6GB/s ± 2%     +1.26%  (p=0.013 n=9+10)
wuffs_adler32_100k/clang9                                          13.7GB/s ± 1%   13.6GB/s ± 1%       ~     (p=0.277 n=8+9)

wuffs_adler32_10k/gcc10                                            12.2GB/s ± 0%   11.4GB/s ± 1%     -7.01%  (p=0.000 n=8+9)
wuffs_adler32_100k/gcc10                                           12.0GB/s ± 1%   11.7GB/s ± 1%     -2.80%  (p=0.000 n=9+9)

mimic_adler32_10k                                                  1.91GB/s ± 0%  25.24GB/s ± 1%  +1218.88%  (p=0.000 n=9+9)
mimic_adler32_100k                                                 1.87GB/s ± 0%  22.94GB/s ± 1%  +1126.66%  (p=0.000 n=10+10)

wuffs_crc32_ieee_10k/clang9                                        7.81GB/s ± 0%   7.70GB/s ± 0%     -1.41%  (p=0.000 n=8+8)
wuffs_crc32_ieee_100k/clang9                                       10.0GB/s ± 2%   10.6GB/s ± 1%     +5.25%  (p=0.000 n=7+8)

wuffs_crc32_ieee_10k/gcc10                                         9.80GB/s ± 1%  10.03GB/s ± 1%     +2.35%  (p=0.000 n=9+10)
wuffs_crc32_ieee_100k/gcc10                                        13.1GB/s ± 0%   12.9GB/s ± 0%     -1.52%  (p=0.000 n=10+9)

mimic_crc32_ieee_10k                                                842MB/s ± 1%  12952MB/s ± 0%  +1437.67%  (p=0.000 n=10+9)
mimic_crc32_ieee_100k                                               838MB/s ± 2%  13363MB/s ± 1%  +1493.79%  (p=0.000 n=10+9)

wuffs_deflate_decode_1k_full_init/clang9                            101MB/s ± 0%    106MB/s ± 1%     +4.22%  (p=0.000 n=8+10)
wuffs_deflate_decode_1k_part_init/clang9                            119MB/s ± 1%    121MB/s ± 1%     +1.39%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_full_init/clang9                           222MB/s ± 0%    215MB/s ± 0%     -3.24%  (p=0.000 n=9+9)
wuffs_deflate_decode_10k_part_init/clang9                           228MB/s ± 0%    218MB/s ± 3%     -4.47%  (p=0.000 n=10+9)
wuffs_deflate_decode_100k_just_one_read/clang9                      291MB/s ± 0%    286MB/s ± 3%     -1.85%  (p=0.000 n=10+10)
wuffs_deflate_decode_100k_many_big_reads/clang9                     189MB/s ± 1%    178MB/s ± 1%     -5.50%  (p=0.000 n=10+10)

wuffs_deflate_decode_1k_full_init/gcc10                            99.1MB/s ± 2%  102.1MB/s ± 1%     +3.12%  (p=0.000 n=10+9)
wuffs_deflate_decode_1k_part_init/gcc10                             117MB/s ± 1%    121MB/s ± 1%     +3.41%  (p=0.000 n=10+9)
wuffs_deflate_decode_10k_full_init/gcc10                            215MB/s ± 1%    218MB/s ± 1%     +1.55%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_part_init/gcc10                            220MB/s ± 1%    225MB/s ± 0%     +2.08%  (p=0.000 n=10+8)
wuffs_deflate_decode_100k_just_one_read/gcc10                       281MB/s ± 1%    279MB/s ± 1%       ~     (p=0.105 n=10+10)
wuffs_deflate_decode_100k_many_big_reads/gcc10                      182MB/s ± 1%    180MB/s ± 0%     -1.14%  (p=0.000 n=9+7)

mimic_deflate_decode_1k_full_init                                   138MB/s ± 1%    179MB/s ± 1%    +29.56%  (p=0.000 n=10+10)
mimic_deflate_decode_10k_full_init                                  155MB/s ± 2%    268MB/s ± 1%    +72.15%  (p=0.000 n=9+10)
mimic_deflate_decode_100k_just_one_read                             191MB/s ± 0%    269MB/s ± 1%    +40.38%  (p=0.000 n=10+10)
mimic_deflate_decode_100k_many_big_reads                            147MB/s ± 1%         skipped

wuffs_gzip_decode_10k/clang9                                        218MB/s ± 1%    211MB/s ± 1%     -3.18%  (p=0.000 n=8+9)
wuffs_gzip_decode_100k/clang9                                       282MB/s ± 0%    282MB/s ± 0%       ~     (p=0.113 n=9+9)

wuffs_gzip_decode_10k/gcc10                                         215MB/s ± 1%    231MB/s ± 1%     +7.34%  (p=0.000 n=10+10)
wuffs_gzip_decode_100k/gcc10                                        271MB/s ± 2%    293MB/s ± 0%     +7.84%  (p=0.000 n=10+9)

mimic_gzip_decode_10k                                               132MB/s ± 1%    263MB/s ± 0%    +99.23%  (p=0.000 n=10+9)
mimic_gzip_decode_100k                                              156MB/s ± 1%    262MB/s ± 3%    +67.93%  (p=0.000 n=9+10)

wuffs_zlib_decode_10k/clang9                                        223MB/s ± 0%    212MB/s ± 1%     -5.05%  (p=0.000 n=7+10)
wuffs_zlib_decode_100k/clang9                                       280MB/s ± 0%    280MB/s ± 0%       ~     (p=0.867 n=8+7)

wuffs_zlib_decode_10k/gcc10                                         232MB/s ± 2%    220MB/s ± 1%     -5.42%  (p=0.000 n=10+10)
wuffs_zlib_decode_100k/gcc10                                        286MB/s ± 5%    277MB/s ± 0%     -2.88%  (p=0.002 n=10+9)

mimic_zlib_decode_10k                                               145MB/s ± 0%    266MB/s ± 0%    +84.02%  (p=0.000 n=10+9)
mimic_zlib_decode_100k                                              173MB/s ± 1%    265MB/s ± 2%    +53.31%  (p=0.000 n=10+9)
2021-04-20 23:33:58 +10: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
Nigel Tao 2784613b49 Add n_bytes_out arg to gif bench functions 2020-06-01 13:14:14 +10: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 b92ea03889 Fix mimiclib/deflate-gzip-zlib.c build with miniz 2019-10-20 20:47:18 +11:00
Nigel Tao c36b4d79c4 Add a mimic test for zlib dictionaries 2019-08-11 20:06:29 +10:00
Nigel Tao 881474be5a Remove "0 means no I/O limit" in tests 2019-07-06 08:41:46 +10:00
Nigel Tao ffeb2bff63 Split benchmarks for full / partial initialization 2019-02-24 16:54:19 +11:00
Nigel Tao 11a6819be9 Add a deflate distance-code-31 test 2019-02-02 13:04:09 +11:00
Nigel Tao 670b45be53 Add some "horizontal rule" comment lines 2019-02-02 08:10:08 +11:00
Nigel Tao 109d6f04bc Add std/deflate many_big_read benchmarks 2019-01-13 10:08:40 +11:00
Nigel Tao f1c5bb6cb7 Add BGRA GIF benchmark, not just indexed color 2018-12-08 21:24:26 +11:00
Nigel Tao 6fed251b40 Split an io_buffer's fields into data and meta 2018-09-15 08:45:50 +10:00
Nigel Tao 76c6af4ff4 Use some more animated GIF test data 2018-05-10 10:14:07 +10:00
Nigel Tao 97aab37462 Rename buf1, reader1, etc to io_buffer, io_reader
Also remove the unused Buf1, Buf2 and Usize tokens.
2018-04-05 20:49:48 +10:00
Nigel Tao a2949fe28d Add Adler32 and CRC32/IEEE tests for pi's digits 2018-03-25 21:54:07 +11:00
Nigel Tao 372618c817 Use the faster mimic_deflate API
name                             old speed     new speed     delta
mimic_deflate_decode_1k/gcc      217MB/s ± 1%  217MB/s ± 1%     ~     (p=1.000 n=5+5)
mimic_deflate_decode_10k/gcc     260MB/s ± 2%  263MB/s ± 1%     ~     (p=0.421 n=5+5)
mimic_deflate_decode_100k/gcc    277MB/s ± 1%  316MB/s ± 1%  +13.95%  (p=0.008 n=5+5)

Note that these numbers are for the C zlib library (these are "mimic"
numbers), not for the Wuffs code.
2018-01-05 18:22:25 +11:00
Nigel Tao 4877279ee7 Be able to test and bench the miniz library
For the record, benchstat numbers for 'old' being zlib-the-library and
'new' being miniz are below. Neither 'old' or 'new' is Wuffs code.

name                             old speed     new speed     delta
mimic_deflate_decode_1k/clang    217MB/s ± 1%  175MB/s ± 1%  -19.54%  (p=0.008 n=5+5)
mimic_deflate_decode_10k/clang   262MB/s ± 2%  222MB/s ± 0%  -15.34%  (p=0.008 n=5+5)
mimic_deflate_decode_100k/clang  281MB/s ± 1%  262MB/s ± 0%   -6.86%  (p=0.008 n=5+5)
mimic_deflate_decode_1k/gcc      220MB/s ± 1%  169MB/s ± 0%  -23.12%  (p=0.008 n=5+5)
mimic_deflate_decode_10k/gcc     267MB/s ± 0%  266MB/s ± 0%     ~     (p=0.222 n=5+5)
mimic_deflate_decode_100k/gcc    283MB/s ± 0%  282MB/s ± 1%     ~     (p=0.690 n=5+5)
mimic_zlib_decode_10k/clang      243MB/s ± 1%  197MB/s ± 1%  -18.68%  (p=0.008 n=5+5)
mimic_zlib_decode_100k/clang     287MB/s ± 1%  229MB/s ± 1%  -20.13%  (p=0.008 n=5+5)
mimic_zlib_decode_10k/gcc        243MB/s ± 0%  240MB/s ± 6%     ~     (p=0.730 n=5+5)
mimic_zlib_decode_100k/gcc       288MB/s ± 1%  260MB/s ± 0%   -9.51%  (p=0.008 n=5+5)
2017-12-15 11:33:35 +11:00
Nigel Tao 1388f84e5c Rename std/flate to std/deflate 2017-12-04 10:27:48 +11:00
Nigel Tao d168e6977b Rename test/c/mimiclib/flate.c 2017-12-03 14:34:41 +11:00
Nigel Tao dd3f0b9ed4 Add a placeholder std/zlib package 2017-12-02 11:21:30 +11:00