1 /*
2 
3 $Log: lpfilt.c,v $
4 Revision 1.2  2006/08/01 13:06:50  rjongbloed
5 Added a raft of unvalidated audio codecs from OpenH323 tree
6 
7 Revision 1.1.2.1  2006/07/22 14:03:17  rjongbloed
8 Added more plug ins
9 
10 Revision 1.1.2.1  2006/05/08 13:49:57  rjongbloed
11 Imported all the audio codec plug ins from OpenH323
12 
13 Revision 1.1  2004/05/04 11:16:43  csoutheren
14 Initial version
15 
16 Revision 1.1  2000/06/05 04:45:12  robertj
17 Added LPC-10 2400bps codec
18 
19  * Revision 1.1  1996/08/19  22:31:35  jaf
20  * Initial revision
21  *
22 
23 */
24 
25 #ifdef P_R_O_T_O_T_Y_P_E_S
26 extern int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp);
27 #endif
28 
29 /*  -- translated by f2c (version 19951025).
30    You must link the resulting object file with the libraries:
31 	-lf2c -lm   (in that order)
32 */
33 
34 #include "f2c.h"
35 
36 /* *********************************************************************** */
37 
38 /* 	LPFILT Version 55 */
39 
40 /* $Log: lpfilt.c,v $
41 /* Revision 1.2  2006/08/01 13:06:50  rjongbloed
42 /* Added a raft of unvalidated audio codecs from OpenH323 tree
43 /*
44 /* Revision 1.1.2.1  2006/07/22 14:03:17  rjongbloed
45 /* Added more plug ins
46 /*
47 /* Revision 1.1.2.1  2006/05/08 13:49:57  rjongbloed
48 /* Imported all the audio codec plug ins from OpenH323
49 /*
50 /* Revision 1.1  2004/05/04 11:16:43  csoutheren
51 /* Initial version
52 /*
53 /* Revision 1.1  2000/06/05 04:45:12  robertj
54 /* Added LPC-10 2400bps codec
55 /*
56  * Revision 1.1  1996/08/19  22:31:35  jaf
57  * Initial revision
58  * */
59 /* Revision 1.3  1996/03/15  16:53:49  jaf */
60 /* Just put comment header in standard form. */
61 
62 /* Revision 1.2  1996/03/12  23:58:06  jaf */
63 /* Comments added explaining that none of the local variables of this */
64 /* subroutine need to be saved from one invocation to the next. */
65 
66 /* Revision 1.1  1996/02/07 14:47:44  jaf */
67 /* Initial revision */
68 
69 
70 /* *********************************************************************** */
71 
72 /*   31 Point Equiripple FIR Low-Pass Filter */
73 /*     Linear phase, delay = 15 samples */
74 
75 /* 	Passband:  ripple = 0.25 dB, cutoff =  800 Hz */
76 /* 	Stopband:  atten. =  40. dB, cutoff = 1240 Hz */
77 
78 /* Inputs: */
79 /*  LEN    - Length of speech buffers */
80 /*  NSAMP  - Number of samples to filter */
81 /*  INBUF  - Input speech buffer */
82 /*           Indices len-nsamp-29 through len are read. */
83 /* Output: */
84 /*  LPBUF  - Low passed speech buffer (must be different array than INBUF) */
85 /*           Indices len+1-nsamp through len are written. */
86 
87 /* This subroutine has no local state. */
88 
lpfilt_(real * inbuf,real * lpbuf,integer * len,integer * nsamp)89 /* Subroutine */ int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *
90 	nsamp)
91 {
92     /* System generated locals */
93     integer i__1;
94 
95     /* Local variables */
96     integer j;
97     real t;
98 
99 /* 	Arguments */
100 /* 	Parameters/constants */
101 /*       Local variables that need not be saved */
102 /*       Local state */
103 /*       None */
104     /* Parameter adjustments */
105     --lpbuf;
106     --inbuf;
107 
108     /* Function Body */
109     i__1 = *len;
110     for (j = *len + 1 - *nsamp; j <= i__1; ++j) {
111 	t = (inbuf[j] + inbuf[j - 30]) * -.0097201988f;
112 	t += (inbuf[j - 1] + inbuf[j - 29]) * -.0105179986f;
113 	t += (inbuf[j - 2] + inbuf[j - 28]) * -.0083479648f;
114 	t += (inbuf[j - 3] + inbuf[j - 27]) * 5.860774e-4f;
115 	t += (inbuf[j - 4] + inbuf[j - 26]) * .0130892089f;
116 	t += (inbuf[j - 5] + inbuf[j - 25]) * .0217052232f;
117 	t += (inbuf[j - 6] + inbuf[j - 24]) * .0184161253f;
118 	t += (inbuf[j - 7] + inbuf[j - 23]) * 3.39723e-4f;
119 	t += (inbuf[j - 8] + inbuf[j - 22]) * -.0260797087f;
120 	t += (inbuf[j - 9] + inbuf[j - 21]) * -.0455563702f;
121 	t += (inbuf[j - 10] + inbuf[j - 20]) * -.040306855f;
122 	t += (inbuf[j - 11] + inbuf[j - 19]) * 5.029835e-4f;
123 	t += (inbuf[j - 12] + inbuf[j - 18]) * .0729262903f;
124 	t += (inbuf[j - 13] + inbuf[j - 17]) * .1572008878f;
125 	t += (inbuf[j - 14] + inbuf[j - 16]) * .2247288674f;
126 	t += inbuf[j - 15] * .250535965f;
127 	lpbuf[j] = t;
128     }
129     return 0;
130 } /* lpfilt_ */
131 
132