spectral: vectors instead of new[]; vlaw: extract law + vlaw_check target

- spectral.cpp: window_/buf_/tmp_buf_/fir_buf_/fir_freq_ as std::vector (no
  exception-leak in ctor, destructor = default)
- framed_model.hpp: extract vlaw_cut/vlaw_mask inline (BLOCKMAP:314 softplus)
- dsp/vlaw_check.cpp: unit test for law (monotonic, zero-level, delta, ref,
  comb-neutral) — PASS
- CMake: add vlaw_check target
- Guard: corpus --compare d=+0.000, fn529fe0_check PASS, twin_check PASS
This commit is contained in:
2026-09-02 23:19:34 +03:00
parent e4c53480ad
commit 2f854cd1da
8 changed files with 163 additions and 29 deletions
+12
View File
@@ -1,5 +1,6 @@
#pragma once
#include <cstddef>
#include <cmath>
#include <complex>
#include <vector>
#include "fn529fe0.hpp"
@@ -45,6 +46,17 @@ inline double lut_parametric(double x, double A, double B, double gamma) {
return A + (B - A) * 0.5 * (1.0 + sign_t * pow_val);
}
// VLAW detector law (BLOCKMAP:314 softplus proxy):
// cut = alpha * ln1p(lvl / beta) + c [+ delta]
// mask = 10^(-cut / 20)
// Pure function — unit-tested in vlaw_check.cpp.
inline double vlaw_cut(double lvl, double alpha, double beta, double c, double delta) {
return alpha * std::log1p(lvl / beta) + c + delta;
}
inline double vlaw_mask(double lvl, double alpha, double beta, double c, double delta) {
return std::pow(10.0, -vlaw_cut(lvl, alpha, beta, c, delta) / 20.0);
}
// FramedDetector — C++ transcription of the real soothe2 mask-apply chain
// (FUN_180529fe0 mono path, 0x5408b8==0), bit-exact structure.