code wiki / (root) / nx_cdmap_pixjudge_lib.nx

nx_cdmap_pixjudge_lib.nx

buildroot/runtime/nx_cdmap_pixjudge_lib.nx

19528 B430 linesdepth 8pulls 12 transitivereach 2 importersview sourcekind librarytopic cdmap
docsdependenciesstructsconstsfunctions

about

nx_cdmap_pixjudge_lib.nx -- the position map's PIXEL REFEREE (datavis DV2, 2026-09-15): the emitted cdmap SVG is re-drawn as INK and the readability defects are counted on the pixels. Every player label is rasterised glyph by glyph through the sovereign TrueType engine (nx_ttf_fontlib, the browser's own font renderer: real outlines, real hmtx advances, the pen walk tf_draw_text walks) and every mark is a filled disk; then: two labels whose ink shares a pixel (LL), a label whose ink enters ANOTHER player's disk (LM), a label whose ink leaves the plot frame (OFF), marks whose disks overlap (MM, the centre-distance rule cl_critic uses, a data property). DEFECTS = LL + LM + OFF, the same sum the emitter publishes, so the pixel vector and the published vector compare slot for slot. SPREAD is a data property, not an ink property, and is not re-derived here. WHY: the self-grade counts BOXES whose width is a heuristic (CL_TEXT_W_PERMIL per glyph); a face wider than the heuristic, or a run of wide glyphs, overlaps in ink while the boxes stay apart -- a font-metric drift the box arithmetic cannot see. This ruler is the in-estate half of the liar-killer: it renders through a second path (glyph coverage, not box arithmetic) and disagrees when the picture does. A foreign browser stays an oracle outside the path. A label's OWN mark is skipped by design, exactly as cl_critic skips it (a halo label sits on its mark on purpose). Ink = coverage at or above CRG_INK_MIN of 255: an anti-aliased fringe is not ink a reader collides on. The figure grammar is cr_scan's (composed, never re-implemented). license_tier: ORIGINAL. No hw writes (Rule 26).

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_cdmap_referee_lib.nx nx_cdmap_pixjudge_lib.nx nx_cdmap_pixjudge.nx nx_cdmap_pixjudge_gate.nx

imports: nx_syscalls.nxnx_cdmap_referee_lib.nx

imported by: nx_cdmap_pixjudge.nxnx_cdmap_pixjudge_gate.nx

structs

none

consts

19const CRG_INK_MIN: i64 = 128 // half coverage: below this a pixel is fringe, not ink
20const CRG_VB_W_DEFAULT: i64 = 760 // the emitter's CDP_SVG_W, used only when the svg carries no viewBox
21const CRG_VB_H_DEFAULT: i64 = 520 // the emitter's CDP_SVG_H
22const CRG_VB_MAX: i64 = 4096 // a viewBox axis past this is refused (one mask would exceed 16 MiB)
23const CRG_I64_BYTES: i64 = 8
24const CRG_CH_SPACE: i64 = 32
25const CRG_BBOX_W: i64 = 4 // minx miny maxx maxy per label, in canvas coordinates, UNCLIPPED
26const CRG_B_X0: i64 = 0
27const CRG_B_Y0: i64 = 1
28const CRG_B_X1: i64 = 2
29const CRG_B_Y1: i64 = 3
31const CRG_R_MX: i64 = 0
32const CRG_R_MY: i64 = 1
33const CRG_R_MR: i64 = 2
34const CRG_R_LX: i64 = 3
35const CRG_R_LY: i64 = 4
36const CRG_R_LFONT: i64 = 5
37const CRG_R_LBOLD: i64 = 6
38const CRG_R_FRAME: i64 = 7
39const CRG_R_OUT: i64 = 8
40const CRG_R_NAMES: i64 = 9
41const CRG_R_NL: i64 = 10
42const CRG_R_NM: i64 = 11
43const CRG_R_W: i64 = 12
44const CRG_R_H: i64 = 13
45const CRG_R_MASKS: i64 = 14
46const CRG_R_INK: i64 = 15
47const CRG_R_BBOX: i64 = 16
50const CRG_R_NNL: i64 = 17 // note lines found
51const CRG_R_NN: i64 = 18 // notes (groups) found
52const CRG_R_NLX: i64 = 19
53const CRG_R_NLY: i64 = 20 // the baseline as emitted
54const CRG_R_NLFONT: i64 = 21
55const CRG_R_NLNOTE: i64 = 22 // the note each line belongs to
56const CRG_R_NNAMES: i64 = 23
57const CRG_R_NMASKS: i64 = 24 // one mask per note
58const CRG_R_NINK: i64 = 25
59const CRG_R_NBBOX: i64 = 26
60const CRG_R_SLOTS: i64 = 27
62const CRG_V_LL: i64 = 0
63const CRG_V_LM: i64 = 1
64const CRG_V_OFF: i64 = 2
65const CRG_V_MM: i64 = 3
66const CRG_V_INKPX: i64 = 4 // ink pixels over every label: a scale field, 0 means nothing was drawn
67const CRG_V_DEFECTS: i64 = 5
68const CRG_V_W: i64 = 6
70const CRG_OK: i64 = 0
71const CRG_NO_FIGURE: i64 = 0 - 1
72const CRG_NO_LABELS: i64 = 0 - 2
73const CRG_UNPAIRED: i64 = 0 - 3
74const CRG_NO_FRAME: i64 = 0 - 4
75const CRG_NO_FONT: i64 = 0 - 5
76const CRG_NO_INK: i64 = 0 - 6
77const CRG_CANVAS: i64 = 0 - 7

functions

79func crg_i64(n: i64) -> *i64 { return sys_mmap(n * CRG_I64_BYTES) as *i64 }
80func crg_rec_new() -> *i64
107func crg_nbbox_at(r: *i64, g: i64) -> *i64 { return ((r[CRG_R_NBBOX] as i64) + g * CRG_BBOX_W * CRG_I64_BYTES) as *i64 }
109func crg_bbox_union(bb: *i64, bb2: *i64) -> i64
called by 1: crg_ink
118func crg_skip_num(h: *u8, p: i64, to: i64) -> i64
called by 1: crg_viewbox
130func crg_skip_sp(h: *u8, p: i64, to: i64) -> i64
called by 1: crg_viewbox
140func crg_viewbox(h: *u8, n: i64, wh: *i64) -> i64
171func crg_scan(h: *u8, n: i64, r: *i64) -> i64
198func crg_mask_label(fh: *i64, s: *u8, ph: i64, x: i64, ybase: i64, W: i64, H: i64, mask: *u8, bb: *i64) -> i64
241func crg_overlap(a: *u8, b: *u8, npx: i64) -> i64
248func crg_ink_over_disk(mask: *u8, W: i64, H: i64, cx: i64, cy: i64, rad: i64) -> i64
270func crg_bbox_off(bb: *i64, fr: *i64) -> i64
279func crg_ink(r: *i64, fhr: *i64, fhb: *i64) -> i64
336func crg_vector(r: *i64, vec: *i64) -> i64
403func crg_judge(h: *u8, n: i64, fhr: *i64, fhb: *i64, r: *i64, vec: *i64) -> i64
413func crg_agree(vec: *i64, published_defects: i64) -> i64
called by 2: mainmain
418func crg_rc_name(rc: i64) -> *u8
called by 1: main
430func crg_bbox_at(r: *i64, i: i64) -> *i64 { return ((r[CRG_R_BBOX] as i64) + i * CRG_BBOX_W * CRG_I64_BYTES) as *i64 }
called by 3: pj_explainmainmain