Asterisk - The Open Source Telephony Project
18.5.0
codecs
lpc10
lpc10.h
Go to the documentation of this file.
1
/*
2
3
$Log$
4
Revision 1.18 2004/08/31 13:32:11 markster
5
Merge NetBSD and Courtesty tone with modifications (bug #2329)
6
7
Revision 1.17 2003/10/26 18:50:49 markster
8
Make it build and run on MacOS X
9
10
Revision 1.3 2003/10/26 18:50:49 markster
11
Make it build and run on MacOS X
12
13
Revision 1.2 2003/04/23 19:13:35 markster
14
More OpenBSD patches
15
16
Revision 1.1.1.2 2003/03/16 22:37:30 matteo
17
dom mar 16 23:37:23 CET 2003
18
19
Revision 1.2 2003/03/16 16:09:48 markster
20
Mere James's cleanups for fewer build warnings
21
22
Revision 1.1 2000/01/05 00:20:06 markster
23
Add broken lpc10 code... It's not too far from working I don't think...
24
25
* Revision 1.1 1996/08/19 22:47:31 jaf
26
* Initial revision
27
*
28
29
*/
30
31
#ifndef __LPC10_H__
32
#define __LPC10_H__
33
34
#define P_R_O_T_O_T_Y_P_E_S
35
36
#define LPC10_SAMPLES_PER_FRAME 180
37
#define LPC10_BITS_IN_COMPRESSED_FRAME 54
38
39
40
/*
41
42
The "#if defined"'s in this file are by no means intended to be
43
complete. They are what Nautilus uses, which has been successfully
44
compiled under DOS with the Microsoft C compiler, and under a few
45
versions of Unix with the GNU C compiler.
46
47
*/
48
49
#if defined(unix) || defined(__unix__) || defined(__NetBSD__)
50
typedef
short
INT16;
51
typedef
int
INT32;
52
#endif
53
54
55
#if defined(__MSDOS__) || defined(MSDOS)
56
typedef
int
INT16;
57
typedef
long
INT32;
58
#endif
59
60
#if defined(__APPLE__)
61
typedef
short
INT16;
62
typedef
int
INT32;
63
#endif
64
65
#if defined(WIN32) && defined(_MSC_VER)
66
typedef
__int16 INT16;
67
typedef
__int32 INT32;
68
#pragma warning(disable: 4005)
69
#endif
70
71
72
/* The initial values for every member of this structure is 0, except
73
where noted in comments. */
74
75
/* These two lines are copied from f2c.h. There should be a more
76
elegant way of doing this than having the same declarations in two
77
files. */
78
79
typedef
float
real
;
80
typedef
INT32
integer
;
81
typedef
INT32
logical
;
82
typedef
INT16
shortint
;
83
84
struct
lpc10_encoder_state
{
85
/* State used only by function hp100 */
86
real
z11
;
87
real
z21
;
88
real
z12
;
89
real
z22
;
90
91
/* State used by function analys */
92
real
inbuf
[540],
pebuf
[540];
93
real
lpbuf
[696],
ivbuf
[312];
94
real
bias
;
95
integer
osbuf
[10];
/* no initial value necessary */
96
integer
osptr
;
/* initial value 1 */
97
integer
obound
[3];
98
integer
vwin
[6]
/* was [2][3] */
;
/* initial value vwin[4] = 307; vwin[5] = 462; */
99
integer
awin
[6]
/* was [2][3] */
;
/* initial value awin[4] = 307; awin[5] = 462; */
100
integer
voibuf
[8]
/* was [2][4] */
;
101
real
rmsbuf
[3];
102
real
rcbuf
[30]
/* was [10][3] */
;
103
real
zpre
;
104
105
106
/* State used by function onset */
107
real
n
;
108
real
d__
;
/* initial value 1.f */
109
real
fpc
;
/* no initial value necessary */
110
real
l2buf
[16];
111
real
l2sum1
;
112
integer
l2ptr1
;
/* initial value 1 */
113
integer
l2ptr2
;
/* initial value 9 */
114
integer
lasti
;
/* no initial value necessary */
115
logical
hyst
;
/* initial value FALSE_ */
116
117
/* State used by function voicin */
118
real
dither
;
/* initial value 20.f */
119
real
snr
;
120
real
maxmin
;
121
real
voice
[6]
/* was [2][3] */
;
/* initial value is probably unnecessary */
122
integer
lbve
,
lbue
,
fbve
,
fbue
;
123
integer
ofbue
,
sfbue
;
124
integer
olbue
,
slbue
;
125
/* Initial values:
126
lbve = 3000;
127
fbve = 3000;
128
fbue = 187;
129
ofbue = 187;
130
sfbue = 187;
131
lbue = 93;
132
olbue = 93;
133
slbue = 93;
134
snr = (real) (fbve / fbue << 6);
135
*/
136
137
/* State used by function dyptrk */
138
real
s
[60];
139
integer
p
[120]
/* was [60][2] */
;
140
integer
ipoint
;
141
real
alphax
;
142
143
/* State used by function chanwr */
144
integer
isync
;
145
146
};
147
148
149
struct
lpc10_decoder_state
{
150
151
/* State used by function decode */
152
integer
iptold
;
/* initial value 60 */
153
logical
first
;
/* initial value TRUE_ */
154
integer
ivp2h
;
155
integer
iovoic
;
156
integer
iavgp
;
/* initial value 60 */
157
integer
erate
;
158
integer
drc[30]
/* was [3][10] */
;
159
integer
dpit[3];
160
integer
drms[3];
161
162
/* State used by function synths */
163
real
buf
[360];
164
integer
buflen
;
/* initial value 180 */
165
166
/* State used by function pitsyn */
167
integer
ivoico
;
/* no initial value necessary as long as first_pitsyn is initially TRUE_ */
168
integer
ipito
;
/* no initial value necessary as long as first_pitsyn is initially TRUE_ */
169
real
rmso
;
/* initial value 1.f */
170
real
rco[10];
/* no initial value necessary as long as first_pitsyn is initially TRUE_ */
171
integer
jsamp
;
/* no initial value necessary as long as first_pitsyn is initially TRUE_ */
172
logical
first_pitsyn
;
/* initial value TRUE_ */
173
174
/* State used by function bsynz */
175
integer
ipo
;
176
real
exc[166];
177
real
exc2[166];
178
real
lpi1
;
179
real
lpi2
;
180
real
lpi3
;
181
real
hpi1
;
182
real
hpi2
;
183
real
hpi3
;
184
real
rmso_bsynz
;
185
186
/* State used by function random */
187
integer
j
;
/* initial value 2 */
188
integer
k
;
/* initial value 5 */
189
shortint
y[5];
/* initial value { -21161,-8478,30892,-10216,16950 } */
190
191
/* State used by function deemp */
192
real
dei1
;
193
real
dei2
;
194
real
deo1
;
195
real
deo2
;
196
real
deo3
;
197
198
};
199
200
201
202
/*
203
204
Calling sequence:
205
206
Call create_lpc10_encoder_state(), which returns a pointer to an
207
already initialized lpc10_encoder_state structure.
208
209
lpc10_encode reads indices 0 through (LPC10_SAMPLES_PER_FRAME-1) of
210
array speech[], and writes indices 0 through
211
(LPC10_BITS_IN_COMPRESSED_FRAME-1) of array bits[], and both reads
212
and writes the lpc10_encoder_state structure contents. The
213
lpc10_encoder_state structure should *not* be initialized for every
214
frame of encoded speech. Once at the beginning of execution, done
215
automatically for you by create_lpc10_encoder_state(), is enough.
216
217
init_lpc10_encoder_state() reinitializes the lpc10_encoder_state
218
structure. This might be useful if you are finished processing one
219
sound sample, and want to reuse the same lpc10_encoder_state
220
structure to process another sound sample. There might be other
221
uses as well.
222
223
Note that the comments in the lpc10/lpcenc.c file imply that indices
224
1 through 180 of array speech[] are read. These comments were
225
written for the Fortran version of the code, before it was
226
automatically converted to C by the conversion program f2c. f2c
227
seems to use the convention that the pointers to arrays passed as
228
function arguments point to the first index used in the Fortran
229
code, whatever index that might be (usually 1), and then it modifies
230
the pointer inside of the function, like so:
231
232
if (speech) {
233
--speech;
234
}
235
236
So that the code can access the first value at index 1 and the last
237
at index 180. This makes the translated C code "closer" to the
238
original Fortran code.
239
240
The calling sequence for the decoder is similar to the encoder. The
241
only significant difference is that the array bits[] is read
242
(indices 0 through (LPC10_BITS_IN_COMPRESSED_FRAME-1)), and the
243
array speech[] is written (indices 0 through
244
(LPC10_SAMPLES_PER_FRAME-1)).
245
246
*/
247
248
struct
lpc10_encoder_state
*
create_lpc10_encoder_state
(
void
);
249
void
init_lpc10_encoder_state
(
struct
lpc10_encoder_state
*st);
250
int
lpc10_encode
(
real
*speech, INT32 *bits,
struct
lpc10_encoder_state
*st);
251
252
struct
lpc10_decoder_state
*
create_lpc10_decoder_state
(
void
);
253
void
init_lpc10_decoder_state
(
struct
lpc10_decoder_state
*st);
254
int
lpc10_decode
(INT32 *bits,
real
*speech,
struct
lpc10_decoder_state
*st);
255
256
#endif
/* __LPC10_H__ */
lpc10_decoder_state::hpi2
real hpi2
Definition:
lpc10.h:182
lpc10_decoder_state::deo3
real deo3
Definition:
lpc10.h:196
lpc10_encoder_state::fbve
integer fbve
Definition:
lpc10.h:122
lpc10_encoder_state::fbue
integer fbue
Definition:
lpc10.h:122
lpc10_encoder_state::olbue
integer olbue
Definition:
lpc10.h:124
lpc10_encoder_state::rcbuf
real rcbuf[30]
Definition:
lpc10.h:102
init_lpc10_encoder_state
void init_lpc10_encoder_state(struct lpc10_encoder_state *st)
Definition:
lpcini.c:272
lpc10_decoder_state::buflen
integer buflen
Definition:
lpc10.h:164
lpc10_decoder_state::erate
integer erate
Definition:
lpc10.h:157
lpc10_decoder_state::iavgp
integer iavgp
Definition:
lpc10.h:156
lpc10_encoder_state::awin
integer awin[6]
Definition:
lpc10.h:99
lpc10_encode
int lpc10_encode(real *speech, INT32 *bits, struct lpc10_encoder_state *st)
Definition:
lpcenc.c:108
buf
char buf[BUFSIZE]
Definition:
eagi_proxy.c:66
lpc10_decoder_state::first
logical first
Definition:
lpc10.h:153
lpc10_decoder_state::iptold
integer iptold
Definition:
lpc10.h:152
lpc10_encoder_state::maxmin
real maxmin
Definition:
lpc10.h:120
lpc10_decoder_state::deo1
real deo1
Definition:
lpc10.h:194
lpc10_encoder_state::lbve
integer lbve
Definition:
lpc10.h:122
lpc10_encoder_state::z12
real z12
Definition:
lpc10.h:88
lpc10_encoder_state::dither
real dither
Definition:
lpc10.h:118
lpc10_decoder_state::dei2
real dei2
Definition:
lpc10.h:193
lpc10_encoder_state::vwin
integer vwin[6]
Definition:
lpc10.h:98
lpc10_decoder_state::rmso_bsynz
real rmso_bsynz
Definition:
lpc10.h:184
lpc10_encoder_state::lpbuf
real lpbuf[696]
Definition:
lpc10.h:93
lpc10_encoder_state::l2ptr1
integer l2ptr1
Definition:
lpc10.h:112
lpc10_decoder_state::lpi3
real lpi3
Definition:
lpc10.h:180
lpc10_encoder_state::l2sum1
real l2sum1
Definition:
lpc10.h:111
lpc10_encoder_state::osbuf
integer osbuf[10]
Definition:
lpc10.h:95
lpc10_encoder_state::n
real n
Definition:
lpc10.h:107
lpc10_decoder_state::iovoic
integer iovoic
Definition:
lpc10.h:155
lpc10_decoder_state::hpi1
real hpi1
Definition:
lpc10.h:181
lpc10_encoder_state::slbue
integer slbue
Definition:
lpc10.h:124
create_lpc10_decoder_state
struct lpc10_decoder_state * create_lpc10_decoder_state(void)
Definition:
lpcini.c:369
lpc10_encoder_state::sfbue
integer sfbue
Definition:
lpc10.h:123
lpc10_encoder_state::p
integer p[120]
Definition:
lpc10.h:139
lpc10_decoder_state::dei1
real dei1
Definition:
lpc10.h:192
lpc10_encoder_state::rmsbuf
real rmsbuf[3]
Definition:
lpc10.h:101
lpc10_encoder_state::obound
integer obound[3]
Definition:
lpc10.h:97
lpc10_encoder_state::inbuf
real inbuf[540]
Definition:
lpc10.h:92
lpc10_decoder_state::lpi2
real lpi2
Definition:
lpc10.h:179
lpc10_decoder_state::k
integer k
Definition:
lpc10.h:188
lpc10_encoder_state::hyst
logical hyst
Definition:
lpc10.h:115
lpc10_decode
int lpc10_decode(INT32 *bits, real *speech, struct lpc10_decoder_state *st)
Definition:
lpcdec.c:113
lpc10_encoder_state::bias
real bias
Definition:
lpc10.h:94
lpc10_encoder_state::fpc
real fpc
Definition:
lpc10.h:109
lpc10_encoder_state::voibuf
integer voibuf[8]
Definition:
lpc10.h:100
lpc10_decoder_state::ipo
integer ipo
Definition:
lpc10.h:175
lpc10_encoder_state::pebuf
real pebuf[540]
Definition:
lpc10.h:92
real
float real
Definition:
lpc10.h:79
lpc10_encoder_state::lasti
integer lasti
Definition:
lpc10.h:114
lpc10_encoder_state::lbue
integer lbue
Definition:
lpc10.h:122
lpc10_decoder_state::rmso
real rmso
Definition:
lpc10.h:169
lpc10_encoder_state::zpre
real zpre
Definition:
lpc10.h:103
lpc10_encoder_state::alphax
real alphax
Definition:
lpc10.h:141
lpc10_decoder_state::ivp2h
integer ivp2h
Definition:
lpc10.h:154
lpc10_encoder_state::z21
real z21
Definition:
lpc10.h:87
lpc10_encoder_state::voice
real voice[6]
Definition:
lpc10.h:121
lpc10_encoder_state::ivbuf
real ivbuf[312]
Definition:
lpc10.h:93
create_lpc10_encoder_state
struct lpc10_encoder_state * create_lpc10_encoder_state(void)
Definition:
lpcini.c:258
lpc10_decoder_state::j
integer j
Definition:
lpc10.h:187
lpc10_decoder_state::ipito
integer ipito
Definition:
lpc10.h:168
lpc10_decoder_state::lpi1
real lpi1
Definition:
lpc10.h:178
lpc10_encoder_state::isync
integer isync
Definition:
lpc10.h:144
lpc10_encoder_state::osptr
integer osptr
Definition:
lpc10.h:96
lpc10_encoder_state::z11
real z11
Definition:
lpc10.h:86
lpc10_encoder_state::ofbue
integer ofbue
Definition:
lpc10.h:123
lpc10_encoder_state::l2buf
real l2buf[16]
Definition:
lpc10.h:110
lpc10_encoder_state
Definition:
lpc10.h:84
lpc10_encoder_state::l2ptr2
integer l2ptr2
Definition:
lpc10.h:113
lpc10_encoder_state::s
real s[60]
Definition:
lpc10.h:138
lpc10_encoder_state::z22
real z22
Definition:
lpc10.h:89
lpc10_decoder_state
Definition:
lpc10.h:149
lpc10_decoder_state::deo2
real deo2
Definition:
lpc10.h:195
lpc10_decoder_state::first_pitsyn
logical first_pitsyn
Definition:
lpc10.h:172
lpc10_decoder_state::jsamp
integer jsamp
Definition:
lpc10.h:171
lpc10_encoder_state::snr
real snr
Definition:
lpc10.h:119
lpc10_decoder_state::hpi3
real hpi3
Definition:
lpc10.h:183
logical
INT32 logical
Definition:
lpc10.h:81
shortint
INT16 shortint
Definition:
lpc10.h:82
lpc10_decoder_state::ivoico
integer ivoico
Definition:
lpc10.h:167
init_lpc10_decoder_state
void init_lpc10_decoder_state(struct lpc10_decoder_state *st)
Definition:
lpcini.c:383
lpc10_encoder_state::ipoint
integer ipoint
Definition:
lpc10.h:140
integer
INT32 integer
Definition:
lpc10.h:80
lpc10_encoder_state::d__
real d__
Definition:
lpc10.h:108
Generated on Sun Aug 8 2021 19:43:51 for Asterisk - The Open Source Telephony Project by
1.8.13