- Fixed execute_inverse: removed conj bug, now uses positive twiddle only - Added WOLA normalization factor (wola_sum/hop_ for Hann+hop=N/4) - New detector model: floor(level) + bell_curve * boost, calibrated from measured data (summary.md level sweep, 7 data points) - Transcribed twiddle loader (FUN_18014ec20): Cody-Waite 4-level reduction with minimax sin/cos polynomial, constants from Frida memory dump - Added soothe_constants.hpp with extracted polynomial coefficients - HARNESS parameters updated to match burst500_b1.rpp (depth=0.864) Results: burst500.wav reduction now -5.8 dB vs Ref -6.8 dB (was -14.4 dB)
67 lines
3.7 KiB
C++
67 lines
3.7 KiB
C++
#pragma once
|
|
// Extracted from soothe2_x64.vst3 runtime memory (Frida dump soothe_mem.bin)
|
|
// FUN_18014ec20 twiddle loader constants
|
|
// Module base: 0x180000000
|
|
|
|
namespace soothe {
|
|
|
|
// Pi reduction constants (range reduction for sin/cos)
|
|
constexpr double REDUCE_PI = 3.1415925025939941; // _DAT_181c80800
|
|
constexpr double REDUCE_STEP = 1.5099578831723193e-07; // _DAT_181c80840 (≈π/2²¹)
|
|
|
|
// Sin polynomial coefficients (odd powers: x³, x⁵, x⁷, x⁹, x¹¹, x¹³)
|
|
// sin(x) ≈ x + x³·(c0 + x²·(c1 + x²·(c2 + x²·(c3 + x²·(c4 + x²·c5)))))
|
|
// SIMD layout: each coefficient stored as __m128d pair (2 copies)
|
|
constexpr double SIN_C0 = 8.333333333285186e-03; // ≈ 1/120
|
|
constexpr double SIN_C1 = -1.984126982494424e-04; // ≈ -1/5040
|
|
constexpr double SIN_C2 = 2.755731658449074e-06; // ≈ 1/362880
|
|
constexpr double SIN_C3 = -2.505187912674299e-08; // ≈ -1/39916800
|
|
constexpr double SIN_C4 = 1.604805557697937e-10; // ≈ 1/6227020800
|
|
|
|
// Cos correction polynomial (for high-accuracy refinement)
|
|
// cos(x) ≈ d0 + x²·(d1 + x²·d2) applied as correction
|
|
constexpr double COS_CORR0 = 8.333322932609515e-03; // ≈ 1/120
|
|
constexpr double COS_CORR1 = -5.000000000000000e-01; // = -0.5
|
|
constexpr double COS_CORR2 = 4.166666666665152e-02; // ≈ 1/24
|
|
|
|
// Chebyshev table (DAT_181c80d00) — used for final correction
|
|
constexpr double CHEB_A = 0.0; // DAT_181c80d00
|
|
constexpr double CHEB_B = 1.0; // DAT_181c80d08
|
|
constexpr double CHEB_C = 0.0; // DAT_181c80d10
|
|
|
|
// Fast float construction constants
|
|
constexpr double DBL_MINX2 = 2.225073858507201e-308; // _DAT_181c912d0 (DBL_MIN*2, denormal threshold)
|
|
constexpr double NEG_ZERO = -0.0; // _DAT_181c91300 (sign bit mask)
|
|
constexpr double ONE_POINT = 1.0; // _DAT_181c91310
|
|
constexpr double TWO_POW_43 = 13194139533312.0; // _DAT_181c91320 (2^43, fast int→float)
|
|
|
|
// Exponent mask for float decomposition
|
|
// _DAT_181c80640: 0x8000000000000000 = -0.0 (sign bit mask for doubles)
|
|
|
|
// Sin/Cos fallback lookup tables (FUN_1801de760/sin, FUN_1801e3f20/cos)
|
|
// 4 doubles per entry: {correction, 1.0, sin/cos_value, ~0}
|
|
// Starting at 0x181c80e00, stride 32 bytes (4 doubles)
|
|
// First 16 entries extracted:
|
|
constexpr double SINCOS_TABLE[][4] = {
|
|
{-4.815273327803114e-03, 1.0, 9.801714032956060e-02, -1.634582302684147e-18},
|
|
{-6.093029997643959e-03, 1.0, 1.102222072938831e-01, -5.678950075852050e-19},
|
|
{-7.520465401290002e-03, 1.0, 1.224106751992162e-01, 2.835450028764130e-18},
|
|
{-9.097364572219975e-03, 1.0, 1.345807085071262e-01, -9.167035578355592e-18},
|
|
{-1.921471959676955e-02, 1.0, 1.950903220161283e-01, -7.991078396422643e-18},
|
|
{-2.168262928037237e-02, 1.0, 2.071113761922186e-01, -1.061336170658517e-17},
|
|
{-2.429786996147145e-02, 1.0, 2.191012401568698e-01, -3.651380984986437e-19},
|
|
{-2.706004779443985e-02, 1.0, 2.310581082806711e-01, 1.012978695740300e-17},
|
|
{-4.305966426779113e-02, 1.0, 2.902846772544624e-01, -1.892797856471813e-17},
|
|
{-4.669395964580617e-02, 1.0, 3.020059493192281e-01, -1.716766542931138e-17},
|
|
{-5.047181940696333e-02, 1.0, 3.136817403988915e-01, 1.456044673246467e-17},
|
|
{-5.439267461947867e-02, 1.0, 3.253102921622629e-01, 7.917124313757339e-18},
|
|
{-7.612046748871325e-02, 1.0, 3.826834323650898e-01, -1.005077218375010e-17},
|
|
{-8.088614830994226e-02, 1.0, 3.939920400610481e-01, 9.764923379470145e-18},
|
|
{-8.579024429646935e-02, 1.0, 4.052413140049899e-01, 9.911139960448081e-18},
|
|
{-9.083201690947762e-02, 1.0, 4.164295600976372e-01, -2.547557964294083e-17},
|
|
};
|
|
|
|
constexpr int SINCOS_TABLE_ENTRIES = sizeof(SINCOS_TABLE) / sizeof(SINCOS_TABLE[0]);
|
|
|
|
} // namespace soothe
|