nx_mediafacts_lib.nx
buildroot/runtime/nx_mediafacts_lib.nx
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
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
| 28 | const MF_N_SLOTS: i64 = 8 |
| 29 | const MF_FMT_UNKNOWN: i64 = 0 |
| 30 | const MF_FMT_PNG: i64 = 1 |
| 31 | const MF_FMT_GIF: i64 = 2 |
| 32 | const MF_FMT_JPEG: i64 = 3 |
| 33 | const MF_FMT_WEBP: i64 = 4 |
| 34 | const MF_FMT_WAV: i64 = 5 |
functions
| 36 | func mf_b(buf: *u8, o: i64) -> i64 { return buf[o] as i64 & 0xff } |
| 37 | func 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 |
| 38 | func 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 |
| 39 | func 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 |
| 44 | func mf_format(buf: *u8, n: i64) -> i64 |
| 58 | func mf_jpeg_exif(buf: *u8, n: i64) -> i64 |
| 86 | func mf_wav(buf: *u8, n: i64, facts: *i64) -> i64 |
| 121 | func mf_probe(buf: *u8, n: i64, facts: *i64) -> i64 |
| 139 | func mf_median(arr: *i64, n: i64) -> i64 |