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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Tue Feb 8 23:31:19 PST 2005


Author: jm
Date: 2005-02-08 23:31:17 -0800 (Tue, 08 Feb 2005)
New Revision: 8883

Modified:
   trunk/speex/libspeex/fixed_arm4.h
   trunk/speex/libspeex/lsp.c
   trunk/speex/libspeex/ltp.c
   trunk/speex/libspeex/vq.c
Log:
misc optimizations


Modified: trunk/speex/libspeex/fixed_arm4.h
===================================================================
--- trunk/speex/libspeex/fixed_arm4.h	2005-02-09 04:10:50 UTC (rev 8882)
+++ trunk/speex/libspeex/fixed_arm4.h	2005-02-09 07:31:17 UTC (rev 8883)
@@ -59,12 +59,23 @@
 #define MAC16_16(c,a,b)     (ADD32((c),MULT16_16((a),(b))))
 #define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
 #define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
-#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
+//#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
+static inline spx_word32_t MULT16_32_Q14(spx_word16_t x, spx_word32_t y) {
+  int res;
+  int dummy;
+  asm (
+        "smull  %0,%1,%2,%3 \n\t"
+        "mov %0, %0, lsr #14 \n\t"
+        "add %0, %0, %1, lsl #18 \n\t"
+   : "=&r"(res), "=&r" (dummy)
+   : "r"(y),"r"((int)x));
+  return(res);
+}
 
 #define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
 #define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
 
-#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
+//#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
 static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
   int res;
   int dummy;

Modified: trunk/speex/libspeex/lsp.c
===================================================================
--- trunk/speex/libspeex/lsp.c	2005-02-09 04:10:50 UTC (rev 8882)
+++ trunk/speex/libspeex/lsp.c	2005-02-09 07:31:17 UTC (rev 8883)
@@ -137,7 +137,7 @@
 
 #ifdef FIXED_POINT
 
-static spx_word32_t cheb_poly_eva(spx_word32_t *coef,spx_word16_t x,int m,char *stack)
+static inline spx_word32_t cheb_poly_eva(spx_word32_t *coef,spx_word16_t x,int m,char *stack)
 /*  float coef[]  	coefficients of the polynomial to be evaluated 	*/
 /*  float x   		the point where polynomial is to be evaluated 	*/
 /*  int m 		order of the polynomial 			*/

Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c	2005-02-09 04:10:50 UTC (rev 8882)
+++ trunk/speex/libspeex/ltp.c	2005-02-09 07:31:17 UTC (rev 8883)
@@ -170,7 +170,6 @@
    for (i=0;i<N;i++)
    {
         best_score[i]=-1;
-        gain[i]=0;
         pitch[i]=start;
    }
 
@@ -250,15 +249,18 @@
    }
 
    /* Compute open-loop gain */
-   for (j=0;j<N;j++)
+   if (gain)
    {
-      spx_word16_t g;
-      i=pitch[j];
-      g = DIV32(corr[i-start], 10+SHR(MULT16_16(spx_sqrt(e0),spx_sqrt(energy[i-start])),6));
-      /* FIXME: g = max(g,corr/energy) */
-      if (g<0)
-         g = 0;
-      gain[j]=g;
+       for (j=0;j<N;j++)
+       {
+          spx_word16_t g;
+          i=pitch[j];
+          g = DIV32(corr[i-start], 10+SHR(MULT16_16(spx_sqrt(e0),spx_sqrt(energy[i-start])),6));
+          /* FIXME: g = max(g,corr/energy) */
+                   if (g<0)
+                   g = 0;
+             gain[j]=g;
+       }
    }
 }
 
@@ -521,7 +523,6 @@
    int N;
    ltp_params *params;
    int *nbest;
-   spx_word16_t *gains;
 
    N=complexity;
    if (N>10)
@@ -530,7 +531,6 @@
       N=1;
 
    nbest=PUSH(stack, N, int);
-   gains = PUSH(stack, N, spx_word16_t);
    params = (ltp_params*) par;
 
    if (end<start)
@@ -548,7 +548,7 @@
    
    if (N>end-start+1)
       N=end-start+1;
-   open_loop_nbest_pitch(sw, start, end, nsf, nbest, gains, N, stack);
+   open_loop_nbest_pitch(sw, start, end, nsf, nbest, NULL, N, stack);
    for (i=0;i<N;i++)
    {
       pitch=nbest[i];

Modified: trunk/speex/libspeex/vq.c
===================================================================
--- trunk/speex/libspeex/vq.c	2005-02-09 04:10:50 UTC (rev 8882)
+++ trunk/speex/libspeex/vq.c	2005-02-09 07:31:17 UTC (rev 8883)
@@ -123,6 +123,10 @@
 
 #else
 
+#if defined(SHORTCUTS) && (defined(ARM4_ASM) || defined(ARM5E_ASM))
+#include "vq_arm4.h"
+#else
+
 /*Finds the indices of the n-best entries in a codebook*/
 void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
 {
@@ -151,6 +155,7 @@
       }
    }
 }
+#endif
 
 #endif
 



More information about the commits mailing list