[FFmpeg-devel] [PATCH] lavc/qsvenc: set HRD buffer size

Zhong Li zhong.li at intel.com
Fri Dec 1 22:02:42 EET 2017


Hypothetical Reference Decoding (HRD) model assumes that data flows into a
buffer of the fixed size BufferSizeInKB with a constant bitrate.
BufferSizeInKB represents the maximum possible size of any compressed frames.

Signed-off-by: Zhong Li <zhong.li at intel.com>
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index c45b2a6..9283d40 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -429,7 +429,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
     q->param.mfx.NumSlice           = avctx->slices;
     q->param.mfx.NumRefFrame        = FFMAX(0, avctx->refs);
     q->param.mfx.EncodedOrder       = 0;
-    q->param.mfx.BufferSizeInKB     = 0;
+    q->param.mfx.BufferSizeInKB     = (avctx->rc_buffer_size > 0) ? avctx->rc_buffer_size / 8000 : 0;
 
     desc = av_pix_fmt_desc_get(sw_format);
     if (!desc)
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list