Re: [FFmpeg-devel] [PATCH 02/17] lavc: Add hardware config metadata for decoders supporting hardware output

2017-11-24 Thread Philip Langdale
On Fri, 24 Nov 2017 00:51:19 +
Mark Thompson  wrote:

> 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. ---
>  libavcodec/cuviddec.c  | 15 ++
>  libavcodec/h263dec.c   | 13 
>  libavcodec/h264dec.c   | 25 
>  libavcodec/hevcdec.c   | 25 
>  libavcodec/hwaccel.h   | 50 +++
>  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, 370 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/hwaccels.h
> 
> 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
> +   NULL
> +   },
>  .caps

Re: [FFmpeg-devel] [PATCH 02/17] lavc: Add hardware config metadata for decoders supporting hardware output

2017-11-24 Thread Timo Rothenpieler

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


ok



smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 02/17] lavc: Add hardware config metadata for decoders supporting hardware output

2017-11-23 Thread Mark Thompson
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.
---
 libavcodec/cuviddec.c  | 15 ++
 libavcodec/h263dec.c   | 13 
 libavcodec/h264dec.c   | 25 
 libavcodec/hevcdec.c   | 25 
 libavcodec/hwaccel.h   | 50 +++
 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, 370 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/hwaccels.h

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
+   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