Let's also include aclocal.m4
[asterisk-bristuff.git] / codecs / lpc10 / mload.c
blob1cdb0647c06f927aea75e875e96af73aac164ddd
1 /*
3 $Log$
4 Revision 1.15 2004/06/26 03:50:14 markster
5 Merge source cleanups (bug #1911)
7 Revision 1.14 2003/02/12 13:59:15 matteo
8 mer feb 12 14:56:57 CET 2003
10 Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11 mer feb 12 14:56:57 CET 2003
13 Revision 1.2 2000/01/05 08:20:39 markster
14 Some OSS fixes and a few lpc changes to make it actually work
16 * Revision 1.1 1996/08/19 22:31:25 jaf
17 * Initial revision
22 /* -- translated by f2c (version 19951025).
23 You must link the resulting object file with the libraries:
24 -lf2c -lm (in that order)
27 #include "f2c.h"
29 #ifdef P_R_O_T_O_T_Y_P_E_S
30 extern int mload_(integer *order, integer *awins, integer *awinf, real *speech, real *phi, real *psi);
31 #endif
33 /* ***************************************************************** */
35 /* MLOAD Version 48 */
37 /* $Log$
38 * Revision 1.15 2004/06/26 03:50:14 markster
39 * Merge source cleanups (bug #1911)
41 * Revision 1.14 2003/02/12 13:59:15 matteo
42 * mer feb 12 14:56:57 CET 2003
44 * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
45 * mer feb 12 14:56:57 CET 2003
47 * Revision 1.2 2000/01/05 08:20:39 markster
48 * Some OSS fixes and a few lpc changes to make it actually work
50 * Revision 1.1 1996/08/19 22:31:25 jaf
51 * Initial revision
52 * */
53 /* Revision 1.5 1996/03/27 23:59:51 jaf */
54 /* Added some more accurate comments about which indices of the argument */
55 /* array SPEECH are read. I thought that this might be the cause of a */
56 /* problem I've been having, but it isn't. */
58 /* Revision 1.4 1996/03/26 19:16:53 jaf */
59 /* Commented out the code at the end that copied the lower triangular */
60 /* half of PHI into the upper triangular half (making the resulting */
61 /* matrix symmetric). The upper triangular half was never used by later */
62 /* code in subroutine ANALYS. */
64 /* Revision 1.3 1996/03/18 21:16:00 jaf */
65 /* Just added a few comments about which array indices of the arguments */
66 /* are used, and mentioning that this subroutine has no local state. */
68 /* Revision 1.2 1996/03/13 16:47:41 jaf */
69 /* Comments added explaining that none of the local variables of this */
70 /* subroutine need to be saved from one invocation to the next. */
72 /* Revision 1.1 1996/02/07 14:48:01 jaf */
73 /* Initial revision */
76 /* ***************************************************************** */
78 /* Load a covariance matrix. */
80 /* Input: */
81 /* ORDER - Analysis order */
82 /* AWINS - Analysis window start */
83 /* AWINF - Analysis window finish */
84 /* SPEECH(AWINF) - Speech buffer */
85 /* Indices MIN(AWINS, AWINF-(ORDER-1)) through */
86 /* MAX(AWINF, AWINS+(ORDER-1)) read. */
87 /* As long as (AWINF-AWINS) .GE. (ORDER-1), */
88 /* this is just indices AWINS through AWINF. */
89 /* Output: */
90 /* PHI(ORDER,ORDER) - Covariance matrix */
91 /* Lower triangular half and diagonal written, and read.*/
92 /* Upper triangular half untouched. */
93 /* PSI(ORDER) - Prediction vector */
94 /* Indices 1 through ORDER written, */
95 /* and most are read after that. */
97 /* This subroutine has no local state. */
99 /* Subroutine */ int mload_(integer *order, integer *awins, integer *awinf,
100 real *speech, real *phi, real *psi)
102 /* System generated locals */
103 integer phi_dim1, phi_offset, i__1, i__2;
105 /* Local variables */
106 integer c__, i__, r__, start;
108 /* Arguments */
109 /* Local variables that need not be saved */
110 /* Load first column of triangular covariance matrix PHI */
111 /* Parameter adjustments */
112 --psi;
113 phi_dim1 = *order;
114 phi_offset = phi_dim1 + 1;
115 phi -= phi_offset;
116 --speech;
118 /* Function Body */
119 start = *awins + *order;
120 i__1 = *order;
121 for (r__ = 1; r__ <= i__1; ++r__) {
122 phi[r__ + phi_dim1] = 0.f;
123 i__2 = *awinf;
124 for (i__ = start; i__ <= i__2; ++i__) {
125 phi[r__ + phi_dim1] += speech[i__ - 1] * speech[i__ - r__];
128 /* Load last element of vector PSI */
129 psi[*order] = 0.f;
130 i__1 = *awinf;
131 for (i__ = start; i__ <= i__1; ++i__) {
132 psi[*order] += speech[i__] * speech[i__ - *order];
134 /* End correct to get additional columns of PHI */
135 i__1 = *order;
136 for (r__ = 2; r__ <= i__1; ++r__) {
137 i__2 = r__;
138 for (c__ = 2; c__ <= i__2; ++c__) {
139 phi[r__ + c__ * phi_dim1] = phi[r__ - 1 + (c__ - 1) * phi_dim1] -
140 speech[*awinf + 1 - r__] * speech[*awinf + 1 - c__] +
141 speech[start - r__] * speech[start - c__];
144 /* End correct to get additional elements of PSI */
145 i__1 = *order - 1;
146 for (c__ = 1; c__ <= i__1; ++c__) {
147 psi[c__] = phi[c__ + 1 + phi_dim1] - speech[start - 1] * speech[start
148 - 1 - c__] + speech[*awinf] * speech[*awinf - c__];
150 /* Copy lower triangular section into upper (why bother?) */
151 /* I'm commenting this out, since the upper triangular half of PHI
153 /* is never used by later code, unless a sufficiently high level of
155 /* tracing is turned on. */
156 /* DO R = 1,ORDER */
157 /* DO C = 1,R-1 */
158 /* PHI(C,R) = PHI(R,C) */
159 /* END DO */
160 /* END DO */
161 return 0;
162 } /* mload_ */