gl/format: fix swizzle indices for RGB10A2/BGR10A2

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3003
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5400>
This commit is contained in:
Matthew Waters 2023-09-27 19:43:59 +10:00
parent 47dbdea469
commit 237d195209

View file

@ -493,6 +493,21 @@ get_single_planar_format_gl_swizzle_order (GstVideoFormat format,
g_return_if_fail (finfo->flags & GST_VIDEO_FORMAT_FLAG_RGB g_return_if_fail (finfo->flags & GST_VIDEO_FORMAT_FLAG_RGB
|| format == GST_VIDEO_FORMAT_AYUV || format == GST_VIDEO_FORMAT_VUYA); || 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++) { for (i = 0; i < finfo->n_components; i++) {
swizzle[c_i++] = finfo->poffset[i] / (GST_ROUND_UP_8 (finfo->bits) / 8); swizzle[c_i++] = finfo->poffset[i] / (GST_ROUND_UP_8 (finfo->bits) / 8);
} }