lpfilt.c

Go to the documentation of this file.
00001 /*
00002 
00003 $Log$
00004 Revision 1.15  2004/06/26 03:50:14  markster
00005 Merge source cleanups (bug #1911)
00006 
00007 Revision 1.14  2003/02/12 13:59:15  matteo
00008 mer feb 12 14:56:57 CET 2003
00009 
00010 Revision 1.1.1.1  2003/02/12 13:59:15  matteo
00011 mer feb 12 14:56:57 CET 2003
00012 
00013 Revision 1.2  2000/01/05 08:20:39  markster
00014 Some OSS fixes and a few lpc changes to make it actually work
00015 
00016  * Revision 1.1  1996/08/19  22:31:35  jaf
00017  * Initial revision
00018  *
00019 
00020 */
00021 
00022 /*  -- translated by f2c (version 19951025).
00023    You must link the resulting object file with the libraries:
00024    -lf2c -lm   (in that order)
00025 */
00026 
00027 #include "f2c.h"
00028 
00029 #ifdef P_R_O_T_O_T_Y_P_E_S
00030 extern int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp);
00031 #endif
00032 
00033 /* *********************************************************************** */
00034 
00035 /*    LPFILT Version 55 */
00036 
00037 /* $Log$
00038  * Revision 1.15  2004/06/26 03:50:14  markster
00039  * Merge source cleanups (bug #1911)
00040  *
00041  * Revision 1.14  2003/02/12 13:59:15  matteo
00042  * mer feb 12 14:56:57 CET 2003
00043  *
00044  * Revision 1.1.1.1  2003/02/12 13:59:15  matteo
00045  * mer feb 12 14:56:57 CET 2003
00046  *
00047  * Revision 1.2  2000/01/05 08:20:39  markster
00048  * Some OSS fixes and a few lpc changes to make it actually work
00049  *
00050  * Revision 1.1  1996/08/19  22:31:35  jaf
00051  * Initial revision
00052  * */
00053 /* Revision 1.3  1996/03/15  16:53:49  jaf */
00054 /* Just put comment header in standard form. */
00055 
00056 /* Revision 1.2  1996/03/12  23:58:06  jaf */
00057 /* Comments added explaining that none of the local variables of this */
00058 /* subroutine need to be saved from one invocation to the next. */
00059 
00060 /* Revision 1.1  1996/02/07 14:47:44  jaf */
00061 /* Initial revision */
00062 
00063 
00064 /* *********************************************************************** */
00065 
00066 /*   31 Point Equiripple FIR Low-Pass Filter */
00067 /*     Linear phase, delay = 15 samples */
00068 
00069 /*    Passband:  ripple = 0.25 dB, cutoff =  800 Hz */
00070 /*    Stopband:  atten. =  40. dB, cutoff = 1240 Hz */
00071 
00072 /* Inputs: */
00073 /*  LEN    - Length of speech buffers */
00074 /*  NSAMP  - Number of samples to filter */
00075 /*  INBUF  - Input speech buffer */
00076 /*           Indices len-nsamp-29 through len are read. */
00077 /* Output: */
00078 /*  LPBUF  - Low passed speech buffer (must be different array than INBUF) */
00079 /*           Indices len+1-nsamp through len are written. */
00080 
00081 /* This subroutine has no local state. */
00082 
00083 /* Subroutine */ int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *
00084    nsamp)
00085 {
00086     /* System generated locals */
00087     integer i__1;
00088 
00089     /* Local variables */
00090     integer j;
00091     real t;
00092 
00093 /*    Arguments */
00094 /*    Parameters/constants */
00095 /*       Local variables that need not be saved */
00096 /*       Local state */
00097 /*       None */
00098     /* Parameter adjustments */
00099     --lpbuf;
00100     --inbuf;
00101 
00102     /* Function Body */
00103     i__1 = *len;
00104     for (j = *len + 1 - *nsamp; j <= i__1; ++j) {
00105    t = (inbuf[j] + inbuf[j - 30]) * -.0097201988f;
00106    t += (inbuf[j - 1] + inbuf[j - 29]) * -.0105179986f;
00107    t += (inbuf[j - 2] + inbuf[j - 28]) * -.0083479648f;
00108    t += (inbuf[j - 3] + inbuf[j - 27]) * 5.860774e-4f;
00109    t += (inbuf[j - 4] + inbuf[j - 26]) * .0130892089f;
00110    t += (inbuf[j - 5] + inbuf[j - 25]) * .0217052232f;
00111    t += (inbuf[j - 6] + inbuf[j - 24]) * .0184161253f;
00112    t += (inbuf[j - 7] + inbuf[j - 23]) * 3.39723e-4f;
00113    t += (inbuf[j - 8] + inbuf[j - 22]) * -.0260797087f;
00114    t += (inbuf[j - 9] + inbuf[j - 21]) * -.0455563702f;
00115    t += (inbuf[j - 10] + inbuf[j - 20]) * -.040306855f;
00116    t += (inbuf[j - 11] + inbuf[j - 19]) * 5.029835e-4f;
00117    t += (inbuf[j - 12] + inbuf[j - 18]) * .0729262903f;
00118    t += (inbuf[j - 13] + inbuf[j - 17]) * .1572008878f;
00119    t += (inbuf[j - 14] + inbuf[j - 16]) * .2247288674f;
00120    t += inbuf[j - 15] * .250535965f;
00121    lpbuf[j] = t;
00122     }
00123     return 0;
00124 } /* lpfilt_ */
00125 

Generated on Thu Apr 16 06:27:38 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6