1 /*
2  * Copyright (C) 2004-2010 NXP Software
3  * Copyright (C) 2010 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 
19 #ifndef __LVEQNB_COEFFS_H__
20 #define __LVEQNB_COEFFS_H__
21 
22 
23 /************************************************************************************/
24 /*                                                                                  */
25 /* Gain table for (10^(Gain/20) - 1)                                                */
26 /*                                                                                  */
27 /************************************************************************************/
28 #ifdef BUILD_FLOAT
29 #define LVEQNB_Gain_Neg15_dB                             (-0.822172f)
30 #define LVEQNB_Gain_Neg14_dB                             (-0.800474f)
31 #define LVEQNB_Gain_Neg13_dB                             (-0.776128f)
32 #define LVEQNB_Gain_Neg12_dB                             (-0.748811f)
33 #define LVEQNB_Gain_Neg11_dB                             (-0.718162f)
34 #define LVEQNB_Gain_Neg10_dB                             (-0.683772f)
35 #define LVEQNB_Gain_Neg9_dB                              (-0.645187f)
36 #define LVEQNB_Gain_Neg8_dB                              (-0.601893f)
37 #define LVEQNB_Gain_Neg7_dB                              (-0.553316f)
38 #define LVEQNB_Gain_Neg6_dB                              (-0.498813f)
39 #define LVEQNB_Gain_Neg5_dB                              (-0.437659f)
40 #define LVEQNB_Gain_Neg4_dB                              (-0.369043f)
41 #define LVEQNB_Gain_Neg3_dB                              (-0.292054f)
42 #define LVEQNB_Gain_Neg2_dB                              (-0.205672f)
43 #define LVEQNB_Gain_Neg1_dB                              (-0.108749f)
44 #define LVEQNB_Gain_0_dB                                  0.000000f
45 #define LVEQNB_Gain_1_dB                                  0.122018f
46 #define LVEQNB_Gain_2_dB                                  0.258925f
47 #define LVEQNB_Gain_3_dB                                  0.412538f
48 #define LVEQNB_Gain_4_dB                                  0.584893f
49 #define LVEQNB_Gain_5_dB                                  0.778279f
50 #define LVEQNB_Gain_6_dB                                  0.995262f
51 #define LVEQNB_Gain_7_dB                                  1.238721f
52 #define LVEQNB_Gain_8_dB                                  1.511886f
53 #define LVEQNB_Gain_9_dB                                  1.818383f
54 #define LVEQNB_Gain_10_dB                                 2.162278f
55 #define LVEQNB_Gain_11_dB                                 2.548134f
56 #define LVEQNB_Gain_12_dB                                 2.981072f
57 #define LVEQNB_Gain_13_dB                                 3.466836f
58 #define LVEQNB_Gain_14_dB                                 4.011872f
59 #define LVEQNB_Gain_15_dB                                 4.623413f
60 #else
61 #define LVEQNB_GAINSHIFT                                   11         /* As a power of 2 */
62 #define LVEQNB_Gain_Neg15_dB                           (-1684)        /* Floating point value -0.822172 */
63 #define LVEQNB_Gain_Neg14_dB                           (-1639)        /* Floating point value -0.800474 */
64 #define LVEQNB_Gain_Neg13_dB                           (-1590)        /* Floating point value -0.776128 */
65 #define LVEQNB_Gain_Neg12_dB                           (-1534)        /* Floating point value -0.748811 */
66 #define LVEQNB_Gain_Neg11_dB                           (-1471)        /* Floating point value -0.718162 */
67 #define LVEQNB_Gain_Neg10_dB                           (-1400)        /* Floating point value -0.683772 */
68 #define LVEQNB_Gain_Neg9_dB                            (-1321)        /* Floating point value -0.645187 */
69 #define LVEQNB_Gain_Neg8_dB                            (-1233)        /* Floating point value -0.601893 */
70 #define LVEQNB_Gain_Neg7_dB                            (-1133)        /* Floating point value -0.553316 */
71 #define LVEQNB_Gain_Neg6_dB                            (-1022)        /* Floating point value -0.498813 */
72 #define LVEQNB_Gain_Neg5_dB                             (-896)        /* Floating point value -0.437659 */
73 #define LVEQNB_Gain_Neg4_dB                             (-756)        /* Floating point value -0.369043 */
74 #define LVEQNB_Gain_Neg3_dB                             (-598)        /* Floating point value -0.292054 */
75 #define LVEQNB_Gain_Neg2_dB                             (-421)        /* Floating point value -0.205672 */
76 #define LVEQNB_Gain_Neg1_dB                             (-223)        /* Floating point value -0.108749 */
77 #define LVEQNB_Gain_0_dB                                    0         /* Floating point value 0.000000 */
78 #define LVEQNB_Gain_1_dB                                  250         /* Floating point value 0.122018 */
79 #define LVEQNB_Gain_2_dB                                  530         /* Floating point value 0.258925 */
80 #define LVEQNB_Gain_3_dB                                  845         /* Floating point value 0.412538 */
81 #define LVEQNB_Gain_4_dB                                 1198         /* Floating point value 0.584893 */
82 #define LVEQNB_Gain_5_dB                                 1594         /* Floating point value 0.778279 */
83 #define LVEQNB_Gain_6_dB                                 2038         /* Floating point value 0.995262 */
84 #define LVEQNB_Gain_7_dB                                 2537         /* Floating point value 1.238721 */
85 #define LVEQNB_Gain_8_dB                                 3096         /* Floating point value 1.511886 */
86 #define LVEQNB_Gain_9_dB                                 3724         /* Floating point value 1.818383 */
87 #define LVEQNB_Gain_10_dB                                4428         /* Floating point value 2.162278 */
88 #define LVEQNB_Gain_11_dB                                5219         /* Floating point value 2.548134 */
89 #define LVEQNB_Gain_12_dB                                6105         /* Floating point value 2.981072 */
90 #define LVEQNB_Gain_13_dB                                7100         /* Floating point value 3.466836 */
91 #define LVEQNB_Gain_14_dB                                8216         /* Floating point value 4.011872 */
92 #define LVEQNB_Gain_15_dB                                9469         /* Floating point value 4.623413 */
93 #endif
94 
95 /************************************************************************************/
96 /*                                                                                  */
97 /* Frequency table for 2*Pi/Fs                                                      */
98 /*                                                                                  */
99 /************************************************************************************/
100 #ifdef BUILD_FLOAT
101 #define LVEQNB_2PiOn_8000                                0.000785f
102 #define LVEQNB_2PiOn_11025                               0.000570f
103 #define LVEQNB_2PiOn_12000                               0.000524f
104 #define LVEQNB_2PiOn_16000                               0.000393f
105 #define LVEQNB_2PiOn_22050                               0.000285f
106 #define LVEQNB_2PiOn_24000                               0.000262f
107 #define LVEQNB_2PiOn_32000                               0.000196f
108 #define LVEQNB_2PiOn_44100                               0.000142f
109 #define LVEQNB_2PiOn_48000                               0.000131f
110 
111 #ifdef HIGHER_FS
112 #define LVEQNB_2PiOn_88200                               0.000071f
113 #define LVEQNB_2PiOn_96000                               0.000065f
114 #define LVEQNB_2PiOn_176400                              0.000036f
115 #define LVEQNB_2PiOn_192000                              0.000033f
116 #endif
117 
118 #else
119 #define LVEQNB_FREQSHIFT                                   25         /* As a power of 2 */
120 #define LVEQNB_2PiOn_8000                               26354         /* Floating point value 0.000785 */
121 #define LVEQNB_2PiOn_11025                              19123         /* Floating point value 0.000570 */
122 #define LVEQNB_2PiOn_12000                              17569         /* Floating point value 0.000524 */
123 #define LVEQNB_2PiOn_16000                              13177         /* Floating point value 0.000393 */
124 #define LVEQNB_2PiOn_22050                               9561         /* Floating point value 0.000285 */
125 #define LVEQNB_2PiOn_24000                               8785         /* Floating point value 0.000262 */
126 #define LVEQNB_2PiOn_32000                               6588         /* Floating point value 0.000196 */
127 #define LVEQNB_2PiOn_44100                               4781         /* Floating point value 0.000142 */
128 #define LVEQNB_2PiOn_48000                               4392         /* Floating point value 0.000131 */
129 #endif
130 
131 /************************************************************************************/
132 /*                                                                                  */
133 /* 50D table for 50 / ( 1 + Gain )                                                  */
134 /*                                                                                  */
135 /************************************************************************************/
136 #ifdef BUILD_FLOAT
137 #define LVEQNB_100D_Neg15_dB                             5.623413f
138 #define LVEQNB_100D_Neg14_dB                             5.011872f
139 #define LVEQNB_100D_Neg13_dB                             4.466836f
140 #define LVEQNB_100D_Neg12_dB                             3.981072f
141 #define LVEQNB_100D_Neg11_dB                             3.548134f
142 #define LVEQNB_100D_Neg10_dB                             3.162278f
143 #define LVEQNB_100D_Neg9_dB                              2.818383f
144 #define LVEQNB_100D_Neg8_dB                              2.511886f
145 #define LVEQNB_100D_Neg7_dB                              2.238721f
146 #define LVEQNB_100D_Neg6_dB                              1.995262f
147 #define LVEQNB_100D_Neg5_dB                              1.778279f
148 #define LVEQNB_100D_Neg4_dB                              1.584893f
149 #define LVEQNB_100D_Neg3_dB                              1.412538f
150 #define LVEQNB_100D_Neg2_dB                              1.258925f
151 #define LVEQNB_100D_Neg1_dB                              1.122018f
152 #define LVEQNB_100D_0_dB                                 1.000000f
153 #else
154 #define LVEQNB_100DSHIFT                                    5         /* As a power of 2 */
155 #define LVEQNB_100D_Neg15_dB                            17995         /* Floating point value 5.623413 */
156 #define LVEQNB_100D_Neg14_dB                            16038         /* Floating point value 5.011872 */
157 #define LVEQNB_100D_Neg13_dB                            14294         /* Floating point value 4.466836 */
158 #define LVEQNB_100D_Neg12_dB                            12739         /* Floating point value 3.981072 */
159 #define LVEQNB_100D_Neg11_dB                            11354         /* Floating point value 3.548134 */
160 #define LVEQNB_100D_Neg10_dB                            10119         /* Floating point value 3.162278 */
161 #define LVEQNB_100D_Neg9_dB                              9019         /* Floating point value 2.818383 */
162 #define LVEQNB_100D_Neg8_dB                              8038         /* Floating point value 2.511886 */
163 #define LVEQNB_100D_Neg7_dB                              7164         /* Floating point value 2.238721 */
164 #define LVEQNB_100D_Neg6_dB                              6385         /* Floating point value 1.995262 */
165 #define LVEQNB_100D_Neg5_dB                              5690         /* Floating point value 1.778279 */
166 #define LVEQNB_100D_Neg4_dB                              5072         /* Floating point value 1.584893 */
167 #define LVEQNB_100D_Neg3_dB                              4520         /* Floating point value 1.412538 */
168 #define LVEQNB_100D_Neg2_dB                              4029         /* Floating point value 1.258925 */
169 #define LVEQNB_100D_Neg1_dB                              3590         /* Floating point value 1.122018 */
170 #define LVEQNB_100D_0_dB                                 3200         /* Floating point value 1.000000 */
171 #endif
172 
173 #endif
174