Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create SIMD-accelerated version of compute_gru function #191

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
RNNoise is a noise suppression library based on a recurrent neural network.
A description of the algorithm is provided in the following paper:

J.-M. Valin, A Hybrid DSP/Deep Learning Approach to Real-Time Full-Band Speech
Enhancement, Proceedings of IEEE Multimedia Signal Processing (MMSP) Workshop,
arXiv:1709.08243, 2018.
https://arxiv.org/pdf/1709.08243.pdf

An interactive demo is available at: https://jmvalin.ca/demo/rnnoise/

To compile, just type:
% ./autogen.sh
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ AC_SUBST(OP_LT_REVISION)
AC_SUBST(OP_LT_AGE)

CC_CHECK_CFLAGS_APPEND(
[-pedantic -Wall -Wextra -Wno-sign-compare -Wno-parentheses -Wno-long-long])
[-O3 -march=native -pedantic -Wall -Wextra -Wno-sign-compare -Wno-parentheses -Wno-long-long])

# Platform-specific tweaks
case $host in
Expand Down
2 changes: 1 addition & 1 deletion src/compile.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

gcc -DTRAINING=1 -Wall -W -O3 -g -I../include denoise.c kiss_fft.c pitch.c celt_lpc.c rnn.c rnn_data.c -o denoise_training -lm
gcc -DTRAINING=1 -march=native -Wall -W -O3 -g -I../include denoise.c kiss_fft.c pitch.c celt_lpc.c rnn.c rnn_data.c -o denoise_training -lm
20 changes: 13 additions & 7 deletions src/denoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ int rnnoise_init(DenoiseState *st, RNNModel *model) {
st->rnn.vad_gru_state = calloc(sizeof(float), st->rnn.model->vad_gru_size);
st->rnn.noise_gru_state = calloc(sizeof(float), st->rnn.model->noise_gru_size);
st->rnn.denoise_gru_state = calloc(sizeof(float), st->rnn.model->denoise_gru_size);
st->rnn.compute_gru_fct = &compute_gru;

#if defined(__AVX2__)
if(is_avx2_supported() == 1) {
st->rnn.compute_gru_fct = &compute_gru_avx2;
}
#endif

return 0;
}

Expand Down Expand Up @@ -408,13 +416,11 @@ static void frame_synthesis(DenoiseState *st, float *out, const kiss_fft_cpx *y)
}

static void biquad(float *y, float mem[2], const float *x, const float *b, const float *a, int N) {
int i;
for (i=0;i<N;i++) {
float xi, yi;
xi = x[i];
yi = x[i] + mem[0];
mem[0] = mem[1] + (b[0]*(double)xi - a[0]*(double)yi);
mem[1] = (b[1]*(double)xi - a[1]*(double)yi);
for (int i=0;i<N;i++) {
float xi = x[i];
float yi = xi + mem[0];
mem[0] = mem[1] + (b[0] * xi - a[0] * yi);
mem[1] = (b[1] * xi - a[1] * yi);
y[i] = yi;
}
}
Expand Down
Loading