24n-2: Delta-branch implemented (peak+neighbourhood, two-pass); dual end-to-end 9.32/11.58 vs ref 10.32/11.82; VLAW corpus: dual 0.708 (was 3.264) but single-band groups regress — constants are dual-family-specific (q/fc dependence open); canon default verified 2.286
This commit is contained in:
+27
-15
@@ -142,26 +142,38 @@ static void process_band_structural(
|
||||
}
|
||||
|
||||
// RT_VLAW=1 (NOTES 24m): decoded two-stage detector law.
|
||||
// cutS(b) = 1.7436*ln(1 + lvl_raw/0.3824) [stage-S, center form]
|
||||
// cutS(b) = 1.729*ln(1 + lvl_raw/0.3824) + Delta(b) [stage-S]
|
||||
// applied gain = 10^(-gamma0*cutS/20), gamma0 = 1.79
|
||||
// Delta-branch: neighbourhoods of off-center content peaks get +4.18 dB.
|
||||
// Bypasses LUT/exp2/blend/warp/IIR3 entirely.
|
||||
static const int vlaw = getenv("RT_VLAW") ? atoi(getenv("RT_VLAW")) : 0;
|
||||
static int frame_dbg_ctr = 0;
|
||||
for (size_t k = 0; k < nbin; k++) {
|
||||
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
|
||||
double lvl = raw_level[k];
|
||||
if (vlaw) {
|
||||
double cutS = 1.7436 * std::log1p(lvl / 0.3824);
|
||||
double g = std::pow(10.0, -1.79 * cutS / 20.0);
|
||||
if (getenv("RT_VDBG") && (k == 43 || k == 171) && (frame_dbg_ctr < 2))
|
||||
fprintf(stderr, "[VLAW] k=%zu lvl=%.5f cutS=%.5f g=%.5f\n",
|
||||
k, lvl, cutS, g);
|
||||
band_level[k] = static_cast<float>(g);
|
||||
} else {
|
||||
band_level[k] = static_cast<float>(lvl);
|
||||
if (vlaw) {
|
||||
double kfc = static_cast<double>(band.fc) / (sample_rate / 2.0) * (nbin - 1);
|
||||
static thread_local std::vector<float> delta_mark;
|
||||
delta_mark.assign(nbin, 0.0f);
|
||||
for (size_t k2 = 1; k2 + 1 < nbin; k2++) {
|
||||
if (raw_level[k2] <= 0.25) continue;
|
||||
if (std::fabs((double)k2 - kfc) <= 8.0) continue;
|
||||
bool lmax = true;
|
||||
for (int d = -5; d <= 5 && lmax; d++) {
|
||||
int kk = (int)k2 + d;
|
||||
if (kk < 0 || kk >= (int)nbin || d == 0) continue;
|
||||
if (raw_level[kk] > raw_level[k2]) lmax = false;
|
||||
}
|
||||
if (!lmax) continue;
|
||||
for (int d = -3; d <= 3; d++) {
|
||||
int kk = (int)k2 + d;
|
||||
if (kk >= 0 && kk < (int)nbin) delta_mark[kk] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!vlaw)
|
||||
for (size_t k2 = 0; k2 < nbin; k2++) {
|
||||
double cs = 1.729 * std::log1p(raw_level[k2] / 0.3824)
|
||||
+ (delta_mark[k2] ? 4.177 : 0.0);
|
||||
band_level[k2] = static_cast<float>(std::pow(10.0, -1.79 * cs / 20.0));
|
||||
}
|
||||
frame_dbg_ctr++;
|
||||
} else
|
||||
for (size_t k = 0; k < nbin; k++) {
|
||||
double res_k = std::max(static_cast<double>(res[k]), 1e-12);
|
||||
double lvl = raw_level[k];
|
||||
|
||||
Reference in New Issue
Block a user