sof: drc: fix drc_pow_fixed function

The proposed calculation doesn't take negative or zero input-x into
consideration, and we also don't need such use cases. Just return 0
for those input-x.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
This commit is contained in:
Pin-chih Lin 2021-02-04 17:45:50 +08:00 committed by Liam Girdwood
parent 90f7ac47b2
commit 5f2de711a0
1 changed files with 4 additions and 0 deletions

View File

@ -183,6 +183,10 @@ inline int32_t drc_asin_fixed(int32_t x)
*/
inline int32_t drc_pow_fixed(int32_t x, int32_t y)
{
/* Negative or zero input x is not supported, just return 0. */
if (x <= 0)
return 0;
/* x^y = expf(y * log(x)) */
return exp_fixed(q_mult(y, drc_log_fixed(x), 30, 26, 27));
}