[FFmpeg-cvslog] lavc: Add hardware config metadata for decoders supporting hardware output
ffmpeg | branch: master | Mark Thompson| Thu Oct 26 00:18:40 2017 +0100| [2fcb0090115f7fc7648ad241a5903f866760d4b6] | committer: Mark Thompson lavc: Add hardware config metadata for decoders supporting hardware output This includes a pointer to the associated hwaccel for decoders using hwaccels - these will be used later to implement the hwaccel setup without needing a global list. Also added is a new file listing all hwaccels as external declarations - this will be used later to generate the hwaccel list at configure time. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fcb0090115f7fc7648ad241a5903f866760d4b6 --- libavcodec/h263dec.c | 10 libavcodec/h264dec.c | 28 ++ libavcodec/hevcdec.c | 22 + libavcodec/hwaccel.h | 38 + libavcodec/hwaccels.h | 59 ++ libavcodec/mmaldec.c | 7 ++ libavcodec/mpeg12dec.c | 27 - libavcodec/mpeg4videodec.c | 10 libavcodec/qsvdec.c| 13 ++ libavcodec/qsvdec.h| 3 +++ libavcodec/qsvdec_h2645.c | 2 ++ libavcodec/qsvdec_other.c | 3 +++ libavcodec/vc1dec.c| 37 + libavcodec/vp8.c | 7 ++ 14 files changed, 265 insertions(+), 1 deletion(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 921ff5fb98..b883c1 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -31,6 +31,7 @@ #include "flv.h" #include "h263.h" #include "h263_parser.h" +#include "hwaccel.h" #include "internal.h" #include "mpeg_er.h" #include "mpeg4video.h" @@ -677,4 +678,13 @@ AVCodec ff_h263_decoder = { AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY, .flush = ff_mpeg_flush, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420, +.hw_configs = (const AVCodecHWConfigInternal*[]) { +#if CONFIG_H263_VAAPI_HWACCEL +HWACCEL_VAAPI(h263), +#endif +#if CONFIG_MPEG4_VDPAU_HWACCEL +HWACCEL_VDPAU(mpeg4), +#endif +NULL +}, }; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 7a8293efa5..4bfd78962d 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -44,6 +44,7 @@ #include "h264chroma.h" #include "h264_mvpred.h" #include "h264_ps.h" +#include "hwaccel.h" #include "mathops.h" #include "me_cmp.h" #include "mpegutils.h" @@ -786,6 +787,33 @@ AVCodec ff_h264_decoder = { .capabilities = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS, +.hw_configs= (const AVCodecHWConfigInternal*[]) { +#if CONFIG_H264_CUVID_HWACCEL + HWACCEL_CUVID(h264), +#endif +#if CONFIG_H264_DXVA2_HWACCEL + HWACCEL_DXVA2(h264), +#endif +#if CONFIG_H264_D3D11VA_HWACCEL + HWACCEL_D3D11VA(h264), +#endif +#if CONFIG_H264_D3D11VA2_HWACCEL + HWACCEL_D3D11VA2(h264), +#endif +#if CONFIG_H264_VAAPI_HWACCEL + HWACCEL_VAAPI(h264), +#endif +#if CONFIG_H264_VDPAU_HWACCEL + HWACCEL_VDPAU(h264), +#endif +#if CONFIG_H264_VDA_HWACCEL + HW_CONFIG_HWACCEL(0, 0, 1, VDA, NONE, ff_h264_vda_hwaccel), +#endif +#if CONFIG_H264_VDA_OLD_HWACCEL + HW_CONFIG_HWACCEL(0, 0, 1, VDA_VLD, NONE, ff_h264_vda_old_hwaccel), +#endif + NULL + }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING, .flush = flush_dpb, .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f1d1c77497..130b99f77e 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -39,6 +39,7 @@ #include "hevc.h" #include "hevc_data.h" #include "hevcdec.h" +#include "hwaccel.h" #include "profiles.h" const uint8_t ff_hevc_qpel_extra_before[4] = { 0, 3, 3, 3 }; @@ -3120,4 +3121,25 @@ AVCodec ff_hevc_decoder = { AV_CODEC_CAP_FRAME_THREADS, .profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles), .caps_internal = FF_CODEC_CAP_EXPORTS_CROPPING | FF_CODEC_CAP_INIT_THREADSAFE, +.hw_configs= (const AVCodecHWConfigInternal*[]) { +#if CONFIG_HEVC_CUVID_HWACCEL + HWACCEL_CUVID(hevc), +#endif +#if CONFIG_HEVC_DXVA2_HWACCEL + HWACCEL_DXVA2(hevc), +#endif +#if CONFIG_HEVC_D3D11VA_HWACCEL + HWACCEL_D3D11VA(hevc), +#endif +#if CONFIG_HEVC_D3D11VA2_HWACCEL +
[FFmpeg-cvslog] lavc: Add hardware config metadata for decoders supporting hardware output
ffmpeg | branch: master | Mark Thompson| Thu Oct 26 00:18:40 2017 +0100| [758fbc54fef2f31957b5c5f22e05e5fd9b04f631] | committer: Mark Thompson lavc: Add hardware config metadata for decoders supporting hardware output This includes a pointer to the associated hwaccel for decoders using hwaccels - these will be used later to implement the hwaccel setup without needing a global list. Also added is a new file listing all hwaccels as external declarations - this will be used later to generate the hwaccel list at configure time. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=758fbc54fef2f31957b5c5f22e05e5fd9b04f631 --- libavcodec/cuviddec.c | 15 ++ libavcodec/h263dec.c | 13 libavcodec/h264dec.c | 25 libavcodec/hevcdec.c | 25 libavcodec/hwaccel.h | 52 libavcodec/hwaccels.h | 74 ++ libavcodec/mediacodecdec.c | 18 +++ libavcodec/mmaldec.c | 7 + libavcodec/mpeg12dec.c | 45 +++- libavcodec/mpeg4videodec.c | 16 ++ libavcodec/qsvdec.c| 13 libavcodec/qsvdec.h| 3 ++ libavcodec/qsvdec_h2645.c | 2 ++ libavcodec/qsvdec_other.c | 3 ++ libavcodec/vc1dec.c| 43 +++ libavcodec/vp9.c | 19 16 files changed, 372 insertions(+), 1 deletion(-) diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index 806dab2074..3bd2409ea2 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -32,6 +32,7 @@ #include "avcodec.h" #include "decode.h" +#include "hwaccel.h" #include "internal.h" typedef struct CuvidContext @@ -1094,6 +1095,19 @@ static const AVOption options[] = { { NULL } }; +static const AVCodecHWConfigInternal *cuvid_hw_configs[] = { +&(const AVCodecHWConfigInternal) { +.public = { +.pix_fmt = AV_PIX_FMT_CUDA, +.methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX | + AV_CODEC_HW_CONFIG_METHOD_INTERNAL, +.device_type = AV_HWDEVICE_TYPE_CUDA +}, +.hwaccel = NULL, +}, +NULL +}; + #define DEFINE_CUVID_CODEC(x, X) \ static const AVClass x##_cuvid_class = { \ .class_name = #x "_cuvid", \ @@ -1127,6 +1141,7 @@ static const AVOption options[] = { AV_PIX_FMT_P010, \ AV_PIX_FMT_P016, \ AV_PIX_FMT_NONE }, \ +.hw_configs = cuvid_hw_configs, \ }; #if CONFIG_HEVC_CUVID_DECODER diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index b222de793b..5608b63245 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -33,6 +33,7 @@ #include "flv.h" #include "h263.h" #include "h263_parser.h" +#include "hwaccel.h" #include "internal.h" #include "mpeg_er.h" #include "mpeg4video.h" @@ -759,4 +760,16 @@ AVCodec ff_h263p_decoder = { .flush = ff_mpeg_flush, .max_lowres = 3, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420, +.hw_configs = (const AVCodecHWConfigInternal*[]) { +#if CONFIG_H263_VAAPI_HWACCEL +HWACCEL_VAAPI(h263), +#endif +#if CONFIG_MPEG4_VDPAU_HWACCEL +HWACCEL_VDPAU(mpeg4), +#endif +#if CONFIG_H263_VIDEOTOOLBOX_HWACCEL +HWACCEL_VIDEOTOOLBOX(h263), +#endif +NULL +}, }; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index be187eb5f4..b03024d4a3 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -47,6 +47,7 @@ #include "h264_mvpred.h" #include "h264_ps.h" #include "golomb.h" +#include "hwaccel.h" #include "mathops.h" #include "me_cmp.h" #include "mpegutils.h" @@ -1059,6 +1060,30 @@ AVCodec ff_h264_decoder = { .capabilities = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS, +.hw_configs= (const AVCodecHWConfigInternal*[]) { +#if CONFIG_H264_DXVA2_HWACCEL + HWACCEL_DXVA2(h264), +#endif +#if CONFIG_H264_D3D11VA_HWACCEL + HWACCEL_D3D11VA(h264), +#endif +#if CONFIG_H264_D3D11VA2_HWACCEL + HWACCEL_D3D11VA2(h264), +#endif +#if CONFIG_H264_NVDEC_HWACCEL + HWACCEL_NVDEC(h264), +#endif +#if CONFIG_H264_VAAPI_HWACCEL + HWACCEL_VAAPI(h264), +#endif +#if CONFIG_H264_VDPAU_HWACCEL + HWACCEL_VDPAU(h264), +#endif +#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL + HWACCEL_VIDEOTOOLBOX(h264), +#endif +