wai-rs: derive the dequant gain — the last fixture-sourced decoder input #29

Merged
dcharlot merged 17 commits from jpegai-dequant-derive into main 2026-07-26 05:56:22 -04:00
Owner

The per-position dequant gain was the one input still read from a dumped fixture. It is now built from normative assets alone, closing the derivation chain.

Verified on real test256.bin: the RVS stage is bit-exact against the ISO reference on both planes (luma 40960/40960, chroma 24576/24576), and the derived tables match the reference buildTables() output for all three cwg variants. The same scale list reproduces RVS_ADDITIVE exactly, so those previously-tabulated constants are now cross-checked against their derivation.

Three hazards pinned down by assertions, each of which silently corrupts the result:

  • scale rounding is half-to-even (125*1.06 is exactly 132.5; half-away-from-zero picks the wrong multiplier)
  • the reference has integer >>16 and float /2^16 paths selected by a device comparison, disagreeing on negative input
  • fusing the two stages into one gain map costs a last-bit f32 difference

70 existing tests still pass.

Co-Authored-By: Claude Opus 4.8 [email protected]

The per-position dequant gain was the one input still read from a dumped fixture. It is now built from normative assets alone, closing the derivation chain. **Verified on real `test256.bin`:** the RVS stage is bit-exact against the ISO reference on both planes (luma 40960/40960, chroma 24576/24576), and the derived tables match the reference `buildTables()` output for all three cwg variants. The same scale list reproduces `RVS_ADDITIVE` exactly, so those previously-tabulated constants are now cross-checked against their derivation. Three hazards pinned down by assertions, each of which silently corrupts the result: - scale rounding is **half-to-even** (`125*1.06` is exactly `132.5`; half-away-from-zero picks the wrong multiplier) - the reference has integer `>>16` and float `/2^16` paths selected by a *device comparison*, disagreeing on negative input - fusing the two stages into one gain map costs a last-bit f32 difference 70 existing tests still pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
dcharlot force-pushed jpegai-dequant-derive from 9593fa71bd
Some checks failed
WAI conformance / cargo-class corpora · macos-latest (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · ubuntu-24.04-arm (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · ubuntu-latest (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · windows-latest (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · macos-latest (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · ubuntu-24.04-arm (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · ubuntu-latest (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · windows-latest (pull_request) Has been cancelled
to 1c98db7fd5
Some checks failed
smart-byte conformance gate / Validate conformance JSON files (pull_request) Successful in 3s
wai cross-architecture byte-equality / macos-arm64 (reference) (pull_request) Failing after 5s
wai cross-architecture byte-equality / linux-aarch64 (pull_request) Failing after 4s
wai cross-architecture byte-equality / windows-x86_64 (pull_request) Failing after 4s
smart-byte conformance gate / Spec changes require vector-pack updates (pull_request) Successful in 3s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Failing after 3s
smart-byte conformance gate / VERSIONS.md and README.md must exist (pull_request) Successful in 3s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Failing after 3s
joule-code conformance gate / Build + round-trip C1-C4 vectors (pull_request) Failing after 2s
WAI conformance / cargo-class corpora · windows (pull_request) Failing after 9s
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Failing after 2s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 3s
WAI conformance / cross-arch byte-equality · windows (pull_request) Failing after 10s
wai cross-architecture byte-equality / linux-x86_64 (pull_request) Failing after 2s
WAI conformance / cargo-class corpora · linux (pull_request) Failing after 3s
WAI conformance / cross-arch byte-equality · linux (pull_request) Failing after 2s
WAI neural decoders end-to-end / synthetic fixtures → Rust decode → reference (±4) (pull_request) Failing after 45s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 1m24s
WAI conformance / cross-arch byte-equality · macos (pull_request) Failing after 18s
2026-07-26 05:53:08 -04:00
Compare
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!29
No description provided.