12c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*
22c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Copyright (C) 2004-2010 NXP Software
32c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Copyright (C) 2010 The Android Open Source Project
42c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *
52c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
62c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * you may not use this file except in compliance with the License.
72c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * You may obtain a copy of the License at
82c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *
92c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
102c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *
112c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Unless required by applicable law or agreed to in writing, software
122c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
132c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * See the License for the specific language governing permissions and
152c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * limitations under the License.
162c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent */
172c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
182c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "BIQUAD.h"
192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*-------------------------------------------------------------------------*/
232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:                                                               */
242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   BQ_2I_D16F32Css_TRC_WRA_01_Init                                       */
252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                         */
262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                            */
272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   These functions initializes a BIQUAD filter defined as a cascade of   */
282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   biquadratic Filter Sections.                                          */
292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                         */
302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                             */
312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   pInstance    - output, returns the pointer to the State Variable      */
322c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                   This state pointer must be passed to any subsequent   */
332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                   call to "Biquad" functions.                           */
342c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   pTaps         - input, pointer to the taps memory                     */
352c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   pCoef         - input, pointer to the coefficient structure           */
362c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   N             - M coefficient factor of QM.N                          */
372c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* RETURNS:                                                                */
382c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   void return code                                                      */
392c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*-------------------------------------------------------------------------*/
40d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri#ifdef BUILD_FLOAT
41d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katurivoid BQ_2I_D16F32Css_TRC_WRA_01_Init (   Biquad_FLOAT_Instance_t         *pInstance,
42d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri                                         Biquad_2I_Order2_FLOAT_Taps_t   *pTaps,
43d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri                                         BQ_FLOAT_Coefs_t            *pCoef)
44d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri{
45d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    LVM_FLOAT temp;
46d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
47d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    pBiquadState->pDelays      = (LVM_FLOAT *) pTaps;
48d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    temp = pCoef->A2;
49d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    pBiquadState->coefs[0] = temp;
50d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    temp = pCoef->A1;
51d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    pBiquadState->coefs[1] = temp;
52d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    temp = pCoef->A0;
53d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    pBiquadState->coefs[2] = temp;
54d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    temp = pCoef->B2;
55d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    pBiquadState->coefs[3] = temp;
56d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    temp = pCoef->B1;
57d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri    pBiquadState->coefs[4] = temp;
58d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri}
59d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri#else
602c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurentvoid BQ_2I_D16F32Css_TRC_WRA_01_Init (   Biquad_Instance_t         *pInstance,
612c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                         Biquad_2I_Order2_Taps_t   *pTaps,
622c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                         BQ_C16_Coefs_t            *pCoef)
632c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
642c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  LVM_INT16 temp;
652c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  PFilter_State pBiquadState = (PFilter_State) pInstance;
662c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->pDelays      =(LVM_INT32 *) pTaps            ;
672c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
682c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  temp=pCoef->A2;
692c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[0]=temp;
702c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  temp=pCoef->A1;
712c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[1]=temp;
722c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  temp=pCoef->A0;
732c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[2]=temp;
742c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  temp=pCoef->B2;
752c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[3]=temp;
762c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  temp=pCoef->B1;
772c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[4]=temp;
782c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
79d7d013446a64c6de9f0f2dfe098a721b140e0b48Ramesh Katuri#endif
802c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*-------------------------------------------------------------------------*/
812c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* End Of File: BQ_2I_D16F32Css_TRC_WRA_01_Init                              */
822c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
83