Unverified Commit bfba2ad7 authored by Gregor Richards's avatar Gregor Richards Committed by Jean-Marc Valin
Browse files

Fix some warnings

parent 231b9c02
......@@ -25,6 +25,9 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RNNOISE_H
#define RNNOISE_H 1
#ifndef RNNOISE_EXPORT
# if defined(WIN32)
# if defined(RNNOISE_BUILD) && defined(DLL_EXPORT)
......@@ -52,3 +55,5 @@ RNNOISE_EXPORT DenoiseState *rnnoise_create(RNNModel *model);
RNNOISE_EXPORT void rnnoise_destroy(DenoiseState *st);
RNNOISE_EXPORT float rnnoise_process_frame(DenoiseState *st, float *out, const float *in);
#endif
......@@ -554,7 +554,8 @@ int main(int argc, char **argv) {
int vad_cnt=0;
int gain_change_count=0;
float speech_gain = 1, noise_gain = 1;
FILE *f1, *f2, *fout;
FILE *f1, *f2;
int maxCount;
DenoiseState *st;
DenoiseState *noise_state;
DenoiseState *noisy;
......@@ -562,12 +563,12 @@ int main(int argc, char **argv) {
noise_state = rnnoise_create(NULL);
noisy = rnnoise_create(NULL);
if (argc!=4) {
fprintf(stderr, "usage: %s <speech> <noise> <output denoised>\n", argv[0]);
fprintf(stderr, "usage: %s <speech> <noise> <count>\n", argv[0]);
return 1;
}
f1 = fopen(argv[1], "r");
f2 = fopen(argv[2], "r");
fout = fopen(argv[3], "w");
maxCount = atoi(argv[3]);
for(i=0;i<150;i++) {
short tmp[FRAME_SIZE];
fread(tmp, sizeof(short), FRAME_SIZE, f2);
......@@ -579,12 +580,11 @@ int main(int argc, char **argv) {
float Ln[NB_BANDS];
float features[NB_FEATURES];
float g[NB_BANDS];
float gf[FREQ_SIZE]={1};
short tmp[FRAME_SIZE];
float vad=0;
float vad_prob;
float E=0;
if (count==50000000) break;
if (count==maxCount) break;
if ((count%1000)==0) fprintf(stderr, "%d\r", count);
if (++gain_change_count > 2821) {
speech_gain = pow(10., (-40+(rand()%60))/20.);
noise_gain = pow(10., (-30+(rand()%50))/20.);
......@@ -659,37 +659,16 @@ int main(int argc, char **argv) {
if (vad==0 && noise_gain==0) g[i] = -1;
}
count++;
#if 0
for (i=0;i<NB_FEATURES;i++) printf("%f ", features[i]);
for (i=0;i<NB_BANDS;i++) printf("%f ", g[i]);
for (i=0;i<NB_BANDS;i++) printf("%f ", Ln[i]);
printf("%f\n", vad);
#endif
#if 1
fwrite(features, sizeof(float), NB_FEATURES, stdout);
fwrite(g, sizeof(float), NB_BANDS, stdout);
fwrite(Ln, sizeof(float), NB_BANDS, stdout);
fwrite(&vad, sizeof(float), 1, stdout);
#endif
#if 0
compute_rnn(&noisy->rnn, g, &vad_prob, features);
interp_band_gain(gf, g);
#if 1
for (i=0;i<FREQ_SIZE;i++) {
X[i].r *= gf[i];
X[i].i *= gf[i];
}
#endif
frame_synthesis(noisy, xn, X);
for (i=0;i<FRAME_SIZE;i++) tmp[i] = xn[i];
fwrite(tmp, sizeof(short), FRAME_SIZE, fout);
#endif
}
fprintf(stderr, "matrix size: %d x %d\n", count, NB_FEATURES + 2*NB_BANDS + 1);
fclose(f1);
fclose(f2);
fclose(fout);
return 0;
}
......
......@@ -27,6 +27,8 @@
#ifndef RNN_H_
#define RNN_H_
#include "rnnoise.h"
#include "opus_types.h"
#define WEIGHTS_SCALE (1.f/256)
......@@ -56,7 +58,6 @@ typedef struct {
int activation;
} GRULayer;
typedef struct RNNModel RNNModel;
typedef struct RNNState RNNState;
void compute_dense(const DenseLayer *layer, float *output, const float *input);
......
......@@ -5,22 +5,22 @@
struct RNNModel {
int input_dense_size;
DenseLayer *input_dense;
const DenseLayer *input_dense;
int vad_gru_size;
GRULayer *vad_gru;
const GRULayer *vad_gru;
int noise_gru_size;
GRULayer *noise_gru;
const GRULayer *noise_gru;
int denoise_gru_size;
GRULayer *denoise_gru;
const GRULayer *denoise_gru;
int denoise_output_size;
DenseLayer *denoise_output;
const DenseLayer *denoise_output;
int vad_output_size;
DenseLayer *vad_output;
const DenseLayer *vad_output;
};
struct RNNState {
......
Markdown is supported
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