Ejemplo n.º 1
0
void VQ_target_vec_norm(Ipp16s linearGain, Ipp16s scaleGain, Ipp16s* target, Ipp16s* nlstarget){
   Ipp16s tmp, nlstmp, nls;
   Ipp32s k, aa0;

   Divide_16s(16384, 14, linearGain, scaleGain, &tmp, &nlstmp);
   for(k=0; k<IDIM; k++) {
      aa0 = tmp * target[k];
      target[k] = (Ipp16s)(aa0 >> 15);
   }
   *nlstarget = (Ipp16s)(2 + (nlstmp - 15));
   VscaleFive_16s(target, target, 14, &nls);
   *nlstarget = (Ipp16s)((*nlstarget) + nls);
   return;
}
Ejemplo n.º 2
0
void LTPCoeffsCalc(const Ipp16s *sst, Ipp32s kp, Ipp16s *gl, Ipp16s *glb, Ipp16s *pTab){
   Ipp32s aa0, aa1;
   Ipp16s den, num;
   Ipp16s nlsden, nlsnum, nlsptab, nls, b;

   /* Pitch_predictor_tab_calc*/ 
   ippsDotProd_16s32s_Sfs(sst-NPWSZ-kp, sst-NPWSZ-kp, NPWSZ,&aa0, 0);
   ippsDotProd_16s32s_Sfs(sst-NPWSZ, sst-NPWSZ-kp, NPWSZ,&aa1, 0);
   if(aa0 == 0) {
      *pTab = 0;
   } else if(aa1 <= 0) {
      *pTab = 0;
   } else {
      if(aa1 >= aa0) *pTab = 16384;
      else {
         VscaleOne_Range30_32s(&aa0, &aa0, &nlsden);
         VscaleOne_Range30_32s(&aa1, &aa1, &nlsnum);
         num = Cnvrt_NR_32s16s(aa1);
         den = Cnvrt_NR_32s16s(aa0);
         Divide_16s(num, nlsnum, den, nlsden, pTab, &nlsptab);
         *pTab = (*pTab) >> (nlsptab - 14);
      }
   }
   /* Update long-term postfilter coefficients*/ 
   if(*pTab < PPFTH) aa0 = 0;
   else              aa0 = PPFZCF * (*pTab);
   b = aa0 >> 14;
   aa0 = aa0 >> 16;
   aa0 = aa0 + 16384;
   den = aa0;
   Divide_16s(16384, 14, den, 14, gl, &nls);
   aa0 = *gl * b;
   *glb = aa0 >> nls;
   if(nls > 14) *gl = (*gl) >> (nls-14);
   return;
}
Ejemplo n.º 3
0
void ScaleFactorCalc(Ipp32s sumunfil, Ipp32s sumfil, Ipp16s *pRatio, Ipp16s *pScaleRatio)
{
   Ipp32s dwDen, dwNum;
   Ipp16s den, num;
   Ipp16s scaleDen, scaleNum;

   if(sumfil > 4) {
      VscaleOne_Range30_32s(&sumfil, &dwDen, &scaleDen);
      den = Cnvrt_NR_32s16s(dwDen);

      VscaleOne_Range30_32s(&sumunfil, &dwNum, &scaleNum);
      num = Cnvrt_NR_32s16s(dwNum);

      Divide_16s(num, scaleNum, den, scaleDen, pRatio, pScaleRatio);
   } else {
      *pRatio = 16384;
      *pScaleRatio = 14;
   }

   return;
}
Ejemplo n.º 4
0
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;
}