1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __LVPSA_TABLES_H__
18 #define __LVPSA_TABLES_H__
19 
20 /************************************************************************************/
21 /*                                                                                  */
22 /*  Sample rate table                                                               */
23 /*                                                                                  */
24 /************************************************************************************/
25 
26 /*
27  * Sample rate table for converting between the enumerated type and the actual
28  * frequency
29  */
30 extern const LVM_UINT32    LVPSA_SampleRateTab[];
31 
32 /************************************************************************************/
33 /*                                                                                  */
34 /*  Sample rate inverse table                                                       */
35 /*                                                                                  */
36 /************************************************************************************/
37 
38 /*
39  * Sample rate table for converting between the enumerated type and the actual
40  * frequency
41  */
42 extern const LVM_UINT32    LVPSA_SampleRateInvTab[];
43 
44 /************************************************************************************/
45 /*                                                                                  */
46 /*  Number of samples in 20ms                                                       */
47 /*                                                                                  */
48 /************************************************************************************/
49 
50 /*
51  * Table for converting between the enumerated type and the number of samples
52  * during 20ms
53  */
54 extern const LVM_UINT16    LVPSA_nSamplesBufferUpdate[];
55 
56 /************************************************************************************/
57 /*                                                                                  */
58 /*  Down sampling factors                                                           */
59 /*                                                                                  */
60 /************************************************************************************/
61 
62 /*
63  * Table for converting between the enumerated type and the down sampling factor
64  */
65 extern const LVM_UINT16    LVPSA_DownSamplingFactor[];
66 
67 /************************************************************************************/
68 /*                                                                                  */
69 /*  Coefficient calculation tables                                                  */
70 /*                                                                                  */
71 /************************************************************************************/
72 
73 /*
74  * Table for 2 * Pi / Fs
75  */
76 extern const LVM_INT16     LVPSA_TwoPiOnFsTable[];
77 extern const LVM_FLOAT     LVPSA_Float_TwoPiOnFsTable[];
78 
79 /*
80  * Gain table
81  */
82 extern const LVM_INT16     LVPSA_GainTable[];
83 extern const LVM_FLOAT     LVPSA_Float_GainTable[];
84 
85 /************************************************************************************/
86 /*                                                                                  */
87 /*  Cosone polynomial coefficients                                                  */
88 /*                                                                                  */
89 /************************************************************************************/
90 
91 /*
92  * Coefficients for calculating the cosine with the equation:
93  *
94  *  Cos(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5)
95  *
96  * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
97  * a range of 0 to Pi. The output is in the range 32767 to -32768 representing the range
98  * +1.0 to -1.0
99  */
100 extern const LVM_INT16     LVPSA_CosCoef[];
101 extern const LVM_FLOAT     LVPSA_Float_CosCoef[];
102 
103 /*
104  * Coefficients for calculating the cosine error with the equation:
105  *
106  *  CosErr(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3)
107  *
108  * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
109  * a range of 0 to Pi/25. The output is in the range 0 to 32767 representing the range
110  * 0.0 to 0.0078852986
111  *
112  * This is used to give a double precision cosine over the range 0 to Pi/25 using the
113  * the equation:
114  *
115  * Cos(x) = 1.0 - CosErr(x)
116  */
117 extern const LVM_INT16     LVPSA_DPCosCoef[];
118 extern const LVM_FLOAT    LVPSA_Float_DPCosCoef[];
119 
120 /************************************************************************************/
121 /*                                                                                  */
122 /*  Quasi peak filter coefficients table                                            */
123 /*                                                                                  */
124 /************************************************************************************/
125 extern const QPD_C32_Coefs     LVPSA_QPD_Coefs[];
126 extern const QPD_FLOAT_Coefs     LVPSA_QPD_Float_Coefs[];
127 
128 #endif /* __LVPSA_TABLES_H__ */
129