SoDaRadio-5.0.3-master:8901fb5
|
Overlap-and-save filter class. More...
#include <OSFilter.hxx>
Public Member Functions | |
OSFilter (float low_cutoff, float low_pass_edge, float high_pass_edge, float high_cutoff, unsigned int filter_length, float filter_gain, float sample_rate, unsigned int inout_buffer_length, unsigned int suggested_transform_length=0) | |
constructor More... | |
unsigned int | apply (std::complex< float > *inbuf, std::complex< float > *outbuf, float outgain=1.0) |
run the filter on a complex input stream More... | |
unsigned int | apply (float *inbuf, float *outbuf, float outgain=1.0, int instride=1, int outstride=1) |
run the filter on a real input stream More... | |
void | dump (std::ostream &os) |
dump the filter FFT to the output stream More... | |
std::pair< double, double > | getFilterEdges () |
Protected Member Functions | |
int | guessN () |
pick a likely N - FFT length. More... | |
void | setupFFT () |
Protected Attributes | |
double | low_edge |
parameters that we keep to support display masks on the spectrogram More... | |
double | high_edge |
unsigned int | M |
the input buffer length; More... | |
unsigned int | Q |
the filter length More... | |
unsigned int | N |
the total length of the transform N > (M + Q-1) More... | |
unsigned int | tail_index |
the beginning of the end. More... | |
std::complex< float > * | fft_input |
a copy of the input stream. More... | |
std::complex< float > * | fft_output |
the transformed input stream + overlap More... | |
std::complex< float > * | ifft_output |
the output stream + overlap discard More... | |
std::complex< float > * | filter_fft |
FFT image of the input filter. More... | |
fftwf_plan | forward_plan |
fftwf_plan | backward_plan |
plans for fftw transform ops More... | |
Overlap-and-save filter class.
Definition at line 50 of file OSFilter.hxx.
SoDa::OSFilter::OSFilter | ( | float | low_cutoff, |
float | low_pass_edge, | ||
float | high_pass_edge, | ||
float | high_cutoff, | ||
unsigned int | filter_length, | ||
float | filter_gain, | ||
float | sample_rate, | ||
unsigned int | inout_buffer_length, | ||
unsigned int | suggested_transform_length = 0 |
||
) |
constructor
constructor Build the filter from a filter spec for a bandpass filter
low_cutoff | frequency below which the response is (ideally) zero |
low_pass_edge | low end of the bandpass range |
high_pass_edge | high end of the bandpass range |
high_cutoff | frequency above which the response is (ideally) zero |
filter_length | minimum number of effective filter taps |
filter_gain | desired gain in passband |
sample_rate | in samples/sec to allow normalization of the frequency specs |
inout_buffer_length | used to set aside storage for overlap and save buffer |
suggested_transform_length | a hint for optimizing FFT operations |
Definition at line 123 of file OSFilter.cxx.
References filter_fft, guessN(), high_edge, low_edge, M, N, Q, setupFFT(), and tail_index.
Referenced by ipow().
unsigned int SoDa::OSFilter::apply | ( | std::complex< float > * | inbuf, |
std::complex< float > * | outbuf, | ||
float | outgain = 1.0 |
||
) |
run the filter on a complex input stream
inbuf | the input buffer I/Q samples (complex) |
outbuf | the output buffer I/Q samples (complex) |
outgain | normalized output gain |
Definition at line 334 of file OSFilter.cxx.
References backward_plan, fft_input, fft_output, filter_fft, forward_plan, ifft_output, M, N, Q, and tail_index.
Referenced by SoDa::BaseBandRX::demodulate(), SoDa::BaseBandRX::demodulateAM(), SoDa::BaseBandRX::demodulateNBFM(), SoDa::BaseBandRX::demodulateWBFM(), main(), and SoDa::BaseBandTX::run().
unsigned int SoDa::OSFilter::apply | ( | float * | inbuf, |
float * | outbuf, | ||
float | outgain = 1.0 , |
||
int | instride = 1 , |
||
int | outstride = 1 |
||
) |
run the filter on a real input stream
inbuf | the input buffer samples |
outbuf | the output buffer samples (this can overlap the inbuf vector) |
outgain | normalized output gain |
instride | index increment for the input buffer |
outstride | index increment for the output buffer |
Definition at line 298 of file OSFilter.cxx.
References backward_plan, fft_input, fft_output, filter_fft, forward_plan, ifft_output, M, N, Q, and tail_index.
void SoDa::OSFilter::dump | ( | std::ostream & | os | ) |
dump the filter FFT to the output stream
os | an output stream. |
Definition at line 364 of file OSFilter.cxx.
References filter_fft, and N.
Referenced by buildFilterMap().
|
inline |
Definition at line 117 of file OSFilter.hxx.
References high_edge, and low_edge.
Referenced by SoDa::BaseBandRX::repAFFilterShape().
|
protected |
pick a likely N - FFT length.
Definition at line 248 of file OSFilter.cxx.
Referenced by ipow(), and OSFilter().
|
protected |
Definition at line 275 of file OSFilter.cxx.
References backward_plan, fft_input, fft_output, forward_plan, ifft_output, N, and Q.
Referenced by ipow(), and OSFilter().
|
protected |
plans for fftw transform ops
Definition at line 150 of file OSFilter.hxx.
Referenced by apply(), and setupFFT().
|
protected |
a copy of the input stream.
Definition at line 141 of file OSFilter.hxx.
Referenced by apply(), and setupFFT().
|
protected |
the transformed input stream + overlap
Definition at line 142 of file OSFilter.hxx.
Referenced by apply(), and setupFFT().
|
protected |
FFT image of the input filter.
Definition at line 146 of file OSFilter.hxx.
Referenced by apply(), dump(), ipow(), and OSFilter().
|
protected |
Definition at line 150 of file OSFilter.hxx.
Referenced by apply(), and setupFFT().
|
protected |
Definition at line 123 of file OSFilter.hxx.
Referenced by getFilterEdges(), and OSFilter().
|
protected |
the output stream + overlap discard
Definition at line 143 of file OSFilter.hxx.
Referenced by apply(), and setupFFT().
|
protected |
parameters that we keep to support display masks on the spectrogram
Definition at line 123 of file OSFilter.hxx.
Referenced by getFilterEdges(), and OSFilter().
|
protected |
the input buffer length;
Definition at line 133 of file OSFilter.hxx.
Referenced by apply(), guessN(), ipow(), and OSFilter().
|
protected |
the total length of the transform N > (M + Q-1)
Definition at line 135 of file OSFilter.hxx.
Referenced by apply(), dump(), ipow(), OSFilter(), and setupFFT().
|
protected |
the filter length
Definition at line 134 of file OSFilter.hxx.
Referenced by apply(), guessN(), ipow(), OSFilter(), and setupFFT().
|
protected |
the beginning of the end.
Definition at line 138 of file OSFilter.hxx.
Referenced by apply(), ipow(), and OSFilter().