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

Zhong Li zhong.li at intel.com
Fri Dec 1 21:04:11 CET 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 9db9eb3..cdddfd9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -437,7 +437,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 libav-devel mailing list