code wiki / (root) / nx_image_search_gate.nx

nx_image_search_gate.nx

buildroot/runtime/nx_image_search_gate.nx

13261 B263 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind gate/prooftopic image
docsdependenciesstructsconstsfunctions

about

nx_image_search_gate.nx -- the engineer's re-runnable instrument for the REUSABLE search-by-image client (nx_image_search). Builds TWO isolated site fingerprint-indices from SYNTHESIZED grayscale images with CONTROLLED dHash relationships, registers both in a sites TSV, writes query images to /tmp, then forks+execs the REAL /tmp/nx_image_search.sov.elf over a KAT + neg-control + isolation oracle. It PROVES (not asserts) the research-documented dHash properties end-to-end (image -> hash -> per-site nearest): row1 identical query -> right image rank 1 at Hamming 0 row2 +brightness query -> STILL Hamming 0 (dHash brightness invariance, Krawetz 2011) row3 near-dup (block tweak) -> right image rank 1, small Hamming (<= threshold) row4 precision -> a structurally-different indexed image (Hamming 64) is EXCLUDED row5 isolation A + neg-ctrl -> a BETA-only image queried on ALPHA returns matches=0 (alpha cannot surface content it does not hold) row6 isolation B -> an image present in BOTH sites, queried on BETA, returns the BETA cid and NEVER an alpha cid (client loaded the right per-site index) row7 unknown site -> clean exit 1 with "unknown site" (no crash) GREEN iff all 7 rows pass. Durable verdict appends to knowledge/status/image_search_gate.log. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_phash.nx nx_image_search_gate.nx

imports: nx_phash.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 g_synth nx_phash_dhash nx_phash_downscale g_num nx_simhash_hamming nx_bits_popcount64_soft g_write_gray sys_openat_wr sys_openat_wr ↻ g_emit_idx_row nx_phash_dhash ↻ nx_phash_ahash nx_phash_downscale ↻ g_strlen g_hexemit g_write_file sys_openat_wr ↻ g_strlen ↻

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
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
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 }
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 }
24func g_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
26func g_write_file(path: *u8, data: *u8) -> i64
called by 1: main calls 2: sys_openat_wrg_strlen
33func g_write_gray(path: *u8, buf: *u8, n: i64) -> i64
called by 1: main calls 1: sys_openat_wr
40func g_read_small(path: *u8, buf: *u8, cap: i64) -> i64
calls 1: sys_read
51func g_hexemit(fd: i64, v: i64) -> i64
called by 1: g_emit_idx_row
69func g_synth(buf: *u8, w: i64, h: i64, kind: i64, bright: i64) -> i64
called by 1: main
90func g_emit_idx_row(fd: i64, cid: *u8, buf: *u8, w: i64, h: i64) -> i64
100func g_run(sites: *u8, site: *u8, qpath: *u8, ws: *u8, hs: *u8, ths: *u8, out_path: *u8) -> i64
119func g_find(hay: *u8, n: i64, needle: *u8) -> i64
called by 2: g_containsg_rank_of calls 1: g_strlen
131func g_contains(hay: *u8, n: i64, needle: *u8) -> i64 { if g_find(hay,n,needle)>=0 { return 1 } return 0 }
calls 1: g_find
132func g_rank_of(buf: *u8, n: i64, expected: *u8) -> i64
calls 1: g_find
146func main() -> i64