• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2018-2021 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5[[video-decode-and-encode-operations]]
6= Video Decode and Encode Operations
7
8Vulkan implementations can: expose video decode and encode engines, which
9are independent from the graphics and compute engines.
10Video decode and encode is performed by recording video operations and
11submitting them to video decode and encode queues.
12Vulkan provides core support for video decode and encode and can: support a
13variety of video codecs through individual extensions built on the core
14video support.
15
16The subsections below detail the fundamental components and operation of
17Vulkan video.
18
19
20== Technical Terminology and Semantics
21
22
23[[video-picture-resources]]
24=== Video Picture Resources
25
26*Video Picture Resources* contain format information, can: be
27multidimensional and may: have associated metadata.
28The metadata can: include implementation-private details required for the
29decode or encode operations and application managed color-space related
30information.
31
32In Vulkan, a <<video-picture-resources,Video Picture Resource>> is
33represented by a slink:VkImage.
34The slink:VkImageView, representing the slink:VkImage, is used with the
35decode operations as <<decoded-output-picture,Output>> and <<dpb,Decoded
36Picture Buffer (DPB)>>, and with the encode operation as
37<<input-encode-picture,Input>> and <<reconstructed-pictures, Reconstructed>>
38<<video-picture-resources,Video Picture Resource>>.
39
40
41[[reference-picture]]
42=== Reference Picture
43
44Video *Reference Picture* is a <<video-picture-resources,Video Picture
45Resource>> that can: be used in the video decode or encode process to
46provide predictions of the values of samples in the subsequently decoded or
47encoded pictures.
48
49
50[[decoded-output-picture]]
51=== Decoded Output Picture
52
53The pixels resulting from the video decoding process are stored in a
54*Decoded Output Picture*, represented by a slink:VkImageView.
55This can: be shared with the <<dpb, Encoder Reconstructed or Decoder DPB>>
56<<video-picture-resources,Video Picture Resources>>.
57It can: also be used as an input for Video Encode, Graphics, Compute
58processing, or WSI presentation.
59
60
61[[input-encode-picture]]
62=== Input Picture to Encode
63
64The primary source of input pixels for the video encoding process is the
65*Input Picture to Encode*, represented by a slink:VkImageView.
66This can: be shared with the <<dpb, Encoder Reconstructed or Decoder DPB>>
67<<video-picture-resources,Video Picture Resources>>.
68It can: be a direct target of Video Decode, Graphics, Compute processing, or
69WSI presentation.
70
71
72[[dpb]]
73=== Decoded Picture Buffer (DPB)
74
75Previously decoded pictures are used by video codecs to provide predictions
76of the values of samples in the subsequently decoded pictures.
77At the decoder, such <<video-picture-resources,Video Picture Resources>> are
78stored in a *Decoded Picture Buffer (DPB)* as an indexed set of
79<<reference-picture,Reference Pictures>>.
80
81
82[[reconstructed-pictures]]
83=== Reconstructed Pictures
84
85An integral part of the video decoding pipeline is the reconstruction of
86pictures from the compressed stream.
87A similar stage exists in the video encoding pipeline as well.
88Such reconstructed pictures may: be used as <<reference-picture,Reference
89Pictures>> for subsequently decoded or encoded pictures.
90The correct use of such <<reference-picture,Reference Pictures>> is driven
91by the video compression standard, the implementation, and the
92application-specific use cases.
93
94This specification refers to the collection of the *Decoded Picture Buffer*
95and *Reconstructed Pictures* as <<dpb, Decoded Picture Buffer (DPB) Set>>,
96or only, *DPB*.
97
98
99[[dpb-slot]]
100=== Decoded Picture Buffer (DPB) Slot
101
102*Decoded Picture Buffer (DPB) Slot* represents a single or multi-layer
103indexed <<reference-picture,Reference Picture's>> entry within the
104<<video-session, Video Session's>> <<dpb,DPB Set>>.
105A valid <<dpb-slot,DPB Slot>> index starts from zero and goes up to the
106maximum of *N* - 1, where *N* is the number of <<reference-picture,Reference
107Picture>> entries requested for a <<video-session, Video Session>>.
108
109
110[[reference-metadata]]
111=== Reference Picture Metadata
112
113The opaque <<dpb-slot,DPB Slot>> state managed by the implementation may:
114contain *Reference Picture Metadata*, present when the
115<<video-picture-resources,picture resource>> associated with the
116<<dpb-slot,DPB Slot>> is used as a <<reference-picture,reference picture>>
117in one or more video decode or encode operations.
118
119An implementation or application may: have other Picture Metadata related to
120the Video Picture Resource or the DPB Slot, but such data is outside the
121scope of this specification.
122
123[NOTE]
124.Note:
125====
126The video decode or encode implementation does not maintain internal
127references to the <<reference-picture,Reference Pictures>>, beyond the
128<<reference-metadata,Reference Picture Metadata>>.
129It is the responsibility of the Vulkan Application to create, manage, and
130destroy, as well as to provide those Video Picture Resources, when required,
131during the decoding or encoding process.
132====
133
134
135[[color-space-metadata]]
136=== Color Space Metadata
137
138*Color Space Metadata* is the additional static or dynamic state associated
139with a <<video-picture-resources,Video Picture Resource>> specifying the
140color volume (the color primaries, white point, and luminance range) of the
141display that was used in mastering the video content.
142The use of *Color Space Metadata* is outside the scope of the current
143version of the video core specification.
144
145
146== Introduction
147
148This chapter discusses extensions supporting Video Decode or Encode
149operations.
150Video Decode and Encode operations are supported by queues with an
151advertised queue capability of ename:VK_QUEUE_VIDEO_DECODE_BIT_KHR and
152ename:VK_QUEUE_VIDEO_ENCODE_BIT_KHR, respectively.
153Video Decode or Encode queue operation support allows for Vulkan
154applications to cooperate closely with other graphics or compute operations
155seamlessly and efficiently, therefore improving the overall application
156performance.
157
158
159[[video-decode-queue]]
160=== Video Decode Queue
161
162`apiext:VK_KHR_video_decode_queue` adds a video decode queue type bit
163ename:VK_QUEUE_VIDEO_DECODE_BIT_KHR to elink:VkQueueFlagBits.
164As in the case of other queue types, an application must: use
165flink:vkGetPhysicalDeviceQueueFamilyProperties to query whether the physical
166device has support for the Video Decode Queue.
167When the implementation reports the ename:VK_QUEUE_VIDEO_DECODE_BIT_KHR bit
168for a queue family, it advertises general support for Vulkan queue
169operations described in <<devsandqueues, Devices and Queues>>.
170
171
172[[video-encode-queue]]
173=== Video Encode Queue
174
175`apiext:VK_KHR_video_encode_queue` adds a video encode queue type bit
176ename:VK_QUEUE_VIDEO_ENCODE_BIT_KHR to elink:VkQueueFlagBits.
177As in the case of other queue types, an application must: use
178flink:vkGetPhysicalDeviceQueueFamilyProperties to query whether the physical
179device has support for the Video Encode Queue.
180When the implementation reports the ename:VK_QUEUE_VIDEO_ENCODE_BIT_KHR bit
181for a queue family, it advertises general support for Vulkan queue
182operations described in <<devsandqueues, Devices and Queues>>.
183
184The rest of the chapter focuses, specifically, on Video Decode and Encode
185queue operations.
186
187
188[[video-session-introduction]]
189=== Video Session
190
191Before performing any video decoding or encoding operations, the application
192must: create a <<video-session,Video Session>> instance, of type
193slink:VkVideoSessionKHR.
194A <<video-session,Video Session>> instance is an immutable object and
195supports a single compression standard (for example, H.264, H.265, VP9, AV1,
196etc.).
197The implementation uses the slink:VkVideoSessionKHR object to maintain the
198video state for the video decode or video encode operation.
199A <<video-session,Video Session>> instance is created specifically:
200
201  * For a particular video compression standard;
202  * For video decoding or video encoding;
203  * With maximum supported decoded or encoded picture width/height;
204  * With the maximum number of supported <<dpb,DPB>> or
205    <<reconstructed-pictures,Reconstructed Pictures>> slots that can be
206    allocated;
207  * With the maximum number of <<reference-picture,Reference Pictures>> that
208    can: be used simultaneously for video decode or encode operations;
209  * Codec color and features profile;
210  * Color Space format description (not supported with this version of the
211    specification);
212
213slink:VkVideoSessionKHR represents a single video decode or encode stream.
214For each concurrently used stream, a separate instance of
215slink:VkVideoSessionKHR is required.
216After the application has finished with the processing of a stream, it can
217reuse the <<video-session,Video Session>> instance for another, provided
218that the configuration parameters between the two usages are compatible (as
219determined by the video compression standard in use).
220Once the slink:VkVideoSessionKHR instance has been created, the video
221compression standard and profiles, <<input-encode-picture,Input>> /
222<<decoded-output-picture,Output>> / <<dpb,DPB>> formats, and the settings
223like the maximum extent cannot: be changed.
224
225The values of the following slink:VkVideoSessionKHR parameters can: be
226updated each frame, subject to the restrictions imposed on parameter updates
227by the video compression standard in use:
228
229  * decoded or encoded picture size
230  * number of active <<dpb,DPB>> or <<reconstructed-pictures,Reconstructed
231    Picture>> slots
232  * number of <<reference-picture,Reference Pictures>> in use,
233  * color space and color space metadata
234  * color space metadata.
235
236The updated parameters must: not exceed the maximum limits specified when
237creating the slink:VkVideoSessionKHR instance.
238
239
240[[video-session-device-memory-heaps]]
241=== Video Session Device Memory Heaps
242
243After creating a <<video-session,Video Session>> instance, and before the
244object can be used for any of the decode or encode operations, the
245application must: allocate and bind device memory resources to the Video
246Session object.
247An implementation may: require one or more device memory heaps of different
248memory types, as reported by the
249flink:vkGetVideoSessionMemoryRequirementsKHR function, to be bound with the
250flink:vkBindVideoSessionMemoryKHR function to the <<video-session,Video
251Session>>, For more information about the *Video Session Device Memory*,
252please refer to the <<binding-session-memory, Binding the Session Object
253Device Memory>> section, below.
254
255
256[[video-session-parameters-introduction]]
257=== Video Session Parameters
258
259A lot of codec standards require parameters that are in use for the entire
260video stream.
261For example, H.264/AVC and HEVC standards require sequence and picture
262parameter sets (SPS and PPS) that apply to multiple Video Decode and Encode
263frames, layers, and sub-layers.
264Vulkan Video uses <<video-session-parameters,Video Session Parameters>>
265objects to store such standard parameters.
266The application creates one or more <<video-session-parameters,Video Session
267Parameters>> Objects against a <<video-session,Video Session>>, with a set
268of common Video Parameters that are required for the processing of the video
269content.
270During the object creation, the implementation stores the parameters to the
271created instance.
272During command buffer recording, it is the responsibility of the application
273to provide the <<video-session-parameters,Video Session Parameters>> object
274containing the parameters that are necessary for the processing the portion
275of the stream under consideration.
276
277
278[[video-picture-subresources]]
279=== Video Picture Subresources
280
281For <<video-picture-resources,Video Picture Resources>>, an application has
282the option to use single or multi-layer <<VkImage,images>> for
283<<resources-image-views,image views>>.
284The layer to be used during decode or encode operations can: be specified
285when the <<VkImageView,image view>> is being created with the
286slink:VkImageSubresourceRange::pname:baseArrayLayer parameter, and/or within
287the resource binding operations in command buffer by using the
288slink:VkVideoPictureResourceKHR::pname:baseArrayLayer parameter.
289
290[NOTE]
291.Note:
292====
293Both Video Decode and Encode operations only work with a single layer at the
294time.
295====
296
297The <<resources-image-views, Image views>> representing the
298<<input-encode-picture,Input>> / <<decoded-output-picture,Output>> /
299<<dpb,DPB>> <<video-picture-resources,Video Picture Resources>> could have
300been created with sizes bigger than the coded size that is used with Video
301Decode and Encode operations.
302This allows for the same Video Picture Resources to be reused when there is
303a change in the input video content resolution.
304The effective coded size of the <<video-picture-resources,Video Picture
305Resources>> used for Video Decode and Encode operations is provided with
306slink:VkVideoPictureResourceKHR::pname:extent parameter of each resource in
307use.
308
309[NOTE]
310.Note:
311====
312Many codec standards require the coded and <<video-picture-resources,Video
313Picture Resources'>> sizes to match.
314====
315
316
317[[dpb-picture-resources]]
318==== Video Session <<dpb,DPB and Reconstructed>> Video Picture Resources
319
320The video compression standard chosen may: require the use of
321<<reference-picture,Reference Pictures>>.
322In Vulkan Video, like any other <<video-picture-resources,Video Picture
323Resources>>, the <<reference-picture,Reference Pictures>> are represented
324with <<resources-image-views, Image Views>>.
325
326When an application requires <<reference-picture,Reference Picture
327Resources>>, it creates and then associates <<VkImageView,image views>>,
328representing these resources, with Video Session <<dpb-slot,DPB or
329Reconstructed slots>> while recording the command buffer.
330
331<<decoded-output-picture, Decoded output pictures>> may: be used as
332<<reference-picture,reference pictures>> in future video decode operations.
333The same pictures may: be used in texture sampling operations or in the
334(WSI) presentation pipeline.
335Representing the <<dpb-slot,DPB's Video Picture Resources>> by
336<<VkImageView,image views>> makes it possible to accommodate all these use
337cases in a "`zero-copy`" fashion.
338Also, it provides more fine-grained control of the application over the
339efficient usage of the DPB and Reconstructed <<VkDeviceMemory,Device Memory
340Resources>>.
341
342
343[[video-session-dpb-slot-resource-management]]
344==== Video Session <<dpb-slot,DPB and Reconstructed Slot>> Resource Management
345
346Before <<dpb-picture-resources, Video Picture Resources>> can be used as
347<<reference-picture,Reference Picture Resources>>, Video Session
348<<dpb-slot,DPB or Reconstructed Slots>> must: be associated with those
349resources.
350
351The application allocates a <<dpb-slot,DPB or Reconstructed Slot>> and
352associates it with a <<video-picture-resources,Video Picture Resource>> and
353then sets up the resource as a target of decode or encode operation.
354After successfully decoding or encoding a picture with the targeted
355<<dpb-slot,DPB or Reconstructed Slot>> , in addition to the
356<<reference-picture,Reference Picture>> pixel data, the implementation may:
357generate an opaque <<reference-metadata,Reference Picture Metadata>> for
358that video session Slot and its associated <<video-picture-resources,Video
359Picture Resource>>.
360
361Subsequently, one or more <<dpb-slot,DPB or Reconstructed video session
362Slots>>, along with their associated <<video-picture-resources,Video Picture
363Resources>>, can: be used as <<reference-picture,Reference Picture's>>
364source for the video decode or encode operations.
365
366If <<reference-picture,Reference Pictures>> were to be required for decoding
367or encoding of the video bitstream, the
368slink:VkVideoSessionCreateInfoKHR::pname:maxReferencePicturesSlotsCount
369must: be set to a value bigger than `0` when the instance of the
370<<video-session,Video Session>> object is created.
371
372Up to
373slink:VkVideoSessionCreateInfoKHR::pname:maxReferencePicturesSlotsCount
374slots can: be activated with <<video-picture-resources,Video Picture
375Resources>> for a video session and up to
376slink:VkVideoSessionCreateInfoKHR::pname:maxReferencePicturesActiveCount
377active slots can: be used as DPB or Reconstructed
378<<reference-picture,Reference Pictures>> within a single decode or encode
379operation.
380
381When the implementation is associating <<reference-metadata,Reference
382Picture Metadata>> with the <<video-picture-resources,Video Picture
383Resources>> themselves, such data must: be independent of the
384<<video-session,Video Session>> to allow for those
385<<video-picture-resources,Video Picture Resources>> to be shared with other
386Video Session instances.
387All of the <<video-session,Video Session>>-dependent
388<<reference-metadata,Reference Picture Metadata>> must: only be associated
389with the <<video-session,Video Session>> <<dpb-slot,DPB or Reconstructed
390Slots>>.
391
392The application with the help of the implementation is responsible for
393managing the individual <<dpb-slot,DPB, or Reconstructed Slots>> that belong
394to a single <<video-session,Video Session>> <<dpb,DPB set>>:
395
396  * The application maintains the Slot allocation and per-slot
397    <<reference-picture,Reference Picture>>
398    <<video-picture-resources,Resources>>;
399  * Implementation maintains global and per-slot opaque
400    <<reference-metadata,Reference Picture Metadata>>;
401
402The application also manages the mapping between the codec-specific picture
403IDs and <<dpb-slot,DPB Slots>>.
404
405When a Video Picture is decoded and is set as a
406<<reference-picture,Reference Picture>> against a Video Session
407<<dpb-slot,DPB Slot>>, or is encoded and a Reconstructed Video Picture
408Resource is associated with a Video Session <<dpb-slot,DPB Slot>> then:
409
410  * The <<video-picture-resources,Video Picture Resource>> associated with
411    the Slot is filled with the decoded or reconstructed pixel data;
412  * The implementation generates the <<dpb-slot,DPB Slot's>>
413    <<reference-metadata,Reference Picture Metadata>>;
414
415When a <<dpb-slot,DPB's Slot>> is deactivated, or a different
416<<video-picture-resources,Video Picture Resource>> is used with the Slot, or
417the content of the <<video-picture-resources,Video Picture Resource>> is
418modified, the <<reference-metadata,Reference Picture Metadata>> associated
419with the <<dpb-slot,DPB Slot>> gets invalidated by the implementation.
420Subsequent attempts to use such, invalidated, <<dpb,DPB>> Slot as a
421<<reference-picture,Reference>> source would produce undefined: results.
422
423
424[[video-session-dpb-picture-size-changes]]
425==== Video Session <<dpb-slot,DPB Slot>> subresources
426
427DPB <<reference-picture,Reference Picture's>> coded width and height can:
428change, dynamically, via slink:VkVideoPictureResourceKHR::pname:extent, and
429the picture parameters from the codec-specific extensions.
430When a <<dpb-slot,DPB Slot>> is activated as a <<reference-picture,Reference
431Picture>> and a decode or encode operation is performed against that slot,
432the coded extent can: be recorded by the implementation to the corresponding
433<<dpb-slot,DPB Slot's>> metadata state.
434Subsequently, when the <<reference-picture,Reference Pictures>> are used
435with the decoded <<decoded-output-picture, Output>> or encoded
436<<input-encode-picture, Input Picture>>, their coded extent can differ.
437Decoding or encoding pictures, using picture sizes, different from the
438previously produced <<reference-picture,Reference Pictures>> should: be used
439with care, not to conflict with the codec standard and the implementation's
440support for that.
441It is the responsibility of the application to ensure that valid <<dpb,DPB
442Set>> of <<reference-picture,Reference Pictures>> are in use, according to
443the codec standard.
444
445In addition, the <<video-picture-resources,Video Picture Resources>> extent
446cannot: exceed the slink:VkVideoSessionCreateInfoKHR::pname:maxCodedExtent.
447
448[NOTE]
449.Note:
450====
451Coding Standards such as VP9 and AV1 allow for images with different sizes
452to be used as <<reference-picture,Reference Pictures>>.
453Others, like H.264 and H.265, do not support <<reference-picture,Reference
454Pictures>> with different sizes.
455Using <<reference-picture,Reference Pictures>> with incompatible sizes with
456such standards would render undefined: results.
457====
458
459
460[[video-resource-management-by-application]]
461==== The application is in control of the allocation and use of the system resource
462
463In Vulkan Video, the application has complete control over how and when
464system resources are used.
465The Vulkan Video framework provides the following tools to ensure that
466device and host memory resources are used in an optimal way:
467
468  * The video application can: allocate or destroy the number of allocated
469    <<decoded-output-picture, Output>> or <<input-encode-picture, Input>>
470    Pictures, and can: grow, or shrink the DPB set of
471    <<reference-picture,Reference Pictures>>, dynamically, based on the
472    changing video content requirement.
473  * <<reference-picture,Reference Pictures>> can: be shared with the decoded
474    <<decoded-output-picture, Output>> or encoded <<input-encode-picture,
475    Input>> pictures.
476  * The application can: use <<sparsememory, sparse memory>> for the
477    <<VkImage,images>>, representing <<video-picture-resources,Video Picture
478    Resources>>.
479    The use of sparse memory would allow the application to remove the
480    <<VkDeviceMemory,Device Memory>> backing of the <<resources-images,
481    image resources>> when the <<dpb-slot,DPB Slot>> is not in active use.
482    Furthermore, if the <<features-sparseResidency,sparse residency
483    feature>> is supported by the implementation (see <<sparsememory,Sparse
484    Resources>>), then <<VkImage,images>> can be, partially, bound with the
485    resource memory.
486    This feature is particularly important when using video content with a
487    significant change of decoded or encoded resolution.
488  * If the implementation supports <<VkImage,image arrays>>, and
489    <<sparsememory, sparse memory resources>>, then the application can:
490    remove the <<VkDeviceMemory,Device Memory>> backing of <<VkImage,image
491    array>> layers that are not used by any <<dpb-slot,DPB Slots>>.
492
493
494[[video-session-dpb-binding-reconstructed-slot]]
495==== Using DPB and Reconstructed Slot's Associated Resources
496
497Before a <<dpb-slot,DPB Slot>> is to become *Valid* for use with a
498<<reference-picture,Reference Picture>>, it requires memory resources to be
499bound to it.
500
501Some of the memory resources required for the <<dpb-slot,DPB Slot>>, are
502opaquely managed by the implementation and, internally, allocated from the
503<<video-session-device-memory-heaps,Session's Device Memory Heaps>>.
504The application provides the <<resources-images, image resources>> of one or
505more <<reference-picture,Reference Pictures>>, in the
506slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots as part of the
507flink:vkCmdBeginVideoCodingKHR command.
508
509If a <<dpb-slot,DPB Slot>> was already used with an <<resources-image-views,
510image view>>, and a new image view or a dlink:VK_NULL_HANDLE handle is used
511with that Slot, then the <<dpb-slot,DPB Slot's>> state will be invalidated
512by the implementation.
513If a <<dpb-slot,DPB Slot>> were to be reused with the same
514<<resources-image-views, image view>>, the state of the Slot would not
515change.
516
517
518[[video-session-activating-dpb-slot]]
519==== Video Session Activating DPB Slot as a Reference
520
521Before a <<dpb-slot,DPB Slot>> is to be used for a
522<<reference-picture,Reference Pictures>> index, it must: be activated.
523The activation of a <<dpb-slot,DPB Slot>> is done within the
524flink:vkCmdDecodeVideoKHR command's
525slink:VkVideoDecodeInfoKHR::pname:slotIndex field for the decode operations,
526and within the flink:vkCmdEncodeVideoKHR command's
527slink:VkVideoEncodeInfoKHR::pname:slotIndex field for the encode operations.
528
529While activating a Slot for DPB, it must: already have an associated
530<<resources-image-views, image view>>, within the
531slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots in the
532flink:vkCmdBeginVideoCodingKHR command and <<VkDeviceMemory,Device Memory>>
533backing of the the <<resources-images, image resources>> must: be resident.
534
535When a <<dpb-slot,DPB Slot>> were to be activated, the
536slink:VkVideoDecodeInfoKHR::pname:slotIndex for decode, or
537slink:VkVideoDecodeInfoKHR::pname:slotIndex for encode, must: be set to the
538application's allocated <<dpb-slot,DPB Slot's index>>.
539When activating a <<dpb-slot,DPB Slot>>, the application will perform a
540decode or encode operation against its Slot's index in order to enable its
541state as a *Valid Picture Reference*.
542If a <<dpb-slot,DPB Slot>> is activated, but a decode or encode operation is
543not performed against that Slot's index, or the decode or encode operation
544was unsuccessful, then the <<dpb-slot,DPB Slot>> would remain in the
545*Invalid Picture Reference* state (see below the
546<<video-session-dpb-slot-states,DPB Slot States>>).
547
548By just providing a <<video-picture-resources,Video Picture Resources>> for
549a <<dpb-slot,DPB Slot>> within the
550slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots, and without
551successfully performing a decode or encode operation against that Slot, the
552<<dpb-slot,DPB Slot's>> state cannot: be changed to *Valid Picture
553Reference*.
554If the <<dpb-slot,DPB Slots>> were already in *Valid Picture Reference*, and
555there is no <<video-picture-resources,Video Picture Resources>> associated
556with the <<dpb-slot,DPB Slot>> for a decode or encode operation, the state
557<<dpb-slot,DPB Slot>> would not change.
558However, if an application is referring to a valid <<dpb-slot,DPB Slot>> in
559its current decode or encode operations, then a valid
560<<resources-image-views, image view>> must: be provided for that Slot within
561slink:VkVideoPictureResourceKHR::pname:imageViewBinding for that decode or
562encode operation.
563
564
565[[video-session-invalidating-dpb-slot]]
566==== Video Session Invalidating DPB Slot's Reference State
567
568When a <<dpb-slot,DPB Slot>> is invalidated, its state is set to *Invalid
569Picture Reference*.
570Using a <<dpb-slot,DPB Slot>> as a <<reference-picture,Reference Picture>>
571index for video decode or encode operations while the Slot is in *Invalid
572Picture Reference* state would render undefined: results.
573
574
575[[video-session-dpb-slot-states]]
576==== Video Session <<dpb,DPB>> Slot States
577
578To help understand the valid use of the <<video-session,Video Session>>
579<<dpb,DPB>> and its resource management, this section aims to explain the
580different states and correct usage of <<dpb-slot,DPB Slots>>.
581
582There are four (4) states that a <<dpb-slot,DPB Slot>> could be in:
583
584  * Picture Reference Unused;
585  * Invalid Picture Reference;
586  * Updating Picture Reference;
587  * Valid Picture Reference;
588
589The different states are outlined within the
590<<video-session-dpb-slot-states-table,DPB Slot States>> and
591<<video-session-dpb-slot-states-flow-diagram, DPB Slot States Flow Diagram>>
592below.
593
594All DPB Slot management operations are performed via the
595slink:VkVideoDecodeInfoKHR::pname:slotIndex or
596slink:VkVideoEncodeInfoKHR::pname:slotIndex field.
597
598All DPB resource binding, invalidating, and activating Slot management
599operations are performed, by the implementation, *before* the decoding or
600encoding commands, based on the slink:VkVideoDecodeInfoKHR::pname:slotIndex
601or slink:VkVideoEncodeInfoKHR::pname:slotIndex field and the entries from
602the slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots.
603The application cannot: move a DPB Slot from a *Picture Reference Unused* to
604*Updating Picture Reference* state, implicitly, within a decode or encode
605command operation.
606Such a DPB Slot must: first be transitioned to an *Invalid Picture
607Reference* state using slink:VkVideoDecodeInfoKHR::pname:slotIndex or
608slink:VkVideoEncodeInfoKHR::pname:slotIndex, as part of a decode command.
609For more details, see <<video-picture-decode-modes, Video Picture Decode
610Modes>>.
611
612When using <<sparsememory, sparse memory resources>>, it would be acceptable
613and valid behavior for the application to unbind the memory while the DPB
614Slot is any of the DPB Slot states, provided the command buffers, in a
615<<commandbuffers-lifecycle, pending state>>, do not reference any such
616<<video-picture-resources,Video Picture Resources>>.
617
618Accessing <<sparsememory-accessing-unbound, unbound regions>> of the
619<<sparsememory, sparse memory resources>> by the decoder or encoder,
620regardless if those are used as <<decoded-output-picture,Output>>,
621<<input-encode-picture,Input>>, <<dpb,DPB>> or
622<<reconstructed-pictures,Reconstructed>> <<video-picture-resources,Video
623Picture Resources>>, would render undefined: results.
624The slink:VkPhysicalDeviceSparseProperties::pname:residencyNonResidentStrict
625property reported by the implementation does not offer guarantees on the
626behavior of decode or encode operations when it comes to accessing
627<<sparsememory-accessing-unbound, unbound regions>>.
628However, both reads and writes are still considered safe and will not affect
629other resources or populated regions of the image.
630
631[[video-session-dpb-slot-states-table]]
632.Video Session <<dpb-slot,DPB Slot>> States
633[cols="10%h,30%,50%,10%",options="header"]
634|====
635| <<dpb-slot,DPB Slot>> State | Moving to <<dpb-slot,DPB Slot>> State | Exiting <<dpb-slot,DPB Slot>> State | Retain Video Picture Resource Memory
636
637| *Picture Reference Unused* |
638* Bind Device Memory; +
639* Reset decode or encode state; +
640* Invalidate, delete or unbind memory of a Picture Reference associated with Reference DPB Slot |
641* Activate Reference DPB Slot -> *Invalid Picture Reference* |
642Application Controlled
643
644| *Invalid Picture Reference* |
645* Activate Reference DPB Slot; +
646* Unsuccessful video decode or encode operation; |
647* Start decode or encode operation with an active Reference DPB Slot target -> *Updating Picture Reference*; +
648* Updating a Picture Resource outside the decoder or encoder or deleting or removing the memory binding(sparse) -> *Picture Reference Unused*; |
649Application Controlled
650
651| *Updating Picture Reference* |
652Start decode or encode operation with an active Reference DPB Slot target; |
653Decode or encode operation with an active Reference DPB Slot target Completed Successfully -> *Valid Picture Reference*; +
654Unsuccessful video decode or encode operation -> *Invalid Picture Reference* |
655Yes
656
657| *Valid Picture Reference* |
658Video decode or encode operation with an active Reference DPB Slot target Completed Successfully; |
659* Replace Reference DPB Slot -> *Invalid Picture Reference*; +
660* Invalidate, delete or unbind memory of a Picture Reference of the Reference DPB Slot -> *Picture Reference Unused*; |
661Yes
662|====
663
664[[video-session-dpb-slot-states-flow-diagram]]
665image::images/VideoDecodeSessionDpbStates.svg[align="center",title="DPB Slot States Flow Diagram",opts="{imageopts}"]
666
667
668[[video-physical-device-capabilities]]
669== Video Physical Device Capabilities
670
671
672[[supported-video-codec-operations-enumeration]]
673=== Supported Video Codec Operations Enumeration
674
675The structure slink:VkVideoQueueFamilyProperties2KHR may: be chained to
676slink:VkQueueFamilyProperties2 when calling
677flink:vkGetPhysicalDeviceQueueFamilyProperties2 to retrieve the video codec
678operations supported for the physical device queue family index.
679
680[open,refpage='VkVideoQueueFamilyProperties2KHR',desc='Structure specifying the codec video operations',type='structs']
681--
682The slink:VkVideoQueueFamilyProperties2KHR structure is defined as:
683
684include::{generated}/api/structs/VkVideoQueueFamilyProperties2KHR.txt[]
685
686  * pname:sType is the type of this structure.
687  * pname:pNext is `NULL` or a pointer to a structure extending this
688    structure.
689  * pname:videoCodecOperations is a bitmask of
690    elink:VkVideoCodecOperationFlagBitsKHR specifying supported video codec
691    operation(s).
692
693include::{generated}/validity/structs/VkVideoQueueFamilyProperties2KHR.txt[]
694--
695
696[open,refpage='VkVideoCodecOperationFlagBitsKHR',desc='Video codec operation types',type='enums']
697--
698The codec operations are defined with the
699elink:VkVideoCodecOperationFlagBitsKHR enum:
700
701include::{generated}/api/enums/VkVideoCodecOperationFlagBitsKHR.txt[]
702
703Each decode or encode codec-specific extension extends this enumeration with
704the appropriate bit corresponding to the extension's codec operation:
705
706  * ename:VK_VIDEO_CODEC_OPERATION_INVALID_BIT_KHR - No video operations are
707    supported for this queue family.
708ifdef::VK_EXT_video_encode_h264[]
709  * ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT - H.264 video encode
710    operations are supported by this queue family.
711endif::VK_EXT_video_encode_h264[]
712ifdef::VK_EXT_video_decode_h264[]
713  * ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT - H.264 video decode
714    operations are supported by this queue family.
715endif::VK_EXT_video_decode_h264[]
716ifdef::VK_EXT_video_decode_h265[]
717  * ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_EXT - H.265 video decode
718    operations are supported by this queue family.
719endif::VK_EXT_video_decode_h265[]
720--
721
722[open,refpage='VkVideoCodecOperationFlagsKHR',desc='Bitmask specifying the Video codec operations supported',type='flags']
723--
724include::{generated}/api/flags/VkVideoCodecOperationFlagsKHR.txt[]
725
726tlink:VkVideoCodecOperationFlagsKHR is a bitmask type for setting a mask of
727zero or more elink:VkVideoCodecOperationFlagBitsKHR.
728--
729
730
731[[video-profiles]]
732=== Video Profiles
733
734[open,refpage='VkVideoProfileKHR',desc='Structure specifying the codec video profile',type='structs']
735--
736A video profile is defined by slink:VkVideoProfileKHR structure as:
737
738include::{generated}/api/structs/VkVideoProfileKHR.txt[]
739
740  * pname:sType is the type of this structure.
741  * pname:pNext is `NULL` or a pointer to a structure extending this
742    structure.
743  * pname:videoCodecOperation is a elink:VkVideoCodecOperationFlagBitsKHR
744    value specifying a video codec operation.
745  * pname:chromaSubsampling is a bitmask of
746    elink:VkVideoChromaSubsamplingFlagBitsKHR specifying video chroma
747    subsampling information.
748  * pname:lumaBitDepth is a bitmask of
749    elink:VkVideoComponentBitDepthFlagBitsKHR specifying video luma bit
750    depth information.
751  * pname:chromaBitDepth is a bitmask of
752    elink:VkVideoComponentBitDepthFlagBitsKHR specifying video chroma bit
753    depth information.
754
755include::{generated}/validity/structs/VkVideoProfileKHR.txt[]
756--
757
758[open,refpage='VkVideoChromaSubsamplingFlagBitsKHR',desc='Video chroma subsampling',type='enums']
759--
760The video format chroma subsampling is defined with the following enums:
761
762include::{generated}/api/enums/VkVideoChromaSubsamplingFlagBitsKHR.txt[]
763
764  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR - the format is
765    monochrome.
766  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR - the format is 4:2:0
767    chroma subsampled.
768    The two chroma components are each subsampled at a factor of 2 both
769    horizontally and vertically.
770  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR - the format is 4:2:2
771    chroma subsampled.
772    The two chroma components are sampled at half the sample rate of luma.
773    The horizontal chroma resolution is halved.
774  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR - the format is 4:4:4
775    chroma sampled.
776    Each of the three YCbCr components have the same sample rate, thus there
777    is no chroma subsampling.
778--
779
780[open,refpage='VkVideoChromaSubsamplingFlagsKHR',desc='Bitmask specifying the Video format chroma subsampling',type='flags']
781--
782include::{generated}/api/flags/VkVideoChromaSubsamplingFlagsKHR.txt[]
783
784tlink:VkVideoChromaSubsamplingFlagsKHR is a bitmask type for setting a mask
785of zero or more elink:VkVideoChromaSubsamplingFlagBitsKHR.
786--
787
788[open,refpage='VkVideoComponentBitDepthFlagBitsKHR',desc='Video component bit depth',type='enums']
789--
790The video format component bit depth is defined with the following enums:
791
792include::{generated}/api/enums/VkVideoComponentBitDepthFlagBitsKHR.txt[]
793
794  * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR - the format component bit
795    depth is 8 bits.
796  * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR - the format component bit
797    depth is 10 bits.
798  * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR - the format component bit
799    depth is 12 bits.
800--
801
802[open,refpage='VkVideoComponentBitDepthFlagsKHR',desc='Bitmask specifying the Video format component bit depth',type='flags']
803--
804include::{generated}/api/flags/VkVideoComponentBitDepthFlagsKHR.txt[]
805
806tlink:VkVideoComponentBitDepthFlagsKHR is a bitmask type for setting a mask
807of zero or more elink:VkVideoComponentBitDepthFlagBitsKHR.
808--
809
810A video profile is provided when querying capabilities or image formats for
811video using flink:vkGetPhysicalDeviceVideoCapabilitiesKHR or
812flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR, respectively.
813A video profile is also provided when creating resources (images, video
814sessions, etc.) used by video queues.
815Each instance of slink:VkVideoProfileKHR must: chain a codec-operation
816specific video profile extension structure, corresponding to the
817codec-operation specified in
818slink:VkVideoProfileKHR::pname:videoCodecOperation.
819Additional information is provided in each codec-operation-specific video
820extension.
821
822
823[[supported-video-decode-or-encode-capabilities]]
824=== Supported Video Decode or Encode Capabilities
825
826[open,refpage='vkGetPhysicalDeviceVideoCapabilitiesKHR',desc='Query video decode or encode capabilities',type='protos']
827--
828To query video decode or encode capabilities for a specific codec, call:
829
830include::{generated}/api/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.txt[]
831
832  * pname:physicalDevice is the physical device whose video decode or encode
833    capabilities will be queried.
834  * pname:pVideoProfile is a pointer to a slink:VkVideoProfileKHR structure
835    with a chained codec-operation specific video profile structure.
836  * pname:pCapabilities is a pointer to a slink:VkVideoCapabilitiesKHR
837    structure in which the capabilities are returned.
838
839include::{generated}/validity/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.txt[]
840--
841
842If pname:pVideoProfile and chained codec-operation specific profile is not
843supported, ename:VK_ERROR_FORMAT_NOT_SUPPORTED is returned.
844
845Otherwise, the implementation will fill pname:pCapabilities with
846capabilities associated with this video profile.
847
848
849[open,refpage='VkVideoCapabilitiesKHR',desc='Structure specifying parameters of video capabilities',type='structs']
850--
851The slink:VkVideoCapabilitiesKHR structure is defined as:
852
853include::{generated}/api/structs/VkVideoCapabilitiesKHR.txt[]
854
855  * pname:sType is the type of this structure.
856  * pname:pNext is `NULL` or a pointer to a structure extending this
857    structure.
858  * pname:capabilityFlags is a bitmask of elink:VkVideoCapabilityFlagBitsKHR
859    specifying capability flags.
860  * pname:minBitstreamBufferOffsetAlignment is the minimum alignment for the
861    input or output bitstream buffer offset.
862  * pname:minBitstreamBufferSizeAlignment is the minimum alignment for the
863    input or output bitstream buffer size
864  * pname:videoPictureExtentGranularity is the minimum size alignment of the
865    extent with the required padding for the decoded or encoded video
866    images.
867  * pname:minExtent is the minimum width and height of the decoded or
868    encoded video.
869  * pname:maxExtent is the maximum width and height of the decoded or
870    encoded video.
871  * pname:maxReferencePicturesSlotsCount is the maximum number of DPB Slots
872    supported by the implementation for a single video session instance.
873  * pname:maxReferencePicturesActiveCount is the maximum slots that can be
874    used as <<reference-picture,Reference Pictures>> with a single decode or
875    encode operation.
876
877include::{generated}/validity/structs/VkVideoCapabilitiesKHR.txt[]
878--
879
880[open,refpage='VkVideoCapabilityFlagBitsKHR',desc='Video Decode and Encode Capability Flags',type='enums']
881--
882The slink:VkVideoCapabilitiesKHR flags are defined with the following
883enumeration:
884
885include::{generated}/api/enums/VkVideoCapabilityFlagBitsKHR.txt[]
886
887  * ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR - the decode or
888    encode session supports protected content.
889  * ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR - the DPB or
890    Reconstructed Video Picture Resources for the video session may: be
891    created as a separate slink:VkImage for each DPB picture.
892    If not supported, the DPB must: be created as single multi-layered image
893    where each layer represents one of the DPB Video Picture Resources.
894--
895
896[open,refpage='VkVideoCapabilityFlagsKHR',desc='Bitmask specifying the Video Decode and Encode Capability Flags',type='flags']
897--
898include::{generated}/api/flags/VkVideoCapabilityFlagsKHR.txt[]
899
900tlink:VkVideoCapabilityFlagsKHR is a bitmask type for setting a mask of zero
901or more elink:VkVideoCapabilityFlagBitsKHR.
902--
903
904
905[[supported-video-input-output-dpb-formats-enumeration]]
906=== Enumeration of Supported Video Output, Input and DPB Formats
907
908[open,refpage='vkGetPhysicalDeviceVideoFormatPropertiesKHR',desc='Query supported Video Decode and Encode image formats',type='protos']
909--
910To enumerate the supported output, input and DPB image formats for a
911specific codec operation and video profile, call:
912
913include::{generated}/api/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.txt[]
914
915  * pname:physicalDevice is the physical device being queried.
916  * pname:pVideoFormatInfo is a pointer to a
917    slink:VkPhysicalDeviceVideoFormatInfoKHR structure specifying the codec
918    and video profile for which information is returned.
919  * pname:pVideoFormatPropertyCount is a pointer to an integer related to
920    the number of video format properties available or queried, as described
921    below.
922  * pname:pVideoFormatProperties is a pointer to an array of
923    slink:VkVideoFormatPropertiesKHR structures in which supported formats
924    are returned.
925
926If pname:pVideoFormatProperties is `NULL`, then the number of video format
927properties supported for the given pname:physicalDevice is returned in
928pname:pVideoFormatPropertyCount.
929Otherwise, pname:pVideoFormatPropertyCount must: point to a variable set by
930the user to the number of elements in the pname:pVideoFormatProperties
931array, and on return the variable is overwritten with the number of values
932actually written to pname:pVideoFormatProperties.
933If the value of pname:pVideoFormatPropertyCount is less than the number of
934video format properties supported, at most pname:pVideoFormatPropertyCount
935values will be written to pname:pVideoFormatProperties, and
936ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
937indicate that not all the available values were returned.
938
939.Valid Usage
940****
941  * [[VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-imageUsage-04844]]
942    The pname:imageUsage enum of slink:VkPhysicalDeviceVideoFormatInfoKHR
943    must: contain at least one of the following video image usage bit(s):
944    ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR,
945    ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR,
946    ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR, or
947    ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
948****
949
950[NOTE]
951.Note:
952====
953For most use cases, only decode or encode related usage flags are going to
954be specified.
955For a use case such as transcode, if the image were to be shared between
956decode and encode session(s), then both decode and encode related usage
957flags can: be set.
958====
959
960include::{generated}/validity/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.txt[]
961--
962
963[open,refpage='VkPhysicalDeviceVideoFormatInfoKHR',desc='Structure specifying the codec video format',type='structs']
964--
965The slink:VkPhysicalDeviceVideoFormatInfoKHR input structure is defined as:
966
967include::{generated}/api/structs/VkPhysicalDeviceVideoFormatInfoKHR.txt[]
968
969  * pname:sType is the type of this structure.
970  * pname:pNext is `NULL` or a pointer to a structure extending this
971    structure.
972  * pname:imageUsage is a bitmask of elink:VkImageUsageFlagBits specifying
973    intended video image usages.
974  * pname:pVideoProfiles is a pointer to a slink:VkVideoProfilesKHR
975    structure providing the video profile(s) of video session(s) that will
976    use the image.
977    For most use cases, the image is used by a single video session and a
978    single video profile is provided.
979    For a use case such as transcode, where a decode session output image
980    may: be used as encode input for one or more encode sessions, multiple
981    video profiles representing the video sessions that will share the image
982    may: be provided.
983
984include::{generated}/validity/structs/VkPhysicalDeviceVideoFormatInfoKHR.txt[]
985--
986
987[open,refpage='VkVideoProfilesKHR',desc='Structure enumerating the video profiles',type='structs']
988--
989The slink:VkVideoProfilesKHR structure is defined as:
990
991include::{generated}/api/structs/VkVideoProfilesKHR.txt[]
992
993  * pname:sType is the type of this structure.
994  * pname:pNext is `NULL` or a pointer to a structure extending this
995    structure.
996  * pname:profileCount is an integer which holds the number of video
997    profiles included in pname:pProfiles.
998  * pname:pProfiles is a pointer to an array of slink:VkVideoProfileKHR
999    structures.
1000    Each slink:VkVideoProfileKHR structure must: chain the corresponding
1001    codec-operation specific extension video profile structure.
1002
1003include::{generated}/validity/structs/VkVideoProfilesKHR.txt[]
1004--
1005
1006[open,refpage='VkVideoFormatPropertiesKHR',desc='Structure enumerating the video image formats',type='structs']
1007--
1008The slink:VkVideoFormatPropertiesKHR output structure for
1009flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR is defined as:
1010
1011include::{generated}/api/structs/VkVideoFormatPropertiesKHR.txt[]
1012
1013  * pname:sType is the type of this structure.
1014  * pname:pNext is `NULL` or a pointer to a structure extending this
1015    structure.
1016  * pname:format is one of the supported formats reported by the
1017    implementation.
1018
1019If the pname:pVideoProfiles provided in input structure
1020pname:pVideoFormatInfo are not supported,
1021ename:VK_ERROR_FORMAT_NOT_SUPPORTED is returned.
1022If the implementation requires an opaque video decode or encode DPB, then
1023when querying with the corresponding video decode or encode DPB image usage
1024in pname:imageUsage, only one image format is returned:
1025ename:VK_FORMAT_UNDEFINED.
1026
1027include::{generated}/validity/structs/VkVideoFormatPropertiesKHR.txt[]
1028--
1029
1030Before creating an image, the application should obtain the supported image
1031creation parameters by querying with
1032flink:vkGetPhysicalDeviceFormatProperties2 or
1033flink:vkGetPhysicalDeviceImageFormatProperties2 using one of the reported
1034pname:pImageFormats and adding slink:VkVideoProfilesKHR to the pname:pNext
1035chain of slink:VkFormatProperties2.
1036
1037
1038[[video-session-objects]]
1039== Video Session Objects
1040
1041
1042[[video-session]]
1043=== Video Session
1044
1045[open,refpage='VkVideoSessionKHR',desc='Opaque handle to a video session object',type='handles']
1046--
1047Video session objects are abstracted and represented by
1048slink:VkVideoSessionKHR handles:
1049
1050include::{generated}/api/handles/VkVideoSessionKHR.txt[]
1051--
1052
1053
1054[[video-session-creation]]
1055==== Creating a Video Session
1056
1057[open,refpage='vkCreateVideoSessionKHR',desc='Creates a video session object',type='protos']
1058--
1059To create a video session object, call:
1060
1061include::{generated}/api/protos/vkCreateVideoSessionKHR.txt[]
1062
1063  * pname:device is the logical device that creates the decode or encode
1064    session object.
1065  * pname:pCreateInfo is a pointer to a slink:VkVideoSessionCreateInfoKHR
1066    structure containing parameters specifying the creation of the decode or
1067    encode session.
1068  * pname:pAllocator controls host memory allocation as described in the
1069    <<memory-allocation, Memory Allocation>> chapter.
1070  * pname:pVideoSession is a pointer to a slink:VkVideoSessionKHR structure
1071    specifying the decode or encode video session object which will be
1072    created by this function when it returns ename:VK_SUCCESS
1073
1074include::{generated}/validity/protos/vkCreateVideoSessionKHR.txt[]
1075--
1076
1077[open,refpage='VkVideoSessionCreateInfoKHR',desc='Structure specifying parameters of a newly created video decode session',type='structs']
1078--
1079The slink:VkVideoSessionCreateInfoKHR structure is defined as:
1080
1081include::{generated}/api/structs/VkVideoSessionCreateInfoKHR.txt[]
1082
1083  * pname:sType is the type of this structure.
1084  * pname:pNext is `NULL` or a pointer to a structure extending this
1085    structure.
1086  * pname:queueFamilyIndex is the queue family of the created video session.
1087  * pname:flags is a bitmask of elink:VkVideoSessionCreateFlagBitsKHR
1088    specifying creation flags.
1089  * pname:pVideoProfile is a pointer to a slink:VkVideoProfileKHR structure.
1090  * pname:pictureFormat is the format of the <<resources-image-views, image
1091    views>> representing decoded <<decoded-output-picture, Output>> or
1092    encoded <<input-encode-picture, Input>> pictures.
1093  * pname:maxCodedExtent is the maximum width and height of the coded
1094    pictures that this instance will be able to support.
1095  * pname:referencePicturesFormat is the format of the <<dpb, DPB>> image
1096    views representing the <<reference-picture,Reference Pictures>>.
1097  * pname:maxReferencePicturesSlotsCount is the maximum number of
1098    <<dpb-slot,DPB Slots>> that can be activated with associated
1099    <<video-picture-resources,Video Picture Resources>> for the created
1100    video session.
1101  * pname:maxReferencePicturesActiveCount is the maximum number of active
1102    <<dpb-slot,DPB Slots>> that can be used as Dpb or Reconstructed
1103    <<reference-picture,Reference Pictures>> within a single decode or
1104    encode operation for the created video session.
1105
1106.Valid Usage
1107****
1108  * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-04845]]
1109    pname:pVideoProfile must: be a pointer to a valid
1110    slink:VkVideoProfileKHR structure whose pname:pNext chain must: include
1111    a valid codec-specific profile structure
1112  * [[VUID-VkVideoSessionCreateInfoKHR-maxReferencePicturesSlotsCount-04846]]
1113    If <<reference-picture,Reference Pictures>> are required for use with
1114    the created video session, the pname:maxReferencePicturesSlotsCount
1115    must: be set to a value bigger than `0`
1116  * [[VUID-VkVideoSessionCreateInfoKHR-maxReferencePicturesSlotsCount-04847]]
1117    pname:maxReferencePicturesSlotsCount cannot: exceed the implementation
1118    reported
1119    slink:VkVideoCapabilitiesKHR::pname:maxReferencePicturesSlotsCount
1120  * [[VUID-VkVideoSessionCreateInfoKHR-maxReferencePicturesActiveCount-04848]]
1121    If <<reference-picture,Reference Pictures>> are required for use with
1122    the created video session, the pname:maxReferencePicturesActiveCount
1123    must: be set to a value bigger than `0`
1124  * [[VUID-VkVideoSessionCreateInfoKHR-maxReferencePicturesActiveCount-04849]]
1125    pname:maxReferencePicturesActiveCount cannot: exceed the implementation
1126    reported
1127    slink:VkVideoCapabilitiesKHR::pname:maxReferencePicturesActiveCount
1128  * [[VUID-VkVideoSessionCreateInfoKHR-maxReferencePicturesActiveCount-04850]]
1129    pname:maxReferencePicturesActiveCount cannot: exceed the
1130    pname:maxReferencePicturesSlotsCount
1131  * [[VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851]]
1132    pname:maxCodedExtent cannot: be smaller than
1133    slink:VkVideoCapabilitiesKHR::pname:minExtent and bigger than
1134    slink:VkVideoCapabilitiesKHR::pname:maxExtent
1135  * [[VUID-VkVideoSessionCreateInfoKHR-referencePicturesFormat-04852]]
1136    pname:referencePicturesFormat must: be one of the supported formats in
1137    slink:VkVideoFormatPropertiesKHR pname:format returned by the
1138    flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR when the
1139    slink:VkPhysicalDeviceVideoFormatInfoKHR pname:imageUsage contains
1140    ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR or
1141    ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR depending on the session
1142    codec operation
1143  * [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04853]]
1144    pname:pictureFormat for decode output must: be one of the supported
1145    formats in slink:VkVideoFormatPropertiesKHR pname:format returned by the
1146    flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR when the
1147    slink:VkPhysicalDeviceVideoFormatInfoKHR pname:imageUsage contains
1148    ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
1149  * [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04854]]
1150    pname:pictureFormat targeting encode operations must: be one of the
1151    supported formats in slink:VkVideoFormatPropertiesKHR pname:format
1152    returned by the flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR when
1153    the slink:VkPhysicalDeviceVideoFormatInfoKHR pname:imageUsage contains
1154    ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
1155****
1156
1157include::{generated}/validity/structs/VkVideoSessionCreateInfoKHR.txt[]
1158--
1159
1160[open,refpage='VkVideoSessionCreateFlagBitsKHR',desc='Video decode or encode video session creation flags',type='enums']
1161--
1162The decode or encode session creation flags defined with the following
1163enums:
1164
1165include::{generated}/api/enums/VkVideoSessionCreateFlagBitsKHR.txt[]
1166
1167  * ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR - create the
1168    video session for use with protected video content
1169--
1170
1171[open,refpage='VkVideoSessionCreateFlagsKHR',desc='Bitmask specifying the video decode or encode video session creation flags',type='flags']
1172--
1173include::{generated}/api/flags/VkVideoSessionCreateFlagsKHR.txt[]
1174
1175tlink:VkVideoSessionCreateFlagsKHR is a bitmask type for setting a mask of
1176zero or more elink:VkVideoSessionCreateFlagBitsKHR.
1177--
1178
1179
1180[[video-session-destruction]]
1181=== Destroying a Video Session
1182
1183[open,refpage='vkDestroyVideoSessionKHR',desc='Destroy decode session object',type='protos']
1184--
1185To destroy a decode session object, call:
1186
1187include::{generated}/api/protos/vkDestroyVideoSessionKHR.txt[]
1188
1189  * pname:device is the device that was used for the creation of the video
1190    session.
1191  * pname:videoSession is the decode or encode video session to be
1192    destroyed.
1193  * pname:pAllocator controls host memory allocation as described in the
1194    <<memory-allocation, Memory Allocation>> chapter.
1195
1196include::{generated}/validity/protos/vkDestroyVideoSessionKHR.txt[]
1197--
1198
1199
1200[[video-session-memory-resource-management]]
1201=== Video Session Memory Resource Management
1202
1203
1204[[obtaining-video-session-memory-requirements]]
1205==== Obtaining the Video Session Object Device Memory Requirements
1206
1207[open,refpage='vkGetVideoSessionMemoryRequirementsKHR',desc='Get Memory Requirements',type='protos']
1208--
1209To get memory requirements for a video session, call:
1210
1211include::{generated}/api/protos/vkGetVideoSessionMemoryRequirementsKHR.txt[]
1212
1213  * pname:device is the logical device that owns the video session.
1214  * pname:videoSession is the video session to query.
1215  * pname:pVideoSessionMemoryRequirementsCount is a pointer to an integer
1216    related to the number of memory heap requirements available or queried,
1217    as described below.
1218  * pname:pVideoSessionMemoryRequirements is `NULL` or a pointer to an array
1219    of slink:VkVideoGetMemoryPropertiesKHR structures in which the memory
1220    heap requirements of the video session are returned.
1221
1222If pname:pVideoSessionMemoryRequirements is `NULL`, then the number of
1223memory heap types required for the video session is returned in
1224pname:pVideoSessionMemoryRequirementsCount.
1225Otherwise, pname:pVideoSessionMemoryRequirementsCount must: point to a
1226variable set by the user with the number of elements in the
1227pname:pVideoSessionMemoryRequirements array, and on return the variable is
1228overwritten with the number of formats actually written to
1229pname:pVideoSessionMemoryRequirements.
1230If pname:pVideoSessionMemoryRequirementsCount is less than the number of
1231memory heap types required for the video session, then at most
1232pname:pVideoSessionMemoryRequirementsCount elements will be written to
1233pname:pVideoSessionMemoryRequirements, and ename:VK_INCOMPLETE will be
1234returned, instead of ename:VK_SUCCESS, to indicate that not all required
1235memory heap types were returned.
1236
1237include::{generated}/validity/protos/vkGetVideoSessionMemoryRequirementsKHR.txt[]
1238--
1239
1240[open,refpage='VkVideoGetMemoryPropertiesKHR',desc='Structure specifying video session required memory heap type',type='structs']
1241--
1242The slink:VkVideoGetMemoryPropertiesKHR structure is defined as:
1243
1244include::{generated}/api/structs/VkVideoGetMemoryPropertiesKHR.txt[]
1245
1246  * pname:sType is the type of this structure.
1247  * pname:pNext is `NULL` or a pointer to a structure extending this
1248    structure.
1249  * pname:memoryBindIndex is the memory bind index of the memory heap type
1250    described by the information returned in pname:pMemoryRequirements.
1251  * pname:pMemoryRequirements is a pointer to a slink:VkMemoryRequirements2
1252    structure in which the requested memory heap requirements for the heap
1253    with index pname:memoryBindIndex are returned.
1254
1255include::{generated}/validity/structs/VkVideoGetMemoryPropertiesKHR.txt[]
1256--
1257
1258
1259[[binding-session-memory]]
1260==== Binding the Session Object Device Memory
1261
1262[open,refpage='vkBindVideoSessionMemoryKHR',desc='Bind Video Memory',type='protos']
1263--
1264To attach memory to a video session object, call:
1265
1266include::{generated}/api/protos/vkBindVideoSessionMemoryKHR.txt[]
1267
1268  * pname:device is the logical device that owns the video session's memory.
1269  * pname:videoSession is the video session to be bound with device memory.
1270  * pname:videoSessionBindMemoryCount is the number of
1271    pname:pVideoSessionBindMemories to be bound.
1272  * pname:pVideoSessionBindMemories is a pointer to an array of
1273    slink:VkVideoBindMemoryKHR structures specifying memory regions to be
1274    bound to a device memory heap.
1275
1276include::{generated}/validity/protos/vkBindVideoSessionMemoryKHR.txt[]
1277--
1278
1279[open,refpage='VkVideoBindMemoryKHR',desc='Structure specifying device memory heap entry for video session object',type='structs']
1280--
1281The slink:VkVideoBindMemoryKHR structure is defined as:
1282
1283include::{generated}/api/structs/VkVideoBindMemoryKHR.txt[]
1284
1285  * pname:sType is the type of this structure.
1286  * pname:pNext is `NULL` or a pointer to a structure extending this
1287    structure.
1288  * pname:memoryBindIndex is the index of the device memory heap returned in
1289    slink:VkVideoGetMemoryPropertiesKHR::pname:memoryBindIndex from
1290    flink:vkGetVideoSessionMemoryRequirementsKHR.
1291  * pname:memory is the allocated device memory to be bound to the video
1292    session's heap with index pname:memoryBindIndex.
1293  * pname:memoryOffset is the start offset of the region of pname:memory
1294    which is to be bound.
1295  * pname:memorySize is the size in bytes of the region of pname:memory,
1296    starting from pname:memoryOffset bytes, to be bound.
1297
1298
1299include::{generated}/validity/structs/VkVideoBindMemoryKHR.txt[]
1300--
1301
1302
1303[[video-session-parameters]]
1304=== Video Session Parameters
1305
1306This specification supports several classes of preprocessed parameters
1307stored in Video Session Parameters objects.
1308The Video Session Parameters objects reduces the number of parameters being
1309dispatched and then processed by the implementation while recording video
1310command buffers.
1311
1312
1313[[creating-video-session-parameters]]
1314=== Creating Video Session Parameters
1315
1316[open,refpage='VkVideoSessionParametersKHR',desc='Opaque handle to a video video session parameters object',type='handles']
1317--
1318Video session parameter objects are represented by
1319slink:VkVideoSessionParametersKHR handles:
1320
1321include::{generated}/api/handles/VkVideoSessionParametersKHR.txt[]
1322--
1323
1324[open,refpage='vkCreateVideoSessionParametersKHR',desc='Creates video session video session parameter object',type='protos']
1325--
1326To create a video session parameters object, call:
1327
1328include::{generated}/api/protos/vkCreateVideoSessionParametersKHR.txt[]
1329
1330  * pname:device is the logical device that was used for the creation of the
1331    video session object.
1332  * pname:pCreateInfo is a pointer to
1333    slink:VkVideoSessionParametersCreateInfoKHR structure specifying the
1334    video session parameters.
1335  * pname:pAllocator controls host memory allocation as described in the
1336    <<memory-allocation, Memory Allocation>> chapter.
1337  * pname:pVideoSessionParameters is a pointer to a
1338    slink:VkVideoSessionParametersKHR handle in which the video session
1339    parameters object is returned.
1340
1341include::{generated}/validity/protos/vkCreateVideoSessionParametersKHR.txt[]
1342--
1343
1344[open,refpage='VkVideoSessionParametersCreateInfoKHR',desc='Structure to set video session parameters',type='structs']
1345--
1346The slink:VkVideoSessionParametersCreateInfoKHR structure is defined as:
1347
1348include::{generated}/api/structs/VkVideoSessionParametersCreateInfoKHR.txt[]
1349
1350  * pname:sType is the type of this structure.
1351  * pname:pNext is `NULL` or a pointer to a structure extending this
1352    structure.
1353  * pname:videoSessionParametersTemplate is dlink:VK_NULL_HANDLE or a valid
1354    handle to a slink:VkVideoSessionParametersKHR object.
1355    If this parameter represents a valid handle, then the underlying Video
1356    Session Parameters object will be used as a template for constructing
1357    the new video session parameters object.
1358    All of the template object's current parameters will be inherited by the
1359    new object in such a case.
1360    Optionally, some of the template's parameters can be updated or new
1361    parameters added to the newly constructed object via the
1362    extension-specific parameters.
1363  * pname:videoSession is the video session object against which the video
1364    session parameters object is going to be created.
1365
1366.Valid Usage
1367****
1368  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-04855]]
1369    If pname:videoSessionParametersTemplate represents a valid handle, it
1370    must: have been created against pname:videoSession
1371****
1372
1373include::{generated}/validity/structs/VkVideoSessionParametersCreateInfoKHR.txt[]
1374--
1375
1376
1377[[UpdatingVideoSessionParameters]]
1378=== Updating the parameters of the Video Session Parameters object
1379
1380[open,refpage='vkUpdateVideoSessionParametersKHR',desc='Update video session video session parameter object',type='protos']
1381--
1382To update, add, or remove video session parameters state, call:
1383
1384include::{generated}/api/protos/vkUpdateVideoSessionParametersKHR.txt[]
1385
1386  * pname:device is the logical device that was used for the creation of the
1387    video session object.
1388  * pname:videoSessionParameters is the video session object that is going
1389    to be updated.
1390  * pname:pUpdateInfo is a pointer to a
1391    sname:VkVideoSessionParametersUpdateInfoKHR structure containing the
1392    session parameters update information.
1393
1394include::{generated}/validity/protos/vkUpdateVideoSessionParametersKHR.txt[]
1395--
1396
1397[open,refpage='VkVideoSessionParametersUpdateInfoKHR',desc='Structure to update video session parameters',type='structs']
1398--
1399The sname:VkVideoSessionParametersUpdateInfoKHR structure is defined as:
1400
1401include::{generated}/api/structs/VkVideoSessionParametersUpdateInfoKHR.txt[]
1402
1403  * pname:sType is the type of this structure.
1404  * pname:pNext is `NULL` or a pointer to a structure extending this
1405    structure.
1406  * pname:updateSequenceCount is the sequence number of the object update
1407    with parameters, starting from `1` and incrementing the value by one
1408    with each subsequent update.
1409
1410include::{generated}/validity/structs/VkVideoSessionParametersUpdateInfoKHR.txt[]
1411--
1412
1413
1414[[destroying-video-session-parameters]]
1415=== Destroying Video Session Parameters
1416
1417[open,refpage='vkDestroyVideoSessionParametersKHR',desc='Destroy video session parameters object',type='protos']
1418--
1419To destroy a video session object, call:
1420
1421include::{generated}/api/protos/vkDestroyVideoSessionParametersKHR.txt[]
1422
1423  * pname:device is the device the video session was created with.
1424  * pname:videoSessionParameters is the video session parameters object to
1425    be destroyed.
1426  * pname:pAllocator controls host memory allocation as described in the
1427    <<memory-allocation, Memory Allocation>> chapter.
1428
1429include::{generated}/validity/protos/vkDestroyVideoSessionParametersKHR.txt[]
1430--
1431
1432
1433=== Video Encode and Decode commands
1434
1435[open,refpage='vkCmdBeginVideoCodingKHR',desc='Start decode jobs',type='protos']
1436--
1437To start video decode or encode operations, call:
1438
1439include::{generated}/api/protos/vkCmdBeginVideoCodingKHR.txt[]
1440
1441  * pname:commandBuffer is the command buffer to be used when recording
1442    commands for the video decode or encode operations.
1443  * pname:pBeginInfo is a pointer to a slink:VkVideoBeginCodingInfoKHR
1444    structure.
1445
1446include::{generated}/validity/protos/vkCmdBeginVideoCodingKHR.txt[]
1447--
1448
1449[open,refpage='VkVideoBeginCodingInfoKHR',desc='Structure specifying parameters of decode starts',type='structs']
1450--
1451The slink:VkVideoBeginCodingInfoKHR structure is defined as:
1452
1453include::{generated}/api/structs/VkVideoBeginCodingInfoKHR.txt[]
1454
1455  * pname:sType is the type of this structure.
1456  * pname:pNext is `NULL` or a pointer to a structure extending this
1457    structure.
1458  * pname:flags is reserved for future use.
1459  * pname:codecQualityPreset is a bitmask of
1460    elink:VkVideoCodingQualityPresetFlagBitsKHR specifying the Video Decode
1461    or Encode quality preset.
1462  * pname:videoSession is the video session object to be bound for the
1463    processing of the video commands.
1464  * pname:videoSessionParameters is dlink:VK_NULL_HANDLE or a handle of a
1465    slink:VkVideoSessionParametersKHR object to be used for the processing
1466    of the video commands.
1467    If dlink:VK_NULL_HANDLE, then no video session parameters apply to this
1468    command buffer context.
1469  * pname:referenceSlotCount is the number of reference slot entries
1470    provided in pname:pReferenceSlots.
1471  * pname:pReferenceSlots is a pointer to an array of
1472    slink:VkVideoReferenceSlotKHR structures specifying reference slots,
1473    used within the video command context between this
1474    flink:vkCmdBeginVideoCodingKHR command and the
1475    flink:vkCmdEndVideoCodingKHR commmand that follows.
1476    Each reference slot provides a slot index and the
1477    slink:VkVideoPictureResourceKHR specifying the reference picture
1478    resource bound to this slot index.
1479    A slot index must: not appear more than once in pname:pReferenceSlots in
1480    a given command.
1481
1482.Valid Usage
1483****
1484  * [[VUID-VkVideoBeginCodingInfoKHR-referenceSlotCount-04856]]
1485    slink:VkVideoBeginCodingInfoKHR::pname:referenceSlotCount must: not
1486    exceed the value specified in
1487    slink:VkVideoSessionCreateInfoKHR::pname:maxReferencePicturesSlotsCount
1488    when creating the video session object that is being provided in
1489    pname:videoSession
1490  * [[VUID-VkVideoBeginCodingInfoKHR-videoSessionParameters-04857]]
1491    If pname:videoSessionParameters is not dlink:VK_NULL_HANDLE, it must:
1492    have been created using pname:videoSession as a parent object
1493****
1494
1495include::{generated}/validity/structs/VkVideoBeginCodingInfoKHR.txt[]
1496--
1497
1498[open,refpage='VkVideoBeginCodingFlagsKHR',desc='Reserved for future use',type='flags']
1499--
1500include::{generated}/api/flags/VkVideoBeginCodingFlagsKHR.txt[]
1501
1502tname:VkVideoBeginCodingFlagsKHR is a bitmask type for setting a mask, but
1503is currently reserved for future use.
1504--
1505
1506[open,refpage='VkVideoCodingQualityPresetFlagBitsKHR',desc='Video codec profile types',type='enums']
1507--
1508The decode preset types are defined with the following:
1509
1510include::{generated}/api/enums/VkVideoCodingQualityPresetFlagBitsKHR.txt[]
1511
1512  * ename:VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR defines normal
1513    decode case.
1514  * ename:VK_VIDEO_CODING_QUALITY_PRESET_POWER_BIT_KHR defines power
1515    efficient case.
1516  * ename:VK_VIDEO_CODING_QUALITY_PRESET_QUALITY_BIT_KHR defines quality
1517    focus case.
1518--
1519
1520[open,refpage='VkVideoCodingQualityPresetFlagsKHR',desc='Bitmask of elink:VkVideoCodingQualityPresetFlagBitsKHR flags',type='flags']
1521--
1522include::{generated}/api/flags/VkVideoCodingQualityPresetFlagsKHR.txt[]
1523
1524tlink:VkVideoCodingQualityPresetFlagsKHR is a bitmask type for setting a
1525mask of zero or more elink:VkVideoCodingQualityPresetFlagBitsKHR.
1526--
1527
1528[open,refpage='VkVideoReferenceSlotKHR',desc='Structure specifying the reference picture slot',type='structs']
1529--
1530The slink:VkVideoReferenceSlotKHR structure is defined as:
1531
1532include::{generated}/api/structs/VkVideoReferenceSlotKHR.txt[]
1533
1534  * pname:sType is the type of this structure.
1535  * pname:pNext is `NULL` or a pointer to a structure extending this
1536    structure.
1537  * pname:slotIndex is the unique reference slot index used for the encode
1538    or decode operation.
1539  * pname:pPictureResource is a pointer to a slink:VkVideoPictureResourceKHR
1540    structure describing the picture resource bound to this slot index.
1541
1542include::{generated}/validity/structs/VkVideoReferenceSlotKHR.txt[]
1543--
1544
1545[open,refpage='VkVideoPictureResourceKHR',desc='Structure specifying the picture resources',type='structs']
1546--
1547The slink:VkVideoPictureResourceKHR structure is defined as:
1548
1549include::{generated}/api/structs/VkVideoPictureResourceKHR.txt[]
1550
1551  * pname:sType is the type of this structure.
1552  * pname:pNext is `NULL` or a pointer to a structure extending this
1553    structure.
1554  * pname:codedOffset is the offset to be used for the picture resource.
1555  * pname:codedExtent is the extent to be used for the picture resource.
1556  * pname:baseArrayLayer is the first array layer to be accessed for the
1557    Decode or Encode Operations.
1558  * pname:imageViewBinding is a slink:VkImageView image view representing
1559    this picture resource.
1560
1561include::{generated}/validity/structs/VkVideoPictureResourceKHR.txt[]
1562--
1563
1564
1565=== End of the Video Session
1566
1567[open,refpage='vkCmdEndVideoCodingKHR',desc='End decode jobs',type='protos']
1568--
1569To end video decode or encode operations, call:
1570
1571include::{generated}/api/protos/vkCmdEndVideoCodingKHR.txt[]
1572
1573  * pname:commandBuffer is the command buffer to be filled by this function.
1574  * pname:pEndCodingInfo is a pointer to a slink:VkVideoEndCodingInfoKHR
1575    structure.
1576
1577include::{generated}/validity/protos/vkCmdEndVideoCodingKHR.txt[]
1578--
1579
1580[open,refpage='VkVideoEndCodingInfoKHR',desc='Structure specifying the end of decode encode commands sequence',type='structs']
1581--
1582The slink:VkVideoEndCodingInfoKHR structure is defined as:
1583
1584include::{generated}/api/structs/VkVideoEndCodingInfoKHR.txt[]
1585
1586  * pname:sType is the type of this structure.
1587  * pname:pNext is `NULL` or a pointer to a structure extending this
1588    structure.
1589  * pname:flags is reserved for future use.
1590
1591include::{generated}/validity/structs/VkVideoEndCodingInfoKHR.txt[]
1592--
1593
1594[open,refpage='VkVideoEndCodingFlagsKHR',desc='Reserved for future use',type='flags']
1595--
1596include::{generated}/api/flags/VkVideoEndCodingFlagsKHR.txt[]
1597
1598tname:VkVideoEndCodingFlagsKHR is a bitmask type for setting a mask, but is
1599currently reserved for future use.
1600--
1601
1602
1603=== Video Session Control Command
1604
1605[open,refpage='vkCmdControlVideoCodingKHR',desc='Set encode rate control parameters',type='protos']
1606--
1607To apply dynamic controls to video decode or video encode operations, call:
1608
1609include::{generated}/api/protos/vkCmdControlVideoCodingKHR.txt[]
1610
1611  * pname:commandBuffer is the command buffer to be filled by this function
1612    for setting encode rate control parameters.
1613  * pname:pCodingControlInfo is a pointer to a
1614    slink:VkVideoCodingControlInfoKHR structure.
1615
1616include::{generated}/validity/protos/vkCmdControlVideoCodingKHR.txt[]
1617--
1618
1619The settings provided in this call are applied to the video stream at the
1620time of queue submission and are in effect until the submission of a
1621subsequent fname:vkCmdControlVideoCodingKHR.
1622
1623[open,refpage='VkVideoCodingControlInfoKHR',desc='Structure specifying parameters of decode starts',type='structs']
1624--
1625The slink:VkVideoCodingControlInfoKHR structure is defined as:
1626
1627include::{generated}/api/structs/VkVideoCodingControlInfoKHR.txt[]
1628
1629  * pname:sType is the type of this structure.
1630  * pname:pNext is `NULL` or a pointer to a structure extending this
1631    structure.
1632  * pname:flags is a bitmask of tlink:VkVideoCodingControlFlagsKHR
1633    specifying control flags.
1634
1635include::{generated}/validity/structs/VkVideoCodingControlInfoKHR.txt[]
1636--
1637
1638[open,refpage='VkVideoCodingControlFlagBitsKHR',desc='Video Coding Control Command Flags',type='enums']
1639--
1640The flink:vkCmdControlVideoCodingKHR flags are defined with the following
1641enumeration:
1642
1643include::{generated}/api/enums/VkVideoCodingControlFlagBitsKHR.txt[]
1644
1645  * ename:VK_VIDEO_CODING_CONTROL_DEFAULT_KHR indicates a request for the
1646    coding control paramaters to be applied to the current state of the
1647    bound video session.
1648  * ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR indicates a request for the
1649    bound video session state to be reset before the coding control
1650    parameters are applied.
1651    The state after reset is identical to the state immediately after video
1652    session creation.
1653--
1654
1655[open,refpage='VkVideoCodingControlFlagsKHR',desc='Bitmask specifying the Video Coding Control Command flink:vkCmdControlVideoCodingKHR flags',type='flags']
1656--
1657include::{generated}/api/flags/VkVideoCodingControlFlagsKHR.txt[]
1658
1659tlink:VkVideoCodingControlFlagsKHR is a bitmask type for setting a mask of
1660zero or more elink:VkVideoCodingControlFlagBitsKHR.
1661--
1662