code wiki / _hdl_build / nx_percept.nx
nx_percept.nx
buildroot/runtime/_hdl_build/nx_percept.nx
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
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
structs
| none |
consts
| 17 | const PJ_MAGIC_500000: i64 = 500000 |
| 18 | const PJ_MAGIC_1000000000: i64 = 1000000000 |
| 20 | const PJ_W: i64 = 400 |
| 21 | const PJ_H: i64 = 240 |
| 22 | const PJ_ND: i64 = 43 |
| 23 | const PJ_NANCH: i64 = 12 |
| 24 | const PJ_FCAP: i64 = 1048576 |
| 51 | const PJ_MAGIC_LEN: i64 = 6 // the six bytes of "NXFH1 " including its separating space |
| 52 | const PJ_ASCII_0: i64 = 48 |
| 53 | const PJ_ASCII_9: i64 = 57 |
| 54 | const PJ_DEC_BASE: i64 = 10 |
| 55 | const PJ_WH_BYTES: i64 = 16 // two i64 out-slots, page-rounded by mmap |
| 56 | const PJ_HDR_READ: i64 = 64 // the header line settles the question; never read the body for it |
| 57 | const PJ_HDR_MIN: i64 = 10 // shortest possible "NXFH1 w h" + newline |
| 58 | const PJ_EXIT_UNJUDGED: i64 = 4 // NOT a low score and NOT a failure: NO score |
functions
| 26 | func pw2(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 27 | func pn2(v: i64) -> i64 |
| 37 | func pj_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: pj_feat |
| 38 | func pj_isq(v: i64) -> i64 |
| 45 | func pj_hex1(c: i64) -> i64 called by 1: pj_load |
| 77 | func pj_hdr_wh(b: *u8, n: i64, out: *i64) -> i64 |
| 124 | func pj_hdr_of_file(path: *u8, out: *i64) -> i64 |
| 139 | func pj_load(path: *u8, rr: *i64, gg: *i64, bb: *i64) -> i64 |
| 183 | func pj_norm(f: *i64, from: i64, cnt: i64) -> i64 called by 1: pj_feat |
| 194 | func pj_feat(rr: *i64, gg: *i64, bb: *i64, f: *i64) -> i64 |
| 329 | func pj_cos(a: *i64, b: *i64) -> i64 |
| 345 | func pj_featfile(path: *u8, f: *i64) -> i64 |
| 358 | func pj_centroids(av: *i64, skip: i64, gc: *i64, jc: *i64) -> i64 |
| 378 | func pj_cos_range(a: *i64, b: *i64, lo: i64, hi: i64) -> i64 |
| 396 | func pj_cos_excl(a: *i64, b: *i64, lo: i64, hi: i64) -> i64 |
| 419 | func pj_score_excl(f: *i64, av: *i64, lo: i64, hi: i64) -> i64 |
| 427 | func pj_score(f: *i64, av: *i64, skip: i64) -> i64 |
| 434 | func pj_anchor_path(i: i64) -> *u8 called by 1: main |
| 449 | func main(argc: i64, argv: *i64) -> i64 |