From 2e0b107b4c6eb5fdae181b88b55c1141185f87ad Mon Sep 17 00:00:00 2001 From: Matiq Date: Thu, 20 Aug 2026 15:32:47 +0300 Subject: [PATCH] P4: document PRNG prologue + remaining bit-exact gaps --- handoff/NOTES_LEVEL.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/handoff/NOTES_LEVEL.md b/handoff/NOTES_LEVEL.md index 5936a60..f3a53c5 100644 --- a/handoff/NOTES_LEVEL.md +++ b/handoff/NOTES_LEVEL.md @@ -864,3 +864,23 @@ exp2 is standard log2e/poly/mantissa-table (0x1f34a80..., log2e~1.4424, floor -7 - comb 4-band at scale 600: per-tone err 300:-5.1, 500:+7.8, 1000:+4.4, 1500:+3.9, 2000:-1.3, 3000:+4.8 dB (max 7.8). Mask shape (warp tilt + FFT-conv smoothing) still approximated. + +## ============ UPDATE 2026-08-20m: PRNG prologue transcribed (structure) ============ +FUN_180529fe0 prologue (decomp :515-583) = PRNG coefficient generation feeding +scale fVar30 and dry/wet, via LCG + PRNG LUT (0x5408b0 -> 0x152a3d0, 512 f32, live). + +LCG: state += (round offsets) & 0x8000007f with sign fixup. Constants: + DAT_18262b5c8=0.4552, DAT_18262b704=0.6089, DAT_18262b700=0.6070, DAT_1824c3c58=0.001 +Round products fVar27*LUT[..]*fVar28*LUT[..]+0.001 are ~0.28 at PRNG state 112 +(live), so (int) truncates to 0 => fVar30 can be 0..~ range frame-to-frame. +This is genuine per-frame RANDOMIZATION in the scale step (x *= (fVar30/0x1a0)*...). +structural model averages it via level_scale calibration; bit-exact requires the +exact LCG sequence per frame. scale already calibrated (t1kq -0.43 dB). + +### Remaining bit-exact gaps (documented, next sessions): +1. exact LCG/LUT per-frame fVar30 (scale + dry/wet randomization) +2. FFT-conv (0x535a70) mask smoothing before FIR +3. bit-exact vectorized exp2 (0x26b820) vs std::exp2 +4. combine/accumulator (0x5407c8) exact feedback (1500Hz comb err +6.4 dB) +5. internal SR=48000/N=4096 vs host 44100/N=2048 and twin per-bin IIR (statically + invisible, FUN_180535880 tail-calls)