[Sound-open-firmware] [PATCH 2/3] mixer: use int64_t intermediate variable to avoid clamping

Keyon Jie yang.jie at linux.intel.com
Tue Jan 3 03:40:53 CET 2017


As we have changed internal buffer to 32 bits, to
avoid clamping, we need to change accumulator to
64 bits.

Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/audio/mixer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/audio/mixer.c b/src/audio/mixer.c
index d08bc30..b996dae 100644
--- a/src/audio/mixer.c
+++ b/src/audio/mixer.c
@@ -51,7 +51,8 @@ struct mixer_data {
 static void mix_n(struct comp_dev *dev, struct comp_buffer *sink,
 	struct comp_buffer **sources, uint32_t num_sources, uint32_t frames)
 {
-	int32_t *src, *dest = sink->w_ptr, val[2], count;
+	int32_t *src, *dest = sink->w_ptr, count;
+	int64_t val[2];
 	int i, j;
 
 	count = frames * sink->params.channels;
-- 
2.7.4



More information about the Sound-open-firmware mailing list