17#include <TargetConditionals.h>
22#if defined(PULP_SIMD_DEFAULT_BACKEND_ACCELERATE) && defined(__aarch64__) && \
23 defined(TARGET_OS_OSX) && TARGET_OS_OSX
24#define PULP_FIXED_IR_MEASURED_TABLE 1
26#define PULP_FIXED_IR_MEASURED_TABLE 0
74 direct_.set_coefficients({});
85 direct_.set_coefficients(std::vector<SampleType>(ir, ir + ir_length));
87 partitioned_.load_ir(ir, ir_length,
block_size);
115#if PULP_FIXED_IR_MEASURED_TABLE
116 if constexpr (!std::is_same_v<SampleType, float>) {
145 void process(
const SampleType* input, SampleType* output, std::size_t num_samples) {
149 std::copy_n(input, num_samples, output);
154 if (num_samples != block_size_)
156 partitioned_.process(input, output, num_samples);
161 if (num_samples > block_size_) {
162 std::fill_n(output, num_samples, SampleType{0});
167 direct_.process(input, output,
static_cast<int>(num_samples));
176 partitioned_.reset();
189 [[nodiscard]] std::size_t
latency() const noexcept {
205 std::size_t block_size_ = 0;
206 std::uint64_t violations_ = 0;
FIR filter with arbitrary coefficients.
Definition fir_filter.hpp:39
Zero-latency convolution with one impulse response for the lifetime of a preparation,...
Definition fixed_ir_convolver.hpp:61
std::size_t block_size() const noexcept
Definition fixed_ir_convolver.hpp:186
void reset()
Clear the history so the next block starts from silence.
Definition fixed_ir_convolver.hpp:174
bool is_loaded() const noexcept
Definition fixed_ir_convolver.hpp:180
void process(const SampleType *input, SampleType *output, std::size_t num_samples)
Process one block.
Definition fixed_ir_convolver.hpp:145
static constexpr ConvolutionBackend choose_backend(std::size_t ir_length, std::size_t block_size) noexcept
The engine policy: a pure function of IR length and block size, so the choice is deterministic and ch...
Definition fixed_ir_convolver.hpp:92
std::size_t latency() const noexcept
Definition fixed_ir_convolver.hpp:189
void load_ir(const SampleType *ir, std::size_t ir_length, std::size_t block_size)
Load an IR on the engine choose_backend() selects.
Definition fixed_ir_convolver.hpp:66
static constexpr std::size_t direct_fir_limit(std::size_t block_size) noexcept
The longest IR run on the direct engine for a block size.
Definition fixed_ir_convolver.hpp:114
std::uint64_t block_size_violations() const noexcept
Calls to process() with a frame count the engine cannot take (any other than block_size() for the FFT...
Definition fixed_ir_convolver.hpp:196
ConvolutionBackend backend() const noexcept
Definition fixed_ir_convolver.hpp:199
void load_ir(const SampleType *ir, std::size_t ir_length, std::size_t block_size, ConvolutionBackend engine)
Load an IR on a named engine, for callers with their own measurements for the target.
Definition fixed_ir_convolver.hpp:72
Uniform partitioned convolution engine.
Definition convolver.hpp:46
Finite Impulse Response filter with configurable order and coefficients.
constexpr std::size_t convolver_block_size(std::size_t block_size) noexcept
The block size a convolver prepared for block_size accepts: the request rounded up to the next power ...
Definition convolver_messages.hpp:188
Definition additive_bank.hpp:218
FixedIrConvolverT< float > FixedIrConvolver
Definition fixed_ir_convolver.hpp:211
FixedIrConvolverT< double > FixedIrConvolver64
Definition fixed_ir_convolver.hpp:212
@ none
Definition dither.hpp:17
ConvolutionBackend
The engine a FixedIrConvolverT runs.
Definition fixed_ir_convolver.hpp:32
@ direct_fir
FirFilterT: a vectorized time-domain dot product.
Definition fixed_ir_convolver.hpp:34
@ none
No IR loaded; process() passes audio through.
Definition fixed_ir_convolver.hpp:33
@ partitioned_fft
PartitionedConvolverT: uniform overlap-save FFT.
Definition fixed_ir_convolver.hpp:35