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.

108 lines
3.9KB

  1. /*
  2. * ATRAC3 compatible decoder data
  3. * Copyright (c) 2006-2007 Maxim Poliakovski
  4. * Copyright (c) 2006-2007 Benjamin Larsson
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file
  24. * ATRAC3 AKA RealAudio 8 compatible decoder data
  25. */
  26. #ifndef AVCODEC_ATRAC3DATA_H
  27. #define AVCODEC_ATRAC3DATA_H
  28. #include <stdint.h>
  29. /* VLC tables */
  30. static const uint8_t atrac3_hufftabs[][2] = {
  31. /* Spectral coefficient 1 - 9 entries */
  32. { 31, 1 }, { 32, 3 }, { 33, 3 }, { 34, 4 }, { 35, 4 },
  33. { 36, 5 }, { 37, 5 }, { 38, 5 }, { 39, 5 },
  34. /* Spectral coefficient 2 - 5 entries */
  35. { 31, 1 }, { 32, 3 }, { 30, 3 }, { 33, 3 }, { 29, 3 },
  36. /* Spectral coefficient 3 - 7 entries */
  37. { 31, 1 }, { 32, 3 }, { 30, 3 }, { 33, 4 },
  38. { 29, 4 }, { 34, 4 }, { 28, 4 },
  39. /* Spectral coefficient 4 - 9 entries */
  40. { 31, 1 }, { 32, 3 }, { 30, 3 }, { 33, 4 }, { 29, 4 },
  41. { 34, 5 }, { 28, 5 }, { 35, 5 }, { 27, 5 },
  42. /* Spectral coefficient 5 - 15 entries */
  43. { 31, 2 }, { 32, 3 }, { 30, 3 }, { 33, 4 }, { 29, 4 },
  44. { 34, 4 }, { 28, 4 }, { 38, 4 }, { 24, 4 }, { 35, 5 },
  45. { 27, 5 }, { 36, 6 }, { 26, 6 }, { 37, 6 }, { 25, 6 },
  46. /* Spectral coefficient 6 - 31 entries */
  47. { 31, 3 }, { 32, 4 }, { 30, 4 }, { 33, 4 }, { 29, 4 }, { 34, 4 },
  48. { 28, 4 }, { 46, 4 }, { 16, 4 }, { 35, 5 }, { 27, 5 }, { 36, 5 },
  49. { 26, 5 }, { 37, 5 }, { 25, 5 }, { 38, 6 }, { 24, 6 }, { 39, 6 },
  50. { 23, 6 }, { 40, 6 }, { 22, 6 }, { 41, 6 }, { 21, 6 }, { 42, 7 },
  51. { 20, 7 }, { 43, 7 }, { 19, 7 }, { 44, 7 }, { 18, 7 }, { 45, 7 },
  52. { 17, 7 },
  53. /* Spectral coefficient 7 - 63 entries */
  54. { 31, 3 }, { 62, 4 }, { 0, 4 }, { 32, 5 }, { 30, 5 }, { 33, 5 },
  55. { 29, 5 }, { 34, 5 }, { 28, 5 }, { 35, 5 }, { 27, 5 }, { 36, 5 },
  56. { 26, 5 }, { 37, 6 }, { 25, 6 }, { 38, 6 }, { 24, 6 }, { 39, 6 },
  57. { 23, 6 }, { 40, 6 }, { 22, 6 }, { 41, 6 }, { 21, 6 }, { 42, 6 },
  58. { 20, 6 }, { 43, 6 }, { 19, 6 }, { 44, 6 }, { 18, 6 }, { 45, 7 },
  59. { 17, 7 }, { 46, 7 }, { 16, 7 }, { 47, 7 }, { 15, 7 }, { 48, 7 },
  60. { 14, 7 }, { 49, 7 }, { 13, 7 }, { 50, 7 }, { 12, 7 }, { 51, 7 },
  61. { 11, 7 }, { 52, 8 }, { 10, 8 }, { 53, 8 }, { 9, 8 }, { 54, 8 },
  62. { 8, 8 }, { 55, 8 }, { 7, 8 }, { 56, 8 }, { 6, 8 }, { 57, 8 },
  63. { 5, 8 }, { 58, 8 }, { 4, 8 }, { 59, 8 }, { 3, 8 }, { 60, 8 },
  64. { 2, 8 }, { 61, 8 }, { 1, 8 },
  65. };
  66. static const uint8_t huff_tab_sizes[7] = {
  67. 9, 5, 7, 9, 15, 31, 63,
  68. };
  69. /* selector tables */
  70. static const uint8_t clc_length_tab[8] = { 0, 4, 3, 3, 4, 4, 5, 6 };
  71. static const int8_t mantissa_clc_tab[4] = { 0, 1, -2, -1 };
  72. static const int8_t mantissa_vlc_tab[18] = {
  73. 0, 0, 0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1
  74. };
  75. /* tables for the scalefactor decoding */
  76. static const float inv_max_quant[8] = {
  77. 0.0, 1.0 / 1.5, 1.0 / 2.5, 1.0 / 3.5,
  78. 1.0 / 4.5, 1.0 / 7.5, 1.0 / 15.5, 1.0 / 31.5
  79. };
  80. static const uint16_t subband_tab[33] = {
  81. 0, 8, 16, 24, 32, 40, 48, 56,
  82. 64, 80, 96, 112, 128, 144, 160, 176,
  83. 192, 224, 256, 288, 320, 352, 384, 416,
  84. 448, 480, 512, 576, 640, 704, 768, 896,
  85. 1024
  86. };
  87. /* joint stereo related tables */
  88. static const float matrix_coeffs[8] = {
  89. 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0
  90. };
  91. #endif /* AVCODEC_ATRAC3DATA_H */