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