[FFmpeg-devel] [PATCH] lavc/vaapi_encode_av1: Always use slot 0 with 1 l0 ref

David Rosca nowrep at gmail.com
Wed Jan 15 23:39:49 EET 2025


Don't need to alternate when only one reference is used.
Fixes fail after bf9f921ef7 ("avcodec/hw_base_encode: restrict size of next_prev")
due to AV1 writer complaining about incorrect ref_order_hint value.
---
 libavcodec/vaapi_encode_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c
index 1b350cd936..aca6c26aa2 100644
--- a/libavcodec/vaapi_encode_av1.c
+++ b/libavcodec/vaapi_encode_av1.c
@@ -504,7 +504,7 @@ static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx,
         fh->base_q_idx = priv->q_idx_p;
         ref = pic->refs[0][pic->nb_refs[0] - 1];
         href = ref->codec_priv;
-        hpic->slot = !href->slot;
+        hpic->slot = ctx->base.ref_l0 > 1 ? !href->slot : 0;
         hpic->last_idr_frame = href->last_idr_frame;
         fh->refresh_frame_flags = 1 << hpic->slot;
 
-- 
2.48.1



More information about the ffmpeg-devel mailing list