code wiki / _hdl_build / nx_visual_diff.nx

nx_visual_diff.nx

buildroot/runtime/_hdl_build/nx_visual_diff.nx

6097 B155 linesdepth 8pulls 11 transitivereach 9 importersview sourcekind librarytopic visual
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_png_decoder.nx nx_visual_diff.nx nx_img_sbs.nx nx_parity_judge.nx nx_struct_diff.nx nx_uiq_visual_lib.nx nx_visual_diff_cli.nx nx_visual_diff_gate.nx

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

15struct VdImg

consts

12const VD_IMG_BYTES: i64 = 32 // px,w,h,nc
13const VD_WORST_SLOTS: i64 = 5 // top-N worst cells reported (cx,cy,delta triples)

functions

23func vd_load(path: *u8) -> *VdImg
40func vd_cell_mean(im: *VdImg, yoff: i64, x0: i64, x1: i64, y0: i64, y1: i64, out: *i64) -> i64
called by 1: vd_grid_parity
68func vd_grid_parity(a: *VdImg, ay: i64, b: *VdImg, by: i64, cw: i64, ch: i64, gx: i64, gy: i64, thresh: i64, out: *i64) -> i64
called by 2: mainmain calls 2: sys_mmapvd_cell_mean
131func vd_content_extent(im: *VdImg, tol: i64) -> i64