[VDPAU] [PATCH 1/1] Add new frame and field mode chroma types. Add VdpDecoderQueryProfileCapability API

Manoj Bonda mbonda at nvidia.com
Wed Oct 31 11:11:56 UTC 2018


Please review the proposed API changes for adding 
Add new frame and field mode chroma types. Add VdpDecoderQueryProfileCapability API



Thanks,
ManojGupta.

-----Original Message-----
From: Manoj Bonda 
Sent: Wednesday, October 17, 2018 5:46 PM
To: vdpau at lists.freedesktop.org
Cc: Manoj Bonda <mbonda at nvidia.com>
Subject: [PATCH 1/1] [VDPAU] Add new frame and field mode chroma types. Add VdpDecoderQueryProfileCapability API

From: manoj <mbonda at nvidia.com>

Chroma types :
    VDP_CHROMA_TYPE_420
    VDP_CHROMA_TYPE_422
    VDP_CHROMA_TYPE_444

already exist, surfaces of these types could be transparently used with any VdpVideoDecoder. The implementation is free to internally convert the surface between frame/field(NV12/NV24) as required by VdpVideoDecoder operation. The interop API would allow registration of these surfaces for either field or frame based interop.

This change adds new enums for frame and field chroma types:
    VDP_CHROMA_TYPE_420_FIELD
    VDP_CHROMA_TYPE_422_FIELD
    VDP_CHROMA_TYPE_444_FIELD
    VDP_CHROMA_TYPE_420_FRAME
    VDP_CHROMA_TYPE_422_FRAME
    VDP_CHROMA_TYPE_444_FRAME

So that frame/field based video surfaces can be created and exposed via VDPAU OpenGL interop.

The new chroma types could only be used by a VdpVideoDecoder that supports output to field/frame surfaces respectively. Internal surface convertion is not allowed. The interop API would allow registration of these surfaces to field/frame based interop only. This will avoid implicit conversions and allocation of shadow surface.

Existing VdpDecoderQueryCapabilities() returns maxlevel, maxwidth, height and macro blocks for a given decoder profile. Since it is not possible to extend this API to return more capabilities, adding new API VdpDecoderQueryProfileCapability(). In this change, new API will be able to return supported picture structure along with other existing capabilities.

VdpDecoderQueryProfileCapability() can be extended in future to query newer capabilities exposed. VdpDecoderCapabilities defines the capabilities that can be queried.

This function returns queried capability of the requested profile on the underlying h/w. By design, only one capability can be queried at a time.
---
 include/vdpau/vdpau.h | 93 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 90 insertions(+), 3 deletions(-)

diff --git a/include/vdpau/vdpau.h b/include/vdpau/vdpau.h index 0bc5b60..3e5a980 100644
--- a/include/vdpau/vdpau.h
+++ b/include/vdpau/vdpau.h
@@ -838,13 +838,66 @@ typedef int VdpBool;
  */
 typedef uint32_t VdpChromaType;
 
-/** \hideinitializer \brief 4:2:0 chroma format. */
+/** \hideinitializer \brief 4:2:0 chroma format. Undefined field/frame 
+based
+ *  Video surfaces allocated with this chroma type have undefined
+ *  field/frame structure. The implementation is free to internally 
+morph
+ *  the surface between frame/field(NV12/NV24) as required by
+ *  VdpVideoDecoder operation. Interop with OpenGL allows registration
+ *  of these surfaces for either field- or frame-based interop. But, an 
+implicit
+ *  field/frame structure conversion may be performed.
+ */
 #define VDP_CHROMA_TYPE_420 ((VdpChromaType)0)
-/** \hideinitializer \brief 4:2:2 chroma format. */
+/** \hideinitializer \brief 4:2:2 chroma format. Undefined field/frame 
+based
+ *  Video surfaces allocated with this chroma type have undefined
+ *  field/frame structure. The implementation is free to internally 
+morph
+ *  the surface between frame/field(NV12/NV24) as required by
+ *  VdpVideoDecoder operation. Interop with OpenGL allows registration
+ *  of these surfaces for either field- or frame-based interop. But, an 
+implicit
+ *  field/frame structure conversion may be performed.
+ */
 #define VDP_CHROMA_TYPE_422 ((VdpChromaType)1)
-/** \hideinitializer \brief 4:4:4 chroma format. */
+/** \hideinitializer \brief 4:4:4 chroma format. Undefined field/frame 
+based
+ *  Video surfaces allocated with this chroma type have undefined
+ *  field/frame structure. The implementation is free to internally 
+morph
+ *  the surface between frame/field(NV12/NV24) as required by
+ *  VdpVideoDecoder operation. Interop with OpenGL allows registration
+ *  of these surfaces for either field- or frame-based interop. But, an 
+implicit
+ *  field/frame structure conversion may be performed.
+ */
 #define VDP_CHROMA_TYPE_444 ((VdpChromaType)2)
 
+/** \hideinitializer \brief 4:2:0 chroma format. Field based.
+ *  Video surfaces allocated with this chroma type can only be
+ *  interoped with OpenGL if the matching field/frame structure is
+ *  specified in the OpenGL API */
+#define VDP_CHROMA_TYPE_420_FIELD ((VdpChromaType)3)
+/** \hideinitializer \brief 4:2:2 chroma format. Field based.
+ *  Video surfaces allocated with this chroma type can only be
+ *  interoped with OpenGL if the matching field/frame structure is
+ *  specified in the OpenGL API */
+#define VDP_CHROMA_TYPE_422_FIELD ((VdpChromaType)4)
+/** \hideinitializer \brief 4:4:4 chroma format. Field based.
+ *  Video surfaces allocated with this chroma type can only be
+ *  interoped with OpenGL if the matching field/frame structure is
+ *  specified in the OpenGL API */
+#define VDP_CHROMA_TYPE_444_FIELD ((VdpChromaType)5)
+
+/** \hideinitializer \brief 4:2:0 chroma format. Frame based.
+ *  Video surfaces allocated with this chroma type can only be
+ *  interoped with OpenGL if the matching field/frame structure is
+ *  specified in the OpenGL API */
+#define VDP_CHROMA_TYPE_420_FRAME ((VdpChromaType)6)
+/** \hideinitializer \brief 4:2:2 chroma format. Frame based.
+ *  Video surfaces allocated with this chroma type can only be
+ *  interoped with OpenGL if the matching field/frame structure is
+ *  specified in the OpenGL API */
+#define VDP_CHROMA_TYPE_422_FRAME ((VdpChromaType)7)
+/** \hideinitializer \brief 4:4:4 chroma format. Frame based.
+ *  Video surfaces allocated with this chroma type can only be
+ *  interoped with OpenGL if the matching field/frame structure is
+ *  specified in the OpenGL API */
+#define VDP_CHROMA_TYPE_444_FRAME ((VdpChromaType)8)
+
 /**
  * \brief The set of all known YCbCr surface formats.
  */
@@ -2620,6 +2673,38 @@ typedef uint32_t VdpDecoderProfile;
 /** \hideinitializer */
 #define VDP_DECODER_LEVEL_HEVC_6_2      186
 
+typedef enum {
+    VDP_VIDEO_SURFACE_FIELD         = (1 << 0),
+    VDP_VIDEO_SURFACE_FRAME         = (1 << 1)
+} VdpVideoSurfaceSupportedType;
+
+typedef enum {
+    VDP_DECODER_PROFILE_MAX_LEVEL                   = 0,
+    VDP_DECODER_PROFILE_MAX_MACROBLOCKS             = 1,
+    VDP_DECODER_PROFILE_MAX_WIDTH                   = 2,
+    VDP_DECODER_PROFILE_MAX_HEIGHT                  = 3,
+    VDP_DECODER_PROFILE_SUPPORTED_SURFACE_FORMAT    = 4
+} VdpDecoderCapabilities;
+
+/**
+  * \brief Query the supported value of the requested capability, for
+  *       the specified profile on the specified device.
+  * \param[in] device The device to query.
+  * \param[in] profile The decoder profile for which information is requested.
+  * \param[in] capability The decoder profile capability for which the value
+  *       is requested.
+  * \param[out] capability_value The value of the requested capability.
+  * \return VdpStatus The completion status of the operation.
+  */
+
+typedef VdpStatus VdpDecoderQueryProfileCapability(
+    VdpDevice                   device,
+    VdpDecoderProfile           profile,
+    /* output parameters follow */
+    VdpDecoderCapabilities      capability,
+    void *                      capability_value
+);
+
 /**
  * \brief Query the implementation's VdpDecoder capabilities.
  * \param[in] device The device to query.
@@ -4587,6 +4672,8 @@ typedef uint32_t VdpFuncId;
 #define VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS                     ((VdpFuncId)65)
 /** \hideinitializer */
 #define VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER                                ((VdpFuncId)66)
+/** \hideinitializer */
+#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITY                                    ((VdpFuncId)67)
 
 #define VDP_FUNC_ID_BASE_WINSYS 0x1000
 
--
2.19.1



More information about the VDPAU mailing list