aacdectab.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. * AAC decoder data
  3. * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
  4. * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
  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 libavcodec/aacdectab.h
  24. * AAC decoder data
  25. * @author Oded Shimon ( ods15 ods15 dyndns org )
  26. * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
  27. */
  28. #ifndef AVCODEC_AACDECTAB_H
  29. #define AVCODEC_AACDECTAB_H
  30. #include "aac.h"
  31. #include <stdint.h>
  32. /* @name swb_offsets
  33. * Sample offset into the window indicating the beginning of a scalefactor
  34. * window band
  35. *
  36. * scalefactor window band - term for scalefactor bands within a window,
  37. * given in Table 4.110 to Table 4.128.
  38. *
  39. * scalefactor band - a set of spectral coefficients which are scaled by one
  40. * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band
  41. * may contain several scalefactor window bands of corresponding frequency. For
  42. * all other window_sequences scalefactor bands and scalefactor window bands are
  43. * identical.
  44. * @{
  45. */
  46. static const uint16_t swb_offset_1024_96[] = {
  47. 0, 4, 8, 12, 16, 20, 24, 28,
  48. 32, 36, 40, 44, 48, 52, 56, 64,
  49. 72, 80, 88, 96, 108, 120, 132, 144,
  50. 156, 172, 188, 212, 240, 276, 320, 384,
  51. 448, 512, 576, 640, 704, 768, 832, 896,
  52. 960, 1024
  53. };
  54. static const uint16_t swb_offset_128_96[] = {
  55. 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
  56. };
  57. static const uint16_t swb_offset_1024_64[] = {
  58. 0, 4, 8, 12, 16, 20, 24, 28,
  59. 32, 36, 40, 44, 48, 52, 56, 64,
  60. 72, 80, 88, 100, 112, 124, 140, 156,
  61. 172, 192, 216, 240, 268, 304, 344, 384,
  62. 424, 464, 504, 544, 584, 624, 664, 704,
  63. 744, 784, 824, 864, 904, 944, 984, 1024
  64. };
  65. static const uint16_t swb_offset_1024_48[] = {
  66. 0, 4, 8, 12, 16, 20, 24, 28,
  67. 32, 36, 40, 48, 56, 64, 72, 80,
  68. 88, 96, 108, 120, 132, 144, 160, 176,
  69. 196, 216, 240, 264, 292, 320, 352, 384,
  70. 416, 448, 480, 512, 544, 576, 608, 640,
  71. 672, 704, 736, 768, 800, 832, 864, 896,
  72. 928, 1024
  73. };
  74. static const uint16_t swb_offset_128_48[] = {
  75. 0, 4, 8, 12, 16, 20, 28, 36,
  76. 44, 56, 68, 80, 96, 112, 128
  77. };
  78. static const uint16_t swb_offset_1024_32[] = {
  79. 0, 4, 8, 12, 16, 20, 24, 28,
  80. 32, 36, 40, 48, 56, 64, 72, 80,
  81. 88, 96, 108, 120, 132, 144, 160, 176,
  82. 196, 216, 240, 264, 292, 320, 352, 384,
  83. 416, 448, 480, 512, 544, 576, 608, 640,
  84. 672, 704, 736, 768, 800, 832, 864, 896,
  85. 928, 960, 992, 1024
  86. };
  87. static const uint16_t swb_offset_1024_24[] = {
  88. 0, 4, 8, 12, 16, 20, 24, 28,
  89. 32, 36, 40, 44, 52, 60, 68, 76,
  90. 84, 92, 100, 108, 116, 124, 136, 148,
  91. 160, 172, 188, 204, 220, 240, 260, 284,
  92. 308, 336, 364, 396, 432, 468, 508, 552,
  93. 600, 652, 704, 768, 832, 896, 960, 1024
  94. };
  95. static const uint16_t swb_offset_128_24[] = {
  96. 0, 4, 8, 12, 16, 20, 24, 28,
  97. 36, 44, 52, 64, 76, 92, 108, 128
  98. };
  99. static const uint16_t swb_offset_1024_16[] = {
  100. 0, 8, 16, 24, 32, 40, 48, 56,
  101. 64, 72, 80, 88, 100, 112, 124, 136,
  102. 148, 160, 172, 184, 196, 212, 228, 244,
  103. 260, 280, 300, 320, 344, 368, 396, 424,
  104. 456, 492, 532, 572, 616, 664, 716, 772,
  105. 832, 896, 960, 1024
  106. };
  107. static const uint16_t swb_offset_128_16[] = {
  108. 0, 4, 8, 12, 16, 20, 24, 28,
  109. 32, 40, 48, 60, 72, 88, 108, 128
  110. };
  111. static const uint16_t swb_offset_1024_8[] = {
  112. 0, 12, 24, 36, 48, 60, 72, 84,
  113. 96, 108, 120, 132, 144, 156, 172, 188,
  114. 204, 220, 236, 252, 268, 288, 308, 328,
  115. 348, 372, 396, 420, 448, 476, 508, 544,
  116. 580, 620, 664, 712, 764, 820, 880, 944,
  117. 1024
  118. };
  119. static const uint16_t swb_offset_128_8[] = {
  120. 0, 4, 8, 12, 16, 20, 24, 28,
  121. 36, 44, 52, 60, 72, 88, 108, 128
  122. };
  123. static const uint16_t *swb_offset_1024[] = {
  124. swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64,
  125. swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32,
  126. swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16,
  127. swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8,
  128. swb_offset_1024_8
  129. };
  130. static const uint16_t *swb_offset_128[] = {
  131. /* The last entry on the following row is swb_offset_128_64 but is a
  132. duplicate of swb_offset_128_96. */
  133. swb_offset_128_96, swb_offset_128_96, swb_offset_128_96,
  134. swb_offset_128_48, swb_offset_128_48, swb_offset_128_48,
  135. swb_offset_128_24, swb_offset_128_24, swb_offset_128_16,
  136. swb_offset_128_16, swb_offset_128_16, swb_offset_128_8,
  137. swb_offset_128_8
  138. };
  139. // @}
  140. /* @name tns_max_bands
  141. * The maximum number of scalefactor bands on which TNS can operate for the long
  142. * and short transforms respectively. The index to these tables is related to
  143. * the sample rate of the audio.
  144. * @{
  145. */
  146. static const uint8_t tns_max_bands_1024[] = {
  147. 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
  148. };
  149. static const uint8_t tns_max_bands_128[] = {
  150. 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
  151. };
  152. // @}
  153. /* @name tns_tmp2_map
  154. * Tables of the tmp2[] arrays of LPC coefficients used for TNS.
  155. * The suffix _M_N[] indicate the values of coef_compress and coef_res
  156. * respectively.
  157. * @{
  158. */
  159. static const float tns_tmp2_map_1_3[4] = {
  160. 0.00000000, -0.43388373, 0.64278758, 0.34202015,
  161. };
  162. static const float tns_tmp2_map_0_3[8] = {
  163. 0.00000000, -0.43388373, -0.78183150, -0.97492790,
  164. 0.98480773, 0.86602539, 0.64278758, 0.34202015,
  165. };
  166. static const float tns_tmp2_map_1_4[8] = {
  167. 0.00000000, -0.20791170, -0.40673664, -0.58778524,
  168. 0.67369562, 0.52643216, 0.36124167, 0.18374951,
  169. };
  170. static const float tns_tmp2_map_0_4[16] = {
  171. 0.00000000, -0.20791170, -0.40673664, -0.58778524,
  172. -0.74314481, -0.86602539, -0.95105654, -0.99452192,
  173. 0.99573416, 0.96182561, 0.89516330, 0.79801720,
  174. 0.67369562, 0.52643216, 0.36124167, 0.18374951,
  175. };
  176. static const float * const tns_tmp2_map[4] = {
  177. tns_tmp2_map_0_3,
  178. tns_tmp2_map_0_4,
  179. tns_tmp2_map_1_3,
  180. tns_tmp2_map_1_4
  181. };
  182. // @}
  183. #endif /* AVCODEC_AACDECTAB_H */