Commit 9ded527
Math: Replace exp() function with more accurate and fast version
The function sofm_exp_int32() is replaced with new sofm_exp_approx()
function. It's not a direct replacement so the name is
changed. The input range changes from +/- 5 to +/- 8.
The wrapper function sofm_exp_fixed() with input range -16 .. +7.6
is updated to use the new function with a simpler range reduction
for large negative input values. All current exponent function
usage in SOF components is for the wrapper function that remains
compatible.
The function sofm_db2lin_fixed() is updated to handle larger
negative input decibels values made possible by the new more
accurate exponent function.
The accuracy in exponent function for input ranges from -8 to +8 or
-16 to 7.6 depending on used exponent function improves from
absolute error of 1 to 1000 ppm to constant less than 1 ppm.
The cycles count for exponent function calculate decreases from
about 369 max to 78 max on MTL platform for HiFi code version with
-O2 or -O3 optimization. The generic C version on MTL platform is
max 88 cycles.
The DRC component is a heavy user of the exponent function. The
saving in MTL build of DRC is 10.5 MCPS, it drops from 22.17 to
11.70 with profiler run:
"scripts/sof-testbench-helper.sh -x -m drc -p profile.txt"
The saving in MTL build of multiband DRC is 30.2 MCPS, it drops from
127.95 to 97.78 with profiler run:
"scripts/sof-testbench-helper.sh -x -m drc_multiband -p profile.txt"
This patch also updates the cmocka test. The test functions are
changed due to changed function name, changed achievable accuracy.
Also the random values test points vector is replaced fixed a
fixed linearly spaced vector for repeatable test and risk for
random failures.
Signed-off-by: Shriram Shastry <malladi.sastry@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>1 parent f60992f commit 9ded527
4 files changed
Lines changed: 533 additions & 628 deletions
File tree
- src
- include/sof/math
- math
- test/cmocka/src/math/arithmetic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
52 | 44 | | |
53 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 56 | | |
61 | | - | |
62 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
0 commit comments