[xiph-commits] r11359 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Sun May 7 08:34:17 PDT 2006
Author: jm
Date: 2006-05-07 08:34:14 -0700 (Sun, 07 May 2006)
New Revision: 11359
Modified:
trunk/speex/libspeex/fixed_generic.h
trunk/speex/libspeex/lpc.c
Log:
Slight accuracy improvement in Levinson-Durbin algo for fixed-point.
Modified: trunk/speex/libspeex/fixed_generic.h
===================================================================
--- trunk/speex/libspeex/fixed_generic.h 2006-05-07 12:41:03 UTC (rev 11358)
+++ trunk/speex/libspeex/fixed_generic.h 2006-05-07 15:34:14 UTC (rev 11359)
@@ -84,6 +84,7 @@
#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11)))
#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13)))
+#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
Modified: trunk/speex/libspeex/lpc.c
===================================================================
--- trunk/speex/libspeex/lpc.c 2006-05-07 12:41:03 UTC (rev 11358)
+++ trunk/speex/libspeex/lpc.c 2006-05-07 15:34:14 UTC (rev 11359)
@@ -94,7 +94,7 @@
for (j = 0; j < i; j++)
rr = SUB32(rr,MULT16_16(lpc[j],ac[i - j]));
#ifdef FIXED_POINT
- r = DIV32_16(rr,ADD16(error,16));
+ r = DIV32_16(rr+PSHR32(error,1),ADD16(error,4));
#else
r = rr/(error+.003*ac[0]);
#endif
@@ -103,11 +103,11 @@
for (j = 0; j < i>>1; j++)
{
spx_word16_t tmp = lpc[j];
- lpc[j] = MAC16_16_Q13(lpc[j],r,lpc[i-1-j]);
- lpc[i-1-j] = MAC16_16_Q13(lpc[i-1-j],r,tmp);
+ lpc[j] = MAC16_16_P13(lpc[j],r,lpc[i-1-j]);
+ lpc[i-1-j] = MAC16_16_P13(lpc[i-1-j],r,tmp);
}
if (i & 1)
- lpc[j] = MAC16_16_Q13(lpc[j],lpc[j],r);
+ lpc[j] = MAC16_16_P13(lpc[j],lpc[j],r);
error = SUB16(error,MULT16_16_Q13(r,MULT16_16_Q13(error,r)));
}
More information about the commits
mailing list