From: Zhong Li <zhongli_dev@126.com> To: ffmpeg-devel@ffmpeg.org Cc: Haihao Xiang <haihao.xiang@intel.com>, Daniel Socek <daniel.socek@intel.com>, Zhong Li <zhongli_dev@126.com> Subject: [FFmpeg-devel] [PATCH 2/2] lavc/qsvenc: enable lookahead for hevc encoding Date: Tue, 21 Dec 2021 23:22:25 +0800 Message-ID: <20211221152225.23833-1-zhongli_dev@126.com> (raw) 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> --- libavcodec/qsvenc.c | 10 ++++++++++ libavcodec/qsvenc_hevc.c | 3 +++ 2 files changed, 13 insertions(+) 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 diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index b7b2f5633e..5847ea21f7 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -235,6 +235,9 @@ static const AVOption options[] = { { "load_plugins", "A :-separate list of hexadecimal plugin UIDs to load in an internal session", OFFSET(qsv.load_plugins), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VE }, +#if QSV_HAVE_LA + { "look_ahead_depth", "Depth of look ahead in number frames, available when extbrc option is enabled", OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, +#endif { "profile", NULL, OFFSET(qsv.profile), AV_OPT_TYPE_INT, { .i64 = MFX_PROFILE_UNKNOWN }, 0, INT_MAX, VE, "profile" }, { "unknown", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, VE, "profile" }, { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
reply other threads:[~2021-12-21 15:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211221152225.23833-1-zhongli_dev@126.com \ --to=zhongli_dev@126.com \ --cc=daniel.socek@intel.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=haihao.xiang@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git