blob: 9739c1daf34656e7ba97720ed437244cf896ec59 [file] [log] [blame]
// Copyright 2018-2023 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0
[[video-coding]]
= Video Coding
Vulkan implementations may: expose one or more queue families supporting
video coding operations.
These operations are performed by recording them into a command buffer
within a <<video-coding-scope,video coding scope>>, and submitting them to
queues with compatible video coding capabilities.
The Vulkan video functionalities are designed to be made available through a
set of APIs built on top of each other, consisting of:
* A core API providing common video coding functionalities,
* APIs providing codec-independent video decode and video encode related
functionalities, respectively,
* Additional codec-specific APIs built on top of those.
This chapter details the fundamental components and operations of these.
[[video-picture-resources]]
== Video Picture Resources
In the context of video coding, multidimensional arrays of image data that
can: be used as the source or target of video coding operations are referred
to as _video picture resources_.
They may: store additional metadata that includes implementation-private
information used during the execution of video coding operations, as
discussed later.
Video picture resources are backed by slink:VkImage objects.
Individual subregions of slink:VkImageView objects created from such
resources can: be used as
ifdef::VK_KHR_video_decode_queue[]
<<decode-output-picture,decode output pictures>>,
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
<<encode-input-picture,encode input pictures>>,
endif::VK_KHR_video_encode_queue[]
<<reconstructed-picture,reconstructed pictures>>, and/or
<<reference-picture, reference pictures>>.
The parameters of a video picture resource are specified using a
sname:VkVideoPictureResourceInfoKHR structure.
[open,refpage='VkVideoPictureResourceInfoKHR',desc='Structure specifying the parameters of a video picture resource',type='structs']
--
The sname:VkVideoPictureResourceInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoPictureResourceInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:codedOffset is the offset in texels of the image subregion to use.
* pname:codedExtent is the size in pixels of the coded image data.
* pname:baseArrayLayer is the array layer of the image view specified in
pname:imageViewBinding to use as the video picture resource.
* pname:imageViewBinding is an image view representing the video picture
resource.
[[video-image-subresource-reference]]
The image subresource referred to by such a structure is defined as the
image array layer index specified in pname:baseArrayLayer relative to the
image subresource range the image view specified in pname:imageViewBinding
was created with.
The meaning of the pname:codedOffset and pname:codedExtent depends on the
command and context the video picture resource is used in, as well as on the
used <<video-profiles,video profile>> and corresponding codec-specific
semantics, as described later.
[[video-picture-resource-uniqueness]]
A video picture resource is uniquely defined by the image subresource
referred to by an instance of this structure, together with the
pname:codedOffset and pname:codedExtent members that identify the image
subregion within the image subresource referenced corresponding to the video
picture resource according to the particular codec-specific semantics.
Accesses to image data within a video picture resource happen at the
granularity indicated by
slink:VkVideoCapabilitiesKHR::pname:pictureAccessGranularity, as returned by
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the used <<video-profiles,
video profile>>.
As a result, given an effective image subregion corresponding to a video
picture resource, the actual image subregion accessed may: be larger than
that as it may: include additional padding texels due to the picture access
granularity.
Any writes performed by video coding operations to such padding texels will
result in undefined: texel values.
[[video-picture-resource-matching]]
Two video picture resources match if they refer to the same image
subresource and they specify identical pname:codedOffset and
pname:codedExtent values.
.Valid Usage
****
* [[VUID-VkVideoPictureResourceInfoKHR-baseArrayLayer-07175]]
pname:baseArrayLayer must: be less than the
slink:VkImageViewCreateInfo::pname:subresourceRange.layerCount specified
when the image view pname:imageViewBinding was created
****
include::{generated}/validity/structs/VkVideoPictureResourceInfoKHR.adoc[]
--
[[dpb]]
== Decoded Picture Buffer
[[reconstructed-picture]]
An integral part of video coding pipelines is the reconstruction of pictures
from a compressed video bitstream.
A _reconstructed picture_ is a <<video-picture-resources,video picture
resource>> resulting from this process.
[[reference-picture]]
Such reconstructed pictures can: be used as _reference pictures_ in
subsequent video coding operations to provide predictions of the values of
samples of subsequently decoded or encoded pictures.
The correct use of such reconstructed pictures as reference pictures is
driven by the video compression standard, the implementation, and the
application-specific use cases.
[[active-reference-pictures]]
The list of reference pictures used to provide such predictions within a
single video coding operation is referred to as the list of _active
reference pictures_.
The _decoded picture buffer (DPB)_ is an indexed data structure that
maintains the set of reference pictures available to be used in video coding
operations.
[[dpb-slot]] Individual indexed entries of the DPB are referred to as the
_decoded picture buffer (DPB) slots_.
[[dpb-capacity]] The range of valid DPB slot indices is between zero and
`N-1`, where `N` is the capacity of the DPB.
Each DPB slot can: refer to a reference picture containing a _video frame_
ifdef::VK_KHR_video_decode_h264[]
or can: refer to up to two reference pictures containing the top and/or
bottom _fields_ that, when both present, together represent a full _video
frame_
endif::VK_KHR_video_decode_h264[]
.
[[dpb-state-and-backing-store]]
In Vulkan, the state and the backing store of the DPB is separated as
follows:
* The state of individual DPB slots is maintained by <<video-session,video
session>> objects.
* The backing store of DPB slots is provided by subregions of
slink:VkImage objects used as <<video-picture-resources,video picture
resources>>.
In addition, the implementation may: also maintain opaque metadata
associated with DPB slots, including:
* [[reference-metadata]] _Reference picture metadata_ corresponding to the
video picture resource associated with the DPB slot.
Such metadata may: be stored by the implementation as part of the DPB slot
state maintained by the video session, or as part of the video picture
resource backing the DPB slot.
Any metadata stored in the video picture resources backing DPB slots are
independent of the video session used to store it, hence such video picture
resources can: be shared with other video sessions.
Correspondingly, any metadata that is dependent on the video session will
always be stored as part of the DPB slot state maintained by that video
session.
The responsibility of managing the DPB is split between the application and
the implementation as follows:
* The application maintains the association between <<dpb-slot,DPB slot>>
indices and corresponding <<video-picture-resources,video picture
resources>>.
* The implementation maintains global and per-slot opaque
<<reference-metadata,reference picture metadata>>.
In addition, the application is also responsible for managing the mapping
between the codec-specific picture IDs and DPB slots, and any other
codec-specific states unless otherwise specified.
[[dpb-slot-states]]
=== DPB Slot States
At a given time, each DPB slot is either in _active_ or _inactive_ state.
Initially, all DPB slots managed by a <<video-session,video session>> are in
_inactive_ state.
A DPB slot can: be _activated_ by using it as the target of picture
reconstruction within a video coding operation, changing its state to
_active_.
As part of the picture reconstruction, the implementation may: also generate
<<reference-metadata,reference picture metadata>>.
If such a video coding operation completes successfully, the activated DPB
slot will have a _valid picture reference_ and the <<reconstructed-picture,
reconstructed picture>> is associated with the DPB slot.
ifdef::VK_KHR_video_decode_h264[]
This is true even if the DPB slot is used as the target of a picture
reconstruction that only sets up a top field or bottom field reference
picture and thus does not yet refer to a complete frame.
endif::VK_KHR_video_decode_h264[]
However, if any data provided as input to such a video coding operation is
not compliant to the video compression standard used, that video coding
operation may: complete unsuccessfully, in which case the activated DPB slot
will have an _invalid picture reference_.
ifdef::VK_KHR_video_decode_h264[]
This is true even if the DPB slot previously had a valid picture reference
to a top field or bottom field reference picture, but the reconstruction of
the other field corresponding to the DPB slot failed.
endif::VK_KHR_video_decode_h264[]
The application can: use <<queries,queries>> to get feedback about the
outcome of video coding operations and use the resulting
elink:VkQueryResultStatusKHR value to determine whether the video coding
operation completed successfully (result status is positive) or
unsuccessfully (result status is negative).
Using a <<reference-picture,reference picture>> associated with a DPB slot
that has an _invalid picture reference_ as an <<active-reference-pictures,
active reference picture>> in subsequent video coding operations is legal,
however, the contents of the outputs of such operations are undefined:, and
any DPB slots activated by such video coding operations will also have an
_invalid picture reference_.
This is true even if such video coding operations may: otherwise complete
successfully.
A DPB slot can: also be _deactivated_ by the application, changing its state
to _inactive_ and invalidating any picture references and
<<reference-metadata,reference picture metadata>> associated with the DPB
slot.
A DPB slot can: be activated with a new frame even if it is already active.
In this case all previous associations of the DPB slots with
<<reference-picture,reference pictures>> are replaced with an association
with the <<reconstructed-picture,reconstructed picture>> used to activate
it.
ifdef::VK_KHR_video_decode_h264[]
If an already active DPB slot is activated with a reconstructed field
picture, then the behavior is as follows:
* If the DPB slot is currently associated with a frame, then that
association is replaced with an association with the reconstructed field
picture used to activate it.
* If the DPB slot is not currently associated with a top field picture and
the DPB slot is activated with a top field picture, or if the DPB slot
is not currently associated with a bottom field picture and the DPB slot
is activated with a bottom field picture, then the DPB slot is
associated with the reconstructed field picture used to activate it,
without disturbing the other field picture association, if any.
* If the DPB slot is currently associated with a top field picture and the
DPB slot is activated with a new top field picture, or if the DPB slot
is currently associated with a bottom field picture and the DPB slot is
activated with a new bottom field picture, then that association is
replaced with an association with the reconstructed field picture used
to activate it, without disturbing the other field picture association,
if any.
endif::VK_KHR_video_decode_h264[]
[[video-profiles]]
== Video Profiles
[open,refpage='VkVideoProfileInfoKHR',desc='Structure specifying a video profile',type='structs']
--
The sname:VkVideoProfileInfoKHR structure is defined as follows:
include::{generated}/api/structs/VkVideoProfileInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:videoCodecOperation is a elink:VkVideoCodecOperationFlagBitsKHR
value specifying a video codec operation.
* pname:chromaSubsampling is a bitmask of
elink:VkVideoChromaSubsamplingFlagBitsKHR specifying video chroma
subsampling information.
* pname:lumaBitDepth is a bitmask of
elink:VkVideoComponentBitDepthFlagBitsKHR specifying video luma bit
depth information.
* pname:chromaBitDepth is a bitmask of
elink:VkVideoComponentBitDepthFlagBitsKHR specifying video chroma bit
depth information.
Video profiles are provided as input to video capability queries such as
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR or
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR, as well as when creating
resources to be used by video coding operations such as images, buffers,
query pools, and video sessions.
The full description of a video profile is specified by an instance of this
structure, and the codec-specific and auxiliary structures provided in its
pname:pNext chain.
[[video-profile-error-codes]]
When this structure is specified as an input parameter to
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR, or through the
pname:pProfiles member of an slink:VkVideoProfileListInfoKHR structure in
the pname:pNext chain of the input parameter of a query command such as
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR or
flink:vkGetPhysicalDeviceImageFormatProperties2, the following error codes
indicate specific causes of the failure of the query operation:
* ename:VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR indicates that the
requested video picture layout
ifdef::VK_KHR_video_decode_h264[]
(e.g. through the pname:pictureLayout member of a
slink:VkVideoDecodeH264ProfileInfoKHR structure included in the
pname:pNext chain of sname:VkVideoProfileInfoKHR)
endif::VK_KHR_video_decode_h264[]
is not supported.
* ename:VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR indicates that
a video profile operation specified by pname:videoCodecOperation is not
supported.
* ename:VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR indicates that
video format parameters specified by pname:chromaSubsampling,
pname:lumaBitDepth, or pname:chromaBitDepth are not supported.
* ename:VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR indicates that the
codec-specific parameters corresponding to the video codec operation are
not supported.
.Valid Usage
****
* [[VUID-VkVideoProfileInfoKHR-chromaSubsampling-07013]]
pname:chromaSubsampling must: have a single bit set
* [[VUID-VkVideoProfileInfoKHR-lumaBitDepth-07014]]
pname:lumaBitDepth must: have a single bit set
* [[VUID-VkVideoProfileInfoKHR-chromaSubsampling-07015]]
If pname:chromaSubsampling is not
ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR, then
pname:chromaBitDepth must: have a single bit set
ifdef::VK_KHR_video_decode_h264[]
* [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07179]]
If pname:videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext
chain must: include a slink:VkVideoDecodeH264ProfileInfoKHR structure
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07180]]
If pname:videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext
chain must: include a slink:VkVideoDecodeH265ProfileInfoKHR structure
endif::VK_KHR_video_decode_h265[]
ifdef::VK_EXT_video_encode_h264[]
* [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07181]]
If pname:videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, then the pname:pNext
chain must: include a slink:VkVideoEncodeH264ProfileInfoEXT structure
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07182]]
If pname:videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT, then the pname:pNext
chain must: include a slink:VkVideoEncodeH265ProfileInfoEXT structure
endif::VK_EXT_video_encode_h265[]
****
include::{generated}/validity/structs/VkVideoProfileInfoKHR.adoc[]
--
[open,refpage='VkVideoCodecOperationFlagBitsKHR',desc='Video codec operation bits',type='enums']
--
Possible values of slink:VkVideoProfileInfoKHR::pname:videoCodecOperation,
specifying the type of video coding operation and video compression standard
used by a video profile, are:
include::{generated}/api/enums/VkVideoCodecOperationFlagBitsKHR.adoc[]
* ename:VK_VIDEO_CODEC_OPERATION_NONE_KHR indicates no support for any
video codec operations.
ifdef::VK_KHR_video_decode_h264[]
* ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR specifies support for
H.264 video decode operations.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR specifies support for
H.265 video decode operations.
endif::VK_KHR_video_decode_h265[]
ifdef::VK_EXT_video_encode_h264[]
* ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT specifies support for
H.264 video encode operations.
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT specifies support for
H.265 video encode operations.
endif::VK_EXT_video_encode_h265[]
--
[open,refpage='VkVideoCodecOperationFlagsKHR',desc='Bitmask of VkVideoCodecOperationFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoCodecOperationFlagsKHR.adoc[]
tname:VkVideoCodecOperationFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoCodecOperationFlagBitsKHR.
--
[open,refpage='VkVideoChromaSubsamplingFlagBitsKHR',desc='Video format chroma subsampling bits',type='enums']
--
The video format chroma subsampling is defined with the following enums:
include::{generated}/api/enums/VkVideoChromaSubsamplingFlagBitsKHR.adoc[]
* ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR specifies that the
format is monochrome.
* ename:VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR specified that the format
is 4:2:0 chroma subsampled, i.e. the two chroma components are sampled
horizontally and vertically at half the sample rate of the luma
component.
* ename:VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR - the format is 4:2:2
chroma subsampled, i.e. the two chroma components are sampled
horizontally at half the sample rate of luma component.
* ename:VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR - the format is 4:4:4
chroma sampled, i.e. all three components of the {YCbCr} format are
sampled at the same rate, thus there is no chroma subsampling.
--
Chroma subsampling is described in more detail in the
<<textures-chroma-reconstruction,Chroma Reconstruction>> section.
[open,refpage='VkVideoChromaSubsamplingFlagsKHR',desc='Bitmask of VkVideoChromaSubsamplingFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoChromaSubsamplingFlagsKHR.adoc[]
tname:VkVideoChromaSubsamplingFlagsKHR is a bitmask type for setting a mask
of zero or more elink:VkVideoChromaSubsamplingFlagBitsKHR.
--
[open,refpage='VkVideoComponentBitDepthFlagBitsKHR',desc='Video format component bit depth',type='enums']
--
Possible values for the video format component bit depth are:
include::{generated}/api/enums/VkVideoComponentBitDepthFlagBitsKHR.adoc[]
* ename:VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR specifies a component bit
depth of 8 bits.
* ename:VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR specifies a component bit
depth of 10 bits.
* ename:VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR specifies a component bit
depth of 12 bits.
--
[open,refpage='VkVideoComponentBitDepthFlagsKHR',desc='Bitmask of VkVideoComponentBitDepthFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoComponentBitDepthFlagsKHR.adoc[]
tname:VkVideoComponentBitDepthFlagsKHR is a bitmask type for setting a mask
of zero or more elink:VkVideoComponentBitDepthFlagBitsKHR.
--
ifdef::VK_KHR_video_decode_queue[]
[open,refpage='VkVideoDecodeUsageInfoKHR',desc='Structure specifying video decode usage information',type='structs']
--
Additional information about the video decode use case can: be provided by
adding a sname:VkVideoDecodeUsageInfoKHR structure to the pname:pNext chain
of slink:VkVideoProfileInfoKHR.
The sname:VkVideoDecodeUsageInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoDecodeUsageInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:videoUsageHints is a bitmask of
elink:VkVideoDecodeUsageFlagBitsKHR specifying hints about the intended
use of the video decode profile.
include::{generated}/validity/structs/VkVideoDecodeUsageInfoKHR.adoc[]
--
[open,refpage='VkVideoDecodeUsageFlagBitsKHR',desc='Video decode usage flags',type='enums']
--
The following bits can: be specified in
slink:VkVideoDecodeUsageInfoKHR::pname:videoUsageHints as a hint about the
video decode use case:
include::{generated}/api/enums/VkVideoDecodeUsageFlagBitsKHR.adoc[]
* ename:VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR specifies that video
decoding is intended to be used in conjunction with video encoding to
transcode a video bitstream with the same and/or different codecs.
* ename:VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR specifies that video
decoding is intended to be used to consume a local video bitstream.
* ename:VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR specifies that video
decoding is intended to be used to consume a video bitstream received as
a continuous flow over network.
[NOTE]
.Note
====
There are no restrictions on the combination of bits that can: be specified
by the application.
However, applications should: use reasonable combinations in order for the
implementation to be able to select the most appropriate mode of operation
for the particular use case.
====
--
[open,refpage='VkVideoDecodeUsageFlagsKHR',desc='Bitmask specifying the video decode usage flags',type='flags']
--
include::{generated}/api/flags/VkVideoDecodeUsageFlagsKHR.adoc[]
tname:VkVideoDecodeUsageFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoDecodeUsageFlagBitsKHR.
--
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
[open,refpage='VkVideoEncodeUsageInfoKHR',desc='Structure specifying video encode usage information',type='structs']
--
Additional information about the video encode use case can: be provided by
adding a sname:VkVideoEncodeUsageInfoKHR structure to the pname:pNext chain
of slink:VkVideoProfileInfoKHR.
The sname:VkVideoEncodeUsageInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoEncodeUsageInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:videoUsageHints is a bitmask of
elink:VkVideoEncodeUsageFlagBitsKHR specifying hints about the intended
use of the video encode profile.
* pname:videoContentHints is a bitmask of
elink:VkVideoEncodeContentFlagBitsKHR specifying hints about the content
to be encoded using the video encode profile.
* pname:tuningMode is a elink:VkVideoEncodeTuningModeKHR value specifying
the tuning mode to use when encoding with the video profile.
include::{generated}/validity/structs/VkVideoEncodeUsageInfoKHR.adoc[]
--
[open,refpage='VkVideoEncodeUsageFlagBitsKHR',desc='Video encode usage flags',type='enums']
--
The following bits can: be specified in
slink:VkVideoEncodeUsageInfoKHR::pname:videoUsageHints as a hint about the
video encode use case:
include::{generated}/api/enums/VkVideoEncodeUsageFlagBitsKHR.adoc[]
* ename:VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR specifies that video
encoding is intended to be used in conjunction with video decoding to
transcode a video bitstream with the same and/or different codecs.
* ename:VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR specifies that video
encoding is intended to be used to produce a video bitstream that is
expected to be sent as a continuous flow over network.
* ename:VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR specifies that video
encoding is intended to be used for real-time recording for offline
consumption.
* ename:VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR specifies that video
encoding is intended to be used in a video conferencing scenario.
[NOTE]
.Note
====
There are no restrictions on the combination of bits that can: be specified
by the application.
However, applications should: use reasonable combinations in order for the
implementation to be able to select the most appropriate mode of operation
for the particular use case.
====
--
[open,refpage='VkVideoEncodeUsageFlagsKHR',desc='Bitmask specifying the video encode usage flags',type='flags']
--
include::{generated}/api/flags/VkVideoEncodeUsageFlagsKHR.adoc[]
tname:VkVideoEncodeUsageFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoEncodeUsageFlagBitsKHR.
--
[open,refpage='VkVideoEncodeContentFlagBitsKHR',desc='Video encode content flags',type='enums']
--
The following bits can: be specified in
slink:VkVideoEncodeUsageInfoKHR::pname:videoContentHints as a hint about the
encoded video content:
include::{generated}/api/enums/VkVideoEncodeContentFlagBitsKHR.adoc[]
* ename:VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR specifies that video
encoding is intended to be used to encode camera content.
* ename:VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR specifies that video
encoding is intended to be used to encode desktop content.
* ename:VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR specified that video
encoding is intended to be used to encode rendered (e.g. game) content.
[NOTE]
.Note
====
There are no restrictions on the combination of bits that can: be specified
by the application.
However, applications should: use reasonable combinations in order for the
implementation to be able to select the most appropriate mode of operation
for the particular content type.
====
--
[open,refpage='VkVideoEncodeContentFlagsKHR',desc='Bitmask specifying the video encode content flags',type='flags']
--
include::{generated}/api/flags/VkVideoEncodeContentFlagsKHR.adoc[]
tname:VkVideoEncodeContentFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoEncodeContentFlagBitsKHR.
--
[open,refpage='VkVideoEncodeTuningModeKHR',desc='Video encode tuning mode',type='enums']
--
Possible video encode tuning mode values are as follows:
include::{generated}/api/enums/VkVideoEncodeTuningModeKHR.adoc[]
* ename:VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR specifies the default
tuning mode.
* ename:VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR specifies that video
encoding is tuned for high quality.
When using this tuning mode, the implementation may: compromise the
latency of video encoding operations to improve quality.
* ename:VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR specifies that video
encoding is tuned for low latency.
When using this tuning mode, the implementation may: compromise quality
to increase the performance and lower the latency of video encode
operations.
* ename:VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR specifies that
video encoding is tuned for ultra-low latency.
When using this tuning mode, the implementation may: compromise quality
to maximize the performance and minimize the latency of video encoding
operations.
* ename:VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR specifies that video
encoding is tuned for lossless encoding.
When using this tuning mode, video encode operations produce lossless
output.
--
endif::VK_KHR_video_encode_queue[]
[open,refpage='VkVideoProfileListInfoKHR',desc='Structure specifying one or more video profiles used in conjunction',type='structs']
--
The sname:VkVideoProfileListInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoProfileListInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:profileCount is the number of elements in the pname:pProfiles
array.
* pname:pProfiles is a pointer to an array of slink:VkVideoProfileInfoKHR
structures.
[NOTE]
.Note:
====
Video transcoding is an example of a use case that necessitates the
specification of multiple profiles in various contexts.
====
When the application provides a video decode profile and one or more video
encode profiles in the profile list, the implementation ensures that any
capabilitities returned or resources created are suitable for the video
transcoding use cases without the need for manual data transformations.
.Valid Usage
****
* [[VUID-VkVideoProfileListInfoKHR-pProfiles-06813]]
pname:pProfiles must: not contain more than one element whose
pname:videoCodecOperation member specifies a decode operation
****
include::{generated}/validity/structs/VkVideoProfileListInfoKHR.adoc[]
--
[[video-capabilities]]
== Video Capabilities
[[video-coding-capabilities]]
=== Video Coding Capabilities
[open,refpage='vkGetPhysicalDeviceVideoCapabilitiesKHR',desc='Query video coding capabilities',type='protos']
--
To query video coding capabilities for a specific video profile, call:
include::{generated}/api/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.adoc[]
* pname:physicalDevice is the physical device from which to query the
video decode or encode capabilities.
* pname:pVideoProfile is a pointer to a slink:VkVideoProfileInfoKHR
structure.
* pname:pCapabilities is a pointer to a slink:VkVideoCapabilitiesKHR
structure in which the capabilities are returned.
[[video-profile-support]]
If the <<video-profiles,video profile>> described by pname:pVideoProfile is
supported by the implementation, then this command returns ename:VK_SUCCESS
and pname:pCapabilities is filled with the capabilities supported with the
specified video profile.
Otherwise, one of the <<video-profile-error-codes, video-profile-specific
error codes>> are returned.
.Valid Usage
****
ifdef::VK_KHR_video_decode_queue[]
* [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07183]]
If pname:pVideoProfile->videoCodecOperation specifies a decode
operation, then the pname:pNext chain of pname:pCapabilities must:
include a slink:VkVideoDecodeCapabilitiesKHR structure
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_decode_h264[]
* [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07184]]
If pname:pVideoProfile->videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext
chain of pname:pCapabilities must: include a
slink:VkVideoDecodeH264CapabilitiesKHR structure
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07185]]
If pname:pVideoProfile->videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext
chain of pname:pCapabilities must: include a
slink:VkVideoDecodeH265CapabilitiesKHR structure
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_encode_queue[]
* [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07186]]
If pname:pVideoProfile->videoCodecOperation specifies an encode
operation, then the pname:pNext chain of pname:pCapabilities must:
include a slink:VkVideoEncodeCapabilitiesKHR structure
endif::VK_KHR_video_encode_queue[]
ifdef::VK_EXT_video_encode_h264[]
* [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07187]]
If pname:pVideoProfile->videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, then the pname:pNext
chain of pname:pCapabilities must: include a
slink:VkVideoEncodeH264CapabilitiesEXT structure
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07188]]
If pname:pVideoProfile->videoCodecOperation is
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT, then the pname:pNext
chain of pname:pCapabilities must: include a
slink:VkVideoEncodeH265CapabilitiesEXT structure
endif::VK_EXT_video_encode_h265[]
****
include::{generated}/validity/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.adoc[]
--
[open,refpage='VkVideoCapabilitiesKHR',desc='Structure describing general video capabilities for a video profile',type='structs']
--
The sname:VkVideoCapabilitiesKHR structure is defined as:
include::{generated}/api/structs/VkVideoCapabilitiesKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:flags is a bitmask of elink:VkVideoCapabilityFlagBitsKHR
specifying capability flags.
* pname:minBitstreamBufferOffsetAlignment is the minimum alignment for
bitstream buffer offsets.
* pname:minBitstreamBufferSizeAlignment is the minimum alignment for
bitstream buffer range sizes.
* pname:pictureAccessGranularity is the granularity at which image access
to video picture resources happen.
* pname:minCodedExtent is the minimum width and height of the coded
frames.
* pname:maxCodedExtent is the maximum width and height of the coded
frames.
* pname:maxDpbSlots is the maximum number of <<dpb-slot,DPB slots>>
supported by a single video session.
* pname:maxActiveReferencePictures is the maximum number of
<<active-reference-pictures,active reference pictures>> a single video
coding operation can: use.
* [[video-std-header-version]] pname:stdHeaderVersion is a
slink:VkExtensionProperties structure reporting the Video Std header
name and version supported for the video profile.
ifdef::VK_KHR_video_decode_queue[]
[NOTE]
.Note:
====
It is common for video compression standards to allow using all reference
pictures associated with active DPB slots as active reference pictures,
hence for video decode profiles the values returned in pname:maxDpbSlots and
pname:maxActiveReferencePictures are often equal.
ifdef::VK_KHR_video_decode_h264[]
Similarly, in case of video decode profiles supporting field pictures the
value of pname:maxActiveReferencePictures often equals
[eq]#pname:maxDpbSlots {times} 2#.
endif::VK_KHR_video_decode_h264[]
====
endif::VK_KHR_video_decode_queue[]
include::{generated}/validity/structs/VkVideoCapabilitiesKHR.adoc[]
--
[open,refpage='VkVideoCapabilityFlagBitsKHR',desc='Video decode and encode capability bits',type='enums']
--
Bits which can: be set in slink:VkVideoCapabilitiesKHR::pname:flags are:
include::{generated}/api/enums/VkVideoCapabilityFlagBitsKHR.adoc[]
* ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR specifies that video
sessions support producing and consuming protected content.
* [[separate-reference-images]]
ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR specifies
that the <<video-picture-resources,video picture resources>> associated
with the <<dpb-slot,DPB slots>> of a video session can: be backed by
separate sname:VkImage objects.
If this capability flag is not present, then all DPB slots of a video
session must: be associated with video picture resources backed by the
same sname:VkImage object (e.g. using different layers of the same
image).
--
[open,refpage='VkVideoCapabilityFlagsKHR',desc='Bitmask of VkVideoCapabilitiesFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoCapabilityFlagsKHR.adoc[]
tname:VkVideoCapabilityFlagsKHR is a bitmask type for setting a mask of zero
or more elink:VkVideoCapabilityFlagBitsKHR.
--
[[video-format-capabilities]]
=== Video Format Capabilities
[open,refpage='vkGetPhysicalDeviceVideoFormatPropertiesKHR',desc='Query supported video decode and encode image formats and capabilities',type='protos']
--
To enumerate the supported output, input and DPB image formats and
corresponding capabilities for a specific video profile, call:
include::{generated}/api/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.adoc[]
* pname:physicalDevice is the physical device from which to query the
video format properties.
* pname:pVideoFormatInfo is a pointer to a
slink:VkPhysicalDeviceVideoFormatInfoKHR structure specifying the usage
and video profiles for which supported image formats and capabilities
are returned.
* pname:pVideoFormatPropertyCount is a pointer to an integer related to
the number of video format properties available or queried, as described
below.
* pname:pVideoFormatProperties is a pointer to an array of
slink:VkVideoFormatPropertiesKHR structures in which supported image
formats and capabilities are returned.
If pname:pVideoFormatProperties is `NULL`, then the number of video format
properties supported for the given pname:physicalDevice is returned in
pname:pVideoFormatPropertyCount.
Otherwise, pname:pVideoFormatPropertyCount must: point to a variable set by
the user to the number of elements in the pname:pVideoFormatProperties
array, and on return the variable is overwritten with the number of values
actually written to pname:pVideoFormatProperties.
If the value of pname:pVideoFormatPropertyCount is less than the number of
video format properties supported, at most pname:pVideoFormatPropertyCount
values will be written to pname:pVideoFormatProperties, and
ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
indicate that not all the available values were returned.
Video format properties are always queried with respect to a specific set of
video profiles.
These are specified by chaining the slink:VkVideoProfileListInfoKHR
structure to pname:pVideoFormatInfo.
For most use cases, the images are used by a single video session and a
single video profile is provided.
For a use case such as video transcoding, where a decode session output
image can: be used as encode input in one or more encode sessions, multiple
video profiles corresponding to the video sessions that will share the image
must: be provided.
If any of the <<video-profiles,video profiles>> specified via
slink:VkVideoProfileListInfoKHR::pname:pProfiles are not supported, then
this command returns one of the <<video-profile-error-codes,
video-profile-specific error codes>>.
Furthermore, if slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage
includes any image usage flags not supported by the specified video
profiles, then this command returns
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.
ifdef::VK_KHR_video_decode_queue[]
This command also returns ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR if
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage does not include
the appropriate flags as dictated by the decode capability flags returned in
slink:VkVideoDecodeCapabilitiesKHR::pname:flags for any of the profiles
specified in the slink:VkVideoProfileListInfoKHR structure provided in the
pname:pNext chain of pname:pVideoFormatInfo.
If the decode capability flags include
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR but not
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR, then in
order to query video format properties for decode DPB and output usage,
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include
both ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR and
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR.
Otherwise, the call will fail with
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.
If the decode capability flags include
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR but not
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR, then in
order to query video format properties for decode DPB usage,
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, but not
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR.
Otherwise, the call will fail with
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.
Similarly, to query video format properties for decode output usage,
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, but not
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR.
Otherwise, the call will fail with
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.
endif::VK_KHR_video_decode_queue[]
The pname:imageUsage member of the slink:VkPhysicalDeviceVideoFormatInfoKHR
structure specifies the expected video usage flags that the returned video
formats must: support.
Correspondingly, the pname:imageUsageFlags member of each
slink:VkVideoFormatPropertiesKHR structure returned will contain at least
the same set of image usage flags.
If the implementation supports using video input, output, or DPB images of a
particular format in operations other than video decode/encode then the
pname:imageUsageFlags member of the corresponding
slink:VkVideoFormatPropertiesKHR structure returned will include additional
image usage flags indicating that.
[NOTE]
.Note:
====
For most use cases, only decode or encode related usage flags are going to
be specified.
For a use case such as transcode, if the image were to be shared between
decode and encode session(s), then both decode and encode related usage
flags can: be set.
====
Multiple sname:VkVideoFormatPropertiesKHR entries may: be returned with the
same pname:format member with different pname:componentMapping,
pname:imageType, or pname:imageTiling values, as described later.
In addition, a different set of sname:VkVideoFormatPropertiesKHR entries
may: be returned depending on the pname:imageUsage member of the
sname:VkPhysicalDeviceVideoFormatInfoKHR structure, even for the same set of
video profiles, for example, based on whether encode input, encode DPB,
decode output, and/or decode DPB usage is requested.
The application can: select the parameters returned in the
sname:VkVideoFormatPropertiesKHR entries and use compatible parameters when
creating the input, output, and DPB images.
The implementation will report all image creation and usage flags that are
valid for images used with the requested video profiles but applications
should: create images only with those that are necessary for the particular
use case.
Before creating an image, the application can: obtain the complete set of
supported image format features by calling
flink:vkGetPhysicalDeviceImageFormatProperties2 using parameters derived
from the members of one of the reported sname:VkVideoFormatPropertiesKHR
entries and adding the same slink:VkVideoProfileListInfoKHR structure to the
pname:pNext chain of slink:VkPhysicalDeviceImageFormatInfo2.
The following applies to all sname:VkVideoFormatPropertiesKHR entries
returned by fname:vkGetPhysicalDeviceVideoFormatPropertiesKHR:
* flink:vkGetPhysicalDeviceFormatProperties2 must: succeed when called
with sname:VkVideoFormatPropertiesKHR::pname:format
* If sname:VkVideoFormatPropertiesKHR::pname:imageTiling is
ename:VK_IMAGE_TILING_OPTIMAL, then the pname:optimalTilingFeatures
returned by flink:vkGetPhysicalDeviceFormatProperties2 must: include all
format features required by the image usage flags reported in
sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags for the format,
as indicated in the <<format-feature-dependent-usage-flags,Format
Feature Dependent Usage Flags>> section.
* If sname:VkVideoFormatPropertiesKHR::pname:imageTiling is
ename:VK_IMAGE_TILING_LINEAR, then the pname:linearTilingFeatures
returned by flink:vkGetPhysicalDeviceFormatProperties2 must: include all
format features required by the image usage flags reported in
sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags for the format,
as indicated in the <<format-feature-dependent-usage-flags,Format
Feature Dependent Usage Flags>> section.
* flink:vkGetPhysicalDeviceImageFormatProperties2 must: succeed when
called with a slink:VkPhysicalDeviceImageFormatInfo2 structure
containing the following information:
** The pname:pNext chain including the same
slink:VkVideoProfileListInfoKHR structure used to call
fname:vkGetPhysicalDeviceVideoFormatPropertiesKHR.
** pname:format set to the value of
sname:VkVideoFormatPropertiesKHR::pname:format.
** pname:type set to the value of
sname:VkVideoFormatPropertiesKHR::pname:imageType.
** pname:tiling set to the value of
sname:VkVideoFormatPropertiesKHR::pname:imageTiling.
** pname:usage set to the value of
sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags.
** pname:flags set to the value of
sname:VkVideoFormatPropertiesKHR::pname:imageCreateFlags.
The pname:componentMapping member of sname:VkVideoFormatPropertiesKHR
defines the ordering of the {YCbCr} color channels from the perspective of
the video codec operations specified in slink:VkVideoProfileListInfoKHR.
For example, if the implementation produces video decode output with the
format ename:VK_FORMAT_G8_B8R8_2PLANE_420_UNORM where the blue and red
chrominance channels are swapped then the pname:componentMapping member of
the corresponding sname:VkVideoFormatPropertiesKHR structure will have the
following member values:
[source,c++]
----
components.r = VK_COMPONENT_SWIZZLE_B; // Cb component
components.g = VK_COMPONENT_SWIZZLE_IDENTITY; // Y component
components.b = VK_COMPONENT_SWIZZLE_R; // Cr component
components.a = VK_COMPONENT_SWIZZLE_IDENTITY; // unused, defaults to 1.0
----
.Valid Usage
****
* [[VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-pNext-06812]]
The pname:pNext chain of pname:pVideoFormatInfo must: include a
slink:VkVideoProfileListInfoKHR structure with pname:profileCount
greater than `0`
****
include::{generated}/validity/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.adoc[]
--
[open,refpage='VkPhysicalDeviceVideoFormatInfoKHR',desc='Structure specifying the codec video format',type='structs']
--
The sname:VkPhysicalDeviceVideoFormatInfoKHR structure is defined as:
include::{generated}/api/structs/VkPhysicalDeviceVideoFormatInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:imageUsage is a bitmask of elink:VkImageUsageFlagBits specifying
the intended usage of the video images.
include::{generated}/validity/structs/VkPhysicalDeviceVideoFormatInfoKHR.adoc[]
--
[open,refpage='VkVideoFormatPropertiesKHR',desc='Structure enumerating the video image formats',type='structs']
--
The sname:VkVideoFormatPropertiesKHR structure is defined as:
include::{generated}/api/structs/VkVideoFormatPropertiesKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:format is a elink:VkFormat that specifies the format that can: be
used with the specified video profiles and image usages.
* pname:componentMapping defines the color channel order used for the
format.
pname:format along with pname:componentMapping describe how the color
channels are ordered when producing video decoder output or are expected
to be ordered in video encoder input, when applicable.
If the pname:format reported does not require component swizzling then
all members of pname:componentMapping will be set to
ename:VK_COMPONENT_SWIZZLE_IDENTITY.
* pname:imageCreateFlags is a bitmask of elink:VkImageCreateFlagBits
specifying the supported image creation flags for the format.
* pname:imageType is a elink:VkImageType that specifies the image type the
format can: be used with.
* pname:imageTiling is a elink:VkImageTiling that specifies the image
tiling the format can: be used with.
* pname:imageUsageFlags is a bitmask of elink:VkImageUsageFlagBits
specifying the supported image usage flags for the format.
include::{generated}/validity/structs/VkVideoFormatPropertiesKHR.adoc[]
--
[[video-session]]
== Video Sessions
[open,refpage='VkVideoSessionKHR',desc='Opaque handle to a video session object',type='handles']
--
Video sessions are objects that represent and maintain the state needed to
perform video decode or encode operations using a specific video profile.
Video sessions are represented by sname:VkVideoSessionKHR handles:
include::{generated}/api/handles/VkVideoSessionKHR.adoc[]
--
[[video-session-creation]]
=== Creating a Video Session
[open,refpage='vkCreateVideoSessionKHR',desc='Creates a video session object',type='protos']
--
To create a video session object, call:
include::{generated}/api/protos/vkCreateVideoSessionKHR.adoc[]
* pname:device is the logical device that creates the video session.
* pname:pCreateInfo is a pointer to a slink:VkVideoSessionCreateInfoKHR
structure containing parameters to be used to create the video session.
* pname:pAllocator controls host memory allocation as described in the
<<memory-allocation, Memory Allocation>> chapter.
* pname:pVideoSession is a pointer to a slink:VkVideoSessionKHR handle in
which the resulting video session object is returned.
The resulting video session object is said to be created with the video
codec operation specified in
pname:pCreateInfo->pVideoProfile->videoCodecOperation.
The name and version of the codec-specific Video Std header to be used with
the video session is specified by the slink:VkExtensionProperties structure
pointed to by pname:pCreateInfo->pStdHeaderVersion.
If a non-existent or unsupported Video Std header version is specified in
pname:pCreateInfo->pStdHeaderVersion->specVersion, then this command returns
ename:VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR.
[[video-session-uninitialized]]
Video session objects are created in _uninitialized_ state.
In order to transition the video session into _initial_ state, the
application must: issue a flink:vkCmdControlVideoCodingKHR command with
slink:VkVideoCodingControlInfoKHR::pname:flags including
ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR.
Video session objects also maintain the
<<dpb-state-and-backing-store,state>> of the DPB.
The number of DPB slots usable with the created video session is specified
in pname:pCreateInfo->maxDpbSlots, and each slot is initially in the
<<dpb-slot-states,inactive state>>.
Each <<dpb-slot,DPB slot>> maintained by the created video session can:
refer to a <<reference-picture,reference picture>> representing a video
frame.
ifdef::VK_KHR_video_decode_h264[]
[[decode-h264-interlaced-support]]
In addition, if the pname:videoCodecOperation member of the
slink:VkVideoProfileInfoKHR structure pointed to by
pname:pCreateInfo->pVideoProfile is
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
pname:pictureLayout member of the slink:VkVideoDecodeH264ProfileInfoKHR
structure provided in the slink:VkVideoProfileInfoKHR::pname:pNext chain is
not ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR, then the
created video session supports _interlaced_ frames and each <<dpb-slot,DPB
slot>> maintained by the created video session can: instead refer to
separate top field and bottom field <<reference-picture,reference pictures>>
that together can: represent a full video frame.
In this case, it is up to the application, driven by the video content,
whether it associates any individual DPB slot with separate top and/or
bottom field pictures or a single picture representing a full frame.
endif::VK_KHR_video_decode_h264[]
The created video session can: be used to perform video coding operations
using video frames up to the maximum size specified in
pname:pCreateInfo->maxCodedExtent.
The minimum frame size allowed is implicitly derived from
slink:VkVideoCapabilitiesKHR::pname:minCodedExtent, as returned by
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
specified by pname:pCreateInfo->pVideoProfile.
Accordingly, the created video session is said to be created with a
pname:minCodedExtent equal to that.
ifdef::VK_KHR_video_encode_queue[]
In case of video session objects created with a video encode operation,
implementations may: return the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the
specified Video Std parameters do not adhere to the syntactic or semantic
requirements of the used video compression standard, or if values derived
from parameters according to the rules defined by the used video compression
standard do not adhere to the capabilities of the video compression standard
or the implementation.
[NOTE]
.Note
====
Applications should: not rely on the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any
command as a means to verify Video Std parameters, as implementations are
not required to report the error in any specific set of cases.
====
endif::VK_KHR_video_encode_queue[]
include::{generated}/validity/protos/vkCreateVideoSessionKHR.adoc[]
--
[open,refpage='VkVideoSessionCreateInfoKHR',desc='Structure specifying parameters of a newly created video session',type='structs']
--
The slink:VkVideoSessionCreateInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoSessionCreateInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:queueFamilyIndex is the index of the queue family the created
video session will be used with.
* pname:flags is a bitmask of elink:VkVideoSessionCreateFlagBitsKHR
specifying creation flags.
* pname:pVideoProfile is a pointer to a slink:VkVideoProfileInfoKHR
structure specifying the video profile the created video session will be
used with.
* pname:pictureFormat is the image format the created video session will
be used with.
ifdef::VK_KHR_video_decode_queue[]
If pname:pVideoProfile->videoCodecOperation specifies a decode
operation, then pname:pictureFormat is the image format of
<<decode-output-picture, decode output pictures>> usable with the
created video session.
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
If pname:pVideoProfile->videoCodecOperation specifies an encode
operation, then pname:pictureFormat is the image format of
<<encode-input-picture, encode input pictures>> usable with the created
video session.
endif::VK_KHR_video_encode_queue[]
* pname:maxCodedExtent is the maximum width and height of the coded frames
the created video session will be used with.
* pname:referencePictureFormat is the image format of
<<reference-picture,reference pictures>> stored in the <<dpb,DPB>> the
created video session will be used with.
* pname:maxDpbSlots is the maximum number of <<dpb-slot,DPB Slots>> that
can: be used with the created video session.
* pname:maxActiveReferencePictures is the maximum number of
<<active-reference-pictures,active reference pictures>> that can: be
used in a single video coding operation using the created video session.
* pname:pStdHeaderVersion is a pointer to a slink:VkExtensionProperties
structure requesting the Video Std header version to use for the
pname:videoCodecOperation specified in pname:pVideoProfile.
.Valid Usage
****
* [[VUID-VkVideoSessionCreateInfoKHR-protectedMemory-07189]]
If the <<features-protectedMemory, pname:protectedMemory>> feature is
not enabled or if slink:VkVideoCapabilitiesKHR::pname:flags does not
include ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR, as returned
by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
specified by pname:pVideoProfile, then pname:flags must: not include
ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR
* [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-04845]]
pname:pVideoProfile must: be a <<video-profile-support, supported video
profile>>
* [[VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04847]]
pname:maxDpbSlots must: be less than or equal to
slink:VkVideoCapabilitiesKHR::pname:maxDpbSlots, as returned by
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
specified by pname:pVideoProfile
* [[VUID-VkVideoSessionCreateInfoKHR-maxActiveReferencePictures-04849]]
pname:maxActiveReferencePictures must: be less than or equal to
slink:VkVideoCapabilitiesKHR::pname:maxActiveReferencePictures, as
returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
profile specified by pname:pVideoProfile
* [[VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04850]]
If either pname:maxDpbSlots or pname:maxActiveReferencePictures is `0`,
then both must: be `0`
* [[VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851]]
pname:maxCodedExtent must: be between
slink:VkVideoCapabilitiesKHR::pname:minCodedExtent and
slink:VkVideoCapabilitiesKHR::pname:maxCodedExtent, inclusive, as
returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
profile specified by pname:pVideoProfile
ifdef::VK_KHR_video_decode_queue[]
* [[VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-04852]]
If pname:pVideoProfile->videoCodecOperation specifies a decode operation
and pname:maxActiveReferencePictures is greater than `0`, then
pname:referencePictureFormat must: be one of the supported decode DPB
formats, as returned by
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
slink:VkVideoFormatPropertiesKHR::pname:format when called with the
pname:imageUsage member of its pname:pVideoFormatInfo parameter
containing ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, and with a
slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
* [[VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-06814]]
If pname:pVideoProfile->videoCodecOperation specifies an encode
operation and pname:maxActiveReferencePictures is greater than `0`, then
pname:referencePictureFormat must: be one of the supported decode DPB
formats, as returned by then pname:referencePictureFormat must: be one
of the supported encode DPB formats, as returned by
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
slink:VkVideoFormatPropertiesKHR::pname:format when called with the
pname:imageUsage member of its pname:pVideoFormatInfo parameter
containing ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR, and with a
slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_decode_queue[]
* [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04853]]
If pname:pVideoProfile->videoCodecOperation specifies a decode
operation, then pname:pictureFormat must: be one of the supported decode
output formats, as returned by
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
slink:VkVideoFormatPropertiesKHR::pname:format when called with the
pname:imageUsage member of its pname:pVideoFormatInfo parameter
containing ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, and with a
slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
* [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04854]]
If pname:pVideoProfile->videoCodecOperation specifies an encode
operation, then pname:pictureFormat must: be one of the supported encode
input formats, as returned by
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
slink:VkVideoFormatPropertiesKHR::pname:format when called with the
pname:imageUsage member of its pname:pVideoFormatInfo parameter
containing ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR, and with a
slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_encode_queue[]
* [[VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190]]
pname:pStdHeaderVersion->extensionName must: match
slink:VkVideoCapabilitiesKHR::pname:stdHeaderVersion.extensionName, as
returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
profile specified by pname:pVideoProfile
* [[VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191]]
pname:pStdHeaderVersion->specVersion must: be less than or equal to
slink:VkVideoCapabilitiesKHR::pname:stdHeaderVersion.specVersion, as
returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
profile specified by pname:pVideoProfile
****
include::{generated}/validity/structs/VkVideoSessionCreateInfoKHR.adoc[]
--
[open,refpage='VkVideoSessionCreateFlagBitsKHR',desc='Video session creation flags',type='enums']
--
Bits which can: be set in slink:VkVideoSessionCreateInfoKHR::pname:flags
are:
include::{generated}/api/enums/VkVideoSessionCreateFlagBitsKHR.adoc[]
* ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR specifies that
the video session uses protected video content.
ifdef::VK_KHR_video_encode_queue[]
* ename:VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR
specifies that the implementation is allowed to override video session
parameters and other codec-specific encoding parameters to optimize
video encode operations based on the specific use case defined by the
<<video-profiles,video profile>> and the used video encode quality
level.
endif::VK_KHR_video_encode_queue[]
--
[open,refpage='VkVideoSessionCreateFlagsKHR',desc='Bitmask of VkVideoSessionCreateFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoSessionCreateFlagsKHR.adoc[]
tname:VkVideoSessionCreateFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoSessionCreateFlagBitsKHR.
--
[[video-session-destruction]]
=== Destroying a Video Session
[open,refpage='vkDestroyVideoSessionKHR',desc='Destroy video session object',type='protos']
--
To destroy a video session, call:
include::{generated}/api/protos/vkDestroyVideoSessionKHR.adoc[]
* pname:device is the logical device that destroys the video session.
* pname:videoSession is the video session to destroy.
* pname:pAllocator controls host memory allocation as described in the
<<memory-allocation, Memory Allocation>> chapter.
.Valid Usage
****
* [[VUID-vkDestroyVideoSessionKHR-videoSession-07192]]
All submitted commands that refer to pname:videoSession must: have
completed execution
* [[VUID-vkDestroyVideoSessionKHR-videoSession-07193]]
If sname:VkAllocationCallbacks were provided when pname:videoSession was
created, a compatible set of callbacks must: be provided here
* [[VUID-vkDestroyVideoSessionKHR-videoSession-07194]]
If no sname:VkAllocationCallbacks were provided when pname:videoSession
was created, pname:pAllocator must: be `NULL`
****
include::{generated}/validity/protos/vkDestroyVideoSessionKHR.adoc[]
--
[[video-session-memory-association]]
=== Video Session Memory Association
After creating a video session object, and before the object can: be used to
record video coding operations into command buffers using it, the
application must: allocate and bind device memory to the video session.
Device memory is allocated separately (see <<memory-device>>) and then
associated with the video session.
Video sessions may: have multiple memory bindings identified by unique
unsigned integer values.
Appropriate device memory must: be bound to each such memory binding before
using the video session to record command buffer commands with it.
[open,refpage='vkGetVideoSessionMemoryRequirementsKHR',desc='Get the memory requirements for a video session',type='protos']
--
To determine the memory requirements for a video session object, call:
include::{generated}/api/protos/vkGetVideoSessionMemoryRequirementsKHR.adoc[]
* pname:device is the logical device that owns the video session.
* pname:videoSession is the video session to query.
* pname:pMemoryRequirementsCount is a pointer to an integer related to the
number of memory binding requirements available or queried, as described
below.
* pname:pMemoryRequirements is `NULL` or a pointer to an array of
slink:VkVideoSessionMemoryRequirementsKHR structures in which the memory
binding requirements of the video session are returned.
If pname:pMemoryRequirements is `NULL`, then the number of memory bindings
required for the video session is returned in
pname:pMemoryRequirementsCount.
Otherwise, pname:pMemoryRequirementsCount must: point to a variable set by
the user with the number of elements in the pname:pMemoryRequirements array,
and on return the variable is overwritten with the number of memory binding
requirements actually written to pname:pMemoryRequirements.
If pname:pMemoryRequirementsCount is less than the number of memory bindings
required for the video session, then at most pname:pMemoryRequirementsCount
elements will be written to pname:pMemoryRequirements, and
ename:VK_INCOMPLETE will be returned, instead of ename:VK_SUCCESS, to
indicate that not all required memory binding requirements were returned.
include::{generated}/validity/protos/vkGetVideoSessionMemoryRequirementsKHR.adoc[]
--
[open,refpage='VkVideoSessionMemoryRequirementsKHR',desc='Structure describing video session memory requirements',type='structs']
--
The sname:VkVideoSessionMemoryRequirementsKHR structure is defined as:
include::{generated}/api/structs/VkVideoSessionMemoryRequirementsKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:memoryBindIndex is the index of the memory binding.
* pname:memoryRequirements is a slink:VkMemoryRequirements structure in
which the requested memory binding requirements for the binding index
specified by pname:memoryBindIndex are returned.
include::{generated}/validity/structs/VkVideoSessionMemoryRequirementsKHR.adoc[]
--
[open,refpage='vkBindVideoSessionMemoryKHR',desc='Bind Video Memory',type='protos']
--
To attach memory to a video session object, call:
include::{generated}/api/protos/vkBindVideoSessionMemoryKHR.adoc[]
* pname:device is the logical device that owns the video session.
* pname:videoSession is the video session to be bound with device memory.
* pname:bindSessionMemoryInfoCount is the number of elements in
pname:pBindSessionMemoryInfos.
* pname:pBindSessionMemoryInfos is a pointer to an array of
pname:bindSessionMemoryInfoCount slink:VkBindVideoSessionMemoryInfoKHR
structures specifying memory regions to be bound to specific memory
bindings of the video session.
The valid usage statements below refer to the slink:VkMemoryRequirements
structure corresponding to a specific element of
pname:pBindSessionMemoryInfos, which is defined as follows:
* If the pname:memoryBindIndex member of the element of
pname:pBindSessionMemoryInfos in question matches the
pname:memoryBindIndex member of one of the elements returned in
pname:pMemoryRequirements when
flink:vkGetVideoSessionMemoryRequirementsKHR is called with the same
pname:videoSession and with pname:pMemoryRequirementsCount equal to
pname:bindSessionMemoryInfoCount, then the pname:memoryRequirements
member of that element of pname:pMemoryRequirements is the
slink:VkMemoryRequirements structure corresponding to the element of
pname:pBindSessionMemoryInfos in question.
* Otherwise the element of pname:pBindSessionMemoryInfos in question is
said to not have a corresponding slink:VkMemoryRequirements structure.
.Valid Usage
****
* [[VUID-vkBindVideoSessionMemoryKHR-videoSession-07195]]
The memory binding of pname:videoSession identified by the
pname:memoryBindIndex member of any element of
pname:pBindSessionMemoryInfos must: not already be backed by a memory
object
* [[VUID-vkBindVideoSessionMemoryKHR-memoryBindIndex-07196]]
The pname:memoryBindIndex member of each element of
pname:pBindSessionMemoryInfos must: be unique within
pname:pBindSessionMemoryInfos
* [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07197]]
Each element of pname:pBindSessionMemoryInfos must: have a corresponding
slink:VkMemoryRequirements structure
* [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07198]]
If an element of pname:pBindSessionMemoryInfos has a corresponding
slink:VkMemoryRequirements structure, then the pname:memory member of
that element of pname:pBindSessionMemoryInfos must: have been allocated
using one of the memory types allowed in the pname:memoryTypeBits member
of the corresponding slink:VkMemoryRequirements structure
* [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07199]]
If an element of pname:pBindSessionMemoryInfos has a corresponding
slink:VkMemoryRequirements structure, then the pname:memoryOffset member
of that element of pname:pBindSessionMemoryInfos must: be an integer
multiple of the pname:alignment member of the corresponding
slink:VkMemoryRequirements structure
* [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07200]]
If an element of pname:pBindSessionMemoryInfos has a corresponding
slink:VkMemoryRequirements structure, then the pname:memorySize member
of that element of pname:pBindSessionMemoryInfos must: equal the
pname:size member of the corresponding slink:VkMemoryRequirements
structure
****
include::{generated}/validity/protos/vkBindVideoSessionMemoryKHR.adoc[]
--
[open,refpage='VkBindVideoSessionMemoryInfoKHR',desc='Structure specifying memory bindings for a video session object',type='structs']
--
The sname:VkBindVideoSessionMemoryInfoKHR structure is defined as:
include::{generated}/api/structs/VkBindVideoSessionMemoryInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:memoryBindIndex is the memory binding index to bind memory to.
* pname:memory is the allocated device memory to be bound to the video
session's memory binding with index pname:memoryBindIndex.
* pname:memoryOffset is the start offset of the region of pname:memory
which is to be bound.
* pname:memorySize is the size in bytes of the region of pname:memory,
starting from pname:memoryOffset bytes, to be bound.
.Valid Usage
****
* [[VUID-VkBindVideoSessionMemoryInfoKHR-memoryOffset-07201]]
pname:memoryOffset must: be less than the size of pname:memory
* [[VUID-VkBindVideoSessionMemoryInfoKHR-memorySize-07202]]
pname:memorySize must: be less than or equal to the size of pname:memory
minus pname:memoryOffset
****
include::{generated}/validity/structs/VkBindVideoSessionMemoryInfoKHR.adoc[]
--
[[video-profile-compatibility]]
== Video Profile Compatibility
Resources and query pools used with a particular video session must: be
compatible with the <<video-profiles,video profile>> the video session was
created with.
A slink:VkBuffer is compatible with a video profile if it was created with
the slink:VkBufferCreateInfo::pname:pNext chain including a
slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles member
containing an element matching the slink:VkVideoProfileInfoKHR structure
chain describing the video profile, and
slink:VkBufferCreateInfo::pname:usage including at least one bit specific to
video coding usage.
ifdef::VK_KHR_video_decode_queue[]
* ename:VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR
* ename:VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
* ename:VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
* ename:VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR
endif::VK_KHR_video_encode_queue[]
A slink:VkImage is compatible with a video profile if it was created with
the slink:VkImageCreateInfo::pname:pNext chain including a
slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles member
containing an element matching the slink:VkVideoProfileInfoKHR structure
chain describing the video profile, and slink:VkImageCreateInfo::pname:usage
including at least one bit specific to video coding usage.
ifdef::VK_KHR_video_decode_queue[]
* ename:VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR
* ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
* ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
* ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
* ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR
* ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
endif::VK_KHR_video_encode_queue[]
A slink:VkImageView is compatible with a video profile if the slink:VkImage
it was created from is also compatible with that video profile.
A slink:VkQueryPool is compatible with a video profile if it was created
with the slink:VkQueryPoolCreateInfo::pname:pNext chain including a
slink:VkVideoProfileInfoKHR structure chain describing the same video
profile, and slink:VkQueryPoolCreateInfo::pname:queryType having one of the
following values:
* ename:VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR
ifdef::VK_KHR_video_encode_queue[]
* ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR
endif::VK_KHR_video_encode_queue[]
[[video-session-parameters]]
== Video Session Parameters
Video session parameters objects can: store preprocessed codec-specific
parameters used with a compatible video session, and enable reducing the
number of parameters needed to be provided and processed by the
implementation while recording video coding operations into command buffers.
Parameters stored in such objects are _immutable_ to facilitate the
concurrent use of the stored parameters in multiple threads.
At the same time, new parameters can: be added to existing objects using the
flink:vkUpdateVideoSessionParametersKHR command.
In order to support concurrent use of the stored immutable parameters while
also allowing the video session parameters object to be extended with new
parameters, each video session parameters object maintains an _update
sequence counter_ that is set to `0` at object creation time and must: be
incremented by each subsequent update operation.
Certain video sequences that adhere to particular video compression
standards permit updating previously supplied parameters.
If a parameter update is necessary, the application has the following
options:
* Cache the set of parameters on the application side and create a new
video session parameters object adding all the parameters with
appropriate changes, as necessary; or
* Create a new video session parameters object providing only the updated
parameters and the previously used object as the template, which ensures
that parameters not specified at creation time will be copied unmodified
from the template object.
The actual types of parameters that can: be stored and the capacity for
individual parameter types, and the methods of initializing, updating, and
referring to individual parameters are specific to the video codec operation
the video session parameters object was created with.
ifdef::VK_KHR_video_decode_h264[]
* For ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR these are defined
in the <<decode-h264-parameter-sets,H.264 Decode Parameter Sets>>
section.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* For ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR these are defined
in the <<decode-h265-parameter-sets,H.265 Decode Parameter Sets>>
section.
endif::VK_KHR_video_decode_h265[]
[open,refpage='VkVideoSessionParametersKHR',desc='Opaque handle to a video session parameters object',type='handles']
--
Video session parameters are represented by
sname:VkVideoSessionParametersKHR handles:
include::{generated}/api/handles/VkVideoSessionParametersKHR.adoc[]
--
[[creating-video-session-parameters]]
=== Creating Video Session Parameters
[open,refpage='vkCreateVideoSessionParametersKHR',desc='Creates video session parameters object',type='protos']
--
To create a video session parameters object, call:
include::{generated}/api/protos/vkCreateVideoSessionParametersKHR.adoc[]
* pname:device is the logical device that creates the video session
parameters object.
* pname:pCreateInfo is a pointer to
slink:VkVideoSessionParametersCreateInfoKHR structure containing
parameters to be used to create the video session parameters object.
* pname:pAllocator controls host memory allocation as described in the
<<memory-allocation, Memory Allocation>> chapter.
* pname:pVideoSessionParameters is a pointer to a
slink:VkVideoSessionParametersKHR handle in which the resulting video
session parameters object is returned.
The resulting video session parameters object is said to be created with the
video codec operation pname:pCreateInfo->videoSession was created with.
If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then it will be used as a template for constructing
the new video session parameters object.
This happens by first adding any parameters according to the additional
creation parameters provided in the pname:pCreateInfo->pNext chain, followed
by adding any parameters from the template object that have a key that does
not match the key of any of the already added parameters.
ifdef::VK_KHR_video_decode_h264[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the
created video session parameters object will initially contain the following
sets of parameter entries:
* code:StdVideoH264SequenceParameterSet structures representing
<<decode-h264-sps,H.264 SPS>> entries, as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
set of code:StdVideoH264SequenceParameterSet entries specified in
pname:pParametersAddInfo->pStdSPSs are added first;
** If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then each code:StdVideoH264SequenceParameterSet
entry stored in it is copied to the created video session parameters
object if the created object does not already contain such an entry
with the same pname:seq_parameter_set_id.
* code:StdVideoH264PictureParameterSet structures representing
<<decode-h264-pps,H.264 PPS>> entries, as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
set of code:StdVideoH264PictureParameterSet entries specified in
pname:pParametersAddInfo->pStdPPSs are added first;
** If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then each code:StdVideoH264PictureParameterSet
entry stored in it is copied to the created video session parameters
object if the created object does not already contain such an entry
with the same pname:seq_parameter_set_id and
pname:pic_parameter_set_id.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
created video session parameters object will initially contain the following
sets of parameter entries:
* code:StdVideoH265VideoParameterSet structures representing
<<decode-h265-vps,H.265 VPS>> entries, as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
set of code:StdVideoH265VideoParameterSet entries specified in
pname:pParametersAddInfo->pStdVPSs are added first;
** If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then each code:StdVideoH265VideoParameterSet
entry stored in it is copied to the created video session parameters
object if the created object does not already contain such an entry
with the same pname:vps_video_parameter_set_id.
* code:StdVideoH265SequenceParameterSet structures representing
<<decode-h265-sps,H.265 SPS>> entries, as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
set of code:StdVideoH265SequenceParameterSet entries specified in
pname:pParametersAddInfo->pStdSPSs are added first;
** If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then each code:StdVideoH265SequenceParameterSet
entry stored in it is copied to the created video session parameters
object if the created object does not already contain such an entry
with the same pname:sps_video_parameter_set_id and
pname:sps_seq_parameter_set_id.
* code:StdVideoH265PictureParameterSet structures representing
<<decode-h265-pps,H.265 PPS>> entries, as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
set of code:StdVideoH265PictureParameterSet entries specified in
pname:pParametersAddInfo->pStdPPSs are added first;
** If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then each code:StdVideoH265PictureParameterSet
entry stored in it is copied to the created video session parameters
object if the created object does not already contain such an entry
with the same pname:sps_video_parameter_set_id,
pname:pps_seq_parameter_set_id, and pname:pps_pic_parameter_set_id.
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_encode_queue[]
In case of video session parameters objects created with a video encode
operation, implementations may: return the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the
specified Video Std parameters do not adhere to the syntactic or semantic
requirements of the used video compression standard, or if values derived
from parameters according to the rules defined by the used video compression
standard do not adhere to the capabilities of the video compression standard
or the implementation.
[NOTE]
.Note
====
Applications should: not rely on the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any
command as a means to verify Video Std parameters, as implementations are
not required to report the error in any specific set of cases.
====
endif::VK_KHR_video_encode_queue[]
include::{generated}/validity/protos/vkCreateVideoSessionParametersKHR.adoc[]
--
[open,refpage='VkVideoSessionParametersCreateInfoKHR',desc='Structure specifying parameters of a newly created video session parameters object',type='structs']
--
The sname:VkVideoSessionParametersCreateInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoSessionParametersCreateInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:flags is reserved for future use.
* pname:videoSessionParametersTemplate is dname:VK_NULL_HANDLE or a valid
handle to a slink:VkVideoSessionParametersKHR object used as a template
for constructing the new video session parameters object.
* pname:videoSession is the video session object against which the video
session parameters object is going to be created.
Limiting values are defined below that are referenced by the relevant valid
usage statements of this structure.
ifdef::VK_KHR_video_decode_h264[]
* If pname:videoSession was created with the codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then let
`StdVideoH264SequenceParameterSet spsAddList[]` be the list of
<<decode-h264-sps,H.264 SPS>> entries to add to the created video
session parameters object, defined as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
provided in the pname:pNext chain is not `NULL`, then the set of
code:StdVideoH264SequenceParameterSet entries specified in
pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList;
** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
then each code:StdVideoH264SequenceParameterSet entry stored in it with
pname:seq_parameter_set_id not matching any of the entries already in
pname:spsAddList is added to pname:spsAddList.
* If pname:videoSession was created with the codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then let
`StdVideoH264PictureParameterSet ppsAddList[]` be the list of
<<decode-h264-pps,H.264 PPS>> entries to add to the created video
session parameters object, defined as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
provided in the pname:pNext chain is not `NULL`, then the set of
code:StdVideoH264PictureParameterSet entries specified in
pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList;
** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
then each code:StdVideoH264PictureParameterSet entry stored in it with
pname:seq_parameter_set_id or pname:pic_parameter_set_id not matching
any of the entries already in pname:ppsAddList is added to
pname:ppsAddList.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* If pname:videoSession was created with the codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let
`StdVideoH265VideoParameterSet vpsAddList[]` be the list of
<<decode-h265-vps,H.265 VPS>> entries to add to the created video
session parameters object, defined as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
provided in the pname:pNext chain is not `NULL`, then the set of
code:StdVideoH265VideoParameterSet entries specified in
pname:pParametersAddInfo->pStdVPSs are added to pname:vpsAddList;
** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
then each code:StdVideoH265VideoParameterSet entry stored in it with
pname:vps_video_parameter_set_id not matching any of the entries
already in pname:vpsAddList is added to pname:vpsAddList.
* If pname:videoSession was created with the codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let
`StdVideoH265SequenceParameterSet spsAddList[]` be the list of
<<decode-h265-sps,H.265 SPS>> entries to add to the created video
session parameters object, defined as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
provided in the pname:pNext chain is not `NULL`, then the set of
code:StdVideoH265SequenceParameterSet entries specified in
pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList;
** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
then each code:StdVideoH265SequenceParameterSet entry stored in it with
pname:sps_video_parameter_set_id or pname:sps_seq_parameter_set_id not
matching any of the entries already in pname:spsAddList is added to
pname:spsAddList.
* If pname:videoSession was created with the codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let
`StdVideoH265PictureParameterSet ppsAddList[]` be the list of
<<decode-h265-pps,H.265 PPS>> entries to add to the created video
session parameters object, defined as follows:
** If the pname:pParametersAddInfo member of the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
provided in the pname:pNext chain is not `NULL`, then the set of
code:StdVideoH265PictureParameterSet entries specified in
pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList;
** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
then each code:StdVideoH265PictureParameterSet entry stored in it with
pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, or
pname:pps_pic_parameter_set_id not matching any of the entries already
in pname:ppsAddList is added to pname:ppsAddList.
endif::VK_KHR_video_decode_h265[]
.Valid Usage
****
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-04855]]
If pname:videoSessionParametersTemplate represents a valid handle, it
must: have been created against pname:videoSession
ifdef::VK_KHR_video_decode_h264[]
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07203]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext
chain must: include a
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07204]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the number of
elements of pname:spsAddList must: be less than or equal to the
pname:maxStdSPSCount specified in the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure included
in the pname:pNext chain
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07205]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the number of
elements of pname:ppsAddList must: be less than or equal to the
pname:maxStdPPSCount specified in the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure included
in the pname:pNext chain
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07206]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext
chain must: include a
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07207]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of
elements of pname:vpsAddList must: be less than or equal to the
pname:maxStdVPSCount specified in the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included
in the pname:pNext chain
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07208]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of
elements of pname:spsAddList must: be less than or equal to the
pname:maxStdSPSCount specified in the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included
in the pname:pNext chain
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07209]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of
elements of pname:ppsAddList must: be less than or equal to the
pname:maxStdPPSCount specified in the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included
in the pname:pNext chain
endif::VK_KHR_video_decode_h265[]
ifdef::VK_EXT_video_encode_h264[]
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07210]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, then the pname:pNext
chain must: include a
slink:VkVideoEncodeH264SessionParametersCreateInfoEXT structure
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07211]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT, then the pname:pNext
chain must: include a
slink:VkVideoEncodeH265SessionParametersCreateInfoEXT structure
endif::VK_EXT_video_encode_h265[]
****
include::{generated}/validity/structs/VkVideoSessionParametersCreateInfoKHR.adoc[]
--
[open,refpage='VkVideoSessionParametersCreateFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkVideoSessionParametersCreateFlagsKHR.adoc[]
tname:VkVideoSessionParametersCreateFlagsKHR is a bitmask type for setting a
mask, but is currently reserved for future use.
--
[[destroying-video-session-parameters]]
=== Destroying Video Session Parameters
[open,refpage='vkDestroyVideoSessionParametersKHR',desc='Destroy video session parameters object',type='protos']
--
To destroy a video session parameters object, call:
include::{generated}/api/protos/vkDestroyVideoSessionParametersKHR.adoc[]
* pname:device is the logical device that destroys the video session
parameters object.
* pname:videoSessionParameters is the video session parameters object to
destroy.
* pname:pAllocator controls host memory allocation as described in the
<<memory-allocation, Memory Allocation>> chapter.
.Valid Usage
****
* [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07212]]
All submitted commands that refer to pname:videoSessionParameters must:
have completed execution
* [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07213]]
If sname:VkAllocationCallbacks were provided when
pname:videoSessionParameters was created, a compatible set of callbacks
must: be provided here
* [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07214]]
If no sname:VkAllocationCallbacks were provided when
pname:videoSessionParameters was created, pname:pAllocator must: be
`NULL`
****
include::{generated}/validity/protos/vkDestroyVideoSessionParametersKHR.adoc[]
--
[[video-session-parameters-update]]
=== Updating Video Session Parameters
[open,refpage='vkUpdateVideoSessionParametersKHR',desc='Update video session parameters object',type='protos']
--
To update video session parameters object with new parameters, call:
include::{generated}/api/protos/vkUpdateVideoSessionParametersKHR.adoc[]
* pname:device is the logical device that updates the video session
parameters.
* pname:videoSessionParameters is the video session parameters object to
update.
* pname:pUpdateInfo is a pointer to a
slink:VkVideoSessionParametersUpdateInfoKHR structure specifying the
parameter update information.
After a successful call to this command, the
<<video-session-parameters,update sequence counter>> of
pname:videoSessionParameters is changed to the value specified in
pname:pUpdateInfo->updateSequenceCount.
[NOTE]
.Note:
====
As each update issued to a video session parameters object needs to specify
the next available update sequence count value, concurrent updates of the
same video session parameters object are inherently disallowed.
However, recording video coding operations to command buffers referring to
parameters previously added to the video session parameters object is
allowed, even if there is a concurrent update in progress adding some new
entries to the object.
====
ifdef::VK_KHR_video_decode_h264[]
If pname:videoSessionParameters was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
pname:pUpdateInfo->pNext chain includes a
slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then this
command adds the following parameter entries to
pname:videoSessionParameters:
* The <<decode-h264-sps,H.264 SPS>> entries specified in
slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdSPSs.
* The <<decode-h264-pps,H.264 PPS>> entries specified in
slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdPPSs.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
If pname:videoSessionParameters was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
pname:pUpdateInfo->pNext chain includes a
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then this
command adds the following parameter entries to
pname:videoSessionParameters:
* The <<decode-h265-vps,H.265 VPS>> entries specified in
slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdVPSs.
* The <<decode-h265-sps,H.265 SPS>> entries specified in
slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdSPSs.
* The <<decode-h265-pps,H.265 PPS>> entries specified in
slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdPPSs.
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_encode_queue[]
In case of video session parameters objects created with a video encode
operation, implementations may: return the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the
specified Video Std parameters do not adhere to the syntactic or semantic
requirements of the used video compression standard, or if values derived
from parameters according to the rules defined by the used video compression
standard do not adhere to the capabilities of the video compression standard
or the implementation.
[NOTE]
.Note
====
Applications should: not rely on the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any
command as a means to verify Video Std parameters, as implementations are
not required to report the error in any specific set of cases.
====
endif::VK_KHR_video_encode_queue[]
.Valid Usage
****
* [[VUID-vkUpdateVideoSessionParametersKHR-pUpdateInfo-07215]]
pname:pUpdateInfo->updateSequenceCount must: equal the current
<<video-session-parameters,update sequence counter>> of
pname:videoSessionParameters plus one
ifdef::VK_KHR_video_decode_h264[]
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07216]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH264SequenceParameterSet entry with
pname:seq_parameter_set_id matching any of the elements of
slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdSPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07217]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the
number of code:StdVideoH264SequenceParameterSet entries already stored
in it plus the value of the pname:stdSPSCount member of the
slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure included in
the pname:pUpdateInfo->pNext chain must: be less than or equal to the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR::pname:maxStdSPSCount
pname:videoSessionParameters was created with
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07218]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH264PictureParameterSet entry with both
pname:seq_parameter_set_id and pname:pic_parameter_set_id matching any
of the elements of
slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdPPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07219]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the
number of code:StdVideoH264PictureParameterSet entries already stored in
it plus the value of the pname:stdPPSCount member of the
slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure included in
the pname:pUpdateInfo->pNext chain must: be less than or equal to the
slink:VkVideoDecodeH264SessionParametersCreateInfoKHR::pname:maxStdPPSCount
pname:videoSessionParameters was created with
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07220]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH265VideoParameterSet entry with
pname:vps_video_parameter_set_id matching any of the elements of
slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdVPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07221]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
number of code:StdVideoH265VideoParameterSet entries already stored in
it plus the value of the pname:stdVPSCount member of the
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in
the pname:pUpdateInfo->pNext chain must: be less than or equal to the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdVPSCount
pname:videoSessionParameters was created with
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07222]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH265SequenceParameterSet entry with both
pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id
matching any of the elements of
slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdSPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07223]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
number of code:StdVideoH265SequenceParameterSet entries already stored
in it plus the value of the pname:stdSPSCount member of the
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in
the pname:pUpdateInfo->pNext chain must: be less than or equal to the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdSPSCount
pname:videoSessionParameters was created with
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07224]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then
pname:videoSessionParameters must: not already 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 all matching any of the elements of
slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdPPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07225]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
number of code:StdVideoH265PictureParameterSet entries already stored in
it plus the value of the pname:stdPPSCount member of the
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in
the pname:pUpdateInfo->pNext chain must: be less than or equal to the
slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdPPSCount
pname:videoSessionParameters was created with
endif::VK_KHR_video_decode_h265[]
ifdef::VK_EXT_video_encode_h264[]
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07226]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoEncodeH264SessionParametersAddInfoEXT structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH264SequenceParameterSet entry with
pname:seq_parameter_set_id matching any of the elements of
slink:VkVideoEncodeH264SessionParametersAddInfoEXT::pname:pStdSPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07227]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoEncodeH264SessionParametersAddInfoEXT structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH264PictureParameterSet entry with both
pname:seq_parameter_set_id and pname:pic_parameter_set_id matching any
of the elements of
slink:VkVideoEncodeH264SessionParametersAddInfoEXT::pname:pStdPPSs
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07228]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoEncodeH265SessionParametersAddInfoEXT structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH265VideoParameterSet entry with
pname:vps_video_parameter_set_id matching any of the elements of
slink:VkVideoEncodeH265SessionParametersAddInfoEXT::pname:pStdVPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07229]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoEncodeH265SessionParametersAddInfoEXT structure, then
pname:videoSessionParameters must: not already contain a
code:StdVideoH265SequenceParameterSet entry with both
pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id
matching any of the elements of
slink:VkVideoEncodeH265SessionParametersAddInfoEXT::pname:pStdSPSs
* [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07230]]
If pname:videoSessionParameters was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT and the
pname:pNext chain of pname:pUpdateInfo includes a
slink:VkVideoEncodeH265SessionParametersAddInfoEXT structure, then
pname:videoSessionParameters must: not already 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 all matching any of the elements of
slink:VkVideoEncodeH265SessionParametersAddInfoEXT::pname:pStdPPSs
endif::VK_EXT_video_encode_h265[]
****
include::{generated}/validity/protos/vkUpdateVideoSessionParametersKHR.adoc[]
--
[open,refpage='VkVideoSessionParametersUpdateInfoKHR',desc='Structure specifying video session parameters update information',type='structs']
--
The sname:VkVideoSessionParametersUpdateInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoSessionParametersUpdateInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:updateSequenceCount is the new <<video-session-parameters,update
sequence count>> to set for the video session parameters object.
include::{generated}/validity/structs/VkVideoSessionParametersUpdateInfoKHR.adoc[]
--
[[video-coding-scope]]
== Video Coding Scope
Applications can: record video coding commands for a video session only
within a video coding scope.
[open,refpage='vkCmdBeginVideoCodingKHR',desc='Begin video coding scope',type='protos']
--
To begin a video coding scope, call:
include::{generated}/api/protos/vkCmdBeginVideoCodingKHR.adoc[]
* pname:commandBuffer is the command buffer in which to record the
command.
* pname:pBeginInfo is a pointer to a slink:VkVideoBeginCodingInfoKHR
structure specifying the parameters of the video coding scope, including
the video session and video session parameters object to use.
After beginning a video coding scope, the video session object specified in
pname:pBeginInfo->videoSession is _bound_ to the command buffer, and the
command buffer is ready to record video coding operations.
Similarly, if pname:pBeginInfo->videoSessionParameters is not
dname:VK_NULL_HANDLE, it is also _bound_ to the command buffer, and video
coding operations can: refer to the codec-specific parameters stored in it.
[[bound-reference-picture-resources]]
This command also establishes the set of _bound reference picture resources_
that can: be used as <<reconstructed-picture,reconstructed pictures>> or
<<reference-picture,reference pictures>> within the video coding scope.
Each element of this set consists of a <<video-picture-resources,video
picture resource>> and the <<dpb-slot,DPB slot>> index associated with it,
if there is one.
The set of bound reference picture resources is immutable within a video
coding scope, however, the DPB slot index associated with any of the bound
reference picture resources can: change during the video coding scope in
response to video coding operations.
The slink:VkVideoReferenceSlotInfoKHR structures provided as the elements of
pname:pBeginInfo->pReferenceSlots are interpreted by this command as
follows:
* If pname:slotIndex is non-negative and pname:pPictureResource is not
`NULL`, then the <<video-picture-resources,video picture resource>>
defined by the slink:VkVideoPictureResourceInfoKHR structure pointed to
by pname:pPictureResource is added to the set of bound reference picture
resources and is associated with the DPB slot index specified in
pname:slotIndex.
* If pname:slotIndex is non-negative and pname:pPictureResource is `NULL`,
then the DPB slot with index pname:slotIndex is <<dpb-slot-states,
deactivated>> by this command.
* If pname:slotIndex is negative and pname:pPictureResource is not `NULL`,
then the <<video-picture-resources,video picture resource>> defined by
the slink:VkVideoPictureResourceInfoKHR structure pointed to by
pname:pPictureResource is added to the set of bound reference picture
resources without an associated DPB slot.
Such a picture resource can: be subsequently used as a
<<reconstructed-picture,reconstructed picture>> to associate it with a
DPB slot.
* If pname:slotIndex is negative and pname:pPictureResource is `NULL`,
then the element is ignored.
ifdef::VK_KHR_video_decode_h264[]
[NOTE]
.Note:
====
It is possible for multiple bound reference picture resources to be
associated with the same DPB slot index, or for a single bound reference
picture to refer to multiple separate reference pictures.
For example, in case of an <<decode-h264-profile,H.264 decode profile>> with
<<decode-h264-interlaced-support,interlaced frame support>> a single DPB
slot can refer to two separate pictures for the top and bottom fields.
Depending on the picture layout used by the <<decode-h264-profile,H.264
decode profile>>, the following special cases may: arise:
* If the picture layout is
ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR,
then the top and bottom field pictures are physically co-located in the
same video picture resource with even scanlines corresponding to the top
field and odd scanlines corresponding to the bottom field, respectively.
* If the picture layout is
ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR,
then the top and bottom field pictures are stored in separate video
picture resources (in separate subregions of the same image layer, in
separate layers of the same image, or in entirely separate images),
hence two elements of
slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots can: contain the
same pname:slotIndex but specify different video picture resources in
their pname:pPictureResource members.
====
endif::VK_KHR_video_decode_h264[]
All non-negative pname:slotIndex values specified in the elements of
pname:pBeginInfo->pReferenceSlots must: identify DPB slots of the video
session that are in the <<dpb-slot-states,active state>> at the time this
command is executed on the device.
[NOTE]
.Note:
====
The application does not have to specify an entry in
pname:pBeginInfo->pReferenceSlots corresponding to all active DPB slots of
the video session, but only for those which are intended to be used in the
video coding scope.
This way the application can avoid any potential runtime cost associated
with binding the corresponding picture resources to the command buffer.
====
.Valid Usage
****
* [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07231]]
The sname:VkCommandPool that pname:commandBuffer was allocated from
must: support the video codec operation pname:pBeginInfo->videoSession
was created with, as returned by
flink:vkGetPhysicalDeviceQueueFamilyProperties2 in
slink:VkQueueFamilyVideoPropertiesKHR::pname:videoCodecOperations
* [[VUID-vkCmdBeginVideoCodingKHR-None-07232]]
There must: be no <<queries-operation-active,active>> queries
* [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07233]]
If pname:commandBuffer is an unprotected command buffer and
<<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
then pname:pBeginInfo->videoSession must: not have been created with
ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR
* [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07234]]
If pname:commandBuffer is a protected command buffer and
<<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
then pname:pBeginInfo->videoSession must: have been created with
ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR
* [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07235]]
If pname:commandBuffer is an unprotected command buffer,
<<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
and the pname:pPictureResource member of any element of
pname:pBeginInfo->pReferenceSlots is not `NULL`, then
pname:pPictureResource->imageViewBinding for that element must: not
specify an image view created from a protected image
* [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07236]]
If pname:commandBuffer is a protected command buffer
<<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
and the pname:pPictureResource member of any element of
pname:pBeginInfo->pReferenceSlots is not `NULL`, then
pname:pPictureResource->imageViewBinding for that element must: specify
an image view created from a protected image
* [[VUID-vkCmdBeginVideoCodingKHR-slotIndex-07239]]
If the pname:slotIndex member of any element of
pname:pBeginInfo->pReferenceSlots is not negative, then it must: specify
the index of a DPB slot that is in the <<dpb-slot-states,active state>>
in pname:pBeginInfo->videoSession at the time the command is executed on
the device
* [[VUID-vkCmdBeginVideoCodingKHR-pPictureResource-07265]]
Each video picture resource specified by any non-`NULL`
pname:pPictureResource member specified in the elements of
pname:pBeginInfo->pReferenceSlots for which pname:slotIndex is not
negative must: <<video-picture-resource-matching,match>> one of the
video picture resources currently associated with the DPB slot index of
pname:pBeginInfo->videoSession specified by pname:slotIndex at the time
the command is executed on the device
****
include::{generated}/validity/protos/vkCmdBeginVideoCodingKHR.adoc[]
--
[open,refpage='VkVideoBeginCodingInfoKHR',desc='Structure specifying video coding scope begin information',type='structs']
--
The slink:VkVideoBeginCodingInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoBeginCodingInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:flags is reserved for future use.
* pname:videoSession is the video session object to be bound for the
processing of the video commands.
* pname:videoSessionParameters is dname:VK_NULL_HANDLE or a handle of a
slink:VkVideoSessionParametersKHR object to be used for the processing
of the video commands.
If dname:VK_NULL_HANDLE, then no video session parameters object is
bound for the duration of the video coding scope.
* pname:referenceSlotCount is the number of elements in the
pname:pReferenceSlots array.
* pname:pReferenceSlots is a pointer to an array of
slink:VkVideoReferenceSlotInfoKHR structures specifying the information
used to determine the set of <<bound-reference-picture-resources,bound
reference picture resources>> for the video coding scope and their
initial association with <<dpb-slot,DPB slot>> indices.
Limiting values are defined below that are referenced by the relevant valid
usage statements of this structure.
* 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 pname:videoSession was created with an <<decode-h264-profile,H.264
decode profile>> 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[]
.Valid Usage
****
* [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07237]]
pname:videoSession must: have memory bound to all of its memory bindings
returned by flink:vkGetVideoSessionMemoryRequirementsKHR for
pname:videoSession
* [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-04856]]
Each non-negative slink:VkVideoReferenceSlotInfoKHR::pname:slotIndex
specified in the elements of pname:pReferenceSlots must: be less than
the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots specified when
pname:videoSession was created
* [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07238]]
Each video picture resource corresponding to any non-`NULL`
pname:pPictureResource member specified in the elements of
pname:pReferenceSlots must: be <<video-picture-resource-uniqueness,
unique>> within pname:pReferenceSlots
* [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07240]]
If the pname:pPictureResource member of any element of
pname:pReferenceSlots is not `NULL`, then the image view specified in
pname:pPictureResource->imageViewBinding for that element must: be
<<video-profile-compatibility,compatible>> with the video profile
pname:videoSession was created with
* [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07241]]
If the pname:pPictureResource member of any element of
pname:pReferenceSlots is not `NULL`, then the format of the image view
specified in pname:pPictureResource->imageViewBinding for that element
must: match the
slink:VkVideoSessionCreateInfoKHR::pname:referencePictureFormat
pname:videoSession was created with
* [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07242]]
If the pname:pPictureResource member of any element of
pname:pReferenceSlots is not `NULL`, then its pname:codedOffset member
must: be an integer multiple of pname:codedOffsetGranularity
* [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07243]]
If the pname:pPictureResource member of any element of
pname:pReferenceSlots is not `NULL`, then its pname:codedExtent member
must: be between pname:minCodedExtent and pname:maxCodedExtent,
inclusive, pname:videoSession was created with
* [[VUID-VkVideoBeginCodingInfoKHR-flags-07244]]
If slink:VkVideoCapabilitiesKHR::pname:flags does not include
ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR, as returned
by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
pname:videoSession was created with, then
pname:pPictureResource->imageViewBinding of all elements of
pname:pReferenceSlots with a non-`NULL` pname:pPictureResource member
must: specify image views created from the same image
ifdef::VK_KHR_video_decode_queue[]
* [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-07245]]
If pname:videoSession was created with a decode operation and the
pname:slotIndex member of any element of pname:pReferenceSlots is not
negative, then the image view specified in
pname:pPictureResource->imageViewBinding for that element must: have
been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
* [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-07246]]
If pname:videoSession was created with an encode operation and the
pname:slotIndex member of any element of pname:pReferenceSlots is not
negative, then the image view specified in
pname:pPictureResource->imageViewBinding for that element must: have
been created with ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_decode_h264[]
* [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07247]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then
pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
* [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07248]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then
pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_decode_h265[]
ifdef::VK_EXT_video_encode_h264[]
* [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07249]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, then
pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07250]]
If pname:videoSession was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT, then
pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_EXT_video_encode_h265[]
* [[VUID-VkVideoBeginCodingInfoKHR-videoSessionParameters-04857]]
If pname:videoSessionParameters is not dname:VK_NULL_HANDLE, it must:
have been created with pname:videoSession specified in
slink:VkVideoSessionParametersCreateInfoKHR::pname:videoSession
****
include::{generated}/validity/structs/VkVideoBeginCodingInfoKHR.adoc[]
--
[open,refpage='VkVideoBeginCodingFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkVideoBeginCodingFlagsKHR.adoc[]
tname:VkVideoBeginCodingFlagsKHR is a bitmask type for setting a mask, but
is currently reserved for future use.
--
[open,refpage='VkVideoReferenceSlotInfoKHR',desc='Structure specifying information about a reference picture slot',type='structs']
--
The sname:VkVideoReferenceSlotInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoReferenceSlotInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:slotIndex is the index of the <<dpb-slot, DPB slot>> or a negative
integer value.
* pname:pPictureResource is `NULL` or a pointer to a
slink:VkVideoPictureResourceInfoKHR structure describing the
<<video-picture-resources,video picture resource>> associated with the
DPB slot index specified by pname:slotIndex.
include::{generated}/validity/structs/VkVideoReferenceSlotInfoKHR.adoc[]
--
[open,refpage='vkCmdEndVideoCodingKHR',desc='End video coding scope',type='protos']
--
To end a video coding scope, call:
include::{generated}/api/protos/vkCmdEndVideoCodingKHR.adoc[]
* pname:commandBuffer is the command buffer in which to record the
command.
* pname:pEndCodingInfo is a pointer to a slink:VkVideoEndCodingInfoKHR
structure specifying the parameters for ending the video coding scope.
After ending a video coding scope, the video session object, the optional
video session parameters object, and all
<<bound-reference-picture-resources, reference picture resources>>
previously bound by the corresponding flink:vkCmdBeginVideoCodingKHR command
are _unbound_.
.Valid Usage
****
* [[VUID-vkCmdEndVideoCodingKHR-None-07251]]
There must: be no <<queries-operation-active,active>> queries
****
include::{generated}/validity/protos/vkCmdEndVideoCodingKHR.adoc[]
--
[open,refpage='VkVideoEndCodingInfoKHR',desc='Structure specifying video coding scope end information',type='structs']
--
The sname:VkVideoEndCodingInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoEndCodingInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:flags is reserved for future use.
include::{generated}/validity/structs/VkVideoEndCodingInfoKHR.adoc[]
--
[open,refpage='VkVideoEndCodingFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkVideoEndCodingFlagsKHR.adoc[]
tname:VkVideoEndCodingFlagsKHR is a bitmask type for setting a mask, but is
currently reserved for future use.
--
[[video-coding-control]]
== Video Coding Control
[open,refpage='vkCmdControlVideoCodingKHR',desc='Control video coding parameters',type='protos']
--
To apply dynamic controls to the currently bound video session object, call:
include::{generated}/api/protos/vkCmdControlVideoCodingKHR.adoc[]
* pname:commandBuffer is the command buffer in which to record the
command.
* pname:pCodingControlInfo is a pointer to a
slink:VkVideoCodingControlInfoKHR structure specifying the control
parameters.
The control parameters provided in this call are applied to the video
session at the time the command executes on the device and are in effect
until a subsequent call to this command with the same video session bound
changes the corresponding control parameters.
A newly created video session must: be reset before performing video coding
operations using it by including ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR
in pname:pCodingControlInfo->flags.
The reset operation also returns all DPB slots of the video session to the
<<dpb-slot-states,inactive state>>.
Correspondingly, any DPB slot index associated with the
<<bound-reference-picture-resources,bound reference picture resources>> is
removed.
ifdef::VK_KHR_video_encode_queue[]
For encode sessions, the reset operation returns rate control configuration
to implementation default settings and sets the video encode quality level
to zero.
endif::VK_KHR_video_encode_queue[]
After video coding operations are performed using a video session, the reset
operation can: be used to return the video session to the same _initial_
state as after the reset of a newly created video session.
This can: be used, for example, when different video sequences are needed to
be processed with the same video session object.
.Valid Usage
****
* [[VUID-vkCmdControlVideoCodingKHR-flags-07017]]
If pname:pCodingControlInfo->flags does not include
ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR, then the bound video
session must: not be in <<video-session-uninitialized,uninitialized>>
state at the time the command is executed on the device
****
include::{generated}/validity/protos/vkCmdControlVideoCodingKHR.adoc[]
--
[open,refpage='VkVideoCodingControlInfoKHR',desc='Structure specifying video coding control parameters',type='structs']
--
The sname:VkVideoCodingControlInfoKHR structure is defined as:
include::{generated}/api/structs/VkVideoCodingControlInfoKHR.adoc[]
* pname:sType is a elink:VkStructureType value identifying this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* pname:flags is a bitmask of tlink:VkVideoCodingControlFlagsKHR
specifying control flags.
.Valid Usage
****
ifdef::VK_KHR_video_encode_queue[]
* [[VUID-VkVideoCodingControlInfoKHR-flags-07018]]
If pname:flags includes
ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, then the
pname:pNext chain must: include a slink:VkVideoEncodeRateControlInfoKHR
structure
endif::VK_KHR_video_encode_queue[]
ifdef::VK_EXT_video_encode_h264[]
* [[VUID-VkVideoCodingControlInfoKHR-flags-07021]]
If pname:flags includes
ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, the
pname:rateControlMode member of slink:VkVideoEncodeRateControlInfoKHR
included in the pname:pNext chain is not
ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or
ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, and the bound
video session was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, then the pname:pNext
chain must: include a slink:VkVideoEncodeH264RateControlInfoEXT
structure
* [[VUID-VkVideoCodingControlInfoKHR-pNext-07022]]
If the pname:pNext chain includes a
slink:VkVideoEncodeRateControlInfoKHR, and
slink:VkVideoEncodeRateControlInfoKHR::pname:layerCount is greater than
`1`, then
slink:VkVideoEncodeH264RateControlInfoEXT::pname:temporalLayerCount
must: be equal to pname:layerCount
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
* [[VUID-VkVideoCodingControlInfoKHR-flags-07024]]
If pname:flags includes
ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, the
pname:rateControlMode member of slink:VkVideoEncodeRateControlInfoKHR
included in the pname:pNext chain is not
ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or
ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, and the bound
video session was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT, then the pname:pNext
chain must: include a slink:VkVideoEncodeH265RateControlInfoEXT
structure
* [[VUID-VkVideoCodingControlInfoKHR-pNext-07025]]
If the pname:pNext chain includes a
slink:VkVideoEncodeRateControlInfoKHR, and
slink:VkVideoEncodeRateControlInfoKHR::pname:layerCount is greater than
`1`, then slink:VkVideoEncodeH265RateControlInfoEXT::pname:subLayerCount
must: be equal to pname:layerCount
endif::VK_EXT_video_encode_h265[]
****
include::{generated}/validity/structs/VkVideoCodingControlInfoKHR.adoc[]
--
[open,refpage='VkVideoCodingControlFlagBitsKHR',desc='Video coding control flags',type='enums']
--
Bits which can: be set in slink:VkVideoCodingControlInfoKHR::pname:flags,
specifying the video coding control parameters to be modified, are:
include::{generated}/api/enums/VkVideoCodingControlFlagBitsKHR.adoc[]
* ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR indicates a request for the
bound video session to be reset before other coding control parameters
are applied.
ifdef::VK_KHR_video_encode_queue[]
* ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR indicates that
the coding control parameters include video encode rate control
parameters (see slink:VkVideoEncodeRateControlInfoKHR).
* ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR indicates
that the coding control parameters include video encode quality level
parameters (see slink:VkVideoEncodeQualityLevelInfoKHR).
endif::VK_KHR_video_encode_queue[]
--
[open,refpage='VkVideoCodingControlFlagsKHR',desc='Bitmask of VkVideoCodingControlFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoCodingControlFlagsKHR.adoc[]
tname:VkVideoCodingControlFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoCodingControlFlagBitsKHR.
--
ifdef::VK_KHR_video_decode_queue[]
include::{chapters}/video_decode_extensions.adoc[]
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_decode_h264[]
include::{chapters}/video_decode_h264_extensions.adoc[]
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
include::{chapters}/video_decode_h265_extensions.adoc[]
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_encode_queue[]
include::{chapters}/video_encode_extensions.adoc[]
endif::VK_KHR_video_encode_queue[]
ifdef::VK_EXT_video_encode_h264[]
include::{chapters}/video_encode_h264_extensions.adoc[]
endif::VK_EXT_video_encode_h264[]
ifdef::VK_EXT_video_encode_h265[]
include::{chapters}/video_encode_h265_extensions.adoc[]
endif::VK_EXT_video_encode_h265[]