code wiki / _hdl_build / nx_photoreal_critic.nx

nx_photoreal_critic.nx

buildroot/runtime/_hdl_build/nx_photoreal_critic.nx

10975 B212 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic photoreal
docsdependenciesstructsconstsfunctions

about

nx_photoreal_critic.nx -- the HARD PHOTOREAL CRITIC (operator 2026-07-04: "for graphics to be photorealistic you need a HARD CRITIC ... have it PARTNER with you on your upward climb"). Measures a rendered framebuffer on concrete, grounded axes that separate PHOTOREAL from CG/CLAY (natural-scene-statistics family, grounded in knowledge/fetched/prc_*.raw: NR-IQA measures exactly local micro-contrast + statistical regularity that clay violates): 1 fine_detail -- fine micro-contrast (pores/texture). CLAY ~ 0 (too smooth). #1 discriminator. 2 non_flatness -- inverse of large same-color regions. CLAY = flat. 3 chroma_var -- skin-tone variation (veins/blush/subsurface). CLAY = uniform. 4 specular -- small sharp localized highlights. CLAY = none/broad. 5 face_structure -- local detail in the head region. A blob has NO face -> reads as not-a-person. CALIBRATED + LIAR-KILLED: it is PROVEN to score a flat clay image ~0 (CLAY) and to respond to real detail (noise raises fine_detail) BEFORE its verdict on our render is trusted -- exactly the font-arc discipline (a critic that doesn't discriminate is a rubber stamp). Partner: it names the WEAKEST axis = the next fix, and states the honest CEILING of the current approach. GREEN = the critic is a VALID discriminator (NOT that our render is photoreal). license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sdfrender.nx nx_photoreal_critic.nx

imports: nx_syscalls.nxnx_sdfrender.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ww hh hw sys_write sys_mmap report sys_mmap ↻ critic_measure pl lum iabs chroma critic_score clamp1000 hw ↻ pn sys_mmap ↻ sys_write ↻ verdict worst_axis critic_measure ↻ pn ↻ sdf_bytes sdf_body sdf_clear_ops sdf_set_floor sdf_set_mtx_amp sdf_set_kb sdf_render sdf_render_rows it_cos4096 it_sin4096 it_sin4096 ↻ sdf_isqrt sdf_shade_ray sdf_eval sdf_ellip sdf_isqrt ↻ sdf_ellip_rot

structs

none

consts

18const K_MAGIC_65536: i64 = 65536
19const K_MAGIC_2654435761: i64 = 2654435761
20const K_MAGIC_1013904223: i64 = 1013904223

functions

22func hw(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 2: reportmain calls 1: sys_write
23func pn(v: i64) -> i64
called by 2: reportmain calls 2: sys_mmapsys_write
35func pl(g: i64) -> i64 { let r: i64 = g & 255; let b: i64 = (g >> 16) & 255; if r >= b { return 1 } return 0 } // foreground=skin (r>=b)
called by 1: critic_measure
36func lum(g: i64) -> i64 { return ((g & 255) + ((g >> 8) & 255) + ((g >> 16) & 255)) / 3 }
called by 1: critic_measure
37func chroma(g: i64) -> i64
called by 1: critic_measure
43func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: critic_measure
47func critic_measure(fb: *i64, w: i64, h: i64, m: *i64) -> i64
called by 2: reportmain calls 4: pllumiabschroma
119func clamp1000(v: i64) -> i64 { if v < 0 { return 0 } if v > 1000 { return 1000 } return v }
called by 1: critic_score
120func critic_score(m: *i64, a: *i64) -> i64
called by 1: report calls 1: clamp1000
134func worst_axis(a: *i64) -> *u8
called by 1: report
144func verdict(score: i64) -> *u8
called by 2: reportmain
150func report(label: *u8, fb: *i64, w: i64, h: i64) -> i64
161func main() -> i64