00001
00006
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 #define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
00036 static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
00037 {
00038 int i, j, k;
00039
00040 for (i=0;i<shape_cb_size;i+=4)
00041 {
00042
00043
00044 E[0]=0;
00045 E[1]=0;
00046 E[2]=0;
00047 E[3]=0;
00048
00049
00050 for(j=0;j<subvect_size;j++)
00051 {
00052 #if 1
00053 spx_word16_t *res;
00054 res = resp+j;
00055 spx_word32_t resj0,resj1,resj2,resj3;
00056 spx_word32_t dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
00057 __asm__ __volatile__ (
00058 "mov %0, #0 \n\t"
00059 "mov %1, #0 \n\t"
00060 "mov %2, #0 \n\t"
00061 "mov %3, #0 \n\t"
00062 ".weighted%=: \n\t"
00063 "ldrsb %8, [%6] \n\t"
00064 "ldr %10, [%5], #-4 \n\t"
00065 "mov %9, %6 \n\t"
00066 "ldrsb %11, [%9, %7]! \n\t"
00067 "mla %0, %10, %8, %0 \n\t"
00068 "ldrsb %8, [%9, %7]! \n\t"
00069 "mla %1, %10, %11, %1 \n\t"
00070 "ldrsb %11, [%9, %7]! \n\t"
00071 "mla %2, %10, %8, %2 \n\t"
00072 "subs %4, %4, #1 \n\t"
00073 "mla %3, %10, %11, %3 \n\t"
00074 "add %6, %6, #1 \n\t"
00075 "bne .weighted%= \n\t"
00076 : "=r" (resj0), "=r" (resj1), "=r" (resj2), "=r" (resj3),
00077 "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
00078 "=r" (dead5), "=r" (dead6), "=r" (dead7), "=r" (dead8)
00079 : "4" (j+1), "5" (r+j), "6" (shape_cb), "7" (subvect_size)
00080 : "cc", "memory");
00081 #else
00082 spx_word16_t *res;
00083 res = resp+j;
00084 spx_word32_t resj0=0;
00085 spx_word32_t resj1=0;
00086 spx_word32_t resj2=0;
00087 spx_word32_t resj3=0;
00088 for (k=0;k<=j;k++)
00089 {
00090 const signed char *shape=shape_cb+k;
00091 resj0 = MAC16_16(resj0,*shape,r[j-k]);
00092 shape += subvect_size;
00093 resj1 = MAC16_16(resj1,*shape,r[j-k]);
00094 shape += subvect_size;
00095 resj2 = MAC16_16(resj2,*shape,r[j-k]);
00096 shape += subvect_size;
00097 resj3 = MAC16_16(resj3,*shape,r[j-k]);
00098 shape += subvect_size;
00099 }
00100 #endif
00101
00102 #ifdef FIXED_POINT
00103 resj0 = SHR(resj0, 11);
00104 resj1 = SHR(resj1, 11);
00105 resj2 = SHR(resj2, 11);
00106 resj3 = SHR(resj3, 11);
00107 #else
00108 resj0 *= 0.03125;
00109 resj1 *= 0.03125;
00110 resj2 *= 0.03125;
00111 resj3 *= 0.03125;
00112 #endif
00113
00114
00115 E[0]=ADD32(E[0],MULT16_16(resj0,resj0));
00116 E[1]=ADD32(E[1],MULT16_16(resj1,resj1));
00117 E[2]=ADD32(E[2],MULT16_16(resj2,resj2));
00118 E[3]=ADD32(E[3],MULT16_16(resj3,resj3));
00119 *res = resj0;
00120 res += subvect_size;
00121 *res = resj1;
00122 res += subvect_size;
00123 *res = resj2;
00124 res += subvect_size;
00125 *res = resj3;
00126 res += subvect_size;
00127 }
00128 resp += subvect_size<<2;
00129 shape_cb += subvect_size<<2;
00130 E+=4;
00131 }
00132
00133 }