code wiki / (root) / nx_scene_through_aperture.nx

nx_scene_through_aperture.nx

buildroot/runtime/nx_scene_through_aperture.nx

9171 B232 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic scene
docsdependenciesstructsconstsfunctions

about

nx_scene_through_aperture.nx -- Tier 6 background-coherence detector. User feedback 2026-05-16: "the car isnt real and the background is a mess". AI image-gen frequently fails the SCENE-THROUGH- FRAMED-APERTURE check: when looking through a window or door, the content visible beyond should follow physical rules: - sharper foreground, blurrier background (depth-of-field) - cooler / hazier colors (atmospheric perspective) - consistent perspective (vanishing lines align with frame) - recognizable objects, not arbitrary blobs (edge-density distribution typical of real scenes) AI puts random fragments through windows because the gen model has no scene-coherence prior beyond local pixel statistics. Substrate's answer: measure the four physics-grounded signatures and emit a sealed verdict. Inputs: caller pre-extracts the APERTURE region (window/door bounding box content) and the IMMEDIATE FOREGROUND region (interior wall / dashboard / face beside window). Computes: sharpness_ratio_q10 = sharpness(aperture) / sharpness(foreground) color_temp_shift = mean(aperture_b - aperture_r) - mean(foreground_b - foreground_r) edge_density_q10 = edge_count(aperture) / aperture_pixels edge_uniformity_q10 = std(local_edge_density) / mean(local_edge_density) Physics expectations for real-photo background: sharpness_ratio in (0.2, 0.8) -- background blurrier color_temp_shift > 0 -- background bluer (atmospheric) edge_density in (0.05, 0.30) -- some structure, not flat, not noise edge_uniformity > 0.4 -- non-uniform distribution Sealed verdict: COHERENT -- all 4 checks pass DEPTH_FAIL -- sharpness ratio outside physical range ATMOSPHERIC_FAIL -- no color-temp shift FRAGMENTED -- edge metrics outside real-scene distribution IMPLAUSIBLE -- 3+ checks fail (likely AI background) genealogy_id: substrate_scene_through_aperture_2026_05_16

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_scene_through_aperture.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nx

imported by: nobody (leaf or entry point)

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

main nx_aperture_classify sys_mmap

structs

72struct NxApertureResult

consts

53const NX_STA_Q10: nx_int = 1024
56const NX_STA_COHERENT: nx_int = 0
57const NX_STA_DEPTH_FAIL: nx_int = 1
58const NX_STA_ATMOSPHERIC_FAIL: nx_int = 2
59const NX_STA_FRAGMENTED: nx_int = 3
60const NX_STA_IMPLAUSIBLE: nx_int = 4
63const NX_STA_SHARP_MIN_Q10: nx_int = 205 // 0.20
64const NX_STA_SHARP_MAX_Q10: nx_int = 819 // 0.80
65const NX_STA_COLOR_MIN_SHIFT: nx_int = 0 // any non-negative shift acceptable; deep negative = fail
66const NX_STA_EDGE_DENS_MIN_Q10: nx_int = 51 // 0.05
67const NX_STA_EDGE_DENS_MAX_Q10: nx_int = 307 // 0.30
68const NX_STA_EDGE_UNIFORM_MIN_Q10: nx_int = 410 // 0.40
82const NX_STA_RESULT_BYTES: nx_size = 64
85const NX_STA_BIT_SHARPNESS: nx_int = 0
86const NX_STA_BIT_COLOR: nx_int = 1
87const NX_STA_BIT_EDGE_DENSITY: nx_int = 2
88const NX_STA_BIT_EDGE_UNIFORM: nx_int = 3

functions

97func nx_aperture_classify(
called by 1: main calls 1: sys_mmap
183func main() -> nx_int