spLib
読み取り中…
検索中…
一致する文字列を見つけられません
filter.h
[詳解]
1
4
#ifndef SPLIB_FILTER_H
5
#define SPLIB_FILTER_H
6
7
#include <
sp/vector.h
>
8
#include <
sp/fft.h
>
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
13
14
#if defined(MACOS)
15
#pragma import on
16
#endif
17
25
/*----@addtogroup filterGroup----*/
26
30
extern
void
fvunwrap(
spFVector
phs,
float
cutoff);
31
extern
void
dvunwrap(
spDVector
phs,
double
cutoff);
32
extern
float
sincf(
float
x);
33
extern
double
sinc(
double
x);
34
extern
float
sinccf(
float
x,
float
c);
35
extern
double
sincc(
double
x,
double
c);
36
42
extern
spDVector
xdvbandstop(
double
lp_cutoff,
double
hp_cutoff,
double
sidelobe,
double
trans,
double
gain);
43
extern
spDVector
xdvbandpass(
double
hp_cutoff,
double
lp_cutoff,
double
sidelobe,
double
trans,
double
gain);
44
extern
spDVector
xdvlowpass(
double
cutoff,
double
sidelobe,
double
trans,
double
gain);
45
extern
spDVector
xdvhighpass(
double
cutoff,
double
sidelobe,
double
trans,
double
gain);
46
52
extern
spDVector
xdvfftfiltex(
spFFTRec
fftrec,
spDVector
b,
spDVector
x);
53
extern
spDVector
xdvfftfiltmex(
spFFTRec
fftrec,
spDVector
b,
spDVector
x);
54
extern
spDVector
xdvfftfilt(
spDVector
b,
spDVector
x,
long
fftl);
55
extern
spDVector
xdvfftfiltm(
spDVector
b,
spDVector
x,
long
fftl);
56
extern
spDVector
xdvconv(
spDVector
a,
spDVector
b);
57
58
/* length of z must be larger than MAX(length of b, length of a)-1 */
59
extern
spDVector
xdvinitfilterstates(
spDVector
b,
spDVector
a);
/* 0.9.1+ */
60
extern
void
dvfiltersamplecplx(
spDVector
b,
spDVector
a,
spDVector
z,
double
*re,
double
*im);
61
extern
double
filtersample(
double
*b,
long
blen,
double
*a,
long
alen,
double
*z,
long
zlen,
double
x);
62
extern
double
dvfiltersample(
spDVector
b,
spDVector
a,
spDVector
z,
double
x);
63
extern
spDVector
xdvfilterex(
spDVector
b,
spDVector
a,
spDVector
z,
spDVector
x);
64
extern
spDVector
xdvfilter(
spDVector
b,
spDVector
a,
spDVector
x);
65
66
extern
spDVector
xdvfreqzex(
spFFTRec
fftrec,
spDVector
b
/* can be NODATA */
,
spDVector
a
/* can be NODATA */
);
67
extern
spDVector
xdvfreqz(
spDVector
b
/* can be NODATA */
,
spDVector
a
/* can be NODATA */
,
long
fftl
/* can be 0 (auto select) */
);
68
74
/* linear interpolation (X must be monotonically increasing) */
75
extern
spBool
dvinterp1l(
spDVector
x,
spDVector
y,
spDVector
xi,
spDVector
yi);
76
extern
spDVector
xdvinterp1l(
spDVector
x,
spDVector
y,
spDVector
xi);
77
78
/* nearest neighbor interpolation (X must be monotonically increasing) */
79
extern
spBool
dvinterp1n(
spDVector
x,
spDVector
y,
spDVector
xi,
spDVector
yi);
80
extern
spDVector
xdvinterp1n(
spDVector
x,
spDVector
y,
spDVector
xi);
81
82
/* cubic spline interpolation on not-a-knot condition (X must be monotonically increasing) */
83
extern
spBool
dvinterp1s(
spDVector
x,
spDVector
y,
spDVector
xi,
spDVector
yi);
84
extern
spDVector
xdvinterp1s(
spDVector
x,
spDVector
y,
spDVector
xi);
85
86
/* Resample data at a higher rate using lowpass interpolation */
87
extern
spDVector
xdvinterpex(
spDVector
x,
long
r,
long
l,
double
a);
88
extern
spDVector
xdvinterp(
spDVector
x,
long
r);
/* l = 4, a = 0.5 */
89
90
/* clamped cubic spline interpolation */
91
extern
spBool
dvsplinecl(
spDVector
x,
spDVector
y,
spDVector
xi,
spDVector
yi,
double
leftslope,
double
rightslope);
92
extern
spDVector
xdvsplinecl(
spDVector
x,
spDVector
y,
spDVector
xi,
double
leftslope,
double
rightslope);
93
/* cubic spline.
94
* if notaknot == SP_TRUE, not-a-knot condition (same as MATLAB), otherwise natural condition. */
95
extern
spBool
dvspline(
spDVector
x,
spDVector
y,
spDVector
xi,
spDVector
yi,
spBool
notaknot);
96
extern
spDVector
xdvspline(
spDVector
x,
spDVector
y,
spDVector
xi,
spBool
notaknot);
97
98
#define SP_DECIMATE_OPTION_USE_FIR (1<<0)
99
#define SP_DECIMATE_OPTION_KEEP_EDGE (2<<0)
100
#define SP_DECIMATE_OPTION_NO_FILTFILT (3<<0)
101
102
/* decrease the sampling rate for a sequence (decimation) */
103
extern
spDVector
xdvdecimateex(
spDVector
x,
104
long
r,
105
long
order,
/* 0: use default (chebyshev: 8, FIR: 30) */
106
unsigned
long
options);
107
extern
spDVector
xdvdecimate(
spDVector
x,
long
r);
/* use 8-order chebyshev IIR */
108
109
typedef
struct
_spDecimateRec *spDecimateRec;
110
extern
spDecimateRec spDecimateOpen(
long
r,
111
long
order,
/* 0: use default (chebyshev: 8, FIR: 30) */
112
long
max_input_buf_length,
113
unsigned
long
options,
114
long
*max_output_buf_length,
115
long
*default_delay);
/* *default_delay = -1: cannot calculate delay */
116
extern
spBool
spDecimateClose(spDecimateRec decimate);
117
extern
long
spDecimateProcess(spDecimateRec decimate,
double
*input_buf,
long
input_buf_length,
double
*output_buf,
118
spBool
last_frame,
long
*current_delay);
/* *current_delay = -1: cannot calculate delay */
119
125
/* Lowpass FIR digital filter by using specified window */
126
extern
void
dvfir1win(
spDVector
filter,
/* (i/o) input is window, output is filter */
127
double
cutoff);
/* cut-off frequency */
128
extern
spDVector
xdvfir1win(
spDVector
win,
129
double
cutoff);
/* cut-off frequency */
130
131
/* Lowpass FIR digital filter by using Hamming window */
132
extern
spDVector
xdvfir1(
long
order,
/* return [order + 1] */
133
double
cutoff);
/* cut-off frequency */
134
135
/* Bandpass FIR Filter (startf-endf) by using specified window */
136
extern
spBool
dvfir1bpwin(
spDVector
filter,
/* (i/o) input is window, output is filter */
137
double
startf,
138
double
endf);
139
extern
spDVector
xdvfir1bpwin(
spDVector
win,
140
double
startf,
141
double
endf);
142
143
/* Bandpass FIR Filter (startf-endf) by using Hamming window */
144
extern
spDVector
xdvfir1bp(
long
order,
145
double
startf,
146
double
endf);
147
148
/* Bandstop FIR Filter (startf-endf) by using specified window */
149
extern
spBool
dvfir1bswin(
spDVector
filter,
/* (i/o) input is window, output is filter */
150
double
startf,
151
double
endf);
152
extern
spDVector
xdvfir1bswin(
spDVector
win,
153
double
startf,
154
double
endf);
155
156
/* Bandstop FIR Filter (startf-endf) by using Hamming window */
157
extern
spDVector
xdvfir1bs(
long
order,
/* return [odd length] */
158
double
startf,
159
double
endf);
160
161
/* Highpass FIR digital filter by using specified window */
162
extern
void
dvfir1hpwin(
spDVector
filter,
/* (i/o) input is window, output is filter */
163
double
cutoff);
/* cut-off frequency */
164
extern
spDVector
xdvfir1hpwin(
spDVector
win,
165
double
cutoff);
/* cut-off frequency */
166
167
/* Highpass FIR digital filter by using Hamming window */
168
extern
spDVector
xdvfir1hp(
long
order,
/* return [odd length] */
169
double
cutoff);
/* cut-off frequency */
170
176
/* Zero-phase forward and reverse digital filtering */
177
extern
spDVector
xdvfiltfiltex(
spDVector
b,
/* filter-coefficient (numerator) */
178
spDVector
a,
/* filter-coefficient (denominator) */
179
spDVector
x,
/* input data */
180
spBool
use_optimum_state);
/* SP_TRUE if optimum initial states are used */
181
extern
spDVector
xdvfiltfilt(
spDVector
b,
/* filter-coefficient (numerator) */
182
spDVector
a,
/* filter-coefficient (denominator) */
183
spDVector
x);
/* input data */
184
190
/* Bilinear transformation for filter (analog -> digital) */
191
extern
spDVectors xdvsbilinear(
spDVector
pv,
/* pole */
192
double
gain,
/* gain */
193
double
cutoff,
/* cutoff frequency */
194
spBool
hp_flag);
/* highpass filter */
195
196
/* Chebyshev analog lowpass filter prototype */
197
extern
spDVector
xdvcheb1ap(
long
n,
/* order */
198
double
rp,
/* passband ripple [dB] */
199
double
*gain);
/* gain */
200
201
/* Chebyshev digital and analog filter design */
202
extern
spDVectors xdvscheby1(
long
n,
/* order */
203
double
rp,
/* passband ripple [dB] */
204
double
cutoff,
/* cut-off frequency */
205
spBool
hp_flag);
/* highpass filter */
206
207
/* Butterworth analog lowpass filter prototype (gain = 1.0) */
208
extern
spDVector
xdvbuttap(
long
n);
/* order */
209
extern
spDVectors xdvsbutter(
long
n,
/* order */
210
double
cutoff,
/* cut-off frequency */
211
spBool
hp_flag);
/* highpass filter */
212
215
/*----@addtogroup windowGroup----*/
216
217
#if defined(MACOS)
218
#pragma import off
219
#endif
220
221
#ifdef __cplusplus
222
}
/* Close scope of 'extern "C"' declaration */
223
#endif
224
225
#endif
/* SPLIB_FILTER_H */
spFFTRec
FFTの実行を制御するクラスです.
fft.h
spBool
int spBool
spDVector
double型を扱うためのベクトル型です.
Definition
vector.h:248
spFVector
float型を扱うためのベクトル型です.
Definition
vector.h:214
vector.h
構築:
1.11.0