17#ifndef RESONANCE_AUDIO_BASE_SIMD_UTILS_H_
18#define RESONANCE_AUDIO_BASE_SIMD_UTILS_H_
29bool IsAligned(
const float* pointer);
30bool IsAligned(
const int16_t* pointer);
40size_t FindNextAlignedArrayIndex(
size_t length,
size_t type_size_bytes,
41 size_t memory_alignment_bytes);
50void AddPointwise(
size_t length,
const float* input_a,
const float* input_b,
59void SubtractPointwise(
size_t length,
const float* input_a,
60 const float* input_b,
float* output);
69void MultiplyPointwise(
size_t length,
const float* input_a,
70 const float* input_b,
float* output);
79void MultiplyAndAccumulatePointwise(
size_t length,
const float* input_a,
80 const float* input_b,
float* accumulator);
88void ScalarMultiply(
size_t length,
float gain,
const float* input,
98void ScalarMultiplyAndAccumulate(
size_t length,
float gain,
const float* input,
106void ReciprocalSqrt(
size_t length,
const float* input,
float* output);
113void Sqrt(
size_t length,
const float* input,
float* output);
121void ApproxComplexMagnitude(
size_t length,
const float* input,
float* output);
135void ComplexInterleavedFormatFromMagnitudeAndSinCosPhase(
136 size_t length,
const float* magnitude,
const float* cos_phase,
137 const float* sin_phase,
float* complex_interleaved_format_output);
146void StereoFromMonoSimd(
size_t length,
const float* mono,
float* left,
156void MonoFromStereoSimd(
size_t length,
const float* left,
const float* right,
164void Int16FromFloat(
size_t length,
const float* input, int16_t* output);
171void FloatFromInt16(
size_t length,
const int16_t* input,
float* output);
180void InterleaveStereo(
size_t length,
const int16_t* channel_0,
181 const int16_t* channel_1, int16_t* interleaved_buffer);
190void InterleaveStereo(
size_t length,
const float* channel_0,
191 const float* channel_1,
float* interleaved_buffer);
201void InterleaveStereo(
size_t length,
const float* channel_0,
202 const float* channel_1, int16_t* interleaved_buffer);
211void DeinterleaveStereo(
size_t length,
const int16_t* interleaved_buffer,
212 int16_t* channel_0, int16_t* channel_1);
221void DeinterleaveStereo(
size_t length,
const float* interleaved_buffer,
222 float* channel_0,
float* channel_1);
232void DeinterleaveStereo(
size_t length,
const int16_t* interleaved_buffer,
233 float* channel_0,
float* channel_1);
245void InterleaveQuad(
size_t length,
const int16_t* channel_0,
246 const int16_t* channel_1,
const int16_t* channel_2,
247 const int16_t* channel_3, int16_t* workspace,
248 int16_t* interleaved_buffer);
260void InterleaveQuad(
size_t length,
const float* channel_0,
261 const float* channel_1,
const float* channel_2,
262 const float* channel_3,
float* workspace,
263 float* interleaved_buffer);
275void DeinterleaveQuad(
size_t length,
const int16_t* interleaved_buffer,
276 int16_t* workspace, int16_t* channel_0,
277 int16_t* channel_1, int16_t* channel_2,
290void DeinterleaveQuad(
size_t length,
const float* interleaved_buffer,
291 float* workspace,
float* channel_0,
float* channel_1,
292 float* channel_2,
float* channel_3);