Vips: bump wasm-vips to 0.0.18 for high-bit-depth AVIF decoding#79179
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @kleisauke, @gregbenz. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: -547 kB (-6.36%) ✅ Total Size: 8.05 MB 📦 View Changed
|
swissspidy
left a comment
There was a problem hiding this comment.
Code changes look sensible, haven't tested it though.
|
@gregbenz this should fix the high bit AVIF handling, it pulls in the upstream update. |
|
Great!
FWIW, this size reduction is likely understated, since it doesn't appear to include the Wasm binaries. See for example: |
|
Ah, sorry, the Wasm files are inlined at build time as base64 data URLs, which don't compress well. Emscripten's |
I'll give that a try! |
Gave it a try — it's a solid win. 👍 One clarification on our setup first: we don't use Emscripten's I measured both encodings on the 0.0.18
The bundle-size bot uses gzip, so the headline is ~745 kB (~18%) off the compressed This is unrelated to the AVIF bump, so I'll track it separately in #79187 rather than expand the scope here. Implementation note for whoever picks it up: it's not a drop-in. The binary-encoded string isn't a fetchable data URL, so Thanks for the pointer, @kleisauke! Update: implemented in #79188, with a matching investigation into @kleisauke's Brotli note. Through a faithful reproduction of the full build pipeline the accurate reduction is ~13% gzip / ~16% brotli on |
wasm-vips 0.0.18 links a libaom built with CONFIG_AV1_HIGHBITDEPTH=1, adding native decoding of 10- and 12-bit AVIF images (kleisauke/wasm-vips#118). 0.0.17 fails on these files with "error in tile" decode errors, which is why client-side media processing could not handle high-bit-depth/HDR AVIF uploads. Add an integration test that decodes real 10-, 12-, and 8-bit AVIF fixtures through the actual wasm-vips build (it cannot be mocked, since the bit-depth handling lives entirely in the WebAssembly module).
38ffc55 to
a4a32a9
Compare
|
Flaky tests detected in 5aa3128. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27751578645
|
wasm-vips 0.0.18 no longer hoists to the root node_modules (it installs under packages/vips/node_modules). This broke two things: - test/e2e/bin/gen-ultrahdr-fixture.mjs imported `wasm-vips` by bare specifier, which no longer resolves from its location at runtime (MODULE_NOT_FOUND) and also tripped ESLint's import/no-unresolved. Resolve it via createRequire anchored at packages/vips, mirroring test/performance/specs/media-processing.spec.js, so the generator actually runs again and needs no lint suppression. - packages/vips/src/test/highbitdepth-avif.ts carried a now-unused @typescript-eslint/no-require-imports disable that the current lint config flags; remove it.
fedb6c7 to
5aa3128
Compare
What?
Bumps
wasm-vipsfrom^0.0.17to^0.0.18in@wordpress/vips, enabling native decoding of 10- and 12-bit (high bit depth) AVIF images, and adds an integration test that decodes real high-bit-depth AVIF fixtures.Closes #78889
Why?
Client-side media processing could not handle high-bit-depth / HDR AVIF uploads because the bundled
wasm-vipsbuild could not decode them. kleisauke/wasm-vips#118 ("Enable HDR AVIF support, allows bit depths of 10 and 12") fixes this upstream by linking alibaombuilt withCONFIG_AV1_HIGHBITDEPTH=1, and it shipped in[email protected].This is the upstream-supported alternative to vendoring a custom build in #78894, which can now be closed. It drops a large checked-in custom WASM binary and the multi-threaded/Web-Worker model that build required; the stock
wasm-vipsbuild is single-threaded and structurally identical to 0.0.17 (samevips.wasm/vips-heif.wasmmodule files and package exports), so no source changes are needed beyond the version bump.How?
wasm-vipsdependency to^0.0.18and update the lock file.packages/vips/src/test/highbitdepth-avif.ts) plus 10-, 12-, and 8-bit AVIF fixtures. Unlike the other tests in this package, it does not mockwasm-vips, because high-bit-depth decoding happens entirely inside the WebAssembly module; it runs in the Node test environment so the package's Node build is used (no Web Worker).Testing Instructions
Verified locally that the bump fixes the decode (10/12-bit gradient AVIFs generated with
avifenc --depth 10/12):[email protected](before)error in tiledecode errors)[email protected](this PR)ushort/rgb16) imageTo run the new test:
All three vips suites pass (28 tests).