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 Dynamic Bass Enhancement module */ 21 /* */ 22 /* This files includes all definitions, types, structures and function */ 23 /* prototypes required by the execution layer. */ 24 /* */ 25 /****************************************************************************************/ 26 27 #ifndef __LVDBE_PRIVATE_H__ 28 #define __LVDBE_PRIVATE_H__ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif /* __cplusplus */ 33 34 35 /****************************************************************************************/ 36 /* */ 37 /* Includes */ 38 /* */ 39 /****************************************************************************************/ 40 41 #include "LVDBE.h" /* Calling or Application layer definitions */ 42 #include "BIQUAD.h" 43 #include "LVC_Mixer.h" 44 #include "AGC.h" 45 46 47 /****************************************************************************************/ 48 /* */ 49 /* Defines */ 50 /* */ 51 /****************************************************************************************/ 52 53 /* General */ 54 #define LVDBE_INVALID 0xFFFF /* Invalid init parameter */ 55 56 /* Memory */ 57 #define LVDBE_MEMREGION_INSTANCE 0 /* Offset to the instance memory region */ 58 #define LVDBE_MEMREGION_PERSISTENT_DATA 1 /* Offset to persistent data memory region */ 59 #define LVDBE_MEMREGION_PERSISTENT_COEF 2 /* Offset to persistent coefficient region */ 60 #define LVDBE_MEMREGION_SCRATCH 3 /* Offset to data scratch memory region */ 61 62 #define LVDBE_INSTANCE_ALIGN 4 /* 32-bit alignment for structures */ 63 #define LVDBE_PERSISTENT_DATA_ALIGN 4 /* 32-bit alignment for data */ 64 #define LVDBE_PERSISTENT_COEF_ALIGN 4 /* 32-bit alignment for coef */ 65 #define LVDBE_SCRATCH_ALIGN 4 /* 32-bit alignment for long data */ 66 67 #ifdef SUPPORT_MC 68 /* Number of buffers required for inplace processing */ 69 #define LVDBE_SCRATCHBUFFERS_INPLACE (LVM_MAX_CHANNELS * 3) 70 #else 71 #define LVDBE_SCRATCHBUFFERS_INPLACE 6 /* Number of buffers required for inplace processing */ 72 #endif 73 74 #define LVDBE_MIXER_TC 5 /* Mixer time */ 75 #define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */ 76 77 78 /****************************************************************************************/ 79 /* */ 80 /* Structures */ 81 /* */ 82 /****************************************************************************************/ 83 84 /* Data structure */ 85 #ifndef BUILD_FLOAT 86 typedef struct 87 { 88 /* AGC parameters */ 89 AGC_MIX_VOL_2St1Mon_D32_t AGCInstance; /* AGC instance parameters */ 90 91 /* Process variables */ 92 Biquad_2I_Order2_Taps_t HPFTaps; /* High pass filter taps */ 93 Biquad_1I_Order2_Taps_t BPFTaps; /* Band pass filter taps */ 94 LVMixer3_1St_st BypassVolume; /* Bypass volume scaler */ 95 LVMixer3_2St_st BypassMixer; /* Bypass Mixer for Click Removal */ 96 97 } LVDBE_Data_t; 98 99 /* Coefs structure */ 100 typedef struct 101 { 102 /* Process variables */ 103 Biquad_Instance_t HPFInstance; /* High pass filter instance */ 104 Biquad_Instance_t BPFInstance; /* Band pass filter instance */ 105 106 } LVDBE_Coef_t; 107 #else 108 /* Data structure */ 109 typedef struct 110 { 111 /* AGC parameters */ 112 AGC_MIX_VOL_2St1Mon_FLOAT_t AGCInstance; /* AGC instance parameters */ 113 114 /* Process variables */ 115 Biquad_2I_Order2_FLOAT_Taps_t HPFTaps; /* High pass filter taps */ 116 Biquad_1I_Order2_FLOAT_Taps_t BPFTaps; /* Band pass filter taps */ 117 LVMixer3_1St_FLOAT_st BypassVolume; /* Bypass volume scaler */ 118 LVMixer3_2St_FLOAT_st BypassMixer; /* Bypass Mixer for Click Removal */ 119 120 } LVDBE_Data_FLOAT_t; 121 122 /* Coefs structure */ 123 typedef struct 124 { 125 /* Process variables */ 126 Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */ 127 Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */ 128 } LVDBE_Coef_FLOAT_t; 129 #endif 130 /* Instance structure */ 131 typedef struct 132 { 133 /* Public parameters */ 134 LVDBE_MemTab_t MemoryTable; /* Instance memory allocation table */ 135 LVDBE_Params_t Params; /* Instance parameters */ 136 LVDBE_Capabilities_t Capabilities; /* Instance capabilities */ 137 138 /* Data and coefficient pointers */ 139 #ifndef BUILD_FLOAT 140 LVDBE_Data_t *pData; /* Instance data */ 141 LVDBE_Coef_t *pCoef; /* Instance coefficients */ 142 #else 143 LVDBE_Data_FLOAT_t *pData; /* Instance data */ 144 LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */ 145 #endif 146 } LVDBE_Instance_t; 147 148 149 /****************************************************************************************/ 150 /* */ 151 /* Function prototypes */ 152 /* */ 153 /****************************************************************************************/ 154 155 void LVDBE_SetAGC(LVDBE_Instance_t *pInstance, 156 LVDBE_Params_t *pParams); 157 158 159 void LVDBE_SetVolume(LVDBE_Instance_t *pInstance, 160 LVDBE_Params_t *pParams); 161 162 163 void LVDBE_SetFilters(LVDBE_Instance_t *pInstance, 164 LVDBE_Params_t *pParams); 165 166 167 #ifdef __cplusplus 168 } 169 #endif /* __cplusplus */ 170 171 #endif /* __LVDBE_PRIVATE_H__ */ 172