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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Wed Jun 8 19:50:30 PDT 2005


Author: jm
Date: 2005-06-08 19:50:28 -0700 (Wed, 08 Jun 2005)
New Revision: 9408

Modified:
   trunk/speex/libspeex/filters_bfin.h
Log:
filter_mem2 now uses dual MAC (still needs some cleanup)


Modified: trunk/speex/libspeex/filters_bfin.h
===================================================================
--- trunk/speex/libspeex/filters_bfin.h	2005-06-09 02:21:03 UTC (rev 9407)
+++ trunk/speex/libspeex/filters_bfin.h	2005-06-09 02:50:28 UTC (rev 9408)
@@ -87,9 +87,18 @@
 {
    spx_word16_t x[N],y[N];
    spx_word16_t *xx, *yy;
+   spx_word32_t xy2[N];
+   spx_word32_t *xy = xy2;
+   spx_word16_t numden_a[2*ord];
+   spx_word16_t *numden = numden_a;
+   int i;
    xx = x;
    yy = y;
-   
+   for (i=0;i<ord;i++)
+   {
+      numden[2*i] = num[i];
+      numden[2*i+1] = den[i];
+   }
    __asm__ __volatile__
    (
    /* Register setup */
@@ -99,12 +108,7 @@
    "I0 = P0;\n\t"
    "B0 = P0;\n\t"
    "L0 = 0;\n\t"
-   
-   "P1 = %5;\n\t"
-   "I1 = P1;\n\t"
-   "B1 = P1;\n\t"
-   "L1 = 0;\n\t"
-   
+      
    "P2 = %0;\n\t"
    "P3 = %1;\n\t"
    "I2 = P2;\n\t"
@@ -123,10 +127,10 @@
    "R1 = R1 + R2;\n\t"
    "[P1++] = R1;\n\t"
    "R1 <<= 2;\n\t"
-   "W[P3] = R1.H;\n\t"
    "R2 <<= 2;\n\t"
-   "W[P2] = R2.H;\n\t"
-
+   "R2 = PACK(R1.H, R2.H);\n\t"
+   "[P2] = R2;\n\t"
+               
    /* Samples 1 to ord-1 (using memory) */
    "R0 += -1;\n\t"
    "R3 = 0;\n\t"
@@ -138,64 +142,65 @@
       
       "R1 = [P4++];\n\t"
       "A1 = R1;\n\t"
+      "A0 = 0;\n\t"
       "I0 = B0;\n\t"
-      "I1 = B1;\n\t"
       "I2 = P2;\n\t"
       "I3 = P3;\n\t"
-      "P2 += 2;\n\t"
+      "P2 += 4;\n\t"
       "P3 += 2;\n\t"
-      "R4.L = W[I0++] || R5.L = W[I2--];\n\t"
+      "R4 = [I0++] || R5 = [I2--];\n\t"
       "LOOP filter_start_inner%= LC1;\n\t"
       "LOOP_BEGIN filter_start_inner%=;\n\t"
-         "A1 += R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
-         "A1 -= R4.L*R5.L (IS) || R4.L = W[I0++] || R5.L = W[I2--];\n\t"
+         "A0 += R4.L*R5.L (IS), A1 -= R4.H*R5.H (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
       "LOOP_END filter_start_inner%=;\n\t"
-   
+      "A0 += A1;A1=A0;\n\t"
       "R1 = A1;\n\t"
       "R1 <<= 1;\n\t"
       "R2 = [P0++];\n\t"
       "R1 = R1 + R2;\n\t"
       "[P1++] = R1;\n\t"
       "R1 <<= 2;\n\t"
-      "W[P3] = R1.H;\n\t"
       "R2 <<= 2;\n\t"
-      "W[P2] = R2.H;\n\t"
+      "R2 = PACK(R1.H, R2.H);\n\t"
+      "[P2] = R2;\n\t"
+
    "LOOP_END filter_start%=;\n\t"
 
    /* Samples ord to N*/   
    "R0 = %7;\n\t"
    "R0 <<= 1;\n\t"
    "I0 = B0;\n\t"
-   "I1 = B1;\n\t"
+   "L1 = R0;\n\t"
+   "R0 <<= 1;\n\t"   
    "L0 = R0;\n\t"
-   "L1 = R0;\n\t"
    
    "R0 = %7;\n\t"
    "R2 = %6;\n\t"
    "R2 = R2 - R0;\n\t"
-   "R4.L = W[I0++];\n\t"
-   "R6.L = W[I1++];\n\t"
+   "R4 = [I0++];\n\t"
    "LC0 = R2;\n\t"
    "LOOP filter_mid%= LC0;\n\t"
    "LOOP_BEGIN filter_mid%=;\n\t"
       "LC1 = R0;\n\t"
-      "A1 = 0;\n\t"
+      "A0 = A1 = 0;\n\t"
       "I2 = P2;\n\t"
       "I3 = P3;\n\t"
-      "P2 += 2;\n\t"
+      "P2 += 4;\n\t"
       "P3 += 2;\n\t"
-      "R5.L = W[I2--] || R7.L = W[I3--];\n\t"
+      "R5 = [I2--];\n\t"
       "LOOP filter_mid_inner%= LC1;\n\t"
       "LOOP_BEGIN filter_mid_inner%=;\n\t"
-         "A1 += R4.L*R5.L (IS) || R4.L = W[I0++] || R5.L = W[I2--];\n\t"
-         "A1 -= R6.L*R7.L (IS) || R6.L = W[I1++] || R7.L = W[I3--];\n\t"
+         "A0 += R4.L*R5.L (IS), A1 -= R4.H*R5.H (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
       "LOOP_END filter_mid_inner%=;\n\t"
+      "A0 += A1;A1=A0;\n\t"
       "R1 = A1;\n\t"
       "R1 = R1 << 1 || R2 = [P0++];\n\t"
       "R1 = R1 + R2;\n\t"
-      "R1 = R1 << 2 || [P1++] = R1;\n\t"
-      "R2 = R2 << 2 || W[P3] = R1.H;\n\t"
-      "W[P2] = R2.H;\n\t"
+         "R1 = R1 << 2 || [P1++] = R1;\n\t"
+         "R2 = R2 << 2 ;//|| W[P3] = R1.H;\n\t"
+      "R2 = PACK(R1.H, R2.H);\n\t"
+      "[P2] = R2;\n\t"
+
    "LOOP_END filter_mid%=;\n\t"
      
    /* Update memory */
@@ -203,30 +208,27 @@
    "R0 = %7;\n\t"
    "LC0 = R0;\n\t"
    "P0 = B0;\n\t"
-   "P1 = B1;\n\t"
    "LOOP mem_update%= LC0;\n\t"
    "LOOP_BEGIN mem_update%=;\n\t"
-      "A0 = 0;\n\t"
+      "A0 = A1 = 0;\n\t"
       "I2 = P2;\n\t"
       "I3 = P3;\n\t"
       "I0 = P0;\n\t"
-      "I1 = P1;\n\t"
-      "P0 += 2;\n\t"
-      "P1 += 2;\n\t"
+      "P0 += 4;\n\t"
       "R0 = LC0;\n\t"
       "LC1=R0;\n\t"
-      "R5.L = W[I2--] || R7.L = W[I3--];\n\t"
-      "R4.L = W[I0++] || R6.L = W[I1++];\n\t"
+      "R5 = [I2--];\n\t"
+      "R4 = [I0++];\n\t"
       "LOOP mem_accum%= LC1;\n\t"
       "LOOP_BEGIN mem_accum%=;\n\t"
-         "A0 += R4.L*R5.L (IS) || R4.L = W[I0++] || R5.L = W[I2--];\n\t"
-         "A0 -= R6.L*R7.L (IS) || R6.L = W[I1++] || R7.L = W[I3--];\n\t"
+         "A0 += R4.L*R5.L (IS), A1 -= R4.H*R5.H (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
       "LOOP_END mem_accum%=;\n\t"
+      "A0 += A1;\n\t"
       "R0 = A0;\n\t"
       "[P4++] = R0;\n\t"
    "LOOP_END mem_update%=;\n\t"
 
-   : : "m" (xx), "m" (yy), "m" (_x), "m" (_y), "m" (num), "m" (den), "m" (N), "m" (ord), "m" (mem)
+   : : "m" (xy), "m" (yy), "m" (_x), "m" (_y), "m" (numden), "m" (den), "m" (N), "m" (ord), "m" (mem)
    : "R0", "R1", "R2", "R3", "R4", "R5", "R7", "P0", "P1", "P2", "P3", "P4", "B0", "B1", "I0", "I1", "I2", "I3", "L0", "L1", "L2", "L3", "memory"
    );
 



More information about the commits mailing list