code wiki / _hdl_build / nx_percept.nx

nx_percept.nx

buildroot/runtime/_hdl_build/nx_percept.nx

29246 B653 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_percept.nx -- AL2: THE PERCEPTUAL JUDGE (operator 2026-08-09: EXCEED needs a human-confirmed perceptual win; the composite critic is CONVICTED as quality -- random squares score 628 on it). This organ does NOT claim absolute quality. It claims RELATIVE PERCEPTUAL POSITION: a candidate's multi-scale structure statistics compared against TWO banked anchor sets -- GOOD = the 10 commercial reference frames (the estate's benchmark artifacts, gate-floored) JUNK = the caricature controls (flat colour, random-squares mosaic) score = sim(candidate, GOOD centroid) - sim(candidate, JUNK centroid), permil cosine, integer. ADMISSION IS EARNED, NEVER ASSUMED: the `ladder` verb replays the HUMAN-CONFIRMED ordering from 2026-08-09 (flat < squares < m2d frame < craft frame; every reference above squares, LEAVE-ONE-OUT so an anchor never scores against a centroid containing itself). If the ladder does not reproduce the human ordering, the judge REFUSES ITSELF -- numbers published either way, all values printed. Features (integer, per NXFH1 400x240 frame): 7-bin hue-order histogram + 3-scale block-delta histograms (2/8/32 px, 8 bins each) + edge-direction distribution (H/V/diag + density) + horizontal same-run length histogram (8 log bins). Each family permil-normalized => 43 dims, cosine compared. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_percept.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main 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 ↻ pj_featfile sys_mmap ↻ pj_load sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close pj_hdr_wh sys_munmap ↻ pj_hex1 pj_feat sys_mmap ↻ pj_norm pj_abs pj_anchor_path pw2 sys_write ↻ pj_score_excl sys_mmap ↻ pj_centroids

structs

none

consts

17const PJ_MAGIC_500000: i64 = 500000
18const PJ_MAGIC_1000000000: i64 = 1000000000
20const PJ_W: i64 = 400
21const PJ_H: i64 = 240
22const PJ_ND: i64 = 43
23const PJ_NANCH: i64 = 12
24const PJ_FCAP: i64 = 1048576
51const PJ_MAGIC_LEN: i64 = 6 // the six bytes of "NXFH1 " including its separating space
52const PJ_ASCII_0: i64 = 48
53const PJ_ASCII_9: i64 = 57
54const PJ_DEC_BASE: i64 = 10
55const PJ_WH_BYTES: i64 = 16 // two i64 out-slots, page-rounded by mmap
56const PJ_HDR_READ: i64 = 64 // the header line settles the question; never read the body for it
57const PJ_HDR_MIN: i64 = 10 // shortest possible "NXFH1 w h" + newline
58const PJ_EXIT_UNJUDGED: i64 = 4 // NOT a low score and NOT a failure: NO score

functions

26func pw2(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
27func pn2(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
37func pj_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: pj_feat
38func pj_isq(v: i64) -> i64
45func pj_hex1(c: i64) -> i64
called by 1: pj_load
77func pj_hdr_wh(b: *u8, n: i64, out: *i64) -> i64
124func pj_hdr_of_file(path: *u8, out: *i64) -> i64
139func pj_load(path: *u8, rr: *i64, gg: *i64, bb: *i64) -> i64
183func pj_norm(f: *i64, from: i64, cnt: i64) -> i64
called by 1: pj_feat
194func pj_feat(rr: *i64, gg: *i64, bb: *i64, f: *i64) -> i64
called by 1: pj_featfile calls 3: sys_mmappj_normpj_abs
329func pj_cos(a: *i64, b: *i64) -> i64
called by 2: pj_scoremain calls 1: pj_isq
345func pj_featfile(path: *u8, f: *i64) -> i64
called by 1: main calls 3: sys_mmappj_loadpj_feat
358func pj_centroids(av: *i64, skip: i64, gc: *i64, jc: *i64) -> i64
378func pj_cos_range(a: *i64, b: *i64, lo: i64, hi: i64) -> i64
called by 1: main calls 1: pj_isq
396func pj_cos_excl(a: *i64, b: *i64, lo: i64, hi: i64) -> i64
called by 1: pj_score_excl calls 1: pj_isq
419func pj_score_excl(f: *i64, av: *i64, lo: i64, hi: i64) -> i64
427func pj_score(f: *i64, av: *i64, skip: i64) -> i64
called by 1: main calls 3: sys_mmappj_centroidspj_cos
434func pj_anchor_path(i: i64) -> *u8
called by 1: main
449func main(argc: i64, argv: *i64) -> i64