Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/vp6.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * @file libavcodec/vp6.c 2 * @file libavcodec/vp6.c
3 * VP6 compatible video decoder 3 * VP6 compatible video decoder
4 * 4 *
5 * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> 5 * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
6 * 6 *
7 * The VP6F decoder accepts an optional 1 byte extradata. It is composed of: 7 * The VP6F decoder accepts an optional 1 byte extradata. It is composed of:
8 * - upper 4bits: difference between encoded width and visible width 8 * - upper 4bits: difference between encoded width and visible width
9 * - lower 4bits: difference between encoded height and visible height 9 * - lower 4bits: difference between encoded height and visible height
10 * 10 *
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 /* first compute probabilities from model */ 221 /* first compute probabilities from model */
222 tmp[0].count = 256; 222 tmp[0].count = 256;
223 for (i=0; i<size-1; i++) { 223 for (i=0; i<size-1; i++) {
224 a = tmp[i].count * coeff_model[i] >> 8; 224 a = tmp[i].count * coeff_model[i] >> 8;
225 b = tmp[i].count * (255 - coeff_model[i]) >> 8; 225 b = tmp[i].count * (255 - coeff_model[i]) >> 8;
226 nodes[map[2*i ]].count = a + !a; 226 nodes[map[2*i ]].count = a + !a;
227 nodes[map[2*i+1]].count = b + !b; 227 nodes[map[2*i+1]].count = b + !b;
228 } 228 }
229 229
230 free_vlc(vlc);
230 /* then build the huffman tree accodring to probabilities */ 231 /* then build the huffman tree accodring to probabilities */
231 ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, 232 ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
232 FF_HUFFMAN_FLAG_HNODE_FIRST); 233 FF_HUFFMAN_FLAG_HNODE_FIRST);
233 } 234 }
234 235
235 static void vp6_parse_coeff_models(VP56Context *s) 236 static void vp6_parse_coeff_models(VP56Context *s)
236 { 237 {
237 VP56RangeCoder *c = &s->c; 238 VP56RangeCoder *c = &s->c;
238 VP56Model *model = s->modelp; 239 VP56Model *model = s->modelp;
239 int def_prob[11]; 240 int def_prob[11];
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 s->adjust = vp6_adjust; 595 s->adjust = vp6_adjust;
595 s->filter = vp6_filter; 596 s->filter = vp6_filter;
596 s->default_models_init = vp6_default_models_init; 597 s->default_models_init = vp6_default_models_init;
597 s->parse_vector_models = vp6_parse_vector_models; 598 s->parse_vector_models = vp6_parse_vector_models;
598 s->parse_coeff_models = vp6_parse_coeff_models; 599 s->parse_coeff_models = vp6_parse_coeff_models;
599 s->parse_header = vp6_parse_header; 600 s->parse_header = vp6_parse_header;
600 601
601 return 0; 602 return 0;
602 } 603 }
603 604
605 static av_cold int vp6_decode_free(AVCodecContext *avctx)
606 {
607 VP56Context *s = avctx->priv_data;
608 int pt, ct, cg;
609
610 vp56_free(avctx);
611
612 for (pt=0; pt<2; pt++) {
613 free_vlc(&s->dccv_vlc[pt]);
614 free_vlc(&s->runv_vlc[pt]);
615 for (ct=0; ct<3; ct++)
616 for (cg=0; cg<6; cg++)
617 free_vlc(&s->ract_vlc[pt][ct][cg]);
618 }
619 return 0;
620 }
621
604 AVCodec vp6_decoder = { 622 AVCodec vp6_decoder = {
605 "vp6", 623 "vp6",
606 CODEC_TYPE_VIDEO, 624 CODEC_TYPE_VIDEO,
607 CODEC_ID_VP6, 625 CODEC_ID_VP6,
608 sizeof(VP56Context), 626 sizeof(VP56Context),
609 vp6_decode_init, 627 vp6_decode_init,
610 NULL, 628 NULL,
611 vp56_free, 629 vp6_decode_free,
612 vp56_decode_frame, 630 vp56_decode_frame,
613 CODEC_CAP_DR1, 631 CODEC_CAP_DR1,
614 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"), 632 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
615 }; 633 };
616 634
617 /* flash version, not flipped upside-down */ 635 /* flash version, not flipped upside-down */
618 AVCodec vp6f_decoder = { 636 AVCodec vp6f_decoder = {
619 "vp6f", 637 "vp6f",
620 CODEC_TYPE_VIDEO, 638 CODEC_TYPE_VIDEO,
621 CODEC_ID_VP6F, 639 CODEC_ID_VP6F,
622 sizeof(VP56Context), 640 sizeof(VP56Context),
623 vp6_decode_init, 641 vp6_decode_init,
624 NULL, 642 NULL,
625 vp56_free, 643 vp6_decode_free,
626 vp56_decode_frame, 644 vp56_decode_frame,
627 CODEC_CAP_DR1, 645 CODEC_CAP_DR1,
628 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"), 646 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
629 }; 647 };
630 648
631 /* flash version, not flipped upside-down, with alpha channel */ 649 /* flash version, not flipped upside-down, with alpha channel */
632 AVCodec vp6a_decoder = { 650 AVCodec vp6a_decoder = {
633 "vp6a", 651 "vp6a",
634 CODEC_TYPE_VIDEO, 652 CODEC_TYPE_VIDEO,
635 CODEC_ID_VP6A, 653 CODEC_ID_VP6A,
636 sizeof(VP56Context), 654 sizeof(VP56Context),
637 vp6_decode_init, 655 vp6_decode_init,
638 NULL, 656 NULL,
639 vp56_free, 657 vp6_decode_free,
640 vp56_decode_frame, 658 vp56_decode_frame,
641 CODEC_CAP_DR1, 659 CODEC_CAP_DR1,
642 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channe l)"), 660 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channe l)"),
643 }; 661 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698