Sound Open Firmware
Loading...
Searching...
No Matches
exp_fcn.h File Reference
Include dependency graph for exp_fcn.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EXPONENTIAL_GENERIC   1
#define SOFM_EXP_FIXED_INPUT_MAX   1023359037
#define SOFM_DB2LIN_INPUT_MAX   1111097957

Functions

int32_t sofm_exp_approx (int32_t x)
 Calculates exponent function exp(x) = e^x with accurate and efficient technique that includes range reduction operations, approximation with Taylor series, and reconstruction operations to compensate the range reductions.
int32_t sofm_exp_fixed (int32_t x)
 Calculated exponent function exp(x) = e^x by using sofm_exp_approx().
int32_t sofm_db2lin_fixed (int32_t db)
 Converts a decibels value to liner amplitude lin = 10^(db/20) value with optimized equation exp(db * log(10)/20).

Macro Definition Documentation

◆ EXPONENTIAL_GENERIC

#define EXPONENTIAL_GENERIC   1

◆ SOFM_DB2LIN_INPUT_MAX

#define SOFM_DB2LIN_INPUT_MAX   1111097957

◆ SOFM_EXP_FIXED_INPUT_MAX

#define SOFM_EXP_FIXED_INPUT_MAX   1023359037

Function Documentation

◆ sofm_db2lin_fixed()

int32_t sofm_db2lin_fixed ( int32_t db)

Converts a decibels value to liner amplitude lin = 10^(db/20) value with optimized equation exp(db * log(10)/20).

Note that due to range limitation of sofm_exp_fixed() the output saturates to maximum with about +66 dB input.

Parameters
dbDecibels value in Q8.24 format, from -128 to +66.226
Returns
Linear value in Q12.20 format, from 3.9811e-07 to 2048

◆ sofm_exp_approx()

int32_t sofm_exp_approx ( int32_t x)

Calculates exponent function exp(x) = e^x with accurate and efficient technique that includes range reduction operations, approximation with Taylor series, and reconstruction operations to compensate the range reductions.

Parameters
xThe input argument as Q4.28 from -8 to +8
Returns
The calculated e^x value as Q13.19 from 3.3546e-04 to 2981.0

◆ sofm_exp_fixed()

int32_t sofm_exp_fixed ( int32_t x)

Calculated exponent function exp(x) = e^x by using sofm_exp_approx().

The input range for large arguments is internally reduced to -8 to +8 with rule exp(x) = exp(x/2) * exp(x/2) and reconstructed back. This function is essentially a wrapper for compatibility with existing usage of exp() function and Q-format choice. Note that the return value saturates to INT32_MAX with input arguments larger than 7.6246.

Parameters
xThe input argument as Q5.27 from -16 to +16
Returns
The calculated e^x value as Q12.20