• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /************************************************************************************/
31 /*                                                                                  */
32 /*  Includes                                                                        */
33 /*                                                                                  */
34 /************************************************************************************/
35 
36 #include <audio_utils/BiquadFilter.h>
37 #include "LVCS.h"                 /* Calling or Application layer definitions */
38 #include "LVCS_StereoEnhancer.h"  /* Stereo enhancer module definitions */
39 #include "LVCS_ReverbGenerator.h" /* Reverberation module definitions */
40 #include "LVCS_Equaliser.h"       /* Equaliser module definitions */
41 #include "LVCS_BypassMix.h"       /* Bypass Mixer module definitions */
42 #include "LVM_Timer.h"
43 
44 /************************************************************************************/
45 /*                                                                                  */
46 /*  Defines                                                                         */
47 /*                                                                                  */
48 /************************************************************************************/
49 
50 /* Configuration switch controls */
51 #define LVCS_STEREOENHANCESWITCH 0x0001 /* Stereo enhancement enable control */
52 #define LVCS_REVERBSWITCH 0x0002        /* Reverberation enable control */
53 #define LVCS_EQUALISERSWITCH 0x0004     /* Equaliser enable control */
54 #define LVCS_BYPASSMIXSWITCH 0x0008     /* Bypass mixer enable control */
55 #define LVCS_COMPGAINFRAME 64           /* Compressor gain update interval */
56 
57 /* Memory */
58 #define LVCS_SCRATCHBUFFERS 8 /* Number of buffers required for inplace processing */
59 /*
60  * The Concert Surround module applies processing only on the first two
61  * channels of a multichannel input. The data of first two channels is copied
62  * from the multichannel input into scratch buffer. The buffers added here
63  * are used for this purpose
64  */
65 #define LVCS_MC_SCRATCHBUFFERS 2
66 
67 /* General */
68 #define LVCS_INVALID 0xFFFF      /* Invalid init parameter */
69 #define LVCS_BYPASS_MIXER_TC 100 /* Bypass mixer time */
70 
71 /* Access to external coefficients table */
72 #define LVCS_NR_OF_FS 9
73 #define LVCS_NR_OF_CHAN_CFG 2
74 
75 /************************************************************************************/
76 /*                                                                                  */
77 /*  Types                                                                           */
78 /*                                                                                  */
79 /************************************************************************************/
80 
81 typedef LVM_UINT16 LVCS_Configuration_t; /* Internal algorithm configuration */
82 
83 typedef enum { LVCS_HEADPHONE = 0, LVCS_DEVICE_MAX = LVM_MAXENUM } LVCS_OutputDevice_en;
84 
85 /************************************************************************************/
86 /*                                                                                  */
87 /*  Structures                                                                      */
88 /*                                                                                  */
89 /************************************************************************************/
90 
91 /* Volume correction structure */
92 typedef struct {
93     LVM_FLOAT CompFull; /* Post CS compression 100% effect */
94     LVM_FLOAT CompMin;  /* Post CS compression 0% effect */
95     LVM_FLOAT GainFull; /* CS gain correct 100% effect */
96     LVM_FLOAT GainMin;  /* CS gain correct 0% effect */
97 } LVCS_VolCorrect_t;
98 
99 /* Instance structure */
100 typedef struct {
101     /* Public parameters */
102     LVCS_Params_t Params;             /* Instance parameters */
103     LVCS_Capabilities_t Capabilities; /* Initialisation capabilities */
104 
105     /* Private parameters */
106     LVCS_OutputDevice_en OutputDevice; /* Selected output device type */
107     LVCS_VolCorrect_t VolCorrect;      /* Volume correction settings */
108     LVM_FLOAT TransitionGain;          /* Transition gain */
109     LVM_FLOAT CompressGain;            /* Last used compressor gain*/
110 
111     /* Sub-block configurations */
112     LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */
113     LVCS_ReverbGenerator_t Reverberation; /* Reverberation configuration */
114     LVCS_BypassMix_t BypassMix;           /* Bypass mixer configuration */
115 
116     /* Bypass variable */
117     LVM_INT16 MSTarget0;                  /* Mixer state control variable for smooth transition */
118     LVM_INT16 MSTarget1;                  /* Mixer state control variable for smooth transition */
119     LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
120     LVM_INT16 bTimerDone;                 /* Timer completion flag */
121     LVM_Timer_Params_t TimerParams;       /* Timer parameters */
122     LVM_Timer_Instance_t TimerInstance;   /* Timer instance */
123     std::unique_ptr<android::audio_utils::BiquadFilter<LVM_FLOAT>>
124             pEqBiquad; /* Biquad filter instance for Equaliser */
125     std::unique_ptr<android::audio_utils::BiquadFilter<LVM_FLOAT>>
126             pRevBiquad; /* Biquad filter instance for Reverberation */
127     std::unique_ptr<android::audio_utils::BiquadFilter<LVM_FLOAT>>
128             pSEMidBiquad; /* Biquad filter instance for Stereo enhancement mid */
129     std::unique_ptr<android::audio_utils::BiquadFilter<LVM_FLOAT>>
130             pSESideBiquad; /* Biquad filter instance for Stereo enhancement side */
131     void* pScratch;                       /* Pointer to bundle scratch buffer */
132 
133 } LVCS_Instance_t;
134 
135 
136 void LVCS_TimerCallBack(void* hInstance, void* pCallBackParams, LVM_INT32 CallbackParam);
137 
138 #endif /* PRIVATE_H */
139