📄 owng729.h
字号:
/*///////////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2005-2007 Intel Corporation. All Rights Reserved.//// Intel(R) Integrated Performance Primitives// USC - Unified Speech Codec interface library//// By downloading and installing USC codec, you hereby agree that the// accompanying Materials are being provided to you under the terms and// conditions of the End User License Agreement for the Intel(R) Integrated// Performance Primitives product previously accepted by you. Please refer// to the file ippEULA.rtf or ippEULA.txt located in the root directory of your Intel(R) IPP// product installation for more information.//// A speech coding standards promoted by ITU, ETSI, 3GPP and other// organizations. Implementations of these standards, or the standard enabled// platforms may require licenses from various entities, including// Intel Corporation.////// Purpose: G.729/A/B/D/E speech codec: main own header file.//*/#ifndef __OWNG729_H__#define __OWNG729_H__#if defined( _WIN32_WCE)#pragma warning( disable : 4505 )#endif#include <ipps.h>#include <ippsc.h>#include "g729api.h"#include "scratchmem.h"#define ENC_KEY 0xecd729#define DEC_KEY 0xdec729#define G729_ENCODER_SCRATCH_MEMORY_SIZE (10240+40)#define SEC_STAGE_BITS 5#define FIR_STAGE_BITS 7#define PARM_DIM 11#define FIR_STAGE (1<<FIR_STAGE_BITS)#define SPEECH_BUF_DIM 240#define SEC_STAGE (1<<SEC_STAGE_BITS)#define LP_LOOK_AHEAD 40#define LP_WINDOW_DIM 240#define LP_SUBFRAME_DIM 40#define LP_FRAME_DIM 80#define LPC_WINDOW (speechHistory + SPEECH_BUF_DIM - LP_WINDOW_DIM)#define PRESENT_SPEECH (speechHistory + SPEECH_BUF_DIM - LP_FRAME_DIM - LP_LOOK_AHEAD)#define MIN_PITCH_LAG 20#define LPF_DIM 10 /*LP filter order */#define INTERPOLATION_FILTER_DIM (10+1)#define MAX_PITCH_LAG 143#define L_prevExcitat (MAX_PITCH_LAG+INTERPOLATION_FILTER_DIM)#define PITCH_SHARP_MIN 3277 /*pitch sharpening min = 0.2 */#define BWF2 22938 /*bandwitdh = 0.7 */#define PITCH_SHARP_MAX 13017 /*pitch sharpening max = 0.8 */#define COEFF1 29491#define CDBK1_BIT_NUM 3#define CDBK2_BIT_NUM 4#define CDBK1_DIM (1<<CDBK1_BIT_NUM)#define LSF_MIN 40 /*lsf min = 0.005 */#define CDBK2_DIM (1<<CDBK2_BIT_NUM)#define LSP_MA_ORDER 4 /*MA moving average */#define BW_EXP_FACT 321 /*bandwidth expansion factor */#define LSF_MAX 25681 /*lsf max = 3.135 */#define BWF2_PST 18022 /*weighting factor */#define PITCH_GAIN_MAX 15564 /*for improving */#define IMP_RESP_LEN 20#define BWF1_PST BWF2 /*weighting factor */#define CORR_DIM 616#define RES_FIL_DIM (MAX_PITCH_LAG + 1 + 8)#define SID_FRAME_MIN 3#define SEED_INIT 11111#define ACF_NOW 2#define ACF_TOTAL 3#define GAIN0 28672#define GAIN1 (-IPP_MIN_16S-GAIN0)#define GAIN_NUM 2#define TOTAL_ACF_DIM (ACF_TOTAL *(LPF_DIM+1))#define VAD_LPC_DIM 12#define ACF_DIM (ACF_NOW *(LPF_DIM+1))#define SIX_PI 19302#define BWLPCF_DIM 30 /*backward LP filter order*/#define SYNTH_BWD_DIM BWLPCF_DIM + 35#define BWLPCF1_DIM (BWLPCF_DIM+1)#define TBWD_DIM LP_FRAME_DIM + SYNTH_BWD_DIM#define N0_98 32113#define BWF2_PST_E 21300 /*Numerator wgt factor */#define BWF1_PST_E BWF2 /*Denominator wgt factor 0.70*/#define IMP_RESP_LEN_E 32 /*Imp.resp. len */#define BWF_HARMONIC_E (1<<13)#define BWF_HARMONIC (1<<14)#define CDBK1_BIT_NUM_6K 3#define CDBK2_BIT_NUM_6K 3#define CDBK1_DIM_6K (1<<CDBK1_BIT_NUM_6K)#define CDBK2_DIM_6K (1<<CDBK2_BIT_NUM_6K)#define CNG_STACK_SIZE (1<<5)#define G729_CODECFUN(type,name,arg) extern type name argtypedef struct _SynthesisFilterState { Ipp32s nTaps; Ipp16s *buffer;}SynthesisFilterState;typedef struct _G729Coder_Obj { Ipp32s objSize; Ipp32s key; Ipp32u mode; G729Codec_Type codecType;}G729Coder_Obj;struct _G729Decoder_Obj { G729Coder_Obj objPrm; ScratchMem_Obj Mem; Ipp16s resFilBuf1[RES_FIL_DIM+LP_SUBFRAME_DIM]; Ipp16s prevLSPfreq[LSP_MA_ORDER][LPF_DIM]; Ipp16s LTPostFilt[TBWD_DIM]; Ipp16s prevExcitat[LP_FRAME_DIM+L_prevExcitat]; Ipp16s prevSubfrLSP[LPF_DIM]; Ipp16s prevSubfrLSPquant[LPF_DIM]; Ipp16s zeroPostFiltVec1[LPF_DIM+BWLPCF_DIM+2]; Ipp16s decPrm[20]; /*analysis data pointer */ Ipp32s coderErr[4]; /*memory for improving */ Ipp16s pBwdLPC[BWLPCF1_DIM]; Ipp16s pBwdLPC2[BWLPCF1_DIM]; Ipp16s pPrevBwdLPC[BWLPCF1_DIM]; Ipp32s hwState[BWLPCF1_DIM]; Ipp16s pPrevFilt[BWLPCF1_DIM]; /* selected previously filter */ G729Codec_Type codecType; Ipp16s preemphFilt; Ipp16s seed; Ipp16s voiceFlag; Ipp16s gainExact; /*gain's precision */ Ipp16s betaPreFilter; /*quant adaptive codebook gain from the previous subframe */ Ipp16s gainNow; Ipp16s sidGain; Ipp16s seedSavage; Ipp16s CNGvar; Ipp16s SIDflag0; Ipp16s lspSID[LPF_DIM]; Ipp16s SIDflag1; Ipp16s CNGidx; /*CNG cache parameters */ Ipp8s *postProc; /*High pass post processing filter memory */ Ipp8s *synFltw; /*Synthesis filter memory */ Ipp8s *synFltw0; /*Synthesis filter memory */ Ipp32s pstFltMode; /*post filter: 1- on, 0- off */ Ipp16s gains[2]; /*pitch + vcodebook gains */ Ipp16s prevFrameDelay; Ipp16s prevMA; /*previous MA prediction coef.*/ Ipp16s prevFrameQuantEn[4]; Ipp16s prevVoiceFlag; Ipp16s prevBFI; Ipp16s prevLPmode; Ipp16s interpCoeff2; Ipp16s interpCoeff2_2; Ipp16s valGainAttenuation; Ipp16s BFIcount; Ipp8s *PhDispMem; Ipp16s pPrevBwdRC[2]; Ipp16s BWDFrameCounter; Ipp16s stat_pitch; /*pitch stationarity */ Ipp16s prevFrameDelay2; /*previous frame delay */ Ipp16s pitchStatIntDelay; Ipp16s pitchStatFracDelay; Ipp16s prevPitch; Ipp16s gammaPost1; Ipp16s gammaPost2; Ipp16s gammaHarm; Ipp16s BWDcounter2; Ipp16s FWDcounter2;};struct _G729Encoder_Obj { G729Coder_Obj objPrm; ScratchMem_Obj Mem; Ipp16s encSyn[LP_FRAME_DIM];/*encodersynthesisbuffer*/ Ipp16s speechHistory[SPEECH_BUF_DIM]; Ipp16s prevLSPfreq[LSP_MA_ORDER][LPF_DIM]; Ipp16s energySfs[GAIN_NUM];/*energyscalefactors*/ Ipp16s pACF[ACF_DIM]; Ipp16s ACFsum[TOTAL_ACF_DIM]; Ipp16s BWDsynth[TBWD_DIM]; Ipp16s energy[GAIN_NUM]; Ipp16s prevFrameQuantEn[4];/*quantizedenergyforpreviousframes*/ Ipp16s resFilMem0[BWLPCF_DIM]; Ipp16s resFilMem[BWLPCF_DIM+LP_SUBFRAME_DIM]; Ipp16s quantLspSID[LPF_DIM]; Ipp16s prevSubfrLSP[LPF_DIM]; Ipp16s prevSubfrLSPquant[LPF_DIM]; Ipp32s hwState[BWLPCF1_DIM]; Ipp16s ACFsfs[ACF_NOW]; Ipp16s ACFsumSfs[ACF_TOTAL]; Ipp16s pPrevFilt[BWLPCF1_DIM]; Ipp16s pPrevBwdLPC[BWLPCF1_DIM]; Ipp16s pBwdLPC2[BWLPCF1_DIM]; Ipp16s betaPreFilter;/*quantadaptivecodebookgainfromtheprevioussubframe*/ Ipp16s prevWgtSpeech[LP_FRAME_DIM+MAX_PITCH_LAG+1]; Ipp16s prevExcitat[LP_FRAME_DIM+L_prevExcitat+2];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -