videocrop: Add support for v210

Like UYVY and similar formats this is rounding down to the start of the
previous macro-pixel to not mix up the different components.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1988>
This commit is contained in:
Sebastian Dröge 2022-03-18 19:33:00 +02:00 committed by GStreamer Marge Bot
parent 49ec82b209
commit 3de245ed17
4 changed files with 48 additions and 5 deletions

View file

@ -25258,12 +25258,12 @@
"long-name": "aspectratiocrop",
"pad-templates": {
"sink": {
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, v210, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, v210, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"direction": "src",
"presence": "always"
}
@ -25302,12 +25302,12 @@
"long-name": "Crop",
"pad-templates": {
"sink": {
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, v210, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"caps": "video/x-raw:\n format: { RGB, BGR, RGB16, RGB15, RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, GRAY8, GRAY16_LE, GRAY16_BE, AYUV, YVYU, YUY2, UYVY, v210, I420, A420, YV12, Y444, Y42B, Y41B, I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, I420_12BE, Y444_12BE, I422_12BE, I420_12LE, Y444_12LE, I422_12LE, GBR, GBR_10BE, GBR_10LE, GBR_12BE, GBR_12LE, GBRA, GBRA_10BE, GBRA_10LE, GBRA_12BE, GBRA_12LE, NV12, NV21 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(ANY):\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"direction": "src",
"presence": "always"
}

View file

@ -10,7 +10,7 @@
#define VIDEO_CROP_FORMATS_PACKED_SIMPLE "RGB, BGR, RGB16, RGB15, " \
"RGBx, xRGB, BGRx, xBGR, RGBA, ARGB, BGRA, ABGR, " \
"GRAY8, GRAY16_LE, GRAY16_BE, AYUV"
#define VIDEO_CROP_FORMATS_PACKED_COMPLEX "YVYU, YUY2, UYVY"
#define VIDEO_CROP_FORMATS_PACKED_COMPLEX "YVYU, YUY2, UYVY, v210"
#define VIDEO_CROP_FORMATS_PLANAR "I420, A420, YV12, Y444, Y42B, Y41B, " \
"I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE, " \
"I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE, " \

View file

@ -293,6 +293,41 @@ gst_video_crop_transform_packed_yvyu (GstVideoCrop * vcrop,
}
}
static void
gst_video_crop_transform_packed_v210 (GstVideoCrop * vcrop,
GstVideoFrame * in_frame, GstVideoFrame * out_frame, gint x, gint y)
{
guint8 *in_data, *out_data;
guint i, dx;
gint width, height;
gint in_stride;
gint out_stride;
width = GST_VIDEO_FRAME_WIDTH (out_frame);
height = GST_VIDEO_FRAME_HEIGHT (out_frame);
in_data = GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0);
out_data = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0);
in_stride = GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0);
out_stride = GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 0);
in_data += vcrop->crop_top * in_stride;
/* rounding down here so we end up at the start of a macro-pixel and not
* in the middle of one */
in_data += (vcrop->crop_left / 6) * 16;
/* copy a whole set of macro-pixels */
dx = ((width + 5) / 6) * 16;
for (i = 0; i < height; ++i) {
memcpy (out_data, in_data, dx);
in_data += in_stride;
out_data += out_stride;
}
}
static void
gst_video_crop_transform_packed_simple (GstVideoCrop * vcrop,
GstVideoFrame * in_frame, GstVideoFrame * out_frame, gint x, gint y)
@ -449,6 +484,9 @@ gst_video_crop_transform_frame (GstVideoFilter * vfilter,
case VIDEO_CROP_PIXEL_FORMAT_PACKED_YVYU:
gst_video_crop_transform_packed_yvyu (vcrop, in_frame, out_frame, x, y);
break;
case VIDEO_CROP_PIXEL_FORMAT_PACKED_v210:
gst_video_crop_transform_packed_v210 (vcrop, in_frame, out_frame, x, y);
break;
case VIDEO_CROP_PIXEL_FORMAT_PLANAR:
gst_video_crop_transform_planar (vcrop, in_frame, out_frame, x, y);
break;
@ -839,6 +877,9 @@ gst_video_crop_set_info (GstVideoFilter * vfilter, GstCaps * in,
crop->macro_y_off = 0;
}
break;
case GST_VIDEO_FORMAT_v210:
crop->packing = VIDEO_CROP_PIXEL_FORMAT_PACKED_v210;
break;
case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_I420_10BE:
case GST_VIDEO_FORMAT_I420_10LE:

View file

@ -42,6 +42,8 @@ typedef enum
VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE = 0,
/* YVYU, YUY2, UYVY */
VIDEO_CROP_PIXEL_FORMAT_PACKED_YVYU,
/* v210 */
VIDEO_CROP_PIXEL_FORMAT_PACKED_v210,
/* I420, A420, YV12, Y444, Y42B, Y41B,
* I420_10BE, A420_10BE, Y444_10BE, A444_10BE, I422_10BE, A422_10BE,
* I420_10LE, A420_10LE, Y444_10LE, A444_10LE, I422_10LE, A422_10LE,