Skip to main content

Module ops

Module ops 

Source
Expand description

Block-rate audio ops at f32. See crate::ops64 for the f64 mirror.

Two implementations per op when wide-backend is enabled: a scalar fallback (the *_scalar variant, also the body when the feature is off) and a vector path that processes f32x8 chunks. The scalar variants are kept pub so the Criterion benches can compare pre-/post-vectorization on exactly the same operation.

Functions§

abs_max_block
max(buf[i].abs()). Returns 0.0 for an empty slice; returns f32::NAN on first NaN (so meters can flag a runaway plugin instead of silently reporting in-range peaks).
copy_block
out[i] = src[i]. Equivalent to copy_from_slice but exposed in the same surface as the other ops for code that wires up its inner loops from this module.
gain_block
buf[i] *= gain for every element. Vectorized when wide-backend is on, otherwise identical to the scalar path.
gain_block_scalar
buf[i] *= gain for every element. Scalar.
mac_block
out[i] += src[i] * scale. Vectorized when wide-backend is on.
mac_block_scalar
Multiply-accumulate: out[i] += src[i] * scale. Scalar.
mix_block
out[i] = a[i] * gain_a + b[i] * gain_b. Vectorized when wide-backend is on.
mix_block_scalar
out[i] = a[i] * gain_a + b[i] * gain_b. Scalar.
mul_block
out[i] = a[i] * b[i]. Vectorized when wide-backend is on.
mul_block_scalar
out[i] = a[i] * b[i] (length: min(out, a, b)). Scalar.
scale_block
out[i] = src[i] * scale. Vectorized when wide-backend is on.
scale_block_scalar
out[i] = src[i] * scale (length: min(out, src)). Scalar. The non-aliased counterpart to gain_block - fills the “copy then gain” hole in the API so a single line covers what would otherwise need two calls and a discarded intermediate.
zero_block
out[i] = 0.0 for all i.