You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.2KB

  1. /*
  2. * mpeg audio layer 2 tables. Most of them come from the mpeg audio
  3. * specification.
  4. *
  5. * Copyright (c) 2000, 2001 Fabrice Bellard.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file mpegaudiotab.h
  23. * mpeg audio layer 2 tables.
  24. * Most of them come from the mpeg audio specification.
  25. */
  26. #define SQRT2 1.41421356237309514547
  27. static const int costab32[30] = {
  28. FIX(0.54119610014619701222),
  29. FIX(1.3065629648763763537),
  30. FIX(0.50979557910415917998),
  31. FIX(2.5629154477415054814),
  32. FIX(0.89997622313641556513),
  33. FIX(0.60134488693504528634),
  34. FIX(0.5024192861881556782),
  35. FIX(5.1011486186891552563),
  36. FIX(0.78815462345125020249),
  37. FIX(0.64682178335999007679),
  38. FIX(0.56694403481635768927),
  39. FIX(1.0606776859903470633),
  40. FIX(1.7224470982383341955),
  41. FIX(0.52249861493968885462),
  42. FIX(10.19000812354803287),
  43. FIX(0.674808341455005678),
  44. FIX(1.1694399334328846596),
  45. FIX(0.53104259108978413284),
  46. FIX(2.0577810099534108446),
  47. FIX(0.58293496820613388554),
  48. FIX(0.83934964541552681272),
  49. FIX(0.50547095989754364798),
  50. FIX(3.4076084184687189804),
  51. FIX(0.62250412303566482475),
  52. FIX(0.97256823786196078263),
  53. FIX(0.51544730992262455249),
  54. FIX(1.4841646163141661852),
  55. FIX(0.5531038960344445421),
  56. FIX(0.74453627100229857749),
  57. FIX(0.5006029982351962726),
  58. };
  59. static const int bitinv32[32] = {
  60. 0, 16, 8, 24, 4, 20, 12, 28,
  61. 2, 18, 10, 26, 6, 22, 14, 30,
  62. 1, 17, 9, 25, 5, 21, 13, 29,
  63. 3, 19, 11, 27, 7, 23, 15, 31
  64. };
  65. static int16_t filter_bank[512];
  66. static int scale_factor_table[64];
  67. #ifdef USE_FLOATS
  68. static float scale_factor_inv_table[64];
  69. #else
  70. static int8_t scale_factor_shift[64];
  71. static unsigned short scale_factor_mult[64];
  72. #endif
  73. static unsigned char scale_diff_table[128];
  74. /* total number of bits per allocation group */
  75. static unsigned short total_quant_bits[17];
  76. /* signal to noise ratio of each quantification step (could be
  77. computed from quant_steps[]). The values are dB multiplied by 10
  78. */
  79. static const unsigned short quant_snr[17] = {
  80. 70, 110, 160, 208,
  81. 253, 316, 378, 439,
  82. 499, 559, 620, 680,
  83. 740, 800, 861, 920,
  84. 980
  85. };
  86. /* fixed psycho acoustic model. Values of SNR taken from the 'toolame'
  87. project */
  88. static const float fixed_smr[SBLIMIT] = {
  89. 30, 17, 16, 10, 3, 12, 8, 2.5,
  90. 5, 5, 6, 6, 5, 6, 10, 6,
  91. -4, -10, -21, -30, -42, -55, -68, -75,
  92. -75, -75, -75, -75, -91, -107, -110, -108
  93. };
  94. static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 };