1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2021 Intel Corporation. All rights reserved. 4 * 5 * Author: Shriram Shastry <malladi.sastry@linux.intel.com> 6 * 7 */ 8 9 #ifndef __SOF_MATH_CORDIC_H__ 10 #define __SOF_MATH_CORDIC_H__ 11 12 #include <stdint.h> 13 14 /** 15 * cordic_atan2_lookup_table = atan(2.^-(0:N-1)) N = 31/16 16 * CORDIC Gain is cordic_gain = prod(sqrt(1 + 2.^(-2*(0:31/16-1)))) 17 * Inverse CORDIC Gain,inverse_cordic_gain = 1 / cordic_gain 18 */ 19 static const int32_t cordic_lookup[CORDIC_31B_TABLE_SIZE] = { 843314857, 497837829, 20 263043837, 133525159, 67021687, 33543516, 16775851, 8388437, 4194283, 2097149, 21 1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 22 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 }; 23 /* calculate LUT = 2*atan(2.^(-1:-1:(nIters)+1)) */ 24 static const int32_t cordic_ilookup[CORDIC_30B_ITABLE_SIZE] = { 25 497837829, 263043836, 133525158, 67021686, 33543515, 16775850, 26 8388437, 4194282, 2097149, 1048575, 524287, 262143, 27 131071, 65535, 32767, 16383, 8191, 4095, 28 2047, 1023, 511, 255, 127, 63, 29 31, 15, 8, 4, 2, 1}; 30 31 #endif /* __SOF_MATH_CORDIC_H__ */ 32