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 /****************************************************************************************/
19 /*                                                                                      */
20 /*    Header file for the private layer interface of Dynamic Bass Enhancement module    */
21 /*                                                                                      */
22 /*  This files includes all definitions, types, structures and function                 */
23 /*  prototypes required by the execution layer.                                         */
24 /*                                                                                      */
25 /****************************************************************************************/
26 
27 #ifndef __LVDBE_PRIVATE_H__
28 #define __LVDBE_PRIVATE_H__
29 
30 /****************************************************************************************/
31 /*                                                                                      */
32 /*    Includes                                                                          */
33 /*                                                                                      */
34 /****************************************************************************************/
35 
36 #include "LVDBE.h"                                /* Calling or Application layer definitions */
37 #include "BIQUAD.h"
38 #include "LVC_Mixer.h"
39 #include "AGC.h"
40 
41 /****************************************************************************************/
42 /*                                                                                      */
43 /*    Defines                                                                           */
44 /*                                                                                      */
45 /****************************************************************************************/
46 
47 /* General */
48 #define    LVDBE_INVALID            0xFFFF        /* Invalid init parameter */
49 
50 /* Memory */
51 #define LVDBE_MEMREGION_INSTANCE         0       /* Offset to the instance memory region */
52 #define LVDBE_MEMREGION_PERSISTENT_DATA  1       /* Offset to persistent data memory region */
53 #define LVDBE_MEMREGION_PERSISTENT_COEF  2       /* Offset to persistent coefficient region */
54 #define LVDBE_MEMREGION_SCRATCH          3       /* Offset to data scratch memory region */
55 
56 #define LVDBE_INSTANCE_ALIGN             4       /* 32-bit alignment for structures */
57 #define LVDBE_PERSISTENT_DATA_ALIGN      4       /* 32-bit alignment for data */
58 #define LVDBE_PERSISTENT_COEF_ALIGN      4       /* 32-bit alignment for coef */
59 #define LVDBE_SCRATCH_ALIGN              4       /* 32-bit alignment for long data */
60 
61 #ifdef SUPPORT_MC
62 /* Number of buffers required for inplace processing */
63 #define LVDBE_SCRATCHBUFFERS_INPLACE     (LVM_MAX_CHANNELS * 3)
64 #else
65 #define LVDBE_SCRATCHBUFFERS_INPLACE     6       /* Number of buffers required for inplace processing */
66 #endif
67 
68 #define LVDBE_MIXER_TC                   5       /* Mixer time  */
69 #define LVDBE_BYPASS_MIXER_TC            100     /* Bypass mixer time */
70 
71 /****************************************************************************************/
72 /*                                                                                      */
73 /*    Structures                                                                        */
74 /*                                                                                      */
75 /****************************************************************************************/
76 
77 /* Data structure */
78 /* Data structure */
79 typedef struct
80 {
81     /* AGC parameters */
82     AGC_MIX_VOL_2St1Mon_FLOAT_t   AGCInstance;        /* AGC instance parameters */
83 
84     /* Process variables */
85     Biquad_2I_Order2_FLOAT_Taps_t     HPFTaps;            /* High pass filter taps */
86     Biquad_1I_Order2_FLOAT_Taps_t     BPFTaps;            /* Band pass filter taps */
87     LVMixer3_1St_FLOAT_st             BypassVolume;       /* Bypass volume scaler */
88     LVMixer3_2St_FLOAT_st             BypassMixer;        /* Bypass Mixer for Click Removal */
89 
90 } LVDBE_Data_FLOAT_t;
91 
92 /* Coefs structure */
93 typedef struct
94 {
95     /* Process variables */
96     Biquad_FLOAT_Instance_t           HPFInstance;        /* High pass filter instance */
97     Biquad_FLOAT_Instance_t           BPFInstance;        /* Band pass filter instance */
98 } LVDBE_Coef_FLOAT_t;
99 /* Instance structure */
100 typedef struct
101 {
102     /* Public parameters */
103     LVDBE_MemTab_t                MemoryTable;        /* Instance memory allocation table */
104     LVDBE_Params_t                Params;             /* Instance parameters */
105     LVDBE_Capabilities_t        Capabilities;         /* Instance capabilities */
106 
107     /* Data and coefficient pointers */
108     LVDBE_Data_FLOAT_t                *pData;                /* Instance data */
109     LVDBE_Coef_FLOAT_t                *pCoef;                /* Instance coefficients */
110 } LVDBE_Instance_t;
111 
112 /****************************************************************************************/
113 /*                                                                                      */
114 /* Function prototypes                                                                  */
115 /*                                                                                      */
116 /****************************************************************************************/
117 
118 void    LVDBE_SetAGC(LVDBE_Instance_t       *pInstance,
119                      LVDBE_Params_t         *pParams);
120 
121 void    LVDBE_SetVolume(LVDBE_Instance_t    *pInstance,
122                         LVDBE_Params_t      *pParams);
123 
124 void    LVDBE_SetFilters(LVDBE_Instance_t   *pInstance,
125                          LVDBE_Params_t     *pParams);
126 
127 #endif      /* __LVDBE_PRIVATE_H__ */
128