[xiph-commits] r10521 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Fri Dec 2 01:40:30 PST 2005


Author: jm
Date: 2005-12-02 01:40:27 -0800 (Fri, 02 Dec 2005)
New Revision: 10521

Modified:
   trunk/speex/libspeex/filters.c
Log:
DC notch filter (not tested yet)


Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c	2005-12-02 08:59:09 UTC (rev 10520)
+++ trunk/speex/libspeex/filters.c	2005-12-02 09:40:27 UTC (rev 10521)
@@ -493,8 +493,23 @@
       mem[i+1] = xx[i];
 }
 
+void filter_dc_notch(spx_sig_t *in, spx_word16_t radius, spx_sig_t *out, int len, spx_mem_t *mem)
+{
+   int i;
+   spx_word16_t num[3], den[3];
+   num[0] = num[2] = 1;
+   num[1] = -2;
+   den[0] = 1;
+   den[1] = -2*radius;
+   den[2] = radius*radius + .7*(1-radius)*(1-radius);
+   for (i=0;i<len;i++)
+   {
+      out[i] = mem[0] + num[0]*in[i];
+      mem[0] = mem[1] + num[1]*in[i] - den[1]*out[i];
+      mem[1] = num[2]*in[i] - den[2]*out[i];
+   }
+}
 
-
 void comb_filter_mem_init (CombFilterMem *mem)
 {
    mem->last_pitch=0;



More information about the commits mailing list