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 /* Header file for the private layer interface of concert sound. */ 21 /* */ 22 /* This files includes all definitions, types, structures and function */ 23 /* prototypes required by the execution layer. */ 24 /* */ 25 /************************************************************************************/ 26 27 #ifndef __LVCS_PRIVATE_H__ 28 #define __LVCS_PRIVATE_H__ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif /* __cplusplus */ 33 34 35 /************************************************************************************/ 36 /* */ 37 /* Includes */ 38 /* */ 39 /************************************************************************************/ 40 41 #include "LVCS.h" /* Calling or Application layer definitions */ 42 #include "LVCS_StereoEnhancer.h" /* Stereo enhancer module definitions */ 43 #include "LVCS_ReverbGenerator.h" /* Reverberation module definitions */ 44 #include "LVCS_Equaliser.h" /* Equaliser module definitions */ 45 #include "LVCS_BypassMix.h" /* Bypass Mixer module definitions */ 46 #include "LVM_Timer.h" 47 48 49 /************************************************************************************/ 50 /* */ 51 /* Defines */ 52 /* */ 53 /************************************************************************************/ 54 55 /* Configuration switch controls */ 56 #define LVCS_STEREOENHANCESWITCH 0x0001 /* Stereo enhancement enable control */ 57 #define LVCS_REVERBSWITCH 0x0002 /* Reverberation enable control */ 58 #define LVCS_EQUALISERSWITCH 0x0004 /* Equaliser enable control */ 59 #define LVCS_BYPASSMIXSWITCH 0x0008 /* Bypass mixer enable control */ 60 #define LVCS_COMPGAINFRAME 64 /* Compressor gain update interval */ 61 62 /* Memory */ 63 #define LVCS_SCRATCHBUFFERS 6 /* Number of buffers required for inplace processing */ 64 #ifdef SUPPORT_MC 65 /* 66 * The Concert Surround module applies processing only on the first two 67 * channels of a multichannel input. The data of first two channels is copied 68 * from the multichannel input into scratch buffer. The buffers added here 69 * are used for this purpose 70 */ 71 #define LVCS_MC_SCRATCHBUFFERS 2 72 #endif 73 74 /* General */ 75 #define LVCS_INVALID 0xFFFF /* Invalid init parameter */ 76 #define LVCS_BYPASS_MIXER_TC 100 /* Bypass mixer time */ 77 78 /* Access to external coefficients table */ 79 #define LVCS_NR_OF_FS 9 80 #define LVCS_NR_OF_CHAN_CFG 2 81 82 83 /************************************************************************************/ 84 /* */ 85 /* Types */ 86 /* */ 87 /************************************************************************************/ 88 89 typedef LVM_UINT16 LVCS_Configuration_t; /* Internal algorithm configuration */ 90 91 typedef enum 92 { 93 LVCS_HEADPHONE = 0, 94 LVCS_DEVICE_MAX = LVM_MAXENUM 95 } LVCS_OutputDevice_en; 96 97 98 /************************************************************************************/ 99 /* */ 100 /* Structures */ 101 /* */ 102 /************************************************************************************/ 103 104 /* Volume correction structure */ 105 typedef struct 106 { 107 #ifdef BUILD_FLOAT 108 LVM_FLOAT CompFull; /* Post CS compression 100% effect */ 109 LVM_FLOAT CompMin; /* Post CS compression 0% effect */ 110 LVM_FLOAT GainFull; /* CS gain correct 100% effect */ 111 LVM_FLOAT GainMin; /* CS gain correct 0% effect */ 112 #else 113 LVM_INT16 CompFull; /* Post CS compression 100% effect */ 114 LVM_INT16 CompMin; /* Post CS compression 0% effect */ 115 LVM_INT16 GainFull; /* CS gain correct 100% effect */ 116 LVM_INT16 GainMin; /* CS gain correct 0% effect */ 117 #endif 118 } LVCS_VolCorrect_t; 119 120 /* Instance structure */ 121 typedef struct 122 { 123 /* Public parameters */ 124 LVCS_MemTab_t MemoryTable; /* Instance memory allocation table */ 125 LVCS_Params_t Params; /* Instance parameters */ 126 LVCS_Capabilities_t Capabilities; /* Initialisation capabilities */ 127 128 /* Private parameters */ 129 LVCS_OutputDevice_en OutputDevice; /* Selected output device type */ 130 LVCS_VolCorrect_t VolCorrect; /* Volume correction settings */ 131 #ifndef BUILD_FLOAT 132 LVM_INT16 TransitionGain; /* Transition gain */ 133 LVM_INT16 CompressGain; /* Last used compressor gain*/ 134 #else 135 LVM_FLOAT TransitionGain; /* Transition gain */ 136 LVM_FLOAT CompressGain; /* Last used compressor gain*/ 137 #endif 138 139 /* Sub-block configurations */ 140 LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */ 141 LVCS_ReverbGenerator_t Reverberation; /* Reverberation configuration */ 142 LVCS_Equaliser_t Equaliser; /* Equaliser configuration */ 143 LVCS_BypassMix_t BypassMix; /* Bypass mixer configuration */ 144 145 /* Bypass variable */ 146 LVM_INT16 MSTarget0; /* Mixer state control variable for smooth transtion */ 147 LVM_INT16 MSTarget1; /* Mixer state control variable for smooth transtion */ 148 LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */ 149 LVM_INT16 bTimerDone; /* Timer completion flag */ 150 LVM_Timer_Params_t TimerParams; /* Timer parameters */ 151 LVM_Timer_Instance_t TimerInstance; /* Timer instance */ 152 153 } LVCS_Instance_t; 154 155 /* Coefficient Structure */ 156 typedef struct 157 { 158 #ifdef BUILD_FLOAT 159 Biquad_FLOAT_Instance_t EqualiserBiquadInstance; 160 Biquad_FLOAT_Instance_t ReverbBiquadInstance; 161 Biquad_FLOAT_Instance_t SEBiquadInstanceMid; 162 Biquad_FLOAT_Instance_t SEBiquadInstanceSide; 163 #else 164 Biquad_Instance_t EqualiserBiquadInstance; 165 Biquad_Instance_t ReverbBiquadInstance; 166 Biquad_Instance_t SEBiquadInstanceMid; 167 Biquad_Instance_t SEBiquadInstanceSide; 168 #endif 169 } LVCS_Coefficient_t; 170 171 /* Data Structure */ 172 typedef struct 173 { 174 #ifdef BUILD_FLOAT 175 Biquad_2I_Order2_FLOAT_Taps_t EqualiserBiquadTaps; 176 Biquad_2I_Order2_FLOAT_Taps_t ReverbBiquadTaps; 177 Biquad_1I_Order1_FLOAT_Taps_t SEBiquadTapsMid; 178 Biquad_1I_Order2_FLOAT_Taps_t SEBiquadTapsSide; 179 #else 180 Biquad_2I_Order2_Taps_t EqualiserBiquadTaps; 181 Biquad_2I_Order2_Taps_t ReverbBiquadTaps; 182 Biquad_1I_Order1_Taps_t SEBiquadTapsMid; 183 Biquad_1I_Order2_Taps_t SEBiquadTapsSide; 184 #endif 185 } LVCS_Data_t; 186 187 void LVCS_TimerCallBack ( void* hInstance, 188 void* pCallBackParams, 189 LVM_INT32 CallbackParam); 190 191 192 #ifdef __cplusplus 193 } 194 #endif /* __cplusplus */ 195 196 #endif /* PRIVATE_H */ 197 198 199