• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2021-2024 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5= VK_KHR_video_decode_queue
6:toc: left
7:refpage: https://registry.khronos.org/vulkan/specs/1.2-extensions/man/html/
8:sectnums:
9
10This document outlines a proposal to enable performing video decode operations in Vulkan.
11
12== Problem Statement
13
14Integrating video decode operations into Vulkan applications enable a wide set of new usage scenarios including, but not limited to, the following examples:
15
16  * Applying post-processing on top of video frames decoded from a compressed video stream
17  * Sourcing dynamic texture data from compressed video streams
18
19It is also not uncommon for Vulkan capable devices to feature dedicated hardware acceleration for video decompression.
20
21The goal of this proposal is to enable these use cases, expose the underlying hardware capabilities, and provide tight integration with other functionalities of the Vulkan API.
22
23
24== Solution Space
25
26The following options have been considered:
27
28  1. Rely on external sharing capabilities to interact with existing video decode APIs
29  2. Add new dedicated APIs to Vulkan specific to video decoding
30  3. Build upon a common set of APIs that enable video coding operations in general
31
32As discussed in the proposal for the `VK_KHR_video_queue` extension, reusing a common, shared infrastructure across all video coding functionalities that leverage existing Vulkan capabilities was preferred, hence this extension follows option 3.
33
34Further sub-options were considered whether a common set of APIs could be used to enable video decoding in general, upon which codec-specific extensions can be built. As the possibility of API reuse is similarly possible within the domain of video decoding as it is for video coding in general, this proposal follows the same principle to extend `VK_KHR_video_queue` with codec-independent video decoding capabilities.
35
36
37== Proposal
38
39=== Video Decode Queues
40
41While `VK_KHR_video_queue` already includes support for a more fine grained query to determine the set of supported video codec operations for a given queue family, this extension introduces an explicit queue flag called `VK_QUEUE_VIDEO_DECODE_BIT_KHR` to indicate support for video decoding.
42
43Applications can use this flag bit to identify video decode capable queue families in general, if needed, before querying more details about the individual video codec operations supported through the use of the `VkQueueFamilyVideoPropertiesKHR` structure. It also indicates support for the set of command buffer commands available on video decode queues, which include the following:
44
45  * Pipeline barrier and event handling commands used for synchronization
46  * Basic query commands to begin, end, and reset queries
47  * Timestamp write commands
48  * Generic video coding commands
49  * The new video decode command introduced by this extension
50
51For the full list of individual commands supported by video decode queues, and whether any command is supported inside/outside of video coding scopes, refer to the manual page of the corresponding command.
52
53
54=== Video Decode Profiles
55
56Video decode profiles are defined using a `VkVideoProfileInfoKHR` structure that specifies a `videoCodecOperation` value identifying a video decode operation. This extension does not introduce any video decode operation flags, as that is left to the codec-specific decode extensions.
57
58On the other hand, this extension allows the application to specify usage hints specific to video decoding by chaining the following new structure to `VkVideoProfileInfoKHR`:
59
60[source,c]
61----
62typedef struct VkVideoDecodeUsageInfoKHR {
63    VkStructureType               sType;
64    const void*                   pNext;
65    VkVideoDecodeUsageFlagsKHR    videoUsageHints;
66} VkVideoDecodeUsageInfoKHR;
67----
68
69The hint flags introduced by this extension are as follows:
70
71  * `VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR` should be used in video transcoding use cases
72  * `VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR` should be used when decoding local video content
73  * `VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR` should be used when decoding video content streamed over network
74
75These usage hints do not provide any restrictions or guarantees, so any combination of flags can be used, but they allow the application to better communicate the intended use case scenario so that implementations can make appropriate choices based on it.
76
77Logically, however, it is part of the video profile definition, so capabilities may vary across video decode profiles that only differ in terms of video decode usage hints, and it also affects video profile compatibility between resources and video sessions, so the same `VkVideoDecodeUsageInfoKHR` structure has to be included everywhere where the specific video decode profile is used.
78
79
80=== New Pipeline Stage and Access Flags
81
82This extension also introduces a new pipeline stage identified by the `VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR` flag to enable synchronizing video decode operations with respect to other Vulkan operations.
83
84In addition, two new access flags are introduced to indicate reads and writes, respectively, performed by the video decode pipeline stage:
85
86  * `VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR`
87  * `VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR`
88
89As these flags did no longer fit into the legacy 32-bit enums, this extension requires the `VK_KHR_synchronization2` extension and relies on the 64-bit versions of the pipeline stage and access mask flags to handle synchronization specific to video decode operations.
90
91
92=== New Buffer and Image Usage Flags
93
94This extension introduces the following new buffer usage flags:
95
96  * `VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR` allows using the buffer as a video bitstream buffer in video decode operations
97  * `VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR` is reserved for future use
98
99This extension also introduces the following new image usage flags:
100
101  * `VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR` is reserved for future use
102  * `VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR` allows using the image as a decode output picture
103  * `VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR` allows using the image as a decode DPB picture (reconstructed/reference picture)
104
105Specifying these usage flags alone is not sufficient to create a buffer or image that is compatible with a video session created against any particular video profile. In fact, when specifying any of these usage flags at resource creation time, the application has to include a `VkVideoProfileListInfoKHR` structure in the `pNext` chain of the corresponding create info structure with `VkVideoProfileListInfoKHR::pProfiles` including a video decode profile. The created resources will be compatible only with that single video decode profile (and any additional video encode profiles that may have been specified in the list).
106
107
108=== New Format Feature Flags
109
110To indicate which formats are compatible with video decode usage, the following new format feature flags are introduced:
111
112  * `VK_FORMAT_FEATURE_VIDEO_DECODE_OUTPUT_BIT_KHR` indicates support for decode output picture usage
113  * `VK_FORMAT_FEATURE_VIDEO_DECODE_DPB_BIT_KHR` indicates support for decode DPB picture usage
114
115The presence of the format flags alone, as returned by the various format queries, is not sufficient to indicate that an image with that format is usable with video decoding using any particular video decode profile. Actual compatibility with a specific video decode profile has to be verified using the `vkGetPhysicalDeviceVideoFormatPropertiesKHR` command.
116
117
118=== Basic Operation
119
120Video decode operations can be recorded into command buffers allocated from command pools created against queue families that support the `VK_QUEUE_VIDEO_DECODE_BIT_KHR` flag.
121
122Recording video decode operations happens through the use of the following new command:
123
124[source,c]
125----
126VKAPI_ATTR void VKAPI_CALL vkCmdDecodeVideoKHR(
127    VkCommandBuffer                             commandBuffer,
128    const VkVideoDecodeInfoKHR*                 pDecodeInfo);
129----
130
131The common, codec-independent parameters of the video decode operation are provided using the following new structure:
132
133[source,c]
134----
135typedef struct VkVideoDecodeInfoKHR {
136    VkStructureType                       sType;
137    const void*                           pNext;
138    VkVideoDecodeFlagsKHR                 flags;
139    VkBuffer                              srcBuffer;
140    VkDeviceSize                          srcBufferOffset;
141    VkDeviceSize                          srcBufferRange;
142    VkVideoPictureResourceInfoKHR         dstPictureResource;
143    const VkVideoReferenceSlotInfoKHR*    pSetupReferenceSlot;
144    uint32_t                              referenceSlotCount;
145    const VkVideoReferenceSlotInfoKHR*    pReferenceSlots;
146} VkVideoDecodeInfoKHR;
147----
148
149Executing such a video decode operation results in the decompression of a single picture (unless otherwise defined by layered extensions), and, if there is an active `VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR` query, the status of the video decode operation is recorded into the active query slot.
150
151If the decode operation requires additional codec-specific parameters, then such parameters are provided in the `pNext` chain of the structure above. Whether such codec-specific information is necessary, and what it may contain is up to the codec-specific extensions.
152
153`srcBuffer`, `srcBufferOffset`, and `srcBufferRange` provide information about the used video bitstream buffer range. The video decode operation reads the compressed picture data from this buffer range.
154
155The application has to create the video bitstream buffer with the new `VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR` usage flag, and must also include the used video session's video profile in the `VkVideoProfileListInfoKHR` structure specified at buffer creation time.
156
157The expected contents of the video bitstream buffer range depends on the specific video codec used, as defined by corresponding codec-specific extensions built upon this proposal.
158
159The `dstPictureResource`, `pSetupReferenceSlot`, and `pReferenceSlots` members specify the decode output picture, reconstructed picture, and reference pictures, respectively, used by the video decode operation, as discussed in later sections of this proposal.
160
161
162=== Decode Output Picture
163
164`dstPictureResource` defines the parameters of the video picture resource to use as the decode output picture. The video decode operation writes the picture data resulting from the decompression of the bitstream data to this video picture resource. As such it is a mandatory parameter of the operation.
165
166The application has to create the image view specified in `dstPictureResource.imageViewBinding` with the new `VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR` usage flag, and must also include the used video session's video profile in the `VkVideoProfileListInfoKHR` structure specified at image creation time.
167
168The image subresource backing the decode output picture has to be in the new `VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR` layout at the time the video decode operation is executed, except if it matches the reconstructed picture, as discussed later, in which case the image subresource has to be in the new `VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR` layout.
169
170
171=== Reconstructed Picture
172
173`pSetupReferenceSlot` is an optional parameter specifying the video picture resource and DPB slot index to use for the reconstructed picture. Implementations use the reconstructed picture for one of the following purposes:
174
175  1. When the decoded picture is requested to be set up as a reference, according to the codec-specific semantics, the video decode operation will output the raw decoding results to this picture and activate the reconstructed picture's DPB slot with it in order to enable using the picture as a reference picture in future video decode operations. Content-wise, this picture is generally identical to the decode output picture unless the decode output picture contains any sort of post-processing (e.g. film grain).
176  2. When the decoded picture is not requested to be set up as a reference, implementations may use the reconstructed picture's resource and/or DPB slot for intermediate data required by the decoding process.
177
178Accordingly, `pSetupReferenceSlot` must never be `NULL`, except when the video session was created without any DPB slots.
179
180[NOTE]
181.Note
182====
183The original version of this extension only required the specification of the reconstructed picture information (i.e. a non-`NULL` `pSetupReferenceSlot`) when the application intended to set up a reference picture by activating a DPB slot. Consequently, the presence of reconstructed picture information always implied DPB slot activation. This was changed in revision 8 of the extension, and whether DPB slot activation happens is now subject to codec-specific semantics. More details on this change are discussed in the corresponding issue in this proposal document.
184====
185
186In summary, for decoded pictures requested to be set up as a reference, this parameter can be used to add new reference pictures to the DPB, and change the association between DPB slot indices and video picture resources. That also implies that the application has to specify a video picture resource in `pSetupReferenceSlot->pPictureResource` that was included in the set of bound reference picture resources specified when the video coding scope was started (in one of the elements of `VkVideoBeginCodingInfoKHR::pReferenceSlots`). No similar requirement exists for the decode output picture specified by `dstPictureResource` which can refer to any video picture resource.
187
188The application has to create the image view specified in `pSetupReferenceSlot->pPictureResource->imageViewBinding` with the new `VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR` usage flag, and must also include the used video session's video profile in the `VkVideoProfileListInfoKHR` structure specified at image creation time.
189
190The image subresource backing the reconstructed picture has to be in the new `VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR` layout at the time the video decode operation is executed.
191
192Implementations diverge in the way they handle reconstructed pictures:
193
194  * On some implementations the decode output picture and reconstructed picture have to be _distinct_ video picture resources, even if the picture data written by the video decode operation to the two resources is identical.
195  * On other implementations the decode output picture and reconstructed picture have to _coincide_, i.e. both have to refer to the same video picture resource.
196  * Some other implementations may actually support both modes.
197
198Support for the individual modes is indicated by the `VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR` and `VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR` capability flags. Implementations are only required to support one of the two modes, hence portable applications have to make sure that they support both options. Dealing with this implementation divergence, however, is fairly simple.
199
200Generally speaking, the application has to create the following images in order to decode a video stream:
201
202  * One or more images usable as reconstructed pictures, some of which will contain the reference pictures associated with the DPB.
203  * Optionally, an additional image usable as the decode output picture when the reconstructed picture has to be _distinct_ or when using video sessions without any DPB slots.
204
205[NOTE]
206.Note
207====
208In practice, applications will typically allocate more than one decode output pictures for buffering purposes and/or to minimize synchronization overhead resulting from having to prevent write-after-write hazards across subsequent video decode operations targeting the same decode output picture resource. Some applications may also allocate more resources for reference pictures than the number of DPB slots for similar reasons.
209====
210
211The application should always create the image(s) backing the DPB with the `VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR` usage flag. If only the _coincide_ mode is supported for reconstructed pictures, then the DPB image(s) that may be used as a reconstructed picture in a video decode operation have to also include the `VK_IMAGE_USAGE_VIDEO_DECODE_DST_KHR` usage flag to allow them to be used as coinciding decode output and reconstructed pictures.
212
213The image backing the decode output picture should always be created with the `VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR` usage flag.
214
215The DPB image(s) are expected to be in the `VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR` layout while in use by video decode operations, while the decode output image is expected to be in the `VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR` layout.
216
217Here we have two cases to consider:
218
219  1. When a reconstructed picture is specified; and
220  2. When one is not needed (as the video session was created without any DPB slots)
221
222In case of (2), the application can use the image created for the decode output picture in `dstPictureResource`, indifferent of whether the _distinct_ or _coincide_ mode is used.
223
224In case of (1), the behavior is as follows:
225
226  * In _distinct_ mode the decode output picture's image should be used in `dstPictureResource`, and (one of) the DPB image(s) should be referred to in `pSetupReferenceSlot`, as it would naturally follow.
227  * In _coincide_ mode both `dstPictureResource` and `pSetupReferenceSlot` should refer to a video picture resource in (one of) the DPB image(s).
228
229In the latter situation the decoded picture will be written only to the DPB image, and the image created for decode-output-only use remains unused. If the application wants to concurrently use the decoded picture while also performing video decode operations using the same picture as reference, it can manually copy the decoded picture stored in the DPB image to the otherwise unused decode output image, if needed. This way it practically mimics the behavior of an implementation supporting the _distinct_ mode. However, in most use cases that is not necessary, hence on implementations supporting the _coincide_ mode the application can avoid having two copies of the decoded pictures, even if they are used as reference pictures later on.
230
231If the video profile in use requires additional codec-specific parameters for the reconstructed picture, then such parameters are provided in the `pNext` chain of `pSetupReferenceSlot`. Whether such codec-specific reconstructed picture information is necessary, and what it may contain is up to the codec-specific extensions.
232
233
234=== Reference Pictures
235
236If the video session allows, reference pictures can be specified in the `pReferenceSlots` array to provide predictions of the values of samples of the decoded picture.
237
238Each entry in the `pReferenceSlots` array adds one or more pictures, currently associated with the DPB slot specified in the element's `slotIndex` member and stored in the video picture resource specified in the element's `pPictureResource` member, to the list of active reference pictures to use in the video decode operation.
239
240The application has to make sure to specify each video picture resource used as a reference picture in a video decode operation, beforehand, in the set of bound reference picture resources specified when the video coding scope was started (in one of the elements of `VkVideoBeginCodingInfoKHR::pReferenceSlots`).
241
242The application has to create the image view specified in `pPictureResource->imageViewBinding` of the elements of `pReferenceSlots` with the new `VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR` usage flag, and must also include the used video session’s video profile in the `VkVideoProfileListInfoKHR` structure specified at image creation time.
243
244The image subresources backing the reference pictures have to be in the new `VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR` layout at the time the video decode operation is executed.
245
246Typically the number of elements in `pReferenceSlots` equals the number of reference pictures added, but in certain cases (depending on the used video codec and video profile) there may be multiple pictures in the same DPB slot resource.
247
248If the video profile in use requires additional codec-specific parameters for the reference pictures, then such parameters are provided in the `pNext` chain of the elements of `pReferenceSlots`. Whether such codec-specific reference picture information is necessary, and what it may contain is up to the codec-specific extensions.
249
250
251=== Capabilities
252
253Querying capabilities specific to video decoding happens through the query mechanisms introduced by the `VK_KHR_video_queue` extension.
254
255Support for individual video decode operations can be retrieved for each queue family using the `VkQueueFamilyVideoPropertiesKHR` structure, as discussed earlier.
256
257The application can also use the `vkGetPhysicalDeviceVideoCapabilitiesKHR` command to query the capabilities of a specific video decode profile. In case of video decode profiles, the following new structure has to be included in the `pNext` chain of the `VkVideoCapabilitiesKHR` structure used to retrieve the general video decode capabilities:
258
259[source,c]
260----
261typedef struct VkVideoDecodeCapabilitiesKHR {
262    VkStructureType                    sType;
263    void*                              pNext;
264    VkVideoDecodeCapabilityFlagsKHR    flags;
265} VkVideoDecodeCapabilitiesKHR;
266----
267
268This structure only contains a new decode-specific `flags` member that indicates support for various video decode capabilities, like the support for the _distinct_ and _coincide_ modes for reconstructed pictures, as discussed earlier.
269
270The `vkGetPhysicalDeviceVideoFormatPropertiesKHR` command can be used to query the supported image/picture formats for a given set of video profiles, as described in the `VK_KHR_video_queue` extension.
271
272In particular, if the application would like to query the list of format properties supported for decode output pictures, then it should include the new `VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR` usage flag in `VkPhysicalDeviceVideoFormatInfoKHR::imageUsage`.
273
274Similarly, to query the list of format properties supported for decode DPB pictures (reconstructed/reference pictures), then it should include the new `VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR` usage flag in `VkPhysicalDeviceVideoFormatInfoKHR::imageUsage`.
275
276When using the _coincide_ mode, the application will need DPB pictures that support both decode output and DPB usage, hence it should call `vkGetPhysicalDeviceVideoFormatPropertiesKHR` with `VkPhysicalDeviceVideoFormatInfoKHR::imageUsage` including both `VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR` and `VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR`.
277
278
279=== Usage Summary
280
281To summarize the usage of the video decoding features introduced by this extension, let us take a look at a typical usage scenario when using this extension to decode a video stream.
282
283Before the application can start recording command buffers with video decode operations, it has to do the following:
284
285  . Ensure that the implementation can decode the video content at hand by first querying the video codec operations supported by each queue family using the `vkGetPhysicalDeviceQueueFamilyProperties2` command and the `VkQueueFamilyVideoPropertiesKHR` output structure.
286  . If needed, the application has to also retrieve the `VkQueueFamilyQueryResultStatusPropertiesKHR` output structure for the queue family to check support for `VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR` queries.
287  . Construct the `VkVideoProfileInfoKHR` structure describing the entire video profile, including the video codec operation, chroma subsampling, bit depths, and any other usage or codec-specific parameters.
288  . Ensure that the specific video profile is supported by the implementation using the `vkGetPhysicalDeviceVideoCapabilitiesKHR` command and retrieve the general, decode-specific, and codec-specific capabilities at the same time.
289  . Query the list of supported image/picture format properties supported for the video profile using the `vkGetPhysicalDeviceVideoFormatPropertiesKHR` structure, and select a suitable format for the DPB and decode output pictures.
290  . If needed, create one or more images corresponding to the decode output picture(s) and/or DPB picture(s) with the appropriate usage flags and video profile list, as described earlier, and bind suitable device memory to them. Also create any image views with the appropriate usage flags to use in the video decode operations.
291  . Create a buffer with the `VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR` usage flag and the video profile list, to use as the source video bitstream buffer. If the buffer is expected to be populated using the CPU, consider binding compatible host-visible device memory to the buffer.
292  . If result status queries are needed and supported (as determined earlier), create a query pool with the `VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR` query type and the used video decode profile.
293  . Create the video session using the video decode profile and appropriate parameters within the capabilities supported by the profile, as determined earlier. Bind suitable device memory to each memory binding index of the video session.
294  . If needed, create a video session parameters object for the video session.
295
296Recording video decode operations into command buffers typically consists of the following sequence:
297
298  . Start a video coding scope with the created video session (and parameters) object using the `vkCmdBeginVideoCodingKHR` command. Make sure to include all video picture resources in `VkVideoBeginCodingInfoKHR::pReferenceSlots` that may be used as reconstructed or reference pictures within the video coding scope, and ensure that the DPB slots specified for each reflect the current DPB slot association for the resource.
299  . If this is the first video coding scope the video session is used in, reset the video session to the initial state by recording a `vkCmdControlVideoCodingKHR` command with the `VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR` flag.
300  . If needed, start a `VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR` query using `vkCmdBeginQuery`. Reset the query using `vkCmdResetQueryPool`, beforehand, as needed.
301  . Issue a video decode operation using the `vkCmdDecodeVideoKHR` command with appropriate parameters, as discussed earlier.
302  . If needed, end the started query using `vkCmdEndQuery`.
303  . Record any further control or decode operations into the video coding scope, as needed.
304  . End the video coding scope using the `vkCmdEndVideoCodingKHR` command.
305
306
307== Examples
308
309=== Select queue family with video decode support for a given video codec operation
310
311[source,c]
312----
313VkVideoCodecOperationFlagBitsKHR neededVideoDecodeOp = ...
314uint32_t queueFamilyIndex;
315uint32_t queueFamilyCount;
316
317vkGetPhysicalDeviceQueueFamilyProperties2(physicalDevice, &queueFamilyCount, NULL);
318
319VkQueueFamilyProperties2* props = calloc(queueFamilyCount,
320    sizeof(VkQueueFamilyProperties2));
321VkQueueFamilyVideoPropertiesKHR* videoProps = calloc(queueFamilyCount,
322    sizeof(VkQueueFamilyVideoPropertiesKHR));
323
324for (queueFamilyIndex = 0; queueFamilyIndex < queueFamilyCount; ++queueFamilyIndex) {
325    props[queueFamilyIndex].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2;
326    props[queueFamilyIndex].pNext = &videoProps[queueFamilyIndex];
327
328    videoProps[queueFamilyIndex].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR;
329}
330
331vkGetPhysicalDeviceQueueFamilyProperties2(physicalDevice, &queueFamilyCount, props);
332
333for (queueFamilyIndex = 0; queueFamilyIndex < queueFamilyCount; ++queueFamilyIndex) {
334    if ((props[queueFamilyIndex].queueFamilyProperties.queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) != 0 &&
335        (videoProps[queueFamilyIndex].videoCodecOperations & neededVideoDecodeOp) != 0) {
336        break;
337    }
338}
339
340if (queueFamilyIndex < queueFamilyCount) {
341    // Found appropriate queue family
342    ...
343} else {
344    // Did not find a queue family with the needed capabilities
345    ...
346}
347----
348
349
350=== Check support and query the capabilities for a video decode profile
351
352[source,c]
353----
354VkResult result;
355
356// We also include the optional decode usage hints here
357VkVideoDecodeUsageInfoKHR profileUsageInfo = {
358    .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR,
359    .pNext = ... // pointer to codec-specific profile structure
360    .videoUsageHints = VK_VIDEO_DECODE_USAGE_DEFAULT_KHR,
361};
362
363VkVideoProfileInfoKHR profileInfo = {
364    .sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR,
365    .pNext = &profileUsageInfo
366    .videoCodecOperation = ... // used video decode operation
367    .chromaSubsampling = VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR,
368    .lumaBitDepth = VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR,
369    .chromaBitDepth = VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR
370};
371
372VkVideoDecodeCapabilitiesKHR decodeCapabilities = {
373    .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR,
374    .pNext = ... // pointer to codec-specific capability structure
375}
376
377VkVideoCapabilitiesKHR capabilities = {
378    .sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR,
379    .pNext = &decodeCapabilities
380};
381
382result = vkGetPhysicalDeviceVideoCapabilitiesKHR(physicalDevice, &profileInfo, &capabilities);
383
384if (result == VK_SUCCESS) {
385    // Profile is supported, check additional capabilities
386    ...
387} else {
388    // Profile is not supported, result provides additional information about why
389    ...
390}
391----
392
393
394=== Select decode output and DPB formats supported by the video decode profile
395
396[source,c]
397----
398VkVideoProfileInfoKHR profileInfo = {
399    ...
400};
401
402VkVideoProfileListInfoKHR profileListInfo = {
403    .sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR,
404    .pNext = NULL,
405    .profileCount = 1,
406    .pProfiles = &profileInfo
407};
408
409VkPhysicalDeviceVideoFormatInfoKHR formatInfo = {
410    .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR,
411    .pNext = &profileListInfo
412};
413
414VkVideoFormatPropertiesKHR* formatProps = NULL;
415
416// First query decode output formats
417formatInfo.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR;
418
419vkGetPhysicalDeviceVideoFormatPropertiesKHR(physicalDevice, &formatInfo, &formatCount, NULL);
420formatProps = calloc(formatCount, sizeof(VkVideoFormatPropertiesKHR));
421for (uint32_t i = 0; i < formatCount; ++i) {
422    formatProps.sType = VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR;
423}
424vkGetPhysicalDeviceVideoFormatPropertiesKHR(physicalDevice, &formatInfo, &formatCount, formatProps);
425
426for (uint32_t i = 0; i < formatCount; ++i) {
427    // Select decode output format and image creation capabilities best suited for the use case
428    ...
429}
430free(formatProps);
431
432// Then query DPB formats
433formatInfo.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
434
435// If DISTINCT mode is not supported or if COINCIDE mode is supported and preferred, then the DPB
436// images generally have to be created to be usable both as decode output and DPB pictures
437if ((decodeCapabilities.flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR) == 0 || preferCoincideMode) {
438    formatInfo.imageUsage |= VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR;
439}
440
441vkGetPhysicalDeviceVideoFormatPropertiesKHR(physicalDevice, &formatInfo, &formatCount, NULL);
442formatProps = calloc(formatCount, sizeof(VkVideoFormatPropertiesKHR));
443for (uint32_t i = 0; i < formatCount; ++i) {
444    formatProps.sType = VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR;
445}
446vkGetPhysicalDeviceVideoFormatPropertiesKHR(physicalDevice, &formatInfo, &formatCount, formatProps);
447
448for (uint32_t i = 0; i < formatCount; ++i) {
449    // Select DPB format and image creation capabilities best suited for the use case
450    ...
451}
452free(formatProps);
453----
454
455
456=== Create bitstream buffer
457
458[source,c]
459----
460VkBuffer bitstreamBuffer = VK_NULL_HANDLE;
461
462VkVideoProfileListInfoKHR profileListInfo = {
463    .sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR,
464    .pNext = NULL,
465    .profileCount = ... // number of video profiles to use the bitstream buffer with
466    .pProfiles = ... // pointer to an array of video profile information structure chains
467};
468
469VkBufferCreateInfo createInfo = {
470    .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
471    .pNext = &profileListInfo,
472    ...
473    .usage = VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR | ... // any other usages that may be needed
474    ...
475};
476
477vkCreateBuffer(device, &createInfo, NULL, &bitstreamBuffer);
478----
479
480
481=== Create decode output image and image view
482
483[source,c]
484----
485VkImage outputImage = VK_NULL_HANDLE;
486VkImageView outputImageView = VK_NULL_HANDLE;
487
488VkVideoProfileListInfoKHR profileListInfo = {
489    .sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR,
490    .pNext = NULL,
491    .profileCount = ... // number of video profiles to use the decode output image with
492    .pProfiles = ... // pointer to an array of video profile information structure chains
493};
494
495VkImageCreateInfo imageCreateInfo = {
496    .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
497    .pNext = &profileListInfo,
498    ...
499    .usage = VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | ... // any other usages that may be needed
500    ...
501};
502
503vkCreateImage(device, &imageCreateInfo, NULL, &outputImage);
504
505VkImageViewUsageCreateInfo imageViewUsageInfo = {
506    .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO,
507    .pNext = NULL,
508    .usage = VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
509};
510
511VkImageViewCreateInfo imageViewCreateInfo = {
512    .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
513    .pNext = &imageViewUsageInfo,
514    .flags = 0,
515    .image = outputImage,
516    .viewType = ... // image view type (only 2D or 2D_ARRAY is supported)
517    ... // other image view creation parameters
518};
519
520vkCreateImageView(device, &imageViewCreateInfo, NULL, &outputImageView);
521----
522
523
524=== Create DPB image and image view
525
526[source,c]
527----
528// NOTE: This example creates a single image and image view that is used to back all DPB pictures
529// but, depending on the support of the VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR
530// capability flag, the application can choose to create separate images for each DPB slot or
531// picture
532
533VkImage dpbImage = VK_NULL_HANDLE;
534VkImageView dpbImageView = VK_NULL_HANDLE;
535
536VkImageUsage dpbImageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
537
538// If DISTINCT mode is not supported or if COINCIDE mode is supported and preferred, then the DPB
539// images generally have to be created to be usable both as decode output and DPB pictures
540if ((decodeCapabilities.flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR) == 0 || preferCoincideMode) {
541    dpbImageUsage |= VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR;
542}
543
544
545VkVideoProfileListInfoKHR profileListInfo = {
546    .sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR,
547    .pNext = NULL,
548    .profileCount = ... // number of video profiles to use the decode DPB image with
549    .pProfiles = ... // pointer to an array of video profile information structure chains
550};
551
552VkImageCreateInfo imageCreateInfo = {
553    .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
554    .pNext = &profileListInfo,
555    ...
556    .usage = dpbImageUsage | ... // any other usages that may be needed
557    ...
558    .arrayLayers = // typically equal to the DPB slot count
559};
560
561vkCreateImage(device, &imageCreateInfo, NULL, &dpbImage);
562
563VkImageViewUsageCreateInfo imageViewUsageInfo = {
564    .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO,
565    .pNext = NULL,
566    .usage = dpbImageUsage
567};
568
569VkImageViewCreateInfo imageViewCreateInfo = {
570    .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
571    .pNext = &imageViewUsageInfo,
572    .flags = 0,
573    .image = dpbImage,
574    .viewType = ... // image view type (only 2D or 2D_ARRAY is supported)
575    ... // other image view creation parameters
576};
577
578vkCreateImageView(device, &imageViewCreateInfo, NULL, &dpbImageView);
579----
580
581
582=== Record decode operation (video session without DPB slots)
583
584[source,c]
585----
586vkCmdBeginVideoCodingKHR(commandBuffer, ...);
587
588VkVideoPictureResourceInfoKHR decodeOutputPictureResource = {
589    .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
590    .pNext = NULL,
591    .codedOffset = ... // offset within the image subresource (typically { 0, 0 })
592    .codedExtent = ... // extent of decoded picture (typically the video frame size)
593    .baseArrayLayer = 0,
594    .imageViewBinding = outputImageView
595};
596
597VkVideoDecodeInfoKHR decodeInfo = {
598    .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR,
599    .pNext = ... // pointer to codec-specific picture information structure
600    .flags = 0,
601    .srcBuffer = bitstreamBuffer,
602    .srcBufferOffset = ... // offset of picture data in the video bitstream buffer
603    .srcBufferRange = ... // size of picture data in the video bitstream buffer
604    .dstPictureResource = decodeOutputPictureResource,
605    .pSetupReferenceSlot = NULL,
606    .referenceSlotCount = 0,
607    .pReferenceSlots = NULL
608};
609
610vkCmdDecodeVideoKHR(commandBuffer, &decodeInfo);
611
612vkCmdEndVideoCodingKHR(commandBuffer, ...);
613----
614
615
616=== Record decode operation with reconstructed picture information (DISTINCT mode)
617
618[source,c]
619----
620// Bound reference resource list provided has to include reconstructed picture resource
621vkCmdBeginVideoCodingKHR(commandBuffer, ...);
622
623VkVideoPictureResourceInfoKHR decodeOutputPictureResource = {
624    .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
625    .pNext = NULL,
626    .codedOffset = ... // offset within the image subresource (typically { 0, 0 })
627    .codedExtent = ... // extent of decoded picture (typically the video frame size)
628    .baseArrayLayer = 0,
629    .imageViewBinding = outputImageView
630};
631
632VkVideoPictureResourceInfoKHR reconstructedPictureResource = {
633    .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
634    .pNext = NULL,
635    .codedOffset = ... // offset within the image subresource (typically { 0, 0 })
636    .codedExtent = ... // extent of reconstructed picture (typically the video frame size)
637    .baseArrayLayer = ... // layer to use for setup picture in DPB
638    .imageViewBinding = dpbImageView
639};
640
641VkVideoReferenceSlotInfoKHR setupSlotInfo = {
642    .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR,
643    .pNext = ... // pointer to codec-specific reconstructed picture information structure
644    .slotIndex = ... // DPB slot index to use with the reconstructed picture
645                     // (optionally activated per the codec-specific semantics)
646    .pPictureResource = &reconstructedPictureResource
647};
648
649VkVideoDecodeInfoKHR decodeInfo = {
650    .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR,
651    .pNext = ... // pointer to codec-specific picture information structure
652    ...
653    .dstPictureResource = decodeOutputPictureResource,
654    .pSetupReferenceSlot = &setupSlotInfo,
655    ...
656};
657
658vkCmdDecodeVideoKHR(commandBuffer, &decodeInfo);
659
660vkCmdEndVideoCodingKHR(commandBuffer, ...);
661----
662
663
664=== Record decode operation with reconstructed picture information (COINCIDE mode)
665
666[source,c]
667----
668// Bound reference resource list provided has to include reconstructed picture resource
669vkCmdBeginVideoCodingKHR(commandBuffer, ...);
670
671VkVideoPictureResourceInfoKHR reconstructedPictureResource = {
672    .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
673    .pNext = NULL,
674    .codedOffset = ... // offset within the image subresource (typically { 0, 0 })
675    .codedExtent = ... // extent of decoded picture (typically the video frame size)
676    .baseArrayLayer = ... // layer to use for setup picture in DPB
677    .imageViewBinding = dpbImageView
678};
679
680VkVideoReferenceSlotInfoKHR setupSlotInfo = {
681    .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR,
682    .pNext = ... // pointer to codec-specific reconstructed picture information structure
683    .slotIndex = ... // DPB slot index to use with the reconstructed picture
684                     // (optionally activated per the codec-specific semantics)
685    .pPictureResource = &reconstructedPictureResource
686};
687
688VkVideoDecodeInfoKHR decodeInfo = {
689    .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR,
690    .pNext = ... // pointer to codec-specific picture information structure
691    ...
692    .dstPictureResource = reconstructedPictureResource,
693    .pSetupReferenceSlot = &setupSlotInfo,
694    ...
695};
696
697vkCmdDecodeVideoKHR(commandBuffer, &decodeInfo);
698
699vkCmdEndVideoCodingKHR(commandBuffer, ...);
700----
701
702
703=== Record decode operation with reference picture list
704
705[source,c]
706----
707// Bound reference resource list provided has to include all used reference picture resources
708vkCmdBeginVideoCodingKHR(commandBuffer, ...);
709
710VkVideoPictureResourceInfoKHR referencePictureResources[] = {
711    {
712        .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
713        .pNext = NULL,
714        .codedOffset = ... // offset within the image subresource (typically { 0, 0 })
715        .codedExtent = ... // extent of reference picture (typically the video frame size)
716        .baseArrayLayer = ... // layer of first reference picture resource
717        .imageViewBinding = dpbImageView
718    },
719    {
720        .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
721        .pNext = NULL,
722        .codedOffset = ... // offset within the image subresource (typically { 0, 0 })
723        .codedExtent = ... // extent of reference picture (typically the video frame size)
724        .baseArrayLayer = ... // layer of second reference picture resource
725        .imageViewBinding = dpbImageView
726    },
727    ...
728};
729// NOTE: Individual resources do not have to refer to the same image view, e.g. if different
730// image views are created for each picture resource, or if the
731// VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR capability is supported and the
732// application created separate images for the reference pictures.
733
734VkVideoReferenceSlotInfoKHR referenceSlotInfo[] = {
735    {
736        .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR,
737        .pNext = ... // pointer to codec-specific reference picture information structure
738        .slotIndex = ... // DPB slot index of the first reference picture
739        .pPictureResource = &referencePictureResource[0]
740    },
741    {
742        .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR,
743        .pNext = ... // pointer to codec-specific reference picture information structure
744        .slotIndex = ... // DPB slot index of the second reference picture
745        .pPictureResource = &referencePictureResource[1]
746    },
747    ...
748};
749
750VkVideoDecodeInfoKHR decodeInfo = {
751    .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR,
752    .pNext = ... // pointer to codec-specific picture information structure
753    ...
754    .referenceSlotCount = sizeof(referenceSlotInfo) / sizeof(referenceSlotInfo[0]),
755    .pReferenceSlots = &referenceSlotInfo[0]
756};
757
758vkCmdDecodeVideoKHR(commandBuffer, &decodeInfo);
759
760vkCmdEndVideoCodingKHR(commandBuffer, ...);
761----
762
763
764== Issues
765
766=== RESOLVED: Why is there no `VK_PIPELINE_STAGE_VIDEO_DECODE_BIT_KHR`?
767
768This extension requires the `VK_KHR_synchronization2` extension because the new access flags introduced did not fit in the 32-bit enum `VkAccessFlagBits`. Accordingly, all new pipeline stage and access flags have been added to the corresponding 64-bit enums and no new flags have been added to the legacy 32-bit enums. While the new pipeline stage flag introduced uses bit #26 which would also fit in the legacy `VkPipelineStageFlagBits` enum, there is no real benefit to include it. Instead the bit is marked reserved.
769
770
771=== RESOLVED: Are the decode output picture data and reconstructed picture data used to activate a DPB slot written to the same resource?
772
773When activating DPB slots with reconstructed pictures (reference picture setup), decode operations have to write the decompressed picture data to a DPB-capable video picture resource.
774
775Behavior varies across implementations in this case:
776
777  * Some implementations write the outputs of the picture decompression to two separate resources: the decoded output picture and the reconstructed picture
778  * Some other implementations only write picture decompression results to one place, which in this case has to be a DPB picture (as it must be usable as a reference picture later on)
779
780A separate output could be useful if e.g. the application intends to use the decode output picture for other purposes (e.g. for window-system presentation or for texture sampling), while using the reconstructed picture in parallel to continue decoding. However, such concurrent use of the outputs is not always necessary.
781
782Trying to mandate a uniform behavior across such implementations could have negative performance implications:
783
784  * If separate outputs would be required, then implementations using a single output would have to perform additional copies even though the application use cases might not need to have one.
785  * If a single output would be required, then applications would have to do copies if they wanted to do such concurrent processing and would not be able to take advantage of implementations that already can write separate outputs in an optimized fashion.
786
787Instead, this extension allows implementations to support either of these modes of operations (separate or single output), as indicated by the `VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR` and `VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR` capability flags, respectively. Implementations are required to support only one of these two modes, and the extension even allows for implementations that may support both modes of operation.
788
789
790=== RESOLVED: How can layered codec-specific decode extensions enable applications to provide the necessary codec-specific picture information, parameter sets, etc. that may be needed to perform the video coding operations?
791
792There are multiple points where codec-specific picture information can be provided to a video decode operation. This extension suggests the following convention:
793
794  * Codec-specific decode parameters are expected to be provided in the `pNext` chain of `VkVideoDecodeInfoKHR`.
795  * Codec-specific reconstructed picture information is expected to be provided in the `pNext` chain of `VkVideoDecodeInfoKHR::pSetupReferenceSlot`.
796  * Codec-specific reference picture information is expected to be provided in the `pNext` chain of the elements of the `VkVideoDecodeInfoKHR::pReferenceSlots` array.
797
798
799=== RESOLVED: Can `vkCmdVideoDecodeKHR` only decode frames? What about field decoding, slice decoding, etc.?
800
801This extension does not define the types of pictures or sub-picture content that can be decoded by a `vkCmdVideoDecodeKHR` command. It is expected that the codec-specific decode extensions built upon this extension define the types of pictures that can be decoded. Furthermore, both codec-specific and codec-independent extensions can expand the set of capabilities introduced here to enable more advanced use cases, as needed.
802
803
804=== RESOLVED: What is the effect of the flags provided in `VkVideoDecodeUsageInfoKHR::videoUsageHints`?
805
806There are no specific behavioral effects associated with any of the video decode usage hints, so the application can specify any combination of these flags. They are included to enable the application to better communicate the intended use case scenario to the implementation.
807
808However, just like any other additional video profile information included in the `pNext` chain of `VkVideoProfileInfoKHR` structures, they are part of the video profile definition, hence whenever matching video profiles have to be provided to an API call, let that be queries or resource creation structures, the application must provide identical video decode usage hint values. This also applies if the application does not include the `VkVideoDecodeUsageInfoKHR` structure, which is treated equivalently to specifying the structure with `videoUsageHints` equal to `VK_VIDEO_DECODE_USAGE_DEFAULT_KHR` (or zero), per the usual conventions of Vulkan.
809
810
811=== RESOLVED: When is it mandatory to specify reconstructed picture information in `VkVideoDecodeInfoKHR::pSetupReferenceSlot`?
812
813In the original version of this extension, specifying a non-`NULL` `pSetupReferenceSlot` parameter was only required for activating DPB slots with reference pictures, but no shipping implementation actually supported specifying `NULL` for `pSetupReferenceSlot`. In the end, some implementations turned out to require a reconstructed picture resource and/or DPB slot, even when the decoded picture is not expected to be used as a reference picture by future video decode operations, so this extension has been changed with revision 8 as follows:
814
815  1. Specifying reconstructed picture information (i.e. a non-`NULL` `pSetupReferenceSlot`) is made mandatory for all cases except when the video session was created with no DPB slots
816  2. Reference picture setup (and, inherently, DPB slot activation) was changed to be subject to codec-specific behavior, meaning that specifying a non-`NULL` `pSetupReferenceSlot` will only trigger reference picture setup if the appropriate codec-specific parameters or semantics indicate so (typically in the form of marking the decoded picture as reference)
817
818(2) was necessary in order to avoid unnecessary DPB slot activation and the cost of populating the reconstructed picture resource when it is distinct from the decode output and the reconstructed picture is not intended to be used as a reference picture by future video decode operations. However, as some implementations may use the reconstructed picture resource and/or DPB slot as transient storage during the decoding process, if a non-`NULL` `pSetupReferenceSlot` is specified but no reference picture setup is requested, then the contents of the reconstructed picture resource become undefined and some of the picture references associated with the reconstructed picture's DPB slot may get invalidated.
819
820While this change breaks backward-compatibility, no implementation actually supported the removed behavior, thus it should not have any effect on shipping applications.
821
822
823=== RESOLVED: Does always requiring the specification of reconstructed picture information in `VkVideoDecodeInfoKHR::pSetupReferenceSlot` have any undesired performance consequences?
824
825There may be performance implications when using _distinct_ mode, i.e. using a reconstructed picture resource that is distinct from the decode output picture. As discussed in the previous issue, the explicit codec-specific opt-in for reference picture setup allows implementations to avoid consuming twice as much memory bandwidth to also write out the reconstructed picture when it is otherwise not needed. However, as it is implementation-specific whether the reconstructed picture is written to, even when no reference picture setup takes place, the reconstructed picture becomes a shared resource that the application has to synchronize in order to avoid write-after-write hazards. Accordingly, depending on the implementation, there may be some performance implications to always requiring the specification of reconstructed picture information.
826
827
828== Further Functionality
829
830This extension is meant to provide only common video decode functionality, thus support for individual video decode profiles using specific video compression standards is left for extensions layered on top of the infrastructure provided here.
831
832Currently the following layered extensions are available:
833
834  * `VK_KHR_video_decode_h264` - adds support for decoding H.264/AVC video sequences
835  * `VK_KHR_video_decode_h265` - adds support for decoding H.265/HEVC video sequences
836