]> git.rkrishnan.org Git - dttsp.git/blob - jDttSP/filter.h
Initial revision
[dttsp.git] / jDttSP / filter.h
1 /* filter.h
2 This file is part of a program that implements a Software-Defined Radio.
3
4 Copyright (C) 2004 by Frank Brickle, AB2KT and Bob McGwier, N4HY
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20 The authors can be reached by email at
21
22 ab2kt@arrl.net
23 or
24 rwmcgwier@comcast.net
25
26 or by paper mail at
27
28 The DTTS Microwave Society
29 6 Kathleen Place
30 Bridgewater, NJ 08807
31 */
32
33 #ifndef _filter_h
34
35 #define _filter_h
36
37 #include <fromsys.h>
38 #include <banal.h>
39 #include <splitfields.h>
40 #include <datatypes.h>
41 #include <bufvec.h>
42 #include <cxops.h>
43 #include <fastrig.h>
44 #include <update.h>
45 #include <lmadf.h>
46 #include <fftw.h>
47 #include <window.h>
48
49 typedef enum {
50   FIR_Undef, FIR_Lowpass, FIR_Bandpass, FIR_Highpass, FIR_Hilbert, FIR_Bandstop
51 } FIR_response_type;
52
53 typedef enum { FIR_Even, FIR_Odd } FIR_parity_type;
54
55 typedef
56 struct _real_FIR {
57   REAL *coef;
58   int size;
59   FIR_response_type type;
60   BOOLEAN cplx;
61   struct { REAL lo, hi; } freq;
62 } RealFIRDesc, *RealFIR;
63
64 typedef
65 struct _complex_FIR {
66   COMPLEX *coef;
67   int size;
68   FIR_response_type type;
69   BOOLEAN cplx;
70   struct { REAL lo, hi; } freq;
71 } ComplexFIRDesc, *ComplexFIR;
72
73 #define FIRcoef(p) ((p)->coef)
74 #define FIRtap(p, i) (FIRcoef(p)[(i)])
75 #define FIRsize(p) ((p)->size)
76 #define FIRtype(p) ((p)->type)
77 #define FIRiscomplex(p) ((p)->cplx)
78 #define FIRisreal(p) (!FIRiscomplex(p))
79 #define FIRfqlo(p) ((p)->freq.lo)
80 #define FIRfqhi(p) ((p)->freq.hi)
81
82 #define delFIR_Lowpass_REAL(p) delFIR_REAL(p)
83 #define delFIR_Lowpass_COMPLEX(p) delFIR_COMPLEX(p)
84 #define delFIR_Bandpass_REAL(p) delFIR_REAL(p)
85 #define delFIR_Bandpass_COMPLEX(p) delFIR_COMPLEX(p)
86 #define delFIR_Highpass_REAL(p) delFIR_REAL(p)
87 #define delFIR_Highpass_COMPLEX(p) delFIR_COMPLEX(p)
88 #define delFIR_Hilbert_REAL(p) delFIR_REAL(p)
89 #define delFIR_Hilbert_COMPLEX(p) delFIR_COMPLEX(p)
90 #define delFIR_Bandstop_REAL(p) delFIR_REAL(p)
91 #define delFIR_Bandstop_COMPLEX(p) delFIR_COMPLEX(p)
92
93 extern RealFIR newFIR_REAL(int size, char *tag);
94 extern ComplexFIR newFIR_COMPLEX(int size, char *tag);
95 extern void delFIR_REAL(RealFIR p);
96 extern void delFIR_COMPLEX(ComplexFIR p);
97 extern RealFIR newFIR_Lowpass_REAL(REAL cutoff, REAL sr, int size);
98 extern ComplexFIR newFIR_Lowpass_COMPLEX(REAL cutoff, REAL sr, int size);
99 extern RealFIR newFIR_Bandpass_REAL(REAL lo, REAL hi, REAL sr, int size);
100 extern ComplexFIR newFIR_Bandpass_COMPLEX(REAL lo, REAL hi, REAL sr, int size);
101 extern RealFIR newFIR_Highpass_REAL(REAL cutoff, REAL sr, int size);
102 extern ComplexFIR newFIR_Highpass_COMPLEX(REAL cutoff, REAL sr, int size);
103 extern RealFIR newFIR_Hilbert_REAL(REAL lo, REAL hi, REAL sr, int size);
104 extern ComplexFIR newFIR_Hilbert_COMPLEX(REAL lo, REAL hi, REAL sr, int size);
105 extern RealFIR newFIR_Bandstop_REAL(REAL lo, REAL hi, REAL sr, int size);
106 extern ComplexFIR newFIR_Bandstop_COMPLEX(REAL lo, REAL hi, REAL sr, int size);
107
108 #endif