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 #include "LVPSA_QPD.h"
19 
20 /************************************************************************************/
21 /*                                                                                  */
22 /* FUNCTION:            LVPSA_QPD_Init                                              */
23 /*                                                                                  */
24 /* DESCRIPTION:                                                                     */
25 /*  Initialize a quasi peak filter instance.                                        */
26 /*                                                                                  */
27 /* PARAMETERS:                                                                      */
28 /*  pQPD_State          Pointer to the filter state                                 */
29 /*   pTaps               Pointer to the filter's taps                               */
30 /*   pCoef               Pointer to the filter's coefficients                       */
31 /*                                                                                  */
32 /* RETURNS:     void                                                                */
33 /*                                                                                  */
34 /************************************************************************************/
LVPSA_QPD_Init(pQPD_State_t pQPD_State,QPD_Taps_t * pTaps,QPD_C32_Coefs * pCoef)35 void LVPSA_QPD_Init(pQPD_State_t pQPD_State, QPD_Taps_t* pTaps, QPD_C32_Coefs* pCoef) {
36     pQPD_State->pDelay = pTaps->Storage;
37     pQPD_State->Coefs[0] = pCoef->KP;
38     pQPD_State->Coefs[1] = pCoef->KM;
39 }
40 
LVPSA_QPD_Init_Float(pQPD_FLOAT_State_t pQPD_State,QPD_FLOAT_Taps_t * pTaps,QPD_FLOAT_Coefs * pCoef)41 void LVPSA_QPD_Init_Float(pQPD_FLOAT_State_t pQPD_State, QPD_FLOAT_Taps_t* pTaps,
42                           QPD_FLOAT_Coefs* pCoef) {
43     pQPD_State->pDelay = pTaps->Storage;
44     pQPD_State->Coefs[0] = ((LVM_FLOAT)pCoef->KP);
45     pQPD_State->Coefs[1] = ((LVM_FLOAT)pCoef->KM);
46 }
47