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 #define LVDBE_SCRATCHBUFFERS_INPLACE 6 /* Number of buffers required for inplace processing */ 68 69 #define LVDBE_MIXER_TC 5 /* Mixer time */ 70 #define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */ 71 72 73 /****************************************************************************************/ 74 /* */ 75 /* Structures */ 76 /* */ 77 /****************************************************************************************/ 78 79 /* Data structure */ 80 #ifndef BUILD_FLOAT 81 typedef struct 82 { 83 /* AGC parameters */ 84 AGC_MIX_VOL_2St1Mon_D32_t AGCInstance; /* AGC instance parameters */ 85 86 /* Process variables */ 87 Biquad_2I_Order2_Taps_t HPFTaps; /* High pass filter taps */ 88 Biquad_1I_Order2_Taps_t BPFTaps; /* Band pass filter taps */ 89 LVMixer3_1St_st BypassVolume; /* Bypass volume scaler */ 90 LVMixer3_2St_st BypassMixer; /* Bypass Mixer for Click Removal */ 91 92 } LVDBE_Data_t; 93 94 /* Coefs structure */ 95 typedef struct 96 { 97 /* Process variables */ 98 Biquad_Instance_t HPFInstance; /* High pass filter instance */ 99 Biquad_Instance_t BPFInstance; /* Band pass filter instance */ 100 101 } LVDBE_Coef_t; 102 #else 103 /* Data structure */ 104 typedef struct 105 { 106 /* AGC parameters */ 107 AGC_MIX_VOL_2St1Mon_FLOAT_t AGCInstance; /* AGC instance parameters */ 108 109 /* Process variables */ 110 Biquad_2I_Order2_FLOAT_Taps_t HPFTaps; /* High pass filter taps */ 111 Biquad_1I_Order2_FLOAT_Taps_t BPFTaps; /* Band pass filter taps */ 112 LVMixer3_1St_FLOAT_st BypassVolume; /* Bypass volume scaler */ 113 LVMixer3_2St_FLOAT_st BypassMixer; /* Bypass Mixer for Click Removal */ 114 115 } LVDBE_Data_FLOAT_t; 116 117 /* Coefs structure */ 118 typedef struct 119 { 120 /* Process variables */ 121 Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */ 122 Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */ 123 } LVDBE_Coef_FLOAT_t; 124 #endif 125 /* Instance structure */ 126 typedef struct 127 { 128 /* Public parameters */ 129 LVDBE_MemTab_t MemoryTable; /* Instance memory allocation table */ 130 LVDBE_Params_t Params; /* Instance parameters */ 131 LVDBE_Capabilities_t Capabilities; /* Instance capabilities */ 132 133 /* Data and coefficient pointers */ 134 #ifndef BUILD_FLOAT 135 LVDBE_Data_t *pData; /* Instance data */ 136 LVDBE_Coef_t *pCoef; /* Instance coefficients */ 137 #else 138 LVDBE_Data_FLOAT_t *pData; /* Instance data */ 139 LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */ 140 #endif 141 } LVDBE_Instance_t; 142 143 144 /****************************************************************************************/ 145 /* */ 146 /* Function prototypes */ 147 /* */ 148 /****************************************************************************************/ 149 150 void LVDBE_SetAGC(LVDBE_Instance_t *pInstance, 151 LVDBE_Params_t *pParams); 152 153 154 void LVDBE_SetVolume(LVDBE_Instance_t *pInstance, 155 LVDBE_Params_t *pParams); 156 157 158 void LVDBE_SetFilters(LVDBE_Instance_t *pInstance, 159 LVDBE_Params_t *pParams); 160 161 162 #ifdef __cplusplus 163 } 164 #endif /* __cplusplus */ 165 166 #endif /* __LVDBE_PRIVATE_H__ */ 167