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