Skip to content

Commit 8bc42e4

Browse files
committed
Audio: DRC: Change DRC to use lookup table based sine function
This change saves about 13 MPCS while the .bss RAM usage increases by 2 kB. TODO: A 16 bit sine function should cope with smaller lookup and be friendlier for cache. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent e4de096 commit 8bc42e4

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/audio/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ config COMP_CROSSOVER
276276

277277
config COMP_DRC
278278
bool "Dynamic Range Compressor component"
279+
select LUT_TRIG_FIXED
279280
select CORDIC_FIXED
280281
select NUMBERS_NORM
281282
select MATH_DECIBELS

src/include/sof/audio/drc/drc_math.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <sof/audio/drc/drc_plat_conf.h>
1313
#include <sof/audio/format.h>
1414
#include <sof/math/numbers.h>
15+
#include <sof/math/lut_trig.h>
1516
#include <sof/math/trig.h>
1617

1718
/* Unmark this define to use cordic arc sine implementation. */
@@ -59,9 +60,7 @@ static inline int32_t drc_sin_fixed(int32_t x)
5960
{
6061
const int32_t lshift = drc_get_lshift(30, 30, 28);
6162
int32_t denorm_x = drc_mult_lshift(x, PI_OVER_TWO_Q30, lshift);
62-
int32_t sin_val = sin_fixed_16b(denorm_x);
63-
64-
return sin_val << 16;
63+
return sofm_lut_sin_fixed_32b(denorm_x);
6564
}
6665

6766
#ifdef DRC_USE_CORDIC_ASIN
@@ -87,9 +86,7 @@ static inline int32_t drc_asin_fixed(int32_t x)
8786
static inline int32_t drc_sin_fixed(int32_t x)
8887
{
8988
const int32_t PI_OVER_TWO = Q_CONVERT_FLOAT(1.57079632679489661923, 30);
90-
int32_t sin_val = sin_fixed_16b(Q_MULTSR_32X32((int64_t)x, PI_OVER_TWO, 30, 30, 28));
91-
92-
return sin_val << 16;
89+
return sofm_lut_sin_fixed_32b(Q_MULTSR_32X32((int64_t)x, PI_OVER_TWO, 30, 30, 28));
9390
}
9491

9592
#ifdef DRC_USE_CORDIC_ASIN

0 commit comments

Comments
 (0)