diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 380426b32d10ba482cee38a06be81bdca2c31eb8..9ca6fdd5158dfbd93ec723dae1d894e725c97dd4 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 555a79b768676e3e34dbdeea805ed1546379deec..12d72e6c7e2807dd39d3437e519107efad26c97b 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 b594cb2d1d2243ad8583acc57f05381a4fbb46f7..18e4240add73b7f2fe5d0e9e9d46337419ce6bef 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 ec4c366a12e6bfe77d4eec508a6babe48a16728c..c5c6c705ad34af4656f847a9b58e2487f0614507 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 9b138f52f90405a3194d5fa910566eff5e2119da..f1cea832ccd18bed39b91883e739715eb593ee32 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); } }