forked from g0orx/wdsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iir.h
196 lines (142 loc) · 4.9 KB
/
iir.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/* iir.h
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2014 Warren Pratt, NR0V
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
The author can be reached by email at
*/
/********************************************************************************************************
* *
* Bi-Quad Notch *
* *
********************************************************************************************************/
#ifndef _snotch_h
#define _snotch_h
typedef struct _snotch
{
int run;
int size;
double* in;
double* out;
double rate;
double f;
double bw;
double a0, a1, a2, b1, b2;
double x0, x1, x2, y1, y2;
CRITICAL_SECTION cs_update;
} snotch, *SNOTCH;
extern SNOTCH create_snotch (int run, int size, double* in, double* out, int rate, double f, double bw);
extern void destroy_snotch (SNOTCH a);
extern void flush_snotch (SNOTCH a);
extern void xsnotch (SNOTCH a);
extern void setBuffers_snotch (SNOTCH a, double* in, double* out);
extern void setSamplerate_snotch (SNOTCH a, int rate);
extern void setSize_snotch (SNOTCH a, int size);
extern void SetSNCTCSSFreq (SNOTCH a, double freq);
extern void SetSNCTCSSRun (SNOTCH a, int run);
#endif
/********************************************************************************************************
* *
* Complex Bi-Quad Peaking *
* *
********************************************************************************************************/
#ifndef _speak_h
#define _speak_h
typedef struct _speak
{
int run;
int size;
double* in;
double* out;
double rate;
double f;
double bw;
double cbw;
double gain;
double fgain;
int nstages;
int design;
double a0, a1, a2, b1, b2;
double *x0, *x1, *x2, *y0, *y1, *y2;
CRITICAL_SECTION cs_update;
} speak, *SPEAK;
extern SPEAK create_speak (int run, int size, double* in, double* out, int rate, double f, double bw, double gain, int nstages, int design);
extern void destroy_speak (SPEAK a);
extern void flush_speak (SPEAK a);
extern void xspeak (SPEAK a);
extern void setBuffers_speak (SPEAK a, double* in, double* out);
extern void setSamplerate_speak (SPEAK a, int rate);
extern void setSize_speak (SPEAK a, int size);
#endif
/********************************************************************************************************
* *
* Complex Multiple Peaking *
* *
********************************************************************************************************/
#ifndef _mpeak_h
#define _mpeak_h
typedef struct _mpeak
{
int run;
int size;
double* in;
double* out;
int rate;
int npeaks;
int* enable;
double* f;
double* bw;
double* gain;
int nstages;
SPEAK* pfil;
double* tmp;
double* mix;
CRITICAL_SECTION cs_update;
} mpeak, *MPEAK;
extern MPEAK create_mpeak (int run, int size, double* in, double* out, int rate, int npeaks, int* enable, double* f, double* bw, double* gain, int nstages);
extern void destroy_mpeak (MPEAK a);
extern void flush_mpeak (MPEAK a);
extern void xmpeak (MPEAK a);
extern void setBuffers_mpeak (MPEAK a, double* in, double* out);
extern void setSamplerate_mpeak (MPEAK a, int rate);
extern void setSize_mpeak (MPEAK a, int size);
#endif
/********************************************************************************************************
* *
* Phase Rotator *
* *
********************************************************************************************************/
#ifndef _phrot_h
#define _phrot_h
typedef struct _phrot
{
int run;
int size;
double* in;
double* out;
int rate;
double fc;
int nstages;
// normalized such that a0 = 1
double a1, b0, b1;
double *x0, *x1, *y0, *y1;
CRITICAL_SECTION cs_update;
} phrot, *PHROT;
extern PHROT create_phrot (int run, int size, double* in, double* out, int rate, double fc, int nstages);
extern void destroy_phrot (PHROT a);
extern void flush_phrot (PHROT a);
extern void xphrot (PHROT a);
extern void setBuffers_phrot (PHROT a, double* in, double* out);
extern void setSamplerate_phrot (PHROT a, int rate);
extern void setSize_phrot (PHROT a, int size);
#endif