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