| public static void vkCmdDecodeVideoKHR(VkCommandBuffer commandBuffer, VkVideoDecodeInfoKHR pDecodeInfo) Launch a video decode operation.
C Specification
To launch video decode operations, call:
void vkCmdDecodeVideoKHR(
VkCommandBuffer commandBuffer,
const VkVideoDecodeInfoKHR* pDecodeInfo);
Description
Each call issues one or more video decode operations. The implicit parameter opCount corresponds to the number of video decode operations issued by the command. After calling this command, the active query index of each active query is incremented by opCount.
Currently each call to this command results in the issue of a single video decode operation.
- Active Reference Picture Information
- The image subregion within the image subresource referred to by the video picture resource used as the reference picture.
- The DPB slot index the reference picture is associated with.
- The codec-specific reference information related to the reference picture.
- Reconstructed Picture Information
- The image subregion within the image subresource referred to by the video picture resource used as the reconstructed picture.
- The DPB slot index to activate with the reconstructed picture.
- The codec-specific reference information related to the reconstructed picture.
- Decode Output Picture Information
- The image subregion within the image subresource referred to by the video picture resource 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, activeReferencePictureCount is set to the value of pDecodeInfo→referenceSlotCount.
- If the bound video session was created with an H.264 decode profile, then let
activeReferencePictureCount be the value of pDecodeInfo→referenceSlotCount plus the number of elements of the pDecodeInfo→pReferenceSlots array that have a VkVideoDecodeH264DpbSlotInfoKHR structure included in their pNext chain with both pStdReferenceInfo→flags.top_field_flag and pStdReferenceInfo→flags.bottom_field_flag set.
- Let
VkOffset2D codedOffsetGranularity be the minimum alignment requirement for the coded offset of video picture resources. Unless otherwise defined, the value of the x and y members of codedOffsetGranularity are 0.
- Let
uint32_t dpbFrameUseCount[] be an array of size maxDpbSlots, where maxDpbSlots is the VkVideoSessionCreateInfoKHR::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
pDecodeInfo→pSetupReferenceSlot is not NULL, then dpbFrameUseCount[i] is incremented by one, where i equals pDecodeInfo→pSetupReferenceSlot→slotIndex. If the bound video session object was created with an H.264 decode profile, then dpbFrameUseCount[i] is decremented by one if either pStdReferenceInfo→flags.top_field_flag or pStdReferenceInfo→flags.bottom_field_flag is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in the pDecodeInfo→pSetupReferenceSlot→pNext chain.
- For each element of
pDecodeInfo→pReferenceSlots, dpbFrameUseCount[i] is incremented by one, where i equals the slotIndex member of the corresponding element. If the bound video session object was created with an H.264 decode profile, then dpbFrameUseCount[i] is decremented by one if either pStdReferenceInfo→flags.top_field_flag or pStdReferenceInfo→flags.bottom_field_flag is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in the pNext chain of the corresponding element of pDecodeInfo→pReferenceSlots.
- Let
uint32_t dpbTopFieldUseCount[] and uint32_t dpbBottomFieldUseCount[] be arrays of size maxDpbSlots, where maxDpbSlots is the VkVideoSessionCreateInfoKHR::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 H.264 decode profile and
pDecodeInfo→pSetupReferenceSlot is not NULL, then perform the following:
- If
pStdReferenceInfo→flags.top_field_flag is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in the pDecodeInfo→pSetupReferenceSlot→pNext chain, then dpbTopFieldUseCount[i] is incremented by one, where i equals pDecodeInfo→pSetupReferenceSlot→slotIndex.
- If
pStdReferenceInfo→flags.bottom_field_flag is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in the pDecodeInfo→pSetupReferenceSlot→pNext chain, then dpbBottomFieldUseCount[i] is incremented by one, where i equals pDecodeInfo→pSetupReferenceSlot→slotIndex.
- If the bound video session object was created with an H.264 decode profile, then perform the following for each element of
pDecodeInfo→pReferenceSlots:
- If
pStdReferenceInfo→flags.top_field_flag is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in the pNext chain of the element, then dpbTopFieldUseCount[i] is incremented by one, where i equals the slotIndex member of the element.
- If
pStdReferenceInfo→flags.bottom_field_flag is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in the pNext chain of the element, then dpbBottomFieldUseCount[i] is incremented by one, where i equals the slotIndex member of the element.
Valid Usage
- The bound video session must not be in uninitialized state at the time the command is executed on the device
- For each active query, the active query index corresponding to the query type of that query plus
opCount must be less than or equal to the last activatable query index corresponding to the query type of that query plus one
pDecodeInfo→srcBuffer must be compatible with the video profile the bound video session was created with
- If
commandBuffer is an unprotected command buffer and protectedNoFault is not supported, then pDecodeInfo→srcBuffer must not be a protected buffer
- If
commandBuffer is a protected command buffer and protectedNoFault is not supported, then pDecodeInfo→srcBuffer must be a protected buffer
pDecodeInfo→srcBufferOffset must be an integer multiple of VkVideoCapabilitiesKHR::minBitstreamBufferOffsetAlignment, as returned by GetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with
pDecodeInfo→srcBufferRange must be an integer multiple of VkVideoCapabilitiesKHR::minBitstreamBufferSizeAlignment, as returned by GetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with
- If
pDecodeInfo→pSetupReferenceSlot is not NULL and VkVideoDecodeCapabilitiesKHR::flags does not include VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR, as returned by GetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then the video picture resources specified by pDecodeInfo→dstPictureResource and pDecodeInfo→pSetupReferenceSlot→pPictureResource must not match
- If
pDecodeInfo→pSetupReferenceSlot is not NULL and VkVideoDecodeCapabilitiesKHR::flags does not include VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR, as returned by GetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then the video picture resources specified by pDecodeInfo→dstPictureResource and pDecodeInfo→pSetupReferenceSlot→pPictureResource must match
pDecodeInfo→dstPictureResource.imageViewBinding must be compatible with the video profile the bound video session was created with
- The format of
pDecodeInfo→dstPictureResource.imageViewBinding must match the VkVideoSessionCreateInfoKHR::pictureFormat the bound video session was created with
pDecodeInfo→dstPictureResource.codedOffset must be an integer multiple of codedOffsetGranularity
pDecodeInfo→dstPictureResource.codedExtent must be between minCodedExtent and maxCodedExtent, inclusive, the bound video session was created with
pDecodeInfo→dstPictureResource.imageViewBinding must have been created with IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
- If
commandBuffer is an unprotected command buffer and protectedNoFault is not supported, then pDecodeInfo→dstPictureResource.imageViewBinding must not have been created from a protected image
- If
commandBuffer is a protected command buffer and protectedNoFault is not supported, then pDecodeInfo→dstPictureResource.imageViewBinding must have been created from a protected image
- If
pDecodeInfo→pSetupReferenceSlot is not NULL, then pDecodeInfo→pSetupReferenceSlot→slotIndex must be less than the VkVideoSessionCreateInfoKHR::maxDpbSlots specified when the bound video session was created
- If
pDecodeInfo→pSetupReferenceSlot is not NULL, then pDecodeInfo→pSetupReferenceSlot→pPictureResource→codedOffset must be an integer multiple of codedOffsetGranularity
- If
pDecodeInfo→pSetupReferenceSlot is not NULL, then pDecodeInfo→pSetupReferenceSlot→pPictureResource must match one of the bound reference picture resource
activeReferencePictureCount must be less than or equal to the VkVideoSessionCreateInfoKHR::maxActiveReferencePictures specified when the bound video session was created
- The
slotIndex member of each element of pDecodeInfo→pReferenceSlots must be less than the VkVideoSessionCreateInfoKHR::maxDpbSlots specified when the bound video session was created
- The
codedOffset member of the VkVideoPictureResourceInfoKHR structure pointed to by the pPictureResource member of each element of pDecodeInfo→pReferenceSlots must be an integer multiple of codedOffsetGranularity
- The
pPictureResource member of each element of pDecodeInfo→pReferenceSlots must match one of the bound reference picture resource associated with the DPB slot index specified in the slotIndex member of that element
- Each video picture resource corresponding to the
pPictureResource member specified in the elements of pDecodeInfo→pReferenceSlots must be unique within pDecodeInfo→pReferenceSlots
- All elements of
dpbFrameUseCount must be less than or equal to 1
- All elements of
dpbTopFieldUseCount must be less than or equal to 1
- All elements of
dpbBottomFieldUseCount must be less than or equal to 1
- If
pDecodeInfo→pSetupReferenceSlot is NULL or pDecodeInfo→pSetupReferenceSlot→pPictureResource does not refer to the same image subresource as pDecodeInfo→dstPictureResource, then the image subresource referred to by pDecodeInfo→dstPictureResource must be in the IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR layout at the time the video decode operation is executed on the device
- If
pDecodeInfo→pSetupReferenceSlot is not NULL and pDecodeInfo→pSetupReferenceSlot→pPictureResource refers to the same image subresource as pDecodeInfo→dstPictureResource, then the image subresource referred to by pDecodeInfo→dstPictureResource must be in the IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout at the time the video decode operation is executed on the device
- If
pDecodeInfo→pSetupReferenceSlot is not NULL, then the image subresource referred to by pDecodeInfo→pSetupReferenceSlot→pPictureResource must be in the IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout at the time the video decode operation is executed on the device
- The image subresource referred to by the
pPictureResource member of each element of pDecodeInfo→pReferenceSlots must be in the IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR layout at the time the video decode operation is executed on the device
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pNext chain of pDecodeInfo must include a VkVideoDecodeH264PictureInfoKHR structure
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR but was not created with interlaced frame support, then the decode output picture must represent a frame
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then all elements of the pSliceOffsets member of the VkVideoDecodeH264PictureInfoKHR structure included in the pNext chain of pDecodeInfo must be less than pDecodeInfo→srcBufferRange
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the bound video session parameters object must contain a StdVideoH264SequenceParameterSet entry with seq_parameter_set_id matching StdVideoDecodeH264PictureInfo::seq_parameter_set_id that is provided in the pStdPictureInfo member of the VkVideoDecodeH264PictureInfoKHR structure included in the pNext chain of pDecodeInfo
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the bound video session parameters object must contain a StdVideoH264PictureParameterSet entry with seq_parameter_set_id and pic_parameter_set_id matching StdVideoDecodeH264PictureInfo::seq_parameter_set_id and StdVideoDecodeH264PictureInfo::pic_parameter_set_id, respectively, that are provided in the pStdPictureInfo member of the VkVideoDecodeH264PictureInfoKHR structure included in the pNext chain of pDecodeInfo
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and pDecodeInfo→pSetupReferenceSlot is not NULL, then the pNext chain of pDecodeInfo→pSetupReferenceSlot must include a VkVideoDecodeH264DpbSlotInfoKHR structure
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR but was not created with interlaced frame support, and pDecodeInfo→pSetupReferenceSlot is not NULL, then the reconstructed picture must represent a frame
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pNext chain of each element of pDecodeInfo→pReferenceSlots must include a VkVideoDecodeH264DpbSlotInfoKHR structure
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR but was not created with interlaced frame support, then each active reference picture corresponding to the elements of pDecodeInfo→pReferenceSlots must represent a frame
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, pDecodeInfo→pSetupReferenceSlot is not NULL, and the decode output picture represents a frame, then the reconstructed picture must also represent a frame
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, pDecodeInfo→pSetupReferenceSlot is not NULL, and the decode output picture represents a top field, then the reconstructed picture must also represent a top field
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, pDecodeInfo→pSetupReferenceSlot is not NULL, and the decode output picture represents a bottom field, then the reconstructed picture must also represent a bottom field
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an active reference picture corresponding to any element of pDecodeInfo→pReferenceSlots represents a frame, then the DPB slot index of the bound video session specified by the slotIndex member of that element must be currently associated with a frame picture matching the video picture resource specified by the pPictureResource member of the same element at the time the command is executed on the device
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an active reference picture corresponding to any element of pDecodeInfo→pReferenceSlots represents a top field, then the DPB slot index of the bound video session specified by the slotIndex member of that element must be currently associated with a top field picture matching the video picture resource specified by the pPictureResource member of the same element at the time the command is executed on the device
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an active reference picture corresponding to any element of pDecodeInfo→pReferenceSlots represents a bottom field, then the DPB slot index of the bound video session specified by the slotIndex member of that element must be currently associated with a bottom field picture matching the video picture resource specified by the pPictureResource member of the same element at the time the command is executed on the device
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pNext chain of pDecodeInfo must include a VkVideoDecodeH265PictureInfoKHR structure
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then all elements of the pSliceSegmentOffsets member of the VkVideoDecodeH265PictureInfoKHR structure included in the pNext chain of pDecodeInfo must be less than pDecodeInfo→srcBufferRange
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the bound video session parameters object must contain a StdVideoH265VideoParameterSet entry with vps_video_parameter_set_id matching StdVideoDecodeH265PictureInfo::sps_video_parameter_set_id that is provided in the pStdPictureInfo member of the VkVideoDecodeH265PictureInfoKHR structure included in the pNext chain of pDecodeInfo
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the bound video session parameters object must contain a StdVideoH265SequenceParameterSet entry with sps_video_parameter_set_id and sps_seq_parameter_set_id matching StdVideoDecodeH265PictureInfo::sps_video_parameter_set_id and StdVideoDecodeH265PictureInfo::pps_seq_parameter_set_id, respectively, that are provided in the pStdPictureInfo member of the VkVideoDecodeH265PictureInfoKHR structure included in the pNext chain of pDecodeInfo
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the bound video session parameters object must contain a StdVideoH265PictureParameterSet entry with sps_video_parameter_set_id, pps_seq_parameter_set_id, and pps_pic_parameter_set_id matching StdVideoDecodeH265PictureInfo::sps_video_parameter_set_id, StdVideoDecodeH265PictureInfo::pps_seq_parameter_set_id, and StdVideoDecodeH265PictureInfo::pps_pic_parameter_set_id, respectively, that are provided in the pStdPictureInfo member of the VkVideoDecodeH265PictureInfoKHR structure included in the pNext chain of pDecodeInfo
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and pDecodeInfo→pSetupReferenceSlot is not NULL, then the pNext chain of pDecodeInfo→pSetupReferenceSlot must include a VkVideoDecodeH265DpbSlotInfoKHR structure
- If the bound video session was created with the video codec operation
VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pNext chain of each element of pDecodeInfo→pReferenceSlots must include a VkVideoDecodeH265DpbSlotInfoKHR structure
Valid Usage (Implicit)
commandBuffer must be a valid VkCommandBuffer handle
pDecodeInfo must be a valid pointer to a valid VkVideoDecodeInfoKHR structure
commandBuffer must be in the recording state
- The
VkCommandPool that commandBuffer was allocated from must support decode operations
- This command must only be called outside of a render pass instance
- This command must only be called inside of a video coding scope
commandBuffer must be a primary VkCommandBuffer
Host Synchronization
- Host access to
commandBuffer must be externally synchronized
- Host access to the
VkCommandPool that commandBuffer was allocated from must be externally synchronized
Command Properties
See Also
VkVideoDecodeInfoKHR
- Parameters
- commandBuffer:VkCommandBuffer
the command buffer in which to record the command.
- pDecodeInfo:VkVideoDecodeInfoKHR
a pointer to a VkVideoDecodeInfoKHR structure specifying the parameters of the video decode operations.
|