diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 653a36d6ab9eb61e601e8e36aad8a0c03e5099b8..4c3d0570b8153e81900c49d58b580b4769218357 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -301,9 +301,7 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setFramesToBeEncoded ( m_framesToBeEncoded ); m_cEncLib.setValidFrames(m_firstValidFrame, m_lastValidFrame); m_cEncLib.setAvoidIntraInDepLayer ( m_avoidIntraInDepLayer ); -#if EXPLICIT_ILRP m_cEncLib.setExplicitILRP ( m_explicitILRP ); -#endif m_cEncLib.setRefLayerMetricsEnabled(m_refMetricsEnabled); m_cEncLib.setRefLayerRescaledAvailable(false); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 86911e667280e57f9b96f61cd14da20ac4240c88..72fe8c211722ea3a889ee06655e30b38c9b8a838 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -139,7 +139,6 @@ std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //in in >> entry.m_numRefPicsActive0; in >> entry.m_numRefPics0; -#if EXPLICIT_ILRP char c; for (int i = 0; i < entry.m_numRefPics0; i++) { @@ -157,16 +156,9 @@ std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //in } } } -#else - for (int i = 0; i < entry.m_numRefPics0; i++) - { - in >> entry.m_deltaRefPics0[i]; - } -#endif in >> entry.m_numRefPicsActive1; in >> entry.m_numRefPics1; -#if EXPLICIT_ILRP for (int i = 0; i < entry.m_numRefPics1; i++) { in >> entry.m_deltaRefPics1[i]; @@ -183,12 +175,6 @@ std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //in } } } -#else - for (int i = 0; i < entry.m_numRefPics1; i++) - { - in >> entry.m_deltaRefPics1[i]; - } -#endif return in; } @@ -1780,9 +1766,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "AvoidIntraInDepLayers", m_avoidIntraInDepLayer, true, "Replaces I pictures in dependent layers with B pictures" ) ( "MaxTidILRefPicsPlusOneLayerId%d", m_maxTidILRefPicsPlus1Str, std::string(""), MAX_VPS_LAYERS, "Maximum temporal ID for inter-layer reference pictures plus 1 of i-th layer, 0 for IRAP only") ( "RPLofDepLayerInSH", m_rplOfDepLayerInSh, false, "define Reference picture lists in slice header instead of SPS for dependant layers") -#if EXPLICIT_ILRP ( "ExplicitILRP", m_explicitILRP, false, "Explicitly define Inter-Layer Reference pictures in GOP entry") -#endif ; opts.addOptions() @@ -2254,13 +2238,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_RPLList0[i].m_deltaRefPics[j] = m_GOPList[i].m_deltaRefPics0[j]; for (int j = 0; j < m_GOPList[i].m_numRefPics1; j++) m_RPLList1[i].m_deltaRefPics[j] = m_GOPList[i].m_deltaRefPics1[j]; -#if EXPLICIT_ILRP for (int j = 0; j < MAX_NUM_REF_PICS; j++) { m_RPLList0[i].m_layerRef[j] = m_GOPList[i].m_layerRef0[j]; m_RPLList1[i].m_layerRef[j] = m_GOPList[i].m_layerRef1[j]; } -#endif } if (m_compositeRefEnabled) @@ -4461,7 +4443,6 @@ bool EncAppCfg::xCheckParameter() #endif xConfirmPara( m_maxSublayers < 1 || m_maxSublayers > 7, "MaxSublayers must be in range [1..7]" ); -#if EXPLICIT_ILRP xConfirmPara( m_explicitILRP && m_allIndependentLayersFlag, "AllIndependentLayersFlag cannot be 1 when ExplicitILRP is enabled" ); if (m_explicitILRP) { @@ -4491,7 +4472,6 @@ bool EncAppCfg::xCheckParameter() { xConfirmPara(usingExplicit_ILRP, "Cannot specify inter-layer reference pictures in GOP entry when ExplicitILRP is disabled."); } -#endif xConfirmPara( m_fastLocalDualTreeMode < 0 || m_fastLocalDualTreeMode > 2, "FastLocalDualTreeMode must be in range [0..2]" ); @@ -4540,12 +4520,10 @@ bool EncAppCfg::xCheckParameter() } } } -#if EXPLICIT_ILRP if (curPOC == refPoc && m_RPLList0[rplIdx].m_layerRef[i]!=-1) { found = true; } -#endif } if (!found) { @@ -4584,9 +4562,7 @@ bool EncAppCfg::xCheckParameter() if (refPoc >= 0) { m_RPLList0[newRplIdx].m_deltaRefPics[newRefs0] = m_RPLList0[rplIdx].m_deltaRefPics[i]; -#if EXPLICIT_ILRP m_RPLList0[newRplIdx].m_layerRef[newRefs0] = m_RPLList0[rplIdx].m_layerRef[i]; -#endif newRefs0++; newActiveRefs0 += i < m_RPLList0[rplIdx].m_numRefPicsActive ? 1 : 0; } @@ -4601,9 +4577,7 @@ bool EncAppCfg::xCheckParameter() if (refPoc >= 0) { m_RPLList1[m_gopSize + extraRPLs].m_deltaRefPics[newRefs1] = m_RPLList1[rplIdx].m_deltaRefPics[i]; -#if EXPLICIT_ILRP m_RPLList1[m_gopSize + extraRPLs].m_layerRef[newRefs0] = m_RPLList1[rplIdx].m_layerRef[i]; -#endif newRefs1++; newActiveRefs1 += i < m_RPLList1[rplIdx].m_numRefPicsActive ? 1 : 0; } @@ -4643,17 +4617,13 @@ bool EncAppCfg::xCheckParameter() } } int prev = newDeltaPoc; -#if EXPLICIT_ILRP int prevLayerRef = -1; // inserted picture should not be an inter-layer -#endif newRefs0++; newActiveRefs0++; for (int j = insertPoint; j < newRefs0; j++) { std::swap(prev, m_RPLList0[newRplIdx].m_deltaRefPics[j]); -#if EXPLICIT_ILRP std::swap(prevLayerRef, m_RPLList0[newRplIdx].m_layerRef[j]); -#endif } } } @@ -4696,17 +4666,13 @@ bool EncAppCfg::xCheckParameter() } } int prev = newDeltaPoc; -#if EXPLICIT_ILRP int prevLayerRef = -1; // inserted picture should not be an inter-layer -#endif newRefs1++; newActiveRefs1++; for (int j = insertPoint; j < newRefs1; j++) { std::swap(prev, m_RPLList1[newRplIdx].m_deltaRefPics[j]); -#if EXPLICIT_ILRP std::swap(prevLayerRef, m_RPLList1[newRplIdx].m_layerRef[j]); -#endif } } } @@ -4773,17 +4739,16 @@ bool EncAppCfg::xCheckParameter() { int numRefPic = m_RPLList0[i].m_numRefPics; -#if EXPLICIT_ILRP for (int tmp = 0; tmp < m_RPLList0[i].m_numRefPics; tmp++) { - if (m_RPLList0[i].m_deltaRefPics[tmp]==0 && m_RPLList0[i].m_layerRef[tmp]!=-1) numRefPic--; //Inter-layer ref pic already in DPB for ref layer, do not count it for current layer. + if (m_RPLList0[i].m_deltaRefPics[tmp]==0 && m_RPLList0[i].m_layerRef[tmp]!=-1) + { + numRefPic--; //Inter-layer ref pic already in DPB for ref layer, do not count it for current layer. + } } -#endif for (int tmp = 0; tmp < m_RPLList1[i].m_numRefPics; tmp++) { -#if EXPLICIT_ILRP if (m_RPLList1[i].m_deltaRefPics[tmp]==0 && m_RPLList1[i].m_layerRef[tmp]!=-1) continue; //Inter-layer ref pic already in DPB for ref layer, do not count it for current layer. -#endif bool notSame = true; for (int jj = 0; notSame && jj < m_RPLList0[i].m_numRefPics; jj++) { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 5dd4a9389412e847a1aab1236d04f8147ca753b0..a40820fe49cb9b85d85854d2d2b9ffe3ddbfac7c 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -1054,9 +1054,7 @@ protected: bool m_defaultPtlDpbHrdMaxTidFlag; bool m_allIndependentLayersFlag; std::string m_predDirectionArray; -#if EXPLICIT_ILRP bool m_explicitILRP; -#endif int m_numRefLayers[MAX_VPS_LAYERS]; std::string m_refLayerIdxStr[MAX_VPS_LAYERS]; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 35d4bcabc19847944bf391e0d3a69ba25157c422..1685cdd509fe34b0ac3a616f1b6af21c2db9c8b4 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -70,8 +70,6 @@ //########### place macros to be be kept below this line ############### -#define EXPLICIT_ILRP 1 - #define GDR_ENABLED 1 #if GDR_ENABLED diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 7a97a90c67ac34866472a0276cc539f6f491f914..f2d377fc3a17e393712e4b2c4699660d8c6727df 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -2255,7 +2255,6 @@ void EncLib::xInitRPL(SPS &sps) // inter-layer reference picture is not signaled in SPS RPL, SPS is shared currently rpl->setNumberOfInterLayerPictures( 0 ); -#if EXPLICIT_ILRP if (getExplicitILRP()) { bool isIntraLayerPredAllowed = (getVPS() && !getRplOfDepLayerInSh()) ? ((m_intraPeriod < 0 && ge.m_POC != 0) || (ge.m_POC % m_intraPeriod) != 0) : true; @@ -2301,48 +2300,46 @@ void EncLib::xInitRPL(SPS &sps) } rpl->setNumberOfShorttermPictures(numRefActive-validNumILRef+numRefInactive); } - else{ -#endif - if (!getRplOfDepLayerInSh()) + else { - bool isIntraLayerPredAllowed = getVPS() ? ((getVPS()->getIndependentLayerFlag(layerIdx) || (getVPS()->getPredDirection(ge.m_temporalId) != 1)) && ((m_intraPeriod < 0 && ge.m_POC != 0) || (ge.m_POC % m_intraPeriod) != 0)) : true; - bool isInterLayerPredAllowed = getVPS() ? (!getVPS()->getIndependentLayerFlag(layerIdx) && (getVPS()->getPredDirection(ge.m_temporalId) != 2) && ((m_intraPeriod < 0 && ge.m_POC != 0) || ((ge.m_POC % m_intraPeriod) != 0) || (getAvoidIntraInDepLayer() && layerIdx))) : false; - - int numRefActive = 0; - if (isIntraLayerPredAllowed) + if (!getRplOfDepLayerInSh()) { - for (int k = 0; k < ge.m_numRefPicsActive; k++) + bool isIntraLayerPredAllowed = getVPS() ? ((getVPS()->getIndependentLayerFlag(layerIdx) || (getVPS()->getPredDirection(ge.m_temporalId) != 1)) && ((m_intraPeriod < 0 && ge.m_POC != 0) || (ge.m_POC % m_intraPeriod) != 0)) : true; + bool isInterLayerPredAllowed = getVPS() ? (!getVPS()->getIndependentLayerFlag(layerIdx) && (getVPS()->getPredDirection(ge.m_temporalId) != 2) && ((m_intraPeriod < 0 && ge.m_POC != 0) || ((ge.m_POC % m_intraPeriod) != 0) || (getAvoidIntraInDepLayer() && layerIdx))) : false; + + int numRefActive = 0; + if (isIntraLayerPredAllowed) { - rpl->setRefPicIdentifier(k, -ge.m_deltaRefPics[k], 0, false, 0); + for (int k = 0; k < ge.m_numRefPicsActive; k++) + { + rpl->setRefPicIdentifier(k, -ge.m_deltaRefPics[k], 0, false, 0); + } + numRefActive = ge.m_numRefPicsActive; } - numRefActive = ge.m_numRefPicsActive; - } - int validNumILRef = 0; - if (isInterLayerPredAllowed) - { - for (int refLayerIdx : refLayersIdx) + int validNumILRef = 0; + if (isInterLayerPredAllowed) { - rpl->setRefPicIdentifier(numRefActive + validNumILRef, 0, true, true, m_vps->getInterLayerRefIdc(layerIdx, refLayerIdx)); - validNumILRef++; + for (int refLayerIdx : refLayersIdx) + { + rpl->setRefPicIdentifier(numRefActive + validNumILRef, 0, true, true, m_vps->getInterLayerRefIdc(layerIdx, refLayerIdx)); + validNumILRef++; + } + rpl->setNumberOfInterLayerPictures(validNumILRef); + rpl->setNumberOfActivePictures(numRefActive + validNumILRef); + } + for (int k = numRefActive; k < ge.m_numRefPics; k++) + { + rpl->setRefPicIdentifier(k + validNumILRef, -ge.m_deltaRefPics[k], 0, false, 0); } - rpl->setNumberOfInterLayerPictures(validNumILRef); - rpl->setNumberOfActivePictures(numRefActive + validNumILRef); - } - for (int k = numRefActive; k < ge.m_numRefPics; k++) - { - rpl->setRefPicIdentifier(k + validNumILRef, -ge.m_deltaRefPics[k], 0, false, 0); } - } - else - { - for (int k = 0; k < ge.m_numRefPics; k++) + else { - rpl->setRefPicIdentifier(k, -ge.m_deltaRefPics[k], 0, false, 0); + for (int k = 0; k < ge.m_numRefPics; k++) + { + rpl->setRefPicIdentifier(k, -ge.m_deltaRefPics[k], 0, false, 0); + } } } -#if EXPLICIT_ILRP - } -#endif } }