Asterisk - The Open Source Telephony Project  18.5.0
Functions
invert.c File Reference
#include "f2c.h"
Include dependency graph for invert.c:

Go to the source code of this file.

Functions

int invert_ (integer *order, real *phi, real *psi, real *rc)
 

Function Documentation

◆ invert_()

int invert_ ( integer order,
real phi,
real psi,
real rc 
)

Definition at line 93 of file invert.c.

References abs, max, min, and order.

Referenced by analys_().

94 {
95  /* System generated locals */
96  unsigned i__2;
97  integer phi_dim1, phi_offset, i__1, i__3;
98  real r__1, r__2;
99 
100  /* Local variables */
101  real save;
102  integer i__, j, k;
103  real v[100] /* was [10][10] */;
104 
105 /* Arguments */
106 /* $Log$
107  * Revision 1.15 2004/06/26 03:50:14 markster
108  * Merge source cleanups (bug #1911)
109  *
110  * Revision 1.14 2003/02/12 13:59:15 matteo
111  * mer feb 12 14:56:57 CET 2003
112  *
113  * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
114  * mer feb 12 14:56:57 CET 2003
115  *
116  * Revision 1.2 2000/01/05 08:20:39 markster
117  * Some OSS fixes and a few lpc changes to make it actually work
118  *
119  * Revision 1.1 1996/08/19 22:32:00 jaf
120  * Initial revision
121  * */
122 /* Revision 1.3 1996/03/29 22:03:47 jaf */
123 /* Removed definitions for any constants that were no longer used. */
124 
125 /* Revision 1.2 1996/03/26 19:34:33 jaf */
126 /* Added comments indicating which constants are not needed in an */
127 /* application that uses the LPC-10 coder. */
128 
129 /* Revision 1.1 1996/02/07 14:43:51 jaf */
130 /* Initial revision */
131 
132 /* LPC Configuration parameters: */
133 /* Frame size, Prediction order, Pitch period */
134 /* Parameters/constants */
135 /* Local variables that need not be saved */
136 /* Decompose PHI into V * D * V' where V is a triangular matrix whose */
137 /* main diagonal elements are all 1, V' is the transpose of V, and */
138 /* D is a vector. Here D(n) is stored in location V(n,n). */
139  /* Parameter adjustments */
140  --rc;
141  --psi;
142  phi_dim1 = *order;
143  phi_offset = phi_dim1 + 1;
144  phi -= phi_offset;
145 
146  /* Function Body */
147  i__1 = *order;
148  for (j = 1; j <= i__1; ++j) {
149  i__2 = *order;
150  for (i__ = j; i__ <= i__2; ++i__) {
151  v[i__ + j * 10 - 11] = phi[i__ + j * phi_dim1];
152  }
153  i__2 = j - 1;
154  for (k = 1; k <= i__2; ++k) {
155  save = v[j + k * 10 - 11] * v[k + k * 10 - 11];
156  i__3 = *order;
157  for (i__ = j; i__ <= i__3; ++i__) {
158  v[i__ + j * 10 - 11] -= v[i__ + k * 10 - 11] * save;
159  }
160  }
161 /* Compute intermediate results, which are similar to RC's */
162  if ((r__1 = v[j + j * 10 - 11], abs(r__1)) < 1e-10f) {
163  goto L100;
164  }
165  rc[j] = psi[j];
166  i__2 = j - 1;
167  for (k = 1; k <= i__2; ++k) {
168  rc[j] -= rc[k] * v[j + k * 10 - 11];
169  }
170  v[j + j * 10 - 11] = 1.f / v[j + j * 10 - 11];
171  rc[j] *= v[j + j * 10 - 11];
172 /* Computing MAX */
173 /* Computing MIN */
174  r__2 = rc[j];
175  r__1 = min(r__2,.999f);
176  rc[j] = max(r__1,-.999f);
177  }
178  return 0;
179 /* Zero out higher order RC's if algorithm terminated early */
180 L100:
181  i__1 = *order;
182  for (i__ = j; i__ <= i__1; ++i__) {
183  rc[i__] = 0.f;
184  }
185 /* Back substitute for PC's (if needed) */
186 /* 110 DO J = ORDER,1,-1 */
187 /* PC(J) = RC(J) */
188 /* DO I = 1,J-1 */
189 /* PC(J) = PC(J) - PC(I)*V(J,I) */
190 /* END DO */
191 /* END DO */
192  return 0;
193 } /* invert_ */
integer order
Definition: analys.c:66
float real
Definition: lpc10.h:79
#define abs(x)
Definition: f2c.h:195
#define min(a, b)
Definition: f2c.h:197
INT32 integer
Definition: lpc10.h:80
#define max(a, b)
Definition: f2c.h:198