From: fei.w.wang-at-intel.com@ffmpeg.org
To: ffmpeg-devel@ffmpeg.org
Cc: fei.w.wang@intel.com
Subject: [FFmpeg-devel] [PATCH v1] lavc/vaapi_encode: Add VAAPI version check for BLBRC
Date: Thu, 28 Mar 2024 16:10:59 +0800
Message-ID: <20240328081059.1057387-1-fei.w.wang@intel.com> (raw)
From: Fei Wang <fei.w.wang@intel.com>
Fix build fail when VAAPI version less than 0.39.2.
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/vaapi_encode.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 940f0678a5..c4b5411e68 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1805,9 +1805,17 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
int i, first = 1, res;
supported_va_rc_modes = rc_attr.value;
- if (ctx->blbrc && !(supported_va_rc_modes & VA_RC_MB)) {
+ if (ctx->blbrc) {
+#if VA_CHECK_VERSION(0, 39, 2)
+ if (!(supported_va_rc_modes & VA_RC_MB)) {
+ ctx->blbrc = 0;
+ av_log(avctx, AV_LOG_WARNING, "Driver does not support BLBRC.\n");
+ }
+#else
ctx->blbrc = 0;
- av_log(avctx, AV_LOG_WARNING, "Driver does not support BLBRC.\n");
+ av_log(avctx, AV_LOG_WARNING, "Please consider to update to VAAPI 0.39.2 "
+ "or above, which can support BLBRC.\n");
+#endif
}
for (i = 0; i < FF_ARRAY_ELEMS(vaapi_encode_rc_modes); i++) {
@@ -2032,7 +2040,11 @@ rc_mode_found:
ctx->config_attributes[ctx->nb_config_attributes++] =
(VAConfigAttrib) {
.type = VAConfigAttribRateControl,
+#if VA_CHECK_VERSION(0, 39, 2)
.value = ctx->blbrc ? ctx->va_rc_mode | VA_RC_MB : ctx->va_rc_mode,
+#else
+ .value = ctx->va_rc_mode,
+#endif
};
}
@@ -2061,10 +2073,12 @@ rc_mode_found:
#if VA_CHECK_VERSION(1, 1, 0)
.ICQ_quality_factor = av_clip(rc_quality, 1, 51),
.max_qp = (avctx->qmax > 0 ? avctx->qmax : 0),
- .rc_flags.bits.mb_rate_control = ctx->blbrc ? 1 : 2,
#endif
#if VA_CHECK_VERSION(1, 3, 0)
.quality_factor = rc_quality,
+#endif
+#if VA_CHECK_VERSION(0, 39, 2)
+ .rc_flags.bits.mb_rate_control = ctx->blbrc ? 1 : 2,
#endif
};
vaapi_encode_add_global_param(avctx,
--
2.25.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".
next reply other threads:[~2024-03-28 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 8:10 fei.w.wang-at-intel.com [this message]
2024-03-29 1:10 fei.w.wang-at-intel.com
2024-04-01 6:01 ` Xiang, Haihao
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=20240328081059.1057387-1-fei.w.wang@intel.com \
--to=fei.w.wang-at-intel.com@ffmpeg.org \
--cc=fei.w.wang@intel.com \
--cc=ffmpeg-devel@ffmpeg.org \
/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