[FFmpeg-cvslog] vulkan_encode_h265: fix rate control VBV values
Lynne
git at videolan.org
Fri Sep 27 10:58:28 EEST 2024
ffmpeg | branch: release/7.1 | Lynne <dev at lynne.ee> | Fri Sep 27 09:52:14 2024 +0200| [9ada04faa3780c6360ffc6f354374e06bca00a8a] | committer: Lynne
vulkan_encode_h265: fix rate control VBV values
The values written were placeholder values.
(cherry picked from commit 81c6e6c9eeb2ced02654631dbe83d342e6b59505)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ada04faa3780c6360ffc6f354374e06bca00a8a
---
libavcodec/vulkan_encode_h265.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/vulkan_encode_h265.c b/libavcodec/vulkan_encode_h265.c
index 54bf071d78..6aadbc93fc 100644
--- a/libavcodec/vulkan_encode_h265.c
+++ b/libavcodec/vulkan_encode_h265.c
@@ -124,12 +124,12 @@ static int init_pic_rc(AVCodecContext *avctx, FFHWBaseEncodePicture *pic,
.consecutiveBFrameCount = FFMAX(ctx->base.b_per_p - 1, 0),
.subLayerCount = 0,
};
-
rc_info->pNext = &hp->vkrc_info;
- rc_info->virtualBufferSizeInMs = 1000;
- rc_info->initialVirtualBufferSizeInMs = 500;
if (rc_info->rateControlMode > VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) {
+ rc_info->virtualBufferSizeInMs = (enc->hrd_buffer_size * 1000LL) / avctx->bit_rate;
+ rc_info->initialVirtualBufferSizeInMs = (enc->initial_buffer_fullness * 1000LL) / avctx->bit_rate;
+
hp->vkrc_layer_info = (VkVideoEncodeH265RateControlLayerInfoKHR) {
.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_KHR,
More information about the ffmpeg-cvslog
mailing list