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