Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
37ab751
encode: make H.264 level limits table readable
srinathkr-nv Nov 26, 2025
6e2dab3
encode: remove "prog" column from H.264 level limits table
srinathkr-nv Nov 26, 2025
fe29120
encode: add H.264 level limits for levels 6.0, 6.1, 6.2
srinathkr-nv Nov 26, 2025
a8bb6ac
EncoderConfigH264: Add InitProfileLevel for common profile and level …
srinathkr-nv Feb 16, 2026
f341c6b
encode: update H.264 level limits based on the profile
srinathkr-nv Nov 25, 2025
b02b077
EncoderConfigH265: Add InitProfileLevel for common profile, level, ti…
srinathkr-nv Feb 16, 2026
b8e01ef
EncoderConfigH265: rename GetLevelTier to DetermineLevelTier
srinathkr-nv Feb 6, 2026
deaad4d
EncoderConfigAV1: Add InitProfileLevel for common profile, level, tie…
srinathkr-nv Feb 16, 2026
4fba129
encode: remove videoProfileIdc and GetDefaultVideoProfileIdc()
srinathkr-nv Feb 16, 2026
4ea5eca
VkEncoderConfig: defer level selection to after device capability query
srinathkr-nv Jul 6, 2026
affa0b3
VkEncoderConfig: introduce InitVideoProfileCapabilities
srinathkr-nv Jul 7, 2026
5daa818
VkEncoderConfig: inline InitCodecProfile into InitVideoProfileCapabil…
srinathkr-nv Jul 7, 2026
8292e27
EncoderConfigH264: add a profile-probing loop in InitVideoProfileCapa…
srinathkr-nv Jul 7, 2026
d8fcc9c
EncoderConfigH264: improve cpbBrNalFactor comment in DetermineLevel
srinathkr-nv Jul 8, 2026
0fe29b3
encode: change DetermineLevelTier to return a boolean
srinathkr-nv Jul 8, 2026
e9599e9
EncoderConfigH264: simplify transform_8x8_mode_flag handling
srinathkr-nv Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,26 +813,6 @@ VkResult EncoderConfig::CreateCodecConfig(int argc, const char *argv[],
return VK_ERROR_INITIALIZATION_FAILED;
}

void EncoderConfig::InitVideoProfile()
{
if (encodeBitDepthLuma == 0) {
encodeBitDepthLuma = input.bpp;
}

if (encodeBitDepthChroma == 0) {
encodeBitDepthChroma = encodeBitDepthLuma;
}

// update the video profile
videoCoreProfile = VkVideoCoreProfile::CreateEncodeProfile(
codec, encodeChromaSubsampling,
GetComponentBitDepthFlagBits(encodeBitDepthLuma),
GetComponentBitDepthFlagBits(encodeBitDepthChroma),
(videoProfileIdc != (uint32_t)-1) ? videoProfileIdc :
GetDefaultVideoProfileIdc(),
tuningMode);
}

bool EncoderConfig::InitRateControl()
{
uint32_t levelBitRate = ((rateControlMode != VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) && hrdBitrate == 0)
Expand Down
11 changes: 5 additions & 6 deletions vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,6 @@ struct EncoderConfig : public VkVideoRefCountBase {
bool noDeviceFallback;
VkVideoCodecOperationFlagBitsKHR codec;
bool useDpbArray;
uint32_t videoProfileIdc;
uint32_t numInputImages;
EncoderInputImageParameters input;
uint8_t encodeBitDepthLuma;
Expand Down Expand Up @@ -793,7 +792,6 @@ struct EncoderConfig : public VkVideoRefCountBase {
, noDeviceFallback(false)
, codec(VK_VIDEO_CODEC_OPERATION_NONE_KHR)
, useDpbArray(false)
, videoProfileIdc((uint32_t)-1)
, numInputImages(DEFAULT_NUM_INPUT_IMAGES)
, input()
, encodeBitDepthLuma(0)
Expand Down Expand Up @@ -915,8 +913,6 @@ struct EncoderConfig : public VkVideoRefCountBase {
// Factory Function
static VkResult CreateCodecConfig(int argc, const char *argv[], VkSharedBaseObj<EncoderConfig>& encoderConfig);

void InitVideoProfile();

int ParseArguments(int argc, const char *argv[]);

virtual int DoParseArguments(int argc, const char *argv[]) {
Expand Down Expand Up @@ -959,9 +955,12 @@ struct EncoderConfig : public VkVideoRefCountBase {
}

// These functions should be overwritten from the codec-specific classes
virtual VkResult InitDeviceCapabilities(const VulkanDeviceContext* vkDevCtx) { return VK_ERROR_INITIALIZATION_FAILED; };
virtual VkResult InitVideoProfileCapabilities(const VulkanDeviceContext* vkDevCtx) { return VK_ERROR_INITIALIZATION_FAILED; };

// Returns the codec-specific profile identifier (must be set by InitCodecProfile first)
virtual uint32_t GetCodecProfile() = 0;

virtual uint32_t GetDefaultVideoProfileIdc() { return 0; };
virtual bool DetermineLevelTier() = 0;

virtual int8_t InitDpbCount() { return 16; };

Expand Down
37 changes: 31 additions & 6 deletions vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigAV1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,36 @@ bool EncoderConfigAV1::InitSequenceHeader(StdVideoAV1SequenceHeader *seqHdr,
return true;
}

VkResult EncoderConfigAV1::InitDeviceCapabilities(const VulkanDeviceContext* vkDevCtx)
VkResult EncoderConfigAV1::InitVideoProfileCapabilities(const VulkanDeviceContext* vkDevCtx)
{
if (encodeBitDepthLuma == 0)
encodeBitDepthLuma = input.bpp;
if (encodeBitDepthChroma == 0)
encodeBitDepthChroma = encodeBitDepthLuma;

// If profile hasn't been specified, determine it based on bit depth and chroma subsampling
if (profile == STD_VIDEO_AV1_PROFILE_INVALID) {
// PROFESSIONAL is required for 12-bit or 422
if ((input.bpp > 10) ||
(encodeChromaSubsampling == VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR)) {
profile = STD_VIDEO_AV1_PROFILE_PROFESSIONAL;
}
// HIGH is required for 444 chroma
else if (encodeChromaSubsampling == VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR) {
profile = STD_VIDEO_AV1_PROFILE_HIGH;
}
// MAIN supports 8-bit and 10-bit with 420
else {
profile = STD_VIDEO_AV1_PROFILE_MAIN;
}
}

videoCoreProfile = VkVideoCoreProfile::CreateEncodeProfile(
codec, encodeChromaSubsampling,
GetComponentBitDepthFlagBits(encodeBitDepthLuma),
GetComponentBitDepthFlagBits(encodeBitDepthChroma),
GetCodecProfile(), tuningMode);

VkResult result = VulkanVideoCapabilities::GetVideoEncodeCapabilities<VkVideoEncodeAV1CapabilitiesKHR, VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_CAPABILITIES_KHR,
VkVideoEncodeAV1QuantizationMapCapabilitiesKHR, VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_QUANTIZATION_MAP_CAPABILITIES_KHR>
(vkDevCtx, videoCoreProfile,
Expand Down Expand Up @@ -342,17 +370,14 @@ bool EncoderConfigAV1::DetermineLevelTier()
}
}
if (lvl > STD_VIDEO_AV1_LEVEL_7_3) {
level = STD_VIDEO_AV1_LEVEL_7_3;
tier = 0;
return false;
}

return true;
}

bool EncoderConfigAV1::InitRateControl()
{
DetermineLevelTier();

// Level and tier are already initialized by DetermineLevelTier()
// use level max values for now. Limit it to 120Mbits/sec
uint32_t levelBitrate = std::min(GetLevelBitrate(level, tier), 120000000u);

Expand Down
21 changes: 12 additions & 9 deletions vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigAV1.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,20 @@ struct EncoderConfigAV1 : public EncoderConfig {
pic_width_in_sbs = DivUp<uint32_t>(encodeWidth, 64);
pic_height_in_sbs = DivUp<uint32_t>(encodeHeight, 16);

if ((pic_width_in_sbs > 0) && (pic_height_in_sbs > 0)) {
return VK_SUCCESS;
if (pic_width_in_sbs == 0 || pic_height_in_sbs == 0) {
assert(!"Invalid pic_width_in_sbs and pic_height_in_sbs");
return VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR;
}

assert(!"Invalid pic_width_in_sbs and pic_height_in_sbs");
return VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR;
return VK_SUCCESS;
}

virtual VkResult InitDeviceCapabilities(const VulkanDeviceContext* vkDevCtx) override;
virtual VkResult InitVideoProfileCapabilities(const VulkanDeviceContext* vkDevCtx) override;

virtual uint32_t GetDefaultVideoProfileIdc() override { return STD_VIDEO_AV1_PROFILE_MAIN; }
virtual uint32_t GetCodecProfile() override {
assert(profile != STD_VIDEO_AV1_PROFILE_INVALID);
return static_cast<uint32_t>(profile);
}

virtual int8_t InitDpbCount() override;

Expand All @@ -138,7 +141,7 @@ struct EncoderConfigAV1 : public EncoderConfig {

bool ValidateLevel(uint32_t lLevel, uint32_t lTier);

bool DetermineLevelTier();
virtual bool DetermineLevelTier() override;

uint32_t GetLevelMaxBitrate(uint32_t lLevel, uint32_t lTier) {
if (lLevel < STD_VIDEO_AV1_LEVEL_4_0) {
Expand Down Expand Up @@ -185,8 +188,8 @@ struct EncoderConfigAV1 : public EncoderConfig {
return ((encodeWidth * encodeHeight * picSizeProfileFactor) >> 3);
}

StdVideoAV1Profile profile{ STD_VIDEO_AV1_PROFILE_MAIN };
StdVideoAV1Level level{ STD_VIDEO_AV1_LEVEL_5_0 };
StdVideoAV1Profile profile{ STD_VIDEO_AV1_PROFILE_INVALID };
StdVideoAV1Level level{ STD_VIDEO_AV1_LEVEL_INVALID };
uint8_t tier{};
VkVideoEncodeAV1CapabilitiesKHR av1EncodeCapabilities{ VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_CAPABILITIES_KHR };
VkVideoEncodeAV1QualityLevelPropertiesKHR av1QualityLevelProperties{ VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_QUALITY_LEVEL_PROPERTIES_KHR };
Expand Down
Loading