From 8d7f21bff7eed75ca3a645bc012ed8da5347964e Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Sat, 22 Jul 2017 02:42:36 -0400 Subject: [PATCH] minor cleanup --- src/denoise.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/denoise.c b/src/denoise.c index b262781..14c18a3 100644 --- a/src/denoise.c +++ b/src/denoise.c @@ -21,6 +21,8 @@ #define NB_BANDS 21 #endif +#define NB_FEATURES NB_BANDS + static const opus_int16 eband5ms[] = { /*0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 20k*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 34, 40, 48, 60, 78, 100 @@ -210,7 +212,7 @@ DenoiseState *rnnoise_create() { } -static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, const float *in) { +static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float *features, const float *in) { float x[WINDOW_SIZE]; int i; RNN_COPY(x, st->analysis_mem, FRAME_SIZE); @@ -218,6 +220,16 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, const float *in) { RNN_COPY(st->analysis_mem, in, FRAME_SIZE); apply_window(x); forward_transform(y, x); + if (Ey != NULL) { + compute_band_energy(Ey, y); + if (features != NULL) { + float Ly[NB_BANDS]; + for (i=0;i 1) g[i] = 1; -- 2.7.4