// Copyright 2018-2022 The Khronos Group Inc. // // SPDX-License-Identifier: CC-BY-4.0 [[video-decode-operations]] == Video Decode Operations [[decode-output-picture]] Video decode operations consume compressed video data from a video bitstream buffer and zero or more reference pictures, and produce a _decode output picture_ and an optional <>. [NOTE] .Note: ==== Such decode output pictures can be shared with the <>, and can also be used ifdef::VK_KHR_video_encode_queue[] as the <> of video encode operations, endif::VK_KHR_video_encode_queue[] with graphics or compute operations, ifdef::VK_KHR_surface[] or with <> APIs, endif::VK_KHR_surface[] depending on the capabilities of the implementation. ==== Video decode operations may: access the following resources in the ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR stage: * The source video bitstream buffer range and the image subregions corresponding to the list of <> with access ename:VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR. * The image subregions corresponding to the target <> and <> with access ename:VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR. The image subresource of each <> accessed by the video coding operation is specified using a corresponding slink:VkVideoPictureResourceInfoKHR structure. Each such image subresource must: be in the appropriate image layout as follows: * If the image subresource is used in the video decode operation only as <>, then it must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR layout. * If the image subresource is used in the video decode operation both as <> and <>, then it must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout. * If the image subresource is used in the video decode operation only as <>, then it must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout. * If the image subresource is used in the video decode operation as a <>, then it must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout. [[decode-unsuccessful]] A video decode operation may: complete unsuccessfully. In this case the <> will have undefined: contents. Similarly, if a <> is specified, it will also have undefined: contents, and the activated DPB slot will have an <>. [[decode-codec-specific-semantics]] === Codec-Specific Semantics The following aspects of video decode operations are codec-specific: * The interpretation of the contents of the source video bitstream buffer range. * The construction and interpretation of the list of <> and the interpretation of the picture data referred to by the corresponding image subregions. * The construction and interpretation of information related to the <> and the generation of picture data to the corresponding image subregion. * The construction and interpretation of information related to the optional <> and the generation of picture data to the corresponding image subregion. These codec-specific behaviors are defined for each video codec operation separately. ifdef::VK_KHR_video_decode_h264[] * If the used video codec operation is ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the codec-specific aspects of the video decoding process are performed as defined in the <> section. endif::VK_KHR_video_decode_h264[] ifdef::VK_KHR_video_decode_h265[] * If the used video codec operation is ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the codec-specific aspects of the video decoding process are performed as defined in the <> section. endif::VK_KHR_video_decode_h265[] [[decode-operation-steps]] === Video Decode Operation Steps Each video decode operation performs the following steps in the ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR stage: 1. Reads the encoded video data from the source video bitstream buffer range. 2. Performs picture reconstruction of the encoded video data according to the <>, applying any prediction data read from the <> in the process; 3. Writes the decoded picture data to the <>, and to the <>, if one is specified and is different from the decode output picture, according to the <>; 4. When <> is provided, the requested <> is <> with the specified picture and the DPB slot index is associated with the corresponding <>. === Capabilities [open,refpage='VkVideoDecodeCapabilitiesKHR',desc='Structure describing general video decode capabilities for a video profile',type='structs'] -- When calling flink:vkGetPhysicalDeviceVideoCapabilitiesKHR with pname:pVideoProfile->videoCodecOperation specifying a decode operation, the sname:VkVideoDecodeCapabilitiesKHR structure must: be included in the pname:pNext chain of the slink:VkVideoCapabilitiesKHR structure to retrieve capabilities specific to video decoding. The sname:VkVideoDecodeCapabilitiesKHR structure is defined as: include::{generated}/api/structs/VkVideoDecodeCapabilitiesKHR.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:flags is a bitmask of elink:VkVideoDecodeCapabilityFlagBitsKHR describing the supported video decoding capabilities. include::{generated}/validity/structs/VkVideoDecodeCapabilitiesKHR.adoc[] -- [open,refpage='VkVideoDecodeCapabilityFlagBitsKHR',desc='Video decode capability flags',type='enums'] -- Bits which may: be set in slink:VkVideoDecodeCapabilitiesKHR::pname:flags, indicating the decoding capabilities supported, are: include::{generated}/api/enums/VkVideoDecodeCapabilityFlagBitsKHR.adoc[] * ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR indicates support for using the same video picture resource as the <> and <> in a video decode operation. * ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR indicates support for using distinct video picture resources as the <> and <> in a video decode operation. Implementations are only required: to support one of ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR and ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR. Accordingly, applications should: handle both cases to maximize portability. [NOTE] .Note: ==== If both ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR and ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR are supported, an application can choose to create separate images for decode DPB and decode output. E.g. in cases when linear tiling is preferred (and supported) for the decode output picture and the DPB requires optimal tiling, this avoids the need for a separate copy at the expense of additional memory bandwidth requirements during decoding. ==== -- [open,refpage='VkVideoDecodeCapabilityFlagsKHR',desc='Bitmask of VkVideoDecodeCapabilityFlagBitsKHR',type='flags'] -- include::{generated}/api/flags/VkVideoDecodeCapabilityFlagsKHR.adoc[] tname:VkVideoDecodeCapabilityFlagsKHR is a bitmask type for setting a mask of zero or more elink:VkVideoDecodeCapabilityFlagBitsKHR. -- === Video Decode Commands [open,refpage='vkCmdDecodeVideoKHR',desc='Launch a video decode operation',type='protos'] -- To launch video decode operations, call: include::{generated}/api/protos/vkCmdDecodeVideoKHR.adoc[] * pname:commandBuffer is the command buffer in which to record the command. * pname:pDecodeInfo is a pointer to a slink:VkVideoDecodeInfoKHR structure specifying the parameters of the video decode operations. Each call issues one or more video decode operations. The implicit parameter pname:opCount corresponds to the number of video decode operations issued by the command. After calling this command, the <> of each <> query is incremented by pname:opCount. Currently each call to this command results in the issue of a single video decode operation. [[decode-active-reference-picture-info]] Active Reference Picture Information:: The list of <> used by a video decode operation is a list of image subregions used as the source of <> data and related parameters, and is derived from the slink:VkVideoReferenceSlotInfoKHR structures provided as the elements of the pname:pDecodeInfo->pReferenceSlots array. For each element of pname:pDecodeInfo->pReferenceSlots, one or more elements are added to the active reference picture list, as defined by the <>. Each element of this list contains the following information: * The image subregion within the image subresource <> to by the <> used as the reference picture. * The <> index the reference picture is associated with. * The codec-specific reference information related to the reference picture. [[decode-reconstructed-picture-info]] Reconstructed Picture Information:: Information related to the optional <> used by a video decode operation is derived from the slink:VkVideoReferenceSlotInfoKHR structure pointed to by pname:pDecodeInfo->pSetupReferenceSlot, if not `NULL`, as defined by the <>, and consists of the following: * The image subregion within the image subresource <> to by the <> used as the reconstructed picture. * The <> index to <> with the reconstructed picture. * The codec-specific reference information related to the reconstructed picture. [[decode-output-picture-info]] Decode Output Picture Information:: Information related to the <> used by a video decode operation is derived from pname:pDecodeInfo->dstPictureResource and any codec-specific parameters provided in the pname:pDecodeInfo->pNext chain, as defined by the <>, and consists of the following: * The image subregion within the image subresource <> to by the <> used as the decode output picture. * The codec-specific picture information related to the decode output picture. Several limiting values are defined below that are referenced by the relevant valid usage statements of this command. * Let `uint32_t activeReferencePictureCount` be the size of the list of active reference pictures used by the video decode operation. Unless otherwise defined, pname:activeReferencePictureCount is set to the value of pname:pDecodeInfo->referenceSlotCount. ifdef::VK_KHR_video_decode_h264[] ** If the bound video session was created with an <>, then let pname:activeReferencePictureCount be the value of pname:pDecodeInfo->referenceSlotCount plus the number of elements of the pname:pDecodeInfo->pReferenceSlots array that have a slink:VkVideoDecodeH264DpbSlotInfoKHR structure included in their pname:pNext chain with both pname:pStdReferenceInfo->flags.top_field_flag and pname:pStdReferenceInfo->flags.bottom_field_flag set. + [NOTE] .Note ==== This means that the elements of pname:pDecodeInfo->pReferenceSlots that include both a top and bottom field reference are counted as two separate active reference pictures, as described in the <>. ==== endif::VK_KHR_video_decode_h264[] * Let `VkOffset2D codedOffsetGranularity` be the minimum alignment requirement for the coded offset of video picture resources. Unless otherwise defined, the value of the pname:x and pname:y members of pname:codedOffsetGranularity are `0`. ifdef::VK_KHR_video_decode_h264[] ** If the bound video session was created with an <> with a slink:VkVideoDecodeH264ProfileInfoKHR::pname:pictureLayout of ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR, then pname:codedOffsetGranularity is equal to slink:VkVideoDecodeH264CapabilitiesKHR::pname:fieldOffsetGranularity, as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for that video profile. endif::VK_KHR_video_decode_h264[] * Let `uint32_t dpbFrameUseCount[]` be an array of size pname:maxDpbSlots, where pname:maxDpbSlots is the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots the bound video session was created with, with each element indicating the number of times a frame associated with the corresponding DPB slot index is referred to by the video coding operation. Let the initial value of each element of the array be `0`. ** If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then `dpbFrameUseCount[i]` is incremented by one, where pname:i equals pname:pDecodeInfo->pSetupReferenceSlot->slotIndex. ifdef::VK_KHR_video_decode_h264[] If the bound video session object was created with an <>, then `dpbFrameUseCount[i]` is decremented by one if either pname:pStdReferenceInfo->flags.top_field_flag or pname:pStdReferenceInfo->flags.bottom_field_flag is set in the slink:VkVideoDecodeH264DpbSlotInfoKHR structure in the pname:pDecodeInfo->pSetupReferenceSlot->pNext chain. endif::VK_KHR_video_decode_h264[] ** For each element of pname:pDecodeInfo->pReferenceSlots, `dpbFrameUseCount[i]` is incremented by one, where pname:i equals the pname:slotIndex member of the corresponding element. ifdef::VK_KHR_video_decode_h264[] If the bound video session object was created with an <>, then `dpbFrameUseCount[i]` is decremented by one if either pname:pStdReferenceInfo->flags.top_field_flag or pname:pStdReferenceInfo->flags.bottom_field_flag is set in the slink:VkVideoDecodeH264DpbSlotInfoKHR structure in the pname:pNext chain of the corresponding element of pname:pDecodeInfo->pReferenceSlots. * Let `uint32_t dpbTopFieldUseCount[]` and `uint32_t dpbBottomFieldUseCount[]` be arrays of size pname:maxDpbSlots, where pname:maxDpbSlots is the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots the bound video session was created with, with each element indicating the number of times the top field or the bottom field, respectively, associated with the corresponding DPB slot index is referred to by the video coding operation. Let the initial value of each element of the arrays be `0`. ** If the bound video session object was created with an <> and pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then perform the following: *** If pname:pStdReferenceInfo->flags.top_field_flag is set in the slink:VkVideoDecodeH264DpbSlotInfoKHR structure in the pname:pDecodeInfo->pSetupReferenceSlot->pNext chain, then `dpbTopFieldUseCount[i]` is incremented by one, where pname:i equals pname:pDecodeInfo->pSetupReferenceSlot->slotIndex. *** If pname:pStdReferenceInfo->flags.bottom_field_flag is set in the slink:VkVideoDecodeH264DpbSlotInfoKHR structure in the pname:pDecodeInfo->pSetupReferenceSlot->pNext chain, then `dpbBottomFieldUseCount[i]` is incremented by one, where pname:i equals pname:pDecodeInfo->pSetupReferenceSlot->slotIndex. ** If the bound video session object was created with an <>, then perform the following for each element of pname:pDecodeInfo->pReferenceSlots: *** If pname:pStdReferenceInfo->flags.top_field_flag is set in the slink:VkVideoDecodeH264DpbSlotInfoKHR structure in the pname:pNext chain of the element, then `dpbTopFieldUseCount[i]` is incremented by one, where pname:i equals the pname:slotIndex member of the element. *** If pname:pStdReferenceInfo->flags.bottom_field_flag is set in the slink:VkVideoDecodeH264DpbSlotInfoKHR structure in the pname:pNext chain of the element, then `dpbBottomFieldUseCount[i]` is incremented by one, where pname:i equals the pname:slotIndex member of the element. endif::VK_KHR_video_decode_h264[] .Valid Usage **** * [[VUID-vkCmdDecodeVideoKHR-None-07011]] The bound video session must: not be in <> state at the time the command is executed on the device * [[VUID-vkCmdDecodeVideoKHR-opCount-07134]] For each <> query, the <> corresponding to the query type of that query plus pname:opCount must: be less than or equal to the <> corresponding to the query type of that query plus one * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07135]] pname:pDecodeInfo->srcBuffer must: be <> with the video profile the bound video session was created with * [[VUID-vkCmdDecodeVideoKHR-commandBuffer-07136]] If pname:commandBuffer is an unprotected command buffer and <> is not supported, then pname:pDecodeInfo->srcBuffer must: not be a protected buffer * [[VUID-vkCmdDecodeVideoKHR-commandBuffer-07137]] If pname:commandBuffer is a protected command buffer and <> is not supported, then pname:pDecodeInfo->srcBuffer must: be a protected buffer * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07138]] pname:pDecodeInfo->srcBufferOffset must: be an integer multiple of slink:VkVideoCapabilitiesKHR::pname:minBitstreamBufferOffsetAlignment, as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07139]] pname:pDecodeInfo->srcBufferRange must: be an integer multiple of slink:VkVideoCapabilitiesKHR::pname:minBitstreamBufferSizeAlignment, as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07140]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL` and slink:VkVideoDecodeCapabilitiesKHR::pname:flags does not include ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR, as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then the video picture resources specified by pname:pDecodeInfo->dstPictureResource and pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource must: not <> * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07141]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL` and slink:VkVideoDecodeCapabilitiesKHR::pname:flags does not include ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR, as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then the video picture resources specified by pname:pDecodeInfo->dstPictureResource and pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource must: <> * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07142]] pname:pDecodeInfo->dstPictureResource.imageViewBinding must: be <> with the video profile the bound video session was created with * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07143]] The format of pname:pDecodeInfo->dstPictureResource.imageViewBinding must: match the slink:VkVideoSessionCreateInfoKHR::pname:pictureFormat the bound video session was created with * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07144]] pname:pDecodeInfo->dstPictureResource.codedOffset must: be an integer multiple of pname:codedOffsetGranularity * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07145]] pname:pDecodeInfo->dstPictureResource.codedExtent must: be between pname:minCodedExtent and pname:maxCodedExtent, inclusive, the bound video session was created with * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07146]] pname:pDecodeInfo->dstPictureResource.imageViewBinding must: have been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR * [[VUID-vkCmdDecodeVideoKHR-commandBuffer-07147]] If pname:commandBuffer is an unprotected command buffer and <> is not supported, then pname:pDecodeInfo->dstPictureResource.imageViewBinding must: not have been created from a protected image * [[VUID-vkCmdDecodeVideoKHR-commandBuffer-07148]] If pname:commandBuffer is a protected command buffer and <> is not supported, then pname:pDecodeInfo->dstPictureResource.imageViewBinding must: have been created from a protected image * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07170]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then pname:pDecodeInfo->pSetupReferenceSlot->slotIndex must: be less than the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots specified when the bound video session was created * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07173]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource->codedOffset must: be an integer multiple of pname:codedOffsetGranularity * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07149]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource must: <> one of the <> * [[VUID-vkCmdDecodeVideoKHR-activeReferencePictureCount-07150]] pname:activeReferencePictureCount must: be less than or equal to the slink:VkVideoSessionCreateInfoKHR::pname:maxActiveReferencePictures specified when the bound video session was created * [[VUID-vkCmdDecodeVideoKHR-slotIndex-07256]] The pname:slotIndex member of each element of pname:pDecodeInfo->pReferenceSlots must: be less than the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots specified when the bound video session was created * [[VUID-vkCmdDecodeVideoKHR-codedOffset-07257]] The pname:codedOffset member of the slink:VkVideoPictureResourceInfoKHR structure pointed to by the pname:pPictureResource member of each element of pname:pDecodeInfo->pReferenceSlots must: be an integer multiple of pname:codedOffsetGranularity * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07151]] The pname:pPictureResource member of each element of pname:pDecodeInfo->pReferenceSlots must: <> one of the <> associated with the DPB slot index specified in the pname:slotIndex member of that element * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07264]] Each video picture resource corresponding to the pname:pPictureResource member specified in the elements of pname:pDecodeInfo->pReferenceSlots must: be <> within pname:pDecodeInfo->pReferenceSlots * [[VUID-vkCmdDecodeVideoKHR-dpbFrameUseCount-07176]] All elements of pname:dpbFrameUseCount must: be less than or equal to `1` ifdef::VK_KHR_video_decode_h264[] * [[VUID-vkCmdDecodeVideoKHR-dpbTopFieldUseCount-07177]] All elements of pname:dpbTopFieldUseCount must: be less than or equal to `1` * [[VUID-vkCmdDecodeVideoKHR-dpbBottomFieldUseCount-07178]] All elements of pname:dpbBottomFieldUseCount must: be less than or equal to `1` endif::VK_KHR_video_decode_h264[] * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07252]] If pname:pDecodeInfo->pSetupReferenceSlot is `NULL` or pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource does not <> to the same image subresource as pname:pDecodeInfo->dstPictureResource, then the image subresource <> to by pname:pDecodeInfo->dstPictureResource must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR layout at the time the video decode operation is executed on the device * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07253]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL` and pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource <> to the same image subresource as pname:pDecodeInfo->dstPictureResource, then the image subresource <> to by pname:pDecodeInfo->dstPictureResource must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout at the time the video decode operation is executed on the device * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07254]] If pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then the image subresource <> to by pname:pDecodeInfo->pSetupReferenceSlot->pPictureResource must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout at the time the video decode operation is executed on the device * [[VUID-vkCmdDecodeVideoKHR-pPictureResource-07255]] The image subresource <> to by the pname:pPictureResource member of each element of pname:pDecodeInfo->pReferenceSlots must: be in the ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout at the time the video decode operation is executed on the device ifdef::VK_KHR_video_decode_h264[] * [[VUID-vkCmdDecodeVideoKHR-pNext-07152]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext chain of pname:pDecodeInfo must: include a slink:VkVideoDecodeH264PictureInfoKHR structure * [[VUID-vkCmdDecodeVideoKHR-None-07258]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR but was not created with <>, then the <> must: represent a frame * [[VUID-vkCmdDecodeVideoKHR-pSliceOffsets-07153]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then all elements of the pname:pSliceOffsets member of the slink:VkVideoDecodeH264PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo must: be less than pname:pDecodeInfo->srcBufferRange * [[VUID-vkCmdDecodeVideoKHR-StdVideoH264SequenceParameterSet-07154]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the bound video session parameters object must: contain a code:StdVideoH264SequenceParameterSet entry with pname:seq_parameter_set_id matching code:StdVideoDecodeH264PictureInfo::pname:seq_parameter_set_id that is provided in the pname:pStdPictureInfo member of the slink:VkVideoDecodeH264PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo * [[VUID-vkCmdDecodeVideoKHR-StdVideoH264PictureParameterSet-07155]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the bound video session parameters object must: contain a code:StdVideoH264PictureParameterSet entry with pname:seq_parameter_set_id and pname:pic_parameter_set_id matching code:StdVideoDecodeH264PictureInfo::pname:seq_parameter_set_id and code:StdVideoDecodeH264PictureInfo::pname:pic_parameter_set_id, respectively, that are provided in the pname:pStdPictureInfo member of the slink:VkVideoDecodeH264PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07156]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then the pname:pNext chain of pname:pDecodeInfo->pSetupReferenceSlot must: include a slink:VkVideoDecodeH264DpbSlotInfoKHR structure * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07259]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR but was not created with <>, and pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then the <> must: represent a frame * [[VUID-vkCmdDecodeVideoKHR-pNext-07157]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext chain of each element of pname:pDecodeInfo->pReferenceSlots must: include a slink:VkVideoDecodeH264DpbSlotInfoKHR structure * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07260]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR but was not created with <>, then each <> corresponding to the elements of pname:pDecodeInfo->pReferenceSlots must: represent a frame * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07261]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, and the <> represents a frame, then the <> must: also represent a frame * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07262]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, and the <> represents a top field, then the <> must: also represent a top field * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07263]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, and the <> represents a bottom field, then the <> must: also represent a bottom field * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07266]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an <> corresponding to any element of pname:pDecodeInfo->pReferenceSlots represents a frame, then the DPB slot index of the bound video session specified by the pname:slotIndex member of that element must: be currently associated with a frame picture <> the video picture resource specified by the pname:pPictureResource member of the same element at the time the command is executed on the device * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07267]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an <> corresponding to any element of pname:pDecodeInfo->pReferenceSlots represents a top field, then the DPB slot index of the bound video session specified by the pname:slotIndex member of that element must: be currently associated with a top field picture <> the video picture resource specified by the pname:pPictureResource member of the same element at the time the command is executed on the device * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07268]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an <> corresponding to any element of pname:pDecodeInfo->pReferenceSlots represents a bottom field, then the DPB slot index of the bound video session specified by the pname:slotIndex member of that element must: be currently associated with a bottom field picture <> the video picture resource specified by the pname:pPictureResource member of the same element at the time the command is executed on the device endif::VK_KHR_video_decode_h264[] ifdef::VK_KHR_video_decode_h265[] * [[VUID-vkCmdDecodeVideoKHR-pNext-07158]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext chain of pname:pDecodeInfo must: include a slink:VkVideoDecodeH265PictureInfoKHR structure * [[VUID-vkCmdDecodeVideoKHR-pSliceSegmentOffsets-07159]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then all elements of the pname:pSliceSegmentOffsets member of the slink:VkVideoDecodeH265PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo must: be less than pname:pDecodeInfo->srcBufferRange * [[VUID-vkCmdDecodeVideoKHR-StdVideoH265VideoParameterSet-07160]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the bound video session parameters object must: contain a code:StdVideoH265VideoParameterSet entry with pname:vps_video_parameter_set_id matching code:StdVideoDecodeH265PictureInfo::pname:sps_video_parameter_set_id that is provided in the pname:pStdPictureInfo member of the slink:VkVideoDecodeH265PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo * [[VUID-vkCmdDecodeVideoKHR-StdVideoH265SequenceParameterSet-07161]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the bound video session parameters object must: contain a code:StdVideoH265SequenceParameterSet entry with pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id matching code:StdVideoDecodeH265PictureInfo::pname:sps_video_parameter_set_id and code:StdVideoDecodeH265PictureInfo::pname:pps_seq_parameter_set_id, respectively, that are provided in the pname:pStdPictureInfo member of the slink:VkVideoDecodeH265PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo * [[VUID-vkCmdDecodeVideoKHR-StdVideoH265PictureParameterSet-07162]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the bound video session parameters object must: contain a code:StdVideoH265PictureParameterSet entry with pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, and pname:pps_pic_parameter_set_id matching code:StdVideoDecodeH265PictureInfo::pname:sps_video_parameter_set_id, code:StdVideoDecodeH265PictureInfo::pname:pps_seq_parameter_set_id, and code:StdVideoDecodeH265PictureInfo::pname:pps_pic_parameter_set_id, respectively, that are provided in the pname:pStdPictureInfo member of the slink:VkVideoDecodeH265PictureInfoKHR structure included in the pname:pNext chain of pname:pDecodeInfo * [[VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07163]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and pname:pDecodeInfo->pSetupReferenceSlot is not `NULL`, then the pname:pNext chain of pname:pDecodeInfo->pSetupReferenceSlot must: include a slink:VkVideoDecodeH265DpbSlotInfoKHR structure * [[VUID-vkCmdDecodeVideoKHR-pNext-07164]] If the bound video session was created with the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext chain of each element of pname:pDecodeInfo->pReferenceSlots must: include a slink:VkVideoDecodeH265DpbSlotInfoKHR structure endif::VK_KHR_video_decode_h265[] **** include::{generated}/validity/protos/vkCmdDecodeVideoKHR.adoc[] -- [open,refpage='VkVideoDecodeInfoKHR',desc='Structure specifying video decode parameters',type='structs'] -- The sname:VkVideoDecodeInfoKHR structure is defined as: include::{generated}/api/structs/VkVideoDecodeInfoKHR.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:flags is reserved for future use. * pname:srcBuffer is the source video bitstream buffer to read the encoded bitstream from. * pname:srcBufferOffset is the starting offset in bytes from the start of pname:srcBuffer to read the encoded bitstream from. * pname:srcBufferRange is the size in bytes of the encoded bitstream to decode from pname:srcBuffer, starting from pname:srcBufferOffset. * pname:dstPictureResource is the video picture resource to use as the <>. * pname:pSetupReferenceSlot is `NULL` or a pointer to a slink:VkVideoReferenceSlotInfoKHR structure describing the DPB slot to <> and the video picture resource to use as the <> to activate the DPB slot with. * pname:referenceSlotCount is the number of elements in the pname:pReferenceSlots array. * pname:pReferenceSlots is a pointer to an array of slink:VkVideoReferenceSlotInfoKHR structures describing the DPB slots and corresponding <> resources to use in this video decode operation (the set of <>). .Valid Usage **** * [[VUID-VkVideoDecodeInfoKHR-srcBuffer-07165]] pname:srcBuffer must: have been created with ename:VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR set * [[VUID-VkVideoDecodeInfoKHR-srcBufferOffset-07166]] pname:srcBufferOffset must: be less than the size of pname:srcBuffer * [[VUID-VkVideoDecodeInfoKHR-srcBufferRange-07167]] pname:srcBufferRange must: be less than or equal to the size of pname:srcBuffer minus pname:srcBufferOffset * [[VUID-VkVideoDecodeInfoKHR-pSetupReferenceSlot-07168]] If pname:pSetupReferenceSlot is not `NULL`, then its pname:slotIndex member must: not be negative * [[VUID-VkVideoDecodeInfoKHR-pSetupReferenceSlot-07169]] If pname:pSetupReferenceSlot is not `NULL`, then its pname:pPictureResource must: not be `NULL` * [[VUID-VkVideoDecodeInfoKHR-slotIndex-07171]] The pname:slotIndex member of each element of pname:pReferenceSlots must: not be negative * [[VUID-VkVideoDecodeInfoKHR-pPictureResource-07172]] The pname:pPictureResource member of each element of pname:pReferenceSlots must: not be `NULL` **** include::{generated}/validity/structs/VkVideoDecodeInfoKHR.adoc[] -- [open,refpage='VkVideoDecodeFlagsKHR',desc='Reserved for future use',type='flags'] -- include::{generated}/api/flags/VkVideoDecodeFlagsKHR.adoc[] tname:VkVideoDecodeFlagsKHR is a bitmask type for setting a mask, but is currently reserved for future use. --