diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2017-10-10 19:30:11 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2017-10-18 06:29:43 +0300 |
commit | 91ef401f4c3536c6de999ac609262691ec888c4c (patch) | |
tree | b473345d88b7549ada12d69548a5fd014bc68d47 | |
parent | 3d2acb836174ed52cd5d54f0ff5683cbc0c82389 (diff) |
Limiting the gain decay
-rw-r--r-- | src/denoise.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/denoise.c b/src/denoise.c index b81f655..128cd99 100644 --- a/src/denoise.c +++ b/src/denoise.c @@ -93,6 +93,7 @@ struct DenoiseState { float last_gain; int last_period; float mem_hp_x[2]; + float lastg[NB_BANDS]; RNNState rnn; }; @@ -487,6 +488,11 @@ float rnnoise_process_frame(DenoiseState *st, float *out, const float *in) { if (!silence) { compute_rnn(&st->rnn, g, &vad_prob, features); pitch_filter(X, P, Ex, Ep, Exp, g); + for (i=0;i<NB_BANDS;i++) { + float alpha = .6f; + g[i] = MAX16(g[i], alpha*st->lastg[i]); + st->lastg[i] = g[i]; + } interp_band_gain(gf, g); #if 1 for (i=0;i<FREQ_SIZE;i++) { |