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 /****************************************************************************************/
22 /*                                                                                      */
23 /*  Includes                                                                            */
24 /*                                                                                      */
25 /****************************************************************************************/
26 
27 #include "LVEQNB.h"                                     /* Calling or Application layer definitions */
28 #include "BIQUAD.h"
29 #include "LVC_Mixer.h"
30 
31 /****************************************************************************************/
32 /*                                                                                      */
33 /*  Defines                                                                             */
34 /*                                                                                      */
35 /****************************************************************************************/
36 
37 /* General */
38 #define LVEQNB_INVALID              0xFFFF              /* Invalid init parameter */
39 
40 /* Memory */
41 #define LVEQNB_INSTANCE_ALIGN       4                   /* 32-bit alignment for instance structures */
42 #define LVEQNB_DATA_ALIGN           4                   /* 32-bit alignment for structures */
43 #define LVEQNB_COEF_ALIGN           4                   /* 32-bit alignment for long words */
44 #ifdef SUPPORT_MC
45 /* Number of buffers required for inplace processing */
46 #define LVEQNB_SCRATCHBUFFERS       (LVM_MAX_CHANNELS * 2)
47 #else
48 #define LVEQNB_SCRATCHBUFFERS       4                   /* Number of buffers required for inplace processing */
49 #endif
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_Float = -1,
64     LVEQNB_SinglePrecision = 0,
65     LVEQNB_DoublePrecision = 1,
66     LVEQNB_OutOfRange      = 2,
67     LVEQNB_BIQUADTYPE_MAX  = LVM_MAXINT_32
68 } LVEQNB_BiquadType_en;
69 
70 /****************************************************************************************/
71 /*                                                                                      */
72 /*  Structures                                                                          */
73 /*                                                                                      */
74 /****************************************************************************************/
75 
76 /* Instance structure */
77 typedef struct
78 {
79     /* Public parameters */
80     LVEQNB_MemTab_t                 MemoryTable;        /* Instance memory allocation table */
81     LVEQNB_Params_t                 Params;             /* Instance parameters */
82     LVEQNB_Capabilities_t           Capabilities;       /* Instance capabilities */
83 
84     /* Aligned memory pointers */
85     LVM_FLOAT                      *pFastTemporary;        /* Fast temporary data base address */
86 
87     Biquad_2I_Order2_FLOAT_Taps_t   *pEQNB_Taps_Float;        /* Equaliser Taps */
88     Biquad_FLOAT_Instance_t         *pEQNB_FilterState_Float; /* State for each filter band */
89 
90     /* Filter definitions and call back */
91     LVM_UINT16                      NBands;             /* Number of bands */
92     LVEQNB_BandDef_t                *pBandDefinitions;  /* Filter band definitions */
93     LVEQNB_BiquadType_en            *pBiquadType;       /* Filter biquad types */
94 
95     /* Bypass variable */
96     LVMixer3_2St_FLOAT_st     BypassMixer;
97 
98     LVM_INT16               bInOperatingModeTransition; /* Operating mode transition flag */
99 
100 } LVEQNB_Instance_t;
101 
102 /****************************************************************************************/
103 /*                                                                                      */
104 /* Function prototypes                                                                  */
105 /*                                                                                      */
106 /****************************************************************************************/
107 
108 void    LVEQNB_SetFilters(LVEQNB_Instance_t   *pInstance,
109                           LVEQNB_Params_t     *pParams);
110 
111 void    LVEQNB_SetCoefficients(LVEQNB_Instance_t    *pInstance);
112 
113 void    LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance);
114 LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16        Fs,
115                                               LVEQNB_BandDef_t  *pFilterDefinition,
116                                               PK_FLOAT_Coefs_t    *pCoefficients);
117 
118 LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance, void *pGeneralPurpose, LVM_INT16 CallbackParam);
119 
120 #endif /* __LVEQNB_PRIVATE_H__ */
121 
122