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

Go to the source code of this file.

Functions

int ivfilt_ (real *lpbuf, real *ivbuf, integer *len, integer *nsamp, real *ivrc)
 

Function Documentation

◆ ivfilt_()

int ivfilt_ ( real lpbuf,
real ivbuf,
integer len,
integer nsamp,
real ivrc 
)

Definition at line 89 of file ivfilt.c.

References len().

Referenced by analys_().

91 {
92  /* System generated locals */
93  integer i__1;
94 
95  /* Local variables */
96  integer i__, j, k;
97  real r__[3], pc1, pc2;
98 
99 /* Arguments */
100 /* Local variables that need not be saved */
101 /* Local state */
102 /* None */
103 /* Calculate Autocorrelations */
104  /* Parameter adjustments */
105  --ivbuf;
106  --lpbuf;
107  --ivrc;
108 
109  /* Function Body */
110  for (i__ = 1; i__ <= 3; ++i__) {
111  r__[i__ - 1] = 0.f;
112  k = (i__ - 1) << 2;
113  i__1 = *len;
114  for (j = (i__ << 2) + *len - *nsamp; j <= i__1; j += 2) {
115  r__[i__ - 1] += lpbuf[j] * lpbuf[j - k];
116  }
117  }
118 /* Calculate predictor coefficients */
119  pc1 = 0.f;
120  pc2 = 0.f;
121  ivrc[1] = 0.f;
122  ivrc[2] = 0.f;
123  if (r__[0] > 1e-10f) {
124  ivrc[1] = r__[1] / r__[0];
125  ivrc[2] = (r__[2] - ivrc[1] * r__[1]) / (r__[0] - ivrc[1] * r__[1]);
126  pc1 = ivrc[1] - ivrc[1] * ivrc[2];
127  pc2 = ivrc[2];
128  }
129 /* Inverse filter LPBUF into IVBUF */
130  i__1 = *len;
131  for (i__ = *len + 1 - *nsamp; i__ <= i__1; ++i__) {
132  ivbuf[i__] = lpbuf[i__] - pc1 * lpbuf[i__ - 4] - pc2 * lpbuf[i__ - 8];
133  }
134  return 0;
135 } /* ivfilt_ */
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80