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 #ifndef __LVEQNB_PRIVATE_H__ 19 #define __LVEQNB_PRIVATE_H__ 20 21 /****************************************************************************************/ 22 /* */ 23 /* Includes */ 24 /* */ 25 /****************************************************************************************/ 26 27 #include <audio_utils/BiquadFilter.h> 28 #include "LVEQNB.h" /* Calling or Application layer definitions */ 29 #include "BIQUAD.h" 30 #include "LVC_Mixer.h" 31 32 /****************************************************************************************/ 33 /* */ 34 /* Defines */ 35 /* */ 36 /****************************************************************************************/ 37 38 /* General */ 39 #define LVEQNB_INVALID 0xFFFF /* Invalid init parameter */ 40 #define LVEQNB_BYPASS_MIXER_TC 100 /* Bypass Mixer TC */ 41 42 /****************************************************************************************/ 43 /* */ 44 /* Types */ 45 /* */ 46 /****************************************************************************************/ 47 48 /* Filter biquad types */ 49 typedef enum { 50 LVEQNB_SinglePrecision_Float = -1, 51 LVEQNB_SinglePrecision = 0, 52 LVEQNB_DoublePrecision = 1, 53 LVEQNB_OutOfRange = 2, 54 LVEQNB_BIQUADTYPE_MAX = LVM_MAXINT_32 55 } LVEQNB_BiquadType_en; 56 57 /****************************************************************************************/ 58 /* */ 59 /* Structures */ 60 /* */ 61 /****************************************************************************************/ 62 63 /* Instance structure */ 64 typedef struct { 65 /* Public parameters */ 66 void* pScratch; /* Pointer to bundle scratch buffer */ 67 LVEQNB_Params_t Params; /* Instance parameters */ 68 LVEQNB_Capabilities_t Capabilities; /* Instance capabilities */ 69 70 /* Aligned memory pointers */ 71 LVM_FLOAT* pFastTemporary; /* Fast temporary data base address */ 72 73 std::vector<android::audio_utils::BiquadFilter<LVM_FLOAT>> 74 eqBiquad; /* Biquad filter instances */ 75 std::vector<LVM_FLOAT> gain; /* Gain values for all bands*/ 76 77 /* Filter definitions and call back */ 78 LVM_UINT16 NBands; /* Number of bands */ 79 LVEQNB_BandDef_t* pBandDefinitions; /* Filter band definitions */ 80 LVEQNB_BiquadType_en* pBiquadType; /* Filter biquad types */ 81 82 /* Bypass variable */ 83 LVMixer3_2St_FLOAT_st BypassMixer; 84 85 LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */ 86 87 } LVEQNB_Instance_t; 88 89 /****************************************************************************************/ 90 /* */ 91 /* Function prototypes */ 92 /* */ 93 /****************************************************************************************/ 94 95 void LVEQNB_SetFilters(LVEQNB_Instance_t* pInstance, LVEQNB_Params_t* pParams); 96 97 void LVEQNB_SetCoefficients(LVEQNB_Instance_t* pInstance); 98 99 void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t* pInstance); 100 LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs, LVEQNB_BandDef_t* pFilterDefinition, 101 PK_FLOAT_Coefs_t* pCoefficients); 102 103 LVM_INT32 LVEQNB_BypassMixerCallBack(void* hInstance, void* pGeneralPurpose, 104 LVM_INT16 CallbackParam); 105 106 #endif /* __LVEQNB_PRIVATE_H__ */ 107