[xiph-cvs] cvs commit: speex/libspeex lsp.c
Jean-Marc Valin
jm at xiph.org
Sat Jan 17 08:06:05 PST 2004
jm 04/01/17 11:06:05
Modified: libspeex lsp.c
Log:
replaced cos by an approximation for the float version
Revision Changes Path
1.50 +23 -4 speex/libspeex/lsp.c
Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- lsp.c 29 Nov 2003 19:25:48 -0000 1.49
+++ lsp.c 17 Jan 2004 16:06:04 -0000 1.50
@@ -90,12 +90,31 @@
#else
-#define C1 0.99940307
+/*#define C1 0.99940307
#define C2 -0.49558072
-#define C3 0.03679168
+#define C3 0.03679168*/
+#define C1 0.9999932946
+#define C2 -0.4999124376
+#define C3 0.0414877472
+#define C4 -0.0012712095
+
+
+#define SPX_PI_2 1.5707963268
+static inline spx_word16_t spx_cos(spx_word16_t x)
+{
+ if (x<SPX_PI_2)
+ {
+ x *= x;
+ return C1 + x*(C2+x*(C3+C4*x));
+ } else {
+ x = M_PI-x;
+ x *= x;
+ return -(C1 + x*(C2+x*(C3+C4*x)));
+ }
+}
#define FREQ_SCALE 1.
-#define ANGLE2X(a) (cos(a))
+#define ANGLE2X(a) (spx_cos(a))
#define X2ANGLE(x) (acos(x))
#endif
@@ -465,7 +484,7 @@
float xout1,xout2,xin1,xin2;
float *Wp;
float *pw,*n1,*n2,*n3,*n4=NULL;
- int m = lpcrdr/2;
+ int m = lpcrdr>>1;
Wp = PUSH(stack, 4*m+2, float);
pw = Wp;
<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