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

Jean-Marc Valin jm at xiph.org
Sun Jan 18 15:37:49 PST 2004



jm          04/01/18 18:37:49

  Modified:    libspeex lsp.c
  Log:
  Saves some useless "cos" calculations

Revision  Changes    Path
1.51      +7 -2      speex/libspeex/lsp.c

Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- lsp.c	17 Jan 2004 16:06:04 -0000	1.50
+++ lsp.c	18 Jan 2004 23:37:43 -0000	1.51
@@ -484,6 +484,7 @@
     float xout1,xout2,xin1,xin2;
     float *Wp;
     float *pw,*n1,*n2,*n3,*n4=NULL;
+    float *x_freq;
     int m = lpcrdr>>1;
 
     Wp = PUSH(stack, 4*m+2, float);
@@ -501,6 +502,10 @@
     xin1 = 1.0;
     xin2 = 1.0;
 
+    x_freq=PUSH(stack, lpcrdr, float);
+    for (i=0;i<lpcrdr;i++)
+       x_freq[i] = ANGLE2X(freq[i]);
+
     /* reconstruct P(z) and Q(z) by  cascading second order
       polynomials in form 1 - 2xz(-1) +z(-2), where x is the
       LSP coefficient */
@@ -512,8 +517,8 @@
             n2 = n1 + 1;
             n3 = n2 + 1;
             n4 = n3 + 1;
-	    xout1 = xin1 - 2*(ANGLE2X(freq[i2])) * *n1 + *n2;
-	    xout2 = xin2 - 2*(ANGLE2X(freq[i2+1])) * *n3 + *n4;
+	    xout1 = xin1 - 2*x_freq[i2] * *n1 + *n2;
+	    xout2 = xin2 - 2*x_freq[i2+1] * *n3 + *n4;
             *n2 = *n1;
             *n4 = *n3;
             *n1 = xin1;

<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