⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 G711语音压缩源码
💻 H
字号:
#define Rate63	0
#define Rate53  1

#define FLOAT float

// Coder global constants 
#define  SubFrLen_1		59

// LPC constants 
#define  RidgeFact         10
#define  CosineTableSize   512
#define  PreCoef           ((FLOAT) -0.25)

#define  LspPred0          ((FLOAT)12.0/(FLOAT)32.0)
#define  LspPred1          ((FLOAT)23.0/(FLOAT)32.0)

#define  LspQntBands       3
#define  LspCbSize         256
#define  LspCbBits         8

// LTP constants 
#define  PwRange           3
#define  ClPitchOrd        5
#define  Pstep             1
#define NbFilt085          85
#define NbFilt170          170

// MP-MLQ constants 
#define  Sgrid             2
#define  MaxPulseNum       6
#define  MlqSteps          2

// acelp constants 

#define SubFrLen2          (SubFrLen +4)
#define DIM_RR             416
#define NB_POS             8
#define STEP               8
#define MSIZE              64
#define threshold          ((FLOAT) 0.5)
#define max_time           120

// Gain constant 
#define  NumOfGainLev      24

// FER constant 
#define  ErrMaxNum         3

// CNG constants  
#define ThreshGain         3  // Theshold for quantized gains               
#define FracThreshP1       ((FLOAT) 1.2136)
#define MaxLev             22 // Max. gain index                            
#define NbPulsBlk          11 // Nb of pulses in 2-subframes blocks         

#define InvNbPulsBlk       ((FLOAT)1.0/(FLOAT)NbPulsBlk)
#define NbFilt             50 // size of LT filters table                   
#define SubFrLenD          (2*SubFrLen)
#define Gexc_Max           ((FLOAT)5000.0) // Max gain for fixed excitation 

// Taming constants 
#define NbFilt085_min       51
#define NbFilt170_min       93
#define Err0                ((FLOAT) 0.00000381464)
#define ThreshErr           ((FLOAT) 128.0)

#define MAXV                ((FLOAT) 256.0)

// best excitation vector parameters for the high rate 
struct BESTDEF
{
	float    MaxErr;
	int      GridId;
	int      MampId;
	int      UseTrn;
	int      Ploc[MaxPulseNum];
	float    Pamp[MaxPulseNum];
};

// Function prototypes for "exc2.cpp"
int   Estim_Pitch(float *Dpnt, int Start);
PWDEF Comp_Pw(float *Dpnt, int Start, int Olp);
void  Filt_Pw(float *DataBuff, float *Dpnt, int Start, PWDEF Pw);
void  Find_Best(BESTDEF *Best, float *Tv, float *ImpResp, int Np, int Olp);
void  Fcbk_Pack(float *Dpnt, SFSDEF *Sfs, BESTDEF *Best, int Np);
void  Cor_h(float *H, float *rr);
void  Cor_h_X(float h[],float X[],float D[]);
int   G_code(float X[], float Y[], float *gain_q);
void  Gen_Trn(float *Dst, float *Src, int Olp);

void  Get_Rez(float *Tv, float *PrevExc, int Lag);
short Comp_Info(float *Buff, int Olp, float *Gain);
void  Regen(float *DataBuff, float *Buff, short Lag, float Gain,
            int Ecount, short *Sd);
int   Find_B(float *Buff, int Olp, int Sfc);
int   Find_F(float *Buff, int Olp, int Sfc);
void  Filt_Lpf(float *Tv, float *Buff, PFDEF Pf, int Sfc);
int   search_T0(int T0, int Gid, float *gain_T0);
void  reset_max_time(void);


// Function prototypes for "lpc2.cpp"
float Durbin(float *Lpc, float *Corr, float Err, float *Pk2);
void   Wght_Lpc(float *PerLpc, float *UnqLpc);
void   Comp_Ir(float *ImpResp, float *QntLpc, float *PerLpc, PWDEF Pw);


// Function prototypes for "lsp2.cpp"
void AtoLsp(float *LspVect, float *Lpc, float *PrevLsp);
int  Lsp_Qnt(float *CurrLsp, float *PrevLsp);
int  Lsp_Svq(float *Lsp, float *Wvect);
void Lsp_Inq(float *Lsp, float *PrevLsp, int LspId, short Crc);
void Lsp_Int(float *QntLpc, float *CurrLsp, float *PrevLsp);
void LsptoA(float *Lsp);

// Function prototypes for "utilcng2.cpp"
short  Qua_SidGain(float *Ener, short nq);
float Dec_SidGain(short iGain);


// Function prototypes for "util2.cpp"
//void   Read_lbc(float *Dpnt, int Len, FILE *Fp);
//void   Write_lbc(float *Dpnt, int Len, FILE *Fp);
void   Mem_Shift(float *PrevDat, float *DataBuff);
short  Rand_lbc(short *p);
short* Par2Ser(int Inp, short *Pnt, int BitNum);
int    Ser2Par(short **Pnt, int Count);

float DotProd(float *in1, float *in2, int len);
float DotProd2(float *in1, float *in2, int len);
float DotProd3(float *in1, float *in2, int len);
float DotProd4(float *in1, float *in2, int len);
float DotProd5(float *in1, float *in2, int len);
float DotProd10(float *in1, float *in2, int len);

float DotProd3s(float *in1, float *in2);
float DotProd4s(float *in1, float *in2);
float DotProd5s(float *in1, float *in2);
float DotProd10s(float *in1, float *in2);
float DotProd20s(float *in1, float *in2);

//void Line_Wr(char *, FILE *);
//int  Line_Rd(char *, FILE *);


// Extern declarations of the tables used by the SG15 LBC Coder for 6.3/5.3 kbps.
extern float HammingWindowTable[LpcFrame];
extern float BinomialWindowTable[LpcOrder];
extern float BandExpTable[LpcOrder];
extern float CosineTable[CosineTableSize];
extern float LspDcTable[LpcOrder];
extern int    BandInfoTable[LspQntBands][2];
extern float Band0Tb8[LspCbSize*3];
extern float Band1Tb8[LspCbSize*3];
extern float Band2Tb8[LspCbSize*4];
extern float *BandQntTable[LspQntBands];
extern float PerFiltZeroTable[LpcOrder];
extern float PerFiltPoleTable[LpcOrder];
extern float PostFiltZeroTable[LpcOrder];
extern float PostFiltPoleTable[LpcOrder];
extern int    Nb_puls[4];
extern float FcbkGainTable[NumOfGainLev];
extern int    MaxPosTable[4];
extern int    CombinatorialTable[MaxPulseNum][SubFrLen/Sgrid];
extern float AcbkGainTable085[85*20];
extern float AcbkGainTable170[170*20];
extern float *AcbkGainTablePtr[2];
extern float LpfConstTable[2];
extern int    epsi170[170];
extern float gain170[170];
extern float tabgain170[170];
extern float tabgain85[85];
extern float fact[4];
extern float bseg[3];
extern float base[3];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -