From 5663221bdbb822bf4860765b080ac6eceb52df81 Mon Sep 17 00:00:00 2001 From: Ruijing Dong Date: Thu, 22 Feb 2024 14:42:29 -0500 Subject: [PATCH] radeonsi/vcn: data structure av1 enc long term reference. Here it borrowed the term "long term reference" to represent the customized reference frame rather than the default ones used. To enable that, it needs application to leverage VAAPI existing interface to mark a frame as "long term reference", and then it will be preserved in the DPB for later usage. This preserved frame later could be refered to by having its signature used in the ref_frame_idx[] list, and the index can be indicated by RefFrameCtrl index2, which has not been used for other purpose. Reviewed-by: Leo Liu Signed-off-by: Ruijing Dong Part-of: --- src/amd/common/ac_vcn_enc.h | 5 +++++ src/gallium/include/pipe/p_video_state.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/amd/common/ac_vcn_enc.h b/src/amd/common/ac_vcn_enc.h index 73f2154387e..589f690f5d7 100644 --- a/src/amd/common/ac_vcn_enc.h +++ b/src/amd/common/ac_vcn_enc.h @@ -200,6 +200,8 @@ #define RENCODE_COLOR_SPACE_YUV 0 #define RENCODE_COLOR_SPACE_RGB 1 +#define RENCODE_VCN4_AV1_MAX_NUM_LTR 2 + typedef struct rvcn_enc_session_info_s { uint32_t interface_version; uint32_t sw_context_address_hi; @@ -611,10 +613,13 @@ typedef struct rvcn_enc_av1_color_description_s typedef struct rvcn_enc_av1_ref_frame_s { bool in_use; + bool is_ltr; uint32_t frame_id; uint32_t temporal_id; uint32_t slot_id; uint32_t frame_type; + uint32_t ltr_seq; + void *frame_signature; } rvcn_enc_av1_ref_frame_t; typedef struct rvcn_enc_av1_recon_slot_s diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index e2b2f9dd434..9f225494260 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -996,6 +996,7 @@ struct pipe_av1_enc_picture_desc uint32_t use_superres:1; uint32_t reduced_tx_set:1; uint32_t skip_mode_present:1; + uint32_t long_term_reference:1; }; struct pipe_enc_quality_modes quality_modes; struct pipe_enc_intra_refresh intra_refresh; @@ -1028,6 +1029,9 @@ struct pipe_av1_enc_picture_desc uint32_t primary_ref_frame; uint8_t refresh_frame_flags; uint8_t ref_frame_idx[7]; + uint32_t ref_frame_ctrl_l0; /* forward prediction only */ + void *ref_list[8]; /* for tracking ref frames */ + void *recon_frame; struct { uint8_t cdef_damping_minus_3;