From f4049bb7d6dfee2925da372956f1e757d6a8c1e4 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Thu, 8 Nov 2018 18:36:06 +0200 Subject: [PATCH] Volume: Bug fix for vol_mult_s24_to_s16() function The previous commit introduced a bug in this volume function. The input parameter for s24 PCM samples must be int32_t. The bug causes for s24 to s16 converted audio very low signal level and noise due to overflows. Signed-off-by: Seppo Ingalsuo --- src/audio/volume_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/volume_generic.c b/src/audio/volume_generic.c index 60215a7b47d5..94104dbe8d47 100644 --- a/src/audio/volume_generic.c +++ b/src/audio/volume_generic.c @@ -50,7 +50,7 @@ * * Volume multiply for 24 bit input and 16 bit bit output. */ -static inline int16_t vol_mult_s24_to_s16(int16_t x, int32_t vol) +static inline int16_t vol_mult_s24_to_s16(int32_t x, int32_t vol) { return (int16_t)q_multsr_sat_32x32_16(sign_extend_s24(x), vol, Q_SHIFT_BITS_64(23, 16, 15));