1 /*
2
3 * Revision 1.2 1996/08/20 20:31:21 jaf
4 * Removed all static local variables that were SAVE'd in the Fortran
5 * code, and put them in struct lpc10_encoder_state that is passed as an
6 * argument.
7 *
8 * Removed init function, since all initialization is now done in
9 * init_lpc10_encoder_state().
10 *
11 * Changed name of function from lpcenc_ to lpc10_encode, simply to make
12 * all lpc10 functions have more consistent naming with each other.
13 *
14 * Revision 1.1 1996/08/19 22:31:44 jaf
15 * Initial revision
16 *
17
18 */
19
20 /* -- translated by f2c (version 19951025).
21 You must link the resulting object file with the libraries:
22 -lf2c -lm (in that order)
23 */
24
25 #include "f2c.h"
26
27 extern int lpcenc_(real *speech, integer *bits);
28 extern int initlpcenc_(void);
29
30 /* Table of constant values */
31
32 static integer c__180 = 180;
33 static integer c__10 = 10;
34
35 /* ***************************************************************** */
36
37 /*
38 * Revision 1.2 1996/08/20 20:31:21 jaf
39 * Removed all static local variables that were SAVE'd in the Fortran
40 * code, and put them in struct lpc10_encoder_state that is passed as an
41 * argument.
42 *
43 * Removed init function, since all initialization is now done in
44 * init_lpc10_encoder_state().
45 *
46 * Changed name of function from lpcenc_ to lpc10_encode, simply to make
47 * all lpc10 functions have more consistent naming with each other.
48 *
49 * Revision 1.1 1996/08/19 22:31:44 jaf
50 * Initial revision
51 * */
52 /* Revision 1.2 1996/03/28 00:01:22 jaf */
53 /* Commented out some trace statements. */
54
55 /* Revision 1.1 1996/03/28 00:00:27 jaf */
56 /* Initial revision */
57
58
59 /* ***************************************************************** */
60
61 /* Encode one frame of 180 speech samples to 54 bits. */
62
63 /* Input: */
64 /* SPEECH - Speech encoded as real values in the range [-1,+1]. */
65 /* Indices 1 through 180 read, and modified (by PREPRO). */
66 /* Output: */
67 /* BITS - 54 encoded bits, stored 1 per array element. */
68 /* Indices 1 through 54 written. */
69
70 /* This subroutine maintains local state from one call to the next. If */
71 /* you want to switch to using a new audio stream for this filter, or */
72 /* reinitialize its state for any other reason, call the ENTRY */
73 /* INITLPCENC. */
74
lpc10_encode(real * speech,integer * bits,struct lpc10_encoder_state * st)75 /* Subroutine */ int lpc10_encode(real *speech, integer *bits,
76 struct lpc10_encoder_state *st)
77 {
78 integer irms, voice[2], pitch, ipitv;
79 real rc[10];
80 extern /* Subroutine */ int encode_(integer *, integer *, real *, real *,
81 integer *, integer *, integer *), chanwr_(integer *, integer *,
82 integer *, integer *, integer *, struct lpc10_encoder_state *),
83 analys_(real *, integer *,
84 integer *, real *, real *, struct lpc10_encoder_state *),
85 prepro_(real *, integer *, struct lpc10_encoder_state *);
86 integer irc[10];
87 real rms;
88
89 /* Arguments */
90
91 /* LPC Configuration parameters: */
92 /* Frame size, Prediction order, Pitch period */
93 /* Local variables that need not be saved */
94 /* Uncoded speech parameters */
95 /* Coded speech parameters */
96 /* Local state */
97 /* None */
98 /* Parameter adjustments */
99 if (speech) {
100 --speech;
101 }
102 if (bits) {
103 --bits;
104 }
105
106 /* Function Body */
107 prepro_(&speech[1], &c__180, st);
108 analys_(&speech[1], voice, &pitch, &rms, rc, st);
109 encode_(voice, &pitch, &rms, rc, &ipitv, &irms, irc);
110 chanwr_(&c__10, &ipitv, &irms, irc, &bits[1], st);
111 return 0;
112 } /* lpcenc_ */
113