Skip to content

feat(codecs): AVIF decoding on wasm32 through sqzer-rav1d - #40

Merged
vlad-salone merged 3 commits into
mainfrom
feat/codecs-sqzer-rav1d
Oct 1, 2026
Merged

vlad-salone merged 3 commits into
mainfrom
feat/codecs-sqzer-rav1d

Conversation

@vlad-salone

@vlad-salone vlad-salone commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

ADR-0011 action item 1: the AVIF decoder moves to sqzer-rav1d on every target, and wasm32 gets AVIF decoding with it.

What and why

re_rav1d was archived in June and never built for wasm32. sqzer-rav1d is upstream rav1d main at d3d1cd6, which has the safe Rust API of upstream PR 1439 that no release carries, plus one commit: on wasm32 the crate aliases itself as libc and a 17-line file provides the names it uses there. Every other target keeps the real libc. The library is still named rav1d.

In sqzer-codecs the decoder moves out of the non-wasm dependency table, the cfg gates go, and decode.rs changes its import, the error variant name and a Vec to a Box<[u8]>.

# the wasm32 build in Node 24, before: "unrecognised image format"
pattern-rgb.avif -f auto:  Avif 48x32 via ravif target=Quality(48.0) search=6 trials, score 72.1, reached true
pattern-10bit.avif -f png: Png 48x32 via png target=Lossless
pattern-rgba.avif -f png:  Png 48x32 via png target=Lossless
pattern-rgb.jpg -f auto:   Avif 48x32 via ravif target=Quality(40.0) search=6 trials, score 72.8, reached true

So a wasm32 build reads AVIF, takes a perceptual target for AVIF output and defaults to AVIF for photos. --list-codecs and --json name the decoder rav1d.

The first push ran CI against the fork through a temporary git patch, before the crate was published: all six targets, native and portable, and wasm32 passed. The second commit drops the patch for sqzer-rav1d 0.1.0 from crates.io.

ADR-0011 item 1 is annotated, not ticked. The fix is offered upstream as memorysafety/rav1d#1505. Two parts are left: the AVIF fixtures in the wasm test, which arrives with item 3, and retiring the fork once an upstream release has the Rust API and that fix.

New dependencies

sqzer-rav1d 0.1.0, BSD-2-Clause, in place of re_rav1d 0.1.3. strum moves from 0.26 to 0.27 with it. paste is still pulled, so the advisory ignore stays.

Checklist

  • CHANGELOG.md has an entry under ## Unreleased
  • no new ADR
  • tests cover the change; golden scores are unchanged: 375 portable and 348 native tests pass locally with no score moved
  • cargo fmt, cargo clippy --all-features, cargo test, cargo doc and cargo deny check pass locally

🤖 Generated with Claude Code

vlad-salone and others added 2 commits October 1, 2026 12:03
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vlad-salone
vlad-salone marked this pull request as ready for review October 1, 2026 10:14
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Replaces AVIF decoder dependency and enables it on WebAssembly.

The PR appears safe to merge; no outstanding or new actionable finding was identified.

Summary

The PR replaces re_rav1d with sqzer-rav1d and enables AVIF decoding on wasm32. The change since the previous review updates the ADR action item to record the opened upstream pull request and the remaining work.

Reviews (2) · Last reviewed commit: "docs(adr): ADR-0011 item 1 names the ups..."

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vlad-salone
vlad-salone merged commit 9ae012b into main Oct 1, 2026
22 checks passed
@vlad-salone
vlad-salone deleted the feat/codecs-sqzer-rav1d branch October 1, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant