code wiki / _hdl_build / nx_polish_census.nx
nx_polish_census.nx
buildroot/runtime/_hdl_build/nx_polish_census.nx
about
nx_polish_census.nx -- MEASURE the visual POLISH gap vs Chrome/Edge as a NUMBER (operator: the evidence
"clearly shows our polish gap" -- so quantify it, no vibes). Legibility (OCR word-recall) says we're
readable (984); polish is a DIFFERENT axis: smooth anti-aliased edges vs blocky 1-bit ones. This census
decodes the SAME bench renders (ours / chrome / edge, via the sovereign PNG decoder) and computes an
ANTI-ALIASING QUALITY score: of the pixels ON A TEXT EDGE (a large luminance jump to a neighbor), what
fraction are INTERMEDIATE GRAY (30..225) = softened by AA, vs pure black/white = aliased. A 1-bit
bitmap render scores ~0; Chrome's rasterizer scores high. The GAP is the number to close.
permille AA = intermediate-gray-edge-px * 1000 / total-edge-px. NEG/liar-kill: a synthetic hard-edged
checkerboard MUST score ~0 (the metric can't be fooled into calling blocky "smooth").
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_img_bytes_to_rgb.nxnx_itoa_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const K_MAGIC_2126: i64 = 2126 |
| 14 | const K_MAGIC_7152: i64 = 7152 |
| 15 | const K_MAGIC_10000: i64 = 10000 |
| 16 | const K_MAGIC_16384: i64 = 16384 |
functions
| 18 | func pc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 23 | func pc_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 24 | func pc_app(buf: *u8, pos: i64, s: *u8) -> i64 { var p: i64=pos; var i: i64=0; while s[i]!=(0 as u8) { buf[p]=s[i]; p=p+1; i=i+1 } return p } called by 1: main |
| 25 | func pc_appd(buf: *u8, pos: i64, v: i64) -> i64 called by 1: main |
| 37 | func pc_write_file(path: *u8, data: *u8, n: i64) -> i64 |
| 44 | func pc_lum(rgb: *u8, o: i64) -> i64 { return (K_MAGIC_2126*(rgb[o] as i64) + K_MAGIC_7152*(rgb[o+1] as i64) + 722*(rgb[o+2] as i64))/K_MAGIC_10000 } called by 1: pc_aa_score |
| 46 | func pc_parse_after(path: *u8, key: *u8) -> i64 |
| 75 | func pc_aa_score(rgb: *u8, w: i64, h: i64, out: *i64) -> i64 |
| 104 | func pc_load(path: *u8, wh: *i64) -> *u8 |
| 112 | func main() -> i64 |