code wiki / (root) / nx_image_index_gate.nx

nx_image_index_gate.nx

buildroot/runtime/nx_image_index_gate.nx

10553 B206 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic image
docsdependenciesstructsconstsfunctions

about

nx_image_index_gate.nx -- referee for the REAL-CORPUS ingestor (nx_image_index). Unlike the search gate (synthetic raw-gray buffers), this builds REAL encoded PNG files at runtime (valid signature + IHDR + zlib stored-block IDAT + IEND, with chunk CRC-32s and the zlib Adler-32 computed by the shipped substrate primitives -- same technique as nx_png_real_smoke), writes them to /tmp, forks+execs the REAL /tmp/nx_image_index.sov.elf over them, and verifies the produced fingerprint index. Because each PNG is filled RGB=(v,v,v), Rec.709 luma == v, so the FULL decode path (inflate -> unfilter -> RGB -> gray -> dHash) must reproduce the KNOWN dHashes proven in the search gate -- a true end-to-end KAT, checkable by pure string match: row1 grad-up -> dHash 0000000000000000 (decode->gray->dHash correct, end to end) row2 +bright -> dHash 0000000000000000 (brightness invariance survives a real PNG round-trip) row3 grad-down -> dHash ffffffffffffffff (second KAT, opposite extreme) row4 mid -> present and DISTINCT from grad-up row5 corrupt -> SKIPPED (graceful degradation, Cardinal 14 -- one bad file can't abort a crawl) row6 summary -> ingestor exit 0, indexed=4 skipped=1 GREEN iff 6/6. Durable verdict appends to knowledge/status/image_index_gate.log. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_crc32.nx nx_adler32.nx nx_image_index_gate.nx

imports: nx_syscalls.nxnx_crc32.nxnx_adler32.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_write sys_mmap gp_build gp_wbe nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at gp_val adler32 g_write_bytes sys_openat_wr sys_write ↻ sys_close g_write_file g_write_bytes ↻ g_strlen g_run sys_fork sys_openat_wr ↻ sys_dup3 sys_mmap ↻ sys_execve sys_exit sys_wait4 g_read_small sys_openat_rd sys_read sys_close ↻ sys_write ↻ g_contains g_find g_strlen ↻ g_num sys_mmap ↻ sys_write ↻ sys_openat_append g_w

structs

none

consts

none

functions

20func g_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 1: main calls 1: sys_write
21func g_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
22func g_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
23func g_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
24func g_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: g_write_fileg_find
26func g_write_bytes(path: *u8, buf: *u8, n: i64) -> i64
33func g_write_file(path: *u8, data: *u8) -> i64 { return g_write_bytes(path, data, g_strlen(data)) }
called by 1: main calls 2: g_write_bytesg_strlen
34func g_read_small(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
43func g_find(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: g_contains calls 1: g_strlen
55func g_contains(hay: *u8, n: i64, needle: *u8) -> i64 { if g_find(hay,n,needle)>=0 { return 1 } return 0 }
called by 1: main calls 1: g_find
58func gp_wbe(buf: *u8, off: i64, val: i64) -> i64
called by 1: gp_build
65func gp_val(kind: i64, x: i64, w: i64, bright: i64) -> i64
called by 1: gp_build
75func gp_build(out: *u8, w: i64, h: i64, kind: i64, bright: i64) -> i64
called by 1: main calls 4: gp_wbenx_crc32gp_valadler32
120func g_run(corpus: *u8, outidx: *u8, outcap: *u8) -> i64
138func main() -> i64