code wiki / (root) / nx_mediafacts_lib.nx

nx_mediafacts_lib.nx

buildroot/runtime/nx_mediafacts_lib.nx

7742 B155 linesdepth 3pulls 3 transitivereach 6 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_mediafacts_lib.nx -- MEDIA FACT EXTRACTION CORE (R1 of the render-docs ingest program, knowledge/render_docs_ingest_program.txt). Turns raw media bytes into a CLOSED VOCABULARY of integer measurements -- the substrate rows the refcorpus admission contract was built for. COMPOSES INCUMBENTS, BUILDS NO NEW DECODER (the duplicate-inflate lesson, debt 1785854636: ask the corpus by capability before building): dimensions come from nx_img_dims.nx (PNG/GIF/JPEG/WebP header walk, in-tree since the media importer). The WAV walk below is NOT a copy of nx_wav_header.nx -- that parser's contract requires the WHOLE file in memory (it bounds-checks every chunk BODY, incl. the data payload). Fact extraction reads a BOUNDED HEADER WINDOW of possibly-huge files, so it needs a walk that only touches chunk HEADERS and never requires the body to be present: a different contract, not a duplicate. ★THE PII WALL IS STRUCTURAL: no byte from the input file ever flows to the output. Every fact is a computed integer or a fixed label from the enum below. EXIF/XMP are surfaced as a PRESENCE FLAG only -- the segment is never parsed, so GPS coordinates, serial numbers and embedded thumbnails are structurally unreadable through this lane. Fact slots (flat i64 array, MF_N_SLOTS): [0] format 0=unknown 1=png 2=gif 3=jpeg 4=webp 5=wav [1] width_px [2] height_px [3] exif_present (jpeg only) [4] channels [5] sample_rate_hz [6] bits_per_sample [7] duration_ms (wav only) Unfilled slots stay -1: "not measured" is DISTINCT from 0 -- a fabricated zero is the exact plausible-number failure the soft-tissue lane banked. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_img_dims.nx nx_mediafacts_lib.nx nx_ingest_audit.nx nx_mediafacts.nx nx_mediafacts_gate.nx nx_modelfacts.nx nx_varfacts.nx

imports: nx_syscalls.nxnx_img_dims.nx

imported by: nx_ingest_audit.nxnx_mediafacts.nxnx_mediafacts_gate.nxnx_modelfacts.nxnx_varfacts.nx

structs

none

consts

28const MF_N_SLOTS: i64 = 8
29const MF_FMT_UNKNOWN: i64 = 0
30const MF_FMT_PNG: i64 = 1
31const MF_FMT_GIF: i64 = 2
32const MF_FMT_JPEG: i64 = 3
33const MF_FMT_WEBP: i64 = 4
34const MF_FMT_WAV: i64 = 5

functions

36func mf_b(buf: *u8, o: i64) -> i64 { return buf[o] as i64 & 0xff }
37func mf_u16le(b: *u8, o: i64) -> i64 { return (b[o] as i64 & 0xff) | ((b[o+1] as i64 & 0xff) << 8) }
called by 1: mf_wav
38func mf_u32le(b: *u8, o: i64) -> i64 { return (b[o] as i64 & 0xff) | ((b[o+1] as i64 & 0xff) << 8) | ((b[o+2] as i64 & 0xff) << 16) | ((b[o+3] as i64 & 0xff) << 24) }
called by 1: mf_wav
39func mf_u16be(b: *u8, o: i64) -> i64 { return ((b[o] as i64 & 0xff) << 8) | (b[o+1] as i64 & 0xff) }
called by 1: mf_jpeg_exif
44func mf_format(buf: *u8, n: i64) -> i64
called by 1: mf_probe calls 1: mf_b
58func mf_jpeg_exif(buf: *u8, n: i64) -> i64
called by 1: mf_probe calls 2: mf_bmf_u16be
86func mf_wav(buf: *u8, n: i64, facts: *i64) -> i64
called by 1: mf_probe calls 3: mf_u32lemf_bmf_u16le
121func mf_probe(buf: *u8, n: i64, facts: *i64) -> i64
139func mf_median(arr: *i64, n: i64) -> i64