wai-rs: derive the entropy-decode inputs — skip_mask + rvs_additive (fixture-free) #28
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/jpegai-derive-inputs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ports the last two inputs the mANS
sgmdecoder needed but that were still read from an e2e fixture. With these, every input of the decode path is computable from the codestream plus normative assets.The skip decision uses the scale without the RVS additive while
sigma_indexuses it with — they differ by exactly the rvs values and are easy to conflate.Band edges are precomputed as
idx2log(thr·2^4)against the reference Log2Lin table, so the 4352-entry table isn not needed at decode time. Band membership is inclusive at the lower edge — only luma exercises this (one block lands exactly on 1352), which is why both planes are tested.Validated against the reference on real test256.bin, both planes, including the composition (derived rvs →
sigma_indexmust reproduce the indices the reference entropy coder consumed):Ports the last two inputs the mANS sgm decoder needed but that were still being read from an e2e fixture. With these, every input of the decode path is computable from the codestream plus normative assets. skip_mask scale_hat = i_s + gain_per_ch ; mask = scale_hat > 382 NOTE the skip decision uses the scale WITHOUT the RVS additive, while sigma_index uses it WITH — the two differ by exactly the rvs values and are easy to conflate. rvs_additive likely = clamp((sum_8x8 |i_s| + 32) >> 6, 0, 4351) band = #{ e in [1003,1352,1937] : likely >= e } rvs = A[grfs_flag ? 0 : 1][band] Band edges are precomputed as idx2log(thr * 2^4) against the reference Log2LinConvertion table, so the 4352-entry table is not needed at decode time; the per-band additives come from the normative scale list scaled by the GRFS branch factor. Band membership is INCLUSIVE at the lower edge — only the luma plane exercises this (one block lands exactly on 1352 and the reference places it in the band above), which is why both planes are tested. Validated against the ISO reference on real test256.bin, both planes, including the composition (derived rvs fed through sigma_index must reproduce the indices the reference entropy coder consumed): luma rvs 40960/40960, mask 40960/40960 (703 coded), sigma 40960/40960 chroma rvs 24576/24576, mask 24576/24576 (537 coded), sigma 24576/24576 Co-Authored-By: Claude Opus 4.8 <[email protected]>