diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 90076621d6ce4e78f0a48bacd8eaef8c18a8db39..3937fa68f29ef5a9da5561f752815a04b2ae9914 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -161,11 +161,7 @@ uint32_t DecApp::decode() } // parse NAL unit syntax if within target decoding layer -#if JVET_Q0814_DPB if( ( m_iMaxTemporalLayer < 0 || nalu.m_temporalId <= m_iMaxTemporalLayer ) && xIsNaluWithinTargetDecLayerIdSet( &nalu ) ) -#else - if ((m_iMaxTemporalLayer < 0 || nalu.m_temporalId <= m_iMaxTemporalLayer) && isNaluWithinTargetDecLayerIdSet(&nalu)) -#endif { CHECK(nalu.m_temporalId > m_iMaxTemporalLayer, "bitstream shall not include any NAL unit with TemporalId greater than HighestTid"); if (m_targetDecLayerIdSet.size()) @@ -192,13 +188,9 @@ uint32_t DecApp::decode() #endif if (nalu.m_nalUnitType == NAL_UNIT_VPS) { -#if JVET_Q0814_DPB m_cDecLib.deriveTargetOutputLayerSet( m_targetOlsIdx ); m_targetDecLayerIdSet = m_cDecLib.getVPS()->m_targetLayerIdSet; m_targetOutputLayerIdSet = m_cDecLib.getVPS()->m_targetOutputLayerIdSet; -#else - deriveOutputLayerSet(); -#endif } } else @@ -248,11 +240,7 @@ uint32_t DecApp::decode() } std::string reconFileName = m_reconFileName; -#if JVET_Q0814_DPB if( m_reconFileName.compare( "/dev/null" ) && m_cDecLib.getVPS() != nullptr && m_cDecLib.getVPS()->getMaxLayers() > 1 && xIsNaluWithinTargetOutputLayerIdSet( &nalu ) ) -#else - if (m_reconFileName.compare("/dev/null") && (m_cDecLib.getVPS() != nullptr) && (m_cDecLib.getVPS()->getMaxLayers() > 1) && (isNaluWithinTargetOutputLayerIdSet(&nalu))) -#endif { size_t pos = reconFileName.find_last_of('.'); if (pos != string::npos) @@ -264,17 +252,10 @@ uint32_t DecApp::decode() reconFileName.append( std::to_string( nalu.m_nuhLayerId ) ); } } -#if JVET_Q0814_DPB if( ( m_cDecLib.getVPS() != nullptr && ( m_cDecLib.getVPS()->getMaxLayers() == 1 || xIsNaluWithinTargetOutputLayerIdSet( &nalu ) ) ) || m_cDecLib.getVPS() == nullptr ) { m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode } -#else - if(((m_cDecLib.getVPS() != nullptr) && - ((m_cDecLib.getVPS()->getMaxLayers() == 1) || (isNaluWithinTargetOutputLayerIdSet(&nalu)))) || - (m_cDecLib.getVPS() == nullptr)) - m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].open(reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon); // write mode -#endif } // write reconstruction to file if( bNewPicture ) @@ -324,178 +305,6 @@ uint32_t DecApp::decode() return nRet; } -#if !JVET_Q0814_DPB -bool DecApp::deriveOutputLayerSet() -{ - int vps_max_layers_minus1 = m_cDecLib.getVPS()->getMaxLayers() - 1; - if(m_targetOlsIdx == - 1 || vps_max_layers_minus1 == 0) - { - m_targetDecLayerIdSet.clear(); - return true; - } - - int TotalNumOlss = 0; - int each_layer_is_an_ols_flag = m_cDecLib.getVPS()->getEachLayerIsAnOlsFlag(); - int ols_mode_idc = m_cDecLib.getVPS()->getOlsModeIdc(); - int num_output_layer_sets_minus1 = m_cDecLib.getVPS()->getNumOutputLayerSets() - 1; - int i = 0, j = 0, k = 0, r = 0; - int* NumOutputLayersInOls; - int* NumLayersInOls; - int** OutputLayerIdInOls; - int** OutputLayerIdx; - int** layerIncludedInOlsFlag; - int** LayerIdInOls; - int** dependencyFlag; - int** RefLayerIdx; - int* NumRefLayers; - - if (vps_max_layers_minus1 == 0) - TotalNumOlss = 1; - else if (each_layer_is_an_ols_flag || ols_mode_idc == 0 || ols_mode_idc == 1) - TotalNumOlss = vps_max_layers_minus1 + 1; - else if (ols_mode_idc == 2) - TotalNumOlss = num_output_layer_sets_minus1 + 1; - - NumOutputLayersInOls = new int[m_cDecLib.getVPS()->getNumOutputLayerSets()]; - NumLayersInOls = new int[m_cDecLib.getVPS()->getNumOutputLayerSets()]; - OutputLayerIdInOls = new int*[TotalNumOlss]; - OutputLayerIdx = new int*[TotalNumOlss]; - layerIncludedInOlsFlag = new int*[TotalNumOlss]; - LayerIdInOls = new int*[TotalNumOlss]; - - for (i = 0; i < TotalNumOlss; i++) - { - OutputLayerIdInOls[i] = new int[vps_max_layers_minus1 + 1]; - OutputLayerIdx[i] = new int[vps_max_layers_minus1 + 1]; - layerIncludedInOlsFlag[i] = new int[vps_max_layers_minus1 + 1]; - LayerIdInOls[i] = new int[vps_max_layers_minus1 + 1]; - } - - dependencyFlag = new int*[vps_max_layers_minus1 + 1]; - RefLayerIdx = new int*[vps_max_layers_minus1 + 1]; - NumRefLayers = new int[vps_max_layers_minus1 + 1]; - - for (i = 0; i <= vps_max_layers_minus1; i++) - { - dependencyFlag[i] = new int[vps_max_layers_minus1 + 1]; - RefLayerIdx[i] = new int[vps_max_layers_minus1 + 1]; - } - - for (i = 0; i <= vps_max_layers_minus1; i++) { - for (j = 0; j <= vps_max_layers_minus1; j++) { - dependencyFlag[i][j] = m_cDecLib.getVPS()->getDirectRefLayerFlag(i, j); - for (k = 0; k < i; k++) - if (m_cDecLib.getVPS()->getDirectRefLayerFlag(i, k) && dependencyFlag[k][j]) - dependencyFlag[i][j] = 1; - } - } - for (i = 0; i <= vps_max_layers_minus1; i++) - { - for (j = 0, r = 0; j <= vps_max_layers_minus1; j++) - { - if (dependencyFlag[i][j]) - RefLayerIdx[i][r++] = j; - } - NumRefLayers[i] = r; - } - - NumOutputLayersInOls[0] = 1; - OutputLayerIdInOls[0][0] = m_cDecLib.getVPS()->getLayerId(0); - for (i = 1; i < TotalNumOlss; i++) - { - if (each_layer_is_an_ols_flag || ols_mode_idc == 0) - { - NumOutputLayersInOls[i] = 1; - OutputLayerIdInOls[i][0] = m_cDecLib.getVPS()->getLayerId(i); - } - else if (ols_mode_idc == 1) { - NumOutputLayersInOls[i] = i + 1; - for (j = 0; j < NumOutputLayersInOls[i]; j++) - OutputLayerIdInOls[i][j] = m_cDecLib.getVPS()->getLayerId(j); - } - else if (ols_mode_idc == 2) { - for (j = 0; j <= vps_max_layers_minus1; j++) - { - layerIncludedInOlsFlag[i][j] = 0; - } - for (k = 0, j = 0; k <= vps_max_layers_minus1; k++) - { - if (m_cDecLib.getVPS()->getOlsOutputLayerFlag(i, k)) - { - layerIncludedInOlsFlag[i][k] = 1; - OutputLayerIdx[i][j] = k; - OutputLayerIdInOls[i][j++] = m_cDecLib.getVPS()->getLayerId(k); - } - } - NumOutputLayersInOls[i] = j; - for (j = 0; j < NumOutputLayersInOls[i]; j++) - { - int idx = OutputLayerIdx[i][j]; - for (k = 0; k < NumRefLayers[idx]; k++) - layerIncludedInOlsFlag[i][RefLayerIdx[idx][k]] = 1; - } - } - } - - m_targetOutputLayerIdSet.clear(); - for (i = 0; i < NumOutputLayersInOls[m_targetOlsIdx]; i++) - m_targetOutputLayerIdSet.push_back(OutputLayerIdInOls[m_targetOlsIdx][i]); - - NumLayersInOls[0] = 1; - LayerIdInOls[0][0] = m_cDecLib.getVPS()->getLayerId(0); - for (i = 1; i < TotalNumOlss; i++) - { - if (each_layer_is_an_ols_flag) - { - NumLayersInOls[i] = 1; - LayerIdInOls[i][0] = m_cDecLib.getVPS()->getLayerId(i); - } - else if (ols_mode_idc == 0 || ols_mode_idc == 1) - { - NumLayersInOls[i] = i + 1; - for (j = 0; j < NumLayersInOls[i]; j++) - LayerIdInOls[i][j] = m_cDecLib.getVPS()->getLayerId(j); - } - else if (ols_mode_idc == 2) - { - for (k = 0, j = 0; k <= vps_max_layers_minus1; k++) - if (layerIncludedInOlsFlag[i][k]) - LayerIdInOls[i][j++] = m_cDecLib.getVPS()->getLayerId(k); - NumLayersInOls[i] = j; - } - } - - m_targetDecLayerIdSet.clear(); - for (i = 0; i < NumLayersInOls[m_targetOlsIdx]; i++) - m_targetDecLayerIdSet.push_back(LayerIdInOls[m_targetOlsIdx][i]); - - delete[] NumOutputLayersInOls; - delete[] NumLayersInOls; - delete[] NumRefLayers; - - for (i = 0; i < TotalNumOlss; i++) - { - delete[] OutputLayerIdInOls[i]; - delete[] OutputLayerIdx[i]; - delete[] layerIncludedInOlsFlag[i]; - delete[] LayerIdInOls[i]; - } - delete[] OutputLayerIdInOls; - delete[] OutputLayerIdx; - delete[] layerIncludedInOlsFlag; - delete[] LayerIdInOls; - - for (i = 0; i <= vps_max_layers_minus1; i++) - { - delete[] dependencyFlag[i]; - delete[] RefLayerIdx[i]; - } - delete[] dependencyFlag; - delete[] RefLayerIdx; - - return true; -} -#endif /** - lookahead through next NAL units to determine if current NAL unit is the first NAL unit in a new picture @@ -784,7 +593,6 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) uint32_t maxDecPicBufferingHighestTid; uint32_t maxNrSublayers = activeSPS->getMaxTLayers(); -#if JVET_Q0814_DPB const VPS* referredVPS = pcListPic->front()->cs->vps; const int temporalId = ( m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers ) ? maxNrSublayers - 1 : m_iMaxTemporalLayer; @@ -798,18 +606,6 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) numReorderPicsHighestTid = referredVPS->getNumReorderPics( temporalId ); maxDecPicBufferingHighestTid = referredVPS->getMaxDecPicBuffering( temporalId ); } -#else - if(m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers) - { - numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1); - maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(maxNrSublayers-1); - } - else - { - numReorderPicsHighestTid = activeSPS->getNumReorderPics(m_iMaxTemporalLayer); - maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer); - } -#endif while (iterPic != pcListPic->end()) { @@ -1098,7 +894,6 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) /** \param nalu Input nalu to check whether its LayerId is within targetDecLayerIdSet */ -#if JVET_Q0814_DPB bool DecApp::xIsNaluWithinTargetDecLayerIdSet( const InputNALUnit* nalu ) const { if( !m_targetDecLayerIdSet.size() ) // By default, the set is empty, meaning all LayerIds are allowed @@ -1120,40 +915,5 @@ bool DecApp::xIsNaluWithinTargetOutputLayerIdSet( const InputNALUnit* nalu ) con return std::find( m_targetOutputLayerIdSet.begin(), m_targetOutputLayerIdSet.end(), nalu->m_nuhLayerId ) != m_targetOutputLayerIdSet.end(); } -#else -bool DecApp::isNaluWithinTargetDecLayerIdSet( InputNALUnit* nalu ) -{ - if ( m_targetDecLayerIdSet.size() == 0 ) // By default, the set is empty, meaning all LayerIds are allowed - { - return true; - } - for (std::vector<int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++) - { - if ( nalu->m_nuhLayerId == (*it) ) - { - return true; - } - } - return false; -} - -/** \param nalu Input nalu to check whether its LayerId is within targetOutputLayerIdSet - */ -bool DecApp::isNaluWithinTargetOutputLayerIdSet(InputNALUnit* nalu) -{ - if (m_targetOutputLayerIdSet.size() == 0) // By default, the set is empty, meaning all LayerIds are allowed - { - return true; - } - for (std::vector<int>::iterator it = m_targetOutputLayerIdSet.begin(); it != m_targetOutputLayerIdSet.end(); it++) - { - if (nalu->m_nuhLayerId == (*it)) - { - return true; - } - } - return false; -} -#endif //! \} diff --git a/source/App/DecoderApp/DecApp.h b/source/App/DecoderApp/DecApp.h index 551d348025a5f235d665f4d67a1165f199b00440..3749288d084dd013b1e61a750bedf14533d63744 100644 --- a/source/App/DecoderApp/DecApp.h +++ b/source/App/DecoderApp/DecApp.h @@ -70,11 +70,9 @@ private: -#if JVET_Q0814_DPB private: bool xIsNaluWithinTargetDecLayerIdSet( const InputNALUnit* nalu ) const; ///< check whether given Nalu is within targetDecLayerIdSet bool xIsNaluWithinTargetOutputLayerIdSet( const InputNALUnit* nalu ) const; ///< check whether given Nalu is within targetOutputLayerIdSet -#endif public: DecApp(); @@ -87,11 +85,6 @@ private: void xDestroyDecLib (); ///< destroy internal classes void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file void xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID ); ///< flush all remaining decoded pictures to file -#if !JVET_Q0814_DPB - bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet - bool isNaluWithinTargetOutputLayerIdSet(InputNALUnit* nalu); ///< check whether given Nalu is within targetOutputLayerIdSet - bool deriveOutputLayerSet(); ///< derive OLS and layer sets -#endif bool isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytestream); ///< check if next NAL unit will be the first NAL unit from a new picture bool isNewAccessUnit(bool newPicture, ifstream *bitstreamFile, class InputByteStream *bytestream); ///< check if next NAL unit will be the first NAL unit from a new access unit diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 2e25d109d82ae8e2cff6c944eb5694beeec8f869..503569a63832cc92d8dedd11a38ab40abe77e894 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -75,12 +75,8 @@ EncApp::~EncApp() void EncApp::xInitLibCfg() { -#if JVET_Q0814_DPB VPS& vps = *m_cEncLib.getVPS(); vps.m_targetOlsIdx = m_targetOlsIdx; -#else - VPS vps; -#endif vps.setMaxLayers( m_maxLayers ); @@ -205,9 +201,6 @@ void EncApp::xInitLibCfg() } vps.setProfileTierLevel(ptls); vps.setVPSExtensionFlag ( false ); -#if !JVET_Q0814_DPB - m_cEncLib.setVPS(&vps); -#endif m_cEncLib.setProfile ( m_profile); m_cEncLib.setLevel ( m_levelTier, m_level); m_cEncLib.setNumSubProfile ( m_numSubProfile ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 0384cc490c3dc7369a290151e4aad96d36b419ce..5b3068342f4017831a7a3e922c3337b2ebcc3123 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1374,9 +1374,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "SwitchPocPeriod", m_switchPocPeriod, 0, "Switch POC period for RPR" ) ( "UpscaledOutput", m_upscaledOutput, 0, "Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR" ) ( "MaxLayers", m_maxLayers, 1, "Max number of layers" ) -#if JVET_Q0814_DPB ( "TargetOutputLayerSet,p", m_targetOlsIdx, -1, "Target output layer set index" ) -#endif ; opts.addOptions() ( "MaxSublayers", m_maxSublayers, 1, "Max number of Sublayers") diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 2bfca35a46f7384dbb3361e2a6568e312287ec21..221e54c80caa2696b0a09f7835af990ca1e8dc03 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -716,9 +716,7 @@ protected: std::map<int, double> m_gopBasedTemporalFilterStrengths; ///< Filter strength per frame for the GOP-based Temporal Filter int m_maxLayers; -#if JVET_Q0814_DPB int m_targetOlsIdx; -#endif int m_layerId[MAX_VPS_LAYERS]; int m_layerIdx; diff --git a/source/Lib/CommonLib/ProfileLevelTier.cpp b/source/Lib/CommonLib/ProfileLevelTier.cpp index e6faf212bef7557e0424e6b5ee9edb3d7dbc049b..0d47501d59c1c73f6fc358e92246812de66dd032 100644 --- a/source/Lib/CommonLib/ProfileLevelTier.cpp +++ b/source/Lib/CommonLib/ProfileLevelTier.cpp @@ -126,7 +126,6 @@ uint64_t ProfileLevelTierFeatures::getCpbSizeInBits() const return (m_pLevelTier!=0 && m_pProfile!=0) ? uint64_t(m_pProfile->cpbVclFactor) * m_pLevelTier->maxCpb[m_tier?1:0] : uint64_t(0); } -#if JVET_Q0814_DPB uint32_t ProfileLevelTierFeatures::getMaxDpbSize( uint32_t picSizeMaxInSamplesY ) const { const uint32_t maxDpbPicBuf = 8; @@ -147,4 +146,3 @@ uint32_t ProfileLevelTierFeatures::getMaxDpbSize( uint32_t picSizeMaxInSamplesY return maxDpbSize; } -#endif \ No newline at end of file diff --git a/source/Lib/CommonLib/ProfileLevelTier.h b/source/Lib/CommonLib/ProfileLevelTier.h index dfb9d4596896a6417e53717be3d1735308f096d0..2d99c311f2bc4db0654b52ccf75f2d41bcd84247 100644 --- a/source/Lib/CommonLib/ProfileLevelTier.h +++ b/source/Lib/CommonLib/ProfileLevelTier.h @@ -95,9 +95,7 @@ class ProfileLevelTierFeatures Level::Tier getTier() const { return m_tier; } uint64_t getCpbSizeInBits() const; double getMinCr() const; -#if JVET_Q0814_DPB uint32_t getMaxDpbSize( uint32_t picSizeMaxInSamplesY ) const; -#endif }; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 76d9f370d920c34e692f6f8799b81e85afcb95be..8695b99b92340f36676032da49198b87009ca686 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2014,12 +2014,10 @@ VPS::VPS() , m_vpsGeneralHrdParamsPresentFlag(false) , m_vpsSublayerCpbParamsPresentFlag(false) , m_numOlsHrdParamsMinus1(0) -#if JVET_Q0814_DPB , m_totalNumOLSs( 0 ) , m_numDpbParams( 0 ) , m_sublayerDpbParamsPresentFlag( false ) , m_targetOlsIdx( -1 ) -#endif { for (int i = 0; i < MAX_VPS_LAYERS; i++) { @@ -2053,7 +2051,6 @@ VPS::~VPS() { } -#if JVET_Q0814_DPB void VPS::deriveOutputLayerSets() { if( m_uiMaxLayers == 1 ) @@ -2224,7 +2221,6 @@ void VPS::deriveTargetOutputLayerSet( int targetOlsIdx ) m_targetLayerIdSet.push_back( m_layerIdInOls[m_targetOlsIdx][i] ); } } -#endif // ------------------------------------------------------------------------------------------------ // Picture Header diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 541e27c3889c59a6de5d1bffdb2d8b063610d4d9..9d5814bc45e32965c3a39229b41db5a797189f2b 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -71,14 +71,12 @@ typedef std::list<Picture*> PicList; // Class definition // ==================================================================================================================== -#if JVET_Q0814_DPB struct DpbParameters { int m_maxDecPicBuffering[MAX_TLAYER] = { 0 }; int m_numReorderPics[MAX_TLAYER] = { 0 }; int m_maxLatencyIncreasePlus1[MAX_TLAYER] = { 0 }; }; -#endif class ReferencePictureList { @@ -943,7 +941,6 @@ private: uint32_t m_hrdMaxTid[MAX_NUM_OLSS]; uint32_t m_olsHrdIdx[MAX_NUM_OLSS]; GeneralHrdParams m_generalHrdParams; -#if JVET_Q0814_DPB std::vector<Size> m_olsDpbPicSize; std::vector<int> m_olsDpbParamsIdx; std::vector<std::vector<int>> m_outputLayerIdInOls; @@ -960,10 +957,6 @@ public: std::vector<int> m_numOutputLayersInOls; std::vector<int> m_numLayersInOls; std::vector<std::vector<int>> m_layerIdInOls; -#elif JVET_P0288_PIC_OUTPUT -public: - int m_targetOlsIdx; -#endif public: VPS(); @@ -1053,7 +1046,6 @@ public: void setTargetOlsIdx(uint32_t t) { m_targetOlsIdx = t; } #endif -#if JVET_Q0814_DPB int getMaxDecPicBuffering( int temporalId ) const { return m_dpbParameters[m_olsDpbParamsIdx[m_targetOlsIdx]].m_maxDecPicBuffering[temporalId]; } int getNumReorderPics( int temporalId ) const { return m_dpbParameters[m_olsDpbParamsIdx[m_targetOlsIdx]].m_numReorderPics[temporalId]; } int getTotalNumOLSs() const { return m_totalNumOLSs; } @@ -1067,7 +1059,6 @@ public: void deriveOutputLayerSets(); void deriveTargetOutputLayerSet( int targetOlsIdx ); -#endif void setNumLayersInOls(int olsIdx, int numLayers) { m_numLayersInOls[olsIdx] = numLayers; } int getNumLayersInOls(int olsIdx) const { return m_numLayersInOls[olsIdx]; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index aebfab222b4f1a98a95279e1eecc9f8d38d0062d..4b66773d820b2578ebb704d7e9e74d4034de7478 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -118,7 +118,6 @@ -#define JVET_Q0814_DPB 1 // JVET-Q0814: DPB capacity is based on picture units regardless of the resoltuion #define ENABLING_MULTI_SPS 1 // Bug fix to enable multiple SPS #define SPS_ID_CHECK 1 // add SPS id check to be the same within CLVS, related to mixed_nalu_types_in_pic_flag #define JVET_P0124_MIXED_NALU 1 // JVET-P0124/P0095/P0222: MIxed IRAP/non-IRAP VCL NAL units within a picture diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 602c0948fdb5453526f1bc0f7d4050bdca7bc3a6..f5bab8d641923edb05eec417bbbc119bf14b5cf5 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -276,7 +276,6 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri uint32_t maxNrSublayers = activeSPS->getMaxTLayers(); uint32_t numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1); uint32_t maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(maxNrSublayers-1); -#if JVET_Q0814_DPB const VPS* referredVPS = pcListPic->front()->cs->vps; if( referredVPS != nullptr && referredVPS->m_numLayersInOls[referredVPS->m_targetOlsIdx] > 1 ) @@ -284,7 +283,6 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri numReorderPicsHighestTid = referredVPS->getNumReorderPics( maxNrSublayers - 1 ); maxDecPicBufferingHighestTid = referredVPS->getMaxDecPicBuffering( maxNrSublayers - 1 ); } -#endif while (iterPic != pcListPic->end()) { @@ -540,11 +538,7 @@ void DecLib::deletePicBuffer ( ) Picture* DecLib::xGetNewPicBuffer( const SPS &sps, const PPS &pps, const uint32_t temporalLayer, const int layerId ) { Picture * pcPic = nullptr; -#if JVET_Q0814_DPB m_iMaxRefPicNum = ( m_vps == nullptr || m_vps->m_numLayersInOls[m_vps->m_targetOlsIdx] == 1 ) ? sps.getMaxDecPicBuffering( temporalLayer ) : m_vps->getMaxDecPicBuffering( temporalLayer ); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded -#else - m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded -#endif if (m_cListPic.size() < (uint32_t)m_iMaxRefPicNum) { pcPic = new Picture(); @@ -1387,9 +1381,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) Slice *slice = m_pcPic->slices[m_uiSliceSegmentIdx]; const SPS *sps = slice->getSPS(); const PPS *pps = slice->getPPS(); -#if JVET_Q0814_DPB const VPS *vps = slice->getVPS(); -#endif if (((vps!=nullptr)&&(vps->getVPSGeneralHrdParamsPresentFlag()))||(sps->getGeneralHrdParametersPresentFlag())) { if (((vps != nullptr) && (vps->getVPSGeneralHrdParamsPresentFlag())) && (sps->getGeneralHrdParametersPresentFlag())) @@ -1448,13 +1440,11 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) CHECK( sps->getWrapAroundEnabledFlag(), "Wraparound shall be disabled when the value of ( CtbSizeY / MinCbSizeY + 1) is less than or equal to ( pic_width_in_luma_samples / MinCbSizeY - 1 )" ); } -#if JVET_Q0814_DPB if( vps != nullptr && vps->m_numOutputLayersInOls[vps->m_targetOlsIdx] > 1 ) { CHECK( sps->getMaxPicWidthInLumaSamples() > vps->getOlsDpbPicSize( vps->m_targetOlsIdx ).width, "pic_width_max_in_luma_samples shall be less than or equal to the value of ols_dpb_pic_width[ i ]" ); CHECK( sps->getMaxPicHeightInLumaSamples() > vps->getOlsDpbPicSize( vps->m_targetOlsIdx ).height, "pic_height_max_in_luma_samples shall be less than or equal to the value of ols_dpb_pic_height[ i ]" ); } -#endif static std::unordered_map<int, int> m_layerChromaFormat; static std::unordered_map<int, int> m_layerBitDepth; diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 727456fa357508cf5fa26890b04db972dc768688..45c62b94ba18ee1645f2a0f720a694c95ad14bde 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -226,9 +226,7 @@ public: bool isSliceNaluFirstInAU( bool newPicture, InputNALUnit &nalu ); const VPS* getVPS() { return m_vps; } -#if JVET_Q0814_DPB void deriveTargetOutputLayerSet( const int targetOlsIdx ) { if( m_vps != nullptr ) m_vps->deriveTargetOutputLayerSet( targetOlsIdx ); } -#endif void initScalingList() { diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index f55abf9ca28dfaa7d2ffe49f74b956dea483a44d..562939f44636aee48ecf3fd506bcffd75f0b53b5 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -2267,7 +2267,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) pcVPS->setOlsPtlIdx(i, 0); } -#if JVET_Q0814_DPB if( !pcVPS->getAllIndependentLayersFlag() ) { READ_UVLC( uiCode, "vps_num_dpb_params" ); pcVPS->m_numDpbParams = uiCode; @@ -2333,7 +2332,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) } } } -#endif if (!pcVPS->getEachLayerIsAnOlsFlag()) { READ_FLAG(uiCode, "vps_general_hrd_params_present_flag"); pcVPS->setVPSGeneralHrdParamsPresentFlag(uiCode); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index ec6a1f071aa7b664a55cbfe419a4a04045d6d7fe..eab51712406891f8a9764ffbf941844ec9e62664 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -693,9 +693,6 @@ protected: #endif CostMode m_costMode; ///< The cost function to use, primarily when considering lossless coding. -#if !JVET_Q0814_DPB - VPS m_cVPS; -#endif #if JVET_Q0117_PARAMETER_SETS_CLEANUP DCI m_dci; @@ -1779,10 +1776,6 @@ public: CostMode getCostMode( ) const { return m_costMode; } void setCostMode(CostMode m ) { m_costMode = m; } -#if !JVET_Q0814_DPB - void setVPS(VPS *p) { m_cVPS = *p; } - VPS * getVPS() { return &m_cVPS; } -#endif #if JVET_Q0117_PARAMETER_SETS_CLEANUP diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 2b4353ec4db3576a30914b6f710a9be0c7999a97..6dc1b726ef91bd09ddc3671dcfceb281c8c06e3c 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -47,9 +47,7 @@ #include <omp.h> #endif #include "EncLibCommon.h" -#if JVET_Q0814_DPB #include "CommonLib/ProfileLevelTier.h" -#endif //! \ingroup EncoderLib //! \{ @@ -71,9 +69,7 @@ EncLib::EncLib( EncLibCommon* encLibCommon ) , m_lmcsAPS(nullptr) , m_scalinglistAPS( nullptr ) , m_doPlt( true ) -#if JVET_Q0814_DPB , m_vps( encLibCommon->getVPS() ) -#endif { m_iPOCLast = -1; m_iNumPicRcvd = 0; @@ -228,13 +224,8 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) aps0.setAPSType( SCALING_LIST_APS ); // initialize SPS -#if JVET_Q0814_DPB xInitSPS( sps0 ); xInitVPS( sps0 ); -#else - xInitSPS( sps0, m_cVPS ); - xInitVPS(m_cVPS, sps0); -#endif #if JVET_Q0117_PARAMETER_SETS_CLEANUP xInitDCI(m_dci, sps0); @@ -469,11 +460,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) Picture *picBg = new Picture; picBg->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false, m_layerId ); picBg->getRecoBuf().fill(0); -#if JVET_Q0814_DPB picBg->finalInit( m_vps, sps0, pps0, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - picBg->finalInit( &m_cVPS, sps0, pps0, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif picBg->allocateNewSlice(); picBg->createSpliceIdx(pps0.pcv->sizeInCtus); m_cGOPEncoder.setPicBg(picBg); @@ -604,11 +591,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu const SPS *sps = m_spsMap.getPS( pps->getSPSId() ); picCurr->M_BUFS( 0, PIC_ORIGINAL ).copyFrom( m_cGOPEncoder.getPicBg()->getRecoBuf() ); -#if JVET_Q0814_DPB picCurr->finalInit( m_vps, *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - picCurr->finalInit( &m_cVPS, *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif picCurr->poc = m_iPOCLast - 1; m_iPOCLast -= 2; if( getUseAdaptiveQP() ) @@ -664,11 +647,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu } } -#if JVET_Q0814_DPB if( m_vps->getMaxLayers() > 1 ) -#else - if( m_cVPS.getMaxLayers() > 1 ) -#endif { ppsID = m_vps->getGeneralLayerIdx( m_layerId ); } @@ -724,11 +703,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL ).swap( *cPicYuvTrueOrg ); } -#if JVET_Q0814_DPB pcPicCurr->finalInit( m_vps, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - pcPicCurr->finalInit( &m_cVPS, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif pcPicCurr->poc = m_iPOCLast; @@ -863,11 +838,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicY const PPS *pPPS = ( ppsID < 0 ) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS( ppsID ); const SPS *pSPS = m_spsMap.getPS( pPPS->getSPSId() ); -#if JVET_Q0814_DPB pcField->finalInit( m_vps, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - pcField->finalInit( &m_cVPS, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif pcField->poc = m_iPOCLast; pcField->reconstructed = false; @@ -955,13 +926,9 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict Slice::sortPicList(m_cListPic); // use an entry in the buffered list if the maximum number that need buffering has been reached: -#if JVET_Q0814_DPB int maxDecPicBuffering = ( m_vps == nullptr || m_vps->m_numLayersInOls[m_vps->m_targetOlsIdx] == 1 ) ? sps.getMaxDecPicBuffering( MAX_TLAYER - 1 ) : m_vps->getMaxDecPicBuffering( MAX_TLAYER - 1 ); if( m_cListPic.size() >= (uint32_t)( m_iGOPSize + maxDecPicBuffering + 2 ) ) -#else - if( m_cListPic.size() >= (uint32_t)( m_iGOPSize + getMaxDecPicBuffering( MAX_TLAYER - 1 ) + 2 ) ) -#endif { PicList::iterator iterPic = m_cListPic.begin(); int iSize = int( m_cListPic.size() ); @@ -1023,7 +990,6 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict m_iNumPicRcvd++; } -#if JVET_Q0814_DPB void EncLib::xInitVPS( const SPS& sps ) { // The SPS must have already been set up. @@ -1106,13 +1072,6 @@ void EncLib::xInitVPS( const SPS& sps ) } } } -#else -void EncLib::xInitVPS(VPS& vps, const SPS& sps) -{ - // The SPS must have already been set up. - // set the VPS profile information. -} -#endif #if JVET_Q0117_PARAMETER_SETS_CLEANUP void EncLib::xInitDCI(DCI& dci, const SPS& sps) @@ -1137,11 +1096,7 @@ void EncLib::xInitDPS(DPS &dps, const SPS &sps, const int dpsId) } #endif -#if JVET_Q0814_DPB void EncLib::xInitSPS( SPS& sps ) -#else -void EncLib::xInitSPS( SPS& sps, VPS& vps ) -#endif { ProfileTierLevel* profileTierLevel = sps.getProfileTierLevel(); ConstraintInfo* cinfo = profileTierLevel->getConstraintInfo(); @@ -1210,11 +1165,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) /* XXX: should Main be marked as compatible with still picture? */ /* XXX: may be a good idea to refactor the above into a function * that chooses the actual compatibility based upon options */ -#if JVET_Q0814_DPB sps.setVPSId( m_vps->getVPSId() ); -#else - sps.setVPSId(m_cVPS.getVPSId()); -#endif sps.setMaxPicWidthInLumaSamples( m_iSourceWidth ); sps.setMaxPicHeightInLumaSamples( m_iSourceHeight ); if (m_rprEnabled) @@ -1472,7 +1423,6 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) } } -#if JVET_Q0814_DPB #if ENABLING_MULTI_SPS sps.setInterLayerPresentFlag( m_layerId > 0 && m_vps->getMaxLayers() > 1 && !m_vps->getAllIndependentLayersFlag() && !m_vps->getIndependentLayerFlag( m_vps->getGeneralLayerIdx( m_layerId ) ) ); CHECK( m_vps->getIndependentLayerFlag( m_vps->getGeneralLayerIdx( m_layerId ) ) && sps.getInterLayerPresentFlag(), " When vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id ]] is equal to 1, the value of inter_layer_ref_pics_present_flag shall be equal to 0." ); @@ -1487,21 +1437,6 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) CHECK((m_vps->getIndependentLayerFlag(i) == 1) && (sps.getInterLayerPresentFlag() != 0), " When vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id ]] is equal to 1, the value of inter_layer_ref_pics_present_flag shall be equal to 0."); } #endif -#else -#if ENABLING_MULTI_SPS - sps.setInterLayerPresentFlag( m_layerId > 0 && vps.getMaxLayers() > 1 && !vps.getAllIndependentLayersFlag() && !vps.getIndependentLayerFlag( vps.getGeneralLayerIdx( m_layerId ) ) ); - CHECK( vps.getIndependentLayerFlag( vps.getGeneralLayerIdx( m_layerId ) ) && sps.getInterLayerPresentFlag(), " When vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id ]] is equal to 1, the value of inter_layer_ref_pics_present_flag shall be equal to 0." ); -#else - sps.setInterLayerPresentFlag( vps.getMaxLayers() > 1 && !vps.getAllIndependentLayersFlag() ); - for (unsigned int i = 0; i < vps.getMaxLayers(); ++i) - { - //Bug fix to make the decoder run with configfile layers.cfg - if(vps.getIndependentLayerFlag(i) == 1) - sps.setInterLayerPresentFlag(0); - CHECK((vps.getIndependentLayerFlag(i) == 1) && (sps.getInterLayerPresentFlag() != 0), " When vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id ]] is equal to 1, the value of inter_layer_ref_pics_present_flag shall be equal to 0."); - } -#endif -#endif sps.setRprEnabledFlag( m_rprEnabled || sps.getInterLayerPresentFlag() ); diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index 5a8ba8c87c69b6cddf24cb276fc09c1e8d184f2e..50a65625ec7a5c9202180d914b5e27a58040d5b7 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -155,9 +155,7 @@ private: #endif int m_picIdInGOP; -#if JVET_Q0814_DPB VPS* m_vps; -#endif public: SPS* getSPS( int spsId ) { return m_spsMap.getPS( spsId ); }; @@ -174,13 +172,8 @@ protected: #else void xInitDPS (DPS &dps, const SPS &sps, const int dpsId); ///< initialize DPS from encoder options #endif -#if JVET_Q0814_DPB void xInitVPS( const SPS& sps ); ///< initialize VPS from encoder options void xInitSPS( SPS& sps ); ///< initialize SPS from encoder options -#else - void xInitVPS(VPS& vps, const SPS& sps); ///< initialize VPS from encoder options - void xInitSPS ( SPS& sps, VPS& vps ); ///< initialize SPS from encoder options -#endif void xInitPPS (PPS &pps, const SPS &sps); ///< initialize PPS from encoder options void xInitPicHeader (PicHeader &picHeader, const SPS &sps, const PPS &pps); ///< initialize Picture Header from encoder options void xInitAPS (APS &aps); ///< initialize APS from encoder options @@ -299,9 +292,7 @@ public: void printSummary( bool isField ) { m_cGOPEncoder.printOutSummary( m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_printHexPsnr, m_rprEnabled, m_spsMap.getFirstPS()->getBitDepths() ); } int getLayerId() const { return m_layerId; } -#if JVET_Q0814_DPB VPS* getVPS() { return m_vps; } -#endif }; //! \} diff --git a/source/Lib/EncoderLib/EncLibCommon.h b/source/Lib/EncoderLib/EncLibCommon.h index a422beda396f3fbf0fad974f1f5a35b649708645..996ddc93af5071311528055c2163982d71f6b6b2 100644 --- a/source/Lib/EncoderLib/EncLibCommon.h +++ b/source/Lib/EncoderLib/EncLibCommon.h @@ -49,9 +49,7 @@ private: ParameterSetMap<PPS> m_ppsMap; ///< PPS, it is shared across all layers ParameterSetMap<APS> m_apsMap; ///< APS, it is shared across all layers PicList m_cListPic; ///< DPB, it is shared across all layers -#if JVET_Q0814_DPB VPS m_vps; -#endif public: EncLibCommon(); @@ -62,8 +60,6 @@ public: ParameterSetMap<SPS>& getSpsMap() { return m_spsMap; } ParameterSetMap<PPS>& getPpsMap() { return m_ppsMap; } ParameterSetMap<APS>& getApsMap() { return m_apsMap; } -#if JVET_Q0814_DPB VPS* getVPS() { return &m_vps; } -#endif }; diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index f619251f631544120438de3234a9c5d18553d24e..e3614a528f531fa0035a4e5ce72d8f15cc698159 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1470,7 +1470,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS) WRITE_CODE(pcVPS->getOlsPtlIdx(i), 8, "ols_ptl_idx"); } -#if JVET_Q0814_DPB if( !pcVPS->getAllIndependentLayersFlag() ) { WRITE_UVLC( pcVPS->m_numDpbParams, "vps_num_dpb_params" ); @@ -1519,7 +1518,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS) } } } -#endif if (!pcVPS->getEachLayerIsAnOlsFlag()) { WRITE_FLAG(pcVPS->getVPSGeneralHrdParamsPresentFlag(), "vps_general_hrd_params_present_flag");