amr: replace 3GPP reference library with vo-amrwbenc
[sox.git] / lpc10 / mload.c
blobd28ff1667c84f8f8196b6af5da43dee96636ff8c
1 /*
3 * Revision 1.1 1996/08/19 22:31:25 jaf
4 * Initial revision
7 */
9 /* -- translated by f2c (version 19951025).
10 You must link the resulting object file with the libraries:
11 -lf2c -lm (in that order)
14 #include "f2c.h"
16 extern int mload_(integer *order, integer *awins, integer *awinf, real *speech, real *phi, real *psi);
18 /* ***************************************************************** */
20 /* MLOAD Version 48 */
23 * Revision 1.1 1996/08/19 22:31:25 jaf
24 * Initial revision
25 * */
26 /* Revision 1.5 1996/03/27 23:59:51 jaf */
27 /* Added some more accurate comments about which indices of the argument */
28 /* array SPEECH are read. I thought that this might be the cause of a */
29 /* problem I've been having, but it isn't. */
31 /* Revision 1.4 1996/03/26 19:16:53 jaf */
32 /* Commented out the code at the end that copied the lower triangular */
33 /* half of PHI into the upper triangular half (making the resulting */
34 /* matrix symmetric). The upper triangular half was never used by later */
35 /* code in subroutine ANALYS. */
37 /* Revision 1.3 1996/03/18 21:16:00 jaf */
38 /* Just added a few comments about which array indices of the arguments */
39 /* are used, and mentioning that this subroutine has no local state. */
41 /* Revision 1.2 1996/03/13 16:47:41 jaf */
42 /* Comments added explaining that none of the local variables of this */
43 /* subroutine need to be saved from one invocation to the next. */
45 /* Revision 1.1 1996/02/07 14:48:01 jaf */
46 /* Initial revision */
49 /* ***************************************************************** */
51 /* Load a covariance matrix. */
53 /* Input: */
54 /* ORDER - Analysis order */
55 /* AWINS - Analysis window start */
56 /* AWINF - Analysis window finish */
57 /* SPEECH(AWINF) - Speech buffer */
58 /* Indices MIN(AWINS, AWINF-(ORDER-1)) through */
59 /* MAX(AWINF, AWINS+(ORDER-1)) read. */
60 /* As long as (AWINF-AWINS) .GE. (ORDER-1), */
61 /* this is just indices AWINS through AWINF. */
62 /* Output: */
63 /* PHI(ORDER,ORDER) - Covariance matrix */
64 /* Lower triangular half and diagonal written, and read.*/
65 /* Upper triangular half untouched. */
66 /* PSI(ORDER) - Prediction vector */
67 /* Indices 1 through ORDER written, */
68 /* and most are read after that. */
70 /* This subroutine has no local state. */
72 /* Subroutine */ int mload_(integer *order, integer *awins, integer *awinf,
73 real *speech, real *phi, real *psi)
75 /* System generated locals */
76 integer phi_dim1, phi_offset, i__1, i__2;
78 /* Local variables */
79 integer c__, i__, r__, start;
81 /* Arguments */
82 /* Local variables that need not be saved */
83 /* Load first column of triangular covariance matrix PHI */
84 /* Parameter adjustments */
85 --psi;
86 phi_dim1 = *order;
87 phi_offset = phi_dim1 + 1;
88 phi -= phi_offset;
89 --speech;
91 /* Function Body */
92 start = *awins + *order;
93 i__1 = *order;
94 for (r__ = 1; r__ <= i__1; ++r__) {
95 phi[r__ + phi_dim1] = 0.f;
96 i__2 = *awinf;
97 for (i__ = start; i__ <= i__2; ++i__) {
98 phi[r__ + phi_dim1] += speech[i__ - 1] * speech[i__ - r__];
101 /* Load last element of vector PSI */
102 psi[*order] = 0.f;
103 i__1 = *awinf;
104 for (i__ = start; i__ <= i__1; ++i__) {
105 psi[*order] += speech[i__] * speech[i__ - *order];
107 /* End correct to get additional columns of PHI */
108 i__1 = *order;
109 for (r__ = 2; r__ <= i__1; ++r__) {
110 i__2 = r__;
111 for (c__ = 2; c__ <= i__2; ++c__) {
112 phi[r__ + c__ * phi_dim1] = phi[r__ - 1 + (c__ - 1) * phi_dim1] -
113 speech[*awinf + 1 - r__] * speech[*awinf + 1 - c__] +
114 speech[start - r__] * speech[start - c__];
117 /* End correct to get additional elements of PSI */
118 i__1 = *order - 1;
119 for (c__ = 1; c__ <= i__1; ++c__) {
120 psi[c__] = phi[c__ + 1 + phi_dim1] - speech[start - 1] * speech[start
121 - 1 - c__] + speech[*awinf] * speech[*awinf - c__];
123 /* Copy lower triangular section into upper (why bother?) */
124 /* I'm commenting this out, since the upper triangular half of PHI
126 /* is never used by later code, unless a sufficiently high level of
128 /* tracing is turned on. */
129 /* DO R = 1,ORDER */
130 /* DO C = 1,R-1 */
131 /* PHI(C,R) = PHI(R,C) */
132 /* END DO */
133 /* END DO */
134 return 0;
135 } /* mload_ */