code wiki / (root) / nx_image_grade_v0.nx

nx_image_grade_v0.nx

buildroot/runtime/nx_image_grade_v0.nx

16246 B457 linesdepth 8pulls 18 transitivereach 1 importersview sourcekind tooltopic image
docsdependenciesstructsconstsfunctions

about

nx_image_grade_v0.nx -- minimum-trigger image grading composer. CAPABILITY_COMPLETENESS: PARTIAL MISSING_CAPABILITIES: - per-region tier-axis verdicts (vein-signal / subsurface / micro-expression / finger-count / shadow-direction / surface-plane / interior-geometry / etc.) -- ALL marked PENDING_SEGMENTATION; require nx_segmenter_classical (queued Phase 3 of NISHI_VLM_AND_GRADER_ROADMAP.md) - true CIELab chroma classification (nx_lab_from_rgb queued); v0 uses RGB-proxy undertone heuristic - palette PNG / progressive JPEG / Adam7 -- caller sees decoder's UNSUPPORTED_* error code propagated up - VLM verdicts (the second triangulation source); this v0 ships MATH ONLY COVERED: - Auto-detect PNG vs JPEG by magic bytes - Decoder dispatch + error propagation - Tier 0 verdicts: dimensions, channels, bytes-per-pixel - Tier 1 whole-image: mean luminance, channel histograms, dynamic range - Tier 1 RGB-proxy undertone (provisional until nx_lab_from_rgb) - Tier 1 RGB-proxy skin-tone band via mean(R+G+B) of all pixels (provisional until skin segmenter lands) - Per-axis verdict + human-legible phrase via nx_verdict_phrase The composer's job is to be the SUBSTRATE'S FIRST TRIGGER PIPELINE -- one call takes an image file's bytes and returns a stratified report. Per-axis PENDING entries are honest; caller learns at COMPILE time (header) which axes are not yet wired. genealogy_id: substrate_image_grade_v0_composer_2026_05_16 lineage_id: nx_image_grade_v0

dependencies 9 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_png_decoder.nx nx_jpeg_decoder.nx nx_verdict_phrase.nx nx_lab_from_rgb.nx nx_skin_tone_ita.nx nx_undertone_class.nx nx_image_grade_v0.nx nx_png_real_smoke.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_png_decoder.nxnx_jpeg_decoder.nxnx_verdict_phrase.nxnx_lab_from_rgb.nxnx_skin_tone_ita.nxnx_undertone_class.nx

imported by: nx_png_real_smoke.nx

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

main sys_mmap _igv0_detect_format nx_image_grade_v0 sys_mmap ↻ _igv0_detect_format ↻ nx_png_decode sys_mmap ↻ _png_check_signature _png_read_u32_be nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at _png_n_channels _png_bytes_per_pixel _png_n_channels ↻ _png_a7_expected _png_a7_col0 _png_a7_coli _png_a7_row0 _png_a7_rowi nx_zlib_inflate sys_mmap ↻ nx_deflate_inflate sys_mmap ↻ nx_bitstream_alloc sys_mmap ↻ _deflate_inflate_block nx_bitstream_read_lsb nx_bitstream_byte_align nx_bitstream_read_byte_ali _deflate_build_static_litl _deflate_build_static_dist _deflate_decode_huffman_bl sys_mmap ↻ _deflate_build_dynamic_tre _deflate_bytes_consumed adler32 _png_a7_deinterlace

structs

77struct NxIgv0AxisVerdict
90struct NxIgv0Report

consts

51const NX_MAGIC_1024: i64 = 1024
55const NX_IGV0_FORMAT_UNKNOWN: nx_int = 0
56const NX_IGV0_FORMAT_PNG: nx_int = 1
57const NX_IGV0_FORMAT_JPEG: nx_int = 2
61const NX_IGV0_OK: nx_int = 0
62const NX_IGV0_ERR_TOO_SHORT: nx_int = 1
63const NX_IGV0_ERR_UNKNOWN_FORMAT: nx_int = 2
64const NX_IGV0_ERR_DECODER: nx_int = 3
65const NX_IGV0_ERR_NULL_PIXELS: nx_int = 4
69const NX_IGV0_AXIS_OK: nx_int = 0
70const NX_IGV0_AXIS_PENDING_SEGMENTATION: nx_int = 1
71const NX_IGV0_AXIS_PENDING_LAB_CONVERSION: nx_int = 2
72const NX_IGV0_AXIS_PENDING_VLM: nx_int = 3
73const NX_IGV0_AXIS_NOT_APPLICABLE: nx_int = 4
86const NX_IGV0_AXIS_VERDICT_BYTES: nx_size = 48
107const NX_IGV0_REPORT_BYTES: nx_size = 96
110const NX_IGV0_AX_DIMENSIONS: nx_int = 0
111const NX_IGV0_AX_LUMINANCE: nx_int = 1
112const NX_IGV0_AX_SKIN_TONE_ITA: nx_int = 4
113const NX_IGV0_AX_GLCM_TEXTURE: nx_int = 5
114const NX_IGV0_AX_PORE_DETAIL: nx_int = 7
115const NX_IGV0_AX_UNDERTONE: nx_int = 12
116const NX_IGV0_AX_VEIN_SIGNAL: nx_int = 16
117const NX_IGV0_AX_SUBSURFACE_SIGNAL: nx_int = 17
118const NX_IGV0_AX_MICRO_EXPRESSION: nx_int = 22
119const NX_IGV0_AX_SHADOW_DIRECTION: nx_int = 23
120const NX_IGV0_AX_FINGER_COUNT: nx_int = 24
121const NX_IGV0_AX_SURFACE_PLANE: nx_int = 27
123const NX_IGV0_N_AXES: nx_int = 12

functions

127func _igv0_detect_format(buf: *u8, n: nx_int) -> nx_int
150func _igv0_scan_means(pixels: *u8, w: nx_int, h: nx_int,
called by 1: nx_image_grade_v0
202func _igv0_lab_skin_tone_band(lab: *NxLabColor) -> nx_int
209func _igv0_lab_undertone(lab: *NxLabColor) -> nx_int
217func _igv0_set_axis(axes: *NxIgv0AxisVerdict, idx: nx_int,
275func nx_image_grade_v0(input: *u8, input_size: nx_int) -> *NxIgv0Report
400func main() -> nx_int