code wiki / _hdl_build / nx_uiq_visual.nx

nx_uiq_visual.nx source

↩ module page · 30 lines · 1701 B

1// nx_uiq_visual.nx -- CLI: sovereign visual-render metrics over a real rendered PNG (experiential). 2// The deterministic-pixel guardrails half of the perceptual axis; catches the marker-vs-rendered gap 3// (a structurally-clean page that renders BLANK). Render fidelity = the input PNG's property. 4// usage: nx_uiq_visual --kat (self-test: encode->decode->analyze, blank/rich/band oracle) 5// nx_uiq_visual analyze <png> (JSON: w/h/ink_permille/colors/mean_lum/content_extent/verdict) 6// license_tier: ORIGINAL expect_exit: 0 genealogy: experiential visual; composes nx_visual_diff + nx_png_decoder 7import "nx_uiq_visual_lib.nx" 8 9func main(argc: i64, argv: *i64) -> i64 { 10 if argc>=2 { 11 let a1: *u8 = argv[1] as *u8 12 if a1[0]==(45 as u8) { 13 uv_w("=== nx_uiq_visual --kat (sovereign real-pixel render metrics) ===\n" as *u8) 14 let f: i64 = uv_selftest() 15 uv_w("checks failed=" as *u8); uv_pn(f); uv_w(" (rich=RENDERED + blank=BLANK-SUSPECT + band content-extent exact, via encode->decode->analyze)\n" as *u8) 16 if f==0 { uv_w("VERDICT=GREEN\n" as *u8); sys_exit(0); return 0 } 17 uv_w("VERDICT=RED\n" as *u8); sys_exit(1); return 1 18 } 19 let vl: i64 = uv_slen(a1) 20 if uv_streq(a1, vl, "analyze" as *u8)==1 { 21 if argc<3 { uv_w("usage: nx_uiq_visual analyze <png-path>\n" as *u8); sys_exit(2); return 2 } 22 let p: *u8 = argv[2] as *u8 23 let r: i64 = uv_analyze(p, 1) 24 if r<0 { sys_exit(2); return 2 } 25 sys_exit(0); return 0 26 } 27 } 28 uv_w("usage: nx_uiq_visual --kat | analyze <png-path>\n" as *u8) 29 sys_exit(2); return 2 30}