Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
oversampling_fir.hpp File Reference

Linear-phase 2x FIR stage used by the realtime oversampler. More...

#include <pulp/signal/fir_filter.hpp>
#include <pulp/signal/windowed_sinc_design.hpp>
#include <pulp/simd/simd.hpp>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <vector>

Go to the source code of this file.

Classes

class  pulp::signal::detail::FixedHalfBandFir65
class  pulp::signal::detail::LinearPhaseOversamplingStage2x< SampleType >
class  pulp::signal::detail::FixedOrderFirBranch< SampleType >
 One polyphase branch of a block 2x stage: a direct-form FIR whose every output is the taps summed oldest-first, one multiply-add each (fused where the hardware has it; see fir_multiply_add()). More...
class  pulp::signal::detail::LinearPhaseOversamplingBlockStage2x< SampleType >
 The block form of LinearPhaseOversamplingStage2x, for OversamplerT: the same prototype and the same polyphase split, run a block at a time. More...

Namespaces

namespace  pulp
namespace  pulp::signal
namespace  pulp::signal::detail
 Round-2 effect-wave vocabulary.

Macros

#define PULP_SIGNAL_HARDWARE_FMA   0
 Whether the block FIR fuses its multiply-adds.

Functions

std::vector< double > pulp::signal::detail::linear_phase_oversampling_prototype (double passband_edge_fraction, double stopband_db, std::size_t taps)
 The Kaiser-windowed lowpass prototype both linear-phase 2x stage forms split into polyphase branches.
template<typename SampleType>
SampleType pulp::signal::detail::fir_multiply_add (SampleType a, SampleType b, SampleType acc) noexcept
 acc + a * b for the block FIR: one fused multiply-add where the hardware has it, a separate multiply and add otherwise.

Variables

constexpr std::size_t pulp::signal::kHouseHalfBandTaps = 65
 Pulp's low-latency linear-phase half-band design.
constexpr double pulp::signal::kHouseHalfBandStopbandDb = 81.3
constexpr double pulp::signal::kHouseHalfBandStageOnePassband = 0.45
constexpr double pulp::signal::kHouseHalfBandStageTwoPassband = 0.225

Detailed Description

Linear-phase 2x FIR stage used by the realtime oversampler.

Macro Definition Documentation

◆ PULP_SIGNAL_HARDWARE_FMA

#define PULP_SIGNAL_HARDWARE_FMA   0

Whether the block FIR fuses its multiply-adds.

Without hardware FMA (x86-64's SSE2 baseline), std::fma is a library call per tap that also blocks vectorization, which made this loop more than an order of magnitude slower on an x86-64 baseline build.

The choice must be the same in every translation unit: the classes below are inline, so two TUs that chose differently (one built with -mfma) would define them differently. It therefore follows the target architecture, which all of a build's TUs share, and never a per-file ISA flag such as FMA: arm64 always has FMA. An x86 build whose every TU targets FMA opts in by defining PULP_SIGNAL_HARDWARE_FMA=1 for the whole build.