00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #define OVERRIDE_INNER_PROD
00037 static spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
00038 {
00039 spx_word32_t sum=0;
00040 __asm__ __volatile__ (
00041 "P0 = %3;\n\t"
00042 "P1 = %1;\n\t"
00043 "P2 = %2;\n\t"
00044 "I0 = P1;\n\t"
00045 "I1 = P2;\n\t"
00046 "L0 = 0;\n\t"
00047 "L1 = 0;\n\t"
00048 "A0 = 0;\n\t"
00049 "R0.L = W[I0++] || R1.L = W[I1++];\n\t"
00050 "LOOP inner%= LC0 = P0;\n\t"
00051 "LOOP_BEGIN inner%=;\n\t"
00052 "A0 += R0.L*R1.L (IS) || R0.L = W[I0++] || R1.L = W[I1++];\n\t"
00053 "LOOP_END inner%=;\n\t"
00054 "A0 += R0.L*R1.L (IS);\n\t"
00055 "A0 = A0 >>> 6;\n\t"
00056 "R0 = A0;\n\t"
00057 "%0 = R0;\n\t"
00058 : "=m" (sum)
00059 : "m" (x), "m" (y), "d" (len-1)
00060 : "P0", "P1", "P2", "R0", "R1", "A0", "I0", "I1", "L0", "L1", "R3"
00061 );
00062 return sum;
00063 }
00064
00065 #define OVERRIDE_PITCH_XCORR
00066 static void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
00067 {
00068 corr += nb_pitch - 1;
00069 __asm__ __volatile__ (
00070 "P2 = %0;\n\t"
00071 "I0 = P2;\n\t"
00072 "B0 = P2;\n\t"
00073 "R0 = %3;\n\t"
00074 "P3 = %3;\n\t"
00075 "P3 += -2;\n\t"
00076 "P4 = %4;\n\t"
00077 "R1 = R0 << 1;\n\t"
00078 "L0 = R1;\n\t"
00079 "P0 = %1;\n\t"
00080
00081 "P1 = %2;\n\t"
00082 "B1 = P1;\n\t"
00083 "L1 = 0;\n\t"
00084
00085 "r0 = [I0++];\n\t"
00086 "LOOP pitch%= LC0 = P4 >> 1;\n\t"
00087 "LOOP_BEGIN pitch%=;\n\t"
00088 "I1 = P0;\n\t"
00089 "A1 = A0 = 0;\n\t"
00090 "R1 = [I1++];\n\t"
00091 "LOOP inner_prod%= LC1 = P3 >> 1;\n\t"
00092 "LOOP_BEGIN inner_prod%=;\n\t"
00093 "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
00094 "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t"
00095 "LOOP_END inner_prod%=;\n\t"
00096 "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
00097 "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R0 = [I0++];\n\t"
00098 "A0 = A0 >>> 6;\n\t"
00099 "A1 = A1 >>> 6;\n\t"
00100 "R2 = A0, R3 = A1;\n\t"
00101 "[P1--] = r2;\n\t"
00102 "[P1--] = r3;\n\t"
00103 "P0 += 4;\n\t"
00104 "LOOP_END pitch%=;\n\t"
00105 "L0 = 0;\n\t"
00106 : : "m" (_x), "m" (_y), "m" (corr), "m" (len), "m" (nb_pitch)
00107 : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
00108 );
00109 }
00110
00111 #define OVERRIDE_COMPUTE_PITCH_ERROR
00112 static inline spx_word32_t compute_pitch_error(spx_word32_t *C, spx_word16_t *g, spx_word16_t pitch_control)
00113 {
00114 spx_word32_t sum;
00115 __asm__ __volatile__
00116 (
00117 "A1 = A0 = 0;\n\t"
00118
00119 "R0 = [%1++];\n\t"
00120 "R1.L = %2.L*%5.L (IS);\n\t"
00121 "R0 <<= 1;\n\t"
00122 "A1 += R1.L*R0.L (M), A0 += R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00123
00124 "R1.L = %3.L*%5.L (IS);\n\t"
00125 "R0 <<= 1;\n\t"
00126 "A1 += R1.L*R0.L (M), A0 += R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00127
00128 "R1.L = %4.L*%5.L (IS);\n\t"
00129 "R0 <<= 1;\n\t"
00130 "A1 += R1.L*R0.L (M), A0 += R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00131
00132 "R1.L = %2.L*%3.L (IS);\n\t"
00133 "R0 <<= 1;\n\t"
00134 "A1 -= R1.L*R0.L (M), A0 -= R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00135
00136 "R1.L = %4.L*%3.L (IS);\n\t"
00137 "R0 <<= 1;\n\t"
00138 "A1 -= R1.L*R0.L (M), A0 -= R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00139
00140 "R1.L = %4.L*%2.L (IS);\n\t"
00141 "R0 <<= 1;\n\t"
00142 "A1 -= R1.L*R0.L (M), A0 -= R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00143
00144 "R1.L = %2.L*%2.L (IS);\n\t"
00145 "R0 <<= 1;\n\t"
00146 "A1 -= R1.L*R0.L (M), A0 -= R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00147
00148 "R1.L = %3.L*%3.L (IS);\n\t"
00149 "R0 <<= 1;\n\t"
00150 "A1 -= R1.L*R0.L (M), A0 -= R1.L*R0.H (IS) || R0 = [%1++];\n\t"
00151
00152 "R1.L = %4.L*%4.L (IS);\n\t"
00153 "R0 <<= 1;\n\t"
00154 "A1 -= R1.L*R0.L (M), A0 -= R1.L*R0.H (IS);\n\t"
00155
00156 "A1 = A1 >>> 16;\n\t"
00157 "A0 += A1;\n\t"
00158 "%0 = A0;\n\t"
00159 : "=&D" (sum), "=a" (C)
00160 : "d" (g[0]), "d" (g[1]), "d" (g[2]), "d" (pitch_control), "1" (C)
00161 : "R0", "R1", "R2", "A0"
00162 );
00163 return sum;
00164 }
00165