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 _BIQUAD_H_ 19 #define _BIQUAD_H_ 20 21 #include "LVM_Types.h" 22 /********************************************************************************** 23 INSTANCE MEMORY TYPE DEFINITION 24 ***********************************************************************************/ 25 typedef struct { 26 /* The memory region created by this structure instance is typecast 27 * into another structure containing a pointer and an array of filter 28 * coefficients. In one case this memory region is used for storing 29 * DC component of channels 30 */ 31 LVM_FLOAT* pStorage; 32 LVM_FLOAT Storage[LVM_MAX_CHANNELS]; 33 } Biquad_FLOAT_Instance_t; 34 /********************************************************************************** 35 COEFFICIENT TYPE DEFINITIONS 36 ***********************************************************************************/ 37 38 /*** Biquad coefficients **********************************************************/ 39 typedef struct { 40 LVM_FLOAT A2; /* a2 */ 41 LVM_FLOAT A1; /* a1 */ 42 LVM_FLOAT A0; /* a0 */ 43 LVM_FLOAT B2; /* -b2! */ 44 LVM_FLOAT B1; /* -b1! */ 45 } BQ_FLOAT_Coefs_t; 46 47 /*** First order coefficients *****************************************************/ 48 typedef struct { 49 LVM_FLOAT A1; /* a1 */ 50 LVM_FLOAT A0; /* a0 */ 51 LVM_FLOAT B1; /* -b1! */ 52 } FO_FLOAT_Coefs_t; 53 54 /*** First order coefficients with Shift*****************************************************/ 55 typedef struct { 56 LVM_FLOAT A1; /* a1 */ 57 LVM_FLOAT A0; /* a0 */ 58 LVM_FLOAT B1; /* -b1! */ 59 } FO_FLOAT_LShx_Coefs_t; 60 /*** Band pass coefficients *******************************************************/ 61 typedef struct { 62 LVM_FLOAT A0; /* a0 */ 63 LVM_FLOAT B2; /* -b2! */ 64 LVM_FLOAT B1; /* -b1! */ 65 } BP_FLOAT_Coefs_t; 66 67 /*** Peaking coefficients *********************************************************/ 68 typedef struct { 69 LVM_FLOAT A0; /* a0 */ 70 LVM_FLOAT B2; /* -b2! */ 71 LVM_FLOAT B1; /* -b1! */ 72 LVM_FLOAT G; /* Gain */ 73 } PK_FLOAT_Coefs_t; 74 75 76 /********************************************************************************** 77 FUNCTION PROTOTYPES: DC REMOVAL FILTERS 78 ***********************************************************************************/ 79 80 /*** 16 bit data path STEREO ******************************************************/ 81 void DC_Mc_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance); 82 83 void DC_Mc_D16_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, 84 LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels); 85 86 /**********************************************************************************/ 87 88 #endif /** _BIQUAD_H_ **/ 89