www.pudn.com > g7231codec.rar > cst_lbc.h
/*
**
** File: "cst_lbc.h"
**
** Description: This file contains global definition of the SG15
** LBC Coder for 6.3/5.3 kbps.
**
*/
/*
ITU-T G.723 Speech Coder ANSI-C Source Code Version 4.1
copyright (c) 1995, AudioCodes, DSP Group, France Telecom,
Universite de Sherbrooke. All rights reserved.
*/
#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 (short) 0xc000 /* -0.25*2 */
#define LspPrd0 12288
#define LspPrd1 23552
#define LspQntBands 3
#define LspCbSize 256
#define LspCbBits 8
/* LTP constants */
#define PitchMin 18
#define PitchMax (PitchMin+127)
#define PwConst (short) 0x2800
#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 16384 /* 0.5 = 16384 in Q15 */
#define max_time 120
/* 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 (int)4 /* scaling factor */
#define ThreshErr 0x40000000L
#define DEC (30 - 7)
/*
Used structures
*/
typedef struct {
/* High pass variables */
short HpfZdl ;
int HpfPdl ;
/* Sine wave detector */
short SinDet ;
/* Lsp previous vector */
short PrevLsp[LpcOrder] ;
/* All pitch operation buffers */
short PrevWgt[PitchMax] ;
short PrevErr[PitchMax] ;
short PrevExc[PitchMax] ;
/* Required memory for the delay */
short PrevDat[LpcFrame-SubFrLen] ;
/* Used delay lines */
short WghtFirDl[LpcOrder] ;
short WghtIirDl[LpcOrder] ;
short RingFirDl[LpcOrder] ;
short RingIirDl[LpcOrder] ;
/* Taming procedure errors */
int Err[SizErr];
} CODSTATDEF ;
typedef struct {
short Ecount ;
short InterGain ;
short InterIndx ;
short Rseed ;
short Park ;
short Gain ;
/* Lsp previous vector */
short PrevLsp[LpcOrder] ;
/* All pitch operation buffers */
short PrevExc[PitchMax] ;
/* Used delay lines */
short SyntIirDl[LpcOrder] ;
short PostFirDl[LpcOrder] ;
short PostIirDl[LpcOrder] ;
} DECSTATDEF ;
/* subframe coded parameters */
typedef struct {
short AcLg ;
short AcGn ;
short Mamp ;
short Grid ;
short Tran ;
short Pamp ;
int Ppos ;
} SFSDEF ;
/* frame coded parameters */
typedef struct {
short Crc ;
int LspId ;
short Olp[SubFrames/2] ;
SFSDEF Sfs[SubFrames] ;
} LINEDEF ;
/* harmonic noise shaping filter parameters */
typedef struct {
short Indx ;
short Gain ;
} PWDEF ;
/* pitch postfilter parameters */
typedef struct {
short Indx ;
short Gain ;
short ScGn ;
} PFDEF ;
/* best excitation vector parameters for the high rate */
typedef struct {
int MaxErr ;
short GridId ;
short MampId ;
short UseTrn ;
short Ploc[MaxPulseNum] ;
short Pamp[MaxPulseNum] ;
} BESTDEF ;