📄 owng729.h
字号:
Ipp16s encPrm[19]; Ipp16s zeroPostFiltVec1[LP_SUBFRAME_DIM+BWLPCF_DIM+1];/*zeroextendedimpulseresponse*/ Ipp16s prevCoeff[LPF_DIM+1]; Ipp16s prevSubfrLPC[LPF_DIM+1]; Ipp16s reflC[LPF_DIM+1]; G729Codec_Type codecType; Ipp16s ACnorm; Ipp16s ACFcounter; Ipp16s gainNow; Ipp16s energyDim;/*energiesnumber*/ Ipp16s SIDframeCounter; Ipp16s prevSubfrSmooth;/*perceptualweighting*/ Ipp16s sidGain; Ipp16s speechDiff; Ipp16s prevLPmode; Ipp16s *pSynth; Ipp16s pPrevBwdRC[2]; Ipp16s prevLAR[2];/*previoussubframelogarearatio*/ Ipp16s prevDTXEnergy; Ipp16s seed; Ipp16s CNGidx;/*CNGcacheparameters*/ Ipp8s *preProc;/*highpasspreprocessingfiltermemory*/ Ipp8s *synFltw;/*synthesisfilter1memory*/ Ipp8s *synFltw0;/*synthesisfilter2memory*/ Ipp8s *vadMem;/*VADmemory*/ Ipp32s mode;/*mode's*/ Ipp16s extraTime;/*fixedcodebooksearchextratime*/ Ipp16s prevRC[2]; Ipp32s coderErr[4]; Ipp16s dominantBWDmode; Ipp16s interpCoeff2_2; Ipp16s statGlobal;/*globalstationaritymesure*/ Ipp16s pLag[5]; Ipp16s pGain[5]; Ipp16s BWDFrameCounter;/*consecutivebackwardframesNbre*/ Ipp16s val_BWDFrameCounter;/*BWDFrameCounterassociated*/ Ipp16s BWDcounter2; Ipp16s FWDcounter2;};Ipp16s ExtractBitsG729(const Ipp8u **pSrc, Ipp32s *len, Ipp32s Count);void NoiseExcitationFactorization_G729B_16s(const Ipp16s *pSrc,Ipp32s val1, Ipp16s val2, Ipp16s *pDst, Ipp32s len);Ipp32s ComfortNoiseExcitation_G729B_16s_I(const Ipp16s *pSrc, const Ipp16s *pPos, const Ipp16s *pSign, Ipp16s val, Ipp16s t, Ipp16s *pSrcDst, Ipp16s *t2, Ipp16s *Sfs);void RandomCodebookParm_G729B_16s(Ipp16s *pSrc1, Ipp16s *pSrc2, Ipp16s *pSrc3, Ipp16s *pSrc4, Ipp16s *n);void QuantSIDGain_G729B_16s(const Ipp16s *pSrc, const Ipp16s *pSrcSfs, Ipp32s len, Ipp16s *p, Ipp32s *pIdx);void Sum_G729_16s_Sfs(const Ipp16s *pSrc, const Ipp16s *pSrcSfs, Ipp16s *pDst, Ipp16s *pDstSfs, Ipp32s len, Ipp32s*pSumMem);void VADMusicDetection( G729Codec_Type codecType, Ipp32s Val, Ipp16s expVal, Ipp16s *rc, Ipp16s *lags, Ipp16s *pgains, Ipp16s stat_flg, Ipp16s *Vad, Ipp8s*pVADmem);IppStatus SynthesisFilter_G729_16s (const Ipp16s *pLPC, const Ipp16s *pSrc, Ipp16s *pDst, Ipp32s len, Ipp8s *pMemUpdated, Ipp32s HistLen);IppStatus SynthesisFilter_G729_16s_update (const Ipp16s *pLPC, const Ipp16s *pSrc, Ipp16s *pDst, Ipp32s len, Ipp8s *pMemUpdated, Ipp32s hLen, Ipp32s update);void SynthesisFilterOvf_G729_16s_I(const Ipp16s *pLPC, Ipp16s *pSrcDst, Ipp32s len, Ipp8s *pMemUpdated, Ipp32s HistLen);void SynthesisFilterOvf_G729_16s (const Ipp16s *pLPC, const Ipp16s *pSrc, Ipp16s *pDst, Ipp32s len, Ipp8s *pMemUpdated, Ipp32s HistLen);void SynthesisFilterInit_G729 (Ipp8s *pMemUpdated);void SynthesisFilterSize_G729 (Ipp32s *pSize);void CodewordImpConv_G729(Ipp32s index, const Ipp16s *pSrc1,const Ipp16s *pSrc2,Ipp16s *pDst);void _ippsRCToLAR_G729_16s (const Ipp16s*pSrc, Ipp16s*pDst, Ipp32s len);void _ippsPWGammaFactor_G729_16s (const Ipp16s*pLAR, const Ipp16s*pLSF, Ipp16s *flat, Ipp16s*pGamma1, Ipp16s*pGamma2, Ipp16s *pMem );void CNG_encoder(Ipp16s *exc, Ipp16s *prevSubfrLSPquant, Ipp16s *Aq, Ipp16s *ana, G729Encoder_Obj *encoderObj);void CNG_Update(Ipp16s *pSrc, Ipp16s val, Ipp16s vad, G729Encoder_Obj *encoderObj);void Post_G729(Ipp16s idx, Ipp16s id, const Ipp16s *LPC, Ipp16s *pDst, Ipp16s *voiceFlag, G729Decoder_Obj *decoderObj);void Post_G729AB(Ipp16s idx, Ipp16s id, const Ipp16s *LPC, Ipp16s *pDst, Ipp16s vad, G729Decoder_Obj *decoderObj);void Post_G729I(Ipp16s idx, Ipp16s id, const Ipp16s *LPC, Ipp16s *pDst, Ipp16s *val, Ipp16s val1, Ipp16s val2, Ipp16s fType, G729Decoder_Obj *decoderObj);void Post_G729Base(Ipp16s idx, Ipp16s id, const Ipp16s *LPC, Ipp16s *pDst, Ipp16s *voiceFlag, Ipp16s ftyp, G729Decoder_Obj *decoderObj);void updateExcErr_G729(Ipp16s x, Ipp32s y, Ipp32s *err);Ipp16s calcErr_G729(Ipp32s val, Ipp32s *pSrc);void BWDLagWindow(Ipp32s *pSrc, Ipp32s *pDst);void SetLPCMode_G729E(Ipp16s *signal_ptr, Ipp16s *aFwd, Ipp16s *pBwdLPC, Ipp16s *lpMode, Ipp16s *lspnew, Ipp16s *lspold, G729Encoder_Obj *encoderObj);void PitchTracking_G729E(Ipp16s *val1, Ipp16s *val2, Ipp16s *prevPitch, Ipp16s *pitchStat, Ipp16s *pitchStatIntDelay, Ipp16s *pitchStatFracDelay);Ipp16s enerDB(Ipp16s *synth, Ipp16s L);void tstDominantBWDmode(Ipp16s *BWDcounter2,Ipp16s *FWDcounter2,Ipp16s *highStat, Ipp16s mode);void Init_CNG_encoder(G729Encoder_Obj *encoderObj);void Log2_G729(Ipp32s val, Ipp16s *pDst1, Ipp16s *pDst2);extern CONST Ipp16s gammaFac1[2*(LPF_DIM+1)];extern CONST Ipp16s g729gammaFac1_pst[LPF_DIM+1];extern CONST Ipp16s g729gammaFac2_pst[LPF_DIM+1];extern CONST Ipp16s cngSeedOut[CNG_STACK_SIZE];extern CONST Ipp16s cngCache[CNG_STACK_SIZE][LP_SUBFRAME_DIM];extern CONST Ipp16s LUT1[CDBK1_DIM];extern CONST Ipp16s presetLSP[LPF_DIM];extern CONST Ipp32s cngInvSqrt[CNG_STACK_SIZE];extern CONST Ipp16s resetPrevLSP[LPF_DIM];extern CONST Ipp16s LUT2[CDBK2_DIM];extern CONST Ipp16s presetOldA[LPF_DIM+1];extern CONST Ipp16s areas[L_prevExcitat-1+3];extern CONST Ipp16s SIDgain[32];#include "aux_fnxs.h"__INLINE Ipp32s equality( Ipp32s val) { Ipp32s temp, i, bit; Ipp32s sum; sum = 1; temp = val >> 1; for(i = 0; i <6; i++) { temp >>= 1; bit = temp & 1; sum += bit; } sum &= 1; return sum;}static __ALIGN32 CONST Ipp16s table0[8]={ 1*1, 2*1, 0*1, 1*1, 2*1, 0*1, 1*1, 2*1};__INLINE void DecodeAdaptCodebookDelays(Ipp16s *prevFrameDelay, Ipp16s *prevFrameDelay2,Ipp16s *delay, Ipp32s id, Ipp32s bad_pitch,Ipp32s pitchIndx,G729Codec_Type type) { Ipp16s minPitchSearchDelay, maxPitchSearchDelay; if(bad_pitch == 0) { if(id == 0) { /*if 1-st subframe */ if(pitchIndx < 197) { delay[0] = (Ipp16s)((pitchIndx+2)/3 + 19); delay[1] = (Ipp16s)(pitchIndx - delay[0] * 3 + 58); } else { delay[0] = (Ipp16s)(pitchIndx - 112); delay[1] = 0; } } else { /*find minPitchSearchDelay and maxPitchSearchDelay for 2-nd subframe */ minPitchSearchDelay = (Ipp16s)(delay[0] - 5); if(minPitchSearchDelay < MIN_PITCH_LAG) minPitchSearchDelay = MIN_PITCH_LAG; maxPitchSearchDelay = (Ipp16s)(minPitchSearchDelay + 9); if(maxPitchSearchDelay > MAX_PITCH_LAG) { maxPitchSearchDelay = MAX_PITCH_LAG; minPitchSearchDelay = MAX_PITCH_LAG - 9; } if(type == G729D_CODEC /* i.e. 6.4 kbps */) { pitchIndx = pitchIndx & 15; if(pitchIndx <= 3) { delay[0] = (Ipp16s)(minPitchSearchDelay + pitchIndx); delay[1] = 0; } else if(pitchIndx < 12) { delay[1] = table0[pitchIndx - 4]; delay[0] = (Ipp16s)((pitchIndx - delay[1])/3 + 2 + minPitchSearchDelay); if(delay[1] == 2) { delay[1] = -1; delay[0]++; } } else { delay[0] = (Ipp16s)(minPitchSearchDelay + pitchIndx - 6); delay[1] = 0; } } else { delay[0] = (Ipp16s)(minPitchSearchDelay + (pitchIndx + 2)/3 - 1); delay[1] = (Ipp16s)(pitchIndx - 2 - 3 *((pitchIndx + 2)/3 - 1)); } } *prevFrameDelay = delay[0]; *prevFrameDelay2 = delay[1]; } else { /* non-equal or bad frame*/ delay[0] = *prevFrameDelay; if(type == G729E_CODEC) { delay[1] = *prevFrameDelay2; } else { delay[1] = 0; *prevFrameDelay += 1; if(*prevFrameDelay > MAX_PITCH_LAG) { *prevFrameDelay = MAX_PITCH_LAG; } } }}/*__INLINE Ipp16s Mul_16s_Sfs(Ipp16s x, Ipp16s y, Ipp32s scaleFactor) { return (Ipp16s)((x*y) >> scaleFactor);}__INLINE Ipp32s Mul_32s(Ipp32s val1,Ipp32s val2) { Ipp16s tmpHigh,tmpLow,tmp2High,tmp2Low; Ipp32s tmp,tmp1,tmp2; tmpHigh = (Ipp16s)(val1 >> 15); tmpLow = (Ipp16s)(val1 & IPP_MAX_16S); tmp2High = (Ipp16s)(val2 >> 15); tmp2Low = (Ipp16s)(val2 & IPP_MAX_16S); tmp1 = Mul_16s_Sfs(tmpHigh,tmp2Low,15); tmp2 = Mul_16s_Sfs(tmpLow,tmp2High,15); tmp = tmpHigh*tmp2High; tmp += tmp1; tmp += tmp2; return(tmp<<1);}*/#endif /* __OWNG729_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -