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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Tue Jun 7 20:14:30 PDT 2005


Author: jm
Date: 2005-06-07 20:14:27 -0700 (Tue, 07 Jun 2005)
New Revision: 9401

Modified:
   trunk/speex/libspeex/cb_search.c
   trunk/speex/libspeex/cb_search_bfin.h
Log:
More optimizations to codebood search, target update in Blackfin assembly


Modified: trunk/speex/libspeex/cb_search.c
===================================================================
--- trunk/speex/libspeex/cb_search.c	2005-06-08 02:26:43 UTC (rev 9400)
+++ trunk/speex/libspeex/cb_search.c	2005-06-08 03:14:27 UTC (rev 9401)
@@ -84,8 +84,18 @@
 }
 #endif
 
+#ifndef OVERRIDE_TARGET_UPDATE
+static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
+{
+   int n;
+   int q=0;
+   for (n=0;n<len;n++,q++)
+      t[n] = SUB32(t[n],MULT16_16_Q11_32(g,r[q]));
+}
+#endif
 
 
+
 static void split_cb_search_shape_sign_N1(
 spx_sig_t target[],			/* target vector */
 spx_coef_t ak[],			/* LPCs for this subframe */
@@ -209,10 +219,10 @@
          q=subvect_size-m;
 #ifdef FIXED_POINT
          g=sign*shape_cb[rind*subvect_size+m];
-         for (n=subvect_size*(i+1);n<nsf;n++,q++)
-            t[n] = SUB32(t[n],MULT16_16_Q11_32(g,r[q]));
+         target_update(t+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1));
 #else
          g=sign*0.03125*shape_cb[rind*subvect_size+m];
+         /*FIXME: I think that one too can be replaced by target_update */
          for (n=subvect_size*(i+1);n<nsf;n++,q++)
             t[n] = SUB32(t[n],g*r[q]);
 #endif
@@ -339,8 +349,6 @@
    {
       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]=VERY_LARGE32;*/
    }
    
    /* FIXME: make that adaptive? */
@@ -413,11 +421,12 @@
       }
       for (j=0;j<N;j++)
       {
-         spx_word16_t *ct = ot[best_ntarget[j]];
+         //spx_word16_t *ct = ot[best_ntarget[j]];
          
          /*previous target (we don't care what happened before*/
          for (m=(i+1)*subvect_size;m<nsf;m++)
-            t[m]=ct[m];
+            nt[j][m]=ot[best_ntarget[j]][m];
+         
          /* New code: update the rest of the target only if it's worth it */
          for (m=0;m<subvect_size;m++)
          {
@@ -434,17 +443,15 @@
             q=subvect_size-m;
 #ifdef FIXED_POINT
             g=sign*shape_cb[rind*subvect_size+m];
-            for (n=subvect_size*(i+1);n<nsf;n++,q++)
-               t[n] = SUB32(t[n],MULT16_16_Q11_32(g,r[q]));
+            target_update(nt[j]+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1));
 #else
             g=sign*0.03125*shape_cb[rind*subvect_size+m];
+            /*FIXME: I think that one too can be replaced by target_update */
             for (n=subvect_size*(i+1);n<nsf;n++,q++)
-               t[n] = SUB32(t[n],g*r[q]);
+               nt[j][n] = SUB32(nt[j][n],g*r[q]);
 #endif
          }
 
-         for (q=(i+1)*subvect_size;q<nsf;q++)
-            nt[j][q]=t[q];
          for (q=0;q<nb_subvect;q++)
             nind[j][q]=oind[best_ntarget[j]][q];
          nind[j][i]=best_nind[j];

Modified: trunk/speex/libspeex/cb_search_bfin.h
===================================================================
--- trunk/speex/libspeex/cb_search_bfin.h	2005-06-08 02:26:43 UTC (rev 9400)
+++ trunk/speex/libspeex/cb_search_bfin.h	2005-06-08 03:14:27 UTC (rev 9401)
@@ -77,3 +77,27 @@
       E++;
    }
 }
+
+#define OVERRIDE_TARGET_UPDATE
+static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
+{
+   __asm__ __volatile__
+         (
+         "I0 = %0;\n\t"
+         "I1 = %1;\n\t"
+         "L0 = 0;\n\t"
+         "L1 = 0;\n\t"
+         "LOOP tupdate%= LC0 = %3;\n\t"
+         "LOOP_BEGIN tupdate%=;\n\t"
+         "R0.L = W[I0] || R1.L = W[I1++];\n\t"
+         "R1 = (A1 = R1.L*%2.L) (IS);\n\t"
+         "R1 >>>= 11;\n\t"
+         "R0.L = R0.L - R1.L;\n\t"
+         "W[I0++] = R0.L;\n\t"
+         "LOOP_END tupdate%=;\n\t"
+   :
+   : "a" (t), "a" (r), "d" (g), "a" (len)
+   : "R0", "R1", "A1", "I0", "I1", "L0", "L1"
+         );
+}
+



More information about the commits mailing list