code wiki / _hdl_build / nx_nv1_lpc_register.nx

nx_nv1_lpc_register.nx source

↩ module page · 51 lines · 4396 B

1// nx_nv1_lpc_register.nx -- GOVERNED registration of the NV1 media rungs. 2// The 2026-06-10 video session shipped NV1 LIVE but never journaled it via 3// the Librarian (journal grep nv1|nishilossless = 0 rows) -- this closes 4// that gap (retro entry) + registers the new LPC rung. Engineer evidence = 5// the two gate elfs built THIS invocation exit 0; Council admits; Librarian 6// allocs via cl_next_idx (never a manual idx) + dual-writes live+journal. 7// license_tier: ORIGINAL 8import "nx_cap_register.nx" 9import "nx_capreg_librarian.nx" 10import "nx_syscalls.nx" 11 12func nvr_run(path: *u8) -> i64 { 13 let pid: i64 = sys_fork() 14 if pid == 0 { 15 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 16 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 17 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 18 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 19 sys_execve(path, argv, envp); sys_exit(127) 20 } 21 let st: *i64 = sys_mmap(16) as *i64 22 sys_wait4(pid, st, 0) 23 return st[0] 24} 25 26func main() -> i64 { 27 var allok: i64 = 1 28 if nvr_run("/tmp/nx_nv1_gate.elf" as *u8) != 0 { allok = 0 } 29 if nvr_run("/tmp/nx_nv1_lpc_gate.elf" as *u8) != 0 { allok = 0 } 30 cr_w(1, "ENGINEER: nv1 container gate + nv1 lpc gate all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 31 let eng: i64 = ig_engineer(1, 1, 1, allok) 32 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 33 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 34 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 35 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 36 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 37 38 let idx1: i64 = cl_next_idx(lp, jp) 39 let ok1: i64 = cl_register_dual(lp, jp, idx1, 5, 40 2, "GEN NV1-NISHILOSSLESS-CONTAINER (retro-registration: shipped LIVE 2026-06-10 by the video session but never journaled -- Librarian gap now closed). NLC1 = OUR circle container, MediaRecorder/webm/opus GONE from the record path: 24B header (magic NLC1, version, NATIVE sample_rate, channels=1) + 9B chunks kind A (Int16 PCM, t_ms from running sample count) / V (JPEG frame) / E (terminator, len=0, final bytes). nx_nv1.nx = team-side authority (writer + nv1_validate w/ named negatives -1..-9 incl truncation/magic/version/kind/nonzero-E/overrun/trailing); browser nv1Pack/nv1Parse in lockstep; daemon ext=nv1; live synthetic upload->store->download BYTE-IDENTICAL on nishifamily.com. Gate nx_nv1_gate 14/14 sovereign (cc->nxasm bits-up). Spec knowledge/specs/2026-06-10-nishilossless-nv1-container.md; ship script _nv1_ship" as *u8) 41 if ok1 != 1 { cr_w(1, "DUAL-WRITE-1 FAILED\n" as *u8); sys_exit(1) } 42 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx1); cr_w(1, " REGISTERED -- NV1 container (retro)\n" as *u8) 43 44 let idx2: i64 = cl_next_idx(lp, jp) 45 let ok2: i64 = cl_register_dual(lp, jp, idx2, 5, 46 2, "GEN NV1-LPC-FLAC-CLASS (arc=NISHI-VIDEO; the named next rung from the NV1 spec: halve the PCM bytes with ZERO loss). nx_nv1_lpc.nx = chunk kind 0x4C L inside NLC1: u8 mode(0..3 FLAC fixed predictors o0..o3 exact integer math; 255=verbatim escape) | u8 rice_k | u32 nsamples | warmup raw | Rice bitstream LSB-first (zigzag residuals). ENCODER costs every (order,k<16) pair EXACTLY + verbatim and writes the smallest -> payload NEVER exceeds 6+2n (noise degrades to verbatim, no expansion). DECODER = validator: named negatives -1..-7 incl bitstream-overrun and OUT-OF-RANGE RECONSTRUCTION -7 (tamper-evident decode, doctrine rung). nv1_validate learned kind L (counts samples from sub-header, -9 short payload). Gate nx_nv1_lpc_gate 25/25 sovereign GREEN: bit-exact decode(encode(x))==x on silence/DC/ramp/triangle/full-range-LCG-noise/speech-ish/alternating-extremes/tiny-n/empty + container integration + 9 rejection KATs; MEASURED permil silence 63, ramp 63, triangle 246, speech-ish 546 (the FLAC-class halving, printed on the log every run) + nv1 container gate stays 14/14. Runner bash _nv1_lpc_run. NEXT: wasm client encode path (nx_video_client_wasm), daemon-side validate-on-upload, real-circle transcode census" as *u8) 47 if ok2 != 1 { cr_w(1, "DUAL-WRITE-2 FAILED\n" as *u8); sys_exit(1) } 48 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx2); cr_w(1, " REGISTERED -- NV1 LPC rung\n" as *u8) 49 sys_exit(0) 50 return 0 51}