93 float gain_comp, maxcc_comp, per, max_per=0;
95 float ftmp, randvec[
BLOCKL_MAX], pitchfact, energy;
106 if (iLBCdec_inst->
prevPLI != 1) {
114 lag, iLBCdec_inst->
blockl, 60);
115 for (i=inlag-2;i<=inlag+3;i++) {
116 compCorr(&maxcc_comp, &gain_comp, &per,
118 i, iLBCdec_inst->
blockl, 60);
120 if (maxcc_comp>maxcc) {
139 max_per=iLBCdec_inst->
per;
148 iLBCdec_inst->
blockl>2*320)
151 iLBCdec_inst->
blockl>3*320)
154 iLBCdec_inst->
blockl>4*320)
158 ftmp=(float)sqrt(max_per);
160 pitchfact=(float)1.0;
161 else if (ftmp>(
float)0.4)
162 pitchfact=(ftmp-(float)0.4)/((float)0.7-(
float)0.4);
181 for (i=0; i<iLBCdec_inst->
blockl; i++) {
185 iLBCdec_inst->
seed=(iLBCdec_inst->
seed*69069L+1) &
187 randlag = 50 + ((
signed long) iLBCdec_inst->
seed)%70;
193 iLBCdec_inst->
blockl+pick];
195 randvec[i] = randvec[pick];
204 iLBCdec_inst->
blockl+pick];
206 PLCresidual[i] = PLCresidual[pick];
212 PLCresidual[i] = use_gain*(pitchfact *
214 ((float)1.0 - pitchfact) * randvec[i]);
216 PLCresidual[i] = (float)0.95*use_gain*(pitchfact *
218 ((
float)1.0 - pitchfact) * randvec[i]);
220 PLCresidual[i] = (float)0.9*use_gain*(pitchfact *
222 ((
float)1.0 - pitchfact) * randvec[i]);
224 energy += PLCresidual[i] * PLCresidual[i];
234 if (sqrt(energy/(
float)iLBCdec_inst->
blockl) < 30.0) {
236 for (i=0; i<iLBCdec_inst->
blockl; i++) {
237 PLCresidual[i] = randvec[i];
243 memcpy(PLClpc,iLBCdec_inst->
prevLpc,
251 memcpy(PLCresidual, decresidual,
252 iLBCdec_inst->
blockl*
sizeof(
float));
261 iLBCdec_inst->
per=max_per;
265 memcpy(iLBCdec_inst->
prevLpc, PLClpc,
268 iLBCdec_inst->
blockl*
sizeof(
float));
float prevResidual[NSUB_MAX *SUBL]
void compCorr(float *cc, float *gc, float *pm, float *buffer, int lag, int bLen, int sRange)
float prevLpc[LPC_FILTERORDER+1]