build: fix symlink selection
[sox.git] / lpc10 / irc2pc.c
blobe29eb36712dd29338534320fe93012148f4849f5
1 /*
3 * Revision 1.1 1996/08/19 22:31:56 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 irc2pc_(real *rc, real *pc, integer *order, real *gprime, real *g2pass);
18 /* ***************************************************************** */
20 /* IRC2PC Version 48 */
23 * Revision 1.1 1996/08/19 22:31:56 jaf
24 * Initial revision
25 * */
26 /* Revision 1.3 1996/03/20 15:47:19 jaf */
27 /* Added comments about which indices of array arguments are read or */
28 /* written. */
30 /* Revision 1.2 1996/03/14 16:59:04 jaf */
31 /* Comments added explaining that none of the local variables of this */
32 /* subroutine need to be saved from one invocation to the next. */
34 /* Revision 1.1 1996/02/07 14:47:27 jaf */
35 /* Initial revision */
38 /* ***************************************************************** */
40 /* Convert Reflection Coefficients to Predictor Coeficients */
42 /* Inputs: */
43 /* RC - Reflection coefficients */
44 /* Indices 1 through ORDER read. */
45 /* ORDER - Number of RC's */
46 /* GPRIME - Excitation modification gain */
47 /* Outputs: */
48 /* PC - Predictor coefficients */
49 /* Indices 1 through ORDER written. */
50 /* Indices 1 through ORDER-1 are read after being written. */
51 /* G2PASS - Excitation modification sharpening factor */
53 /* This subroutine has no local state. */
55 /* Subroutine */ int irc2pc_(real *rc, real *pc, integer *order, real *gprime,
56 real *g2pass)
58 /* System generated locals */
59 integer i__1, i__2;
61 /* Builtin functions */
62 double sqrt(doublereal);
64 /* Local variables */
65 real temp[10];
66 integer i__, j;
68 /* Arguments */
69 /* LPC Configuration parameters: */
70 /* Frame size, Prediction order, Pitch period */
71 /* Local variables that need not be saved */
72 /* Parameter adjustments */
73 --pc;
74 --rc;
76 /* Function Body */
77 *g2pass = 1.f;
78 i__1 = *order;
79 for (i__ = 1; i__ <= i__1; ++i__) {
80 *g2pass *= 1.f - rc[i__] * rc[i__];
82 *g2pass = *gprime * sqrt(*g2pass);
83 pc[1] = rc[1];
84 i__1 = *order;
85 for (i__ = 2; i__ <= i__1; ++i__) {
86 i__2 = i__ - 1;
87 for (j = 1; j <= i__2; ++j) {
88 temp[j - 1] = pc[j] - rc[i__] * pc[i__ - j];
90 i__2 = i__ - 1;
91 for (j = 1; j <= i__2; ++j) {
92 pc[j] = temp[j - 1];
94 pc[i__] = rc[i__];
96 return 0;
97 } /* irc2pc_ */