33 void upsample(std::span<const ComplexType>
in,
unsigned size, std::span<ComplexType>
out);
41 std::vector<ComplexType>
downsample(std::span<const ComplexType>
in);
69 std::vector<RealType> _coeffs;
70 std::vector<ComplexType> _line;
71 std::vector<ComplexType> _pending;
72 std::uint64_t _input_sample_count = 0;
73 std::uint64_t _processed_sample_count = 0;
74 std::uint64_t _next_output_index = 0;
75 std::uint64_t _target_output_count = 0;
76 std::size_t _delay = 0;
77 bool _finished =
false;
104 virtual void filter(std::span<RealType> samples) = 0;
146 void filter(std::span<RealType> samples)
noexcept override;
149 std::vector<RealType> _a;
150 std::vector<RealType> _b;
151 std::vector<RealType> _w;
168 _filter(coeffs.
begin(), coeffs.end()), _w(coeffs.
size()), _order(coeffs.
size())
178 void filter(std::span<RealType> )
noexcept override {}
185 void filter(std::vector<ComplexType>& samples)
const;
188 std::vector<RealType> _filter;
189 std::vector<RealType> _w;
190 std::size_t _order{};
Implements a specialized upsampler with a fixed upsampling factor of 10.
DecadeUpsampler & operator=(const DecadeUpsampler &)=delete
~DecadeUpsampler()=default
DecadeUpsampler(const DecadeUpsampler &)=delete
DecadeUpsampler(DecadeUpsampler &&) noexcept=default
Stateful FIR decimator for chunked streaming output.
unsigned ratio() const noexcept
std::uint64_t inputSampleCount() const noexcept
std::uint64_t outputSampleCount() const noexcept
std::vector< ComplexType > takeOutput()
void consume(std::span< const ComplexType > block)
Abstract base class for digital filters.
DspFilter(const DspFilter &)=delete
DspFilter & operator=(const DspFilter &)=delete
virtual ~DspFilter()=default
DspFilter(DspFilter &&) noexcept=default
virtual void filter(std::span< RealType > samples)=0
Filters a block of samples.
virtual RealType filter(RealType sample)=0
Filters a single sample.
Implements a Finite Impulse Response (FIR) filter.
void filter(std::span< RealType >) noexcept override
Filters real-valued samples; FIR block filtering is unsupported for this overload.
~FirFilter() override=default
FirFilter(std::span< const RealType > coeffs)
Constructs an FIR filter with the given coefficients.
RealType filter(RealType) override
Filters a single real-valued sample; FIR scalar filtering is unsupported.
Implements an Infinite Impulse Response (IIR) filter.
~IirFilter() override=default
Global configuration file for the project.
double RealType
Type for real numbers.
std::complex< RealType > ComplexType
Type for complex numbers.
void upsample(const std::span< const ComplexType > in, const unsigned size, std::span< ComplexType > out)
Upsamples a complex waveform with zero-stuffing followed by Blackman FIR filtering.
std::vector< ComplexType > downsample(std::span< const ComplexType > in)
Low-pass filters and decimates an oversampled complex waveform back to base rate.