Unverified Commit fc90663e authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

wip

parent f76d63ac
...@@ -50,6 +50,7 @@ typedef struct { ...@@ -50,6 +50,7 @@ typedef struct {
int memid; int memid;
float synthesis_mem[FRAME_SIZE]; float synthesis_mem[FRAME_SIZE];
float pitch_buf[PITCH_BUF_SIZE]; float pitch_buf[PITCH_BUF_SIZE];
float pitch_enh_buf[PITCH_BUF_SIZE];
float last_gain; float last_gain;
int last_period; int last_period;
} DenoiseState; } DenoiseState;
...@@ -233,7 +234,10 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float * ...@@ -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); RNN_COPY(st->analysis_mem, in, FRAME_SIZE);
apply_window(x); apply_window(x);
forward_transform(y, x); forward_transform(y, x);
compute_band_energy(Ey, y);
if (1) { if (1) {
float p[WINDOW_SIZE];
kiss_fft_cpx P[WINDOW_SIZE];
float pitch_buf[PITCH_BUF_SIZE>>1]; float pitch_buf[PITCH_BUF_SIZE>>1];
int pitch_index; int pitch_index;
float gain; float gain;
...@@ -250,9 +254,16 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float * ...@@ -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); PITCH_FRAME_SIZE, &pitch_index, st->last_period, st->last_gain);
st->last_period = pitch_index; st->last_period = pitch_index;
st->last_gain = gain; st->last_gain = gain;
RNN_MOVE(st->pitch_enh_buf, &st->pitch_enh_buf[FRAME_SIZE], PITCH_BUF_SIZE-FRAME_SIZE);
for (i=0;i<FRAME_SIZE;i++)
st->pitch_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) { if (features != NULL) {
float *ceps_0, *ceps_1, *ceps_2; float *ceps_0, *ceps_1, *ceps_2;
float spec_variability = 0; float spec_variability = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment