code wiki / (root) / nx_av1_ec_gate.nx

nx_av1_ec_gate.nx

buildroot/runtime/nx_av1_ec_gate.nx

6364 B154 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic av1
docsdependenciesstructsconstsfunctions

about

nx_av1_ec_gate.nx -- proves the AV1/AV2 multi-symbol CDF arithmetic decoder. This gate exists because writing this module produced a real bug: the first draft mixed libaom's INVERTED cdf convention with the spec's FORWARD one and wrote the adaptation as a bare `if i == symbol` instead of the spec's running threshold. Both mistakes still decode -- they drift. T7/T8/T9 pin the adaptation DIRECTION and MAGNITUDE against hand-computed spec values, so the convention cannot silently flip again. T13 is the one that matters most for liveness: the terminator cdf[N-1] must stay exactly 32768 forever. update_cdf only walks i < N-1 precisely so it cannot touch it. If it ever drifts below, f never reaches 0, cur never reaches 0, and decode_symbol walks off the end of every distribution. NON-VACUITY: T11/T12 are negative controls -- out-of-range symbols, tiny alphabets and a null coder must each be REFUSED. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_bitstream.nx nx_av1_ec.nx nx_av1_ec_gate.nx

imports: nx_syscalls.nxnx_bitstream.nxnx_av1_ec.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_av1_floor_log2 nx_av1_cdf_uniform sys_mmap sys_mmap ↻ nx_bitstream_alloc sys_mmap ↻ nx_av1_ec_init nx_av1_min nx_bitstream_read_msb nx_bitstream_bits_remainin _bs_peek_byte sys_mmap ↻ nx_av1_decode_symbol nx_av1_ec_renorm nx_av1_floor_log2 ↻ nx_av1_min ↻ nx_av1_max nx_bitstream_read_msb ↻ nx_av1_update_cdf nx_av1_floor_log2 ↻ nx_av1_min ↻ g_puts sys_write sys_exit

structs

none

consts

none

functions

23func g_puts(s: *u8) -> i64
called by 1: main calls 1: sys_write
30func main() -> i64