wai: register the byte-exact JPEG-AI decoder + restore the byte-equality matrix #50
Merged
dcharlot
merged 6 commits from 2026-08-01 05:43:10 -04:00
wai-jpegai-integrate into main 2026-08-01
wai: document the reconstruction binding + dispatch/conformance changes
Some checks failed
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 4s
wai cross-architecture byte-equality / linux-x86_64 (pull_request) Successful in 14s
wai cross-architecture byte-equality / linux-aarch64 (pull_request) Successful in 32s
wai cross-architecture byte-equality / macos-arm64 (reference) (pull_request) Successful in 51s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 31s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 15s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 56s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 20s
WAI neural decoders end-to-end / synthetic fixtures → Rust decode → reference (±4) (pull_request) Failing after 1m7s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 1m26s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 23s
WAI conformance / cargo-class corpora · windows (pull_request) Successful in 1m33s
WAI conformance / cross-arch byte-equality · windows (pull_request) Successful in 22s
wai cross-architecture byte-equality / windows-x86_64 (pull_request) Failing after 10m27s
- SPEC §5: reference extensions/reconstruction-binding.md alongside the other provenance sub-specs, so the new capability is discoverable from the spec. - CHANGELOG: entries for the reproducible-reconstruction binding (the C2PA/ JPEG-Trust hard binding over decoded pixels), the wai.image.jpegai dispatch now preferring the byte-exact decoder, and the restored byte-equality matrix. Docs only; no code change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
wai-rs: mark the legacy ORT mANS decoder, point new code at the canonical one
Some checks failed
wai cross-architecture byte-equality / linux-aarch64 (pull_request) Successful in 56s
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 1m2s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 4s
wai cross-architecture byte-equality / linux-x86_64 (pull_request) Successful in 16s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 33s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 15s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 1m39s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 1m10s
wai cross-architecture byte-equality / macos-arm64 (reference) (pull_request) Successful in 4m4s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 59s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 20s
WAI neural decoders end-to-end / synthetic fixtures → Rust decode → reference (±4) (pull_request) Failing after 3m27s
wai cross-architecture byte-equality / windows-x86_64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · windows (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · windows (pull_request) Has been cancelled
Two mANS decoders exist: the crate-root `jpegai_mans` (byte-exact, in the cross-arch byte-equality matrix, used by the deterministic decode) and this `neural/jpegai_mans` (the older port backing the float ORT fallback). They are cleanly separated by path — only `neural/jpegai.rs` uses this one — so rather than force a risky merge of the fallback's entropy stage, mark this copy legacy/ORT-only with a pointer to the canonical crate-root decoder and the deprecation direction: it stays only while the ORT fallback does, and goes when the deterministic path fully supersedes it. Also verified this pass (not a code change): the byte-exact decode compiles to wasm32-unknown-unknown under `neural_int`, so the deterministic reconstruction runs on every host including the browser — the portability half of the byte-exact contract, alongside the entropy stage's presence in the cross-arch byte-equality CI matrix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
wai: reproducible-reconstruction binding — a C2PA/JPEG-Trust hard binding over pixels
The byte-exact decoder's payoff: a provenance binding neural-coded media normally cannot carry. A hard binding hashes asset bytes; over the decoded image it was impossible, because a neural decode isn't reproducible — JPEG AI's own normative conformance point is the entropy-decoder output (not pixels), and its multi-branch design lets one codestream reconstruct three ways, so a decoded-pixel hash isn't portable. Provenance over the rendered result has had to fall back to fuzzy soft bindings. WAI decodes to RGB deterministically, which restores a stable, portable decoded-pixel hash — pinning one reconstruction is a determinism guarantee beyond what the base standard requires. This adds: - reconstruction_binding (feature provenance): ReconstructionBinding::bind hashes the canonical RGB8 buffer (row-major, no padding) under a descriptor that pins the reproducible decode (synthesis branch / profile / level / layout / color space); verify re-decodes-and-compares. SHA-256 — the C2PA default — so the digest is reproducible by any validator. bind/verify/tamper/JSON tests pass. - extensions/reconstruction-binding.md: the standard. Decode-equivalence conformance; carriage as a custom C2PA/JPEG-Trust assertion (science.transaction.wai.hash. reconstruction, CBOR, beside the standard byte-binding); and a note that a signed binding over reconstructed content is a substrate for machine-readable AI-content marking (e.g. EU AI Act Article 50, from 2 Aug 2026) — stated as a capability, not a legal claim. It is the reconstruct-side analogue of the provenance extension: that binds the opaque carried bytes; this binds the reconstructed pixels. Co-Authored-By: Claude Opus 4.8 <[email protected]>
wai-rs: dispatch wai.image.jpegai to the deterministic decoder when its bundle ships
The envelope dispatched `wai.image.jpegai` to the old ORT float decode even after the byte-exact decoder merged. Wire the deterministic path in, additively: when the model directory carries the integer weight bundle (`weights/*.json` + `norm.json`, as `tools/wai_jpegai_build_e2e_inputs.py` produces), decode through `jpegai_decode::decode` — the reconstruction with a portable decoded-pixel hash. When that bundle is absent, fall back to the ORT decode unchanged, so existing ONNX bundles keep working. `neural` already implies `neural_int`, so the deterministic module is reachable from the dispatch. The file I/O lives at the dispatch boundary (`try_jpegai_exact`), keeping `jpegai_decode` itself I/O-free; the weight/norm loaders reuse `IntNet::from_json`, `Weights::from_json`, and a new `IcciNet::from_json` (+ `Conv`/`IcciPath::from_json`). Tested (feature `neural`): with the bundle present the loader decodes the real test256 codestream to a 256×256 RGB image; with it absent `try_jpegai_exact` returns None so dispatch falls back. Builds clean under the ORT feature. Co-Authored-By: Claude Opus 4.8 <[email protected]>
wai: house-style pass on public copy — drop comparisons, vendor names, vanity counts
Bring the git-visible surfaces in line with the framing rules (self-referential;
no competitive comparisons, no vanity metrics, describe by capability):
- SPEC.md neural table: drop company prefixes (Meta/Descript-company/Kyutai → the
capability's own model identifier), drop BD-rate "vs VTM/VVC" comparisons and the
"current SOTA" superlative (describe each capability's regime instead), and reword
the "vs the float X family that desyncs" lines as self-referential statements of
why the integer contract exists ("a float decode desyncs on…").
- README status line: "passes 11 … tests" → "round-trips every registered capability
through the full envelope" (a count that describes coverage, not a number that drifts).
- glossary: "canonical 342-entry dataset" → "canonical survey dataset".
Unchanged on purpose: "dispatches to SOTA standard codecs" and similar — that is the
ingest thesis (we route to the best existing codecs), self-referential, not a
comparison of our own work; and the source-column model IDs, which are factual
dependency pointers.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
wai: register the byte-exact JPEG-AI decoder + restore the byte-equality matrix
Integration follow-through on the merged jpegai_decode: make the decoder visible
where the standard describes itself, and get it into the cross-arch matrix.
SPEC/docs:
- Register `wai.image.jpegai` in SPEC.md §5 (neural table) — a live, dispatchable
capability was absent from the normative menu. Framed as decode-equivalence: one
pinned reconstruction of an ISO/IEC 6048 codestream to RGB, reproducible on every
machine (a portable decoded-pixel hash), entropy/dequant integer-exact, synthesis
within 1 LSB of the reference.
- CHANGELOG entry for the byte-exact codestream→RGB decoder, distinguishing its
decode-equivalence profile from the all-i64 hash-portable in-house codecs.
- Fix the stale CAP_IMAGE_JPEGAI comment ("decoder library not yet in this crate" —
untrue post-merge) and drop its "~30% over conventional SOTA" comparison.
byte-exact-conformance:
- The crate did not compile on main: `rans.rs` was moved out of `neural/` to the
wai-rs crate root, but the shim still #[path]-included the old `neural/rans.rs`;
the moved file also references `crate::int_entropy`. Repoint rans to the crate
root and shim `int_entropy` (self-contained). This restores the cross-arch
byte-equality build.
- Add a golden that decodes the same ISO reference mANS stream through the MERGED
decoder's entropy stage (crate-root `jpegai_mans`, flat-table/sliced-offset API)
and asserts the identical symbols. The decoder `wai.image.jpegai` actually
reconstructs with is now in the byte-equality matrix, not only the older
`neural/` port. 15 conformance tests pass.
Co-Authored-By: Claude Opus 4.8 <[email protected]>