[FFmpeg-cvslog] vulkan_encode_h264: fix rate control VBV values

Lynne git at videolan.org
Fri Sep 27 10:56:04 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Fri Sep 27 09:49:35 2024 +0200| [934be0ff50fbe58aa44bc8a876f07195846d15ea] | committer: Lynne

vulkan_encode_h264: fix rate control VBV values

The values must be in milliseconds, not bytes.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=934be0ff50fbe58aa44bc8a876f07195846d15ea
---

 libavcodec/vulkan_encode_h264.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vulkan_encode_h264.c b/libavcodec/vulkan_encode_h264.c
index 9964ba5b8b..a0a00a3db2 100644
--- a/libavcodec/vulkan_encode_h264.c
+++ b/libavcodec/vulkan_encode_h264.c
@@ -130,12 +130,12 @@ static int init_pic_rc(AVCodecContext *avctx, FFHWBaseEncodePicture *pic,
         .consecutiveBFrameCount = FFMAX(ctx->base.b_per_p - 1, 0),
         .temporalLayerCount = 0,
     };
-
     rc_info->pNext = &hp->vkrc_info;
-    rc_info->virtualBufferSizeInMs = enc->unit_opts.hrd_buffer_size;
-    rc_info->initialVirtualBufferSizeInMs = enc->unit_opts.initial_buffer_fullness;
 
     if (rc_info->rateControlMode > VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) {
+        rc_info->virtualBufferSizeInMs = (enc->unit_opts.hrd_buffer_size * 1000LL) / avctx->bit_rate;
+        rc_info->initialVirtualBufferSizeInMs = (enc->unit_opts.initial_buffer_fullness * 1000LL) / avctx->bit_rate;
+
         hp->vkrc_layer_info = (VkVideoEncodeH264RateControlLayerInfoKHR) {
             .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_KHR,
 



More information about the ffmpeg-cvslog mailing list