diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 7f564cfd054319c5a8cbb979a495bf9ff2167f93..2768fddc10a2ef5eea329780ca6df87c0ed28f5e 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -82,10 +82,8 @@ struct GOPEntry int m_deltaRefPics1[MAX_NUM_REF_PICS]; bool m_isEncoded; bool m_ltrpInSliceHeaderFlag; -#if EXPLICIT_ILRP int m_layerRef0[MAX_VPS_LAYERS]; int m_layerRef1[MAX_VPS_LAYERS]; -#endif GOPEntry() : m_POC(-1) , m_QPOffset(0) @@ -114,10 +112,8 @@ struct GOPEntry { ::memset(m_deltaRefPics0, 0, sizeof(m_deltaRefPics0)); ::memset(m_deltaRefPics1, 0, sizeof(m_deltaRefPics1)); -#if EXPLICIT_ILRP ::memset(m_layerRef0, -1, sizeof(m_layerRef0)); ::memset(m_layerRef1, -1, sizeof(m_layerRef1)); -#endif } }; @@ -132,9 +128,7 @@ struct RPLEntry int m_deltaRefPics[MAX_NUM_REF_PICS]; bool m_isEncoded; bool m_ltrpInSliceHeaderFlag; -#if EXPLICIT_ILRP int m_layerRef[MAX_NUM_REF_PICS]; -#endif RPLEntry() : m_POC(-1) , m_temporalId(0) @@ -146,9 +140,7 @@ struct RPLEntry , m_ltrpInSliceHeaderFlag(false) { ::memset(m_deltaRefPics, 0, sizeof(m_deltaRefPics)); -#if EXPLICIT_ILRP ::memset(m_layerRef, -1, sizeof(m_layerRef)); -#endif } }; @@ -1108,9 +1100,7 @@ protected: bool m_craAPSreset; bool m_rprRASLtoolSwitch; bool m_refLayerMetricsEnabled; -#if EXPLICIT_ILRP bool m_explicitILRP; -#endif public: EncCfg() @@ -3031,10 +3021,8 @@ public: void setAvoidIntraInDepLayer(bool b) { m_avoidIntraInDepLayer = b; } bool getAvoidIntraInDepLayer() const { return m_avoidIntraInDepLayer; } -#if EXPLICIT_ILRP void setExplicitILRP(bool b) { m_explicitILRP = b; } bool getExplicitILRP() const { return m_explicitILRP; } -#endif const EncCfgParam::CfgVPSParameters &getVPSParameters() const { diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 93562a108c3e31b930a470183908ca7267328059..1c0e2d071e6634ebb97d29befb716448ffa309f0 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -6948,15 +6948,9 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL { higherTLayerRefs[l].push_back(ii); } -#if EXPLICIT_ILRP else if (num[l] >= rpl->getNumberOfActivePictures() - rpl->getNumberOfInterLayerPictures() && layerIdx != 0 && vps != nullptr && !vps->getAllIndependentLayersFlag() && isInterLayerPredAllowed && !m_pcEncLib->getExplicitILRP()) -#else - else if (num[l] >= rpl->getNumberOfActivePictures() - rpl->getNumberOfInterLayerPictures() - && layerIdx != 0 && vps != nullptr && !vps->getAllIndependentLayersFlag() - && isInterLayerPredAllowed) -#endif { inactiveRefs[l].push_back(ii); } @@ -6974,7 +6968,6 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL } } } -#if EXPLICIT_ILRP else if (m_pcEncLib->getExplicitILRP() && layerIdx != 0 && vps != nullptr && !vps->getAllIndependentLayersFlag() && isInterLayerPredAllowed) { for (const auto &pic: rcListPic) @@ -6989,11 +6982,9 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL } } } -#endif } } -#if EXPLICIT_ILRP // AvoidIntraInDepLayer IRAPs in dependent layers are replaced with inter slices but may have empty L0 list (e.g. if no IL ref specified in config) // In this case implicitly add an inter-layer ref to avoid inter slices with no ref if (m_pcEncLib->getExplicitILRP()) @@ -7018,25 +7009,22 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL } else { -#endif - // inter-layer reference pictures are added to the end of the reference picture list - if (layerIdx != 0 && vps != nullptr && !vps->getAllIndependentLayersFlag() && isInterLayerPredAllowed) - { - for (const auto &pic: rcListPic) + // inter-layer reference pictures are added to the end of the reference picture list + if (layerIdx != 0 && vps != nullptr && !vps->getAllIndependentLayersFlag() && isInterLayerPredAllowed) { - int refLayerIdx = vps->getGeneralLayerIdx(pic->layerId); - if (pic->referenced && pic->getPOC() == curPic->getPOC() && vps->getDirectRefLayerFlag(layerIdx, refLayerIdx) - && xCheckMaxTidILRefPics(layerIdx, pic, slice->isIRAP())) + for (const auto &pic: rcListPic) { - localRpl[l].setRefPicIdentifier(num[l], 0, true, true, vps->getInterLayerRefIdc(layerIdx, refLayerIdx)); - num[l]++; - numIlrp[l]++; + int refLayerIdx = vps->getGeneralLayerIdx(pic->layerId); + if (pic->referenced && pic->getPOC() == curPic->getPOC() && vps->getDirectRefLayerFlag(layerIdx, refLayerIdx) + && xCheckMaxTidILRefPics(layerIdx, pic, slice->isIRAP())) + { + localRpl[l].setRefPicIdentifier(num[l], 0, true, true, vps->getInterLayerRefIdc(layerIdx, refLayerIdx)); + num[l]++; + numIlrp[l]++; + } } } } -#if EXPLICIT_ILRP - } -#endif } uint32_t numPrev[NUM_REF_PIC_LIST_01] = { num[REF_PIC_LIST_0], num[REF_PIC_LIST_1] }; @@ -7057,12 +7045,10 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL const int identifier = localRpl[k].getRefPicIdentifier(ii); const bool isLongTerm = localRpl[k].isRefPicLongterm(ii); const bool isInterLayer = localRpl[k].isInterLayerRefPic(ii); -#if EXPLICIT_ILRP if (m_pcEncLib->getExplicitILRP() && isInterLayer) { continue;//do not implicitly add inter layer refs from other list if explicitILRP is enabled. } -#endif // Make sure this copy is not already present bool canIncludeThis = true;