Skip to content

Commit 8d2fb32

Browse files
singalsulgirdwood
authored andcommitted
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 <seppo.ingalsuo@linux.intel.com>
1 parent 3a1cded commit 8d2fb32

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/audio/drc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
config COMP_DRC
44
bool "Dynamic Range Compressor component"
55
select CORDIC_FIXED
6+
select MATH_LUT_SINE_FIXED
67
select NUMBERS_NORM
78
select MATH_EXP
89
select COMP_BLOB

src/audio/drc/drc_math.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <stdint.h>
1212
#include <sof/audio/format.h>
1313
#include <sof/math/numbers.h>
14+
#include <sof/math/lut_trig.h>
1415
#include <sof/math/trig.h>
1516

1617
#include "drc_plat_conf.h"
@@ -60,9 +61,8 @@ static inline int32_t drc_sin_fixed(int32_t x)
6061
{
6162
const int32_t lshift = drc_get_lshift(30, 30, 28);
6263
int32_t denorm_x = drc_mult_lshift(x, PI_OVER_TWO_Q30, lshift);
63-
int32_t sin_val = sin_fixed_16b(denorm_x);
6464

65-
return sin_val << 16;
65+
return sofm_lut_sin_fixed_16b(denorm_x) << 16;
6666
}
6767

6868
#ifdef DRC_USE_CORDIC_ASIN
@@ -88,9 +88,8 @@ static inline int32_t drc_asin_fixed(int32_t x)
8888
static inline int32_t drc_sin_fixed(int32_t x)
8989
{
9090
const int32_t PI_OVER_TWO = Q_CONVERT_FLOAT(1.57079632679489661923, 30);
91-
int32_t sin_val = sin_fixed_16b(Q_MULTSR_32X32((int64_t)x, PI_OVER_TWO, 30, 30, 28));
9291

93-
return sin_val << 16;
92+
return sofm_lut_sin_fixed_16b(Q_MULTSR_32X32((int64_t)x, PI_OVER_TWO, 30, 30, 28)) << 16;
9493
}
9594

9695
#ifdef DRC_USE_CORDIC_ASIN

0 commit comments

Comments
 (0)