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