code wiki / (root) / nx_capres_lib.nx

nx_capres_lib.nx

buildroot/runtime/nx_capres_lib.nx

12619 B311 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_capres_lib.nx -- CAPTURE-RESOLUTION RULER core (LIB, no main). Operator standing order 2026-08-28: "when you screenshot it needs to be full resolution not this bullshit sampled tiny stuff make sure this is true everywhere, we are fine with the cost to make sure the product is the best it can be." THE DEFECT THIS EXISTS TO MAKE REFUSABLE. A capture is evidence, and a capture taken below the resolution the product actually renders at is evidence about a different, smaller subject. The estate had no way to say so mechanically: nx_world_snap announced w= and h= but nothing said what FULL was, so 240x150 and 1920x1200 read identically to every consumer. MEASURED 2026-08-28 the world capture instrument was emitting 36,000 of the engine's 2,304,000 native pixels -- 15 permil -- and the number moved with how busy the box was, because the resolution was being chosen by an adaptive frame-time governor rather than by anyone. THREE QUESTIONS, THREE ANSWERS, AND THE THIRD IS THE ONE EVERYONE FORGETS: 1. what resolution IS this capture -> cr_dims (read it, never assume it) 2. is that the subject's FULL resolution -> cr_permil + cr_verdict 3. can the JUDGE about to score it even SEE -> cr_judge that many pixels (3) is the hidden half. A downsampling ruler makes every quality improvement unmeasurable and every regression invisible, and it fails SILENTLY -- a judge that internally reads a 400x240 window of a 1920x1200 frame returns a confident number about the top 50 rows. A capture policy that fixes only the camera and leaves the ruler blind fixes nothing. ABSTAIN, NEVER ACQUIT. An unreadable artifact, an unknown subject and an unknown judge all return UNPROVEN. "I could not look" is not "it is fine" -- the estate has paid for that confusion before. DATA-DRIVEN BY CONSTRUCTION (rules 11 + 17): every resolution this lib compares against is read from knowledge/capres.conf. There is no resolution literal in this file, and there must never be one: a ruler carrying its own copy of the subject's size is a second owner of that number. PLAIN-IF ONLY (no else) -- the imported-else parser landmine, debt 1784673261, the same reason nx_charjudge_lib says so in its own header. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_capres_lib.nx nx_capres.nx nx_capres_gate.nx

imports: nx_syscalls.nx

imported by: nx_capres.nxnx_capres_gate.nx

structs

none

consts

36const CR_PERMIL: i64 = 1000 // permil base; res_permil == CR_PERMIL is exactly "full"
37const CR_CONF: *u8 = "knowledge/capres.conf" as *u8
39const CR_KIND_UNKNOWN: i64 = 0
40const CR_KIND_PNG: i64 = 1
41const CR_KIND_NXFH1: i64 = 2
45const CR_V_FULL: i64 = 0
46const CR_V_REDUCED: i64 = 1
47const CR_V_UNPROVEN: i64 = 3
50const CR_J_SEES: i64 = 0
51const CR_J_BLIND: i64 = 1
56const CR_PNG_S0: i64 = 137
57const CR_PNG_S1: i64 = 80
58const CR_PNG_S2: i64 = 78
59const CR_PNG_S3: i64 = 71
60const CR_PNG_S4: i64 = 13
61const CR_PNG_S5: i64 = 10
62const CR_PNG_S6: i64 = 26
63const CR_PNG_S7: i64 = 10
64const CR_PNG_IHDR_W_OFF: i64 = 16
65const CR_PNG_IHDR_H_OFF: i64 = 20
66const CR_PNG_HDR_MIN: i64 = 24 // the shortest prefix that carries both IHDR dimensions
67const CR_U32_BYTES: i64 = 4
68const CR_BYTE_BASE: i64 = 256
72const CR_NXFH_MAGIC_LEN: i64 = 6
74const CR_ASCII_0: i64 = 48
75const CR_ASCII_9: i64 = 57
76const CR_ASCII_NL: i64 = 10
77const CR_ASCII_EQ: i64 = 61
78const CR_ASCII_HASH: i64 = 35
79const CR_ASCII_X: i64 = 120 // the separator in <w>x<h>
80const CR_DEC_BASE: i64 = 10
81const CR_CURSOR_BYTES: i64 = 16 // one i64 cursor cell, page-rounded by mmap
86const CR_HDR_READ: i64 = 128

functions

91func cr_num_at(b: *u8, n: i64, pos: *i64) -> i64
called by 2: cr_dimscr_conf_res
110func cr_be32(b: *u8, off: i64) -> i64
called by 1: cr_dims
123func cr_dims(b: *u8, n: i64, out: *i64) -> i64
171func cr_read_hdr(path: *u8, b: *u8) -> i64
180func cr_dims_of_file(path: *u8, out: *i64) -> i64
194func cr_conf_res(path: *u8, key: *u8, out: *i64) -> i64
245func cr_conf_count(path: *u8, key: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
283func cr_permil(cw: i64, ch: i64, fw: i64, fh: i64) -> i64
called by 3: cx_selftestmainmain
292func cr_verdict(permil: i64) -> i64
called by 3: cx_selftestmainmain
303func cr_judge(cw: i64, ch: i64, jw: i64, jh: i64) -> i64
called by 3: cx_selftestmainmain