vkvideoutils: add gst_vulkan_video_profile_is_equal()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-07-03 17:43:05 +02:00 committed by GStreamer Marge Bot
parent 13d78652b7
commit 8023e3c19a
2 changed files with 44 additions and 0 deletions

View file

@ -365,3 +365,44 @@ gst_vulkan_video_profile_is_valid (GstVulkanVideoProfile * profile, guint codec)
#endif
return FALSE;
}
/**
* gst_vulkan_video_profile_is_equal:
* @a: a #GstVulkanVideoProfile
* @b: another #GstVulkanVideoProfile
*
* Returns: whether @a and @b contains the same information.
*/
gboolean
gst_vulkan_video_profile_is_equal (const GstVulkanVideoProfile * a,
const GstVulkanVideoProfile * b)
{
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
gboolean profile;
g_return_val_if_fail (a && b, FALSE);
profile = ((a->profile.videoCodecOperation == b->profile.videoCodecOperation)
&& (a->profile.chromaSubsampling == b->profile.chromaSubsampling)
&& (a->profile.chromaBitDepth == b->profile.chromaBitDepth)
&& (a->profile.lumaBitDepth == b->profile.lumaBitDepth)
&& (a->codec.base.sType == b->codec.base.sType));
if (!profile)
return FALSE;
switch (a->profile.videoCodecOperation) {
case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR:
return ((a->codec.h264dec.stdProfileIdc == b->codec.h264dec.stdProfileIdc)
&& a->codec.h264dec.pictureLayout == b->codec.h264dec.pictureLayout);
case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR:
return (a->codec.h265dec.stdProfileIdc == b->codec.h265dec.stdProfileIdc);
default:
return FALSE;
}
g_assert_not_reached ();
#else
return FALSE;
#endif
}

View file

@ -55,5 +55,8 @@ gboolean gst_vulkan_video_profile_from_caps (GstVulkanVideoP
GST_VULKAN_API
gboolean gst_vulkan_video_profile_is_valid (GstVulkanVideoProfile * profile,
guint codec);
GST_VULKAN_API
gboolean gst_vulkan_video_profile_is_equal (const GstVulkanVideoProfile * a,
const GstVulkanVideoProfile * b);
G_END_DECLS