1 /*
2
3 $Log$
4 Revision 1.2 2006/08/01 13:06:50 rjongbloed
5 Added a raft of unvalidated audio codecs from OpenH323 tree
6
7 Revision 1.1.2.1 2006/07/22 14:03:17 rjongbloed
8 Added more plug ins
9
10 Revision 1.1.2.1 2006/05/08 13:49:57 rjongbloed
11 Imported all the audio codec plug ins from OpenH323
12
13 Revision 1.1 2004/05/04 11:16:43 csoutheren
14 Initial version
15
16 Revision 1.1 2000/06/05 04:45:12 robertj
17 Added LPC-10 2400bps codec
18
19 * Revision 1.2 1996/08/20 20:31:21 jaf
20 * Removed all static local variables that were SAVE'd in the Fortran
21 * code, and put them in struct lpc10_encoder_state that is passed as an
22 * argument.
23 *
24 * Removed init function, since all initialization is now done in
25 * init_lpc10_encoder_state().
26 *
27 * Changed name of function from lpcenc_ to lpc10_encode, simply to make
28 * all lpc10 functions have more consistent naming with each other.
29 *
30 * Revision 1.1 1996/08/19 22:31:44 jaf
31 * Initial revision
32 *
33
34 */
35
36 #ifdef P_R_O_T_O_T_Y_P_E_S
37 extern int lpcenc_(real *speech, integer *bits);
38 extern int initlpcenc_(void);
39 /*:ref: prepro_ 14 2 6 4 */
40 /*:ref: analys_ 14 5 6 4 4 6 6 */
41 /*:ref: encode_ 14 7 4 4 6 6 4 4 4 */
42 /*:ref: chanwr_ 14 5 4 4 4 4 4 */
43 /*:ref: initprepro_ 14 0 */
44 /*:ref: initanalys_ 14 0 */
45 #endif
46
47 /* -- translated by f2c (version 19951025).
48 You must link the resulting object file with the libraries:
49 -lf2c -lm (in that order)
50 */
51
52 #include "f2c.h"
53
54 /* Table of constant values */
55
56 static integer c__180 = 180;
57 static integer c__10 = 10;
58
59 /* ***************************************************************** */
60
61 /* $Log$
62 /* Revision 1.2 2006/08/01 13:06:50 rjongbloed
63 /* Added a raft of unvalidated audio codecs from OpenH323 tree
64 /*
65 /* Revision 1.1.2.1 2006/07/22 14:03:17 rjongbloed
66 /* Added more plug ins
67 /*
68 /* Revision 1.1.2.1 2006/05/08 13:49:57 rjongbloed
69 /* Imported all the audio codec plug ins from OpenH323
70 /*
71 /* Revision 1.1 2004/05/04 11:16:43 csoutheren
72 /* Initial version
73 /*
74 /* Revision 1.1 2000/06/05 04:45:12 robertj
75 /* Added LPC-10 2400bps codec
76 /*
77 * Revision 1.2 1996/08/20 20:31:21 jaf
78 * Removed all static local variables that were SAVE'd in the Fortran
79 * code, and put them in struct lpc10_encoder_state that is passed as an
80 * argument.
81 *
82 * Removed init function, since all initialization is now done in
83 * init_lpc10_encoder_state().
84 *
85 * Changed name of function from lpcenc_ to lpc10_encode, simply to make
86 * all lpc10 functions have more consistent naming with each other.
87 *
88 * Revision 1.1 1996/08/19 22:31:44 jaf
89 * Initial revision
90 * */
91 /* Revision 1.2 1996/03/28 00:01:22 jaf */
92 /* Commented out some trace statements. */
93
94 /* Revision 1.1 1996/03/28 00:00:27 jaf */
95 /* Initial revision */
96
97
98 /* ***************************************************************** */
99
100 /* Encode one frame of 180 speech samples to 54 bits. */
101
102 /* Input: */
103 /* SPEECH - Speech encoded as real values in the range [-1,+1]. */
104 /* Indices 1 through 180 read, and modified (by PREPRO). */
105 /* Output: */
106 /* BITS - 54 encoded bits, stored 1 per array element. */
107 /* Indices 1 through 54 written. */
108
109 /* This subroutine maintains local state from one call to the next. If */
110 /* you want to switch to using a new audio stream for this filter, or */
111 /* reinitialize its state for any other reason, call the ENTRY */
112 /* INITLPCENC. */
113
lpc10_encode(real * speech,integer * bits,struct lpc10_encoder_state * st)114 /* Subroutine */ int lpc10_encode(real *speech, integer *bits,
115 struct lpc10_encoder_state *st)
116 {
117 integer irms, voice[2], pitch, ipitv;
118 real rc[10];
119 extern /* Subroutine */ int encode_(integer *, integer *, real *, real *,
120 integer *, integer *, integer *), chanwr_(integer *, integer *,
121 integer *, integer *, integer *, struct lpc10_encoder_state *),
122 analys_(real *, integer *,
123 integer *, real *, real *, struct lpc10_encoder_state *),
124 prepro_(real *, integer *, struct lpc10_encoder_state *);
125 integer irc[10];
126 real rms;
127
128 /* Arguments */
129 /* $Log$
130 /* Revision 1.2 2006/08/01 13:06:50 rjongbloed
131 /* Added a raft of unvalidated audio codecs from OpenH323 tree
132 /*
133 /* Revision 1.1.2.1 2006/07/22 14:03:17 rjongbloed
134 /* Added more plug ins
135 /*
136 /* Revision 1.1.2.1 2006/05/08 13:49:57 rjongbloed
137 /* Imported all the audio codec plug ins from OpenH323
138 /*
139 /* Revision 1.1 2004/05/04 11:16:43 csoutheren
140 /* Initial version
141 /*
142 /* Revision 1.1 2000/06/05 04:45:12 robertj
143 /* Added LPC-10 2400bps codec
144 /*
145 * Revision 1.2 1996/08/20 20:31:21 jaf
146 * Removed all static local variables that were SAVE'd in the Fortran
147 * code, and put them in struct lpc10_encoder_state that is passed as an
148 * argument.
149 *
150 * Removed init function, since all initialization is now done in
151 * init_lpc10_encoder_state().
152 *
153 * Changed name of function from lpcenc_ to lpc10_encode, simply to make
154 * all lpc10 functions have more consistent naming with each other.
155 *
156 * Revision 1.1 1996/08/19 22:31:44 jaf
157 * Initial revision
158 * */
159 /* Revision 1.3 1996/03/29 22:03:47 jaf */
160 /* Removed definitions for any constants that were no longer used. */
161
162 /* Revision 1.2 1996/03/26 19:34:33 jaf */
163 /* Added comments indicating which constants are not needed in an */
164 /* application that uses the LPC-10 coder. */
165
166 /* Revision 1.1 1996/02/07 14:43:51 jaf */
167 /* Initial revision */
168
169 /* LPC Configuration parameters: */
170 /* Frame size, Prediction order, Pitch period */
171 /* Local variables that need not be saved */
172 /* Uncoded speech parameters */
173 /* Coded speech parameters */
174 /* Local state */
175 /* None */
176 /* Parameter adjustments */
177 if (speech) {
178 --speech;
179 }
180 if (bits) {
181 --bits;
182 }
183
184 /* Function Body */
185 prepro_(&speech[1], &c__180, st);
186 analys_(&speech[1], voice, &pitch, &rms, rc, st);
187 encode_(voice, &pitch, &rms, rc, &ipitv, &irms, irc);
188 chanwr_(&c__10, &ipitv, &irms, irc, &bits[1], st);
189 return 0;
190 } /* lpcenc_ */
191