code wiki / (root) / nx_jpeg_tables_gate.nx

nx_jpeg_tables_gate.nx

buildroot/runtime/nx_jpeg_tables_gate.nx

11493 B191 linesdepth 9pulls 22 transitivereach 0 importersview sourcekind gate/prooftopic jpeg
docsdependenciesstructsconstsfunctions

about

nx_jpeg_tables_gate.nx -- the referee for the decoder's table slots (debt 1789603770, 2026-09-16). T.81 B.2.4.2 names every DHT and DQT table and a later definition REPLACES it. The decoders appended tables by order of appearance into four slots, so a progressive file (one DHT per scan: ri_diora_baird_1 carries 7 tables over 6 scans, ri_diora_baird_4 ten over ten) wrote past the array (ARENA-OVERRUN prev_alloc_size=256 on every real decode) and a redefined table lost to its stale first definition. In-process teeth on hand-built payloads: slots are keyed by name, a redefinition wins, twelve definitions leave the slot count at eight, an undefined name reads absent, a class the standard lacks is refused by name and places nothing. End-to-end teeth on two mirrored progressive stills: the decode agrees with an OUTSIDE decoder (libjpeg-turbo through OpenCV 5.0.0 on the laptop, 2026-09-16) on the channel means -- the liar-killer no in-process tooth can supply; that decoder never enters a build or run path, only its numbers do. Values are printed with gv_kv. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_jpeg_ascii.nx nx_jpeg_tables_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_jpeg_ascii.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mmap ↻ nx_jpeg_dec_ctx_init sys_mmap ↻ nx_jpeg_ctx_tables_reset nx_jpeg_ctx_htable_at nx_jpeg_ctx_htable_bind nx_jpeg_ctx_htable_at ↻ nx_jpeg_ctx_qtable_at gv_check gv_puts sys_write ↻ nx_jpeg_ctx_htable nx_jpeg_ctx_htable_at ↻ jt_dht_table nx_jpeg_ctx_parse_dht sys_mmap ↻ nx_jpeg_dht_parse nx_jpeg_dht_build_decode_t nx_jpeg_ctx_htable_at ↻ nx_jpeg_ctx_htable_bind ↻ nx_jpeg_copy_i64 jt_dqt_table nx_jpeg_ctx_parse_dqt

structs

none

consts

15const JT_I64: i64 = 8
16const JT_BYTE: i64 = 255
17const JT_BPP: i64 = 3
18const JT_DHT_HDR: i64 = 17
19const JT_BITS_N: i64 = 16
20const JT_DQT_VALUES: i64 = 64
21const JT_PAYLOAD_B: i64 = 128
22const JT_MEANS_N: i64 = 5
23const JT_ROUNDS: i64 = 3
24const JT_TOL_MEAN: i64 = 4
25const JT_FIX1: *u8 = "knowledge/fetched/ri_diora_baird_1.jpg"
26const JT_FIX1_W: i64 = 405
27const JT_FIX1_H: i64 = 500
28const JT_FIX1_R: i64 = 171
29const JT_FIX1_G: i64 = 156
30const JT_FIX1_B: i64 = 146
31const JT_FIX2: *u8 = "knowledge/fetched/ri_diora_baird_4.jpg"
32const JT_FIX2_W: i64 = 831
33const JT_FIX2_H: i64 = 1200
34const JT_FIX2_R: i64 = 119
35const JT_FIX2_G: i64 = 117
36const JT_FIX2_B: i64 = 80
37const JT_TC_DC: i64 = 0
38const JT_TC_AC: i64 = 1
39const JT_TC_BAD: i64 = 2
40const JT_TH_NEVER: i64 = 2
41const JT_TQ_A: i64 = 1
42const JT_TQ_NEVER: i64 = 0
43const JT_VAL_A: i64 = 7
44const JT_VAL_B: i64 = 9
45const JT_SYM_A: i64 = 0
46const JT_SYM_B: i64 = 5
47const JT_SYM_B2: i64 = 7
48const JT_SYM_C: i64 = 8
49const JT_E_UNREADABLE: i64 = 0 - 1

functions

51func jt_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: jt_near
52func jt_near(a: i64, b: i64, tol: i64) -> i64 { if jt_abs(a - b) <= tol { return 1 } return 0 }
called by 1: main calls 1: jt_abs
54func jt_dht_table(buf: *u8, o: i64, tc: i64, th: i64, n1: i64, n2: i64, sym0: i64) -> i64
called by 1: main
65func jt_dqt_table(buf: *u8, o: i64, tq: i64, value: i64) -> i64
called by 1: main
72func jt_decode_means(path: *u8, out: *i64) -> i64
103func main() -> i64