/****************************************************************** iLBC Speech Coder ANSI-C Source Code createCB.c Copyright (C) The Internet Society (2004). All Rights Reserved. ******************************************************************/ #include "iLBC_define.h" #include "createCB.h" #include "constants.h" #include #include /*----------------------------------------------------------------* * Construct an additional codebook vector by filtering the * initial codebook buffer. This vector is then used to expand * the codebook with an additional section. *---------------------------------------------------------------*/ void filteredCBvecs( float *cbvectors, /* (o) Codebook vectors for the higher section */ float *mem, /* (i) Buffer to create codebook vector from */ int lMem /* (i) Length of buffer */ ){ int j, k; float *pp, *pp1; float tempbuff2[CB_MEML+CB_FILTERLEN]; float *pos; memset(tempbuff2, 0, (CB_HALFFILTERLEN-1)*sizeof(float)); memcpy(&tempbuff2[CB_HALFFILTERLEN-1], mem, lMem*sizeof(float)); memset(&tempbuff2[lMem+CB_HALFFILTERLEN-1], 0, (CB_HALFFILTERLEN+1)*sizeof(float)); /* Create codebook vector for higher section by filtering */ /* do filtering */ pos=cbvectors; memset(pos, 0, lMem*sizeof(float)); for (k=0; k0.0) { invenergy[tmpIndex]=(float)1.0/(energy[tmpIndex]+EPS); } else { invenergy[tmpIndex] = (float) 0.0; } if (stage==0) { measure = (float)-10000000.0; if (crossDot > 0.0) { measure = crossDot*crossDot*invenergy[tmpIndex]; } } else { measure = crossDot*crossDot*invenergy[tmpIndex]; } /* check if measure is better */ ftmp = crossDot*invenergy[tmpIndex]; if ((measure>*max_measure) && (fabs(ftmp)