Structures

VkVideoEncodeRateControlInfoKHR

Structure to set encode stream rate control parameters

The VkVideoEncodeRateControlInfoKHR structure is defined as:

typedef struct VkVideoEncodeRateControlInfoKHR {
    VkStructureType sType;
    const void* pNext;
    VkVideoEncodeRateControlFlagsKHR flags;
    VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode;
    uint32_t layerCount;
    const VkVideoEncodeRateControlLayerInfoKHR* pLayers;
    uint32_t virtualBufferSizeInMs;
    uint32_t initialVirtualBufferSizeInMs;
} VkVideoEncodeRateControlInfoKHR;
  • sType is a VkStructureType value identifying this structure.
  • pNext is NULL or a pointer to a structure extending this structure.
  • flags is reserved for future use.
  • rateControlMode is a VkVideoEncodeRateControlModeFlagBitsKHR value specifying the rate control mode.
  • layerCount specifies the number of rate control layers to use.
  • pLayers is a pointer to an array of layerCount
    VkVideoEncodeRateControlLayerInfoKHR structures, each specifying the rate control configuration of the corresponding rate control layer.
  • virtualBufferSizeInMs is the size in milliseconds of the virtual buffer used by the implementation’s rate control algorithm for the leaky bucket model, with respect to the average bitrate of the stream calculated by summing the values of the averageBitrate members of the elements of the pLayers array.
  • initialVirtualBufferSizeInMs is the initial occupancy in milliseconds of the virtual buffer used by the implementation’s rate control algorithm for the leaky bucket model.

If layerCount is zero then the values of virtualBufferSizeInMs and initialVirtualBufferSizeInMs are ignored.

This structure can be specified in the following places:

Including this structure in the pNext chain of VkVideoCodingControlInfoKHR and including VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR in VkVideoCodingControlInfoKHR::flags enables updating the rate control configuration of the bound video session. This replaces the entire rate control configuration of the bound video session and may reset the state of all enabled rate control layers to an initial state according to the codec-specific rate control semantics defined in the corresponding sections listed below.

When layerCount is greater than one, multiple rate control layers are configured, and each rate control layer is applied to the corresponding video coding layer identified by the index of the corresponding element of pLayer.

  • If the video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then this index specifies the H.264 temporal layer ID of the video coding layer the rate control layer is applied to.
  • If the video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then this index specifies the H.265 temporal ID of the video coding layer the rate control layer is applied to.

Additional structures providing codec-specific rate control parameters can be included in the pNext chain of VkVideoCodingControlInfoKHR depending on the video profile the bound video session was created. For further details see:

The new rate control configuration takes effect when the corresponding vkCmdControlVideoCodingKHR is executed on the device, and only impacts video encode operations that follow in execution order.

Valid Usage

VUID-VkVideoEncodeRateControlInfoKHR-rateControlMode-08248

If rateControlMode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, then layerCount must be 0

VUID-VkVideoEncodeRateControlInfoKHR-rateControlMode-08275

If rateControlMode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR or VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR, then layerCount must be greater than 0

VUID-VkVideoEncodeRateControlInfoKHR-rateControlMode-08244

If rateControlMode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR, then it must specify one of the bits included in VkVideoEncodeCapabilitiesKHR::rateControlModes, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the used video profile

VUID-VkVideoEncodeRateControlInfoKHR-layerCount-08245

layerCount member must be less than or equal to VkVideoEncodeCapabilitiesKHR::maxRateControlLayers, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the used video profile

VUID-VkVideoEncodeRateControlInfoKHR-pLayers-08276

For each element of pLayers, its averageBitrate member must be between 1 and VkVideoEncodeCapabilitiesKHR::maxBitrate, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the used video profile

VUID-VkVideoEncodeRateControlInfoKHR-pLayers-08277

For each element of pLayers, its maxBitrate member must be between 1 and VkVideoEncodeCapabilitiesKHR::maxBitrate, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the used video profile

VUID-VkVideoEncodeRateControlInfoKHR-rateControlMode-08356

If rateControlMode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR, then for each element of pLayers, its averageBitrate member must equal its maxBitrate member

VUID-VkVideoEncodeRateControlInfoKHR-rateControlMode-08278

If rateControlMode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR, then for each element of pLayers, its averageBitrate member must be less than or equal to its maxBitrate member

VUID-VkVideoEncodeRateControlInfoKHR-layerCount-08357

If layerCount is not zero, then virtualBufferSizeInMs must be greater than zero

VUID-VkVideoEncodeRateControlInfoKHR-layerCount-08358

If layerCount is not zero, then initialVirtualBufferSizeInMsmust be less than virtualBufferSizeInMs

VUID-VkVideoEncodeRateControlInfoKHR-videoCodecOperation-07022

If the videoCodecOperation of the used video profile is VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, the pNext chain this structure is included in also includes an instance of the VkVideoEncodeH264RateControlInfoKHR structure, and layerCount is greater than 1, then layerCount must equal VkVideoEncodeH264RateControlInfoKHR::temporalLayerCount

VUID-VkVideoEncodeRateControlInfoKHR-videoCodecOperation-07025

If the videoCodecOperation of the used video profile is VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, the pNext chain this structure is included in also includes an instance of the VkVideoEncodeH265RateControlInfoKHR structure, and layerCount is greater than 1, then layerCount must equal VkVideoEncodeH265RateControlInfoKHR::subLayerCount

Valid Usage (Implicit)

VUID-VkVideoEncodeRateControlInfoKHR-sType-sType

sType must be VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR

VUID-VkVideoEncodeRateControlInfoKHR-pLayers-parameter

If layerCount is not 0, pLayers must be a valid pointer to an array of layerCount valid VkVideoEncodeRateControlLayerInfoKHR structures