code wiki / _hdl_build / nx_rvq_gate.nx

nx_rvq_gate.nx

buildroot/runtime/_hdl_build/nx_rvq_gate.nx

5468 B103 linesdepth 4pulls 8 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_rvq_gate.nx -- proves Residual VQ (nx_rvq): greedily train a 3-stage RVQ stack on LPC reflection vectors, then show the reconstruction distortion DROPS with each added stage (the rate-distortion knob), reaching far below single-stage VQ. This is the SoundStream/Lyra codec structure; the neural net replaces the fixed centroids with learned ones.

dependencies 6 imports · 0 importers

nx_syscalls_x86_64.nx nx_lpc_autocorr.nx nx_lpc_levinson.nx nx_vq.nx nx_vq_train.nx nx_rvq.nx nx_rvq_gate.nx

imports: nx_syscalls_x86_64.nxnx_lpc_autocorr.nxnx_lpc_levinson.nxnx_vq.nxnx_vq_train.nxnx_rvq.nx

imported by: nobody (leaf or entry point)

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

main g_puts fill_parabola st16 nx_lpc_autocorr nx_lpc_levinson _q30_mul ld64 rvq_stage vqt_iterate vq_encode vq_dist2 vqt_vec vq_encode ↻ rvq_encode rvq_stage ↻ vq_encode ↻ rvq_decode_partial rvq_stage ↻ rvq_dist vq_index_bits g_pn g_check g_puts ↻

structs

none

consts

none

functions

11func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: g_checkmain
12func g_pn(v: i64) -> i64
called by 1: main
22func g_check(name: *u8, cond: i64) -> i64
called by 1: main calls 1: g_puts
26func st16(buf: *u8, idx: i64, v: i64) -> i64 { var x: i64 = v; if x < 0 { x = x + 65536 } buf[idx*2] = x & 0xff; buf[idx*2+1] = (x >> 8) & 0xff; return 0 }
called by 1: fill_parabola
27func ld64(buf: *u8, byteoff: i64) -> i64 { var v: i64 = 0; var b: i64 = 0; while b < 8 { v = v | (buf[byteoff + b] << (b*8)); b = b + 1 } return v }
called by 1: main
28func fill_parabola(s: *u8, n: i64, period: i64) -> i64 { var i: i64=0; while i<n { let p: i64 = i % period; st16(s, i, 40 + p*(period-p)*2); i=i+1 } return 0 }
called by 1: main calls 1: st16
30func main() -> i64