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 concert sound.                   */
21 /*                                                                                  */
22 /*  This files includes all definitions, types, structures and function             */
23 /*  prototypes required by the execution layer.                                     */
24 /*                                                                                  */
25 /************************************************************************************/
26 
27 #ifndef __LVCS_PRIVATE_H__
28 #define __LVCS_PRIVATE_H__
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33 
34 
35 /************************************************************************************/
36 /*                                                                                  */
37 /*  Includes                                                                        */
38 /*                                                                                  */
39 /************************************************************************************/
40 
41 #include "LVCS.h"                               /* Calling or Application layer definitions */
42 #include "LVCS_StereoEnhancer.h"                /* Stereo enhancer module definitions */
43 #include "LVCS_ReverbGenerator.h"               /* Reverberation module definitions */
44 #include "LVCS_Equaliser.h"                     /* Equaliser module definitions */
45 #include "LVCS_BypassMix.h"                     /* Bypass Mixer module definitions */
46 #include "LVM_Timer.h"
47 
48 
49 /************************************************************************************/
50 /*                                                                                  */
51 /*  Defines                                                                         */
52 /*                                                                                  */
53 /************************************************************************************/
54 
55 /* Configuration switch controls */
56 #define LVCS_STEREOENHANCESWITCH    0x0001      /* Stereo enhancement enable control */
57 #define LVCS_REVERBSWITCH           0x0002      /* Reverberation enable control */
58 #define LVCS_EQUALISERSWITCH        0x0004      /* Equaliser enable control */
59 #define LVCS_BYPASSMIXSWITCH        0x0008      /* Bypass mixer enable control */
60 #define LVCS_COMPGAINFRAME          64          /* Compressor gain update interval */
61 
62 /* Memory */
63 #define LVCS_SCRATCHBUFFERS              6      /* Number of buffers required for inplace processing */
64 
65 /* General */
66 #define LVCS_INVALID                0xFFFF      /* Invalid init parameter */
67 #define LVCS_BYPASS_MIXER_TC        100         /* Bypass mixer time */
68 
69 /* Access to external coefficients table */
70 #define LVCS_NR_OF_FS                    9
71 #define LVCS_NR_OF_CHAN_CFG              2
72 
73 
74 /************************************************************************************/
75 /*                                                                                  */
76 /*  Types                                                                           */
77 /*                                                                                  */
78 /************************************************************************************/
79 
80 typedef LVM_UINT16  LVCS_Configuration_t;       /* Internal algorithm configuration */
81 
82 typedef enum
83 {
84     LVCS_HEADPHONE  = 0,
85     LVCS_DEVICE_MAX = LVM_MAXENUM
86 } LVCS_OutputDevice_en;
87 
88 
89 /************************************************************************************/
90 /*                                                                                  */
91 /*  Structures                                                                      */
92 /*                                                                                  */
93 /************************************************************************************/
94 
95 /* Volume correction structure */
96 typedef struct
97 {
98     LVM_INT16   CompFull;                       /* Post CS compression 100% effect */
99     LVM_INT16   CompMin;                        /* Post CS compression 0% effect */
100     LVM_INT16   GainFull;                       /* CS gain correct 100% effect */
101     LVM_INT16   GainMin;                        /* CS gain correct 0% effect */
102 } LVCS_VolCorrect_t;
103 
104 /* Instance structure */
105 typedef struct
106 {
107     /* Public parameters */
108     LVCS_MemTab_t           MemoryTable;        /* Instance memory allocation table */
109     LVCS_Params_t           Params;             /* Instance parameters */
110     LVCS_Capabilities_t     Capabilities;       /* Initialisation capabilities */
111 
112     /* Private parameters */
113     LVCS_OutputDevice_en    OutputDevice;       /* Selected output device type */
114     LVCS_VolCorrect_t       VolCorrect;         /* Volume correction settings */
115     LVM_INT16               TransitionGain;     /* Transition gain */
116     LVM_INT16               CompressGain;       /* Last used compressor gain*/
117 
118     /* Sub-block configurations */
119     LVCS_StereoEnhancer_t   StereoEnhancer;     /* Stereo enhancer configuration */
120     LVCS_ReverbGenerator_t  Reverberation;      /* Reverberation configuration */
121     LVCS_Equaliser_t        Equaliser;          /* Equaliser configuration */
122     LVCS_BypassMix_t        BypassMix;          /* Bypass mixer configuration */
123 
124     /* Bypass variable */
125     LVM_INT16               MSTarget0;                          /* Mixer state control variable for smooth transtion */
126     LVM_INT16               MSTarget1;                          /* Mixer state control variable for smooth transtion */
127     LVM_INT16               bInOperatingModeTransition;         /* Operating mode transition flag */
128     LVM_INT16               bTimerDone;                         /* Timer completion flag */
129     LVM_Timer_Params_t      TimerParams;                        /* Timer parameters */
130     LVM_Timer_Instance_t    TimerInstance;                      /* Timer instance */
131 
132 } LVCS_Instance_t;
133 
134 /* Coefficient Structure */
135 typedef struct
136 {
137     Biquad_Instance_t       EqualiserBiquadInstance;
138     Biquad_Instance_t       ReverbBiquadInstance;
139     Biquad_Instance_t       SEBiquadInstanceMid;
140     Biquad_Instance_t       SEBiquadInstanceSide;
141 
142 } LVCS_Coefficient_t;
143 
144 /* Data Structure */
145 typedef struct
146 {
147     Biquad_2I_Order2_Taps_t EqualiserBiquadTaps;
148     Biquad_2I_Order2_Taps_t ReverbBiquadTaps;
149     Biquad_1I_Order1_Taps_t SEBiquadTapsMid;
150     Biquad_1I_Order2_Taps_t SEBiquadTapsSide;
151 
152 } LVCS_Data_t;
153 
154 
155 void LVCS_TimerCallBack (   void* hInstance,
156                             void* pCallBackParams,
157                             LVM_INT32 CallbackParam);
158 
159 
160 #ifdef __cplusplus
161 }
162 #endif /* __cplusplus */
163 
164 #endif      /* PRIVATE_H */
165 
166 
167