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 /*  Includes                                                                        */
21 /*                                                                                  */
22 /************************************************************************************/
23 
24 #include "LVCS_Private.h"
25 #include "LVCS_Tables.h"
26 #include "Filters.h"                            /* Filter definitions */
27 #include "BIQUAD.h"                             /* Biquad definitions */
28 #include "LVCS_Headphone_Coeffs.h"              /* Headphone coefficients */
29 
30 /************************************************************************************/
31 /*                                                                                  */
32 /*  Stereo Enhancer coefficient constant tables                                     */
33 /*                                                                                  */
34 /************************************************************************************/
35 
36 /* Coefficient table for the middle filter */
37 const BiquadA01B1CoefsSP_t LVCS_SEMidCoefTable[] = {
38     {CS_MIDDLE_8000_A0,         /* 8kS/s coefficients */
39      CS_MIDDLE_8000_A1,
40      CS_MIDDLE_8000_B1,
41      (LVM_UINT16 )CS_MIDDLE_8000_SCALE},
42     {CS_MIDDLE_11025_A0,        /* 11kS/s coefficients */
43      CS_MIDDLE_11025_A1,
44      CS_MIDDLE_11025_B1,
45      (LVM_UINT16 )CS_MIDDLE_11025_SCALE},
46     {CS_MIDDLE_12000_A0,        /* 12kS/s coefficients */
47      CS_MIDDLE_12000_A1,
48      CS_MIDDLE_12000_B1,
49      (LVM_UINT16 )CS_MIDDLE_12000_SCALE},
50     {CS_MIDDLE_16000_A0,        /* 16kS/s coefficients */
51      CS_MIDDLE_16000_A1,
52      CS_MIDDLE_16000_B1,
53      (LVM_UINT16 )CS_MIDDLE_16000_SCALE},
54     {CS_MIDDLE_22050_A0,        /* 22kS/s coefficients */
55      CS_MIDDLE_22050_A1,
56      CS_MIDDLE_22050_B1,
57      (LVM_UINT16 )CS_MIDDLE_22050_SCALE},
58     {CS_MIDDLE_24000_A0,        /* 24kS/s coefficients */
59      CS_MIDDLE_24000_A1,
60      CS_MIDDLE_24000_B1,
61      (LVM_UINT16 )CS_MIDDLE_24000_SCALE},
62     {CS_MIDDLE_32000_A0,        /* 32kS/s coefficients */
63      CS_MIDDLE_32000_A1,
64      CS_MIDDLE_32000_B1,
65      (LVM_UINT16 )CS_MIDDLE_32000_SCALE},
66     {CS_MIDDLE_44100_A0,        /* 44kS/s coefficients */
67      CS_MIDDLE_44100_A1,
68      CS_MIDDLE_44100_B1,
69      (LVM_UINT16 )CS_MIDDLE_44100_SCALE},
70     {CS_MIDDLE_48000_A0,        /* 48kS/s coefficients */
71      CS_MIDDLE_48000_A1,
72      CS_MIDDLE_48000_B1,
73      (LVM_UINT16 )CS_MIDDLE_48000_SCALE}
74     ,
75     {CS_MIDDLE_88200_A0,        /* 88kS/s coefficients */
76      CS_MIDDLE_88200_A1,
77      CS_MIDDLE_88200_B1,
78      (LVM_UINT16)CS_MIDDLE_88200_SCALE},
79     {CS_MIDDLE_96000_A0,        /* 96kS/s coefficients */
80      CS_MIDDLE_96000_A1,
81      CS_MIDDLE_96000_B1,
82      (LVM_UINT16 )CS_MIDDLE_96000_SCALE},
83     {CS_MIDDLE_176400_A0,        /* 176kS/s coefficients */
84      CS_MIDDLE_176400_A1,
85      CS_MIDDLE_176400_B1,
86      (LVM_UINT16)CS_MIDDLE_176400_SCALE},
87     {CS_MIDDLE_192000_A0,        /* 192kS/s coefficients */
88      CS_MIDDLE_192000_A1,
89      CS_MIDDLE_192000_B1,
90      (LVM_UINT16 )CS_MIDDLE_192000_SCALE}
91     };
92 
93 /* Coefficient table for the side filter */
94 const BiquadA012B12CoefsSP_t LVCS_SESideCoefTable[] = {
95     /* Headphone Side coefficients */
96     {CS_SIDE_8000_A0,           /* 8kS/s coefficients */
97      CS_SIDE_8000_A1,
98      CS_SIDE_8000_A2,
99      CS_SIDE_8000_B1,
100      CS_SIDE_8000_B2,
101      (LVM_UINT16 )CS_SIDE_8000_SCALE},
102     {CS_SIDE_11025_A0,          /* 11kS/s coefficients */
103      CS_SIDE_11025_A1,
104      CS_SIDE_11025_A2,
105      CS_SIDE_11025_B1,
106      CS_SIDE_11025_B2,
107      (LVM_UINT16 )CS_SIDE_11025_SCALE},
108     {CS_SIDE_12000_A0,          /* 12kS/s coefficients */
109      CS_SIDE_12000_A1,
110      CS_SIDE_12000_A2,
111      CS_SIDE_12000_B1,
112      CS_SIDE_12000_B2,
113      (LVM_UINT16 )CS_SIDE_12000_SCALE},
114     {CS_SIDE_16000_A0,          /* 16kS/s coefficients */
115      CS_SIDE_16000_A1,
116      CS_SIDE_16000_A2,
117      CS_SIDE_16000_B1,
118      CS_SIDE_16000_B2,
119      (LVM_UINT16 )CS_SIDE_16000_SCALE},
120     {CS_SIDE_22050_A0,          /* 22kS/s coefficients */
121      CS_SIDE_22050_A1,
122      CS_SIDE_22050_A2,
123      CS_SIDE_22050_B1,
124      CS_SIDE_22050_B2,
125      (LVM_UINT16 )CS_SIDE_22050_SCALE},
126     {CS_SIDE_24000_A0,          /* 24kS/s coefficients */
127      CS_SIDE_24000_A1,
128      CS_SIDE_24000_A2,
129      CS_SIDE_24000_B1,
130      CS_SIDE_24000_B2,
131      (LVM_UINT16 )CS_SIDE_24000_SCALE},
132     {CS_SIDE_32000_A0,          /* 32kS/s coefficients */
133      CS_SIDE_32000_A1,
134      CS_SIDE_32000_A2,
135      CS_SIDE_32000_B1,
136      CS_SIDE_32000_B2,
137      (LVM_UINT16 )CS_SIDE_32000_SCALE},
138     {CS_SIDE_44100_A0,          /* 44kS/s coefficients */
139      CS_SIDE_44100_A1,
140      CS_SIDE_44100_A2,
141      CS_SIDE_44100_B1,
142      CS_SIDE_44100_B2,
143      (LVM_UINT16 )CS_SIDE_44100_SCALE},
144     {CS_SIDE_48000_A0,          /* 48kS/s coefficients */
145      CS_SIDE_48000_A1,
146      CS_SIDE_48000_A2,
147      CS_SIDE_48000_B1,
148      CS_SIDE_48000_B2,
149      (LVM_UINT16 )CS_SIDE_48000_SCALE}
150      ,
151     {CS_SIDE_88200_A0,          /* 88kS/s coefficients */
152      CS_SIDE_88200_A1,
153      CS_SIDE_88200_A2,
154      CS_SIDE_88200_B1,
155      CS_SIDE_88200_B2,
156      (LVM_UINT16)CS_SIDE_88200_SCALE},
157      {CS_SIDE_96000_A0,          /* 96kS/s coefficients */
158      CS_SIDE_96000_A1,
159      CS_SIDE_96000_A2,
160      CS_SIDE_96000_B1,
161      CS_SIDE_96000_B2,
162      (LVM_UINT16 )CS_SIDE_96000_SCALE},
163     {CS_SIDE_176400_A0,          /*176kS/s coefficients */
164      CS_SIDE_176400_A1,
165      CS_SIDE_176400_A2,
166      CS_SIDE_176400_B1,
167      CS_SIDE_176400_B2,
168      (LVM_UINT16)CS_SIDE_176400_SCALE},
169      {CS_SIDE_192000_A0,          /* 192kS/s coefficients */
170      CS_SIDE_192000_A1,
171      CS_SIDE_192000_A2,
172      CS_SIDE_192000_B1,
173      CS_SIDE_192000_B2,
174      (LVM_UINT16 )CS_SIDE_192000_SCALE}
175 };
176 
177 /************************************************************************************/
178 /*                                                                                  */
179 /*  Equaliser coefficient constant tables                                           */
180 /*                                                                                  */
181 /************************************************************************************/
182 
183 const BiquadA012B12CoefsSP_t LVCS_EqualiserCoefTable[] = {
184     /* Headphone coefficients */
185     {CS_EQUALISER_8000_A0,      /* 8kS/s coefficients */
186      CS_EQUALISER_8000_A1,
187      CS_EQUALISER_8000_A2,
188      CS_EQUALISER_8000_B1,
189      CS_EQUALISER_8000_B2,
190      (LVM_UINT16 )CS_EQUALISER_8000_SCALE},
191     {CS_EQUALISER_11025_A0,     /* 11kS/s coefficients */
192      CS_EQUALISER_11025_A1,
193      CS_EQUALISER_11025_A2,
194      CS_EQUALISER_11025_B1,
195      CS_EQUALISER_11025_B2,
196      (LVM_UINT16 )CS_EQUALISER_11025_SCALE},
197     {CS_EQUALISER_12000_A0,     /* 12kS/s coefficients */
198      CS_EQUALISER_12000_A1,
199      CS_EQUALISER_12000_A2,
200      CS_EQUALISER_12000_B1,
201      CS_EQUALISER_12000_B2,
202      (LVM_UINT16 )CS_EQUALISER_12000_SCALE},
203     {CS_EQUALISER_16000_A0,     /* 16kS/s coefficients */
204      CS_EQUALISER_16000_A1,
205      CS_EQUALISER_16000_A2,
206      CS_EQUALISER_16000_B1,
207      CS_EQUALISER_16000_B2,
208      (LVM_UINT16 )CS_EQUALISER_16000_SCALE},
209     {CS_EQUALISER_22050_A0,     /* 22kS/s coefficients */
210      CS_EQUALISER_22050_A1,
211      CS_EQUALISER_22050_A2,
212      CS_EQUALISER_22050_B1,
213      CS_EQUALISER_22050_B2,
214      (LVM_UINT16 )CS_EQUALISER_22050_SCALE},
215     {CS_EQUALISER_24000_A0,     /* 24kS/s coefficients */
216      CS_EQUALISER_24000_A1,
217      CS_EQUALISER_24000_A2,
218      CS_EQUALISER_24000_B1,
219      CS_EQUALISER_24000_B2,
220      (LVM_UINT16 )CS_EQUALISER_24000_SCALE},
221     {CS_EQUALISER_32000_A0,     /* 32kS/s coefficients */
222      CS_EQUALISER_32000_A1,
223      CS_EQUALISER_32000_A2,
224      CS_EQUALISER_32000_B1,
225      CS_EQUALISER_32000_B2,
226      (LVM_UINT16 )CS_EQUALISER_32000_SCALE},
227     {CS_EQUALISER_44100_A0,     /* 44kS/s coefficients */
228      CS_EQUALISER_44100_A1,
229      CS_EQUALISER_44100_A2,
230      CS_EQUALISER_44100_B1,
231      CS_EQUALISER_44100_B2,
232      (LVM_UINT16 )CS_EQUALISER_44100_SCALE},
233     {CS_EQUALISER_48000_A0,     /* 48kS/s coefficients */
234      CS_EQUALISER_48000_A1,
235      CS_EQUALISER_48000_A2,
236      CS_EQUALISER_48000_B1,
237      CS_EQUALISER_48000_B2,
238      (LVM_UINT16 )CS_EQUALISER_48000_SCALE},
239     {CS_EQUALISER_88200_A0,     /* 88kS/s coeffieients */
240      CS_EQUALISER_88200_A1,
241      CS_EQUALISER_88200_A2,
242      CS_EQUALISER_88200_B1,
243      CS_EQUALISER_88200_B2,
244      (LVM_UINT16)CS_EQUALISER_88200_SCALE},
245     {CS_EQUALISER_96000_A0,     /* 96kS/s coefficients */
246      CS_EQUALISER_96000_A1,
247      CS_EQUALISER_96000_A2,
248      CS_EQUALISER_96000_B1,
249      CS_EQUALISER_96000_B2,
250      (LVM_UINT16 )CS_EQUALISER_96000_SCALE},
251     {CS_EQUALISER_176400_A0,     /* 176kS/s coefficients */
252      CS_EQUALISER_176400_A1,
253      CS_EQUALISER_176400_A2,
254      CS_EQUALISER_176400_B1,
255      CS_EQUALISER_176400_B2,
256      (LVM_UINT16)CS_EQUALISER_176400_SCALE},
257     {CS_EQUALISER_192000_A0,     /* 192kS/s coefficients */
258      CS_EQUALISER_192000_A1,
259      CS_EQUALISER_192000_A2,
260      CS_EQUALISER_192000_B1,
261      CS_EQUALISER_192000_B2,
262      (LVM_UINT16 )CS_EQUALISER_192000_SCALE},
263 
264     /* Concert Sound EX Headphone coefficients */
265     {CSEX_EQUALISER_8000_A0,    /* 8kS/s coefficients */
266      CSEX_EQUALISER_8000_A1,
267      CSEX_EQUALISER_8000_A2,
268      CSEX_EQUALISER_8000_B1,
269      CSEX_EQUALISER_8000_B2,
270      (LVM_UINT16 )CSEX_EQUALISER_8000_SCALE},
271     {CSEX_EQUALISER_11025_A0,   /* 11kS/s coefficients */
272      CSEX_EQUALISER_11025_A1,
273      CSEX_EQUALISER_11025_A2,
274      CSEX_EQUALISER_11025_B1,
275      CSEX_EQUALISER_11025_B2,
276      (LVM_UINT16 )CSEX_EQUALISER_11025_SCALE},
277     {CSEX_EQUALISER_12000_A0,   /* 12kS/s coefficients */
278      CSEX_EQUALISER_12000_A1,
279      CSEX_EQUALISER_12000_A2,
280      CSEX_EQUALISER_12000_B1,
281      CSEX_EQUALISER_12000_B2,
282      (LVM_UINT16 )CSEX_EQUALISER_12000_SCALE},
283     {CSEX_EQUALISER_16000_A0,   /* 16kS/s coefficients */
284      CSEX_EQUALISER_16000_A1,
285      CSEX_EQUALISER_16000_A2,
286      CSEX_EQUALISER_16000_B1,
287      CSEX_EQUALISER_16000_B2,
288      (LVM_UINT16 )CSEX_EQUALISER_16000_SCALE},
289     {CSEX_EQUALISER_22050_A0,   /* 22kS/s coefficients */
290      CSEX_EQUALISER_22050_A1,
291      CSEX_EQUALISER_22050_A2,
292      CSEX_EQUALISER_22050_B1,
293      CSEX_EQUALISER_22050_B2,
294      (LVM_UINT16 )CSEX_EQUALISER_22050_SCALE},
295     {CSEX_EQUALISER_24000_A0,   /* 24kS/s coefficients */
296      CSEX_EQUALISER_24000_A1,
297      CSEX_EQUALISER_24000_A2,
298      CSEX_EQUALISER_24000_B1,
299      CSEX_EQUALISER_24000_B2,
300      (LVM_UINT16 )CSEX_EQUALISER_24000_SCALE},
301     {CSEX_EQUALISER_32000_A0,   /* 32kS/s coefficients */
302      CSEX_EQUALISER_32000_A1,
303      CSEX_EQUALISER_32000_A2,
304      CSEX_EQUALISER_32000_B1,
305      CSEX_EQUALISER_32000_B2,
306      (LVM_UINT16 )CSEX_EQUALISER_32000_SCALE},
307     {CSEX_EQUALISER_44100_A0,   /* 44kS/s coefficients */
308      CSEX_EQUALISER_44100_A1,
309      CSEX_EQUALISER_44100_A2,
310      CSEX_EQUALISER_44100_B1,
311      CSEX_EQUALISER_44100_B2,
312      (LVM_UINT16 )CSEX_EQUALISER_44100_SCALE},
313     {CSEX_EQUALISER_48000_A0,   /* 48kS/s coefficients */
314      CSEX_EQUALISER_48000_A1,
315      CSEX_EQUALISER_48000_A2,
316      CSEX_EQUALISER_48000_B1,
317      CSEX_EQUALISER_48000_B2,
318      (LVM_UINT16 )CSEX_EQUALISER_48000_SCALE}
319     ,
320     {CSEX_EQUALISER_88200_A0,   /* 88kS/s coefficients */
321      CSEX_EQUALISER_88200_A1,
322      CSEX_EQUALISER_88200_A2,
323      CSEX_EQUALISER_88200_B1,
324      CSEX_EQUALISER_88200_B2,
325      (LVM_UINT16)CSEX_EQUALISER_88200_SCALE},
326     {CSEX_EQUALISER_96000_A0,   /* 96kS/s coefficients */
327      CSEX_EQUALISER_96000_A1,
328      CSEX_EQUALISER_96000_A2,
329      CSEX_EQUALISER_96000_B1,
330      CSEX_EQUALISER_96000_B2,
331      (LVM_UINT16 )CSEX_EQUALISER_96000_SCALE},
332     {CSEX_EQUALISER_176400_A0,   /* 176kS/s coefficients */
333      CSEX_EQUALISER_176400_A1,
334      CSEX_EQUALISER_176400_A2,
335      CSEX_EQUALISER_176400_B1,
336      CSEX_EQUALISER_176400_B2,
337      (LVM_UINT16)CSEX_EQUALISER_176400_SCALE},
338      {CSEX_EQUALISER_192000_A0,   /* 192kS/s coefficients */
339      CSEX_EQUALISER_192000_A1,
340      CSEX_EQUALISER_192000_A2,
341      CSEX_EQUALISER_192000_B1,
342      CSEX_EQUALISER_192000_B2,
343      (LVM_UINT16 )CSEX_EQUALISER_192000_SCALE}
344 };
345 
346 /************************************************************************************/
347 /*                                                                                  */
348 /*  Reverb delay constant tables                                                    */
349 /*                                                                                  */
350 /************************************************************************************/
351 
352 /* Stereo delay table for Concert Sound */
353 const LVM_UINT16    LVCS_StereoDelayCS[] = {
354     LVCS_STEREODELAY_CS_8KHZ,
355     LVCS_STEREODELAY_CS_11KHZ,
356     LVCS_STEREODELAY_CS_12KHZ,
357     LVCS_STEREODELAY_CS_16KHZ,
358     LVCS_STEREODELAY_CS_22KHZ,
359     LVCS_STEREODELAY_CS_24KHZ,
360     LVCS_STEREODELAY_CS_32KHZ,
361     LVCS_STEREODELAY_CS_44KHZ,
362     LVCS_STEREODELAY_CS_48KHZ,
363     LVCS_STEREODELAY_CS_88KHZ,
364     LVCS_STEREODELAY_CS_96KHZ,
365     LVCS_STEREODELAY_CS_176KHZ,
366     LVCS_STEREODELAY_CS_192KHZ,
367 };
368 
369 /************************************************************************************/
370 /*                                                                                  */
371 /*  Reverb coefficients constant table                                              */
372 /*                                                                                  */
373 /************************************************************************************/
374 
375 const BiquadA012B12CoefsSP_t LVCS_ReverbCoefTable[] = {
376     /* Headphone coefficients */
377     {CS_REVERB_8000_A0,             /* 8kS/s coefficients */
378      CS_REVERB_8000_A1,
379      CS_REVERB_8000_A2,
380      CS_REVERB_8000_B1,
381      CS_REVERB_8000_B2,
382      (LVM_UINT16 )CS_REVERB_8000_SCALE},
383     {CS_REVERB_11025_A0,            /* 11kS/s coefficients */
384      CS_REVERB_11025_A1,
385      CS_REVERB_11025_A2,
386      CS_REVERB_11025_B1,
387      CS_REVERB_11025_B2,
388      (LVM_UINT16 )CS_REVERB_11025_SCALE},
389     {CS_REVERB_12000_A0,            /* 12kS/s coefficients */
390      CS_REVERB_12000_A1,
391      CS_REVERB_12000_A2,
392      CS_REVERB_12000_B1,
393      CS_REVERB_12000_B2,
394      (LVM_UINT16 )CS_REVERB_12000_SCALE},
395     {CS_REVERB_16000_A0,            /* 16kS/s coefficients */
396      CS_REVERB_16000_A1,
397      CS_REVERB_16000_A2,
398      CS_REVERB_16000_B1,
399      CS_REVERB_16000_B2,
400      (LVM_UINT16 )CS_REVERB_16000_SCALE},
401     {CS_REVERB_22050_A0,            /* 22kS/s coefficients */
402      CS_REVERB_22050_A1,
403      CS_REVERB_22050_A2,
404      CS_REVERB_22050_B1,
405      CS_REVERB_22050_B2,
406      (LVM_UINT16 )CS_REVERB_22050_SCALE},
407     {CS_REVERB_24000_A0,            /* 24kS/s coefficients */
408      CS_REVERB_24000_A1,
409      CS_REVERB_24000_A2,
410      CS_REVERB_24000_B1,
411      CS_REVERB_24000_B2,
412      (LVM_UINT16 )CS_REVERB_24000_SCALE},
413     {CS_REVERB_32000_A0,            /* 32kS/s coefficients */
414      CS_REVERB_32000_A1,
415      CS_REVERB_32000_A2,
416      CS_REVERB_32000_B1,
417      CS_REVERB_32000_B2,
418      (LVM_UINT16 )CS_REVERB_32000_SCALE},
419     {CS_REVERB_44100_A0,            /* 44kS/s coefficients */
420      CS_REVERB_44100_A1,
421      CS_REVERB_44100_A2,
422      CS_REVERB_44100_B1,
423      CS_REVERB_44100_B2,
424      (LVM_UINT16 )CS_REVERB_44100_SCALE},
425     {CS_REVERB_48000_A0,            /* 48kS/s coefficients */
426      CS_REVERB_48000_A1,
427      CS_REVERB_48000_A2,
428      CS_REVERB_48000_B1,
429      CS_REVERB_48000_B2,
430      (LVM_UINT16 )CS_REVERB_48000_SCALE}
431     ,
432     {CS_REVERB_88200_A0,            /* 88kS/s coefficients */
433      CS_REVERB_88200_A1,
434      CS_REVERB_88200_A2,
435      CS_REVERB_88200_B1,
436      CS_REVERB_88200_B2,
437      (LVM_UINT16)CS_REVERB_88200_SCALE},
438     {CS_REVERB_96000_A0,            /* 96kS/s coefficients */
439      CS_REVERB_96000_A1,
440      CS_REVERB_96000_A2,
441      CS_REVERB_96000_B1,
442      CS_REVERB_96000_B2,
443      (LVM_UINT16 )CS_REVERB_96000_SCALE},
444     {CS_REVERB_176400_A0,            /* 176kS/s coefficients */
445      CS_REVERB_176400_A1,
446      CS_REVERB_176400_A2,
447      CS_REVERB_176400_B1,
448      CS_REVERB_176400_B2,
449      (LVM_UINT16)CS_REVERB_176400_SCALE},
450      {CS_REVERB_192000_A0,            /* 192kS/s coefficients */
451      CS_REVERB_192000_A1,
452      CS_REVERB_192000_A2,
453      CS_REVERB_192000_B1,
454      CS_REVERB_192000_B2,
455      (LVM_UINT16 )CS_REVERB_192000_SCALE}
456 };
457 
458 /************************************************************************************/
459 /*                                                                                  */
460 /*  Bypass mixer constant tables                                                    */
461 /*                                                                                  */
462 /************************************************************************************/
463 
464 const Gain_t LVCS_OutputGainTable[] = {
465     {LVCS_HEADPHONE_SHIFT,         /* Headphone, stereo mode */
466      LVCS_HEADPHONE_SHIFTLOSS,
467      LVCS_HEADPHONE_GAIN},
468     {LVCS_EX_HEADPHONE_SHIFT,      /* EX Headphone, stereo mode */
469      LVCS_EX_HEADPHONE_SHIFTLOSS,
470      LVCS_EX_HEADPHONE_GAIN},
471     {LVCS_HEADPHONE_SHIFT,         /* Headphone, mono mode */
472      LVCS_HEADPHONE_SHIFTLOSS,
473      LVCS_HEADPHONE_GAIN},
474     {LVCS_EX_HEADPHONE_SHIFT,      /* EX Headphone, mono mode */
475      LVCS_EX_HEADPHONE_SHIFTLOSS,
476      LVCS_EX_HEADPHONE_GAIN}
477 };
478 
479 /************************************************************************************/
480 /*                                                                                  */
481 /*  Volume correction table                                                         */
482 /*                                                                                  */
483 /*  Coefficient order:                                                              */
484 /*      Compression 100% effect                                                     */
485 /*      Compression 0% effect                                                       */
486 /*      Gain 100% effect                                                            */
487 /*      Gain 0% effect                                                              */
488 /*                                                                                  */
489 /*  The Compression gain is represented by a Q1.15 number to give a range of 0dB    */
490 /*  to +6dB, E.g.:                                                                  */
491 /*          0       is 0dB compression (no effect)                                  */
492 /*          5461    is 1dB compression gain                                         */
493 /*          10923   is 2dB compression gain                                         */
494 /*          32767   is 6dB compression gain                                         */
495 /*                                                                                  */
496 /*  The Gain is represented as a Q3.13 number to give a range of +8 to -infinity    */
497 /*  E.g.:                                                                           */
498 /*          0       is -infinity                                                    */
499 /*          32767   is +18dB (x8) gain                                              */
500 /*          4096    is 0dB gain                                                     */
501 /*          1024    is -12dB gain                                                   */
502 /*                                                                                  */
503 /************************************************************************************/
504 const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {
505     {0.433362f,          /* Headphone, stereo mode */
506      0.000000f,
507      1.000024f,
508      1.412640f},
509     {0.433362f,          /* EX Headphone, stereo mode */
510      0.000000f,
511      1.000024f,
512      1.412640f},
513     {1.000000f,         /* Headphone, mono mode */
514      0.000000f,
515      1.000024f,
516      1.412640f},
517     {1.000000f,         /* EX Headphone, mono mode */
518      0.000000f,
519      1.000024f,
520      1.412640f}
521 };
522 
523 /************************************************************************************/
524 /*                                                                                  */
525 /*  Mixer time constants, 100ms                                                     */
526 /*                                                                                  */
527 /************************************************************************************/
528 
529 #define LVCS_VOL_TC_Fs8000      32580       /* Floating point value 0.994262695 */
530 #define LVCS_VOL_TC_Fs11025     32632       /* Floating point value 0.995849609 */
531 #define LVCS_VOL_TC_Fs12000     32643       /* Floating point value 0.996185303 */
532 #define LVCS_VOL_TC_Fs16000     32674       /* Floating point value 0.997131348 */
533 #define LVCS_VOL_TC_Fs22050     32700       /* Floating point value 0.997924805 */
534 #define LVCS_VOL_TC_Fs24000     32705       /* Floating point value 0.998077393 */
535 #define LVCS_VOL_TC_Fs32000     32721       /* Floating point value 0.998565674 */
536 #define LVCS_VOL_TC_Fs44100     32734       /* Floating point value 0.998962402 */
537 #define LVCS_VOL_TC_Fs48000     32737       /* Floating point value 0.999053955 */
538 #define LVCS_VOL_TC_Fs88200     32751       /* Floating point value 0.999481066 */
539 #define LVCS_VOL_TC_Fs96000     32751       /* Floating point value 0.999511703 */   /* Todo @ need to re check this value*/
540 #define LVCS_VOL_TC_Fs176400    32759       /* Floating point value 0.999740499 */
541 #define LVCS_VOL_TC_Fs192000    32763       /* Floating point value 0.999877925 */  /* Todo @ need to re check this value*/
542 
543 const LVM_INT16 LVCS_VolumeTCTable[13] = {LVCS_VOL_TC_Fs8000,
544                                           LVCS_VOL_TC_Fs11025,
545                                           LVCS_VOL_TC_Fs12000,
546                                           LVCS_VOL_TC_Fs16000,
547                                           LVCS_VOL_TC_Fs22050,
548                                           LVCS_VOL_TC_Fs24000,
549                                           LVCS_VOL_TC_Fs32000,
550                                           LVCS_VOL_TC_Fs44100,
551                                           LVCS_VOL_TC_Fs48000,
552                                           LVCS_VOL_TC_Fs88200,
553                                           LVCS_VOL_TC_Fs96000,
554                                           LVCS_VOL_TC_Fs176400,
555                                           LVCS_VOL_TC_Fs192000
556 };
557 
558 /************************************************************************************/
559 /*                                                                                  */
560 /*  Sample rate table                                                               */
561 /*                                                                                  */
562 /************************************************************************************/
563 const LVM_INT32   LVCS_SampleRateTable[13] = {8000,
564                                               11025,
565                                               12000,
566                                               16000,
567                                               22050,
568                                               24000,
569                                               32000,
570                                               44100,
571                                               48000,
572                                               88200,
573                                               96000,
574                                               176400,
575                                               192000
576 };
577