## C Specification

The VkVideoEncodeRateControlLayerInfoKHR structure is defined as:

// Provided by VK_KHR_video_encode_queue
typedef struct VkVideoEncodeRateControlLayerInfoKHR {
VkStructureType    sType;
const void*        pNext;
uint32_t           averageBitrate;
uint32_t           maxBitrate;
uint32_t           frameRateNumerator;
uint32_t           frameRateDenominator;
uint32_t           virtualBufferSizeInMs;
uint32_t           initialVirtualBufferSizeInMs;
} VkVideoEncodeRateControlLayerInfoKHR;

## Members

• sType is the type of this structure.

• pNext is a pointer to a structure extending this structure.

• averageBitrate is the average bitrate in bits/second. Valid when rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR.

• maxBitrate is the peak bitrate in bits/second. Valid when rate control mode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR.

• frameRateNumerator is the numerator of the frame rate. Valid when rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR.

• frameRateDenominator is the denominator of the frame rate. Valid when rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR.

• virtualBufferSizeInMs is the leaky bucket model virtual buffer size in milliseconds, with respect to peak bitrate. Valid when rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR. For example, virtual buffer size is (virtualBufferSizeInMs × maxBitrate / 1000).

• initialVirtualBufferSizeInMs is the initial occupancy in milliseconds of the virtual buffer in the leaky bucket model. Valid when the rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR.

## Description

A codec-specific structure specifying additional per-layer rate control settings must be chained to VkVideoEncodeRateControlLayerInfoKHR. If multiple rate control layers are enabled (VkVideoEncodeRateControlInfoKHR::layerCount is greater than 1), then the chained codec-specific extension structure also identifies the specific video coding layer its parent VkVideoEncodeRateControlLayerInfoKHR applies to. If multiple rate control layers are enabled, the number of rate control layers must match the number of video coding layers. The specification for an encode codec-specific extension would describe how multiple video coding layers are enabled for the corresponding codec.

Per-layer rate control settings for all enabled rate control layers must be initialized or re-initialized whenever stream rate control settings are provided via VkVideoEncodeRateControlInfoKHR. This is done by specifying settings for all enabled rate control layers in VkVideoEncodeRateControlInfoKHR::pLayerConfigs.

To adjust rate control settings for an individual layer at runtime, add a VkVideoEncodeRateControlLayerInfoKHR structure to the pNext chain of the VkVideoCodingControlInfoKHR structure passed to the vkCmdControlVideoCodingKHR command. This adjustment only impacts the specified layer without impacting the rate control settings or implementation rate control algorithm behavior for any other enabled rate control layers. The adjustment takes effect whenever the corresponding vkCmdControlVideoCodingKHR is executed, and only impacts vkCmdEncodeVideoKHR operations pertaining to the corresponding video coding layer that follow in execution order.

It is possible for an application to enable multiple video coding layers (via codec-specific extensions to encoding operations) while only enabling a single layer of rate control for the entire video stream. To achieve this, layerCount in VkVideoEncodeRateControlInfoKHR must be set to 1, and the single VkVideoEncodeRateControlLayerInfoKHR provided in pLayerConfigs would apply to all encoded segments of the video stream, regardless of which codec-defined video coding layer they belong to. In this case, the implementation decides bitrate distribution across video coding layers (if applicable to the specified stream rate control mode).

Valid Usage (Implicit)
• VUID-VkVideoEncodeRateControlLayerInfoKHR-sType-sType
sType must be VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_LAYER_INFO_KHR

## 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 2014-2022 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0