vp6data.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /**
  2. * @file libavcodec/vp6data.h
  3. * VP6 compatible video decoder
  4. *
  5. * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef AVCODEC_VP6DATA_H
  24. #define AVCODEC_VP6DATA_H
  25. #include "vp56data.h"
  26. static const uint8_t vp6_def_fdv_vector_model[2][8] = {
  27. { 247, 210, 135, 68, 138, 220, 239, 246 },
  28. { 244, 184, 201, 44, 173, 221, 239, 253 },
  29. };
  30. static const uint8_t vp6_def_pdv_vector_model[2][7] = {
  31. { 225, 146, 172, 147, 214, 39, 156 },
  32. { 204, 170, 119, 235, 140, 230, 228 },
  33. };
  34. static const uint8_t vp6_def_coeff_reorder[] = {
  35. 0, 0, 1, 1, 1, 2, 2, 2,
  36. 2, 2, 2, 3, 3, 4, 4, 4,
  37. 5, 5, 5, 5, 6, 6, 7, 7,
  38. 7, 7, 7, 8, 8, 9, 9, 9,
  39. 9, 9, 9, 10, 10, 11, 11, 11,
  40. 11, 11, 11, 12, 12, 12, 12, 12,
  41. 12, 13, 13, 13, 13, 13, 14, 14,
  42. 14, 14, 15, 15, 15, 15, 15, 15,
  43. };
  44. static const uint8_t vp6_def_runv_coeff_model[2][14] = {
  45. { 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 },
  46. { 135, 201, 181, 154, 98, 117, 132, 126, 146, 169, 184, 240, 246, 254 },
  47. };
  48. static const uint8_t vp6_sig_dct_pct[2][2] = {
  49. { 237, 246 },
  50. { 231, 243 },
  51. };
  52. static const uint8_t vp6_pdv_pct[2][7] = {
  53. { 253, 253, 254, 254, 254, 254, 254 },
  54. { 245, 253, 254, 254, 254, 254, 254 },
  55. };
  56. static const uint8_t vp6_fdv_pct[2][8] = {
  57. { 254, 254, 254, 254, 254, 250, 250, 252 },
  58. { 254, 254, 254, 254, 254, 251, 251, 254 },
  59. };
  60. static const uint8_t vp6_dccv_pct[2][11] = {
  61. { 146, 255, 181, 207, 232, 243, 238, 251, 244, 250, 249 },
  62. { 179, 255, 214, 240, 250, 255, 244, 255, 255, 255, 255 },
  63. };
  64. static const uint8_t vp6_coeff_reorder_pct[] = {
  65. 255, 132, 132, 159, 153, 151, 161, 170,
  66. 164, 162, 136, 110, 103, 114, 129, 118,
  67. 124, 125, 132, 136, 114, 110, 142, 135,
  68. 134, 123, 143, 126, 153, 183, 166, 161,
  69. 171, 180, 179, 164, 203, 218, 225, 217,
  70. 215, 206, 203, 217, 229, 241, 248, 243,
  71. 253, 255, 253, 255, 255, 255, 255, 255,
  72. 255, 255, 255, 255, 255, 255, 255, 255,
  73. };
  74. static const uint8_t vp6_runv_pct[2][14] = {
  75. { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 },
  76. { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 },
  77. };
  78. static const uint8_t vp6_ract_pct[3][2][6][11] = {
  79. { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 },
  80. { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 },
  81. { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 },
  82. { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 },
  83. { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
  84. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
  85. { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
  86. { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 },
  87. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  88. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  89. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  90. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } },
  91. { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 },
  92. { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 },
  93. { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 },
  94. { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 },
  95. { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
  96. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
  97. { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
  98. { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
  99. { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  100. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  101. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  102. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } },
  103. { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 },
  104. { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 },
  105. { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 },
  106. { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 },
  107. { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
  108. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
  109. { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 },
  110. { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 },
  111. { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  112. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  113. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
  114. { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }
  115. };
  116. static const int vp6_dccv_lc[3][5][2] = {
  117. { { 122, 133 }, { 0, 1 }, { 78, 171 }, { 139, 117 }, { 168, 79 } },
  118. { { 133, 51 }, { 0, 1 }, { 169, 71 }, { 214, 44 }, { 210, 38 } },
  119. { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246, -3 }, { 203, 17 } },
  120. };
  121. static const uint8_t vp6_coeff_groups[] = {
  122. 0, 0, 1, 1, 1, 2, 2, 2,
  123. 2, 2, 2, 3, 3, 3, 3, 3,
  124. 3, 3, 3, 3, 3, 3, 4, 4,
  125. 4, 4, 4, 4, 4, 4, 4, 4,
  126. 4, 4, 4, 4, 4, 5, 5, 5,
  127. 5, 5, 5, 5, 5, 5, 5, 5,
  128. 5, 5, 5, 5, 5, 5, 5, 5,
  129. 5, 5, 5, 5, 5, 5, 5, 5,
  130. };
  131. static const int16_t vp6_block_copy_filter[17][8][4] = {
  132. { { 0, 128, 0, 0 }, /* 0 */
  133. { -3, 122, 9, 0 },
  134. { -4, 109, 24, -1 },
  135. { -5, 91, 45, -3 },
  136. { -4, 68, 68, -4 },
  137. { -3, 45, 91, -5 },
  138. { -1, 24, 109, -4 },
  139. { 0, 9, 122, -3 } },
  140. { { 0, 128, 0, 0 }, /* 1 */
  141. { -4, 124, 9, -1 },
  142. { -5, 110, 25, -2 },
  143. { -6, 91, 46, -3 },
  144. { -5, 69, 69, -5 },
  145. { -3, 46, 91, -6 },
  146. { -2, 25, 110, -5 },
  147. { -1, 9, 124, -4 } },
  148. { { 0, 128, 0, 0 }, /* 2 */
  149. { -4, 123, 10, -1 },
  150. { -6, 110, 26, -2 },
  151. { -7, 92, 47, -4 },
  152. { -6, 70, 70, -6 },
  153. { -4, 47, 92, -7 },
  154. { -2, 26, 110, -6 },
  155. { -1, 10, 123, -4 } },
  156. { { 0, 128, 0, 0 }, /* 3 */
  157. { -5, 124, 10, -1 },
  158. { -7, 110, 27, -2 },
  159. { -7, 91, 48, -4 },
  160. { -6, 70, 70, -6 },
  161. { -4, 48, 92, -8 },
  162. { -2, 27, 110, -7 },
  163. { -1, 10, 124, -5 } },
  164. { { 0, 128, 0, 0 }, /* 4 */
  165. { -6, 124, 11, -1 },
  166. { -8, 111, 28, -3 },
  167. { -8, 92, 49, -5 },
  168. { -7, 71, 71, -7 },
  169. { -5, 49, 92, -8 },
  170. { -3, 28, 111, -8 },
  171. { -1, 11, 124, -6 } },
  172. { { 0, 128, 0, 0 }, /* 5 */
  173. { -6, 123, 12, -1 },
  174. { -9, 111, 29, -3 },
  175. { -9, 93, 50, -6 },
  176. { -8, 72, 72, -8 },
  177. { -6, 50, 93, -9 },
  178. { -3, 29, 111, -9 },
  179. { -1, 12, 123, -6 } },
  180. { { 0, 128, 0, 0 }, /* 6 */
  181. { -7, 124, 12, -1 },
  182. { -10, 111, 30, -3 },
  183. { -10, 93, 51, -6 },
  184. { -9, 73, 73, -9 },
  185. { -6, 51, 93, -10 },
  186. { -3, 30, 111, -10 },
  187. { -1, 12, 124, -7 } },
  188. { { 0, 128, 0, 0 }, /* 7 */
  189. { -7, 123, 13, -1 },
  190. { -11, 112, 31, -4 },
  191. { -11, 94, 52, -7 },
  192. { -10, 74, 74, -10 },
  193. { -7, 52, 94, -11 },
  194. { -4, 31, 112, -11 },
  195. { -1, 13, 123, -7 } },
  196. { { 0, 128, 0, 0 }, /* 8 */
  197. { -8, 124, 13, -1 },
  198. { -12, 112, 32, -4 },
  199. { -12, 94, 53, -7 },
  200. { -10, 74, 74, -10 },
  201. { -7, 53, 94, -12 },
  202. { -4, 32, 112, -12 },
  203. { -1, 13, 124, -8 } },
  204. { { 0, 128, 0, 0 }, /* 9 */
  205. { -9, 124, 14, -1 },
  206. { -13, 112, 33, -4 },
  207. { -13, 95, 54, -8 },
  208. { -11, 75, 75, -11 },
  209. { -8, 54, 95, -13 },
  210. { -4, 33, 112, -13 },
  211. { -1, 14, 124, -9 } },
  212. { { 0, 128, 0, 0 }, /* 10 */
  213. { -9, 123, 15, -1 },
  214. { -14, 113, 34, -5 },
  215. { -14, 95, 55, -8 },
  216. { -12, 76, 76, -12 },
  217. { -8, 55, 95, -14 },
  218. { -5, 34, 112, -13 },
  219. { -1, 15, 123, -9 } },
  220. { { 0, 128, 0, 0 }, /* 11 */
  221. { -10, 124, 15, -1 },
  222. { -14, 113, 34, -5 },
  223. { -15, 96, 56, -9 },
  224. { -13, 77, 77, -13 },
  225. { -9, 56, 96, -15 },
  226. { -5, 34, 113, -14 },
  227. { -1, 15, 124, -10 } },
  228. { { 0, 128, 0, 0 }, /* 12 */
  229. { -10, 123, 16, -1 },
  230. { -15, 113, 35, -5 },
  231. { -16, 98, 56, -10 },
  232. { -14, 78, 78, -14 },
  233. { -10, 56, 98, -16 },
  234. { -5, 35, 113, -15 },
  235. { -1, 16, 123, -10 } },
  236. { { 0, 128, 0, 0 }, /* 13 */
  237. { -11, 124, 17, -2 },
  238. { -16, 113, 36, -5 },
  239. { -17, 98, 57, -10 },
  240. { -14, 78, 78, -14 },
  241. { -10, 57, 98, -17 },
  242. { -5, 36, 113, -16 },
  243. { -2, 17, 124, -11 } },
  244. { { 0, 128, 0, 0 }, /* 14 */
  245. { -12, 125, 17, -2 },
  246. { -17, 114, 37, -6 },
  247. { -18, 99, 58, -11 },
  248. { -15, 79, 79, -15 },
  249. { -11, 58, 99, -18 },
  250. { -6, 37, 114, -17 },
  251. { -2, 17, 125, -12 } },
  252. { { 0, 128, 0, 0 }, /* 15 */
  253. { -12, 124, 18, -2 },
  254. { -18, 114, 38, -6 },
  255. { -19, 99, 59, -11 },
  256. { -16, 80, 80, -16 },
  257. { -11, 59, 99, -19 },
  258. { -6, 38, 114, -18 },
  259. { -2, 18, 124, -12 } },
  260. { { 0, 128, 0, 0 }, /* 16 */
  261. { -4, 118, 16, -2 },
  262. { -7, 106, 34, -5 },
  263. { -8, 90, 53, -7 },
  264. { -8, 72, 72, -8 },
  265. { -7, 53, 90, -8 },
  266. { -5, 34, 106, -7 },
  267. { -2, 16, 118, -4 } },
  268. };
  269. static const VP56Tree vp6_pcr_tree[] = {
  270. { 8, 0},
  271. { 4, 1},
  272. { 2, 2}, {-1}, {-2},
  273. { 2, 3}, {-3}, {-4},
  274. { 8, 4},
  275. { 4, 5},
  276. { 2, 6}, {-5}, {-6},
  277. { 2, 7}, {-7}, {-8},
  278. {-0},
  279. };
  280. static const uint8_t vp6_coord_div[] = { 4, 4, 4, 4, 8, 8 };
  281. static const uint8_t vp6_huff_coeff_map[] = {
  282. 13, 14, 11, 0, 1, 15, 16, 18, 2, 17, 3, 4, 19, 20, 5, 6, 21, 22, 7, 8, 9, 10
  283. };
  284. static const uint8_t vp6_huff_run_map[] = {
  285. 10, 13, 11, 12, 0, 1, 2, 3, 14, 8, 15, 16, 4, 5, 6, 7
  286. };
  287. #endif /* AVCODEC_VP6DATA_H */