code wiki / _hdl_build / nx_mdct.nx
nx_mdct.nx
buildroot/runtime/_hdl_build/nx_mdct.nx
about
nx_mdct.nx -- R1 of the transform ladder: the Modified Discrete Cosine Transform (the lapped transform every
perceptual audio codec uses -- MP3/AAC/Opus-CELT). Built on the SAME sine absorbed into nx_audio_osc
(osc_sin_unit) -- one sine, no dup. Sine analysis+synthesis window (Princen-Bradley) -> Time-Domain Aliasing
Cancellation: overlap-add of consecutive half-overlapped blocks PERFECTLY reconstructs the signal. That PR
property is a pure math gate (verifiable without ears). No-float -> deterministic/bit-reproducible (the exceed).
Unlocks R2 = psychoacoustic masking + quantization = perceptual audio toward Opus. license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 1 importers
imports: nx_audio_osc.nxnx_syscalls.nx
imported by: nx_perceptual.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 9 | const K_MAGIC_1100: i64 = 1100 |
| 10 | const K_MAGIC_2999: i64 = 2999 |
| 11 | const K_MAGIC_65536: i64 = 65536 |
| 13 | const OSCP: i64 = 65536 |
| 14 | const QPI: i64 = 16384 // pi/2 in osc units; cos(x) = sin(x + pi/2) |
functions
| 16 | func mp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 17 | func mpn(v: i64) -> i64 |
| 25 | func m_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: main |
| 28 | func mk_window(w: *i64, N: i64) -> i64 |
| 35 | func mbasis(n: i64, k: i64, N: i64) -> i64 |
| 42 | func mdct(x: *i64, X: *i64, w: *i64, N: i64) -> i64 |
| 55 | func imdct(X: *i64, y: *i64, w: *i64, N: i64) -> i64 |
| 69 | func main() -> i64 |