10#ifndef SBL_DSP_TYPES_CONVERT_HPP_
11#define SBL_DSP_TYPES_CONVERT_HPP_
22#ifdef SBL_PROFILING_ENABLED
23#define SBL_NAN_DETECTED() (++sbl::dsp::types::nan_detect_count())
25#define SBL_NAN_DETECTED() ((void)0)
52 constexpr uint32_t PAD_BITS = 8;
53 for (
size_t i = 0; i < frames; ++i) {
58 const int32_t l =
static_cast<int32_t
>(
static_cast<uint32_t
>(interleaved[i * 2]) << PAD_BITS) >> PAD_BITS;
59 const int32_t r =
static_cast<int32_t
>(
static_cast<uint32_t
>(interleaved[i * 2 + 1]) << PAD_BITS) >> PAD_BITS;
65#ifdef SBL_PROFILING_ENABLED
72inline uint32_t& nan_detect_count() {
73 static uint32_t count = 0;
94 for (
size_t i = 0; i < frames; ++i) {
#define SBL_NAN_DETECTED()
Count a NaN replaced by interleave_from_float()
Conversion at the DMA boundary.
void interleave_from_float(const float *left, const float *right, S24RjI32 *interleaved, uint16_t frames)
Interleave float L/R buffers into stereo codec words.
int32_t S24RjI32
One sample in the codec's DMA word format, s24_rj_i32
void deinterleave_to_float(const S24RjI32 *interleaved, float *left, float *right, uint16_t frames)
Deinterleave stereo codec words into float L/R buffers.
constexpr float SAMPLE_SCALE_INV_F
constexpr float SAMPLE_SCALE_F