From 237d19520941e2afae751e02e48043d1268fc937 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 27 Sep 2023 19:43:59 +1000 Subject: [PATCH] gl/format: fix swizzle indices for RGB10A2/BGR10A2 Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3003 Part-of: --- .../gst-libs/gst/gl/gstglformat.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c index e03dc8cf94..c5ba5e0ef4 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglformat.c @@ -493,6 +493,21 @@ get_single_planar_format_gl_swizzle_order (GstVideoFormat format, g_return_if_fail (finfo->flags & GST_VIDEO_FORMAT_FLAG_RGB || format == GST_VIDEO_FORMAT_AYUV || format == GST_VIDEO_FORMAT_VUYA); + if (format == GST_VIDEO_FORMAT_BGR10A2_LE) { + swizzle[0] = 2; + swizzle[1] = 1; + swizzle[2] = 0; + swizzle[3] = 3; + return; + } + if (format == GST_VIDEO_FORMAT_RGB10A2_LE) { + swizzle[0] = 0; + swizzle[1] = 1; + swizzle[2] = 2; + swizzle[3] = 3; + return; + } + for (i = 0; i < finfo->n_components; i++) { swizzle[c_i++] = finfo->poffset[i] / (GST_ROUND_UP_8 (finfo->bits) / 8); }