dsp: freqpath - warp 0x5406a8 = 0.87*x/(1+x/K) (K=exp(2.0723), x=f/2000) из FUN_180530850 (0x530900) + self-check (rel err 1.5e-07, PASS)

This commit is contained in:
2026-08-18 17:08:42 +03:00
parent 0a4c0c959b
commit 111d47530e
4 changed files with 166 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "freqpath.hpp"
#include <cmath>
#include <cstring>
namespace detkernel {
// Bit-faithful transcription of the warp builder loop in FUN_180530850 (0x530900).
void build_warp(float fs_total, int n, float* warp) {
const float K = std::exp(2.0723267f); // 0x1824c4208 -> exp (0x1a14cac)
const float F = (2000.0f / (fs_total * 0.5f)) * static_cast<float>(n); // 0x1824c45b4 / ([0x24]*0.5) * N
for (int i = 1; i < n; ++i) {
float x = static_cast<float>(i) / F;
float t = x / K;
t = t + 1.0f; // +1.0 (0x1824c3ea4)
float r = 1.0f / t; // divss
r = static_cast<float>(std::fabs(static_cast<double>(r))); // cvtss2sd/andpd/cvtpd2ps
warp[i] = r * x;
}
const float scale = 0.87f; // 0x1824c3e50 (also 0.87 as double 0x24c4110)
for (int i = 0; i < n; ++i) warp[i] *= scale;
warp[0] = 0.0f; // 0x5406a8[0] = 0 (DC)
}
} // namespace detkernel