comparison h263dec.c @ 10803:4605bd2fdb7f libavcodec

Split the mpeg4 encoder and decoder off h263.c
author michael
date Thu, 07 Jan 2010 23:53:49 +0000
parents 13c67390a846
children c03a8c6c755b
comparison
equal deleted inserted replaced
10802:4f614b69b4e5 10803:4605bd2fdb7f
32 #include "h263_parser.h" 32 #include "h263_parser.h"
33 #include "mpeg4video_parser.h" 33 #include "mpeg4video_parser.h"
34 #include "msmpeg4.h" 34 #include "msmpeg4.h"
35 #include "vdpau_internal.h" 35 #include "vdpau_internal.h"
36 #include "flv.h" 36 #include "flv.h"
37 #include "mpeg4video.h"
37 38
38 //#define DEBUG 39 //#define DEBUG
39 //#define PRINT_FRAME_TIME 40 //#define PRINT_FRAME_TIME
40 41
41 av_cold int ff_h263_decode_init(AVCodecContext *avctx) 42 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
62 case CODEC_ID_H263: 63 case CODEC_ID_H263:
63 s->unrestricted_mv= 0; 64 s->unrestricted_mv= 0;
64 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; 65 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
65 break; 66 break;
66 case CODEC_ID_MPEG4: 67 case CODEC_ID_MPEG4:
67 s->decode_mb= ff_mpeg4_decode_mb;
68 s->time_increment_bits = 4; /* default value for broken headers */
69 s->h263_pred = 1;
70 s->low_delay = 0; //default, might be overriden in the vol header during header parsing
71 avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
72 break; 68 break;
73 case CODEC_ID_MSMPEG4V1: 69 case CODEC_ID_MSMPEG4V1:
74 s->h263_msmpeg4 = 1; 70 s->h263_msmpeg4 = 1;
75 s->h263_pred = 1; 71 s->h263_pred = 1;
76 s->msmpeg4_version=1; 72 s->msmpeg4_version=1;
728 av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time); 724 av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
729 #endif 725 #endif
730 726
731 return get_consumed_bytes(s, buf_size); 727 return get_consumed_bytes(s, buf_size);
732 } 728 }
733
734 AVCodec mpeg4_decoder = {
735 "mpeg4",
736 CODEC_TYPE_VIDEO,
737 CODEC_ID_MPEG4,
738 sizeof(MpegEncContext),
739 ff_h263_decode_init,
740 NULL,
741 ff_h263_decode_end,
742 ff_h263_decode_frame,
743 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
744 .flush= ff_mpeg_flush,
745 .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
746 .pix_fmts= ff_hwaccel_pixfmt_list_420,
747 };
748 729
749 AVCodec h263_decoder = { 730 AVCodec h263_decoder = {
750 "h263", 731 "h263",
751 CODEC_TYPE_VIDEO, 732 CODEC_TYPE_VIDEO,
752 CODEC_ID_H263, 733 CODEC_ID_H263,
814 ff_h263_decode_frame, 795 ff_h263_decode_frame,
815 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, 796 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
816 .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"), 797 .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
817 .pix_fmts= ff_pixfmt_list_420, 798 .pix_fmts= ff_pixfmt_list_420,
818 }; 799 };
819
820 #if CONFIG_MPEG4_VDPAU_DECODER
821 AVCodec mpeg4_vdpau_decoder = {
822 "mpeg4_vdpau",
823 CODEC_TYPE_VIDEO,
824 CODEC_ID_MPEG4,
825 sizeof(MpegEncContext),
826 ff_h263_decode_init,
827 NULL,
828 ff_h263_decode_end,
829 ff_h263_decode_frame,
830 CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
831 .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
832 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE},
833 };
834 #endif