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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Tue Jun 7 19:26:46 PDT 2005


Author: jm
Date: 2005-06-07 19:26:43 -0700 (Tue, 07 Jun 2005)
New Revision: 9400

Modified:
   trunk/speex/libspeex/arch.h
   trunk/speex/libspeex/cb_search.c
Log:
more optimizations for complexity > 1


Modified: trunk/speex/libspeex/arch.h
===================================================================
--- trunk/speex/libspeex/arch.h	2005-06-08 01:36:51 UTC (rev 9399)
+++ trunk/speex/libspeex/arch.h	2005-06-08 02:26:43 UTC (rev 9400)
@@ -70,6 +70,8 @@
 #define SIG_SHIFT    14
 
 #define VERY_SMALL 0
+#define VERY_LARGE32 ((spx_word32_t)2147483647)
+#define VERY_LARGE16 ((spx_word16_t)32767)
 
 
 #ifdef FIXED_DEBUG
@@ -113,7 +115,9 @@
 #define LSP_SHIFT    0
 #define SIG_SHIFT    0
 
-#define VERY_SMALL 1e-15
+#define VERY_SMALL 1e-15f
+#define VERY_LARGE32 1e15f
+#define VERY_LARGE16 1e15f
 
 #define NEG16(x) (-(x))
 #define NEG32(x) (-(x))

Modified: trunk/speex/libspeex/cb_search.c
===================================================================
--- trunk/speex/libspeex/cb_search.c	2005-06-08 01:36:51 UTC (rev 9399)
+++ trunk/speex/libspeex/cb_search.c	2005-06-08 02:26:43 UTC (rev 9400)
@@ -339,8 +339,8 @@
    {
       nind[i]=itmp+2*i*nb_subvect;
       oind[i]=itmp+(2*i+1)*nb_subvect;
-      for (j=0;j<nb_subvect;j++)
-         nind[i][j]=oind[i][j]=-1;
+      /*for (j=0;j<nb_subvect;j++)
+      nind[i][j]=oind[i][j]=VERY_LARGE32;*/
    }
    
    /* FIXME: make that adaptive? */
@@ -348,23 +348,20 @@
       t[i]=EXTRACT16(PSHR32(target[i],6));
 
    for (j=0;j<N;j++)
-      for (i=0;i<nsf;i++)
-         ot[j][i]=t[i];
+      speex_move(&ot[j][0], t, nsf*sizeof(spx_word16_t));
 
-   /*for (i=0;i<nsf;i++)
-     printf ("%d\n", (int)t[i]);*/
-
    /* Pre-compute codewords response and energy */
    compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
 
    for (j=0;j<N;j++)
       odist[j]=0;
+   
    /*For all subvectors*/
    for (i=0;i<nb_subvect;i++)
    {
       /*"erase" nbest list*/
       for (j=0;j<N;j++)
-         ndist[j]=-2;
+         ndist[j]=VERY_LARGE32;
 
       /*For all n-bests of previous subvector*/
       for (j=0;j<N;j++)
@@ -391,11 +388,11 @@
             spx_word32_t err = ADD32(ADD32(odist[j],best_dist[k]),tener);
             
             /*update n-best list*/
-            if (err<ndist[N-1] || ndist[N-1]<-1)
+            if (err<ndist[N-1])
             {
                for (m=0;m<N;m++)
                {
-                  if (err < ndist[m] || ndist[m]<-1)
+                  if (err < ndist[m])
                   {
                      for (n=N-1;n>m;n--)
                      {



More information about the commits mailing list