tables_LTP.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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_LTP_per_index_iCDF[3] = {
  32. 179, 99, 0
  33. };
  34. static const opus_uint8 silk_LTP_gain_iCDF_0[8] = {
  35. 71, 56, 43, 30, 21, 12, 6, 0
  36. };
  37. static const opus_uint8 silk_LTP_gain_iCDF_1[16] = {
  38. 199, 165, 144, 124, 109, 96, 84, 71,
  39. 61, 51, 42, 32, 23, 15, 8, 0
  40. };
  41. static const opus_uint8 silk_LTP_gain_iCDF_2[32] = {
  42. 241, 225, 211, 199, 187, 175, 164, 153,
  43. 142, 132, 123, 114, 105, 96, 88, 80,
  44. 72, 64, 57, 50, 44, 38, 33, 29,
  45. 24, 20, 16, 12, 9, 5, 2, 0
  46. };
  47. static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = {
  48. 15, 131, 138, 138, 155, 155, 173, 173
  49. };
  50. static const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = {
  51. 69, 93, 115, 118, 131, 138, 141, 138,
  52. 150, 150, 155, 150, 155, 160, 166, 160
  53. };
  54. static const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = {
  55. 131, 128, 134, 141, 141, 141, 145, 145,
  56. 145, 150, 155, 155, 155, 155, 160, 160,
  57. 160, 160, 166, 166, 173, 173, 182, 192,
  58. 182, 192, 192, 192, 205, 192, 205, 224
  59. };
  60. const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = {
  61. silk_LTP_gain_iCDF_0,
  62. silk_LTP_gain_iCDF_1,
  63. silk_LTP_gain_iCDF_2
  64. };
  65. const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = {
  66. silk_LTP_gain_BITS_Q5_0,
  67. silk_LTP_gain_BITS_Q5_1,
  68. silk_LTP_gain_BITS_Q5_2
  69. };
  70. static const opus_int8 silk_LTP_gain_vq_0[8][5] =
  71. {
  72. {
  73. 4, 6, 24, 7, 5
  74. },
  75. {
  76. 0, 0, 2, 0, 0
  77. },
  78. {
  79. 12, 28, 41, 13, -4
  80. },
  81. {
  82. -9, 15, 42, 25, 14
  83. },
  84. {
  85. 1, -2, 62, 41, -9
  86. },
  87. {
  88. -10, 37, 65, -4, 3
  89. },
  90. {
  91. -6, 4, 66, 7, -8
  92. },
  93. {
  94. 16, 14, 38, -3, 33
  95. }
  96. };
  97. static const opus_int8 silk_LTP_gain_vq_1[16][5] =
  98. {
  99. {
  100. 13, 22, 39, 23, 12
  101. },
  102. {
  103. -1, 36, 64, 27, -6
  104. },
  105. {
  106. -7, 10, 55, 43, 17
  107. },
  108. {
  109. 1, 1, 8, 1, 1
  110. },
  111. {
  112. 6, -11, 74, 53, -9
  113. },
  114. {
  115. -12, 55, 76, -12, 8
  116. },
  117. {
  118. -3, 3, 93, 27, -4
  119. },
  120. {
  121. 26, 39, 59, 3, -8
  122. },
  123. {
  124. 2, 0, 77, 11, 9
  125. },
  126. {
  127. -8, 22, 44, -6, 7
  128. },
  129. {
  130. 40, 9, 26, 3, 9
  131. },
  132. {
  133. -7, 20, 101, -7, 4
  134. },
  135. {
  136. 3, -8, 42, 26, 0
  137. },
  138. {
  139. -15, 33, 68, 2, 23
  140. },
  141. {
  142. -2, 55, 46, -2, 15
  143. },
  144. {
  145. 3, -1, 21, 16, 41
  146. }
  147. };
  148. static const opus_int8 silk_LTP_gain_vq_2[32][5] =
  149. {
  150. {
  151. -6, 27, 61, 39, 5
  152. },
  153. {
  154. -11, 42, 88, 4, 1
  155. },
  156. {
  157. -2, 60, 65, 6, -4
  158. },
  159. {
  160. -1, -5, 73, 56, 1
  161. },
  162. {
  163. -9, 19, 94, 29, -9
  164. },
  165. {
  166. 0, 12, 99, 6, 4
  167. },
  168. {
  169. 8, -19, 102, 46, -13
  170. },
  171. {
  172. 3, 2, 13, 3, 2
  173. },
  174. {
  175. 9, -21, 84, 72, -18
  176. },
  177. {
  178. -11, 46, 104, -22, 8
  179. },
  180. {
  181. 18, 38, 48, 23, 0
  182. },
  183. {
  184. -16, 70, 83, -21, 11
  185. },
  186. {
  187. 5, -11, 117, 22, -8
  188. },
  189. {
  190. -6, 23, 117, -12, 3
  191. },
  192. {
  193. 3, -8, 95, 28, 4
  194. },
  195. {
  196. -10, 15, 77, 60, -15
  197. },
  198. {
  199. -1, 4, 124, 2, -4
  200. },
  201. {
  202. 3, 38, 84, 24, -25
  203. },
  204. {
  205. 2, 13, 42, 13, 31
  206. },
  207. {
  208. 21, -4, 56, 46, -1
  209. },
  210. {
  211. -1, 35, 79, -13, 19
  212. },
  213. {
  214. -7, 65, 88, -9, -14
  215. },
  216. {
  217. 20, 4, 81, 49, -29
  218. },
  219. {
  220. 20, 0, 75, 3, -17
  221. },
  222. {
  223. 5, -9, 44, 92, -8
  224. },
  225. {
  226. 1, -3, 22, 69, 31
  227. },
  228. {
  229. -6, 95, 41, -12, 5
  230. },
  231. {
  232. 39, 67, 16, -4, 1
  233. },
  234. {
  235. 0, -6, 120, 55, -36
  236. },
  237. {
  238. -13, 44, 122, 4, -24
  239. },
  240. {
  241. 81, 5, 11, 3, 7
  242. },
  243. {
  244. 2, 0, 9, 10, 88
  245. }
  246. };
  247. const opus_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = {
  248. (opus_int8 *)&silk_LTP_gain_vq_0[0][0],
  249. (opus_int8 *)&silk_LTP_gain_vq_1[0][0],
  250. (opus_int8 *)&silk_LTP_gain_vq_2[0][0]
  251. };
  252. /* Maximum frequency-dependent response of the pitch taps above,
  253. computed as max(abs(freqz(taps))) */
  254. static const opus_uint8 silk_LTP_gain_vq_0_gain[8] = {
  255. 46, 2, 90, 87, 93, 91, 82, 98
  256. };
  257. static const opus_uint8 silk_LTP_gain_vq_1_gain[16] = {
  258. 109, 120, 118, 12, 113, 115, 117, 119,
  259. 99, 59, 87, 111, 63, 111, 112, 80
  260. };
  261. static const opus_uint8 silk_LTP_gain_vq_2_gain[32] = {
  262. 126, 124, 125, 124, 129, 121, 126, 23,
  263. 132, 127, 127, 127, 126, 127, 122, 133,
  264. 130, 134, 101, 118, 119, 145, 126, 86,
  265. 124, 120, 123, 119, 170, 173, 107, 109
  266. };
  267. const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS] = {
  268. &silk_LTP_gain_vq_0_gain[0],
  269. &silk_LTP_gain_vq_1_gain[0],
  270. &silk_LTP_gain_vq_2_gain[0]
  271. };
  272. const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = {
  273. 8, 16, 32
  274. };