cudaupload,cudadownload: Add support for planar 8bits RGB formats

Defines RGBP, BGRP, and GBR formats, which have the same memory
layout as already supported Y444. And defines GBRA format as well
which needs just one additional alpha plane

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3389>
This commit is contained in:
Seungha Yang 2022-11-10 19:38:03 +09:00 committed by GStreamer Marge Bot
parent 9c4c8c3932
commit c1efa9ac4b
2 changed files with 21 additions and 2 deletions

View file

@ -168,6 +168,9 @@ gst_cuda_allocator_alloc_internal (GstCudaAllocator * self,
break;
case GST_VIDEO_FORMAT_Y444:
case GST_VIDEO_FORMAT_Y444_16LE:
case GST_VIDEO_FORMAT_RGBP:
case GST_VIDEO_FORMAT_BGRP:
case GST_VIDEO_FORMAT_GBR:
alloc_info->stride[0] = pitch;
alloc_info->stride[1] = pitch;
alloc_info->stride[2] = pitch;
@ -175,6 +178,16 @@ gst_cuda_allocator_alloc_internal (GstCudaAllocator * self,
alloc_info->offset[1] = alloc_info->stride[0] * height;
alloc_info->offset[2] = alloc_info->offset[1] * 2;
break;
case GST_VIDEO_FORMAT_GBRA:
alloc_info->stride[0] = pitch;
alloc_info->stride[1] = pitch;
alloc_info->stride[2] = pitch;
alloc_info->stride[3] = pitch;
alloc_info->offset[0] = 0;
alloc_info->offset[1] = alloc_info->stride[0] * height;
alloc_info->offset[2] = alloc_info->offset[1] * 2;
alloc_info->offset[3] = alloc_info->offset[1] * 3;
break;
case GST_VIDEO_FORMAT_BGRA:
case GST_VIDEO_FORMAT_RGBA:
case GST_VIDEO_FORMAT_RGBx:
@ -516,8 +529,14 @@ gst_cuda_allocator_alloc (GstCudaAllocator * allocator,
case GST_VIDEO_FORMAT_I422_12LE:
case GST_VIDEO_FORMAT_Y444:
case GST_VIDEO_FORMAT_Y444_16LE:
case GST_VIDEO_FORMAT_RGBP:
case GST_VIDEO_FORMAT_BGRP:
case GST_VIDEO_FORMAT_GBR:
alloc_height *= 3;
break;
case GST_VIDEO_FORMAT_GBRA:
alloc_height *= 4;
break;
default:
break;
}

View file

@ -26,12 +26,12 @@ G_BEGIN_DECLS
#define GST_CUDA_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, YUY2, UYVY }"
"Y42B, I422_10LE, I422_12LE, YUY2, UYVY, RGBP, BGRP, GBR, GBRA }"
#define GST_CUDA_GL_FORMATS \
"{ I420, YV12, NV12, NV21, P010_10LE, P016_LE, Y444, " \
"BGRA, RGBA, RGBx, BGRx, ARGB, ABGR, RGB, BGR, BGR10A2_LE, RGB10A2_LE, " \
"YUY2, UYVY }"
"YUY2, UYVY, RGBP, BGRP, GBR, GBRA }"
#define GST_CUDA_D3D11_FORMATS \
"{ I420, YV12, I420_10LE, Y444, Y444_16LE, " \