[vlc-devel] [PATCH 3/6] fourcc: add nvdec opaque formats

Steve Lhomme robux4 at ycbcr.xyz
Thu Sep 12 14:44:19 CEST 2019


---
 include/vlc_fourcc.h   |  5 +++++
 src/misc/fourcc.c      | 26 ++++++++++++++++++++++++++
 src/misc/fourcc_list.h |  9 +++++++++
 3 files changed, 40 insertions(+)

diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index c84466575c6..691e493eb73 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -403,6 +403,11 @@
 #define VLC_CODEC_D3D11_OPAQUE_RGBA     VLC_FOURCC('D','X','R','G')
 #define VLC_CODEC_D3D11_OPAQUE_BGRA     VLC_FOURCC('D','A','G','R')
 
+/* NVDEC opaque video format for use the NVDec API */
+#define VLC_CODEC_NVDEC_OPAQUE          VLC_FOURCC('N','V','D','8') /* 4:2:0  8 bpc */
+#define VLC_CODEC_NVDEC_OPAQUE_10B      VLC_FOURCC('N','V','D','0') /* 4:2:0 10 bpc */
+#define VLC_CODEC_NVDEC_OPAQUE_16B      VLC_FOURCC('N','V','D','6') /* 4:2:0 16 bpc */
+
 /* CVPixelBuffer opaque buffer type */
 #define VLC_CODEC_CVPX_NV12       VLC_FOURCC('C','V','P','N')
 #define VLC_CODEC_CVPX_UYVY       VLC_FOURCC('C','V','P','Y')
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index 7ce049d087e..c29fb5deebf 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -420,6 +420,22 @@ static const vlc_fourcc_t p_D3D11_OPAQUE_RGBA_fallback[] = {
     VLC_CODEC_D3D11_OPAQUE_RGBA, VLC_CODEC_RGBA, 0,
 };
 
+static const vlc_fourcc_t p_NVDEC_OPAQUE_fallback[] = {
+    VLC_CODEC_NVDEC_OPAQUE, VLC_CODEC_NV12, 0,
+};
+
+static const vlc_fourcc_t p_NVDEC_OPAQUE_10B_fallback[] = {
+    VLC_CODEC_NVDEC_OPAQUE_10B,
+    VLC_CODEC_P010,
+    VLC_CODEC_I420_10L, 0,
+};
+
+static const vlc_fourcc_t p_NVDEC_OPAQUE_16B_fallback[] = {
+    VLC_CODEC_NVDEC_OPAQUE_16B,
+    VLC_CODEC_P016, VLC_CODEC_P010,
+    VLC_CODEC_I420_16L, VLC_CODEC_I420_12L, VLC_CODEC_I420_10L, 0,
+};
+
 static const vlc_fourcc_t p_I440_fallback[] = {
     VLC_CODEC_I440,
     VLC_CODEC_YUV_PLANAR_420,
@@ -510,6 +526,9 @@ static const vlc_fourcc_t *pp_YUV_fallback[] = {
     p_D3D9_OPAQUE_10B_fallback,
     p_D3D11_OPAQUE_fallback,
     p_D3D11_OPAQUE_10B_fallback,
+    p_NVDEC_OPAQUE_fallback,
+    p_NVDEC_OPAQUE_10B_fallback,
+    p_NVDEC_OPAQUE_16B_fallback,
     NULL,
 };
 
@@ -541,6 +560,9 @@ static const vlc_fourcc_t p_list_YUV[] = {
     VLC_CODEC_D3D9_OPAQUE_10B,
     VLC_CODEC_D3D11_OPAQUE,
     VLC_CODEC_D3D11_OPAQUE_10B,
+    VLC_CODEC_NVDEC_OPAQUE,
+    VLC_CODEC_NVDEC_OPAQUE_10B,
+    VLC_CODEC_NVDEC_OPAQUE_16B,
     0,
 };
 
@@ -793,6 +815,10 @@ static const struct
         VLC_CODEC_D3D11_OPAQUE_RGBA, VLC_CODEC_D3D11_OPAQUE_BGRA },
                                                FAKE_FMT() },
 
+    { { VLC_CODEC_NVDEC_OPAQUE_16B,
+        VLC_CODEC_NVDEC_OPAQUE_10B, VLC_CODEC_NVDEC_OPAQUE },
+                                               FAKE_FMT() },
+
     { { VLC_CODEC_CVPX_NV12, VLC_CODEC_CVPX_UYVY,
         VLC_CODEC_CVPX_I420, VLC_CODEC_CVPX_BGRA },
                                                FAKE_FMT() },
diff --git a/src/misc/fourcc_list.h b/src/misc/fourcc_list.h
index fbf810b61d1..1dff2af3356 100644
--- a/src/misc/fourcc_list.h
+++ b/src/misc/fourcc_list.h
@@ -1214,6 +1214,15 @@ static const staticentry_t p_list_video[] = {
     B(VLC_CODEC_D3D11_OPAQUE_BGRA, "BGRA D3D11 opaque"),
         A("DAGR"),
 
+    B(VLC_CODEC_NVDEC_OPAQUE, "4:2:0 NVDEC opaque"),
+        A("NVD8"),
+
+    B(VLC_CODEC_NVDEC_OPAQUE_10B, "4:2:0 10bits NVDEC opaque"),
+        A("NVD0"),
+
+    B(VLC_CODEC_NVDEC_OPAQUE_16B, "4:2:0 16bits NVDEC opaque"),
+        A("NVD6"),
+
     B(VLC_CODEC_AGM, "AmuseGraphics Movie"),
         A("AGM0"),
         A("AGM1"),
-- 
2.17.1



More information about the vlc-devel mailing list