Sound Open Firmware
Loading...
Searching...
No Matches
exp_fcn.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2022-2025 Intel Corporation.
4 *
5 * Author: Shriram Shastry <malladi.sastry@linux.intel.com>
6 * Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
7 * Pasca, Bogdan <bogdan.pasca@intel.com>
8 */
9
10#ifndef __SOFM_EXP_FCN_H__
11#define __SOFM_EXP_FCN_H__
12
13#include <stdint.h>
14
15#if defined(__XCC__)
16/* HiFi */
17#include <xtensa/config/core-isa.h>
18#if XCHAL_HAVE_HIFI5 == 1
19#define SOFM_EXPONENTIAL_HIFI5 1
20#elif XCHAL_HAVE_HIFI4 == 1
21#define SOFM_EXPONENTIAL_HIFI4 1
22#elif XCHAL_HAVE_HIFI3 == 1
23#define SOFM_EXPONENTIAL_HIFI3 1
24#endif
25#else
26/* !XCC */
27#define EXPONENTIAL_GENERIC 1
28
29#endif
30
31/* Q5.27 int32(round(log((2^31 - 1)/2^20) * 2^27)) */
32#define SOFM_EXP_FIXED_INPUT_MAX 1023359037
33
34/* Q8.24 int32(round((log((2^31 - 1)/2^20) * 20 / log(10)) * 2^24)) */
35#define SOFM_DB2LIN_INPUT_MAX 1111097957
36
44int32_t sofm_exp_approx(int32_t x);
45
55int32_t sofm_exp_fixed(int32_t x);
56
57
65int32_t sofm_db2lin_fixed(int32_t db);
66
67#endif /* __SOFM_EXP_FCN_H__ */
int32_t sofm_exp_approx(int32_t x)
Calculates exponent function exp(x) = e^x with accurate and efficient technique that includes range r...
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 * ...