## C Specification

The VkVideoEncodeInfoKHR structure is defined as:

// Provided by VK_KHR_video_encode_queue
typedef struct VkVideoEncodeInfoKHR {
VkStructureType                   sType;
const void*                       pNext;
VkVideoEncodeFlagsKHR             flags;
uint32_t                          qualityLevel;
VkBuffer                          dstBitstreamBuffer;
VkDeviceSize                      dstBitstreamBufferOffset;
VkDeviceSize                      dstBitstreamBufferMaxRange;
VkVideoPictureResourceKHR         srcPictureResource;
const VkVideoReferenceSlotKHR*    pSetupReferenceSlot;
uint32_t                          referenceSlotCount;
const VkVideoReferenceSlotKHR*    pReferenceSlots;
uint32_t                          precedingExternallyEncodedBytes;
} VkVideoEncodeInfoKHR;

## Members

• sType is the type of this structure.

• pNext is a pointer to a structure extending this structure. A codec-specific extension structure must be chained to specify what bitstream unit to generate with this encode operation.

• flags is a bitmask of VkVideoEncodeFlagBitsKHR specifying encode flags, and is reserved for future versions of this specification.

• qualityLevel is the coding quality level of the encoding. It is defined by the codec-specific extensions.

• dstBitstreamBuffer is the buffer where the encoded bitstream output will be produced.

• dstBitstreamBufferOffset is the offset in the dstBitstreamBuffer where the encoded bitstream output will start. dstBitstreamBufferOffset’s value must be aligned to VkVideoCapabilitiesKHR::minBitstreamBufferOffsetAlignment, as reported by the implementation.

• dstBitstreamBufferMaxRange is the maximum size of the dstBitstreamBuffer that can be used while the encoded bitstream output is produced. dstBitstreamBufferMaxRange’s value must be aligned to VkVideoCapabilitiesKHR::minBitstreamBufferSizeAlignment, as reported by the implementation.

• srcPictureResource is the Picture Resource of the Input Picture to be encoded by the operation.

• pSetupReferenceSlot is a pointer to a VkVideoReferenceSlotKHR structure used for generating a reconstructed reference slot and Picture Resource. pSetupReferenceSlot->slotIndex specifies the slot index number to use as a target for producing the Reconstructed (DPB) data. pSetupReferenceSlot must be one of the entries provided in VkVideoBeginCodingInfoKHR via the pReferenceSlots within the vkCmdBeginVideoCodingKHR command that established the Vulkan Video Encode Context for this command.

• referenceSlotCount is the number of Reconstructed Reference Pictures that will be used when this encoding operation is executing.

• pReferenceSlots is NULL or a pointer to an array of VkVideoReferenceSlotKHR structures that will be used when this encoding operation is executing. Each entry in pReferenceSlots must be one of the entries provided in VkVideoBeginCodingInfoKHR via the pReferenceSlots within the vkCmdBeginVideoCodingKHR command that established the Vulkan Video Encode Context for this command.

• precedingExternallyEncodedBytes is the number of bytes externally encoded for insertion in the active video encode session overall bitstream prior to the bitstream that will be generated by the implementation for this instance of VkVideoEncodeInfoKHR. Valid when VkVideoEncodeRateControlInfoKHR::rateControlMode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR. The value provided is used to update the implementation’s rate control algorithm for the rate control layer this instance of VkVideoEncodeInfoKHR belongs to, by accounting for the bitrate budget consumed by these externally encoded bytes. See VkVideoEncodeRateControlInfoKHR for additional information about encode rate control.

## Description

The coded size of the encode operation is specified in codedExtent of srcPictureResource.

Multiple vkCmdEncodeVideoKHR commands may be recorded within a Vulkan Video Encode Context. The execution of each vkCmdEncodeVideoKHR command will result in generating codec-specific bitstream units. These bitstream units are generated consecutively into the bitstream buffer specified in dstBitstreamBuffer of a VkVideoEncodeInfoKHR structure within the vkCmdBeginVideoCodingKHR command. The produced bitstream is the sum of all these bitstream units, including any padding between the bitstream units. Any bitstream padding must be filled with data compliant to the codec standard so as not to cause any syntax errors during decoding of the bitstream units with the padding included. The range of the bitstream buffer written can be queried via video encode bitstream buffer range queries.

Valid Usage (Implicit)
• VUID-VkVideoEncodeInfoKHR-sType-sType
sType must be VK_STRUCTURE_TYPE_VIDEO_ENCODE_INFO_KHR

• VUID-VkVideoEncodeInfoKHR-pNext-pNext
Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkVideoEncodeH264EmitPictureParametersEXT, VkVideoEncodeH264VclFrameInfoEXT, VkVideoEncodeH265EmitPictureParametersEXT, or VkVideoEncodeH265VclFrameInfoEXT

• VUID-VkVideoEncodeInfoKHR-sType-unique
The sType value of each struct in the pNext chain must be unique

• VUID-VkVideoEncodeInfoKHR-flags-parameter
flags must be a valid combination of VkVideoEncodeFlagBitsKHR values

• VUID-VkVideoEncodeInfoKHR-dstBitstreamBuffer-parameter
dstBitstreamBuffer must be a valid VkBuffer handle

• VUID-VkVideoEncodeInfoKHR-srcPictureResource-parameter
srcPictureResource must be a valid VkVideoPictureResourceKHR structure

• VUID-VkVideoEncodeInfoKHR-pSetupReferenceSlot-parameter
pSetupReferenceSlot must be a valid pointer to a valid VkVideoReferenceSlotKHR structure

• VUID-VkVideoEncodeInfoKHR-pReferenceSlots-parameter
If referenceSlotCount is not 0, pReferenceSlots must be a valid pointer to an array of referenceSlotCount valid VkVideoReferenceSlotKHR structures