void AbsSum_G728_16s32s(Ipp16s* pSrc, Ipp32s* pAbsSum){ Ipp32s k, sum; for(k=0,sum=0; k<IDIM; k++) { sum += Abs_32s(pSrc[k]); } *pAbsSum = sum; return; }
void Excitation_signal_extrapolation(Ipp16s voiced, Ipp16s *fedelay, Ipp16s fescale, Ipp16s nlsfescale, Ipp16s* etpast, Ipp16s *et, Ipp16s *nlset, Ipp16s *seed) { Ipp16s temp, nlstemp,den,nlsden,nls; Ipp32s i, aa0, aa1; if(voiced == G728_TRUE) { temp = fescale; nlstemp = 15; for(i=0; i<IDIM; i++) etpast[i] = etpast[i-(*fedelay)]; /* nlstemp = 15;*/ } if(voiced == G728_FALSE) { *fedelay = Rand_G728_16s(seed); aa1 = 0; for(i=0; i<IDIM; i++) { etpast[i] = etpast[i-(*fedelay)]; aa1 = aa1 + Abs_32s(etpast[i]); } if((aa1==0)||(fescale==0)) { temp = 0; nlstemp = 15; } else { Vscale_32s(&aa1, 1, 1, 30, &aa1, &nlsden); den = Cnvrt_NR_32s16s(aa1); nlsden = nlsden - 16; Divide(fescale, nlsfescale, den, nlsden, &temp, &nlstemp); } } for(i=0; i<IDIM; i++) { aa0 = temp * etpast[i]; aa0 = ShiftR_32s(aa0, nlstemp); aa0 = Cnvrt_32s16s(aa0); etpast[i] = aa0; } Vscale_16s(etpast, IDIM, IDIM, 13, et, &nls); *nlset = nls + 2; return; }
void Set_Flags_and_Scalin_Factor_for_Frame_Erasure(Ipp16s fecount, Ipp16s ptab, Ipp16s kp, Ipp16s* fedelay, Ipp16s* fescale, Ipp16s* nlsfescale, Ipp16s* voiced, Ipp16s* etpast, Ipp16s *avmag, Ipp16s *nlsavmag) { Ipp16s n10msec, nls; Ipp32s aa0, i; n10msec = (Ipp16s)(fecount >> 2); if(n10msec == 0) { if(ptab > VTH) { *fedelay = kp; *voiced = G728_TRUE; } else { *voiced = G728_FALSE; aa0 = 0; for(i = -40;i < 0; i++) aa0 = aa0 + Abs_32s(etpast[i]); VscaleOne_Range30_32s(&aa0, &aa0, &nls); *avmag = Cnvrt_NR_32s16s(aa0); *nlsavmag = (Ipp16s)(nls - 16 + 3); } } if(*voiced == G728_TRUE) { if(n10msec < 5) *fescale = voicedfegain[n10msec]; else *fescale = 0; } else { if(n10msec < 6) { *fescale = unvoicedfegain[n10msec]; aa0 = (*fescale) * (*avmag); VscaleOne_Range30_32s(&aa0, &aa0, nlsfescale); *fescale = Cnvrt_NR_32s16s(aa0); *nlsfescale = (Ipp16s)((*nlsfescale)+(*nlsavmag) - 1); } else { *fescale = 0; } } return; }
void ExcitationSignalExtrapolation(Ipp16s voiced, Ipp16s *fedelay, Ipp16s fescale, Ipp16s nlsfescale, Ipp16s* etpast, Ipp16s *et, Ipp16s *nlset, Ipp16s *seed) { Ipp16s temp = fescale, nlstemp = 15,den,nlsden,nls; Ipp32s i, aa0, aa1; if(voiced == G728_TRUE) { for(i=0; i<IDIM; i++) etpast[i] = etpast[i-(*fedelay)]; /* nlstemp = 15;*/ } if(voiced == G728_FALSE) { *fedelay = Rand_G728_16s(seed); aa1 = 0; for(i=0; i<IDIM; i++) { etpast[i] = etpast[i-(*fedelay)]; aa1 = aa1 + Abs_32s(etpast[i]); } if((aa1==0)||(fescale==0)) { temp = 0; nlstemp = 15; } else { VscaleOne_Range30_32s(&aa1, &aa1, &nlsden); den = Cnvrt_NR_32s16s(aa1); nlsden = (Ipp16s)(nlsden - 16); Divide_16s(fescale, nlsfescale, den, nlsden, &temp, &nlstemp); } } for(i=0; i<IDIM; i++) { aa0 = temp * etpast[i]; aa0 = aa0 >> nlstemp; aa0 = Cnvrt_32s16s(aa0); etpast[i] = (Ipp16s)aa0; } VscaleFive_16s(etpast, et, 13, &nls); *nlset = (Ipp16s)(nls + 2); return; }