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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Wed Jun 8 22:32:39 PDT 2005


Author: jm
Date: 2005-06-08 22:32:37 -0700 (Wed, 08 Jun 2005)
New Revision: 9414

Modified:
   trunk/speex/libspeex/cb_search_bfin.h
   trunk/speex/libspeex/ltp_bfin.h
   trunk/speex/libspeex/misc_bfin.h
Log:
Removed accesses past array bounds.


Modified: trunk/speex/libspeex/cb_search_bfin.h
===================================================================
--- trunk/speex/libspeex/cb_search_bfin.h	2005-06-09 05:09:53 UTC (rev 9413)
+++ trunk/speex/libspeex/cb_search_bfin.h	2005-06-09 05:32:37 UTC (rev 9414)
@@ -56,7 +56,7 @@
             "R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
             "LOOP inner%= LC1 = P0;\n\t"
             "LOOP_BEGIN inner%=;\n\t"
-               "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t" /* Is there a danger of reading too far? */
+               "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
             "LOOP_END inner%=;\n\t"
             "R0 = A0;\n\t"
             "R0 >>>= 11;\n\t"
@@ -89,11 +89,11 @@
          "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"
+            "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)

Modified: trunk/speex/libspeex/ltp_bfin.h
===================================================================
--- trunk/speex/libspeex/ltp_bfin.h	2005-06-09 05:09:53 UTC (rev 9413)
+++ trunk/speex/libspeex/ltp_bfin.h	2005-06-09 05:32:37 UTC (rev 9414)
@@ -49,11 +49,12 @@
       "LOOP_BEGIN inner%=;\n\t"
          "A0 += R0.L*R1.L (IS) || R0.L = W[I0++] || R1.L = W[I1++];\n\t"
       "LOOP_END inner%=;\n\t"
+      "A0 += R0.L*R1.L (IS);\n\t"
       "A0 = A0 >>> 6;\n\t"
       "R0 = A0;\n\t"
       "%0 = R0;\n\t"
    : "=m" (sum)
-   : "m" (x), "m" (y), "m" (len)
+   : "m" (x), "m" (y), "d" (len-1)
    : "P0", "P1", "P2", "R0", "R1", "A0", "I0", "I1", "L0", "L1", "R3"
    );
    return sum;
@@ -68,7 +69,8 @@
       "I0 = P2;\n\t" /* x in I0 */
       "B0 = P2;\n\t" /* x in B0 */
       "R0 = %3;\n\t" /* len in R0 */
-      "P3 = %3;\n\t" /* len in R0 */
+      "P3 = %3;\n\t"
+      "P3 += -2;\n\t" /* len in R0 */
       "P4 = %4;\n\t" /* nb_pitch in R0 */
       "R1 = R0 << 1;\n\t" /* number of bytes in x */
       "L0 = R1;\n\t"
@@ -89,6 +91,8 @@
             "A0 += R0.L*R1.L , A1 += R0.L*R1.H (is) || R1.L = W[I1++];\n\t"
             "A0 += R0.H*R1.H , A1 += R0.H*R1.L (is) || R1.H = W[I1++] || R0 = [I0++];\n\t"
          "LOOP_END inner_prod%=;\n\t"
+         "A0 += R0.L*R1.L , A1 += R0.L*R1.H (is) || R1.L = W[I1++];\n\t"
+         "A0 += R0.H*R1.H , A1 += R0.H*R1.L (is) || R0 = [I0++];\n\t"
          "A0 = A0 >>> 6;\n\t"
          "A1 = A1 >>> 6;\n\t"
          "R2 = A0, R3 = A1;\n\t"

Modified: trunk/speex/libspeex/misc_bfin.h
===================================================================
--- trunk/speex/libspeex/misc_bfin.h	2005-06-09 05:09:53 UTC (rev 9413)
+++ trunk/speex/libspeex/misc_bfin.h	2005-06-09 05:32:37 UTC (rev 9414)
@@ -36,14 +36,17 @@
 {
    __asm__ __volatile__
          (
+         "L0 = 0;\n\t"
+         "I0 = %0;\n\t"
+         "R0 = [I0++];\n\t"
          "LOOP move%= LC0 = %2;\n\t"
          "LOOP_BEGIN move%=;\n\t"
-            "R0 = [%0++];\n\t"
-            "[%1++] = R0;\n\t"
+            "[%1++] = R0 || R0 = [I0++];\n\t"
          "LOOP_END move%=;\n\t"
+         "[%1++] = R0;\n\t"
    : "=a" (src), "=a" (dest)
-   : "a" (n>>2), "0" (src), "1" (dest)
-   : "R0", "memory"
+   : "a" ((n>>2)-1), "0" (src), "1" (dest)
+   : "R0", "I0", "L0", "memory"
          );
    return dest;
 }



More information about the commits mailing list