code wiki / _hdl_build / nx_visual_diff.nx
nx_visual_diff.nx
buildroot/runtime/_hdl_build/nx_visual_diff.nx
about
nx_visual_diff.nx -- sovereign VISUAL PARITY instrument (lib): compares two rendered screenshots
(e.g. the Nishi browser vs a Chrome/Edge/Firefox oracle of the SAME page) and turns "looks the same"
into NUMBERS: (1) grid-cell parity -- split the shared region into a GxG grid, compare each cell's mean
color, report the matched-cell permille + the worst cells with coordinates; (2) content extent -- the
last y row that differs from the page background, i.e. the page's rendered height (layout parity: if
Chrome fits a page in 1500px and we take 4500px, the ratio IS the layout bug). Grid means tolerate
font-rasterizer differences while catching structural drift (missing blocks, wrong colors, stretched
rows). This is the S21 "same output as Chrome" benchmark's measuring stick. license_tier: ORIGINAL
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_png_decoder.nx
imported by: nx_img_sbs.nxnx_parity_judge.nxnx_struct_diff.nxnx_uiq_visual_lib.nxnx_visual_diff_cli.nxnx_visual_diff_gate.nx
structs
| 15 | struct VdImg |
consts
| 12 | const VD_IMG_BYTES: i64 = 32 // px,w,h,nc |
| 13 | const VD_WORST_SLOTS: i64 = 5 // top-N worst cells reported (cx,cy,delta triples) |
functions
| 23 | func vd_load(path: *u8) -> *VdImg |
| 40 | func vd_cell_mean(im: *VdImg, yoff: i64, x0: i64, x1: i64, y0: i64, y1: i64, out: *i64) -> i64 called by 1: vd_grid_parity |
| 68 | func vd_grid_parity(a: *VdImg, ay: i64, b: *VdImg, by: i64, cw: i64, ch: i64, gx: i64, gy: i64, thresh: i64, out: *i64) -> i64 |
| 131 | func vd_content_extent(im: *VdImg, tol: i64) -> i64 |