diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index e0bef48c13fbd2ea9ee23ee29013521997dbbe91..eaae06f15c94514cae797acd0becf5766746e4b4 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -470,6 +470,9 @@ void EncApp::xInitLibCfg() #if JVET_O0041_FRAME_FIELD_SEI m_cEncLib.setFrameFieldInfoSEIEnabled ( m_frameFieldInfoSEIEnabled ); #endif +#if JVET_N0867_TEMP_SCAL_HRD + m_cEncLib.setBpDeltasGOPStructure ( m_bpDeltasGOPStructure ); +#endif #if JVET_O0189_DU m_cEncLib.setDecodingUnitInfoSEIEnabled ( m_decodingUnitInfoSEIEnabled ); #endif diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 91ba60a3ec5053d418ac291c9621c4b455d084d1..2d89332d3b761f8ba1384de3e79a598e0f884211 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1453,7 +1453,49 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_switchPocPeriod = m_iFrameRate / 2 / m_iGOPSize * m_iGOPSize; } #endif - +#if JVET_N0867_TEMP_SCAL_HRD + m_bpDeltasGOPStructure = false; + if(m_iGOPSize == 16) + { + if ((m_GOPList[0].m_POC == 16 && m_GOPList[0].m_temporalId == 0 ) + && (m_GOPList[1].m_POC == 8 && m_GOPList[1].m_temporalId == 1 ) + && (m_GOPList[2].m_POC == 4 && m_GOPList[2].m_temporalId == 2 ) + && (m_GOPList[3].m_POC == 2 && m_GOPList[3].m_temporalId == 3 ) + && (m_GOPList[4].m_POC == 1 && m_GOPList[4].m_temporalId == 4 ) + && (m_GOPList[5].m_POC == 3 && m_GOPList[5].m_temporalId == 4 ) + && (m_GOPList[6].m_POC == 6 && m_GOPList[6].m_temporalId == 3 ) + && (m_GOPList[7].m_POC == 5 && m_GOPList[7].m_temporalId == 4 ) + && (m_GOPList[8].m_POC == 7 && m_GOPList[8].m_temporalId == 4 ) + && (m_GOPList[9].m_POC == 12 && m_GOPList[9].m_temporalId == 2 ) + && (m_GOPList[10].m_POC == 10 && m_GOPList[10].m_temporalId == 3 ) + && (m_GOPList[11].m_POC == 9 && m_GOPList[11].m_temporalId == 4 ) + && (m_GOPList[12].m_POC == 11 && m_GOPList[12].m_temporalId == 4 ) + && (m_GOPList[13].m_POC == 14 && m_GOPList[13].m_temporalId == 3 ) + && (m_GOPList[14].m_POC == 13 && m_GOPList[14].m_temporalId == 4 ) + && (m_GOPList[15].m_POC == 15 && m_GOPList[15].m_temporalId == 4 )) + { + m_bpDeltasGOPStructure = true; + } + } + else if(m_iGOPSize == 8) + { + if ((m_GOPList[0].m_POC == 8 && m_GOPList[0].m_temporalId == 0 ) + && (m_GOPList[1].m_POC == 4 && m_GOPList[1].m_temporalId == 1 ) + && (m_GOPList[2].m_POC == 2 && m_GOPList[2].m_temporalId == 2 ) + && (m_GOPList[3].m_POC == 1 && m_GOPList[3].m_temporalId == 3 ) + && (m_GOPList[4].m_POC == 3 && m_GOPList[4].m_temporalId == 3 ) + && (m_GOPList[5].m_POC == 6 && m_GOPList[5].m_temporalId == 2 ) + && (m_GOPList[6].m_POC == 5 && m_GOPList[6].m_temporalId == 3 ) + && (m_GOPList[7].m_POC == 7 && m_GOPList[7].m_temporalId == 3 )) + { + m_bpDeltasGOPStructure = true; + } + } + else + { + m_bpDeltasGOPStructure = false; + } +#endif for (int i = 0; m_GOPList[i].m_POC != -1 && i < MAX_GOP + 1; i++) { m_RPLList0[i].m_POC = m_RPLList1[i].m_POC = m_GOPList[i].m_POC; diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 913cfaeb39a6a38d2ec77d08b8b6e3e41bb2fe4e..780d0268bb1b4651435d2dad10656f3a58005bbb 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -469,6 +469,9 @@ protected: #endif bool m_bufferingPeriodSEIEnabled; bool m_pictureTimingSEIEnabled; +#if JVET_N0867_TEMP_SCAL_HRD + bool m_bpDeltasGOPStructure; +#endif #if JVET_O0189_DU bool m_decodingUnitInfoSEIEnabled; #endif diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 026e52512ea1a20926efe756e2a8b91786f4d287..2447e9507c5c1bf4339c7cb2943f1b7d0124f981 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -374,7 +374,7 @@ typedef std::pair<int, int> TrCost; // ==================================================================================================================== #ifndef ENABLE_TRACING -#define ENABLE_TRACING 0 // DISABLE by default (enable only when debugging, requires 15% run-time in decoding) -- see documentation in 'doc/DTrace for NextSoftware.pdf' +#define ENABLE_TRACING 1 // DISABLE by default (enable only when debugging, requires 15% run-time in decoding) -- see documentation in 'doc/DTrace for NextSoftware.pdf' #endif #if ENABLE_TRACING diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index b541bd96aca6c05436d06c030f3d644d704bcf96..74320e92437ec0edbb5dd35bb06bd4191a6e1a0b 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -569,6 +569,9 @@ protected: bool m_temporalLevel0IndexSEIEnabled; bool m_gradualDecodingRefreshInfoEnabled; int m_noDisplaySEITLayer; +#endif +#if JVET_N0867_TEMP_SCAL_HRD + bool m_bpDeltasGOPStructure; #endif bool m_decodingUnitInfoSEIEnabled; #if HEVC_SEI @@ -1488,6 +1491,10 @@ public: bool getGradualDecodingRefreshInfoEnabled() const { return m_gradualDecodingRefreshInfoEnabled; } void setNoDisplaySEITLayer(int b) { m_noDisplaySEITLayer = b; } int getNoDisplaySEITLayer() { return m_noDisplaySEITLayer; } +#endif +#if JVET_N0867_TEMP_SCAL_HRD + void setBpDeltasGOPStructure(bool b) { m_bpDeltasGOPStructure = b; } + bool getBpDeltasGOPStructure() const { return m_bpDeltasGOPStructure; } #endif void setDecodingUnitInfoSEIEnabled(bool b) { m_decodingUnitInfoSEIEnabled = b; } bool getDecodingUnitInfoSEIEnabled() const { return m_decodingUnitInfoSEIEnabled; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 0b764fc2169e6c0c180a862e5e990aadf8cf0ce6..e467b07d348ce03894359d7c25316cfd37b33f16 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -952,7 +952,7 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, } else { - assert(0); + THROW("m_cpbRemovalDelayDeltaIdx not applicable for the sub-layer and GOP size"); } } break; @@ -996,13 +996,13 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, } else { - assert(0); + THROW("m_cpbRemovalDelayDeltaIdx not applicable for the sub-layer and GOP size"); } } break; default: { - assert (0); + THROW("m_cpbRemovalDelayDeltaIdx not supported for the current GOP size"); } break; } @@ -1027,7 +1027,7 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, } else { - assert(0); + THROW("m_cpbRemovalDelayDeltaIdx not applicable for the sub-layer and GOP size"); } } break; @@ -1055,13 +1055,13 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, } else { - assert(0); + THROW("m_cpbRemovalDelayDeltaIdx not applicable for the sub-layer and GOP size"); } } break; default: { - assert (0); + THROW("m_cpbRemovalDelayDeltaIdx not applicable for the sub-layer and GOP size"); } break; } diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index ab25977ee393220371833cb29df6d907513d488a..ef9f54a9aa252ae722d3407ad87e13259d506567 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -281,7 +281,7 @@ void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI, bufferingPeriodSEI->m_dpbDelayOffset = 0; #endif #if JVET_N0867_TEMP_SCAL_HRD - bufferingPeriodSEI->m_cpbRemovalDelayDeltasPresentFlag = ((bufferingPeriodSEI->m_bpMaxSubLayers > 1) && (( m_pcCfg->getGOPSize() == 8 && bufferingPeriodSEI->m_bpMaxSubLayers == 4) || ( m_pcCfg->getGOPSize() == 16 && bufferingPeriodSEI->m_bpMaxSubLayers == 5)) ) ? (true) : (false); + bufferingPeriodSEI->m_cpbRemovalDelayDeltasPresentFlag = m_pcCfg->getBpDeltasGOPStructure() ; if (bufferingPeriodSEI->m_cpbRemovalDelayDeltasPresentFlag) { switch (m_pcCfg->getGOPSize()) @@ -334,7 +334,7 @@ void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI, break; default: { - assert (0); + THROW("m_cpbRemovalDelayDelta not applicable for the GOP size"); } break; }