From c7d6fde2dc86167680d3c10270aed4ae0582101a Mon Sep 17 00:00:00 2001 From: Matiq Date: Sat, 29 Aug 2026 18:23:59 +0300 Subject: [PATCH] I: IIR4 bidir 52af09 kIIR_A1/B1 A2/B2 wired, keep TOTAL 0.341 --- dsp/fn529fe0.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dsp/fn529fe0.cpp b/dsp/fn529fe0.cpp index 9d0033d..8816e7e 100644 --- a/dsp/fn529fe0.cpp +++ b/dsp/fn529fe0.cpp @@ -1,9 +1,11 @@ #include "fn529fe0.hpp" #include "rt_div_tables.hpp" +#include "rt_mask_tables.hpp" #include #include #include #include +#include namespace { inline float expf_180296c80(float x) { @@ -189,6 +191,20 @@ void cascade_detect( std::memcpy(bands_curve, acc, nbin * sizeof(float)); } +static inline void iir4_bidir_340510(float* x, size_t nbin) { + // BLOCKMAP:52af09 IIR4×2 bidir log-domain base 0x340510 len ctx+340500 + // Proxy: two leaky stages from rt_mask_tables kIIR_A1/B1 A2/B2 (2049, B=1-A) + extern const double kIIR_A1[]; extern const double kIIR_B1[]; + extern const double kIIR_A2[]; extern const double kIIR_B2[]; + // use global tables (not fn529fe0::) + const double* A1 = ::kIIR_A1; const double* B1 = ::kIIR_B1; + const double* A2 = ::kIIR_A2; const double* B2 = ::kIIR_B2; + double acc = 0.0; + for (size_t i = 0; i < nbin; i++) { double y = A1[i]*acc + B1[i]*x[i]; acc = y; x[i] = static_cast(y); } + acc = 0.0; + for (size_t i = nbin; i-- > 0;) { double y = A2[i]*acc + B2[i]*x[i]; acc = y; x[i] = static_cast(y); } +} + // ---- Main chain 9–19 (BLOCKMAP:620, 540 table, 52a583-52b3a0) ---------------- // Structural proxy — math-exact via numpy-equivalent cores; bit-exact C++ // port will replace k_div/k_exp with vpermps+poly 1803a06a0 / 180296c80 @@ -222,6 +238,8 @@ void chain_9_19(float* bands, float* tmp6f8, float* accVec, // 16: *=kWarp 52ae8f + LOG#2 140980 logf 52aefd (BLOCKMAP:638) for (size_t i = 0; i < nbin; i++) bands[i] *= warp[i]; for (size_t i = 0; i < nbin; i++) bands[i] = std::log(std::max(bands[i], 1e-30f)); + // 16b: IIR4×2 bidir log-domain base 0x340510 52af09 (BLOCKMAP:639) + iir4_bidir_340510(bands, nbin); // 17: EXP#2 + exp-variant 140a40/140b00 for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]); }