From d94e8abafda0f8b84279e0a7ceda2e217a1d1a35 Mon Sep 17 00:00:00 2001 From: Vadim Seregin <vseregin@qti.qualcomm.com> Date: Tue, 31 May 2022 13:05:56 +0000 Subject: [PATCH] Fix: Add SPS for extendPicBorder --- source/Lib/CommonLib/CodingStructure.cpp | 24 ------------------------ source/Lib/CommonLib/Picture.cpp | 6 +++++- source/Lib/CommonLib/Picture.h | 4 ++++ source/Lib/CommonLib/Slice.cpp | 15 +++++++++++++++ source/Lib/EncoderLib/EncGOP.cpp | 16 ++++++++++++++++ 5 files changed, 40 insertions(+), 25 deletions(-) diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 380426b32..9ca6fdd51 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -590,34 +590,16 @@ bool CodingStructure::isClean(const TransformUnit &tu) const #if JVET_Z0118_GDR void CodingStructure::updateReconMotIPM(const UnitArea &uarea) const { - if (!sps->getGDREnabledFlag()) - { - picture->getRecoBuf(uarea).copyFrom(getRecoBuf(uarea)); - return; - } - updateReconMotIPM(uarea, getRecoBuf(uarea)); } void CodingStructure::updateReconMotIPM(const CompArea &carea) const { - if (!sps->getGDREnabledFlag()) - { - picture->getRecoBuf(carea).copyFrom(getRecoBuf(carea)); - return; - } - updateReconMotIPM(carea, getRecoBuf(carea)); } void CodingStructure::updateReconMotIPM(const UnitArea &uarea, const CPelUnitBuf &pbuf) const { - if (!sps->getGDREnabledFlag()) - { - picture->getRecoBuf(uarea).copyFrom(pbuf); - return; - } - for (int i = 0; i < MAX_NUM_COMPONENT; i++) { ComponentID compID = (ComponentID)i; @@ -630,12 +612,6 @@ void CodingStructure::updateReconMotIPM(const UnitArea &uarea, const CPelUnitBuf void CodingStructure::updateReconMotIPM(const CompArea &carea, const CPelBuf &pbuf) const { - if (!sps->getGDREnabledFlag()) - { - picture->getRecoBuf(carea).copyFrom(pbuf); - return; - } - const ComponentID compID = carea.compID; if (!isInGdrIntervalOrRecoveryPoc()) diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 555a79b76..12d72e6c7 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -1193,7 +1193,11 @@ void Picture::restoreSubPicBorder(int POC, int subPicX0, int subPicY0, int subPi m_bufWrapSubPicBelow.destroy(); } +#if JVET_Z0118_GDR +void Picture::extendPicBorder( const SPS *sps, const PPS *pps ) +#else void Picture::extendPicBorder( const PPS *pps ) +#endif { if ( m_bIsBorderExtended ) { @@ -1206,7 +1210,7 @@ void Picture::extendPicBorder( const PPS *pps ) #if JVET_Z0118_GDR int numPt = PIC_RECONSTRUCTION_0; - if (cs->slice->getSPS()->getGDREnabledFlag()) + if (sps->getGDREnabledFlag()) { numPt = PIC_RECONSTRUCTION_1; } diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index b594cb2d1..18e4240ad 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -149,7 +149,11 @@ struct Picture : public UnitArea PelUnitBuf getBuf(const UnitArea &unit, const PictureType &type); const CPelUnitBuf getBuf(const UnitArea &unit, const PictureType &type) const; +#if JVET_Z0118_GDR + void extendPicBorder( const SPS *sps, const PPS *pps ); +#else void extendPicBorder( const PPS *pps ); +#endif void extendWrapBorder( const PPS *pps ); void finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHeader *picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps ); diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index ec4c366a1..c5c6c705a 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -852,7 +852,12 @@ void Slice::constructRefPicList(PicList& rcListPic) pcRefPic = xGetLongTermRefPic( rcListPic, ltrpPoc, m_localRPL0.getDeltaPocMSBPresentFlag( ii ), m_pcPic->layerId ); pcRefPic->longTerm = true; } + +#if JVET_Z0118_GDR + pcRefPic->extendPicBorder( getSPS(), getPPS() ); +#else pcRefPic->extendPicBorder( getPPS() ); +#endif m_apcRefPicList[REF_PIC_LIST_0][ii] = pcRefPic; m_bIsUsedAsLongTerm[REF_PIC_LIST_0][ii] = pcRefPic->longTerm; } @@ -892,7 +897,12 @@ void Slice::constructRefPicList(PicList& rcListPic) pcRefPic = xGetLongTermRefPic( rcListPic, ltrpPoc, m_localRPL1.getDeltaPocMSBPresentFlag( ii ), m_pcPic->layerId ); pcRefPic->longTerm = true; } + +#if JVET_Z0118_GDR + pcRefPic->extendPicBorder( getSPS(), getPPS() ); +#else pcRefPic->extendPicBorder( getPPS() ); +#endif m_apcRefPicList[REF_PIC_LIST_1][ii] = pcRefPic; m_bIsUsedAsLongTerm[REF_PIC_LIST_1][ii] = pcRefPic->longTerm; } @@ -5086,7 +5096,12 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling, sps->getHorCollocatedChromaFlag(), sps->getVerCollocatedChromaFlag() ); scaledRefPic[j]->unscaledPic = m_apcRefPicList[refList][rIdx]; + +#if JVET_Z0118_GDR + scaledRefPic[j]->extendPicBorder( getSPS(), getPPS() ); +#else scaledRefPic[j]->extendPicBorder( getPPS() ); +#endif m_scaledRefPicList[refList][rIdx] = scaledRefPic[j]; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 9b138f52f..f1cea832c 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -5962,7 +5962,11 @@ void EncGOP::updateCompositeReference(Slice* pcSlice, PicList& rcListPic, int po // Update background reference if (pcSlice->isIRAP())//(pocCurr == 0) { +#if JVET_Z0118_GDR + curPic->extendPicBorder( pcSlice->getSPS(), pcSlice->getPPS() ); +#else curPic->extendPicBorder( pcSlice->getPPS() ); +#endif curPic->setBorderExtension(true); m_picBg->getRecoBuf().copyFrom(curPic->getRecoBuf()); @@ -6001,15 +6005,27 @@ void EncGOP::updateCompositeReference(Slice* pcSlice, PicList& rcListPic, int po } } m_picBg->setBorderExtension(false); +#if JVET_Z0118_GDR + m_picBg->extendPicBorder( pcSlice->getSPS(), pcSlice->getPPS() ); +#else m_picBg->extendPicBorder( pcSlice->getPPS() ); +#endif m_picBg->setBorderExtension(true); +#if JVET_Z0118_GDR + curPic->extendPicBorder( pcSlice->getSPS(), pcSlice->getPPS() ); +#else curPic->extendPicBorder( pcSlice->getPPS() ); +#endif curPic->setBorderExtension(true); m_picOrig->getOrigBuf().copyFrom(curPic->getOrigBuf()); m_picBg->setBorderExtension(false); +#if JVET_Z0118_GDR + m_picBg->extendPicBorder( pcSlice->getSPS(), pcSlice->getPPS() ); +#else m_picBg->extendPicBorder( pcSlice->getPPS() ); +#endif m_picBg->setBorderExtension(true); } } -- GitLab