From 8d2fb32fa50156d6c6361d6ecd16905d6e51cf73 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Fri, 17 Nov 2023 18:32:58 +0200 Subject: [PATCH] Audio: DRC: Change DRC to use lookup table based sine function This change saves in TGL platform about 13 MPCS, from 83 to 70 MCPS. In MTL platform the saving is 12 MCPS, from 46 to 34 MCPS. The .bss RAM usage increases by 1 kB from selecting CONFIG_MATH_LUT_SINE_FIXED. Signed-off-by: Seppo Ingalsuo --- src/audio/drc/Kconfig | 1 + src/audio/drc/drc_math.h | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/drc/Kconfig b/src/audio/drc/Kconfig index 985feede9..dfc5aba4f 100644 --- a/src/audio/drc/Kconfig +++ b/src/audio/drc/Kconfig @@ -3,6 +3,7 @@ config COMP_DRC bool "Dynamic Range Compressor component" select CORDIC_FIXED + select MATH_LUT_SINE_FIXED select NUMBERS_NORM select MATH_EXP select COMP_BLOB diff --git a/src/audio/drc/drc_math.h b/src/audio/drc/drc_math.h index 8748632e5..0d89fd77a 100644 --- a/src/audio/drc/drc_math.h +++ b/src/audio/drc/drc_math.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "drc_plat_conf.h" @@ -60,9 +61,8 @@ static inline int32_t drc_sin_fixed(int32_t x) { const int32_t lshift = drc_get_lshift(30, 30, 28); int32_t denorm_x = drc_mult_lshift(x, PI_OVER_TWO_Q30, lshift); - int32_t sin_val = sin_fixed_16b(denorm_x); - return sin_val << 16; + return sofm_lut_sin_fixed_16b(denorm_x) << 16; } #ifdef DRC_USE_CORDIC_ASIN @@ -88,9 +88,8 @@ static inline int32_t drc_asin_fixed(int32_t x) static inline int32_t drc_sin_fixed(int32_t x) { const int32_t PI_OVER_TWO = Q_CONVERT_FLOAT(1.57079632679489661923, 30); - int32_t sin_val = sin_fixed_16b(Q_MULTSR_32X32((int64_t)x, PI_OVER_TWO, 30, 30, 28)); - return sin_val << 16; + return sofm_lut_sin_fixed_16b(Q_MULTSR_32X32((int64_t)x, PI_OVER_TWO, 30, 30, 28)) << 16; } #ifdef DRC_USE_CORDIC_ASIN