Mercurial > libavcodec.hg
comparison h263dec.c @ 936:caa77cd960c0 libavcodec
qpel encoding
4mv+b frames encoding finally fixed
chroma ME
5 comparission functions for ME
b frame encoding speedup
wmv2 codec (unfinished)
user specified diamond size for EPZS
author | michaelni |
---|---|
date | Fri, 27 Dec 2002 23:51:46 +0000 |
parents | 5bc072934017 |
children | 1e22655551b9 |
comparison
equal
deleted
inserted
replaced
935:c9bbd35064b6 | 936:caa77cd960c0 |
---|---|
38 // printf("%d\n", int(l/1000)); | 38 // printf("%d\n", int(l/1000)); |
39 return l; | 39 return l; |
40 } | 40 } |
41 #endif | 41 #endif |
42 | 42 |
43 static int h263_decode_init(AVCodecContext *avctx) | 43 int ff_h263_decode_init(AVCodecContext *avctx) |
44 { | 44 { |
45 MpegEncContext *s = avctx->priv_data; | 45 MpegEncContext *s = avctx->priv_data; |
46 | 46 |
47 s->avctx = avctx; | 47 s->avctx = avctx; |
48 s->out_format = FMT_H263; | 48 s->out_format = FMT_H263; |
111 h263_decode_init_vlc(s); | 111 h263_decode_init_vlc(s); |
112 | 112 |
113 return 0; | 113 return 0; |
114 } | 114 } |
115 | 115 |
116 static int h263_decode_end(AVCodecContext *avctx) | 116 int ff_h263_decode_end(AVCodecContext *avctx) |
117 { | 117 { |
118 MpegEncContext *s = avctx->priv_data; | 118 MpegEncContext *s = avctx->priv_data; |
119 | 119 |
120 MPV_common_end(s); | 120 MPV_common_end(s); |
121 return 0; | 121 return 0; |
341 pc->frame_start_found= vop_found; | 341 pc->frame_start_found= vop_found; |
342 pc->state= state; | 342 pc->state= state; |
343 return -1; | 343 return -1; |
344 } | 344 } |
345 | 345 |
346 static int h263_decode_frame(AVCodecContext *avctx, | 346 int ff_h263_decode_frame(AVCodecContext *avctx, |
347 void *data, int *data_size, | 347 void *data, int *data_size, |
348 UINT8 *buf, int buf_size) | 348 UINT8 *buf, int buf_size) |
349 { | 349 { |
350 MpegEncContext *s = avctx->priv_data; | 350 MpegEncContext *s = avctx->priv_data; |
351 int ret,i; | 351 int ret,i; |
414 | 414 |
415 if (!s->context_initialized) { | 415 if (!s->context_initialized) { |
416 if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix | 416 if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix |
417 return -1; | 417 return -1; |
418 } | 418 } |
419 | 419 |
420 /* let's go :-) */ | 420 /* let's go :-) */ |
421 if (s->h263_msmpeg4) { | 421 if (s->msmpeg4_version==5) { |
422 ret= ff_wmv2_decode_picture_header(s); | |
423 } else if (s->msmpeg4_version) { | |
422 ret = msmpeg4_decode_picture_header(s); | 424 ret = msmpeg4_decode_picture_header(s); |
423 } else if (s->h263_pred) { | 425 } else if (s->h263_pred) { |
424 if(s->avctx->extradata_size && s->picture_number==0){ | 426 if(s->avctx->extradata_size && s->picture_number==0){ |
425 GetBitContext gb; | 427 GetBitContext gb; |
426 | 428 |
632 if(status&MV_END) | 634 if(status&MV_END) |
633 num_end_markers--; | 635 num_end_markers--; |
634 } | 636 } |
635 if(num_end_markers || error){ | 637 if(num_end_markers || error){ |
636 fprintf(stderr, "concealing errors\n"); | 638 fprintf(stderr, "concealing errors\n"); |
637 //printf("type:%d\n", s->pict_type); | |
638 ff_error_resilience(s); | 639 ff_error_resilience(s); |
639 } | 640 } |
640 } | 641 } |
641 | 642 |
642 MPV_frame_end(s); | 643 MPV_frame_end(s); |
711 AVCodec mpeg4_decoder = { | 712 AVCodec mpeg4_decoder = { |
712 "mpeg4", | 713 "mpeg4", |
713 CODEC_TYPE_VIDEO, | 714 CODEC_TYPE_VIDEO, |
714 CODEC_ID_MPEG4, | 715 CODEC_ID_MPEG4, |
715 sizeof(MpegEncContext), | 716 sizeof(MpegEncContext), |
716 h263_decode_init, | 717 ff_h263_decode_init, |
717 NULL, | 718 NULL, |
718 h263_decode_end, | 719 ff_h263_decode_end, |
719 h263_decode_frame, | 720 ff_h263_decode_frame, |
720 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, | 721 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, |
721 }; | 722 }; |
722 | 723 |
723 AVCodec h263_decoder = { | 724 AVCodec h263_decoder = { |
724 "h263", | 725 "h263", |
725 CODEC_TYPE_VIDEO, | 726 CODEC_TYPE_VIDEO, |
726 CODEC_ID_H263, | 727 CODEC_ID_H263, |
727 sizeof(MpegEncContext), | 728 sizeof(MpegEncContext), |
728 h263_decode_init, | 729 ff_h263_decode_init, |
729 NULL, | 730 NULL, |
730 h263_decode_end, | 731 ff_h263_decode_end, |
731 h263_decode_frame, | 732 ff_h263_decode_frame, |
732 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | 733 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
733 }; | 734 }; |
734 | 735 |
735 AVCodec msmpeg4v1_decoder = { | 736 AVCodec msmpeg4v1_decoder = { |
736 "msmpeg4v1", | 737 "msmpeg4v1", |
737 CODEC_TYPE_VIDEO, | 738 CODEC_TYPE_VIDEO, |
738 CODEC_ID_MSMPEG4V1, | 739 CODEC_ID_MSMPEG4V1, |
739 sizeof(MpegEncContext), | 740 sizeof(MpegEncContext), |
740 h263_decode_init, | 741 ff_h263_decode_init, |
741 NULL, | 742 NULL, |
742 h263_decode_end, | 743 ff_h263_decode_end, |
743 h263_decode_frame, | 744 ff_h263_decode_frame, |
744 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | 745 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
745 }; | 746 }; |
746 | 747 |
747 AVCodec msmpeg4v2_decoder = { | 748 AVCodec msmpeg4v2_decoder = { |
748 "msmpeg4v2", | 749 "msmpeg4v2", |
749 CODEC_TYPE_VIDEO, | 750 CODEC_TYPE_VIDEO, |
750 CODEC_ID_MSMPEG4V2, | 751 CODEC_ID_MSMPEG4V2, |
751 sizeof(MpegEncContext), | 752 sizeof(MpegEncContext), |
752 h263_decode_init, | 753 ff_h263_decode_init, |
753 NULL, | 754 NULL, |
754 h263_decode_end, | 755 ff_h263_decode_end, |
755 h263_decode_frame, | 756 ff_h263_decode_frame, |
756 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | 757 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
757 }; | 758 }; |
758 | 759 |
759 AVCodec msmpeg4v3_decoder = { | 760 AVCodec msmpeg4v3_decoder = { |
760 "msmpeg4", | 761 "msmpeg4", |
761 CODEC_TYPE_VIDEO, | 762 CODEC_TYPE_VIDEO, |
762 CODEC_ID_MSMPEG4V3, | 763 CODEC_ID_MSMPEG4V3, |
763 sizeof(MpegEncContext), | 764 sizeof(MpegEncContext), |
764 h263_decode_init, | 765 ff_h263_decode_init, |
765 NULL, | 766 NULL, |
766 h263_decode_end, | 767 ff_h263_decode_end, |
767 h263_decode_frame, | 768 ff_h263_decode_frame, |
768 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | 769 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
769 }; | 770 }; |
770 | 771 |
771 AVCodec wmv1_decoder = { | 772 AVCodec wmv1_decoder = { |
772 "wmv1", | 773 "wmv1", |
773 CODEC_TYPE_VIDEO, | 774 CODEC_TYPE_VIDEO, |
774 CODEC_ID_WMV1, | 775 CODEC_ID_WMV1, |
775 sizeof(MpegEncContext), | 776 sizeof(MpegEncContext), |
776 h263_decode_init, | 777 ff_h263_decode_init, |
777 NULL, | 778 NULL, |
778 h263_decode_end, | 779 ff_h263_decode_end, |
779 h263_decode_frame, | 780 ff_h263_decode_frame, |
780 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | |
781 }; | |
782 | |
783 AVCodec wmv2_decoder = { | |
784 "wmv2", | |
785 CODEC_TYPE_VIDEO, | |
786 CODEC_ID_WMV2, | |
787 sizeof(MpegEncContext), | |
788 h263_decode_init, | |
789 NULL, | |
790 h263_decode_end, | |
791 h263_decode_frame, | |
792 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | 781 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
793 }; | 782 }; |
794 | 783 |
795 AVCodec h263i_decoder = { | 784 AVCodec h263i_decoder = { |
796 "h263i", | 785 "h263i", |
797 CODEC_TYPE_VIDEO, | 786 CODEC_TYPE_VIDEO, |
798 CODEC_ID_H263I, | 787 CODEC_ID_H263I, |
799 sizeof(MpegEncContext), | 788 sizeof(MpegEncContext), |
800 h263_decode_init, | 789 ff_h263_decode_init, |
801 NULL, | 790 NULL, |
802 h263_decode_end, | 791 ff_h263_decode_end, |
803 h263_decode_frame, | 792 ff_h263_decode_frame, |
804 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | 793 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
805 }; | 794 }; |
806 | 795 |