code wiki / (root) / nx_charjudge_lib.nx

nx_charjudge_lib.nx

buildroot/runtime/nx_charjudge_lib.nx

29466 B653 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic charjudge
docsdependenciesstructsconstsfunctions

about

nx_charjudge_lib.nx -- CHARACTER-IMAGE JUDGE v2 core (operator 2026-08-04: "eat the debt and build to actually get to sota"). v1 (composition-bimodality x palette) reproduced the human ordering and killed the patch-scramble that fooled ns_assess -- but had a NAMED gameable vector: a designed smooth+noise+palette collage. v2 adds the axes that close it: CONTOUR COHERENCE -- permil of edge pixels on runs >= run_min (row+col propagation). A scramble cannot carry a contour past its patch size; per-pixel noise has edges but no runs. FACE PRESENCE -- multi-scale center-surround dark-blob (iris/pupil class, anime AND photo) + PAIR geometry (two compact blobs, level, spaced). No face = capability floor 0 (a blob with no face is not 40pc of a character). Ring compactness (all 8 ring points lighter) rejects line-art edges. HEADLINE = MIN(composition, palette, contour, face). Thresholds = CONF ROWS (knowledge/charjudge.conf, key=value, # comments; code defaults = the 2026-08-04 battery calibration) per rules 11+17. All integer, zero third-party. Plain-if only in this lib (imported-else parser landmine, debt 1784673261). Buffers are mmap-per-call, bounded by call count (CLI=1, gate<16) -- not a daemon lib.

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_charjudge_lib.nx nx_charjudge.nx nx_charjudge_gate.nx

imports: nx_syscalls.nx

imported by: nx_charjudge.nxnx_charjudge_gate.nx

structs

none

consts

16const CHJ_CELL: i64 = 16
17const CHJ_BUCKETS: i64 = 4096
18const CHJ_CAND_MAX: i64 = 128
19const CHJ_MAGIC_65536: i64 = 65536
20const CHJ_C_SMOOTH_T: i64 = 0
21const CHJ_C_DETAIL_T: i64 = 1
22const CHJ_C_SMOOTH_DIV: i64 = 2
23const CHJ_C_DETAIL_DIV: i64 = 3
24const CHJ_C_PAL_DIV: i64 = 4
25const CHJ_C_EDGE_T: i64 = 5
26const CHJ_C_RUN_MIN: i64 = 6
27const CHJ_C_COH_DIV: i64 = 7
28const CHJ_C_EYE_T: i64 = 8
29const CHJ_C_FACE_REQ: i64 = 9
35const CHJ_C_EYE_DY: i64 = 10 // max vertical misalignment of a candidate pair
36const CHJ_C_EYE_DXMIN: i64 = 11 // min horizontal separation of a pair
37const CHJ_C_EYE_DXMAX: i64 = 12 // max horizontal separation of a pair
38const CHJ_C_PROBE_FAR: i64 = 13 // axial centre-surround probe radius
39const CHJ_C_PROBE_DIAG: i64 = 14 // diagonal centre-surround probe radius
40const CHJ_C_DEDUP_R: i64 = 15 // candidate dedup radius
41const CHJ_C_BORDER: i64 = 16 // scan border margin
42const CHJ_C_STRIDE: i64 = 17 // scan stride
43const CHJ_C_PYR_MIN: i64 = 18 // smallest pyramid level edge the scan is still meaningful on
51const CHJ_C_REF_W: i64 = 19
56const CHJ_C_CONTOUR_BLUR_DIV: i64 = 20
57const CHJ_NCONF: i64 = 21
61const CHJ_NOUT: i64 = 16

functions

63func chj_conf_defaults(cf: *i64) -> i64
called by 1: chj_conf_load
91func chj_keyeq(buf: *u8, at: i64, end: i64, key: *u8) -> i64
called by 1: chj_slot_for
104func chj_slot_for(buf: *u8, at: i64, end: i64) -> i64
called by 1: chj_conf_load calls 1: chj_keyeq
128func chj_conf_load(path: *u8, cf: *i64) -> i64
175func chj_luma(fb: *i64, w: i64, h: i64, luma: *i64) -> i64
called by 1: chj_judge
189func chj_cells(luma: *i64, w: i64, h: i64, cf: *i64, outp: *i64) -> i64
called by 1: chj_judge
231func chj_palette(fb: *i64, w: i64, h: i64) -> i64
called by 1: chj_judge calls 1: sys_mmap
253func chj_contour(luma: *i64, w: i64, h: i64, cf: *i64, outp: *i64) -> i64
called by 1: chj_judge calls 2: sys_mmapsys_munmap
428func chj_face_scan(l: *i64, w: i64, h: i64, cf: *i64, ncout: *i64) -> i64
called by 1: chj_face calls 1: sys_mmap
552func chj_face(luma: *i64, w: i64, h: i64, cf: *i64, diag: *i64) -> i64
604func chj_judge(fb: *i64, w: i64, h: i64, confpath: *u8, out: *i64) -> i64