C Specification
To launch video decode operations, call:
// Provided by VK_KHR_video_decode_queue
void vkCmdDecodeVideoKHR(
VkCommandBuffer commandBuffer,
const VkVideoDecodeInfoKHR* pDecodeInfo);
Parameters
-
commandBufferis the command buffer in which to record the command. -
pDecodeInfois a pointer to a VkVideoDecodeInfoKHR structure specifying the parameters of the video decode operations.
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.
If the bound video session was created with
VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR and the pNext
chain of pDecodeInfo includes a VkVideoInlineQueryInfoKHR
structure with its queryPool member specifying a valid
VkQueryPool handle, then this command will execute a query for each
video decode operation issued by it.
- Active Reference Picture Information
-
The list of active reference pictures used by a video decode operation is a list of image subregions used as the source of reference picture data and related parameters, and is derived from the VkVideoReferenceSlotInfoKHR structures provided as the elements of the
pDecodeInfo->pReferenceSlotsarray. For each element ofpDecodeInfo->pReferenceSlots, one or more elements are added to the active reference picture list, as defined by the codec-specific semantics. Each element of this list contains the following 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
-
Information related to the optional reconstructed picture used by a video decode operation is derived from the VkVideoReferenceSlotInfoKHR structure pointed to by
pDecodeInfo->pSetupReferenceSlot, if notNULL, as defined by the codec-specific semantics, and consists of the following:-
The image subregion within the image subresource referred to by the video picture resource used as the reconstructed picture.
-
The DPB slot index to use for picture reconstruction.
-
The codec-specific reference information related to the reconstructed picture.
-
Specifying a valid VkVideoReferenceSlotInfoKHR structure in
pDecodeInfo->pSetupReferenceSlot is always required, unless the video
session was created with VkVideoSessionCreateInfoKHR::maxDpbSlot
equal to zero.
However, the DPB slot identified by
pDecodeInfo->pSetupReferenceSlot->slotIndex is only
activated with the reconstructed
picture specified in
pDecodeInfo->pSetupReferenceSlot->pPictureResource if reference
picture setup is requested according to the
codec-specific semantics.
If reconstructed picture information is specified, and
pDecodeInfo->pSetupReferenceSlot->pPictureResource refers to a
video picture resource different than that of
the decode output picture, but reference picture
setup is not requested, the contents of the video
picture resource corresponding to the reconstructed picture will be
undefined after the video decode operation.
|
Note
Some implementations may always output the reconstructed picture or use it as temporary storage during the video decode operation even when the reconstructed picture is not marked for future reference. |
- Decode Output Picture Information
-
Information related to the decode output picture used by a video decode operation is derived from
pDecodeInfo->dstPictureResourceand any codec-specific parameters provided in thepDecodeInfo->pNextchain, as defined by the codec-specific semantics, and consists of the following:-
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 activeReferencePictureCountbe the size of the list of active reference pictures used by the video decode operation. Unless otherwise defined,activeReferencePictureCountis set to the value ofpDecodeInfo->referenceSlotCount.-
If the bound video session was created with an H.264 decode profile, then let
activeReferencePictureCountbe the value ofpDecodeInfo->referenceSlotCountplus the number of elements of thepDecodeInfo->pReferenceSlotsarray that have a VkVideoDecodeH264DpbSlotInfoKHR structure included in theirpNextchain with bothpStdReferenceInfo->flags.top_field_flagandpStdReferenceInfo->flags.bottom_field_flagset.NoteThis means that the elements of
pDecodeInfo->pReferenceSlotsthat include both a top and bottom field reference are counted as two separate active reference pictures, as described in the active reference picture list construction rules for H.264 decode operations.
-
-
Let
VkOffset2D codedOffsetGranularitybe the minimum alignment requirement for the coded offset of video picture resources. Unless otherwise defined, the value of thexandymembers ofcodedOffsetGranularityare0.-
If the bound video session was created with an H.264 decode profile with a VkVideoDecodeH264ProfileInfoKHR::
pictureLayoutofVK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR, thencodedOffsetGranularityis equal to VkVideoDecodeH264CapabilitiesKHR::fieldOffsetGranularity, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for that video profile.
-
-
Let
uint32_t dpbFrameUseCount[]be an array of sizemaxDpbSlots, wheremaxDpbSlotsis the VkVideoSessionCreateInfoKHR::maxDpbSlotsthe 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 be0.-
If
pDecodeInfo->pSetupReferenceSlotis notNULL, thendpbFrameUseCount[i]is incremented by one, whereiequalspDecodeInfo->pSetupReferenceSlot->slotIndex. If the bound video session object was created with an H.264 decode profile, thendpbFrameUseCount[i]is decremented by one if eitherpStdReferenceInfo->flags.top_field_flagorpStdReferenceInfo->flags.bottom_field_flagis set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepDecodeInfo->pSetupReferenceSlot->pNextchain. -
For each element of
pDecodeInfo->pReferenceSlots,dpbFrameUseCount[i]is incremented by one, whereiequals theslotIndexmember of the corresponding element. If the bound video session object was created with an H.264 decode profile, thendpbFrameUseCount[i]is decremented by one if eitherpStdReferenceInfo->flags.top_field_flagorpStdReferenceInfo->flags.bottom_field_flagis set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepNextchain of the corresponding element ofpDecodeInfo->pReferenceSlots.
-
-
Let
uint32_t dpbTopFieldUseCount[]anduint32_t dpbBottomFieldUseCount[]be arrays of sizemaxDpbSlots, wheremaxDpbSlotsis the VkVideoSessionCreateInfoKHR::maxDpbSlotsthe 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 be0.-
If the bound video session object was created with an H.264 decode profile and
pDecodeInfo->pSetupReferenceSlotis notNULL, then perform the following:-
If
pStdReferenceInfo->flags.top_field_flagis set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepDecodeInfo->pSetupReferenceSlot->pNextchain, thendpbTopFieldUseCount[i]is incremented by one, whereiequalspDecodeInfo->pSetupReferenceSlot->slotIndex. -
If
pStdReferenceInfo->flags.bottom_field_flagis set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepDecodeInfo->pSetupReferenceSlot->pNextchain, thendpbBottomFieldUseCount[i]is incremented by one, whereiequalspDecodeInfo->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_flagis set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepNextchain of the element, thendpbTopFieldUseCount[i]is incremented by one, whereiequals theslotIndexmember of the element. -
If
pStdReferenceInfo->flags.bottom_field_flagis set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepNextchain of the element, thendpbBottomFieldUseCount[i]is incremented by one, whereiequals theslotIndexmember of the element.
-
-
Document Notes
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.