22l: pool5+scale1.144+floor hits tone floor -20.74 (real -20.72); corpus 5.9 — params need systematic fit; canon untouched

This commit is contained in:
2026-08-22 21:33:31 +03:00
parent 355ce828f4
commit 98a35e8648
2 changed files with 59 additions and 1 deletions
+31 -1
View File
@@ -102,10 +102,40 @@ static void process_band_structural(
// hypothesis: audio path has NO LUT (FUN_180563a60 was GUI-only, 22b);
// mask = blend*exp2(-lvl_raw) directly.
static const int lut_off = getenv("RT_LUT_OFF") ? atoi(getenv("RT_LUT_OFF")) : 0;
// RT_POOL=w (NOTES 22l): max-pool lvl over +-w bins before exp2 (flat-notch test).
// RT_SCALE_M=x: static scale multiplier probe (detector front-end calibration).
static const int pool_w = getenv("RT_POOL") ? atoi(getenv("RT_POOL")) : 0;
static const double scale_mult = getenv("RT_SCALE_M") ? atof(getenv("RT_SCALE_M")) : 1.0;
const double scale_factor_x = scale_factor * scale_mult;
std::vector<float> lvl_in(nbin);
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
lvl_in[k] = static_cast<float>(static_cast<double>(am[k]) / res_k * scale_factor_x);
}
if (pool_w > 0 && !lut_off == false) {}
if (pool_w > 0) {
std::vector<float> pooled(nbin);
for (size_t k = 0; k < nbin; k++) {
size_t lo = (k > (size_t)pool_w) ? k - pool_w : 0;
size_t hi = std::min(nbin - 1, k + (size_t)pool_w);
float mx = 0.0f;
for (size_t j = lo; j <= hi; j++) mx = std::max(mx, lvl_in[j]);
pooled[k] = mx;
}
lvl_in.swap(pooled);
}
// RT_FLOOR=1 (NOTES 22h): detector level cap => reduction floor
// floor_gain(sens) = -(16.78+sens/3)/6.0174*6.0174 dB => lvl_cap below
static const int floor_on = getenv("RT_FLOOR") ? atoi(getenv("RT_FLOOR")) : 0;
if (floor_on) {
float cap = (16.78f + band.sens / 3.0f) / 6.0174f;
for (size_t k = 0; k < nbin; k++) if (lvl_in[k] > cap) lvl_in[k] = cap;
}
for (size_t k = 0; k < nbin; k++) {
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
double lvl = static_cast<double>(am[k]) / res_k * scale_factor;
double lvl = lvl_in[k];
if (!lut_off) {
// dB-domain LUT (FUN_180563a60) on LEVEL before IIR/exp2: keeps both
// quiet (t1kq) and loud (t1k) inputs inside the LUT domain [A,B],