tables_pulses_per_block.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /***********************************************************************
  2. Copyright (c) 2006-2011, Skype Limited. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions
  5. are met:
  6. - Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. - Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. - Neither the name of Internet Society, IETF or IETF Trust, nor the
  12. names of specific contributors, may be used to endorse or promote
  13. products derived from this software without specific prior written
  14. permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  19. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. ***********************************************************************/
  27. #ifdef HAVE_CONFIG_H
  28. #include "config.h"
  29. #endif
  30. #include "tables.h"
  31. const opus_uint8 silk_max_pulses_table[ 4 ] = {
  32. 8, 10, 12, 16
  33. };
  34. const opus_uint8 silk_pulses_per_block_iCDF[ 10 ][ 18 ] = {
  35. {
  36. 125, 51, 26, 18, 15, 12, 11, 10,
  37. 9, 8, 7, 6, 5, 4, 3, 2,
  38. 1, 0
  39. },
  40. {
  41. 198, 105, 45, 22, 15, 12, 11, 10,
  42. 9, 8, 7, 6, 5, 4, 3, 2,
  43. 1, 0
  44. },
  45. {
  46. 213, 162, 116, 83, 59, 43, 32, 24,
  47. 18, 15, 12, 9, 7, 6, 5, 3,
  48. 2, 0
  49. },
  50. {
  51. 239, 187, 116, 59, 28, 16, 11, 10,
  52. 9, 8, 7, 6, 5, 4, 3, 2,
  53. 1, 0
  54. },
  55. {
  56. 250, 229, 188, 135, 86, 51, 30, 19,
  57. 13, 10, 8, 6, 5, 4, 3, 2,
  58. 1, 0
  59. },
  60. {
  61. 249, 235, 213, 185, 156, 128, 103, 83,
  62. 66, 53, 42, 33, 26, 21, 17, 13,
  63. 10, 0
  64. },
  65. {
  66. 254, 249, 235, 206, 164, 118, 77, 46,
  67. 27, 16, 10, 7, 5, 4, 3, 2,
  68. 1, 0
  69. },
  70. {
  71. 255, 253, 249, 239, 220, 191, 156, 119,
  72. 85, 57, 37, 23, 15, 10, 6, 4,
  73. 2, 0
  74. },
  75. {
  76. 255, 253, 251, 246, 237, 223, 203, 179,
  77. 152, 124, 98, 75, 55, 40, 29, 21,
  78. 15, 0
  79. },
  80. {
  81. 255, 254, 253, 247, 220, 162, 106, 67,
  82. 42, 28, 18, 12, 9, 6, 4, 3,
  83. 2, 0
  84. }
  85. };
  86. const opus_uint8 silk_pulses_per_block_BITS_Q5[ 9 ][ 18 ] = {
  87. {
  88. 31, 57, 107, 160, 205, 205, 255, 255,
  89. 255, 255, 255, 255, 255, 255, 255, 255,
  90. 255, 255
  91. },
  92. {
  93. 69, 47, 67, 111, 166, 205, 255, 255,
  94. 255, 255, 255, 255, 255, 255, 255, 255,
  95. 255, 255
  96. },
  97. {
  98. 82, 74, 79, 95, 109, 128, 145, 160,
  99. 173, 205, 205, 205, 224, 255, 255, 224,
  100. 255, 224
  101. },
  102. {
  103. 125, 74, 59, 69, 97, 141, 182, 255,
  104. 255, 255, 255, 255, 255, 255, 255, 255,
  105. 255, 255
  106. },
  107. {
  108. 173, 115, 85, 73, 76, 92, 115, 145,
  109. 173, 205, 224, 224, 255, 255, 255, 255,
  110. 255, 255
  111. },
  112. {
  113. 166, 134, 113, 102, 101, 102, 107, 118,
  114. 125, 138, 145, 155, 166, 182, 192, 192,
  115. 205, 150
  116. },
  117. {
  118. 224, 182, 134, 101, 83, 79, 85, 97,
  119. 120, 145, 173, 205, 224, 255, 255, 255,
  120. 255, 255
  121. },
  122. {
  123. 255, 224, 192, 150, 120, 101, 92, 89,
  124. 93, 102, 118, 134, 160, 182, 192, 224,
  125. 224, 224
  126. },
  127. {
  128. 255, 224, 224, 182, 155, 134, 118, 109,
  129. 104, 102, 106, 111, 118, 131, 145, 160,
  130. 173, 131
  131. }
  132. };
  133. const opus_uint8 silk_rate_levels_iCDF[ 2 ][ 9 ] =
  134. {
  135. {
  136. 241, 190, 178, 132, 87, 74, 41, 14,
  137. 0
  138. },
  139. {
  140. 223, 193, 157, 140, 106, 57, 39, 18,
  141. 0
  142. }
  143. };
  144. const opus_uint8 silk_rate_levels_BITS_Q5[ 2 ][ 9 ] =
  145. {
  146. {
  147. 131, 74, 141, 79, 80, 138, 95, 104,
  148. 134
  149. },
  150. {
  151. 95, 99, 91, 125, 93, 76, 123, 115,
  152. 123
  153. }
  154. };
  155. const opus_uint8 silk_shell_code_table0[ 152 ] = {
  156. 128, 0, 214, 42, 0, 235, 128, 21,
  157. 0, 244, 184, 72, 11, 0, 248, 214,
  158. 128, 42, 7, 0, 248, 225, 170, 80,
  159. 25, 5, 0, 251, 236, 198, 126, 54,
  160. 18, 3, 0, 250, 238, 211, 159, 82,
  161. 35, 15, 5, 0, 250, 231, 203, 168,
  162. 128, 88, 53, 25, 6, 0, 252, 238,
  163. 216, 185, 148, 108, 71, 40, 18, 4,
  164. 0, 253, 243, 225, 199, 166, 128, 90,
  165. 57, 31, 13, 3, 0, 254, 246, 233,
  166. 212, 183, 147, 109, 73, 44, 23, 10,
  167. 2, 0, 255, 250, 240, 223, 198, 166,
  168. 128, 90, 58, 33, 16, 6, 1, 0,
  169. 255, 251, 244, 231, 210, 181, 146, 110,
  170. 75, 46, 25, 12, 5, 1, 0, 255,
  171. 253, 248, 238, 221, 196, 164, 128, 92,
  172. 60, 35, 18, 8, 3, 1, 0, 255,
  173. 253, 249, 242, 229, 208, 180, 146, 110,
  174. 76, 48, 27, 14, 7, 3, 1, 0
  175. };
  176. const opus_uint8 silk_shell_code_table1[ 152 ] = {
  177. 129, 0, 207, 50, 0, 236, 129, 20,
  178. 0, 245, 185, 72, 10, 0, 249, 213,
  179. 129, 42, 6, 0, 250, 226, 169, 87,
  180. 27, 4, 0, 251, 233, 194, 130, 62,
  181. 20, 4, 0, 250, 236, 207, 160, 99,
  182. 47, 17, 3, 0, 255, 240, 217, 182,
  183. 131, 81, 41, 11, 1, 0, 255, 254,
  184. 233, 201, 159, 107, 61, 20, 2, 1,
  185. 0, 255, 249, 233, 206, 170, 128, 86,
  186. 50, 23, 7, 1, 0, 255, 250, 238,
  187. 217, 186, 148, 108, 70, 39, 18, 6,
  188. 1, 0, 255, 252, 243, 226, 200, 166,
  189. 128, 90, 56, 30, 13, 4, 1, 0,
  190. 255, 252, 245, 231, 209, 180, 146, 110,
  191. 76, 47, 25, 11, 4, 1, 0, 255,
  192. 253, 248, 237, 219, 194, 163, 128, 93,
  193. 62, 37, 19, 8, 3, 1, 0, 255,
  194. 254, 250, 241, 226, 205, 177, 145, 111,
  195. 79, 51, 30, 15, 6, 2, 1, 0
  196. };
  197. const opus_uint8 silk_shell_code_table2[ 152 ] = {
  198. 129, 0, 203, 54, 0, 234, 129, 23,
  199. 0, 245, 184, 73, 10, 0, 250, 215,
  200. 129, 41, 5, 0, 252, 232, 173, 86,
  201. 24, 3, 0, 253, 240, 200, 129, 56,
  202. 15, 2, 0, 253, 244, 217, 164, 94,
  203. 38, 10, 1, 0, 253, 245, 226, 189,
  204. 132, 71, 27, 7, 1, 0, 253, 246,
  205. 231, 203, 159, 105, 56, 23, 6, 1,
  206. 0, 255, 248, 235, 213, 179, 133, 85,
  207. 47, 19, 5, 1, 0, 255, 254, 243,
  208. 221, 194, 159, 117, 70, 37, 12, 2,
  209. 1, 0, 255, 254, 248, 234, 208, 171,
  210. 128, 85, 48, 22, 8, 2, 1, 0,
  211. 255, 254, 250, 240, 220, 189, 149, 107,
  212. 67, 36, 16, 6, 2, 1, 0, 255,
  213. 254, 251, 243, 227, 201, 166, 128, 90,
  214. 55, 29, 13, 5, 2, 1, 0, 255,
  215. 254, 252, 246, 234, 213, 183, 147, 109,
  216. 73, 43, 22, 10, 4, 2, 1, 0
  217. };
  218. const opus_uint8 silk_shell_code_table3[ 152 ] = {
  219. 130, 0, 200, 58, 0, 231, 130, 26,
  220. 0, 244, 184, 76, 12, 0, 249, 214,
  221. 130, 43, 6, 0, 252, 232, 173, 87,
  222. 24, 3, 0, 253, 241, 203, 131, 56,
  223. 14, 2, 0, 254, 246, 221, 167, 94,
  224. 35, 8, 1, 0, 254, 249, 232, 193,
  225. 130, 65, 23, 5, 1, 0, 255, 251,
  226. 239, 211, 162, 99, 45, 15, 4, 1,
  227. 0, 255, 251, 243, 223, 186, 131, 74,
  228. 33, 11, 3, 1, 0, 255, 252, 245,
  229. 230, 202, 158, 105, 57, 24, 8, 2,
  230. 1, 0, 255, 253, 247, 235, 214, 179,
  231. 132, 84, 44, 19, 7, 2, 1, 0,
  232. 255, 254, 250, 240, 223, 196, 159, 112,
  233. 69, 36, 15, 6, 2, 1, 0, 255,
  234. 254, 253, 245, 231, 209, 176, 136, 93,
  235. 55, 27, 11, 3, 2, 1, 0, 255,
  236. 254, 253, 252, 239, 221, 194, 158, 117,
  237. 76, 42, 18, 4, 3, 2, 1, 0
  238. };
  239. const opus_uint8 silk_shell_code_table_offsets[ 17 ] = {
  240. 0, 0, 2, 5, 9, 14, 20, 27,
  241. 35, 44, 54, 65, 77, 90, 104, 119,
  242. 135
  243. };
  244. const opus_uint8 silk_sign_iCDF[ 42 ] = {
  245. 254, 49, 67, 77, 82, 93, 99,
  246. 198, 11, 18, 24, 31, 36, 45,
  247. 255, 46, 66, 78, 87, 94, 104,
  248. 208, 14, 21, 32, 42, 51, 66,
  249. 255, 94, 104, 109, 112, 115, 118,
  250. 248, 53, 69, 80, 88, 95, 102
  251. };