Add Q19.12 to float conversion
Change-Id: I4c9affada24da4a61afff83442fc74bb0db41549
Signed-off-by: Andy Hung <hunga@google.com>
diff --git a/audio_utils/primitives.c b/audio_utils/primitives.c
index e2d4abc..153f3a3 100644
--- a/audio_utils/primitives.c
+++ b/audio_utils/primitives.c
@@ -60,6 +60,15 @@
}
}
+void memcpy_to_float_from_q19_12(float *dst, const int32_t *src, size_t c)
+{
+ size_t i;
+ static const float scale = 1. / (32768. * 4096.);
+ for (i = 0; i < c; ++i) {
+ *dst++ = *src++ * scale;
+ }
+}
+
void downmix_to_mono_i16_from_stereo_i16(int16_t *dst, const int16_t *src, size_t count)
{
while (count--) {