[xiph-cvs] cvs commit: speex/libspeex filters.c filters.h

Jean-Marc Valin jm at xiph.org
Sun Nov 30 17:00:49 PST 2003



jm          03/11/30 20:00:49

  Modified:    libspeex filters.c filters.h
  Log:
  fixed-point: comb filter, part 4.12

Revision  Changes    Path
1.73      +13 -2     speex/libspeex/filters.c

Index: filters.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- filters.c	30 Nov 2003 22:22:59 -0000	1.72
+++ filters.c	1 Dec 2003 01:00:47 -0000	1.73
@@ -524,12 +524,23 @@
    gain = (exc_energy)/(.1+new_exc_energy);
    if (gain < .5)
       gain=.5;
-   if (gain>1)
-      gain=1;
+   if (gain>.9999)
+      gain=.9999;
 
+#ifdef FIXED_POINT
+   {
+      spx_word16_t gg = gain*32768;
+      for (i=0;i<nsf;i++)
+   {
+      mem->smooth_gain = MULT16_16_Q15(31457,mem->smooth_gain) + MULT16_16_Q15(1311,gg);
+      new_exc[i] = MULT16_32_Q15(mem->smooth_gain, new_exc[i]);
+   }
+   }
+#else
    for (i=0;i<nsf;i++)
    {
       mem->smooth_gain = .96*mem->smooth_gain + .04*gain;
       new_exc[i] *= mem->smooth_gain;
    }
+#endif
 }

<p><p>1.36      +1 -1      speex/libspeex/filters.h

Index: filters.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- filters.h	30 Nov 2003 19:38:47 -0000	1.35
+++ filters.h	1 Dec 2003 01:00:48 -0000	1.36
@@ -48,7 +48,7 @@
 typedef struct CombFilterMem {
    int   last_pitch;
    spx_word16_t last_pitch_gain[3];
-   float smooth_gain;
+   spx_word16_t smooth_gain;
 } CombFilterMem;
 
 

<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