From c2d000ec27af1a5cd5341a67e941e0313879ab18 Mon Sep 17 00:00:00 2001 From: Linjie Fu Date: Wed, 11 Mar 2020 18:39:28 +0800 Subject: lavc/qsvenc_hevc: add qmax/qmin support for HEVC encoding Add qmax/qmin support for HEVC software bitrate control(SWBRC). Limitations: - RateControlMethod != MFX_RATECONTROL_CQP - with EXTBRC ON Signed-off-by: Dmitry Rogozhkin Signed-off-by: Linjie Fu Signed-off-by: Zhong Li --- libavcodec/qsvenc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'libavcodec/qsvenc.c') diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index ed4539f697..1ed8f5d973 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -735,6 +735,11 @@ FF_ENABLE_DEPRECATION_WARNINGS if (q->adaptive_b >= 0) q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; #endif + } + + if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) { + if (q->extbrc >= 0) + q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; #if QSV_VERSION_ATLEAST(1, 9) if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) { @@ -750,12 +755,6 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extco2.MaxQPP = q->extco2.MaxQPB = q->extco2.MaxQPI; } #endif - } - - if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) { - if (q->extbrc >= 0) - q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; - q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; q->extco2.Header.BufferSz = sizeof(q->extco2); -- cgit v1.2.3