vp8data.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. /*
  2. * Copyright (C) 2010 David Conrad
  3. * Copyright (C) 2010 Ronald S. Bultje
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * VP8 compatible video decoder
  24. */
  25. #ifndef AVCODEC_VP8DATA_H
  26. #define AVCODEC_VP8DATA_H
  27. #include "vp8.h"
  28. #include "h264pred.h"
  29. static const uint8_t vp7_pred4x4_mode[] = {
  30. [DC_PRED8x8] = DC_PRED,
  31. [VERT_PRED8x8] = TM_VP8_PRED,
  32. [HOR_PRED8x8] = TM_VP8_PRED,
  33. [PLANE_PRED8x8] = TM_VP8_PRED,
  34. };
  35. static const uint8_t vp8_pred4x4_mode[] = {
  36. [DC_PRED8x8] = DC_PRED,
  37. [VERT_PRED8x8] = VERT_PRED,
  38. [HOR_PRED8x8] = HOR_PRED,
  39. [PLANE_PRED8x8] = TM_VP8_PRED,
  40. };
  41. static const int8_t vp8_pred16x16_tree_intra[4][2] = {
  42. { -MODE_I4x4, 1 }, // '0'
  43. { 2, 3 },
  44. { -DC_PRED8x8, -VERT_PRED8x8 }, // '100', '101'
  45. { -HOR_PRED8x8, -PLANE_PRED8x8 }, // '110', '111'
  46. };
  47. static const int8_t vp8_pred16x16_tree_inter[4][2] = {
  48. { -DC_PRED8x8, 1 }, // '0'
  49. { 2, 3 },
  50. { -VERT_PRED8x8, -HOR_PRED8x8 }, // '100', '101'
  51. { -PLANE_PRED8x8, -MODE_I4x4 }, // '110', '111'
  52. };
  53. typedef struct VP7MVPred {
  54. int8_t yoffset;
  55. int8_t xoffset;
  56. uint8_t subblock;
  57. uint8_t score;
  58. } VP7MVPred;
  59. #define VP7_MV_PRED_COUNT 12
  60. static const VP7MVPred vp7_mv_pred[VP7_MV_PRED_COUNT] = {
  61. { -1, 0, 12, 8 },
  62. { 0, -1, 3, 8 },
  63. { -1, -1, 15, 2 },
  64. { -1, 1, 12, 2 },
  65. { -2, 0, 12, 2 },
  66. { 0, -2, 3, 2 },
  67. { -1, -2, 15, 1 },
  68. { -2, -1, 15, 1 },
  69. { -2, 1, 12, 1 },
  70. { -1, 2, 12, 1 },
  71. { -2, -2, 15, 1 },
  72. { -2, 2, 12, 1 },
  73. };
  74. static const int vp7_mode_contexts[31][4] = {
  75. { 3, 3, 1, 246 },
  76. { 7, 89, 66, 239 },
  77. { 10, 90, 78, 238 },
  78. { 14, 118, 95, 241 },
  79. { 14, 123, 106, 238 },
  80. { 20, 140, 109, 240 },
  81. { 13, 155, 103, 238 },
  82. { 21, 158, 99, 240 },
  83. { 27, 82, 108, 232 },
  84. { 19, 99, 123, 217 },
  85. { 45, 139, 148, 236 },
  86. { 50, 117, 144, 235 },
  87. { 57, 128, 164, 238 },
  88. { 69, 139, 171, 239 },
  89. { 74, 154, 179, 238 },
  90. { 112, 165, 186, 242 },
  91. { 98, 143, 185, 245 },
  92. { 105, 153, 190, 250 },
  93. { 124, 167, 192, 245 },
  94. { 131, 186, 203, 246 },
  95. { 59, 184, 222, 224 },
  96. { 148, 215, 214, 213 },
  97. { 137, 211, 210, 219 },
  98. { 190, 227, 128, 228 },
  99. { 183, 228, 128, 228 },
  100. { 194, 234, 128, 228 },
  101. { 202, 236, 128, 228 },
  102. { 205, 240, 128, 228 },
  103. { 205, 244, 128, 228 },
  104. { 225, 246, 128, 228 },
  105. { 233, 251, 128, 228 },
  106. };
  107. static const int vp8_mode_contexts[6][4] = {
  108. { 7, 1, 1, 143 },
  109. { 14, 18, 14, 107 },
  110. { 135, 64, 57, 68 },
  111. { 60, 56, 128, 65 },
  112. { 159, 134, 128, 34 },
  113. { 234, 188, 128, 28 },
  114. };
  115. static const uint8_t vp8_mbsplits[5][16] = {
  116. { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
  117. { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 },
  118. { 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 },
  119. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
  120. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
  121. };
  122. static const uint8_t vp8_mbfirstidx[4][16] = {
  123. { 0, 8 },
  124. { 0, 2 },
  125. { 0, 2, 8, 10 },
  126. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
  127. };
  128. static const uint8_t vp8_mbsplit_count[4] = {
  129. 2, 2, 4, 16
  130. };
  131. static const uint8_t vp8_mbsplit_prob[3] = {
  132. 110, 111, 150
  133. };
  134. static const uint8_t vp7_submv_prob[3] = {
  135. 180, 162, 25
  136. };
  137. static const uint8_t vp8_submv_prob[5][3] = {
  138. { 147, 136, 18 },
  139. { 106, 145, 1 },
  140. { 179, 121, 1 },
  141. { 223, 1, 34 },
  142. { 208, 1, 1 }
  143. };
  144. static const uint8_t vp8_pred16x16_prob_intra[4] = {
  145. 145, 156, 163, 128
  146. };
  147. static const uint8_t vp8_pred16x16_prob_inter[4] = {
  148. 112, 86, 140, 37
  149. };
  150. static const int8_t vp8_pred4x4_tree[9][2] = {
  151. { -DC_PRED, 1 }, // '0'
  152. { -TM_VP8_PRED, 2 }, // '10'
  153. { -VERT_PRED, 3 }, // '110'
  154. { 4, 6 },
  155. { -HOR_PRED, 5 }, // '11100'
  156. { -DIAG_DOWN_RIGHT_PRED, -VERT_RIGHT_PRED }, // '111010', '111011'
  157. { -DIAG_DOWN_LEFT_PRED, 7 }, // '11110'
  158. { -VERT_LEFT_PRED, 8 }, // '111110'
  159. { -HOR_DOWN_PRED, -HOR_UP_PRED }, // '1111110', '1111111'
  160. };
  161. static const int8_t vp8_pred8x8c_tree[3][2] = {
  162. { -DC_PRED8x8, 1 }, // '0'
  163. { -VERT_PRED8x8, 2 }, // '10
  164. { -HOR_PRED8x8, -PLANE_PRED8x8 }, // '110', '111'
  165. };
  166. static const uint8_t vp8_pred8x8c_prob_intra[3] = {
  167. 142, 114, 183
  168. };
  169. static const uint8_t vp8_pred8x8c_prob_inter[3] = {
  170. 162, 101, 204
  171. };
  172. static const uint8_t vp8_pred4x4_prob_inter[9] = {
  173. 120, 90, 79, 133, 87, 85, 80, 111, 151
  174. };
  175. static const uint8_t vp8_pred4x4_prob_intra[10][10][9] = {
  176. {
  177. { 39, 53, 200, 87, 26, 21, 43, 232, 171 },
  178. { 56, 34, 51, 104, 114, 102, 29, 93, 77 },
  179. { 88, 88, 147, 150, 42, 46, 45, 196, 205 },
  180. { 107, 54, 32, 26, 51, 1, 81, 43, 31 },
  181. { 39, 28, 85, 171, 58, 165, 90, 98, 64 },
  182. { 34, 22, 116, 206, 23, 34, 43, 166, 73 },
  183. { 34, 19, 21, 102, 132, 188, 16, 76, 124 },
  184. { 68, 25, 106, 22, 64, 171, 36, 225, 114 },
  185. { 62, 18, 78, 95, 85, 57, 50, 48, 51 },
  186. { 43, 97, 183, 117, 85, 38, 35, 179, 61 },
  187. },
  188. {
  189. { 112, 113, 77, 85, 179, 255, 38, 120, 114 },
  190. { 40, 42, 1, 196, 245, 209, 10, 25, 109 },
  191. { 193, 101, 35, 159, 215, 111, 89, 46, 111 },
  192. { 100, 80, 8, 43, 154, 1, 51, 26, 71 },
  193. { 88, 43, 29, 140, 166, 213, 37, 43, 154 },
  194. { 61, 63, 30, 155, 67, 45, 68, 1, 209 },
  195. { 41, 40, 5, 102, 211, 183, 4, 1, 221 },
  196. { 142, 78, 78, 16, 255, 128, 34, 197, 171 },
  197. { 51, 50, 17, 168, 209, 192, 23, 25, 82 },
  198. { 60, 148, 31, 172, 219, 228, 21, 18, 111 },
  199. },
  200. {
  201. { 175, 69, 143, 80, 85, 82, 72, 155, 103 },
  202. { 56, 58, 10, 171, 218, 189, 17, 13, 152 },
  203. { 231, 120, 48, 89, 115, 113, 120, 152, 112 },
  204. { 144, 71, 10, 38, 171, 213, 144, 34, 26 },
  205. { 114, 26, 17, 163, 44, 195, 21, 10, 173 },
  206. { 121, 24, 80, 195, 26, 62, 44, 64, 85 },
  207. { 63, 20, 8, 114, 114, 208, 12, 9, 226 },
  208. { 170, 46, 55, 19, 136, 160, 33, 206, 71 },
  209. { 81, 40, 11, 96, 182, 84, 29, 16, 36 },
  210. { 152, 179, 64, 126, 170, 118, 46, 70, 95 },
  211. },
  212. {
  213. { 75, 79, 123, 47, 51, 128, 81, 171, 1 },
  214. { 57, 17, 5, 71, 102, 57, 53, 41, 49 },
  215. { 125, 98, 42, 88, 104, 85, 117, 175, 82 },
  216. { 115, 21, 2, 10, 102, 255, 166, 23, 6 },
  217. { 38, 33, 13, 121, 57, 73, 26, 1, 85 },
  218. { 41, 10, 67, 138, 77, 110, 90, 47, 114 },
  219. { 57, 18, 10, 102, 102, 213, 34, 20, 43 },
  220. { 101, 29, 16, 10, 85, 128, 101, 196, 26 },
  221. { 117, 20, 15, 36, 163, 128, 68, 1, 26 },
  222. { 95, 84, 53, 89, 128, 100, 113, 101, 45 },
  223. },
  224. {
  225. { 63, 59, 90, 180, 59, 166, 93, 73, 154 },
  226. { 40, 40, 21, 116, 143, 209, 34, 39, 175 },
  227. { 138, 31, 36, 171, 27, 166, 38, 44, 229 },
  228. { 57, 46, 22, 24, 128, 1, 54, 17, 37 },
  229. { 47, 15, 16, 183, 34, 223, 49, 45, 183 },
  230. { 46, 17, 33, 183, 6, 98, 15, 32, 183 },
  231. { 40, 3, 9, 115, 51, 192, 18, 6, 223 },
  232. { 65, 32, 73, 115, 28, 128, 23, 128, 205 },
  233. { 87, 37, 9, 115, 59, 77, 64, 21, 47 },
  234. { 67, 87, 58, 169, 82, 115, 26, 59, 179 },
  235. },
  236. {
  237. { 54, 57, 112, 184, 5, 41, 38, 166, 213 },
  238. { 30, 34, 26, 133, 152, 116, 10, 32, 134 },
  239. { 104, 55, 44, 218, 9, 54, 53, 130, 226 },
  240. { 75, 32, 12, 51, 192, 255, 160, 43, 51 },
  241. { 39, 19, 53, 221, 26, 114, 32, 73, 255 },
  242. { 31, 9, 65, 234, 2, 15, 1, 118, 73 },
  243. { 56, 21, 23, 111, 59, 205, 45, 37, 192 },
  244. { 88, 31, 35, 67, 102, 85, 55, 186, 85 },
  245. { 55, 38, 70, 124, 73, 102, 1, 34, 98 },
  246. { 64, 90, 70, 205, 40, 41, 23, 26, 57 },
  247. },
  248. {
  249. { 86, 40, 64, 135, 148, 224, 45, 183, 128 },
  250. { 22, 26, 17, 131, 240, 154, 14, 1, 209 },
  251. { 164, 50, 31, 137, 154, 133, 25, 35, 218 },
  252. { 83, 12, 13, 54, 192, 255, 68, 47, 28 },
  253. { 45, 16, 21, 91, 64, 222, 7, 1, 197 },
  254. { 56, 21, 39, 155, 60, 138, 23, 102, 213 },
  255. { 18, 11, 7, 63, 144, 171, 4, 4, 246 },
  256. { 85, 26, 85, 85, 128, 128, 32, 146, 171 },
  257. { 35, 27, 10, 146, 174, 171, 12, 26, 128 },
  258. { 51, 103, 44, 131, 131, 123, 31, 6, 158 },
  259. },
  260. {
  261. { 68, 45, 128, 34, 1, 47, 11, 245, 171 },
  262. { 62, 17, 19, 70, 146, 85, 55, 62, 70 },
  263. { 102, 61, 71, 37, 34, 53, 31, 243, 192 },
  264. { 75, 15, 9, 9, 64, 255, 184, 119, 16 },
  265. { 37, 43, 37, 154, 100, 163, 85, 160, 1 },
  266. { 63, 9, 92, 136, 28, 64, 32, 201, 85 },
  267. { 56, 8, 17, 132, 137, 255, 55, 116, 128 },
  268. { 86, 6, 28, 5, 64, 255, 25, 248, 1 },
  269. { 58, 15, 20, 82, 135, 57, 26, 121, 40 },
  270. { 69, 60, 71, 38, 73, 119, 28, 222, 37 },
  271. },
  272. {
  273. { 101, 75, 128, 139, 118, 146, 116, 128, 85 },
  274. { 56, 41, 15, 176, 236, 85, 37, 9, 62 },
  275. { 190, 80, 35, 99, 180, 80, 126, 54, 45 },
  276. { 146, 36, 19, 30, 171, 255, 97, 27, 20 },
  277. { 71, 30, 17, 119, 118, 255, 17, 18, 138 },
  278. { 101, 38, 60, 138, 55, 70, 43, 26, 142 },
  279. { 32, 41, 20, 117, 151, 142, 20, 21, 163 },
  280. { 138, 45, 61, 62, 219, 1, 81, 188, 64 },
  281. { 112, 19, 12, 61, 195, 128, 48, 4, 24 },
  282. { 85, 126, 47, 87, 176, 51, 41, 20, 32 },
  283. },
  284. {
  285. { 66, 102, 167, 99, 74, 62, 40, 234, 128 },
  286. { 41, 53, 9, 178, 241, 141, 26, 8, 107 },
  287. { 134, 183, 89, 137, 98, 101, 106, 165, 148 },
  288. { 104, 79, 12, 27, 217, 255, 87, 17, 7 },
  289. { 74, 43, 26, 146, 73, 166, 49, 23, 157 },
  290. { 65, 38, 105, 160, 51, 52, 31, 115, 128 },
  291. { 47, 41, 14, 110, 182, 183, 21, 17, 194 },
  292. { 87, 68, 71, 44, 114, 51, 15, 186, 23 },
  293. { 66, 45, 25, 102, 197, 189, 23, 18, 22 },
  294. { 72, 187, 100, 130, 157, 111, 32, 75, 80 },
  295. },
  296. };
  297. static const int8_t vp8_segmentid_tree[][2] = {
  298. { 1, 2 },
  299. { -0, -1 }, // '00', '01'
  300. { -2, -3 }, // '10', '11'
  301. };
  302. static const uint8_t vp8_coeff_band[16] = {
  303. 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7
  304. };
  305. /* Inverse of vp8_coeff_band: mappings of bands to coefficient indexes.
  306. * Each list is -1-terminated. */
  307. static const int8_t vp8_coeff_band_indexes[8][10] = {
  308. { 0, -1 },
  309. { 1, -1 },
  310. { 2, -1 },
  311. { 3, -1 },
  312. { 5, -1 },
  313. { 6, -1 },
  314. { 4, 7, 8, 9, 10, 11, 12, 13, 14, -1 },
  315. { 15, -1 }
  316. };
  317. static const uint8_t vp8_dct_cat1_prob[] = {
  318. 159, 0
  319. };
  320. static const uint8_t vp8_dct_cat2_prob[] = {
  321. 165, 145, 0
  322. };
  323. static const uint8_t vp8_dct_cat3_prob[] = {
  324. 173, 148, 140, 0
  325. };
  326. static const uint8_t vp8_dct_cat4_prob[] = {
  327. 176, 155, 140, 135, 0
  328. };
  329. static const uint8_t vp8_dct_cat5_prob[] = {
  330. 180, 157, 141, 134, 130, 0
  331. };
  332. static const uint8_t vp8_dct_cat6_prob[] = {
  333. 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0
  334. };
  335. // only used for cat3 and above; cat 1 and 2 are referenced directly
  336. const uint8_t *const ff_vp8_dct_cat_prob[] = {
  337. vp8_dct_cat3_prob,
  338. vp8_dct_cat4_prob,
  339. vp8_dct_cat5_prob,
  340. vp8_dct_cat6_prob,
  341. };
  342. static const uint8_t vp8_token_default_probs[4][8][3][NUM_DCT_TOKENS - 1] = {
  343. {
  344. {
  345. { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  346. { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  347. { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  348. },
  349. {
  350. { 253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128 },
  351. { 189, 129, 242, 255, 227, 213, 255, 219, 128, 128, 128 },
  352. { 106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128 },
  353. },
  354. {
  355. { 1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128 },
  356. { 181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128 },
  357. { 78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128 },
  358. },
  359. {
  360. { 1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128 },
  361. { 184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128 },
  362. { 77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128 },
  363. },
  364. {
  365. { 1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128 },
  366. { 170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128 },
  367. { 37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128 },
  368. },
  369. {
  370. { 1, 204, 254, 255, 245, 255, 128, 128, 128, 128, 128 },
  371. { 207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128 },
  372. { 102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128 },
  373. },
  374. {
  375. { 1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128 },
  376. { 177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128 },
  377. { 80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128 },
  378. },
  379. {
  380. { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  381. { 246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  382. { 255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  383. },
  384. },
  385. {
  386. {
  387. { 198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62 },
  388. { 131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1 },
  389. { 68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128 },
  390. },
  391. {
  392. { 1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128 },
  393. { 184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128 },
  394. { 81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128 },
  395. },
  396. {
  397. { 1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128 },
  398. { 99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128 },
  399. { 23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128 },
  400. },
  401. {
  402. { 1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128 },
  403. { 109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128 },
  404. { 44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128 },
  405. },
  406. {
  407. { 1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128 },
  408. { 94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128 },
  409. { 22, 100, 174, 245, 186, 161, 255, 199, 128, 128, 128 },
  410. },
  411. {
  412. { 1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128 },
  413. { 124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128 },
  414. { 35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128 },
  415. },
  416. {
  417. { 1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128 },
  418. { 121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128 },
  419. { 45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128 },
  420. },
  421. {
  422. { 1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128 },
  423. { 203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
  424. { 137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128 },
  425. },
  426. },
  427. {
  428. {
  429. { 253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128 },
  430. { 175, 13, 224, 243, 193, 185, 249, 198, 255, 255, 128 },
  431. { 73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128 },
  432. },
  433. {
  434. { 1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128 },
  435. { 239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128 },
  436. { 155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128 },
  437. },
  438. {
  439. { 1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128 },
  440. { 201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128 },
  441. { 69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128 },
  442. },
  443. {
  444. { 1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128 },
  445. { 223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128 },
  446. { 141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
  447. },
  448. {
  449. { 1, 16, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
  450. { 190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128 },
  451. { 149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  452. },
  453. {
  454. { 1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  455. { 247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  456. { 240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  457. },
  458. {
  459. { 1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128 },
  460. { 213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128 },
  461. { 55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  462. },
  463. {
  464. { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  465. { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  466. { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  467. },
  468. },
  469. {
  470. {
  471. { 202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255 },
  472. { 126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128 },
  473. { 61, 46, 138, 219, 151, 178, 240, 170, 255, 216, 128 },
  474. },
  475. {
  476. { 1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128 },
  477. { 166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128 },
  478. { 39, 77, 162, 232, 172, 180, 245, 178, 255, 255, 128 },
  479. },
  480. {
  481. { 1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128 },
  482. { 124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128 },
  483. { 24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128 },
  484. },
  485. {
  486. { 1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128 },
  487. { 149, 150, 226, 252, 216, 205, 255, 171, 128, 128, 128 },
  488. { 28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128 },
  489. },
  490. {
  491. { 1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128 },
  492. { 123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128 },
  493. { 20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128 },
  494. },
  495. {
  496. { 1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128 },
  497. { 168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128 },
  498. { 47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128 },
  499. },
  500. {
  501. { 1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128 },
  502. { 141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128 },
  503. { 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 },
  504. },
  505. {
  506. { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  507. { 244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  508. { 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
  509. },
  510. },
  511. };
  512. static const uint8_t vp8_token_update_probs[4][8][3][NUM_DCT_TOKENS - 1] = {
  513. {
  514. {
  515. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  516. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  517. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  518. },
  519. {
  520. { 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  521. { 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
  522. { 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  523. },
  524. {
  525. { 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
  526. { 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  527. { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  528. },
  529. {
  530. { 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  531. { 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  532. { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  533. },
  534. {
  535. { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  536. { 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  537. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  538. },
  539. {
  540. { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  541. { 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  542. { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  543. },
  544. {
  545. { 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
  546. { 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
  547. { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  548. },
  549. {
  550. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  551. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  552. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  553. },
  554. },
  555. {
  556. {
  557. { 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  558. { 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
  559. { 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 },
  560. },
  561. {
  562. { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  563. { 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  564. { 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
  565. },
  566. {
  567. { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  568. { 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  569. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  570. },
  571. {
  572. { 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  573. { 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  574. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  575. },
  576. {
  577. { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  578. { 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  579. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  580. },
  581. {
  582. { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  583. { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  584. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  585. },
  586. {
  587. { 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  588. { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  589. { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  590. },
  591. {
  592. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  593. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  594. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  595. },
  596. },
  597. {
  598. {
  599. { 186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
  600. { 234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255 },
  601. { 251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255 },
  602. },
  603. {
  604. { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  605. { 236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  606. { 251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255 },
  607. },
  608. {
  609. { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  610. { 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  611. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  612. },
  613. {
  614. { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  615. { 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  616. { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  617. },
  618. {
  619. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  620. { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  621. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  622. },
  623. {
  624. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  625. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  626. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  627. },
  628. {
  629. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  630. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  631. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  632. },
  633. {
  634. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  635. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  636. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  637. },
  638. },
  639. {
  640. {
  641. { 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  642. { 250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255 },
  643. { 248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255 },
  644. },
  645. {
  646. { 255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  647. { 246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  648. { 252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255 },
  649. },
  650. {
  651. { 255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
  652. { 248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  653. { 253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
  654. },
  655. {
  656. { 255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  657. { 245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  658. { 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  659. },
  660. {
  661. { 255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  662. { 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  663. { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  664. },
  665. {
  666. { 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  667. { 249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  668. { 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
  669. },
  670. {
  671. { 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
  672. { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  673. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  674. },
  675. {
  676. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  677. { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  678. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  679. },
  680. },
  681. };
  682. static const uint8_t vp8_dc_qlookup[VP8_MAX_QUANT + 1] = {
  683. 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 17,
  684. 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 28,
  685. 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43,
  686. 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
  687. 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
  688. 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
  689. 91, 93, 95, 96, 98, 100, 101, 102, 104, 106, 108, 110, 112, 114, 116, 118,
  690. 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 143, 145, 148, 151, 154, 157,
  691. };
  692. static const uint16_t vp8_ac_qlookup[VP8_MAX_QUANT + 1] = {
  693. 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  694. 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
  695. 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
  696. 52, 53, 54, 55, 56, 57, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
  697. 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108,
  698. 110, 112, 114, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152,
  699. 155, 158, 161, 164, 167, 170, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209,
  700. 213, 217, 221, 225, 229, 234, 239, 245, 249, 254, 259, 264, 269, 274, 279, 284,
  701. };
  702. static const uint8_t vp8_mv_update_prob[2][19] = {
  703. { 237,
  704. 246,
  705. 253, 253, 254, 254, 254, 254, 254,
  706. 254, 254, 254, 254, 254, 250, 250, 252, /* VP8 only: */ 254, 254 },
  707. { 231,
  708. 243,
  709. 245, 253, 254, 254, 254, 254, 254,
  710. 254, 254, 254, 254, 254, 251, 251, 254, /* VP8 only: */ 254, 254 }
  711. };
  712. static const uint8_t vp7_mv_default_prob[2][17] = {
  713. { 162,
  714. 128,
  715. 225, 146, 172, 147, 214, 39, 156,
  716. 247, 210, 135, 68, 138, 220, 239, 246 },
  717. { 164,
  718. 128,
  719. 204, 170, 119, 235, 140, 230, 228,
  720. 244, 184, 201, 44, 173, 221, 239, 253 }
  721. };
  722. static const uint8_t vp8_mv_default_prob[2][19] = {
  723. { 162,
  724. 128,
  725. 225, 146, 172, 147, 214, 39, 156,
  726. 128, 129, 132, 75, 145, 178, 206, 239, 254, 254 },
  727. { 164,
  728. 128,
  729. 204, 170, 119, 235, 140, 230, 228,
  730. 128, 130, 130, 74, 148, 180, 203, 236, 254, 254 }
  731. };
  732. static const uint8_t vp7_feature_value_size[2][4] = {
  733. { 7, 6, 0, 8 },
  734. { 7, 6, 0, 5 },
  735. };
  736. static const int8_t vp7_feature_index_tree[4][2] =
  737. {
  738. { 1, 2 },
  739. { -0, -1 }, // '00', '01'
  740. { -2, -3 }, // '10', '11'
  741. };
  742. static const uint16_t vp7_ydc_qlookup[] = {
  743. 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15,
  744. 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29,
  745. 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41,
  746. 41, 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 52,
  747. 53, 53, 54, 56, 57, 58, 59, 60, 62, 63, 65, 66, 68, 70, 72,
  748. 74, 76, 79, 81, 84, 87, 90, 93, 96, 100, 104, 108, 112, 116, 121,
  749. 126, 131, 136, 142, 148, 154, 160, 167, 174, 182, 189, 198, 206, 215, 224,
  750. 234, 244, 254, 265, 277, 288, 301, 313, 327, 340, 355, 370, 385, 401, 417,
  751. 434, 452, 470, 489, 509, 529, 550, 572,
  752. };
  753. static const uint16_t vp7_yac_qlookup[] = {
  754. 4, 4, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 15,
  755. 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35,
  756. 37, 38, 40, 41, 42, 44, 45, 46, 48, 49, 50, 51, 53, 54,
  757. 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 67, 68, 69, 70,
  758. 72, 73, 75, 76, 78, 80, 82, 84, 86, 88, 91, 93, 96, 99,
  759. 102, 105, 109, 112, 116, 121, 125, 130, 135, 140, 146, 152, 158, 165,
  760. 172, 180, 188, 196, 205, 214, 224, 234, 245, 256, 268, 281, 294, 308,
  761. 322, 337, 353, 369, 386, 404, 423, 443, 463, 484, 506, 529, 553, 578,
  762. 604, 631, 659, 688, 718, 749, 781, 814, 849, 885, 922, 960, 1000, 1041,
  763. 1083, 1127,
  764. };
  765. static const uint16_t vp7_y2dc_qlookup[] = {
  766. 7, 9, 11, 13, 15, 17, 19, 21, 23, 26, 28, 30, 33, 35,
  767. 37, 39, 42, 44, 46, 48, 51, 53, 55, 57, 59, 61, 63, 65,
  768. 67, 69, 70, 72, 74, 75, 77, 78, 80, 81, 83, 84, 85, 87,
  769. 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 104,
  770. 105, 106, 108, 109, 111, 113, 114, 116, 118, 120, 123, 125, 128, 131,
  771. 134, 137, 140, 144, 148, 152, 156, 161, 166, 171, 176, 182, 188, 195,
  772. 202, 209, 217, 225, 234, 243, 253, 263, 274, 285, 297, 309, 322, 336,
  773. 350, 365, 381, 397, 414, 432, 450, 470, 490, 511, 533, 556, 579, 604,
  774. 630, 656, 684, 713, 742, 773, 805, 838, 873, 908, 945, 983, 1022, 1063,
  775. 1105, 1148,
  776. };
  777. static const uint16_t vp7_y2ac_qlookup[] = {
  778. 7, 9, 11, 13, 16, 18, 21, 24, 26, 29, 32, 35,
  779. 38, 41, 43, 46, 49, 52, 55, 58, 61, 64, 66, 69,
  780. 72, 74, 77, 79, 82, 84, 86, 88, 91, 93, 95, 97,
  781. 98, 100, 102, 104, 105, 107, 109, 110, 112, 113, 115, 116,
  782. 117, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 136,
  783. 138, 141, 143, 146, 149, 152, 155, 158, 162, 166, 171, 175,
  784. 180, 185, 191, 197, 204, 210, 218, 226, 234, 243, 252, 262,
  785. 273, 284, 295, 308, 321, 335, 350, 365, 381, 398, 416, 435,
  786. 455, 476, 497, 520, 544, 569, 595, 622, 650, 680, 711, 743,
  787. 776, 811, 848, 885, 925, 965, 1008, 1052, 1097, 1144, 1193, 1244,
  788. 1297, 1351, 1407, 1466, 1526, 1588, 1652, 1719,
  789. };
  790. #endif /* AVCODEC_VP8DATA_H */