Integrate live-captured A/B/gamma params into framed_model; add CAP_ constants and parametric LUT helper
This commit is contained in:
@@ -10,7 +10,42 @@ struct DetectorBand {
|
||||
float level_scale = 1.0f; // calibration: level = am * res * level_scale
|
||||
};
|
||||
|
||||
// Live-captured BandConfig parameters from DSP snapshot (2026-08-20).
|
||||
// +0x180 (level LUT curve, FUN_180563a60): A = -24.0, B = +28.0, gamma = 1.0, flag = 0.
|
||||
// +0x188 (freq-range shaper, FUN_180563440): A = 16.0, B = 20000.0, gamma = 1.0, flag = 0.
|
||||
// These values are identical for both render_long.rpp and t1kq_only1_1000 configs.
|
||||
// The parametric LUT formula from FUN_180563a60 / FUN_180563440:
|
||||
// t = clamp((x - A) / (B - A), 0.0, 1.0);
|
||||
// val = A + (B - A) * t^gamma
|
||||
// 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).
|
||||
|
||||
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;
|
||||
|
||||
// Helper: parametric LUT evaluation (gamma=1 path, linear interpolation)
|
||||
inline double lut_parametric(double x, double A, double B, double gamma) {
|
||||
double t = (x - A) / (B - A);
|
||||
if (t < 0.0) t = 0.0;
|
||||
if (t > 1.0) t = 1.0;
|
||||
if (gamma == 1.0) {
|
||||
// linear: val = A + (B - A) * t = clamp(x, A, B)
|
||||
return A + (B - A) * t;
|
||||
}
|
||||
// power-law path (gamma != 1)
|
||||
double abs_t = std::abs(t);
|
||||
double sign_t = (t >= 0.0) ? 1.0 : -1.0;
|
||||
double pow_val = std::pow(std::max(abs_t, 1e-12), gamma);
|
||||
return A + (B - A) * 0.5 * (1.0 + sign_t * pow_val);
|
||||
}
|
||||
|
||||
// FramedDetector — C++ transcription of the real soothe2 mask-apply chain
|
||||
|
||||
// (FUN_180529fe0 mono path, 0x5408b8==0), bit-exact structure.
|
||||
//
|
||||
// Per band, per bin (exact decomp /tmp/consumers_out.txt:638-1111):
|
||||
|
||||
Reference in New Issue
Block a user