summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorZhong Li <zhongli_dev@126.com>2021-12-21 23:22:25 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2021-12-23 15:49:07 +0800
commit7e4747ec504586658bf12a38c304659fa8d84a6a (patch)
tree3856d6d2da395848f3899628087d33376ed7a61e /libavcodec/qsvenc.c
parent0598b38e9316391c76da24cc0f8c11d5e0292ae7 (diff)
lavc/qsvenc: enable lookahead for hevc encoding
Update version based on the patch: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20211009015949.1510-1-haihao.xiang@intel.com/ Signed-off-by: Daniel Socek <daniel.socek@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index be5a541409..db6d397068 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -210,6 +210,11 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
av_log(avctx, AV_LOG_VERBOSE,
"BufferSizeInKB: %"PRIu16"; InitialDelayInKB: %"PRIu16"; TargetKbps: %"PRIu16"; MaxKbps: %"PRIu16"; BRCParamMultiplier: %"PRIu16"\n",
info->BufferSizeInKB, info->InitialDelayInKB, info->TargetKbps, info->MaxKbps, info->BRCParamMultiplier);
+#if QSV_HAVE_LA
+ if (info->RateControlMethod == MFX_RATECONTROL_VBR && q->extbrc && q->look_ahead_depth > 0 ) {
+ av_log(avctx, AV_LOG_VERBOSE, "LookAheadDepth: %"PRIu16"\n",co2->LookAheadDepth);
+ }
+#endif
} else if (info->RateControlMethod == MFX_RATECONTROL_CQP) {
av_log(avctx, AV_LOG_VERBOSE, "QPI: %"PRIu16"; QPP: %"PRIu16"; QPB: %"PRIu16"\n",
info->QPI, info->QPP, info->QPB);
@@ -742,6 +747,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
switch (q->param.mfx.RateControlMethod) {
case MFX_RATECONTROL_CBR:
case MFX_RATECONTROL_VBR:
+#if QSV_HAVE_LA
+ if (q->extbrc) {
+ q->extco2.LookAheadDepth = q->look_ahead_depth;
+ }
+#endif
#if QSV_HAVE_VCM
case MFX_RATECONTROL_VCM:
#endif