forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRC: math: swapout the exponential function and fixing compilation er…
…rors. For improved performance, this checkin substitutes sofm_exp_int32() for exp_small_fixed(). Changes for successful compilation are also included; MATH_EXP was added to the Kconfig file, and an error occurred when 'unsigned long' was passed as a parameter of an incompatible type. Signed-off-by: shastry <[email protected]>
- Loading branch information
1 parent
cff6a6b
commit 87a4019
Showing
5 changed files
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,9 @@ | |
// | ||
// Author: Seppo Ingalsuo <[email protected]> | ||
|
||
#include <sof/audio/format.h> | ||
#include <sof/math/decibels.h> | ||
#include <sof/math/exp_fcn.h> | ||
#include <sof/audio/format.h> | ||
#include <stdint.h> | ||
|
||
#define ONE_Q20 Q_CONVERT_FLOAT(1.0, 20) /* Use Q12.20 */ | ||
|
@@ -105,10 +106,10 @@ int32_t exp_fixed(int32_t x) | |
n++; | ||
} | ||
|
||
/* exp_small_fixed() input is Q3.29, while x1 is Q5.27 | ||
* exp_small_fixed() output is Q9.23, while y0 is Q12.20 | ||
/* sofm_exp_int32() input is Q4.28, while x1 is Q5.27 | ||
* sofm_exp_int32() output is Q9.23, while y0 is Q12.20 | ||
*/ | ||
y0 = Q_SHIFT_RND(exp_small_fixed(Q_SHIFT_LEFT(xs, 27, 29)), 23, 20); | ||
y0 = Q_SHIFT_RND(sofm_exp_int32(Q_SHIFT_LEFT(xs, 27, 28)), 23, 20); | ||
y = ONE_Q20; | ||
for (i = 0; i < (1 << n); i++) | ||
y = (int32_t)Q_MULTSR_32X32((int64_t)y, y0, 20, 20, 20); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters