Vectorised buffer operations on pulp::audio::BufferView<float>. More...
Go to the source code of this file.
Classes | |
| struct | pulp::audio::buffer_ops::MinMax |
| Pair returned by find_min_max. More... | |
| struct | pulp::audio::buffer_ops::PeakRms |
| Block level reading returned by measure_peak_rms: the peak absolute sample value and the root-mean-square level. More... | |
Namespaces | |
| namespace | pulp |
| namespace | pulp::audio |
| namespace | pulp::audio::buffer_ops |
Functions | |
| template<typename Fn> | |
| void | pulp::audio::buffer_ops::map_samples (const float *in, float *out, std::size_t n, Fn &&fn) |
| Write out[i] = fn(in[i]) for every sample, in index order. | |
| template<std::size_t... Counts, typename Fn> | |
| void | pulp::audio::buffer_ops::with_channel_count (std::size_t channels, Fn &&fn) |
| Call fn once with the channel count, as a compile-time constant when it is one of Counts... and as a runtime std::size_t otherwise. | |
| void | pulp::audio::buffer_ops::apply_gain (std::span< float > samples, float gain) |
| Apply a constant gain to a single channel of samples in place. | |
| void | pulp::audio::buffer_ops::apply_gain (BufferView< float > buffer, float gain) |
| Apply a constant gain to every channel of a multi-channel buffer. | |
| void | pulp::audio::buffer_ops::apply_gain_ramp (std::span< float > samples, float start_gain, float end_gain) |
| Apply a linear gain ramp from start_gain to end_gain across the span. | |
| void | pulp::audio::buffer_ops::apply_gain_ramp (BufferView< float > buffer, float start_gain, float end_gain) |
| Apply the same gain ramp to every channel of a multi-channel buffer. | |
| void | pulp::audio::buffer_ops::clip (std::span< float > samples, float lo, float hi) |
| Hard-clip every sample to [lo, hi] in place. | |
| void | pulp::audio::buffer_ops::clip (BufferView< float > buffer, float lo, float hi) |
| Hard-clip every channel of a multi-channel buffer to [lo, hi]. | |
| MinMax | pulp::audio::buffer_ops::find_min_max (std::span< const float > samples) |
| Find the min and max sample values in a span. | |
| MinMax | pulp::audio::buffer_ops::find_min_max (const BufferView< float > &buffer, std::size_t channel) |
| Find the min and max for one channel of a multi-channel buffer. | |
| MinMax | pulp::audio::buffer_ops::find_min_max (const BufferView< const float > &buffer, std::size_t channel) |
| float | pulp::audio::buffer_ops::find_magnitude (std::span< const float > samples) |
| Find the peak absolute value (magnitude) in a span. | |
| float | pulp::audio::buffer_ops::find_magnitude (const BufferView< float > &buffer, std::size_t channel) |
| Find the peak absolute value across one channel of a multi-channel buffer. | |
| float | pulp::audio::buffer_ops::find_magnitude (const BufferView< const float > &buffer, std::size_t channel) |
| PeakRms | pulp::audio::buffer_ops::measure_peak_rms (std::span< const float > samples) noexcept |
| Measure the peak absolute value and RMS of a block in one pass. | |
| PeakRms | pulp::audio::buffer_ops::measure_peak_rms (const BufferView< float > &buffer, std::size_t channel) noexcept |
| Measure one channel of a multi-channel buffer. | |
| PeakRms | pulp::audio::buffer_ops::measure_peak_rms (const BufferView< const float > &buffer, std::size_t channel) noexcept |
Variables | |
| constexpr std::size_t | pulp::audio::buffer_ops::kPeakRmsLanes = 16 |
| Number of independent partial sums measure_peak_rms keeps. | |
Vectorised buffer operations on pulp::audio::BufferView<float>.
These helpers wrap the SIMD primitives in pulp::runtime::simd with audio-friendly semantics: in-place gain, gain ramps, hard clipping, and min/max + magnitude scans. They are allocation-free and safe to call from the audio thread.
Layout choice:
Ramp helpers (apply_gain_ramp) keep the increment scalar so successive samples step in exactly one ULP intervals — vectorising the ramp loop would either introduce off-by-N rounding or require a per-lane initial offset table that costs more than the scalar walk on modern OoO cores.