Add i32 Q0.31 support to audio primitives
Change-Id: I118b5eacc9e348cbab8fc51bdf1d498fcbe25241
Signed-off-by: Andy Hung <hunga@google.com>
diff --git a/audio_utils/primitives.c b/audio_utils/primitives.c
index f57dc42..9a50bac 100644
--- a/audio_utils/primitives.c
+++ b/audio_utils/primitives.c
@@ -127,6 +127,27 @@
}
}
+void memcpy_to_i32_from_i16(int32_t *dst, const int16_t *src, size_t count)
+{
+ while (count--) {
+ *dst++ = (int32_t)*src++ << 16;
+ }
+}
+
+void memcpy_to_i32_from_float(int32_t *dst, const float *src, size_t count)
+{
+ while (count--) {
+ *dst++ = clamp32_from_float(*src++);
+ }
+}
+
+void memcpy_to_float_from_i32(float *dst, const int32_t *src, size_t count)
+{
+ while (count--) {
+ *dst++ = float_from_i32(*src++);
+ }
+}
+
void downmix_to_mono_i16_from_stereo_i16(int16_t *dst, const int16_t *src, size_t count)
{
while (count--) {