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 _LVPSA_QPD_H_ 19 #define _LVPSA_QPD_H_ 20 21 #include "LVM_Types.h" 22 23 typedef struct { 24 LVM_INT32* pDelay; /* pointer to the delayed samples (data of 32 bits) */ 25 LVM_INT32 Coefs[2]; /* pointer to the filter coefficients */ 26 } QPD_State_t, *pQPD_State_t; 27 28 typedef struct { 29 /* pointer to the delayed samples (data of 32 bits) */ 30 LVM_FLOAT* pDelay; 31 LVM_FLOAT Coefs[2]; /* pointer to the filter coefficients */ 32 } QPD_FLOAT_State_t, *pQPD_FLOAT_State_t; 33 34 typedef struct { 35 LVM_INT32 KP; /*should store a0*/ 36 LVM_INT32 KM; /*should store b2*/ 37 38 } QPD_C32_Coefs, *PQPD_C32_Coefs; 39 40 typedef struct { 41 LVM_FLOAT KP; /*should store a0*/ 42 LVM_FLOAT KM; /*should store b2*/ 43 44 } QPD_FLOAT_Coefs, *PQPD_FLOAT_Coefs; 45 46 typedef struct { 47 LVM_INT32 Storage[1]; 48 49 } QPD_Taps_t, *pQPD_Taps_t; 50 51 typedef struct { 52 LVM_FLOAT Storage[1]; 53 54 } QPD_FLOAT_Taps_t, *pQPD_FLOAT_Taps_t; 55 56 /************************************************************************************/ 57 /* */ 58 /* FUNCTION: LVPSA_QPD_Process */ 59 /* */ 60 /* DESCRIPTION: */ 61 /* Apply downsampling, post gain, quasi peak filtering and write the levels values */ 62 /* in the buffer every 20 ms. */ 63 /* */ 64 /* PARAMETERS: */ 65 /* */ 66 /* RETURNS: void */ 67 /* */ 68 /************************************************************************************/ 69 void LVPSA_QPD_Process(void* hInstance, LVM_INT16* pInSamps, LVM_INT16 numSamples, 70 LVM_INT16 BandIndex); 71 72 void LVPSA_QPD_Process_Float(void* hInstance, LVM_FLOAT* pInSamps, LVM_INT16 numSamples, 73 LVM_INT16 BandIndex); 74 /************************************************************************************/ 75 /* */ 76 /* FUNCTION: LVPSA_QPD_Init */ 77 /* */ 78 /* DESCRIPTION: */ 79 /* Initialize a quasi peak filter instance. */ 80 /* */ 81 /* PARAMETERS: */ 82 /* pInstance Pointer to the instance */ 83 /* pTaps Pointer to the filter's taps */ 84 /* pCoef Pointer to the filter's coefficients */ 85 /* */ 86 /* RETURNS: void */ 87 /* */ 88 /************************************************************************************/ 89 void LVPSA_QPD_Init(QPD_State_t* pInstance, QPD_Taps_t* pTaps, QPD_C32_Coefs* pCoef); 90 91 void LVPSA_QPD_Init_Float(QPD_FLOAT_State_t* pInstance, QPD_FLOAT_Taps_t* pTaps, 92 QPD_FLOAT_Coefs* pCoef); 93 94 #endif 95