This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 8db0d5b0046bbb6f33eab4554c42a0d7ab82dc56
Author:     Uraza Aru <[email protected]>
AuthorDate: Wed Oct 14 02:14:02 2026 +0500
Commit:     Lynne <[email protected]>
CommitDate: Sat Nov 7 08:36:02 2026 +0000

    avcodec/vulkan_encode_av1: name the second P reference consistently
    
    For P frames with two references, ref_frame_idx[] puts the older
    reference under GOLDEN and points every other name, LAST2 included, at
    the newest one. set_name_slot() however gives the older reference the
    first free allowed name, LAST2, in referenceNameSlotIndices. The
    encoder then predicts LAST2 blocks from the older picture while
    decoders, following the frame header, use the newer one, and the
    picture drifts: on an RTX 4090, 1280x720 CBR 10 Mbit/s without B-frames
    fell from 44.8 dB PSNR on the key frame to 12.8 dB by frame 299.
    
    Index ref_frame_idx[] with the name set_name_slot() returns, so both
    mappings agree. The B-frame branch already keeps them in step.
    
    Fixes #25046.
    
    Assisted-by: Claude Opus 5.5
    Signed-off-by: Uraza Aru <[email protected]>
---
 libavcodec/vulkan_encode_av1.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vulkan_encode_av1.c b/libavcodec/vulkan_encode_av1.c
index 379b9f2eb9..9f864732df 100644
--- a/libavcodec/vulkan_encode_av1.c
+++ b/libavcodec/vulkan_encode_av1.c
@@ -188,6 +188,7 @@ static int init_pic_params(AVCodecContext *avctx, 
FFHWBaseEncodePicture *pic,
 
     uint32_t ref_name_mask = 0x0;
     int name_slots[STD_VIDEO_AV1_REFS_PER_FRAME];
+    int name;
 
     StdVideoAV1Segmentation *segmentation = &ap->segmentation;
     StdVideoAV1LoopFilter  *loop_filter = &ap->loop_filter;
@@ -397,10 +398,10 @@ static int init_pic_params(AVCodecContext *avctx, 
FFHWBaseEncodePicture *pic,
             }
             ref = pic->refs[0][pic->nb_refs[0] - 2];
             ap_ref = ref->codec_priv;
-            ap->av1pic_info.ref_frame_idx[3] = ap_ref->slot;
             ap->av1pic_info.ref_order_hint[ap_ref->slot] = ref->display_order 
- ap_ref->last_idr_frame;
-//            vpic->ref_frame_ctrl_l0.fields.search_idx1 = 
AV1_REF_FRAME_GOLDEN;
-            set_name_slot(ap_ref->av1pic_info.current_frame_id, name_slots, 
ref_name_mask, 0);
+            /* The header must name the same reference the encoder uses for 
it. */
+            name = set_name_slot(ap_ref->av1pic_info.current_frame_id, 
name_slots, ref_name_mask, 0);
+            ap->av1pic_info.ref_frame_idx[name] = ap_ref->slot;
         }
         break;
     case FF_HW_PICTURE_TYPE_B:

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to