tests: add vulkan H.265 encode

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6676>
This commit is contained in:
Stéphane Cerveau 2024-04-22 09:48:14 +02:00 committed by GStreamer Marge Bot
parent 5320514076
commit 73c64e8182
6 changed files with 1190 additions and 1 deletions

View file

@ -42,6 +42,10 @@ const VkExtensionProperties _vk_codec_extensions[] = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION,
},
[GST_VK_VIDEO_EXTENSION_ENCODE_H265] = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION,
}
#endif
};

View file

@ -79,7 +79,7 @@ struct _GstVulkanVideoFunctions
#undef DEFINE_FUNCTION
};
extern const VkExtensionProperties _vk_codec_extensions[3];
extern const VkExtensionProperties _vk_codec_extensions[4];
extern const VkComponentMapping _vk_identity_component_map;
gboolean gst_vulkan_video_get_vk_functions (GstVulkanInstance * instance,

View file

@ -39,6 +39,8 @@ static const struct {
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
{ GST_VULKAN_VIDEO_OPERATION_ENCODE, VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, "video/x-h264",
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_KHR },
{ GST_VULKAN_VIDEO_OPERATION_ENCODE, VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, "video/x-h265",
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_INFO_KHR },
#endif
};
@ -161,6 +163,16 @@ gst_vulkan_video_profile_to_caps (const GstVulkanVideoProfile * profile)
}
}
break;
case VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR:
if (profile->codec.h265enc.sType == video_codecs_map[i].stype) {
int j;
for (j = 0; j < G_N_ELEMENTS (h265_profile_map); j++) {
if (profile->codec.h265enc.stdProfileIdc
== h265_profile_map[j].vk_profile)
profile_str = h265_profile_map[j].profile_str;
}
}
break;
#endif
default:
break;
@ -317,6 +329,24 @@ gst_vulkan_video_profile_from_caps (GstVulkanVideoProfile * profile,
}
break;
}
case VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR:{
int j;
profile->codec.h265enc.sType = video_codecs_map[i].stype;
profile->codec.h265enc.stdProfileIdc =
STD_VIDEO_H265_PROFILE_IDC_INVALID;
profile->profile.pNext = &profile->codec;
profile_str = gst_structure_get_string (structure, "profile");
for (j = 0; profile_str && j < G_N_ELEMENTS (h265_profile_map); j++) {
if (g_strcmp0 (profile_str, h265_profile_map[j].profile_str) == 0) {
profile->codec.h265enc.stdProfileIdc =
h265_profile_map[j].vk_profile;
break;
}
}
break;
}
#endif
default:
profile->usage.decode.pNext = NULL;

View file

@ -50,6 +50,7 @@ struct _GstVulkanVideoProfile
VkVideoDecodeH265ProfileInfoKHR h265dec;
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
VkVideoEncodeH264ProfileInfoKHR h264enc;
VkVideoEncodeH265ProfileInfoKHR h265enc;
#endif
} codec;
#endif

File diff suppressed because it is too large Load diff

View file

@ -110,6 +110,7 @@ base_tests = [
[['libs/vkimagebufferpool.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
[['libs/vkvideodecode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_EXTENSIONS') != 1, [gstvulkan_dep]],
[['libs/vkvideoh264encode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_ENCODERS') != 1, [gstvulkan_dep, gstcodecparsers_dep]],
[['libs/vkvideoh265encode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_ENCODERS') != 1, [gstvulkan_dep, gstcodecparsers_dep]],
[['libs/d3d11device.cpp'], not gstd3d11_dep.found(), [gstd3d11_dep, gstvideo_dep]],
[['libs/d3d11memory.c'], not gstd3d11_dep.found(), [gstd3d11_dep]],
[['libs/cudamemory.c'], not gstcuda_dep.found(), [gstcuda_dep, gstcuda_stub_dep]],