diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 4aafcc33fbc47a388659af040940282d1f575bb2..6227841ed07808c0dc0cc37a94e545d63c820bc4 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -216,22 +216,14 @@ void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SP *getLocalRPL0() = *picHeader->getLocalRPL0(); if(getRPL0idx() != -1) { - setRPL0(sps->getRPLList0()->getReferencePictureList(getRPL0idx())); - } - else - { - setRPL0(getLocalRPL0()); + *getLocalRPL0() = *sps->getRPLList0()->getReferencePictureList(getRPL0idx()); } setRPL1idx( picHeader->getRPL1idx() ); *getLocalRPL1() = *picHeader->getLocalRPL1(); if(getRPL1idx() != -1) { - setRPL1(sps->getRPLList1()->getReferencePictureList(getRPL1idx())); - } - else - { - setRPL1(getLocalRPL1()); + *getLocalRPL1() = *sps->getRPLList1()->getReferencePictureList(getRPL1idx()); } } @@ -492,22 +484,22 @@ void Slice::constructRefPicList(PicList& rcListPic) for (int ii = 0; ii < numOfActiveRef; ii++) { - if( m_pRPL0->isInterLayerRefPic( ii ) ) + if( m_localRPL0.isInterLayerRefPic( ii ) ) { - CHECK( m_pRPL0->getInterLayerRefPicIdx( ii ) == NOT_VALID, "Wrong ILRP index" ); + CHECK( m_localRPL0.getInterLayerRefPicIdx( ii ) == NOT_VALID, "Wrong ILRP index" ); - int refLayerId = m_pcPic->cs->vps->getLayerId( m_pcPic->cs->vps->getDirectRefLayerIdx( layerIdx, m_pRPL0->getInterLayerRefPicIdx( ii ) ) ); + int refLayerId = m_pcPic->cs->vps->getLayerId( m_pcPic->cs->vps->getDirectRefLayerIdx( layerIdx, m_localRPL0.getInterLayerRefPicIdx( ii ) ) ); pcRefPic = xGetRefPic( rcListPic, getPOC(), refLayerId ); pcRefPic->longTerm = true; } else - if (!m_pRPL0->isRefPicLongterm(ii)) + if (!m_localRPL0.isRefPicLongterm(ii)) { #if JVET_S0045_SIGN - pcRefPic = xGetRefPic(rcListPic, getPOC() + m_pRPL0->getRefPicIdentifier(ii), m_pcPic->layerId); + pcRefPic = xGetRefPic(rcListPic, getPOC() + m_localRPL0.getRefPicIdentifier(ii), m_pcPic->layerId); #else - pcRefPic = xGetRefPic( rcListPic, getPOC() - m_pRPL0->getRefPicIdentifier( ii ), m_pcPic->layerId ); + pcRefPic = xGetRefPic( rcListPic, getPOC() - m_localRPL0.getRefPicIdentifier( ii ), m_pcPic->layerId ); #endif pcRefPic->longTerm = false; } @@ -515,7 +507,7 @@ void Slice::constructRefPicList(PicList& rcListPic) { int pocBits = getSPS()->getBitsForPOC(); int pocMask = (1 << pocBits) - 1; - int ltrpPoc = m_pRPL0->getRefPicIdentifier(ii) & pocMask; + int ltrpPoc = m_localRPL0.getRefPicIdentifier(ii) & pocMask; if(m_localRPL0.getDeltaPocMSBPresentFlag(ii)) { ltrpPoc += getPOC() - m_localRPL0.getDeltaPocMSBCycleLT(ii) * (pocMask + 1) - (getPOC() & pocMask); @@ -532,22 +524,22 @@ void Slice::constructRefPicList(PicList& rcListPic) numOfActiveRef = getNumRefIdx(REF_PIC_LIST_1); for (int ii = 0; ii < numOfActiveRef; ii++) { - if( m_pRPL1->isInterLayerRefPic( ii ) ) + if( m_localRPL1.isInterLayerRefPic( ii ) ) { - CHECK( m_pRPL1->getInterLayerRefPicIdx( ii ) == NOT_VALID, "Wrong ILRP index" ); + CHECK( m_localRPL1.getInterLayerRefPicIdx( ii ) == NOT_VALID, "Wrong ILRP index" ); - int refLayerId = m_pcPic->cs->vps->getLayerId( m_pcPic->cs->vps->getDirectRefLayerIdx( layerIdx, m_pRPL1->getInterLayerRefPicIdx( ii ) ) ); + int refLayerId = m_pcPic->cs->vps->getLayerId( m_pcPic->cs->vps->getDirectRefLayerIdx( layerIdx, m_localRPL1.getInterLayerRefPicIdx( ii ) ) ); pcRefPic = xGetRefPic( rcListPic, getPOC(), refLayerId ); pcRefPic->longTerm = true; } else - if (!m_pRPL1->isRefPicLongterm(ii)) + if (!m_localRPL1.isRefPicLongterm(ii)) { #if JVET_S0045_SIGN - pcRefPic = xGetRefPic(rcListPic, getPOC() + m_pRPL1->getRefPicIdentifier(ii), m_pcPic->layerId); + pcRefPic = xGetRefPic(rcListPic, getPOC() + m_localRPL1.getRefPicIdentifier(ii), m_pcPic->layerId); #else - pcRefPic = xGetRefPic( rcListPic, getPOC() - m_pRPL1->getRefPicIdentifier( ii ), m_pcPic->layerId ); + pcRefPic = xGetRefPic( rcListPic, getPOC() - m_localRPL1.getRefPicIdentifier( ii ), m_pcPic->layerId ); #endif pcRefPic->longTerm = false; } @@ -555,7 +547,7 @@ void Slice::constructRefPicList(PicList& rcListPic) { int pocBits = getSPS()->getBitsForPOC(); int pocMask = (1 << pocBits) - 1; - int ltrpPoc = m_pRPL1->getRefPicIdentifier(ii) & pocMask; + int ltrpPoc = m_localRPL1.getRefPicIdentifier(ii) & pocMask; if(m_localRPL1.getDeltaPocMSBPresentFlag(ii)) { ltrpPoc += getPOC() - m_localRPL1.getDeltaPocMSBCycleLT(ii) * (pocMask + 1) - (getPOC() & pocMask); @@ -1139,8 +1131,8 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) if( cpyAlmostAll ) m_iDepth = pSrc->m_iDepth; // access channel - if (cpyAlmostAll) m_pRPL0 = pSrc->m_pRPL0; - if (cpyAlmostAll) m_pRPL1 = pSrc->m_pRPL1; + if (cpyAlmostAll) m_localRPL0 = pSrc->m_localRPL0; + if (cpyAlmostAll) m_localRPL1 = pSrc->m_localRPL1; m_iLastIDR = pSrc->m_iLastIDR; if( cpyAlmostAll ) m_pcPic = pSrc->m_pcPic; @@ -2770,8 +2762,6 @@ PicHeader::PicHeader() , m_numVerVirtualBoundaries ( 0 ) , m_numHorVirtualBoundaries ( 0 ) , m_picOutputFlag ( true ) -, m_pRPL0 ( 0 ) -, m_pRPL1 ( 0 ) , m_rpl0Idx ( 0 ) , m_rpl1Idx ( 0 ) , m_splitConsOverrideFlag ( 0 ) @@ -2862,8 +2852,6 @@ void PicHeader::initPicHeader() m_numVerVirtualBoundaries = 0; m_numHorVirtualBoundaries = 0; m_picOutputFlag = true; - m_pRPL0 = 0; - m_pRPL1 = 0; m_rpl0Idx = 0; m_rpl1Idx = 0; m_splitConsOverrideFlag = 0; diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 84df6e13445d30947a97124d2d8d81cc4c84651c..37d61bbb5da1aa98cdaa7089734650a537833db2 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -2502,9 +2502,6 @@ private: unsigned m_virtualBoundariesPosX[3]; //!< horizontal virtual boundary positions unsigned m_virtualBoundariesPosY[3]; //!< vertical virtual boundary positions bool m_picOutputFlag; //!< picture output flag - const ReferencePictureList - *m_pRPL0; //!< pointer to RPL for L0, either in the SPS or the local RPS in the picture header - const ReferencePictureList* m_pRPL1; //!< pointer to RPL for L1, either in the SPS or the local RPS in the picture header ReferencePictureList m_localRPL0; //!< RPL for L0 when present in picture header ReferencePictureList m_localRPL1; //!< RPL for L1 when present in picture header int m_rpl0Idx; //!< index of used RPL in the SPS or -1 for local RPL in the picture header @@ -2602,15 +2599,12 @@ public: unsigned getVirtualBoundariesPosY(unsigned idx) const { CHECK( idx >= 3, "boundary index exceeds valid range" ); return m_virtualBoundariesPosY[idx];} void setPicOutputFlag( bool b ) { m_picOutputFlag = b; } bool getPicOutputFlag() const { return m_picOutputFlag; } - void setRPL( bool b, const ReferencePictureList *pcRPL) { if(b==1) { m_pRPL1 = pcRPL; } else { m_pRPL0 = pcRPL; } } - const ReferencePictureList* getRPL( bool b ) { return b==1 ? m_pRPL1 : m_pRPL0; } + const ReferencePictureList* getRPL( bool b ) { return getLocalRPL(b); } ReferencePictureList* getLocalRPL( bool b ) { return b==1 ? &m_localRPL1 : &m_localRPL0; } void setRPLIdx( bool b, int rplIdx) { if(b==1) { m_rpl1Idx = rplIdx; } else { m_rpl0Idx = rplIdx; } } int getRPLIdx( bool b ) const { return b==1 ? m_rpl1Idx : m_rpl0Idx; } - void setRPL0(const ReferencePictureList *pcRPL) { m_pRPL0 = pcRPL; } - void setRPL1(const ReferencePictureList *pcRPL) { m_pRPL1 = pcRPL; } - const ReferencePictureList* getRPL0() { return m_pRPL0; } - const ReferencePictureList* getRPL1() { return m_pRPL1; } + const ReferencePictureList* getRPL0() { return getLocalRPL0(); } + const ReferencePictureList* getRPL1() { return getLocalRPL1(); } ReferencePictureList* getLocalRPL0() { return &m_localRPL0; } ReferencePictureList* getLocalRPL1() { return &m_localRPL1; } void setRPL0idx(int rplIdx) { m_rpl0Idx = rplIdx; } @@ -2775,8 +2769,6 @@ private: bool m_useLTforDRAP; bool m_isDRAP; int m_latestDRAPPOC; - const ReferencePictureList* m_pRPL0; //< pointer to RPL for L0, either in the SPS or the local RPS in the same slice header - const ReferencePictureList* m_pRPL1; //< pointer to RPL for L1, either in the SPS or the local RPS in the same slice header ReferencePictureList m_localRPL0; //< RPL for L0 when present in slice header ReferencePictureList m_localRPL1; //< RPL for L1 when present in slice header int m_rpl0Idx; //< index of used RPL in the SPS or -1 for local RPL in the slice header @@ -2904,10 +2896,8 @@ public: APS** getAlfAPSs() { return m_alfApss; } void setSaoEnabledFlag(ChannelType chType, bool s) {m_saoEnabledFlag[chType] =s; } bool getSaoEnabledFlag(ChannelType chType) const { return m_saoEnabledFlag[chType]; } - void setRPL0(const ReferencePictureList *pcRPL) { m_pRPL0 = pcRPL; } - void setRPL1(const ReferencePictureList *pcRPL) { m_pRPL1 = pcRPL; } - const ReferencePictureList* getRPL0() { return m_pRPL0; } - const ReferencePictureList* getRPL1() { return m_pRPL1; } + const ReferencePictureList* getRPL0() { return getLocalRPL0(); } + const ReferencePictureList* getRPL1() { return getLocalRPL1(); } ReferencePictureList* getLocalRPL0() { return &m_localRPL0; } ReferencePictureList* getLocalRPL1() { return &m_localRPL1; } void setRPL0idx(int rplIdx) { m_rpl0Idx = rplIdx; } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index c378cd3b7d85d06166c61ecfae5527ad7edc005a..93c8d1a61ae7433c601e4d4452d04f0d33db1b54 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -3139,13 +3139,12 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } // explicit RPL in picture header + auto const rpl = picHeader->getLocalRPL( listIdx ); if (!uiCode) { - ReferencePictureList* rpl = picHeader->getLocalRPL( listIdx ); (*rpl) = ReferencePictureList(); parseRefPicList(sps, rpl, -1); picHeader->setRPLIdx(listIdx, -1); - picHeader->setRPL(listIdx, rpl); } // use list from SPS else @@ -3156,65 +3155,65 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag int numBits = ceilLog2(sps->getNumRPL( listIdx )); READ_CODE(numBits, uiCode, "rpl_idx[i]"); picHeader->setRPLIdx( listIdx, uiCode ); - picHeader->setRPL( listIdx, sps->getRPLList( listIdx )->getReferencePictureList(uiCode)); + *rpl = *sps->getRPLList( listIdx )->getReferencePictureList(uiCode); } else if (sps->getNumRPL(listIdx) == 1) { picHeader->setRPLIdx( listIdx, 0 ); - picHeader->setRPL( listIdx, sps->getRPLList( listIdx )->getReferencePictureList(0)); + *rpl = *sps->getRPLList( listIdx )->getReferencePictureList(0); } else { assert(picHeader->getRPLIdx(0) != -1); picHeader->setRPLIdx( listIdx, picHeader->getRPLIdx(0)); - picHeader->setRPL( listIdx, sps->getRPLList( listIdx )->getReferencePictureList(picHeader->getRPLIdx( listIdx ))); + *rpl = *sps->getRPLList( listIdx )->getReferencePictureList(picHeader->getRPLIdx( listIdx )); } } // POC MSB cycle signalling for LTRP - for (int i = 0; i < picHeader->getRPL( listIdx )->getNumberOfLongtermPictures() + picHeader->getRPL( listIdx )->getNumberOfShorttermPictures(); i++) + for (int i = 0; i < rpl->getNumberOfLongtermPictures() + rpl->getNumberOfShorttermPictures(); i++) { - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBPresentFlag(i, false); - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBCycleLT(i, 0); + rpl->setDeltaPocMSBPresentFlag(i, false); + rpl->setDeltaPocMSBCycleLT(i, 0); } - if (picHeader->getRPL( listIdx )->getNumberOfLongtermPictures()) + if (rpl->getNumberOfLongtermPictures()) { - for (int i = 0; i < picHeader->getRPL( listIdx )->getNumberOfLongtermPictures() + picHeader->getRPL( listIdx )->getNumberOfShorttermPictures(); i++) + for (int i = 0; i < rpl->getNumberOfLongtermPictures() + rpl->getNumberOfShorttermPictures(); i++) { - if (picHeader->getRPL( listIdx )->isRefPicLongterm(i)) + if (rpl->isRefPicLongterm(i)) { - if (picHeader->getRPL( listIdx )->getLtrpInSliceHeaderFlag()) + if (rpl->getLtrpInSliceHeaderFlag()) { READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt[i][j]"); - picHeader->getLocalRPL( listIdx )->setRefPicIdentifier( i, uiCode, true, false, 0 ); + rpl->setRefPicIdentifier( i, uiCode, true, false, 0 ); } READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]"); - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); + rpl->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); if (uiCode) { READ_UVLC(uiCode, "delta_poc_msb_cycle_lt[i][j]"); if(i != 0) { - uiCode += picHeader->getLocalRPL( listIdx )->getDeltaPocMSBCycleLT(i-1); + uiCode += rpl->getDeltaPocMSBCycleLT(i-1); } - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBCycleLT(i, uiCode); + rpl->setDeltaPocMSBCycleLT(i, uiCode); } else if(i != 0) { - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBCycleLT(i, picHeader->getLocalRPL( listIdx )->getDeltaPocMSBCycleLT(i-1)); + rpl->setDeltaPocMSBCycleLT(i, rpl->getDeltaPocMSBCycleLT(i-1)); } else { - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBCycleLT(i,0); + rpl->setDeltaPocMSBCycleLT(i,0); } } else if(i != 0) { - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBCycleLT(i, picHeader->getLocalRPL( listIdx )->getDeltaPocMSBCycleLT(i-1)); + rpl->setDeltaPocMSBCycleLT(i, rpl->getDeltaPocMSBCycleLT(i-1)); } else { - picHeader->getLocalRPL( listIdx )->setDeltaPocMSBCycleLT(i,0); + rpl->setDeltaPocMSBCycleLT(i,0); } } } @@ -4036,8 +4035,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par #endif if( pps->getRplInfoInPhFlag() ) { - pcSlice->setRPL0(picHeader->getRPL0()); - pcSlice->setRPL1(picHeader->getRPL1()); *pcSlice->getLocalRPL0() = *picHeader->getLocalRPL0(); *pcSlice->getLocalRPL1() = *picHeader->getLocalRPL1(); } @@ -4045,10 +4042,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { ReferencePictureList* rpl0 = pcSlice->getLocalRPL0(); (*rpl0) = ReferencePictureList(); - pcSlice->setRPL0(rpl0); ReferencePictureList* rpl1 = pcSlice->getLocalRPL1(); (*rpl1) = ReferencePictureList(); - pcSlice->setRPL1(rpl1); } else { @@ -4066,13 +4061,12 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par rplSpsFlag0 = uiCode; + auto const rpl0 = pcSlice->getLocalRPL0(); if (!uiCode) //explicitly carried in this SH { - ReferencePictureList* rpl0 = pcSlice->getLocalRPL0(); (*rpl0) = ReferencePictureList(); parseRefPicList(sps, rpl0, -1); pcSlice->setRPL0idx(-1); - pcSlice->setRPL0(rpl0); } else //Refer to list in SPS { @@ -4081,58 +4075,58 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par int numBits = ceilLog2(sps->getNumRPL0()); READ_CODE(numBits, uiCode, "ref_pic_list_idx[0]"); pcSlice->setRPL0idx(uiCode); - pcSlice->setRPL0(sps->getRPLList0()->getReferencePictureList(uiCode)); + *rpl0 = *sps->getRPLList0()->getReferencePictureList(uiCode); } else { pcSlice->setRPL0idx(0); - pcSlice->setRPL0(sps->getRPLList0()->getReferencePictureList(0)); + *rpl0 = *sps->getRPLList0()->getReferencePictureList(0); } } //Deal POC Msb cycle signalling for LTRP - for (int i = 0; i < pcSlice->getRPL0()->getNumberOfLongtermPictures() + pcSlice->getRPL0()->getNumberOfShorttermPictures(); i++) + for (int i = 0; i < rpl0->getNumberOfLongtermPictures() + rpl0->getNumberOfShorttermPictures(); i++) { - pcSlice->getLocalRPL0()->setDeltaPocMSBPresentFlag(i, false); - pcSlice->getLocalRPL0()->setDeltaPocMSBCycleLT(i, 0); + rpl0->setDeltaPocMSBPresentFlag(i, false); + rpl0->setDeltaPocMSBCycleLT(i, 0); } - if (pcSlice->getRPL0()->getNumberOfLongtermPictures()) + if (rpl0->getNumberOfLongtermPictures()) { - for (int i = 0; i < pcSlice->getRPL0()->getNumberOfLongtermPictures() + pcSlice->getRPL0()->getNumberOfShorttermPictures(); i++) + for (int i = 0; i < rpl0->getNumberOfLongtermPictures() + rpl0->getNumberOfShorttermPictures(); i++) { - if (pcSlice->getRPL0()->isRefPicLongterm(i)) + if (rpl0->isRefPicLongterm(i)) { - if (pcSlice->getRPL0()->getLtrpInSliceHeaderFlag()) + if (rpl0->getLtrpInSliceHeaderFlag()) { READ_CODE(sps->getBitsForPOC(), uiCode, "slice_poc_lsb_lt[i][j]"); - pcSlice->getLocalRPL0()->setRefPicIdentifier( i, uiCode, true, false, 0 ); + rpl0->setRefPicIdentifier( i, uiCode, true, false, 0 ); } READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]"); - pcSlice->getLocalRPL0()->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); + rpl0->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); if (uiCode) { READ_UVLC(uiCode, "slice_delta_poc_msb_cycle_lt[i][j]"); if(i != 0) { - uiCode += pcSlice->getLocalRPL0()->getDeltaPocMSBCycleLT(i-1); + uiCode += rpl0->getDeltaPocMSBCycleLT(i-1); } - pcSlice->getLocalRPL0()->setDeltaPocMSBCycleLT(i, uiCode); + rpl0->setDeltaPocMSBCycleLT(i, uiCode); } else if(i != 0) { - pcSlice->getLocalRPL0()->setDeltaPocMSBCycleLT(i, pcSlice->getLocalRPL0()->getDeltaPocMSBCycleLT(i-1)); + rpl0->setDeltaPocMSBCycleLT(i, rpl0->getDeltaPocMSBCycleLT(i-1)); } else { - pcSlice->getLocalRPL0()->setDeltaPocMSBCycleLT(i,0); + rpl0->setDeltaPocMSBCycleLT(i,0); } } else if(i != 0) { - pcSlice->getLocalRPL0()->setDeltaPocMSBCycleLT(i, pcSlice->getLocalRPL0()->getDeltaPocMSBCycleLT(i-1)); + rpl0->setDeltaPocMSBCycleLT(i, rpl0->getDeltaPocMSBCycleLT(i-1)); } else { - pcSlice->getLocalRPL0()->setDeltaPocMSBCycleLT(i,0); + rpl0->setDeltaPocMSBCycleLT(i,0); } } } @@ -4151,80 +4145,77 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par uiCode = rplSpsFlag0; } + auto const rpl1 = pcSlice->getLocalRPL1(); if (uiCode == 1) { if (sps->getNumRPL(1) > 1 && pps->getRpl1IdxPresentFlag()) { int numBits = ceilLog2(sps->getNumRPL1()); READ_CODE(numBits, uiCode, "ref_pic_list_idx[1]"); - pcSlice->setRPL1idx(uiCode); - pcSlice->setRPL1(sps->getRPLList1()->getReferencePictureList(uiCode)); + *rpl1 = *sps->getRPLList1()->getReferencePictureList(uiCode); } else if (sps->getNumRPL(1) == 1) { - pcSlice->setRPL1idx(0); - pcSlice->setRPL1(sps->getRPLList1()->getReferencePictureList(0)); + *rpl1 = *sps->getRPLList1()->getReferencePictureList(0); } else { assert(pcSlice->getRPL0idx() != -1); pcSlice->setRPL1idx(pcSlice->getRPL0idx()); - pcSlice->setRPL1(sps->getRPLList1()->getReferencePictureList(pcSlice->getRPL0idx())); + *rpl1 = *sps->getRPLList1()->getReferencePictureList(pcSlice->getRPL0idx()); } } else { - ReferencePictureList* rpl1 = pcSlice->getLocalRPL1(); (*rpl1) = ReferencePictureList(); parseRefPicList(sps, rpl1, -1); pcSlice->setRPL1idx(-1); - pcSlice->setRPL1(rpl1); } //Deal POC Msb cycle signalling for LTRP - for (int i = 0; i < pcSlice->getRPL1()->getNumberOfLongtermPictures() + pcSlice->getRPL1()->getNumberOfShorttermPictures(); i++) + for (int i = 0; i < rpl1->getNumberOfLongtermPictures() + rpl1->getNumberOfShorttermPictures(); i++) { - pcSlice->getLocalRPL1()->setDeltaPocMSBPresentFlag(i, false); - pcSlice->getLocalRPL1()->setDeltaPocMSBCycleLT(i, 0); + rpl1->setDeltaPocMSBPresentFlag(i, false); + rpl1->setDeltaPocMSBCycleLT(i, 0); } - if (pcSlice->getRPL1()->getNumberOfLongtermPictures()) + if (rpl1->getNumberOfLongtermPictures()) { - for (int i = 0; i < pcSlice->getRPL1()->getNumberOfLongtermPictures() + pcSlice->getRPL1()->getNumberOfShorttermPictures(); i++) + for (int i = 0; i < rpl1->getNumberOfLongtermPictures() + rpl1->getNumberOfShorttermPictures(); i++) { - if (pcSlice->getRPL1()->isRefPicLongterm(i)) + if (rpl1->isRefPicLongterm(i)) { - if (pcSlice->getRPL1()->getLtrpInSliceHeaderFlag()) + if (rpl1->getLtrpInSliceHeaderFlag()) { READ_CODE(sps->getBitsForPOC(), uiCode, "slice_poc_lsb_lt[i][j]"); - pcSlice->getLocalRPL1()->setRefPicIdentifier( i, uiCode, true, false, 0 ); + rpl1->setRefPicIdentifier( i, uiCode, true, false, 0 ); } READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]"); - pcSlice->getLocalRPL1()->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); + rpl1->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); if (uiCode) { READ_UVLC(uiCode, "slice_delta_poc_msb_cycle_lt[i][j]"); if(i != 0) { - uiCode += pcSlice->getLocalRPL1()->getDeltaPocMSBCycleLT(i-1); + uiCode += rpl1->getDeltaPocMSBCycleLT(i-1); } - pcSlice->getLocalRPL1()->setDeltaPocMSBCycleLT(i, uiCode); + rpl1->setDeltaPocMSBCycleLT(i, uiCode); } else if(i != 0) { - pcSlice->getLocalRPL1()->setDeltaPocMSBCycleLT(i, pcSlice->getLocalRPL1()->getDeltaPocMSBCycleLT(i-1)); + rpl1->setDeltaPocMSBCycleLT(i, rpl1->getDeltaPocMSBCycleLT(i-1)); } else { - pcSlice->getLocalRPL1()->setDeltaPocMSBCycleLT(i,0); + rpl1->setDeltaPocMSBCycleLT(i,0); } } else if(i != 0) { - pcSlice->getLocalRPL1()->setDeltaPocMSBCycleLT(i, pcSlice->getLocalRPL1()->getDeltaPocMSBCycleLT(i-1)); + rpl1->setDeltaPocMSBCycleLT(i, rpl1->getDeltaPocMSBCycleLT(i-1)); } else { - pcSlice->getLocalRPL1()->setDeltaPocMSBCycleLT(i,0); + rpl1->setDeltaPocMSBCycleLT(i,0); } } } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 2ab88b182d95295d4ea33a84c7dd1776cb531c0f..93926e8858d237323166962a0bcd35fa1a2e9fe0 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -3334,8 +3334,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } m_pcSliceEncoder->setSliceSegmentIdx(sliceSegmentIdxCount); - pcSlice->setRPL0(pcPic->slices[0]->getRPL0()); - pcSlice->setRPL1(pcPic->slices[0]->getRPL1()); + *pcSlice->getLocalRPL0() = *pcPic->slices[0]->getRPL0(); + *pcSlice->getLocalRPL1() = *pcPic->slices[0]->getRPL1(); pcSlice->setRPL0idx(pcPic->slices[0]->getRPL0idx()); pcSlice->setRPL1idx(pcPic->slices[0]->getRPL1idx()); @@ -3369,8 +3369,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { picHeader->setRPL0idx(pcSlice->getRPL0idx()); picHeader->setRPL1idx(pcSlice->getRPL1idx()); - picHeader->setRPL0(pcSlice->getRPL0()); - picHeader->setRPL1(pcSlice->getRPL1()); *picHeader->getLocalRPL0() = *pcSlice->getLocalRPL0(); *picHeader->getLocalRPL1() = *pcSlice->getLocalRPL1(); } @@ -5432,8 +5430,9 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL int layerIdx = vps == nullptr ? 0 : vps->getGeneralLayerIdx( pic->layerId ); bool isIntraLayerPredAllowed = (vps->getIndependentLayerFlag(layerIdx) || (vps->getPredDirection(slice->getTLayer()) != 1)) && !slice->isIRAP(); bool isInterLayerPredAllowed = !vps->getIndependentLayerFlag(layerIdx) && (vps->getPredDirection(slice->getTLayer()) != 2); - ReferencePictureList* pLocalRPL0 = slice->getLocalRPL0(); - *pLocalRPL0 = ReferencePictureList( slice->getSPS()->getInterLayerPresentFlag() ); + + auto localRPL0 = ReferencePictureList( slice->getSPS()->getInterLayerPresentFlag() ); + auto const pLocalRPL0 = &localRPL0; uint32_t numOfSTRPL0 = 0; uint32_t numOfLTRPL0 = 0; @@ -5565,8 +5564,8 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL numOfLTRPL0 += (rpl0->isRefPicLongterm(ii) && !rpl0->isInterLayerRefPic(ii)) ? 1 : 0; } - ReferencePictureList* pLocalRPL1 = slice->getLocalRPL1(); - *pLocalRPL1 = ReferencePictureList( slice->getSPS()->getInterLayerPresentFlag() ); + auto localRPL1 = ReferencePictureList( slice->getSPS()->getInterLayerPresentFlag() ); + auto const pLocalRPL1 = &localRPL1; uint32_t numOfSTRPL1 = 0; uint32_t numOfLTRPL1 = 0; @@ -5712,7 +5711,7 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL pLocalRPL0->setNumberOfActivePictures( ( numPics < rpl0->getNumberOfActivePictures() ? numPics : rpl0->getNumberOfActivePictures() ) + numOfILRPL0 ); pLocalRPL0->setLtrpInSliceHeaderFlag( 1 ); slice->setRPL0idx( -1 ); - slice->setRPL0( pLocalRPL0 ); + *slice->getLocalRPL0() = *pLocalRPL0; //Copy from L0 if we have less than active ref pic numOfNeedToFill = pLocalRPL0->getNumberOfActivePictures() - ( numOfLTRPL1 + numOfSTRPL1 ); @@ -5756,6 +5755,6 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL pLocalRPL1->setNumberOfActivePictures( ( isDisallowMixedRefPic ? numPics : ( numPics < rpl1->getNumberOfActivePictures() ? numPics : rpl1->getNumberOfActivePictures() ) ) + numOfILRPL1 ); pLocalRPL1->setLtrpInSliceHeaderFlag( 1 ); slice->setRPL1idx( -1 ); - slice->setRPL1( pLocalRPL1 ); + *slice->getLocalRPL1() = *pLocalRPL1; } //! \} diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index ac6201f8fe3ec44f64b4438f6ae36ad2d35afa0f..ceb8e0bd311fa0810d79bf52264a04123eed583a 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -2245,8 +2245,8 @@ void EncLib::selectReferencePictureList(Slice* slice, int POCCurr, int GOPid, in const ReferencePictureList *rpl0 = (slice->getSPS()->getRPLList0()->getReferencePictureList(slice->getRPL0idx())); const ReferencePictureList *rpl1 = (slice->getSPS()->getRPLList1()->getReferencePictureList(slice->getRPL1idx())); - slice->setRPL0(rpl0); - slice->setRPL1(rpl1); + *slice->getLocalRPL0() = *rpl0; + *slice->getLocalRPL1() = *rpl1; }