fix: corpus 24-bit loader + LUT calibration env var

- Fix reshape error in corpus.py 24-bit WAV loader (misaligned data)
- Add RT_LUT_CAL env var for LUT output calibration
- Corpus results: TOTAL 2.397 (bridge 1.594), comb improved (-4.032)
- Structural chain regresses on t1kq/t1k/al/dual due to LUT curve mismatch
- The LUT produces different frequency response than plugin's FIR construction
This commit is contained in:
2026-08-24 15:18:39 +03:00
parent a1632a9fce
commit 475b1958d5
2 changed files with 7 additions and 0 deletions
+4
View File
@@ -152,6 +152,10 @@ static void process_band_structural(
double t = (dB - LUT_A) / (LUT_B - LUT_A); double t = (dB - LUT_A) / (LUT_B - LUT_A);
t = std::min(std::max(t, 0.0), 1.0); t = std::min(std::max(t, 0.0), 1.0);
lvl = std::pow(t, static_cast<double>(LUT_GAMMA)) * LUT_MULT; lvl = std::pow(t, static_cast<double>(LUT_GAMMA)) * LUT_MULT;
// RT_LUT_CAL: calibration multiplier on LUT output (empirical,
// calibrated against plugin steady-state mask@43=0.510).
static const double lut_cal = getenv("RT_LUT_CAL") ? atof(getenv("RT_LUT_CAL")) : 1.0;
lvl *= lut_cal;
} }
band_level[k] = static_cast<float>(lvl); band_level[k] = static_cast<float>(lvl);
} }
+3
View File
@@ -32,6 +32,9 @@ def load_mono(p):
ch = w.getnchannels(); b = w.getsampwidth() ch = w.getnchannels(); b = w.getsampwidth()
if b == 2: if b == 2:
return np.frombuffer(d, dtype=np.int16).astype(np.float64).reshape(-1, ch).mean(1) / 32768 return np.frombuffer(d, dtype=np.int16).astype(np.float64).reshape(-1, ch).mean(1) / 32768
# 24-bit: handle misaligned data (extra bytes from bext/junk chunks)
n_samples = len(d) // (ch * 3)
d = d[:n_samples * ch * 3]
raw = np.frombuffer(d, dtype=np.uint8).reshape(-1, ch, 3) raw = np.frombuffer(d, dtype=np.uint8).reshape(-1, ch, 3)
s = raw[:, :, 0].astype(np.int64) | (raw[:, :, 1].astype(np.int64) << 8) | (raw[:, :, 2].astype(np.int64) << 16) s = raw[:, :, 0].astype(np.int64) | (raw[:, :, 1].astype(np.int64) << 8) | (raw[:, :, 2].astype(np.int64) << 16)
return np.where(s >= 0x800000, s - 0x1000000, s).mean(1).astype(np.float64) / 8388608.0 return np.where(s >= 0x800000, s - 0x1000000, s).mean(1).astype(np.float64) / 8388608.0