dsp/: fix FFT inverse, WOLA normalization, detector model, twiddle loader

- 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)
This commit is contained in:
2026-08-17 18:39:50 +03:00
parent 785aff352b
commit 847725f5fc
6 changed files with 216 additions and 31 deletions
+11 -1
View File
@@ -41,11 +41,21 @@ void SpectralProcessor::stftFrame(const float* in, std::complex<double>* out) {
void SpectralProcessor::istftFrame(std::complex<double>* in, float* out, float* overlap) {
memcpy(tmp_buf_, in, nfft_ * sizeof(std::complex<double>));
fft::execute_inverse(&plan_, tmp_buf_);
static bool wola_computed = false;
static float wola_norm = 1.0f;
if (!wola_computed) {
double wola_sum = 0.0;
for (size_t i = 0; i < nfft_; i++) {
wola_sum += window_[i] * window_[i];
}
wola_norm = static_cast<float>(wola_sum / hop_);
wola_computed = true;
}
for (size_t i = 0; i < nfft_; i++) {
overlap[i] += static_cast<float>(tmp_buf_[i].real() * window_[i]);
}
for (size_t i = 0; i < hop_; i++) {
out[i] = overlap[i];
out[i] = overlap[i] / wola_norm;
}
for (size_t i = 0; i < nfft_ - hop_; i++) {
overlap[i] = overlap[i + hop_];