LVREV_Tables.c revision c59c6fd7f859b4010d788db89b8d4d76bbb70e57
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/*     Project::                                                                        */
21/*     $Author: beq07716 $ */
22/*     $Revision: 1011 $ */
23/*     $Date: 2010-06-28 15:07:08 +0200 (Mon, 28 Jun 2010) $ */
24/*                                                                                      */
25/****************************************************************************************/
26
27/****************************************************************************************/
28/*                                                                                      */
29/*  Includes                                                                            */
30/*                                                                                      */
31/****************************************************************************************/
32#include "LVREV.h"
33
34/****************************************************************************************/
35/*                                                                                      */
36/*  Tables                                                                              */
37/*                                                                                      */
38/****************************************************************************************/
39
40/* Table with supported sampling rates.  The table can be indexed using LVM_Fs_en       */
41const LVM_UINT16 LVM_FsTable[] = {
42    8000 ,
43    11025,
44    12000,
45    16000,
46    22050,
47    24000,
48    32000,
49    44100,
50    48000
51};
52
53/* Table with supported sampling rates.  The table can be indexed using LVM_Fs_en       */
54LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
55    if (FsIndex > LVM_FS_48000)
56        return 0;
57
58    return (LVM_FsTable[FsIndex]);
59}
60
61/* In order to maintain consistant input and out put signal strengths
62   output gain/attenuation is applied. This gain depends on T60 and Rooms
63   size parameters. These polynomial coefficients are calculated experimentally.
64   First value in the table is room size
65   second value is  A0
66   third value is   A1
67   fourth value is  A2
68   fifth value is   A3
69   sixth value is   A4
70
71     shift value  is to be added array (to use LVM_Polynomial function)
72
73  The gain is calculated using variable x=(T60*32767/7000)*32768;
74
75   first values is used to get polynomial set for given room size,
76   For room sizes which are not in the table, linear interpolation can be used.
77
78  */
79
80/* Normalizing output including Reverb Level part (only shift up)*/
81const LVM_INT32 LVREV_GainPolyTable[24][5]={{1,17547434,128867434,-120988896,50761228,},
82                                            {2,18256869,172666902,-193169292,88345744,},
83                                            {3,16591311,139250151,-149667234,66770059,},
84                                            {4,17379977,170835131,-173579321,76278163,},
85                                            {5,18963512,210364934,-228623519,103435022,},
86                                            {6,17796318,135756417,-144084053,64327698,},
87                                            {7,17454695,174593214,-187513064,85146582,},
88                                            {8,17229257,140715570,-145790588,65361740,},
89                                            {9,17000547,163195946,-176733969,79562130,},
90                                            {10,16711699,142476304,-133339887,58366547,},
91                                            {13,18108419,149223697,-161762020,74397589,},
92                                            {15,16682043,124844884,-134284487,60082180,},
93                                            {17,16627346,120936430,-121766674,53146421,},
94                                            {20,17338325,125432694,-126616983,56534237,},
95                                            {25,16489146,99218217,-94597467,40616506,},
96                                            {30,15582373,84479043,-75365006,30952348,},
97                                            {40,16000669,84896611,-75031127,30696306,},
98                                            {50,15087054,71695031,-59349268,23279669,},
99                                            {60,15830714,68672971,-58211201,23671158,},
100                                            {70,15536061,66657972,-55901437,22560153,},
101                                            {75,15013145,48179917,-24138354,5232074,},
102                                            {80,15688738,50195036,-34206760,11515792,},
103                                            {90,16003322,48323661,-35607378,13153872,},
104                                            {100,15955223,48558201,-33706865,11715792,},
105                                            };
106
107/* End of file */
108
109