@@ -58,25 +58,42 @@ _Static_assert(sizeof(uint32_t) == 4, "uint32_t must be exactly 32 bits");
5858#define REFERENCE_LEVEL (90.F)
5959#define SINE_AMPLITUDE (1.F)
6060
61- // Masking Thresholds
62- #define BIAS false
63- #define HIGH_FREQ_BIAS 20.F
64- #if BIAS
65- // clang-format off
66- #define relative_thresholds \
67- (float[25]){-16.F, -17.F, -18.F, -19.F, -20.F, -21.F, -22.F, -23.F, -24.F, \
68- -25.F, -25.F, -25.F, -25.F, -25.F, -25.F, -24.F, -23.F, -22.F, \
69- -19.F, -18.F, -18.F, -18.F, -18.F, -18.F, -18.F}
70- // clang-format on
71- #endif
61+ // Johnston Psychoacoustic Model (1988)
62+ #define DB_FS_TO_SPL_REF 96.0F // 0dBFS -> 96dB SPL reference level
63+ #define POWER_LAW_EXPONENT (0.6F) // Johnston power-law integration exponent
64+
65+ // Default Additivity Exponents
66+ #define SPECTRAL_ADDITIVITY_EXPONENT_STANDARD (1.0F) // Pure Johnston
67+ #define SPECTRAL_ADDITIVITY_EXPONENT_PEAQ (0.4F) // Advanced precision
68+
69+ // Schroeder spreading function constants
70+ #define S_MIN_UPWARD (5.0F) // Minimum upward spreading slope (dB/Bark)
71+ #define S_MAX_UPWARD (15.0F) // Maximum upward spreading slope (dB/Bark)
72+ #define S_DOWNWARD (25.0F) // Constant downward spreading slope (dB/Bark)
73+
74+ // Threshold Offsets (NMT = Noise-Masking-Tone, TMN = Tone-Masking-Noise)
75+ #define NMT_OFFSET_DB (6.0F) // Standard offset for NMT
76+ #define TMN_OFFSET_BASE (14.5F) // Base offset for TMN (Bark-dependent)
77+
78+ // Johnston SFM (Spectral Flatness Measure) constants
79+ #define SFM_MIN_DB (-60.0F) // Minimum expected SFM (highly tonal)
80+ #define SFM_MAX_DB (0.0F) // Maximum expected SFM (random noise)
81+ // Temporal Masking Constants
82+ #define FORWARD_MASKING_TAU_LOW_MS (0.100F) // 100ms decay for low frequencies
83+ #define FORWARD_MASKING_TAU_HIGH_MS (0.025F) // 25ms decay for high frequencies
84+ #define BACKWARD_MASKING_TAU_MS (0.010F) // 10ms decay for pre-masking
85+
86+ // Schroeder Slope Adaptation Constants
87+ #define S_LEVEL_REF_DB 40.0F // Reference level for slope adaptation (dB SPL)
88+ #define S_SLOPE_FACTOR 0.2F // Slope broadening factor per dB
7289
7390// Veto Parameters
74- #define MASKING_VETO_ALPHA_FLOOR \
75- (0.2F) // Set to 0.0 for full preservation, or 1.0 for standard reduction.
91+ #define MASKING_VETO_SMOOTHING 0.5F // Stabilization alpha for clean signal
92+ #define MASKING_VETO_NMR_RANGE 20.0F // NMR range for protection mapping (dB)
7693
7794// Gain Estimators
7895#define GSS_EXPONENT \
79- 2.0F // 2 Power Subtraction / 1 Magnitude Subtraxtion / 0.5 Spectral
96+ 2.0F // 2 Power Subtraction / 1 Magnitude Subtraction / 0.5 Spectral
8097 // Subtraction
8198
8299// Oversubtraction criteria
@@ -92,7 +109,6 @@ _Static_assert(sizeof(uint32_t) == 4, "uint32_t must be exactly 32 bits");
92109#define ESTIMATOR_SILENCE_THRESHOLD (1e-10F) // Roughly -100dB in power
93110
94111// Martin (2001) Constants
95- #define MARTIN_WINDOW_LEN 96 // Total window length (frames)
96112#define MARTIN_SUBWIN_COUNT 8 // Number of sub-windows
97113#define MARTIN_SUBWIN_LEN 12 // Sub-window length (96/8)
98114#define MARTIN_BIAS_CORR 1.5F // Conservative bias correction for min tracking
@@ -116,7 +132,8 @@ _Static_assert(sizeof(uint32_t) == 4, "uint32_t must be exactly 32 bits");
116132 (1e-6F) // Precision for bias correction calc
117133#define BRANDT_ESTIMATOR_MIN_HISTORY_FRAMES \
118134 5U // Minimum frames for history-based tracking
119- #define BRANDT_ESTIMATOR_MIN_DURATION_MS 0.1F // Safety floor for duration calcs
135+ #define BRANDT_ESTIMATOR_MIN_DURATION_MS \
136+ (0.1F) // Safety floor for duration calcs
120137
121138// Tonal Detector Constants
122139#define PEAK_THRESHOLD 1.41f // ~3dB above neighbor background
@@ -132,6 +149,9 @@ _Static_assert(sizeof(uint32_t) == 4, "uint32_t must be exactly 32 bits");
132149// Transient Detector Constants
133150#define UPPER_LIMIT (5.F)
134151#define DEFAULT_TRANSIENT_THRESHOLD (2.F)
152+ #define MIN_INNOVATION_ENERGY 1e-10F // ~ -100dB floor for transient trigger
153+ #define ONSET_RATIO_SENSITIVITY 0.25F // Innovation required for full weight
154+ #define TRANSIENT_SMOOTH_ALPHA 0.8F // Reference smoothing alpha
135155
136156// Noise Estimator Constants
137157#define MIN_NUMBER_OF_WINDOWS_NOISE_AVERAGED 5
@@ -170,6 +190,9 @@ _Static_assert(sizeof(uint32_t) == 4, "uint32_t must be exactly 32 bits");
170190#define CRITICAL_BANDS_TYPE_1D BARK_SCALE
171191#define GAIN_ESTIMATION_TYPE_1D WIENER
172192
193+ // Masking Veto defaults
194+ #define USE_TEMPORAL_MASKING_1D_DEFAULT true
195+
173196/* ------------------------------------------------------------------ */
174197/* ------------------- 2D Denoiser configurations ------------------- */
175198/* ------------------------------------------------------------------ */
@@ -190,4 +213,7 @@ _Static_assert(sizeof(uint32_t) == 4, "uint32_t must be exactly 32 bits");
190213#define CRITICAL_BANDS_TYPE_2D BARK_SCALE
191214#define GAIN_ESTIMATION_TYPE_2D WIENER
192215
216+ // Masking Veto defaults
217+ #define USE_TEMPORAL_MASKING_2D_DEFAULT true
218+
193219#endif // MODULES_CONFIGURATIONS_H
0 commit comments