Asterisk - The Open Source Telephony Project GIT-master-7e7a603
iLBC_define.h
Go to the documentation of this file.
1
2 /******************************************************************
3
4 iLBC Speech Coder ANSI-C Source Code
5
6 iLBC_define.h
7
8 Copyright (C) The Internet Society (2004).
9 All Rights Reserved.
10
11 ******************************************************************/
12 #include <string.h>
13
14 #ifndef __iLBC_ILBCDEFINE_H
15 #define __iLBC_ILBCDEFINE_H
16
17 /* general codec settings */
18
19 #define BLOCKL_20MS 160
20 #define BLOCKL_30MS 240
21 #define BLOCKL_MAX 240
22 #define NSUB_20MS 4
23 #define NSUB_30MS 6
24 #define NSUB_MAX 6
25 #define NASUB_20MS 2
26
27
28
29
30
31 #define NASUB_30MS 4
32 #define NASUB_MAX 4
33 #define SUBL 40
34 #define STATE_LEN 80
35 #define STATE_SHORT_LEN_30MS 58
36 #define STATE_SHORT_LEN_20MS 57
37
38 /* LPC settings */
39
40 #define LPC_FILTERORDER 10
41 #define LPC_CHIRP_SYNTDENUM (float)0.9025
42 #define LPC_CHIRP_WEIGHTDENUM (float)0.4222
43 #define LPC_LOOKBACK 60
44 #define LPC_N_20MS 1
45 #define LPC_N_30MS 2
46 #define LPC_N_MAX 2
47 #define LPC_ASYMDIFF 20
48 #define LPC_BW (float)60.0
49 #define LPC_WN (float)1.0001
50 #define LSF_NSPLIT 3
51 #define LSF_NUMBER_OF_STEPS 4
52 #define LPC_HALFORDER (LPC_FILTERORDER/2)
53
54 /* cb settings */
55
56 #define CB_NSTAGES 3
57 #define CB_EXPAND 2
58 #define CB_MEML 147
59 #define CB_FILTERLEN 2*4
60 #define CB_HALFFILTERLEN 4
61 #define CB_RESRANGE 34
62 #define CB_MAXGAIN (float)1.3
63
64 /* enhancer */
65
66 #define ENH_BLOCKL 80 /* block length */
67 #define ENH_BLOCKL_HALF (ENH_BLOCKL/2)
68 #define ENH_HL 3 /* 2*ENH_HL+1 is number blocks
69 in said second sequence */
70 #define ENH_SLOP 2 /* max difference estimated and
71 correct pitch period */
72 #define ENH_PLOCSL 20 /* pitch-estimates and pitch-
73 locations buffer length */
74 #define ENH_OVERHANG 2
75 #define ENH_UPS0 4 /* upsampling rate */
76 #define ENH_FL0 3 /* 2*FLO+1 is the length of
77 each filter */
78 #define ENH_VECTL (ENH_BLOCKL+2*ENH_FL0)
79
84 #define ENH_CORRDIM (2*ENH_SLOP+1)
85 #define ENH_NBLOCKS (BLOCKL_MAX/ENH_BLOCKL)
86 #define ENH_NBLOCKS_EXTRA 5
87 #define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS +
88 ENH_NBLOCKS_EXTRA */
89 #define ENH_BUFL (ENH_NBLOCKS_TOT)*ENH_BLOCKL
90 #define ENH_ALPHA0 (float)0.05
92 /* Down sampling */
93
94 #define FILTERORDER_DS 7
95 #define DELAY_DS 3
96 #define FACTOR_DS 2
98 /* bit stream defs */
100 #define NO_OF_BYTES_20MS 38
101 #define NO_OF_BYTES_30MS 50
102 #define NO_OF_WORDS_20MS 19
103 #define NO_OF_WORDS_30MS 25
104 #define STATE_BITS 3
105 #define BYTE_LEN 8
106 #define ULP_CLASSES 3
108 /* help parameters */
110 #define FLOAT_MAX (float)1.0e37
111 #define EPS (float)2.220446049250313e-016
112 #define PI (float)3.14159265358979323846
113 #define MIN_SAMPLE -32768
114 #define MAX_SAMPLE 32767
115 #define TWO_PI (float)6.283185307
116 #define PI2 (float)0.159154943
118 /* type definition encoder instance */
119 typedef struct iLBC_ULP_Inst_t_ {
130
131 /* type definition encoder instance */
133
134
136
137 typedef struct iLBC_Enc_Inst_t_ {
139 /* flag for frame size mode */
140 int mode;
142 /* basic parameters for different frame sizes */
144 int nsub;
145 int nasub;
147 int lpc_n;
148 int state_short_len;
151 /* analysis filter state */
152 float anaMem[LPC_FILTERORDER];
153
154 /* old lsf parameters for interpolation */
155 float lsfold[LPC_FILTERORDER];
158 /* signal buffer for LP analysis */
160
161 /* state of input HP filter */
162 float hpimem[4];
163
166 /* type definition decoder instance */
167 typedef struct iLBC_Dec_Inst_t_ {
169 /* flag for frame size mode */
170 int mode;
172 /* basic parameters for different frame sizes */
174 int nsub;
175 int nasub;
177 int lpc_n;
178 int state_short_len;
180
181 /* synthesis filter state */
183
184 /* old LSF for interpolation */
186
187
189
192 /* pitch lag estimated in enhancer and used in PLC */
195 /* PLC state information */
197 float prevLpc[LPC_FILTERORDER+1];
199 float per;
200 unsigned long seed;
202 /* previous synthesis filter parameters */
205 /* state of output HP filter */
206 float hpomem[4];
207
208 /* enhancer state information */
209 int use_enhancer;
210 float enh_buf[ENH_BUFL];
212
214
215 #endif
#define LPC_LOOKBACK
Definition: iLBC_define.h:43
struct iLBC_Dec_Inst_t_ iLBC_Dec_Inst_t
#define BLOCKL_MAX
Definition: iLBC_define.h:21
#define CB_NSTAGES
Definition: iLBC_define.h:56
struct iLBC_ULP_Inst_t_ iLBC_ULP_Inst_t
#define SUBL
Definition: iLBC_define.h:33
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
#define NSUB_MAX
Definition: iLBC_define.h:24
#define ENH_BUFL
Definition: iLBC_define.h:84
#define ENH_NBLOCKS_TOT
Definition: iLBC_define.h:83
struct iLBC_Enc_Inst_t_ iLBC_Enc_Inst_t
#define ULP_CLASSES
Definition: iLBC_define.h:101
float old_syntdenum[(LPC_FILTERORDER+1) *NSUB_MAX]
Definition: iLBC_define.h:198
const iLBC_ULP_Inst_t * ULP_inst
Definition: iLBC_define.h:174
float syntMem[LPC_FILTERORDER]
Definition: iLBC_define.h:177
float enh_buf[ENH_BUFL]
Definition: iLBC_define.h:205
unsigned long seed
Definition: iLBC_define.h:195
float enh_period[ENH_NBLOCKS_TOT]
Definition: iLBC_define.h:206
float prevResidual[NSUB_MAX *SUBL]
Definition: iLBC_define.h:193
float prevLpc[LPC_FILTERORDER+1]
Definition: iLBC_define.h:192
float lsfdeqold[LPC_FILTERORDER]
Definition: iLBC_define.h:185
const iLBC_ULP_Inst_t * ULP_inst
Definition: iLBC_define.h:144
float lsfold[LPC_FILTERORDER]
Definition: iLBC_define.h:150
float anaMem[LPC_FILTERORDER]
Definition: iLBC_define.h:147
float lpc_buffer[LPC_LOOKBACK+BLOCKL_MAX]
Definition: iLBC_define.h:154
float lsfdeqold[LPC_FILTERORDER]
Definition: iLBC_define.h:151
int scale_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:118
int extra_cb_index[CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:120
int lsf_bits[6][ULP_CLASSES+2]
Definition: iLBC_define.h:115
int startfirst_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:117
int cb_index[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:122
int cb_gain[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:123
int extra_cb_gain[CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:121
int start_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:116
int state_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:119