This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 426841da9d avcodec/vulkan_encode: speed up hevc_vulkan with encode
optimizations
426841da9d is described below
commit 426841da9d9167781007e4238583a7c0da5f04c4
Author: Tymur Boiko <[email protected]>
AuthorDate: Wed Aug 12 17:55:58 2026 +0200
Commit: Lynne <[email protected]>
CommitDate: Mon Aug 17 06:48:49 2026 +0000
avcodec/vulkan_encode: speed up hevc_vulkan with encode optimizations
Without ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS and with min CU forced to
8x8, hevc_vulkan keeps a much heavier encode config at common quality
levels than h264_vulkan (16x16 macroblocks, no min-CU SPS field). Set
the session flag and use min CU 16x16 when CTB >= 32; also fix
max_transform_hierarchy_depth_inter assignment.
When applying GetEncoded SPS feedback, sync overridden fields together
(extent/conf_win, min/diff CU and TB sizes, transform hierarchy). Copying
only log2_diff left CtbLog2SizeY=7 and undecodable HEVC after some
implementations rewrote min CU.
Reporter cmd (1080p testsrc2, quality 1, 1000 frames):
before: hevc ~200–317 fps vs higher h264
after: hevc 289/325/358 fps, h264 288/317/359 fps (parity)
---
libavcodec/vulkan_encode.c | 2 +-
libavcodec/vulkan_encode_h265.c | 27 +++++++++++++++++++++++----
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/libavcodec/vulkan_encode.c b/libavcodec/vulkan_encode.c
index 74e1082353..eac9767351 100644
--- a/libavcodec/vulkan_encode.c
+++ b/libavcodec/vulkan_encode.c
@@ -1108,7 +1108,7 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx,
FFVulkanEncodeContext *
/* Create session */
session_create.pVideoProfile = &ctx->profile;
- session_create.flags = 0x0;
+ session_create.flags =
VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR;
session_create.queueFamilyIndex = ctx->qf_enc->idx;
session_create.maxCodedExtent = ctx->caps.maxCodedExtent;
session_create.maxDpbSlots = ctx->caps.maxDpbSlots;
diff --git a/libavcodec/vulkan_encode_h265.c b/libavcodec/vulkan_encode_h265.c
index 7ed0fdbe77..6ca46ac3a2 100644
--- a/libavcodec/vulkan_encode_h265.c
+++ b/libavcodec/vulkan_encode_h265.c
@@ -793,14 +793,21 @@ static av_cold int init_sequence_headers(AVCodecContext
*avctx)
else if (enc->caps.transformBlockSizes &
VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_KHR)
max_tb_size = 4;
- units->raw_sps.log2_min_luma_coding_block_size_minus3 = 0;
- units->raw_sps.log2_diff_max_min_luma_coding_block_size =
av_log2(max_ctb_size) - 3;
+ /* Prefer 16x16 min CU when the CTB is at least 32; 8x8 min CU is much
+ * more expensive on some implementations for the common quality levels. */
+ if (max_ctb_size >= 32) {
+ units->raw_sps.log2_min_luma_coding_block_size_minus3 = 1;
+ units->raw_sps.log2_diff_max_min_luma_coding_block_size =
av_log2(max_ctb_size) - 4;
+ } else {
+ units->raw_sps.log2_min_luma_coding_block_size_minus3 = 0;
+ units->raw_sps.log2_diff_max_min_luma_coding_block_size =
av_log2(max_ctb_size) - 3;
+ }
units->raw_sps.log2_min_luma_transform_block_size_minus2 =
av_log2(min_tb_size) - 2;
units->raw_sps.log2_diff_max_min_luma_transform_block_size =
av_log2(max_tb_size) - av_log2(min_tb_size);
max_transform_hierarchy = av_log2(max_ctb_size) - av_log2(min_tb_size);
units->raw_sps.max_transform_hierarchy_depth_intra =
max_transform_hierarchy;
- units->raw_sps.max_transform_hierarchy_depth_intra =
max_transform_hierarchy;
+ units->raw_sps.max_transform_hierarchy_depth_inter =
max_transform_hierarchy;
units->raw_sps.vui.bitstream_restriction_flag = 0;
units->raw_sps.vui.max_bytes_per_pic_denom = 2;
@@ -1227,7 +1234,19 @@ static int parse_feedback_units(AVCodecContext *avctx,
H265RawSPS *sps = au.units[i].content;
enc->units.raw_sps.pic_width_in_luma_samples =
sps->pic_width_in_luma_samples;
enc->units.raw_sps.pic_height_in_luma_samples =
sps->pic_height_in_luma_samples;
- enc->units.raw_sps.log2_diff_max_min_luma_coding_block_size =
sps->log2_diff_max_min_luma_coding_block_size;
+ enc->units.raw_sps.conformance_window_flag =
sps->conformance_window_flag;
+ enc->units.raw_sps.conf_win_left_offset =
sps->conf_win_left_offset;
+ enc->units.raw_sps.conf_win_right_offset =
sps->conf_win_right_offset;
+ enc->units.raw_sps.conf_win_top_offset =
sps->conf_win_top_offset;
+ enc->units.raw_sps.conf_win_bottom_offset =
sps->conf_win_bottom_offset;
+ enc->units.raw_sps.log2_min_luma_coding_block_size_minus3 =
+ sps->log2_min_luma_coding_block_size_minus3;
+ enc->units.raw_sps.log2_diff_max_min_luma_coding_block_size =
+ sps->log2_diff_max_min_luma_coding_block_size;
+ enc->units.raw_sps.log2_min_luma_transform_block_size_minus2 =
+ sps->log2_min_luma_transform_block_size_minus2;
+ enc->units.raw_sps.log2_diff_max_min_luma_transform_block_size
=
+ sps->log2_diff_max_min_luma_transform_block_size;
enc->units.raw_sps.max_transform_hierarchy_depth_inter =
sps->max_transform_hierarchy_depth_inter;
enc->units.raw_sps.max_transform_hierarchy_depth_intra =
sps->max_transform_hierarchy_depth_intra;
}
--
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]