context.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. /*
  2. * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "entropy.h"
  11. /* *** GENERATED FILE: DO NOT EDIT *** */
  12. #if 0
  13. int Contexts[vp8_coef_counter_dimen];
  14. const int default_contexts[vp8_coef_counter_dimen] =
  15. {
  16. {
  17. // Block Type ( 0 )
  18. {
  19. // Coeff Band ( 0 )
  20. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  21. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  22. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  23. },
  24. {
  25. // Coeff Band ( 1 )
  26. {30190, 26544, 225, 24, 4, 0, 0, 0, 0, 0, 0, 4171593,},
  27. {26846, 25157, 1241, 130, 26, 6, 1, 0, 0, 0, 0, 149987,},
  28. {10484, 9538, 1006, 160, 36, 18, 0, 0, 0, 0, 0, 15104,},
  29. },
  30. {
  31. // Coeff Band ( 2 )
  32. {25842, 40456, 1126, 83, 11, 2, 0, 0, 0, 0, 0, 0,},
  33. {9338, 8010, 512, 73, 7, 3, 2, 0, 0, 0, 0, 43294,},
  34. {1047, 751, 149, 31, 13, 6, 1, 0, 0, 0, 0, 879,},
  35. },
  36. {
  37. // Coeff Band ( 3 )
  38. {26136, 9826, 252, 13, 0, 0, 0, 0, 0, 0, 0, 0,},
  39. {8134, 5574, 191, 14, 2, 0, 0, 0, 0, 0, 0, 35302,},
  40. { 605, 677, 116, 9, 1, 0, 0, 0, 0, 0, 0, 611,},
  41. },
  42. {
  43. // Coeff Band ( 4 )
  44. {10263, 15463, 283, 17, 0, 0, 0, 0, 0, 0, 0, 0,},
  45. {2773, 2191, 128, 9, 2, 2, 0, 0, 0, 0, 0, 10073,},
  46. { 134, 125, 32, 4, 0, 2, 0, 0, 0, 0, 0, 50,},
  47. },
  48. {
  49. // Coeff Band ( 5 )
  50. {10483, 2663, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0,},
  51. {2137, 1251, 27, 1, 1, 0, 0, 0, 0, 0, 0, 14362,},
  52. { 116, 156, 14, 2, 1, 0, 0, 0, 0, 0, 0, 190,},
  53. },
  54. {
  55. // Coeff Band ( 6 )
  56. {40977, 27614, 412, 28, 0, 0, 0, 0, 0, 0, 0, 0,},
  57. {6113, 5213, 261, 22, 3, 0, 0, 0, 0, 0, 0, 26164,},
  58. { 382, 312, 50, 14, 2, 0, 0, 0, 0, 0, 0, 345,},
  59. },
  60. {
  61. // Coeff Band ( 7 )
  62. { 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  63. { 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,},
  64. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,},
  65. },
  66. },
  67. {
  68. // Block Type ( 1 )
  69. {
  70. // Coeff Band ( 0 )
  71. {3268, 19382, 1043, 250, 93, 82, 49, 26, 17, 8, 25, 82289,},
  72. {8758, 32110, 5436, 1832, 827, 668, 420, 153, 24, 0, 3, 52914,},
  73. {9337, 23725, 8487, 3954, 2107, 1836, 1069, 399, 59, 0, 0, 18620,},
  74. },
  75. {
  76. // Coeff Band ( 1 )
  77. {12419, 8420, 452, 62, 9, 1, 0, 0, 0, 0, 0, 0,},
  78. {11715, 8705, 693, 92, 15, 7, 2, 0, 0, 0, 0, 53988,},
  79. {7603, 8585, 2306, 778, 270, 145, 39, 5, 0, 0, 0, 9136,},
  80. },
  81. {
  82. // Coeff Band ( 2 )
  83. {15938, 14335, 1207, 184, 55, 13, 4, 1, 0, 0, 0, 0,},
  84. {7415, 6829, 1138, 244, 71, 26, 7, 0, 0, 0, 0, 9980,},
  85. {1580, 1824, 655, 241, 89, 46, 10, 2, 0, 0, 0, 429,},
  86. },
  87. {
  88. // Coeff Band ( 3 )
  89. {19453, 5260, 201, 19, 0, 0, 0, 0, 0, 0, 0, 0,},
  90. {9173, 3758, 213, 22, 1, 1, 0, 0, 0, 0, 0, 9820,},
  91. {1689, 1277, 276, 51, 17, 4, 0, 0, 0, 0, 0, 679,},
  92. },
  93. {
  94. // Coeff Band ( 4 )
  95. {12076, 10667, 620, 85, 19, 9, 5, 0, 0, 0, 0, 0,},
  96. {4665, 3625, 423, 55, 19, 9, 0, 0, 0, 0, 0, 5127,},
  97. { 415, 440, 143, 34, 20, 7, 2, 0, 0, 0, 0, 101,},
  98. },
  99. {
  100. // Coeff Band ( 5 )
  101. {12183, 4846, 115, 11, 1, 0, 0, 0, 0, 0, 0, 0,},
  102. {4226, 3149, 177, 21, 2, 0, 0, 0, 0, 0, 0, 7157,},
  103. { 375, 621, 189, 51, 11, 4, 1, 0, 0, 0, 0, 198,},
  104. },
  105. {
  106. // Coeff Band ( 6 )
  107. {61658, 37743, 1203, 94, 10, 3, 0, 0, 0, 0, 0, 0,},
  108. {15514, 11563, 903, 111, 14, 5, 0, 0, 0, 0, 0, 25195,},
  109. { 929, 1077, 291, 78, 14, 7, 1, 0, 0, 0, 0, 507,},
  110. },
  111. {
  112. // Coeff Band ( 7 )
  113. { 0, 990, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0,},
  114. { 0, 412, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1641,},
  115. { 0, 18, 7, 1, 0, 0, 0, 0, 0, 0, 0, 30,},
  116. },
  117. },
  118. {
  119. // Block Type ( 2 )
  120. {
  121. // Coeff Band ( 0 )
  122. { 953, 24519, 628, 120, 28, 12, 4, 0, 0, 0, 0, 2248798,},
  123. {1525, 25654, 2647, 617, 239, 143, 42, 5, 0, 0, 0, 66837,},
  124. {1180, 11011, 3001, 1237, 532, 448, 239, 54, 5, 0, 0, 7122,},
  125. },
  126. {
  127. // Coeff Band ( 1 )
  128. {1356, 2220, 67, 10, 4, 1, 0, 0, 0, 0, 0, 0,},
  129. {1450, 2544, 102, 18, 4, 3, 0, 0, 0, 0, 0, 57063,},
  130. {1182, 2110, 470, 130, 41, 21, 0, 0, 0, 0, 0, 6047,},
  131. },
  132. {
  133. // Coeff Band ( 2 )
  134. { 370, 3378, 200, 30, 5, 4, 1, 0, 0, 0, 0, 0,},
  135. { 293, 1006, 131, 29, 11, 0, 0, 0, 0, 0, 0, 5404,},
  136. { 114, 387, 98, 23, 4, 8, 1, 0, 0, 0, 0, 236,},
  137. },
  138. {
  139. // Coeff Band ( 3 )
  140. { 579, 194, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  141. { 395, 213, 5, 1, 0, 0, 0, 0, 0, 0, 0, 4157,},
  142. { 119, 122, 4, 0, 0, 0, 0, 0, 0, 0, 0, 300,},
  143. },
  144. {
  145. // Coeff Band ( 4 )
  146. { 38, 557, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  147. { 21, 114, 12, 1, 0, 0, 0, 0, 0, 0, 0, 427,},
  148. { 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,},
  149. },
  150. {
  151. // Coeff Band ( 5 )
  152. { 52, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  153. { 18, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652,},
  154. { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,},
  155. },
  156. {
  157. // Coeff Band ( 6 )
  158. { 640, 569, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  159. { 25, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 517,},
  160. { 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,},
  161. },
  162. {
  163. // Coeff Band ( 7 )
  164. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  165. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  166. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  167. },
  168. },
  169. {
  170. // Block Type ( 3 )
  171. {
  172. // Coeff Band ( 0 )
  173. {2506, 20161, 2707, 767, 261, 178, 107, 30, 14, 3, 0, 100694,},
  174. {8806, 36478, 8817, 3268, 1280, 850, 401, 114, 42, 0, 0, 58572,},
  175. {11003, 27214, 11798, 5716, 2482, 2072, 1048, 175, 32, 0, 0, 19284,},
  176. },
  177. {
  178. // Coeff Band ( 1 )
  179. {9738, 11313, 959, 205, 70, 18, 11, 1, 0, 0, 0, 0,},
  180. {12628, 15085, 1507, 273, 52, 19, 9, 0, 0, 0, 0, 54280,},
  181. {10701, 15846, 5561, 1926, 813, 570, 249, 36, 0, 0, 0, 6460,},
  182. },
  183. {
  184. // Coeff Band ( 2 )
  185. {6781, 22539, 2784, 634, 182, 123, 20, 4, 0, 0, 0, 0,},
  186. {6263, 11544, 2649, 790, 259, 168, 27, 5, 0, 0, 0, 20539,},
  187. {3109, 4075, 2031, 896, 457, 386, 158, 29, 0, 0, 0, 1138,},
  188. },
  189. {
  190. // Coeff Band ( 3 )
  191. {11515, 4079, 465, 73, 5, 14, 2, 0, 0, 0, 0, 0,},
  192. {9361, 5834, 650, 96, 24, 8, 4, 0, 0, 0, 0, 22181,},
  193. {4343, 3974, 1360, 415, 132, 96, 14, 1, 0, 0, 0, 1267,},
  194. },
  195. {
  196. // Coeff Band ( 4 )
  197. {4787, 9297, 823, 168, 44, 12, 4, 0, 0, 0, 0, 0,},
  198. {3619, 4472, 719, 198, 60, 31, 3, 0, 0, 0, 0, 8401,},
  199. {1157, 1175, 483, 182, 88, 31, 8, 0, 0, 0, 0, 268,},
  200. },
  201. {
  202. // Coeff Band ( 5 )
  203. {8299, 1226, 32, 5, 1, 0, 0, 0, 0, 0, 0, 0,},
  204. {3502, 1568, 57, 4, 1, 1, 0, 0, 0, 0, 0, 9811,},
  205. {1055, 1070, 166, 29, 6, 1, 0, 0, 0, 0, 0, 527,},
  206. },
  207. {
  208. // Coeff Band ( 6 )
  209. {27414, 27927, 1989, 347, 69, 26, 0, 0, 0, 0, 0, 0,},
  210. {5876, 10074, 1574, 341, 91, 24, 4, 0, 0, 0, 0, 21954,},
  211. {1571, 2171, 778, 324, 124, 65, 16, 0, 0, 0, 0, 979,},
  212. },
  213. {
  214. // Coeff Band ( 7 )
  215. { 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
  216. { 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459,},
  217. { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13,},
  218. },
  219. },
  220. };
  221. //Update probabilities for the nodes in the token entropy tree.
  222. const vp8_prob tree_update_probs[vp8_coef_tree_dimen] =
  223. {
  224. {
  225. {
  226. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  227. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  228. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  229. },
  230. {
  231. {176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  232. {223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
  233. {249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  234. },
  235. {
  236. {255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
  237. {234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  238. {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  239. },
  240. {
  241. {255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  242. {239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  243. {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  244. },
  245. {
  246. {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  247. {251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  248. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  249. },
  250. {
  251. {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  252. {251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  253. {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  254. },
  255. {
  256. {255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255, },
  257. {250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255, },
  258. {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  259. },
  260. {
  261. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  262. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  263. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  264. },
  265. },
  266. {
  267. {
  268. {217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  269. {225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255, },
  270. {234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255, },
  271. },
  272. {
  273. {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  274. {223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  275. {238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
  276. },
  277. {
  278. {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  279. {249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  280. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  281. },
  282. {
  283. {255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  284. {247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  285. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  286. },
  287. {
  288. {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  289. {252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  290. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  291. },
  292. {
  293. {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  294. {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  295. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  296. },
  297. {
  298. {255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  299. {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  300. {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  301. },
  302. {
  303. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  304. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  305. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  306. },
  307. },
  308. {
  309. {
  310. {186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255, },
  311. {234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255, },
  312. {251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255, },
  313. },
  314. {
  315. {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  316. {236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  317. {251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, },
  318. },
  319. {
  320. {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  321. {254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  322. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  323. },
  324. {
  325. {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  326. {254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  327. {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  328. },
  329. {
  330. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  331. {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  332. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  333. },
  334. {
  335. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  336. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  337. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  338. },
  339. {
  340. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  341. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  342. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  343. },
  344. {
  345. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  346. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  347. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  348. },
  349. },
  350. {
  351. {
  352. {248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  353. {250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255, },
  354. {248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255, },
  355. },
  356. {
  357. {255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  358. {246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  359. {252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255, },
  360. },
  361. {
  362. {255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
  363. {248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  364. {253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
  365. },
  366. {
  367. {255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  368. {245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  369. {253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  370. },
  371. {
  372. {255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  373. {252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  374. {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  375. },
  376. {
  377. {255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  378. {249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  379. {255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
  380. },
  381. {
  382. {255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
  383. {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  384. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  385. },
  386. {
  387. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  388. {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  389. {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
  390. },
  391. },
  392. };
  393. #endif