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/*-------------------------------------------------------------------------*/
192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "BIQUAD.h"
202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*-------------------------------------------------------------------------*/
242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:                                                               */
252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   BP_1I_D16F32Cll_TRC_WRA_01_Init                                       */
262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                         */
272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                            */
282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   These functions initializes a Band pass filter (BIQUAD)               */
292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   biquadratic Filter Sections.                                          */
302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                         */
312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                             */
322c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   pInstance    - output, returns the pointer to the State Variable      */
332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                   This state pointer must be passed to any subsequent   */
342c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                   call to "Biquad" functions.                           */
352c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   pTaps         - input, pointer to the taps memory                     */
362c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   pCoef         - input, pointer to the coefficient structure           */
372c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   N             - M coefficient factor of QM.N                          */
382c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                         */
392c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*        The coefficients are modified in the init() function such that lower               */
402c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*        half word is right shifted by one and most significant bit of the lower            */
412c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*        word is made to be zero.                                                           */
422c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                           */
432c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*       Reason: For MIPS effciency,we are using DSP 32*16 multiplication                    */
442c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*       instruction. But we have 32*32 multiplication. This can be realized by two 32*16    */
452c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*       multiplication. But 16th bit in the 32 bit word is not a sign bit. So this is done  */
462c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*       by putting 16th bit to zero and lossing one bit precision by division of lower      */
472c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*       half word by 2.                                                                     */
482c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* RETURNS:                                                                */
492c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*   void return code                                                      */
502c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*-------------------------------------------------------------------------*/
512c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurentvoid BP_1I_D16F32Cll_TRC_WRA_01_Init (   Biquad_Instance_t         *pInstance,
522c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                         Biquad_1I_Order2_Taps_t   *pTaps,
532c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                         BP_C32_Coefs_t            *pCoef)
542c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
552c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  PFilter_State pBiquadState = (PFilter_State) pInstance;
562c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->pDelays       =(LVM_INT32 *) pTaps;
572c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
582c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[0] =  pCoef->A0;
592c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[1] =  pCoef->B2;
602c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent  pBiquadState->coefs[2] =  pCoef->B1;
612c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
622c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*-------------------------------------------------------------------------*/
632c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* End Of File: BP_1I_D16F32Cll_TRC_WRA_01_Init.c                              */
642c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
65