cuda: Add YUY2 and UYVY formats for GL interop

Those formats are not supported conversion formats by CUDA convert/scale elements
but would be useful for GL <-> CUDA interop use case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2691>
This commit is contained in:
Seungha Yang 2022-06-30 16:45:46 +09:00 committed by GStreamer Marge Bot
parent d9f08e17f1
commit ce82c0570e
3 changed files with 12 additions and 4 deletions

View file

@ -185,6 +185,8 @@ gst_cuda_allocator_alloc_internal (GstCudaAllocator * self,
case GST_VIDEO_FORMAT_BGR: case GST_VIDEO_FORMAT_BGR:
case GST_VIDEO_FORMAT_BGR10A2_LE: case GST_VIDEO_FORMAT_BGR10A2_LE:
case GST_VIDEO_FORMAT_RGB10A2_LE: case GST_VIDEO_FORMAT_RGB10A2_LE:
case GST_VIDEO_FORMAT_YUY2:
case GST_VIDEO_FORMAT_UYVY:
alloc_info->stride[0] = pitch; alloc_info->stride[0] = pitch;
alloc_info->offset[0] = 0; alloc_info->offset[0] = 0;
break; break;

View file

@ -40,18 +40,22 @@
GST_DEBUG_CATEGORY_STATIC (gst_cuda_base_filter_debug); GST_DEBUG_CATEGORY_STATIC (gst_cuda_base_filter_debug);
#define GST_CAT_DEFAULT gst_cuda_base_filter_debug #define GST_CAT_DEFAULT gst_cuda_base_filter_debug
#define GST_CUDA_FILTER_FORMATS \
"{ I420, YV12, NV12, NV21, P010_10LE, P016_LE, I420_10LE, Y444, Y444_16LE, " \
"BGRA, RGBA, RGBx, BGRx, ARGB, ABGR, RGB, BGR, BGR10A2_LE, RGB10A2_LE, Y42B, I422_10LE, I422_12LE }"
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, GST_CUDA_FORMATS)) (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, GST_CUDA_FILTER_FORMATS))
); );
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, GST_CUDA_FORMATS)) (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, GST_CUDA_FILTER_FORMATS))
); );
#define gst_cuda_base_filter_parent_class parent_class #define gst_cuda_base_filter_parent_class parent_class

View file

@ -25,11 +25,13 @@ G_BEGIN_DECLS
#define GST_CUDA_FORMATS \ #define GST_CUDA_FORMATS \
"{ I420, YV12, NV12, NV21, P010_10LE, P016_LE, I420_10LE, Y444, Y444_16LE, " \ "{ I420, YV12, NV12, NV21, P010_10LE, P016_LE, I420_10LE, Y444, Y444_16LE, " \
"BGRA, RGBA, RGBx, BGRx, ARGB, ABGR, RGB, BGR, BGR10A2_LE, RGB10A2_LE, Y42B, I422_10LE, I422_12LE }" "BGRA, RGBA, RGBx, BGRx, ARGB, ABGR, RGB, BGR, BGR10A2_LE, RGB10A2_LE, " \
"Y42B, I422_10LE, I422_12LE, YUY2, UYVY }"
#define GST_CUDA_GL_FORMATS \ #define GST_CUDA_GL_FORMATS \
"{ I420, YV12, NV12, NV21, P010_10LE, P016_LE, Y444, " \ "{ I420, YV12, NV12, NV21, P010_10LE, P016_LE, Y444, " \
"BGRA, RGBA, RGBx, BGRx, ARGB, ABGR, RGB, BGR, BGR10A2_LE, RGB10A2_LE }" "BGRA, RGBA, RGBx, BGRx, ARGB, ABGR, RGB, BGR, BGR10A2_LE, RGB10A2_LE, " \
"YUY2, UYVY }"
#define GST_CUDA_D3D11_FORMATS \ #define GST_CUDA_D3D11_FORMATS \
"{ I420, YV12, I420_10LE, Y444, Y444_16LE, " \ "{ I420, YV12, I420_10LE, Y444, Y444_16LE, " \