www.pudn.com > CryptoPhone-src-031122.zip > main.h


/* Copyright 2001,2002,2003 NAH6 
 * All Rights Reserved 
 * 
 * Parts Copyright DoD, Parts Copyright Starium 
 * 
 */ 
/************************************************************************** 
*                                                                         * 
* INCLUDE FILE 
*		main.h 
* 
* FUNCTION 
*		CELP parameters and variables 
* 
**************************************************************************/ 
/* General Constants */ 
 
#define F_LEN		240		/* number of speech samples in frame	 	*/ 
#define NUM_SF		4		/* number of subframes in frame		 	*/ 
#define SF_LEN		60		/* number of speech samples in subframe	 	*/ 
#define CELP_BITS	144		/* number of bits for CELP parameters 		*/ 
 
#define ORDER		10		/* order of LP analysis			 	*/ 
 
#define LAMBDA		0		/* HF correction scale factor		 	*/ 
#define OMEGA		0.994127  	/* Bandwidth expansion for LPC analysis (15 Hz)	*/ 
#define GAMMA		0.8 
 
#define RES_LEN 	SF_LEN		/* number of residual samples in subframe 	*/ 
 
#define ANALYSIS 	11		/* for distinguishing between routines  	*/ 
#define SYNTHESIS 	22		/*   shared between analysis and synthesis 	*/ 
 
#define	TRUE		1 
#define FALSE		0 
 
/* Adaptive Codebook Constants */ 
#define	MIN_DELAY	20		/* minimum adaptvie delay 			*/ 
#define MAX_DELAY	147		/* maximum adaptive delay 			*/ 
#define MAX_ACB_TAP	3		/* number of acb taps (filter)			*/ 
#define ACB_SIZE	MAX_DELAY + SF_LEN 
#define MAX_NUM_ADAPT	256		/* maximum number of adaptive delays 		*/ 
#define	MAX_A_LEN	60		/* maximum adaptive frame length		*/ 
#define MAX_ABUF_LEN	229		/* maximum adaptive analysis buffer length	*/ 
#define	AGAIN_BITS1	8		/* adaptive gain coding bit allocation		*/ 
#define	AGAIN_BITS2	6		/* adaptive gain coding bit allocation		*/ 
#define	AGAIN_BITS3	5		/* adaptive gain coding bit allocation		*/ 
#define	AGAIN_BITS4	0		/* adaptive gain coding bit allocation		*/ 
#define	AGAIN_BITS5	0		/* adaptive gain coding bit allocation		*/ 
#define NUM_FULL_ADELAYS 256		/* 2**AGAIN_BITS1 -- number of full search pitch delays	*/ 
#define NUM_DELTA_ADELAYS 64		/* 2**AGAIN_BITS2 -- number of delta search pitch delays*/ 
#define B_PTR 		MAX_DELAY + 2*SF_LEN  
 
/*  Stochastic Codebook Constants */ 
#define MAX_STOCH_CB_SIZE 512		/* maximum stochastic code book size (number of codewords)	*/ 
#define STOCH_CB_SIZE	512		/* actual stochastic code book size 		*/ 
 
#define LOG		111 
 
#define STOCH_GAIN_BITS	5		/* code book gain bit allocation 		*/ 
#define STOCH_QUAN_TYPE LOG		/* code book gain quantizer type		*/ 
#define MAX_CW_VEC_LEN	60		/* maximum codeword vector length		*/ 
 
/* Delay constants */ 
#define MAX_M1		20	/* values for longest delay calculation */ 
#define MAX_M2		19 
#define	MAX_WINDOW_WIDTH 12*MAX_M1 + 12*(MAX_M2+1) 
#define	MAX_NFRAC	5 
 
 
/*  Quantization constants */ 
#define	LSFTABLE_LENGTH	ORDER 
#define LSFTABLE_WIDTH	16 
 
/*  Channel constants */ 
#define	CLEAR	9000 
#define	RBER	9001 
#define	RBLER	9005 
#define	OTHER	9006 
 
#define	BINARY		0x011 
#define	HEX		0x111 
#define BINARY_INT	0x101 
 
/* 
#define min(A,B)        ((A)<(B)?(A):(B)) 
#define max(A,B)        ((A)>(B)?(A):(B)) 
*/ 
 
 
 
typedef struct	{ 
	float	lsf[11]; 
	float	AdaptiveDelay[4]; 
	float	AdaptiveGain[4]; 
	int	StochasticIndex[4]; 
	float	StochasticGain[4]; 
} TX_PARAM; 
 
typedef struct	{ 
	int	lsf[10]; 
	int	AdaptiveDelay[4]; 
	int	AdaptiveGain[4]; 
	int	StochasticIndex[4]; 
	int	StochasticGain[4]; 
	int	Bishnu; 
	int	Hamming; 
	int	Sync; 
} TX_BITS; 
 
typedef struct	{ 
	int	WhoKnows; 
	short	What; 
	float	ThisShouldBe; 
} INTEGRITY;