code wiki / (root) / nx_img_decode_gate.nx

nx_img_decode_gate.nx

buildroot/runtime/nx_img_decode_gate.nx

10258 B196 linesdepth 11pulls 52 transitivereach 0 importersview sourcekind gate/prooftopic img
docsdependenciesstructsconstsfunctions

about

nx_img_decode_gate.nx -- referee for JPEG wired into the shared decode path (nx_img_to_gray / nx_img_to_rgb now route FF-D8-FF to the sovereign baseline JPEG decoder). The real web is JPEG, so this is what unblocks perceptual-fingerprinting real media for the reverse-image discovery engine. row1 JPEG -> gray dims -- the 137-byte all-128 baseline JPEG decodes to 8x8 via nx_img_to_gray. row2 JPEG gray value -- decoded luma is ~128 (real IDCT, not a stub). row3 JPEG -> rgb -- nx_img_to_rgb yields packed RGB ~ (128,128,128). row4 CROSS-FORMAT MATCH -- dHash(JPEG) == dHash(PNG) for the same image (Hamming 0): a site serving JPEG and a site serving PNG of the SAME media now MATCH -- the heart of cross-site reverse-image. row5 PNG REGRESSION -- a red/green PNG still decodes correctly through nx_img_to_rgb (PNG path intact after adding the JPEG branch). GREEN iff 5/5. Durable verdict -> knowledge/status/img_decode_gate.log. license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_img_to_rgb.nx nx_image_gray.nx nx_phash.nx nx_crc32.nx nx_adler32.nx nx_img_decode_gate.nx

imports: nx_img_to_rgb.nxnx_image_gray.nxnx_phash.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 _build_gray_jpeg g_write_bytes sys_openat_wr gp_build_lr gp_wbe nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at adler32 nx_img_to_gray sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close nx_jpeg_decode_luma sys_mmap ↻ nx_jpeg_dec_ctx_init sys_mmap ↻ _jpeg_ascii_probe_sof sys_mmap ↻ nx_jpeg_seg_init nx_jpeg_seg_next nx_jpeg_classify_marker nx_jpeg_marker_is_lengthle nx_jpeg_sof_parse nx_jpeg_is_progressive prog_be16 nx_jpeg_prog_decode sys_mmap ↻ prog_be16 ↻ nx_jpeg_dqt_parse nx_jpeg_dht_parse nx_jpeg_dht_build_decode_t nx_jpeg_sos_parse prog_next_marker

structs

none

consts

none

functions

18func 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
19func 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
20func 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
21func 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
22func g_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: main
23func g_write_bytes(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 { return 0-1 } sys_write(fd, buf, n); sys_close(fd); return 0 }
called by 1: main calls 1: sys_openat_wr
26func _build_gray_jpeg(jpeg: *u8) -> i64
called by 1: main
72func gp_wbe(buf: *u8, off: i64, val: i64) -> i64 { buf[off]=((val>>24)&255) as u8; buf[off+1]=((val>>16)&255) as u8; buf[off+2]=((val>>8)&255) as u8; buf[off+3]=(val&255) as u8; return 0 }
called by 1: gp_build_lr
73func gp_build_lr(out: *u8, w: i64, h: i64, r1: i64, g1: i64, b1: i64, r2: i64, g2: i64, b2: i64) -> i64
called by 1: main calls 3: gp_wbenx_crc32adler32
118func main() -> i64