This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 135be23ab3eda748f81492c3bf16be2589aa71c7
Author:     Lynne <[email protected]>
AuthorDate: Wed Sep 16 09:09:33 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Sun Sep 20 11:59:47 2026 +0900

    vulkan_decode, vulkan_encode: do not query capabilities for unmappable 
pixel formats
    
    A pixel format whose chroma subsampling or bit depth has no video profile
    representation, such as 4:4:0 or 16-bit, ends up as a profile with zeroed
    fields, which is not valid to pass to 
vkGetPhysicalDeviceVideoCapabilitiesKHR
    (VUID-VkVideoProfileInfoKHR-chromaSubsampling-requiredbitmask and friends).
    Report such formats as unsupported before the query instead, through the
    same path the driver rejecting a format takes.
---
 libavcodec/vulkan_decode.c |  6 ++++++
 libavcodec/vulkan_encode.c | 12 +++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index ab313423e5..0e1749c5f7 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -797,6 +797,12 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx,
     profile->lumaBitDepth        = 
ff_vk_depth_from_av_depth(desc->comp[0].depth);
     profile->chromaBitDepth      = profile->lumaBitDepth;
 
+    /* A pixel format without a video profile representation is not a valid
+     * profile to query the capabilities for */
+    if (profile->chromaSubsampling == VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR 
||
+        profile->lumaBitDepth == VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR)
+        return VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR;
+
     profile_list->sType        = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR;
     profile_list->profileCount = 1;
     profile_list->pProfiles    = profile;
diff --git a/libavcodec/vulkan_encode.c b/libavcodec/vulkan_encode.c
index eac9767351..796c9275a0 100644
--- a/libavcodec/vulkan_encode.c
+++ b/libavcodec/vulkan_encode.c
@@ -923,9 +923,15 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, 
FFVulkanEncodeContext *
     ctx->caps.sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR;
     ctx->caps.pNext = &ctx->enc_caps;
 
-    ret = vk->GetPhysicalDeviceVideoCapabilitiesKHR(s->hwctx->phys_dev,
-                                                    &ctx->profile,
-                                                    &ctx->caps);
+    /* A pixel format without a video profile representation is not a valid
+     * profile to query the capabilities for */
+    if (ctx->profile.chromaSubsampling == 
VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR ||
+        ctx->profile.lumaBitDepth == VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR)
+        ret = VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR;
+    else
+        ret = vk->GetPhysicalDeviceVideoCapabilitiesKHR(s->hwctx->phys_dev,
+                                                        &ctx->profile,
+                                                        &ctx->caps);
     if (ret == VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR) {
         av_log(avctx, AV_LOG_ERROR, "Unable to initialize encoding: "
                "%s profile \"%s\" not supported!\n",

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to