fixed-point version of the high-pass seems to work now.
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Sun, 30 Jul 2006 15:06:42 +0000 (15:06 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Sun, 30 Jul 2006 15:06:42 +0000 (15:06 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@11725 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/filters.c

index 6296ec3..7f61cf0 100644 (file)
@@ -78,11 +78,12 @@ void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_m
    for (i=0;i<len;i++)
    {
       spx_word16_t xi, yi, nyi;
+      spx_word32_t vout = ADD32(MULT16_16(num[0], x[i]),mem[0]);
       xi = x[i];
-      yi = EXTRACT16(SATURATE(PSHR32(ADD32(MULT16_16(num[0], x[i]),mem[0]),15),32767));
+      yi = EXTRACT16(SATURATE(PSHR32(vout,14),32767));
       nyi = NEG16(yi);
-      mem[0] = MAC16_16(MAC16_16(mem[1], num[1],xi), den[1],nyi);
-      mem[1] = ADD32(MULT16_16(num[2],xi), MULT16_16(den[2],nyi));
+      mem[0] = ADD32(MAC16_16(mem[1], num[1],xi), MULT16_32_Q14(-den[1],vout));
+      mem[1] = ADD32(MULT16_16(num[2],xi), MULT16_32_Q14(-den[2],vout));
       y[i] = yi;
    }
 }