17#ifndef SBL_DSP_PRIMITIVES_BIT_REDUCER_HPP_
18#define SBL_DSP_PRIMITIVES_BIT_REDUCER_HPP_
31 levels_ = exp2f(
bits);
32 inv_levels_ = 1.0f / levels_;
35 float bits()
const {
return bits_; }
39 return roundf(x * levels_) * inv_levels_;
43 void process(
float* buf, uint16_t n)
const {
44 for (uint16_t i = 0; i < n; ++i) {
51 float levels_ = 65536.0f;
52 float inv_levels_ = 1.0f / 65536.0f;
void set_bits(float bits)
float process(float x) const
Process a single sample.
void process(float *buf, uint16_t n) const
Process a block of samples in-place.
Stateful, single-concern building blocks.