C Specification
To launch video decode operations, call:
// Provided by VK_KHR_video_decode_queue
void vkCmdDecodeVideoKHR(
VkCommandBuffer commandBuffer,
const VkVideoDecodeInfoKHR* pDecodeInfo);
Parameters
-
commandBuffer
is the command buffer in which to record the command. -
pDecodeInfo
is 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->pReferenceSlots
array. 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->dstPictureResource
and any codec-specific parameters provided in thepDecodeInfo->pNext
chain, 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 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 ofpDecodeInfo->referenceSlotCount
.-
If the bound video session was created with an H.264 decode profile, then let
activeReferencePictureCount
be the value ofpDecodeInfo->referenceSlotCount
plus the number of elements of thepDecodeInfo->pReferenceSlots
array that have a VkVideoDecodeH264DpbSlotInfoKHR structure included in theirpNext
chain with bothpStdReferenceInfo->flags.top_field_flag
andpStdReferenceInfo->flags.bottom_field_flag
set.NoteThis means that the elements of
pDecodeInfo->pReferenceSlots
that 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 codedOffsetGranularity
be the minimum alignment requirement for the coded offset of video picture resources. Unless otherwise defined, the value of thex
andy
members ofcodedOffsetGranularity
are0
.-
If the bound video session was created with an H.264 decode profile with a VkVideoDecodeH264ProfileInfoKHR::
pictureLayout
ofVK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR
, thencodedOffsetGranularity
is equal to VkVideoDecodeH264CapabilitiesKHR::fieldOffsetGranularity
, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for that video profile.
-
-
Let
uint32_t dpbFrameUseCount[]
be an array of sizemaxDpbSlots
, wheremaxDpbSlots
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 be0
.-
If
pDecodeInfo->pSetupReferenceSlot
is notNULL
, thendpbFrameUseCount[i]
is incremented by one, wherei
equalspDecodeInfo->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_flag
orpStdReferenceInfo->flags.bottom_field_flag
is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepDecodeInfo->pSetupReferenceSlot->pNext
chain. -
For each element of
pDecodeInfo->pReferenceSlots
,dpbFrameUseCount[i]
is incremented by one, wherei
equals theslotIndex
member 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_flag
orpStdReferenceInfo->flags.bottom_field_flag
is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepNext
chain of the corresponding element ofpDecodeInfo->pReferenceSlots
.
-
-
Let
uint32_t dpbTopFieldUseCount[]
anduint32_t dpbBottomFieldUseCount[]
be arrays of sizemaxDpbSlots
, wheremaxDpbSlots
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 be0
.-
If the bound video session object was created with an H.264 decode profile and
pDecodeInfo->pSetupReferenceSlot
is notNULL
, then perform the following:-
If
pStdReferenceInfo->flags.top_field_flag
is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepDecodeInfo->pSetupReferenceSlot->pNext
chain, thendpbTopFieldUseCount[i]
is incremented by one, wherei
equalspDecodeInfo->pSetupReferenceSlot->slotIndex
. -
If
pStdReferenceInfo->flags.bottom_field_flag
is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepDecodeInfo->pSetupReferenceSlot->pNext
chain, thendpbBottomFieldUseCount[i]
is incremented by one, wherei
equalspDecodeInfo->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 thepNext
chain of the element, thendpbTopFieldUseCount[i]
is incremented by one, wherei
equals theslotIndex
member of the element. -
If
pStdReferenceInfo->flags.bottom_field_flag
is set in the VkVideoDecodeH264DpbSlotInfoKHR structure in thepNext
chain of the element, thendpbBottomFieldUseCount[i]
is incremented by one, wherei
equals theslotIndex
member 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.