Asterisk - The Open Source Telephony Project GIT-master-f36a736
ivfilt.c
Go to the documentation of this file.
1/*
2
3$Log$
4Revision 1.16 2004/06/26 03:50:14 markster
5Merge source cleanups (bug #1911)
6
7Revision 1.15 2003/09/19 01:20:22 markster
8Code cleanups (bug #66)
9
10Revision 1.2 2003/09/19 01:20:22 markster
11Code cleanups (bug #66)
12
13Revision 1.1.1.1 2003/02/12 13:59:15 matteo
14mer feb 12 14:56:57 CET 2003
15
16Revision 1.2 2000/01/05 08:20:39 markster
17Some OSS fixes and a few lpc changes to make it actually work
18
19 * Revision 1.1 1996/08/19 22:31:53 jaf
20 * Initial revision
21 *
22
23*/
24
25/* -- translated by f2c (version 19951025).
26 You must link the resulting object file with the libraries:
27 -lf2c -lm (in that order)
28*/
29
30#include "f2c.h"
31
32#ifdef P_R_O_T_O_T_Y_P_E_S
33extern int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *nsamp, real *ivrc);
34#endif
35
36/* ********************************************************************* */
37
38/* IVFILT Version 48 */
39
40/* $Log$
41 * Revision 1.16 2004/06/26 03:50:14 markster
42 * Merge source cleanups (bug #1911)
43 *
44 * Revision 1.15 2003/09/19 01:20:22 markster
45 * Code cleanups (bug #66)
46 *
47 * Revision 1.2 2003/09/19 01:20:22 markster
48 * Code cleanups (bug #66)
49 *
50 * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
51 * mer feb 12 14:56:57 CET 2003
52 *
53 * Revision 1.2 2000/01/05 08:20:39 markster
54 * Some OSS fixes and a few lpc changes to make it actually work
55 *
56 * Revision 1.1 1996/08/19 22:31:53 jaf
57 * Initial revision
58 * */
59/* Revision 1.3 1996/03/15 21:36:29 jaf */
60/* Just added a few comments about which array indices of the arguments */
61/* are used, and mentioning that this subroutine has no local state. */
62
63/* Revision 1.2 1996/03/13 00:01:00 jaf */
64/* Comments added explaining that none of the local variables of this */
65/* subroutine need to be saved from one invocation to the next. */
66
67/* Revision 1.1 1996/02/07 14:47:34 jaf */
68/* Initial revision */
69
70
71/* ********************************************************************* */
72
73/* 2nd order inverse filter, speech is decimated 4:1 */
74
75/* Input: */
76/* LEN - Length of speech buffers */
77/* NSAMP - Number of samples to filter */
78/* LPBUF - Low pass filtered speech buffer */
79/* Indices LEN-NSAMP-7 through LEN read. */
80/* Output: */
81/* IVBUF - Inverse filtered speech buffer */
82/* Indices LEN-NSAMP+1 through LEN written. */
83/* IVRC - Inverse filter reflection coefficients (for voicing) */
84/* Indices 1 and 2 both written (also read, but only after writing).
85*/
86
87/* This subroutine has no local state. */
88
89/* Subroutine */ int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *
90 nsamp, real *ivrc)
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)
int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *nsamp, real *ivrc)
Definition: ivfilt.c:89
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80