cvsd.h 1.84 KB
#ifndef	__CVSD_H__
#define	__CVSD_H__


#define __CVSD_TEXT//		__attribute__ ((section (".internal_ram_1_text")))


#define	CVSD_CODEC_BY_OPTEK	//note: need change lib file

#ifdef RF_USE_RDA5876    
#define	CVSD_CODEC_BY_OPTEK	//note: cvsd in RF RDA5876 must codec by optek  
#endif


#define	RDA_CVSD_PATCH

#define	CVSD_BUF_ALLOC_DYNAMIC


//#define	CVSD_ENCODE_SEND_CAP_FILE
//#define	CVSD_DECODE_CAP_FILE

/*
#define	CVSD_64K_10MS_BYTES				80		// 640 samples,  1 bit per sample
#define	HFP_PCM_8K_10MS_BYTES			(80*2)	// 80 samples, 16bits per sample
#define	MIC_PCM_32K_10MS_STEREO_BYTES	(32*10*4)

#define	AEC_PCM_8K_10MS_SAMPLES			80		// 8x10

#define	CVSD_64K_10MS_SAMPLES			640
#define	MIC_PCM_32K_10MS_SAMPLES		(32*10)
*/

// not enough space for 10ms/7.5ms, try 5ms
#if	1
#define	CVSD_64K_10MS_BYTES				40		// 640 samples,  1 bit per sample
#define	HFP_PCM_8K_10MS_BYTES			(40*2)	// 80 samples, 16bits per sample
#define	MIC_PCM_32K_10MS_STEREO_BYTES	(32*5*4)	// 32x7.5x4

#define	AEC_PCM_8K_10MS_SAMPLES			40		// 8x10

#define	CVSD_64K_10MS_SAMPLES			320
#define	MIC_PCM_32K_10MS_SAMPLES		(32*5)
#endif

#if	0
// 2.5ms
#define	CVSD_64K_10MS_BYTES				20		// 640 samples,  1 bit per sample
#define	HFP_PCM_8K_10MS_BYTES			(20*2)	// 80 samples, 16bits per sample
#define	MIC_PCM_32K_10MS_STEREO_BYTES	(80*4)	// 32x2.5x4

#define	AEC_PCM_8K_10MS_SAMPLES			20		// 8x10

#define	CVSD_64K_10MS_SAMPLES			160
#define	MIC_PCM_32K_10MS_SAMPLES		(80)	// 32*2.5
#endif


int cvsd_decInit(void);
//int cvsd_getDecodeOutBytes( int inbytes );	// 16 x

/*
	all size are byte size
*/
int cvsd_decode(U8 *in, int insize, I16 *out, int outbufsize, int *outsize );


int cvsd_encInit(void);

/*
	all size are byte size
	note: (insize % (8*2) ) = 0
*/
int cvsd_encode(I16 *in, int insize, U8 *out, int outbufsize, int *outsize );


// for test
int cvsd_read( U8 *data, int bytes );


#endif