42 lines
1.9 KiB
C++
42 lines
1.9 KiB
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <vector>
|
|
|
|
// Structural transcription of the soothe2 mask-apply mono path
|
|
// FUN_180529fe0 (0x5408b8==0), BITEXACT_PLAN step 1. Uses the live-captured
|
|
// tables (dsp/rt_mask_tables.*, dsp/rt_weights.*) and the exact step sequence
|
|
// from NOTES_LEVEL:820-840 / :237-253.
|
|
//
|
|
// Unlike the empirical bridge (dsp/framed_model.cpp), this reproduces the real
|
|
// reduction/exp2-domain chain:
|
|
// scale -> IIR1 -> copy -> IIR2 -> mirror -> blend(0.8 pedestal)
|
|
// -> exp2(-level)*blend -> combine/acc -> warp(kBand768*kWarp)
|
|
// -> IIR3 x2 -> dry/wet -> (FFT-conv is step 4, separate module)
|
|
//
|
|
// The IIR/weight tables are indexed 0..N/2 of the INTERNAL grid (N=4096/SR=48000);
|
|
// per-bin level is supplied by the caller (level-path), same xv domain as bridge
|
|
// (level = am/res) but fed through the structural chain instead of the LUT bridge.
|
|
namespace fn529fe0 {
|
|
|
|
// All per-bin buffers are length nbin = nfft/2+1 (internal grid).
|
|
// IIR stage: y[i] = A[i]*acc + B[i]*x[i]; acc=y (first-order leaky, like leveltrack).
|
|
void iir1(float* x, const double* A, const double* B, size_t nbin, double acc0);
|
|
|
|
// Blend step 6: f6f8[k] = freqaxis[k]*(1-mix) + mix*0.8; out = exp2(-x)*f6f8.
|
|
void blend_exp2(float* mask, const float* x, const float* freqaxis,
|
|
float mix, size_t nbin);
|
|
|
|
// Combine step 7 (reduction/exp2 domain): accumulates per-band.
|
|
// acc = band - f6f8; += wAtt[mirror]*upper; += wRel[mirror]*lower; += band
|
|
// In-place on acc; band and f6f8 are inputs (len nbin, mirrored to full nfft).
|
|
void combine_acc(double* acc, const float* band, const float* f6f8,
|
|
const float* wAtt, const float* wRel, size_t nfft);
|
|
|
|
// Warp step 8: mask *= kBand768 * kWarp (two multiplies).
|
|
void warp_mask(float* mask, const float* kBand768, const float* kWarp, size_t nbin);
|
|
|
|
// Dry/wet step 10 (fVar30=1, 0x540888=1 -> identity for default).
|
|
void dry_wet(float* mask, float fVar30, float wet, size_t nbin);
|
|
|
|
} // namespace fn529fe0
|