You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

644 lines
21KB

  1. /**
  2. * @file libavcodec/vp6.c
  3. * VP6 compatible video decoder
  4. *
  5. * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
  6. *
  7. * The VP6F decoder accepts an optional 1 byte extradata. It is composed of:
  8. * - upper 4bits: difference between encoded width and visible width
  9. * - lower 4bits: difference between encoded height and visible height
  10. *
  11. * This file is part of FFmpeg.
  12. *
  13. * FFmpeg is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU Lesser General Public
  15. * License as published by the Free Software Foundation; either
  16. * version 2.1 of the License, or (at your option) any later version.
  17. *
  18. * FFmpeg is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. * Lesser General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Lesser General Public
  24. * License along with FFmpeg; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  26. */
  27. #include <stdlib.h>
  28. #include "avcodec.h"
  29. #include "dsputil.h"
  30. #include "get_bits.h"
  31. #include "huffman.h"
  32. #include "vp56.h"
  33. #include "vp56data.h"
  34. #include "vp6data.h"
  35. static void vp6_parse_coeff(VP56Context *s);
  36. static void vp6_parse_coeff_huffman(VP56Context *s);
  37. static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
  38. int *golden_frame)
  39. {
  40. VP56RangeCoder *c = &s->c;
  41. int parse_filter_info = 0;
  42. int coeff_offset = 0;
  43. int vrt_shift = 0;
  44. int sub_version;
  45. int rows, cols;
  46. int res = 1;
  47. int separated_coeff = buf[0] & 1;
  48. s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
  49. vp56_init_dequant(s, (buf[0] >> 1) & 0x3F);
  50. if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
  51. sub_version = buf[1] >> 3;
  52. if (sub_version > 8)
  53. return 0;
  54. s->filter_header = buf[1] & 0x06;
  55. if (buf[1] & 1) {
  56. av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
  57. return 0;
  58. }
  59. if (separated_coeff || !s->filter_header) {
  60. coeff_offset = AV_RB16(buf+2) - 2;
  61. buf += 2;
  62. buf_size -= 2;
  63. }
  64. rows = buf[2]; /* number of stored macroblock rows */
  65. cols = buf[3]; /* number of stored macroblock cols */
  66. /* buf[4] is number of displayed macroblock rows */
  67. /* buf[5] is number of displayed macroblock cols */
  68. if (!s->macroblocks || /* first frame */
  69. 16*cols != s->avctx->coded_width ||
  70. 16*rows != s->avctx->coded_height) {
  71. avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
  72. if (s->avctx->extradata_size == 1) {
  73. s->avctx->width -= s->avctx->extradata[0] >> 4;
  74. s->avctx->height -= s->avctx->extradata[0] & 0x0F;
  75. }
  76. res = 2;
  77. }
  78. vp56_init_range_decoder(c, buf+6, buf_size-6);
  79. vp56_rac_gets(c, 2);
  80. parse_filter_info = s->filter_header;
  81. if (sub_version < 8)
  82. vrt_shift = 5;
  83. s->sub_version = sub_version;
  84. } else {
  85. if (!s->sub_version)
  86. return 0;
  87. if (separated_coeff || !s->filter_header) {
  88. coeff_offset = AV_RB16(buf+1) - 2;
  89. buf += 2;
  90. buf_size -= 2;
  91. }
  92. vp56_init_range_decoder(c, buf+1, buf_size-1);
  93. *golden_frame = vp56_rac_get(c);
  94. if (s->filter_header) {
  95. s->deblock_filtering = vp56_rac_get(c);
  96. if (s->deblock_filtering)
  97. vp56_rac_get(c);
  98. if (s->sub_version > 7)
  99. parse_filter_info = vp56_rac_get(c);
  100. }
  101. }
  102. if (parse_filter_info) {
  103. if (vp56_rac_get(c)) {
  104. s->filter_mode = 2;
  105. s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift;
  106. s->max_vector_length = 2 << vp56_rac_gets(c, 3);
  107. } else if (vp56_rac_get(c)) {
  108. s->filter_mode = 1;
  109. } else {
  110. s->filter_mode = 0;
  111. }
  112. if (s->sub_version > 7)
  113. s->filter_selection = vp56_rac_gets(c, 4);
  114. else
  115. s->filter_selection = 16;
  116. }
  117. s->use_huffman = vp56_rac_get(c);
  118. s->parse_coeff = vp6_parse_coeff;
  119. if (coeff_offset) {
  120. buf += coeff_offset;
  121. buf_size -= coeff_offset;
  122. if (buf_size < 0)
  123. return 0;
  124. if (s->use_huffman) {
  125. s->parse_coeff = vp6_parse_coeff_huffman;
  126. init_get_bits(&s->gb, buf, buf_size<<3);
  127. } else {
  128. vp56_init_range_decoder(&s->cc, buf, buf_size);
  129. s->ccp = &s->cc;
  130. }
  131. } else {
  132. s->ccp = &s->c;
  133. }
  134. return res;
  135. }
  136. static void vp6_coeff_order_table_init(VP56Context *s)
  137. {
  138. int i, pos, idx = 1;
  139. s->modelp->coeff_index_to_pos[0] = 0;
  140. for (i=0; i<16; i++)
  141. for (pos=1; pos<64; pos++)
  142. if (s->modelp->coeff_reorder[pos] == i)
  143. s->modelp->coeff_index_to_pos[idx++] = pos;
  144. }
  145. static void vp6_default_models_init(VP56Context *s)
  146. {
  147. VP56Model *model = s->modelp;
  148. model->vector_dct[0] = 0xA2;
  149. model->vector_dct[1] = 0xA4;
  150. model->vector_sig[0] = 0x80;
  151. model->vector_sig[1] = 0x80;
  152. memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
  153. memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv));
  154. memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv));
  155. memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv));
  156. memcpy(model->coeff_reorder, vp6_def_coeff_reorder, sizeof(model->coeff_reorder));
  157. vp6_coeff_order_table_init(s);
  158. }
  159. static void vp6_parse_vector_models(VP56Context *s)
  160. {
  161. VP56RangeCoder *c = &s->c;
  162. VP56Model *model = s->modelp;
  163. int comp, node;
  164. for (comp=0; comp<2; comp++) {
  165. if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0]))
  166. model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
  167. if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1]))
  168. model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
  169. }
  170. for (comp=0; comp<2; comp++)
  171. for (node=0; node<7; node++)
  172. if (vp56_rac_get_prob(c, vp6_pdv_pct[comp][node]))
  173. model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
  174. for (comp=0; comp<2; comp++)
  175. for (node=0; node<8; node++)
  176. if (vp56_rac_get_prob(c, vp6_fdv_pct[comp][node]))
  177. model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7);
  178. }
  179. /* nodes must ascend by count, but with descending symbol order */
  180. static int vp6_huff_cmp(const void *va, const void *vb)
  181. {
  182. const Node *a = va, *b = vb;
  183. return (a->count - b->count)*16 + (b->sym - a->sym);
  184. }
  185. static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
  186. const uint8_t *map, unsigned size, VLC *vlc)
  187. {
  188. Node nodes[2*size], *tmp = &nodes[size];
  189. int a, b, i;
  190. /* first compute probabilities from model */
  191. tmp[0].count = 256;
  192. for (i=0; i<size-1; i++) {
  193. a = tmp[i].count * coeff_model[i] >> 8;
  194. b = tmp[i].count * (255 - coeff_model[i]) >> 8;
  195. nodes[map[2*i ]].count = a + !a;
  196. nodes[map[2*i+1]].count = b + !b;
  197. }
  198. /* then build the huffman tree accodring to probabilities */
  199. ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
  200. FF_HUFFMAN_FLAG_HNODE_FIRST);
  201. }
  202. static void vp6_parse_coeff_models(VP56Context *s)
  203. {
  204. VP56RangeCoder *c = &s->c;
  205. VP56Model *model = s->modelp;
  206. int def_prob[11];
  207. int node, cg, ctx, pos;
  208. int ct; /* code type */
  209. int pt; /* plane type (0 for Y, 1 for U or V) */
  210. memset(def_prob, 0x80, sizeof(def_prob));
  211. for (pt=0; pt<2; pt++)
  212. for (node=0; node<11; node++)
  213. if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) {
  214. def_prob[node] = vp56_rac_gets_nn(c, 7);
  215. model->coeff_dccv[pt][node] = def_prob[node];
  216. } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
  217. model->coeff_dccv[pt][node] = def_prob[node];
  218. }
  219. if (vp56_rac_get(c)) {
  220. for (pos=1; pos<64; pos++)
  221. if (vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos]))
  222. model->coeff_reorder[pos] = vp56_rac_gets(c, 4);
  223. vp6_coeff_order_table_init(s);
  224. }
  225. for (cg=0; cg<2; cg++)
  226. for (node=0; node<14; node++)
  227. if (vp56_rac_get_prob(c, vp6_runv_pct[cg][node]))
  228. model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7);
  229. for (ct=0; ct<3; ct++)
  230. for (pt=0; pt<2; pt++)
  231. for (cg=0; cg<6; cg++)
  232. for (node=0; node<11; node++)
  233. if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) {
  234. def_prob[node] = vp56_rac_gets_nn(c, 7);
  235. model->coeff_ract[pt][ct][cg][node] = def_prob[node];
  236. } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
  237. model->coeff_ract[pt][ct][cg][node] = def_prob[node];
  238. }
  239. if (s->use_huffman) {
  240. for (pt=0; pt<2; pt++) {
  241. vp6_build_huff_tree(s, model->coeff_dccv[pt],
  242. vp6_huff_coeff_map, 12, &s->dccv_vlc[pt]);
  243. vp6_build_huff_tree(s, model->coeff_runv[pt],
  244. vp6_huff_run_map, 9, &s->runv_vlc[pt]);
  245. for (ct=0; ct<3; ct++)
  246. for (cg = 0; cg < 6; cg++)
  247. vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg],
  248. vp6_huff_coeff_map, 12,
  249. &s->ract_vlc[pt][ct][cg]);
  250. }
  251. memset(s->nb_null, 0, sizeof(s->nb_null));
  252. } else {
  253. /* coeff_dcct is a linear combination of coeff_dccv */
  254. for (pt=0; pt<2; pt++)
  255. for (ctx=0; ctx<3; ctx++)
  256. for (node=0; node<5; node++)
  257. model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255);
  258. }
  259. }
  260. static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
  261. {
  262. VP56RangeCoder *c = &s->c;
  263. VP56Model *model = s->modelp;
  264. int comp;
  265. *vect = (VP56mv) {0,0};
  266. if (s->vector_candidate_pos < 2)
  267. *vect = s->vector_candidate[0];
  268. for (comp=0; comp<2; comp++) {
  269. int i, delta = 0;
  270. if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
  271. static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4};
  272. for (i=0; i<sizeof(prob_order); i++) {
  273. int j = prob_order[i];
  274. delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][j])<<j;
  275. }
  276. if (delta & 0xF0)
  277. delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][3])<<3;
  278. else
  279. delta |= 8;
  280. } else {
  281. delta = vp56_rac_get_tree(c, vp56_pva_tree,
  282. model->vector_pdv[comp]);
  283. }
  284. if (delta && vp56_rac_get_prob(c, model->vector_sig[comp]))
  285. delta = -delta;
  286. if (!comp)
  287. vect->x += delta;
  288. else
  289. vect->y += delta;
  290. }
  291. }
  292. /**
  293. * Read number of consecutive blocks with null DC or AC.
  294. * This value is < 74.
  295. */
  296. static unsigned vp6_get_nb_null(VP56Context *s)
  297. {
  298. unsigned val = get_bits(&s->gb, 2);
  299. if (val == 2)
  300. val += get_bits(&s->gb, 2);
  301. else if (val == 3) {
  302. val = get_bits1(&s->gb) << 2;
  303. val = 6+val + get_bits(&s->gb, 2+val);
  304. }
  305. return val;
  306. }
  307. static void vp6_parse_coeff_huffman(VP56Context *s)
  308. {
  309. VP56Model *model = s->modelp;
  310. uint8_t *permute = s->scantable.permutated;
  311. VLC *vlc_coeff;
  312. int coeff, sign, coeff_idx;
  313. int b, cg, idx;
  314. int pt = 0; /* plane type (0 for Y, 1 for U or V) */
  315. for (b=0; b<6; b++) {
  316. int ct = 0; /* code type */
  317. if (b > 3) pt = 1;
  318. vlc_coeff = &s->dccv_vlc[pt];
  319. for (coeff_idx=0; coeff_idx<64; ) {
  320. int run = 1;
  321. if (coeff_idx<2 && s->nb_null[coeff_idx][pt]) {
  322. s->nb_null[coeff_idx][pt]--;
  323. if (coeff_idx)
  324. break;
  325. } else {
  326. if (get_bits_count(&s->gb) >= s->gb.size_in_bits)
  327. return;
  328. coeff = get_vlc2(&s->gb, vlc_coeff->table, 9, 3);
  329. if (coeff == 0) {
  330. if (coeff_idx) {
  331. int pt = (coeff_idx >= 6);
  332. run += get_vlc2(&s->gb, s->runv_vlc[pt].table, 9, 3);
  333. if (run >= 9)
  334. run += get_bits(&s->gb, 6);
  335. } else
  336. s->nb_null[0][pt] = vp6_get_nb_null(s);
  337. ct = 0;
  338. } else if (coeff == 11) { /* end of block */
  339. if (coeff_idx == 1) /* first AC coeff ? */
  340. s->nb_null[1][pt] = vp6_get_nb_null(s);
  341. break;
  342. } else {
  343. int coeff2 = vp56_coeff_bias[coeff];
  344. if (coeff > 4)
  345. coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 : 11);
  346. ct = 1 + (coeff2 > 1);
  347. sign = get_bits1(&s->gb);
  348. coeff2 = (coeff2 ^ -sign) + sign;
  349. if (coeff_idx)
  350. coeff2 *= s->dequant_ac;
  351. idx = model->coeff_index_to_pos[coeff_idx];
  352. s->block_coeff[b][permute[idx]] = coeff2;
  353. }
  354. }
  355. coeff_idx+=run;
  356. cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
  357. vlc_coeff = &s->ract_vlc[pt][ct][cg];
  358. }
  359. }
  360. }
  361. static void vp6_parse_coeff(VP56Context *s)
  362. {
  363. VP56RangeCoder *c = s->ccp;
  364. VP56Model *model = s->modelp;
  365. uint8_t *permute = s->scantable.permutated;
  366. uint8_t *model1, *model2, *model3;
  367. int coeff, sign, coeff_idx;
  368. int b, i, cg, idx, ctx;
  369. int pt = 0; /* plane type (0 for Y, 1 for U or V) */
  370. for (b=0; b<6; b++) {
  371. int ct = 1; /* code type */
  372. int run = 1;
  373. if (b > 3) pt = 1;
  374. ctx = s->left_block[vp56_b6to4[b]].not_null_dc
  375. + s->above_blocks[s->above_block_idx[b]].not_null_dc;
  376. model1 = model->coeff_dccv[pt];
  377. model2 = model->coeff_dcct[pt][ctx];
  378. for (coeff_idx=0; coeff_idx<64; ) {
  379. if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
  380. /* parse a coeff */
  381. if (vp56_rac_get_prob(c, model2[2])) {
  382. if (vp56_rac_get_prob(c, model2[3])) {
  383. idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);
  384. coeff = vp56_coeff_bias[idx+5];
  385. for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
  386. coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
  387. } else {
  388. if (vp56_rac_get_prob(c, model2[4]))
  389. coeff = 3 + vp56_rac_get_prob(c, model1[5]);
  390. else
  391. coeff = 2;
  392. }
  393. ct = 2;
  394. } else {
  395. ct = 1;
  396. coeff = 1;
  397. }
  398. sign = vp56_rac_get(c);
  399. coeff = (coeff ^ -sign) + sign;
  400. if (coeff_idx)
  401. coeff *= s->dequant_ac;
  402. idx = model->coeff_index_to_pos[coeff_idx];
  403. s->block_coeff[b][permute[idx]] = coeff;
  404. run = 1;
  405. } else {
  406. /* parse a run */
  407. ct = 0;
  408. if (coeff_idx > 0) {
  409. if (!vp56_rac_get_prob(c, model2[1]))
  410. break;
  411. model3 = model->coeff_runv[coeff_idx >= 6];
  412. run = vp56_rac_get_tree(c, vp6_pcr_tree, model3);
  413. if (!run)
  414. for (run=9, i=0; i<6; i++)
  415. run += vp56_rac_get_prob(c, model3[i+8]) << i;
  416. }
  417. }
  418. cg = vp6_coeff_groups[coeff_idx+=run];
  419. model1 = model2 = model->coeff_ract[pt][ct][cg];
  420. }
  421. s->left_block[vp56_b6to4[b]].not_null_dc =
  422. s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];
  423. }
  424. }
  425. static int vp6_adjust(int v, int t)
  426. {
  427. int V = v, s = v >> 31;
  428. V ^= s;
  429. V -= s;
  430. if (V-t-1 >= (unsigned)(t-1))
  431. return v;
  432. V = 2*t - V;
  433. V += s;
  434. V ^= s;
  435. return V;
  436. }
  437. static int vp6_block_variance(uint8_t *src, int stride)
  438. {
  439. int sum = 0, square_sum = 0;
  440. int y, x;
  441. for (y=0; y<8; y+=2) {
  442. for (x=0; x<8; x+=2) {
  443. sum += src[x];
  444. square_sum += src[x]*src[x];
  445. }
  446. src += 2*stride;
  447. }
  448. return (16*square_sum - sum*sum) >> 8;
  449. }
  450. static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride,
  451. int delta, const int16_t *weights)
  452. {
  453. int x, y;
  454. for (y=0; y<8; y++) {
  455. for (x=0; x<8; x++) {
  456. dst[x] = av_clip_uint8(( src[x-delta ] * weights[0]
  457. + src[x ] * weights[1]
  458. + src[x+delta ] * weights[2]
  459. + src[x+2*delta] * weights[3] + 64) >> 7);
  460. }
  461. src += stride;
  462. dst += stride;
  463. }
  464. }
  465. static void vp6_filter_diag2(VP56Context *s, uint8_t *dst, uint8_t *src,
  466. int stride, int h_weight, int v_weight)
  467. {
  468. uint8_t *tmp = s->edge_emu_buffer+16;
  469. s->dsp.put_h264_chroma_pixels_tab[0](tmp, src, stride, 9, h_weight, 0);
  470. s->dsp.put_h264_chroma_pixels_tab[0](dst, tmp, stride, 8, 0, v_weight);
  471. }
  472. static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src,
  473. int offset1, int offset2, int stride,
  474. VP56mv mv, int mask, int select, int luma)
  475. {
  476. int filter4 = 0;
  477. int x8 = mv.x & mask;
  478. int y8 = mv.y & mask;
  479. if (luma) {
  480. x8 *= 2;
  481. y8 *= 2;
  482. filter4 = s->filter_mode;
  483. if (filter4 == 2) {
  484. if (s->max_vector_length &&
  485. (FFABS(mv.x) > s->max_vector_length ||
  486. FFABS(mv.y) > s->max_vector_length)) {
  487. filter4 = 0;
  488. } else if (s->sample_variance_threshold
  489. && (vp6_block_variance(src+offset1, stride)
  490. < s->sample_variance_threshold)) {
  491. filter4 = 0;
  492. }
  493. }
  494. }
  495. if ((y8 && (offset2-offset1)*s->flip<0) || (!y8 && offset1 > offset2)) {
  496. offset1 = offset2;
  497. }
  498. if (filter4) {
  499. if (!y8) { /* left or right combine */
  500. vp6_filter_hv4(dst, src+offset1, stride, 1,
  501. vp6_block_copy_filter[select][x8]);
  502. } else if (!x8) { /* above or below combine */
  503. vp6_filter_hv4(dst, src+offset1, stride, stride,
  504. vp6_block_copy_filter[select][y8]);
  505. } else {
  506. s->dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride,
  507. vp6_block_copy_filter[select][x8],
  508. vp6_block_copy_filter[select][y8]);
  509. }
  510. } else {
  511. if (!x8 || !y8) {
  512. s->dsp.put_h264_chroma_pixels_tab[0](dst, src+offset1, stride, 8, x8, y8);
  513. } else {
  514. vp6_filter_diag2(s, dst, src+offset1 + ((mv.x^mv.y)>>31), stride, x8, y8);
  515. }
  516. }
  517. }
  518. static av_cold int vp6_decode_init(AVCodecContext *avctx)
  519. {
  520. VP56Context *s = avctx->priv_data;
  521. vp56_init(avctx, avctx->codec->id == CODEC_ID_VP6,
  522. avctx->codec->id == CODEC_ID_VP6A);
  523. s->vp56_coord_div = vp6_coord_div;
  524. s->parse_vector_adjustment = vp6_parse_vector_adjustment;
  525. s->adjust = vp6_adjust;
  526. s->filter = vp6_filter;
  527. s->default_models_init = vp6_default_models_init;
  528. s->parse_vector_models = vp6_parse_vector_models;
  529. s->parse_coeff_models = vp6_parse_coeff_models;
  530. s->parse_header = vp6_parse_header;
  531. return 0;
  532. }
  533. AVCodec vp6_decoder = {
  534. "vp6",
  535. CODEC_TYPE_VIDEO,
  536. CODEC_ID_VP6,
  537. sizeof(VP56Context),
  538. vp6_decode_init,
  539. NULL,
  540. vp56_free,
  541. vp56_decode_frame,
  542. CODEC_CAP_DR1,
  543. .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
  544. };
  545. /* flash version, not flipped upside-down */
  546. AVCodec vp6f_decoder = {
  547. "vp6f",
  548. CODEC_TYPE_VIDEO,
  549. CODEC_ID_VP6F,
  550. sizeof(VP56Context),
  551. vp6_decode_init,
  552. NULL,
  553. vp56_free,
  554. vp56_decode_frame,
  555. CODEC_CAP_DR1,
  556. .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
  557. };
  558. /* flash version, not flipped upside-down, with alpha channel */
  559. AVCodec vp6a_decoder = {
  560. "vp6a",
  561. CODEC_TYPE_VIDEO,
  562. CODEC_ID_VP6A,
  563. sizeof(VP56Context),
  564. vp6_decode_init,
  565. NULL,
  566. vp56_free,
  567. vp56_decode_frame,
  568. CODEC_CAP_DR1,
  569. .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
  570. };