VkVideoEncodeInfoKHR(3)

# VkVideoEncodeInfoKHR(3) Manual Page

## Name

VkVideoEncodeInfoKHR - Structure to chain codec-specific structures to

Loading… please wait.

## 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;
        VkBuffer                              dstBuffer;
        VkDeviceSize                          dstBufferOffset;
        VkDeviceSize                          dstBufferRange;
        VkVideoPictureResourceInfoKHR         srcPictureResource;
        const VkVideoReferenceSlotInfoKHR*    pSetupReferenceSlot;
        uint32_t                              referenceSlotCount;
        const VkVideoReferenceSlotInfoKHR*    pReferenceSlots;
        uint32_t                              precedingExternallyEncodedBytes;
    } VkVideoEncodeInfoKHR;

## Members

- `sType` is a VkStructureType value identifying 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 reserved for future use.

- `dstBuffer` is the destination video bitstream buffer to write the encoded bitstream to.

- `dstBufferOffset` is the starting offset in bytes from the start of `dstBuffer` to write the encoded bitstream to. `dstBufferOffset`’s value must be aligned to VkVideoCapabilitiesKHR::`minBitstreamBufferOffsetAlignment`, as reported by the implementation.

- `dstBufferRange` is the maximum size in bytes of the encoded bitstream written to `dstBuffer`, starting from `dstBufferOffset`. `dstBufferRange`’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 VkVideoReferenceSlotInfoKHR 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 VkVideoReferenceSlotInfoKHR 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`. 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 `dstBuffer` 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 feedback queries.

Valid Usage

- VUID-VkVideoEncodeInfoKHR-None-07012
  The bound video session must not be in uninitialized state at the time the command is executed on the device

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 VkVideoEncodeH264PictureInfoEXT or VkVideoEncodeH265PictureInfoEXT

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

- VUID-VkVideoEncodeInfoKHR-flags-zerobitmask
  `flags` must be `0`

- VUID-VkVideoEncodeInfoKHR-dstBuffer-parameter
  `dstBuffer` must be a valid VkBuffer handle

- VUID-VkVideoEncodeInfoKHR-srcPictureResource-parameter
  `srcPictureResource` must be a valid VkVideoPictureResourceInfoKHR structure

- VUID-VkVideoEncodeInfoKHR-pSetupReferenceSlot-parameter
  If `pSetupReferenceSlot` is not `NULL`, `pSetupReferenceSlot` must be a valid pointer to a valid VkVideoReferenceSlotInfoKHR structure

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

## See Also

VK_KHR_video_encode_queue, VkBuffer, VkDeviceSize, VkStructureType, VkVideoEncodeFlagsKHR, VkVideoPictureResourceInfoKHR, VkVideoReferenceSlotInfoKHR, vkCmdEncodeVideoKHR

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0