Home | History | Annotate | Download | only in src
      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 __LVEQNB_PRIVATE_H__
     19 #define __LVEQNB_PRIVATE_H__
     20 
     21 #ifdef __cplusplus
     22 extern "C" {
     23 #endif /* __cplusplus */
     24 
     25 
     26 /****************************************************************************************/
     27 /*                                                                                      */
     28 /*  Includes                                                                            */
     29 /*                                                                                      */
     30 /****************************************************************************************/
     31 
     32 #include "LVEQNB.h"                                     /* Calling or Application layer definitions */
     33 #include "BIQUAD.h"
     34 #include "LVC_Mixer.h"
     35 
     36 /****************************************************************************************/
     37 /*                                                                                      */
     38 /*  Defines                                                                             */
     39 /*                                                                                      */
     40 /****************************************************************************************/
     41 
     42 /* General */
     43 #define LVEQNB_INVALID              0xFFFF              /* Invalid init parameter */
     44 
     45 /* Memory */
     46 #define LVEQNB_INSTANCE_ALIGN       4                   /* 32-bit alignment for instance structures */
     47 #define LVEQNB_DATA_ALIGN           4                   /* 32-bit alignment for structures */
     48 #define LVEQNB_COEF_ALIGN           4                   /* 32-bit alignment for long words */
     49 #define LVEQNB_SCRATCHBUFFERS       4                   /* Number of buffers required for inplace processing */
     50 #define LVEQNB_SCRATCH_ALIGN        4                   /* 32-bit alignment for long data */
     51 
     52 #define LVEQNB_BYPASS_MIXER_TC      100                 /* Bypass Mixer TC */
     53 
     54 /****************************************************************************************/
     55 /*                                                                                      */
     56 /*  Types                                                                               */
     57 /*                                                                                      */
     58 /****************************************************************************************/
     59 
     60 /* Filter biquad types */
     61 typedef enum
     62 {
     63     LVEQNB_SinglePrecision = 0,
     64     LVEQNB_DoublePrecision = 1,
     65     LVEQNB_OutOfRange      = 2,
     66     LVEQNB_BIQUADTYPE_MAX  = LVM_MAXINT_32
     67 } LVEQNB_BiquadType_en;
     68 
     69 
     70 /****************************************************************************************/
     71 /*                                                                                      */
     72 /*  Structures                                                                          */
     73 /*                                                                                      */
     74 /****************************************************************************************/
     75 
     76 
     77 
     78 /* Instance structure */
     79 typedef struct
     80 {
     81     /* Public parameters */
     82     LVEQNB_MemTab_t                 MemoryTable;        /* Instance memory allocation table */
     83     LVEQNB_Params_t                 Params;             /* Instance parameters */
     84     LVEQNB_Capabilities_t           Capabilities;       /* Instance capabilities */
     85 
     86     /* Aligned memory pointers */
     87     LVM_INT16                      *pFastTemporary;        /* Fast temporary data base address */
     88 
     89     /* Process variables */
     90     Biquad_2I_Order2_Taps_t         *pEQNB_Taps;        /* Equaliser Taps */
     91     Biquad_Instance_t               *pEQNB_FilterState; /* State for each filter band */
     92 
     93     /* Filter definitions and call back */
     94     LVM_UINT16                      NBands;             /* Number of bands */
     95     LVEQNB_BandDef_t                *pBandDefinitions;  /* Filter band definitions */
     96     LVEQNB_BiquadType_en            *pBiquadType;       /* Filter biquad types */
     97 
     98     /* Bypass variable */
     99     LVMixer3_2St_st           BypassMixer;              /* Bypass mixer used in transitions */
    100     LVM_INT16               bInOperatingModeTransition; /* Operating mode transition flag */
    101 
    102 } LVEQNB_Instance_t;
    103 
    104 
    105 /****************************************************************************************/
    106 /*                                                                                      */
    107 /* Function prototypes                                                                  */
    108 /*                                                                                      */
    109 /****************************************************************************************/
    110 
    111 void    LVEQNB_SetFilters(LVEQNB_Instance_t   *pInstance,
    112                           LVEQNB_Params_t     *pParams);
    113 
    114 void    LVEQNB_SetCoefficients(LVEQNB_Instance_t    *pInstance);
    115 
    116 void    LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance);
    117 
    118 LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16        Fs,
    119                                               LVEQNB_BandDef_t  *pFilterDefinition,
    120                                               PK_C16_Coefs_t    *pCoefficients);
    121 
    122 LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16        Fs,
    123                                               LVEQNB_BandDef_t  *pFilterDefinition,
    124                                               PK_C32_Coefs_t    *pCoefficients);
    125 
    126 LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance, void *pGeneralPurpose, LVM_INT16 CallbackParam);
    127 
    128 #ifdef __cplusplus
    129 }
    130 #endif /* __cplusplus */
    131 
    132 #endif /* __LVEQNB_PRIVATE_H__ */
    133 
    134