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