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