nx_charjudge_lib.nx
buildroot/runtime/nx_charjudge_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_charjudge.nxnx_charjudge_gate.nx
structs
| none |
consts
| 16 | const CHJ_CELL: i64 = 16 |
| 17 | const CHJ_BUCKETS: i64 = 4096 |
| 18 | const CHJ_CAND_MAX: i64 = 128 |
| 19 | const CHJ_MAGIC_65536: i64 = 65536 |
| 20 | const CHJ_C_SMOOTH_T: i64 = 0 |
| 21 | const CHJ_C_DETAIL_T: i64 = 1 |
| 22 | const CHJ_C_SMOOTH_DIV: i64 = 2 |
| 23 | const CHJ_C_DETAIL_DIV: i64 = 3 |
| 24 | const CHJ_C_PAL_DIV: i64 = 4 |
| 25 | const CHJ_C_EDGE_T: i64 = 5 |
| 26 | const CHJ_C_RUN_MIN: i64 = 6 |
| 27 | const CHJ_C_COH_DIV: i64 = 7 |
| 28 | const CHJ_C_EYE_T: i64 = 8 |
| 29 | const CHJ_C_FACE_REQ: i64 = 9 |
| 35 | const CHJ_C_EYE_DY: i64 = 10 // max vertical misalignment of a candidate pair |
| 36 | const CHJ_C_EYE_DXMIN: i64 = 11 // min horizontal separation of a pair |
| 37 | const CHJ_C_EYE_DXMAX: i64 = 12 // max horizontal separation of a pair |
| 38 | const CHJ_C_PROBE_FAR: i64 = 13 // axial centre-surround probe radius |
| 39 | const CHJ_C_PROBE_DIAG: i64 = 14 // diagonal centre-surround probe radius |
| 40 | const CHJ_C_DEDUP_R: i64 = 15 // candidate dedup radius |
| 41 | const CHJ_C_BORDER: i64 = 16 // scan border margin |
| 42 | const CHJ_C_STRIDE: i64 = 17 // scan stride |
| 43 | const CHJ_C_PYR_MIN: i64 = 18 // smallest pyramid level edge the scan is still meaningful on |
| 51 | const CHJ_C_REF_W: i64 = 19 |
| 56 | const CHJ_C_CONTOUR_BLUR_DIV: i64 = 20 |
| 57 | const CHJ_NCONF: i64 = 21 |
| 61 | const CHJ_NOUT: i64 = 16 |
functions
| 63 | func chj_conf_defaults(cf: *i64) -> i64 called by 1: chj_conf_load |
| 91 | func chj_keyeq(buf: *u8, at: i64, end: i64, key: *u8) -> i64 called by 1: chj_slot_for |
| 104 | func chj_slot_for(buf: *u8, at: i64, end: i64) -> i64 |
| 128 | func chj_conf_load(path: *u8, cf: *i64) -> i64 |
| 175 | func chj_luma(fb: *i64, w: i64, h: i64, luma: *i64) -> i64 called by 1: chj_judge |
| 189 | func chj_cells(luma: *i64, w: i64, h: i64, cf: *i64, outp: *i64) -> i64 called by 1: chj_judge |
| 231 | func chj_palette(fb: *i64, w: i64, h: i64) -> i64 |
| 253 | func chj_contour(luma: *i64, w: i64, h: i64, cf: *i64, outp: *i64) -> i64 |
| 428 | func chj_face_scan(l: *i64, w: i64, h: i64, cf: *i64, ncout: *i64) -> i64 |
| 552 | func chj_face(luma: *i64, w: i64, h: i64, cf: *i64, diag: *i64) -> i64 |
| 604 | func chj_judge(fb: *i64, w: i64, h: i64, confpath: *u8, out: *i64) -> i64 |