📄 g723api.h
字号:
/***************************************************************************/
/* File Name: g723api.h */
/* Function: defines the application programming interface (API) of */
/* the G.723.1 Compliant Speech coder */
/* Copyright (C) 1996-98 MiBridge Inc */
/***************************************************************************/
#ifndef __g723api__
#define __g723api__
//#include <windows.h>
#define G723_FRAMESIZE 240
#define G723_53_PACKSIZE 20
#define G723_63_PACKSIZE 24
#define G723_INITIALIZE 0
#define G723_INIT_ENCODE 1
#define G723_INIT_DECODE 2
#define G723_INIT_MIBRIDGE 3
#define G723_53_ENCODER 4
#define G723_63_ENCODER 5
#define G723_NOISE_ENCODER 6
#define G723_DECODER 7
/* Intel Suggestion - macro for doing integer compare */
/* on floating point numbers */
#define asint(x) (*(int *)&(x))
/* Ray's li'l debug corner */
/* #define T_CODE1 */ /* enable Estim_Pitch() monitor */
/* #define T_CODE2 */ /* enable Loop_Srch() monitor */
/* #define T_CODE3 */ /* enable DotProd() monitor */
/* #define T_CODE4 */ /* enable Lpc() monitor */
/* #define T_CODE5 */ /* enable Main_Loop() monitor */
/* #define T_CODE6 */ /* enable Find_Best() monitor */
#define USEHP /* Hardwires HPF into algorithm */
#define USEPF /* Hardwires PF into algorithm */
#define NOCLIP /* Don't count clips */
#define False 0
#define True 1
/* Definition of the working mode */
enum Wmode {Both, Cod, Dec};
/* Coder rate */
enum Crate {Rate63, Rate53};
/* Coder global constants */
#define Frame 240
#define LpcFrame 180
#define SubFrames 4
#define SubFrLen (Frame/SubFrames)
/* LPC constants */
#define LpcOrder 10
#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 PitchMin 18
#define PitchMax (PitchMin+127)
#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
#define Inf 1.0e38
/* Gain constant */
#define NumOfGainLev 24
/* FER constant */
#define ErrMaxNum 3
/* Taming constants */
#define NbFilt085_min 51
#define NbFilt170_min 93
#define SizErr 5
#define Err0 0.00000381464f
#define ThreshErr 128.0f
#define MAXV 256.0f
/* Used structures */
typedef struct {
/* High pass variables */
float HpfZdl;
float HpfPdl;
/* Lsp previos vector */
float PrevLsp[LpcOrder];
/* All pitch operation buffers */
float PrevWgt[PitchMax];
float PrevErr[PitchMax];
float PrevExc[PitchMax];
/* Requered memory for the delay */
float PrevDat[LpcFrame-SubFrLen];
/* Used delay lines */
float WghtFirDl[LpcOrder];
float WghtIirDl[LpcOrder];
float RingFirDl[LpcOrder];
float RingIirDl[LpcOrder];
float pamp_64[NumOfGainLev][SubFrLen];
/* For taming procedure */
int SinDet;
float Err[SizErr];
int ResetFlag;
} CODSTATDEF;
typedef struct {
int Ecount;
float InterGain;
int InterIndx;
unsigned short Rseed;
unsigned short seed[2];
float Park;
float Gain;
/* Lsp previous vector */
float PrevLsp[LpcOrder];
/* All pitch operation buffers */
float PrevExc[PitchMax];
/* Used delay lines */
float SyntIirDl[LpcOrder];
float PostFirDl[LpcOrder];
float PostIirDl[LpcOrder];
} DECSTATDEF ;
typedef struct {
CODSTATDEF encstate;
DECSTATDEF decstate;
float pamp_64[NumOfGainLev][SubFrLen];
} g723Mem;
/* subframe coded parameters */
typedef struct {
int AcLg;
int AcGn;
int Mamp;
int Grid;
int Tran;
int Pamp;
unsigned int Ppos;
} SFSDEF;
/* frame coded parameters */
typedef struct {
int Crc;
unsigned int LspId;
int Olp[SubFrames/2];
SFSDEF Sfs[SubFrames];
} LINEDEF;
/* harmonic noise shaping filter parameters */
typedef struct {
int Indx;
float Gain;
} PWDEF;
/* pitch postfilter parameters */
typedef struct {
int Indx;
float Gain;
float ScGn;
} PFDEF;
/* best excitation vector parameters for the high rate */
typedef struct {
float MaxErr;
int GridId;
int MampId;
int UseTrn;
int Ploc[MaxPulseNum];
float Pamp[MaxPulseNum];
} BESTDEF;
extern int g723(g723Mem *mem, short *SamBuf,char *BSbuf,int mode, int quality);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -