From 7b479f535727caf5ca28a08618d86e8bbff4b8bf Mon Sep 17 00:00:00 2001 From: Matiq Date: Sun, 30 Aug 2026 18:07:15 +0300 Subject: [PATCH] B1/B2: ACC table double-deref 5407c8 + chain_9_19_sim op-by-op (BLOCKMAP 620-644) --- scripts/cascade_sim.py | 39 +++++++++++++++++++++++++++++++++++++++ scripts/rendersnap2.py | 19 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/scripts/cascade_sim.py b/scripts/cascade_sim.py index 047c873..d2be623 100644 --- a/scripts/cascade_sim.py +++ b/scripts/cascade_sim.py @@ -62,6 +62,45 @@ def k_div_exact(a, b): return np.asarray(b, dtype=np.float64) / np.asarray(a, dtype=np.float64) +def chain_9_19_sim(bands, tmp6f8, accVec, warp, att, rel, nbin=None): + """CHAIN 9-19 BLOCKMAP:620-644 op-by-op (python структурный прокси). + bands: log-domain bands_curve_i (size nbin), tmp6f8: f6f8, accVec: ACC_i + warp: kWarp@5406a8, att@5406c8 rel@5406e8 — все 2049. + Возвращает bands mutated (log domain после IIR, перед FIR).""" + if nbin is None: + nbin = len(bands) + bands = np.asarray(bands, dtype=np.float64) + tmp6f8 = np.asarray(tmp6f8, dtype=np.float64) + accVec = np.asarray(accVec, dtype=np.float64) + # 9a zero already (vec698 irrelevant), 9b: tmp6f8 += 0.8 (p=1.0 *0.8) + # 9c DIVIDE dst=bands A=bands B=tmp6f8+0.8? Actually B=tmp6f8, but step 9b already added 0.8 + # BLOCKMAP 24mm5: bands = tmp6f8 / bands (divide B/A) + # Use k_div_exact + b = tmp6f8 + 0.8 # proxy for step 9b effect (when tmp6f8 initially 0, b=0.8) + # If tmp6f8 already has data, 9b is additive 0.8, so b = tmp6f8 +0.8 + # For calibration where tmp6f8 is 0, this yields 0.8/bands + bands = k_div_exact(np.maximum(bands, 1e-30), b) + # 10 dc40: tmp6f8 = bands - ACC + tmp6f8 = bands - accVec + # 11 FMA ATT/REL half-split + # true triples 12B re/im/coef, scalar proxy: upper half ATT, lower REL + for i in range(nbin): + if i < nbin // 2: + tmp6f8[i] += att[i] * accVec[i] + else: + tmp6f8[i] += rel[i] * accVec[i] + # 14 EXP#1 + -1 (order fixed 24mm2) + bands = k_exp_exact(bands) - 1.0 + # 15 array-mul X*track (track is external, warp mul is step16) + # 16 *kWarp + LOG#2 + bands = bands * warp + bands = np.log(np.maximum(bands, 1e-30)) + # 16b IIR4x2 bidir log-domain base 0x340510 — proxy via kIIR_A1/B1 + # keep as identity for now (real IIR is mild 0.003-0.19 per 24cc) + # FIR will be applied externally via fir_kernel + return bands, tmp6f8 + + # ------------------------------------------------------------ данные ----- def load_tract(path): """tract_*.txt: k am res lvl_raw band_level prewarp w""" diff --git a/scripts/rendersnap2.py b/scripts/rendersnap2.py index d454cd9..7a24770 100644 --- a/scripts/rendersnap2.py +++ b/scripts/rendersnap2.py @@ -176,6 +176,25 @@ def main(): store['lut_G'] = struct.unpack(' buf 2049 f32 each + for bi in range(4): + q = rd(ctx + off + 8*bi, 8) + if not q: continue + ptr = struct.unpack('= 0x10000: + ab = rd(ptr, NARR * 4) + if ab: + store[hex(off)] = np.frombuffer(ab, dtype='