[xiph-cvs] cvs commit: speex/libspeex denoise.c speex_denoise.h testdenoise.c
Jean-Marc Valin
jm at xiph.org
Wed May 21 12:53:08 PDT 2003
jm 03/05/21 15:53:08
Modified: libspeex denoise.c speex_denoise.h testdenoise.c
Log:
added the "speex" prefix to the denoising stuff
Revision Changes Path
1.10 +6 -5 speex/libspeex/denoise.c
Index: denoise.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/denoise.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- denoise.c 21 May 2003 18:24:21 -0000 1.9
+++ denoise.c 21 May 2003 19:53:08 -0000 1.10
@@ -77,12 +77,12 @@
}
}
-DenoiseState *denoise_state_init(int frame_size)
+SpeexDenoiseState *speex_denoise_state_init(int frame_size)
{
int i;
int N, N3, N4;
- DenoiseState *st = (DenoiseState *)speex_alloc(sizeof(DenoiseState));
+ SpeexDenoiseState *st = (SpeexDenoiseState *)speex_alloc(sizeof(SpeexDenoiseState));
st->frame_size = frame_size;
/* Round ps_size down to the nearest power of two */
@@ -168,7 +168,7 @@
return st;
}
-void denoise_state_destroy(DenoiseState *st)
+void speex_denoise_state_destroy(SpeexDenoiseState *st)
{
speex_free(st->frame);
speex_free(st->ps);
@@ -192,7 +192,7 @@
speex_free(st);
}
-static void update_noise(DenoiseState *st, float *ps)
+static void update_noise(SpeexDenoiseState *st, float *ps)
{
int i;
float beta;
@@ -205,7 +205,7 @@
st->noise[i] = (1-beta)*st->noise[i] + beta*ps[i];
}
-int denoise(DenoiseState *st, float *x)
+int speex_denoise(SpeexDenoiseState *st, float *x)
{
int i;
int is_speech=0;
@@ -380,6 +380,7 @@
st->consec_noise=0;
}
+ /*fprintf (stderr, "%f %f ", mean_prior, mean_post);*/
if (mean_prior>1 && mean_post > 1)
{
is_speech=1;
<p><p>1.4 +5 -5 speex/libspeex/speex_denoise.h
Index: speex_denoise.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_denoise.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- speex_denoise.h 14 May 2003 04:37:00 -0000 1.3
+++ speex_denoise.h 21 May 2003 19:53:08 -0000 1.4
@@ -38,7 +38,7 @@
extern "C" {
#endif
-typedef struct DenoiseState {
+typedef struct SpeexDenoiseState {
int frame_size; /**< Number of samples processed each time */
int ps_size; /**< Number of points in the power spectrum */
@@ -71,16 +71,16 @@
float min_ener; /**< */
drft_lookup fft_lookup; /**< */
-} DenoiseState;
+} SpeexDenoiseState;
/** Creates a new denoising state */
-DenoiseState *denoise_state_init(int frame_size);
+SpeexDenoiseState *speex_denoise_state_init(int frame_size);
/** Destroys a denoising state */
-void denoise_state_destroy(DenoiseState *st);
+void speex_denoise_state_destroy(SpeexDenoiseState *st);
/** Denoise a frame */
-int denoise(DenoiseState *st, float *x);
+int speex_denoise(SpeexDenoiseState *st, float *x);
#ifdef __cplusplus
}
<p><p>1.4 +6 -5 speex/libspeex/testdenoise.c
Index: testdenoise.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/testdenoise.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- testdenoise.c 20 May 2003 02:46:34 -0000 1.3
+++ testdenoise.c 21 May 2003 19:53:08 -0000 1.4
@@ -9,23 +9,24 @@
short out[NN];
float x[NN];
int i;
- DenoiseState *st;
+ SpeexDenoiseState *st;
- st = denoise_state_init(NN);
+ st = speex_denoise_state_init(NN);
while (1)
{
+ int vad;
fread(in, sizeof(short), NN, stdin);
if (feof(stdin))
break;
for (i=0;i<NN;i++)
x[i]=in[i];
- denoise(st, x);
+ vad = speex_denoise(st, x);
for (i=0;i<NN;i++)
out[i]=x[i];
-
+ /*fprintf (stderr, "%d\n", vad);*/
fwrite(out, sizeof(short), NN, stdout);
}
- denoise_state_destroy(st);
+ speex_denoise_state_destroy(st);
return 0;
}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list