code wiki / _hdl_build / nx_photoreal_critic.nx
nx_photoreal_critic.nx
buildroot/runtime/_hdl_build/nx_photoreal_critic.nx
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
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
structs
| none |
consts
| 18 | const K_MAGIC_65536: i64 = 65536 |
| 19 | const K_MAGIC_2654435761: i64 = 2654435761 |
| 20 | const K_MAGIC_1013904223: i64 = 1013904223 |
functions
| 22 | func hw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 23 | func pn(v: i64) -> i64 |
| 35 | func 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 |
| 36 | func lum(g: i64) -> i64 { return ((g & 255) + ((g >> 8) & 255) + ((g >> 16) & 255)) / 3 } called by 1: critic_measure |
| 37 | func chroma(g: i64) -> i64 called by 1: critic_measure |
| 43 | func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: critic_measure |
| 47 | func critic_measure(fb: *i64, w: i64, h: i64, m: *i64) -> i64 |
| 119 | func clamp1000(v: i64) -> i64 { if v < 0 { return 0 } if v > 1000 { return 1000 } return v } called by 1: critic_score |
| 120 | func critic_score(m: *i64, a: *i64) -> i64 |
| 134 | func worst_axis(a: *i64) -> *u8 called by 1: report |
| 144 | func verdict(score: i64) -> *u8 |
| 150 | func report(label: *u8, fb: *i64, w: i64, h: i64) -> i64 |
| 161 | func main() -> i64 |