22w: faithful mask-shaping chain v1 behind RT_FAITHFUL (fnfaith.cpp) — exact 180533340 freq-warped bidir-IIR coefficients (fc_bin=85@48k/4096, constants from dump); corpus TOTAL 5.315 but comb 2.57 best-ever; decisive: mask shape cannot balance dual tones -> level contrast is created by the DETECTOR (time-domain twin bank hypothesis priority #1)

This commit is contained in:
2026-08-23 17:04:23 +03:00
parent 34156315e6
commit 13c2d028bf
5 changed files with 200 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
#pragma once
// FAITHFUL mask-shaping chain (22w) — transcription of FUN_180529fe0 per
// handoff/BLOCKMAP_529fe0.md (raw asm). Replaces process_band_structural
// when RT_FAITHFUL=1.
//
// band = lvl * s (s = RT_FAITH_SCALE, decomp: /0x1a0*0x870*0x88c)
// mask = exp2(-band) (bigkernel exp2 family)
// bidir(mask, A); bidir(mask, A) // states reset each pass (52d650 + inline)
// bidir(mask, B) // pass #3
// bidir(mask, C); bidir(mask, C) // pass #4 x2
// mirror upper half; dry/wet identity.
//
// Bidirectional one-pole per FUN_18052d650: acc = up[i]*acc + down[i]*x[i],
// forward over all bins, backward n-2..1 with persistent acc, reset per call.
// Coefficients per FUN_180533340 (freq-warped): fc_bin = C/(sr/2)*nbin;
// g = fc/i below crossover, powf(fc/i, p) above; c = 1/(g*tau/mult+1);
// up[i] = exp(-2*pi*kappa*c*g*tau), down[i] = 1-up[i].
//
// Decoded defaults (FUN_180530b60 log-interp @ live 0x540878/87c = 0.5):
// setA/B tau=19.03 mult=360 ; set3/set4 tau=10.68 mult=2400 ; p=0.822 ;
// C=1000 Hz ; kappa = 1/T8 ~ 0.0094 (T8 unknown -> env).
#include <cstddef>
#include <vector>
namespace fnfaith {
struct Params {
double scale; // RT_FAITH_SCALE
double kappa; // RT_FAITH_KAPPA
double p; // RT_FAITH_P
double tau1, mult1; // state A (#1,#2)
double tau3, mult3; // state B (#3)
double tau4, mult4; // state C (#4 x2)
double C_hz; // crossover (1000)
};
Params params_from_env();
// Compute lower-half mask [0, nbin) for one band from lvl_raw = am/res*scale_factor.
void band_mask_faithful(const float* am, const float* res, size_t nbin,
float sample_rate, float scale_factor, const Params& pr,
float* mask_out /* nbin */);
} // namespace fnfaith