From 750e4a4abfb3fe081f435fb3cdb7dbd15cccb214 Mon Sep 17 00:00:00 2001 From: Hendry <hendry197@gmail.com> Date: Mon, 9 Mar 2020 16:28:17 -0700 Subject: [PATCH] Fix the encoder for selecting RPL idx when the max distance between current pic and ref pic never be greater than GOP size --- source/Lib/EncoderLib/EncLib.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index b97a0b312..96639464b 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -2222,8 +2222,9 @@ void EncLib::getActiveRefPicListNumForPOC(const SPS *sps, int POCCurr, int GOPid { if (POCCurr < (2 * m_iGOPSize + 2)) { - rpl0Idx = POCCurr + m_iGOPSize - 1; - rpl1Idx = POCCurr + m_iGOPSize - 1; + int candidateIdx = (POCCurr + m_iGOPSize - 1 >= fullListNum + partialListNum) ? GOPid : POCCurr + m_iGOPSize - 1; + rpl0Idx = candidateIdx; + rpl1Idx = candidateIdx; } else { @@ -2284,8 +2285,9 @@ void EncLib::selectReferencePictureList(Slice* slice, int POCCurr, int GOPid, in { if (POCCurr < (2 * m_iGOPSize + 2)) { - slice->setRPL0idx(POCCurr + m_iGOPSize - 1); - slice->setRPL1idx(POCCurr + m_iGOPSize - 1); + int candidateIdx = (POCCurr + m_iGOPSize - 1 >= fullListNum + partialListNum) ? GOPid : POCCurr + m_iGOPSize - 1; + slice->setRPL0idx(candidateIdx); + slice->setRPL1idx(candidateIdx); } else { -- GitLab