2 * Copyright (C) 2004-2010 NXP Software
3 * Copyright (C) 2010 The Android Open Source Project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 /************************************************************************************/
23 /************************************************************************************/
26 #include "LVEQNB_Coeffs.h"
29 /************************************************************************************/
31 /* Sample rate table */
33 /************************************************************************************/
36 * Sample rate table for converting between the enumerated type and the actual
39 const LVM_UINT16 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
50 /************************************************************************************/
52 /* Coefficient calculation tables */
54 /************************************************************************************/
57 * Table for 2 * Pi / Fs
59 const LVM_INT16 LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
67 LVEQNB_2PiOn_48000}; /* 48kS/s */
72 const LVM_INT16 LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
87 LVEQNB_Gain_0_dB, /* 0dB gain */
102 LVEQNB_Gain_15_dB}; /* +15dB gain */
106 * D table for 100 / (Gain + 1)
108 const LVM_INT16 LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
109 LVEQNB_100D_Neg14_dB,
110 LVEQNB_100D_Neg13_dB,
111 LVEQNB_100D_Neg12_dB,
112 LVEQNB_100D_Neg11_dB,
113 LVEQNB_100D_Neg10_dB,
123 LVEQNB_100D_0_dB}; /* 0dB gain */
126 /************************************************************************************/
128 /* Filter polynomial coefficients */
130 /************************************************************************************/
133 * Coefficients for calculating the cosine with the equation:
135 * Cos(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5)
137 * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
138 * a range of 0 to Pi. The output is in the range 32767 to -32768 representing the range
141 const LVM_INT16 LVEQNB_CosCoef[] = {3, /* Shifts */
150 * Coefficients for calculating the cosine error with the equation:
152 * CosErr(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3)
154 * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
155 * a range of 0 to Pi/25. The output is in the range 0 to 32767 representing the range
156 * 0.0 to 0.0078852986
158 * This is used to give a double precision cosine over the range 0 to Pi/25 using the
161 * Cos(x) = 1.0 - CosErr(x)
163 const LVM_INT16 LVEQNB_DPCosCoef[] = {1, /* Shifts */
169 /************************************************************************************/
171 /* Bypass mixer time constants (100ms) */
173 /************************************************************************************/
175 #define LVEQNB_MIX_TC_Fs8000 32580 /* Floating point value 0.994262695 */
176 #define LVEQNB_MIX_TC_Fs11025 32632 /* Floating point value 0.995849609 */
177 #define LVEQNB_MIX_TC_Fs12000 32643 /* Floating point value 0.996185303 */
178 #define LVEQNB_MIX_TC_Fs16000 32674 /* Floating point value 0.997131348 */
179 #define LVEQNB_MIX_TC_Fs22050 32700 /* Floating point value 0.997924805 */
180 #define LVEQNB_MIX_TC_Fs24000 32705 /* Floating point value 0.998077393 */
181 #define LVEQNB_MIX_TC_Fs32000 32721 /* Floating point value 0.998565674 */
182 #define LVEQNB_MIX_TC_Fs44100 32734 /* Floating point value 0.998962402 */
183 #define LVEQNB_MIX_TC_Fs48000 32737 /* Floating point value 0.999053955 */
186 const LVM_INT16 LVEQNB_MixerTCTable[] = {
187 LVEQNB_MIX_TC_Fs8000,
188 LVEQNB_MIX_TC_Fs11025,
189 LVEQNB_MIX_TC_Fs12000,
190 LVEQNB_MIX_TC_Fs16000,
191 LVEQNB_MIX_TC_Fs22050,
192 LVEQNB_MIX_TC_Fs24000,
193 LVEQNB_MIX_TC_Fs32000,
194 LVEQNB_MIX_TC_Fs44100,
195 LVEQNB_MIX_TC_Fs48000};