522 float *enh_buf, *enh_period;
524 int lag=0, ilag, i, ioffset;
527 float *inPtr, *enh_bufPtr1, *enh_bufPtr2;
532 int start, plc_blockl, inlag;
537 memmove(enh_buf, &enh_buf[iLBCdec_inst->
blockl],
541 iLBCdec_inst->
blockl*
sizeof(
float));
543 if (iLBCdec_inst->
mode==30)
550 if (iLBCdec_inst->
mode==20) ioffset=1;
553 memmove(enh_period, &enh_period[i],
572 lpState, downsampled);
575 for (iblock = 0; iblock<
ENH_NBLOCKS-ioffset; iblock++) {
580 ENH_BLOCKL_HALF-lag, ENH_BLOCKL_HALF);
581 for (ilag=11; ilag<60; ilag++) {
584 ENH_BLOCKL_HALF-ilag, ENH_BLOCKL_HALF);
606 for (ilag=inlag; ilag<=inlag+1; ilag++) {
628 enh_bufPtr1=&plc_pred[plc_blockl-1];
630 if (lag>plc_blockl) {
636 for (isample = start; isample>0; isample--) {
637 *enh_bufPtr1-- = *inPtr--;
641 for (isample = (plc_blockl-1-lag); isample>=0; isample--) {
642 *enh_bufPtr1-- = *enh_bufPtr2--;
648 for (i=0;i<plc_blockl;i++) {
651 ftmp1+=plc_pred[i]*plc_pred[i];
653 ftmp1=(float)sqrt(ftmp1/(
float)plc_blockl);
654 ftmp2=(float)sqrt(ftmp2/(
float)plc_blockl);
655 if (ftmp1>(
float)2.0*ftmp2 && ftmp1>0.0) {
656 for (i=0;i<plc_blockl-10;i++) {
657 plc_pred[i]*=(float)2.0*ftmp2/ftmp1;
659 for (i=plc_blockl-10;i<plc_blockl;i++) {
660 plc_pred[i]*=(float)(i-plc_blockl+10)*
661 ((float)1.0-(
float)2.0*ftmp2/ftmp1)/(
float)(10)+
667 (
float)2.0*ftmp2/ftmp1;
672 for (i=0; i<plc_blockl; i++) {
673 ftmp1 = (float) (i+1) / (float) (plc_blockl+1);
674 *enh_bufPtr1 *= ftmp1;
675 *enh_bufPtr1 += ((float)1.0-ftmp1)*
676 plc_pred[plc_blockl-1-i];
681 if (iLBCdec_inst->
mode==20) {
683 for (iblock = 0; iblock<2; iblock++) {
689 }
else if (iLBCdec_inst->
mode==30) {
691 for (iblock = 0; iblock<3; iblock++) {
float lpFilt_coefsTbl[FILTERORDER_DS]
#define ENH_NBLOCKS_EXTRA
float xCorrCoef(float *target, float *regressor, int subl)
float enh_period[ENH_NBLOCKS_TOT]
void enhancer(float *odata, float *idata, int idatal, int centerStartPos, float alpha0, float *period, float *plocs, int periodl)
float enh_plocsTbl[ENH_NBLOCKS_TOT]
void DownSample(float *In, float *Coef, int lengthIn, float *state, float *Out)