I: IIR4 bidir 52af09 kIIR_A1/B1 A2/B2 wired, keep TOTAL 0.341

This commit is contained in:
2026-08-29 18:23:59 +03:00
parent e39c97e014
commit c7d6fde2dc
+18
View File
@@ -1,9 +1,11 @@
#include "fn529fe0.hpp"
#include "rt_div_tables.hpp"
#include "rt_mask_tables.hpp"
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cfenv>
#include <vector>
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<float>(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<float>(y); }
}
// ---- Main chain 919 (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]);
}