From 283c843da213985f8e446e47d03ee986800b13b4 Mon Sep 17 00:00:00 2001 From: Raju Konda Date: Mon, 18 Nov 2024 21:40:55 -0800 Subject: [PATCH] optimize choosing primary_ref_frame --- .../libs/VkVideoEncoder/VkEncoderDpbAV1.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vk_video_encoder/libs/VkVideoEncoder/VkEncoderDpbAV1.cpp b/vk_video_encoder/libs/VkVideoEncoder/VkEncoderDpbAV1.cpp index 647fffa..19b3779 100644 --- a/vk_video_encoder/libs/VkVideoEncoder/VkEncoderDpbAV1.cpp +++ b/vk_video_encoder/libs/VkVideoEncoder/VkEncoderDpbAV1.cpp @@ -416,6 +416,8 @@ VkVideoEncoderAV1PrimaryRefType VkEncDpbAV1::GetPrimaryRefType(StdVideoAV1Refere return GLD_FRAME; } else if (refName == STD_VIDEO_AV1_REFERENCE_NAME_BWDREF_FRAME) { return BRF_FRAME; + } else if (m_maxRefFramesL1 > 0) { + return INT_ARF_FRAME; } else { return REGULAR_FRAME; } @@ -431,6 +433,14 @@ int32_t VkEncDpbAV1::GetPrimaryRefBufId(VkVideoEncoderAV1PrimaryRefType primaryR refBufId = m_primaryRefBufIdMap[primaryRefType]; } + if (refBufId == VkEncDpbAV1::INVALID_IDX) { + if (primaryRefType == INT_ARF_FRAME) { + refBufId = m_primaryRefBufIdMap[ARF_FRAME]; + } else { + refBufId = m_primaryRefBufIdMap[(m_maxRefFramesL1 > 0) ? BRF_FRAME : REGULAR_FRAME]; + } + } + return refBufId; }