]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/hevcdec: Add VDPAU to list of supported formats
authorManojGuptaBonda <mbonda@nvidia.com>
Sat, 27 Jun 2020 13:34:22 +0000 (19:04 +0530)
committerPhilip Langdale <philipl@overt.org>
Fri, 10 Jul 2020 03:54:11 +0000 (20:54 -0700)
Added VDPAU to list of supported formats for HEVC10 and 12 bit formats
also added 42010 bit to surface_parameters and new VDP chroma formats to
VDPAUPixFmtMaps

Add HEVC 420 10/12 Bit  and 444 10/12 Bit support for VDPAU

YUV444P10 is defined as the 444 surface with 10bit valid data in LSBs
but H/w returns Data in MSBs Hence if we map output as YUV444p16 it
is filtering out the LSB to convert to p10 format.

Signed-off-by: Philip Langdale <philipl@overt.org>
Changelog
libavcodec/hevcdec.c
libavcodec/vdpau.c
libavcodec/version.h
libavutil/hwcontext_vdpau.c

index b8212635ace0a3e63610c6a33cbcb38ee9870cfe..49fc2604585573378c338b6eeca7c953c5793c46 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,7 @@ version <next>:
 - MacCaption demuxer
 - PGX decoder
 - chromanr video filter
+- VDPAU accelerated HEVC 10/12bit decoding
 
 
 version 4.3:
index 369181480582f6e4cbc42ef065ccb0354c0aa3cd..b77df8d89f6c494796ad1a9a5528c8e2b5093074 100644 (file)
@@ -424,6 +424,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
         *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
 #endif
+#if CONFIG_HEVC_VDPAU_HWACCEL
+        *fmt++ = AV_PIX_FMT_VDPAU;
+#endif
 #if CONFIG_HEVC_NVDEC_HWACCEL
         *fmt++ = AV_PIX_FMT_CUDA;
 #endif
@@ -445,6 +448,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
     case AV_PIX_FMT_YUV420P12:
     case AV_PIX_FMT_YUV444P10:
     case AV_PIX_FMT_YUV444P12:
+#if CONFIG_HEVC_VDPAU_HWACCEL
+        *fmt++ = AV_PIX_FMT_VDPAU;
+#endif
 #if CONFIG_HEVC_NVDEC_HWACCEL
         *fmt++ = AV_PIX_FMT_CUDA;
 #endif
index 167f06d7aebbf10768b3a93ff235b680f25b12b1..fa10905c756674c1e90107e2c9e8d4a7840f3270 100644 (file)
@@ -83,6 +83,8 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx,
     switch (avctx->sw_pix_fmt) {
     case AV_PIX_FMT_YUV420P:
     case AV_PIX_FMT_YUVJ420P:
+    case AV_PIX_FMT_YUV420P10:
+    case AV_PIX_FMT_YUV420P12:
         t = VDP_CHROMA_TYPE_420;
         w = (w + 1) & ~1;
         h = (h + 3) & ~3;
@@ -95,6 +97,8 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx,
         break;
     case AV_PIX_FMT_YUV444P:
     case AV_PIX_FMT_YUVJ444P:
+    case AV_PIX_FMT_YUV444P10:
+    case AV_PIX_FMT_YUV444P12:
         t = VDP_CHROMA_TYPE_444;
         h = (h + 1) & ~1;
         break;
index 482cc6d6ba61767ceadd38ae49649689bb6c8397..e75891d4637be360f021c75110b82e01030494e7 100644 (file)
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  94
+#define LIBAVCODEC_VERSION_MINOR  95
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
index 6b8c1d5f7677af3f97b7c62f007fb39edc41ace2..dbef5495aff94823077638c7f935dbf05036c646 100644 (file)
@@ -39,8 +39,8 @@ typedef struct VDPAUDeviceContext {
     VdpVideoSurfaceCreate                           *surf_create;
     VdpVideoSurfaceDestroy                          *surf_destroy;
 
-    enum AVPixelFormat *pix_fmts[3];
-    int              nb_pix_fmts[3];
+    enum AVPixelFormat *pix_fmts[8];
+    int              nb_pix_fmts[8];
 } VDPAUDeviceContext;
 
 typedef struct VDPAUFramesContext {
@@ -61,6 +61,10 @@ typedef struct VDPAUPixFmtMap {
 static const VDPAUPixFmtMap pix_fmts_420[] = {
     { VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV12    },
     { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV420P },
+#ifdef VDP_YCBCR_FORMAT_P016
+    { VDP_YCBCR_FORMAT_P016, AV_PIX_FMT_P016    },
+    { VDP_YCBCR_FORMAT_P010, AV_PIX_FMT_P010    },
+#endif
     { 0,                     AV_PIX_FMT_NONE,   },
 };
 
@@ -75,6 +79,9 @@ static const VDPAUPixFmtMap pix_fmts_422[] = {
 static const VDPAUPixFmtMap pix_fmts_444[] = {
 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
     { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },
+#endif
+#ifdef VDP_YCBCR_FORMAT_P016
+    {VDP_YCBCR_FORMAT_Y_U_V_444_16, AV_PIX_FMT_YUV444P16},
 #endif
     { 0,                          AV_PIX_FMT_NONE,   },
 };
@@ -87,6 +94,13 @@ static const struct {
     { VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUV420P, pix_fmts_420 },
     { VDP_CHROMA_TYPE_422, AV_PIX_FMT_YUV422P, pix_fmts_422 },
     { VDP_CHROMA_TYPE_444, AV_PIX_FMT_YUV444P, pix_fmts_444 },
+#ifdef VDP_YCBCR_FORMAT_P016
+    { VDP_CHROMA_TYPE_420_16, AV_PIX_FMT_YUV420P10, pix_fmts_420 },
+    { VDP_CHROMA_TYPE_420_16, AV_PIX_FMT_YUV420P12, pix_fmts_420 },
+    { VDP_CHROMA_TYPE_422_16, AV_PIX_FMT_YUV422P10, pix_fmts_422 },
+    { VDP_CHROMA_TYPE_444_16, AV_PIX_FMT_YUV444P10, pix_fmts_444 },
+    { VDP_CHROMA_TYPE_444_16, AV_PIX_FMT_YUV444P12, pix_fmts_444 },
+#endif
 };
 
 static int count_pixfmts(const VDPAUPixFmtMap *map)
@@ -354,6 +368,9 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
     if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
             || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
+#endif
+#ifdef VDP_YCBCR_FORMAT_P016
+            || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444_16)
 #endif
             )
         FFSWAP(void*, data[1], data[2]);