code wiki / _hdl_build / nx_frame_codec_adaptive.nx

nx_frame_codec_adaptive.nx

buildroot/runtime/_hdl_build/nx_frame_codec_adaptive.nx

10343 B246 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tooltopic frame
docsdependenciesstructsconstsfunctions

about

nx_frame_codec_adaptive.nx -- TUTOR-AUTHORED SCAFFOLD (Claude), NOT team-emitter output. ADAPTIVE 2-D lossless frame codec: the UNION of the field's best lossless predictors (SUB/UP/AVG/PAETH/MED) with PER-FRAME best-pick by min Rice bits -- the S-class EXCEED mechanism. A single codec commits to ONE predictor (FFV1=MED, PNG=per-row filter); this carries ALL of them and picks the smallest, exact-integer, lossless. FOUNDED on nx_nv1_lpc (Rice bit I/O + best-k) and the proven nx_frame_codec MED bootstrap (X-CDC-FRAME-001). Bit-exact (lossless); tamper-evident (-7). main() = self-test: round-trip on diverse frames + the selector PICKS THE RIGHT PREDICTOR (h-ramp->SUB, v-ramp->UP) + adaptive <= MED ratio. NOT FLOATING (founded on GREEN nv1_lpc). BACK-FILL: the team RE-AUTHORS this from a DATA spec via the emitter-of-emitters (X-AUT-006c/e/f, spec 2026-06-13-codec-dual-spec-and-kat.md sec 1-6); NOT credited as team self-authoring (meter-integrity). Header: u32 w|u32 h|u8 pid|u8 k|Rice. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_nv1_lpc.nx nx_frame_codec_adaptive.nx

imports: nx_nv1_lpc.nx

imported by: nobody (leaf or entry point)

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

main fa_puts fa_gen_hgrad fa_roundtrip fa_encode fa_residuals fa_pred fa_paeth fa_med nv1l_best_k nv1l_cost_bits nv1_wr_u32 nv1l_rice_put nv1l_bit_put fa_puts ↻ fa_putn fa_decode nv1_rd_u32 nv1l_rice_get nv1l_bit_get fa_pred ↻ fa_med_size fa_residuals ↻ nv1l_best_k ↻ fa_predname fa_gen_vgrad fa_gen_checker fa_gen_noise fa_encode ↻ fa_putn ↻

structs

none

consts

16const K_MAGIC_2463534242: i64 = 2463534242
17const K_MAGIC_1103515245: i64 = 1103515245
18const K_MAGIC_12345: i64 = 12345
19const K_MAGIC_2147483647: i64 = 2147483647
20const K_MAGIC_65536: i64 = 65536

functions

22func fa_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: fa_roundtripmain
23func fa_putn(v: i64) -> i64
called by 2: fa_roundtripmain
29func fa_predname(pid: i64) -> *u8
called by 1: fa_roundtrip
37func fa_med(a: i64, b: i64, c: i64) -> i64
called by 1: fa_pred
44func fa_paeth(a: i64, b: i64, c: i64) -> i64
called by 1: fa_pred
55func fa_pred(buf: *u8, w: i64, x: i64, y: i64, pid: i64) -> i64
72func fa_residuals(buf: *u8, w: i64, h: i64, pid: i64, u: *i64) -> i64
called by 2: fa_encodefa_med_size calls 1: fa_pred
94func fa_encode(buf: *u8, w: i64, h: i64, out: *u8, outcap: i64, pidout: *i64) -> i64
128func fa_decode(pl: *u8, plen: i64, out: *u8, outcap: i64) -> i64
163func fa_med_size(buf: *u8, w: i64, h: i64) -> i64
173func fa_gen_hgrad(buf: *u8, w: i64, h: i64) -> i64
called by 1: main
178func fa_gen_vgrad(buf: *u8, w: i64, h: i64) -> i64
called by 1: main
183func fa_gen_checker(buf: *u8, w: i64, h: i64) -> i64
called by 1: main
188func fa_gen_noise(buf: *u8, w: i64, h: i64) -> i64
called by 1: main
194func fa_roundtrip(name: *u8, buf: *u8, w: i64, h: i64) -> i64
214func main() -> i64