From: Jean-Marc Valin Date: Fri, 28 Jul 2017 05:31:42 +0000 (-0400) Subject: wip X-Git-Tag: v0~67 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc90663e1158c2cddf8f595b774f3766e122c5d0;p=platform%2Fupstream%2Frnnoise.git wip --- diff --git a/src/denoise.c b/src/denoise.c index 5e1088a..2d51cd2 100644 --- a/src/denoise.c +++ b/src/denoise.c @@ -50,6 +50,7 @@ typedef struct { int memid; float synthesis_mem[FRAME_SIZE]; float pitch_buf[PITCH_BUF_SIZE]; + float pitch_enh_buf[PITCH_BUF_SIZE]; float last_gain; int last_period; } DenoiseState; @@ -233,7 +234,10 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float * RNN_COPY(st->analysis_mem, in, FRAME_SIZE); apply_window(x); forward_transform(y, x); + compute_band_energy(Ey, y); if (1) { + float p[WINDOW_SIZE]; + kiss_fft_cpx P[WINDOW_SIZE]; float pitch_buf[PITCH_BUF_SIZE>>1]; int pitch_index; float gain; @@ -250,9 +254,16 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float * PITCH_FRAME_SIZE, &pitch_index, st->last_period, st->last_gain); st->last_period = pitch_index; st->last_gain = gain; + + RNN_MOVE(st->pitch_enh_buf, &st->pitch_enh_buf[FRAME_SIZE], PITCH_BUF_SIZE-FRAME_SIZE); + for (i=0;ipitch_buf[PITCH_BUF_SIZE-FRAME_SIZE+i] = in[i] + gain*st->pitch_buf[PITCH_BUF_SIZE-FRAME_SIZE+i-pitch_index]; + RNN_COPY(p, &st->pitch_buf[PITCH_BUF_SIZE-WINDOW_SIZE], WINDOW_SIZE); + apply_window(p); + forward_transform(P, p); + } - if (Ey != NULL) { - compute_band_energy(Ey, y); + { if (features != NULL) { float *ceps_0, *ceps_1, *ceps_2; float spec_variability = 0;