wai-rs: jpegai_bitstream — tools-header (TON) post-filter chain parser #18
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/jpegai-ton"
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?
Decodes the TON post-filter chain →
ToolsHeader: EFE-linear (B1 means + two decode_filters groups), eICCI (per-tile use flags + signalled Y/joint-UV model indices — the last input the eICCI net needed), EFE-nonlinear (min/max symbol, masks, luma ranges, A1 weights), LEF — in filters-factory order, each gated by its recursive enable flag.Adds the universal width rule as a primitive:
BitReader::read_max(max)readsceil(log2(max+1))bits (referenceHeaderCoder::calc_bits_count). No header field has a fixed width, and several are runtime-dependent — a just-decodedmax_symbolsets the width of the weights after it (65535→16 bits, then 99→7 bits inside the same EFE-linear header).Validated on real test256.bin, ending exactly on bit 973 (+3 pad closing the 63-byte TON), every value matching. Two independent cross-checks: EFN luma range (497/25320) + the 8 A1 weights are the
luma_min_q/luma_max_q/weights_q15of the byte-exactefn_filter; and B1/100 = 125.61/130.91 are the meansefl_chromaconsumes.start_bitis the first filter enable flag, not the TON payload start —_stream_header_partdefaults totool_header, so other tools emit into TON ahead of the chain (2 such bits here).dcharlot referenced this pull request2026-11-06 13:54:17 -05:00