nx_capres_lib.nx
buildroot/runtime/nx_capres_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_capres.nxnx_capres_gate.nx
structs
| none |
consts
| 36 | const CR_PERMIL: i64 = 1000 // permil base; res_permil == CR_PERMIL is exactly "full" |
| 37 | const CR_CONF: *u8 = "knowledge/capres.conf" as *u8 |
| 39 | const CR_KIND_UNKNOWN: i64 = 0 |
| 40 | const CR_KIND_PNG: i64 = 1 |
| 41 | const CR_KIND_NXFH1: i64 = 2 |
| 45 | const CR_V_FULL: i64 = 0 |
| 46 | const CR_V_REDUCED: i64 = 1 |
| 47 | const CR_V_UNPROVEN: i64 = 3 |
| 50 | const CR_J_SEES: i64 = 0 |
| 51 | const CR_J_BLIND: i64 = 1 |
| 56 | const CR_PNG_S0: i64 = 137 |
| 57 | const CR_PNG_S1: i64 = 80 |
| 58 | const CR_PNG_S2: i64 = 78 |
| 59 | const CR_PNG_S3: i64 = 71 |
| 60 | const CR_PNG_S4: i64 = 13 |
| 61 | const CR_PNG_S5: i64 = 10 |
| 62 | const CR_PNG_S6: i64 = 26 |
| 63 | const CR_PNG_S7: i64 = 10 |
| 64 | const CR_PNG_IHDR_W_OFF: i64 = 16 |
| 65 | const CR_PNG_IHDR_H_OFF: i64 = 20 |
| 66 | const CR_PNG_HDR_MIN: i64 = 24 // the shortest prefix that carries both IHDR dimensions |
| 67 | const CR_U32_BYTES: i64 = 4 |
| 68 | const CR_BYTE_BASE: i64 = 256 |
| 72 | const CR_NXFH_MAGIC_LEN: i64 = 6 |
| 74 | const CR_ASCII_0: i64 = 48 |
| 75 | const CR_ASCII_9: i64 = 57 |
| 76 | const CR_ASCII_NL: i64 = 10 |
| 77 | const CR_ASCII_EQ: i64 = 61 |
| 78 | const CR_ASCII_HASH: i64 = 35 |
| 79 | const CR_ASCII_X: i64 = 120 // the separator in <w>x<h> |
| 80 | const CR_DEC_BASE: i64 = 10 |
| 81 | const CR_CURSOR_BYTES: i64 = 16 // one i64 cursor cell, page-rounded by mmap |
| 86 | const CR_HDR_READ: i64 = 128 |
functions
| 91 | func cr_num_at(b: *u8, n: i64, pos: *i64) -> i64 |
| 110 | func cr_be32(b: *u8, off: i64) -> i64 called by 1: cr_dims |
| 123 | func cr_dims(b: *u8, n: i64, out: *i64) -> i64 |
| 171 | func cr_read_hdr(path: *u8, b: *u8) -> i64 |
| 180 | func cr_dims_of_file(path: *u8, out: *i64) -> i64 |
| 194 | func cr_conf_res(path: *u8, key: *u8, out: *i64) -> i64 |
| 245 | func cr_conf_count(path: *u8, key: *u8) -> i64 |
| 283 | func cr_permil(cw: i64, ch: i64, fw: i64, fh: i64) -> i64 |
| 292 | func cr_verdict(permil: i64) -> i64 |
| 303 | func cr_judge(cw: i64, ch: i64, jw: i64, jh: i64) -> i64 |