cvsd.h
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#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