Commit Graph
410 Commits
Author SHA1 Message Date
Claude eb5ae76130 std/brotli: document large-window encoding and short workbufs 2026-10-27 02:40:28 +00:00
Claude b9f9d6ce65 std/brotli: document the encoder at qualities 2 to 9 2026-10-27 01:20:26 +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 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
Claude f33e9f3377 std/softfloat: add bit-exact IEEE 754 binary64/binary32 arithmetic
Wuffs the Language has no floating point types, but some reference
implementations (notably the brotli encoder) make decisions with double and
float arithmetic and libm's log2. Porting them with byte-identical output
needs bit-exact floating point results.

This package implements f64 and f32 add, sub, mul, div, fma, comparisons,
min/max, integer conversions and f64<->f32 conversions on bit patterns,
with round-to-nearest-even, subnormals, infinities and NaNs, following the
structure of Berkeley SoftFloat 3. It also ports glibc 2.39's x86-64
__log2_fma log2 implementation (the variant selected on CPUs with FMA and
AVX2), following the shipped machine code's fused operations.

Verification: test/c/std/softfloat.c checks every operation against the C
compiler's native arithmetic on edge cases and random operands. The
script/manual-test-softfloat-*.c programs run 10^8 random operations per
operation group and compare log2_u64 against libm for every integer in
[1, 2^32) plus 10^7 larger values; all with zero mismatches.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
2026-10-26 22:46:32 +00:00
Nigel Tao 0d8b52336e spec/suitar: fix normalization link 2026-10-20 14:33:59 +11:00
Nigel Tao 0baab7fe72 release: spin in v0.3.6
This copies wuffs-v0.3.c from the v0.3 branch to the main branch. The
main branch is currently working on an unstable v0.4.
2026-10-20 14:32:33 +11:00
Nigel Tao ab24b06450 doc: add lz4, etc to enumerated-media-types.txt 2026-10-18 14:47:55 +11:00
Nigel Tao 89b7cc7a36 base: add WUFFS_BASE__MIME_TYPE__ETC 2026-10-05 16:55:53 +11:00
Nigel Tao b2e6da3024 lib/suitar: allow implicitly-sized entries 2026-09-29 22:31:20 +10:00
Nigel Tao 72045c951e doc: add rar, zip to enumerated-media-types.txt 2026-09-21 09:43:35 +10:00
Nigel Tao 901b740c00 spec/suitar: elaborate on duplicate file names 2026-09-15 10:42:51 +10:00
Nigel Tao 742e8b78d9 lib/suitar: reject names ending in "/." or "/.." 2026-09-15 10:42:51 +10:00
Nigel Tao 0f214ba59c lib/suitar: add trailing EOF blocks
Both /usr/bin/tar and the Go standard library don't seem to need this,
but some other TAR readers might expect it.
2026-09-03 08:31:06 +10:00
Nigel Tao 504f8485f4 lib/suitar: add new Go package
$ TZ=UTC tar -tvf test/data/archive.dense.suitar
-rw-r--r-- nobody/nobody     0 2020-02-05 06:10 artificial/0.bytes
-rw-r--r-- nobody/nobody   853 2020-08-12 14:04 github-tags.json
-rwxr-xr-x nobody/nobody   693 2021-05-03 06:19 hello.sh
-rw-r--r-- nobody/nobody   104 2021-05-03 06:16 non-ascii/αβ.txt
-rw-r--r-- nobody/nobody   151 2021-05-03 06:23 non-ascii/😻.txt
-rw-r--r-- nobody/nobody   208 2020-02-05 06:10 pjw-thumbnail.png
-rw-r--r-- nobody/nobody   942 2020-02-05 06:10 romeo.txt
-rw-r--r-- nobody/nobody   558 2020-02-05 06:10 romeo.txt.gz
2026-09-01 21:55:46 +10:00
Nigel Tao 5d5fb1d6d9 base38: add "BCP 47 as base38" example 2026-08-06 14:57:00 +10:00
Nigel Tao 6e9e2e00c2 std/vp8: accept VP8X (but ignore any ALPH chunk) 2026-07-20 21:24:35 +10:00
Nigel Tao b22c03837f release: spin in v0.3.5
This copies wuffs-v0.3.c from the v0.3 branch to the main branch. The
main branch is currently working on an unstable v0.4.
2026-07-11 20:44:46 +10:00
Nigel Tao 4d5d2e89c0 enumerated-media-types: add some Microsoft values
This covers the list of MIME types at
https://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc
2026-06-23 11:41:37 +10:00
Nigel Tao 15a1cbf055 enumerated-media-types: add some Android values 2026-06-23 11:30:07 +10:00
Nigel Tao 39deb24f40 Merge pull request #155 from hughsie/hughsie/sbom
Add a SBOM template in CycloneDX format
2025-05-19 14:13:22 +10:00
Nigel Tao 43a6814dfe std/handsum: add new package 2025-02-24 11:18:24 +11:00
Richard Hughes 13d041626c Add a SBOM template in CycloneDX format
Improve supply chain security by including a SBOM file with substituted values.

This will be used to construct a composite platform SBOM.

Signed-off-by: Richard Hughes <rhughes@redhat.com>
2024-12-09 13:24:09 +00:00
Nigel Tao f6ccf2c990 base: add range_ie_i32 and rect_ie_i32
Just the C types for now. The Wuffs types can be added later (along with
the base.i32 type).
2024-10-24 19:43:17 +10:30
Nigel Tao 13617c4907 convert-to-nia: add -output-uncompressed-png flag 2024-09-19 17:17:30 +09:30
Nigel Tao a14745aa45 base38: tweak note re 4/2 and 4/4/2 notation 2024-09-14 13:14:21 +10:00
Nigel Tao affff51fbf base: add pixel_format.coloration 2024-09-08 10:37:43 +10:00
Nigel Tao 85af5a4bed std/tga: rename to std/targa 2024-09-08 09:00:10 +10:00
Nigel Tao 8924b5f003 cgen: add ETC__ENABLE_DROP_IN_REPLACEMENT__STB
Fixes #153
2024-09-07 22:21:00 +10:00
Nigel Tao 43b6fef8b1 std/thumbhash: add QUIRK_JUST_RAW_THUMBHASH 2024-09-06 13:23:38 +10:00
Nigel Tao b8740d8881 std/thumbhash: add new package 2024-09-03 20:07:37 +10:00
Nigel Tao 86d16d90df base38: add enumerated-media-types.txt 2024-08-31 13:13:20 +10:00
Nigel Tao bd42fa7af2 base38: reassign alphabet and numbers
It changes from " 0-9?a-z" to ".0-9a-z~". The default or placeholder
changes from " " to "." so it's now always visible. The wildcard changes
from "?" to "~" so it's now sorted last.
2024-08-26 12:30:20 +10:00
Nigel Tao 43df015669 std/etc2: add new package 2024-08-17 15:31:29 +10:00
Nigel Tao a07eb7704b std/jpeg: add QUIRK_REJECT_PROGRESSIVE_JPEGS 2024-08-11 10:15:13 +10:00
Nigel Tao d06700f00b std/qoi: add new package
Fixes #63
2024-08-08 23:49:17 +10:00
Nigel Tao c9fff5b207 std/jpeg: add and use WUFFS_BASE__QUIRK_QUALITY 2024-08-04 23:15:58 +10:00
Nigel Tao fb769ff82f base: disable SIMD on MSVC x86_64 by default
This recreates the case as of commit f1698226 (tag v0.4.0-alpha.4), in
that, by default (without #define'ing a macro or passing an /arch:ETC
compiler flag), Wuffs does not use SIMD on MSVC x86_64.

Commit b64a7610 (after tag v0.4.0-alpha.4, before tag v0.4.0-alpha.5)
changed the default so that x86_64_v2 (roughly equivalent to SSE4.2) was
enabled by default, since the user from issue #148 was enabling that
anyway (in an unsupported way, by #define'ing a macro that was a private
implementation detail) with no problems (and better performance).

However, another user later reported (in issue #151) that enabling SIMD
on MSVC x86_64 somehow lead to ICEs (Internal Compiler Errors).

This commit restores the default to "no SIMD" and it is up to the MSVC
user to opt in to the SIMD code paths. Clang and GCC are unaffected:
SIMD remains enabled by default.

Updates #148
Updates #151
2024-07-31 17:12:55 +10:00
Nigel Tao aae5997e12 lang: remove endwhile keyword 2024-07-08 17:15:48 +10:00
Nigel Tao 09f4500e19 std/webp: add new package (and vp8 placeholder) 2024-05-10 13:52:07 +10:00
Nigel Tao a3bfb57003 release: spin in v0.3.4
This copies wuffs-v0.3.c from the v0.3 branch to the main branch. The
main branch is currently working on an unstable v0.4.

Fixes #146
2024-04-19 21:47:55 +10:00
Nigel Tao da0d51d802 std/png: ignore tRNS chunks for color types 4, 6
Updates #146
2024-04-19 21:31:39 +10:00
Nigel Tao d7f6b81d31 base: have empty_foo() functions use NULL ptr
This largely reverts commit f81deb6b6e.

Updates #135
2024-04-05 15:29:51 +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 24151f8132 doc: update changelog for std/png YA_NONPREMUL 2024-03-28 16:43:06 +11:00
Nigel Tao 0c9b700df0 base: fix PIXEL_FORMAT__YA_{NON,}PREMUL values
These pixel formats have two channels (gray, alpha), not one.

Updates #143
2024-03-27 16:53:19 +11:00
Nigel Tao 793ab36569 std/lzip: add new package 2024-03-01 09:52:54 +11:00
Nigel Tao 22b4ff4842 std/xz: decode concatenated streams 2024-02-26 23:02:40 +11:00
Nigel Tao 9fb3859488 lang: more anticipating io_forget_history 2024-02-09 15:03:44 +11:00
Nigel Tao 4dbea68208 doc: re-arrange some changelog bullets 2023-12-27 18:18:03 +11:00