vkformat: invert srgb and multiplane && planes > 1 checks

The primary format for RGB includes sRGB transfer but was not actually
being used.

The !(no_multiplane && planes > 1) check for YUV resulted in those
formats never being used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
This commit is contained in:
Matthew Waters 2023-09-06 12:41:29 +10:00 committed by Víctor Manuel Jáquez Leal
parent 8a9d630e3b
commit 4d3b03e8e8
2 changed files with 9 additions and 7 deletions

View file

@ -646,8 +646,8 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
}
if (GST_VIDEO_INFO_IS_RGB (info)) {
if (basics_primary && GST_VIDEO_INFO_COLORIMETRY (info).transfer !=
GST_VIDEO_TRANSFER_SRGB) {
if (basics_primary && (GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
GST_VIDEO_TRANSFER_SRGB)) {
if (fmts)
fmts[0] = vk_formats_map[i].vkfrmt;
if (n_imgs)
@ -655,7 +655,7 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
if (usage)
*usage = _get_usage (feats_primary);
} else if (basics_secondary
&& GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
&& GST_VIDEO_INFO_COLORIMETRY (info).transfer !=
GST_VIDEO_TRANSFER_SRGB) {
if (fmts)
fmts[0] = vk_formats_map[i].vkfrmts[0];
@ -667,8 +667,8 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
return FALSE;
}
} else {
if (basics_primary && !(no_multiplane
&& GST_VIDEO_INFO_N_PLANES (info) > 1)) {
if (basics_primary && !no_multiplane
&& GST_VIDEO_INFO_N_PLANES (info) > 1) {
if (fmts)
fmts[0] = vk_formats_map[i].vkfrmt;
if (n_imgs)

View file

@ -69,11 +69,13 @@ GST_START_TEST (test_format_from_video_info_2)
fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGBA, 620,
480));
fail_unless (GST_VIDEO_INFO_COLORIMETRY (&vinfo).transfer ==
GST_VIDEO_TRANSFER_SRGB);
fail_unless (gst_vulkan_format_from_video_info_2 (phy_dev, &vinfo,
VK_IMAGE_TILING_LINEAR, TRUE, vk_fmts, &n_imgs, &supported_usage));
fail_unless (n_imgs == 1 && vk_fmts[0] == VK_FORMAT_R8G8B8A8_UNORM);
fail_unless (n_imgs == 1 && vk_fmts[0] == VK_FORMAT_R8G8B8A8_SRGB);
fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGBA, 620,
480));
@ -83,7 +85,7 @@ GST_START_TEST (test_format_from_video_info_2)
fail_unless (gst_vulkan_format_from_video_info_2 (phy_dev, &vinfo,
VK_IMAGE_TILING_LINEAR, TRUE, vk_fmts, &n_imgs, &supported_usage));
fail_unless (n_imgs == 1 && vk_fmts[0] == VK_FORMAT_R8G8B8A8_SRGB);
fail_unless (n_imgs == 1 && vk_fmts[0] == VK_FORMAT_R8G8B8A8_UNORM);
}
GST_END_TEST;