Composes every validated stage into one decode of test256.bin and compares the
result to the reference test256_dec.png:
codestream ─┬ luma: z→i_s→σ/mask→SORP→y_q→resi→ψ→MCM→ŷ→LSBS→decode_y
└ chroma: z→i_s→σ/mask→SORS→y_q→resi→ψ→(no MCM)→ŷ→LSBS→decode_uv
YUV → EFElinear → eICCI → EFEnonlinear → LEF → BT.709 → RGB
Result: max|Δ| = 1, 4.45% of samples differ. Every differing sample is off by
exactly one, and the fraction sits at the PTQ floor already measured per plane —
luma ~1.4%, chroma ~3.4%, so ~4.4% across the combined RGB is expected. This is
not bit-equality with the reference PNG and is not meant to be: ψ, the MCM stages
and synthesis are 16-bit PTQ. The contract the integer path keeps is determinism —
byte-identical output on every machine — bought with ~1 LSB of accuracy.
Composing the stages is what earned this test its place. Each stage passed in
isolation, yet the composition surfaced four wiring faults no per-stage test could
see, three of them the exact class this test exists to catch:
* hyper_scale / hyper_decoder take z at the 4×4 hyper resolution, not the 16×16
latent plane — a hardcoded 16 indexed off the end of the weights;
* reconstruct_yhat / LSBS take the 16×16 plane dims, which the function halves
internally — passing 2× double-counted;
* eICCI runs in [0,1]; the chain handed it [0,255], the folded BN and ReLUs
misbehaved, and it scored worse than a no-op (already fixed in the eICCI
commit, re-confirmed composed here);
* EFElinear applies `filters_best2`, NOT `filters_best` — the naming is inverted,
and the wrong group has a ~−16 luma cross-gain that blew U/V to −3882.
wai_jpegai_build_e2e_inputs.py extracts every runtime input — the model weights
for both planes, the normative tables, the LSBS and LEF op-point tables, and the
reference RGB — straight from the shipped assets, so the test is reproducible from
the assets alone rather than from hand-made scratch files. Verified: regenerating
the inputs with it and re-running gives the identical 4.45%.
Co-Authored-By: Claude Opus 4.8 <[email protected]>