Asterisk - The Open Source Telephony Project GIT-master-7e7a603
lpfilt.c
Go to the documentation of this file.
1/*
2
3$Log$
4Revision 1.15 2004/06/26 03:50:14 markster
5Merge source cleanups (bug #1911)
6
7Revision 1.14 2003/02/12 13:59:15 matteo
8mer feb 12 14:56:57 CET 2003
9
10Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11mer feb 12 14:56:57 CET 2003
12
13Revision 1.2 2000/01/05 08:20:39 markster
14Some OSS fixes and a few lpc changes to make it actually work
15
16 * Revision 1.1 1996/08/19 22:31:35 jaf
17 * Initial revision
18 *
19
20*/
21
22/* -- translated by f2c (version 19951025).
23 You must link the resulting object file with the libraries:
24 -lf2c -lm (in that order)
25*/
26
27#include "f2c.h"
28
29#ifdef P_R_O_T_O_T_Y_P_E_S
30extern int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp);
31#endif
32
33/* *********************************************************************** */
34
35/* LPFILT Version 55 */
36
37/* $Log$
38 * Revision 1.15 2004/06/26 03:50:14 markster
39 * Merge source cleanups (bug #1911)
40 *
41 * Revision 1.14 2003/02/12 13:59:15 matteo
42 * mer feb 12 14:56:57 CET 2003
43 *
44 * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
45 * mer feb 12 14:56:57 CET 2003
46 *
47 * Revision 1.2 2000/01/05 08:20:39 markster
48 * Some OSS fixes and a few lpc changes to make it actually work
49 *
50 * Revision 1.1 1996/08/19 22:31:35 jaf
51 * Initial revision
52 * */
53/* Revision 1.3 1996/03/15 16:53:49 jaf */
54/* Just put comment header in standard form. */
55
56/* Revision 1.2 1996/03/12 23:58:06 jaf */
57/* Comments added explaining that none of the local variables of this */
58/* subroutine need to be saved from one invocation to the next. */
59
60/* Revision 1.1 1996/02/07 14:47:44 jaf */
61/* Initial revision */
62
63
64/* *********************************************************************** */
65
66/* 31 Point Equiripple FIR Low-Pass Filter */
67/* Linear phase, delay = 15 samples */
68
69/* Passband: ripple = 0.25 dB, cutoff = 800 Hz */
70/* Stopband: atten. = 40. dB, cutoff = 1240 Hz */
71
72/* Inputs: */
73/* LEN - Length of speech buffers */
74/* NSAMP - Number of samples to filter */
75/* INBUF - Input speech buffer */
76/* Indices len-nsamp-29 through len are read. */
77/* Output: */
78/* LPBUF - Low passed speech buffer (must be different array than INBUF) */
79/* Indices len+1-nsamp through len are written. */
80
81/* This subroutine has no local state. */
82
83/* Subroutine */ int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *
84 nsamp)
85{
86 /* System generated locals */
87 integer i__1;
88
89 /* Local variables */
90 integer j;
91 real t;
92
93/* Arguments */
94/* Parameters/constants */
95/* Local variables that need not be saved */
96/* Local state */
97/* None */
98 /* Parameter adjustments */
99 --lpbuf;
100 --inbuf;
101
102 /* Function Body */
103 i__1 = *len;
104 for (j = *len + 1 - *nsamp; j <= i__1; ++j) {
105 t = (inbuf[j] + inbuf[j - 30]) * -.0097201988f;
106 t += (inbuf[j - 1] + inbuf[j - 29]) * -.0105179986f;
107 t += (inbuf[j - 2] + inbuf[j - 28]) * -.0083479648f;
108 t += (inbuf[j - 3] + inbuf[j - 27]) * 5.860774e-4f;
109 t += (inbuf[j - 4] + inbuf[j - 26]) * .0130892089f;
110 t += (inbuf[j - 5] + inbuf[j - 25]) * .0217052232f;
111 t += (inbuf[j - 6] + inbuf[j - 24]) * .0184161253f;
112 t += (inbuf[j - 7] + inbuf[j - 23]) * 3.39723e-4f;
113 t += (inbuf[j - 8] + inbuf[j - 22]) * -.0260797087f;
114 t += (inbuf[j - 9] + inbuf[j - 21]) * -.0455563702f;
115 t += (inbuf[j - 10] + inbuf[j - 20]) * -.040306855f;
116 t += (inbuf[j - 11] + inbuf[j - 19]) * 5.029835e-4f;
117 t += (inbuf[j - 12] + inbuf[j - 18]) * .0729262903f;
118 t += (inbuf[j - 13] + inbuf[j - 17]) * .1572008878f;
119 t += (inbuf[j - 14] + inbuf[j - 16]) * .2247288674f;
120 t += inbuf[j - 15] * .250535965f;
121 lpbuf[j] = t;
122 }
123 return 0;
124} /* lpfilt_ */
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
int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp)
Definition: lpfilt.c:83
static int inbuf(struct baseio *bio, FILE *fi)
utility used by inchar(), for base_encode()
Definition: utils.c:590