comparison h263dec.c @ 10509:cdf5b1ed3500 libavcodec

Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used by video players. Original patch by NVIDIA corporation.
author cehoyos
date Tue, 10 Nov 2009 18:52:39 +0000
parents 8cf141fae2f3
children 95f3daa991a2
comparison
equal deleted inserted replaced
10508:f33404f82b9e 10509:cdf5b1ed3500
30 #include "dsputil.h" 30 #include "dsputil.h"
31 #include "mpegvideo.h" 31 #include "mpegvideo.h"
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 36
36 //#define DEBUG 37 //#define DEBUG
37 //#define PRINT_FRAME_TIME 38 //#define PRINT_FRAME_TIME
38 39
39 av_cold int ff_h263_decode_init(AVCodecContext *avctx) 40 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
619 } 620 }
620 621
621 if(MPV_frame_start(s, avctx) < 0) 622 if(MPV_frame_start(s, avctx) < 0)
622 return -1; 623 return -1;
623 624
625 if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
626 ff_vdpau_mpeg4_decode_picture(s, buf, buf_size);
627 goto frame_end;
628 }
629
624 if (avctx->hwaccel) { 630 if (avctx->hwaccel) {
625 if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) 631 if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
626 return -1; 632 return -1;
627 } 633 }
628 634
693 } 699 }
694 700
695 intrax8_decoded: 701 intrax8_decoded:
696 ff_er_frame_end(s); 702 ff_er_frame_end(s);
697 703
704 frame_end:
698 if (avctx->hwaccel) { 705 if (avctx->hwaccel) {
699 if (avctx->hwaccel->end_frame(avctx) < 0) 706 if (avctx->hwaccel->end_frame(avctx) < 0)
700 return -1; 707 return -1;
701 } 708 }
702 709
833 ff_h263_decode_frame, 840 ff_h263_decode_frame,
834 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, 841 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
835 .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"), 842 .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
836 .pix_fmts= ff_pixfmt_list_420, 843 .pix_fmts= ff_pixfmt_list_420,
837 }; 844 };
845
846 #if CONFIG_MPEG4_VDPAU_DECODER
847 AVCodec mpeg4_vdpau_decoder = {
848 "mpeg4_vdpau",
849 CODEC_TYPE_VIDEO,
850 CODEC_ID_MPEG4,
851 sizeof(MpegEncContext),
852 ff_h263_decode_init,
853 NULL,
854 ff_h263_decode_end,
855 ff_h263_decode_frame,
856 CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
857 .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
858 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE},
859 };
860 #endif