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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Mon Jun 6 21:58:44 PDT 2005


Author: jm
Date: 2005-06-06 21:58:41 -0700 (Mon, 06 Jun 2005)
New Revision: 9383

Modified:
   trunk/speex/libspeex/ltp.c
   trunk/speex/libspeex/ltp_bfin.h
Log:
Blackfin assembly for compute_pitch_error


Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c	2005-06-07 03:52:46 UTC (rev 9382)
+++ trunk/speex/libspeex/ltp.c	2005-06-07 04:58:41 UTC (rev 9383)
@@ -151,7 +151,8 @@
 #endif
 #endif
 
-static spx_word32_t compute_pitch_error(spx_word32_t *C, spx_word16_t *g, spx_word16_t pitch_control)
+#ifndef OVERRIDE_COMPUTE_PITCH_ERROR
+static inline spx_word32_t compute_pitch_error(spx_word32_t *C, spx_word16_t *g, spx_word16_t pitch_control)
 {
    spx_word32_t sum = 0;
    sum = ADD32(sum,MULT16_32_Q15(MULT16_16_16(g[0],pitch_control),C[0]));
@@ -165,6 +166,8 @@
    sum = SUB32(sum,MULT16_32_Q15(MULT16_16_16(g[2],g[2]),C[8]));
    return sum;
 }
+#endif
+
 void open_loop_nbest_pitch(spx_sig_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack)
 {
    int i,j,k;

Modified: trunk/speex/libspeex/ltp_bfin.h
===================================================================
--- trunk/speex/libspeex/ltp_bfin.h	2005-06-07 03:52:46 UTC (rev 9382)
+++ trunk/speex/libspeex/ltp_bfin.h	2005-06-07 04:58:41 UTC (rev 9383)
@@ -100,3 +100,59 @@
    : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
    );
 }
+
+#define OVERRIDE_COMPUTE_PITCH_ERROR
+static inline spx_word32_t compute_pitch_error(spx_word32_t *C, spx_word16_t *g, spx_word16_t pitch_control)
+{
+   spx_word32_t sum;
+   __asm__ __volatile__
+         (
+         "A0 = A1 = 0;\n\t"
+         
+         "R0 = [%1++];\n\t"
+         "R1.L = %2.L*%5.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 += R1.L*R0.H (IS), A1 += R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+         
+         "R1.L = %3.L*%5.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 += R1.L*R0.H (IS), A1 += R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+         
+         "R1.L = %4.L*%5.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 += R1.L*R0.H (IS), A1 += R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+         
+         "R1.L = %2.L*%3.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 -= R1.L*R0.H (IS), A1 -= R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+
+         "R1.L = %4.L*%3.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 -= R1.L*R0.H (IS), A1 -= R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+         
+         "R1.L = %4.L*%2.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 -= R1.L*R0.H (IS), A1 -= R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+         
+         "R1.L = %2.L*%2.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 -= R1.L*R0.H (IS), A1 -= R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+
+         "R1.L = %3.L*%3.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 -= R1.L*R0.H (IS), A1 -= R1.L*R0.L (M,IS) || R0 = [%1++];\n\t"
+         
+         "R1.L = %4.L*%4.L (IS);\n\t"
+         "R0 <<= 1;\n\t"
+         "A0 -= R1.L*R0.H (IS), A1 -= R1.L*R0.L (M,IS);\n\t"
+         
+         "A1 = A1 >>> 16;\n\t"
+         "A0 += A1;\n\t"
+         "%0 = A0;\n\t"
+   : "=&D" (sum), "=a" (C)
+   : "d" (g[0]), "d" (g[1]), "d" (g[2]), "d" (pitch_control), "1" (C)
+   : "R0", "R1", "R2", "A0"
+         );
+   return sum;
+}
+



More information about the commits mailing list