The branch, master has been updated
via a0936b9769718f13662812eb9ea4ae377916c6a8 (commit)
from c6297b689f1a0ec28d45a9991bc02127e7a2abbd (commit)
- Log -----------------------------------------------------------------
commit a0936b9769718f13662812eb9ea4ae377916c6a8
Author: Cameron Gutman <[email protected]>
AuthorDate: Tue Apr 1 23:11:20 2025 -0500
Commit: Tong Wu <[email protected]>
CommitDate: Wed Sep 17 06:40:16 2025 +0000
avcodec/vaapi_encode: skip AVBR if HRD parameters are set
AVBR does not use VAEncMiscParameterTypeHRD, so attempting to set
rc_buffer_size and bit_rate together will cause the rc_buffer_size
to be ignored if the VAAPI driver supports AVBR. We should prefer
regular VBR for that case.
Signed-off-by: Cameron Gutman <[email protected]>
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 8960e6b20a..ed62347c06 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1294,7 +1294,8 @@ static av_cold int
vaapi_encode_init_rate_control(AVCodecContext *avctx)
// * If bitrate and quality are both set, try QVBR.
// * If quality is set, try ICQ, then CQP.
// * If bitrate and maxrate are set and have the same value, try CBR.
- // * If a bitrate is set, try AVBR, then VBR, then CBR.
+ // * If bitrate is set and RC buffer size/occupancy is not, try AVBR.
+ // * If a bitrate is set, try VBR, then CBR.
// * If no bitrate is set, try ICQ, then CQP.
#define TRY_RC_MODE(mode, fail) do { \
@@ -1338,7 +1339,10 @@ static av_cold int
vaapi_encode_init_rate_control(AVCodecContext *avctx)
TRY_RC_MODE(RC_MODE_CBR, 0);
if (avctx->bit_rate > 0) {
- TRY_RC_MODE(RC_MODE_AVBR, 0);
+ // AVBR does not enforce RC buffer constraints
+ if (!avctx->rc_buffer_size && !avctx->rc_initial_buffer_occupancy)
+ TRY_RC_MODE(RC_MODE_AVBR, 0);
+
TRY_RC_MODE(RC_MODE_VBR, 0);
TRY_RC_MODE(RC_MODE_CBR, 0);
} else {
-----------------------------------------------------------------------
Summary of changes:
libavcodec/vaapi_encode.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]