code wiki / _hdl_build / nx_frame_sanity.nx
nx_frame_sanity.nx
buildroot/runtime/_hdl_build/nx_frame_sanity.nx
about
nx_frame_sanity.nx -- EXPERIENTIAL frame verifier: mechanizes the eyeball for rendered RGB frames.
WHY: three Gx framing bugs (pure-sky win frame, camera buried in hillside, 50.4% blown-white) each
passed every numeric gate tooth and were caught ONLY by a human eyeball (rule 5). vqoe's probe835
taught the same lesson for video (median GREEN while 100% of frames never decoded). This lib gives
every gate a cheap composable tooth: "does this frame LOOK like a scene a player would accept?"
Metrics (all integer, deterministic, RGB24 caller fb like nx_swgpu/nx_gamehud):
[0] blown_permil -- pixels clipped to near-white (the tonemap-missing class)
[1] black_permil -- pixels near-black (the void/underexposed class)
[2] edge_permil -- luminance-step density (detail present at all; pure sky scores ~0)
[3] cedge_permil -- edge density in the CENTER THIRD (framing: the subject belongs mid-frame;
a sky-stare or floor-stare has its detail off-center or absent)
[4] flat_permil -- horizontal-run flatness (px == right neighbor); gradient skies are flat
fs_verdict applies DATA-DRIVEN thresholds (caller-supplied; keep them in a conf, rule 11).
HONEST RESIDUAL: cannot judge SEMANTICS (is that the right building?) -- it kills the gross framing
classes only; the realism-loop critic stays the fidelity judge. LIB, no main. license_tier: ORIGINAL
dependencies 1 imports · 5 importers
imports: nx_syscalls.nx
imported by: nx_frame_sanity_gate.nxnx_gx7_game_gate.nxnx_wire_diablo2_gate.nxnx_wire_endlesssky_gate.nxnx_wire_harness.nx
structs
| none |
consts
| 18 | const FS_NMETRIC: i64 = 5 |
| 19 | const FS_M_BLOWN: i64 = 0 |
| 20 | const FS_M_BLACK: i64 = 1 |
| 21 | const FS_M_EDGE: i64 = 2 |
| 22 | const FS_M_CEDGE: i64 = 3 |
| 23 | const FS_M_FLAT: i64 = 4 |
functions
| 25 | func fs_lum(fb: *u8, o: i64) -> i64 called by 1: fs_score |
| 31 | func fs_score(fb: *u8, w: i64, h: i64, out: *i64) -> i64 |
| 86 | func fs_score_i64(fb: *i64, w: i64, h: i64, out: *i64) -> i64 |
| 103 | func fs_verdict(out: *i64, th: *i64) -> i64 |
| 117 | func fs_default_th(th: *i64) -> i64 |