50 memset(pos, 0, lMem*
sizeof(
float));
51 for (k=0; k<lMem; k++) {
55 (*pos)+=(*pp++)*(*pp1--);
88 int icount, ilow, j, tmpIndex;
89 float *pp, *ppo, *ppi, *ppe, crossDot, alfa;
90 float weighted, measure, nrjRecursive;
95 nrjRecursive = (float) 0.0;
96 pp = buffer - low + 1;
97 for (j=0; j<(low-5); j++) {
98 nrjRecursive += ( (*pp)*(*pp) );
104 for (icount=low; icount<=high; icount++) {
108 tmpIndex = startIndex+icount-20;
113 nrjRecursive = nrjRecursive + (*ppe)*(*ppe);
115 energy[tmpIndex] = nrjRecursive;
124 crossDot = (float) 0.0;
126 for (j=0; j<ilow; j++) {
127 crossDot += target[j]*(*pp++);
133 ppi = buffer-icount-4;
134 for (j=ilow; j<icount; j++) {
135 weighted = ((float)1.0-alfa)*(*ppo)+alfa*(*ppi);
138 energy[tmpIndex] += weighted*weighted;
139 crossDot += target[j]*weighted;
145 pp = buffer - icount;
146 for (j=icount; j<
SUBL; j++) {
147 energy[tmpIndex] += (*pp)*(*pp);
148 crossDot += target[j]*(*pp++);
151 if (energy[tmpIndex]>0.0) {
152 invenergy[tmpIndex]=(float)1.0/(energy[tmpIndex]+
EPS);
154 invenergy[tmpIndex] = (float) 0.0;
158 measure = (float)-10000000.0;
160 if (crossDot > 0.0) {
161 measure = crossDot*crossDot*invenergy[tmpIndex];
165 measure = crossDot*crossDot*invenergy[tmpIndex];
169 ftmp = crossDot*invenergy[tmpIndex];
171 if ((measure>*max_measure) && (fabs(ftmp)<
CB_MAXGAIN)) {
177 *best_index = tmpIndex;
178 *max_measure = measure;
198 float *pp, *ppo, *ppi, alfa, alfa1, weighted;
205 memcpy(cbVec,pp,
sizeof(
float)*index);
212 ppi = buffer-index-5;
213 for (j=ilow; j<index; j++) {
214 weighted = ((float)1.0-alfa)*(*ppo)+alfa*(*ppi);
224 memcpy(cbVec+index,pp,
sizeof(
float)*(
SUBL-index));
float cbfiltersTbl[CB_FILTERLEN]
void createAugmentedVec(int index, float *buffer, float *cbVec)
void searchAugmentedCB(int low, int high, int stage, int startIndex, float *target, float *buffer, float *max_measure, int *best_index, float *gain, float *energy, float *invenergy)
void filteredCBvecs(float *cbvectors, float *mem, int lMem)