Replace empirical Pchip LUT with parametric form from live DSP capture

This commit is contained in:
2026-08-20 23:08:04 +03:00
parent 16853d7e0b
commit 12094f8119
+1 -12
View File
@@ -22,17 +22,6 @@ constexpr float SENS_SCALE = 2.054f;
// With gamma=1: val = clamp(x, A, B) [linear interpolation between A and B]. // With gamma=1: val = clamp(x, A, B) [linear interpolation between A and B].
// The x input is the mask-dependent dB-scaled value (mask * 8.6859 from 0x24c43e0). // The x input is the mask-dependent dB-scaled value (mask * 8.6859 from 0x24c43e0).
constexpr double CAP_A_LEVEL = -24.0;
constexpr double CAP_B_LEVEL = 28.0;
constexpr double CAP_GAMMA = 1.0;
constexpr double CAP_A_FREQ = 16.0;
constexpr double CAP_B_FREQ = 20000.0;
constexpr double CAP_GAMMA_FREQ = 1.0;
// ---- Empirical bridge fit (NOTES_LEVEL:147, phase-5 step 5b). ----
// C(f_k) = G·LUT(log10(am_k/res_k)) + W·warp(f_k)^A ; gain = (1C)·res^rp(Q).
// The Pchip LUT below IS the runtime BandConfig curve (FUN_180563440/563a60,
// ctx+0x188 A/B/gamma) evaluated at the measured (xv, C) nodes (al_* dataset + // ctx+0x188 A/B/gamma) evaluated at the measured (xv, C) nodes (al_* dataset +
// B.11 anchors). Marked EMPIRICAL (all numbers from the joint dual+al_* fit, // B.11 anchors). Marked EMPIRICAL (all numbers from the joint dual+al_* fit,
// honest trimmed metric); the structural parametric A/B/gamma form is its // honest trimmed metric); the structural parametric A/B/gamma form is its
@@ -150,7 +139,7 @@ void FramedDetector::processFrame(const std::complex<double>* spectrum, float* m
double res_k = std::max(static_cast<double>(res_[b][k]), 1e-12); double res_k = std::max(static_cast<double>(res_[b][k]), 1e-12);
double lvl = static_cast<double>(am_[k]) / res_k; double lvl = static_cast<double>(am_[k]) / res_k;
double xv = std::log10(std::max(lvl, 1e-9)); double xv = std::log10(std::max(lvl, 1e-9));
double C = G_FIT * lut_pchip(xv) + W_FIT * std::pow(warp_c(fk), A_FIT); double C = G_FIT * lut_parametric(xv, CAP_A_LEVEL, CAP_B_LEVEL, CAP_GAMMA) + W_FIT * std::pow(warp_c(fk), A_FIT);
double g = std::max(1.0 - C, 1e-9) * std::pow(res_k, rp); double g = std::max(1.0 - C, 1e-9) * std::pow(res_k, rp);
mask[k] = std::min(static_cast<float>(g), mask[k]); mask[k] = std::min(static_cast<float>(g), mask[k]);
fk += fstep; fk += fstep;