[xiph-cvs] cvs commit: speex/libspeex preprocess.c speex_preprocess.h testdenoise.c

Jean-Marc Valin jm at xiph.org
Tue Sep 16 16:44:19 PDT 2003



jm          03/09/16 19:44:19

  Modified:    libspeex preprocess.c speex_preprocess.h testdenoise.c
  Log:
  cleaned up stuff that was no longer necessary.

Revision  Changes    Path
1.5       +0 -41     speex/libspeex/preprocess.c

Index: preprocess.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/preprocess.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- preprocess.c	16 Sep 2003 20:39:56 -0000	1.4
+++ preprocess.c	16 Sep 2003 23:44:19 -0000	1.5
@@ -37,9 +37,6 @@
 #include "misc.h"
 #include "smallft.h"
 
-#define STABILITY_TIME 20
-#define NB_LAST_PS 10
-
 #define max(a,b) ((a) > (b) ? (a) : (b))
 #define min(a,b) ((a) < (b) ? (a) : (b))
 
@@ -128,9 +125,6 @@
    st->gain = (float*)speex_alloc(N*sizeof(float));
    st->prior = (float*)speex_alloc(N*sizeof(float));
    st->post = (float*)speex_alloc(N*sizeof(float));
-   st->min_ps = (float*)speex_alloc(N*sizeof(float));
-   st->last_energy = (float*)speex_alloc(STABILITY_TIME*sizeof(float));
-   st->last_ps = (float*)speex_alloc(NB_LAST_PS*N*sizeof(float));
    st->loudness_weight = (float*)speex_alloc(N*sizeof(float));
    st->inbuf = (float*)speex_alloc(N3*sizeof(float));
    st->outbuf = (float*)speex_alloc(N3*sizeof(float));
@@ -197,7 +191,6 @@
    st->nb_preprocess=0;
    st->nb_min_estimate=0;
    st->last_update=0;
-   st->last_id=0;
    return st;
 }
 
@@ -212,9 +205,6 @@
    speex_free(st->gain);
    speex_free(st->prior);
    speex_free(st->post);
-   speex_free(st->min_ps);
-   speex_free(st->last_energy);
-   speex_free(st->last_ps);
    speex_free(st->loudness_weight);
    speex_free(st->echo_noise);
 
@@ -505,7 +495,6 @@
    int is_speech=1;
    float mean_post=0;
    float mean_prior=0;
-   float energy;
    int N = st->ps_size;
    int N3 = 2*N - st->frame_size;
    int N4 = st->frame_size - N3;
@@ -569,31 +558,7 @@
       /*fprintf (stderr, "%f ", st->S[i]/st->Smin[i]);*/
       /*fprintf (stderr, "%f ", st->update_prob[i]);*/
    }
-   /*fprintf (stderr, "\n");*/
-   energy=0;
-   for (i=1;i<N;i++)
-      energy += log(100+ps[i]);
-   energy /= 160;
-   st->last_energy[st->nb_preprocess%STABILITY_TIME]=energy;
 
-   if (st->nb_preprocess>=STABILITY_TIME)
-   {
-      float E=0, E2=0;
-      float std;
-      for (i=0;i<STABILITY_TIME;i++)
-      {
-         E+=st->last_energy[i];
-         E2+=st->last_energy[i]*st->last_energy[i];
-      }
-      E2=E2/STABILITY_TIME;
-      E=E/STABILITY_TIME;
-      std = sqrt(E2-E*E);
-      if (std<.15 && st->last_update>20)
-      {
-         update_noise(st, &st->last_ps[st->last_id*N], echo);
-      }
-      /*fprintf (stderr, "%f\n", std);*/
-   }
 
    st->nb_preprocess++;
 
@@ -842,12 +807,6 @@
    for (i=1;i<N;i++)
       st->old_ps[i] = ps[i];
 
-   for (i=1;i<N;i++)
-      st->last_ps[st->last_id*N+i] = ps[i];
-   st->last_id++;
-   if (st->last_id>=NB_LAST_PS)
-      st->last_id=0;
-
    return is_speech;
 }
 

<p><p>1.5       +0 -4      speex/libspeex/speex_preprocess.h

Index: speex_preprocess.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_preprocess.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- speex_preprocess.h	16 Sep 2003 20:41:34 -0000	1.4
+++ speex_preprocess.h	16 Sep 2003 23:44:19 -0000	1.5
@@ -58,8 +58,6 @@
    float *prior;             /**< A-priori SNR */
    float *post;              /**< A-posteriori SNR */
    float *min_ps;            /**< */
-   float *last_energy;       /**< Energy of the previous frames */
-   float *last_ps;           /**< Power spectrum of the past frames */
 
    float *S;                 /**< Smoothed power spectrum */
    float *Smin;              /**< See Cohen paper */
@@ -70,8 +68,6 @@
 
    float *echo_noise;
 
-   int    last_id;           /**< */
-
    float *noise_bands;
    float *noise_bands2;
    int    noise_bandsN;

<p><p>1.9       +1 -1      speex/libspeex/testdenoise.c

Index: testdenoise.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/testdenoise.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- testdenoise.c	16 Sep 2003 19:36:17 -0000	1.8
+++ testdenoise.c	16 Sep 2003 23:44:19 -0000	1.9
@@ -14,7 +14,7 @@
    st = speex_preprocess_state_init(NN, 8000);
    i=1;
    speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i);
-   speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i);
+   /*speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i);*/
    while (1)
    {
       int vad;

<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