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 /* */
20 /* Includes */
21 /* */
22 /****************************************************************************************/
23 #include "LVREV.h"
24 #include "LVREV_Tables.h"
25
26 /****************************************************************************************/
27 /* */
28 /* Tables */
29 /* */
30 /****************************************************************************************/
31
32 /* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
33 const LVM_UINT32 LVM_FsTable[] = {
34 8000 ,
35 11025,
36 12000,
37 16000,
38 22050,
39 24000,
40 32000,
41 44100,
42 48000,
43 88200,
44 96000,
45 176400,
46 192000
47 };
48 /* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
LVM_GetFsFromTable(LVM_Fs_en FsIndex)49 LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
50 if (FsIndex > LVM_FS_192000)
51 return 0;
52
53 return (LVM_FsTable[FsIndex]);
54 }
55
56 /* In order to maintain consistant input and out put signal strengths
57 output gain/attenuation is applied. This gain depends on T60 and Rooms
58 size parameters. These polynomial coefficients are calculated experimentally.
59 First value in the table is room size
60 second value is A0
61 third value is A1
62 fourth value is A2
63 fifth value is A3
64 sixth value is A4
65
66 shift value is to be added array (to use LVM_Polynomial function)
67
68 The gain is calculated using variable x=(T60*32767/7000)*32768;
69
70 first values is used to get polynomial set for given room size,
71 For room sizes which are not in the table, linear interpolation can be used.
72
73 */
74
75 /* Normalizing output including Reverb Level part (only shift up)*/
76 const LVM_FLOAT LVREV_GainPolyTable[24][5]={{1,1.045909f,7.681098f,-7.211500f,3.025605f,},
77 {2,1.088194f,10.291749f,-11.513787f,5.265817f,},
78 {3,0.988919f,8.299956f,-8.920862f,3.979806f,},
79 {4,1.035927f,10.182567f,-10.346134f,4.546533f,},
80 {5,1.130313f,12.538727f,-13.627023f,6.165208f,},
81 {6,1.060743f,8.091713f,-8.588079f,3.834230f,},
82 {7,1.040381f,10.406566f,-11.176650f,5.075132f,},
83 {8,1.026944f,8.387302f,-8.689796f,3.895863f,},
84 {9,1.013312f,9.727236f,-10.534165f,4.742272f,},
85 {10,0.996095f,8.492249f,-7.947677f,3.478917f,},
86 {13,1.079346f,8.894425f,-9.641768f,4.434442f,},
87 {15,0.994327f,7.441335f,-8.003979f,3.581177f,},
88 {17,0.991067f,7.208373f,-7.257859f,3.167774f,},
89 {20,1.033445f,7.476371f,-7.546960f,3.369703f,},
90 {25,0.982830f,5.913867f,-5.638448f,2.420932f,},
91 {30,0.928782f,5.035343f,-4.492104f,1.844904f,},
92 {40,0.953714f,5.060232f,-4.472204f,1.829642f,},
93 {50,0.899258f,4.273357f,-3.537492f,1.387576f,},
94 {60,0.943584f,4.093228f,-3.469658f,1.410911f,},
95 {70,0.926021f,3.973125f,-3.331985f,1.344690f,},
96 {75,0.894853f,2.871747f,-1.438758f,0.311856f,},
97 {80,0.935122f,2.991857f,-2.038882f,0.686395f,},
98 {90,0.953872f,2.880315f,-2.122365f,0.784032f,},
99 {100,0.951005f,2.894294f,-2.009086f,0.698316f,},
100 };
101 /* End of file */
102
103