diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp index d603402bf4935b8206a2672c43d16becb9580438..69d39506d0d048e9ea2e6a215d38ea7fdce4178e 100644 --- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp +++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp @@ -46,9 +46,7 @@ #include "EncoderLib/AnnexBwrite.h" BitstreamExtractorApp::BitstreamExtractorApp() -#if JVET_P0118_OLS_EXTRACTION :m_vpsId(-1) -#endif { } @@ -79,7 +77,6 @@ void BitstreamExtractorApp::xPrintVPSInfo (VPS *vps) } } -#if JVET_Q0397_SUB_PIC_EXTRACT void BitstreamExtractorApp::xPrintSubPicInfo (PPS *pps) { msg (VERBOSE, "Subpic Info: \n"); @@ -282,7 +279,6 @@ void BitstreamExtractorApp::xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, S } -#endif void BitstreamExtractorApp::xWriteVPS(VPS *vps, std::ostream& out, int layerId, int temporalId) { @@ -411,9 +407,7 @@ uint32_t BitstreamExtractorApp::decode() // get VPS back vps = m_parameterSetManager.getVPS(vpsId); xPrintVPSInfo(vps); -#if JVET_P0118_OLS_EXTRACTION m_vpsId = vps->getVPSId(); -#endif // example: just write the parsed VPS back to the stream // *** add modifications here *** // only write, if not dropped earlier @@ -424,7 +418,6 @@ uint32_t BitstreamExtractorApp::decode() } } -#if JVET_P0118_OLS_EXTRACTION VPS *vps = nullptr; if (m_targetOlsIdx >= 0) { @@ -449,7 +442,6 @@ uint32_t BitstreamExtractorApp::decode() writeInpuNalUnitToStream &= (isSpecialNalTypes || isIncludedInTargetOls); } } -#endif if( nalu.m_nalUnitType == NAL_UNIT_SPS ) { SPS* sps = new SPS(); @@ -466,7 +458,6 @@ uint32_t BitstreamExtractorApp::decode() // *** add modifications here *** // only write, if not dropped earlier // rewrite the SPS -#if JVET_Q0397_SUB_PIC_EXTRACT if (m_subPicId >= 0) { // we generally don't write SPS to the bitstream unless referred to by PPS @@ -474,7 +465,6 @@ uint32_t BitstreamExtractorApp::decode() xSetSPSUpdated(sps->getSPSId()); writeInpuNalUnitToStream = false; } -#endif if (writeInpuNalUnitToStream) { xWriteSPS(sps, bitstreamFileOut, nalu.m_nuhLayerId, nalu.m_temporalId); @@ -494,7 +484,6 @@ uint32_t BitstreamExtractorApp::decode() pps = m_parameterSetManager.getPPS(ppsId); msg (VERBOSE, "PPS Info: PPS ID = %d\n", pps->getPPSId()); -#if JVET_Q0397_SUB_PIC_EXTRACT SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); if ( nullptr == sps) { @@ -536,7 +525,6 @@ uint32_t BitstreamExtractorApp::decode() writeInpuNalUnitToStream = false; } } -#endif // example: just write the parsed PPS back to the stream // *** add modifications here *** @@ -547,7 +535,6 @@ uint32_t BitstreamExtractorApp::decode() writeInpuNalUnitToStream = false; } } -#if JVET_Q0397_SUB_PIC_EXTRACT // when re-using code for slice header parsing, we need to store APSs if( ( nalu.m_nalUnitType == NAL_UNIT_PREFIX_APS ) || ( nalu.m_nalUnitType == NAL_UNIT_SUFFIX_APS )) { @@ -566,8 +553,6 @@ uint32_t BitstreamExtractorApp::decode() { xReadPicHeader(nalu); } -#endif -#if JVET_P0118_OLS_EXTRACTION if (m_targetOlsIdx>=0) { if (nalu.m_nalUnitType == NAL_UNIT_PREFIX_SEI) @@ -609,8 +594,6 @@ uint32_t BitstreamExtractorApp::decode() delete vps; } } -#endif -#if JVET_Q0397_SUB_PIC_EXTRACT if (m_subPicId>=0) { if ( nalu.isSlice() ) @@ -620,7 +603,6 @@ uint32_t BitstreamExtractorApp::decode() } } -#endif unitCnt++; if( writeInpuNalUnitToStream ) diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h index 6adc782a1048e9533a8faceb7c706f33f2560e55..67ca21234ab323647852f6d12ee1342a3fe26659 100644 --- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h +++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h @@ -49,9 +49,7 @@ #include "VLCReader.h" #include "VLCWriter.h" -#if JVET_P0118_OLS_EXTRACTION #include "SEIread.h" -#endif class BitstreamExtractorApp : public BitstreamExtractorAppCfg { @@ -64,7 +62,6 @@ public: protected: void xPrintVPSInfo (VPS *vps); -#if JVET_Q0397_SUB_PIC_EXTRACT void xPrintSubPicInfo (PPS *pps); void xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic); void xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, SubPic &subPic); @@ -75,7 +72,6 @@ protected: void xSetSPSUpdated(int spsId) { return m_updatedSPSList.push_back(spsId); } bool xIsSPSUpdate(int spsId) { return (std::find(m_updatedSPSList.begin(),m_updatedSPSList.end(), spsId) != m_updatedSPSList.end()); } void xClearSPSUpdated(int spsId) { m_updatedSPSList.erase(std::remove(m_updatedSPSList.begin(), m_updatedSPSList.end(), spsId)); }; -#endif void xWriteVPS(VPS *vps, std::ostream& out, int layerId, int temporalId); void xWriteSPS(SPS *sps, std::ostream& out, int layerId, int temporalId); @@ -84,18 +80,14 @@ protected: ParameterSetManager m_parameterSetManager; HLSyntaxReader m_hlSynaxReader; HLSWriter m_hlSyntaxWriter; -#if JVET_P0118_OLS_EXTRACTION SEIReader m_seiReader; int m_vpsId; -#endif -#if JVET_Q0397_SUB_PIC_EXTRACT PicHeader m_picHeader; int m_prevTid0Poc; std::vector<int> m_updatedVPSList; std::vector<int> m_updatedSPSList; std::vector<int> m_updatedPPSList; -#endif }; #endif // __BITSTREAMEXTRACTORAPP__ diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp index 51978d83270bf8332ef38352705859d4ae4c61eb..b5b989effe83a3f0bd45ec8129e2a7cc5886df38 100644 --- a/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp +++ b/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp @@ -120,22 +120,7 @@ namespace po = df::program_options_lite; return false; } } -#if JVET_P0118_OLS_EXTRACTION CHECK(m_maxTemporalLayer < -1 || m_maxTemporalLayer > 6, "MaxTemporalLayer shall either be equal -1 (for diabled) or in the range of 0 to 6, inclusive"); -#else - if (m_targetOlsIdx != -1) - { - std::cerr << "Extraction by target output layer set index is not implemented yet"; - return false; - } -#endif -#if !JVET_Q0397_SUB_PIC_EXTRACT - if (m_subPicId != -1) - { - std::cerr << "Extraction by subpicture ID is not implemented yet"; - return false; - } -#endif if (m_bitstreamFileNameIn.empty()) { @@ -155,13 +140,8 @@ namespace po = df::program_options_lite; BitstreamExtractorAppCfg::BitstreamExtractorAppCfg() : m_bitstreamFileNameIn() , m_bitstreamFileNameOut() -#if JVET_P0118_OLS_EXTRACTION , m_maxTemporalLayer( 0 ) , m_targetOlsIdx( 0 ) -#else -, m_maxTemporalLayer( -1 ) -, m_targetOlsIdx( -1 ) -#endif , m_subPicId( -1 ) { } diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 50dc96432f5ebeb9c03d3360aa301c1cf68df085..2de06ad2c9a4b9acf92f479ff2162c8ec9de86ac 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -95,7 +95,6 @@ uint32_t DecApp::decode() } } -#if JVET_P2008_OUTPUT_LOG if (!m_oplFilename.empty() && m_oplFilename!="-") { m_oplFileStream.open(m_oplFilename.c_str(), std::ios::out); @@ -104,7 +103,6 @@ uint32_t DecApp::decode() EXIT( "Unable to open file "<< m_oplFilename.c_str() << " to write an opl-file for conformance testing (see JVET-P2008 for details)"); } } -#endif //JVET_P2008_OUTPUT_LOG // create & initialize internal classes xCreateDecLib(); @@ -122,11 +120,7 @@ uint32_t DecApp::decode() } // main decoder loop -#if JVET_P0125_EOS_LAYER_SPECIFIC bool loopFiltered[MAX_VPS_LAYERS] = { false }; -#else - bool loopFiltered = false; -#endif bool bPicSkipped = false; @@ -167,19 +161,13 @@ 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 { -#if JVET_P0115_LAYER_TID_CONSTRAINT CHECK(nalu.m_temporalId > m_iMaxTemporalLayer, "bitstream shall not include any NAL unit with TemporalId greater than HighestTid"); if (m_targetDecLayerIdSet.size()) { CHECK(std::find(m_targetDecLayerIdSet.begin(), m_targetDecLayerIdSet.end(), nalu.m_nuhLayerId) == m_targetDecLayerIdSet.end(), "bitstream shall not contain any other layers than included in the OLS with OlsIdx"); } -#endif if (bPicSkipped) { if ((nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR)) @@ -188,27 +176,17 @@ uint32_t DecApp::decode() { m_cDecLib.resetAccessUnitNals(); m_cDecLib.resetAccessUnitApsNals(); -#if JVET_P0101_POC_MULTILAYER m_cDecLib.resetAccessUnitPicInfo(); -#endif } bPicSkipped = false; } } -#if JVET_P0288_PIC_OUTPUT m_cDecLib.decode(nalu, m_iSkipFrame, m_iPOCLastDisplay, m_targetOlsIdx); -#else - m_cDecLib.decode(nalu, m_iSkipFrame, m_iPOCLastDisplay); -#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 @@ -218,45 +196,23 @@ uint32_t DecApp::decode() } } -#if JVET_P0125_EOS_LAYER_SPECIFIC if ((bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && !m_cDecLib.getFirstSliceInSequence(nalu.m_nuhLayerId) && !bPicSkipped) -#else - if ((bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && !m_cDecLib.getFirstSliceInSequence() && !bPicSkipped) -#endif { -#if JVET_P0125_EOS_LAYER_SPECIFIC if (!loopFiltered[nalu.m_nuhLayerId] || bitstreamFile) -#else - if (!loopFiltered || bitstreamFile) -#endif { m_cDecLib.executeLoopFilters(); m_cDecLib.finishPicture( poc, pcListPic ); } -#if JVET_P0125_EOS_LAYER_SPECIFIC loopFiltered[nalu.m_nuhLayerId] = (nalu.m_nalUnitType == NAL_UNIT_EOS); -#else - loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS); -#endif if (nalu.m_nalUnitType == NAL_UNIT_EOS) { -#if JVET_P0125_EOS_LAYER_SPECIFIC m_cDecLib.setFirstSliceInSequence(true, nalu.m_nuhLayerId); -#else - m_cDecLib.setFirstSliceInSequence(true); -#endif } -#if JVET_P0978_RPL_RESTRICTIONS m_cDecLib.updateAssociatedIRAP(); -#endif } else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && -#if JVET_P0125_EOS_LAYER_SPECIFIC m_cDecLib.getFirstSliceInSequence(nalu.m_nuhLayerId)) -#else - m_cDecLib.getFirstSliceInSequence () ) -#endif { m_cDecLib.setFirstSliceInPicture (true); } @@ -280,11 +236,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) @@ -296,17 +248,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 ) @@ -327,19 +272,13 @@ uint32_t DecApp::decode() } if(bNewAccessUnit) { -#if JVET_P0125_ASPECT_TID_LAYER_ID_NUH m_cDecLib.checkTidLayerIdInAccessUnit(); m_cDecLib.resetAccessUnitSeiTids(); -#endif -#if JVET_P0125_SEI_CONSTRAINTS m_cDecLib.checkSEIInAccessUnit(); m_cDecLib.resetAccessUnitSeiPayLoadTypes(); -#endif m_cDecLib.resetAccessUnitNals(); m_cDecLib.resetAccessUnitApsNals(); -#if JVET_P0101_POC_MULTILAYER m_cDecLib.resetAccessUnitPicInfo(); -#endif } } @@ -362,178 +301,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 @@ -575,11 +342,7 @@ bool DecApp::isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytest // NUT that indicate the start of a new picture case NAL_UNIT_ACCESS_UNIT_DELIMITER: -#if JVET_Q0117_PARAMETER_SETS_CLEANUP case NAL_UNIT_DCI: -#else - case NAL_UNIT_DPS: -#endif case NAL_UNIT_VPS: case NAL_UNIT_SPS: case NAL_UNIT_PPS: @@ -588,11 +351,7 @@ bool DecApp::isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytest finished = true; break; -#if JVET_Q0775_PH_IN_SH // NUT that may be the start of a new picture - check first bit in slice header -#else - // NUT that are not the start of a new picture -#endif case NAL_UNIT_CODED_SLICE_TRAIL: case NAL_UNIT_CODED_SLICE_STSA: case NAL_UNIT_CODED_SLICE_RASL: @@ -606,13 +365,11 @@ bool DecApp::isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytest case NAL_UNIT_CODED_SLICE_GDR: case NAL_UNIT_RESERVED_IRAP_VCL_11: case NAL_UNIT_RESERVED_IRAP_VCL_12: -#if JVET_Q0775_PH_IN_SH ret = checkPictureHeaderInSliceHeaderFlag(nalu); finished = true; break; // NUT that are not the start of a new picture -#endif case NAL_UNIT_EOS: case NAL_UNIT_EOB: case NAL_UNIT_SUFFIX_APS: @@ -745,7 +502,6 @@ bool DecApp::isNewAccessUnit( bool newPicture, ifstream *bitstreamFile, class In return ret; } -#if JVET_P2008_OUTPUT_LOG void DecApp::writeLineToOutputLog(Picture * pcPic) { if (m_oplFileStream.is_open() && m_oplFileStream.good()) @@ -758,7 +514,6 @@ void DecApp::writeLineToOutputLog(Picture * pcPic) m_oplFileStream << std::setw(8) << pcPic->getPOC() << "," << std::setw(5) << pcPic->Y().width << "," << std::setw(5) << pcPic->Y().height << "," << hashToString(recon_digest, numChar) << "\n"; } } -#endif // JVET_P2008_OUTPUT_LOG // ==================================================================================================================== // Protected member functions @@ -785,9 +540,7 @@ void DecApp::xCreateDecLib() std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout; m_cDecLib.setDecodedSEIMessageOutputStream(&os); } -#if JVET_O1143_SUBPIC_BOUNDARY m_cDecLib.m_targetSubPicIdx = this->m_targetSubPicIdx; -#endif m_cDecLib.initScalingList(); } @@ -824,7 +577,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; @@ -838,18 +590,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()) { @@ -911,10 +651,8 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) NUM_CHROMA_FORMAT, isTff ); } } -#if JVET_P2008_OUTPUT_LOG writeLineToOutputLog(pcPicTop); writeLineToOutputLog(pcPicBottom); -#endif // update POC of display order m_iPOCLastDisplay = pcPicBottom->getPOC(); @@ -973,9 +711,7 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } } -#if JVET_P2008_OUTPUT_LOG writeLineToOutputLog(pcPic); -#endif // update POC of display order m_iPOCLastDisplay = pcPic->getPOC(); @@ -1039,10 +775,8 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) conf.getWindowBottomOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ), NUM_CHROMA_FORMAT, isTff ); } -#if JVET_P2008_OUTPUT_LOG writeLineToOutputLog(pcPicTop); writeLineToOutputLog(pcPicBottom); -#endif // update POC of display order m_iPOCLastDisplay = pcPicBottom->getPOC(); @@ -1110,9 +844,7 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } } -#if JVET_P2008_OUTPUT_LOG writeLineToOutputLog(pcPic); -#endif // update POC of display order m_iPOCLastDisplay = pcPic->getPOC(); @@ -1146,7 +878,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 @@ -1168,40 +899,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 b3a9d9420d2556ac80b974379708a10fbb726276..3749288d084dd013b1e61a750bedf14533d63744 100644 --- a/source/App/DecoderApp/DecApp.h +++ b/source/App/DecoderApp/DecApp.h @@ -66,17 +66,13 @@ private: int m_iPOCLastDisplay; ///< last POC in display order std::ofstream m_seiMessageFileStream; ///< Used for outputing SEI messages. -#if JVET_P2008_OUTPUT_LOG std::ofstream m_oplFileStream; ///< Used to output log file for confomance testing -#endif //JVET_P2008_OUTPUT_LOG -#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(); @@ -89,17 +85,10 @@ 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 -#if JVET_P2008_OUTPUT_LOG void writeLineToOutputLog(Picture * pcPic); -#endif // JVET_P2008_OUTPUT_LOG }; diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index f54530eea1c81be7487d62e76b1ef1c59aa30b3f..602f949ab9ca2c16c60df75d173484ec5206b59b 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -77,9 +77,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) ("BitstreamFile,b", m_bitstreamFileName, string(""), "bitstream input file name") ("ReconFile,o", m_reconFileName, string(""), "reconstructed YUV output file name\n") -#if JVET_P2008_OUTPUT_LOG ("OplFile,-opl", m_oplFilename , string(""), "opl-file name without extension for conformance testing\n") -#endif //JVET_P2008_OUTPUT_LOG #if ENABLE_SIMD_OPT ("SIMD", ignore, string(""), "SIMD extension to use (SCALAR, SSE41, SSE42, AVX, AVX2, AVX512), default: the highest supported extension\n") @@ -117,9 +115,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) "\t3: enable bit and tool statistic\n") #endif ("MCTSCheck", m_mctsCheck, false, "If enabled, the decoder checks for violations of mc_exact_sample_value_match_flag in Temporal MCTS ") -#if JVET_O1143_SUBPIC_BOUNDARY ("targetSubPicIdx", m_targetSubPicIdx, 0, "Specify which subpicture shall be written to output, using subpic index, 0: disabled, subpicIdx=m_targetSubPicIdx-1 \n" ) -#endif ( "UpscaledOutput", m_upscaledOutput, 0, "Upscaled output for RPR" ) ; @@ -227,9 +223,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) DecAppCfg::DecAppCfg() : m_bitstreamFileName() , m_reconFileName() -#if JVET_P2008_OUTPUT_LOG , m_oplFilename() -#endif //JVET_P2008_OUTPUT_LOG , m_iSkipFrame(0) // m_outputBitDepth array initialised below diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h index bd0b4d1cd5fe0496a91b253b1dbfebd0181b14bb..a13a6766e7849596e4a8e05939617106d9ebdec8 100644 --- a/source/App/DecoderApp/DecAppCfg.h +++ b/source/App/DecoderApp/DecAppCfg.h @@ -59,9 +59,7 @@ protected: std::string m_bitstreamFileName; ///< input bitstream file name std::string m_reconFileName; ///< output reconstruction file name -#if JVET_P2008_OUTPUT_LOG std::string m_oplFilename; ///< filename to output conformance log. -#endif //JVET_P2008_OUTPUT_LOG int m_iSkipFrame; ///< counter for frames prior to the random access point to skip int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output @@ -83,9 +81,7 @@ protected: bool m_mctsCheck; int m_upscaledOutput; ////< Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR. -#if JVET_O1143_SUBPIC_BOUNDARY int m_targetSubPicIdx; ///< Specify which subpicture shall be write to output, using subpicture index -#endif public: DecAppCfg(); virtual ~DecAppCfg(); diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 52ff9f6ab8e542ac4705811b88aaed8828984461..a5f25f522e6db28fb7d47a84ede490426a40099b 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 ); @@ -175,7 +171,6 @@ void EncApp::xInitLibCfg() } } } -#if JVET_Q0786_PTL_only CHECK( m_numPtlsInVps == 0, "There has to be at least one PTL structure in the VPS." ); vps.setNumPtls ( m_numPtlsInVps ); vps.setPtPresentFlag (0, 1); @@ -205,11 +200,7 @@ void EncApp::xInitLibCfg() ptls[i].setLevelIdc (m_levelPtl[i]); } vps.setProfileTierLevel(ptls); -#endif 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 ); @@ -220,13 +211,11 @@ void EncApp::xInitLibCfg() m_cEncLib.setProgressiveSourceFlag ( m_progressiveSourceFlag); m_cEncLib.setInterlacedSourceFlag ( m_interlacedSourceFlag); m_cEncLib.setNonPackedConstraintFlag ( m_nonPackedConstraintFlag); -#if JVET_Q0114_CONSTRAINT_FLAGS m_cEncLib.setNonProjectedConstraintFlag ( m_nonProjectedConstraintFlag ); m_cEncLib.setNoResChangeInClvsConstraintFlag ( m_noResChangeInClvsConstraintFlag ); m_cEncLib.setOneTilePerPicConstraintFlag ( m_oneTilePerPicConstraintFlag ); m_cEncLib.setOneSlicePerPicConstraintFlag ( m_oneSlicePerPicConstraintFlag ); m_cEncLib.setOneSubpicPerPicConstraintFlag ( m_oneSubpicPerPicConstraintFlag ); -#endif m_cEncLib.setFrameOnlyConstraintFlag ( m_frameOnlyConstraintFlag); m_cEncLib.setIntraConstraintFlag ( m_intraConstraintFlag ); @@ -257,9 +246,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoPartitionConstraintsOverrideConstraintFlag ( !m_SplitConsOverrideEnabledFlag ); m_cEncLib.setNoSaoConstraintFlag ( !m_bUseSAO ); m_cEncLib.setNoAlfConstraintFlag ( !m_alf ); -#if JVET_Q0795_CCALF m_cEncLib.setNoAlfConstraintFlag ( !m_ccalf ); -#endif m_cEncLib.setNoRefWraparoundConstraintFlag ( m_bNoRefWraparoundConstraintFlag ); m_cEncLib.setNoTemporalMvpConstraintFlag ( m_TMVPModeId ? false : true ); m_cEncLib.setNoSbtmvpConstraintFlag ( m_SubPuMvpMode ? false : true ); @@ -274,18 +261,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoIbcConstraintFlag ( m_IBCMode ? false : true ); m_cEncLib.setNoCiipConstraintFlag ( !m_ciip ); m_cEncLib.setNoFPelMmvdConstraintFlag ( !(m_MMVD && m_allowDisFracMMVD) ); -#if !JVET_Q0806 - m_cEncLib.setNoTriangleConstraintFlag ( !m_Triangle ); -#else m_cEncLib.setNoGeoConstraintFlag ( !m_Geo ); -#endif m_cEncLib.setNoLadfConstraintFlag ( !m_LadfEnabed ); m_cEncLib.setNoTransformSkipConstraintFlag ( !m_useTransformSkip ); -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM m_cEncLib.setNoBDPCMConstraintFlag ( !m_useBDPCM ); -#else - m_cEncLib.setNoBDPCMConstraintFlag ( m_useBDPCM == 0 ); -#endif m_cEncLib.setNoJointCbCrConstraintFlag (!m_JointCbCrMode); m_cEncLib.setNoQpDeltaConstraintFlag ( m_bNoQpDeltaConstraintFlag ); m_cEncLib.setNoDepQuantConstraintFlag ( !m_depQuantEnabledFlag); @@ -333,9 +312,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setPad ( m_aiPad ); m_cEncLib.setAccessUnitDelimiter ( m_AccessUnitDelimiter ); -#if JVET_Q0775_PH_IN_SH m_cEncLib.setEnablePictureHeaderInSliceHeader ( m_enablePictureHeaderInSliceHeader ); -#endif m_cEncLib.setMaxTempLayer ( m_maxTempLayer ); @@ -346,12 +323,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS ); m_cEncLib.setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); m_cEncLib.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS m_cEncLib.setLoopFilterCbBetaOffset ( m_loopFilterCbBetaOffsetDiv2 ); m_cEncLib.setLoopFilterCbTcOffset ( m_loopFilterCbTcOffsetDiv2 ); m_cEncLib.setLoopFilterCrBetaOffset ( m_loopFilterCrBetaOffsetDiv2 ); m_cEncLib.setLoopFilterCrTcOffset ( m_loopFilterCrTcOffsetDiv2 ); -#endif #if W0038_DB_OPT m_cEncLib.setDeblockingFilterMetric ( m_deblockingFilterMetric ); #else @@ -416,13 +391,8 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setRDpenalty ( m_rdPenalty ); m_cEncLib.setCTUSize ( m_uiCTUSize ); -#if JVET_Q0119_CLEANUPS m_cEncLib.setSubPicInfoPresentFlag ( m_subPicInfoPresentFlag ); if(m_subPicInfoPresentFlag) -#else - m_cEncLib.setSubPicPresentFlag ( m_subPicPresentFlag ); - if(m_subPicPresentFlag) -#endif { m_cEncLib.setNumSubPics ( m_numSubPics ); m_cEncLib.setSubPicCtuTopLeftX ( m_subPicCtuTopLeftX ); @@ -433,13 +403,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setLoopFilterAcrossSubpicEnabledFlag ( m_loopFilterAcrossSubpicEnabledFlag ); m_cEncLib.setSubPicIdMappingInSpsFlag ( m_subPicIdMappingInSpsFlag ); m_cEncLib.setSubPicIdLen ( m_subPicIdLen ); -#if JVET_Q0119_CLEANUPS m_cEncLib.setSubPicIdMappingExplicitlySignalledFlag ( m_subPicIdMappingExplicitlySignalledFlag ); if (m_subPicIdMappingExplicitlySignalledFlag) -#else - m_cEncLib.setSubPicIdSignallingPresentFlag ( m_subPicIdSignallingPresentFlag ); - if(m_subPicIdSignallingPresentFlag) -#endif { m_cEncLib.setSubPicId ( m_subPicId ); } @@ -453,10 +418,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseSplitConsOverride ( m_SplitConsOverrideEnabledFlag ); m_cEncLib.setMinQTSizes ( m_uiMinQT ); m_cEncLib.setMaxMTTHierarchyDepth ( m_uiMaxMTTHierarchyDepth, m_uiMaxMTTHierarchyDepthI, m_uiMaxMTTHierarchyDepthIChroma ); -#if JVET_Q0330_BLOCK_PARTITION m_cEncLib.setMaxBTSizes ( m_uiMaxBT ); m_cEncLib.setMaxTTSizes ( m_uiMaxTT ); -#endif m_cEncLib.setDualITree ( m_dualTree ); m_cEncLib.setLFNST ( m_LFNST ); m_cEncLib.setUseFastLFNST ( m_useFastLFNST ); @@ -492,11 +455,7 @@ void EncApp::xInitLibCfg() } #endif m_cEncLib.setUseCiip ( m_ciip ); -#if !JVET_Q0806 - m_cEncLib.setUseTriangle ( m_Triangle ); -#else m_cEncLib.setUseGeo ( m_Geo ); -#endif m_cEncLib.setUseHashME ( m_HashME ); m_cEncLib.setAllowDisFracMMVD ( m_allowDisFracMMVD ); @@ -521,14 +480,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setWrapAroundOffset ( m_wrapAroundOffset ); // ADD_NEW_TOOL : (encoder app) add setting of tool enabling flags and associated parameters here -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG m_cEncLib.setVirtualBoundariesEnabledFlag ( m_virtualBoundariesEnabledFlag ); if( m_cEncLib.getVirtualBoundariesEnabledFlag() ) { m_cEncLib.setVirtualBoundariesPresentFlag ( m_virtualBoundariesPresentFlag ); -#else - m_cEncLib.setLoopFilterAcrossVirtualBoundariesDisabledFlag ( m_loopFilterAcrossVirtualBoundariesDisabledFlag ); -#endif m_cEncLib.setNumVerVirtualBoundaries ( m_numVerVirtualBoundaries ); m_cEncLib.setNumHorVirtualBoundaries ( m_numHorVirtualBoundaries ); for( unsigned i = 0; i < m_numVerVirtualBoundaries; i++ ) @@ -539,18 +494,11 @@ void EncApp::xInitLibCfg() { m_cEncLib.setVirtualBoundariesPosY ( m_virtualBoundariesPosY[ i ], i ); } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif m_cEncLib.setMaxCUWidth ( m_uiCTUSize ); m_cEncLib.setMaxCUHeight ( m_uiCTUSize ); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX m_cEncLib.setLog2MinCodingBlockSize ( m_log2MinCuSize ); -#else - m_cEncLib.setMaxCodingDepth ( m_uiMaxCodingDepth ); - m_cEncLib.setLog2DiffMaxMinCodingBlockSize ( m_uiLog2DiffMaxMinCodingBlockSize ); -#endif m_cEncLib.setLog2MaxTbSize ( m_log2MaxTbSize ); m_cEncLib.setUseEncDbOpt(m_encDbOpt); m_cEncLib.setUseFastLCTU ( m_useFastLCTU ); @@ -571,14 +519,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseMIP ( m_MIP ); m_cEncLib.setUseFastMIP ( m_useFastMIP ); m_cEncLib.setFastLocalDualTreeMode ( m_fastLocalDualTreeMode ); -#if !REMOVE_PPS_REXT - m_cEncLib.setCrossComponentPredictionEnabledFlag ( m_crossComponentPredictionEnabledFlag ); -#endif m_cEncLib.setUseReconBasedCrossCPredictionEstimate ( m_reconBasedCrossCPredictionEstimate ); -#if !JVET_Q0441_SAO_MOD_12_BIT - m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_LUMA , m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA] ); - m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); -#endif m_cEncLib.setUseTransformSkip ( m_useTransformSkip ); m_cEncLib.setUseTransformSkipFast ( m_useTransformSkipFast ); m_cEncLib.setUseChromaTS ( m_useChromaTS && m_useTransformSkip); @@ -607,25 +548,15 @@ void EncApp::xInitLibCfg() m_cEncLib.setMaxNumMergeCand ( m_maxNumMergeCand ); m_cEncLib.setMaxNumAffineMergeCand ( m_maxNumAffineMergeCand ); -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - m_cEncLib.setMaxNumGeoCand(m_maxNumGeoCand); -#else - m_cEncLib.setMaxNumTriangleCand ( m_maxNumTriangleCand ); -#endif -#else m_cEncLib.setMaxNumGeoCand ( m_maxNumGeoCand ); -#endif m_cEncLib.setMaxNumIBCMergeCand ( m_maxNumIBCMergeCand ); //====== Weighted Prediction ======== m_cEncLib.setUseWP ( m_useWeightedPred ); m_cEncLib.setWPBiPred ( m_useWeightedBiPred ); -#if JVET_Q0297_MER //====== Parallel Merge Estimation ======== m_cEncLib.setLog2ParallelMergeLevelMinus2(m_log2ParallelMergeLevel - 2); -#endif //====== Tiles and Slices ======== m_cEncLib.setNoPicPartitionFlag( !m_picPartitionFlag ); @@ -669,9 +600,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setFrameFieldInfoSEIEnabled ( m_frameFieldInfoSEIEnabled ); m_cEncLib.setBpDeltasGOPStructure ( m_bpDeltasGOPStructure ); m_cEncLib.setDecodingUnitInfoSEIEnabled ( m_decodingUnitInfoSEIEnabled ); -#if JVET_P0190_SCALABLE_NESTING_SEI m_cEncLib.setScalableNestingSEIEnabled ( m_scalableNestingSEIEnabled ); -#endif m_cEncLib.setHrdParametersPresentFlag ( m_hrdParametersPresentFlag ); m_cEncLib.setFramePackingArrangementSEIEnabled ( m_framePackingSEIEnabled ); m_cEncLib.setFramePackingArrangementSEIType ( m_framePackingSEIType ); @@ -738,18 +667,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setGcmpSEIFunctionCoeffV ( m_gcmpSEIFunctionCoeffV ); m_cEncLib.setGcmpSEIFunctionVAffectedByUFlag ( m_gcmpSEIFunctionVAffectedByUFlag ); m_cEncLib.setGcmpSEIGuardBandFlag ( m_gcmpSEIGuardBandFlag ); -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE m_cEncLib.setGcmpSEIGuardBandType ( m_gcmpSEIGuardBandType ); m_cEncLib.setGcmpSEIGuardBandBoundaryExteriorFlag ( m_gcmpSEIGuardBandBoundaryExteriorFlag ); -#else - m_cEncLib.setGcmpSEIGuardBandBoundaryType ( m_gcmpSEIGuardBandBoundaryType ); -#endif m_cEncLib.setGcmpSEIGuardBandSamplesMinus1 ( (uint8_t)m_gcmpSEIGuardBandSamplesMinus1 ); -#if JVET_SUBPIC_LEVEL_CFG m_cEncLib.setSubpicureLevelInfoSEICfg (m_cfgSubpictureLevelInfoSEI); -#else - m_cEncLib.setSubpicureLevelInfoSEIEnabled (m_subpicureLevelInfoSEIEnabled); -#endif m_cEncLib.setSampleAspectRatioInfoSEIEnabled (m_sampleAspectRatioInfoSEIEnabled); m_cEncLib.setSariCancelFlag (m_sariCancelFlag); m_cEncLib.setSariPersistenceFlag (m_sariPersistenceFlag); @@ -801,36 +722,14 @@ void EncApp::xInitLibCfg() m_cEncLib.setCcvSEIMaxLuminanceValue (m_ccvSEIMaxLuminanceValue); m_cEncLib.setCcvSEIAvgLuminanceValue (m_ccvSEIAvgLuminanceValue); m_cEncLib.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); -#if JVET_Q0151_Q0205_ENTRYPOINTS m_cEncLib.setEntropyCodingSyncEntryPointPresentFlag ( m_entropyCodingSyncEntryPointPresentFlag ); -#endif m_cEncLib.setTMVPModeId ( m_TMVPModeId ); m_cEncLib.setSliceLevelRpl ( m_sliceLevelRpl ); m_cEncLib.setSliceLevelDblk ( m_sliceLevelDblk ); m_cEncLib.setSliceLevelSao ( m_sliceLevelSao ); -#if JVET_Q0819_PH_CHANGES m_cEncLib.setSliceLevelWp ( m_sliceLevelWp ); m_cEncLib.setSliceLevelDeltaQp ( m_sliceLevelDeltaQp ); -#endif m_cEncLib.setSliceLevelAlf ( m_sliceLevelAlf ); -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - m_cEncLib.setConstantSliceHeaderParamsEnabledFlag ( m_constantSliceHeaderParamsEnabledFlag ); - m_cEncLib.setPPSDepQuantEnabledIdc ( m_PPSDepQuantEnabledIdc ); - m_cEncLib.setPPSRefPicListSPSIdc0 ( m_PPSRefPicListSPSIdc0 ); - m_cEncLib.setPPSRefPicListSPSIdc1 ( m_PPSRefPicListSPSIdc1 ); - m_cEncLib.setPPSMvdL1ZeroIdc ( m_PPSMvdL1ZeroIdc ); - m_cEncLib.setPPSCollocatedFromL0Idc ( m_PPSCollocatedFromL0Idc ); - m_cEncLib.setPPSSixMinusMaxNumMergeCandPlus1 ( m_PPSSixMinusMaxNumMergeCandPlus1 ); -#endif -#if !JVET_Q0806 -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - m_cEncLib.setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ( m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ); -#endif -#else -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - m_cEncLib.setPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 ( m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 ); -#endif -#endif m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); m_cEncLib.setDisableScalingMatrixForLfnstBlks ( m_disableScalingMatrixForLfnstBlks); @@ -850,11 +749,7 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setCostMode ( m_costMode ); m_cEncLib.setUseRecalculateQPAccordingToLambda ( m_recalculateQPAccordingToLambda ); -#if JVET_Q0117_PARAMETER_SETS_CLEANUP m_cEncLib.setDCIEnabled ( m_DCIEnabled ); -#else - m_cEncLib.setDecodingParameterSetEnabled ( m_decodingParameterSetEnabled ); -#endif m_cEncLib.setVuiParametersPresentFlag ( m_vuiParametersPresentFlag ); m_cEncLib.setAspectRatioInfoPresentFlag ( m_aspectRatioInfoPresentFlag); m_cEncLib.setAspectRatioIdc ( m_aspectRatioIdc ); @@ -892,10 +787,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setForceSingleSplitThread ( m_forceSplitSequential ); #endif m_cEncLib.setUseALF ( m_alf ); -#if JVET_Q0795_CCALF m_cEncLib.setUseCCALF ( m_ccalf ); m_cEncLib.setCCALFQpThreshold ( m_ccalfQpThreshold ); -#endif m_cEncLib.setLmcs ( m_lmcsEnabled ); m_cEncLib.setReshapeSignalType ( m_reshapeSignalType ); m_cEncLib.setReshapeIntraCMD ( m_intraCMD ); @@ -1254,11 +1147,7 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector<uint32_t>& a case NAL_UNIT_CODED_SLICE_GDR: case NAL_UNIT_CODED_SLICE_RADL: case NAL_UNIT_CODED_SLICE_RASL: -#if JVET_Q0117_PARAMETER_SETS_CLEANUP case NAL_UNIT_DCI: -#else - case NAL_UNIT_DPS: -#endif case NAL_UNIT_VPS: case NAL_UNIT_SPS: case NAL_UNIT_PPS: diff --git a/source/App/EncoderApp/EncApp.h b/source/App/EncoderApp/EncApp.h index 2a42fbc8e1ff3e911ce2befd18479736a48a8de1..2597ef4f6c38061f13858211e25bcf15832409d2 100644 --- a/source/App/EncoderApp/EncApp.h +++ b/source/App/EncoderApp/EncApp.h @@ -118,11 +118,9 @@ public: #if JVET_O0756_CALCULATE_HDRMETRICS std::chrono::duration<long long, ratio<1, 1000000000>> getMetricTime() const { return m_metricTime; }; #endif -#if JVET_Q0172_CHROMA_FORMAT_BITDEPTH_CONSTRAINT VPS * getVPS() { return m_cEncLib.getVPS(); } int getChromaFormatIDC() const { return m_cEncLib.getChromaFormatIdc(); } int getBitDepth() const { return m_cEncLib.getBitDepth(CHANNEL_TYPE_LUMA); } -#endif };// END CLASS DEFINITION EncApp //! \} diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 81123428e084552ae5a0b71a6828979d4801ddcf..582d7476dcb5b8d26c9230bd4e1b7f137ecfa8c9 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -87,9 +87,7 @@ EncAppCfg::EncAppCfg() , m_noPartitionConstraintsOverrideConstraintFlag(false) , m_bNoSaoConstraintFlag(false) , m_bNoAlfConstraintFlag(false) -#if JVET_Q0795_CCALF , m_noCCAlfConstraintFlag(false) -#endif , m_bNoRefWraparoundConstraintFlag(false) , m_bNoTemporalMvpConstraintFlag(false) , m_bNoSbtmvpConstraintFlag(false) @@ -104,11 +102,7 @@ EncAppCfg::EncAppCfg() , m_noIbcConstraintFlag(false) , m_bNoCiipConstraintFlag(false) , m_noFPelMmvdConstraintFlag(false) -#if !JVET_Q0806 -, m_bNoTriangleConstraintFlag(false) -#else , m_noGeoConstraintFlag(false) -#endif , m_bNoLadfConstraintFlag(false) , m_noTransformSkipConstraintFlag(false) , m_noBDPCMConstraintFlag(false) @@ -168,12 +162,10 @@ std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //in in>>entry.m_QPFactor; in>>entry.m_tcOffsetDiv2; in>>entry.m_betaOffsetDiv2; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS in>>entry.m_CbTcOffsetDiv2; in>>entry.m_CbBetaOffsetDiv2; in>>entry.m_CrTcOffsetDiv2; in>>entry.m_CrBetaOffsetDiv2; -#endif in>>entry.m_temporalId; in >> entry.m_numRefPicsActive0; in >> entry.m_numRefPics0; @@ -602,9 +594,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) string inputColourSpaceConvert; string inputPathPrefix; ExtendedProfileName extendedProfile; -#if !JVET_Q0441_SAO_MOD_12_BIT - int saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE]; -#endif // Multi-value input fields: // minval, maxval (incl), min_entries, max_entries (incl) [, default values, number of default values] SMultiValueInput<uint32_t> cfgTileColumnWidth (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint32_t>::max()); @@ -703,10 +692,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<bool> cfg_loopFilterAcrossSubpicEnabledFlag(0, 1, 0, MAX_NUM_SUB_PICS); SMultiValueInput<uint32_t> cfg_subPicId(0, std::numeric_limits<uint16_t>::max(), 0, MAX_NUM_SUB_PICS); -#if JVET_SUBPIC_LEVEL_CFG SMultiValueInput<int> cfg_sliFractions(0, 100, 0, std::numeric_limits<int>::max()); SMultiValueInput<Level::Name> cfg_sliRefLevels(Level::NONE, Level::LEVEL8_5, 0, 8); -#endif int warnUnknowParameter = 0; @@ -769,9 +756,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") ("AccessUnitDelimiter", m_AccessUnitDelimiter, false, "Enable Access Unit Delimiter NALUs") -#if JVET_Q0775_PH_IN_SH ("EnablePictureHeaderInSliceHeader", m_enablePictureHeaderInSliceHeader, true, "Enable Picture Header in Slice Header") -#endif ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") ("TemporalSubsampleRatio,-ts", m_temporalSubsampleRatio, 1u, "Temporal sub-sample ratio when reading input YUV") @@ -812,11 +797,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1, or none") ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level (main or high only)") ("SubProfile", cfg_SubProfile, cfg_SubProfile, "Sub-profile idc") -#if JVET_Q0117_PARAMETER_SETS_CLEANUP ("EnableDecodingCapabilityInformation", m_DCIEnabled, false, "Enables writing of Decoding Capability Information") -#else - ("EnableDecodingParameterSet", m_decodingParameterSetEnabled, false, "Enables writing of Decoding Parameter Set") -#endif ("MaxBitDepthConstraint", m_bitDepthConstraint, 0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters") ("MaxChromaFormatConstraint", tmpConstraintChromaFormat, 0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters") ("IntraConstraintFlag", m_intraConstraintFlag, false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)") @@ -824,23 +805,15 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") -#if JVET_Q0114_CONSTRAINT_FLAGS ("NonProjectedConstraintFlag", m_nonProjectedConstraintFlag, false, "Indicate that the bitstream contains projection SEI messages") ("NoResChangeInClvsConstraintFlag", m_noResChangeInClvsConstraintFlag, false, "Indicate that the picture spatial resolution does not change within any CLVS referring to the SPS") ("OneTilePerPicConstraintFlag", m_oneTilePerPicConstraintFlag, false, "Indicate that each picture shall contain only one tile") ("OneSlicePerPicConstraintFlag", m_oneSlicePerPicConstraintFlag, false, "Indicate that each picture shall contain only one slice") ("OneSubpicPerPicConstraintFlag", m_oneSubpicPerPicConstraintFlag, false, "Indicate that each picture shall contain only one subpicture") -#endif ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") ("CTUSize", m_uiCTUSize, 128u, "CTUSize (specifies the CTU size if QTBT is on) [default: 128]") -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX ("Log2MinCuSize", m_log2MinCuSize, 2u, "Log2 min CU size") -#endif -#if JVET_Q0119_CLEANUPS ("SubPicInfoPresentFlag", m_subPicInfoPresentFlag, false, "equal to 1 specifies that subpicture parameters are present in in the SPS RBSP syntax") -#else - ("SubPicPresentFlag", m_subPicPresentFlag, false, "equal to 1 specifies that subpicture parameters are present in in the SPS RBSP syntax") -#endif ("NumSubPics", m_numSubPics, 0u, "specifies the number of subpictures") ("SubPicCtuTopLeftX", cfg_subPicCtuTopLeftX, cfg_subPicCtuTopLeftX, "specifies horizontal position of top left CTU of i-th subpicture in unit of CtbSizeY") ("SubPicCtuTopLeftY", cfg_subPicCtuTopLeftY, cfg_subPicCtuTopLeftY, "specifies vertical position of top left CTU of i-th subpicture in unit of CtbSizeY") @@ -848,13 +821,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SubPicHeight", cfg_subPicHeight, cfg_subPicHeight, "specifies the height of the i-th subpicture in units of CtbSizeY") ("SubPicTreatedAsPicFlag", cfg_subPicTreatedAsPicFlag, cfg_subPicTreatedAsPicFlag, "equal to 1 specifies that the i-th subpicture of each coded picture in the CLVS is treated as a picture in the decoding process excluding in-loop filtering operations") ("LoopFilterAcrossSubpicEnabledFlag", cfg_loopFilterAcrossSubpicEnabledFlag, cfg_loopFilterAcrossSubpicEnabledFlag, "equal to 1 specifies that in-loop filtering operations may be performed across the boundaries of the i-th subpicture in each coded picture in the CLVS") -#if JVET_Q0119_CLEANUPS ("SubPicIdMappingExplicitlySignalledFlag", m_subPicIdMappingExplicitlySignalledFlag, false, "equal to 1 specifies that the subpicture ID mapping is explicitly signalled, either in the SPS or in the PPSs") ("SubPicIdMappingInSpsFlag", m_subPicIdMappingInSpsFlag, false, "equal to 1 specifies that subpicture ID mapping is signalled in the SPS") -#else - ("SubPicIdPresentFlag", m_subPicIdPresentFlag, false, "equal to 1 specifies that subpicture ID mapping is present in the SPS") - ("SubPicIdSignallingPresentFlag", m_subPicIdSignallingPresentFlag, false, "equal to 1 specifies that subpicture ID mapping is signalled in the SPS") -#endif ("SubPicIdLen", m_subPicIdLen, 0u, "specifies the number of bits used to represent the syntax element sps_subpic_id[ i ]. ") ("SubPicId", cfg_subPicId, cfg_subPicId, "specifies that subpicture ID of the i-th subpicture") ("SingleSlicePerSubpic", m_singleSlicePerSubPicFlag, false, "Enables setting of a single slice per sub-picture (no explicit configuration required)") @@ -867,14 +835,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MaxMTTHierarchyDepthI", m_uiMaxMTTHierarchyDepthI, 3u, "MaxMTTHierarchyDepthI") ("MaxMTTHierarchyDepthISliceL", m_uiMaxMTTHierarchyDepthI, 3u, "MaxMTTHierarchyDepthISliceL") ("MaxMTTHierarchyDepthISliceC", m_uiMaxMTTHierarchyDepthIChroma, 3u, "MaxMTTHierarchyDepthISliceC") -#if JVET_Q0330_BLOCK_PARTITION ("MaxBTLumaISlice", m_uiMaxBT[0], 32u, "MaxBTLumaISlice") ("MaxBTChromaISlice", m_uiMaxBT[2], 64u, "MaxBTChromaISlice") ("MaxBTNonISlice", m_uiMaxBT[1], 128u, "MaxBTNonISlice") ("MaxTTLumaISlice", m_uiMaxTT[0], 32u, "MaxTTLumaISlice") ("MaxTTChromaISlice", m_uiMaxTT[2], 32u, "MaxTTChromaISlice") ("MaxTTNonISlice", m_uiMaxTT[1], 64u, "MaxTTNonISlice") -#endif ("DualITree", m_dualTree, false, "Use separate QTBT trees for intra slice luma and chroma channel types") ( "LFNST", m_LFNST, false, "Enable LFNST (0:off, 1:on) [default: off]" ) ( "FastLFNST", m_useFastLFNST, false, "Fast methods for LFNST" ) @@ -919,11 +885,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("LadfIntervalLowerBound", cfg_LadfIntervalLowerBound, cfg_LadfIntervalLowerBound, "LADF lower bound for 2nd lowest interval") #endif ("CIIP", m_ciip, false, "Enable CIIP mode") -#if !JVET_Q0806 - ("Triangle", m_Triangle, false, "Enable triangular shape motion vector prediction (0:off, 1:on)") -#else ("Geo", m_Geo, false, "Enable geometric partitioning mode (0:off, 1:on)") -#endif ("HashME", m_HashME, false, "Enable hash motion estimation (0:off, 1:on)") ("AllowDisFracMMVD", m_allowDisFracMMVD, false, "Disable fractional MVD in MMVD mode adaptively") @@ -946,11 +908,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("WrapAroundOffset", m_wrapAroundOffset, 0u, "Offset in luma samples used for computing the horizontal wrap-around position") // ADD_NEW_TOOL : (encoder app) add parsing parameters here -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG ( "VirtualBoundariesPresentInSPSFlag", m_virtualBoundariesPresentFlag, true, "Virtual Boundary position information is signalled in SPS or PH (1:SPS, 0:PH) [default: on]" ) -#else - ("LoopFilterAcrossVirtualBoundariesDisabledFlag", m_loopFilterAcrossVirtualBoundariesDisabledFlag, false, "Disable in-loop filtering operations across the virtual boundaries (0:off, 1:on) [default: off]") -#endif ("NumVerVirtualBoundaries", m_numVerVirtualBoundaries, 0u, "Number of vertical virtual boundaries (0-3, inclusive)") ("NumHorVirtualBoundaries", m_numHorVirtualBoundaries, 0u, "Number of horizontal virtual boundaries (0-3, inclusive)") ("VirtualBoundariesPosX", cfg_virtualBoundariesPosX, cfg_virtualBoundariesPosX, "Locations of the vertical virtual boundaries in units of luma samples") @@ -985,9 +943,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) // todo: remove defaults from MaxCUSize ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") -#endif ("Log2MaxTbSize", m_log2MaxTbSize, 6, "Maximum transform block size in logarithm base 2 (Default: 6)") @@ -1093,35 +1048,22 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, true) ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0) ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0) -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS ("LoopFilterCbBetaOffset_div2", m_loopFilterCbBetaOffsetDiv2, 0) ("LoopFilterCbTcOffset_div2", m_loopFilterCbTcOffsetDiv2, 0) ("LoopFilterCrBetaOffset_div2", m_loopFilterCrBetaOffsetDiv2, 0) ("LoopFilterCrTcOffset_div2", m_loopFilterCrTcOffsetDiv2, 0) -#endif #if W0038_DB_OPT ("DeblockingFilterMetric", m_deblockingFilterMetric, 0) #else ("DeblockingFilterMetric", m_DeblockingFilterMetric, false) #endif // Coding tools -#if !REMOVE_PPS_REXT - ("CrossComponentPrediction", m_crossComponentPredictionEnabledFlag, false, "Enable the use of cross-component prediction (not valid in V1 profiles)") -#endif ("ReconBasedCrossCPredictionEstimate", m_reconBasedCrossCPredictionEstimate, false, "When determining the alpha value for cross-component prediction, use the decoded residual rather than the pre-transform encoder-side residual") -#if !JVET_Q0441_SAO_MOD_12_BIT - ("SaoLumaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_LUMA], 0, "Specify the luma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP") - ("SaoChromaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_CHROMA], 0, "Specify the chroma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP") -#endif ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") ("TransformSkipFast", m_useTransformSkipFast, false, "Fast encoder search for transform skipping, winner takes it all mode.") ("TransformSkipLog2MaxSize", m_log2MaxTransformSkipBlockSize, 5U, "Specify transform-skip maximum size. Minimum 2, Maximum 5. (not valid in V1 profiles)") ("ChromaTS", m_useChromaTS, false, "Enable encoder search of chromaTS") -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM ("BDPCM", m_useBDPCM, false, "BDPCM (0:off, 1:luma and chroma)") -#else - ("BDPCM", m_useBDPCM, 0, "BDPCM (0:off, 1:lumaonly, 2:lumachroma") -#endif ("ISPFast", m_useFastISP, false, "Fast encoder search for ISP") ("ImplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT], false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)") ("ExplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT], false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)") @@ -1153,13 +1095,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") ("WeightedPredMethod,-wpM", tmpWeightedPredictionMethod, int(WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT), "Weighted prediction method") -#if JVET_Q0297_MER ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") -#endif ("WaveFrontSynchro", m_entropyCodingSyncEnabledFlag, false, "0: entropy coding sync disabled; 1 entropy coding sync enabled") -#if JVET_Q0151_Q0205_ENTRYPOINTS ("WaveFrontEntryPointsPresent", m_entropyCodingSyncEntryPointPresentFlag, false, "0: entry points for WPP is not present; 1 entry points for WPP may be present in slice header") -#endif ("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile") ("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.") ("DisableScalingMatrixForLFNST", m_disableScalingMatrixForLfnstBlks, true, "Disable scaling matrices, when enabled, for LFNST-coded blocks") @@ -1167,15 +1105,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, false, "Enable sign hiding" ) ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") ("MaxNumAffineMergeCand", m_maxNumAffineMergeCand, 5u, "Maximum number of affine merge candidates") -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - ("MaxNumGeoCand", m_maxNumGeoCand, 5u, "Maximum number of geometric partitioning mode candidates") -#else - ("MaxNumTriangleCand", m_maxNumTriangleCand, 5u, "Maximum number of triangle candidates") -#endif -#else ("MaxNumGeoCand", m_maxNumGeoCand, 5u, "Maximum number of geometric partitioning mode candidates") -#endif ("MaxNumIBCMergeCand", m_maxNumIBCMergeCand, 6u, "Maximum number of IBC merge candidates") /* Misc. */ ("SEIDecodedPictureHash,-dph", tmpDecodedPictureHashSEIMappedType, 0, "Control generation of decode picture hash SEI messages\n" @@ -1184,18 +1114,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "\t1: use MD5\n" "\t0: disable") ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - ("PPSorSliceMode", m_PPSorSliceMode, 0, "Enable signalling certain parameters either in PPS or per slice\n" - "\tmode 0: Always per slice (default), 1: RA settings, 2: LDB settings, 3: LDP settings") -#endif ("SliceLevelRpl", m_sliceLevelRpl, true, "Code reference picture lists in slice headers rather than picture header.") ("SliceLevelDblk", m_sliceLevelDblk, true, "Code deblocking filter parameters in slice headers rather than picture header.") ("SliceLevelSao", m_sliceLevelSao, true, "Code SAO parameters in slice headers rather than picture header.") ("SliceLevelAlf", m_sliceLevelAlf, true, "Code ALF parameters in slice headers rather than picture header.") -#if JVET_Q0819_PH_CHANGES ("SliceLevelWeightedPrediction", m_sliceLevelWp, true, "Code weighted prediction parameters in slice headers rather than picture header.") ("SliceLevelDeltaQp", m_sliceLevelDeltaQp, true, "Code delta Qp in slice headers rather than picture header.") -#endif ("FEN", tmpFastInterSearchMode, int(FASTINTERSEARCH_DISABLED), "fast encoder setting") ("ECU", m_bUseEarlyCU, false, "Early CU setting") ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") @@ -1236,9 +1160,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, false, "Control generation of buffering period SEI messages") ("SEIPictureTiming", m_pictureTimingSEIEnabled, false, "Control generation of picture timing SEI messages") ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, false, "Control generation of decoding unit information SEI message.") -#if JVET_P0190_SCALABLE_NESTING_SEI ("SEIScalableNesting", m_scalableNestingSEIEnabled, false, "Control generation of scalable nesting SEI messages") -#endif ("SEIFrameFieldInfo", m_frameFieldInfoSEIEnabled, false, "Control generation of frame field information SEI messages") ("SEIFramePacking", m_framePackingSEIEnabled, false, "Control generation of frame packing SEI messages") ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" @@ -1321,22 +1243,14 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SEIGcmpFunctionCoeffV", cfg_gcmpSEIFunctionCoeffV, cfg_gcmpSEIFunctionCoeffV, "Specifies the coefficient used in the cubemap mapping function of the v-axis of the i-th face") ("SEIGcmpFunctionVAffectedByUFlag", cfg_gcmpSEIFunctionVAffectedByUFlag, cfg_gcmpSEIFunctionVAffectedByUFlag, "Specifies whether the cubemap mapping function of the v-axis refers to the u position of the sample location") ("SEIGcmpGuardBandFlag", m_gcmpSEIGuardBandFlag, false, "Indicate the existence of guard band areas in the picture") -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE ("SEIGcmpGuardBandType", m_gcmpSEIGuardBandType, 0u, "Indicate the type of the guard bands") ("SEIGcmpGuardBandBoundaryExteriorFlag", m_gcmpSEIGuardBandBoundaryExteriorFlag, false, "Indicate whether face boundaries contain guard bands") -#else - ("SEIGcmpGuardBandBoundaryType", m_gcmpSEIGuardBandBoundaryType, false, "Indicate which face boundaries contain guard bands") -#endif ("SEIGcmpGuardBandSamplesMinus1", m_gcmpSEIGuardBandSamplesMinus1, 0u, "Specifies the number of guard band samples minus1 used in the cubemap projected picture") -#if JVET_SUBPIC_LEVEL_CFG ("SEISubpicLevelInfoEnabled", m_cfgSubpictureLevelInfoSEI.m_enabled, false, "Control generation of Subpicture Level Information SEI messages") ("SEISubpicLevelInfoRefLevels", cfg_sliRefLevels, cfg_sliRefLevels, "List of reference levels for Subpicture Level Information SEI messages") ("SEISubpicLevelInfoExplicitFraction", m_cfgSubpictureLevelInfoSEI.m_explicitFraction, false, "Enable sending of explicit fractions in Subpicture Level Information SEI messages") ("SEISubpicLevelInfoNumSubpics", m_cfgSubpictureLevelInfoSEI.m_numSubpictures, 1, "Number of subpictures for Subpicture Level Information SEI messages") ("SEISubpicLevelInfoRefLevelFractions", cfg_sliFractions, cfg_sliFractions, "List of fractions for Subpicture Level Information SEI messages") -#else - ("SEISubpicureLevelInfo", m_subpicureLevelInfoSEIEnabled, false, "Control generation of Subpicture Level Information SEI messages") -#endif ("SEISampleAspectRatioInfo", m_sampleAspectRatioInfoSEIEnabled, false, "Control generation of Sample Aspect Ratio Information SEI messages") ("SEISARICancelFlag", m_sariCancelFlag, false, "Indicates that Sample Aspect Ratio Information SEI message cancels the persistence or follows") ("SEISARIPersistenceFlag", m_sariPersistenceFlag, true, "Specifies the persistence of the Sample Aspect Ratio Information SEI message") @@ -1409,19 +1323,15 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("DebugCTU", m_debugCTU, -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC-frame at CTUline containin debug CTU.") ("EnsureWppBitEqual", m_ensureWppBitEqual, false, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off") ( "ALF", m_alf, true, "Adaptive Loop Filter\n" ) -#if JVET_Q0795_CCALF ( "CCALF", m_ccalf, true, "Cross-component Adaptive Loop Filter" ) ( "CCALFQpTh", m_ccalfQpThreshold, 37, "QP threshold above which encoder reduces CCALF usage") -#endif ( "ScalingRatioHor", m_scalingRatioHor, 1.0, "Scaling ratio in hor direction" ) ( "ScalingRatioVer", m_scalingRatioVer, 1.0, "Scaling ratio in ver direction" ) ( "FractionNumFrames", m_fractionOfFrames, 1.0, "Encode a fraction of the specified in FramesToBeEncoded frames" ) ( "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") @@ -1434,9 +1344,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "OlsModeIdc", m_olsModeIdc, 0, "Output layer set mode") ( "NumOutputLayerSets", m_numOutputLayerSets, 1, "Number of output layer sets") ( "OlsOutputLayer%d", m_olsOutputLayerStr, string(""), MAX_VPS_LAYERS, "Output layer index of i-th OLS") -#if JVET_Q0786_PTL_only ( "NumPTLsInVPS", m_numPtlsInVps, 1, "Number of profile_tier_level structures in VPS" ) -#endif ; opts.addOptions() @@ -1457,7 +1365,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); } -#if JVET_Q0786_PTL_only for(int i = 0; i < MAX_NUM_OLSS; i++) { std::ostringstream cOSS1; @@ -1468,7 +1375,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) cOSS2<<"OlsPTLIdx"<<i; opts.addOptions()(cOSS2.str(), m_olsPtlIdx[i], 0); } -#endif po::setDefaults(opts); po::ErrorReporter err; @@ -1629,11 +1535,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) //number of fields to encode m_framesToBeEncoded *= 2; } -#if JVET_Q0119_CLEANUPS if ( m_subPicInfoPresentFlag ) -#else - if ( m_subPicPresentFlag ) -#endif { CHECK( m_numSubPics > MAX_NUM_SUB_PICS || m_numSubPics < 1, "Number of subpicture must be within 1 to 2^16" ); CHECK( cfg_subPicCtuTopLeftX.values.size() != m_numSubPics, "Number of SubPicCtuTopLeftX values must be equal to NumSubPics"); @@ -1681,12 +1583,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } CHECK( m_subPicIdLen > 16, "SubPicIdLen must not exceed 16 bits" ); -#if JVET_Q0043_RPR_and_Subpics CHECK( m_rprEnabled, "RPR and subpictures cannot be enabled together" ); -#endif } -#if JVET_SUBPIC_LEVEL_CFG if (m_cfgSubpictureLevelInfoSEI.m_enabled) { CHECK (m_numSubPics != m_cfgSubpictureLevelInfoSEI.m_numSubpictures, "NumSubPics must be equal to SEISubpicLevelInfoNumSubpics" ); @@ -1697,7 +1596,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) CHECK (cfg_sliRefLevels.values.size() * m_cfgSubpictureLevelInfoSEI.m_numSubpictures != cfg_sliFractions.values.size(), "Number of subpicture level fractions must be equal to the numer of subpictures times the number of reference levels."); } } -#endif if( m_picPartitionFlag ) { @@ -1778,12 +1676,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_outputBitDepth [CHANNEL_TYPE_CHROMA] = m_outputBitDepth [CHANNEL_TYPE_LUMA ]; } -#if JVET_Q0151_Q0205_ENTRYPOINTS if( !m_entropyCodingSyncEnabledFlag ) { m_entropyCodingSyncEntryPointPresentFlag = false; } -#endif m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat); m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat))); @@ -1831,16 +1727,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true); m_rgbFormat = (m_inputColourSpaceConvert == IPCOLOURSPACE_RGBtoGBR && m_chromaFormatIDC == CHROMA_444) ? true : false; -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS // Picture width and height must be multiples of 8 and minCuSize const int minResolutionMultiple = std::max(8, 1 << m_log2MinCuSize); CHECK(((m_iSourceWidth% minResolutionMultiple) || (m_iSourceHeight % minResolutionMultiple)) && m_conformanceWindowMode != 1, "Picture width or height is not a multiple of 8 or minCuSize, please use ConformanceMode 1!"); -#else - const int minCuSize = 1 << m_log2MinCuSize; - CHECK(((m_iSourceWidth % minCuSize ) || (m_iSourceHeight % minCuSize )) && m_conformanceWindowMode != 1, "Picture width or height is not a multiple of minCuSize, please use ConformanceMode 1!"); -#endif -#endif switch (m_conformanceWindowMode) { case 0: @@ -1853,16 +1742,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) case 1: { // automatic padding to minimum CU size -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS - // Picture width and height must be multiples of 8 and minCuSize - int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); - int minResolutionMultiple = std::max(8, minCuSize); -#else - int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); -#endif -#endif -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS if (m_iSourceWidth % minResolutionMultiple) { m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minResolutionMultiple) + 1) * minResolutionMultiple - m_iSourceWidth; @@ -1871,16 +1750,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (m_iSourceHeight % minResolutionMultiple) { m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minResolutionMultiple) + 1) * minResolutionMultiple - m_iSourceHeight; -#else - if (m_iSourceWidth % minCuSize) - { - m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; - m_iSourceWidth += m_confWinRight; - } - if (m_iSourceHeight % minCuSize) - { - m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; -#endif m_iSourceHeight += m_confWinBottom; if ( m_isField ) { @@ -1974,26 +1843,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } #endif -#if !JVET_Q0441_SAO_MOD_12_BIT - for(uint32_t ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) - { - if (saoOffsetBitShift[ch]<0) - { - if (m_internalBitDepth[ch]>10) - { - m_log2SaoOffsetScale[ch]=uint32_t(Clip3<int>(0, m_internalBitDepth[ch]-10, int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) ); - } - else - { - m_log2SaoOffsetScale[ch]=0; - } - } - else - { - m_log2SaoOffsetScale[ch]=uint32_t(saoOffsetBitShift[ch]); - } - } -#endif #if SHARP_LUMA_DELTA_QP CHECK( lumaLevelToDeltaQPMode >= LUMALVL_TO_DQP_NUM_MODES, "Error in cfg" ); @@ -2110,23 +1959,16 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } #endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG m_virtualBoundariesEnabledFlag = 0; if( m_numVerVirtualBoundaries > 0 || m_numHorVirtualBoundaries > 0 ) m_virtualBoundariesEnabledFlag = 1; if( m_virtualBoundariesEnabledFlag ) { -#if JVET_Q0210_SUBPIC_VIRTUAL_BOUNDARY_CONSTRAINT CHECK( m_subPicInfoPresentFlag && m_virtualBoundariesPresentFlag != 1, "When subpicture signalling is present, the signalling of virtual boundaries, if present, shall be in the SPS" ); -#endif if( m_virtualBoundariesPresentFlag ) { -#else - if ( m_loopFilterAcrossVirtualBoundariesDisabledFlag ) - { -#endif CHECK( m_numVerVirtualBoundaries > 3, "Number of vertical virtual boundaries must be comprised between 0 and 3 included" ); CHECK( m_numHorVirtualBoundaries > 3, "Number of horizontal virtual boundaries must be comprised between 0 and 3 included" ); CHECK( m_numVerVirtualBoundaries != cfg_virtualBoundariesPosX.values.size(), "Size of VirtualBoundariesPosX must be equal to NumVerVirtualBoundaries"); @@ -2160,9 +2002,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif if ( m_alf ) { @@ -2365,26 +2205,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #endif #endif // ENABLE_QPA -#if JVET_AHG14_LOSSLESS_ENC_QP_FIX if( m_costMode == COST_LOSSLESS_CODING ) { m_iQP = LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP - ( ( m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8 ) * 6 ); } -#endif -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - const int minCuSize = 1 << MIN_CU_LOG2; - m_uiMaxCodingDepth = 0; - while( ( m_uiCTUSize >> m_uiMaxCodingDepth ) > minCuSize ) - { - m_uiMaxCodingDepth++; - } - m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCodingDepth; -#endif m_uiMaxCUWidth = m_uiMaxCUHeight = m_uiCTUSize; -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - m_uiMaxCUDepth = m_uiMaxCodingDepth; -#endif // check validity of input parameters if( xCheckParameter() ) @@ -2468,15 +2294,9 @@ bool EncAppCfg::xCheckParameter() if( m_wrapAround ) { -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int minCUSize = 1 << m_log2MinCuSize; xConfirmPara(m_wrapAroundOffset <= m_uiCTUSize + minCUSize, "Wrap-around offset must be greater than CtbSizeY + MinCbSize"); xConfirmPara(m_wrapAroundOffset > m_iSourceWidth, "Wrap-around offset must not be greater than the source picture width"); -#else - xConfirmPara( m_wrapAroundOffset <= m_uiCTUSize + (m_uiMaxCUWidth >> m_uiLog2DiffMaxMinCodingBlockSize), "Wrap-around offset must be greater than CtbSizeY + MinCbSize" ); - xConfirmPara( m_wrapAroundOffset > m_iSourceWidth, "Wrap-around offset must not be greater than the source picture width" ); - int minCUSize = m_uiCTUSize >> m_uiLog2DiffMaxMinCodingBlockSize; -#endif xConfirmPara( m_wrapAroundOffset % minCUSize != 0, "Wrap-around offset must be an integer multiple of the specified minimum CU size" ); } @@ -2511,9 +2331,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_internalBitDepth[CHANNEL_TYPE_CHROMA] != m_internalBitDepth[CHANNEL_TYPE_LUMA], "The internalBitDepth must be the same for luma and chroma"); if (m_profile==Profile::MAIN_10 || m_profile==Profile::MAIN_444_10) { -#if !REMOVE_PPS_REXT - xConfirmPara(m_crossComponentPredictionEnabledFlag==true, "CrossComponentPrediction must not be used for given profile."); -#endif xConfirmPara(m_log2MaxTransformSkipBlockSize>=6, "Transform Skip Log2 Max Size must be less or equal to 5 for given profile."); xConfirmPara(m_transformSkipRotationEnabledFlag==true, "UseResidualRotation must not be enabled for given profile."); xConfirmPara(m_transformSkipContextEnabledFlag==true, "UseSingleSignificanceMapContext must not be enabled for given profile."); @@ -2559,10 +2376,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] < m_inputBitDepth[CHANNEL_TYPE_LUMA ]), "MSB-extended bit depth for luma channel (--MSBExtendedBitDepth) must be greater than or equal to input bit depth for luma channel (--InputBitDepth)" ); xConfirmPara( (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] < m_inputBitDepth[CHANNEL_TYPE_CHROMA]), "MSB-extended bit depth for chroma channel (--MSBExtendedBitDepthC) must be greater than or equal to input bit depth for chroma channel (--InputBitDepthC)" ); -#if !JVET_Q0441_SAO_MOD_12_BIT - xConfirmPara( m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA] > (m_internalBitDepth[CHANNEL_TYPE_LUMA ]<10?0:(m_internalBitDepth[CHANNEL_TYPE_LUMA ]-10)), "SaoLumaOffsetBitShift must be in the range of 0 to InternalBitDepth-10, inclusive"); - xConfirmPara( m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] > (m_internalBitDepth[CHANNEL_TYPE_CHROMA]<10?0:(m_internalBitDepth[CHANNEL_TYPE_CHROMA]-10)), "SaoChromaOffsetBitShift must be in the range of 0 to InternalBitDepth-10, inclusive"); -#endif xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT, "ChromaFormatIDC must be either 400, 420, 422 or 444" ); std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true); @@ -2595,16 +2408,6 @@ bool EncAppCfg::xCheckParameter() m_pictureTimingSEIEnabled = false; } -#if !REMOVE_PPS_REXT - if(m_crossComponentPredictionEnabledFlag && (m_chromaFormatIDC != CHROMA_444)) - { - msg( WARNING, "****************************************************************************\n"); - msg( WARNING, "** WARNING: Cross-component prediction is specified for 4:4:4 format only **\n"); - msg( WARNING, "****************************************************************************\n"); - - m_crossComponentPredictionEnabledFlag = false; - } -#endif xConfirmPara( m_bufferingPeriodSEIEnabled == true && m_RCCpbSize == 0, "RCCpbSize must be greater than zero, when buffering period SEI is enabled" ); xConfirmPara (m_log2MaxTransformSkipBlockSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)"); @@ -2630,17 +2433,12 @@ bool EncAppCfg::xCheckParameter() #else xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0"); #endif -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS xConfirmPara( m_loopFilterBetaOffsetDiv2 < -12 || m_loopFilterBetaOffsetDiv2 > 12, "Loop Filter Beta Offset div. 2 exceeds supported range (-12 to 12" ); xConfirmPara( m_loopFilterTcOffsetDiv2 < -12 || m_loopFilterTcOffsetDiv2 > 12, "Loop Filter Tc Offset div. 2 exceeds supported range (-12 to 12)" ); xConfirmPara( m_loopFilterCbBetaOffsetDiv2 < -12 || m_loopFilterCbBetaOffsetDiv2 > 12, "Loop Filter Beta Offset div. 2 exceeds supported range (-12 to 12" ); xConfirmPara( m_loopFilterCbTcOffsetDiv2 < -12 || m_loopFilterCbTcOffsetDiv2 > 12, "Loop Filter Tc Offset div. 2 exceeds supported range (-12 to 12)" ); xConfirmPara( m_loopFilterCrBetaOffsetDiv2 < -12 || m_loopFilterCrBetaOffsetDiv2 > 12, "Loop Filter Beta Offset div. 2 exceeds supported range (-12 to 12" ); xConfirmPara( m_loopFilterCrTcOffsetDiv2 < -12 || m_loopFilterCrTcOffsetDiv2 > 12, "Loop Filter Tc Offset div. 2 exceeds supported range (-12 to 12)" ); -#else - xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)" ); - xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)" ); -#endif xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); xConfirmPara( m_bipredSearchRange < 0 , "Bi-prediction refinement search range must be more than 0" ); xConfirmPara( m_minSearchWindow < 0, "Minimum motion search window size for the adaptive window ME must be greater than or equal to 0" ); @@ -2694,7 +2492,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_cbQpOffsetDualTree > 12, "Max. Chroma Cb QP Offset for dual tree is 12" ); xConfirmPara( m_crQpOffsetDualTree < -12, "Min. Chroma Cr QP Offset for dual tree is -12" ); xConfirmPara( m_crQpOffsetDualTree > 12, "Max. Chroma Cr QP Offset for dual tree is 12" ); -#if JVET_Q0438_MONOCHROME_BUGFIXES if (m_dualTree && (m_chromaFormatIDC == CHROMA_400)) { msg( WARNING, "****************************************************************************\n"); @@ -2709,7 +2506,6 @@ bool EncAppCfg::xCheckParameter() msg( WARNING, "****************************************************************************\n"); m_ccalf = false; } -#endif if (m_JointCbCrMode && (m_chromaFormatIDC == CHROMA_400)) { msg( WARNING, "****************************************************************************\n"); @@ -2729,12 +2525,8 @@ bool EncAppCfg::xCheckParameter() { xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); } -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - xConfirmPara( m_uiMaxCUDepth > MAX_CU_DEPTH, "MaxPartitionDepth exceeds predefined MAX_CU_DEPTH limit"); -#endif xConfirmPara( m_uiMaxCUWidth > MAX_CU_SIZE, "MaxCUWith exceeds predefined MAX_CU_SIZE limit"); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int minCuSize = 1 << m_log2MinCuSize; xConfirmPara( m_uiMinQT[0] < minCuSize, "Min Luma QT size in I slices should be larger than or equal to minCuSize"); xConfirmPara( m_uiMinQT[1] < minCuSize, "Min Luma QT size in non-I slices should be larger than or equal to minCuSize"); @@ -2743,21 +2535,11 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( minDiff < 0 , "Min Chroma QT size in I slices is smaller than Min Luma CU size even considering color format"); xConfirmPara( (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)) > std::min(64, (int)m_uiCTUSize), "Min Chroma QT size in I slices should be smaller than or equal to CTB size or CB size after implicit split of CTB"); -#else - xConfirmPara( m_uiMinQT[0] < 1<<MIN_CU_LOG2, "Minimum QT size should be larger than or equal to 4"); - xConfirmPara( m_uiMinQT[1] < 1<<MIN_CU_LOG2, "Minimum QT size should be larger than or equal to 4"); -#endif xConfirmPara( m_uiCTUSize < 32, "CTUSize must be greater than or equal to 32"); xConfirmPara( m_uiCTUSize > 128, "CTUSize must be less than or equal to 128"); xConfirmPara( m_uiCTUSize != 32 && m_uiCTUSize != 64 && m_uiCTUSize != 128, "CTUSize must be a power of 2 (32, 64, or 128)"); -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - xConfirmPara( m_uiMaxCUDepth < 1, "MaxPartitionDepth must be greater than zero"); - xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); - xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); -#endif xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); -#if JVET_Q0330_BLOCK_PARTITION xConfirmPara( m_uiMaxBT[0] < m_uiMinQT[0], "Maximum BT size for luma block in I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxBT[0] > m_uiCTUSize, "Maximum BT size for luma block in I slice should be smaller than or equal to CTUSize"); xConfirmPara( m_uiMaxBT[1] < m_uiMinQT[1], "Maximum BT size for luma block in non I slice should be larger than minimum QT size"); @@ -2772,14 +2554,8 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_uiMaxTT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), "Maximum TT size for chroma block in I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxTT[2] > m_uiCTUSize, "Maximum TT size for chroma block in I slice should be smaller than or equal to CTUSize"); -#endif -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX xConfirmPara( (m_iSourceWidth % (std::max(8u, m_log2MinCuSize))) != 0, "Resulting coded frame width must be a multiple of Max(8, the minimum CU size)"); xConfirmPara( (m_iSourceHeight % (std::max(8u, m_log2MinCuSize))) != 0, "Resulting coded frame height must be a multiple of Max(8, the minimum CU size)"); -#else - xConfirmPara( (m_iSourceWidth % (std::max(8, int(m_uiMaxCUWidth >> (m_uiMaxCUDepth - 1))))) != 0, "Resulting coded frame width must be a multiple of Max(8, the minimum CU size)"); - xConfirmPara( (m_iSourceHeight % (std::max(8, int(m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1))))) != 0, "Resulting coded frame height must be a multiple of Max(8, the minimum CU size)"); -#endif if (m_uiMaxMTTHierarchyDepthI == 0) { xConfirmPara(m_uiMaxBT[0] != m_uiMinQT[0], "MaxBTLumaISlice shall be equal to MinQTLumaISlice when MaxMTTHierarchyDepthISliceL is 0."); @@ -2799,21 +2575,9 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_log2MaxTbSize < 5, "Log2MaxTbSize must be 5 or greater." ); xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); xConfirmPara( m_maxNumMergeCand > MRG_MAX_NUM_CANDS, "MaxNumMergeCand must be no more than MRG_MAX_NUM_CANDS." ); -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - xConfirmPara(m_maxNumGeoCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS."); - xConfirmPara(m_maxNumGeoCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand."); - xConfirmPara(0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0."); -#else - xConfirmPara( m_maxNumTriangleCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS." ); - xConfirmPara( m_maxNumTriangleCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand." ); - xConfirmPara( 0 < m_maxNumTriangleCand && m_maxNumTriangleCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0." ); -#endif -#else xConfirmPara( m_maxNumGeoCand > GEO_MAX_NUM_UNI_CANDS, "MaxNumGeoCand must be no more than GEO_MAX_NUM_UNI_CANDS." ); xConfirmPara( m_maxNumGeoCand > m_maxNumMergeCand, "MaxNumGeoCand must be no more than MaxNumMergeCand." ); xConfirmPara( 0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumGeoCand must be no less than 2 unless MaxNumGeoCand is 0." ); -#endif xConfirmPara( m_maxNumIBCMergeCand < 1, "MaxNumIBCMergeCand must be 1 or greater." ); xConfirmPara( m_maxNumIBCMergeCand > IBC_MRG_MAX_NUM_CANDS, "MaxNumIBCMergeCand must be no more than IBC_MRG_MAX_NUM_CANDS." ); xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." ); @@ -2836,12 +2600,10 @@ bool EncAppCfg::xCheckParameter() } -#if JVET_Q0795_CCALF if (!m_alf) { xConfirmPara( m_ccalf, "CCALF cannot be enabled when ALF is disabled" ); } -#endif xConfirmPara( m_iSourceWidth % SPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); @@ -2884,12 +2646,10 @@ bool EncAppCfg::xCheckParameter() m_GOPList[0].m_QPFactor = 1; m_GOPList[0].m_betaOffsetDiv2 = 0; m_GOPList[0].m_tcOffsetDiv2 = 0; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS m_GOPList[0].m_CbBetaOffsetDiv2 = 0; m_GOPList[0].m_CbTcOffsetDiv2 = 0; m_GOPList[0].m_CrBetaOffsetDiv2 = 0; m_GOPList[0].m_CrTcOffsetDiv2 = 0; -#endif m_GOPList[0].m_POC = 1; m_RPLList0[0] = RPLEntry(); m_RPLList1[0] = RPLEntry(); @@ -2932,17 +2692,12 @@ bool EncAppCfg::xCheckParameter() { for(int i=0; i<m_iGOPSize; i++) { -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS xConfirmPara( (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -12 || (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 12, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -12 || (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 12, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( (m_GOPList[i].m_CbBetaOffsetDiv2 + m_loopFilterCbBetaOffsetDiv2) < -12 || (m_GOPList[i].m_CbBetaOffsetDiv2 + m_loopFilterCbBetaOffsetDiv2) > 12, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( (m_GOPList[i].m_CbTcOffsetDiv2 + m_loopFilterCbTcOffsetDiv2) < -12 || (m_GOPList[i].m_CbTcOffsetDiv2 + m_loopFilterCbTcOffsetDiv2) > 12, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( (m_GOPList[i].m_CrBetaOffsetDiv2 + m_loopFilterCrBetaOffsetDiv2) < -12 || (m_GOPList[i].m_CrBetaOffsetDiv2 + m_loopFilterCrBetaOffsetDiv2) > 12, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( (m_GOPList[i].m_CrTcOffsetDiv2 + m_loopFilterCrTcOffsetDiv2) < -12 || (m_GOPList[i].m_CrTcOffsetDiv2 + m_loopFilterCrTcOffsetDiv2) > 12, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); -#else - xConfirmPara( (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); - xConfirmPara( (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); -#endif } } @@ -3570,74 +3325,6 @@ bool EncAppCfg::xCheckParameter() m_BIO = false; } -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - // If m_PPSorSliceFlag is equal to 1, for each PPS parameter below, - // 0: value is signaled in slice header - // >0: value is derived from PPS parameter as value - 1 - switch (m_PPSorSliceMode) - { - case 0: // All parameter values are signaled in slice header - m_constantSliceHeaderParamsEnabledFlag = 0; - m_PPSDepQuantEnabledIdc = 0; - m_PPSRefPicListSPSIdc0 = 0; - m_PPSRefPicListSPSIdc1 = 0; - m_PPSMvdL1ZeroIdc = 0; - m_PPSCollocatedFromL0Idc = 0; - m_PPSSixMinusMaxNumMergeCandPlus1 = 0; -#if !JVET_Q0806 - m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = 0; -#else - m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 = 0; -#endif - break; - case 1: // RA setting - m_constantSliceHeaderParamsEnabledFlag = 1; - m_PPSDepQuantEnabledIdc = (m_depQuantEnabledFlag ? 1 : 0) + 1; - m_PPSRefPicListSPSIdc0 = 0; - m_PPSRefPicListSPSIdc1 = 0; - m_PPSMvdL1ZeroIdc = 0; - m_PPSCollocatedFromL0Idc = 0; - m_PPSSixMinusMaxNumMergeCandPlus1 = 6 - m_maxNumMergeCand + 1; -#if !JVET_Q0806 - m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = m_maxNumMergeCand - m_maxNumTriangleCand + 1; -#else - m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 = m_maxNumMergeCand - m_maxNumGeoCand + 1; -#endif - break; - case 2: // LDB setting - m_constantSliceHeaderParamsEnabledFlag = 1; - m_PPSDepQuantEnabledIdc = (m_depQuantEnabledFlag ? 1 : 0) + 1; - m_PPSRefPicListSPSIdc0 = 2; - m_PPSRefPicListSPSIdc1 = 2; - m_PPSMvdL1ZeroIdc = 2; - m_PPSCollocatedFromL0Idc = 1; - m_PPSSixMinusMaxNumMergeCandPlus1 = 6 - m_maxNumMergeCand + 1; -#if !JVET_Q0806 - m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = m_maxNumMergeCand - m_maxNumTriangleCand + 1; -#else - m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 = m_maxNumMergeCand - m_maxNumGeoCand + 1; -#endif - break; - case 3: // LDP setting - m_constantSliceHeaderParamsEnabledFlag = 1; - m_PPSDepQuantEnabledIdc = (m_depQuantEnabledFlag ? 1 : 0) + 1; - m_PPSRefPicListSPSIdc0 = 2; - m_PPSRefPicListSPSIdc1 = 2; - m_PPSMvdL1ZeroIdc = 0; - m_PPSCollocatedFromL0Idc = 0; - m_PPSSixMinusMaxNumMergeCandPlus1 = 6 - m_maxNumMergeCand + 1; -#if !JVET_Q0806 - m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = 0; -#else - m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 = 0; -#endif - break; - default: - THROW("Invalid value for PPSorSliceMode"); - } - xConfirmPara(m_drapPeriod > 0 && m_PPSRefPicListSPSIdc0 > 0, "PPSRefPicListSPSIdc0 shall be 0 when DRAP is used. This can be fixed by setting PPSorSliceMode=0."); - xConfirmPara(m_drapPeriod > 0 && m_PPSRefPicListSPSIdc1 > 0, "PPSRefPicListSPSIdc1 shall be 0 when DRAP is used. This can be fixed by setting PPSorSliceMode=0."); -#endif xConfirmPara( m_sariAspectRatioIdc < 0 || m_sariAspectRatioIdc > 255, "SEISARISampleAspectRatioIdc must be in the range of 0 to 255"); @@ -3720,19 +3407,15 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_gcmpSEIGuardBandSamplesMinus1 < 0 || m_gcmpSEIGuardBandSamplesMinus1 > 15, "SEIGcmpGuardBandSamplesMinus1 must be in the range of 0 to 15"); } } -#if JVET_Q0297_MER xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); -#endif #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI xConfirmPara(m_preferredTransferCharacteristics > 255, "transfer_characteristics_idc should not be greater than 255."); #endif xConfirmPara( unsigned(m_ImvMode) > 1, "ImvMode exceeds range (0 to 1)" ); -#if JVET_Q0444_AMVR_SIGNALLING if (m_AffineAmvr) { xConfirmPara(!m_ImvMode, "AffineAmvr cannot be used when IMV is disabled."); } -#endif xConfirmPara( m_decodeBitstreams[0] == m_bitstreamFileName, "Debug bitstream and the output bitstream cannot be equal.\n" ); xConfirmPara( m_decodeBitstreams[1] == m_bitstreamFileName, "Decode2 bitstream and the output bitstream cannot be equal.\n" ); xConfirmPara(unsigned(m_LMChroma) > 1, "LMMode exceeds range (0 to 1)"); @@ -3744,12 +3427,7 @@ bool EncAppCfg::xCheckParameter() check_failed |= m_ext360.verifyParameters(); #endif -#if !JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM - xConfirmPara(m_useBDPCM < 0 || m_useBDPCM > 2, "BDPCM must be in range 0..2"); -#endif -#if JVET_Q0820_ACT xConfirmPara(m_useColorTrans && (m_log2MaxTbSize == 6), "Log2MaxTbSize must be less than 6 when ACT is enabled, otherwise ACT needs to be disabled"); -#endif #undef xConfirmPara return check_failed; @@ -3800,19 +3478,10 @@ void EncAppCfg::xPrintParameter() { msg( DETAILS, "Profile : %s\n", profileToString(m_profile) ); } -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX msg(DETAILS, "CTU size / min CU size : %d / %d \n", m_uiMaxCUWidth, 1 << m_log2MinCuSize); -#else - msg( DETAILS, "CU size / depth / total-depth : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxCodingDepth ); -#endif -#if JVET_Q0119_CLEANUPS msg(DETAILS, "subpicture info present flag : %d\n", m_subPicInfoPresentFlag); if (m_subPicInfoPresentFlag) -#else - msg(DETAILS, "subpicture present flag : %d\n", m_subPicPresentFlag); - if (m_subPicPresentFlag) -#endif { msg(DETAILS, "number of subpictures : %d\n", m_numSubPics); for (int i = 0; i < m_numSubPics; i++) @@ -3825,17 +3494,10 @@ void EncAppCfg::xPrintParameter() } } -#if JVET_Q0119_CLEANUPS msg(DETAILS, "subpicture ID present flag : %d\n", m_subPicIdMappingExplicitlySignalledFlag); if (m_subPicIdMappingExplicitlySignalledFlag) { msg(DETAILS, "subpicture ID signalling present flag : %d\n", m_subPicIdMappingInSpsFlag); -#else - msg(DETAILS, "subpicture ID present flag : %d\n", m_subPicIdPresentFlag); - if (m_subPicIdPresentFlag) - { - msg(DETAILS, "subpicture ID signalling present flag : %d\n", m_subPicIdSignallingPresentFlag); -#endif for (int i = 0; i < m_numSubPics; i++) { msg(DETAILS, "[%d]th subpictures ID length :%d\n", i, m_subPicIdLen); @@ -3876,19 +3538,9 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "explicit_rdpcm_enabled_flag : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") ); msg( DETAILS, "transform_skip_rotation_enabled_flag : %s\n", (m_transformSkipRotationEnabledFlag ? "Enabled" : "Disabled") ); msg( DETAILS, "transform_skip_context_enabled_flag : %s\n", (m_transformSkipContextEnabledFlag ? "Enabled" : "Disabled") ); -#if !REMOVE_PPS_REXT - msg( DETAILS, "cross_component_prediction_enabled_flag: %s\n", (m_crossComponentPredictionEnabledFlag ? (m_reconBasedCrossCPredictionEstimate ? "Enabled (reconstructed-residual-based estimate)" : "Enabled (encoder-side-residual-based estimate)") : "Disabled") ); -#endif msg( DETAILS, "high_precision_offsets_enabled_flag : %s\n", (m_highPrecisionOffsetsEnabledFlag ? "Enabled" : "Disabled") ); msg( DETAILS, "persistent_rice_adaptation_enabled_flag: %s\n", (m_persistentRiceAdaptationEnabledFlag ? "Enabled" : "Disabled") ); msg( DETAILS, "cabac_bypass_alignment_enabled_flag : %s\n", (m_cabacBypassAlignmentEnabledFlag ? "Enabled" : "Disabled") ); -#if !JVET_Q0441_SAO_MOD_12_BIT - if (m_bUseSAO) - { - msg( DETAILS, "log2_sao_offset_scale_luma : %d\n", m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA] ); - msg( DETAILS, "log2_sao_offset_scale_chroma : %d\n", m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); - } -#endif switch (m_costMode) { @@ -3922,15 +3574,7 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "Max Num Merge Candidates : %d\n", m_maxNumMergeCand ); msg( DETAILS, "Max Num Affine Merge Candidates : %d\n", m_maxNumAffineMergeCand ); -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - msg(DETAILS, "Max Num Triangle Merge Candidates : %d\n", m_maxNumGeoCand); -#else - msg( DETAILS, "Max Num Triangle Merge Candidates : %d\n", m_maxNumTriangleCand ); -#endif -#else msg( DETAILS, "Max Num Geo Merge Candidates : %d\n", m_maxNumGeoCand ); -#endif msg( DETAILS, "Max Num IBC Merge Candidates : %d\n", m_maxNumIBCMergeCand ); msg( DETAILS, "\n"); @@ -3962,15 +3606,11 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "MCTS:%d ", m_MCTSEncConstraint ); msg( VERBOSE, "SAO:%d ", (m_bUseSAO)?(1):(0)); msg( VERBOSE, "ALF:%d ", m_alf ? 1 : 0 ); -#if JVET_Q0795_CCALF msg( VERBOSE, "CCALF:%d ", m_ccalf ? 1 : 0 ); -#endif msg( VERBOSE, "WPP:%d ", (int)m_useWeightedPred); msg( VERBOSE, "WPB:%d ", (int)m_useWeightedBiPred); -#if JVET_Q0297_MER msg( VERBOSE, "PME:%d ", m_log2ParallelMergeLevel); -#endif const int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; msg( VERBOSE, " WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams); msg( VERBOSE, " ScalingList:%d ", m_useScalingListId ); @@ -4007,11 +3647,7 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "LADF:%d ", m_LadfEnabed ); #endif msg(VERBOSE, "CIIP:%d ", m_ciip); -#if !JVET_Q0806 - msg( VERBOSE, "Triangle:%d ", m_Triangle ); -#else msg( VERBOSE, "Geo:%d ", m_Geo ); -#endif m_allowDisFracMMVD = m_MMVD ? m_allowDisFracMMVD : false; if ( m_MMVD ) msg(VERBOSE, "AllowDisFracMMVD:%d ", m_allowDisFracMMVD); @@ -4022,15 +3658,8 @@ void EncAppCfg::xPrintParameter() msg(VERBOSE, "MmvdDisNum:%d ", m_MmvdDisNum); msg(VERBOSE, "JointCbCr:%d ", m_JointCbCrMode); } -#if JVET_Q0820_ACT m_useColorTrans = (m_chromaFormatIDC == CHROMA_444) ? m_useColorTrans : 0u; -#else - m_useColorTrans = (m_chromaFormatIDC == CHROMA_444 && m_costMode != COST_LOSSLESS_CODING) ? m_useColorTrans : 0u; -#endif msg(VERBOSE, "ACT:%d ", m_useColorTrans); -#if !JVET_Q0504_PLT_NON444 - m_PLTMode = ( m_chromaFormatIDC == CHROMA_444) ? m_PLTMode : 0u; -#endif msg(VERBOSE, "PLT:%d ", m_PLTMode); msg(VERBOSE, "IBC:%d ", m_IBCMode); msg( VERBOSE, "HashME:%d ", m_HashME ); @@ -4040,16 +3669,10 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "WrapAroundOffset:%d ", m_wrapAroundOffset ); } // ADD_NEW_TOOL (add some output indicating the usage of tools) -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG msg( VERBOSE, "VirtualBoundariesEnabledFlag:%d ", m_virtualBoundariesEnabledFlag ); msg( VERBOSE, "VirtualBoundariesPresentInSPSFlag:%d ", m_virtualBoundariesPresentFlag ); if( m_virtualBoundariesPresentFlag ) { -#else - msg(VERBOSE, "LoopFilterAcrossVirtualBoundaries:%d ", m_loopFilterAcrossVirtualBoundariesDisabledFlag); - if ( m_loopFilterAcrossVirtualBoundariesDisabledFlag ) - { -#endif msg(VERBOSE, "vertical virtual boundaries:["); for (unsigned i = 0; i < m_numVerVirtualBoundaries; i++) { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 0a82b669bd7708b49db410205639f5b2a594e53d..25f89d5b5dc69d62bcd8e5c44cc8d22ec211fe4d 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -116,9 +116,7 @@ protected: int m_framesToBeEncoded; ///< number of encoded frames int m_aiPad[2]; ///< number of padded pixels for width and height bool m_AccessUnitDelimiter; ///< add Access Unit Delimiter NAL units -#if JVET_Q0775_PH_IN_SH bool m_enablePictureHeaderInSliceHeader; ///< Enable Picture Header in Slice Header -#endif InputColourSpaceConversion m_inputColourSpaceConvert; ///< colour space conversion to apply to input video bool m_snrInternalColourSpace; ///< if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input is applied. bool m_outputInternalColourSpace; ///< if true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied. @@ -141,9 +139,7 @@ protected: bool m_noPartitionConstraintsOverrideConstraintFlag; bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; -#if JVET_Q0795_CCALF bool m_noCCAlfConstraintFlag; -#endif bool m_bNoRefWraparoundConstraintFlag; bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; @@ -158,11 +154,7 @@ protected: bool m_noIbcConstraintFlag; bool m_bNoCiipConstraintFlag; bool m_noFPelMmvdConstraintFlag; -#if !JVET_Q0806 - bool m_bNoTriangleConstraintFlag; -#else bool m_noGeoConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; bool m_noBDPCMConstraintFlag; @@ -192,13 +184,11 @@ protected: bool m_progressiveSourceFlag; bool m_interlacedSourceFlag; bool m_nonPackedConstraintFlag; -#if JVET_Q0114_CONSTRAINT_FLAGS bool m_nonProjectedConstraintFlag; bool m_noResChangeInClvsConstraintFlag; bool m_oneTilePerPicConstraintFlag; bool m_oneSlicePerPicConstraintFlag; bool m_oneSubpicPerPicConstraintFlag; -#endif bool m_frameOnlyConstraintFlag; // coding structure @@ -213,20 +203,10 @@ protected: GOPEntry m_GOPList[MAX_GOP]; ///< the coding structure entries from the config file int m_numReorderPics[MAX_TLAYER]; ///< total number of reorder pictures int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of pictures in the decoded picture buffer -#if !REMOVE_PPS_REXT - bool m_crossComponentPredictionEnabledFlag; ///< flag enabling the use of cross-component prediction -#endif bool m_reconBasedCrossCPredictionEstimate; ///< causes the alpha calculation in encoder search to be based on the decoded residual rather than the pre-transform encoder-side residual -#if !JVET_Q0441_SAO_MOD_12_BIT - uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; ///< number of bits for the upward bit shift operation on the decoded SAO offsets -#endif bool m_useTransformSkip; ///< flag for enabling intra transform skipping bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool m_useBDPCM; -#else - int m_useBDPCM; -#endif uint32_t m_log2MaxTransformSkipBlockSize; ///< transform-skip maximum size (minimum of 2) bool m_transformSkipRotationEnabledFlag; ///< control flag for transform-skip/transquant-bypass residual rotation bool m_transformSkipContextEnabledFlag; ///< control flag for transform-skip/transquant-bypass single significance map context @@ -285,11 +265,7 @@ protected: // coding unit (CU) definition unsigned m_uiCTUSize; -#if JVET_Q0119_CLEANUPS bool m_subPicInfoPresentFlag; -#else - bool m_subPicPresentFlag; -#endif unsigned m_numSubPics; std::vector<uint32_t> m_subPicCtuTopLeftX; std::vector<uint32_t> m_subPicCtuTopLeftY; @@ -297,13 +273,8 @@ protected: std::vector<uint32_t> m_subPicHeight; std::vector<bool> m_subPicTreatedAsPicFlag; std::vector<bool> m_loopFilterAcrossSubpicEnabledFlag; -#if JVET_Q0119_CLEANUPS bool m_subPicIdMappingExplicitlySignalledFlag; bool m_subPicIdMappingInSpsFlag; -#else - bool m_subPicIdPresentFlag; - bool m_subPicIdSignallingPresentFlag; -#endif unsigned m_subPicIdLen; std::vector<uint16_t> m_subPicId; bool m_SplitConsOverrideEnabledFlag; @@ -311,10 +282,8 @@ protected: unsigned m_uiMaxMTTHierarchyDepth; unsigned m_uiMaxMTTHierarchyDepthI; unsigned m_uiMaxMTTHierarchyDepthIChroma; -#if JVET_Q0330_BLOCK_PARTITION unsigned m_uiMaxBT[3]; unsigned m_uiMaxTT[3]; -#endif bool m_dualTree; bool m_LFNST; bool m_useFastLFNST; @@ -344,11 +313,7 @@ protected: #endif bool m_ciip; -#if !JVET_Q0806 - bool m_Triangle; -#else bool m_Geo; -#endif bool m_HashME; bool m_allowDisFracMMVD; bool m_AffineAmvr; @@ -373,12 +338,8 @@ protected: unsigned m_wrapAroundOffset; // ADD_NEW_TOOL : (encoder app) add tool enabling flags and associated parameters here -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG bool m_virtualBoundariesEnabledFlag; bool m_virtualBoundariesPresentFlag; -#else - bool m_loopFilterAcrossVirtualBoundariesDisabledFlag; -#endif unsigned m_numVerVirtualBoundaries; unsigned m_numHorVirtualBoundaries; std::vector<unsigned> m_virtualBoundariesPosX; @@ -394,13 +355,7 @@ protected: bool m_encDbOpt; unsigned m_uiMaxCUWidth; ///< max. CU width in pixel unsigned m_uiMaxCUHeight; ///< max. CU height in pixel -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX unsigned m_log2MinCuSize; ///< min. CU size log2 -#else - unsigned m_uiMaxCUDepth; ///< max. CU depth (as specified by command line) - unsigned m_uiMaxCodingDepth; ///< max. total CU depth - includes depth of transform-block structure - unsigned m_uiLog2DiffMaxMinCodingBlockSize; ///< difference between largest and smallest CU depth -#endif bool m_useFastLCTU; bool m_usePbIntraFast; @@ -449,12 +404,10 @@ protected: bool m_loopFilterOffsetInPPS; ///< offset for deblocking filter in 0 = slice header, 1 = PPS int m_loopFilterBetaOffsetDiv2; ///< beta offset for deblocking filter int m_loopFilterTcOffsetDiv2; ///< tc offset for deblocking filter -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int m_loopFilterCbBetaOffsetDiv2; ///< beta offset for Cb deblocking filter int m_loopFilterCbTcOffsetDiv2; ///< tc offset for Cb deblocking filter int m_loopFilterCrBetaOffsetDiv2; ///< beta offset for Cr deblocking filter int m_loopFilterCrTcOffsetDiv2; ///< tc offset for Cr deblocking filter -#endif #if W0038_DB_OPT int m_deblockingFilterMetric; ///< blockiness metric in encoder #else @@ -501,9 +454,7 @@ protected: uint32_t m_numTileRows; ///< derived number of tile rows bool m_singleSlicePerSubPicFlag; bool m_entropyCodingSyncEnabledFlag; -#if JVET_Q0151_Q0205_ENTRYPOINTS bool m_entropyCodingSyncEntryPointPresentFlag; ///< flag for the presence of entry points for WPP -#endif bool m_bFastUDIUseMPMEnabled; bool m_bFastMEForGenBLowDelayEnabled; @@ -514,9 +465,7 @@ protected: bool m_pictureTimingSEIEnabled; bool m_bpDeltasGOPStructure; bool m_decodingUnitInfoSEIEnabled; -#if JVET_P0190_SCALABLE_NESTING_SEI bool m_scalableNestingSEIEnabled; -#endif bool m_frameFieldInfoSEIEnabled; bool m_framePackingSEIEnabled; int m_framePackingSEIType; @@ -621,19 +570,11 @@ protected: std::vector<double> m_gcmpSEIFunctionCoeffV; std::vector<bool> m_gcmpSEIFunctionVAffectedByUFlag; bool m_gcmpSEIGuardBandFlag; -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE uint32_t m_gcmpSEIGuardBandType; bool m_gcmpSEIGuardBandBoundaryExteriorFlag; -#else - bool m_gcmpSEIGuardBandBoundaryType; -#endif uint32_t m_gcmpSEIGuardBandSamplesMinus1; -#if JVET_SUBPIC_LEVEL_CFG EncCfgParam::CfgSEISubpictureLevel m_cfgSubpictureLevelInfoSEI; -#else - bool m_subpicureLevelInfoSEIEnabled; -#endif bool m_sampleAspectRatioInfoSEIEnabled; bool m_sariCancelFlag; @@ -649,47 +590,20 @@ protected: bool m_useWeightedBiPred; ///< Use of bi-directional weighted prediction in B slices WeightedPredictionMethod m_weightedPredictionMethod; -#if JVET_Q0297_MER uint32_t m_log2ParallelMergeLevel; ///< Parallel merge estimation region -#endif uint32_t m_maxNumMergeCand; ///< Max number of merge candidates uint32_t m_maxNumAffineMergeCand; ///< Max number of affine merge candidates -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - uint32_t m_maxNumGeoCand; -#else - uint32_t m_maxNumTriangleCand; -#endif -#else uint32_t m_maxNumGeoCand; -#endif uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates bool m_sliceLevelRpl; ///< code reference picture lists in slice headers rather than picture header bool m_sliceLevelDblk; ///< code deblocking filter parameters in slice headers rather than picture header bool m_sliceLevelSao; ///< code SAO parameters in slice headers rather than picture header bool m_sliceLevelAlf; ///< code ALF parameters in slice headers rather than picture header -#if JVET_Q0819_PH_CHANGES bool m_sliceLevelWp; ///< code weighted prediction parameters in slice headers rather than picture header bool m_sliceLevelDeltaQp; ///< code delta in slice headers rather than picture header -#endif int m_TMVPModeId; -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - int m_PPSorSliceMode; - bool m_constantSliceHeaderParamsEnabledFlag; - int m_PPSDepQuantEnabledIdc; - int m_PPSRefPicListSPSIdc0; - int m_PPSRefPicListSPSIdc1; - int m_PPSMvdL1ZeroIdc; - int m_PPSCollocatedFromL0Idc; - uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; -#if !JVET_Q0806 - uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#else - uint32_t m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1; -#endif -#endif bool m_depQuantEnabledFlag; bool m_signDataHidingEnabledFlag; bool m_RCEnableRateControl; ///< enable rate control or not @@ -711,11 +625,7 @@ protected: bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value -#if JVET_Q0117_PARAMETER_SETS_CLEANUP bool m_DCIEnabled; ///< enable Decoding Capability Information (DCI) -#else - bool m_decodingParameterSetEnabled; ///< enable decoding parameter set -#endif bool m_hrdParametersPresentFlag; ///< enable generation of HRD parameters bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present @@ -752,10 +662,8 @@ protected: bool m_forceDecodeBitstream1; bool m_alf; ///< Adaptive Loop Filter -#if JVET_Q0795_CCALF bool m_ccalf; int m_ccalfQpThreshold; -#endif double m_scalingRatioHor; double m_scalingRatioVer; @@ -769,9 +677,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; @@ -785,11 +691,9 @@ protected: int m_numOutputLayerSets; std::string m_olsOutputLayerStr[MAX_VPS_LAYERS]; -#if JVET_Q0786_PTL_only int m_numPtlsInVps; Level::Name m_levelPtl[MAX_NUM_OLSS]; int m_olsPtlIdx[MAX_NUM_OLSS]; -#endif #if EXTENSION_360_VIDEO TExt360AppEncCfg m_ext360; diff --git a/source/App/EncoderApp/encmain.cpp b/source/App/EncoderApp/encmain.cpp index 16a02a429b29a67233b57d20a57e73d1f8a453f4..e10acfcbfb921dc36a017ef29793586a01e5cc5c 100644 --- a/source/App/EncoderApp/encmain.cpp +++ b/source/App/EncoderApp/encmain.cpp @@ -180,7 +180,6 @@ int main(int argc, char* argv[]) delete[] layerArgv; -#if JVET_Q0172_CHROMA_FORMAT_BITDEPTH_CONSTRAINT if (layerIdx > 1) { VPS* vps = pcEncApp[0]->getVPS(); @@ -201,7 +200,6 @@ int main(int argc, char* argv[]) } } } -#endif #if PRINT_MACRO_VALUES printMacroSettings(); diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp index 01d70b297a219546593b3ac43f89fae40ff29da7..c0ed4807a180e8a9e1ff19feb9e825c7985251e0 100644 --- a/source/App/Parcat/parcat.cpp +++ b/source/App/Parcat/parcat.cpp @@ -48,15 +48,10 @@ class ParcatHLSyntaxReader : public VLCReader { public: -#if JVET_Q0819_PH_CHANGES void parsePictureHeaderUpToPoc ( ParameterSetManager *parameterSetManager ); bool parsePictureHeaderInSliceHeaderFlag ( ParameterSetManager *parameterSetManager ); -#else - void parseSliceHeaderUpToPoc ( ParameterSetManager *parameterSetManager ); -#endif }; -#if JVET_Q0819_PH_CHANGES bool ParcatHLSyntaxReader::parsePictureHeaderInSliceHeaderFlag(ParameterSetManager *parameterSetManager) { @@ -89,13 +84,6 @@ void ParcatHLSyntaxReader::parsePictureHeaderUpToPoc ( ParameterSetManager *para CHECK(sps == 0, "Invalid SPS"); return; } -#else -void ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parameterSetManager ) -{ - // POC is first syntax element in slice header - return; -} -#endif /** Find the beginning and end of a NAL (Network Abstraction Layer) unit in a byte buffer containing H264 bitstream data. @@ -230,12 +218,8 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int int bits_for_poc = 8; bool skip_next_sei = false; -#if JVET_Q0819_PH_CHANGES bool change_poc = false; bool first_idr_slice_after_ph_nal = false; -#else - bool first_slice_segment_in_pic_flag = false; -#endif while(find_nal_unit(p, sz, &nal_start, &nal_end) > 0) { @@ -282,28 +266,17 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int HLSReader.parsePPS( pps ); parameterSetManager.storePPS( pps, inp_nalu.getBitstream().getFifo() ); } -#if !JVET_Q0819_PH_CHANGES - if( inp_nalu.m_nalUnitType == NAL_UNIT_PH ) - { - first_slice_segment_in_pic_flag = true; - } -#endif if(nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) { poc = 0; new_poc = *poc_base + poc; -#if JVET_Q0819_PH_CHANGES if (first_idr_slice_after_ph_nal) { cnt--; } first_idr_slice_after_ph_nal = false; -#else - first_slice_segment_in_pic_flag = false; -#endif } -#if JVET_Q0819_PH_CHANGES if(inp_nalu.m_nalUnitType == NAL_UNIT_PH || (nalu_type < NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (nalu_type > NAL_UNIT_CODED_SLICE_IDR_N_LP && nalu_type <= NAL_UNIT_RESERVED_IRAP_VCL_12) ) { parcatHLSReader.setBitstream( &inp_nalu.getBitstream() ); @@ -348,57 +321,14 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int change_poc = false; } } -#else - if((nalu_type < NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (nalu_type > NAL_UNIT_CODED_SLICE_IDR_N_LP && nalu_type <= NAL_UNIT_RESERVED_IRAP_VCL_12) ) - { - parcatHLSReader.setBitstream( &inp_nalu.getBitstream() ); - - // beginning of slice header parsing, taken from VLCReader - parcatHLSReader.parseSliceHeaderUpToPoc( ¶meterSetManager ); - int num_bits_up_to_poc_lsb = parcatHLSReader.getBitstream()->getNumBitsRead(); - int offset = num_bits_up_to_poc_lsb; - - int byte_offset = offset / 8; - int hi_bits = offset % 8; - uint16_t data = (nalu[byte_offset] << 8) | nalu[byte_offset + 1]; - int low_bits = 16 - hi_bits - bits_for_poc; - poc_lsb = (data >> low_bits) & 0xff; - poc = poc_lsb; //calc_poc(poc_lsb, 0, bits_for_poc, nalu_type); - - new_poc = poc + *poc_base; - // int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); - unsigned picOrderCntLSB = (new_poc - *last_idr_poc +(1 << bits_for_poc)) & ((1<<bits_for_poc)-1); - - int low = data & ((1 << low_bits) - 1); - int hi = data >> (16 - hi_bits); - data = (hi << (16 - hi_bits)) | (picOrderCntLSB << low_bits) | low; - - nalu[byte_offset] = data >> 8; - nalu[byte_offset + 1] = data & 0xff; - - if( first_slice_segment_in_pic_flag ) - { -#if ENABLE_TRACING - std::cout << "Changed poc " << poc << " to " << new_poc << std::endl; -#endif - ++cnt; - first_slice_segment_in_pic_flag = false; - } - } -#endif if(idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) { skip_next_sei = true; idr_found = true; } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP if ((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_DCI || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_PREFIX_APS || nalu_type == NAL_UNIT_SUFFIX_APS || nalu_type == NAL_UNIT_PH || nalu_type == NAL_UNIT_ACCESS_UNIT_DELIMITER)) || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei)) -#else - if ((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_DPS || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_PREFIX_APS || nalu_type == NAL_UNIT_SUFFIX_APS || nalu_type == NAL_UNIT_PH || nalu_type == NAL_UNIT_ACCESS_UNIT_DELIMITER)) - || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei)) -#endif { } else diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index eb28dd449a14145b501ee7072bc813d8ca52210e..51a237c90d4a88c1a45c51d12d81e7840001f248 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -63,9 +63,7 @@ AdaptiveLoopFilter::AdaptiveLoopFilter() } m_deriveClassificationBlk = deriveClassificationBlk; -#if JVET_Q0795_CCALF m_filterCcAlf = filterBlkCcAlf<CC_ALF>; -#endif m_filter5x5Blk = filterBlk<ALF_FILTER_5>; m_filter7x7Blk = filterBlk<ALF_FILTER_7>; @@ -83,13 +81,8 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs const PPS* pps = cs.pps; const PicHeader* picHeader = cs.picHeader; -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG if( picHeader->getVirtualBoundariesPresentFlag() ) { -#else - if( picHeader->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { -#endif for( int i = 0; i < picHeader->getNumHorVirtualBoundaries(); i++ ) { if( picHeader->getVirtualBoundariesPosY(i) == yPos ) @@ -126,10 +119,8 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs int ctuSize = slice.getSPS()->getCTUSize(); const Position currCtuPos(xPos, yPos); const CodingUnit *currCtu = cs.getCU(currCtuPos, CHANNEL_TYPE_LUMA); -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY const SubPic& curSubPic = slice.getPPS()->getSubPicFromPos(currCtuPos); bool loopFilterAcrossSubPicEnabledFlag = curSubPic.getloopFilterAcrossEnabledFlag(); -#endif //top if (yPos >= ctuSize && clipTop == false) { @@ -137,9 +128,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs const CodingUnit *prevCtu = cs.getCU(prevCtuPos, CHANNEL_TYPE_LUMA); if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *prevCtu)) || (!pps->getLoopFilterAcrossTilesEnabledFlag() && !CU::isSameTile(*currCtu, *prevCtu)) -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *prevCtu)) -#endif ) { clipTop = true; @@ -153,9 +142,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs const CodingUnit *nextCtu = cs.getCU(nextCtuPos, CHANNEL_TYPE_LUMA); if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *nextCtu)) || (!pps->getLoopFilterAcrossTilesEnabledFlag() && !CU::isSameTile(*currCtu, *nextCtu)) -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *nextCtu)) -#endif ) { clipBottom = true; @@ -169,9 +156,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs const CodingUnit *prevCtu = cs.getCU(prevCtuPos, CHANNEL_TYPE_LUMA); if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *prevCtu)) || (!pps->getLoopFilterAcrossTilesEnabledFlag() && !CU::isSameTile(*currCtu, *prevCtu)) -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *prevCtu)) -#endif ) { clipLeft = true; @@ -185,9 +170,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs const CodingUnit *nextCtu = cs.getCU(nextCtuPos, CHANNEL_TYPE_LUMA); if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *nextCtu)) || (!pps->getLoopFilterAcrossTilesEnabledFlag() && !CU::isSameTile(*currCtu, *nextCtu)) -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *nextCtu)) -#endif ) { clipRight = true; @@ -313,7 +296,6 @@ const int AdaptiveLoopFilter::m_classToFilterMapping[NUM_FIXED_FILTER_SETS][MAX_ { 16, 31, 32, 15, 60, 30, 4, 17, 19, 25, 22, 20, 4, 53, 19, 21, 22, 46, 25, 55, 26, 48, 63, 58, 55 }, }; -#if JVET_Q0795_CCALF void AdaptiveLoopFilter::applyCcAlfFilter(CodingStructure &cs, ComponentID compID, const PelBuf &dstBuf, const PelUnitBuf &recYuvExt, uint8_t *filterControl, const short filterSet[MAX_NUM_CC_ALF_FILTERS][MAX_NUM_CC_ALF_CHROMA_COEFF], @@ -413,7 +395,6 @@ void AdaptiveLoopFilter::applyCcAlfFilter(CodingStructure &cs, ComponentID compI } } } -#endif void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) { @@ -463,9 +444,7 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) cs.slice = cu->slice; reconstructCoeffAPSs(cs, true, cu->slice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) || cu->slice->getTileGroupAlfEnabledFlag(COMPONENT_Cr), false); alfCtuFilterIndex = cu->slice->getPic()->getAlfCtbFilterIndex(); -#if JVET_Q0795_CCALF m_ccAlfFilterParam = cu->slice->m_ccAlfFilterParam; -#endif } lastSliceIdx = cu->slice->getSliceID(); @@ -475,12 +454,10 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { ctuEnableFlag |= m_ctuEnableFlag[compIdx][ctuIdx] > 0; -#if JVET_Q0795_CCALF if (cu->slice->m_ccAlfFilterParam.ccAlfFilterEnabled[compIdx - 1]) { ctuEnableFlag |= m_ccAlfFilterControl[compIdx - 1][ctuIdx] > 0; } -#endif } int rasterSliceAlfPad = 0; if( ctuEnableFlag && isCrossedByVirtualBoundaries( cs, xPos, yPos, width, height, clipTop, clipBottom, clipLeft, clipRight, numHorVirBndry, numVerVirBndry, horVirBndryPos, verVirBndryPos, rasterSliceAlfPad ) ) @@ -556,7 +533,6 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) , m_alfVBChmaCTUHeight , m_alfVBChmaPos ); } -#if JVET_Q0795_CCALF if (cu->slice->m_ccAlfFilterParam.ccAlfFilterEnabled[compIdx - 1]) { const int filterIdx = m_ccAlfFilterControl[compIdx - 1][ctuIdx]; @@ -572,7 +548,6 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) m_alfVBLumaCTUHeight, m_alfVBLumaPos); } } -#endif } xStart = xEnd; @@ -621,7 +596,6 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos); } -#if JVET_Q0795_CCALF if (cu->slice->m_ccAlfFilterParam.ccAlfFilterEnabled[compIdx - 1]) { const int filterIdx = m_ccAlfFilterControl[compIdx - 1][ctuIdx]; @@ -637,7 +611,6 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) m_alfVBLumaCTUHeight, m_alfVBLumaPos); } } -#endif } } ctuIdx++; @@ -701,11 +674,7 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfParam& alfParam, ChannelType chann for( int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx ) { m_chromaCoeffFinal[altIdx][coeffIdx] = coeff[coeffIdx]; -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG int clipIdx = alfParam.nonLinearFlag[channel] ? clipp[coeffIdx] : 0; -#else - int clipIdx = alfParam.nonLinearFlag[channel][altIdx] ? clipp[coeffIdx] : 0; -#endif m_chromaClippFinal[altIdx][coeffIdx] = isRdo ? clipIdx : m_alfClippingValues[channel][clipIdx]; } m_chromaCoeffFinal[altIdx][numCoeffMinus1] = factor; @@ -725,11 +694,7 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfParam& alfParam, ChannelType chann m_clippFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = isRdo ? 0 : m_alfClippingValues[channel][0]; for( int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx ) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG int clipIdx = alfParam.nonLinearFlag[channel] ? clipp[filterIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] : 0; -#else - int clipIdx = alfParam.nonLinearFlag[channel][altIdx] ? clipp[filterIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] : 0; -#endif CHECK(!(clipIdx >= 0 && clipIdx < MaxAlfNumClippingValues), "Bad clip idx in ALF"); m_clippFinal[classIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] = isRdo ? clipIdx : m_alfClippingValues[channel][clipIdx]; } @@ -754,10 +719,8 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const m_numCTUsInWidth = ( m_picWidth / m_maxCUWidth ) + ( ( m_picWidth % m_maxCUWidth ) ? 1 : 0 ); m_numCTUsInHeight = ( m_picHeight / m_maxCUHeight ) + ( ( m_picHeight % m_maxCUHeight ) ? 1 : 0 ); m_numCTUsInPic = m_numCTUsInHeight * m_numCTUsInWidth; -#if JVET_Q0795_CCALF m_filterShapesCcAlf[0].push_back(AlfFilterShape(size_CC_ALF)); m_filterShapesCcAlf[1].push_back(AlfFilterShape(size_CC_ALF)); -#endif m_filterShapes[CHANNEL_TYPE_LUMA].push_back( AlfFilterShape( 7 ) ); m_filterShapes[CHANNEL_TYPE_CHROMA].push_back( AlfFilterShape( 5 ) ); m_alfVBLumaPos = m_maxCUHeight - ALF_VB_POS_ABOVE_CTUROW_LUMA; @@ -767,34 +730,19 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const m_alfVBChmaCTUHeight = (m_maxCUHeight >> ((m_chromaFormat == CHROMA_420) ? 1 : 0)); static_assert( AlfNumClippingValues[CHANNEL_TYPE_LUMA] > 0, "AlfNumClippingValues[CHANNEL_TYPE_LUMA] must be at least one" ); -#if JVET_Q0495_NLALF_CLIP_CLEANUP m_alfClippingValues[CHANNEL_TYPE_LUMA][0] = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA]; int shiftLuma = m_inputBitDepth[CHANNEL_TYPE_LUMA] - 8; for (int i = 1; i < AlfNumClippingValues[CHANNEL_TYPE_LUMA]; ++i) { m_alfClippingValues[CHANNEL_TYPE_LUMA][i] = 1 << (7 - 2 * i + shiftLuma); } -#else - for( int i = 0; i < AlfNumClippingValues[CHANNEL_TYPE_LUMA]; ++i ) - { - m_alfClippingValues[CHANNEL_TYPE_LUMA][i] = (Pel)std::round( std::pow(2., double(m_inputBitDepth[CHANNEL_TYPE_LUMA] - 2.35*i)) ); - } -#endif static_assert( AlfNumClippingValues[CHANNEL_TYPE_CHROMA] > 0, "AlfNumClippingValues[CHANNEL_TYPE_CHROMA] must be at least one" ); -#if JVET_Q0495_NLALF_CLIP_CLEANUP m_alfClippingValues[CHANNEL_TYPE_CHROMA][0] = 1 << m_inputBitDepth[CHANNEL_TYPE_CHROMA]; int shiftChroma = m_inputBitDepth[CHANNEL_TYPE_CHROMA] - 8; for (int i = 1; i < AlfNumClippingValues[CHANNEL_TYPE_CHROMA]; ++i) { m_alfClippingValues[CHANNEL_TYPE_CHROMA][i] = 1 << (7 - 2 * i + shiftChroma); } -#else - m_alfClippingValues[CHANNEL_TYPE_CHROMA][0] = 1 << m_inputBitDepth[CHANNEL_TYPE_CHROMA]; - for( int i = 1; i < AlfNumClippingValues[CHANNEL_TYPE_CHROMA]; ++i ) - { - m_alfClippingValues[CHANNEL_TYPE_CHROMA][i] = (Pel)std::round( std::pow(2., double(m_inputBitDepth[CHANNEL_TYPE_CHROMA] - 2.35*i)) ); - } -#endif if (m_created) { return; @@ -837,10 +785,8 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const } m_created = true; -#if JVET_Q0795_CCALF m_ccAlfFilterControl[0] = new uint8_t[m_numCTUsInPic]; m_ccAlfFilterControl[1] = new uint8_t[m_numCTUsInPic]; -#endif } void AdaptiveLoopFilter::destroy() @@ -863,7 +809,6 @@ void AdaptiveLoopFilter::destroy() m_filterShapes[CHANNEL_TYPE_CHROMA].clear(); m_created = false; -#if JVET_Q0795_CCALF m_filterShapesCcAlf[0].clear(); m_filterShapesCcAlf[1].clear(); if ( m_ccAlfFilterControl[0] ) @@ -877,7 +822,6 @@ void AdaptiveLoopFilter::destroy() delete [] m_ccAlfFilterControl[1]; m_ccAlfFilterControl[1] = nullptr; } -#endif } void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk ) @@ -1275,10 +1219,8 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf pImg3 = (yVb <= vbPos + 1) ? pImg1 : pImg3; pImg5 = (yVb <= vbPos + 2) ? pImg3 : pImg5; } -#if JVET_Q0150 bool isNearVBabove = yVb < vbPos && (yVb >= vbPos - 1); bool isNearVBbelow = yVb >= vbPos && (yVb <= vbPos); -#endif for( int jj = 0; jj < clsSizeX; jj++ ) { @@ -1314,7 +1256,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf sum += filterCoeff[4] * ( clipALF(filterClipp[4], curr, pImg0[+2], pImg0[-2]) ); sum += filterCoeff[5] * ( clipALF(filterClipp[5], curr, pImg0[+1], pImg0[-1]) ); } -#if JVET_Q0150 if (!(isNearVBabove || isNearVBbelow)) { sum = (sum + offset) >> shift; @@ -1323,9 +1264,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf { sum = (sum + offset) >> (shift + 3); } -#else - sum = ( sum + offset ) >> shift; -#endif sum += curr; pRec1[jj] = ClipPel( sum, clpRng ); @@ -1353,7 +1291,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf } } -#if JVET_Q0795_CCALF template<AlfFilterType filtTypeCcAlf> void AdaptiveLoopFilter::filterBlkCcAlf(const PelBuf &dstBuf, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blkSrc, const ComponentID compId, const int16_t *filterCoeff, @@ -1444,4 +1381,3 @@ void AdaptiveLoopFilter::filterBlkCcAlf(const PelBuf &dstBuf, const CPelUnitBuf lumaPtr += lumaStride * clsSizeY << getComponentScaleY(compId, nChromaFormat); } } -#endif diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.h b/source/Lib/CommonLib/AdaptiveLoopFilter.h index 39d1731146ded03a37db884b96724846ba77b4ac..74c9bdbd022a4f0168fb3411ae45b627450f5d34 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.h +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.h @@ -91,12 +91,10 @@ public: const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, const int shift, const int vbCTUHeight, int vbPos); void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk ); -#if JVET_Q0795_CCALF template<AlfFilterType filtTypeCcAlf> static void filterBlkCcAlf(const PelBuf &dstBuf, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blkSrc, const ComponentID compId, const int16_t *filterCoeff, const ClpRngs &clpRngs, CodingStructure &cs, int vbCTUHeight, int vbPos); -#endif template<AlfFilterType filtType> static void filterBlk(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, @@ -107,7 +105,6 @@ public: const Area &blkDst, const Area &blk, const int shift, const int vbCTUHeight, int vbPos); -#if JVET_Q0795_CCALF void (*m_filterCcAlf)(const PelBuf &dstBuf, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blkSrc, const ComponentID compId, const int16_t *filterCoeff, const ClpRngs &clpRngs, CodingStructure &cs, int vbCTUHeight, int vbPos); @@ -117,7 +114,6 @@ public: const int selectedFilterIdx); CcAlfFilterParam &getCcAlfFilterParam() { return m_ccAlfFilterParam; } uint8_t* getCcAlfControlIdc(const ComponentID compID) { return m_ccAlfFilterControl[compID-1]; } -#endif void (*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight, @@ -135,11 +131,9 @@ public: protected: bool isCrossedByVirtualBoundaries( const CodingStructure& cs, const int xPos, const int yPos, const int width, const int height, bool& clipTop, bool& clipBottom, bool& clipLeft, bool& clipRight, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], int& rasterSliceAlfPad ); -#if JVET_Q0795_CCALF static constexpr int m_scaleBits = 7; // 8-bits CcAlfFilterParam m_ccAlfFilterParam; uint8_t* m_ccAlfFilterControl[2]; -#endif static const int m_classToFilterMapping[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES]; static const int m_fixedFilterSetCoeff[ALF_FIXED_FILTER_NUM][MAX_NUM_ALF_LUMA_COEFF]; short m_fixedFilterSetCoeffDec[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; @@ -150,9 +144,7 @@ protected: short m_chromaCoeffFinal[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF]; AlfParam* m_alfParamChroma; Pel m_alfClippingValues[MAX_NUM_CHANNEL_TYPE][MaxAlfNumClippingValues]; -#if JVET_Q0795_CCALF std::vector<AlfFilterShape> m_filterShapesCcAlf[2]; -#endif std::vector<AlfFilterShape> m_filterShapes[MAX_NUM_CHANNEL_TYPE]; AlfClassifier** m_classifier; short m_coeffFinal[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; diff --git a/source/Lib/CommonLib/AlfParameters.h b/source/Lib/CommonLib/AlfParameters.h index 45fa9b275ddc919a153392eff223b38aa0d7c6d4..989952d81b69e9122709ab8e933846ea19f63ca1 100644 --- a/source/Lib/CommonLib/AlfParameters.h +++ b/source/Lib/CommonLib/AlfParameters.h @@ -48,16 +48,12 @@ enum AlfFilterType { ALF_FILTER_5, ALF_FILTER_7, -#if JVET_Q0795_CCALF CC_ALF, -#endif ALF_NUM_OF_FILTER_TYPES }; -#if JVET_Q0795_CCALF static const int size_CC_ALF = -1; -#endif struct AlfFilterShape { @@ -105,7 +101,6 @@ struct AlfFilterShape filterType = ALF_FILTER_7; } -#if JVET_Q0795_CCALF else if (size == size_CC_ALF) { size = 4; @@ -114,7 +109,6 @@ struct AlfFilterShape filterSize = 8; filterType = CC_ALF; } -#endif else { filterType = ALF_NUM_OF_FILTER_TYPES; @@ -133,11 +127,7 @@ struct AlfFilterShape struct AlfParam { bool enabledFlag[MAX_NUM_COMPONENT]; // alf_slice_enable_flag, alf_chroma_idc -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG bool nonLinearFlag[MAX_NUM_CHANNEL_TYPE]; // alf_[luma/chroma]_clip_flag -#else - bool nonLinearFlag[MAX_NUM_CHANNEL_TYPE][MAX_NUM_ALF_ALTERNATIVES_CHROMA]; // alf_[luma/chroma]_clip_flag -#endif short lumaCoeff[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; // alf_coeff_luma_delta[i][j] short lumaClipp[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; // alf_clipp_luma_[i][j] int numAlternativesChroma; // alf_chroma_num_alts_minus_one + 1 @@ -249,7 +239,6 @@ struct AlfParam } }; -#if JVET_Q0795_CCALF struct CcAlfFilterParam { bool ccAlfFilterEnabled[2]; @@ -285,7 +274,6 @@ struct CcAlfFilterParam return *this; } }; -#endif //! \} #endif // end of #ifndef __ALFPARAMETERS__ diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 7b59a40e88aaed51824cbecb6fa4f7aae3a9e1b4..aaa870866ce7bd16d721860eb9d0ec66257a3fa7 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -553,7 +553,6 @@ void AreaBuf<Pel>::copyClip( const AreaBuf<const Pel> &src, const ClpRng& clpRng } } -#if JVET_Q0806 template<> void AreaBuf<Pel>::roundToOutputBitdepth( const AreaBuf<const Pel> &src, const ClpRng& clpRng ) { @@ -583,7 +582,6 @@ void AreaBuf<Pel>::roundToOutputBitdepth( const AreaBuf<const Pel> &src, const C #undef RND_INC } } -#endif template<> @@ -811,11 +809,7 @@ const CPelUnitBuf PelStorage::getBuf( const UnitArea &unit ) const } template<> -#if JVET_Q0820_ACT void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forward, const ClpRng& clpRng) -#else -void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forward) -#endif { const Pel* pOrg0 = bufs[COMPONENT_Y].buf; const Pel* pOrg1 = bufs[COMPONENT_Cb].buf; @@ -829,9 +823,7 @@ void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forwa int width = bufs[COMPONENT_Y].width; int height = bufs[COMPONENT_Y].height; -#if JVET_Q0820_ACT int maxAbsclipBD = (1 << (clpRng.bd + 1)) - 1; -#endif int r, g, b; int y0, cg, co; @@ -849,21 +841,12 @@ void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forwa g = pOrg0[x]; b = pOrg1[x]; -#if JVET_Q0820_ACT co = r - b; int t = b + (co >> 1); cg = g - t; pDst0[x] = t + (cg >> 1); pDst1[x] = cg; pDst2[x] = co; -#else - pDst0[x] = (g << 1) + r + b; - pDst1[x] = (g << 1) - r - b; - pDst2[x] = ((r - b) << 1); - pDst0[x] = (pDst0[x] + 2) >> 2; - pDst1[x] = (pDst1[x] + 2) >> 2; - pDst2[x] = (pDst2[x] + 2) >> 2; -#endif } pOrg0 += strideOrg; pOrg1 += strideOrg; @@ -883,7 +866,6 @@ void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forwa cg = pOrg1[x]; co = pOrg2[x]; -#if JVET_Q0820_ACT y0 = Clip3((-maxAbsclipBD - 1), maxAbsclipBD, y0); cg = Clip3((-maxAbsclipBD - 1), maxAbsclipBD, cg); co = Clip3((-maxAbsclipBD - 1), maxAbsclipBD, co); @@ -892,11 +874,6 @@ void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forwa pDst0[x] = cg + t; pDst1[x] = t - (co >> 1); pDst2[x] = co + pDst1[x]; -#else - pDst0[x] = (y0 + cg); - pDst1[x] = (y0 - cg - co); - pDst2[x] = (y0 - cg + co); -#endif } pOrg0 += strideOrg; diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index fa72565ba5dcf5e4ebeac4fd2bfaca4d7593accc..5719f521c8aec400bad6239d3207c1717a83ef8a 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -110,9 +110,7 @@ struct AreaBuf : public Size void memset ( const int val ); void copyFrom ( const AreaBuf<const T> &other ); -#if JVET_Q0806 void roundToOutputBitdepth(const AreaBuf<const T> &src, const ClpRng& clpRng); -#endif void reconstruct ( const AreaBuf<const T> &pred, const AreaBuf<const T> &resi, const ClpRng& clpRng); void copyClip ( const AreaBuf<const T> &src, const ClpRng& clpRng); @@ -767,9 +765,7 @@ struct UnitBuf void fill ( const T &val ); void copyFrom ( const UnitBuf<const T> &other, const bool lumaOnly = false, const bool chromaOnly = false ); -#if JVET_Q0806 void roundToOutputBitdepth(const UnitBuf<const T> &src, const ClpRngs& clpRngs); -#endif void reconstruct ( const UnitBuf<const T> &pred, const UnitBuf<const T> &resi, const ClpRngs& clpRngs ); void copyClip ( const UnitBuf<const T> &src, const ClpRngs& clpRngs, const bool lumaOnly = false, const bool chromaOnly = false ); void subtract ( const UnitBuf<const T> &other ); @@ -785,11 +781,7 @@ struct UnitBuf UnitBuf< T> subBuf (const UnitArea& subArea); const UnitBuf<const T> subBuf (const UnitArea& subArea) const; -#if JVET_Q0820_ACT void colorSpaceConvert(const UnitBuf<T> &other, const bool forward, const ClpRng& clpRng); -#else - void colorSpaceConvert(const UnitBuf<T> &other, const bool forward); -#endif }; typedef UnitBuf< Pel> PelUnitBuf; @@ -849,7 +841,6 @@ void UnitBuf<T>::copyClip(const UnitBuf<const T> &src, const ClpRngs &clpRngs, c } -#if JVET_Q0806 template<typename T> void UnitBuf<T>::roundToOutputBitdepth(const UnitBuf<const T> &src, const ClpRngs& clpRngs) { @@ -860,7 +851,6 @@ void UnitBuf<T>::roundToOutputBitdepth(const UnitBuf<const T> &src, const ClpRng bufs[i].roundToOutputBitdepth(src.bufs[i], clpRngs.comp[i]); } } -#endif template<typename T> void UnitBuf<T>::reconstruct(const UnitBuf<const T> &pred, const UnitBuf<const T> &resi, const ClpRngs& clpRngs) @@ -903,21 +893,13 @@ void UnitBuf<T>::addAvg(const UnitBuf<const T> &other1, const UnitBuf<const T> & } template<typename T> -#if JVET_Q0820_ACT void UnitBuf<T>::colorSpaceConvert(const UnitBuf<T> &other, const bool forward, const ClpRng& clpRng) -#else -void UnitBuf<T>::colorSpaceConvert(const UnitBuf<T> &other, const bool forward) -#endif { THROW("Type not supported"); } template<> -#if JVET_Q0820_ACT void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forward, const ClpRng& clpRng); -#else -void UnitBuf<Pel>::colorSpaceConvert(const UnitBuf<Pel> &other, const bool forward); -#endif template<typename T> void UnitBuf<T>::extendSingleBorderPel() diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h index 7c0ad7af7ecca5b2bb650e9045a49bdbe4acd933..1dac08f648ac76f7bbfd9af9ca7fe6582661cb59 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -112,19 +112,12 @@ enum CodingStatisticsType STATS__CABAC_BITS__BCW_IDX, STATS__CABAC_BITS__SBT_MODE, STATS__CABAC_BITS__MH_INTRA_FLAG, -#if !JVET_Q0806 - STATS__CABAC_BITS__TRIANGLE_FLAG, - STATS__CABAC_BITS__TRIANGLE_INDEX, -#else STATS__CABAC_BITS__GEO_FLAG, STATS__CABAC_BITS__GEO_INDEX, -#endif STATS__CABAC_BITS__MULTI_REF_LINE, STATS__CABAC_BITS__SYMMVD_FLAG, STATS__CABAC_BITS__BDPCM_MODE, -#if JVET_Q0795_CCALF STATS__CABAC_BITS__CROSS_COMPONENT_ALF_BLOCK_LEVEL_IDC, -#endif STATS__TOOL_TOTAL_FRAME,// This is a special case and is not included in the report. STATS__TOOL_AFF, STATS__TOOL_EMT, @@ -212,19 +205,12 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__BCW_IDX", "CABAC_BITS__SBT_MODE", "CABAC_BITS__MH_INTRA_FLAG", -#if !JVET_Q0806 - "CABAC_BITS__TRIANGLE_FLAG", - "CABAC_BITS__TRIANGLE_INDEX", -#else "CABAC_BITS__GEO_FLAG", "CABAC_BITS__GEO_INDEX", -#endif "CABAC_BITS__MULTI_REF_LINE", "CABAC_BITS__SYMMVD_FLAG", "CABAC_BITS__BDPCM_MODE", -#if JVET_Q0795_CCALF "CABAC_BITS__CROSS_COMPONENT_ALF_BLOCK_LEVEL_IDC", -#endif "TOOL_FRAME", "TOOL_AFFINE", "TOOL_EMT", diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index adbec8ed09fddb2f5ea4241cf9c9a2aae5312b49..b52500e14ee9c831202cbf1d42620030b5f5172f 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -900,9 +900,7 @@ void CodingStructure::reorderPrevPLT(PLTBuf& prevPLT, uint8_t curPLTSize[MAX_NUM uint8_t tempCurPLTsize[MAX_NUM_CHANNEL_TYPE]; uint8_t stuffPLTsize[MAX_NUM_COMPONENT]; -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE uint32_t maxPredPltSize = jointPLT ? MAXPLTPREDSIZE : MAXPLTPREDSIZE_DUALTREE; -#endif for (int i = compBegin; i < (compBegin + numComp); i++) { @@ -918,11 +916,7 @@ void CodingStructure::reorderPrevPLT(PLTBuf& prevPLT, uint8_t curPLTSize[MAX_NUM if (ch > 1) break; for (int i = 0; i < prevPLT.curPLTSize[comID]; i++) { -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE if (tempCurPLTsize[comID] + stuffPLTsize[ch] >= maxPredPltSize) -#else - if (tempCurPLTsize[comID] + stuffPLTsize[ch] >= MAXPLTPREDSIZE) -#endif break; if (!reuseflag[comID][i]) @@ -946,13 +940,10 @@ void CodingStructure::reorderPrevPLT(PLTBuf& prevPLT, uint8_t curPLTSize[MAX_NUM ComponentID comID = jointPLT ? (ComponentID)compBegin : ((i > 0) ? COMPONENT_Cb : COMPONENT_Y); prevPLT.curPLTSize[comID] = curPLTSize[comID] + stuffPLTsize[comID]; memcpy(prevPLT.curPLT[i], stuffedPLT[i], prevPLT.curPLTSize[comID] * sizeof(Pel)); -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE CHECK(prevPLT.curPLTSize[comID] > maxPredPltSize, " Maximum palette predictor size exceed limit"); -#endif } } -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU void CodingStructure::setPrevPLT(PLTBuf predictor) { for (int comp = 0; comp < MAX_NUM_CHANNEL_TYPE; comp++) @@ -975,7 +966,6 @@ void CodingStructure::storePrevPLT(PLTBuf& predictor) memcpy(predictor.curPLT[comp], prevPLT.curPLT[comp], MAXPLTPREDSIZE * sizeof(Pel)); } } -#endif void CodingStructure::rebindPicBufs() { @@ -1008,11 +998,7 @@ void CodingStructure::createCoeffs(const bool isPLTused) if (isPLTused) { -#if JVET_Q0438_MONOCHROME_BUGFIXES for (unsigned i = 0; i < (isChromaEnabled(area.chromaFormat) ? 2 : 1); i++) -#else - for (unsigned i = 0; i < numCh - 1; i++) -#endif { unsigned _area = area.blocks[i].area(); @@ -1569,11 +1555,7 @@ const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const C const CodingUnit* cu = getCU( pos, _chType ); // exists same slice and tile cu precedes curCu in encoding order // (thus, is either from parent CS in RD-search or its index is lower) -#if JVET_Q0151_Q0205_ENTRYPOINTS const bool wavefrontsEnabled = curCu.slice->getSPS()->getEntropyCodingSyncEnabledFlag(); -#else - const bool wavefrontsEnabled = curCu.slice->getPPS()->getEntropyCodingSyncEnabledFlag(); -#endif int ctuSizeBit = floorLog2(curCu.cs->sps->getMaxCUWidth()); int xNbY = pos.x << getChannelTypeScaleX( _chType, curCu.chromaFormat ); int xCurr = curCu.blocks[_chType].x << getChannelTypeScaleX( _chType, curCu.chromaFormat ); @@ -1591,11 +1573,7 @@ const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const C const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const Position curPos, const unsigned curSliceIdx, const unsigned curTileIdx, const ChannelType _chType ) const { const CodingUnit* cu = getCU( pos, _chType ); -#if JVET_Q0151_Q0205_ENTRYPOINTS const bool wavefrontsEnabled = this->slice->getSPS()->getEntropyCodingSyncEnabledFlag(); -#else - const bool wavefrontsEnabled = this->slice->getPPS()->getEntropyCodingSyncEnabledFlag(); -#endif int ctuSizeBit = floorLog2(this->sps->getMaxCUWidth()); int xNbY = pos.x << getChannelTypeScaleX( _chType, this->area.chromaFormat ); int xCurr = curPos.x << getChannelTypeScaleX( _chType, this->area.chromaFormat ); @@ -1608,11 +1586,7 @@ const PredictionUnit* CodingStructure::getPURestricted( const Position &pos, con const PredictionUnit* pu = getPU( pos, _chType ); // exists same slice and tile pu precedes curPu in encoding order // (thus, is either from parent CS in RD-search or its index is lower) -#if JVET_Q0151_Q0205_ENTRYPOINTS const bool wavefrontsEnabled = curPu.cu->slice->getSPS()->getEntropyCodingSyncEnabledFlag(); -#else - const bool wavefrontsEnabled = curPu.cu->slice->getPPS()->getEntropyCodingSyncEnabledFlag(); -#endif int ctuSizeBit = floorLog2(curPu.cs->sps->getMaxCUWidth()); int xNbY = pos.x << getChannelTypeScaleX( _chType, curPu.chromaFormat ); int xCurr = curPu.blocks[_chType].x << getChannelTypeScaleX( _chType, curPu.chromaFormat ); @@ -1632,11 +1606,7 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons const TransformUnit* tu = getTU( pos, _chType ); // exists same slice and tile tu precedes curTu in encoding order // (thus, is either from parent CS in RD-search or its index is lower) -#if JVET_Q0151_Q0205_ENTRYPOINTS const bool wavefrontsEnabled = curTu.cu->slice->getSPS()->getEntropyCodingSyncEnabledFlag(); -#else - const bool wavefrontsEnabled = curTu.cu->slice->getPPS()->getEntropyCodingSyncEnabledFlag(); -#endif int ctuSizeBit = floorLog2(curTu.cs->sps->getMaxCUWidth()); int xNbY = pos.x << getChannelTypeScaleX( _chType, curTu.chromaFormat ); int xCurr = curTu.blocks[_chType].x << getChannelTypeScaleX( _chType, curTu.chromaFormat ); diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index 1b2f9796635947b3e29fd5928add8ecb14146ce5..57cda86111b280b86e5551145fc9f743bad31ffe 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -203,10 +203,8 @@ public: PLTBuf prevPLT; void resetPrevPLT(PLTBuf& prevPLT); void reorderPrevPLT(PLTBuf& prevPLT, uint8_t curPLTSize[MAX_NUM_CHANNEL_TYPE], Pel curPLT[MAX_NUM_COMPONENT][MAXPLTSIZE], bool reuseflag[MAX_NUM_CHANNEL_TYPE][MAXPLTPREDSIZE], uint32_t compBegin, uint32_t numComp, bool jointPLT); -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU void setPrevPLT(PLTBuf predictor); void storePrevPLT(PLTBuf& predictor); -#endif private: // needed for TU encoding diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 834705078ac5f97fcaa95219e6b8a6faabcca3d5..2fa1f4a5e5cef1c0495d936af19f835e8037dfd1 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -187,12 +187,10 @@ static const int MAX_NUM_ALF_CHROMA_COEFF = 7; static const int MAX_ALF_FILTER_LENGTH = 7; static const int MAX_NUM_ALF_COEFF = MAX_ALF_FILTER_LENGTH * MAX_ALF_FILTER_LENGTH / 2 + 1; static const int MAX_ALF_PADDING_SIZE = 4; -#if JVET_Q0795_CCALF #define MAX_NUM_CC_ALF_FILTERS 4 static constexpr int MAX_NUM_CC_ALF_CHROMA_COEFF = 8; static constexpr int CCALF_DYNAMIC_RANGE = 6; static constexpr int CCALF_BITS_PER_COEFF_LEVEL = 3; -#endif static const int ALF_FIXED_FILTER_NUM = 64; static const int ALF_CTB_MAX_NUM_APS = 8; @@ -383,24 +381,10 @@ static const int DMVR_NUM_ITERATION = 2; //QTBT high level parameters //for I slice luma CTB configuration para. static const int MAX_BT_DEPTH = 4; ///< <=7 -#if !JVET_Q0330_BLOCK_PARTITION -static const int MAX_BT_SIZE = 32; ///< [1<<MIN_QT_SIZE, 1<<CTU_LOG2] - -static const int MAX_TT_SIZE = 32; ///< [1<<MIN_QT_SIZE, 1<<CTU_LOG2] -static const int MAX_TT_SIZE_C = 32; ///< [1<<MIN_QT_SIZE, 1<<CTU_LOG2] -#endif //for P/B slice CTU config. para. static const int MAX_BT_DEPTH_INTER = 4; ///< <=7 -#if !JVET_Q0330_BLOCK_PARTITION -static const int MAX_BT_SIZE_INTER = 128; ///< for initialization, [1<<MIN_BT_SIZE_INTER, 1<<CTU_LOG2] -#endif //for I slice chroma CTB configuration para. (in luma samples) static const int MAX_BT_DEPTH_C = 0; ///< <=7 -#if !JVET_Q0330_BLOCK_PARTITION -static const int MAX_BT_SIZE_C = 64; ///< [1<<MIN_QT_SIZE_C, 1<<CTU_LOG2], in luma samples - -static const int MAX_TT_SIZE_INTER = 64; ///< for initialization, [1<<MIN_CU_LOG2, 64] -#endif static const int MIN_DUALTREE_CHROMA_WIDTH = 4; static const int MIN_DUALTREE_CHROMA_SIZE = 16; static const SplitSeries SPLIT_BITS = 5; @@ -434,13 +418,6 @@ static const int MAX_LADF_INTERVALS = 5; /// max n static const int NTAPS_BILINEAR = 2; ///< Number of taps for bilinear filter static const int ATMVP_SUB_BLOCK_SIZE = 3; ///< sub-block size for ATMVP -#if !JVET_Q0806 -static const int TRIANGLE_MAX_NUM_UNI_CANDS = 6; -static const int TRIANGLE_MAX_NUM_CANDS_MEM = 7; -static const int TRIANGLE_MAX_NUM_CANDS = TRIANGLE_MAX_NUM_UNI_CANDS * (TRIANGLE_MAX_NUM_UNI_CANDS - 1) * 2; -static const int TRIANGLE_MAX_NUM_SATD_CANDS = 3; -static const int TRIANGLE_MIN_SIZE = 8 * 8; -#else static const int GEO_MAX_NUM_UNI_CANDS = 6; static const int GEO_MAX_NUM_CANDS = GEO_MAX_NUM_UNI_CANDS * (GEO_MAX_NUM_UNI_CANDS - 1); static const int GEO_MIN_CU_LOG2 = 3; @@ -456,7 +433,6 @@ static const int GEO_WEIGHT_MASK_SIZE = 3 * (GEO_MAX_CU_SIZE >> 3) * 2 + GEO_MAX static const int GEO_MV_MASK_SIZE = GEO_WEIGHT_MASK_SIZE >> 2; static const int GEO_MAX_TRY_WEIGHTED_SAD = 60; static const int GEO_MAX_TRY_WEIGHTED_SATD = 8; -#endif static const int SBT_MAX_SIZE = 64; ///< maximum CU size for using SBT static const int SBT_NUM_SL = 10; ///< maximum number of historical PU decision saved for a CU @@ -500,10 +476,8 @@ static const int NUM_TRELLIS_STATE = 3; static const double ENC_CHROMA_WEIGHTING = 0.8; static const int MAXPLTPREDSIZE = 63; static const int MAXPLTSIZE = 31; -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE static const int MAXPLTPREDSIZE_DUALTREE = 31; static const int MAXPLTSIZE_DUALTREE = 15; -#endif static const double PLT_CHROMA_WEIGHTING = 0.8; static const int PLT_ENCBITDEPTH = 8; static const int PLT_FAST_RATIO = 100; @@ -514,12 +488,7 @@ static const int ENC_PPS_ID_RPR = 3; static const int SCALE_RATIO_BITS = 14; static const int MAX_SCALING_RATIO = 2; // max downsampling ratio for RPR static const std::pair<int, int> SCALE_1X = std::pair<int, int>( 1 << SCALE_RATIO_BITS, 1 << SCALE_RATIO_BITS ); // scale ratio 1x -#if JVET_Q0820_ACT static const int DELTA_QP_ACT[4] = { -5, 1, 3, 1 }; -#else -static const int DELTA_QP_FOR_Y_Cg = -5; -static const int DELTA_QP_FOR_Co = -3; -#endif // ==================================================================================================================== // Macro functions @@ -739,10 +708,8 @@ static inline int ceilLog2(uint32_t x) #define PARL_PARAM0(DEF) #endif -#if JVET_Q0795_CCALF static const uint32_t CCALF_CANDS_COEFF_NR = 8; static const int CCALF_SMALL_TAB[CCALF_CANDS_COEFF_NR] = { 0, 1, 2, 4, 8, 16, 32, 64 }; -#endif //! \} diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index 6913c4d54f3075d930bc7a96a4922abc5a106e12..5eccb4993fc04cfe657779f3941dd312fb9a3915 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -320,19 +320,11 @@ unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu) void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) { CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" ); -#if !JVET_Q0806 - pu.regularMergeFlag = !(pu.ciipFlag || pu.cu->triangle); -#else pu.regularMergeFlag = !(pu.ciipFlag || pu.cu->geoFlag); -#endif pu.mergeFlag = true; pu.mmvdMergeFlag = false; pu.interDir = interDirNeighbours[candIdx]; -#if !JVET_Q0806 - pu.cu->imv = (!pu.cu->triangle && useAltHpelIf[candIdx]) ? IMV_HPEL : 0; -#else pu.cu->imv = (!pu.cu->geoFlag && useAltHpelIf[candIdx]) ? IMV_HPEL : 0; -#endif pu.mergeIdx = candIdx; pu.mergeType = mrgTypeNeighbours[candIdx]; pu.mv [REF_PIC_LIST_0] = mvFieldNeighbours[(candIdx << 1) + 0].mv; diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index fa51ac28709c5bbf965a9024ae9c4fe63bd2dad1..15ced18b47d8f24d46cde24b4bd2287983684108 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -416,9 +416,7 @@ public: violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; lfnstLastScanPos = false; violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND mtsLastScanPos = false; -#endif } CUCtx(int _qp) : isDQPCoded(false), isChromaQpAdjCoded(false), qgStart(false), @@ -428,9 +426,7 @@ public: violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; lfnstLastScanPos = false; violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND mtsLastScanPos = false; -#endif } ~CUCtx() {} public: @@ -441,9 +437,7 @@ public: int8_t qp; // used as a previous(last) QP and for QP prediction bool violatesLfnstConstrained[MAX_NUM_CHANNEL_TYPE]; bool violatesMtsCoeffConstraint; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND bool mtsLastScanPos; -#endif }; class MergeCtx diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 35ecc410b4fbba97d7b9156479ac8126e5e4a654..283e83855c65fa9dc53f49b39c269b1b2a5d5794 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -185,7 +185,6 @@ CtxSet ContextSetCfg::addCtxSet( std::initializer_list<std::initializer_list<uin std::vector<std::vector<uint8_t>> ContextSetCfg::sm_InitTables(NUMBER_OF_SLICE_TYPES + 1); // clang-format off -#if CABAC_RETRAIN const CtxSet ContextSetCfg::SplitFlag = ContextSetCfg::addCtxSet ({ { 18, 27, 15, 18, 28, 45, 19, 7, 23, }, @@ -420,17 +419,10 @@ const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::BDPCMMode = ContextSetCfg::addCtxSet ({ -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 { 19, 21, 0, 28, }, { 40, 36, 0, 28, }, { 19, 35, 1, 35, }, { 4, 4, 1, 0, }, -#else - { 19, 28, }, - { 40, 36, }, - { 19, 35, }, - { 4, 4, }, -#endif }); const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet @@ -832,7 +824,6 @@ const CtxSet ContextSetCfg::AlfUseTemporalFilt = ContextSetCfg::addCtxSet { 0, }, }); -#if JVET_Q0795_CCALF const CtxSet ContextSetCfg::CcAlfFilterControlFlag = ContextSetCfg::addCtxSet ({ { 25, 35, 37, 25, 28, 37, }, @@ -840,7 +831,6 @@ const CtxSet ContextSetCfg::CcAlfFilterControlFlag = ContextSetCfg::addCtxSet { 18, 29, 38, 18, 29, 38, }, { 4, 4, 4, 4, 2, 4, }, }); -#endif const CtxSet ContextSetCfg::CiipFlag = ContextSetCfg::addCtxSet ({ @@ -913,736 +903,6 @@ const CtxSet ContextSetCfg::TsResidualSign = ContextSetCfg::addCtxSet { 20, 17, 46, 28, 25, 46, }, { 1, 4, 4, 8, 8, 8, }, }); -#else -const CtxSet ContextSetCfg::SplitFlag = ContextSetCfg::addCtxSet -({ - { 18, 27, 15, 18, 28, 30, 19, 7, 23, }, - { 11, 35, 53, 12, 6, 30, 13, 15, 31, }, - { 19, 28, 38, 27, 29, 38, 28, 38, 31, }, - { 12, 13, 8, 8, 13, 12, 5, 9, 9, }, -}); - -const CtxSet ContextSetCfg::SplitQtFlag = ContextSetCfg::addCtxSet -({ - { 26, 36, 38, 33, 34, 21, }, - { 20, 14, 23, 18, 19, 6, }, - { 27, 6, 15, 25, 19, 22, }, - { 0, 8, 8, 12, 12, 9, }, -}); - -const CtxSet ContextSetCfg::SplitHvFlag = ContextSetCfg::addCtxSet -({ - { 43, 42, 37, 35, 44, }, - { 36, 35, 37, 27, 52, }, - { 43, 42, 29, 27, 44, }, - { 9, 8, 9, 8, 8, }, -}); - -const CtxSet ContextSetCfg::Split12Flag = ContextSetCfg::addCtxSet -({ - { 28, 29, 28, 29, }, - { 43, 37, 21, 22, }, - { 51, 45, 36, 45, }, - { 12, 13, 12, 13, }, -}); - -const CtxSet ContextSetCfg::ModeConsFlag = ContextSetCfg::addCtxSet -({ - { 25, 20, }, - { 25, 12, }, - { CNU, CNU, }, - { 1, 0, }, -}); - -const CtxSet ContextSetCfg::SkipFlag = ContextSetCfg::addCtxSet -({ - { 57, 60, 53, }, - { 57, 59, 45, }, - { 0, 26, 28, }, - { 5, 4, 8, }, -}); - -const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet -({ - { 6, }, - { 6, }, - { 26, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::RegularMergeFlag = ContextSetCfg::addCtxSet -({ - { 46, 15, }, - { 38, 7, }, - { CNU, CNU, }, - { 5, 5, }, -}); - -const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet -({ - { 33, }, - { 35, }, - { 34, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet -({ - { 40, }, - { 26, }, - { CNU, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::MmvdMergeIdx = ContextSetCfg::addCtxSet -({ - { 43, }, - { 43, }, - { CNU, }, - { 10, }, -}); - -const CtxSet ContextSetCfg::MmvdStepMvpIdx = ContextSetCfg::addCtxSet -({ - { 51, }, - { 60, }, - { CNU, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::PredMode = ContextSetCfg::addCtxSet -({ - { 40, 35, }, - { 40, 35, }, - { CNU, CNU, }, - { 5, 1, }, -}); - -const CtxSet ContextSetCfg::MultiRefLineIdx = ContextSetCfg::addCtxSet -({ - { 25, 58, }, - { 25, 50, }, - { 25, 59, }, - { 6, 8, }, -}); - -const CtxSet ContextSetCfg::IntraLumaMpmFlag = ContextSetCfg::addCtxSet -({ - { 29, }, - { 36, }, - { 45, }, - { 6, }, -}); - -const CtxSet ContextSetCfg::IntraLumaPlanarFlag = ContextSetCfg::addCtxSet -({ - { 13, 6, }, - { 12, 20, }, - { 13, 28, }, - { 1, 5, }, -}); - -const CtxSet ContextSetCfg::CclmModeFlag = ContextSetCfg::addCtxSet -({ - { 26, }, - { 34, }, - { 59, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::CclmModeIdx = ContextSetCfg::addCtxSet -({ - { 27, }, - { 27, }, - { 27, }, - { 9, }, -}); - -const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet -({ - { 25, }, - { 18, }, - { 34, }, - { 5, }, -}); - -const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet -({ - { 56, 57, 50, 26, }, - { 41, 57, 58, 26, }, - { 33, 49, 42, 25, }, - { 9, 10, 9, 6, }, -}); - -const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet -({ - { CNU, CNU, }, - { CNU, CNU, }, - { CNU, CNU, }, - { DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet -({ - { 14, 6, 5, 4, 3, 40, }, - { 7, 6, 5, 4, 11, 40, }, - { CNU, CNU, CNU, CNU, CNU, CNU, }, - { 0, 0, 1, 4, 1, 0, }, -}); - -const CtxSet ContextSetCfg::RefPic = ContextSetCfg::addCtxSet -({ - { 20, 20, }, - { 27, 35, }, - { CNU, CNU, }, - { 0, 4, }, -}); - -const CtxSet ContextSetCfg::SubblockMergeFlag = ContextSetCfg::addCtxSet -({ - { 40, 51, 45, }, - { 48, 57, 44, }, - { CNU, CNU, CNU, }, - { 4, 4, 4, }, -}); - -const CtxSet ContextSetCfg::AffineFlag = ContextSetCfg::addCtxSet -({ - { 12, 13, 6, }, - { 12, 13, 6, }, - { CNU, CNU, CNU, }, - { 4, 0, 0, }, -}); - -const CtxSet ContextSetCfg::AffineType = ContextSetCfg::addCtxSet -({ - { 35, }, - { 35, }, - { CNU, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::AffMergeIdx = ContextSetCfg::addCtxSet -({ - { 4, }, - { 5, }, - { CNU, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::BcwIdx = ContextSetCfg::addCtxSet -({ - { 5, }, - { 4, }, - { CNU, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet -({ - { 51, 58, }, - { 44, 43, }, - { 14, 45, }, - { 9, 5, }, -}); - -const CtxSet ContextSetCfg::BDPCMMode = ContextSetCfg::addCtxSet -({ -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 - { 19, 28, 25, 51, }, - { 40, 36, 17, 28, }, - { 19, 35, 9, 44, }, - { 4, 4, 1, 1, }, -#else - { 19, 28, }, - { 40, 36, }, - { 19, 35, }, - { 4, 4, }, -#endif -}); - -const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet -({ - { 12, }, - { 5, }, - { 6, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::ACTFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, - }); - -const CtxSet ContextSetCfg::QtCbf[] = -{ - ContextSetCfg::addCtxSet - ({ - { 15, 13, 5, 14, }, - { 23, 4, 20, 7, }, - { 7, 19, 5, 7, }, - { 5, 1, 8, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 25, CNU, }, - { 25, CNU, }, - { 4, CNU, }, - { 5, DWS, }, - }), - ContextSetCfg::addCtxSet - ({ - { 9, 44, CNU, }, - { 25, 29, CNU, }, - { 33, 28, CNU, }, - { 2, 1, DWS, }, - }) -}; - -const CtxSet ContextSetCfg::SigCoeffGroup[] = -{ - ContextSetCfg::addCtxSet - ({ - { 25, 45, }, - { 25, 30, }, - { 18, 31, }, - { 8, 5, }, - }), - ContextSetCfg::addCtxSet - ({ - { 25, 45, }, - { 25, 52, }, - { 25, 7, }, - { 5, 8, }, - }) -}; - -const CtxSet ContextSetCfg::SigFlag[] = -{ - ContextSetCfg::addCtxSet - ({ - { 17, 41, 49, 36, 1, 49, 50, 37, 48, 51, 58, 45, }, - { 17, 41, 42, 29, 25, 49, 43, 37, 33, 51, 51, 30, }, - { 25, 19, 28, 14, 25, 20, 29, 30, 19, 37, 30, 38, }, - { 12, 9, 9, 10, 9, 9, 9, 10, 8, 8, 8, 10, }, - }), - ContextSetCfg::addCtxSet - ({ - { 9, 49, 42, 21, 48, 59, 59, 53, }, - { 17, 19, 20, 29, 41, 59, 60, 38, }, - { 25, 27, 28, 37, 49, 53, 53, 46, }, - { 9, 9, 9, 13, 4, 5, 8, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 26, 45, 53, 46, 49, 54, 61, 39, 42, 39, 39, 39, }, - { 19, 38, 38, 46, 34, 54, 54, 39, 6, 39, 39, 39, }, - { 11, 38, 46, 54, 27, 39, 39, 39, 36, 39, 39, 39, }, - { 9, 13, 8, 8, 8, 8, 8, 5, 8, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 34, 45, 38, 31, 58, 39, 39, 39, }, - { 35, 45, 53, 54, 44, 39, 39, 39, }, - { 19, 46, 38, 39, 52, 39, 39, 39, }, - { 8, 12, 8, 8, 4, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 19, 54, 39, 39, 50, 39, 39, 39, 0, 39, 39, 39, }, - { 19, 39, 54, 39, 19, 39, 39, 39, 56, 39, 39, 39, }, - { 18, 39, 39, 39, 19, 39, 39, 39, 0, 39, 39, 39, }, - { 8, 8, 8, 8, 8, 0, 4, 4, 0, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 34, 38, 54, 39, 41, 39, 39, 39, }, - { 34, 38, 62, 39, 26, 39, 39, 39, }, - { 26, 39, 39, 39, 19, 39, 39, 39, }, - { 8, 8, 8, 8, 4, 0, 0, 0, }, - }) -}; - -const CtxSet ContextSetCfg::ParFlag[] = -{ - ContextSetCfg::addCtxSet - ({ - { 33, 40, 25, 41, 26, 42, 25, 33, 26, 34, 27, 25, 41, 42, 42, 35, 33, 27, 35, 42, 43, }, - { 18, 17, 33, 18, 34, 42, 25, 33, 26, 42, 27, 25, 34, 42, 42, 35, 26, 27, 42, 20, 20, }, - { 33, 25, 18, 26, 34, 27, 25, 26, 19, 42, 35, 33, 19, 27, 35, 35, 34, 42, 20, 43, 20, }, - { 8, 9, 12, 13, 13, 13, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 10, 13, 13, 13, 13, }, - }), - ContextSetCfg::addCtxSet - ({ - { 33, 25, 26, 19, 19, 27, 33, 42, 43, 35, 43, }, - { 25, 25, 26, 11, 19, 27, 33, 42, 50, 20, 43, }, - { 33, 25, 26, 42, 19, 27, 26, 50, 35, 20, 43, }, - { 9, 13, 12, 12, 13, 13, 13, 13, 13, 13, 13, }, - }) -}; - -const CtxSet ContextSetCfg::GtxFlag[] = -{ - ContextSetCfg::addCtxSet - ({ - { 25, 0, 0, 17, 25, 18, 0, 9, 25, 33, 19, 0, 25, 33, 26, 20, 25, 33, 34, 35, 29, }, - { 17, 0, 1, 17, 25, 18, 0, 9, 25, 33, 34, 9, 25, 18, 26, 20, 25, 18, 19, 27, 21, }, - { 25, 1, 40, 25, 33, 11, 17, 25, 25, 18, 4, 17, 33, 26, 19, 5, 33, 19, 20, 28, 22, }, - { 1, 5, 9, 9, 9, 6, 5, 9, 10, 10, 9, 9, 9, 9, 9, 9, 6, 8, 9, 9, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 25, 1, 40, 33, 26, 4, 25, 33, 27, 36, 37, }, - { 17, 9, 25, 10, 3, 4, 17, 33, 19, 28, 29, }, - { 48, 9, 25, 18, 26, 35, 25, 26, 35, 28, 37, }, - { 1, 5, 8, 8, 8, 6, 6, 9, 8, 8, 10, }, - }), - ContextSetCfg::addCtxSet - ({ - { 0, 0, 33, 34, 35, 36, 25, 34, 35, 28, 29, 40, 42, 43, 36, 30, 56, 43, 44, 45, 38, }, - { 0, 17, 26, 19, 20, 21, 25, 34, 20, 28, 29, 33, 27, 28, 29, 22, 34, 28, 44, 37, 38, }, - { 25, 25, 11, 27, 20, 21, 18, 12, 28, 21, 22, 34, 28, 29, 29, 30, 28, 29, 45, 30, 23, }, - { 9, 5, 10, 13, 13, 10, 9, 10, 13, 13, 13, 9, 10, 10, 10, 13, 8, 9, 9, 10, 13, }, - }), - ContextSetCfg::addCtxSet - ({ - { 0, 40, 42, 20, 21, 29, 57, 52, 53, 38, 46, }, - { 0, 25, 27, 20, 13, 6, 57, 52, 30, 38, 31, }, - { 40, 33, 27, 28, 21, 37, 51, 37, 53, 38, 46, }, - { 9, 9, 10, 12, 12, 10, 5, 9, 9, 9, 12, }, - }) -}; - -const CtxSet ContextSetCfg::LastX[] = -{ - ContextSetCfg::addCtxSet - ({ - { 14, 6, 5, 7, 14, 4, 7, 7, 6, 12, 29, 7, 6, 6, 20, 28, 7, 13, 13, 20, }, - { 6, 13, 12, 6, 6, 4, 14, 14, 5, 12, 29, 14, 13, 5, 36, 28, 14, 13, 20, 19, }, - { 13, 5, 4, 6, 14, 4, 6, 14, 21, 11, 14, 7, 14, 13, 11, 21, 37, 37, 21, 50, }, - { 8, 5, 4, 5, 4, 4, 5, 4, 1, 0, 4, 1, 0, 0, 0, 1, 1, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 11, 5, 3, }, - { 12, 4, 18, }, - { 12, 4, 3, }, - { 2, 1, 1, }, - }) -}; - -const CtxSet ContextSetCfg::LastY[] = -{ - ContextSetCfg::addCtxSet - ({ - { 13, 5, 5, 6, 6, 12, 14, 6, 5, 5, 14, 7, 5, 12, 21, 13, 7, 13, 12, 41, }, - { 5, 5, 12, 6, 6, 19, 6, 14, 5, 19, 29, 7, 13, 5, 36, 21, 7, 13, 5, 27, }, - { 13, 5, 4, 6, 6, 11, 14, 14, 5, 11, 14, 22, 14, 12, 3, 21, 37, 52, 28, 34, }, - { 8, 5, 8, 5, 5, 4, 5, 5, 4, 0, 5, 5, 1, 0, 0, 1, 4, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 11, 5, 19, }, - { 11, 4, 18, }, - { 12, 4, 3, }, - { 6, 2, 2, }, - }) -}; - -const CtxSet ContextSetCfg::MVPIdx = ContextSetCfg::addCtxSet -({ - { 34, }, - { 34, }, - { 42, }, - { 12, }, -}); - -const CtxSet ContextSetCfg::SmvdFlag = ContextSetCfg::addCtxSet -({ - { 50, }, - { 28, }, - { CNU, }, - { 5, }, -}); - -const CtxSet ContextSetCfg::SaoMergeFlag = ContextSetCfg::addCtxSet -({ - { 10, }, - { 60, }, - { 52, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::SaoTypeIdx = ContextSetCfg::addCtxSet -({ - { 10, }, - { 5, }, - { 5, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::LFNSTIdx = ContextSetCfg::addCtxSet -({ - { 52, 37, 33, }, - { 45, 45, 18, }, - { CNU, 52, 33, }, - { 9, 9, 5, }, -}); - -const CtxSet ContextSetCfg::PLTFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::RotationFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::RunTypeFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::IdxRunModel = ContextSetCfg::addCtxSet -({ - { CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, }, - { DWS, DWS, DWS, DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::CopyRunModel = ContextSetCfg::addCtxSet -({ - { CNU, CNU, CNU, }, - { CNU, CNU, CNU, }, - { CNU, CNU, CNU, }, - { DWS, DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet -({ - { CNU, CNU, }, - { CNU, CNU, }, - { CNU, CNU, }, - { DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet -({ - { CNU, CNU, }, - { CNU, CNU, }, - { CNU, CNU, }, - { DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::TransformSkipFlag = ContextSetCfg::addCtxSet -({ - { 25, 17, }, - { 25, 17, }, - { 25, 1, }, - { 1, 1, }, -}); - -const CtxSet ContextSetCfg::MTSIdx = ContextSetCfg::addCtxSet -({ - { 37, 25, 27, 0, }, - { 30, 40, 27, 0, }, - { 13, 0, 35, 0, }, - { 8, 0, 9, 0, }, -}); - -const CtxSet ContextSetCfg::ISPMode = ContextSetCfg::addCtxSet -({ - { 33, 43, }, - { 33, 36, }, - { 33, 43, }, - { 9, 2, }, -}); - -const CtxSet ContextSetCfg::SbtFlag = ContextSetCfg::addCtxSet -({ - { 49, 50, }, - { 49, 50, }, - { CNU, CNU, }, - { 1, 5, }, -}); - -const CtxSet ContextSetCfg::SbtQuadFlag = ContextSetCfg::addCtxSet -({ - { 42, }, - { 42, }, - { CNU, }, - { 10, }, -}); - -const CtxSet ContextSetCfg::SbtHorFlag = ContextSetCfg::addCtxSet -({ - { 35, 51, 27, }, - { 20, 43, 12, }, - { CNU, CNU, CNU, }, - { 8, 4, 1, }, -}); - -const CtxSet ContextSetCfg::SbtPosFlag = ContextSetCfg::addCtxSet -({ - { 28, }, - { 28, }, - { CNU, }, - { 13, }, -}); - -const CtxSet ContextSetCfg::CrossCompPred = ContextSetCfg::addCtxSet -({ - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::ChromaQpAdjFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet -({ - { 51, 33, 50, 60, 45, }, - { 59, 48, 58, 60, 60, }, - { CNU, 34, CNU, CNU, CNU, }, - { 0, 5, 1, 0, 4, }, -}); - -const CtxSet ContextSetCfg::ctbAlfFlag = ContextSetCfg::addCtxSet -({ - { 26, 52, 46, 18, 61, 54, 18, 61, 54, }, - { 6, 23, 46, 12, 61, 54, 5, 46, 54, }, - { 39, 39, 39, 62, 39, 39, 31, 39, 39, }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, }, -}); - -const CtxSet ContextSetCfg::ctbAlfAlternative = ContextSetCfg::addCtxSet -({ - { 11, 11, }, - { 20, 12, }, - { 28, 28, }, - { 0, 0, }, -}); - - -const CtxSet ContextSetCfg::AlfUseTemporalFilt = ContextSetCfg::addCtxSet -({ - { 46, }, - { 53, }, - { 46, }, - { 0, }, -}); - -#if JVET_Q0795_CCALF -const CtxSet ContextSetCfg::CcAlfFilterControlFlag = ContextSetCfg::addCtxSet -({ - { 35, 35, 35, 35, 35, 35 }, - { 35, 35, 35, 35, 35, 35 }, - { 35, 35, 35, 35, 35, 35 }, - { DWS, DWS, DWS, DWS, DWS, DWS }, -}); -#endif - -const CtxSet ContextSetCfg::CiipFlag = ContextSetCfg::addCtxSet -({ - { 50, }, - { 50, }, - { CNU, }, - { 1, }, -}); - -const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet -({ - { 0, 43, 45, }, - { 0, 42, 37, }, - { 17, 42, 36, }, - { 1, 5, 8, }, -}); - -const CtxSet ContextSetCfg::JointCbCrFlag = ContextSetCfg::addCtxSet -({ - { 43, 51, 45, }, - { 35, 44, 45, }, - { 35, 29, 51, }, - { 1, 1, 0, }, -}); - -const CtxSet ContextSetCfg::TsSigCoeffGroup = ContextSetCfg::addCtxSet -({ - { 18, 35, 37, }, - { 18, 12, 29, }, - { 18, 20, 38, }, - { 5, 8, 8, }, -}); - -const CtxSet ContextSetCfg::TsSigFlag = ContextSetCfg::addCtxSet -({ - { 25, 50, 37, }, - { 40, 35, 44, }, - { 25, 28, 38, }, - { 13, 13, 8, }, -}); - -const CtxSet ContextSetCfg::TsParFlag = ContextSetCfg::addCtxSet -({ - { 11, }, - { 3, }, - { 11, }, - { 6, }, -}); - -const CtxSet ContextSetCfg::TsGtxFlag = ContextSetCfg::addCtxSet -({ - { CNU, 10, 4, 4, 5, }, - { CNU, 2, 3, 3, 11, }, - { CNU, 10, 3, 3, 3, }, - { DWS, 1, 1, 1, 1, }, -}); - -const CtxSet ContextSetCfg::TsLrg1Flag = ContextSetCfg::addCtxSet -({ - { 19, 11, 4, 6, }, - { 18, 11, 4, 28, }, - { 11, 5, 5, 6, }, - { 4, 2, 1, 6, }, -}); - -const CtxSet ContextSetCfg::TsResidualSign = ContextSetCfg::addCtxSet -({ - { 28, 25, 53, 28, 33, 30, }, - { 5, 10, 53, 35, 25, 53, }, - { 20, 17, 46, 20, 25, 46, }, - { 1, 4, 4, 8, 8, 8, }, -}); -#endif // clang-format on const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size(); diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index d17ce051c9c97dda638745f13f97ae85fb3c35a9..7759a98fdaee65c46fb7aa6f4db859aa4b2aa951 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -263,9 +263,7 @@ public: static const CtxSet ctbAlfFlag; static const CtxSet ctbAlfAlternative; static const CtxSet AlfUseTemporalFilt; -#if JVET_Q0795_CCALF static const CtxSet CcAlfFilterControlFlag; -#endif static const CtxSet CiipFlag; static const CtxSet SmvdFlag; static const CtxSet IBCFlag; diff --git a/source/Lib/CommonLib/CrossCompPrediction.cpp b/source/Lib/CommonLib/CrossCompPrediction.cpp index a334dae975719724430fc4244119a048d0bc1ee2..ba8b6e04d19837718420308e1c33450560a7df84 100644 --- a/source/Lib/CommonLib/CrossCompPrediction.cpp +++ b/source/Lib/CommonLib/CrossCompPrediction.cpp @@ -42,93 +42,3 @@ #include "CodingStructure.h" #include "Slice.h" -#if !REMOVE_PPS_REXT - -//! \ingroup CommonLib -//! \{ - -int8_t CrossComponentPrediction::xCalcCrossComponentPredictionAlpha( TransformUnit &tu, const ComponentID &compID, bool useRecoResidual ) -{ - const CPelBuf pResiL = useRecoResidual ? tu.cs->getResiBuf( tu.Y() ) : tu.cs->getOrgResiBuf( tu.Y() ); - const CPelBuf pResiC = tu.cs->getResiBuf( tu.blocks[compID] ); - - const int diffBitDepth = tu.cs->sps->getDifferentialLumaChromaBitDepth(); - - int8_t alpha = 0; - int SSxy = 0; - int SSxx = 0; - - for( uint32_t uiY = 0; uiY < pResiL.height; uiY++ ) - { - for( uint32_t uiX = 0; uiX < pResiL.width; uiX++ ) - { - const Pel scaledResiL = rightShift( pResiL.at( uiX, uiY ), diffBitDepth ); - SSxy += ( scaledResiL * pResiC.at( uiX, uiY ) ); - SSxx += ( scaledResiL * scaledResiL ); - } - } - - if( SSxx != 0 ) - { - double dAlpha = SSxy / double( SSxx ); - alpha = int8_t( Clip3<int>( -16, 16, ( int ) ( dAlpha * 16 ) ) ); - - static const int8_t alphaQuant[17] = { 0, 1, 1, 2, 2, 2, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8 }; - - alpha = ( alpha < 0 ) ? -alphaQuant[int( -alpha )] : alphaQuant[int( alpha )]; - } - - tu.compAlpha[compID] = alpha; - - return alpha; -} - - -void CrossComponentPrediction::crossComponentPrediction( TransformUnit &tu, - const ComponentID &compID, - const CPelBuf &piResiL, - const CPelBuf &piResiC, - PelBuf &piResiT, - const bool &reverse ) -{ - const int alpha = tu.compAlpha[compID]; - const int diffBitDepth = tu.cs->sps->getDifferentialLumaChromaBitDepth(); - -#if !RExt__HIGH_BIT_DEPTH_SUPPORT - ClpRng clpRng; //not limited by adaptive clipping - clpRng.min = std::numeric_limits<Pel>::min(); - clpRng.max = std::numeric_limits<Pel>::max(); -#endif - - for( int y = 0; y < piResiT.height; y++ ) - { - if( reverse ) - { - // A constraint is to be added to the HEVC Standard to limit the size of pResiL and pResiC at this point. - // The likely form of the constraint is to either restrict the values to CoeffMin to CoeffMax, - // or to be representable in a bitDepthY+4 or bitDepthC+4 signed integer. - // The result of the constraint is that for 8/10/12bit profiles, the input values - // can be represented within a 16-bit Pel-type. -#if RExt__HIGH_BIT_DEPTH_SUPPORT - for( int x = 0; x < piResiT.width; x++ ) - { - piResiT.at( x, y ) = piResiC.at( x, y ) + ( ( alpha * rightShift( piResiL.at( x, y ), diffBitDepth ) ) >> 3 ); - } -#else - for( int x = 0; x < piResiT.width; x++ ) - { - piResiT.at( x, y ) = ClipPel<int>( piResiC.at( x, y ) + ( ( alpha * rightShift<int>( int( piResiL.at( x, y ) ), diffBitDepth ) ) >> 3 ), clpRng ); - } -#endif - } - else - { - // Forward does not need clipping. Pel type should always be big enough. - for( int x = 0; x < piResiT.width; x++ ) - { - piResiT.at( x, y ) = piResiC.at( x, y ) - ( ( alpha * rightShift<int>( int( piResiL.at( x, y ) ), diffBitDepth ) ) >> 3 ); - } - } - } -} -#endif diff --git a/source/Lib/CommonLib/CrossCompPrediction.h b/source/Lib/CommonLib/CrossCompPrediction.h index 7ed591f1c3a7c337efe87989d85ef5e263521e22..dffddfda3f038e6e430ccf4897bf5764b068b7db 100644 --- a/source/Lib/CommonLib/CrossCompPrediction.h +++ b/source/Lib/CommonLib/CrossCompPrediction.h @@ -30,43 +30,3 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ -#if !REMOVE_PPS_REXT -/** \file Prediction.h - \brief prediction class (header) -*/ - -#ifndef __CROSSCOMPPREDICTION__ -#define __CROSSCOMPPREDICTION__ - - -// Include files -#include "Unit.h" -#include "Buffer.h" - -//! \ingroup CommonLib -//! \{ - -// ==================================================================================================================== -// Class definition -// ==================================================================================================================== - -class CrossComponentPrediction -{ -protected: - - int8_t xCalcCrossComponentPredictionAlpha( TransformUnit &tu, const ComponentID &compID, bool useRecoResidual ); - -public: - - static void crossComponentPrediction( TransformUnit &tu, - const ComponentID &compID, - const CPelBuf &piResiL, - const CPelBuf &piResiC, - PelBuf &piResiT, - const bool &reverse ); -}; - -//! \} - -#endif // __PREDICTION__ -#endif diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 7d2903c8ddc10018c4bb52fc622379910b00c83d..0cec835a1c69e90f74ffffc53d5143e813232b4b 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -1586,17 +1586,9 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const uint32_t log2TrWidth = floorLog2(width); const uint32_t log2TrHeight = floorLog2(height); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif static_cast<DQIntern::DepQuant*>(p)->quant( tu, pSrc, compID, cQP, Quant::m_dLambda, ctx, uiAbsSum, enableScalingLists, Quant::getQuantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); } else @@ -1619,17 +1611,9 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const uint32_t log2TrWidth = floorLog2(width); const uint32_t log2TrHeight = floorLog2(height); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif static_cast<DQIntern::DepQuant*>(p)->dequant( tu, dstCoeff, compID, cQP, enableScalingLists, Quant::getDequantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); } else diff --git a/source/Lib/CommonLib/HRD.cpp b/source/Lib/CommonLib/HRD.cpp index 14e4b8dfce55aae914a3bc60416357c659d6291a..fcd707c063c624e97f4a0630f0855e3c6b9ce49b 100644 --- a/source/Lib/CommonLib/HRD.cpp +++ b/source/Lib/CommonLib/HRD.cpp @@ -33,7 +33,6 @@ #include "HRD.h" -#if JVET_P0118_HRD_ASPECTS OlsHrdParams::OlsHrdParams() : m_fixedPicRateGeneralFlag(false) , m_fixedPicRateWithinCvsFlag(false) @@ -56,5 +55,4 @@ OlsHrdParams::OlsHrdParams() OlsHrdParams::~OlsHrdParams() { } -#endif diff --git a/source/Lib/CommonLib/HRD.h b/source/Lib/CommonLib/HRD.h index 5147df1fae399d69d03431f82bc53a6bf736c43d..9cbab19608ef5b2429f353df89b6d9dd004467fb 100644 --- a/source/Lib/CommonLib/HRD.h +++ b/source/Lib/CommonLib/HRD.h @@ -37,50 +37,6 @@ #include "Common.h" #include "SEI.h" -#if !JVET_P0118_HRD_ASPECTS -class TimingInfo -{ -protected: - bool m_timingInfoPresentFlag; - uint32_t m_numUnitsInTick; - uint32_t m_timeScale; - int m_numTicksPocDiffOneMinus1; - -public: - TimingInfo() - : m_timingInfoPresentFlag (false) - , m_numUnitsInTick (1001) - , m_timeScale (60000) - , m_numTicksPocDiffOneMinus1 (0) - {} - - void setTimingInfoPresentFlag( bool flag ) { m_timingInfoPresentFlag = flag; } - bool getTimingInfoPresentFlag( ) const { return m_timingInfoPresentFlag; } - - void setNumUnitsInTick( uint32_t value ) { m_numUnitsInTick = value; } - uint32_t getNumUnitsInTick( ) const { return m_numUnitsInTick; } - void setTimeScale( uint32_t value ) { m_timeScale = value; } - uint32_t getTimeScale( ) const { return m_timeScale; } - - void setNumTicksPocDiffOneMinus1(int x) { m_numTicksPocDiffOneMinus1 = x; } - int getNumTicksPocDiffOneMinus1( ) const { return m_numTicksPocDiffOneMinus1; } -}; - -struct HrdSubLayerInfo -{ - bool fixedPicRateFlag; - bool fixedPicRateWithinCvsFlag; - uint32_t picDurationInTcMinus1; - bool lowDelayHrdFlag; - uint32_t cpbCntMinus1; - uint32_t bitRateValueMinus1[MAX_CPB_CNT][2]; - uint32_t cpbSizeValue [MAX_CPB_CNT][2]; - uint32_t ducpbSizeValue [MAX_CPB_CNT][2]; - bool cbrFlag [MAX_CPB_CNT][2]; - uint32_t duBitRateValue [MAX_CPB_CNT][2]; -}; -#endif -#if JVET_P0118_HRD_ASPECTS class OlsHrdParams { private: @@ -118,61 +74,34 @@ public: void setCbrFlag(int cpbcnt, int nalOrVcl, bool value) { m_cbrFlag[cpbcnt][nalOrVcl] = value; } bool getCbrFlag(int cpbcnt, int nalOrVcl) const { return m_cbrFlag[cpbcnt][nalOrVcl]; } }; -#endif -#if JVET_P0118_HRD_ASPECTS class GeneralHrdParams -#else -class HRDParameters -#endif { private: -#if JVET_P0118_HRD_ASPECTS uint32_t m_numUnitsInTick; uint32_t m_timeScale; bool m_generalNalHrdParamsPresentFlag; bool m_generalVclHrdParamsPresentFlag; bool m_generalSamPicTimingInAllOlsFlag; -#else - bool m_nalHrdParametersPresentFlag; - bool m_vclHrdParametersPresentFlag; -#endif uint32_t m_tickDivisorMinus2; bool m_generalDecodingUnitHrdParamsPresentFlag; uint32_t m_bitRateScale; uint32_t m_cpbSizeScale; uint32_t m_cpbSizeDuScale; -#if JVET_P0118_HRD_ASPECTS uint32_t m_hrdCpbCntMinus1; -#endif -#if !JVET_P0118_HRD_ASPECTS - HrdSubLayerInfo m_HRD[MAX_TLAYER]; -#endif public: -#if JVET_P0118_HRD_ASPECTS GeneralHrdParams() -#else - HRDParameters() -#endif -#if JVET_P0118_HRD_ASPECTS :m_generalNalHrdParamsPresentFlag(false) ,m_generalVclHrdParamsPresentFlag(false) ,m_generalSamPicTimingInAllOlsFlag(true) -#else - :m_nalHrdParametersPresentFlag (false) - ,m_vclHrdParametersPresentFlag (false) -#endif ,m_tickDivisorMinus2 (0) ,m_generalDecodingUnitHrdParamsPresentFlag (false) ,m_bitRateScale (0) ,m_cpbSizeScale (0) ,m_cpbSizeDuScale (0) -#if JVET_P0118_HRD_ASPECTS ,m_hrdCpbCntMinus1(0) -#endif {} -#if JVET_P0118_HRD_ASPECTS bool operator==(const GeneralHrdParams& other) const { return (m_numUnitsInTick == other.m_numUnitsInTick @@ -210,13 +139,7 @@ public: m_hrdCpbCntMinus1 = input.m_hrdCpbCntMinus1; return *this; } -#endif -#if JVET_P0118_HRD_ASPECTS virtual ~GeneralHrdParams() {} -#else - virtual ~HRDParameters() {} -#endif -#if JVET_P0118_HRD_ASPECTS void setNumUnitsInTick(uint32_t value) { m_numUnitsInTick = value; } uint32_t getNumUnitsInTick() const { return m_numUnitsInTick; } @@ -231,13 +154,6 @@ public: void setGeneralSamPicTimingInAllOlsFlag(bool flag) { m_generalSamPicTimingInAllOlsFlag = flag; } bool getGeneralSamPicTimingInAllOlsFlag() const { return m_generalSamPicTimingInAllOlsFlag; } -#else - void setNalHrdParametersPresentFlag( bool flag ) { m_nalHrdParametersPresentFlag = flag; } - bool getNalHrdParametersPresentFlag( ) const { return m_nalHrdParametersPresentFlag; } - - void setVclHrdParametersPresentFlag( bool flag ) { m_vclHrdParametersPresentFlag = flag; } - bool getVclHrdParametersPresentFlag( ) const { return m_vclHrdParametersPresentFlag; } -#endif void setTickDivisorMinus2( uint32_t value ) { m_tickDivisorMinus2 = value; } @@ -255,41 +171,9 @@ public: void setCpbSizeDuScale( uint32_t value ) { m_cpbSizeDuScale = value; } uint32_t getCpbSizeDuScale( ) const { return m_cpbSizeDuScale; } -#if JVET_P0118_HRD_ASPECTS void setHrdCpbCntMinus1(uint32_t value) { m_hrdCpbCntMinus1 = value; } uint32_t getHrdCpbCntMinus1() const { return m_hrdCpbCntMinus1; } -#endif - -#if !JVET_P0118_HRD_ASPECTS - void setFixedPicRateFlag( int layer, bool flag ) { m_HRD[layer].fixedPicRateFlag = flag; } - bool getFixedPicRateFlag( int layer ) const { return m_HRD[layer].fixedPicRateFlag; } - - void setFixedPicRateWithinCvsFlag( int layer, bool flag ) { m_HRD[layer].fixedPicRateWithinCvsFlag = flag; } - bool getFixedPicRateWithinCvsFlag( int layer ) const { return m_HRD[layer].fixedPicRateWithinCvsFlag; } - - void setPicDurationInTcMinus1( int layer, uint32_t value ) { m_HRD[layer].picDurationInTcMinus1 = value; } - uint32_t getPicDurationInTcMinus1( int layer ) const { return m_HRD[layer].picDurationInTcMinus1; } - void setLowDelayHrdFlag( int layer, bool flag ) { m_HRD[layer].lowDelayHrdFlag = flag; } - bool getLowDelayHrdFlag( int layer ) const { return m_HRD[layer].lowDelayHrdFlag; } - - void setCpbCntMinus1( int layer, uint32_t value ) { m_HRD[layer].cpbCntMinus1 = value; } - uint32_t getCpbCntMinus1( int layer ) const { return m_HRD[layer].cpbCntMinus1; } - - void setBitRateValueMinus1( int layer, int cpbcnt, int nalOrVcl, uint32_t value ) { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value; } - uint32_t getBitRateValueMinus1( int layer, int cpbcnt, int nalOrVcl ) const { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl]; } - - void setCpbSizeValueMinus1( int layer, int cpbcnt, int nalOrVcl, uint32_t value ) { m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl] = value; } - uint32_t getCpbSizeValueMinus1( int layer, int cpbcnt, int nalOrVcl ) const { return m_HRD[layer].cpbSizeValue[cpbcnt][nalOrVcl]; } - void setDuCpbSizeValueMinus1( int layer, int cpbcnt, int nalOrVcl, uint32_t value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value; } - uint32_t getDuCpbSizeValueMinus1( int layer, int cpbcnt, int nalOrVcl ) const { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl]; } - void setDuBitRateValueMinus1( int layer, int cpbcnt, int nalOrVcl, uint32_t value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value; } - uint32_t getDuBitRateValueMinus1(int layer, int cpbcnt, int nalOrVcl ) const { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl]; } - void setCbrFlag( int layer, int cpbcnt, int nalOrVcl, bool value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value; } - bool getCbrFlag( int layer, int cpbcnt, int nalOrVcl ) const { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl]; } - - bool getCpbDpbDelaysPresentFlag( ) const { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); } -#endif }; class HRD @@ -297,14 +181,11 @@ class HRD public: HRD() :m_bufferingPeriodInitialized (false) -#if JVET_Q0818_PT_SEI , m_pictureTimingAvailable (false) -#endif {}; virtual ~HRD() {}; -#if JVET_P0118_HRD_ASPECTS void setGeneralHrdParameters(GeneralHrdParams &generalHrdParam) { m_generalHrdParams = generalHrdParam; } GeneralHrdParams getGeneralHrdParameters() const { return m_generalHrdParams; } const GeneralHrdParams& getGeneralHrdParameters() { return m_generalHrdParams; } @@ -314,38 +195,20 @@ public: OlsHrdParams* getOlsHrdParametersAddr() { return &m_olsHrdParams[0]; } const OlsHrdParams& getOlsHrdParameters() const { return m_olsHrdParams[0]; } -#else - void setHRDParameters(HRDParameters &hrdParam) { m_hrdParams=hrdParam; } - HRDParameters getHRDParameters() const { return m_hrdParams; } - const HRDParameters& getHRDParameters() { return m_hrdParams; } - - void setTimingInfo(TimingInfo &timingInfo) { m_timingInfo=timingInfo; } - TimingInfo getTimingInfo() const { return m_timingInfo; } - const TimingInfo& getTimingInfo() { return m_timingInfo; } -#endif void setBufferingPeriodSEI(const SEIBufferingPeriod* bp) { bp->copyTo(m_bufferingPeriodSEI); m_bufferingPeriodInitialized = true; } const SEIBufferingPeriod* getBufferingPeriodSEI() const { return m_bufferingPeriodInitialized ? &m_bufferingPeriodSEI : nullptr; } -#if JVET_Q0818_PT_SEI void setPictureTimingSEI(const SEIPictureTiming* pt) { pt->copyTo(m_pictureTimingSEI); m_pictureTimingAvailable = true; } const SEIPictureTiming* getPictureTimingSEI() const { return m_pictureTimingAvailable ? &m_pictureTimingSEI : nullptr; } -#endif protected: -#if JVET_P0118_HRD_ASPECTS GeneralHrdParams m_generalHrdParams; OlsHrdParams m_olsHrdParams[MAX_TLAYER]; -#else - HRDParameters m_hrdParams; - TimingInfo m_timingInfo; -#endif bool m_bufferingPeriodInitialized; SEIBufferingPeriod m_bufferingPeriodSEI; -#if JVET_Q0818_PT_SEI bool m_pictureTimingAvailable; SEIPictureTiming m_pictureTimingSEI; -#endif }; #endif //__HRD__ diff --git a/source/Lib/CommonLib/Hash.cpp b/source/Lib/CommonLib/Hash.cpp index 9750be390676f5f808744f2cd963a684d33b28aa..a6e7844e9a001c3d2de86a4234b13c86e2e70944 100644 --- a/source/Lib/CommonLib/Hash.cpp +++ b/source/Lib/CommonLib/Hash.cpp @@ -377,17 +377,11 @@ void TComHash::getPixelsIn1DCharArrayByBlock2x2(const PelUnitBuf &curPicBuf, uns if (bitDepths.recon[CHANNEL_TYPE_LUMA] == 8 && bitDepths.recon[CHANNEL_TYPE_CHROMA] == 8) { -#if JVET_Q0438_MONOCHROME_BUGFIXES Pel* curPel[MAX_NUM_COMPONENT]={nullptr}; int stride[MAX_NUM_COMPONENT]={0}; const int maxComponent=includeAllComponent?MAX_NUM_COMPONENT:1; for (int id = 0; id < maxComponent; id++) -#else - Pel* curPel[3]; - int stride[3]; - for (int id = 0; id < 3; id++) -#endif { ComponentID compID = ComponentID(id); stride[id] = (curPicBuf).get(compID).stride; @@ -418,19 +412,12 @@ void TComHash::getPixelsIn1DCharArrayByBlock2x2(const PelUnitBuf &curPicBuf, uns else { int shift = bitDepths.recon[CHANNEL_TYPE_LUMA] - 8; -#if JVET_Q0438_MONOCHROME_BUGFIXES int shiftc = includeAllComponent ? (bitDepths.recon[CHANNEL_TYPE_CHROMA] - 8) : 0; Pel* curPel[MAX_NUM_COMPONENT]={nullptr}; int stride[MAX_NUM_COMPONENT]={0}; const int maxComponent=includeAllComponent?MAX_NUM_COMPONENT:1; for (int id = 0; id < maxComponent; id++) -#else - int shiftc = bitDepths.recon[CHANNEL_TYPE_CHROMA] - 8; - Pel* curPel[3]; - int stride[3]; - for (int id = 0; id < 3; id++) -#endif { ComponentID compID = ComponentID(id); stride[id] = (curPicBuf).get(compID).stride; diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 291772a652847dd62de198592763751a4019769f..5aed9cd5dddaf418e5c6bc8e7337a33fc8ff315b 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -126,12 +126,8 @@ void InterPrediction::destroy() } } -#if !JVET_Q0806 - m_triangleBuf.destroy(); -#else m_geoPartBuf[0].destroy(); m_geoPartBuf[1].destroy(); -#endif m_colorTransResiBuf[0].destroy(); m_colorTransResiBuf[1].destroy(); m_colorTransResiBuf[2].destroy(); @@ -197,12 +193,8 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC, cons } } -#if !JVET_Q0806 - m_triangleBuf.create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); -#else m_geoPartBuf[0].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); m_geoPartBuf[1].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); -#endif m_colorTransResiBuf[0].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); m_colorTransResiBuf[1].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); m_colorTransResiBuf[2].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); @@ -313,11 +305,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R int fstStep = (!verMC ? puHeight : puWidth); int secStep = (!verMC ? puWidth : puHeight); -#if JVET_Q0487_SCALING_WINDOW_ISSUES bool scaled = pu.cu->slice->getRefPic( REF_PIC_LIST_0, 0 )->isRefScaled( pu.cs->pps ) || ( pu.cs->slice->getSliceType() == B_SLICE ? pu.cu->slice->getRefPic( REF_PIC_LIST_1, 0 )->isRefScaled( pu.cs->pps ) : false ); -#else - bool scaled = pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, 0 ) != SCALE_1X || ( pu.cs->slice->getSliceType() == B_SLICE ? pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, 0 ) != SCALE_1X : false ); -#endif m_subPuMC = true; @@ -484,11 +472,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& if( !pu.cu->affine ) { -#if JVET_Q0487_SCALING_WINDOW_ISSUES if( !isIBC && pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->isRefScaled( pu.cs->pps ) == false ) -#else - if( pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx ) == SCALE_1X ) -#endif { if( !sps.getWrapAroundEnabledFlag() ) { @@ -549,11 +533,7 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co } else { -#if JVET_Q0128_DMVR_BDOF_ENABLING_CONDITION const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp0[COMPONENT_Cb].bPresentFlag || wp0[COMPONENT_Cr].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Cb].bPresentFlag || wp1[COMPONENT_Cr].bPresentFlag) && slice.getSliceType() == B_SLICE); -#else - const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag) && slice.getSliceType() == B_SLICE); -#endif const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE); if (biocheck0 && biocheck1 @@ -586,16 +566,10 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co bool dmvrApplied = false; dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); -#if JVET_Q0487_SCALING_WINDOW_ISSUES bool refIsScaled = ( refIdx0 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) ) || ( refIdx1 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->isRefScaled( pu.cs->pps ) ); dmvrApplied = dmvrApplied && !refIsScaled; bioApplied = bioApplied && !refIsScaled; -#else - bool samePicSize = ( refIdx0 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ) == SCALE_1X ) && ( refIdx1 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ) == SCALE_1X ); - dmvrApplied = dmvrApplied && samePicSize; - bioApplied = bioApplied && samePicSize; -#endif for (uint32_t refList = 0; refList < NUM_REF_PIC_LIST_01; refList++) { @@ -639,11 +613,7 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co } else { -#if !JVET_Q0806 - xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle -#else xPredInterUni(pu, eRefPicList, pcMbBuf, pu.cu->geoFlag -#endif , bioApplied , luma, chroma ); @@ -658,21 +628,13 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[1][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvPred.Cr())) ); const bool lumaOnly = luma && !chroma; const bool chromaOnly = !luma && chroma; -#if !JVET_Q0806 - if( !pu.cu->triangle && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->BcwIdx==BCW_DEFAULT) -#else if( !pu.cu->geoFlag && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->BcwIdx == BCW_DEFAULT) -#endif { xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred, lumaOnly, chromaOnly ); if (yuvPredTmp) yuvPredTmp->copyFrom(pcYuvPred); } -#if !JVET_Q0806 - else if( !pu.cu->triangle && pps.getUseWP() && slice.getSliceType() == P_SLICE ) -#else else if( !pu.cu->geoFlag && pps.getUseWP() && slice.getSliceType() == P_SLICE ) -#endif { xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred, lumaOnly, chromaOnly ); if (yuvPredTmp) @@ -933,14 +895,6 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction int iMvScaleHor = mvLT.getHor() << iBit; int iMvScaleVer = mvLT.getVer() << iBit; const SPS &sps = *pu.cs->sps; -#if !JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY - const int iMvShift = 4; - const int iOffset = 8; - const int iHorMax = ( pu.cs->pps->getPicWidthInLumaSamples() + iOffset - pu.Y().x - 1 ) << iMvShift; - const int iHorMin = ( -(int)pu.cs->pcv->maxCUWidth - iOffset - (int)pu.Y().x + 1 ) << iMvShift; - const int iVerMax = ( pu.cs->pps->getPicHeightInLumaSamples() + iOffset - pu.Y().y - 1 ) << iMvShift; - const int iVerMin = ( -(int)pu.cs->pcv->maxCUHeight - iOffset - (int)pu.Y().y + 1 ) << iMvShift; -#endif const int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; @@ -954,12 +908,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction enablePROF &= !subblkMVSpreadOverLimit; const int profThres = 1 << (iBit + (m_isBi ? 1 : 0)); enablePROF &= !m_encOnly || pu.cu->slice->getCheckLDC() || iDMvHorX > profThres || iDMvHorY > profThres || iDMvVerX > profThres || iDMvVerY > profThres || iDMvHorX < -profThres || iDMvHorY < -profThres || iDMvVerX < -profThres || iDMvVerY < -profThres; -#if JVET_Q0487_SCALING_WINDOW_ISSUES enablePROF &= (refPic->isRefScaled( pu.cs->pps ) == false); -#else - enablePROF &= pu.cs->pps->getPicWidthInLumaSamples() == refPic->getPicWidthInLumaSamples() && pu.cs->pps->getPicHeightInLumaSamples() == refPic->getPicHeightInLumaSamples(); - enablePROF &= scalingRatio == SCALE_1X; -#endif bool isLast = enablePROF ? false : !bi; @@ -1130,20 +1079,11 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction { wrapRef = false; m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); -#if JVET_Q0487_SCALING_WINDOW_ISSUES if( refPic->isRefScaled( pu.cs->pps ) == false ) -#else - if( scalingRatio == SCALE_1X ) -#endif { -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY clipMv(tmpMv, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps); iMvScaleTmpHor = tmpMv.getHor(); iMvScaleTmpVer = tmpMv.getVer(); -#else - iMvScaleTmpHor = std::min<int>(iHorMax, std::max<int>(iHorMin, iMvScaleTmpHor)); - iMvScaleTmpVer = std::min<int>(iVerMax, std::max<int>(iVerMin, iMvScaleTmpVer)); -#endif } } } @@ -1159,18 +1099,9 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction else { wrapRef = false; -#if JVET_Q0487_SCALING_WINDOW_ISSUES if( refPic->isRefScaled( pu.cs->pps ) == false ) -#else - if( scalingRatio == SCALE_1X ) -#endif { -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY clipMv(curMv, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps); -#else - curMv.hor = std::min<int>(iHorMax, std::max<int>(iHorMin, curMv.hor)); - curMv.ver = std::min<int>(iVerMax, std::max<int>(iVerMin, curMv.ver)); -#endif } } iMvScaleTmpHor = curMv.hor; @@ -1438,55 +1369,21 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB yuvDstTmp->bufs[0].copyFrom(pcYuvDst.bufs[0]); } } -#if JVET_Q0128_DMVR_BDOF_ENABLING_CONDITION if (!bioApplied && (lumaOnly || chromaOnly)) { pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, chromaOnly, lumaOnly); } else pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); -#else - if (pu.cs->pps->getWPBiPred()) - { - const int iRefIdx0 = pu.refIdx[0]; - const int iRefIdx1 = pu.refIdx[1]; - WPScalingParam *pwp0; - WPScalingParam *pwp1; - getWpScaling(pu.cu->slice, iRefIdx0, iRefIdx1, pwp0, pwp1); - if (!bioApplied) - { - if (!chromaOnly) - addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Y); - } - if (!lumaOnly) - { - addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Cb); - addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Cr); - } - } - else - { - if (!bioApplied && (lumaOnly || chromaOnly)) - { - pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, chromaOnly, lumaOnly); - } - else - pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); - } -#endif if (yuvDstTmp) { if (bioApplied) { -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(yuvDstTmp->chromaFormat)) { -#endif yuvDstTmp->bufs[1].copyFrom(pcYuvDst.bufs[1]); yuvDstTmp->bufs[2].copyFrom(pcYuvDst.bufs[2]); -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif } else yuvDstTmp->copyFrom(pcYuvDst, lumaOnly, chromaOnly); @@ -1494,38 +1391,22 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB } else if( iRefIdx0 >= 0 && iRefIdx1 < 0 ) { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - pcYuvDst.copyFrom( pcYuvSrc0 ); - } - else -#else if( pu.cu->geoFlag ) { pcYuvDst.copyFrom( pcYuvSrc0 ); } else -#endif pcYuvDst.copyClip( pcYuvSrc0, clpRngs, lumaOnly, chromaOnly ); if (yuvDstTmp) yuvDstTmp->copyFrom( pcYuvDst, lumaOnly, chromaOnly ); } else if( iRefIdx0 < 0 && iRefIdx1 >= 0 ) { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - pcYuvDst.copyFrom( pcYuvSrc1 ); - } - else -#else if( pu.cu->geoFlag ) { pcYuvDst.copyFrom( pcYuvSrc1 ); } else -#endif pcYuvDst.copyClip( pcYuvSrc1, clpRngs, lumaOnly, chromaOnly ); if (yuvDstTmp) yuvDstTmp->copyFrom(pcYuvDst, lumaOnly, chromaOnly); @@ -1538,11 +1419,9 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu , PelUnitBuf* predBufWOBIO /*= NULL*/ ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES // Note: there appears to be an interaction with weighted prediction that // makes the code follow different paths if chroma is on or off (in the encoder). // Therefore for 4:0:0, "chroma" is not changed to false. -#endif CHECK(predBufWOBIO && pu.ciipFlag, "the case should not happen!"); if (!pu.cs->pcv->isEncoder) @@ -1614,11 +1493,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu } else { -#if JVET_Q0128_DMVR_BDOF_ENABLING_CONDITION const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp0[COMPONENT_Cb].bPresentFlag || wp0[COMPONENT_Cr].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Cb].bPresentFlag || wp1[COMPONENT_Cr].bPresentFlag) && slice.getSliceType() == B_SLICE); -#else - const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag) && slice.getSliceType() == B_SLICE); -#endif const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE); if (biocheck0 && biocheck1 @@ -1651,13 +1526,9 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu } } -#if JVET_Q0487_SCALING_WINDOW_ISSUES bool refIsScaled = ( refIdx0 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) ) || ( refIdx1 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->isRefScaled( pu.cs->pps ) ); bioApplied = refIsScaled ? false : bioApplied; -#else - bioApplied = ( ( refIdx0 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ) == SCALE_1X ) && ( refIdx1 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ) == SCALE_1X ) ) ? bioApplied : false; -#endif bool dmvrApplied = false; dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); if ((pu.lumaSize().width > MAX_BDOF_APPLICATION_REGION || pu.lumaSize().height > MAX_BDOF_APPLICATION_REGION) && pu.mergeType != MRG_TYPE_SUBPU_ATMVP && (bioApplied && !dmvrApplied)) @@ -1717,66 +1588,6 @@ int InterPrediction::rightShiftMSB(int numer, int denom) return numer >> floorLog2(denom); } -#if !JVET_Q0806 -void InterPrediction::motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ) -{ - for( auto &pu : CU::traversePUs( cu ) ) - { - const UnitArea localUnitArea( cu.cs->area.chromaFormat, Area( 0, 0, pu.lwidth(), pu.lheight() ) ); - PelUnitBuf tmpTriangleBuf = m_triangleBuf.getBuf( localUnitArea ); - PelUnitBuf predBuf = cu.cs->getPredBuf( pu ); - - triangleMrgCtx.setMergeInfo( pu, candIdx0 ); - PU::spanMotionInfo( pu ); - motionCompensation( pu, tmpTriangleBuf ); - - { - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } - } - - triangleMrgCtx.setMergeInfo( pu, candIdx1 ); - PU::spanMotionInfo( pu ); - motionCompensation( pu, predBuf ); - - { - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } - } - weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, tmpTriangleBuf, predBuf ); - } -} - -void InterPrediction::weightedTriangleBlk( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -{ - if( channel == CHANNEL_TYPE_LUMA ) - { - m_if.weightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); - } - else if( channel == CHANNEL_TYPE_CHROMA ) - { - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); - } - else - { - m_if.weightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); -#if JVET_Q0438_MONOCHROME_BUGFIXES - if (isChromaEnabled(pu.chromaFormat)) - { -#endif - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); -#if JVET_Q0438_MONOCHROME_BUGFIXES - } -#endif - } -} -#else void InterPrediction::motionCompensationGeo( CodingUnit &cu, MergeCtx &geoMrgCtx ) { const uint8_t splitDir = cu.firstPU->geoSplitDir; @@ -1822,18 +1633,13 @@ void InterPrediction::weightedGeoBlk( PredictionUnit &pu, const uint8_t splitDir else { m_if.weightedGeoBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(pu.chromaFormat)) { -#endif m_if.weightedGeoBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); m_if.weightedGeoBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif } } -#endif void InterPrediction::xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId, bool forLuma) { @@ -1886,11 +1692,7 @@ void InterPrediction::xPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList ref int offset = 0, width, height; int padsize; Mv cMv; -#if JVET_Q0438_MONOCHROME_BUGFIXES for (int compID = 0; compID < getNumberValidComponents(pu.chromaFormat); compID++) -#else - for (int compID = 0; compID < MAX_NUM_COMPONENT; compID++) -#endif { int filtersize = (compID == (COMPONENT_Y)) ? NTAPS_LUMA : NTAPS_CHROMA; width = pcPad.bufs[compID].width; @@ -2053,11 +1855,7 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu pu.lx(), pu.ly(), pu.lwidth(), pu.lheight(), startMv.getHor(), startMv.getVer(), tileArea.topLeft().x, tileArea.topLeft().y, tileArea.bottomRight().x, tileArea.bottomRight().y ); THROW( "MCTS constraint failed!" ); } -#if JVET_Q0438_MONOCHROME_BUGFIXES for (int compID = 0; compID < getNumberValidComponents(pu.chromaFormat); compID++) -#else - for (int compID = 0; compID < MAX_NUM_COMPONENT; compID++) -#endif { Pel *srcBufPelPtr = NULL; int pcPadstride = 0; @@ -2340,26 +2138,18 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con if (pu.mvdL0SubPu[num] != Mv(0, 0)) { blockMoved = true; -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(pu.chromaFormat)) { -#endif xPrefetch(subPu, m_cYuvRefBuffDMVRL0, REF_PIC_LIST_0, 0); xPrefetch(subPu, m_cYuvRefBuffDMVRL1, REF_PIC_LIST_1, 0); -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif xPad(subPu, m_cYuvRefBuffDMVRL0, REF_PIC_LIST_0); xPad(subPu, m_cYuvRefBuffDMVRL1, REF_PIC_LIST_1); } -#if JVET_Q0438_MONOCHROME_BUGFIXES int dstStride[MAX_NUM_COMPONENT] = { pcYuvDst.bufs[COMPONENT_Y].stride, isChromaEnabled(pu.chromaFormat) ? pcYuvDst.bufs[COMPONENT_Cb].stride : 0, isChromaEnabled(pu.chromaFormat) ? pcYuvDst.bufs[COMPONENT_Cr].stride : 0}; -#else - int dstStride[MAX_NUM_COMPONENT] = { pcYuvDst.bufs[COMPONENT_Y].stride, pcYuvDst.bufs[COMPONENT_Cb].stride, pcYuvDst.bufs[COMPONENT_Cr].stride }; -#endif subPu.mv[0] = mergeMv[REF_PIC_LIST_0] + pu.mvdL0SubPu[num]; subPu.mv[1] = mergeMv[REF_PIC_LIST_1] - pu.mvdL0SubPu[num]; @@ -2372,16 +2162,12 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con subPredBuf.bufs[COMPONENT_Y].buf = pcYuvDst.bufs[COMPONENT_Y].buf + xStart + yStart * dstStride[COMPONENT_Y]; -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(pu.chromaFormat)) { -#endif subPredBuf.bufs[COMPONENT_Cb].buf = pcYuvDst.bufs[COMPONENT_Cb].buf + (xStart >> scaleX) + ((yStart >> scaleY) * dstStride[COMPONENT_Cb]); subPredBuf.bufs[COMPONENT_Cr].buf = pcYuvDst.bufs[COMPONENT_Cr].buf + (xStart >> scaleX) + ((yStart >> scaleY) * dstStride[COMPONENT_Cr]); -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif xWeightedAverage(subPu, srcPred0, srcPred1, subPredBuf, subPu.cu->slice->getSPS()->getBitDepths(), subPu.cu->slice->clpRngs(), bioAppliedType[num]); num++; } @@ -2513,11 +2299,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, int height = blk.height; CPelBuf refBuf; -#if JVET_Q0487_SCALING_WINDOW_ISSUES const bool scaled = refPic->isRefScaled( &pps ); -#else - const bool scaled = scalingRatio != SCALE_1X; -#endif if( scaled ) { @@ -2549,7 +2331,6 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, yFilter = 3; } } -#if JVET_Q0517_RPR_AFFINE_DS if (filterIndex == 2) { if (isLuma(compID)) @@ -2593,7 +2374,6 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, } } } -#endif const int posShift = SCALE_RATIO_BITS - 4; int stepX = ( scalingRatio.first + 8 ) >> 4; @@ -2603,30 +2383,17 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, int offX = 1 << ( posShift - shiftHor - 1 ); int offY = 1 << ( posShift - shiftVer - 1 ); -#if JVET_Q0487_SCALING_WINDOW_ISSUES const int64_t posX = ( ( blk.pos().x << ::getComponentScaleX( compID, chFmt ) ) - ( pps.getScalingWindow().getWindowLeftOffset() * SPS::getWinUnitX( chFmt ) ) ) >> ::getComponentScaleX( compID, chFmt ); const int64_t posY = ( ( blk.pos().y << ::getComponentScaleY( compID, chFmt ) ) - ( pps.getScalingWindow().getWindowTopOffset() * SPS::getWinUnitY( chFmt ) ) ) >> ::getComponentScaleY( compID, chFmt ); -#else - const int64_t posX = ( ( blk.pos().x << ::getComponentScaleX( compID, chFmt ) ) - pps.getScalingWindow().getWindowLeftOffset() ) >> ::getComponentScaleX( compID, chFmt ); - const int64_t posY = ( ( blk.pos().y << ::getComponentScaleY( compID, chFmt ) ) - pps.getScalingWindow().getWindowTopOffset() ) >> ::getComponentScaleY( compID, chFmt ); -#endif int addX = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getHorCollocatedChromaFlag() ) * 8 * ( scalingRatio.first - SCALE_1X.first ); int addY = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getVerCollocatedChromaFlag() ) * 8 * ( scalingRatio.second - SCALE_1X.second ); x0Int = ( ( posX << ( 4 + ::getComponentScaleX( compID, chFmt ) ) ) + mv.getHor() ) * (int64_t)scalingRatio.first + addX; -#if JVET_Q0487_SCALING_WINDOW_ISSUES x0Int = SIGN( x0Int ) * ( ( llabs( x0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleX( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleX( compID, chFmt ) ) ) + ( ( refPic->getScalingWindow().getWindowLeftOffset() * SPS::getWinUnitX( chFmt ) ) << ( ( posShift - ::getComponentScaleX( compID, chFmt ) ) ) ); -#else - x0Int = SIGN( x0Int ) * ( ( llabs( x0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleX( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleX( compID, chFmt ) ) ) + ( refPic->getScalingWindow().getWindowLeftOffset() << ( ( posShift - ::getComponentScaleX( compID, chFmt ) ) ) ); -#endif y0Int = ( ( posY << ( 4 + ::getComponentScaleY( compID, chFmt ) ) ) + mv.getVer() ) * (int64_t)scalingRatio.second + addY; -#if JVET_Q0487_SCALING_WINDOW_ISSUES y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleY( compID, chFmt ) ) ) + ( ( refPic->getScalingWindow().getWindowTopOffset() * SPS::getWinUnitY( chFmt ) ) << ( ( posShift - ::getComponentScaleY( compID, chFmt ) ) ) ); -#else - y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleY( compID, chFmt ) ) ) + ( refPic->getScalingWindow().getWindowTopOffset() << ( ( posShift - ::getComponentScaleY( compID, chFmt ) ) ) ); -#endif const int extSize = isLuma( compID ) ? 1 : 2; int vFilterSize = isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA; @@ -2659,11 +2426,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, offset, Size( 1, refHeight ) ), wrapRef ); Pel* tempBuf = buffer + col; -#if JVET_Q0449_RPR_NO_SMOOTHING m_if.filterHor( compID, (Pel*)refBuf.buf - ( ( vFilterSize >> 1 ) - 1 ) * refBuf.stride, refBuf.stride, tempBuf, tmpStride, 1, refHeight + vFilterSize - 1 + extSize, xFrac, false, chFmt, clpRng, xFilter, false, useAltHpelIf && scalingRatio.first == 1 << SCALE_RATIO_BITS ); -#else - m_if.filterHor( compID, (Pel*)refBuf.buf - ( ( vFilterSize >> 1 ) - 1 ) * refBuf.stride, refBuf.stride, tempBuf, tmpStride, 1, refHeight + vFilterSize - 1 + extSize, xFrac, false, chFmt, clpRng, xFilter, false, useAltHpelIf ); -#endif } for( row = 0; row < height; row++ ) @@ -2678,11 +2441,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, Pel* tempBuf = buffer + ( yInt - yInt0 ) * tmpStride; JVET_J0090_SET_CACHE_ENABLE( false ); -#if JVET_Q0449_RPR_NO_SMOOTHING m_if.filterVer( compID, tempBuf + ( ( vFilterSize >> 1 ) - 1 ) * tmpStride, tmpStride, dst + row * dstStride, dstStride, width, 1, yFrac, false, rndRes, chFmt, clpRng, yFilter, false, useAltHpelIf && scalingRatio.second == 1 << SCALE_RATIO_BITS ); -#else - m_if.filterVer( compID, tempBuf + ( ( vFilterSize >> 1 ) - 1 ) * tmpStride, tmpStride, dst + row * dstStride, dstStride, width, 1, yFrac, false, rndRes, chFmt, clpRng, yFilter, false, useAltHpelIf ); -#endif JVET_J0090_SET_CACHE_ENABLE( true ); } } diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index a7455d46186a691fddb8ec20d96a67a12b29a729..6b67d430fbef514b8b34903db31209e541b9368c 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -81,11 +81,7 @@ protected: RdCost* m_pcRdCost; int m_iRefListIdx; -#if !JVET_Q0806 - PelStorage m_triangleBuf; -#else PelStorage m_geoPartBuf[2]; -#endif Mv* m_storedMv; /*buffers for bilinear Filter data for DMVR refinement*/ Pel* m_cYuvPredTempDMVRL0; @@ -142,9 +138,6 @@ protected: void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, const bool lumaOnly = false, const bool chromaOnly = false, PelUnitBuf* yuvDstTmp = NULL ); void xPredAffineBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const bool genChromaMv = false, const std::pair<int, int> scalingRatio = SCALE_1X ); -#if !JVET_Q0806 - void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#endif static bool xCheckIdenticalMotion( const PredictionUnit& pu ); @@ -177,13 +170,8 @@ public: , const bool luma = true, const bool chroma = true ); -#if !JVET_Q0806 - void motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ); - void weightedTriangleBlk ( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#else void motionCompensationGeo(CodingUnit &cu, MergeCtx &GeoMrgCtx); void weightedGeoBlk(PredictionUnit &pu, const uint8_t splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif void xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId, bool forLuma); void xPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId); void xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvSrc0, PelUnitBuf &pcYuvSrc1, PelUnitBuf &pcPad0, PelUnitBuf &pcPad1, const bool bioApplied diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp index 5fb66c384000e6eb3a174233326180ed17e118c3..ba76ca68f389d381cec220441db1f715b1f6e6f5 100644 --- a/source/Lib/CommonLib/InterpolationFilter.cpp +++ b/source/Lib/CommonLib/InterpolationFilter.cpp @@ -136,7 +136,6 @@ const TFilterCoeff InterpolationFilter::m_lumaFilterRPR2[LUMA_INTERPOLATION_FILT { -2, -4, 5, 21, 29, 19, 0, -4 } }; -#if JVET_Q0517_RPR_AFFINE_DS // 1.5x const TFilterCoeff InterpolationFilter::m_affineLumaFilterRPR1[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA] = { @@ -178,7 +177,6 @@ const TFilterCoeff InterpolationFilter::m_affineLumaFilterRPR2[LUMA_INTERPOLATIO { 0, -6, 6, 22, 29, 18, -5, 0 }, { 0, -6, 5, 21, 29, 19, -4, 0 } }; -#endif const TFilterCoeff InterpolationFilter::m_lumaAltHpelIFilter[NTAPS_LUMA] = { 0, 3, 9, 20, 20, 9, 3, 0 }; const TFilterCoeff InterpolationFilter::m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA] = @@ -371,11 +369,7 @@ InterpolationFilter::InterpolationFilter() m_filterCopy[1][0] = filterCopy<true, false>; m_filterCopy[1][1] = filterCopy<true, true>; -#if !JVET_Q0806 - m_weightedTriangleBlk = xWeightedTriangleBlk; -#else m_weightedGeoBlk = xWeightedGeoBlk; -#endif } @@ -765,7 +759,6 @@ void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, in { filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterRPR2[frac], biMCForDMVR ); } -#if JVET_Q0517_RPR_AFFINE_DS else if (nFilterIdx == 5) { filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_affineLumaFilterRPR1[frac], biMCForDMVR); @@ -774,7 +767,6 @@ void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, in { filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_affineLumaFilterRPR2[frac], biMCForDMVR); } -#endif else if( frac == 8 && useAltHpelIf ) { filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaAltHpelIFilter, biMCForDMVR ); @@ -850,7 +842,6 @@ void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, in { filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterRPR2[frac], biMCForDMVR ); } -#if JVET_Q0517_RPR_AFFINE_DS else if (nFilterIdx == 5) { filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_affineLumaFilterRPR1[frac], biMCForDMVR); @@ -859,7 +850,6 @@ void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, in { filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_affineLumaFilterRPR2[frac], biMCForDMVR); } -#endif else if( frac == 8 && useAltHpelIf ) { filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaAltHpelIFilter, biMCForDMVR ); @@ -892,103 +882,6 @@ void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, in } } -#if !JVET_Q0806 -void InterpolationFilter::xWeightedTriangleBlk( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -{ - Pel* dst = predDst .get(compIdx).buf; - Pel* src0 = predSrc0.get(compIdx).buf; - Pel* src1 = predSrc1.get(compIdx).buf; - int32_t strideDst = predDst .get(compIdx).stride - width; - int32_t strideSrc0 = predSrc0.get(compIdx).stride - width; - int32_t strideSrc1 = predSrc1.get(compIdx).stride - width; - - const char log2WeightBase = 3; - const ClpRng clipRng = pu.cu->slice->clpRngs().comp[compIdx]; - const int32_t clipbd = clipRng.bd; - const int32_t shiftDefault = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)); - const int32_t offsetDefault = (1<<(shiftDefault-1)) + IF_INTERNAL_OFFS; - const int32_t shiftWeighted = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)) + log2WeightBase; - const int32_t offsetWeighted = (1 << (shiftWeighted - 1)) + (IF_INTERNAL_OFFS << log2WeightBase); - int32_t stepX = 1 << getComponentScaleX(compIdx, pu.chromaFormat); - int32_t stepY = 1 << getComponentScaleY(compIdx, pu.chromaFormat); - - int32_t widthY = width << getComponentScaleX(compIdx, pu.chromaFormat); - int32_t heightY = height << getComponentScaleY(compIdx, pu.chromaFormat); - - int32_t ratioWH = (widthY > heightY) ? (widthY / heightY) : 1; - int32_t ratioHW = (widthY > heightY) ? 1 : (heightY / widthY); - - int32_t weightedLength = 7; - int32_t weightedStartPos = (splitDir == 0) ? (0 - (weightedLength >> 1) * ratioWH) : (widthY - ((weightedLength + 1) >> 1) * ratioWH); - int32_t weightedEndPos = weightedStartPos + weightedLength * ratioWH - 1; - int32_t weightedPosoffset = ( splitDir == 0 ) ? ratioWH : -ratioWH; - - Pel tmpPelWeighted; - int32_t weightIdx; - int32_t x, y, tmpX, tmpY, tmpWeightedStart, tmpWeightedEnd; - for (y = 0; y < heightY; y += ratioHW) - { - if (y % stepY != 0) - { - weightedStartPos += weightedPosoffset; - weightedEndPos += weightedPosoffset; - continue; - } - for (tmpY = ratioHW; tmpY > 0; tmpY -= stepY) - { - for (x = 0; x < weightedStartPos; x += stepX) - { - *dst++ = ClipPel( rightShift( (splitDir == 0 ? *src1 : *src0) + offsetDefault, shiftDefault), clipRng ); - src0++; - src1++; - } - - tmpWeightedStart = std::max((int32_t)0, weightedStartPos); - tmpWeightedEnd = std::min(weightedEndPos, (int32_t)(widthY - 1)); - weightIdx = 1; - if( weightedStartPos < 0 ) - { - weightIdx += abs(weightedStartPos) / ratioWH; - } - for( x = tmpWeightedStart; x <= tmpWeightedEnd; x+= ratioWH ) - { - if (x % stepX != 0) - { - weightIdx++; - continue; - } - - for (tmpX = ratioWH; tmpX > 0; tmpX -= stepX) - { - tmpPelWeighted = Clip3(1, 7, weightIdx); - tmpPelWeighted = splitDir ? ( 8 - tmpPelWeighted ) : tmpPelWeighted; - *dst++ = ClipPel( rightShift( (tmpPelWeighted*(*src0++) + ((8 - tmpPelWeighted) * (*src1++)) + offsetWeighted), shiftWeighted ), clipRng ); - } - weightIdx ++; - } - - int32_t start = ((weightedEndPos + 1) % stepX != 0) ? (weightedEndPos + 2) : (weightedEndPos + 1); - for (x = start; x < widthY; x += stepX) - { - *dst++ = ClipPel( rightShift( (splitDir == 0 ? *src0 : *src1) + offsetDefault, shiftDefault ), clipRng ); - src0++; - src1++; - } - - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - } - weightedStartPos += weightedPosoffset; - weightedEndPos += weightedPosoffset; - } -} - -void InterpolationFilter::weightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) -{ - m_weightedTriangleBlk(pu, width, height, compIdx, splitDir, predDst, predSrc0, predSrc1); -} -#else void InterpolationFilter::weightedGeoBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) { m_weightedGeoBlk(pu, width, height, compIdx, splitDir, predDst, predSrc0, predSrc1); @@ -1046,7 +939,6 @@ void InterpolationFilter::xWeightedGeoBlk(const PredictionUnit &pu, const uint32 weight += stepY; } } -#endif /** * \brief turn on SIMD fuc diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h index c166395af7ec59bb1e37dad27a2c3436d81e0a96..58a811c38de9c75975c2044e23d90bc07a197b9f 100644 --- a/source/Lib/CommonLib/InterpolationFilter.h +++ b/source/Lib/CommonLib/InterpolationFilter.h @@ -63,10 +63,8 @@ public: static const TFilterCoeff m_lumaFilterRPR2[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps 2x static const TFilterCoeff m_chromaFilterRPR1[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps 1.5x static const TFilterCoeff m_chromaFilterRPR2[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps 2x -#if JVET_Q0517_RPR_AFFINE_DS static const TFilterCoeff m_affineLumaFilterRPR1[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps 1.5x static const TFilterCoeff m_affineLumaFilterRPR2[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps 2x -#endif private: static const TFilterCoeff m_lumaAltHpelIFilter[NTAPS_LUMA]; ///< Luma filter taps static const TFilterCoeff m_bilinearFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps @@ -83,13 +81,8 @@ public: template<int N> void filterVer(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR); -#if !JVET_Q0806 - static void xWeightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); - void weightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#else static void xWeightedGeoBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); void weightedGeoBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif protected: #if JVET_J0090_MEMORY_BANDWITH_MEASURE static CacheModel* m_cacheModel; @@ -100,11 +93,7 @@ public: void( *m_filterHor[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); void( *m_filterVer[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); void( *m_filterCopy[2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool biMCForDMVR); -#if !JVET_Q0806 - void( *m_weightedTriangleBlk )(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#else void( *m_weightedGeoBlk )(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif void initInterpolationFilter( bool enable ); #ifdef TARGET_SIMD_X86 diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 3bb4c1b3924c5341522eaf47dd9a861d6e7712fb..faaf5d1ec286850a3b29b0ebfea6f61be12482af 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -365,11 +365,7 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA m_ipaParam.multiRefIndex = isLuma (chType) ? pu.multiRefIdx : 0 ; m_ipaParam.refFilterFlag = false; m_ipaParam.interpolationFlag = false; -#if JVET_Q0293_REMOVAL_PDPC_CHROMA_NX2 m_ipaParam.applyPDPC = (puSize.width >= MIN_TB_SIZEY && puSize.height >= MIN_TB_SIZEY) && m_ipaParam.multiRefIndex == 0; -#else - m_ipaParam.applyPDPC = ((puSize.width >= MIN_TB_SIZEY && puSize.height >= MIN_TB_SIZEY) || !isLuma(compId)) && m_ipaParam.multiRefIndex == 0; -#endif const int intraPredAngleMode = (m_ipaParam.isModeVer) ? predMode - VER_IDX : -(predMode - HOR_IDX); @@ -743,12 +739,10 @@ void IntraPrediction::geneIntrainterPred(const CodingUnit &cu) initIntraPatternChType(cu, pu->Y()); predIntraAng(COMPONENT_Y, cu.cs->getPredBuf(*pu).Y(), *pu); -#if JVET_Q0438_MONOCHROME_BUGFIXES int maxCompID = 1; if (isChromaEnabled(pu->chromaFormat)) { maxCompID = MAX_NUM_COMPONENT; -#endif if (pu->chromaSize().width > 2) { initIntraPatternChType(cu, pu->Cb()); @@ -757,7 +751,6 @@ void IntraPrediction::geneIntrainterPred(const CodingUnit &cu) initIntraPatternChType(cu, pu->Cr()); predIntraAng(COMPONENT_Cr, cu.cs->getPredBuf(*pu).Cr(), *pu); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } for (int currCompID = 0; currCompID < maxCompID; currCompID++) { @@ -765,12 +758,6 @@ void IntraPrediction::geneIntrainterPred(const CodingUnit &cu) { continue; } -#else - for (int currCompID = 0; currCompID < 3; currCompID++) - { - if (pu->chromaSize().width <= 2 && currCompID > 0) - continue; -#endif ComponentID currCompID2 = (ComponentID)currCompID; PelBuf tmpBuf = currCompID == 0 ? cu.cs->getPredBuf(*pu).Y() : (currCompID == 1 ? cu.cs->getPredBuf(*pu).Cb() : cu.cs->getPredBuf(*pu).Cr()); switchBuffer(*pu, currCompID2, tmpBuf, getPredictorPtr2(currCompID2, 0)); @@ -1422,9 +1409,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom bool isFirstRowOfCtu = ( lumaArea.y & ((pu.cs->sps)->getCTUSize() - 1) ) == 0; const int strOffset = (CHROMA_444 == pu.chromaFormat) ? 0 : iRecStride; -#if !JVET_Q0500_CCLM_REF_PADDING - int c0_2tap = 1, c1_2tap = 1, offset_2tap = 1, shift_2tap = 1; //sum = 2 -#endif int c0_3tap = 2, c1_3tap = 1, c2_3tap = 1, offset_3tap = 2, shift_3tap = 2; //sum = 4 int c0_5tap = 1, c1_5tap = 4, c2_5tap = 1, c3_5tap = 1, c4_5tap = 1, offset_5tap = 4, shift_5tap = 3; //sum = 8 int c0_6tap = 2, c1_6tap = 1, c2_6tap = 1, c3_6tap = 2, c4_6tap = 1, c5_6tap = 1, offset_6tap = 4, shift_6tap = 3; //sum = 8 @@ -1432,18 +1416,12 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom switch (pu.chromaFormat) { case CHROMA_422: //overwrite filter coefficient values for 422 -#if !JVET_Q0500_CCLM_REF_PADDING - c0_2tap = 1, c1_2tap = 0, offset_2tap = 0, shift_2tap = 0; //sum = 1 -#endif c0_3tap = 2, c1_3tap = 1, c2_3tap = 1, offset_3tap = 2, shift_3tap = 2; //sum = 4 c0_5tap = 0, c1_5tap = 1, c2_5tap = 0, c3_5tap = 0, c4_5tap = 0, offset_5tap = 0, shift_5tap = 0; //sum = 1 c0_6tap = 2, c1_6tap = 1, c2_6tap = 1, c3_6tap = 0, c4_6tap = 0, c5_6tap = 0, offset_6tap = 2, shift_6tap = 2; //sum = 4 break; case CHROMA_444: //overwrite filter coefficient values for 422 -#if !JVET_Q0500_CCLM_REF_PADDING - c0_2tap = 1, c1_2tap = 0, offset_2tap = 0, shift_2tap = 0; //sum = 1 -#endif c0_3tap = 1, c1_3tap = 0, c2_3tap = 0, offset_3tap = 0, shift_3tap = 0; //sum = 1 c0_5tap = 0, c1_5tap = 1, c2_5tap = 0, c3_5tap = 0, c4_5tap = 0, offset_5tap = 0, shift_5tap = 0; //sum = 1 c0_6tap = 1, c1_6tap = 0, c2_6tap = 0, c3_6tap = 0, c4_6tap = 0, c5_6tap = 0, offset_6tap = 0, shift_6tap = 0; //sum = 1 @@ -1469,11 +1447,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC)) { -#if JVET_Q0500_CCLM_REF_PADDING pDst[i] = (piSrc[mult * i] * c0_3tap + piSrc[mult * i] * c1_3tap + piSrc[mult * i + 1] * c2_3tap + offset_3tap) >> shift_3tap; -#else - pDst[i] = piSrc[mult * i]; -#endif } else { @@ -1486,14 +1460,10 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC)) { -#if JVET_Q0500_CCLM_REF_PADDING pDst[i] = (piSrc[mult * i - strOffset] * c0_5tap + piSrc[mult * i] * c1_5tap + piSrc[mult * i] * c2_5tap + piSrc[mult * i + 1] * c3_5tap + piSrc[mult * i + strOffset] * c4_5tap + offset_5tap) >> shift_5tap; -#else - pDst[i] = (piSrc[mult * i] * c0_3tap + piSrc[mult * i - strOffset] * c1_3tap + piSrc[mult * i + strOffset] * c2_3tap + offset_3tap) >> shift_3tap; -#endif } else { @@ -1509,13 +1479,9 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC)) { -#if JVET_Q0500_CCLM_REF_PADDING pDst[i] = ((piSrc[mult * i] * c0_6tap + piSrc[mult * i] * c1_6tap + piSrc[mult * i + 1] * c2_6tap) + (piSrc[mult * i + strOffset] * c3_6tap + piSrc[mult * i + strOffset] * c4_6tap + piSrc[mult * i + 1 + strOffset] * c5_6tap) + offset_6tap) >> shift_6tap; -#else - pDst[i] = (piSrc[mult * i] * c0_2tap + piSrc[mult * i + strOffset] * c1_2tap + offset_2tap) >> shift_2tap; -#endif } else { @@ -1545,14 +1511,10 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { if ((j == 0 && !bAboveAvaillable) || (j == uiCHeight + addedLeftBelow - 1 + logSubWidthC)) { -#if JVET_Q0500_CCLM_REF_PADDING pDst[0] = ( piSrc[1 ] * c0_5tap + piSrc[1 ] * c1_5tap + piSrc[0] * c2_5tap + piSrc[2] * c3_5tap + piSrc[1 + strOffset] * c4_5tap + offset_5tap ) >> shift_5tap; -#else - pDst[0] = ( piSrc[1] * c0_3tap + piSrc[0] * c1_3tap + piSrc[2] * c2_3tap + offset_3tap) >> shift_3tap; -#endif } else { @@ -1585,37 +1547,25 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { if ( j == 0 && !bAboveAvaillable ) { -#if JVET_Q0500_CCLM_REF_PADDING pDst0[i] = (pRecSrc0[mult * i] * c0_5tap + pRecSrc0[mult * i] * c1_5tap + pRecSrc0[mult * i] * c2_5tap + pRecSrc0[mult * i + 1] * c3_5tap + pRecSrc0[mult * i + strOffset] * c4_5tap + offset_5tap) >> shift_5tap; -#else - pDst0[i] = pRecSrc0[mult * i]; -#endif } else { -#if JVET_Q0500_CCLM_REF_PADDING pDst0[i] = (pRecSrc0[mult * i - strOffset] * c0_5tap + pRecSrc0[mult * i] * c1_5tap + pRecSrc0[mult * i] * c2_5tap + pRecSrc0[mult * i + 1] * c3_5tap + pRecSrc0[mult * i + strOffset] * c4_5tap + offset_5tap) >> shift_5tap; -#else - pDst0[i] = (pRecSrc0[mult * i] * c0_3tap + pRecSrc0[mult * i - strOffset] * c1_3tap + pRecSrc0[mult * i + strOffset] * c2_3tap + offset_3tap) >> shift_3tap; -#endif } } else if ( j == 0 && !bAboveAvaillable ) { -#if JVET_Q0500_CCLM_REF_PADDING pDst0[i] = (pRecSrc0[mult * i] * c0_5tap + pRecSrc0[mult * i] * c1_5tap + pRecSrc0[mult * i - 1] * c2_5tap + pRecSrc0[mult * i + 1] * c3_5tap + pRecSrc0[mult * i + strOffset] * c4_5tap + offset_5tap) >> shift_5tap; -#else - pDst0[i] = (pRecSrc0[mult * i] * c0_3tap + pRecSrc0[mult * i - 1] * c1_3tap + pRecSrc0[mult * i + 1] * c2_3tap + offset_3tap) >> shift_3tap; -#endif } else { @@ -1630,7 +1580,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth - 1 + logSubWidthC)) { -#if JVET_Q0500_CCLM_REF_PADDING int s = offset_6tap; s += pRecSrc0[mult * i] * c0_6tap; s += pRecSrc0[mult * i + 1] * c1_6tap; @@ -1642,9 +1591,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom s += pRecSrc0[mult * i + strOffset] * c5_6tap; } pDst0[i] = s >> shift_6tap; -#else - pDst0[i] = (pRecSrc0[mult * i] * c0_2tap + pRecSrc0[mult * i + strOffset] * c1_2tap + offset_2tap) >> shift_2tap; -#endif } else { @@ -1943,10 +1889,8 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, for (curidx = 0; curidx < cu.curPLTSize[compBegin]; curidx++) { -#if JVET_Q0504_PLT_NON444 if( curPLTpred[curidx] ) continue; -#endif bool matchTmp = true; for (int comp = compBegin; comp < (compBegin + numComp); comp++) { @@ -1963,7 +1907,6 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, { cu.reuseflag[compBegin][predidx] = true; curPLTpred[curidx] = true; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) { cu.reuseflag[COMPONENT_Y][predidx] = true; @@ -1974,14 +1917,11 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, } else { -#endif for (int comp = compBegin; comp < (compBegin + numComp); comp++) { curPLTtmp[comp][reusePLTSizetmp] = cs.prevPLT.curPLT[comp][predidx]; } -#if JVET_Q0504_PLT_NON444 } -#endif reusePLTSizetmp++; pltSizetmp++; } @@ -1991,7 +1931,6 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, { if (!curPLTpred[curidx]) { -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) { for( int comp = compBegin; comp < (compBegin + numComp); comp++ ) @@ -2010,21 +1949,17 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, } else { -#endif for (int comp = compBegin; comp < (compBegin + numComp); comp++) { curPLTtmp[comp][pltSizetmp] = cu.curPLT[comp][curidx]; } -#if JVET_Q0504_PLT_NON444 } -#endif pltSizetmp++; } } assert(pltSizetmp == cu.curPLTSize[compBegin]); for (int curidx = 0; curidx < cu.curPLTSize[compBegin]; curidx++) { -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) { for( int comp = COMPONENT_Y; comp < MAX_NUM_COMPONENT; comp++ ) @@ -2034,14 +1969,11 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, } else { -#endif for (int comp = compBegin; comp < (compBegin + numComp); comp++) { cu.curPLT[comp][curidx] = curPLTtmp[comp][curidx]; } -#if JVET_Q0504_PLT_NON444 } -#endif } } //! \} diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 97335e5e3d238344423b98b98e1462f0322c4542..ac007d78db692098770e1080bbb31eda6d2dd28b 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -81,30 +81,14 @@ inline static uint32_t getRasterIdx(const Position& pos, const PreCalcValues& pc // ==================================================================================================================== // utility functions // ==================================================================================================================== -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY static bool isAvailableLeft( const CodingUnit& cu, const CodingUnit& cu2, const bool bEnforceSliceRestriction, const bool bEnforceTileRestriction, const bool bEnforceSubPicRestriction) -#else -static bool isAvailableLeft( const CodingUnit& cu, const CodingUnit& cu2, const bool bEnforceSliceRestriction, const bool bEnforceTileRestriction) -#endif { -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY return ((!bEnforceSliceRestriction || CU::isSameSlice(cu, cu2)) && (!bEnforceTileRestriction || CU::isSameTile(cu, cu2)) && (!bEnforceSubPicRestriction || CU::isSameSubPic(cu, cu2))); -#else - return ((!bEnforceSliceRestriction || CU::isSameSlice(cu, cu2)) && (!bEnforceTileRestriction || CU::isSameTile(cu, cu2))); -#endif } -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY static bool isAvailableAbove( const CodingUnit& cu, const CodingUnit& cu2, const bool bEnforceSliceRestriction, const bool bEnforceTileRestriction, const bool bEnforceSubPicRestriction) -#else -static bool isAvailableAbove( const CodingUnit& cu, const CodingUnit& cu2, const bool bEnforceSliceRestriction, const bool bEnforceTileRestriction) -#endif { -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY return ( !bEnforceSliceRestriction || CU::isSameSlice( cu, cu2 ) ) && ( !bEnforceTileRestriction || CU::isSameTile( cu, cu2 ) ) && (!bEnforceSubPicRestriction || CU::isSameSubPic(cu, cu2)); -#else - return ( !bEnforceSliceRestriction || CU::isSameSlice( cu, cu2 ) ) && ( !bEnforceTileRestriction || CU::isSameTile( cu, cu2 ) ) ; -#endif } @@ -450,11 +434,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) xEdgeFilterLuma( cu, edgeDir, edge ); } -#if JVET_Q0438_MONOCHROME_BUGFIXES if ( pcv.chrFormat != CHROMA_400 && cu.blocks[COMPONENT_Cb].valid() ) -#else - if ( cu.blocks[COMPONENT_Cb].valid() && pcv.chrFormat != CHROMA_400 ) -#endif { if ( !cu.ispMode || edge == 0 ) { @@ -467,13 +447,8 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) inline bool LoopFilter::isCrossedByVirtualBoundaries(const int xPos, const int yPos, const int width, const int height, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PicHeader* picHeader ) { numHorVirBndry = 0; numVerVirBndry = 0; -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG if( picHeader->getVirtualBoundariesPresentFlag() ) { -#else - if (picHeader->getLoopFilterAcrossVirtualBoundariesDisabledFlag()) - { -#endif for (int i = 0; i < picHeader->getNumHorVirtualBoundaries(); i++) { if (yPos <= picHeader->getVirtualBoundariesPosY(i) && picHeader->getVirtualBoundariesPosY(i) < yPos + height) @@ -519,11 +494,7 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e if ( edgeDir == EDGE_HOR ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES for ( int cIdx = 0; cIdx < ::getNumberValidComponents(tuQ.chromaFormat); cIdx++ ) // per component -#else - for ( int cIdx = 0; cIdx < MAX_NUM_COMPONENT; cIdx++ ) // per component -#endif { const ComponentID comp = ComponentID(cIdx); const ChannelType ch = toChannelType(comp); @@ -568,11 +539,7 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e } if ( edgeDir == EDGE_VER ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES for ( int cIdx = 0; cIdx < ::getNumberValidComponents(tuQ.chromaFormat); cIdx++ ) // per component -#else - for ( int cIdx = 0; cIdx < MAX_NUM_COMPONENT; cIdx++ ) // per component -#endif { const ComponentID comp = ComponentID(cIdx); const ChannelType ch = toChannelType(comp); @@ -738,24 +705,10 @@ void LoopFilter::xSetLoopfilterParam( const CodingUnit& cu ) m_stLFCUParam.internalEdge = true; -#if JVET_Q0371_DEBLOCKING_CLEANUP m_stLFCUParam.leftEdge = (0 < pos.x) && isAvailableLeft(cu, *cu.cs->getCU(pos.offset(-1, 0), cu.chType), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(*cu.cs->getCU(pos.offset(-1, 0), cu.chType)).getloopFilterAcrossEnabledFlag())); m_stLFCUParam.topEdge = (0 < pos.y) && isAvailableAbove(cu, *cu.cs->getCU(pos.offset(0, -1), cu.chType), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(*cu.cs->getCU(pos.offset(0, -1), cu.chType)).getloopFilterAcrossEnabledFlag())); -#else -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY - m_stLFCUParam.leftEdge = ( 0 < pos.x ) && isAvailableLeft ( cu, *cu.cs->getCU( pos.offset( -1, 0 ), cu.chType ), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() ); -#else - m_stLFCUParam.leftEdge = ( 0 < pos.x ) && isAvailableLeft ( cu, *cu.cs->getCU( pos.offset( -1, 0 ), cu.chType ), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag()); -#endif - -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY - m_stLFCUParam.topEdge = ( 0 < pos.y ) && isAvailableAbove( cu, *cu.cs->getCU( pos.offset( 0, -1 ), cu.chType ), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() ); -#else - m_stLFCUParam.topEdge = ( 0 < pos.y ) && isAvailableAbove( cu, *cu.cs->getCU( pos.offset( 0, -1 ), cu.chType ), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag()); -#endif -#endif } unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const Position& localPos, const ChannelType chType ) const @@ -821,10 +774,8 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De } else { -#if JVET_Q0438_MONOCHROME_BUGFIXES if (pcv.chrFormat != CHROMA_400) { -#endif // U if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cb) || TU::getCbf(tuP, COMPONENT_Cb) || tuQ.jointCbCr || tuP.jointCbCr)) { @@ -835,9 +786,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De { tmpBs += BsSet(1, COMPONENT_Cr); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif } if (BsGet(tmpBs, COMPONENT_Y) == 1) { @@ -1036,16 +985,8 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg // Derive neighboring PU index if (edgeDir == EDGE_VER) { -#if JVET_Q0371_DEBLOCKING_CLEANUP if (!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag()))) -#else -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY - if (!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag())) -#else - if (!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag())) -#endif -#endif { m_aapucBS[edgeDir][uiBsAbsIdx] = uiBs = 0; continue; @@ -1053,16 +994,8 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg } else // (iDir == EDGE_HOR) { -#if JVET_Q0371_DEBLOCKING_CLEANUP if (!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag()))) -#else -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY - if (!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag())) -#else - if (!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag())) -#endif -#endif { m_aapucBS[edgeDir][uiBsAbsIdx] = uiBs = 0; continue; @@ -1245,13 +1178,8 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed bool bPartPNoFilter = false; bool bPartQNoFilter = false; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS const int tcOffsetDiv2[2] = { slice.getDeblockingFilterCbTcOffsetDiv2(), slice.getDeblockingFilterCrTcOffsetDiv2() }; const int betaOffsetDiv2[2] = { slice.getDeblockingFilterCbBetaOffsetDiv2(), slice.getDeblockingFilterCrBetaOffsetDiv2() }; -#else - const int tcOffsetDiv2 = slice.getDeblockingFilterTcOffsetDiv2(); - const int betaOffsetDiv2 = slice.getDeblockingFilterBetaOffsetDiv2(); -#endif // Vertical Position unsigned uiEdgeNumInCtuVert = rasterIdx % pcv.partsInCtuWidth + iEdge; @@ -1322,29 +1250,13 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed if (edgeDir == EDGE_VER) { -#if JVET_Q0371_DEBLOCKING_CLEANUP CHECK(!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag())), "Neighbour not available"); -#else -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY - CHECK(!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag()), "Neighbour not available"); -#else - CHECK(!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag()), "Neighbour not available"); -#endif -#endif } else // (iDir == EDGE_HOR) { -#if JVET_Q0371_DEBLOCKING_CLEANUP CHECK(!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag())), "Neighbour not available"); -#else -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY - CHECK(!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), !pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag()), "Neighbour not available"); -#else - CHECK(!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag()), "Neighbour not available"); -#endif -#endif } bPartPNoFilter = bPartQNoFilter = false; @@ -1379,33 +1291,20 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed const TransformUnit& tuQ = *cuQ.cs->getTU(recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, CHANNEL_TYPE_CHROMA, pos), CHANNEL_TYPE_CHROMA); const TransformUnit& tuP = *cuP.cs->getTU(recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, CHANNEL_TYPE_CHROMA, (edgeDir == EDGE_VER) ? pos.offset(-1, 0) : pos.offset(0, -1)), CHANNEL_TYPE_CHROMA); -#if JVET_Q0820_ACT const QpParam cQP(tuP, ComponentID(chromaIdx + 1), -MAX_INT, false); const QpParam cQQ(tuQ, ComponentID(chromaIdx + 1), -MAX_INT, false); -#else - const QpParam cQP(tuP, ComponentID(chromaIdx + 1)); - const QpParam cQQ(tuQ, ComponentID(chromaIdx + 1)); -#endif const int qpBdOffset = tuP.cs->sps->getQpBDOffset(toChannelType(ComponentID(chromaIdx + 1))); int baseQp_P = cQP.Qp(0) - qpBdOffset; int baseQp_Q = cQQ.Qp(0) - qpBdOffset; int iQP = ((baseQp_Q + baseQp_P + 1) >> 1); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS const int iIndexTC = Clip3<int>(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (bS[chromaIdx] - 1) + (tcOffsetDiv2[chromaIdx] << 1)); -#else - const int iIndexTC = Clip3<int>(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (bS[chromaIdx] - 1) + (tcOffsetDiv2 << 1)); -#endif const int iTc = sps.getBitDepth(CHANNEL_TYPE_CHROMA) < 10 ? ((sm_tcTable[iIndexTC] + 2) >> (10 - sps.getBitDepth(CHANNEL_TYPE_CHROMA))) : ((sm_tcTable[iIndexTC]) << (sps.getBitDepth(CHANNEL_TYPE_CHROMA) - 10)); bool useLongFilter = false; if (largeBoundary) { -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS const int indexB = Clip3<int>(0, MAX_QP, iQP + (betaOffsetDiv2[chromaIdx] << 1)); -#else - const int indexB = Clip3<int>(0, MAX_QP, iQP + (betaOffsetDiv2 << 1)); -#endif const int beta = sm_betaTable[indexB] * iBitdepthScale; const int dp0 = xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset, isChromaHorCTBBoundary); @@ -1742,7 +1641,6 @@ inline bool LoopFilter::xUseStrongFiltering(Pel* piSrc, const int iOffset, const { Pel mP4; Pel m11; -#if JVET_Q0054 if (sidePisLarge) { if (maxFilterLengthP == 7) @@ -1776,34 +1674,6 @@ inline bool LoopFilter::xUseStrongFiltering(Pel* piSrc, const int iOffset, const sq3 = (sq3 + abs(m11 - m7) + 1) >> 1; } return ((sp3 + sq3) < (beta*3 >> 5)) && (d < (beta >> 4)) && (abs(m3 - m4) < ((tc * 5 + 1) >> 1)); -#else - if (maxFilterLengthP == 5) - { - mP4 = piSrc[-iOffset * 6]; - } - else - { - mP4 = piSrc[-iOffset * 8]; - } - if (maxFilterLengthQ == 5) - { - m11 = piSrc[iOffset * 5]; - } - else - { - m11 = piSrc[iOffset * 7]; - } - - if (sidePisLarge) - { - sp3 = (sp3 + abs(m0 - mP4) + 1) >> 1; - } - if (sideQisLarge) - { - sq3 = (sq3 + abs(m11 - m7) + 1) >> 1; - } - return ((sp3 + sq3) < (beta*3 >> 5)) && (d < (beta >> 2)) && (abs(m3 - m4) < ((tc * 5 + 1) >> 1)); -#endif } else return ( ( d_strong < ( beta >> 3 ) ) && ( d < ( beta >> 2 ) ) && ( abs( m3 - m4 ) < ( ( tc * 5 + 1 ) >> 1 ) ) ); diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.cpp b/source/Lib/CommonLib/MatrixIntraPrediction.cpp index af6adae25633456c844c2b326f7b96c4badb8d7d..45165a7cc44d3f426886494bb9e9d886d375be7f 100644 --- a/source/Lib/CommonLib/MatrixIntraPrediction.cpp +++ b/source/Lib/CommonLib/MatrixIntraPrediction.cpp @@ -105,13 +105,8 @@ void MatrixIntraPrediction::prepareInputForPred(const CPelBuf &pSrc, const Area& m_inputOffsetTransp = m_reducedBoundaryTransposed[0]; const bool hasFirstCol = (m_sizeId < 2); -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET m_reducedBoundary [0] = hasFirstCol ? ((1 << (bitDepth - 1)) - m_inputOffset ) : 0; // first column of matrix not needed for large blocks m_reducedBoundaryTransposed[0] = hasFirstCol ? ((1 << (bitDepth - 1)) - m_inputOffsetTransp) : 0; -#else - m_reducedBoundary [0] = hasFirstCol ? (m_inputOffset - (1 << (bitDepth - 1))) : 0; // first column of matrix not needed for large blocks - m_reducedBoundaryTransposed[0] = hasFirstCol ? (m_inputOffsetTransp - (1 << (bitDepth - 1))) : 0; -#endif for (int i = 1; i < inputSize; i++) { m_reducedBoundary [i] -= m_inputOffset; @@ -123,22 +118,12 @@ void MatrixIntraPrediction::predBlock(int* const result, const int modeIdx, cons { const bool needUpsampling = ( m_upsmpFactorHor > 1 ) || ( m_upsmpFactorVer > 1 ); -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET const uint8_t* matrix = getMatrixData(modeIdx); -#else - const uint8_t* matrix; - int shiftMatrix = 0, offsetMatrix = 0; - getMatrixData(matrix, shiftMatrix, offsetMatrix, modeIdx); -#endif static_vector<int, MIP_MAX_REDUCED_OUTPUT_SAMPLES> bufReducedPred( m_reducedPredSize * m_reducedPredSize ); int* const reducedPred = needUpsampling ? bufReducedPred.data() : result; const int* const reducedBoundary = transpose ? m_reducedBoundaryTransposed.data() : m_reducedBoundary.data(); -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET computeReducedPred(reducedPred, reducedBoundary, matrix, transpose, bitDepth); -#else - computeReducedPred( reducedPred, reducedBoundary, matrix, shiftMatrix, offsetMatrix, transpose, bitDepth ); -#endif if( needUpsampling ) { predictionUpsampling( result, reducedPred ); @@ -275,47 +260,22 @@ void MatrixIntraPrediction::predictionUpsampling( int* const dst, const int* con } } -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET const uint8_t* MatrixIntraPrediction::getMatrixData(const int modeIdx) const -#else -void MatrixIntraPrediction::getMatrixData(const uint8_t*& matrix, int &shiftMatrix, int &offsetMatrix, const int modeIdx) const -#endif { switch( m_sizeId ) { -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET case 0: return &mipMatrix4x4[modeIdx][0][0]; case 1: return &mipMatrix8x8[modeIdx][0][0]; case 2: return &mipMatrix16x16[modeIdx][0][0]; -#else - case 0: matrix = &mipMatrix4x4 [modeIdx][0][0]; - shiftMatrix = mipShiftMatrix4x4 [modeIdx]; - offsetMatrix = mipOffsetMatrix4x4[modeIdx]; - break; - - case 1: matrix = &mipMatrix8x8 [modeIdx][0][0]; - shiftMatrix = mipShiftMatrix8x8 [modeIdx]; - offsetMatrix = mipOffsetMatrix8x8[modeIdx]; - break; - - case 2: matrix = &mipMatrix16x16 [modeIdx][0][0]; - shiftMatrix = mipShiftMatrix16x16 [modeIdx]; - offsetMatrix = mipOffsetMatrix16x16[modeIdx]; - break; -#endif default: THROW( "Invalid mipSizeId" ); } } void MatrixIntraPrediction::computeReducedPred( int*const result, const int* const input, -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET const uint8_t* matrix, -#else - const uint8_t*matrix, const int shiftMatrix, const int offsetMatrix, -#endif const bool transpose, const int bitDepth ) { const int inputSize = 2 * m_reducedBdrySize; @@ -326,11 +286,7 @@ void MatrixIntraPrediction::computeReducedPred( int*const result, const int* con int sum = 0; for( int i = 0; i < inputSize; i++ ) { sum += input[i]; } -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET const int offset = (1 << (MIP_SHIFT_MATRIX - 1)) - MIP_OFFSET_MATRIX * sum; -#else - const int offset = (1 << (shiftMatrix - 1)) - offsetMatrix * sum; -#endif CHECK( inputSize != 4 * (inputSize >> 2), "Error, input size not divisible by four" ); const uint8_t *weight = matrix; @@ -354,11 +310,7 @@ void MatrixIntraPrediction::computeReducedPred( int*const result, const int* con tmp2 += input[i + 2] * weight[i + 2]; tmp3 += input[i + 3] * weight[i + 3]; } -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET resPtr[posRes++] = ClipBD<int>(((tmp0 + tmp1 + tmp2 + tmp3 + offset) >> MIP_SHIFT_MATRIX) + inputOffset, bitDepth); -#else - resPtr[posRes++] = ClipBD<int>( ((tmp0 + tmp1 + tmp2 + tmp3 + offset) >> shiftMatrix) + inputOffset, bitDepth ); -#endif weight += inputSize; } diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.h b/source/Lib/CommonLib/MatrixIntraPrediction.h index 2452150d3f6fa46c020f2fd704e64554292cbf1c..12b26eac24fdae1b42f1e823f6b9f69525cafb58 100644 --- a/source/Lib/CommonLib/MatrixIntraPrediction.h +++ b/source/Lib/CommonLib/MatrixIntraPrediction.h @@ -80,19 +80,11 @@ public: const SizeType bndryStep, const unsigned int upsmpFactor ); -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET const uint8_t* getMatrixData(const int modeIdx) const; -#else - void getMatrixData(const uint8_t*& matrix, int &shiftMatrix, int &offsetMatrix, const int modeIdx) const; -#endif void computeReducedPred( int*const result, const int* const input, -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET const uint8_t* matrix, -#else - const uint8_t*matrix, const int shiftMatrix, const int offsetMatrix, -#endif const bool transpose, const int bitDepth ); }; diff --git a/source/Lib/CommonLib/MipData.h b/source/Lib/CommonLib/MipData.h index 7200a9f85234c563ecd95bdb1de60e1d6d203656..bc7ea3e6222c9254e9c5ddd1ef900d13c814bca0 100644 --- a/source/Lib/CommonLib/MipData.h +++ b/source/Lib/CommonLib/MipData.h @@ -35,7 +35,6 @@ \brief weight and bias data for matrix-based intra prediction (MIP) */ -#if JVET_Q0446_MIP_CONST_SHIFT_OFFSET static const uint8_t MIP_SHIFT_MATRIX = 6; static const uint8_t MIP_OFFSET_MATRIX = 32; @@ -878,862 +877,3 @@ ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipMatrix16x16[6][64][7]) = { 62, 49, 35, 33, 34, 34, 33} } }; -#else -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipMatrix4x4[16][16][4]) = -{ - { - { 5, 16, 51, 2}, - { 5, 22, 18, 36}, - { 5, 15, 5, 55}, - { 5, 10, 6, 59}, - { 4, 6, 12, 59}, - { 5, 3, 4, 66}, - { 7, 0, 5, 67}, - { 8, 1, 7, 65}, - { 6, 2, 3, 67}, - { 7, 1, 5, 66}, - { 9, 1, 6, 66}, - { 10, 2, 6, 66}, - { 7, 3, 5, 64}, - { 9, 2, 6, 64}, - { 10, 2, 6, 65}, - { 10, 3, 7, 64} - }, - { - { 28, 27, 58, 26}, - { 28, 27, 52, 27}, - { 29, 39, 43, 28}, - { 28, 70, 38, 27}, - { 28, 28, 61, 28}, - { 28, 27, 62, 26}, - { 29, 30, 60, 25}, - { 25, 61, 49, 23}, - { 29, 28, 35, 54}, - { 29, 28, 42, 47}, - { 28, 26, 50, 36}, - { 16, 42, 46, 19}, - { 28, 28, 23, 64}, - { 29, 28, 24, 64}, - { 25, 24, 23, 58}, - { 0, 19, 21, 31} - }, - { - { 28, 27, 39, 26}, - { 29, 32, 29, 27}, - { 29, 60, 31, 27}, - { 27, 68, 31, 26}, - { 28, 27, 51, 27}, - { 28, 39, 39, 26}, - { 26, 64, 33, 28}, - { 21, 64, 27, 35}, - { 27, 28, 38, 50}, - { 19, 44, 31, 51}, - { 10, 57, 22, 54}, - { 7, 53, 16, 58}, - { 19, 31, 12, 72}, - { 6, 47, 14, 64}, - { 0, 50, 15, 60}, - { 2, 48, 15, 60} - }, - { - { 42, 40, 64, 45}, - { 43, 41, 44, 52}, - { 43, 67, 34, 49}, - { 41, 76, 38, 45}, - { 42, 41, 50, 67}, - { 41, 39, 42, 71}, - { 38, 52, 33, 63}, - { 31, 70, 31, 47}, - { 40, 41, 39, 76}, - { 31, 36, 38, 74}, - { 17, 30, 35, 69}, - { 9, 47, 30, 50}, - { 32, 37, 37, 75}, - { 15, 29, 36, 68}, - { 3, 22, 37, 62}, - { 0, 26, 38, 52} - }, - { - { 57, 53, 73, 55}, - { 58, 75, 61, 55}, - { 55, 91, 53, 63}, - { 45, 87, 43, 74}, - { 58, 60, 80, 63}, - { 51, 71, 62, 73}, - { 30, 65, 48, 77}, - { 14, 50, 47, 73}, - { 50, 56, 53, 89}, - { 20, 43, 50, 77}, - { 2, 32, 53, 67}, - { 2, 30, 54, 65}, - { 26, 41, 47, 82}, - { 2, 28, 53, 65}, - { 0, 27, 55, 63}, - { 3, 29, 55, 64} - }, - { - { 23, 19, 88, 8}, - { 23, 44, 61, 25}, - { 22, 64, 24, 52}, - { 21, 56, 0, 71}, - { 21, 25, 53, 61}, - { 20, 26, 31, 80}, - { 20, 22, 21, 88}, - { 19, 20, 17, 88}, - { 20, 22, 19, 89}, - { 19, 21, 19, 89}, - { 18, 20, 20, 88}, - { 17, 19, 20, 86}, - { 19, 20, 20, 87}, - { 18, 21, 21, 86}, - { 16, 21, 21, 85}, - { 13, 19, 21, 83} - }, - { - { 9, 0, 11, 6}, - { 9, 19, 11, 8}, - { 9, 70, 11, 8}, - { 9, 76, 12, 8}, - { 9, 0, 12, 6}, - { 9, 19, 11, 7}, - { 9, 70, 11, 9}, - { 9, 76, 12, 9}, - { 9, 0, 12, 6}, - { 9, 20, 12, 7}, - { 9, 70, 12, 9}, - { 9, 75, 12, 9}, - { 9, 1, 11, 8}, - { 9, 20, 12, 8}, - { 9, 70, 12, 8}, - { 9, 75, 11, 9} - }, - { - { 6, 3, 61, 7}, - { 7, 0, 34, 7}, - { 7, 13, 5, 6}, - { 6, 56, 1, 4}, - { 6, 7, 74, 5}, - { 6, 4, 70, 6}, - { 6, 0, 51, 6}, - { 6, 8, 19, 5}, - { 7, 7, 55, 23}, - { 7, 7, 71, 8}, - { 6, 5, 74, 5}, - { 6, 3, 59, 7}, - { 5, 5, 3, 74}, - { 6, 6, 36, 41}, - { 7, 7, 62, 15}, - { 6, 7, 66, 10} - }, - { - { 35, 26, 78, 28}, - { 34, 39, 35, 33}, - { 34, 96, 32, 35}, - { 35, 102, 35, 35}, - { 31, 30, 107, 25}, - { 29, 34, 66, 24}, - { 31, 93, 32, 31}, - { 35, 101, 34, 35}, - { 31, 31, 64, 72}, - { 19, 28, 86, 30}, - { 18, 85, 47, 20}, - { 31, 99, 34, 33}, - { 32, 32, 27, 106}, - { 12, 26, 52, 71}, - { 0, 72, 60, 19}, - { 20, 93, 37, 26} - }, - { - { 10, 6, 60, 0}, - { 7, 14, 39, 4}, - { 4, 65, 21, 11}, - { 1, 80, 12, 16}, - { 10, 11, 52, 46}, - { 6, 9, 36, 57}, - { 2, 18, 20, 65}, - { 0, 23, 11, 65}, - { 13, 13, 13, 80}, - { 12, 13, 12, 80}, - { 12, 12, 13, 80}, - { 11, 12, 14, 79}, - { 15, 14, 12, 79}, - { 15, 14, 13, 79}, - { 16, 16, 15, 78}, - { 16, 16, 17, 76} - }, - { - { 50, 48, 85, 42}, - { 47, 44, 59, 44}, - { 43, 52, 51, 43}, - { 14, 107, 51, 29}, - { 51, 49, 92, 77}, - { 47, 44, 70, 81}, - { 35, 32, 47, 79}, - { 0, 47, 35, 60}, - { 50, 49, 49, 116}, - { 49, 47, 49, 117}, - { 45, 41, 49, 115}, - { 30, 32, 47, 106}, - { 50, 49, 46, 117}, - { 49, 49, 48, 115}, - { 50, 48, 49, 115}, - { 47, 45, 50, 113} - }, - { - { 67, 65, 96, 61}, - { 66, 65, 90, 62}, - { 68, 83, 79, 64}, - { 59, 102, 70, 61}, - { 67, 67, 93, 74}, - { 68, 67, 93, 74}, - { 64, 75, 88, 69}, - { 30, 85, 69, 49}, - { 67, 67, 68, 97}, - { 68, 67, 68, 98}, - { 43, 60, 69, 80}, - { 4, 68, 65, 40}, - { 66, 66, 63, 101}, - { 62, 63, 62, 99}, - { 22, 49, 60, 76}, - { 0, 65, 64, 41} - }, - { - { 27, 18, 53, 22}, - { 26, 35, 22, 28}, - { 27, 90, 27, 27}, - { 28, 97, 29, 28}, - { 22, 19, 80, 29}, - { 15, 24, 42, 22}, - { 17, 72, 27, 20}, - { 22, 89, 28, 23}, - { 19, 22, 40, 82}, - { 6, 13, 36, 68}, - { 0, 19, 14, 53}, - { 8, 33, 10, 38}, - { 22, 26, 24, 95}, - { 13, 19, 25, 91}, - { 6, 14, 22, 87}, - { 4, 14, 13, 79} - }, - { - { 50, 48, 80, 49}, - { 50, 45, 73, 49}, - { 50, 48, 62, 49}, - { 49, 61, 54, 48}, - { 50, 50, 84, 48}, - { 50, 49, 84, 48}, - { 50, 48, 82, 49}, - { 50, 47, 76, 49}, - { 50, 50, 69, 64}, - { 51, 50, 77, 56}, - { 48, 48, 82, 50}, - { 37, 43, 81, 45}, - { 49, 48, 44, 87}, - { 40, 43, 50, 78}, - { 17, 32, 58, 58}, - { 0, 27, 64, 44} - }, - { - { 29, 26, 37, 36}, - { 24, 42, 16, 40}, - { 25, 62, 35, 28}, - { 28, 54, 51, 22}, - { 24, 29, 22, 52}, - { 9, 44, 21, 31}, - { 16, 50, 54, 14}, - { 27, 40, 65, 19}, - { 17, 36, 21, 49}, - { 0, 40, 41, 10}, - { 15, 37, 65, 9}, - { 28, 34, 66, 21}, - { 16, 41, 36, 33}, - { 6, 37, 54, 3}, - { 19, 32, 64, 12}, - { 28, 33, 62, 24} - }, - { - { 19, 20, 50, 19}, - { 19, 21, 49, 20}, - { 19, 27, 47, 19}, - { 19, 34, 43, 19}, - { 19, 22, 54, 18}, - { 19, 22, 55, 18}, - { 19, 22, 55, 18}, - { 19, 22, 53, 18}, - { 21, 22, 45, 27}, - { 19, 22, 47, 24}, - { 18, 21, 48, 23}, - { 18, 21, 47, 24}, - { 9, 14, 2, 65}, - { 3, 12, 2, 62}, - { 0, 11, 4, 59}, - { 0, 12, 6, 57} - } -}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipOffsetMatrix4x4[16]) = -{ 1, 28, 28, 42, 56, 22, 9, 6, 35, 14, 50, 66, 29, 50, 31, 19}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipShiftMatrix4x4[16]) = -{ 6, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 5, 6, 5, 5, 5}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipMatrix8x8[8][16][8]) = -{ - { - { 18, 77, 44, 26, 0, 17, 18, 19}, - { 19, 70, 83, 26, 16, 13, 16, 17}, - { 20, 40, 98, 36, 16, 16, 15, 16}, - { 20, 29, 75, 68, 15, 17, 16, 16}, - { 19, 82, 61, 29, 14, 10, 12, 22}, - { 21, 59, 88, 30, 17, 13, 14, 17}, - { 23, 46, 93, 36, 16, 17, 14, 16}, - { 23, 33, 96, 43, 16, 18, 15, 17}, - { 19, 82, 64, 30, 16, 17, 8, 17}, - { 22, 61, 89, 29, 17, 17, 12, 15}, - { 24, 44, 94, 38, 17, 17, 15, 16}, - { 25, 34, 90, 47, 16, 19, 15, 17}, - { 19, 77, 61, 30, 15, 17, 20, 10}, - { 22, 63, 83, 30, 17, 16, 18, 10}, - { 24, 44, 89, 39, 17, 18, 16, 16}, - { 24, 35, 82, 50, 16, 19, 16, 17} - }, - { - { 14, 15, 10, 12, 99, 11, 12, 13}, - { 12, 61, 6, 9, 32, 8, 14, 13}, - { 12, 104, 54, 2, 9, 17, 11, 14}, - { 12, 24, 110, 33, 11, 18, 10, 14}, - { 14, 14, 15, 11, 69, 102, 6, 12}, - { 13, 13, 11, 10, 105, 30, 5, 14}, - { 12, 45, 6, 8, 55, 5, 13, 12}, - { 12, 72, 38, 6, 18, 14, 12, 13}, - { 14, 12, 18, 10, 2, 77, 102, 3}, - { 13, 12, 19, 8, 41, 122, 22, 7}, - { 13, 4, 18, 8, 97, 60, 0, 13}, - { 12, 16, 18, 9, 73, 17, 11, 12}, - { 14, 12, 19, 9, 10, 8, 67, 98}, - { 13, 12, 20, 8, 4, 57, 104, 20}, - { 13, 10, 22, 7, 29, 109, 37, 12}, - { 12, 5, 24, 9, 66, 70, 12, 17} - }, - { - { 23, 42, 18, 23, 18, 41, 20, 23}, - { 23, 86, 33, 20, 20, 33, 21, 23}, - { 23, 18, 90, 25, 22, 32, 20, 23}, - { 23, 25, 12, 94, 22, 33, 21, 23}, - { 23, 36, 21, 23, 0, 79, 31, 21}, - { 23, 68, 29, 21, 0, 67, 29, 21}, - { 23, 29, 70, 24, 5, 58, 28, 21}, - { 23, 22, 21, 78, 11, 50, 29, 22}, - { 22, 28, 23, 23, 18, 9, 97, 25}, - { 21, 35, 25, 22, 16, 8, 99, 22}, - { 19, 30, 36, 22, 15, 6, 100, 21}, - { 18, 22, 22, 45, 16, 5, 92, 23}, - { 19, 24, 23, 21, 20, 28, 4, 101}, - { 16, 23, 23, 20, 18, 28, 6, 99}, - { 11, 24, 22, 18, 16, 28, 8, 97}, - { 8, 21, 21, 23, 16, 25, 11, 93} - }, - { - { 45, 61, 48, 48, 60, 81, 44, 44}, - { 45, 46, 72, 53, 41, 84, 46, 43}, - { 45, 42, 60, 78, 38, 76, 50, 43}, - { 44, 46, 43, 94, 39, 63, 55, 45}, - { 44, 44, 53, 51, 43, 83, 68, 44}, - { 45, 33, 59, 63, 39, 68, 77, 44}, - { 44, 43, 42, 79, 38, 54, 85, 46}, - { 41, 46, 40, 82, 39, 44, 80, 52}, - { 44, 41, 49, 52, 43, 39, 98, 60}, - { 41, 40, 46, 63, 43, 33, 92, 66}, - { 34, 43, 39, 70, 41, 30, 80, 75}, - { 26, 40, 41, 68, 35, 36, 62, 83}, - { 39, 42, 45, 52, 41, 43, 35, 117}, - { 26, 44, 41, 56, 38, 44, 30, 115}, - { 8, 36, 44, 53, 28, 51, 23, 108}, - { 0, 26, 48, 51, 22, 56, 21, 103} - }, - { - { 10, 15, 10, 11, 79, 18, 7, 10}, - { 10, 18, 15, 10, 79, 14, 8, 10}, - { 10, 15, 24, 13, 72, 12, 8, 9}, - { 10, 12, 8, 40, 59, 13, 8, 9}, - { 10, 10, 11, 10, 0, 80, 17, 7}, - { 10, 9, 11, 11, 4, 82, 12, 6}, - { 9, 11, 11, 11, 9, 81, 10, 6}, - { 9, 10, 12, 15, 15, 72, 12, 6}, - { 10, 11, 10, 10, 12, 2, 77, 14}, - { 10, 12, 11, 11, 11, 8, 76, 10}, - { 9, 11, 12, 11, 9, 15, 73, 7}, - { 9, 11, 11, 14, 9, 24, 63, 8}, - { 10, 11, 10, 11, 8, 12, 1, 82}, - { 10, 12, 11, 11, 9, 10, 8, 76}, - { 10, 11, 12, 12, 10, 7, 17, 69}, - { 9, 11, 10, 15, 10, 8, 25, 60} - }, - { - { 14, 34, 30, 13, 20, 58, 8, 14}, - { 13, 1, 44, 32, 7, 32, 33, 13}, - { 13, 12, 2, 56, 11, 11, 36, 33}, - { 12, 17, 5, 38, 13, 7, 23, 58}, - { 13, 7, 20, 22, 10, 21, 65, 18}, - { 11, 10, 6, 29, 13, 5, 39, 56}, - { 9, 17, 4, 20, 13, 9, 12, 83}, - { 8, 14, 15, 11, 12, 13, 9, 85}, - { 12, 14, 9, 19, 15, 7, 23, 74}, - { 8, 15, 10, 14, 13, 13, 0, 93}, - { 6, 14, 15, 9, 11, 15, 0, 93}, - { 6, 14, 16, 9, 10, 15, 5, 87}, - { 11, 14, 12, 15, 13, 15, 2, 89}, - { 8, 13, 15, 12, 11, 15, 3, 88}, - { 6, 14, 15, 11, 11, 16, 4, 87}, - { 6, 14, 15, 12, 11, 16, 6, 83} - }, - { - { 10, 6, 9, 11, 70, 11, 8, 9}, - { 9, 8, 6, 11, 49, 4, 10, 8}, - { 9, 38, 4, 11, 25, 6, 11, 8}, - { 9, 41, 22, 14, 15, 9, 11, 8}, - { 9, 8, 9, 11, 21, 68, 11, 7}, - { 9, 6, 7, 11, 49, 49, 4, 8}, - { 8, 9, 4, 11, 64, 23, 6, 8}, - { 9, 16, 7, 9, 52, 11, 11, 7}, - { 9, 10, 8, 10, 7, 19, 73, 5}, - { 8, 9, 7, 11, 4, 50, 51, 0}, - { 8, 9, 7, 11, 15, 66, 24, 3}, - { 9, 10, 6, 12, 33, 53, 14, 6}, - { 8, 9, 8, 10, 11, 5, 21, 67}, - { 7, 10, 6, 11, 11, 1, 55, 37}, - { 7, 11, 6, 11, 8, 13, 69, 15}, - { 8, 12, 6, 12, 11, 31, 52, 9} - }, - { - { 26, 43, 21, 27, 21, 46, 23, 26}, - { 26, 66, 67, 19, 25, 27, 28, 26}, - { 27, 18, 64, 63, 27, 27, 27, 27}, - { 28, 28, 16, 101, 28, 27, 27, 28}, - { 25, 42, 27, 24, 0, 81, 39, 21}, - { 25, 39, 84, 23, 23, 32, 28, 25}, - { 27, 22, 40, 84, 28, 25, 27, 27}, - { 29, 28, 15, 102, 28, 28, 27, 28}, - { 24, 34, 37, 22, 21, 19, 87, 30}, - { 25, 22, 82, 38, 25, 29, 33, 25}, - { 28, 26, 27, 95, 27, 28, 25, 27}, - { 30, 27, 17, 101, 28, 28, 27, 28}, - { 24, 24, 42, 27, 27, 27, 12, 95}, - { 26, 19, 64, 55, 29, 28, 23, 39}, - { 29, 28, 26, 94, 27, 28, 27, 26}, - { 30, 28, 20, 98, 28, 28, 27, 30} - } -}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const short mipOffsetMatrix8x8[8]) = -{ 15, 14, 23, 45, 10, 14, 10, 27}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const short mipShiftMatrix8x8[8]) = -{ 7, 7, 6, 6, 6, 6, 6, 6}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipMatrix16x16[6][64][7]) = -{ - { - { 22, 13, 15, 50, 16, 17, 14}, - { 55, 5, 15, 25, 22, 16, 14}, - { 83, 7, 14, 18, 22, 17, 14}, - { 58, 47, 7, 15, 21, 17, 15}, - { 15, 81, 9, 12, 20, 18, 14}, - { 5, 61, 38, 12, 19, 18, 14}, - { 14, 20, 73, 13, 17, 18, 15}, - { 18, 4, 84, 16, 16, 19, 16}, - { 30, 12, 15, 57, 36, 15, 14}, - { 54, 8, 14, 44, 33, 18, 13}, - { 69, 14, 12, 29, 32, 20, 12}, - { 48, 46, 8, 18, 30, 22, 13}, - { 17, 68, 14, 11, 26, 24, 13}, - { 10, 47, 43, 10, 22, 24, 13}, - { 16, 16, 70, 12, 18, 24, 14}, - { 20, 6, 77, 15, 16, 24, 16}, - { 24, 15, 15, 28, 67, 15, 15}, - { 38, 14, 14, 34, 52, 23, 13}, - { 46, 21, 13, 29, 45, 27, 11}, - { 36, 38, 13, 19, 38, 31, 11}, - { 21, 46, 22, 13, 31, 34, 11}, - { 18, 32, 43, 10, 26, 34, 12}, - { 21, 13, 62, 11, 21, 33, 14}, - { 22, 7, 66, 13, 18, 31, 17}, - { 18, 17, 15, 12, 58, 40, 12}, - { 22, 19, 15, 18, 50, 42, 12}, - { 24, 23, 15, 19, 44, 45, 11}, - { 25, 27, 19, 16, 37, 47, 11}, - { 24, 26, 27, 13, 31, 48, 12}, - { 25, 18, 39, 11, 27, 46, 13}, - { 25, 12, 48, 10, 23, 43, 16}, - { 25, 11, 51, 11, 20, 40, 19}, - { 16, 17, 16, 14, 24, 71, 13}, - { 14, 19, 16, 15, 27, 67, 14}, - { 14, 20, 17, 15, 26, 66, 13}, - { 18, 18, 21, 15, 24, 65, 13}, - { 24, 14, 27, 15, 22, 64, 14}, - { 27, 12, 31, 13, 20, 61, 16}, - { 27, 13, 35, 12, 19, 56, 19}, - { 26, 14, 37, 12, 18, 50, 23}, - { 15, 16, 16, 17, 8, 68, 31}, - { 13, 17, 17, 16, 8, 72, 26}, - { 13, 17, 18, 17, 8, 74, 23}, - { 16, 14, 21, 17, 8, 73, 22}, - { 21, 11, 24, 17, 9, 72, 22}, - { 25, 11, 24, 16, 9, 69, 24}, - { 26, 14, 25, 15, 10, 64, 26}, - { 25, 15, 28, 14, 12, 56, 30}, - { 14, 15, 16, 16, 9, 37, 62}, - { 14, 15, 17, 18, 4, 52, 51}, - { 15, 14, 18, 19, 1, 60, 44}, - { 17, 13, 19, 20, 0, 64, 41}, - { 20, 11, 20, 19, 1, 63, 40}, - { 22, 12, 20, 18, 3, 61, 40}, - { 23, 14, 20, 17, 5, 58, 40}, - { 23, 15, 22, 16, 8, 52, 42}, - { 16, 14, 17, 16, 12, 15, 81}, - { 17, 13, 17, 17, 6, 29, 71}, - { 18, 13, 18, 19, 3, 38, 64}, - { 18, 13, 18, 19, 1, 44, 60}, - { 19, 13, 17, 20, 2, 45, 58}, - { 20, 14, 17, 19, 3, 45, 56}, - { 21, 14, 18, 18, 5, 45, 55}, - { 22, 15, 19, 18, 7, 43, 53} - }, - { - { 42, 21, 26, 96, 39, 29, 20}, - { 42, 32, 28, 49, 66, 35, 21}, - { 30, 41, 30, 29, 73, 40, 23}, - { 23, 42, 35, 23, 72, 42, 26}, - { 25, 34, 44, 22, 68, 46, 26}, - { 26, 32, 49, 22, 65, 47, 25}, - { 24, 33, 53, 21, 62, 47, 25}, - { 22, 30, 62, 21, 57, 47, 25}, - { 27, 25, 27, 46, 97, 33, 22}, - { 11, 31, 31, 22, 94, 53, 22}, - { 0, 29, 35, 16, 89, 60, 26}, - { 6, 17, 41, 15, 86, 62, 28}, - { 20, 4, 42, 16, 84, 63, 28}, - { 26, 8, 35, 17, 84, 61, 28}, - { 23, 24, 25, 18, 83, 60, 27}, - { 21, 31, 27, 19, 77, 58, 28}, - { 16, 22, 27, 14, 107, 48, 24}, - { 11, 21, 32, 13, 84, 70, 26}, - { 11, 17, 36, 14, 77, 73, 29}, - { 13, 15, 35, 15, 77, 71, 31}, - { 16, 14, 34, 15, 80, 68, 30}, - { 17, 16, 31, 15, 84, 64, 30}, - { 19, 19, 29, 16, 85, 61, 29}, - { 19, 23, 30, 18, 81, 60, 29}, - { 17, 18, 28, 14, 81, 76, 24}, - { 15, 17, 31, 15, 71, 77, 33}, - { 15, 16, 33, 14, 70, 74, 36}, - { 15, 17, 32, 14, 73, 71, 36}, - { 15, 18, 32, 13, 77, 67, 36}, - { 15, 18, 32, 13, 81, 65, 34}, - { 16, 17, 32, 13, 82, 64, 32}, - { 18, 19, 32, 15, 78, 63, 32}, - { 18, 17, 28, 18, 52, 97, 31}, - { 16, 16, 31, 15, 64, 76, 41}, - { 14, 17, 31, 14, 66, 72, 43}, - { 15, 17, 32, 13, 70, 70, 42}, - { 16, 18, 33, 11, 72, 70, 38}, - { 16, 18, 33, 11, 74, 71, 35}, - { 17, 17, 34, 13, 73, 72, 32}, - { 18, 19, 33, 14, 70, 72, 32}, - { 17, 19, 26, 16, 39, 87, 55}, - { 14, 19, 29, 13, 57, 78, 49}, - { 15, 18, 31, 12, 61, 76, 45}, - { 15, 18, 32, 13, 63, 76, 42}, - { 16, 17, 33, 13, 63, 79, 38}, - { 17, 15, 35, 13, 62, 82, 34}, - { 18, 15, 36, 13, 62, 82, 33}, - { 19, 18, 34, 15, 59, 81, 33}, - { 17, 19, 25, 15, 34, 59, 89}, - { 14, 19, 29, 13, 47, 80, 56}, - { 14, 19, 31, 12, 54, 84, 44}, - { 16, 18, 32, 13, 57, 83, 41}, - { 17, 17, 33, 14, 55, 85, 38}, - { 18, 15, 35, 14, 53, 87, 36}, - { 19, 14, 36, 15, 53, 86, 35}, - { 20, 17, 36, 17, 52, 81, 37}, - { 19, 19, 26, 17, 32, 42, 105}, - { 17, 19, 28, 15, 40, 75, 65}, - { 16, 19, 30, 14, 45, 84, 49}, - { 17, 18, 32, 14, 50, 83, 45}, - { 18, 17, 33, 16, 50, 82, 43}, - { 19, 16, 35, 16, 49, 84, 40}, - { 20, 15, 38, 17, 48, 83, 40}, - { 21, 17, 38, 18, 48, 78, 41} - }, - { - { 52, 46, 46, 55, 50, 46, 47}, - { 65, 45, 45, 42, 52, 47, 47}, - { 74, 48, 45, 40, 51, 48, 47}, - { 67, 61, 44, 39, 50, 48, 48}, - { 52, 74, 45, 39, 48, 48, 49}, - { 44, 75, 53, 39, 47, 48, 50}, - { 44, 57, 71, 40, 46, 46, 51}, - { 50, 31, 92, 42, 45, 41, 55}, - { 55, 45, 45, 48, 61, 48, 46}, - { 65, 46, 45, 36, 57, 53, 46}, - { 72, 50, 44, 31, 54, 54, 48}, - { 66, 61, 44, 31, 51, 54, 49}, - { 54, 73, 45, 32, 48, 52, 52}, - { 45, 76, 52, 33, 46, 49, 55}, - { 45, 59, 70, 36, 44, 44, 59}, - { 50, 30, 93, 40, 43, 37, 64}, - { 54, 46, 45, 39, 66, 53, 46}, - { 65, 46, 45, 31, 57, 60, 47}, - { 71, 50, 44, 26, 52, 61, 50}, - { 67, 60, 44, 26, 48, 58, 53}, - { 56, 72, 45, 27, 45, 53, 58}, - { 47, 76, 51, 29, 43, 47, 63}, - { 46, 59, 69, 33, 41, 39, 69}, - { 51, 29, 93, 37, 40, 30, 76}, - { 53, 46, 46, 35, 60, 64, 47}, - { 64, 47, 45, 27, 53, 65, 50}, - { 71, 50, 45, 22, 49, 62, 55}, - { 68, 59, 44, 22, 46, 57, 61}, - { 58, 71, 45, 24, 43, 50, 67}, - { 48, 76, 51, 27, 41, 41, 74}, - { 46, 59, 69, 32, 39, 31, 82}, - { 51, 30, 93, 36, 38, 21, 88}, - { 52, 46, 46, 35, 51, 71, 50}, - { 63, 47, 45, 24, 51, 63, 58}, - { 70, 51, 45, 19, 49, 56, 65}, - { 68, 59, 44, 19, 45, 50, 72}, - { 58, 71, 45, 22, 42, 41, 80}, - { 48, 76, 51, 26, 39, 31, 88}, - { 46, 59, 69, 30, 37, 21, 95}, - { 51, 30, 93, 34, 36, 13, 100}, - { 52, 46, 46, 35, 47, 65, 61}, - { 62, 47, 45, 24, 49, 56, 69}, - { 69, 51, 45, 19, 47, 47, 77}, - { 68, 60, 44, 19, 44, 38, 85}, - { 59, 71, 45, 22, 40, 29, 94}, - { 49, 75, 51, 25, 37, 19, 102}, - { 47, 59, 69, 28, 35, 11, 108}, - { 52, 31, 93, 33, 34, 6, 110}, - { 52, 47, 46, 36, 46, 50, 77}, - { 61, 48, 45, 26, 46, 42, 84}, - { 67, 52, 45, 21, 44, 34, 92}, - { 66, 60, 44, 21, 41, 26, 100}, - { 59, 70, 46, 22, 38, 17, 108}, - { 50, 73, 53, 25, 35, 10, 114}, - { 48, 57, 70, 28, 33, 3, 118}, - { 52, 31, 92, 32, 32, 1, 118}, - { 52, 47, 46, 38, 45, 32, 93}, - { 59, 49, 46, 30, 43, 27, 99}, - { 65, 53, 46, 25, 41, 21, 106}, - { 64, 60, 46, 23, 38, 15, 111}, - { 58, 67, 48, 24, 36, 9, 117}, - { 51, 68, 56, 25, 34, 4, 121}, - { 49, 55, 72, 27, 32, 0, 123}, - { 52, 32, 92, 31, 30, 0, 123} - }, - { - { 18, 16, 16, 71, 13, 16, 16}, - { 36, 14, 16, 63, 18, 15, 17}, - { 64, 11, 16, 60, 20, 13, 17}, - { 64, 30, 13, 55, 22, 13, 17}, - { 33, 63, 9, 50, 25, 12, 18}, - { 15, 64, 24, 44, 27, 11, 18}, - { 19, 27, 59, 38, 30, 10, 18}, - { 24, 0, 81, 32, 31, 12, 18}, - { 22, 16, 16, 65, 46, 10, 17}, - { 25, 17, 16, 63, 50, 8, 18}, - { 35, 16, 16, 58, 54, 6, 19}, - { 41, 19, 16, 53, 58, 6, 19}, - { 36, 30, 15, 48, 62, 5, 19}, - { 28, 35, 20, 43, 63, 6, 19}, - { 26, 24, 35, 37, 62, 8, 18}, - { 26, 10, 50, 31, 59, 11, 19}, - { 18, 17, 16, 22, 81, 10, 18}, - { 18, 18, 16, 22, 81, 12, 19}, - { 19, 18, 16, 21, 81, 13, 19}, - { 22, 16, 17, 20, 80, 15, 18}, - { 25, 16, 17, 20, 77, 20, 17}, - { 26, 19, 17, 20, 73, 25, 16}, - { 25, 19, 20, 20, 68, 29, 16}, - { 24, 16, 27, 21, 60, 31, 17}, - { 16, 17, 16, 9, 59, 45, 14}, - { 16, 17, 16, 10, 55, 49, 14}, - { 16, 17, 16, 12, 50, 54, 14}, - { 17, 16, 16, 13, 45, 59, 13}, - { 19, 15, 16, 15, 39, 63, 13}, - { 21, 16, 16, 17, 35, 66, 14}, - { 22, 17, 16, 18, 33, 65, 16}, - { 22, 17, 19, 18, 33, 59, 21}, - { 17, 16, 16, 15, 20, 78, 16}, - { 17, 16, 16, 16, 18, 77, 19}, - { 17, 16, 15, 17, 15, 77, 22}, - { 17, 16, 15, 17, 13, 76, 24}, - { 18, 16, 15, 18, 11, 75, 27}, - { 18, 16, 15, 19, 11, 71, 31}, - { 19, 17, 15, 19, 13, 65, 35}, - { 19, 17, 16, 18, 16, 57, 39}, - { 17, 16, 16, 18, 9, 61, 42}, - { 17, 16, 15, 18, 10, 55, 47}, - { 18, 16, 15, 18, 9, 51, 52}, - { 18, 17, 15, 18, 9, 47, 56}, - { 18, 17, 15, 18, 10, 43, 60}, - { 18, 17, 14, 18, 11, 39, 63}, - { 18, 18, 14, 17, 12, 36, 65}, - { 19, 17, 15, 18, 13, 35, 65}, - { 16, 16, 15, 16, 14, 24, 75}, - { 17, 17, 15, 17, 14, 21, 78}, - { 17, 17, 15, 17, 14, 19, 80}, - { 18, 17, 15, 17, 13, 17, 82}, - { 18, 18, 14, 17, 13, 16, 84}, - { 18, 18, 15, 17, 13, 15, 84}, - { 19, 17, 15, 17, 13, 16, 84}, - { 19, 17, 16, 17, 14, 18, 81}, - { 16, 16, 16, 16, 16, 8, 89}, - { 17, 16, 16, 16, 16, 8, 89}, - { 18, 17, 15, 16, 15, 8, 90}, - { 18, 18, 15, 16, 15, 8, 90}, - { 19, 18, 15, 17, 15, 8, 90}, - { 19, 18, 15, 17, 15, 7, 90}, - { 19, 17, 16, 17, 14, 8, 90}, - { 19, 17, 17, 17, 15, 10, 87} - }, - { - { 29, 12, 13, 53, 18, 11, 15}, - { 56, 12, 13, 24, 32, 7, 16}, - { 54, 32, 12, 12, 33, 11, 15}, - { 21, 61, 15, 8, 27, 18, 13}, - { 5, 54, 36, 8, 20, 22, 13}, - { 10, 21, 64, 9, 15, 24, 16}, - { 16, 2, 75, 11, 11, 23, 23}, - { 16, 2, 68, 12, 9, 19, 33}, - { 29, 16, 14, 41, 56, 2, 17}, - { 28, 29, 15, 18, 56, 10, 15}, - { 14, 42, 21, 7, 42, 24, 13}, - { 6, 36, 37, 7, 25, 35, 14}, - { 11, 14, 55, 10, 13, 37, 21}, - { 16, 0, 61, 11, 8, 33, 31}, - { 16, 0, 56, 11, 6, 26, 43}, - { 15, 6, 46, 12, 7, 20, 53}, - { 13, 22, 16, 9, 73, 17, 14}, - { 8, 28, 22, 9, 46, 40, 11}, - { 6, 23, 32, 11, 21, 53, 15}, - { 11, 9, 43, 13, 9, 50, 27}, - { 16, 0, 46, 14, 4, 40, 42}, - { 17, 2, 41, 14, 5, 28, 55}, - { 15, 7, 34, 13, 6, 20, 65}, - { 14, 11, 29, 12, 9, 15, 69}, - { 10, 18, 19, 8, 35, 62, 9}, - { 9, 16, 25, 15, 13, 67, 18}, - { 12, 9, 32, 17, 4, 54, 36}, - { 15, 5, 34, 17, 4, 36, 53}, - { 16, 4, 31, 15, 7, 22, 67}, - { 16, 8, 27, 15, 9, 14, 75}, - { 14, 12, 22, 13, 10, 11, 79}, - { 12, 14, 21, 12, 12, 10, 78}, - { 12, 13, 19, 16, 6, 73, 23}, - { 13, 10, 24, 17, 4, 49, 46}, - { 14, 7, 26, 17, 7, 27, 65}, - { 15, 7, 25, 16, 10, 13, 77}, - { 15, 9, 22, 15, 12, 7, 83}, - { 14, 12, 19, 14, 13, 5, 85}, - { 13, 14, 18, 13, 13, 5, 85}, - { 12, 14, 18, 12, 14, 7, 82}, - { 14, 12, 19, 16, 7, 40, 56}, - { 14, 9, 22, 15, 11, 17, 74}, - { 14, 8, 22, 15, 13, 6, 84}, - { 14, 9, 21, 15, 14, 2, 87}, - { 13, 11, 18, 14, 14, 2, 88}, - { 13, 13, 17, 14, 15, 2, 88}, - { 12, 14, 16, 13, 16, 3, 87}, - { 12, 15, 16, 12, 15, 6, 83}, - { 14, 11, 18, 14, 14, 10, 81}, - { 14, 9, 19, 14, 15, 3, 87}, - { 14, 10, 19, 14, 15, 0, 90}, - { 13, 11, 17, 14, 15, 0, 90}, - { 13, 12, 17, 14, 15, 1, 89}, - { 13, 14, 16, 13, 16, 2, 88}, - { 12, 15, 15, 12, 16, 3, 86}, - { 12, 14, 16, 13, 16, 6, 83}, - { 13, 11, 17, 14, 16, 2, 87}, - { 14, 11, 18, 14, 16, 1, 88}, - { 14, 11, 17, 14, 15, 2, 88}, - { 13, 13, 17, 14, 15, 3, 87}, - { 13, 13, 17, 14, 15, 3, 86}, - { 13, 14, 16, 13, 16, 4, 85}, - { 12, 15, 16, 12, 16, 5, 83}, - { 12, 15, 16, 13, 15, 7, 81} - }, - { - { 11, 11, 11, 53, 9, 12, 11}, - { 18, 10, 10, 32, 13, 10, 11}, - { 40, 8, 11, 20, 13, 11, 11}, - { 56, 14, 9, 16, 13, 12, 10}, - { 47, 37, 6, 13, 12, 12, 10}, - { 23, 60, 10, 12, 13, 11, 11}, - { 10, 50, 33, 11, 12, 11, 11}, - { 13, 15, 66, 12, 12, 11, 11}, - { 15, 11, 11, 62, 26, 9, 10}, - { 13, 12, 10, 57, 17, 11, 10}, - { 17, 12, 10, 43, 15, 11, 10}, - { 34, 8, 11, 30, 14, 12, 10}, - { 49, 12, 10, 22, 13, 12, 10}, - { 45, 31, 7, 17, 13, 12, 10}, - { 28, 49, 11, 14, 13, 12, 10}, - { 17, 41, 31, 13, 13, 11, 10}, - { 14, 11, 11, 33, 59, 6, 11}, - { 13, 11, 11, 48, 42, 8, 10}, - { 12, 12, 11, 51, 30, 9, 10}, - { 18, 10, 11, 45, 22, 11, 10}, - { 31, 8, 11, 37, 17, 12, 10}, - { 41, 13, 10, 28, 15, 12, 9}, - { 39, 27, 8, 21, 15, 12, 10}, - { 29, 36, 15, 17, 15, 12, 10}, - { 11, 12, 11, 11, 63, 26, 8}, - { 12, 11, 11, 23, 61, 16, 10}, - { 12, 12, 11, 34, 53, 10, 10}, - { 13, 12, 11, 41, 43, 9, 10}, - { 18, 10, 11, 42, 33, 9, 10}, - { 27, 9, 11, 37, 26, 10, 10}, - { 33, 14, 10, 31, 22, 11, 10}, - { 32, 23, 12, 24, 20, 11, 10}, - { 11, 12, 11, 10, 32, 61, 5}, - { 11, 12, 11, 11, 49, 42, 6}, - { 11, 12, 11, 17, 58, 26, 8}, - { 11, 12, 11, 25, 58, 16, 9}, - { 13, 11, 11, 32, 52, 11, 9}, - { 17, 10, 11, 35, 43, 10, 10}, - { 23, 11, 10, 34, 35, 10, 10}, - { 27, 15, 11, 29, 29, 12, 9}, - { 11, 12, 11, 13, 9, 70, 17}, - { 11, 11, 11, 12, 23, 65, 10}, - { 11, 12, 10, 12, 38, 53, 6}, - { 11, 12, 10, 14, 51, 37, 7}, - { 11, 11, 11, 20, 56, 24, 8}, - { 12, 11, 11, 26, 53, 17, 9}, - { 16, 11, 11, 30, 47, 14, 9}, - { 20, 13, 11, 30, 38, 14, 10}, - { 11, 11, 10, 13, 9, 35, 52}, - { 11, 11, 10, 13, 11, 51, 34}, - { 11, 11, 10, 13, 20, 57, 20}, - { 11, 12, 10, 13, 33, 52, 12}, - { 10, 12, 10, 14, 44, 42, 10}, - { 11, 12, 10, 18, 49, 32, 9}, - { 12, 12, 11, 23, 49, 24, 10}, - { 15, 13, 11, 25, 43, 21, 10}, - { 11, 11, 11, 11, 16, 0, 81}, - { 10, 12, 10, 12, 16, 16, 65}, - { 11, 11, 10, 13, 17, 33, 47}, - { 11, 12, 10, 13, 22, 43, 31}, - { 11, 12, 10, 13, 29, 45, 21}, - { 11, 12, 11, 15, 37, 40, 16}, - { 11, 12, 11, 18, 41, 34, 14}, - { 12, 13, 12, 20, 40, 28, 14} - } -}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipOffsetMatrix16x16[6]) = -{ 15, 19, 46, 16, 14, 11}; - -ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipShiftMatrix16x16[6]) = -{ 6, 7, 5, 6, 6, 6}; -#endif \ No newline at end of file diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp index 5587cbecfd66592a5459203335e512728c9e39d2..436fee1bf94e3c80319580902446a760d35d8f2b 100644 --- a/source/Lib/CommonLib/Mv.cpp +++ b/source/Lib/CommonLib/Mv.cpp @@ -66,7 +66,6 @@ void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& int iVerMax = ( pps.getPicHeightInLumaSamples() + iOffset - (int)pos.y - 1 ) << iMvShift; int iVerMin = ( -( int ) sps.getMaxCUHeight() - iOffset - ( int ) pos.y + 1 ) << iMvShift; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY const SubPic& curSubPic = pps.getSubPicFromPos(pos); if (curSubPic.getTreatedAsPicFlag()) { @@ -76,7 +75,6 @@ void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& iVerMax = ((curSubPic.getSubPicBottom() + 1) + iOffset - (int)pos.y - 1) << iMvShift; iVerMin = (-(int)sps.getMaxCUHeight() - iOffset - ((int)pos.y - curSubPic.getSubPicTop()) + 1) << iMvShift; } -#endif rcMv.setHor( std::min( iHorMax, std::max( iHorMin, rcMv.getHor() ) ) ); rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) ); } diff --git a/source/Lib/CommonLib/ParameterSetManager.cpp b/source/Lib/CommonLib/ParameterSetManager.cpp index e1760f7dec2964fc160f556e327d7888e2784a75..c57d580ee0ab51062b6c94f6825c7dd3dbbd6003 100644 --- a/source/Lib/CommonLib/ParameterSetManager.cpp +++ b/source/Lib/CommonLib/ParameterSetManager.cpp @@ -38,13 +38,7 @@ ParameterSetManager::ParameterSetManager() : m_spsMap(MAX_NUM_SPS) , m_ppsMap(MAX_NUM_PPS) , m_apsMap(MAX_NUM_APS * MAX_NUM_APS_TYPE) -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP -, m_dpsMap(MAX_NUM_DPS) -#endif , m_vpsMap(MAX_NUM_VPS) -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP -, m_activeDPSId(-1) -#endif , m_activeSPSId(-1) , m_activeVPSId(-1) { @@ -63,47 +57,11 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) if (pps) { int spsId = pps->getSPSId(); -#if !ENABLING_MULTI_SPS - if (!isIRAP && (spsId != m_activeSPSId )) - { - msg( WARNING, "Warning: tried to activate a PPS referring to an inactive SPS at non-IDR."); - } - else -#endif { SPS *sps = m_spsMap.getPS(spsId); if (sps) { -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - int dpsId = sps->getDecodingParameterSetId(); - if ((m_activeDPSId!=-1) && (dpsId != m_activeDPSId )) - { - msg( WARNING, "Warning: tried to activate a DPS with different ID than the currently active DPS. This should not happen within the same bitstream!"); - } - else - { - if (dpsId != 0) - { - DPS *dps =m_dpsMap.getPS(dpsId); - if (dps) - { - m_activeDPSId = dpsId; - m_dpsMap.setActive(dpsId); - } - else - { - msg( WARNING, "Warning: tried to activate a PPS that refers to a non-existing DPS."); - } - } - else - { - // set zero as active DPS ID (special reserved value, no actual DPS) - m_activeDPSId = dpsId; - m_dpsMap.setActive(dpsId); - } - } -#endif int vpsId = sps->getVPSId(); if(vpsId != 0) { @@ -146,9 +104,6 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) // Failed to activate if reach here. m_activeSPSId=-1; -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - m_activeDPSId=-1; -#endif return false; } diff --git a/source/Lib/CommonLib/ParameterSetManager.h b/source/Lib/CommonLib/ParameterSetManager.h index 697f52b0c1381bcfcf2247f24da020948beb2e50..1824d492eee203f1dd974eb5aac8540aafc75efb 100644 --- a/source/Lib/CommonLib/ParameterSetManager.h +++ b/source/Lib/CommonLib/ParameterSetManager.h @@ -227,14 +227,6 @@ public: void storeVPS(VPS *vps, const std::vector<uint8_t> &naluData) { m_vpsMap.storePS(vps->getVPSId(), vps, &naluData); } VPS* getVPS( int vpsId ) { return m_vpsMap.getPS( vpsId ); }; -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - void storeDPS(DPS *dps, const std::vector<uint8_t> &naluData) { m_dpsMap.storePS( dps->getDecodingParameterSetId(), dps, &naluData); }; - // get pointer to existing video parameter set - DPS* getDPS(int dpsId) { return m_dpsMap.getPS(dpsId); }; - bool getDPSChangedFlag(int dpsId) const { return m_dpsMap.getChangedFlag(dpsId); } - void clearDPSChangedFlag(int dpsId) { m_dpsMap.clearChangedFlag(dpsId); } - DPS* getFirstDPS() { return m_dpsMap.getFirstPS(); }; -#endif // store sequence parameter set and take ownership of it // warning: sps object cannot be used after storing (repeated parameter sets are directly deleted) void storeSPS(SPS *sps, const std::vector<uint8_t> &naluData) { m_spsMap.storePS( sps->getSPSId(), sps, &naluData); }; @@ -268,24 +260,15 @@ public: APS* getFirstAPS() { return m_apsMap.getFirstPS(); }; bool activateAPS(int apsId, int apsType); const SPS* getActiveSPS()const { return m_spsMap.getPS(m_activeSPSId); }; -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - const DPS* getActiveDPS()const { return m_dpsMap.getPS(m_activeDPSId); }; -#endif void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals ) { m_apsMap.checkAuApsContent( aps, accessUnitApsNals ); } protected: ParameterSetMap<SPS> m_spsMap; ParameterSetMap<PPS> m_ppsMap; ParameterSetMap<APS> m_apsMap; -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - ParameterSetMap<DPS> m_dpsMap; -#endif ParameterSetMap<VPS> m_vpsMap; APS* m_apss[ALF_CTB_MAX_NUM_APS]; -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - int m_activeDPSId; // -1 for nothing active -#endif int m_activeSPSId; // -1 for nothing active int m_activeVPSId; // -1 for nothing active }; diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index a74e5ed1e1ecf3e74d1116d80786b94552234ab6..d8079c89c3b5f2d98e0f75d34d419eaa02ba843b 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -173,9 +173,7 @@ int Scheduler::getNumPicInstances() const Picture::Picture() { cs = nullptr; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY m_isSubPicBorderSaved = false; -#endif m_bIsBorderExtended = false; usedByCurr = false; longTerm = false; @@ -725,19 +723,13 @@ void Picture::rescalePicture( const std::pair<int, int> scalingRatio, const PelBuf& afterScale = afterScaling.get( compID ); sampleRateConv( scalingRatio, std::pair<int, int>( ::getComponentScaleX( compID, chromaFormatIDC ), ::getComponentScaleY( compID, chromaFormatIDC ) ), -#if JVET_Q0487_SCALING_WINDOW_ISSUES beforeScale, scalingWindowBefore.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), scalingWindowBefore.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), afterScale, scalingWindowAfter.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), scalingWindowAfter.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), -#else - beforeScale, scalingWindowBefore.getWindowLeftOffset(), scalingWindowBefore.getWindowTopOffset(), - afterScale, scalingWindowAfter.getWindowLeftOffset(), scalingWindowAfter.getWindowTopOffset(), -#endif bitDepths.recon[toChannelType(compID)], downsampling || useLumaFilter ? true : isLuma( compID ), downsampling, isLuma( compID ) ? 1 : horCollocatedChromaFlag, isLuma( compID ) ? 1 : verCollocatedChromaFlag ); } } -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY void Picture::saveSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWidth, int subPicHeight) { @@ -948,7 +940,6 @@ void Picture::restoreSubPicBorder(int POC, int subPicX0, int subPicY0, int subPi m_bufSubPicLeft.destroy(); m_bufSubPicRight.destroy(); } -#endif void Picture::extendPicBorder() { diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index 28440c240626ce1880758f88f1e6558ad81d45dd..0c8a7ba71902c2e19ad7c518827b0775b88f3347 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -148,12 +148,10 @@ struct Picture : public UnitArea void finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHeader *picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps ); int getPOC() const { return poc; } -#if JVET_P0978_RPL_RESTRICTIONS int getDecodingOrderNumber() const { return m_decodingOrderNumber; } void setDecodingOrderNumber(const int val) { m_decodingOrderNumber = val; } NalUnitType getPictureType() const { return m_pictureType; } void setPictureType(const NalUnitType val) { m_pictureType = val; } -#endif void setBorderExtension( bool bFlag) { m_bIsBorderExtended = bFlag;} Pel* getOrigin( const PictureType &type, const ComponentID compID ) const; @@ -176,13 +174,10 @@ struct Picture : public UnitArea private: Window m_conformanceWindow; Window m_scalingWindow; -#if JVET_P0978_RPL_RESTRICTIONS int m_decodingOrderNumber; NalUnitType m_pictureType; -#endif public: -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY bool m_isSubPicBorderSaved; PelStorage m_bufSubPicAbove; @@ -196,7 +191,6 @@ public: bool getSubPicSaved() { return m_isSubPicBorderSaved; } void setSubPicSaved(bool bVal) { m_isSubPicBorderSaved = bVal; } -#endif bool m_bIsBorderExtended; bool referenced; bool reconstructed; @@ -242,14 +236,12 @@ public: const Window& getConformanceWindow() const { return m_conformanceWindow; } Window& getScalingWindow() { return m_scalingWindow; } const Window& getScalingWindow() const { return m_scalingWindow; } -#if JVET_Q0487_SCALING_WINDOW_ISSUES bool isRefScaled( const PPS* pps ) const { return unscaledPic->getPicWidthInLumaSamples() != pps->getPicWidthInLumaSamples() || unscaledPic->getPicHeightInLumaSamples() != pps->getPicHeightInLumaSamples() || getScalingWindow().getWindowLeftOffset() != pps->getScalingWindow().getWindowLeftOffset() || getScalingWindow().getWindowRightOffset() != pps->getScalingWindow().getWindowRightOffset() || getScalingWindow().getWindowTopOffset() != pps->getScalingWindow().getWindowTopOffset() || getScalingWindow().getWindowBottomOffset() != pps->getScalingWindow().getWindowBottomOffset(); } -#endif void allocateNewSlice(); Slice *swapSliceObject(Slice * p, uint32_t i); @@ -324,10 +316,8 @@ public: int calcAndPrintHashStatus(const CPelUnitBuf& pic, const class SEIDecodedPictureHash* pictureHashSEI, const BitDepths &bitDepths, const MsgLevel msgl); -#if JVET_P2008_OUTPUT_LOG uint32_t calcMD5(const CPelUnitBuf& pic, PictureHash &digest, const BitDepths &bitDepths); std::string hashToString(const PictureHash &digest, int numChar); -#endif // JVET_P2008_OUTPUT_LOG typedef std::list<Picture*> PicList; 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/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 87fa5aa7c0524a99e863fdb29d878a3f77924668..cf4f78c1bc33f89880e0ce2270bb2729123b104c 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -70,9 +70,7 @@ QpParam::QpParam(const int qpy, const ChromaFormat chFmt, const int dqp , const SPS *sps -#if JVET_Q0820_ACT , const bool applyACTQpoffset -#endif ) { int baseQp; @@ -87,12 +85,10 @@ QpParam::QpParam(const int qpy, baseQp = Clip3(-qpBdOffset, MAX_QP, baseQp + chromaQPOffset) + qpBdOffset; } -#if JVET_Q0820_ACT if (applyACTQpoffset) { baseQp += DELTA_QP_ACT[compID]; } -#endif baseQp = Clip3( 0, MAX_QP+qpBdOffset, baseQp + dqp ); Qps[0] =baseQp; @@ -107,11 +103,7 @@ QpParam::QpParam(const int qpy, rems[1] = baseQpTS % 6; } -#if JVET_Q0820_ACT QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int QP /*= -MAX_INT*/, const bool allowACTQpoffset /*= true*/) -#else -QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int QP /*= -MAX_INT*/) -#endif { int chromaQpOffset = 0; ComponentID compID = MAP_CHROMA(compIDX); @@ -129,12 +121,8 @@ QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int int dqp = 0; const bool useJQP = isChroma(compID) && (abs(TU::getICTMode(tu)) == 2); -#if JVET_Q0820_ACT bool applyACTQpoffset = tu.cu->colorTransform && allowACTQpoffset; *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, useJQP ? JOINT_CbCr : compID, tu.cs->sps->getQpBDOffset(toChannelType(compID)), tu.cs->sps->getMinQpPrimeTsMinus4(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp, tu.cs->sps, applyACTQpoffset); -#else - *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, useJQP ? JOINT_CbCr : compID, tu.cs->sps->getQpBDOffset(toChannelType(compID)), tu.cs->sps->getMinQpPrimeTsMinus4(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp, tu.cs->sps); -#endif } @@ -381,17 +369,9 @@ void Quant::dequant(const TransformUnit &tu, const TCoeff transformMinimum = -(1 << maxLog2TrDynamicRange); const TCoeff transformMaximum = (1 << maxLog2TrDynamicRange) - 1; const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif const int scalingListType = getScalingListType(tu.cu->predMode, compID); const int channelBitDepth = sps->getBitDepth(toChannelType(compID)); @@ -547,22 +527,18 @@ void Quant::setScalingList(ScalingList *scalingList, const int maxLog2TrDynamicR { if ((size == SCALING_LIST_2x2 && list < 4) || (size == SCALING_LIST_64x64 && list % (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES) != 0)) // skip 2x2 luma continue; -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 if (scalingList->getChromaScalingListPresentFlag() || scalingList->isLumaScalingList(scalingListId)) { -#endif for(int qp = minimumQp; qp < maximumQp; qp++) { xSetScalingListEnc(scalingList, list, size, qp, scalingListId); xSetScalingListDec(*scalingList, list, size, qp, scalingListId); } -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 } else // chroma QMs in 400 { scalingList->processDefaultMatrix(scalingListId); } -#endif scalingListId++; } } @@ -1002,17 +978,9 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const uint32_t uiLog2TrWidth = floorLog2(uiWidth); const uint32_t uiLog2TrHeight = floorLog2(uiHeight); int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip, isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip, tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif // for blocks that where width*height != 4^N, the effective scaling applied during transformation cannot be // compensated by a bit-shift (the quantised result will be sqrt(2) * larger than required). @@ -1085,17 +1053,9 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const uint32_t uiLog2TrHeight = floorLog2(uiHeight); int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0), isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the @@ -1144,17 +1104,9 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); const int scalingListType = getScalingListType(tu.cu->predMode, compID); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif const bool useTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); const int defaultQuantisationCoefficient = g_quantScales[0][cQP.rem(useTransformSkip)]; @@ -1212,17 +1164,9 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); const int scalingListType = getScalingListType(tu.cu->predMode, compID); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); @@ -1302,11 +1246,7 @@ void Quant::lambdaAdjustColorTrans(bool forward) for (uint8_t component = 0; component < MAX_NUM_COMPONENT; component++) { ComponentID compID = (ComponentID)component; -#if JVET_Q0820_ACT int delta_QP = DELTA_QP_ACT[compID]; -#else - int delta_QP = (compID == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); -#endif double lamdbaAdjustRate = pow(2.0, delta_QP / 3.0); m_lambdasStore[0][component] = m_lambdas[component]; diff --git a/source/Lib/CommonLib/Quant.h b/source/Lib/CommonLib/Quant.h index c5c638a8acabe25cacce59033d5ca8627acc4e05..1ca79b093bbafa3608c642594a45d40b8fa2337c 100644 --- a/source/Lib/CommonLib/Quant.h +++ b/source/Lib/CommonLib/Quant.h @@ -82,18 +82,12 @@ private: const ChromaFormat chFmt, const int dqp , const SPS *sps -#if JVET_Q0820_ACT , const bool applyACTQpoffset -#endif ); public: -#if JVET_Q0820_ACT QpParam(const TransformUnit& tu, const ComponentID &compID, const int QP = -MAX_INT, const bool allowACTQpoffset = true); -#else - QpParam(const TransformUnit& tu, const ComponentID &compID, const int QP = -MAX_INT); -#endif int Qp ( const bool ts ) const { return Qps [ts?1:0]; } int per( const bool ts ) const { return pers[ts?1:0]; } diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index a811c59b29f0ee05db5adef222ffabcdbed06a9d..0f3ad32e650afbc2d2db808999f7f034f8035428 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -629,17 +629,9 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem(isTransformSkip)); const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem(isTransformSkip), uiLog2BlockWidth, uiLog2BlockHeight); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, isLfnstApplied, disableSMForLFNST); -#else - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem(isTransformSkip)]; const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem(isTransformSkip)); const int iQBits = QUANT_SHIFT + cQP.per(isTransformSkip) + iTransformShift + (needSqrtAdjustment?-1:0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index 5a68bee8aee8913ad2830b7874efbbb97c8db157..95b8e460da269de1585405fd481733ddcfdf3236 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -65,12 +65,10 @@ double RdCost::calcRdCost( uint64_t fracBits, Distortion distortion, bool useUna double RdCost::calcRdCost( uint64_t fracBits, Distortion distortion ) #endif { -#if JVET_AHG14_LOSSLESS if( m_costMode == COST_LOSSLESS_CODING && 0 != distortion ) { return MAX_DOUBLE; } -#endif #if WCG_EXT return ( useUnadjustedLambda ? m_DistScaleUnadjusted : m_DistScale ) * double( distortion ) + double( fracBits ); #else @@ -92,11 +90,7 @@ void RdCost::lambdaAdjustColorTrans(bool forward, ComponentID componentID) for (uint8_t component = 0; component < MAX_NUM_COMPONENT; component++) { ComponentID compID = (ComponentID)component; -#if JVET_Q0820_ACT int delta_QP = DELTA_QP_ACT[compID]; -#else - int delta_QP = (compID == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); -#endif double lamdbaAdjustRate = pow(2.0, delta_QP / 3.0); m_lambdaStore[0][component] = m_dLambda; @@ -205,9 +199,7 @@ void RdCost::init() m_afpDistortFunc[DF_SAD_INTERMEDIATE_BITDEPTH] = RdCost::xGetSAD; -#if JVET_Q0806 m_afpDistortFunc[DF_SAD_WITH_MASK] = RdCost::xGetSADwMask; -#endif #if ENABLE_SIMD_OPT_DIST #ifdef TARGET_SIMD_X86 @@ -322,7 +314,6 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRef rcDP.subShift = 1; } } -#if JVET_Q0806 else if( subShiftMode == 3 ) { if (rcDP.org.height > 8 ) @@ -330,7 +321,6 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRef rcDP.subShift = 1; } } -#endif } void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, ComponentID compID, bool useHadamard ) @@ -3466,7 +3456,6 @@ Distortion RdCost::xGetMRHADs( const DistParam &rcDtParam ) return m_afpDistortFunc[DF_HAD]( modDistParam ); } -#if JVET_Q0806 void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY, int iRefStride, const Pel* mask, int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID) { rcDP.bitDepth = bitDepth; @@ -3529,5 +3518,4 @@ Distortion RdCost::xGetSADwMask( const DistParam& rcDtParam ) sum <<= subShift; return (sum >> distortionShift ); } -#endif //! \} diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 7d10e131abeee507b6dd52fb589a2d843f2c060b..fb5cd351c76b4c2ed2d50ab4610d77ec36ec2491 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -72,12 +72,10 @@ public: #if WCG_EXT CPelBuf orgLuma; #endif -#if JVET_Q0806 const Pel* mask; int maskStride; int stepX; int maskStride2; -#endif int step; FpDistFunc distFunc; int bitDepth; @@ -97,12 +95,10 @@ public: int cShiftY; DistParam() : org(), cur(), -#if JVET_Q0806 mask( nullptr ), maskStride( 0 ), stepX(0), maskStride2(0), -#endif step( 1 ), bitDepth( 0 ), useMR( false ), applyWeight( false ), isBiPred( false ), wpCur( nullptr ), compID( MAX_NUM_COMPONENT ), maximumDistortionForEarlyExit( std::numeric_limits<Distortion>::max() ), subShift( 0 ) , cShiftX(-1), cShiftY(-1) { } @@ -180,9 +176,7 @@ public: void setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY , int iRefStride, int bitDepth, ComponentID compID, int subShiftMode = 0, int step = 1, bool useHadamard = false ); void setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, ComponentID compID, bool useHadamard = false ); void setDistParam( DistParam &rcDP, const Pel* pOrg, const Pel* piRefY, int iOrgStride, int iRefStride, int bitDepth, ComponentID compID, int width, int height, int subShiftMode = 0, int step = 1, bool useHadamard = false, bool bioApplied = false ); -#if JVET_Q0806 void setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY, int iRefStride, const Pel* mask, int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID); -#endif double getMotionLambda ( ) { return m_dLambdaMotionSAD; } void selectMotionLambda ( ) { m_motionLambda = getMotionLambda( ); } @@ -367,9 +361,7 @@ private: static Distortion xGetSAD48 ( const DistParam& pcDtParam ); static Distortion xGetSAD_full ( const DistParam& pcDtParam ); -#if JVET_Q0806 static Distortion xGetSADwMask ( const DistParam& pcDtParam ); -#endif static Distortion xGetMRSAD ( const DistParam& pcDtParam ); static Distortion xGetMRSAD4 ( const DistParam& pcDtParam ); @@ -409,11 +401,9 @@ private: template<X86_VEXT vext> static Distortion xGetHADs_SIMD ( const DistParam& pcDtParam ); -#if JVET_Q0806 template< X86_VEXT vext > static Distortion xGetSADwMask_SIMD( const DistParam& pcDtParam ); #endif -#endif public: @@ -423,9 +413,7 @@ public: Distortion getDistPart( const CPelBuf &org, const CPelBuf &cur, int bitDepth, const ComponentID compID, DFunc eDFunc ); #endif -#if JVET_Q0806 Distortion getDistPart(const CPelBuf &org, const CPelBuf &cur, const Pel* mask, int bitDepth, const ComponentID compID, DFunc eDFunc); -#endif };// END CLASS DEFINITION RdCost //! \} diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 8ec4e5f855a20ce8279cf8a02073b87a0c59faaf..2ce823a75c79a260b77af0b368a5c5e552de0f89 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -70,11 +70,7 @@ const char* nalUnitTypeToString(NalUnitType type) case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; case NAL_UNIT_CODED_SLICE_GDR: return "GDR"; -#if JVET_Q0117_PARAMETER_SETS_CLEANUP case NAL_UNIT_DCI: return "DCI"; -#else - case NAL_UNIT_DPS: return "DPS"; -#endif case NAL_UNIT_VPS: return "VPS"; case NAL_UNIT_SPS: return "SPS"; case NAL_UNIT_PPS: return "PPS"; @@ -407,57 +403,10 @@ void initROM() } } -#if !JVET_Q0806 - for( int idxH = MAX_CU_DEPTH - MIN_CU_LOG2; idxH >= 0; --idxH ) - { - for( int idxW = MAX_CU_DEPTH - MIN_CU_LOG2; idxW >= 0; --idxW ) - { - int numW = 1 << idxW; - int numH = 1 << idxH; - int ratioW = std::max( 0, idxW - idxH ); - int ratioH = std::max( 0, idxH - idxW ); - int sum = std::max( (numW >> ratioW), (numH >> ratioH) ) - 1; - for( int y = 0; y < numH; y++ ) - { - int idxY = y >> ratioH; - for( int x = 0; x < numW; x++ ) - { - int idxX = x >> ratioW; - g_triangleMvStorage[TRIANGLE_DIR_135][idxH][idxW][y][x] = (idxX == idxY) ? 2 : (idxX > idxY ? 0 : 1); - g_triangleMvStorage[TRIANGLE_DIR_45][idxH][idxW][y][x] = (idxX + idxY == sum) ? 2 : (idxX + idxY > sum ? 1 : 0); - } - } - } - } - - for (int idxH = 0; idxH < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxH) - { - for (int idxW = 0; idxW < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxW) - { - const int nCbH = 1 << (idxH + 1); - const int nCbW = 1 << (idxW + 1); - const int nCbR = (nCbW > nCbH) ? nCbW / nCbH : nCbH / nCbW; - - // let SIMD can read at least 64-bit when at last row - g_triangleWeights[0][idxH][idxW] = new int16_t[nCbH * nCbW + 4]; - g_triangleWeights[1][idxH][idxW] = new int16_t[nCbH * nCbW + 4]; - for (int y = 0; y < nCbH; y++) - { - for (int x = 0; x < nCbW; x++) - { - g_triangleWeights[0][idxH][idxW][y*nCbW + x] = (nCbW > nCbH) ? Clip3(0, 8, x / nCbR - y + 4) : Clip3(0, 8, x - y / nCbR + 4); - g_triangleWeights[1][idxH][idxW][y*nCbW + x] = (nCbW > nCbH) ? Clip3(0, 8, nCbH - 1 - x / nCbR - y + 4) : Clip3(0, 8, nCbW - 1 - x - y / nCbR + 4); - } - } - } - } -#else initGeoTemplate(); -#endif ::memset(g_isReusedUniMVsFilled, 0, sizeof(g_isReusedUniMVsFilled)); -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX for (int qp = 0; qp < 57; qp++) { int qpRem = (qp + 12) % 6; @@ -467,7 +416,6 @@ void initROM() double threshQP = ((double)(1 << quantiserRightShift)) / quantiserScale; g_paletteQuant[qp] = (int)(threshQP*0.16 + 0.5); } -#endif } void destroyROM() @@ -493,18 +441,6 @@ void destroyROM() delete gp_sizeIdxInfo; gp_sizeIdxInfo = nullptr; -#if !JVET_Q0806 - for (int idxH = 0; idxH < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxH) - { - for (int idxW = 0; idxW < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxW) - { - delete[] g_triangleWeights[0][idxH][idxW]; - delete[] g_triangleWeights[1][idxH][idxW]; - g_triangleWeights[0][idxH][idxW] = nullptr; - g_triangleWeights[1][idxH][idxW] = nullptr; - } - } -#else for( int modeIdx = 0; modeIdx < GEO_NUM_PARTITION_MODE; modeIdx++ ) { delete[] g_GeoParams[modeIdx]; @@ -518,7 +454,6 @@ void destroyROM() g_globalGeoWeights [i] = nullptr; g_globalGeoEncSADmask[i] = nullptr; } -#endif } // ==================================================================================================================== @@ -744,23 +679,14 @@ const uint32_t g_scalingListSize [SCALING_LIST_SIZE_NUM] = { 1, 4, 16, 64, 256, const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -#if !JVET_Q0806 -uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -int16_t *g_triangleWeights[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; -#endif Mv g_reusedUniMVs[32][32][8][8][2][33]; bool g_isReusedUniMVsFilled[32][32][8][8]; -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX uint16_t g_paletteQuant[57]; -#else -const uint8_t g_paletteQuant[52] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 24, 23, 25, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 45 }; -#endif uint8_t g_paletteRunTopLut [5] = { 0, 1, 1, 2, 2 }; uint8_t g_paletteRunLeftLut[5] = { 0, 1, 2, 3, 4 }; -#if JVET_Q0806 void initGeoTemplate() { g_GeoParams = new int16_t*[GEO_NUM_PARTITION_MODE]; @@ -841,5 +767,4 @@ int16_t g_weightOffset [GEO_NUM_PARTITION_MODE][GEO_NUM_CU_SIZE][GEO_NUM int8_t g_angle2mask[GEO_NUM_ANGLES] = { 0, -1, 1, 2, 3, 4, -1, -1, 5, -1, -1, 4, 3, 2, 1, -1, 0, -1, 1, 2, 3, 4, -1, -1, 5, -1, -1, 4, 3, 2, 1, -1 }; int8_t g_Dis[GEO_NUM_ANGLES] = { 8, 8, 8, 8, 4, 4, 2, 1, 0, -1, -2, -4, -4, -8, -8, -8, -8, -8, -8, -8, -4, -4, -2, -1, 0, 1, 2, 4, 4, 8, 8, 8 }; int8_t g_angle2mirror[GEO_NUM_ANGLES] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2 }; -#endif //! \} diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index ecdbdd9bc79e9645352fc21264fa241d8685064a..e3b7fa5905c8c278a3ee13c99a86741160ea9e5b 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -205,11 +205,6 @@ constexpr uint8_t g_tbMax[257] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, //! \} -#if !JVET_Q0806 -extern uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -// 7-tap/3-tap, direction, 2/4/8/16/32/64/128 -extern int16_t *g_triangleWeights[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; -#endif extern bool g_mctsDecCheckEnabled; @@ -217,17 +212,12 @@ class Mv; extern Mv g_reusedUniMVs[32][32][8][8][2][33]; extern bool g_isReusedUniMVsFilled[32][32][8][8]; -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX extern uint16_t g_paletteQuant[57]; -#else -extern const uint8_t g_paletteQuant[52]; -#endif extern uint8_t g_paletteRunTopLut[5]; extern uint8_t g_paletteRunLeftLut[5]; const int g_IBCBufferSize = 256 * 128; -#if JVET_Q0806 void initGeoTemplate(); extern int16_t** g_GeoParams; extern int16_t* g_globalGeoWeights [GEO_NUM_PRESTORED_MASK]; @@ -236,6 +226,5 @@ extern int16_t g_weightOffset [GEO_NUM_PARTITION_MODE][GEO_NUM_CU_SIZE][ extern int8_t g_angle2mask [GEO_NUM_ANGLES]; extern int8_t g_Dis[GEO_NUM_ANGLES]; extern int8_t g_angle2mirror[GEO_NUM_ANGLES]; -#endif #endif //__TCOMROM__ diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index c0b86e0903f43070291af133844d6e3e8b179b7f..27550e7ba09c353e725639603ad768c0cb94647f 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -156,9 +156,7 @@ const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) case SEI::FILM_GRAIN_CHARACTERISTICS: return "Film grain characteristics"; // not currently decoded case SEI::FRAME_PACKING: return "Frame packing arrangement"; case SEI::DECODING_UNIT_INFO: return "Decoding unit information"; -#if JVET_P0190_SCALABLE_NESTING_SEI case SEI::SCALABLE_NESTING: return "Scalable nesting"; -#endif case SEI::DECODED_PICTURE_HASH: return "Decoded picture hash"; case SEI::DEPENDENT_RAP_INDICATION: return "Dependent RAP indication"; case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: return "Mastering display colour volume"; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 2e7e2d92c2d7896c83ace8eb49aa67c86e3e49af..182cdbe46f6e0968951aef8ecf85fbff0fe4c792 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -63,9 +63,7 @@ public: FRAME_PACKING = 45, DECODING_UNIT_INFO = 130, DECODED_PICTURE_HASH = 132, -#if JVET_P0190_SCALABLE_NESTING_SEI SCALABLE_NESTING = 133, -#endif MASTERING_DISPLAY_COLOUR_VOLUME = 137, DEPENDENT_RAP_INDICATION = 145, EQUIRECTANGULAR_PROJECTION = 150, @@ -197,12 +195,8 @@ public: std::vector<uint8_t> m_gcmpFunctionCoeffV; std::vector<bool> m_gcmpFunctionVAffectedByUFlag; bool m_gcmpGuardBandFlag; -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE uint8_t m_gcmpGuardBandType; bool m_gcmpGuardBandBoundaryExteriorFlag; -#else - bool m_gcmpGuardBandBoundaryType; -#endif uint8_t m_gcmpGuardBandSamplesMinus1; }; @@ -283,9 +277,7 @@ public: , m_bpMaxSubLayers (0) , m_bpDecodingUnitHrdParamsPresentFlag (false) , m_decodingUnitCpbParamsInPicTimingSeiFlag (false) -#if JVET_Q0221 , m_decodingUnitDpbDuParamsInPicTimingSeiFlag(false) -#endif , m_sublayerInitialCpbRemovalDelayPresentFlag(false) , m_additionalConcatenationInfoPresentFlag (false) , m_maxInitialRemovalDelayForConcatenation (0) @@ -320,9 +312,7 @@ public: uint32_t m_cpbRemovalDelayDelta [15]; bool m_bpDecodingUnitHrdParamsPresentFlag; bool m_decodingUnitCpbParamsInPicTimingSeiFlag; -#if JVET_Q0221 bool m_decodingUnitDpbDuParamsInPicTimingSeiFlag; -#endif bool m_sublayerInitialCpbRemovalDelayPresentFlag; bool m_additionalConcatenationInfoPresentFlag; uint32_t m_maxInitialRemovalDelayForConcatenation; @@ -342,13 +332,7 @@ public: , m_numDecodingUnitsMinus1 (0) , m_duCommonCpbRemovalDelayFlag (false) , m_cpbAltTimingInfoPresentFlag (false) -#if !JVET_Q0219_SIGNAL_ALT_BUFFER_DELAY_PARMS - , m_cpbDelayOffset(0) - , m_dpbDelayOffset(0) -#endif -#if JVET_Q0818_PT_SEI , m_ptDisplayElementalPeriodsMinus1(0) -#endif { ::memset(m_ptSubLayerDelaysPresentFlag, 0, sizeof(m_ptSubLayerDelaysPresentFlag)); ::memset(m_duCommonCpbRemovalDelayMinus1, 0, sizeof(m_duCommonCpbRemovalDelayMinus1)); @@ -373,20 +357,11 @@ public: std::vector<uint32_t> m_numNalusInDuMinus1; std::vector<uint32_t> m_duCpbRemovalDelayMinus1; bool m_cpbAltTimingInfoPresentFlag; -#if JVET_Q0219_SIGNAL_ALT_BUFFER_DELAY_PARMS std::vector<std::vector<uint32_t>> m_cpbAltInitialCpbRemovalDelayDelta; std::vector<std::vector<uint32_t>> m_cpbAltInitialCpbRemovalOffsetDelta; std::vector<uint32_t> m_cpbDelayOffset; std::vector<uint32_t> m_dpbDelayOffset; -#else - std::vector<uint32_t> m_cpbAltInitialCpbRemovalDelayDelta; - std::vector<uint32_t> m_cpbAltInitialCpbRemovalOffsetDelta; - uint32_t m_cpbDelayOffset; - uint32_t m_dpbDelayOffset; -#endif -#if JVET_Q0818_PT_SEI int m_ptDisplayElementalPeriodsMinus1; -#endif }; class SEIDecodingUnitInfo : public SEI @@ -490,7 +465,6 @@ SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType); /// delete list of SEI messages (freeing the referenced objects) void deleteSEIs (SEIMessages &seiList); -#if JVET_P0190_SCALABLE_NESTING_SEI class SEIScalableNesting : public SEI { public: @@ -513,7 +487,6 @@ public: SEIMessages m_nestedSEIs; }; -#endif #if ENABLE_TRACING @@ -638,27 +611,15 @@ class SEISubpicureLevelInfo : public SEI public: PayloadType payloadType() const { return SUBPICTURE_LEVEL_INFO; } SEISubpicureLevelInfo() -#if !JVET_Q0630_SUBPIC_LEVEL - : m_sliSeqParameterSetId(0) - , m_numRefLevels(0) -#else : m_numRefLevels(0) -#endif , m_explicitFractionPresentFlag (false) -#if JVET_Q0630_SUBPIC_LEVEL , m_numSubpics(0) -#endif {} virtual ~SEISubpicureLevelInfo() {} -#if !JVET_Q0630_SUBPIC_LEVEL - int m_sliSeqParameterSetId; -#endif int m_numRefLevels; bool m_explicitFractionPresentFlag; -#if JVET_Q0630_SUBPIC_LEVEL int m_numSubpics; -#endif std::vector<Level::Name> m_refLevelIdc; std::vector<std::vector<int>> m_refLevelFraction; }; diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index 5f72527565b9622b9e40118c54435c73fefd0846..a34b44676ae08a1e7ef54515f7498e84c8ce5fd4 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -727,7 +727,6 @@ void SampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructure& isBelowRightAvail = (!isBelowRightAvail) ? false : CU::isSameTile(*cuCurr, *cuBelowRight); } -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY // check cross subpic flags const SubPic& curSubPic = cs.pps->getSubPicFromCU(*cuCurr); if (!curSubPic.getloopFilterAcrossEnabledFlag()) @@ -741,19 +740,13 @@ void SampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructure& isBelowLeftAvail = (!isBelowLeftAvail) ? false : CU::isSameSubPic(*cuCurr, *cuBelowLeft); isBelowRightAvail = (!isBelowRightAvail) ? false : CU::isSameSubPic(*cuCurr, *cuBelowRight); } -#endif } bool SampleAdaptiveOffset::isCrossedByVirtualBoundaries(const int xPos, const int yPos, const int width, const int height, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PicHeader* picHeader ) { numHorVirBndry = 0; numVerVirBndry = 0; -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG if( picHeader->getVirtualBoundariesPresentFlag() ) { -#else - if (picHeader->getLoopFilterAcrossVirtualBoundariesDisabledFlag()) - { -#endif for (int i = 0; i < picHeader->getNumHorVirtualBoundaries(); i++) { if (yPos <= picHeader->getVirtualBoundariesPosY(i) && picHeader->getVirtualBoundariesPosY(i) <= yPos + height) diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 84d8c42bca8544242187d7d0dec23f16837da382..e59b9c29a3090af16ab069429c6a3900c6faa5b0 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -53,52 +53,33 @@ Slice::Slice() , m_iAssociatedIRAPType ( NAL_UNIT_INVALID ) , m_rpl0Idx ( -1 ) , m_rpl1Idx ( -1 ) -#if JVET_Q0155_COLOUR_ID , m_colourPlaneId ( 0 ) -#endif , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) -#if JVET_Q0775_PH_IN_SH , m_pictureHeaderInSliceHeader ( false ) -#endif , m_eSliceType ( I_SLICE ) , m_iSliceQp ( 0 ) , m_ChromaQpAdjEnabled ( false ) -#if JVET_Q0346_LMCS_ENABLE_IN_SH , m_lmcsEnabledFlag ( 0 ) -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH , m_explicitScalingListUsed ( 0 ) -#endif , m_deblockingFilterDisable ( false ) , m_deblockingFilterOverrideFlag ( false ) , m_deblockingFilterBetaOffsetDiv2( 0 ) , m_deblockingFilterTcOffsetDiv2 ( 0 ) -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS , m_deblockingFilterCbBetaOffsetDiv2( 0 ) , m_deblockingFilterCbTcOffsetDiv2 ( 0 ) , m_deblockingFilterCrBetaOffsetDiv2( 0 ) , m_deblockingFilterCrTcOffsetDiv2 ( 0 ) -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM , m_tsResidualCodingDisabledFlag ( false ) -#endif , m_pendingRasInit ( false ) , m_bCheckLDC ( false ) , m_biDirPred ( false ) , m_iSliceQpDelta ( 0 ) , m_iDepth ( 0 ) -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP -, m_dps ( nullptr ) -#endif , m_pcSPS ( NULL ) , m_pcPPS ( NULL ) , m_pcPic ( NULL ) , m_pcPicHeader ( NULL ) , m_colFromL0Flag ( true ) -#if !SPS_ID_CHECK -, m_noIncorrectPicOutputFlag ( false ) -, m_handleCraAsCvsStartFlag ( false ) -#endif , m_colRefIdx ( 0 ) , m_uiTLayer ( 0 ) , m_bTLayerSwitchingFlag ( false ) @@ -153,12 +134,10 @@ Slice::Slice() } memset(m_alfApss, 0, sizeof(m_alfApss)); -#if JVET_Q0795_CCALF m_ccAlfFilterParam.reset(); resetTileGroupAlfEnabledFlag(); resetTileGroupCcAlCbfEnabledFlag(); resetTileGroupCcAlCrfEnabledFlag(); -#endif m_sliceMap.initSliceMap(); } @@ -176,16 +155,10 @@ void Slice::initSlice() m_aiNumRefIdx[i] = 0; } m_colFromL0Flag = true; -#if JVET_Q0155_COLOUR_ID m_colourPlaneId = 0; -#endif m_colRefIdx = 0; -#if JVET_Q0346_LMCS_ENABLE_IN_SH m_lmcsEnabledFlag = 0; -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH m_explicitScalingListUsed = 0; -#endif initEqualRef(); m_bCheckLDC = false; @@ -210,22 +183,16 @@ void Slice::initSlice() m_isDRAP = false; m_latestDRAPPOC = MAX_INT; resetTileGroupAlfEnabledFlag(); -#if JVET_Q0795_CCALF m_ccAlfFilterParam.reset(); m_tileGroupCcAlfCbEnabledFlag = 0; m_tileGroupCcAlfCrEnabledFlag = 0; m_tileGroupCcAlfCbApsId = -1; m_tileGroupCcAlfCrApsId = -1; -#endif } void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SPS *sps ) { -#if JVET_Q0819_PH_CHANGES if (pps->getRplInfoInPhFlag()) -#else - if(picHeader->getPicRplPresentFlag()) -#endif { setRPL0idx( picHeader->getRPL0idx() ); *getLocalRPL0() = *picHeader->getLocalRPL0(); @@ -253,12 +220,10 @@ void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SP setDeblockingFilterDisable( picHeader->getDeblockingFilterDisable() ); setDeblockingFilterBetaOffsetDiv2( picHeader->getDeblockingFilterBetaOffsetDiv2() ); setDeblockingFilterTcOffsetDiv2( picHeader->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS setDeblockingFilterCbBetaOffsetDiv2( picHeader->getDeblockingFilterCbBetaOffsetDiv2() ); setDeblockingFilterCbTcOffsetDiv2( picHeader->getDeblockingFilterCbTcOffsetDiv2() ); setDeblockingFilterCrBetaOffsetDiv2( picHeader->getDeblockingFilterCrBetaOffsetDiv2() ); setDeblockingFilterCrTcOffsetDiv2( picHeader->getDeblockingFilterCrTcOffsetDiv2() ); -#endif setSaoEnabledFlag(CHANNEL_TYPE_LUMA, picHeader->getSaoEnabledFlag(CHANNEL_TYPE_LUMA)); setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, picHeader->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA)); @@ -269,17 +234,14 @@ void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SP setTileGroupNumAps(picHeader->getNumAlfAps()); setAlfAPSs(picHeader->getAlfAPSs()); setTileGroupApsIdChroma(picHeader->getAlfApsIdChroma()); -#if JVET_Q0795_CCALF setTileGroupCcAlfCbEnabledFlag(picHeader->getCcAlfEnabledFlag(COMPONENT_Cb)); setTileGroupCcAlfCrEnabledFlag(picHeader->getCcAlfEnabledFlag(COMPONENT_Cr)); setTileGroupCcAlfCbApsId(picHeader->getCcAlfCbApsId()); setTileGroupCcAlfCrApsId(picHeader->getCcAlfCrApsId()); m_ccAlfFilterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1] = picHeader->getCcAlfEnabledFlag(COMPONENT_Cb); m_ccAlfFilterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1] = picHeader->getCcAlfEnabledFlag(COMPONENT_Cr); -#endif } -#if JVET_Q0151_Q0205_ENTRYPOINTS void Slice::setNumSubstream(const SPS* sps, const PPS* pps) { uint32_t ctuAddr, ctuX, ctuY; @@ -301,14 +263,9 @@ void Slice::setNumSubstream(const SPS* sps, const PPS* pps) } void Slice::setNumEntryPoints(const SPS *sps, const PPS *pps) -#else -void Slice::setNumEntryPoints( const PPS *pps ) -#endif { uint32_t ctuAddr, ctuX, ctuY; -#if JVET_Q0151_Q0205_ENTRYPOINTS uint32_t prevCtuAddr, prevCtuX, prevCtuY; -#endif m_numEntryPoints = 0; // count the number of CTUs that align with either the start of a tile, or with an entropy coding sync point @@ -318,15 +275,11 @@ void Slice::setNumEntryPoints( const PPS *pps ) ctuAddr = m_sliceMap.getCtuAddrInSlice( i ); ctuX = ( ctuAddr % pps->getPicWidthInCtu() ); ctuY = ( ctuAddr / pps->getPicWidthInCtu() ); -#if JVET_Q0151_Q0205_ENTRYPOINTS prevCtuAddr = m_sliceMap.getCtuAddrInSlice(i - 1); prevCtuX = (prevCtuAddr % pps->getPicWidthInCtu()); prevCtuY = (prevCtuAddr / pps->getPicWidthInCtu()); if (pps->ctuToTileRowBd(ctuY) != pps->ctuToTileRowBd(prevCtuY) || pps->ctuToTileColBd(ctuX) != pps->ctuToTileColBd(prevCtuX) || (ctuY != prevCtuY && sps->getEntropyCodingSyncEntryPointsPresentFlag())) -#else - if( pps->ctuIsTileColBd( ctuX ) && (pps->ctuIsTileRowBd( ctuY ) || pps->getEntropyCodingSyncEnabledFlag() ) ) -#endif { m_numEntryPoints++; } @@ -606,11 +559,7 @@ void Slice::checkColRefIdx(uint32_t curSliceSegmentIdx, const Picture* pic) } } -#if JVET_P0978_RPL_RESTRICTIONS void Slice::checkCRA(const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int pocCRA, PicList& rcListPic) -#else -void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic) -#endif { if (pocCRA < MAX_UINT && getPOC() > pocCRA) { @@ -653,21 +602,8 @@ void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureLi } } } -#if !JVET_P0978_RPL_RESTRICTIONS - if (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP) // IDR picture found - { - pocCRA = getPOC(); - associatedIRAPType = getNalUnitType(); - } - else if (getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) // CRA picture found - { - pocCRA = getPOC(); - associatedIRAPType = getNalUnitType(); - } -#endif } -#if JVET_P0978_RPL_RESTRICTIONS void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int associatedIRAPDecodingOrderNumber, PicList& rcListPic) { Picture* pcRefPic; @@ -682,11 +618,7 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi int numActiveEntriesL0 = getNumRefIdx(REF_PIC_LIST_0); int numActiveEntriesL1 = getNumRefIdx(REF_PIC_LIST_1); -#if JVET_Q0042_VUI bool fieldSeqFlag = getSPS()->getFieldSeqFlag(); -#else - bool fieldSeqFlag = getSPS()->getVuiParameters() && getSPS()->getVuiParameters()->getFieldSeqFlag(); -#endif int currentPictureIsTrailing = 0; if (getPic()->getDecodingOrderNumber() > associatedIRAPDecodingOrderNumber) @@ -805,7 +737,6 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi } } } -#endif void Slice::checkSTSA(PicList& rcListPic) @@ -818,18 +749,10 @@ void Slice::checkSTSA(PicList& rcListPic) { pcRefPic = m_apcRefPicList[REF_PIC_LIST_0][ii]; -#if JVET_Q0156_STSA if( m_eNalUnitType == NAL_UNIT_CODED_SLICE_STSA && pcRefPic->layerId == m_pcPic->layerId ) { CHECK( pcRefPic->layer == m_uiTLayer, "When the current picture is an STSA picture and nuh_layer_id equal to that of the current picture, there shall be no active entry in the RPL that has TemporalId equal to that of the current picture" ); } -#else - // Checking this: "When the current picture is an STSA picture, there shall be no active entry in RefPicList[ 0 ] or RefPicList[ 1 ] that has TemporalId equal to that of the current picture" - if (getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA) - { - CHECK(pcRefPic->layer == m_uiTLayer, "When the current picture is an STSA picture, there shall be no active entry in the RPL that has TemporalId equal to that of the current picture"); - } -#endif // Checking this: "When the current picture is a picture that follows, in decoding order, an STSA picture that has TemporalId equal to that of the current picture, there shall be no // picture that has TemporalId equal to that of the current picture included as an active entry in RefPicList[ 0 ] or RefPicList[ 1 ] that precedes the STSA picture in decoding order." @@ -841,18 +764,10 @@ void Slice::checkSTSA(PicList& rcListPic) { pcRefPic = m_apcRefPicList[REF_PIC_LIST_1][ii]; -#if JVET_Q0156_STSA if( m_eNalUnitType == NAL_UNIT_CODED_SLICE_STSA && pcRefPic->layerId == m_pcPic->layerId ) { CHECK( pcRefPic->layer == m_uiTLayer, "When the current picture is an STSA picture and nuh_layer_id equal to that of the current picture, there shall be no active entry in the RPL that has TemporalId equal to that of the current picture" ); } -#else - // Checking this: "When the current picture is an STSA picture, there shall be no active entry in RefPicList[ 0 ] or RefPicList[ 1 ] that has TemporalId equal to that of the current picture" - if (getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA) - { - CHECK(pcRefPic->layer == m_uiTLayer, "When the current picture is an STSA picture, there shall be no active entry in the RPL that has TemporalId equal to that of the current picture"); - } -#endif // Checking this: "When the current picture is a picture that follows, in decoding order, an STSA picture that has TemporalId equal to that of the current picture, there shall be no // picture that has TemporalId equal to that of the current picture included as an active entry in RefPicList[ 0 ] or RefPicList[ 1 ] that precedes the STSA picture in decoding order." @@ -988,15 +903,11 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_deblockingFilterOverrideFlag = pSrc->m_deblockingFilterOverrideFlag; m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2; m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS m_deblockingFilterCbBetaOffsetDiv2 = pSrc->m_deblockingFilterCbBetaOffsetDiv2; m_deblockingFilterCbTcOffsetDiv2 = pSrc->m_deblockingFilterCbTcOffsetDiv2; m_deblockingFilterCrBetaOffsetDiv2 = pSrc->m_deblockingFilterCrBetaOffsetDiv2; m_deblockingFilterCrTcOffsetDiv2 = pSrc->m_deblockingFilterCrTcOffsetDiv2; -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM m_tsResidualCodingDisabledFlag = pSrc->m_tsResidualCodingDisabledFlag; -#endif for (i = 0; i < NUM_REF_PIC_LIST_01; i++) { @@ -1064,12 +975,8 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_independentSliceIdx = pSrc->m_independentSliceIdx; m_nextSlice = pSrc->m_nextSlice; m_clpRngs = pSrc->m_clpRngs; -#if JVET_Q0346_LMCS_ENABLE_IN_SH m_lmcsEnabledFlag = pSrc->m_lmcsEnabledFlag; -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH m_explicitScalingListUsed = pSrc->m_explicitScalingListUsed; -#endif m_pendingRasInit = pSrc->m_pendingRasInit; @@ -1102,7 +1009,6 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_scalingRatio[i][j] = pSrc->m_scalingRatio[i][j]; } } -#if JVET_Q0795_CCALF m_ccAlfFilterParam = pSrc->m_ccAlfFilterParam; m_ccAlfFilterControl[0] = pSrc->m_ccAlfFilterControl[0]; m_ccAlfFilterControl[1] = pSrc->m_ccAlfFilterControl[1]; @@ -1110,7 +1016,6 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_tileGroupCcAlfCrEnabledFlag = pSrc->m_tileGroupCcAlfCrEnabledFlag; m_tileGroupCcAlfCbApsId = pSrc->m_tileGroupCcAlfCbApsId; m_tileGroupCcAlfCrApsId = pSrc->m_tileGroupCcAlfCrApsId; -#endif } @@ -1154,18 +1059,13 @@ bool Slice::isStepwiseTemporalLayerSwitchingPointCandidate(PicList& rcListPic) c } -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps) const -#else -void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const -#endif { int nalUnitType = this->getNalUnitType(); // When a picture is a leading picture, it shall be a RADL or RASL picture. if(this->getAssociatedIRAPPOC() > this->getPOC()) { -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES //check this only when mixed_nalu_types_in_pic_flag is equal to 0 if (pps.getMixedNaluTypesInPicFlag() == 0) { @@ -1177,31 +1077,17 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const nalUnitType != NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type"); } } -#else - // Do not check IRAP pictures since they may get a POC lower than their associated IRAP - if (nalUnitType < NAL_UNIT_CODED_SLICE_IDR_W_RADL || - nalUnitType > NAL_UNIT_CODED_SLICE_CRA) - { - CHECK(nalUnitType != NAL_UNIT_CODED_SLICE_RASL && - nalUnitType != NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type"); - } -#endif } // When a picture is a trailing picture, it shall not be a RADL or RASL picture. if(this->getAssociatedIRAPPOC() < this->getPOC()) { -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES //check this only when mixed_nalu_types_in_pic_flag is equal to 0 if (pps.getMixedNaluTypesInPicFlag() == 0) { CHECK(nalUnitType == NAL_UNIT_CODED_SLICE_RASL || nalUnitType == NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type"); } -#else - CHECK(nalUnitType == NAL_UNIT_CODED_SLICE_RASL || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type"); -#endif } @@ -1279,11 +1165,7 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const { numLeadingPicsFound++; int limitNonLP = 0; -#if JVET_Q0042_VUI if (pcSlice->getSPS()->getFieldSeqFlag()) -#else - if (pcSlice->getSPS()->getVuiParameters() && pcSlice->getSPS()->getVuiParameters()->getFieldSeqFlag()) -#endif limitNonLP = 1; CHECK(pcPic->poc > this->getAssociatedIRAPPOC() && numLeadingPicsFound > limitNonLP, "Invalid POC"); } @@ -1326,18 +1208,10 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const //Function for applying picture marking based on the Reference Picture List -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId, const PPS& pps ) const -#else -void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId ) const -#endif { int i, isReference; -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES checkLeadingPictureRestrictions(rcListPic, pps); -#else - checkLeadingPictureRestrictions(rcListPic); -#endif bool isNeedToCheck = (this->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) ? false : true; @@ -2039,21 +1913,15 @@ VPS::VPS() , m_vpsEachLayerIsAnOlsFlag (1) , m_vpsOlsModeIdc (0) , m_vpsNumOutputLayerSets (1) -#if JVET_Q0786_PTL_only , m_vpsNumPtls (1) -#endif , m_vpsExtensionFlag() -#if JVET_P0118_HRD_ASPECTS , m_vpsGeneralHrdParamsPresentFlag(false) , m_vpsSublayerCpbParamsPresentFlag(false) , m_numOlsHrdParamsMinus1(0) -#endif -#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++) { @@ -2072,18 +1940,14 @@ VPS::VPS() { m_vpsOlsOutputLayerFlag[i][j] = 0; } -#if JVET_Q0786_PTL_only if(i == 0) m_ptPresentFlag[i] = 1; else m_ptPresentFlag[i] = 0; m_ptlMaxTemporalId[i] = m_vpsMaxSubLayers - 1; m_olsPtlIdx[i] = 0; -#endif -#if JVET_P0118_HRD_ASPECTS m_hrdMaxTid[i] = m_vpsMaxSubLayers - 1; m_olsHrdIdx[i] = 0; -#endif } } @@ -2091,7 +1955,6 @@ VPS::~VPS() { } -#if JVET_Q0814_DPB void VPS::deriveOutputLayerSets() { if( m_uiMaxLayers == 1 ) @@ -2119,10 +1982,8 @@ void VPS::deriveOutputLayerSets() std::vector<std::vector<int>> layerIncludedInOlsFlag( m_totalNumOLSs, std::vector<int>( m_uiMaxLayers, 0 ) ); std::vector<std::vector<int>> dependencyFlag( m_uiMaxLayers, std::vector<int>( m_uiMaxLayers, NOT_VALID ) ); std::vector<std::vector<int>> refLayerIdx( m_uiMaxLayers, std::vector<int>( m_uiMaxLayers, NOT_VALID ) ); -#if JVET_Q0118_CLEANUPS std::vector<int> layerUsedAsRefLayerFlag( m_uiMaxLayers, 0 ); std::vector<int> layerUsedAsOutputLayerFlag( m_uiMaxLayers, NOT_VALID ); -#endif for( int i = 0; i < m_uiMaxLayers; i++ ) { @@ -2139,12 +2000,10 @@ void VPS::deriveOutputLayerSets() dependencyFlag[i][j] = 1; } } -#if JVET_Q0118_CLEANUPS if (m_vpsDirectRefLayerFlag[i][j]) { layerUsedAsRefLayerFlag[j] = 1; } -#endif if( dependencyFlag[i][j] ) { @@ -2157,7 +2016,6 @@ void VPS::deriveOutputLayerSets() m_numOutputLayersInOls[0] = 1; m_outputLayerIdInOls[0][0] = m_vpsLayerId[0]; -#if JVET_Q0118_CLEANUPS layerUsedAsOutputLayerFlag[0] = 1; for (int i = 1; i < m_uiMaxLayers; i++) { @@ -2170,7 +2028,6 @@ void VPS::deriveOutputLayerSets() layerUsedAsOutputLayerFlag[i] = 0; } } -#endif for( int i = 1; i < m_totalNumOLSs; i++ ) { @@ -2196,9 +2053,7 @@ void VPS::deriveOutputLayerSets() if( m_vpsOlsOutputLayerFlag[i][k] ) { layerIncludedInOlsFlag[i][k] = 1; -#if JVET_Q0118_CLEANUPS layerUsedAsOutputLayerFlag[k] = 1; -#endif outputLayerIdx[i][j] = k; m_outputLayerIdInOls[i][j++] = m_vpsLayerId[k]; } @@ -2215,12 +2070,10 @@ void VPS::deriveOutputLayerSets() } } } -#if JVET_Q0118_CLEANUPS for (int i = 0; i < m_uiMaxLayers; i++) { CHECK(layerUsedAsRefLayerFlag[i] == 0 && layerUsedAsOutputLayerFlag[i] == 0, "There shall be no layer that is neither an output layer nor a direct reference layer"); } -#endif m_numLayersInOls[0] = 1; m_layerIdInOls[0][0] = m_vpsLayerId[0]; @@ -2272,7 +2125,6 @@ void VPS::deriveTargetOutputLayerSet( int targetOlsIdx ) m_targetLayerIdSet.push_back( m_layerIdInOls[m_targetOlsIdx][i] ); } } -#endif // ------------------------------------------------------------------------------------------------ // Picture Header @@ -2284,36 +2136,18 @@ PicHeader::PicHeader() , m_gdrPicFlag ( 0 ) , m_noOutputOfPriorPicsFlag ( 0 ) , m_recoveryPocCnt ( 0 ) -#if SPS_ID_CHECK , m_noOutputBeforeRecoveryFlag ( false ) , m_handleCraAsCvsStartFlag ( false ) , m_handleGdrAsCvsStartFlag ( false ) -#endif , m_spsId ( -1 ) , m_ppsId ( -1 ) -#if JVET_P0116_POC_MSB , m_pocMsbPresentFlag ( 0 ) , m_pocMsbVal ( 0 ) -#endif -#if !JVET_Q0119_CLEANUPS -, m_subPicIdSignallingPresentFlag ( 0 ) -, m_subPicIdLen ( 0 ) -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG , m_virtualBoundariesEnabledFlag ( 0 ) , m_virtualBoundariesPresentFlag ( 0 ) -#else -, m_loopFilterAcrossVirtualBoundariesDisabledFlag ( 0 ) -#endif , m_numVerVirtualBoundaries ( 0 ) , m_numHorVirtualBoundaries ( 0 ) -#if !JVET_Q0155_COLOUR_ID -, m_colourPlaneId ( 0 ) -#endif , m_picOutputFlag ( true ) -#if !JVET_Q0819_PH_CHANGES -, m_picRplPresentFlag ( 0 ) -#endif , m_pRPL0 ( 0 ) , m_pRPL1 ( 0 ) , m_rpl0Idx ( 0 ) @@ -2324,70 +2158,38 @@ PicHeader::PicHeader() , m_cuChromaQpOffsetSubdivIntra ( 0 ) , m_cuChromaQpOffsetSubdivInter ( 0 ) , m_enableTMVPFlag ( true ) -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS , m_picColFromL0Flag ( true ) -#endif , m_mvdL1ZeroFlag ( 0 ) -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -, m_maxNumMergeCand ( MRG_MAX_NUM_CANDS ) -#endif , m_maxNumAffineMergeCand ( AFFINE_MRG_MAX_NUM_CANDS ) , m_disFracMMVD ( 0 ) , m_disBdofFlag ( 0 ) , m_disDmvrFlag ( 0 ) , m_disProfFlag ( 0 ) -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0806 -, m_maxNumTriangleCand ( 0 ) -#else -, m_maxNumGeoCand ( 0 ) -#endif -, m_maxNumIBCMergeCand ( IBC_MRG_MAX_NUM_CANDS ) -#endif , m_jointCbCrSignFlag ( 0 ) -#if JVET_Q0819_PH_CHANGES , m_qpDelta ( 0 ) -#else -, m_saoEnabledPresentFlag ( 0 ) -, m_alfEnabledPresentFlag ( 0 ) -#endif , m_numAlfAps ( 0 ) , m_alfApsId ( 0 ) , m_alfChromaApsId ( 0 ) , m_depQuantEnabledFlag ( 0 ) , m_signDataHidingEnabledFlag ( 0 ) -#if !JVET_Q0819_PH_CHANGES -, m_deblockingFilterOverridePresentFlag ( 0 ) -#endif , m_deblockingFilterOverrideFlag ( 0 ) , m_deblockingFilterDisable ( 0 ) , m_deblockingFilterBetaOffsetDiv2 ( 0 ) , m_deblockingFilterTcOffsetDiv2 ( 0 ) -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS , m_deblockingFilterCbBetaOffsetDiv2 ( 0 ) , m_deblockingFilterCbTcOffsetDiv2 ( 0 ) , m_deblockingFilterCrBetaOffsetDiv2 ( 0 ) , m_deblockingFilterCrTcOffsetDiv2 ( 0 ) -#endif , m_lmcsEnabledFlag ( 0 ) , m_lmcsApsId ( -1 ) , m_lmcsAps ( nullptr ) , m_lmcsChromaResidualScaleFlag ( 0 ) -#if JVET_Q0346_SCALING_LIST_USED_IN_SH , m_explicitScalingListEnabledFlag ( 0 ) -#else -, m_scalingListPresentFlag ( 0 ) -#endif , m_scalingListApsId ( -1 ) , m_scalingListAps ( nullptr ) -#if JVET_Q0819_PH_CHANGES , m_numL0Weights ( 0 ) , m_numL1Weights ( 0 ) -#endif { -#if !JVET_Q0119_CLEANUPS - memset(m_subPicId, 0, sizeof(m_subPicId)); -#endif memset(m_virtualBoundariesPosX, 0, sizeof(m_virtualBoundariesPosX)); memset(m_virtualBoundariesPosY, 0, sizeof(m_virtualBoundariesPosY)); memset(m_saoEnabledFlag, 0, sizeof(m_saoEnabledFlag)); @@ -2411,9 +2213,7 @@ PicHeader::PicHeader() m_alfApsId.resize(0); -#if JVET_Q0819_PH_CHANGES resetWpScaling(); -#endif } PicHeader::~PicHeader() @@ -2433,29 +2233,13 @@ void PicHeader::initPicHeader() m_recoveryPocCnt = 0; m_spsId = -1; m_ppsId = -1; -#if JVET_P0116_POC_MSB m_pocMsbPresentFlag = 0; m_pocMsbVal = 0; -#endif -#if !JVET_Q0119_CLEANUPS - m_subPicIdSignallingPresentFlag = 0; - m_subPicIdLen = 0; -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG m_virtualBoundariesEnabledFlag = 0; m_virtualBoundariesPresentFlag = 0; -#else - m_loopFilterAcrossVirtualBoundariesDisabledFlag = 0; -#endif m_numVerVirtualBoundaries = 0; m_numHorVirtualBoundaries = 0; -#if !JVET_Q0155_COLOUR_ID - m_colourPlaneId = 0; -#endif m_picOutputFlag = true; -#if !JVET_Q0819_PH_CHANGES - m_picRplPresentFlag = 0; -#endif m_pRPL0 = 0; m_pRPL1 = 0; m_rpl0Idx = 0; @@ -2466,68 +2250,36 @@ void PicHeader::initPicHeader() m_cuChromaQpOffsetSubdivIntra = 0; m_cuChromaQpOffsetSubdivInter = 0; m_enableTMVPFlag = true; -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS m_picColFromL0Flag = true; -#endif m_mvdL1ZeroFlag = 0; -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - m_maxNumMergeCand = MRG_MAX_NUM_CANDS; -#endif m_maxNumAffineMergeCand = AFFINE_MRG_MAX_NUM_CANDS; m_disFracMMVD = 0; m_disBdofFlag = 0; m_disDmvrFlag = 0; m_disProfFlag = 0; -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0806 - m_maxNumTriangleCand = 0; -#else - m_maxNumGeoCand = 0; -#endif - m_maxNumIBCMergeCand = IBC_MRG_MAX_NUM_CANDS; -#endif m_jointCbCrSignFlag = 0; -#if JVET_Q0819_PH_CHANGES m_qpDelta = 0; -#else - m_saoEnabledPresentFlag = 0; - m_alfEnabledPresentFlag = 0; -#endif m_numAlfAps = 0; m_alfChromaApsId = 0; m_depQuantEnabledFlag = 0; m_signDataHidingEnabledFlag = 0; -#if !JVET_Q0819_PH_CHANGES - m_deblockingFilterOverridePresentFlag = 0; -#endif m_deblockingFilterOverrideFlag = 0; m_deblockingFilterDisable = 0; m_deblockingFilterBetaOffsetDiv2 = 0; m_deblockingFilterTcOffsetDiv2 = 0; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS m_deblockingFilterCbBetaOffsetDiv2 = 0; m_deblockingFilterCbTcOffsetDiv2 = 0; m_deblockingFilterCrBetaOffsetDiv2 = 0; m_deblockingFilterCrTcOffsetDiv2 = 0; -#endif m_lmcsEnabledFlag = 0; m_lmcsApsId = -1; m_lmcsAps = nullptr; m_lmcsChromaResidualScaleFlag = 0; -#if JVET_Q0346_SCALING_LIST_USED_IN_SH m_explicitScalingListEnabledFlag = 0; -#else - m_scalingListPresentFlag = 0; -#endif m_scalingListApsId = -1; m_scalingListAps = nullptr; -#if JVET_Q0819_PH_CHANGES m_numL0Weights = 0; m_numL1Weights = 0; -#endif -#if !JVET_Q0119_CLEANUPS - memset(m_subPicId, 0, sizeof(m_subPicId)); -#endif memset(m_virtualBoundariesPosX, 0, sizeof(m_virtualBoundariesPosX)); memset(m_virtualBoundariesPosY, 0, sizeof(m_virtualBoundariesPosY)); memset(m_saoEnabledFlag, 0, sizeof(m_saoEnabledFlag)); @@ -2550,7 +2302,6 @@ void PicHeader::initPicHeader() m_alfApsId.resize(0); } -#if JVET_Q0819_PH_CHANGES void PicHeader::getWpScaling(RefPicList e, int iRefIdx, WPScalingParam *&wp) const { CHECK(e >= NUM_REF_PIC_LIST_01, "Invalid picture reference list"); @@ -2574,7 +2325,6 @@ void PicHeader::resetWpScaling() } } } -#endif // ------------------------------------------------------------------------------------------------ // Sequence parameter set (SPS) @@ -2598,9 +2348,6 @@ SPSRExt::SPSRExt() SPS::SPS() : m_SPSId ( 0) -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP -, m_decodingParameterSetId ( 0 ) -#endif , m_VPSId ( 0 ) , m_affineAmvrEnabledFlag ( false ) , m_DMVR ( false ) @@ -2610,48 +2357,24 @@ SPS::SPS() , m_chromaFormatIdc (CHROMA_420) , m_separateColourPlaneFlag ( 0 ) , m_uiMaxTLayers ( 1) -#if JVET_P0117_PTL_SCALABILITY , m_ptlDpbHrdParamsPresentFlag (1) , m_SubLayerDpbParamsFlag (0) -#endif // Structure , m_maxWidthInLumaSamples (352) , m_maxHeightInLumaSamples (288) -#if JVET_Q0119_CLEANUPS , m_subPicInfoPresentFlag (false) -#else -, m_subPicPresentFlag (0) -#endif , m_numSubPics(1) -#if JVET_Q0119_CLEANUPS , m_subPicIdMappingExplicitlySignalledFlag ( false ) , m_subPicIdMappingInSpsFlag ( false ) -#else -, m_subPicIdPresentFlag(0) -, m_subPicIdSignallingPresentFlag(0) -#endif , m_subPicIdLen(16) -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX , m_log2MinCodingBlockSize ( 2) -#else -, m_log2MinCodingBlockSize ( 0) -, m_log2DiffMaxMinCodingBlockSize(0) -#endif , m_CTUSize(0) , m_minQT{ 0, 0, 0 } , m_maxMTTHierarchyDepth{ MAX_BT_DEPTH, MAX_BT_DEPTH_INTER, MAX_BT_DEPTH_C } -#if JVET_Q0330_BLOCK_PARTITION , m_maxBTSize{ 0, 0, 0 } , m_maxTTSize{ 0, 0, 0 } -#else -, m_maxBTSize{ MAX_BT_SIZE, MAX_BT_SIZE_INTER, MAX_BT_SIZE_C } -, m_maxTTSize{ MAX_TT_SIZE, MAX_TT_SIZE_INTER, MAX_TT_SIZE_C } -#endif , m_uiMaxCUWidth ( 32) , m_uiMaxCUHeight ( 32) -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX -, m_uiMaxCodingDepth ( 3) -#endif , m_numRPL0 ( 0 ) , m_numRPL1 ( 0 ) , m_rpl1CopyFromRpl0Flag ( false ) @@ -2660,19 +2383,11 @@ SPS::SPS() , m_bLongTermRefsPresent (false) // Tool list , m_transformSkipEnabledFlag (false) -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL , m_log2MaxTransformSkipBlockSize (2) -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM , m_BDPCMEnabledFlag (false) -#else -, m_BDPCMEnabled (0) -#endif , m_JointCbCrEnabledFlag (false) -#if JVET_Q0151_Q0205_ENTRYPOINTS , m_entropyCodingSyncEnabledFlag(false) , m_entropyCodingSyncEntryPointPresentFlag(false) -#endif , m_sbtmvpEnabledFlag (false) , m_bdofEnabledFlag (false) , m_fpelMmvdEnabledFlag ( false ) @@ -2680,14 +2395,10 @@ SPS::SPS() , m_DmvrControlPresentFlag ( false ) , m_ProfControlPresentFlag ( false ) , m_uiBitsForPOC ( 8) -#if JVET_P0116_POC_MSB , m_pocMsbFlag ( false ) , m_pocMsbLen ( 1 ) -#endif -#if JVET_Q0400_EXTRA_BITS , m_numExtraPHBitsBytes ( 0 ) , m_numExtraSHBitsBytes ( 0 ) -#endif , m_numLongTermRefPicSPS ( 0) , m_log2MaxTbSize ( 6) @@ -2697,22 +2408,12 @@ SPS::SPS() , m_saoEnabledFlag (false) , m_bTemporalIdNestingFlag (false) , m_scalingListEnabledFlag (false) -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG , m_virtualBoundariesEnabledFlag( 0 ) , m_virtualBoundariesPresentFlag( 0 ) -#else -, m_loopFilterAcrossVirtualBoundariesDisabledFlag(0) -#endif , m_numVerVirtualBoundaries(0) , m_numHorVirtualBoundaries(0) -#if JVET_P0118_HRD_ASPECTS , m_generalHrdParametersPresentFlag(false) -#else -, m_hrdParametersPresentFlag (false) -#endif -#if JVET_Q0042_VUI , m_fieldSeqFlag (false) -#endif , m_vuiParametersPresentFlag (false) , m_vuiParameters () , m_wrapAroundEnabledFlag (false) @@ -2731,11 +2432,7 @@ SPS::SPS() , m_AffineType ( false ) , m_PROF ( false ) , m_ciip ( false ) -#if !JVET_Q0806 -, m_Triangle ( false ) -#else , m_Geo ( false ) -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET , m_LadfEnabled ( false ) , m_LadfNumIntervals ( 0 ) @@ -2747,12 +2444,10 @@ SPS::SPS() , m_GDREnabledFlag ( true ) , m_SubLayerCbpParametersPresentFlag ( true ) , m_rprEnabledFlag ( false ) -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE , m_maxNumMergeCand(MRG_MAX_NUM_CANDS) , m_maxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS) , m_maxNumIBCMergeCand(IBC_MRG_MAX_NUM_CANDS) , m_maxNumGeoCand(0) -#endif { for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) { @@ -2771,9 +2466,7 @@ SPS::SPS() ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); ::memset(m_virtualBoundariesPosX, 0, sizeof(m_virtualBoundariesPosX)); ::memset(m_virtualBoundariesPosY, 0, sizeof(m_virtualBoundariesPosY)); -#if JVET_Q0179_SCALING_WINDOW_SIZE_CONSTRAINT ::memset(m_ppsValidFlag, 0, sizeof(m_ppsValidFlag)); -#endif } SPS::~SPS() @@ -2884,7 +2577,6 @@ RectSlice::~RectSlice() { } -#if JVET_O1143_SUBPIC_BOUNDARY SubPic::SubPic() : m_subPicID (0) , m_numCTUsInSubPic (0) @@ -2908,23 +2600,7 @@ SubPic::~SubPic() { m_ctuAddrInSubPic.clear(); } -#endif -#if !REMOVE_PPS_REXT -PPSRExt::PPSRExt() -: m_crossComponentPredictionEnabledFlag(false) -#if JVET_Q0441_SAO_MOD_12_BIT -{ -#else -// m_log2SaoOffsetScale initialized below -{ - for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) - { - m_log2SaoOffsetScale[ch] = 0; - } -#endif -} -#endif PPS::PPS() : m_PPSId (0) @@ -2940,11 +2616,7 @@ PPS::PPS() , m_numRefIdxL1DefaultActive (1) , m_rpl1IdxPresentFlag (false) , m_numSubPics (1) -#if JVET_Q0119_CLEANUPS , m_subPicIdMappingInPpsFlag (0) -#else -, m_subPicIdSignallingPresentFlag (0) -#endif , m_subPicIdLen (16) , m_noPicPartitionFlag (1) , m_log2CtuSize (0) @@ -2959,46 +2631,19 @@ PPS::PPS() , m_tileIdxDeltaPresentFlag (0) , m_loopFilterAcrossTilesEnabledFlag (1) , m_loopFilterAcrossSlicesEnabledFlag(0) -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - , m_log2MaxTransformSkipBlockSize (2) -#endif -#if !JVET_Q0151_Q0205_ENTRYPOINTS -, m_entropyCodingSyncEnabledFlag (false) -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS -, m_constantSliceHeaderParamsEnabledFlag (false) -, m_PPSDepQuantEnabledIdc (0) -, m_PPSRefPicListSPSIdc0 (0) -, m_PPSRefPicListSPSIdc1 (0) -, m_PPSMvdL1ZeroIdc (0) -, m_PPSCollocatedFromL0Idc (0) -, m_PPSSixMinusMaxNumMergeCandPlus1 (0) -#if !JVET_Q0806 -, m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 (0) -#else -, m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 (0) -#endif -#endif , m_cabacInitPresentFlag (false) , m_pictureHeaderExtensionPresentFlag(0) , m_sliceHeaderExtensionPresentFlag (false) , m_listsModificationPresentFlag (0) -#if JVET_Q0819_PH_CHANGES , m_rplInfoInPhFlag (0) , m_dbfInfoInPhFlag (0) , m_saoInfoInPhFlag (0) , m_alfInfoInPhFlag (0) , m_wpInfoInPhFlag (0) , m_qpDeltaInfoInPhFlag (0) -#endif -#if SPS_ID_CHECK , m_mixedNaluTypesInPicFlag ( false ) -#endif , m_picWidthInLumaSamples(352) , m_picHeightInLumaSamples( 288 ) -#if !REMOVE_PPS_REXT -, m_ppsRangeExtension () -#endif , pcv (NULL) { m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CbOffset = 0; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0. This is initialised here and never subsequently changed. @@ -3013,9 +2658,7 @@ PPS::PPS() m_ctuToSubPicIdx.clear(); m_rectSlices.clear(); m_sliceMap.clear(); -#if JVET_O1143_SUBPIC_BOUNDARY m_subPics.clear(); -#endif } PPS::~PPS() @@ -3030,9 +2673,7 @@ PPS::~PPS() m_rectSlices.clear(); m_sliceMap.clear(); -#if JVET_O1143_SUBPIC_BOUNDARY m_subPics.clear(); -#endif delete pcv; } @@ -3184,11 +2825,7 @@ void PPS::initRectSliceMap(const SPS *sps) } } -#if JVET_Q0817 if( getSingleSlicePerSubPicFlag() ) -#else - if ((getNumSubPics() > 0) && getSingleSlicePerSubPicFlag()) -#endif { CHECK (sps==nullptr, "RectSliceMap can only be initialized for slice_per_sub_pic_flag with a valid SPS"); m_numSlicesInPic = sps->getNumSubPics(); @@ -3318,7 +2955,6 @@ void PPS::initRectSliceMap(const SPS *sps) /** - initialize mapping between subpicture and CTUs */ -#if JVET_O1143_SUBPIC_BOUNDARY void PPS::initSubPic(const SPS &sps) { if (getSubPicIdMappingInPpsFlag()) @@ -3344,7 +2980,6 @@ void PPS::initSubPic(const SPS &sps) for (int i=0; i< getNumSubPics(); i++) { m_subPics[i].setSubPicIdx(i); -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS if(sps.getSubPicIdMappingExplicitlySignalledFlag()) { if(m_subPicIdMappingInPpsFlag) @@ -3360,7 +2995,6 @@ void PPS::initSubPic(const SPS &sps) { m_subPics[i].setSubPicID(i); } -#endif m_subPics[i].setSubPicCtuTopLeftX(sps.getSubPicCtuTopLeftX(i)); m_subPics[i].setSubPicCtuTopLeftY(sps.getSubPicCtuTopLeftY(i)); m_subPics[i].setSubPicWidthInCTUs(sps.getSubPicWidth(i)); @@ -3394,15 +3028,11 @@ void PPS::initSubPic(const SPS &sps) { CHECK(getNumSubPics() != 1, "only one slice in picture, but number of subpic is not one"); m_subPics[i].addAllCtusInPicToSubPic(0, getPicWidthInCtu(), 0, getPicHeightInCtu(), getPicWidthInCtu()); -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS m_subPics[i].setNumSlicesInSubPic(1); -#endif } else { -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS int numSlicesInSubPic = 0; -#endif for (int j = 0; j < m_numSlicesInPic; j++) { uint32_t ctu = m_sliceMap[j].getCtuAddrInSlice(0); @@ -3415,14 +3045,10 @@ void PPS::initSubPic(const SPS &sps) { // add ctus in a slice to the subpicture it belongs to m_subPics[i].addCTUsToSubPic(m_sliceMap[j].getCtuAddrList()); -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS numSlicesInSubPic++; -#endif } } -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS m_subPics[i].setNumSlicesInSubPic(numSlicesInSubPic); -#endif } m_subPics[i].setTreatedAsPicFlag(sps.getSubPicTreatedAsPicFlag(i)); m_subPics[i].setloopFilterAcrossEnabledFlag(sps.getLoopFilterAcrossSubpicEnabledFlag(i)); @@ -3446,9 +3072,7 @@ const SubPic& PPS::getSubPicFromCU(const CodingUnit& cu) const const Position lumaPos = cu.Y().valid() ? cu.Y().pos() : recalcPosition(cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].pos()); return getSubPicFromPos(lumaPos); } -#endif -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS uint32_t PPS::getSubPicIdxFromSubPicId( uint32_t subPicId ) const { for (int i = 0; i < m_numSubPics; i++) @@ -3460,7 +3084,6 @@ uint32_t PPS::getSubPicIdxFromSubPicId( uint32_t subPicId ) const } return 0; } -#endif void PPS::initRasterSliceMap( std::vector<uint32_t> numTilesInSlice ) { @@ -3626,9 +3249,7 @@ void ReferencePictureList::printRefPicInfo() const ScalingList::ScalingList() { m_disableScalingMatrixForLfnstBlks = true; -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 m_chromaScalingListPresentFlag = true; -#endif for (uint32_t scalingListId = 0; scalingListId < 28; scalingListId++) { int matrixSize = (scalingListId < SCALING_LIST_1D_START_4x4) ? 2 : (scalingListId < SCALING_LIST_1D_START_8x8) ? 4 : 8; @@ -4082,12 +3703,10 @@ void ScalingList::checkDcOfMatrix() } } -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 bool ScalingList::isLumaScalingList( int scalingListId) const { return (scalingListId % MAX_NUM_COMPONENT == SCALING_LIST_1D_START_4x4 || scalingListId == SCALING_LIST_1D_START_64x64 + 1); } -#endif uint32_t PreCalcValues::getValIdx( const Slice &slice, const ChannelType chType ) const { @@ -4169,11 +3788,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS CU::getRprScaling( sps, pps, m_apcRefPicList[refList][rIdx], xScale, yScale ); m_scalingRatio[refList][rIdx] = std::pair<int, int>( xScale, yScale ); -#if JVET_Q0487_SCALING_WINDOW_ISSUES if( m_apcRefPicList[refList][rIdx]->isRefScaled( pps ) == false ) -#else - if( m_scalingRatio[refList][rIdx] == SCALE_1X && pps->getPicWidthInLumaSamples() == m_apcRefPicList[refList][rIdx]->getPicWidthInLumaSamples() && pps->getPicHeightInLumaSamples() == m_apcRefPicList[refList][rIdx]->getPicHeightInLumaSamples() ) -#endif { refPicIsSameRes = true; } @@ -4317,7 +3932,6 @@ bool Slice::checkRPR() return false; } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP bool operator == (const ConstraintInfo& op1, const ConstraintInfo& op2) { if( op1.m_progressiveSourceFlag != op2.m_progressiveSourceFlag ) return false; @@ -4333,9 +3947,7 @@ bool operator == (const ConstraintInfo& op1, const ConstraintInfo& o if( op1.m_noPartitionConstraintsOverrideConstraintFlag != op2.m_noPartitionConstraintsOverrideConstraintFlag ) return false; if( op1.m_noSaoConstraintFlag != op2.m_noSaoConstraintFlag ) return false; if( op1.m_noAlfConstraintFlag != op2.m_noAlfConstraintFlag ) return false; -#if JVET_Q0795_CCALF if( op1.m_noCCAlfConstraintFlag != op2.m_noCCAlfConstraintFlag ) return false; -#endif if( op1.m_noRefWraparoundConstraintFlag != op2.m_noRefWraparoundConstraintFlag ) return false; if( op1.m_noTemporalMvpConstraintFlag != op2.m_noTemporalMvpConstraintFlag ) return false; if( op1.m_noSbtmvpConstraintFlag != op2.m_noSbtmvpConstraintFlag ) return false; @@ -4350,9 +3962,6 @@ bool operator == (const ConstraintInfo& op1, const ConstraintInfo& o if( op1.m_noIbcConstraintFlag != op2.m_noIbcConstraintFlag ) return false; if( op1.m_noCiipConstraintFlag != op2.m_noCiipConstraintFlag ) return false; if( op1.m_noFPelMmvdConstraintFlag != op2.m_noFPelMmvdConstraintFlag ) return false; -#if !JVET_Q0806 - if( op1.m_noTriangleConstraintFlag != op2.m_noTriangleConstraintFlag ) return false; -#endif if( op1.m_noLadfConstraintFlag != op2.m_noLadfConstraintFlag ) return false; if( op1.m_noTransformSkipConstraintFlag != op2.m_noTransformSkipConstraintFlag ) return false; if( op1.m_noBDPCMConstraintFlag != op2.m_noBDPCMConstraintFlag ) return false; @@ -4404,7 +4013,6 @@ bool operator != (const ProfileTierLevel& op1, const ProfileTierLeve { return !(op1 == op2); } -#endif #if ENABLE_TRACING void xTraceVPSHeader() @@ -4412,17 +4020,10 @@ void xTraceVPSHeader() DTRACE( g_trace_ctx, D_HEADER, "=========== Video Parameter Set ===========\n" ); } -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP -void xTraceDPSHeader() -{ - DTRACE( g_trace_ctx, D_HEADER, "=========== Decoding Parameter Set ===========\n" ); -} -#else void xTraceDCIHeader() { DTRACE( g_trace_ctx, D_HEADER, "=========== Decoding Capability Information ===========\n" ); } -#endif void xTraceSPSHeader() { diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index f7ed56e5e778621c977562cd7357d83eea42987b..6c1dd85a9cac0ac31f877cd9000d21d1bc3f6818 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 { @@ -191,11 +189,9 @@ public: void codeScalingList(int* scalingList, int scalingListDC, int scalinListId, int& bitsCost); void setScalingListPreditorModeFlag(uint32_t scalingListId, bool bIsPred) { m_scalingListPreditorModeFlag[scalingListId] = bIsPred; } bool getScalingListPreditorModeFlag(uint32_t scalingListId) const { return m_scalingListPreditorModeFlag[scalingListId]; } -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 bool getChromaScalingListPresentFlag() const {return m_chromaScalingListPresentFlag;} void setChromaScalingListPresentFlag( bool flag) { m_chromaScalingListPresentFlag = flag;} bool isLumaScalingList( int scalingListId) const; -#endif void checkDcOfMatrix(); bool xParseScalingList(const std::string &fileName); void setDefaultScalingList(); @@ -236,9 +232,7 @@ private: uint32_t m_refMatrixId [30]; //!< RefMatrixID bool m_scalingListPreditorModeFlag [30]; //!< reference list index std::vector<int> m_scalingListCoef [30]; //!< quantization matrix -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 bool m_chromaScalingListPresentFlag; -#endif }; class ConstraintInfo @@ -246,13 +240,11 @@ class ConstraintInfo bool m_progressiveSourceFlag; bool m_interlacedSourceFlag; bool m_nonPackedConstraintFlag; -#if JVET_Q0114_CONSTRAINT_FLAGS bool m_nonProjectedConstraintFlag; bool m_noResChangeInClvsConstraintFlag; bool m_oneTilePerPicConstraintFlag; bool m_oneSlicePerPicConstraintFlag; bool m_oneSubpicPerPicConstraintFlag; -#endif bool m_frameOnlyConstraintFlag; bool m_intraOnlyConstraintFlag; uint32_t m_maxBitDepthConstraintIdc; @@ -264,9 +256,7 @@ class ConstraintInfo bool m_noPartitionConstraintsOverrideConstraintFlag; bool m_noSaoConstraintFlag; bool m_noAlfConstraintFlag; -#if JVET_Q0795_CCALF bool m_noCCAlfConstraintFlag; -#endif bool m_noRefWraparoundConstraintFlag; bool m_noTemporalMvpConstraintFlag; bool m_noSbtmvpConstraintFlag; @@ -281,11 +271,7 @@ class ConstraintInfo bool m_noIbcConstraintFlag; bool m_noCiipConstraintFlag; bool m_noFPelMmvdConstraintFlag; -#if !JVET_Q0806 - bool m_noTriangleConstraintFlag; -#else bool m_noGeoConstraintFlag; -#endif bool m_noLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; bool m_noBDPCMConstraintFlag; @@ -293,9 +279,7 @@ class ConstraintInfo bool m_noQpDeltaConstraintFlag; bool m_noDepQuantConstraintFlag; bool m_noSignDataHidingConstraintFlag; -#if JVET_P0124_MIXED_NALU bool m_noMixedNaluTypesInPicConstraintFlag; -#endif bool m_noTrailConstraintFlag; bool m_noStsaConstraintFlag; bool m_noRaslConstraintFlag; @@ -310,13 +294,11 @@ public: : m_progressiveSourceFlag (false) , m_interlacedSourceFlag (false) , m_nonPackedConstraintFlag (false) -#if JVET_Q0114_CONSTRAINT_FLAGS , m_nonProjectedConstraintFlag(false) , m_noResChangeInClvsConstraintFlag(false) , m_oneTilePerPicConstraintFlag(false) , m_oneSlicePerPicConstraintFlag(false) , m_oneSubpicPerPicConstraintFlag(false) -#endif , m_frameOnlyConstraintFlag (false) , m_intraOnlyConstraintFlag (false) , m_maxBitDepthConstraintIdc ( 0) @@ -327,9 +309,7 @@ public: , m_noPartitionConstraintsOverrideConstraintFlag(false) , m_noSaoConstraintFlag (false) , m_noAlfConstraintFlag (false) -#if JVET_Q0795_CCALF , m_noCCAlfConstraintFlag (false) -#endif , m_noRefWraparoundConstraintFlag(false) , m_noTemporalMvpConstraintFlag(false) , m_noSbtmvpConstraintFlag (false) @@ -344,11 +324,7 @@ public: , m_noIbcConstraintFlag (false) , m_noCiipConstraintFlag (false) , m_noFPelMmvdConstraintFlag (false) -#if !JVET_Q0806 - , m_noTriangleConstraintFlag (false) -#else , m_noGeoConstraintFlag (false) -#endif , m_noLadfConstraintFlag (false) , m_noTransformSkipConstraintFlag(false) , m_noBDPCMConstraintFlag (false) @@ -356,9 +332,7 @@ public: , m_noQpDeltaConstraintFlag (false) , m_noDepQuantConstraintFlag (false) , m_noSignDataHidingConstraintFlag(false) -#if JVET_P0124_MIXED_NALU , m_noMixedNaluTypesInPicConstraintFlag(false) -#endif , m_noTrailConstraintFlag (false) , m_noStsaConstraintFlag (false) , m_noRaslConstraintFlag (false) @@ -387,7 +361,6 @@ public: ChromaFormat getMaxChromaFormatConstraintIdc() const { return m_maxChromaFormatConstraintIdc; } void setMaxChromaFormatConstraintIdc(ChromaFormat fmt) { m_maxChromaFormatConstraintIdc = fmt; } -#if JVET_Q0114_CONSTRAINT_FLAGS bool getNonProjectedConstraintFlag() const { return m_nonProjectedConstraintFlag; } void setNonProjectedConstraintFlag(bool b) { m_nonProjectedConstraintFlag = b; } @@ -402,7 +375,6 @@ public: bool getOneSubpicPerPicConstraintFlag() const { return m_oneSubpicPerPicConstraintFlag; } void setOneSubpicPerPicConstraintFlag(bool b) { m_oneSubpicPerPicConstraintFlag = b; } -#endif bool getIntraOnlyConstraintFlag() const { return m_intraOnlyConstraintFlag; } void setIntraOnlyConstraintFlag(bool b) { m_intraOnlyConstraintFlag = b; } @@ -421,10 +393,8 @@ public: void setNoSaoConstraintFlag(bool bVal) { m_noSaoConstraintFlag = bVal; } bool getNoAlfConstraintFlag() const { return m_noAlfConstraintFlag; } void setNoAlfConstraintFlag(bool bVal) { m_noAlfConstraintFlag = bVal; } -#if JVET_Q0795_CCALF bool getNoCCAlfConstraintFlag() const { return m_noCCAlfConstraintFlag; } void setNoCCAlfConstraintFlag(bool val) { m_noCCAlfConstraintFlag = val; } -#endif bool getNoJointCbCrConstraintFlag() const { return m_noJointCbCrConstraintFlag; } void setNoJointCbCrConstraintFlag(bool bVal) { m_noJointCbCrConstraintFlag = bVal; } bool getNoRefWraparoundConstraintFlag() const { return m_noRefWraparoundConstraintFlag; } @@ -455,13 +425,8 @@ public: void setNoCiipConstraintFlag(bool bVal) { m_noCiipConstraintFlag = bVal; } bool getNoFPelMmvdConstraintFlag() const { return m_noFPelMmvdConstraintFlag; } void setNoFPelMmvdConstraintFlag(bool bVal) { m_noFPelMmvdConstraintFlag = bVal; } -#if !JVET_Q0806 - bool getNoTriangleConstraintFlag() const { return m_noTriangleConstraintFlag; } - void setNoTriangleConstraintFlag(bool bVal) { m_noTriangleConstraintFlag = bVal; } -#else bool getNoGeoConstraintFlag() const { return m_noGeoConstraintFlag; } void setNoGeoConstraintFlag(bool bVal) { m_noGeoConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_noLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_noLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } @@ -474,10 +439,8 @@ public: void setNoDepQuantConstraintFlag(bool bVal) { m_noDepQuantConstraintFlag = bVal; } bool getNoSignDataHidingConstraintFlag() const { return m_noSignDataHidingConstraintFlag; } void setNoSignDataHidingConstraintFlag(bool bVal) { m_noSignDataHidingConstraintFlag = bVal; } -#if JVET_P0124_MIXED_NALU bool getNoMixedNaluTypesInPicConstraintFlag() const { return m_noMixedNaluTypesInPicConstraintFlag; } void setNoMixedNaluTypesInPicConstraintFlag(bool bVal) { m_noMixedNaluTypesInPicConstraintFlag = bVal; } -#endif bool getNoTrailConstraintFlag() const { return m_noTrailConstraintFlag; } void setNoTrailConstraintFlag(bool bVal) { m_noTrailConstraintFlag = bVal; } bool getNoStsaConstraintFlag() const { return m_noStsaConstraintFlag; } @@ -495,10 +458,8 @@ public: bool getNoApsConstraintFlag() const { return m_noApsConstraintFlag; } void setNoApsConstraintFlag(bool bVal) { m_noApsConstraintFlag = bVal; } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP friend bool operator == (const ConstraintInfo& op1, const ConstraintInfo& op2); friend bool operator != (const ConstraintInfo& op1, const ConstraintInfo& op2); -#endif }; class ProfileTierLevel @@ -540,10 +501,8 @@ public: Level::Name getSubLayerLevelIdc(int i) const { return m_subLayerLevelIdc[i]; } void setSubLayerLevelIdc(int i, Level::Name x) { m_subLayerLevelIdc[i] = x; } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP friend bool operator == (const ProfileTierLevel& op1, const ProfileTierLevel& op2); friend bool operator != (const ProfileTierLevel& op1, const ProfileTierLevel& op2); -#endif }; @@ -750,7 +709,6 @@ public: }; -#if JVET_O1143_SUBPIC_BOUNDARY class SubPic { private: @@ -773,9 +731,7 @@ private: bool m_treatedAsPicFlag; //!< whether the subpicture is treated as a picture in the decoding process excluding in-loop filtering operations bool m_loopFilterAcrossSubPicEnabledFlag; //!< whether in-loop filtering operations may be performed across the boundaries of the subpicture -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS uint32_t m_numSlicesInSubPic; //!< Number of slices contained in this subpicture -#endif public: SubPic(); @@ -842,7 +798,6 @@ public: bool isFirstCTUinSubPic(uint32_t ctuAddr) { return ctuAddr == m_firstCtuInSubPic; } bool isLastCTUinSubPic(uint32_t ctuAddr) { return ctuAddr == m_lastCtuInSubPic; } -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS void setNumSlicesInSubPic( uint32_t val ) { m_numSlicesInSubPic = val; } uint32_t getNumSlicesInSubPic() const { return m_numSlicesInSubPic; } bool containsCtu(const Position& pos) const @@ -850,8 +805,6 @@ public: return pos.x >= m_subPicCtuTopLeftX && pos.x < m_subPicCtuTopLeftX + m_subPicWidth && pos.y >= m_subPicCtuTopLeftY && pos.y < m_subPicCtuTopLeftY + m_subPicHeight; } -#endif -#if JVET_Q0397_SUB_PIC_EXTRACT bool containsCtu(int ctuAddr) const { for (auto & addr : m_ctuAddrInSubPic) @@ -863,11 +816,8 @@ public: } return false; } - #endif }; -#endif -#if JVET_Q0117_PARAMETER_SETS_CLEANUP // Rename DPS to DCI (decoding_capability_information) class DCI { private: @@ -894,33 +844,6 @@ public: return true; } }; -#else -class DPS -{ -private: - int m_decodingParameterSetId; - int m_maxSubLayersMinus1; - std::vector<ProfileTierLevel> m_profileTierLevel; - -public: - DPS() - : m_decodingParameterSetId(-1) - , m_maxSubLayersMinus1 (0) - {}; - - virtual ~DPS() {}; - - int getDecodingParameterSetId() const { return m_decodingParameterSetId; } - void setDecodingParameterSetId(int val) { m_decodingParameterSetId = val; } - int getMaxSubLayersMinus1() const { return m_maxSubLayersMinus1; } - void setMaxSubLayersMinus1(int val) { m_maxSubLayersMinus1 = val; } - - size_t getNumPTLs() const { return m_profileTierLevel.size(); } - void setProfileTierLevel(const std::vector<ProfileTierLevel> &val) { m_profileTierLevel = val; } - const ProfileTierLevel& getProfileTierLevel(int idx) const { return m_profileTierLevel[idx]; } -}; - -#endif class VPS @@ -942,33 +865,26 @@ private: uint32_t m_directRefLayerIdx[MAX_VPS_LAYERS][MAX_VPS_LAYERS]; uint32_t m_generalLayerIdx[MAX_VPS_LAYERS]; -#if JVET_Q0786_PTL_only uint32_t m_vpsNumPtls; bool m_ptPresentFlag[MAX_NUM_OLSS]; uint32_t m_ptlMaxTemporalId[MAX_NUM_OLSS]; std::vector<ProfileTierLevel> m_vpsProfileTierLevel; uint32_t m_olsPtlIdx[MAX_NUM_OLSS]; -#endif // stores index ( ilrp_idx within 0 .. NumDirectRefLayers ) of the dependent reference layers uint32_t m_interLayerRefIdx[MAX_VPS_LAYERS][MAX_VPS_LAYERS]; bool m_vpsExtensionFlag; -#if JVET_P0118_HRD_ASPECTS bool m_vpsGeneralHrdParamsPresentFlag; bool m_vpsSublayerCpbParamsPresentFlag; uint32_t m_numOlsHrdParamsMinus1; uint32_t m_hrdMaxTid[MAX_NUM_OLSS]; uint32_t m_olsHrdIdx[MAX_NUM_OLSS]; GeneralHrdParams m_generalHrdParams; -#endif -#if JVET_Q0814_DPB std::vector<Size> m_olsDpbPicSize; std::vector<int> m_olsDpbParamsIdx; std::vector<std::vector<int>> m_outputLayerIdInOls; public: -#if JVET_P0118_HRD_ASPECTS std::vector<std::vector<OlsHrdParams>> m_olsHrdParams; -#endif int m_totalNumOLSs; int m_numDpbParams; std::vector<DpbParameters> m_dpbParameters; @@ -980,10 +896,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(); @@ -1034,7 +946,6 @@ public: bool getOlsOutputLayerFlag(uint32_t ols, uint32_t layer) const { return m_vpsOlsOutputLayerFlag[ols][layer]; } void setOlsOutputLayerFlag(uint32_t ols, uint32_t layer, bool t) { m_vpsOlsOutputLayerFlag[ols][layer] = t; } -#if JVET_Q0786_PTL_only uint32_t getNumPtls() const { return m_vpsNumPtls; } void setNumPtls(uint32_t val) { m_vpsNumPtls = val; } @@ -1049,11 +960,9 @@ public: uint32_t getOlsPtlIdx(int idx) const { return m_olsPtlIdx[idx]; } void setOlsPtlIdx(int idx, uint32_t val) { m_olsPtlIdx[idx] = val; } -#endif bool getVPSExtensionFlag() const { return m_vpsExtensionFlag; } void setVPSExtensionFlag(bool t) { m_vpsExtensionFlag = t; } -#if JVET_P0118_HRD_ASPECTS bool getVPSGeneralHrdParamsPresentFlag() const { return m_vpsGeneralHrdParamsPresentFlag; } void setVPSGeneralHrdParamsPresentFlag(bool t) { m_vpsGeneralHrdParamsPresentFlag = t; } bool getVPSSublayerCpbParamsPresentFlag() const { return m_vpsSublayerCpbParamsPresentFlag; } @@ -1071,13 +980,9 @@ public: GeneralHrdParams* getGeneralHrdParameters() { return &m_generalHrdParams; } const GeneralHrdParams* getGeneralHrdParameters() const { return &m_generalHrdParams; } -#endif -#if JVET_P0288_PIC_OUTPUT int getTargetOlsIdx() { return m_targetOlsIdx; } 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; } @@ -1091,18 +996,13 @@ public: void deriveOutputLayerSets(); void deriveTargetOutputLayerSet( int targetOlsIdx ); -#endif -#if JVET_P0125_SEI_CONSTRAINTS void setNumLayersInOls(int olsIdx, int numLayers) { m_numLayersInOls[olsIdx] = numLayers; } int getNumLayersInOls(int olsIdx) const { return m_numLayersInOls[olsIdx]; } void setLayerIdInOls (int olsIdx, int layerIdx, int layerId) { m_layerIdInOls[olsIdx][layerIdx] = layerId; } uint32_t getLayerIdInOls (int olsIdx, int layerIdx) const { return m_layerIdInOls[olsIdx][layerIdx] ; } -#endif -#if JVET_P0118_OLS_EXTRACTION std::vector<int> getLayerIdsInOls(int targetOlsIdx) { return m_layerIdInOls[targetOlsIdx]; } -#endif }; class Window @@ -1155,9 +1055,6 @@ private: int m_colourPrimaries; int m_transferCharacteristics; int m_matrixCoefficients; -#if !JVET_Q0042_VUI - bool m_fieldSeqFlag; -#endif bool m_chromaLocInfoPresentFlag; int m_chromaSampleLocTypeTopField; int m_chromaSampleLocTypeBottomField; @@ -1177,9 +1074,6 @@ public: , m_colourPrimaries (2) , m_transferCharacteristics (2) , m_matrixCoefficients (2) -#if !JVET_Q0042_VUI - , m_fieldSeqFlag (false) -#endif , m_chromaLocInfoPresentFlag (false) , m_chromaSampleLocTypeTopField (0) , m_chromaSampleLocTypeBottomField (0) @@ -1217,10 +1111,6 @@ public: int getMatrixCoefficients() const { return m_matrixCoefficients; } void setMatrixCoefficients(int i) { m_matrixCoefficients = i; } -#if !JVET_Q0042_VUI - bool getFieldSeqFlag() const { return m_fieldSeqFlag; } - void setFieldSeqFlag(bool i) { m_fieldSeqFlag = i; } -#endif bool getChromaLocInfoPresentFlag() const { return m_chromaLocInfoPresentFlag; } void setChromaLocInfoPresentFlag(bool i) { m_chromaLocInfoPresentFlag = i; } @@ -1306,9 +1196,6 @@ class SPS { private: int m_SPSId; -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - int m_decodingParameterSetId; -#endif int m_VPSId; bool m_affineAmvrEnabledFlag; @@ -1321,22 +1208,14 @@ private: uint32_t m_uiMaxTLayers; // maximum number of temporal layers -#if JVET_P0117_PTL_SCALABILITY bool m_ptlDpbHrdParamsPresentFlag; bool m_SubLayerDpbParamsFlag; -#endif // Structure uint32_t m_maxWidthInLumaSamples; uint32_t m_maxHeightInLumaSamples; -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS Window m_conformanceWindow; -#endif -#if JVET_Q0119_CLEANUPS bool m_subPicInfoPresentFlag; // indicates the presence of sub-picture info -#else - bool m_subPicPresentFlag; // indicates the presence of sub-pictures -#endif uint32_t m_numSubPics; //!< number of sub-pictures used std::vector<uint32_t> m_subPicCtuTopLeftX; std::vector<uint32_t> m_subPicCtuTopLeftY; @@ -1344,20 +1223,12 @@ private: std::vector<uint32_t> m_subPicHeight; std::vector<bool> m_subPicTreatedAsPicFlag; std::vector<bool> m_loopFilterAcrossSubpicEnabledFlag; -#if JVET_Q0119_CLEANUPS bool m_subPicIdMappingExplicitlySignalledFlag; bool m_subPicIdMappingInSpsFlag; -#else - bool m_subPicIdPresentFlag; //!< indicates the presence of sub-picture IDs - bool m_subPicIdSignallingPresentFlag; //!< indicates the presence of sub-picture ID signalling in the SPS -#endif uint32_t m_subPicIdLen; //!< sub-picture ID length in bits std::vector<uint16_t> m_subPicId; //!< sub-picture ID for each sub-picture in the sequence int m_log2MinCodingBlockSize; -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - int m_log2DiffMaxMinCodingBlockSize; -#endif unsigned m_CTUSize; unsigned m_partitionOverrideEnalbed; // enable partition constraints override function unsigned m_minQT[3]; // 0: I slice luma; 1: P/B slice; 2: I slice chroma @@ -1368,9 +1239,6 @@ private: unsigned m_dualITree; uint32_t m_uiMaxCUWidth; uint32_t m_uiMaxCUHeight; -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - uint32_t m_uiMaxCodingDepth; ///< Total CU depth, relative to the smallest possible transform block size. -#endif RPLList m_RPLList0; RPLList m_RPLList1; @@ -1387,21 +1255,13 @@ private: // Tool list bool m_transformSkipEnabledFlag; -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL int m_log2MaxTransformSkipBlockSize; -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool m_BDPCMEnabledFlag; -#else - int m_BDPCMEnabled; -#endif bool m_JointCbCrEnabledFlag; // Parameter BitDepths m_bitDepths; -#if JVET_Q0151_Q0205_ENTRYPOINTS bool m_entropyCodingSyncEnabledFlag; //!< Flag for enabling WPP bool m_entropyCodingSyncEntryPointPresentFlag; //!< Flag for indicating the presence of WPP entry points - #endif int m_qpBDOffset[MAX_NUM_CHANNEL_TYPE]; int m_minQpMinus4[MAX_NUM_CHANNEL_TYPE]; // QP_internal - QP_input; @@ -1412,16 +1272,12 @@ private: bool m_DmvrControlPresentFlag; bool m_ProfControlPresentFlag; uint32_t m_uiBitsForPOC; -#if JVET_P0116_POC_MSB bool m_pocMsbFlag; uint32_t m_pocMsbLen; -#endif -#if JVET_Q0400_EXTRA_BITS int m_numExtraPHBitsBytes; int m_numExtraSHBitsBytes; std::vector<bool> m_extraPHBitPresentFlag; std::vector<bool> m_extraSHBitPresentFlag; -#endif uint32_t m_numLongTermRefPicSPS; uint32_t m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]; bool m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS]; @@ -1434,16 +1290,10 @@ private: bool m_bTemporalIdNestingFlag; // temporal_id_nesting_flag bool m_scalingListEnabledFlag; -#if DQ_SDH_SIGNALLING bool m_depQuantEnabledFlag; //!< dependent quantization enabled flag bool m_signDataHidingEnabledFlag; //!< sign data hiding enabled flag -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG bool m_virtualBoundariesEnabledFlag; //!< Enable virtual boundaries tool bool m_virtualBoundariesPresentFlag; //!< disable loop filtering across virtual boundaries -#else - bool m_loopFilterAcrossVirtualBoundariesDisabledFlag; //!< disable loop filtering across virtual boundaries -#endif unsigned m_numVerVirtualBoundaries; //!< number of vertical virtual boundaries unsigned m_numHorVirtualBoundaries; //!< number of horizontal virtual boundaries unsigned m_virtualBoundariesPosX[3]; //!< horizontal position of each vertical virtual boundary @@ -1452,24 +1302,11 @@ private: uint32_t m_uiMaxLatencyIncreasePlus1[MAX_TLAYER]; -#if !JVET_P0118_HRD_ASPECTS - TimingInfo m_timingInfo; -#endif -#if JVET_P0118_HRD_ASPECTS bool m_generalHrdParametersPresentFlag; -#else - bool m_hrdParametersPresentFlag; -#endif -#if JVET_P0118_HRD_ASPECTS GeneralHrdParams m_generalHrdParams; OlsHrdParams m_olsHrdParams[MAX_TLAYER]; -#else - HRDParameters m_hrdParameters; -#endif -#if JVET_Q0042_VUI bool m_fieldSeqFlag; -#endif bool m_vuiParametersPresentFlag; VUI m_vuiParameters; @@ -1480,9 +1317,7 @@ private: ProfileTierLevel m_profileTierLevel; bool m_alfEnabledFlag; -#if JVET_Q0795_CCALF bool m_ccalfEnabledFlag; -#endif bool m_wrapAroundEnabledFlag; unsigned m_wrapAroundOffset; unsigned m_IBCFlag; @@ -1504,11 +1339,7 @@ private: bool m_PROF; bool m_bcw; // bool m_ciip; -#if !JVET_Q0806 - bool m_Triangle; -#else bool m_Geo; -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET bool m_LadfEnabled; int m_LadfNumIntervals; @@ -1524,19 +1355,13 @@ private: bool m_rprEnabledFlag; bool m_interLayerPresentFlag; -#if JVET_Q0297_MER uint32_t m_log2ParallelMergeLevelMinus2; -#endif -#if JVET_Q0179_SCALING_WINDOW_SIZE_CONSTRAINT bool m_ppsValidFlag[64]; Size m_scalingWindowSizeInPPS[64]; -#endif -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE uint32_t m_maxNumMergeCand; uint32_t m_maxNumAffineMergeCand; uint32_t m_maxNumIBCMergeCand; uint32_t m_maxNumGeoCand; -#endif public: SPS(); @@ -1544,10 +1369,6 @@ public: int getSPSId() const { return m_SPSId; } void setSPSId(int i) { m_SPSId = i; } -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - void setDecodingParameterSetId(int val) { m_decodingParameterSetId = val; } - int getDecodingParameterSetId() const { return m_decodingParameterSetId; } -#endif int getVPSId() const { return m_VPSId; } void setVPSId(int i) { m_VPSId = i; } @@ -1564,19 +1385,12 @@ public: uint32_t getMaxPicWidthInLumaSamples() const { return m_maxWidthInLumaSamples; } void setMaxPicHeightInLumaSamples( uint32_t u ) { m_maxHeightInLumaSamples = u; } uint32_t getMaxPicHeightInLumaSamples() const { return m_maxHeightInLumaSamples; } -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS Window& getConformanceWindow() { return m_conformanceWindow; } const Window& getConformanceWindow() const { return m_conformanceWindow; } void setConformanceWindow( Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } -#endif -#if JVET_Q0119_CLEANUPS void setSubPicInfoPresentFlag(bool b) { m_subPicInfoPresentFlag = b; } bool getSubPicInfoPresentFlag() const { return m_subPicInfoPresentFlag; } -#else - void setSubPicPresentFlag(bool b) { m_subPicPresentFlag = b; } - bool getSubPicPresentFlag() const { return m_subPicPresentFlag; } -#endif void setNumSubPics( uint32_t u ) { CHECK( u >= MAX_NUM_SUB_PICS, "Maximum number of subpictures exceeded" ); m_numSubPics = u; @@ -1610,17 +1424,10 @@ public: void setLoopFilterAcrossSubpicEnabledFlag (const std::vector<bool> &v) { CHECK(v.size()!=m_numSubPics, "number of vector entries must be equal to numSubPics") ;m_loopFilterAcrossSubpicEnabledFlag = v; } -#if JVET_Q0119_CLEANUPS void setSubPicIdMappingExplicitlySignalledFlag( bool b ) { m_subPicIdMappingExplicitlySignalledFlag = b; } bool getSubPicIdMappingExplicitlySignalledFlag() const { return m_subPicIdMappingExplicitlySignalledFlag; } void setSubPicIdMappingInSpsFlag( bool b ) { m_subPicIdMappingInSpsFlag = b; } bool getSubPicIdMappingInSpsFlag() const { return m_subPicIdMappingInSpsFlag; } -#else - void setSubPicIdPresentFlag( bool b ) { m_subPicIdPresentFlag = b; } - bool getSubPicIdPresentFlag() const { return m_subPicIdPresentFlag; } - void setSubPicIdSignallingPresentFlag( bool b ) { m_subPicIdSignallingPresentFlag = b; } - bool getSubPicIdSignallingPresentFlag() const { return m_subPicIdSignallingPresentFlag; } -#endif void setSubPicIdLen( uint32_t u ) { m_subPicIdLen = u; } uint32_t getSubPicIdLen() const { return m_subPicIdLen; } void setSubPicId( int i, uint16_t u ) { m_subPicId[i] = u; } @@ -1638,10 +1445,6 @@ public: int getLog2MinCodingBlockSize() const { return m_log2MinCodingBlockSize; } void setLog2MinCodingBlockSize(int val) { m_log2MinCodingBlockSize = val; } -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - int getLog2DiffMaxMinCodingBlockSize() const { return m_log2DiffMaxMinCodingBlockSize; } - void setLog2DiffMaxMinCodingBlockSize(int val) { m_log2DiffMaxMinCodingBlockSize = val; } -#endif void setCTUSize(unsigned ctuSize) { m_CTUSize = ctuSize; } unsigned getCTUSize() const { return m_CTUSize; } void setSplitConsOverrideEnabledFlag(bool b) { m_partitionOverrideEnalbed = b; } @@ -1684,32 +1487,18 @@ public: uint32_t getMaxCUWidth() const { return m_uiMaxCUWidth; } void setMaxCUHeight( uint32_t u ) { m_uiMaxCUHeight = u; } uint32_t getMaxCUHeight() const { return m_uiMaxCUHeight; } -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - void setMaxCodingDepth( uint32_t u ) { m_uiMaxCodingDepth = u; } - uint32_t getMaxCodingDepth() const { return m_uiMaxCodingDepth; } -#endif bool getTransformSkipEnabledFlag() const { return m_transformSkipEnabledFlag; } void setTransformSkipEnabledFlag( bool b ) { m_transformSkipEnabledFlag = b; } -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL uint32_t getLog2MaxTransformSkipBlockSize() const { return m_log2MaxTransformSkipBlockSize; } void setLog2MaxTransformSkipBlockSize(uint32_t u) { m_log2MaxTransformSkipBlockSize = u; } -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool getBDPCMEnabledFlag() const { return m_BDPCMEnabledFlag; } void setBDPCMEnabledFlag( bool b ) { m_BDPCMEnabledFlag = b; } -#else - int getBDPCMEnabled() const { return m_BDPCMEnabled; } - void setBDPCMEnabled(int val) { m_BDPCMEnabled = val; } -#endif void setBitsForPOC( uint32_t u ) { m_uiBitsForPOC = u; } uint32_t getBitsForPOC() const { return m_uiBitsForPOC; } -#if JVET_P0116_POC_MSB void setPocMsbFlag(bool b) { m_pocMsbFlag = b; } bool getPocMsbFlag() const { return m_pocMsbFlag; } void setPocMsbLen(uint32_t u) { m_pocMsbLen = u; } uint32_t getPocMsbLen() const { return m_pocMsbLen; } -#endif -#if JVET_Q0400_EXTRA_BITS void setNumExtraPHBitsBytes(int i) { m_numExtraPHBitsBytes = i; } int getNumExtraPHBitsBytes() const { return m_numExtraPHBitsBytes; } void setNumExtraSHBitsBytes(int i) { m_numExtraSHBitsBytes = i; } @@ -1718,7 +1507,6 @@ public: const std::vector<bool> getExtraPHBitPresentFlags() const { return m_extraPHBitPresentFlag; } void setExtraSHBitPresentFlags(const std::vector<bool> &b) { m_extraSHBitPresentFlag = b; } const std::vector<bool> getExtraSHBitPresentFlags() const { return m_extraSHBitPresentFlag; } -#endif void setNumReorderPics(int i, uint32_t tlayer) { m_numReorderPics[tlayer] = i; } int getNumReorderPics(uint32_t tlayer) const { return m_numReorderPics[tlayer]; } void createRPLList0(int numRPL); @@ -1749,12 +1537,10 @@ public: void setBitDepth(ChannelType type, int u ) { m_bitDepths.recon[type] = u; } const BitDepths& getBitDepths() const { return m_bitDepths; } -#if JVET_Q0151_Q0205_ENTRYPOINTS bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; } void setEntropyCodingSyncEnabledFlag(bool val) { m_entropyCodingSyncEnabledFlag = val; } bool getEntropyCodingSyncEntryPointsPresentFlag() const { return m_entropyCodingSyncEntryPointPresentFlag; } void setEntropyCodingSyncEntryPointsPresentFlag(bool val) { m_entropyCodingSyncEntryPointPresentFlag = val; } -#endif int getMaxLog2TrDynamicRange(ChannelType channelType) const { return getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ? std::max<int>(15, int(m_bitDepths.recon[channelType] + 6)) : 15; } int getDifferentialLumaChromaBitDepth() const { return int(m_bitDepths.recon[CHANNEL_TYPE_LUMA]) - int(m_bitDepths.recon[CHANNEL_TYPE_CHROMA]); } @@ -1768,10 +1554,8 @@ public: bool getALFEnabledFlag() const { return m_alfEnabledFlag; } void setALFEnabledFlag( bool b ) { m_alfEnabledFlag = b; } -#if JVET_Q0795_CCALF bool getCCALFEnabledFlag() const { return m_ccalfEnabledFlag; } void setCCALFEnabledFlag( bool b ) { m_ccalfEnabledFlag = b; } -#endif void setJointCbCrEnabledFlag(bool bVal) { m_JointCbCrEnabledFlag = bVal; } bool getJointCbCrEnabledFlag() const { return m_JointCbCrEnabledFlag; } @@ -1798,32 +1582,23 @@ void setCCALFEnabledFlag( bool b ) uint32_t getMaxTLayers() const { return m_uiMaxTLayers; } void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; } -#if JVET_P0117_PTL_SCALABILITY bool getPtlDpbHrdParamsPresentFlag() const { return m_ptlDpbHrdParamsPresentFlag; } void setPtlDpbHrdParamsPresentFlag(bool b) { m_ptlDpbHrdParamsPresentFlag = b; } bool getSubLayerDpbParamsFlag() const { return m_SubLayerDpbParamsFlag; } void setSubLayerDpbParamsFlag(bool b) { m_SubLayerDpbParamsFlag = b; } -#endif bool getTemporalIdNestingFlag() const { return m_bTemporalIdNestingFlag; } void setTemporalIdNestingFlag( bool bValue ) { m_bTemporalIdNestingFlag = bValue; } bool getScalingListFlag() const { return m_scalingListEnabledFlag; } void setScalingListFlag( bool b ) { m_scalingListEnabledFlag = b; } -#if DQ_SDH_SIGNALLING void setDepQuantEnabledFlag(bool b) { m_depQuantEnabledFlag = b; } bool getDepQuantEnabledFlag() const { return m_depQuantEnabledFlag; } void setSignDataHidingEnabledFlag(bool b) { m_signDataHidingEnabledFlag = b; } bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; } -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG void setVirtualBoundariesEnabledFlag( bool b ) { m_virtualBoundariesEnabledFlag = b; } bool getVirtualBoundariesEnabledFlag() const { return m_virtualBoundariesEnabledFlag; } void setVirtualBoundariesPresentFlag( bool b ) { m_virtualBoundariesPresentFlag = b; } bool getVirtualBoundariesPresentFlag() const { return m_virtualBoundariesPresentFlag; } -#else - void setLoopFilterAcrossVirtualBoundariesDisabledFlag(bool b) { m_loopFilterAcrossVirtualBoundariesDisabledFlag = b; } - bool getLoopFilterAcrossVirtualBoundariesDisabledFlag() const { return m_loopFilterAcrossVirtualBoundariesDisabledFlag; } -#endif void setNumVerVirtualBoundaries(unsigned u) { m_numVerVirtualBoundaries = u; } unsigned getNumVerVirtualBoundaries() const { return m_numVerVirtualBoundaries; } void setNumHorVirtualBoundaries(unsigned u) { m_numHorVirtualBoundaries = u; } @@ -1836,7 +1611,6 @@ void setCCALFEnabledFlag( bool b ) void setMaxDecPicBuffering( uint32_t ui, uint32_t tlayer ) { CHECK(tlayer >= MAX_TLAYER, "Invalid T-layer"); m_uiMaxDecPicBuffering[tlayer] = ui; } uint32_t getMaxLatencyIncreasePlus1(uint32_t tlayer) const { return m_uiMaxLatencyIncreasePlus1[tlayer]; } void setMaxLatencyIncreasePlus1( uint32_t ui , uint32_t tlayer) { m_uiMaxLatencyIncreasePlus1[tlayer] = ui; } -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; } void setMaxNumMergeCand(uint32_t u) { m_maxNumMergeCand = u; } uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; } @@ -1845,34 +1619,17 @@ void setCCALFEnabledFlag( bool b ) void setMaxNumIBCMergeCand(uint32_t u) { m_maxNumIBCMergeCand = u; } uint32_t getMaxNumGeoCand() const { return m_maxNumGeoCand; } void setMaxNumGeoCand(uint32_t u) { m_maxNumGeoCand = u; } -#endif void setAffineAmvrEnabledFlag( bool val ) { m_affineAmvrEnabledFlag = val; } bool getAffineAmvrEnabledFlag() const { return m_affineAmvrEnabledFlag; } -#if !JVET_P0118_HRD_ASPECTS - TimingInfo* getTimingInfo() { return &m_timingInfo; } - const TimingInfo* getTimingInfo() const { return &m_timingInfo; } -#endif -#if JVET_P0118_HRD_ASPECTS bool getGeneralHrdParametersPresentFlag() const { return m_generalHrdParametersPresentFlag; } void setGeneralHrdParametersPresentFlag(bool b) { m_generalHrdParametersPresentFlag = b; } -#else - bool getHrdParametersPresentFlag() const { return m_hrdParametersPresentFlag; } - void setHrdParametersPresentFlag(bool b) { m_hrdParametersPresentFlag = b; } -#endif -#if JVET_P0118_HRD_ASPECTS OlsHrdParams* getOlsHrdParameters() { return &m_olsHrdParams[0]; } const OlsHrdParams* getOlsHrdParameters() const { return &m_olsHrdParams[0]; } GeneralHrdParams* getGeneralHrdParameters() { return &m_generalHrdParams; } const GeneralHrdParams* getGeneralHrdParameters() const { return &m_generalHrdParams; } -#else - HRDParameters* getHrdParameters() { return &m_hrdParameters; } - const HRDParameters* getHrdParameters() const { return &m_hrdParameters; } -#endif -#if JVET_Q0042_VUI bool getFieldSeqFlag() const { return m_fieldSeqFlag; } void setFieldSeqFlag(bool i) { m_fieldSeqFlag = i; } -#endif bool getVuiParametersPresentFlag() const { return m_vuiParametersPresentFlag; } void setVuiParametersPresentFlag(bool b) { m_vuiParametersPresentFlag = b; } VUI* getVuiParameters() { return &m_vuiParameters; } @@ -1941,13 +1698,8 @@ void setCCALFEnabledFlag( bool b ) void setUseCiip ( bool b ) { m_ciip = b; } bool getUseCiip () const { return m_ciip; } -#if !JVET_Q0806 - void setUseTriangle ( bool b ) { m_Triangle = b; } - bool getUseTriangle () const { return m_Triangle; } -#else void setUseGeo ( bool b ) { m_Geo = b; } bool getUseGeo () const { return m_Geo; } -#endif void setUseMRL ( bool b ) { m_MRL = b; } bool getUseMRL () const { return m_MRL; } void setUseMIP ( bool b ) { m_MIP = b; } @@ -1971,56 +1723,14 @@ void setCCALFEnabledFlag( bool b ) bool getInterLayerPresentFlag() const { return m_interLayerPresentFlag; } void setInterLayerPresentFlag( bool b ) { m_interLayerPresentFlag = b; } -#if JVET_Q0297_MER uint32_t getLog2ParallelMergeLevelMinus2() const { return m_log2ParallelMergeLevelMinus2; } void setLog2ParallelMergeLevelMinus2(uint32_t mrgLevel) { m_log2ParallelMergeLevelMinus2 = mrgLevel; } -#endif -#if JVET_Q0179_SCALING_WINDOW_SIZE_CONSTRAINT void setPPSValidFlag(int i, bool b) { m_ppsValidFlag[i] = b; } bool getPPSValidFlag(int i) { return m_ppsValidFlag[i]; } void setScalingWindowSizeInPPS(int i, int scWidth, int scHeight) { m_scalingWindowSizeInPPS[i].width = scWidth; m_scalingWindowSizeInPPS[i].height = scHeight;} const Size& getScalingWindowSizeInPPS(int i) { return m_scalingWindowSizeInPPS[i]; } -#endif }; -#if !REMOVE_PPS_REXT -/// Reference Picture Lists class - - -/// PPS RExt class -class PPSRExt // TODO: remove -{ -private: - bool m_crossComponentPredictionEnabledFlag; - -#if !JVET_Q0441_SAO_MOD_12_BIT - uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; -#endif - -public: - PPSRExt(); - - bool settingsDifferFromDefaults(const bool bTransformSkipEnabledFlag) const - { -#if JVET_Q0441_SAO_MOD_12_BIT - return (getCrossComponentPredictionEnabledFlag() ); -#else - return (getCrossComponentPredictionEnabledFlag() ) - || (getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA) !=0 ) - || (getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) !=0 ); -#endif - } - - bool getCrossComponentPredictionEnabledFlag() const { return m_crossComponentPredictionEnabledFlag; } - void setCrossComponentPredictionEnabledFlag(bool value) { m_crossComponentPredictionEnabledFlag = value; } - -#if !JVET_Q0441_SAO_MOD_12_BIT - // Now: getPpsRangeExtension().getLog2SaoOffsetScale and getPpsRangeExtension().setLog2SaoOffsetScale - uint32_t getLog2SaoOffsetScale(ChannelType type) const { return m_log2SaoOffsetScale[type]; } - void setLog2SaoOffsetScale(ChannelType type, uint32_t uiBitShift) { m_log2SaoOffsetScale[type] = uiBitShift; } -#endif -}; -#endif /// PPS class class PPS @@ -2030,9 +1740,7 @@ private: int m_SPSId; // seq_parameter_set_id int m_picInitQPMinus26; bool m_useDQP; -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG bool m_usePPSChromaTool; -#endif bool m_bSliceChromaQpFlag; // slicelevel_chroma_qp_flag int m_layerId; @@ -2058,11 +1766,7 @@ private: bool m_useWeightedBiPred; //!< Use of Weighting Bi-Prediction (B_SLICE) bool m_OutputFlagPresentFlag; //!< Indicates the presence of output_flag in slice header uint32_t m_numSubPics; //!< number of sub-pictures used - must match SPS -#if JVET_Q0119_CLEANUPS bool m_subPicIdMappingInPpsFlag; -#else - bool m_subPicIdSignallingPresentFlag; //!< indicates the presence of sub-picture ID signalling in the PPS -#endif uint32_t m_subPicIdLen; //!< sub-picture ID length in bits std::vector<uint16_t> m_subPicId; //!< sub-picture ID for each sub-picture in the sequence bool m_noPicPartitionFlag; //!< no picture partitioning flag - single slice, single tile @@ -2087,32 +1791,10 @@ private: bool m_tileIdxDeltaPresentFlag; //!< tile index delta present flag std::vector<RectSlice> m_rectSlices; //!< list of rectangular slice signalling parameters std::vector<SliceMap> m_sliceMap; //!< list of CTU maps for each slice in the picture -#if JVET_O1143_SUBPIC_BOUNDARY std::vector<SubPic> m_subPics; //!< list of subpictures in the picture -#endif bool m_loopFilterAcrossTilesEnabledFlag; //!< loop filtering applied across tiles flag bool m_loopFilterAcrossSlicesEnabledFlag; //!< loop filtering applied across slices flag -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - int m_log2MaxTransformSkipBlockSize; -#endif -#if !JVET_Q0151_Q0205_ENTRYPOINTS - bool m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - bool m_constantSliceHeaderParamsEnabledFlag; - int m_PPSDepQuantEnabledIdc; - int m_PPSRefPicListSPSIdc0; - int m_PPSRefPicListSPSIdc1; - int m_PPSMvdL1ZeroIdc; - int m_PPSCollocatedFromL0Idc; - uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; -#if !JVET_Q0806 - uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#else - uint32_t m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1; -#endif -#endif bool m_cabacInitPresentFlag; @@ -2123,34 +1805,25 @@ private: bool m_ppsDeblockingFilterDisabledFlag; int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int m_deblockingFilterCbBetaOffsetDiv2; //< beta offset for Cb deblocking filter int m_deblockingFilterCbTcOffsetDiv2; //< tc offset for Cb deblocking filter int m_deblockingFilterCrBetaOffsetDiv2; //< beta offset for Cr deblocking filter int m_deblockingFilterCrTcOffsetDiv2; //< tc offset for Cr deblocking filter -#endif bool m_listsModificationPresentFlag; -#if JVET_Q0819_PH_CHANGES bool m_rplInfoInPhFlag; bool m_dbfInfoInPhFlag; bool m_saoInfoInPhFlag; bool m_alfInfoInPhFlag; bool m_wpInfoInPhFlag; bool m_qpDeltaInfoInPhFlag; -#endif -#if SPS_ID_CHECK bool m_mixedNaluTypesInPicFlag; -#endif uint32_t m_picWidthInLumaSamples; uint32_t m_picHeightInLumaSamples; Window m_conformanceWindow; Window m_scalingWindow; -#if !REMOVE_PPS_REXT - PPSRExt m_ppsRangeExtension; -#endif public: PreCalcValues *pcv; @@ -2173,10 +1846,8 @@ public: void setPicInitQPMinus26( int i ) { m_picInitQPMinus26 = i; } bool getUseDQP() const { return m_useDQP; } void setUseDQP( bool b ) { m_useDQP = b; } -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG bool getPPSChromaToolFlag() const { return m_usePPSChromaTool; } void setPPSChromaToolFlag(bool b) { m_usePPSChromaTool = b; } -#endif bool getSliceChromaQpFlag() const { return m_bSliceChromaQpFlag; } void setSliceChromaQpFlag( bool b ) { m_bSliceChromaQpFlag = b; } @@ -2247,21 +1918,14 @@ public: m_subPicId.resize(m_numSubPics); } uint32_t getNumSubPics( ) const { return m_numSubPics; } -#if JVET_Q0119_CLEANUPS void setSubPicIdMappingInPpsFlag( bool b ) { m_subPicIdMappingInPpsFlag = b; } bool getSubPicIdMappingInPpsFlag() const { return m_subPicIdMappingInPpsFlag; } -#else - void setSubPicIdSignallingPresentFlag( bool b ) { m_subPicIdSignallingPresentFlag = b; } - bool getSubPicIdSignallingPresentFlag() const { return m_subPicIdSignallingPresentFlag; } -#endif void setSubPicIdLen( uint32_t u ) { m_subPicIdLen = u; } uint32_t getSubPicIdLen() const { return m_subPicIdLen; } void setSubPicId( int i, uint16_t u ) { m_subPicId[i] = u; } void setSubPicId(const std::vector<uint16_t> &v) { CHECK(v.size()!=m_numSubPics, "number of vector entries must be equal to numSubPics") ; m_subPicId = v; } uint16_t getSubPicId( int i ) const { return m_subPicId[i]; } -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS uint32_t getSubPicIdxFromSubPicId( uint32_t subPicId ) const; -#endif void setNoPicPartitionFlag( bool b ) { m_noPicPartitionFlag = b; } bool getNoPicPartitionFlag( ) const { return m_noPicPartitionFlag; } void setLog2CtuSize( uint8_t u ) { m_log2CtuSize = u; m_ctuSize = 1 << m_log2CtuSize; @@ -2301,11 +1965,7 @@ public: bool getRectSliceFlag( ) const { return m_rectSliceFlag; } void setSingleSlicePerSubPicFlag( bool b ) { m_singleSlicePerSubPicFlag = b; } bool getSingleSlicePerSubPicFlag( ) const { return m_singleSlicePerSubPicFlag; } -#if JVET_Q0817 uint32_t getCtuToSubPicIdx( int idx ) const { CHECK( idx >= m_ctuToSubPicIdx.size(), "CTU address index exceeds valid range" ); CHECK( getNumSubPics() < 1, "Number of subpicture cannot be 0" ); return m_ctuToSubPicIdx[ idx ]; } -#else - uint32_t getCtuToSubPicIdx( int idx ) const { CHECK( idx >= m_ctuToSubPicIdx.size(), "CTU address index exceeds valid range" ); return m_ctuToSubPicIdx[idx]; } -#endif void setNumSlicesInPic( uint32_t u ) { CHECK( u > MAX_SLICES, "Number of slices in picture exceeds valid range" ); m_numSlicesInPic = u; } uint32_t getNumSlicesInPic( ) const { return m_numSlicesInPic; } void setTileIdxDeltaPresentFlag( bool b ) { m_tileIdxDeltaPresentFlag = b; } @@ -2329,52 +1989,16 @@ public: void initTiles(); void initRectSlices(); void initRectSliceMap(const SPS *sps); -#if JVET_O1143_SUBPIC_BOUNDARY std::vector<SubPic> getSubPics() const {return m_subPics; }; -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS SubPic getSubPic(uint32_t idx) const { return m_subPics[idx]; } -#endif void initSubPic(const SPS &sps); const SubPic& getSubPicFromPos(const Position& pos) const; const SubPic& getSubPicFromCU (const CodingUnit& cu) const; -#endif void initRasterSliceMap( std::vector<uint32_t> sizes ); void checkSliceMap(); SliceMap getSliceMap( int idx ) const { CHECK( idx >= m_numSlicesInPic, "Slice index exceeds valid range" ); return m_sliceMap[idx]; } -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - uint32_t getLog2MaxTransformSkipBlockSize() const { return m_log2MaxTransformSkipBlockSize; } - void setLog2MaxTransformSkipBlockSize(uint32_t u) { m_log2MaxTransformSkipBlockSize = u; } -#endif -#if !JVET_Q0151_Q0205_ENTRYPOINTS - bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; } - void setEntropyCodingSyncEnabledFlag(bool val) { m_entropyCodingSyncEnabledFlag = val; } -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - bool getConstantSliceHeaderParamsEnabledFlag() const { return m_constantSliceHeaderParamsEnabledFlag; } - void setConstantSliceHeaderParamsEnabledFlag(bool b) { m_constantSliceHeaderParamsEnabledFlag = b; } - int getPPSDepQuantEnabledIdc() const { return m_PPSDepQuantEnabledIdc; } - void setPPSDepQuantEnabledIdc(int u) { m_PPSDepQuantEnabledIdc = u; } - int getPPSRefPicListSPSIdc( bool b ) const { return b==1 ? m_PPSRefPicListSPSIdc1: m_PPSRefPicListSPSIdc0; } - int getPPSRefPicListSPSIdc0() const { return m_PPSRefPicListSPSIdc0; } - void setPPSRefPicListSPSIdc0(int u) { m_PPSRefPicListSPSIdc0 = u; } - int getPPSRefPicListSPSIdc1() const { return m_PPSRefPicListSPSIdc1; } - void setPPSRefPicListSPSIdc1(int u) { m_PPSRefPicListSPSIdc1 = u; } - int getPPSMvdL1ZeroIdc() const { return m_PPSMvdL1ZeroIdc; } - void setPPSMvdL1ZeroIdc(int u) { m_PPSMvdL1ZeroIdc = u; } - int getPPSCollocatedFromL0Idc() const { return m_PPSCollocatedFromL0Idc; } - void setPPSCollocatedFromL0Idc(int u) { m_PPSCollocatedFromL0Idc = u; } - uint32_t getPPSSixMinusMaxNumMergeCandPlus1() const { return m_PPSSixMinusMaxNumMergeCandPlus1; } - void setPPSSixMinusMaxNumMergeCandPlus1(uint32_t u) { m_PPSSixMinusMaxNumMergeCandPlus1 = u; } -#if !JVET_Q0806 - uint32_t getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() const { return m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; } - void setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(uint32_t u) { m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = u; } -#else - uint32_t getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1() const { return m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1; } - void setPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1(uint32_t u) { m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 = u; } -#endif -#endif void setCabacInitPresentFlag( bool flag ) { m_cabacInitPresentFlag = flag; } bool getCabacInitPresentFlag() const { return m_cabacInitPresentFlag; } @@ -2388,7 +2012,6 @@ public: int getDeblockingFilterBetaOffsetDiv2() const { return m_deblockingFilterBetaOffsetDiv2; } //!< get beta offset for deblocking filter void setDeblockingFilterTcOffsetDiv2(int val) { m_deblockingFilterTcOffsetDiv2 = val; } //!< set tc offset for deblocking filter int getDeblockingFilterTcOffsetDiv2() const { return m_deblockingFilterTcOffsetDiv2; } //!< get tc offset for deblocking filter -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS void setDeblockingFilterCbBetaOffsetDiv2(int val) { m_deblockingFilterCbBetaOffsetDiv2 = val; } //!< set beta offset for Cb deblocking filter int getDeblockingFilterCbBetaOffsetDiv2() const { return m_deblockingFilterCbBetaOffsetDiv2; } //!< get beta offset for Cb deblocking filter void setDeblockingFilterCbTcOffsetDiv2(int val) { m_deblockingFilterCbTcOffsetDiv2 = val; } //!< set tc offset for Cb deblocking filter @@ -2397,7 +2020,6 @@ public: int getDeblockingFilterCrBetaOffsetDiv2() const { return m_deblockingFilterCrBetaOffsetDiv2; } //!< get beta offset for Cr deblocking filter void setDeblockingFilterCrTcOffsetDiv2(int val) { m_deblockingFilterCrTcOffsetDiv2 = val; } //!< set tc offset for Cr deblocking filter int getDeblockingFilterCrTcOffsetDiv2() const { return m_deblockingFilterCrTcOffsetDiv2; } //!< get tc offset for Cr deblocking filter -#endif bool getListsModificationPresentFlag() const { return m_listsModificationPresentFlag; } void setListsModificationPresentFlag( bool b ) { m_listsModificationPresentFlag = b; } bool getPictureHeaderExtensionPresentFlag() const { return m_pictureHeaderExtensionPresentFlag; } @@ -2405,7 +2027,6 @@ public: bool getSliceHeaderExtensionPresentFlag() const { return m_sliceHeaderExtensionPresentFlag; } void setSliceHeaderExtensionPresentFlag(bool val) { m_sliceHeaderExtensionPresentFlag = val; } -#if JVET_Q0819_PH_CHANGES void setRplInfoInPhFlag(bool flag) { m_rplInfoInPhFlag = flag; } bool getRplInfoInPhFlag() const { return m_rplInfoInPhFlag; } void setDbfInfoInPhFlag(bool flag) { m_dbfInfoInPhFlag = flag; } @@ -2418,12 +2039,7 @@ public: bool getWpInfoInPhFlag() const { return m_wpInfoInPhFlag; } void setQpDeltaInfoInPhFlag(bool flag) { m_qpDeltaInfoInPhFlag = flag; } bool getQpDeltaInfoInPhFlag() const { return m_qpDeltaInfoInPhFlag; } -#endif -#if !REMOVE_PPS_REXT - const PPSRExt& getPpsRangeExtension() const { return m_ppsRangeExtension; } - PPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; } -#endif void setPicWidthInLumaSamples( uint32_t u ) { m_picWidthInLumaSamples = u; } uint32_t getPicWidthInLumaSamples() const { return m_picWidthInLumaSamples; } @@ -2438,10 +2054,8 @@ public: const Window& getScalingWindow() const { return m_scalingWindow; } void setScalingWindow( Window& scalingWindow ) { m_scalingWindow = scalingWindow; } -#if SPS_ID_CHECK int getMixedNaluTypesInPicFlag() const { return m_mixedNaluTypesInPicFlag; } void setMixedNaluTypesInPicFlag( const bool flag ) { m_mixedNaluTypesInPicFlag = flag; } -#endif }; class APS @@ -2454,9 +2068,7 @@ private: AlfParam m_alfAPSParam; SliceReshapeInfo m_reshapeAPSInfo; ScalingList m_scalingListApsInfo; -#if JVET_Q0795_CCALF CcAlfFilterParam m_ccAlfAPSParam; -#endif public: APS(); @@ -2479,10 +2091,8 @@ public: SliceReshapeInfo& getReshaperAPSInfo() { return m_reshapeAPSInfo; } void setScalingList( ScalingList& scalingListAPSInfo ) { m_scalingListApsInfo = scalingListAPSInfo; } ScalingList& getScalingList() { return m_scalingListApsInfo; } -#if JVET_Q0795_CCALF void setCcAlfAPSParam(CcAlfFilterParam& ccAlfAPSParam) { m_ccAlfAPSParam = ccAlfAPSParam; } CcAlfFilterParam& getCcAlfAPSParam() { return m_ccAlfAPSParam; } -#endif }; struct WPScalingParam { @@ -2513,47 +2123,26 @@ class PicHeader private: bool m_valid; //!< picture header is valid yet or not Picture* m_pcPic; //!< pointer to picture structure -#if JVET_Q0819_PH_CHANGES int m_pocLsb; //!< least significant bits of picture order count -#endif bool m_nonReferencePictureFlag; //!< non-reference picture flag bool m_gdrOrIrapPicFlag; //!< gdr or irap picture flag bool m_gdrPicFlag; //!< gradual decoding refresh picture flag bool m_noOutputOfPriorPicsFlag; //!< no output of prior pictures flag uint32_t m_recoveryPocCnt; //!< recovery POC count -#if SPS_ID_CHECK bool m_noOutputBeforeRecoveryFlag; //!< NoOutputBeforeRecoveryFlag bool m_handleCraAsCvsStartFlag; //!< HandleCraAsCvsStartFlag bool m_handleGdrAsCvsStartFlag; //!< HandleGdrAsCvsStartFlag -#endif int m_spsId; //!< sequence parameter set ID int m_ppsId; //!< picture parameter set ID -#if JVET_P0116_POC_MSB bool m_pocMsbPresentFlag; //!< ph_poc_msb_present_flag int m_pocMsbVal; //!< poc_msb_val -#endif -#if !JVET_Q0119_CLEANUPS - bool m_subPicIdSignallingPresentFlag; //!< indicates the presence of sub-picture ID signalling in the SPS - uint32_t m_subPicIdLen; //!< sub-picture ID length in bits - uint16_t m_subPicId[MAX_NUM_SUB_PICS]; //!< sub-picture ID for each sub-picture in the sequence -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG bool m_virtualBoundariesEnabledFlag; //!< loop filtering across virtual boundaries disabled bool m_virtualBoundariesPresentFlag; //!< loop filtering across virtual boundaries disabled -#else - bool m_loopFilterAcrossVirtualBoundariesDisabledFlag; //!< loop filtering across virtual boundaries disabled -#endif unsigned m_numVerVirtualBoundaries; //!< number of vertical virtual boundaries unsigned m_numHorVirtualBoundaries; //!< number of horizontal virtual boundaries unsigned m_virtualBoundariesPosX[3]; //!< horizontal virtual boundary positions unsigned m_virtualBoundariesPosY[3]; //!< vertical virtual boundary positions -#if !JVET_Q0155_COLOUR_ID - unsigned m_colourPlaneId; //!< 4:4:4 colour plane ID -#endif bool m_picOutputFlag; //!< picture output flag -#if !JVET_Q0819_PH_CHANGES - bool m_picRplPresentFlag; //!< reference lists present in picture header or not -#endif 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 @@ -2561,85 +2150,48 @@ private: 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 int m_rpl1Idx; //!< index of used RPL in the SPS or -1 for local RPL in the picture header -#if JVET_Q0819_PH_CHANGES bool m_picInterSliceAllowedFlag; //!< inter slice allowed flag in PH bool m_picIntraSliceAllowedFlag; //!< intra slice allowed flag in PH -#endif bool m_splitConsOverrideFlag; //!< partitioning constraint override flag uint32_t m_cuQpDeltaSubdivIntra; //!< CU QP delta maximum subdivision for intra slices uint32_t m_cuQpDeltaSubdivInter; //!< CU QP delta maximum subdivision for inter slices uint32_t m_cuChromaQpOffsetSubdivIntra; //!< CU chroma QP offset maximum subdivision for intra slices uint32_t m_cuChromaQpOffsetSubdivInter; //!< CU chroma QP offset maximum subdivision for inter slices bool m_enableTMVPFlag; //!< enable temporal motion vector prediction -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS bool m_picColFromL0Flag; //!< syntax element collocated_from_l0_flag -#endif -#if JVET_Q0259_COLLOCATED_PIC_IN_PH uint32_t m_colRefIdx; -#endif bool m_mvdL1ZeroFlag; //!< L1 MVD set to zero flag -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - uint32_t m_maxNumMergeCand; //!< max number of merge candidates -#endif uint32_t m_maxNumAffineMergeCand; //!< max number of sub-block merge candidates bool m_disFracMMVD; //!< fractional MMVD offsets disabled flag bool m_disBdofFlag; //!< picture level BDOF disable flag bool m_disDmvrFlag; //!< picture level DMVR disable flag bool m_disProfFlag; //!< picture level PROF disable flag -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0806 - uint32_t m_maxNumTriangleCand; //!< max number of triangle merge candidates -#else - uint32_t m_maxNumGeoCand; //!< max number of geometric merge candidates -#endif - uint32_t m_maxNumIBCMergeCand; //!< max number of IBC merge candidates -#endif bool m_jointCbCrSignFlag; //!< joint Cb/Cr residual sign flag -#if JVET_Q0819_PH_CHANGES int m_qpDelta; //!< value of Qp delta -#else - bool m_saoEnabledPresentFlag; //!< sao enabled flags present in the picture header -#endif bool m_saoEnabledFlag[MAX_NUM_CHANNEL_TYPE]; //!< sao enabled flags for each channel -#if !JVET_Q0819_PH_CHANGES - bool m_alfEnabledPresentFlag; //!< alf enabled flags present in the picture header -#endif bool m_alfEnabledFlag[MAX_NUM_COMPONENT]; //!< alf enabled flags for each component int m_numAlfAps; //!< number of alf aps active for the picture std::vector<int> m_alfApsId; //!< list of alf aps for the picture int m_alfChromaApsId; //!< chroma alf aps ID -#if JVET_Q0358_ALF_NALU_TID_CONSTRAINT int m_alfChromaIdc; //!< alf chroma idc -#endif -#if JVET_Q0795_CCALF bool m_ccalfEnabledFlag[MAX_NUM_COMPONENT]; int m_ccalfCbApsId; int m_ccalfCrApsId; -#endif bool m_depQuantEnabledFlag; //!< dependent quantization enabled flag bool m_signDataHidingEnabledFlag; //!< sign data hiding enabled flag -#if !JVET_Q0819_PH_CHANGES - bool m_deblockingFilterOverridePresentFlag; //!< deblocking filter override controls present in picture header -#endif bool m_deblockingFilterOverrideFlag; //!< deblocking filter override controls enabled bool m_deblockingFilterDisable; //!< deblocking filter disabled flag int m_deblockingFilterBetaOffsetDiv2; //!< beta offset for deblocking filter int m_deblockingFilterTcOffsetDiv2; //!< tc offset for deblocking filter -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int m_deblockingFilterCbBetaOffsetDiv2; //!< beta offset for deblocking filter int m_deblockingFilterCbTcOffsetDiv2; //!< tc offset for deblocking filter int m_deblockingFilterCrBetaOffsetDiv2; //!< beta offset for deblocking filter int m_deblockingFilterCrTcOffsetDiv2; //!< tc offset for deblocking filter -#endif bool m_lmcsEnabledFlag; //!< lmcs enabled flag int m_lmcsApsId; //!< lmcs APS ID APS* m_lmcsAps; //!< lmcs APS bool m_lmcsChromaResidualScaleFlag; //!< lmcs chroma residual scale flag -#if JVET_Q0346_SCALING_LIST_USED_IN_SH bool m_explicitScalingListEnabledFlag; //!< explicit quantization scaling list enabled -#else - bool m_scalingListPresentFlag; //!< quantization scaling lists present -#endif int m_scalingListApsId; //!< quantization scaling list APS ID APS* m_scalingListAps; //!< quantization scaling list APS unsigned m_minQT[3]; //!< minimum quad-tree size 0: I slice luma; 1: P/B slice; 2: I slice chroma @@ -2647,11 +2199,9 @@ private: unsigned m_maxBTSize[3]; //!< maximum BT size unsigned m_maxTTSize[3]; //!< maximum TT size -#if JVET_Q0819_PH_CHANGES WPScalingParam m_weightPredTable[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V] int m_numL0Weights; //!< number of weights for L0 list int m_numL1Weights; //!< number of weights for L1 list -#endif public: PicHeader(); @@ -2662,10 +2212,8 @@ public: void setPic( Picture* p ) { m_pcPic = p; } Picture* getPic() { return m_pcPic; } const Picture* getPic() const { return m_pcPic; } -#if JVET_Q0819_PH_CHANGES void setPocLsb(int i) { m_pocLsb = i; } int getPocLsb() { return m_pocLsb; } -#endif void setNonReferencePictureFlag( bool b ) { m_nonReferencePictureFlag = b; } bool getNonReferencePictureFlag() const { return m_nonReferencePictureFlag; } void setGdrOrIrapPicFlag( bool b ) { m_gdrOrIrapPicFlag = b; } @@ -2680,27 +2228,12 @@ public: uint32_t getSPSId() const { return m_spsId; } void setPPSId( uint32_t u ) { m_ppsId = u; } uint32_t getPPSId() const { return m_ppsId; } -#if JVET_P0116_POC_MSB void setPocMsbPresentFlag(bool b) { m_pocMsbPresentFlag = b; } bool getPocMsbPresentFlag() const { return m_pocMsbPresentFlag; } void setPocMsbVal(int i) { m_pocMsbVal = i; } int getPocMsbVal() { return m_pocMsbVal; } -#endif -#if !JVET_Q0119_CLEANUPS - void setSubPicIdSignallingPresentFlag( bool b ) { m_subPicIdSignallingPresentFlag = b; } - bool getSubPicIdSignallingPresentFlag() const { return m_subPicIdSignallingPresentFlag; } - void setSubPicIdLen( uint32_t u ) { m_subPicIdLen = u; } - uint32_t getSubPicIdLen() const { return m_subPicIdLen; } - void setSubPicId( int i, uint16_t u ) { m_subPicId[i] = u; } - uint16_t getSubPicId( int i ) const { return m_subPicId[i]; } -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG void setVirtualBoundariesPresentFlag( bool b ) { m_virtualBoundariesPresentFlag = b; } bool getVirtualBoundariesPresentFlag() const { return m_virtualBoundariesPresentFlag; } -#else - void setLoopFilterAcrossVirtualBoundariesDisabledFlag(bool b) { m_loopFilterAcrossVirtualBoundariesDisabledFlag = b; } - bool getLoopFilterAcrossVirtualBoundariesDisabledFlag() const { return m_loopFilterAcrossVirtualBoundariesDisabledFlag; } -#endif void setNumVerVirtualBoundaries(unsigned u) { m_numVerVirtualBoundaries = u; } unsigned getNumVerVirtualBoundaries() const { return m_numVerVirtualBoundaries; } void setNumHorVirtualBoundaries(unsigned u) { m_numHorVirtualBoundaries = u; } @@ -2709,16 +2242,8 @@ public: unsigned getVirtualBoundariesPosX(unsigned idx) const { CHECK( idx >= 3, "boundary index exceeds valid range" ); return m_virtualBoundariesPosX[idx];} void setVirtualBoundariesPosY(unsigned u, unsigned idx) { CHECK( idx >= 3, "boundary index exceeds valid range" ); m_virtualBoundariesPosY[idx] = u; } unsigned getVirtualBoundariesPosY(unsigned idx) const { CHECK( idx >= 3, "boundary index exceeds valid range" ); return m_virtualBoundariesPosY[idx];} -#if !JVET_Q0155_COLOUR_ID - void setColourPlaneId(unsigned u) { m_colourPlaneId = u; } - unsigned getColourPlaneId() const { return m_colourPlaneId; } -#endif void setPicOutputFlag( bool b ) { m_picOutputFlag = b; } bool getPicOutputFlag() const { return m_picOutputFlag; } -#if !JVET_Q0819_PH_CHANGES - void setPicRplPresentFlag( bool b ) { m_picRplPresentFlag = b; } - bool getPicRplPresentFlag() const { return m_picRplPresentFlag; } -#endif 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; } ReferencePictureList* getLocalRPL( bool b ) { return b==1 ? &m_localRPL1 : &m_localRPL0; } @@ -2734,12 +2259,10 @@ public: void setRPL1idx(int rplIdx) { m_rpl1Idx = rplIdx; } int getRPL0idx() const { return m_rpl0Idx; } int getRPL1idx() const { return m_rpl1Idx; } -#if JVET_Q0819_PH_CHANGES void setPicInterSliceAllowedFlag(bool b) { m_picInterSliceAllowedFlag = b; } bool getPicInterSliceAllowedFlag() const { return m_picInterSliceAllowedFlag; } void setPicIntraSliceAllowedFlag(bool b) { m_picIntraSliceAllowedFlag = b; } bool getPicIntraSliceAllowedFlag() const { return m_picIntraSliceAllowedFlag; } -#endif void setSplitConsOverrideFlag( bool b ) { m_splitConsOverrideFlag = b; } bool getSplitConsOverrideFlag() const { return m_splitConsOverrideFlag; } void setCuQpDeltaSubdivIntra( uint32_t u ) { m_cuQpDeltaSubdivIntra = u; } @@ -2752,20 +2275,12 @@ public: uint32_t getCuChromaQpOffsetSubdivInter() const { return m_cuChromaQpOffsetSubdivInter; } void setEnableTMVPFlag( bool b ) { m_enableTMVPFlag = b; } bool getEnableTMVPFlag() const { return m_enableTMVPFlag; } -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS void setPicColFromL0Flag(bool val) { m_picColFromL0Flag = val; } bool getPicColFromL0Flag() const { return m_picColFromL0Flag; } -#endif -#if JVET_Q0259_COLLOCATED_PIC_IN_PH void setColRefIdx( uint32_t refIdx) { m_colRefIdx = refIdx; } uint32_t getColRefIdx() { return m_colRefIdx; } -#endif void setMvdL1ZeroFlag( bool b ) { m_mvdL1ZeroFlag = b; } bool getMvdL1ZeroFlag() const { return m_mvdL1ZeroFlag; } -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - void setMaxNumMergeCand(uint32_t val ) { m_maxNumMergeCand = val; } - uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; } -#endif void setMaxNumAffineMergeCand( uint32_t val ) { m_maxNumAffineMergeCand = val; } uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; } void setDisFracMMVD( bool val ) { m_disFracMMVD = val; } @@ -2776,43 +2291,20 @@ public: bool getDisDmvrFlag() const { return m_disDmvrFlag; } void setDisProfFlag( bool val ) { m_disProfFlag = val; } bool getDisProfFlag() const { return m_disProfFlag; } -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0806 - void setMaxNumTriangleCand(uint32_t b) { m_maxNumTriangleCand = b; } - uint32_t getMaxNumTriangleCand() const { return m_maxNumTriangleCand; } -#else - void setMaxNumGeoCand(uint32_t b) { m_maxNumGeoCand = b; } - uint32_t getMaxNumGeoCand() const { return m_maxNumGeoCand; } -#endif - void setMaxNumIBCMergeCand( uint32_t b ) { m_maxNumIBCMergeCand = b; } - uint32_t getMaxNumIBCMergeCand() const { return m_maxNumIBCMergeCand; } -#endif void setJointCbCrSignFlag( bool b ) { m_jointCbCrSignFlag = b; } bool getJointCbCrSignFlag() const { return m_jointCbCrSignFlag; } -#if JVET_Q0819_PH_CHANGES void setQpDelta(int b) { m_qpDelta = b; } int getQpDelta() const { return m_qpDelta; } -#else - void setSaoEnabledPresentFlag( bool b ) { m_saoEnabledPresentFlag = b; } - bool getSaoEnabledPresentFlag() const { return m_saoEnabledPresentFlag; } -#endif void setSaoEnabledFlag(ChannelType chType, bool b) { m_saoEnabledFlag[chType] = b; } bool getSaoEnabledFlag(ChannelType chType) const { return m_saoEnabledFlag[chType]; } -#if !JVET_Q0819_PH_CHANGES - void setAlfEnabledPresentFlag( bool b ) { m_alfEnabledPresentFlag = b; } - bool getAlfEnabledPresentFlag() const { return m_alfEnabledPresentFlag; } -#endif void setAlfEnabledFlag(ComponentID compId, bool b) { m_alfEnabledFlag[compId] = b; } bool getAlfEnabledFlag(ComponentID compId) const { return m_alfEnabledFlag[compId]; } void setNumAlfAps(int i) { m_numAlfAps = i; } int getNumAlfAps() const { return m_numAlfAps; } void setAlfApsIdChroma(int i) { m_alfChromaApsId = i; } int getAlfApsIdChroma() const { return m_alfChromaApsId; } -#if JVET_Q0358_ALF_NALU_TID_CONSTRAINT void setAlfChromaIdc(int i) { m_alfChromaIdc = i; } int getAlfChromaIdc() const { return m_alfChromaIdc; } -#endif -#if JVET_Q0795_CCALF void setCcAlfEnabledFlag(ComponentID compId, bool b) { m_ccalfEnabledFlag[compId] = b; } bool getCcAlfEnabledFlag(ComponentID compId) const { return m_ccalfEnabledFlag[compId]; } @@ -2820,15 +2312,10 @@ public: int getCcAlfCbApsId() const { return m_ccalfCbApsId; } void setCcAlfCrApsId(int i) { m_ccalfCrApsId = i; } int getCcAlfCrApsId() const { return m_ccalfCrApsId; } -#endif void setDepQuantEnabledFlag( bool b ) { m_depQuantEnabledFlag = b; } bool getDepQuantEnabledFlag() const { return m_depQuantEnabledFlag; } void setSignDataHidingEnabledFlag( bool b ) { m_signDataHidingEnabledFlag = b; } bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; } -#if !JVET_Q0819_PH_CHANGES - void setDeblockingFilterOverridePresentFlag( bool b ) { m_deblockingFilterOverridePresentFlag = b; } - bool getDeblockingFilterOverridePresentFlag() const { return m_deblockingFilterOverridePresentFlag; } -#endif void setDeblockingFilterOverrideFlag( bool b ) { m_deblockingFilterOverrideFlag = b; } bool getDeblockingFilterOverrideFlag() const { return m_deblockingFilterOverrideFlag; } void setDeblockingFilterDisable( bool b ) { m_deblockingFilterDisable= b; } @@ -2837,7 +2324,6 @@ public: int getDeblockingFilterBetaOffsetDiv2()const { return m_deblockingFilterBetaOffsetDiv2; } void setDeblockingFilterTcOffsetDiv2( int i ) { m_deblockingFilterTcOffsetDiv2 = i; } int getDeblockingFilterTcOffsetDiv2() const { return m_deblockingFilterTcOffsetDiv2; } -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS void setDeblockingFilterCbBetaOffsetDiv2( int i ) { m_deblockingFilterCbBetaOffsetDiv2 = i; } int getDeblockingFilterCbBetaOffsetDiv2()const { return m_deblockingFilterCbBetaOffsetDiv2; } void setDeblockingFilterCbTcOffsetDiv2( int i ) { m_deblockingFilterCbTcOffsetDiv2 = i; } @@ -2846,7 +2332,6 @@ public: int getDeblockingFilterCrBetaOffsetDiv2()const { return m_deblockingFilterCrBetaOffsetDiv2; } void setDeblockingFilterCrTcOffsetDiv2( int i ) { m_deblockingFilterCrTcOffsetDiv2 = i; } int getDeblockingFilterCrTcOffsetDiv2() const { return m_deblockingFilterCrTcOffsetDiv2; } -#endif void setLmcsEnabledFlag(bool b) { m_lmcsEnabledFlag = b; } bool getLmcsEnabledFlag() { return m_lmcsEnabledFlag; } const bool getLmcsEnabledFlag() const { return m_lmcsEnabledFlag; } @@ -2861,15 +2346,9 @@ public: APS* getScalingListAPS() const { return m_scalingListAps; } void setScalingListAPSId( int id ) { m_scalingListApsId = id; } int getScalingListAPSId() const { return m_scalingListApsId; } -#if JVET_Q0346_SCALING_LIST_USED_IN_SH void setExplicitScalingListEnabledFlag( bool b ) { m_explicitScalingListEnabledFlag = b; } bool getExplicitScalingListEnabledFlag() { return m_explicitScalingListEnabledFlag; } const bool getExplicitScalingListEnabledFlag() const { return m_explicitScalingListEnabledFlag; } -#else - void setScalingListPresentFlag( bool b ) { m_scalingListPresentFlag = b; } - bool getScalingListPresentFlag() { return m_scalingListPresentFlag; } - const bool getScalingListPresentFlag() const { return m_scalingListPresentFlag; } -#endif unsigned* getMinQTSizes() const { return (unsigned *)m_minQT; } unsigned* getMaxMTTHierarchyDepths() const { return (unsigned *)m_maxMTTHierarchyDepth; } @@ -2904,7 +2383,6 @@ public: std::vector<int> getAlfAPSs() const { return m_alfApsId; } -#if JVET_Q0819_PH_CHANGES void setWpScaling(WPScalingParam *wp) { memcpy(m_weightPredTable, wp, sizeof(WPScalingParam) * NUM_REF_PIC_LIST_01 * MAX_NUM_REF * MAX_NUM_COMPONENT); @@ -2916,16 +2394,13 @@ public: int getNumL0Weights() { return m_numL0Weights; } void setNumL1Weights(int b) { m_numL1Weights = b; } int getNumL1Weights() { return m_numL1Weights; } -#endif -#if SPS_ID_CHECK void setNoOutputBeforeRecoveryFlag( bool val ) { m_noOutputBeforeRecoveryFlag = val; } bool getNoOutputBeforeRecoveryFlag() const { return m_noOutputBeforeRecoveryFlag; } void setHandleCraAsCvsStartFlag( bool val ) { m_handleCraAsCvsStartFlag = val; } bool getHandleCraAsCvsStartFlag() const { return m_handleCraAsCvsStartFlag; } void setHandleGdrAsCvsStartFlag( bool val ) { m_handleGdrAsCvsStartFlag = val; } bool getHandleGdrAsCvsStartFlag() const { return m_handleGdrAsCvsStartFlag; } -#endif }; /// slice header class @@ -2949,39 +2424,25 @@ private: 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 int m_rpl1Idx; //< index of used RPL in the SPS or -1 for local RPL in the slice header -#if JVET_Q0155_COLOUR_ID int m_colourPlaneId; //!< 4:4:4 colour plane ID -#endif NalUnitType m_eNalUnitType; ///< Nal unit type for the slice -#if JVET_Q0775_PH_IN_SH bool m_pictureHeaderInSliceHeader; -#endif -#if JVET_Q0118_CLEANUPS uint32_t m_nuhLayerId; ///< Nal unit layer id -#endif SliceType m_eSliceType; int m_iSliceQp; int m_iSliceQpBase; bool m_ChromaQpAdjEnabled; -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool m_lmcsEnabledFlag; -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH bool m_explicitScalingListUsed; -#endif bool m_deblockingFilterDisable; bool m_deblockingFilterOverrideFlag; //< offsets for deblocking filter inherit from PPS int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int m_deblockingFilterCbBetaOffsetDiv2; //< beta offset for deblocking filter int m_deblockingFilterCbTcOffsetDiv2; //< tc offset for deblocking filter int m_deblockingFilterCrBetaOffsetDiv2; //< beta offset for deblocking filter int m_deblockingFilterCrTcOffsetDiv2; //< tc offset for deblocking filter -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool m_tsResidualCodingDisabledFlag; -#endif int m_list1IdxToList0Idx[MAX_NUM_REF]; int m_aiNumRefIdx [NUM_REF_PIC_LIST_01]; // for multiple reference of current slice bool m_pendingRasInit; @@ -3004,9 +2465,6 @@ private: // access channel -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - const DPS* m_dps; -#endif const VPS* m_pcVPS; const SPS* m_pcSPS; const PPS* m_pcPPS; @@ -3014,10 +2472,6 @@ private: const PicHeader* m_pcPicHeader; //!< pointer to picture header structure bool m_colFromL0Flag; // collocated picture from List0 flag -#if !SPS_ID_CHECK - bool m_noIncorrectPicOutputFlag; - bool m_handleCraAsCvsStartFlag; -#endif uint32_t m_colRefIdx; double m_lambdas[MAX_NUM_COMPONENT]; @@ -3040,9 +2494,7 @@ private: ClpRngs m_clpRngs; std::vector<uint32_t> m_substreamSizes; uint32_t m_numEntryPoints; -#if JVET_Q0151_Q0205_ENTRYPOINTS uint32_t m_numSubstream; -#endif bool m_cabacInitFlag; @@ -3063,12 +2515,10 @@ private: int m_tileGroupNumAps; std::vector<int> m_tileGroupLumaApsId; int m_tileGroupChromaApsId; -#if JVET_Q0795_CCALF bool m_tileGroupCcAlfCbEnabledFlag; bool m_tileGroupCcAlfCrEnabledFlag; int m_tileGroupCcAlfCbApsId; int m_tileGroupCcAlfCrApsId; -#endif bool m_disableSATDForRd; public: Slice(); @@ -3079,10 +2529,6 @@ public: const PicHeader* getPicHeader() const { return m_pcPicHeader; } int getRefIdx4MVPair( RefPicList eCurRefPicList, int nCurRefIdx ); -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - void setDPS( DPS* dps ) { m_dps = dps; } - const DPS* getDPS() const { return m_dps; } -#endif void setSPS( const SPS* pcSPS ) { m_pcSPS = pcSPS; } const SPS* getSPS() const { return m_pcSPS; } @@ -3123,34 +2569,24 @@ public: bool getDeblockingFilterOverrideFlag() const { return m_deblockingFilterOverrideFlag; } int getDeblockingFilterBetaOffsetDiv2()const { return m_deblockingFilterBetaOffsetDiv2; } int getDeblockingFilterTcOffsetDiv2() const { return m_deblockingFilterTcOffsetDiv2; } -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int getDeblockingFilterCbBetaOffsetDiv2()const { return m_deblockingFilterCbBetaOffsetDiv2; } int getDeblockingFilterCbTcOffsetDiv2() const { return m_deblockingFilterCbTcOffsetDiv2; } int getDeblockingFilterCrBetaOffsetDiv2()const { return m_deblockingFilterCrBetaOffsetDiv2; } int getDeblockingFilterCrTcOffsetDiv2() const { return m_deblockingFilterCrTcOffsetDiv2; } -#endif bool getPendingRasInit() const { return m_pendingRasInit; } void setPendingRasInit( bool val ) { m_pendingRasInit = val; } -#if JVET_Q0346_LMCS_ENABLE_IN_SH void setLmcsEnabledFlag(bool b) { m_lmcsEnabledFlag = b; } bool getLmcsEnabledFlag() { return m_lmcsEnabledFlag; } const bool getLmcsEnabledFlag() const { return m_lmcsEnabledFlag; } -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH void setExplicitScalingListUsed(bool b) { m_explicitScalingListUsed = b; } bool getExplicitScalingListUsed() { return m_explicitScalingListUsed; } -#endif int getNumRefIdx( RefPicList e ) const { return m_aiNumRefIdx[e]; } Picture* getPic() { return m_pcPic; } const Picture* getPic() const { return m_pcPic; } -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY Picture* getRefPic( RefPicList e, int iRefIdx) const { return m_apcRefPicList[e][iRefIdx]; } -#else - const Picture* getRefPic( RefPicList e, int iRefIdx) const { return m_apcRefPicList[e][iRefIdx]; } -#endif int getRefPOC( RefPicList e, int iRefIdx) const { return m_aiRefPOCList[e][iRefIdx]; } int getDepth() const { return m_iDepth; } bool getColFromL0Flag() const { return m_colFromL0Flag; } @@ -3161,33 +2597,21 @@ public: bool getCheckLDC() const { return m_bCheckLDC; } int getList1IdxToList0Idx( int list1Idx ) const { return m_list1IdxToList0Idx[list1Idx]; } void setPOC( int i ) { m_iPOC = i; } -#if JVET_Q0775_PH_IN_SH bool getPictureHeaderInSliceHeader() const { return m_pictureHeaderInSliceHeader; } void setPictureHeaderInSliceHeader( bool e ) { m_pictureHeaderInSliceHeader = e; } -#endif void setNalUnitType( NalUnitType e ) { m_eNalUnitType = e; } NalUnitType getNalUnitType() const { return m_eNalUnitType; } -#if JVET_Q0118_CLEANUPS void setNalUnitLayerId( uint32_t i ) { m_nuhLayerId = i; } uint32_t getNalUnitLayerId() const { return m_nuhLayerId; } -#endif bool getRapPicFlag() const; bool getIdrPicFlag() const { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } bool isIRAP() const { return (getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA); } -#if SPS_ID_CHECK // CLVSS PU is either an IRAP PU with NoOutputBeforeRecoveryFlag equal to 1 or a GDR PU with NoOutputBeforeRecoveryFlag equal to 1. bool isClvssPu() const { return m_eNalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_GDR && !m_pcPPS->getMixedNaluTypesInPicFlag() && m_pcPicHeader->getNoOutputBeforeRecoveryFlag(); } -#endif bool isIDRorBLA() const { return (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP); } -#if JVET_P0978_RPL_RESTRICTIONS void checkCRA(const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int pocCRA, PicList& rcListPic); -#else - void checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic); -#endif void checkSTSA(PicList& rcListPic); -#if JVET_P0978_RPL_RESTRICTIONS void checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int associatedIRAPDecodingOrderNumber, PicList& rcListPic); -#endif void decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& rcListPic, const bool bEfficientFieldIRAPEnabled); void setSliceType( SliceType e ) { m_eSliceType = e; } void setSliceQp( int i ) { m_iSliceQp = i; } @@ -3198,16 +2622,12 @@ public: void setDeblockingFilterOverrideFlag( bool b ) { m_deblockingFilterOverrideFlag = b; } void setDeblockingFilterBetaOffsetDiv2( int i ) { m_deblockingFilterBetaOffsetDiv2 = i; } void setDeblockingFilterTcOffsetDiv2( int i ) { m_deblockingFilterTcOffsetDiv2 = i; } -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS void setDeblockingFilterCbBetaOffsetDiv2( int i ) { m_deblockingFilterCbBetaOffsetDiv2 = i; } void setDeblockingFilterCbTcOffsetDiv2( int i ) { m_deblockingFilterCbTcOffsetDiv2 = i; } void setDeblockingFilterCrBetaOffsetDiv2( int i ) { m_deblockingFilterCrBetaOffsetDiv2 = i; } void setDeblockingFilterCrTcOffsetDiv2( int i ) { m_deblockingFilterCrTcOffsetDiv2 = i; } -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM void setTSResidualCodingDisabledFlag(bool b) { m_tsResidualCodingDisabledFlag = b; } bool getTSResidualCodingDisabledFlag() const { return m_tsResidualCodingDisabledFlag; } -#endif void setNumRefIdx( RefPicList e, int i ) { m_aiNumRefIdx[e] = i; } void setPic( Picture* p ) { m_pcPic = p; } @@ -3240,10 +2660,8 @@ public: bool isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder ); bool isPOCInRefPicList( const ReferencePictureList *rpl, int poc ); void checkConformanceForDRAP( uint32_t temporalId ); -#if JVET_Q0155_COLOUR_ID void setColourPlaneId( int id ) { m_colourPlaneId = id; } int getColourPlaneId() const { return m_colourPlaneId; } -#endif void setLambdas( const double lambdas[MAX_NUM_COMPONENT] ) { for (int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; } const double* getLambdas() const { return m_lambdas; } @@ -3278,27 +2696,12 @@ public: uint32_t getTLayer() const { return m_uiTLayer; } void setTLayer( uint32_t uiTLayer ) { m_uiTLayer = uiTLayer; } -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES void checkLeadingPictureRestrictions( PicList& rcListPic, const PPS& pps) const; -#else - void checkLeadingPictureRestrictions( PicList& rcListPic ) const; -#endif int checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList* pRPL, int rplIdx, bool printErrors, int* refPicIndex, int numActiveRefPics) const; -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES void applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId, const PPS& pps ) const; -#else - void applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId ) const; -#endif bool isTemporalLayerSwitchingPoint( PicList& rcListPic ) const; bool isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic ) const; int checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList *pRPL, int rplIdx, bool printErrors) const; -#if !SPS_ID_CHECK - void setNoIncorrectPicOutputFlag(bool val) { m_noIncorrectPicOutputFlag = val; } - bool getNoIncorrectPicOutputFlag() const { return m_noIncorrectPicOutputFlag; } - - void setHandleCraAsCvsStartFlag( bool val ) { m_handleCraAsCvsStartFlag = val; } - bool getHandleCraAsCvsStartFlag() const { return m_handleCraAsCvsStartFlag; } -#endif void setNumTilesInSlice( uint32_t u ) { m_sliceMap.setNumTilesInSlice( u ); } uint32_t getNumTilesInSlice() const { return m_sliceMap.getNumTilesInSlice(); } @@ -3327,13 +2730,11 @@ public: { memcpy(m_weightPredTable, wp, sizeof(WPScalingParam)*NUM_REF_PIC_LIST_01*MAX_NUM_REF*MAX_NUM_COMPONENT); } -#if JVET_Q0819_PH_CHANGES void setWpScaling(WPScalingParam *wp) { memcpy(m_weightPredTable, wp, sizeof(WPScalingParam) * NUM_REF_PIC_LIST_01 * MAX_NUM_REF * MAX_NUM_COMPONENT); } WPScalingParam * getWpScalingAll() { return (WPScalingParam *) m_weightPredTable; } -#endif void getWpScaling( RefPicList e, int iRefIdx, WPScalingParam *&wp) const; void resetWpScaling(); @@ -3348,11 +2749,9 @@ public: uint32_t getNumberOfSubstreamSizes( ) { return (uint32_t) m_substreamSizes.size(); } void addSubstreamSize( uint32_t size ) { m_substreamSizes.push_back(size); } uint32_t getSubstreamSize( uint32_t idx ) { CHECK(idx>=getNumberOfSubstreamSizes(),"Invalid index"); return m_substreamSizes[idx]; } -#if JVET_Q0151_Q0205_ENTRYPOINTS void resetNumberOfSubstream() { m_numSubstream = 0; } uint32_t getNumberOfSubstream() { return (uint32_t) m_numSubstream; } void increaseNumberOfSubstream() { m_numSubstream++; } -#endif void setCabacInitFlag( bool val ) { m_cabacInitFlag = val; } //!< set CABAC initial flag bool getCabacInitFlag() const { return m_cabacInitFlag; } //!< get CABAC initial flag @@ -3390,7 +2789,6 @@ public: m_tileGroupLumaApsId[i] = ApsIDs[i]; } } -#if JVET_Q0795_CCALF void resetTileGroupCcAlCbfEnabledFlag() { m_tileGroupCcAlfCbEnabledFlag = 0; } void resetTileGroupCcAlCrfEnabledFlag() { m_tileGroupCcAlfCrEnabledFlag = 0; } @@ -3403,35 +2801,24 @@ public: bool getTileGroupCcAlfCrEnabledFlag() { return m_tileGroupCcAlfCrEnabledFlag; } int getTileGroupCcAlfCbApsId() { return m_tileGroupCcAlfCbApsId; } int getTileGroupCcAlfCrApsId() { return m_tileGroupCcAlfCrApsId; } -#endif void setDisableSATDForRD(bool b) { m_disableSATDForRd = b; } bool getDisableSATDForRD() { return m_disableSATDForRd; } void scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS** apss, APS* lmcsAps, APS* scalingListAps, const bool isDecoder ); void freeScaledRefPicList( Picture *scaledRefPic[] ); bool checkRPR(); const std::pair<int, int>& getScalingRatio( const RefPicList refPicList, const int refIdx ) const { CHECK( refIdx < 0, "Invalid reference index" ); return m_scalingRatio[refPicList][refIdx]; } -#if JVET_Q0151_Q0205_ENTRYPOINTS void setNumSubstream( const SPS *sps, const PPS *pps ); void setNumEntryPoints( const SPS *sps, const PPS *pps ); -#else - void setNumEntryPoints( const PPS *pps ); -#endif uint32_t getNumEntryPoints( ) const { return m_numEntryPoints; } -#if JVET_Q0795_CCALF CcAlfFilterParam m_ccAlfFilterParam; uint8_t* m_ccAlfFilterControl[2]; -#endif protected: Picture* xGetRefPic( PicList& rcListPic, int poc, const int layerId ); Picture* xGetLongTermRefPic( PicList& rcListPic, int poc, bool pocHasMsb, const int layerId ); public: -#if JVET_Q0504_PLT_NON444 std::unordered_map< Position, std::unordered_map< Size, double> > m_mapPltCost[2]; -#else - std::unordered_map< Position, std::unordered_map< Size, double> > m_mapPltCost; -#endif private: };// END CLASS DEFINITION Slice @@ -3448,34 +2835,19 @@ public: , maxCUHeightMask ( maxCUHeight - 1 ) , maxCUWidthLog2 ( floorLog2( maxCUWidth ) ) , maxCUHeightLog2 ( floorLog2( maxCUHeight ) ) -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX , minCUWidth ( 1 << MIN_CU_LOG2 ) , minCUHeight ( 1 << MIN_CU_LOG2 ) -#else - , minCUWidth ( sps.getMaxCUWidth() >> sps.getMaxCodingDepth() ) - , minCUHeight ( sps.getMaxCUHeight() >> sps.getMaxCodingDepth() ) -#endif , minCUWidthLog2 ( floorLog2( minCUWidth ) ) , minCUHeightLog2 ( floorLog2( minCUHeight ) ) -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX , partsInCtuWidth ( maxCUWidth >> MIN_CU_LOG2) , partsInCtuHeight ( maxCUHeight >> MIN_CU_LOG2) , partsInCtu ( partsInCtuWidth * partsInCtuHeight ) -#else - , partsInCtuWidth ( 1 << sps.getMaxCodingDepth() ) - , partsInCtuHeight ( 1 << sps.getMaxCodingDepth() ) - , partsInCtu ( 1 << (sps.getMaxCodingDepth() << 1) ) -#endif , widthInCtus ( (pps.getPicWidthInLumaSamples () + sps.getMaxCUWidth () - 1) / sps.getMaxCUWidth () ) , heightInCtus ( (pps.getPicHeightInLumaSamples() + sps.getMaxCUHeight() - 1) / sps.getMaxCUHeight() ) , sizeInCtus ( widthInCtus * heightInCtus ) , lumaWidth ( pps.getPicWidthInLumaSamples() ) , lumaHeight ( pps.getPicHeightInLumaSamples() ) -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX , fastDeltaQPCuMaxSize( Clip3(1u << sps.getLog2MinCodingBlockSize(), sps.getMaxCUHeight(), 32u) ) -#else - , fastDeltaQPCuMaxSize( Clip3(sps.getMaxCUHeight() >> (sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u) ) -#endif , noChroma2x2 ( false ) , isEncoder ( _isEncoder ) , ISingleTree ( !sps.getUseDualITree() ) @@ -3534,11 +2906,7 @@ public: #if ENABLE_TRACING void xTraceVPSHeader(); -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP -void xTraceDPSHeader(); -#else void xTraceDCIHeader(); -#endif void xTraceSPSHeader(); void xTracePPSHeader(); void xTraceAPSHeader(); diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index 02e7b138adb67827bb22873e0e34df7c99566684..3bb4af85d2e1eb3f4356c46213b518c0bcc49b73 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -313,11 +313,7 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID ) const uint32_t width = area.width; const uint32_t height = area.height; const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#if JVET_Q0784_LFNST_COMBINATION if( lfnstIdx && tu.mtsIdx[compID] != MTS_SKIP && (tu.cu->isSepTree() ? true : isLuma(compID)) ) -#else - if (lfnstIdx && tu.mtsIdx[compID] != MTS_SKIP && width >= 4 && height >= 4) -#endif { const bool whge3 = width >= 8 && height >= 8; const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; @@ -408,11 +404,7 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons const uint32_t width = area.width; const uint32_t height = area.height; const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#if JVET_Q0784_LFNST_COMBINATION if( lfnstIdx && tu.mtsIdx[compID] != MTS_SKIP && (tu.cu->isSepTree() ? true : isLuma(compID)) ) -#else - if( lfnstIdx && tu.mtsIdx[compID] != MTS_SKIP && width >= 4 && height >= 4) -#endif { const bool whge3 = width >= 8 && height >= 8; const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 3897957d5c3f58b24a273c202d4b82512a7dea0b..0715bffceb854e19ca1a35646940f3c052bcb25e 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,265 +50,17 @@ #include <assert.h> #include <cassert> -#define DQ_SDH_SIGNALLING 1 // Merge request !1506: add DQ and SDH signalling in SPS to align with spec. - -#define JVET_Q0237_STSA_TID_ZERO_DEPLAYER 1 // JVET-Q0237: STSA picture with TemporalId equal to 0 in a dependent layer - -#define JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 1 // JVET-Q0798: signal the number of merge candidates in SPS - -#define JVET_Q0157_SUBPICTURE_REORDERING_CONSTRAINT 1 //JVET-Q0157: subpicture reordering constraint - -#define JVET_P0118_HRD_ASPECTS 1 //JVET-P0118: HRD aspects - -#define JVET_Q0371_DEBLOCKING_CLEANUP 1 //JVET_Q0371: cleanup on deblocking across subpicture boundaries - -#define JVET_Q0289_BUGFIX_RECT_SLICE_FLAG 1 //JVET-Q0289: If NumTilesInPic is equal to 1, don't signal the rect_slice_flag and infer its value to be 1. - -#define CABAC_RETRAIN 1 // CABAC retraining based on VTM8rc1 - -#define JVET_Q0210_SUBPIC_VIRTUAL_BOUNDARY_CONSTRAINT 1 // JVET-Q0210 (aspect 7): when subpicture signalling is present, virtual boundaries if present shall be in the SPS. - -#define JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG 1 // JVET-Q0246: virtual boundary enable flag in the SPS. - -#define JVET_Q0244 1 // JVET-Q0244 Aspect 3: Signal the slice width(height) in tiles when the number of tile columns(rows) is greater than 1. - -#define JVET_Q0355_DCI_LEVEL_IDC_CONSTRAINT 1 // JVET-Q0355: max level signaled in the DCI shall not be less than the level signaled in the SPS - -#define JVET_P0115_LAYER_TID_CONSTRAINT 1 // JVET-P0115: bitstream shall not contain any other layers than included in the OLS with OlsIdx and shall not include any NAL unit with TemporalId greater than HighestTid - -#define JVET_Q0359_TILE_SIZE_CONSTRAINT 1 // JVET-Q0359: sum of the explicit signaled tile size shall less than or equal to pic size - -#define JVET_Q0044_SLICE_IDX_WITH_SUBPICS 1 // JVET-Q0044: slice index with subpictures - -#define JVET_P0125_ASPECT_TID_LAYER_ID_NUH 1 // JVET-P0125: Aspects of constraints on TemporalId and nuh_layer_id -#define JVET_P0125_SEI_CONSTRAINTS 1 // JVET-P0125: 4th aspect: SEI constraints +//########### place macros to be removed in next cycle below this line ############### #define JVET_Q0471_CHROMA_QT_SPLIT 1 // JVET-Q0471: Chroma QT split -#define JVET_P0117_PTL_SCALABILITY 1 // JVET-P0117: sps_ptl_dpb_hrd_params_present_flag related syntax change, others in JVET-Q0786 - -#define JVET_Q0358_ALF_NALU_TID_CONSTRAINT 1 // JVET-Q0358: TemporalId constraint between ALF_APS NALU and the pic associated with PH - -#define JVET_Q0118_CLEANUPS 1 // JVET-Q0118: AHG8/AHG9: Scalability HLS cleanups - -#define JVET_Q0416_WRAPAROUND_OFFSET 1 //JVET-Q0416: subtract CtbSizeY / MinCbSizeY + 2 from wraparound offset before signaling - -#define JVET_P0125_EOS_LAYER_SPECIFIC 1 // JVET-P0125: Specify EOS NAL units to be layer specific - -#define JVET_Q0482_REMOVE_CONSTANT_PARAMS 1 // JVET-Q0482: Remove constant slice header parameter settings in PPS - -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS -#define JVET_Q0259_COLLOCATED_PIC_IN_PH 1 // JVET-Q0259 aspect 5: Include collocated pic in PH when TMVP enabled and rpl_info_in_ph_flag is 1 -#endif - -#define JVET_Q0505_CHROAM_QM_SIGNALING_400 1 //JVET-Q0505: Cleanup of chroma quantization matrix signaling for 400 color format - -#define JVET_Q0786_PTL_only 1 // JVET-Q0786: modifications to VPS syntax - PTL part only (signal PTL for single layer OLSs) - -#define JVET_P0116_POC_MSB 1 // JVET-P0116: use POC MSB cycle signalling for independent layers,to support of mixed IRAP and non-IRAP pictures within an AU - -#define JVET_P0978_RPL_RESTRICTIONS 1 // JVET-P0978: A set of RPL-related bitstream conformance restrictions - -#define JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX 1 // JVET-Q0468: add support of min Luma coding block size; JVET-Q0469: fix for signaling of Intra Chroma Min QT size - -#define JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS 1 // JVET-Q0260: Conformance cropping window in the SPS that applies to the max picture size - -#define JVET_Q0210_UEK_REMOVAL 1 // JVET-Q0210 Aspect 8: Replace uek signalling in alf_data with ue(v). - -#define JVET_Q0449_RPR_NO_SMOOTHING 1 // JVET-Q0449: Disable smoothing half-sample interpolation filter in conjunction with RPR - -#define JVET_Q0493_PLT_ENCODER_LOSSLESS 1 // JVET-Q0493: Palette encoder improvements for lossless coding - -#define JVET_Q0629_REMOVAL_PLT_4X4 1 // JVET-Q0629: Removal of 4x4 blocks in palette mode - -#define JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE 1 // JVET-Q0291: reduce palette size of dual tree from 31 to 15 and palette predictor size of dual tree from 63 to 31 - -#define JVET_Q0330_BLOCK_PARTITION 1 // JVET-Q0330: fix the block partitioning at picture boundary - -#define JVET_Q0417_CONSTRAINT_SPS_VB_PRESENT_FLAG 1 // JVET_Q0417: a constraint on the value of sps_virtual_boundaries_present_flag based on res_change_in_clvs_allowed_flag - -#define JVET_Q0179_SCALING_WINDOW_SIZE_CONSTRAINT 1 // JVET-Q0179: Scaling window size constraint for constraining worst case memory bandwidth - -#define JVET_Q0257_SCALING_WINDOW_CONSTRAINT 1 // JVET-Q0257: Constraint expression to limit actual scaling ratios rather than the picture sizes - -#define JVET_P2008_OUTPUT_LOG 1 // Output log file for conformance tests - -#define JVET_P0097_REMOVE_VPS_DEP_NONSCALABLE_LAYER 1 // Removing dependencies on VPS from the decoding process of a non-scalable bitstream - -#define JVET_Q0420_PPS_CHROMA_TOOL_FLAG 1 // JVET-Q0420: add pps_chroma_tool_offsets_present_flag in PPS - -#define JVET_Q0172_CHROMA_FORMAT_BITDEPTH_CONSTRAINT 1 // JVET-Q0172: Disallow differing chroma format and different bit depths for cross-layer prediction. - -#define JVET_Q0491_PLT_ESCAPE 1 // JVET-Q0491: Palette escape binarization - -#define JVET_Q414_CONSTRAINT_ON_GDR_PIC_FLAG 1 //JVET-Q0414: when gdr_enabled_flag is equal to 0, gdr_pic_flag shall be 0 - -#define JVET_Q0817 1 // JVET_Q0817: Remove the constraint on single_slice_per_subpic_flag - -#define JVET_Q0413_SKIP_LAST_SUBPIC_SIG 1 //JVET-Q0413 modification 2: skip the width and height signaling of last subpicture - -#define JVET_Q0169_SUBPIC_LEN_CONFORM 1 // JVET-Q0169: add bitstream conformance check on subpic length - -#define JVET_Q0504_PLT_NON444 1 // JVET-Q0504: enable palette mode for non 444 color format - -#define JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL 1 // JVET-Q0183: Signal the max block size in SPS and conditionally signal min_qp_prime_ts_minus4 - -#define JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM 1 // JVET-Q0089: RRC slice-level switch for lossless coding and one SPS flag for luma and chroma BDPCM. - -#define JVET_Q0816 1 // JVET_Q0816: Omit the signalling of subpic layout when there is only one subpicture - -#define JVET_Q0438_MONOCHROME_BUGFIXES 1 // JVET-Q0438: Monochrome bug fixes - -#define JVET_Q0441_SAO_MOD_12_BIT 1 // JVET-Q0441: SAO modification for 12 bit. Also removes old HEVC RExt SAO modification, which was broken. - -#define JVET_Q0043_RPR_and_Subpics 1 // JVET-Q0043: Disallow for both RPR and subpics to be used together - -#define JVET_Q0818_PT_SEI 1 // JVET-Q0818: add display_elemental_periods_minus1 to picture timing SEI message - -#define JVET_Q0343_GCMP_GUARD_BAND_TYPE 1 // JVET-Q0343: Add gcmp_guard_band_type to generalized cubemap projection SEI message and rename boundary guard band - -#define JVET_Q0110_Q0785_CHROMA_BDPCM_420 1 // JVET-Q0110/Q0785: Enable chroma BDPCM for 420, separate contexts for chroma BDPCM and bug-fixes. - -#define JVET_Q0042_VUI 1 // Modifications to VUI syntax - -#define JVET_Q0512_ENC_CHROMA_TS_ACT 1 // JVET-Q0512: encoder-side improvement on enabling chroma transform-skip for ACT - -#define JVET_P0101_POC_MULTILAYER 1 // POC derivation for pictures in dependent layers - -#define JVET_Q0446_MIP_CONST_SHIFT_OFFSET 1 // JVET-Q0446: MIP with constant shift and offset - -#define JVET_Q0265 1 // JVET-Q0265: Cleanup for monochrome and independently coded color planes - -#define JVET_Q0447_WP_PARAM_ESTIM 1 // JVET-Q0447: Add search iterations for method 2,3 and 4 - -#define JVET_Q0119_CLEANUPS 1 // JVET-Q0119: AHG12: Cleanups on signalling of subpictures, tiles, and rectangular slices - -#define JVET_Q0114_CONSTRAINT_FLAGS 1 // JVET-Q0114: AHG9: A few more general constraints flags - -#define JVET_Q0820_ACT 1 // JVET-Q0820: ACT bug fixes and reversible ACT transform - -#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 -#define JVET_Q0117_PARAMETER_SETS_CLEANUP 1 // JVET-Q0117: cleanups on parameter sets -#define JVET_Q0751_MIXED_NAL_UNIT_TYPES 1 // JVET-Q0751: Constraints and properties of mixed nal unit types - -#define JVET_Q0353_ACT_SW_FIX 1 // JVET-Q0353: Bug fix of ACT - -#define JVET_P0288_PIC_OUTPUT 1 // JVET-P0288: Set the value of PictureOutputFlag - -#define JVET_Q0695_CHROMA_TS_JCCR 1 // JVET-Q0695: Enabling the RD checking of chroma transform-skip mode for JCCR at encoder -#define JVET_Q0500_CCLM_REF_PADDING 1 // JVET-Q0500: Reference samples padding for CCLM - -#define JVET_Q0128_DMVR_BDOF_ENABLING_CONDITION 1 // JVET-Q0128: Cleanup of enabling condition for DMVR and BDOF - -#define JVET_Q0784_LFNST_COMBINATION 1 // lfnst signaling, latency reduction and a bugfix for scaling from Q0106, Q0686, Q0133 - -#define JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU 1 // JVET-Q0501: Initialize palette predictor from above CTU row in WPP - -#define JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX 1 // JVET-Q0503/Q0712: Platte encoder improvement/bugfix - -#define JVET_Q0819_PH_CHANGES 1 // JVET-Q0819: Combination of PH related syntax changes - -#define JVET_Q0481_PARTITION_CONSTRAINTS_ORDER 1 // JVET-Q0481: Ordering of partition constraints syntax elements in the SPS - -#define JVET_Q0155_COLOUR_ID 1 // JVET-Q0155: move colour_plane_id from PH to SH - -#define JVET_Q0444_AMVR_SIGNALLING 1 // JVET-Q0444: Conditional signaling of sps_affine_amvr_enabled_flag based on sps_amvr_enabled_flag - -#define JVET_Q0147_JCCR_SIGNALLING 1 // JVET-Q0147: Conditional signaling of sps_joint_cbcr_enabled_flag based on ChromaArrayType - -#define JVET_Q0346_LMCS_ENABLE_IN_SH 1 // JVET-Q0346 aspect 1: LMCS enabled flag in SH - -#if JVET_Q0819_PH_CHANGES -#define JVET_Q0346_SCALING_LIST_USED_IN_SH 1 // JVET-Q0346 aspect 2: Scaling list used flag in SH -#endif - -#define JVET_Q0267_RESET_CHROMA_QP_OFFSET 1 // JVET-Q0267: Reset chroma QP offsets at the start of each chroma QP offset group - -#define JVET_Q0293_REMOVAL_PDPC_CHROMA_NX2 1 // JVET-Q0293: Removal of chroma Nx2 blocks in PDPC - -#define JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS 1 // JVET-Q0121: Add deblocking control parameters for Cb and Cr and extend the parameter ranges - -#define JVET_Q0517_RPR_AFFINE_DS 1 // JVET-Q0517: affine down-sampling filters for RPR - -#define JVET_Q0151_Q0205_ENTRYPOINTS 1 // JVET-Q0151 & JVET-Q0205: Make mandatory the tile offsets signalling and move the entropy_coding_sync_enabled_flag entry_point_offsets_present_flag syntax elements to the SPS from the PPS - -#define JVET_Q0203_MULTI_SLICE_IN_TILE 1 // JVET-Q0203: Signalling of multiple rectangular slices within a tile - -#define JVET_O1143_SUBPIC_BOUNDARY 1 // treat subpicture boundary as picture boundary - -#if JVET_O1143_SUBPIC_BOUNDARY -#define JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY 1 -#define JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY 1 -#endif - -#define JVET_Q0495_NLALF_CLIP_CLEANUP 1 // JVET-Q0495: Cleanup of clipping table for NL-ALF - -#define JVET_Q0156_STSA 1 // JVET-Q0156: Enable inter-layer prediction for STSA pictures - -#define JVET_Q0249_ALF_CHROMA_CLIPFLAG 1 // JVET-Q0249: Cleanup of chroma clipping flags for ALF -#define JVET_Q0150 1 // fix for ALF virtual horizontal CTU boundary processing -#define JVET_Q0054 1 // fix for long luma deblocking decision -#define JVET_Q0795_CCALF 1 // Cross-component ALF - -#define JVET_Q0297_MER 1 // JVET_Q0297: Merge estimation region - -#define JVET_Q0483_CLIP_TMVP 1 // JVET-Q0483: Clip TMVP when no scaling is applied - -#define JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND 1 // JVET-Q0516/Q0685: disable MTS when there is only DC coefficient - -#define JVET_Q0806 1 // Geo related adoptions (JVET-Q0059, JVET-Q0077, JVET-Q0123, JVET-Q0188, JVET-Q0242_GEO, JVET-Q0309, JVET-Q0365 and JVET-Q0370) - -#define JVET_Q0055_MTS_SIGNALLING 1 // JVET-Q0055: Check for transform coefficients outside the 16x16 area -#define JVET_Q0480_RASTER_RECT_SLICES 1 // JVET-Q0480: Eliminate redundant slice height syntax when in raster rectangular slice mode (tile_idx_delta_present_flag == 0) - -#define JVET_Q0775_PH_IN_SH 1 // JVET-Q0755: Allow picture header in slice header - -#define JVET_Q0433_MODIFIED_CHROMA_DIST_WEIGHT 1 // modification of chroma distortion weight (as agreed during presentation of JVET-Q0433) - -#define JVET_P0188_MINCR 1 // JVET-P0188: Add MinCR checking in encoder. -#define JVET_Q0436_CABAC_ZERO_WORD 1 // JVET-Q0436: Add modified CABAC zero word insertion in encoder. - -#define JVET_Q0487_SCALING_WINDOW_ISSUES 1 // JVET-Q0487: Fix scaling window issues when scaling ratio is 1:1 - -#define JVET_Q0787_SUBPIC 1 // JVET-Q0787: fix subpicture location signalling - -#define JVET_Q0400_EXTRA_BITS 1 // JVET-Q0400: reserved bits for future extensions - -#define JVET_AHG14_LOSSLESS 1 -#define JVET_AHG14_LOSSLESS_ENC_QP_FIX 1 && JVET_AHG14_LOSSLESS +//########### place macros to be be kept below this line ############### #define JVET_M0497_MATRIX_MULT 0 // 0: Fast method; 1: Matrix multiplication -#define JVET_Q0221 1 // JVET-Q0221: Decoding unit parameter signalling - -#define JVET_Q0216 1 // JVET-Q0216: modification to picture timing SEI message - -#define JVET_Q0218_PROPOSAL3 1 // JVET-Q0218_PROPOSAL3: fix missing inference rule for single_slice_per_subpic_flag - #define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on -#define REMOVE_PPS_REXT 1 // remove RExt PPS extension - -#define JVET_P0118_OLS_EXTRACTION 1 // OLS based sub-bitstream extraction - -#define JVET_Q0397_SUB_PIC_EXTRACT 1 // subpicture extraction - -#define JVET_Q0218_PROPOSAL1 1 // JVET-Q0218_PROPOSAL1: Conditionally signal tile_idx_delta_present_flag - -#define JVET_Q0219_SIGNAL_ALT_BUFFER_DELAY_PARMS 1 // JVET-Q0219: Signal alternative buffering delay parameters - -#define JVET_Q0399_SCALING_INFERENCE 1 // JVET-Q0399 infer scaling window to conformance window, if not present - -#define JVET_Q0630_SUBPIC_LEVEL 1 // JVET-Q0630 parsing dependency fix for subpicture level info SEI - -#define JVET_SUBPIC_LEVEL_CFG 1 // improved configuration of subpicture level info SEI - -#define JVET_Q0217_PROPOSAL5 1 // JVET-Q0217 Proposal 5: modifications to reference picture information signalling - typedef std::pair<int, bool> TrMode; typedef std::pair<int, int> TrCost; @@ -319,10 +71,6 @@ typedef std::pair<int, int> TrCost; #endif // clang-format on -#define JVET_P0190_SCALABLE_NESTING_SEI 1 // JVET-P0190 scalable nesting sei message - -#define JVET_Q0222_SUBPICTURE_SIGNALLING 1 // JVET-Q0222_Proposal1: Inference rule to signal horizontal and vertical position of the top left CTU of 0-th subpicture - #ifndef JVET_J0090_MEMORY_BANDWITH_MEASURE #define JVET_J0090_MEMORY_BANDWITH_MEASURE 0 #endif @@ -517,14 +265,6 @@ typedef uint64_t Distortion; ///< distortion measurement // Enumeration // ==================================================================================================================== -#if !JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM -enum BDPCMControl -{ - BDPCM_INACTIVE = 0, - BDPCM_LUMAONLY = 1, - BDPCM_LUMACHROMA = 2, -}; -#endif enum ApsType { @@ -625,11 +365,7 @@ enum SliceType NUMBER_OF_SLICE_TYPES = 3 }; -#if JVET_Q0265 /// chroma formats (according to how the monochrome or the color planes are intended to be coded) -#else -/// chroma formats (according to semantics of chroma_format_idc) -#endif enum ChromaFormat { CHROMA_400 = 0, @@ -805,12 +541,8 @@ enum DFunc DF_SAD_INTERMEDIATE_BITDEPTH = 63, -#if JVET_Q0806 DF_SAD_WITH_MASK = 64, DF_TOTAL_FUNCTIONS = 65 -#else - DF_TOTAL_FUNCTIONS = 64 -#endif }; /// motion vector predictor direction used in AMVP @@ -1046,11 +778,7 @@ enum NalUnitType NAL_UNIT_RESERVED_IRAP_VCL_11, NAL_UNIT_RESERVED_IRAP_VCL_12, -#if JVET_Q0117_PARAMETER_SETS_CLEANUP NAL_UNIT_DCI, // 13 -#else - NAL_UNIT_DPS, // 13 -#endif NAL_UNIT_VPS, // 14 NAL_UNIT_SPS, // 15 NAL_UNIT_PPS, // 16 @@ -1091,14 +819,6 @@ enum MergeType NUM_MRG_TYPE // 5 }; -#if !JVET_Q0806 -enum TriangleSplit -{ - TRIANGLE_DIR_135 = 0, - TRIANGLE_DIR_45, - TRIANGLE_DIR_NUM -}; -#endif ////////////////////////////////////////////////////////////////////////// // Encoder modes to try out diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 03b0cf861927dee870906902dcbbf9d0c7194968..39b239117ff3a97a927accc82d5291389dab82a7 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -266,11 +266,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) affine = other.affine; affineType = other.affineType; colorTransform = other.colorTransform; -#if !JVET_Q0806 - triangle = other.triangle; -#else geoFlag = other.geoFlag; -#endif bdpcmMode = other.bdpcmMode; bdpcmModeChroma = other.bdpcmModeChroma; qp = other.qp; @@ -330,11 +326,7 @@ void CodingUnit::initData() affine = false; affineType = 0; colorTransform = false; -#if !JVET_Q0806 - triangle = false; -#else geoFlag = false; -#endif bdpcmMode = 0; bdpcmModeChroma = 0; qp = 0; @@ -378,12 +370,10 @@ const bool CodingUnit::isSepTree() const return treeType != TREE_D || CS::isDualITree( *cs ); } -#if JVET_Q0504_PLT_NON444 const bool CodingUnit::isLocalSepTree() const { return treeType != TREE_D && !CS::isDualITree(*cs); } -#endif const bool CodingUnit::checkCCLMAllowed() const { @@ -473,12 +463,6 @@ const uint8_t CodingUnit::checkAllowedSbt() const { return 0; } -#if !JVET_Q0806 - if( triangle ) - { - return 0; - } -#endif uint8_t sbtAllowed = 0; int cuWidth = lwidth(); @@ -545,15 +529,9 @@ void PredictionUnit::initData() mergeFlag = false; regularMergeFlag = false; mergeIdx = MAX_UCHAR; -#if !JVET_Q0806 - triangleSplitDir = MAX_UCHAR; - triangleMergeIdx0 = MAX_UCHAR; - triangleMergeIdx1 = MAX_UCHAR; -#else geoSplitDir = MAX_UCHAR; geoMergeIdx0 = MAX_UCHAR; geoMergeIdx1 = MAX_UCHAR; -#endif mmvdMergeFlag = false; mmvdMergeIdx = MAX_UINT; interDir = MAX_UCHAR; @@ -602,15 +580,9 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) mergeFlag = predData.mergeFlag; regularMergeFlag = predData.regularMergeFlag; mergeIdx = predData.mergeIdx; -#if !JVET_Q0806 - triangleSplitDir = predData.triangleSplitDir ; - triangleMergeIdx0 = predData.triangleMergeIdx0 ; - triangleMergeIdx1 = predData.triangleMergeIdx1 ; -#else geoSplitDir = predData.geoSplitDir; geoMergeIdx0 = predData.geoMergeIdx0; geoMergeIdx1 = predData.geoMergeIdx1; -#endif mmvdMergeFlag = predData.mmvdMergeFlag; mmvdMergeIdx = predData.mmvdMergeIdx; interDir = predData.interDir; @@ -654,15 +626,9 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) mergeFlag = other.mergeFlag; regularMergeFlag = other.regularMergeFlag; mergeIdx = other.mergeIdx; -#if !JVET_Q0806 - triangleSplitDir = other.triangleSplitDir ; - triangleMergeIdx0 = other.triangleMergeIdx0 ; - triangleMergeIdx1 = other.triangleMergeIdx1 ; -#else geoSplitDir = other.geoSplitDir; geoMergeIdx0 = other.geoMergeIdx0; geoMergeIdx1 = other.geoMergeIdx1; -#endif mmvdMergeFlag = other.mmvdMergeFlag; mmvdMergeIdx = other.mmvdMergeIdx; interDir = other.interDir; @@ -771,9 +737,6 @@ void TransformUnit::initData() { cbf[i] = 0; rdpcm[i] = NUMBER_OF_RDPCM_MODES; -#if !REMOVE_PPS_REXT - compAlpha[i] = 0; -#endif mtsIdx[i] = MTS_DCT2_DCT2; } depth = 0; @@ -791,12 +754,8 @@ void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf, bool **runType) m_pcmbuf[i] = pcmbuf[i]; } -#if JVET_Q0438_MONOCHROME_BUGFIXES // numBlocks is either 1 for 4:0:0, or 3 otherwise. It would perhaps be better to loop over getNumberValidChannels(*cs->pcv.chrFormat) for m_runType. for (uint32_t i = 0; i < std::max<uint32_t>(2, numBlocks)-1; i++) -#else - for (uint32_t i = 0; i < numBlocks - 1; i++) -#endif { m_runType[i] = runType[i]; } @@ -821,9 +780,6 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other) } cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; -#if !REMOVE_PPS_REXT - compAlpha[i] = other.compAlpha[i]; -#endif mtsIdx[i] = other.mtsIdx[i]; } depth = other.depth; @@ -849,9 +805,6 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; -#if !REMOVE_PPS_REXT - compAlpha[i] = other.compAlpha[i]; -#endif depth = other.depth; mtsIdx[i] = other.mtsIdx[i]; noResidual = other.noResidual; diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index c867c38725db9ba2f95abcea75fc0cb637b7e4c7..e4e562d3b86c119f4ed3bf9c44bb929c5da9e0a7 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -271,11 +271,7 @@ struct UnitAreaRelative : public UnitArea class SPS; class VPS; -#if JVET_Q0117_PARAMETER_SETS_CLEANUP class DCI; -#else -class DPS; -#endif class PPS; class Slice; @@ -313,11 +309,7 @@ struct CodingUnit : public UnitArea bool affine; int affineType; bool colorTransform; -#if !JVET_Q0806 - bool triangle; -#else bool geoFlag; -#endif int bdpcmMode; int bdpcmModeChroma; uint8_t imv; @@ -371,9 +363,7 @@ struct CodingUnit : public UnitArea const uint8_t checkAllowedSbt() const; const bool checkCCLMAllowed() const; const bool isSepTree() const; -#if JVET_Q0504_PLT_NON444 const bool isLocalSepTree() const; -#endif const bool isConsInter() const { return modeType == MODE_TYPE_INTER; } const bool isConsIntra() const { return modeType == MODE_TYPE_INTRA; } }; @@ -394,15 +384,9 @@ struct InterPredictionData bool mergeFlag; bool regularMergeFlag; uint8_t mergeIdx; -#if !JVET_Q0806 - uint8_t triangleSplitDir; - uint8_t triangleMergeIdx0; - uint8_t triangleMergeIdx1; -#else uint8_t geoSplitDir; uint8_t geoMergeIdx0; uint8_t geoMergeIdx1; -#endif bool mmvdMergeFlag; uint32_t mmvdMergeIdx; uint8_t interDir; @@ -475,9 +459,6 @@ struct TransformUnit : public UnitArea uint8_t jointCbCr; uint8_t cbf [ MAX_NUM_TBLOCKS ]; RDPCMMode rdpcm [ MAX_NUM_TBLOCKS ]; -#if !REMOVE_PPS_REXT - int8_t compAlpha [ MAX_NUM_TBLOCKS ]; -#endif TransformUnit() : chType( CH_L ) { } TransformUnit(const UnitArea& unit); diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index 81b0469a7bc569c40e085d023226caf0b65ca793..6c224138b2245db4dccafbb7d26ebc50040bd759 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -253,11 +253,7 @@ void QTBTPartitioner::initCtu( const UnitArea& ctuArea, const ChannelType _chTyp currQtDepth = 0; currSubdiv = 0; currQgPos = ctuArea.lumaPos(); -#if JVET_Q0438_MONOCHROME_BUGFIXES currQgChromaPos = ctuArea.chromaFormat != CHROMA_400 ? ctuArea.chromaPos() : Position(); -#else - currQgChromaPos = ctuArea.chromaPos(); -#endif currImplicitBtDepth = 0; chType = _chType; @@ -378,11 +374,7 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca // the minimal and maximal sizes are given in luma samples const CompArea& area = currArea().Y(); -#if JVET_Q0438_MONOCHROME_BUGFIXES const CompArea *areaC = (chType == CHANNEL_TYPE_CHROMA) ? &(currArea().Cb()) : nullptr; -#else - const CompArea& areaC = currArea().Cb(); -#endif PartLevel& level = m_partStack.back(); const PartSplit lastSplit = level.split; @@ -398,11 +390,7 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca if( area.width <= minQtSize ) canQt = false; #endif -#if JVET_Q0438_MONOCHROME_BUGFIXES if( areaC && areaC->width <= MIN_DUALTREE_CHROMA_WIDTH ) canQt = false; -#else - if( chType == CHANNEL_TYPE_CHROMA && areaC.width <= MIN_DUALTREE_CHROMA_WIDTH ) canQt = false; -#endif if( treeType == TREE_C ) { canQt = canBh = canTh = canBv = canTv = false; @@ -414,14 +402,8 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca canBh = implicitSplit == CU_HORZ_SPLIT; canBv = implicitSplit == CU_VERT_SPLIT; -#if JVET_Q0438_MONOCHROME_BUGFIXES if (areaC && areaC->width == 4) canBv = false; -#else - if (chType == CHANNEL_TYPE_CHROMA && areaC.width == 4) canBv = false; -#endif -#if JVET_Q0330_BLOCK_PARTITION if( !canBh && !canBv && !canQt ) canQt = true; -#endif return; } @@ -457,35 +439,19 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca // specific check for BT splits if( area.height <= minBtSize ) canBh = false; if( area.width > MAX_TB_SIZEY && area.height <= MAX_TB_SIZEY ) canBh = false; -#if JVET_Q0438_MONOCHROME_BUGFIXES if( areaC && areaC->width * areaC->height <= MIN_DUALTREE_CHROMA_SIZE ) canBh = false; -#else - if( chType == CHANNEL_TYPE_CHROMA && areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE ) canBh = false; -#endif if( area.width <= minBtSize ) canBv = false; if( area.width <= MAX_TB_SIZEY && area.height > MAX_TB_SIZEY ) canBv = false; -#if JVET_Q0438_MONOCHROME_BUGFIXES if (areaC && (areaC->width * areaC->height <= MIN_DUALTREE_CHROMA_SIZE || areaC->width == 4)) canBv = false; -#else - if (chType == CHANNEL_TYPE_CHROMA && (areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE || areaC.width == 4)) canBv = false; -#endif if( modeType == MODE_TYPE_INTER && area.width * area.height == 32 ) canBv = canBh = false; if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize ) canTh = false; if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTh = false; -#if JVET_Q0438_MONOCHROME_BUGFIXES if( areaC && areaC->width * areaC->height <= MIN_DUALTREE_CHROMA_SIZE*2 ) canTh = false; -#else - if( chType == CHANNEL_TYPE_CHROMA && areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE*2 ) canTh = false; -#endif if( area.width <= 2 * minTtSize || area.width > maxTtSize || area.height > maxTtSize ) canTv = false; if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTv = false; -#if JVET_Q0438_MONOCHROME_BUGFIXES if (areaC && (areaC->width * areaC->height <= MIN_DUALTREE_CHROMA_SIZE * 2 || areaC->width == 8)) canTv = false; -#else - if (chType == CHANNEL_TYPE_CHROMA && (areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE * 2 || areaC.width == 8)) canTv = false; -#endif if( modeType == MODE_TYPE_INTER && area.width * area.height == 64 ) canTv = canTh = false; } @@ -564,11 +530,7 @@ PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) const CompArea& area = currArea().Y(); const unsigned maxBtSize = cs.pcv->getMaxBtSize( *cs.slice, chType ); -#if JVET_Q0330_BLOCK_PARTITION const bool isBtAllowed = area.width <= maxBtSize && area.height <= maxBtSize && currMtDepth < (cs.pcv->getMaxBtDepth(*cs.slice, chType) + currImplicitBtDepth); -#else - const bool isBtAllowed = area.width <= maxBtSize && area.height <= maxBtSize; -#endif const unsigned minQtSize = cs.pcv->getMinQtSize( *cs.slice, chType ); #if JVET_Q0471_CHROMA_QT_SPLIT // minQtSize is in luma samples unit @@ -582,19 +544,11 @@ PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) { split = CU_QUAD_SPLIT; } -#if JVET_Q0330_BLOCK_PARTITION else if( !isBlInPic && isBtAllowed && area.width <= MAX_TB_SIZEY ) -#else - else if( !isBlInPic && isBtAllowed ) -#endif { split = CU_HORZ_SPLIT; } -#if JVET_Q0330_BLOCK_PARTITION else if( !isTrInPic && isBtAllowed && area.height <= MAX_TB_SIZEY ) -#else - else if( !isTrInPic && isBtAllowed ) -#endif { split = CU_VERT_SPLIT; } @@ -606,17 +560,10 @@ PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) { split = CU_QUAD_SPLIT; } -#if JVET_Q0330_BLOCK_PARTITION if( (!isBlInPic || !isTrInPic) && split == CU_DONT_SPLIT ) { split = CU_QUAD_SPLIT; } -#else - if ((!isBlInPic || !isTrInPic) && (currArea().Y().width > MAX_TB_SIZEY || currArea().Y().height > MAX_TB_SIZEY)) - { - split = CU_QUAD_SPLIT; - } -#endif } m_partStack.back().checkdIfImplicit = true; @@ -638,11 +585,7 @@ void QTBTPartitioner::exitCurrSplit() currSubdiv--; if( currQgEnable() ) currQgPos = currArea().lumaPos(); -#if JVET_Q0438_MONOCHROME_BUGFIXES if( currArea().chromaFormat != CHROMA_400 && currQgChromaEnable() ) -#else - if( currQgChromaEnable() ) -#endif currQgChromaPos = currArea().chromaPos(); #if _DEBUG m_currArea = m_partStack.back().parts[m_partStack.back().idx]; @@ -861,22 +804,12 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const } else { -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const uint32_t minCUSize = 1 << cs.sps->getLog2MinCodingBlockSize(); -#else - const uint32_t minCUSize = ( cs.sps->getMaxCUWidth() >> cs.sps->getMaxCodingDepth() ); -#endif bool canSplit = cuArea.lumaSize().width > minCUSize && cuArea.lumaSize().height > minCUSize; Partitioning ret; -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - if( cs.slice->getSliceType() == I_SLICE ) - { - canSplit &= cuArea.lumaSize().width > cs.pcv->minCUWidth && cuArea.lumaSize().height > cs.pcv->minCUHeight; - } -#endif if( canSplit ) { @@ -1076,11 +1009,7 @@ void PartitionerImpl::getTUIntraSubPartitions( Partitioning &sub, const UnitArea THROW( "Unknown TU sub-partitioning" ); } //we only partition luma, so there is going to be only one chroma tu at the end (unless it is dual tree, in which case there won't be any chroma components) -#if JVET_Q0438_MONOCHROME_BUGFIXES uint32_t partitionsWithoutChroma = (cs.area.chromaFormat == CHROMA_400) ? 0 : (isDualTree ? nPartitions : nPartitions - 1); -#else - uint32_t partitionsWithoutChroma = isDualTree ? nPartitions : nPartitions - 1; -#endif for( uint32_t i = 0; i < partitionsWithoutChroma; i++ ) { CompArea& blkCb = sub[i].blocks[COMPONENT_Cb]; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index bab812f74866016b2b9fa2dcc29b1e3b1aa7ac05..a2bc9ed21430c7c06f09342f0b5f7dc7d93b733a 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -103,27 +103,16 @@ void CS::setRefinedMotionField(CodingStructure &cs) bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int& xScale, int& yScale ) { const Window& curScalingWindow = curPPS->getScalingWindow(); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int curPicWidth = curPPS->getPicWidthInLumaSamples() - SPS::getWinUnitX( sps->getChromaFormatIdc() ) * (curScalingWindow.getWindowLeftOffset() + curScalingWindow.getWindowRightOffset()); int curPicHeight = curPPS->getPicHeightInLumaSamples() - SPS::getWinUnitY( sps->getChromaFormatIdc() ) * (curScalingWindow.getWindowTopOffset() + curScalingWindow.getWindowBottomOffset()); -#else - int curPicWidth = curPPS->getPicWidthInLumaSamples() - curScalingWindow.getWindowLeftOffset() - curScalingWindow.getWindowRightOffset(); - int curPicHeight = curPPS->getPicHeightInLumaSamples() - curScalingWindow.getWindowTopOffset() - curScalingWindow.getWindowBottomOffset(); -#endif const Window& refScalingWindow = refPic->getScalingWindow(); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int refPicWidth = refPic->getPicWidthInLumaSamples() - SPS::getWinUnitX( sps->getChromaFormatIdc() ) * (refScalingWindow.getWindowLeftOffset() + refScalingWindow.getWindowRightOffset()); int refPicHeight = refPic->getPicHeightInLumaSamples() - SPS::getWinUnitY( sps->getChromaFormatIdc() ) * (refScalingWindow.getWindowTopOffset() + refScalingWindow.getWindowBottomOffset()); -#else - int refPicWidth = refPic->getPicWidthInLumaSamples() - refScalingWindow.getWindowLeftOffset() - refScalingWindow.getWindowRightOffset(); - int refPicHeight = refPic->getPicHeightInLumaSamples() - refScalingWindow.getWindowTopOffset() - refScalingWindow.getWindowBottomOffset(); -#endif xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; -#if JVET_Q0179_SCALING_WINDOW_SIZE_CONSTRAINT int curSeqMaxPicWidthY = sps->getMaxPicWidthInLumaSamples(); // pic_width_max_in_luma_samples int curSeqMaxPicHeightY = sps->getMaxPicHeightInLumaSamples(); // pic_height_max_in_luma_samples int curPicWidthY = curPPS->getPicWidthInLumaSamples(); // pic_width_in_luma_samples @@ -132,20 +121,13 @@ bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int& CHECK((curPicWidth * curSeqMaxPicWidthY) < refPicWidth * (curPicWidthY - max8MinCbSizeY), "(curPicWidth * curSeqMaxPicWidthY) should be greater than or equal to refPicWidth * (curPicWidthY - max8MinCbSizeY))"); CHECK((curPicHeight * curSeqMaxPicHeightY) < refPicHeight * (curPicHeightY - max8MinCbSizeY), "(curPicHeight * curSeqMaxPicHeightY) should be greater than or equal to refPicHeight * (curPicHeightY - max8MinCbSizeY))"); -#endif -#if JVET_Q0257_SCALING_WINDOW_CONSTRAINT CHECK(curPicWidth * 2 < refPicWidth, "curPicWidth * 2 shall be greater than or equal to refPicWidth"); CHECK(curPicHeight * 2 < refPicHeight, "curPicHeight * 2 shall be greater than or equal to refPicHeight"); CHECK(curPicWidth > refPicWidth * 8, "curPicWidth shall be less than or equal to refPicWidth * 8"); CHECK(curPicHeight > refPicHeight * 8, "curPicHeight shall be less than or equal to refPicHeight * 8"); -#endif -#if JVET_Q0487_SCALING_WINDOW_ISSUES return refPic->isRefScaled( curPPS ); -#else - return refPicWidth != curPicWidth || refPicHeight != curPicHeight; -#endif } bool CU::isIntra(const CodingUnit &cu) @@ -190,12 +172,10 @@ bool CU::isSameSliceAndTile(const CodingUnit& cu, const CodingUnit& cu2) return ( cu.slice->getIndependentSliceIdx() == cu2.slice->getIndependentSliceIdx() ) && ( cu.tileIdx == cu2.tileIdx ); } -#if JVET_O1143_SUBPIC_BOUNDARY bool CU::isSameSubPic(const CodingUnit& cu, const CodingUnit& cu2) { return (cu.slice->getPPS()->getSubPicFromCU(cu).getSubPicIdx() == cu2.slice->getPPS()->getSubPicFromCU(cu2).getSubPicIdx()) ; } -#endif bool CU::isSameCtu(const CodingUnit& cu, const CodingUnit& cu2) { @@ -269,24 +249,18 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) { const PredictionUnit& pu = *cu.firstPU; -#if !JVET_Q0806 - if (!cu.triangle && !cu.affine && !isToBeDone ) -#else if (!cu.geoFlag && !cu.affine && !isToBeDone) -#endif { MotionInfo mi = pu.getMotionInfo(); mi.BcwIdx = (mi.interDir == 3) ? cu.BcwIdx : BCW_DEFAULT; -#if JVET_Q0297_MER const unsigned log2ParallelMergeLevel = (pu.cs->sps->getLog2ParallelMergeLevelMinus2() + 2); const unsigned xBr = pu.cu->Y().width + pu.cu->Y().x; const unsigned yBr = pu.cu->Y().height + pu.cu->Y().y; bool enableHmvp = ((xBr >> log2ParallelMergeLevel) > (pu.cu->Y().x >> log2ParallelMergeLevel)) && ((yBr >> log2ParallelMergeLevel) > (pu.cu->Y().y >> log2ParallelMergeLevel)); bool enableInsertion = CU::isIBC(cu) || enableHmvp; if (enableInsertion) -#endif cu.cs->addMiToLut(CU::isIBC(cu) ? cu.cs->motionLut.lutIbc : cu.cs->motionLut.lut, mi); } } @@ -753,12 +727,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, const int void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx) { const CodingStructure &cs = *pu.cs; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumIBCMergeCand(); -#else - const Slice &slice = *pu.cs->slice; - const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumIBCMergeCand(); -#endif for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui) { mrgCtx.BcwIdx[ui] = BCW_DEFAULT; @@ -782,11 +751,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const //left const PredictionUnit* puLeft = cs.getPURestricted(posLB.offset(-1, 0), pu, pu.chType); bool isGt4x4 = pu.lwidth() * pu.lheight() > 16; -#if JVET_Q0297_MER const bool isAvailableA1 = puLeft && pu.cu != puLeft->cu && CU::isIBC(*puLeft->cu); -#else - const bool isAvailableA1 = puLeft && isDiffMER(pu, *puLeft) && pu.cu != puLeft->cu && CU::isIBC(*puLeft->cu); -#endif if (isGt4x4 && isAvailableA1) { miLeft = puLeft->getMotionInfo(posLB.offset(-1, 0)); @@ -810,11 +775,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const // above const PredictionUnit *puAbove = cs.getPURestricted(posRT.offset(0, -1), pu, pu.chType); -#if JVET_Q0297_MER bool isAvailableB1 = puAbove && pu.cu != puAbove->cu && CU::isIBC(*puAbove->cu); -#else - bool isAvailableB1 = puAbove && isDiffMER(pu, *puAbove) && pu.cu != puAbove->cu && CU::isIBC(*puAbove->cu); -#endif if (isGt4x4 && isAvailableB1) { miAbove = puAbove->getMotionInfo(posRT.offset(0, -1)); @@ -872,16 +833,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int mmvdList, const int& mrgCandIdx ) { -#if JVET_Q0297_MER const unsigned plevel = pu.cs->sps->getLog2ParallelMergeLevelMinus2() + 2; -#endif const CodingStructure &cs = *pu.cs; const Slice &slice = *pu.cs->slice; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand(); -#else - const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumMergeCand(); -#endif for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui) { mrgCtx.BcwIdx[ui] = BCW_DEFAULT; @@ -905,11 +860,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // above const PredictionUnit *puAbove = cs.getPURestricted(posRT.offset(0, -1), pu, pu.chType); -#if JVET_Q0297_MER bool isAvailableB1 = puAbove && isDiffMER(pu.lumaPos(), posRT.offset(0, -1), plevel) && pu.cu != puAbove->cu && CU::isInter(*puAbove->cu); -#else - bool isAvailableB1 = puAbove && isDiffMER(pu, *puAbove) && pu.cu != puAbove->cu && CU::isInter(*puAbove->cu); -#endif if (isAvailableB1) { @@ -943,11 +894,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, //left const PredictionUnit* puLeft = cs.getPURestricted(posLB.offset(-1, 0), pu, pu.chType); -#if JVET_Q0297_MER const bool isAvailableA1 = puLeft && isDiffMER(pu.lumaPos(), posLB.offset(-1, 0), plevel) && pu.cu != puLeft->cu && CU::isInter(*puLeft->cu); -#else - const bool isAvailableA1 = puLeft && isDiffMER(pu, *puLeft) && pu.cu != puLeft->cu && CU::isInter(*puLeft->cu); -#endif if (isAvailableA1) { @@ -984,11 +931,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // above right const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); -#if JVET_Q0297_MER bool isAvailableB0 = puAboveRight && isDiffMER( pu.lumaPos(), posRT.offset(1, -1), plevel) && CU::isInter( *puAboveRight->cu ); -#else - bool isAvailableB0 = puAboveRight && isDiffMER( pu, *puAboveRight ) && CU::isInter( *puAboveRight->cu ); -#endif if( isAvailableB0 ) { @@ -1026,11 +969,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, //left bottom const PredictionUnit *puLeftBottom = cs.getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType ); -#if JVET_Q0297_MER bool isAvailableA0 = puLeftBottom && isDiffMER( pu.lumaPos(), posLB.offset(-1, 1), plevel) && CU::isInter( *puLeftBottom->cu ); -#else - bool isAvailableA0 = puLeftBottom && isDiffMER( pu, *puLeftBottom ) && CU::isInter( *puLeftBottom->cu ); -#endif if( isAvailableA0 ) { @@ -1071,11 +1010,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); -#if JVET_Q0297_MER bool isAvailableB2 = puAboveLeft && isDiffMER( pu.lumaPos(), posLT.offset(-1, -1), plevel ) && CU::isInter( *puAboveLeft->cu ); -#else - bool isAvailableB2 = puAboveLeft && isDiffMER( pu, *puAboveLeft ) && CU::isInter( *puAboveLeft->cu ); -#endif if( isAvailableB2 ) { @@ -1121,7 +1056,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, Position posC0; Position posC1 = pu.Y().center(); bool C0Avail = false; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY bool boundaryCond = ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight); const SubPic& curSubPic = pu.cs->slice->getPPS()->getSubPicFromPos(pu.lumaPos()); if (curSubPic.getTreatedAsPicFlag()) @@ -1130,9 +1064,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, (posRB.y + pcv.minCUHeight) <= curSubPic.getSubPicBottom()); } if (boundaryCond) -#else - if (((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight)) -#endif { int posYInCtu = posRB.y & pcv.maxCUHeightMask; if (posYInCtu + 4 < pcv.maxCUHeight) @@ -1330,17 +1261,9 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) && (pu.lwidth() >= 8) && ((pu.lheight() * pu.lwidth()) >= 128) && (pu.cu->BcwIdx == BCW_DEFAULT) -#if JVET_Q0128_DMVR_BDOF_ENABLING_CONDITION && ((!wp0[COMPONENT_Y].bPresentFlag) && (!wp0[COMPONENT_Cb].bPresentFlag) && (!wp0[COMPONENT_Cr].bPresentFlag) && (!wp1[COMPONENT_Y].bPresentFlag) && (!wp1[COMPONENT_Cb].bPresentFlag) && (!wp1[COMPONENT_Cr].bPresentFlag)) -#else - && ((!wp0[COMPONENT_Y].bPresentFlag) && (!wp1[COMPONENT_Y].bPresentFlag)) -#endif -#if JVET_Q0487_SCALING_WINDOW_ISSUES && ( refIdx0 < 0 ? true : (pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) == false) ) && ( refIdx1 < 0 ? true : (pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->isRefScaled( pu.cs->pps ) == false) ) -#else - && ( refIdx0 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ) == SCALE_1X ) && ( refIdx1 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ) == SCALE_1X ) -#endif ; } else @@ -1465,7 +1388,6 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList return false; } -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY // Check the position of colocated block is within a subpicture const SubPic &curSubPic = pu.cs->slice->getPPS()->getSubPicFromPos(pu.lumaPos()); if (curSubPic.getTreatedAsPicFlag()) @@ -1473,7 +1395,6 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList if (!curSubPic.isContainingPos(pos)) return false; } -#endif RefPicList eColRefPicList = slice.getCheckLDC() ? eRefPicList : RefPicList(slice.getColFromL0Flag()); const MotionInfo& mi = pColPic->cs->getMotionInfo( pos ); @@ -1547,9 +1468,7 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList if (bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/) { rcMv = cColMv; -#if JVET_Q0483_CLIP_TMVP rcMv.clipToStorageBitDepth(); -#endif } else { @@ -1562,9 +1481,7 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList if (distscale == 4096) { rcMv = cColMv; -#if JVET_Q0483_CLIP_TMVP rcMv.clipToStorageBitDepth(); -#endif } else { @@ -1575,7 +1492,6 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList return true; } -#if JVET_Q0297_MER bool PU::isDiffMER(const Position &pos1, const Position &pos2, const unsigned plevel) { const unsigned xN = pos1.x; @@ -1595,27 +1511,6 @@ bool PU::isDiffMER(const Position &pos1, const Position &pos2, const unsigned pl return false; } -#else -bool PU::isDiffMER(const PredictionUnit &pu1, const PredictionUnit &pu2) -{ - const unsigned xN = pu1.lumaPos().x; - const unsigned yN = pu1.lumaPos().y; - const unsigned xP = pu2.lumaPos().x; - const unsigned yP = pu2.lumaPos().y; - - if ((xN >> 2) != (xP >> 2)) - { - return true; - } - - if ((yN >> 2) != (yP >> 2)) - { - return true; - } - - return false; -} -#endif bool PU::isAddNeighborMv(const Mv& currMv, Mv* neighborMvs, int numNeighborMv) { @@ -1858,7 +1753,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in Position posC1 = pu.Y().center(); Mv cColMv; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY bool boundaryCond = ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight); const SubPic &curSubPic = pu.cs->slice->getPPS()->getSubPicFromPos(pu.lumaPos()); if (curSubPic.getTreatedAsPicFlag()) @@ -1867,9 +1761,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in (posRB.y + pcv.minCUHeight) <= curSubPic.getSubPicBottom()); } if (boundaryCond) -#else - if( ( ( posRB.x + pcv.minCUWidth ) < pcv.lumaWidth ) && ( ( posRB.y + pcv.minCUHeight ) < pcv.lumaHeight ) ) -#endif { int posYInCtu = posRB.y & pcv.maxCUHeightMask; if (posYInCtu + 4 < pcv.maxCUHeight) @@ -2184,7 +2075,6 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co bool C0Avail = false; Position posC1 = pu.Y().center(); Mv cColMv; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY bool boundaryCond = ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight); const SubPic &curSubPic = pu.cs->slice->getPPS()->getSubPicFromPos(pu.lumaPos()); if (curSubPic.getTreatedAsPicFlag()) @@ -2193,9 +2083,6 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co (posRB.y + pcv.minCUHeight) <= curSubPic.getSubPicBottom()); } if (boundaryCond) -#else - if ( ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight) ) -#endif { int posYInCtu = posRB.y & pcv.maxCUHeightMask; if (posYInCtu + 4 < pcv.maxCUHeight) @@ -2487,16 +2374,12 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu { const Position posLB = pu.Y().bottomLeft(); int num = 0; -#if JVET_Q0297_MER const unsigned plevel = pu.cs->sps->getLog2ParallelMergeLevelMinus2() + 2; -#endif const PredictionUnit *puLeftBottom = pu.cs->getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType ); if ( puLeftBottom && puLeftBottom->cu->affine && puLeftBottom->mergeType == MRG_TYPE_DEFAULT_N -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), posLB.offset(-1, 1), plevel) -#endif ) { npu[num++] = puLeftBottom; @@ -2506,9 +2389,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu const PredictionUnit* puLeft = pu.cs->getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType ); if ( puLeft && puLeft->cu->affine && puLeft->mergeType == MRG_TYPE_DEFAULT_N -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), posLB.offset(-1, 0), plevel) -#endif ) { npu[num++] = puLeft; @@ -2522,17 +2403,13 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p { const Position posLT = pu.Y().topLeft(); const Position posRT = pu.Y().topRight(); -#if JVET_Q0297_MER const unsigned plevel = pu.cs->sps->getLog2ParallelMergeLevelMinus2() + 2; -#endif int num = numAffNeighLeft; const PredictionUnit* puAboveRight = pu.cs->getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); if ( puAboveRight && puAboveRight->cu->affine && puAboveRight->mergeType == MRG_TYPE_DEFAULT_N -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), posRT.offset(1, -1), plevel) -#endif ) { npu[num++] = puAboveRight; @@ -2542,9 +2419,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p const PredictionUnit* puAbove = pu.cs->getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType ); if ( puAbove && puAbove->cu->affine && puAbove->mergeType == MRG_TYPE_DEFAULT_N -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), posRT.offset(0, -1), plevel) -#endif ) { npu[num++] = puAbove; @@ -2554,9 +2429,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p const PredictionUnit *puAboveLeft = pu.cs->getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); if ( puAboveLeft && puAboveLeft->cu->affine && puAboveLeft->mergeType == MRG_TYPE_DEFAULT_N -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), posLT.offset(-1, -1), plevel) -#endif ) { npu[num++] = puAboveLeft; @@ -2571,9 +2444,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx const CodingStructure &cs = *pu.cs; const Slice &slice = *pu.cs->slice; const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand(); -#if JVET_Q0297_MER const unsigned plevel = pu.cs->sps->getLog2ParallelMergeLevelMinus2() + 2; -#endif for ( int i = 0; i < maxNumAffineMergeCand; i++ ) { @@ -2608,11 +2479,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx //left const PredictionUnit* puLeft = cs.getPURestricted( posCurLB.offset( -1, 0 ), pu, pu.chType ); -#if JVET_Q0297_MER const bool isAvailableA1 = puLeft && isDiffMER(pu.lumaPos(), posCurLB.offset(-1, 0), plevel) && pu.cu != puLeft->cu && CU::isInter( *puLeft->cu ); -#else - const bool isAvailableA1 = puLeft && isDiffMER( pu, *puLeft ) && pu.cu != puLeft->cu && CU::isInter( *puLeft->cu ); -#endif if ( isAvailableA1 ) { miLeft = puLeft->getMotionInfo( posCurLB.offset( -1, 0 ) ); @@ -2721,9 +2588,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx const PredictionUnit* puNeigh = cs.getPURestricted( pos, pu, pu.chType ); if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), pos, plevel) -#endif ) { isAvailable[0] = true; @@ -2742,9 +2607,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), pos, plevel) -#endif ) { isAvailable[1] = true; @@ -2763,9 +2626,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_Q0297_MER && PU::isDiffMER(pu.lumaPos(), pos, plevel) -#endif ) { isAvailable[2] = true; @@ -2785,7 +2646,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx Position posC0; bool C0Avail = false; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY bool boundaryCond = ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight); const SubPic &curSubPic = pu.cs->slice->getPPS()->getSubPicFromPos(pu.lumaPos()); if (curSubPic.getTreatedAsPicFlag()) @@ -2794,9 +2654,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx (posRB.y + pcv.minCUHeight) <= curSubPic.getSubPicBottom()); } if (boundaryCond) -#else - if ( ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight) ) -#endif { int posYInCtu = posRB.y & pcv.maxCUHeightMask; if (posYInCtu + 4 < pcv.maxCUHeight) @@ -2986,7 +2843,6 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu) int log2CtuSize = floorLog2(pu.cs->sps->getCTUSize()); int ctuX = ((puPos.x >> log2CtuSize) << log2CtuSize); int ctuY = ((puPos.y >> log2CtuSize) << log2CtuSize); -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY int horMax; const SubPic &curSubPic = pu.cu->slice->getPPS()->getSubPicFromPos(puPos); if (curSubPic.getTreatedAsPicFlag()) @@ -2997,9 +2853,6 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu) { horMax = std::min((int)pu.cs->pps->getPicWidthInLumaSamples() - 1, ctuX + (int)pu.cs->sps->getCTUSize() + 3); } -#else - int horMax = std::min( (int)pu.cs->pps->getPicWidthInLumaSamples() - 1, ctuX + (int)pu.cs->sps->getCTUSize() + 3 ); -#endif int horMin = std::max((int)0, ctuX); int verMax = std::min( (int)pu.cs->pps->getPicHeightInLumaSamples() - 1, ctuY + (int)pu.cs->sps->getCTUSize() - 1 ); int verMin = std::max((int)0, ctuY); @@ -3335,179 +3188,12 @@ void PU::restrictBiPredMergeCandsOne(PredictionUnit &pu) } } -#if !JVET_Q0806 -void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangleMrgCtx ) -{ - MergeCtx tmpMergeCtx; - -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand(); -#else - const Slice &slice = *pu.cs->slice; - const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumMergeCand(); -#endif - - triangleMrgCtx.numValidMergeCand = 0; - - for (int32_t i = 0; i < TRIANGLE_MAX_NUM_UNI_CANDS; i++) - { - triangleMrgCtx.BcwIdx[i] = BCW_DEFAULT; - triangleMrgCtx.interDirNeighbours[i] = 0; - triangleMrgCtx.mrgTypeNeighbours[i] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours[(i << 1)].refIdx = NOT_VALID; - triangleMrgCtx.mvFieldNeighbours[(i << 1) + 1].refIdx = NOT_VALID; - triangleMrgCtx.mvFieldNeighbours[(i << 1)].mv = Mv(); - triangleMrgCtx.mvFieldNeighbours[(i << 1) + 1].mv = Mv(); - triangleMrgCtx.useAltHpelIf[i] = false; - } - - PU::getInterMergeCandidates(pu, tmpMergeCtx, 0); - - for (int32_t i = 0; i < maxNumMergeCand; i++) - { - int parity = i & 1; - if (tmpMergeCtx.interDirNeighbours[i] & (0x01 + parity)) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1 + parity; - triangleMrgCtx.mrgTypeNeighbours[triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].mv = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].mv; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].refIdx = -1; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].refIdx; - triangleMrgCtx.numValidMergeCand++; - if (triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS) - { - return; - } - continue; - } - - if (tmpMergeCtx.interDirNeighbours[i] & (0x02 - parity)) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 2 - parity; - triangleMrgCtx.mrgTypeNeighbours[triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].mv = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].mv; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].refIdx; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].refIdx = -1; - triangleMrgCtx.numValidMergeCand++; - if (triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS) - { - return; - } - } - } -} - -void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ) -{ - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - MotionBuf mb = pu.getMotionBuf(); - - MotionInfo biMv; - biMv.isInter = true; - biMv.sliceIdx = pu.cs->slice->getIndependentSliceIdx(); - - if( triangleMrgCtx.interDirNeighbours[candIdx0] == 1 && triangleMrgCtx.interDirNeighbours[candIdx1] == 2 ) - { - biMv.interDir = 3; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].mv; - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].refIdx; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; - } - else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 2 && triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ) - { - biMv.interDir = 3; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].mv; - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv; - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].refIdx; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx; - } - else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 1 && triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ) - { - biMv.interDir = 1; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].mv; - biMv.mv[1] = Mv(0, 0); - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].refIdx; - biMv.refIdx[1] = -1; - } - else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 2 && triangleMrgCtx.interDirNeighbours[candIdx1] == 2 ) - { - biMv.interDir = 2; - biMv.mv[0] = Mv(0, 0); - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - biMv.refIdx[0] = -1; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; - } - - int32_t idxW = (int32_t)(floorLog2(pu.lwidth() ) - MIN_CU_LOG2); - int32_t idxH = (int32_t)(floorLog2(pu.lheight()) - MIN_CU_LOG2); - for( int32_t y = 0; y < mb.height; y++ ) - { - for( int32_t x = 0; x < mb.width; x++ ) - { - if( g_triangleMvStorage[splitDir][idxH][idxW][y][x] == 2 ) - { - mb.at( x, y ).isInter = true; - mb.at( x, y ).interDir = biMv.interDir; - mb.at( x, y ).refIdx[0] = biMv.refIdx[0]; - mb.at( x, y ).refIdx[1] = biMv.refIdx[1]; - mb.at( x, y ).mv [0] = biMv.mv [0]; - mb.at( x, y ).mv [1] = biMv.mv [1]; - mb.at( x, y ).sliceIdx = biMv.sliceIdx; - } - else if( g_triangleMvStorage[splitDir][idxH][idxW][y][x] == 0 ) - { - mb.at( x, y ).isInter = true; - mb.at( x, y ).interDir = triangleMrgCtx.interDirNeighbours[candIdx0]; - mb.at( x, y ).refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].refIdx; - mb.at( x, y ).refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx; - mb.at( x, y ).mv [0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].mv; - mb.at( x, y ).mv [1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv; - mb.at( x, y ).sliceIdx = biMv.sliceIdx; - } - else - { - mb.at( x, y ).isInter = true; - mb.at( x, y ).interDir = triangleMrgCtx.interDirNeighbours[candIdx1]; - mb.at( x, y ).refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].refIdx; - mb.at( x, y ).refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; - mb.at( x, y ).mv [0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].mv; - mb.at( x, y ).mv [1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - mb.at( x, y ).sliceIdx = biMv.sliceIdx; - } - } - } -} - -int32_t PU::mappingRefPic( const PredictionUnit &pu, int32_t refPicPoc, bool targetRefPicList ) -{ - int32_t numRefIdx = pu.cs->slice->getNumRefIdx( (RefPicList)targetRefPicList ); - - for( int32_t i = 0; i < numRefIdx; i++ ) - { - if( pu.cs->slice->getRefPOC( (RefPicList)targetRefPicList, i ) == refPicPoc ) - { - return i; - } - } - return -1; -} -#else void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) { MergeCtx tmpMergeCtx; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand(); -#else - const Slice &slice = *pu.cs->slice; - const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumMergeCand(); -#endif geoMrgCtx.numValidMergeCand = 0; for (int32_t i = 0; i < GEO_MAX_NUM_UNI_CANDS; i++) @@ -3660,7 +3346,6 @@ void PU::spanGeoMotionInfo( PredictionUnit &pu, MergeCtx &geoMrgCtx, const uint8 } } } -#endif bool CU::hasSubCUNonZeroMVd( const CodingUnit& cu ) { @@ -3982,37 +3667,20 @@ uint8_t CU::deriveBcwIdx( uint8_t bcwLO, uint8_t bcwL1 ) bool CU::bdpcmAllowed( const CodingUnit& cu, const ComponentID compID ) { -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL SizeType transformSkipMaxSize = 1 << cu.cs->sps->getLog2MaxTransformSkipBlockSize(); -#else - SizeType transformSkipMaxSize = 1 << cu.cs->pps->getLog2MaxTransformSkipBlockSize(); -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool bdpcmAllowed = cu.cs->sps->getBDPCMEnabledFlag(); -#else - bool bdpcmAllowed = cu.cs->sps->getBDPCMEnabled(); - bdpcmAllowed &= (isLuma(compID) || cu.cs->sps->getBDPCMEnabled() == BDPCM_LUMACHROMA); -#endif bdpcmAllowed &= CU::isIntra( cu ); if (isLuma(compID)) bdpcmAllowed &= (cu.lwidth() <= transformSkipMaxSize && cu.lheight() <= transformSkipMaxSize); else -#if JVET_Q0353_ACT_SW_FIX bdpcmAllowed &= (cu.chromaSize().width <= transformSkipMaxSize && cu.chromaSize().height <= transformSkipMaxSize) && !cu.colorTransform; -#else - bdpcmAllowed &= (cu.chromaSize().width <= transformSkipMaxSize && cu.chromaSize().height <= transformSkipMaxSize); -#endif return bdpcmAllowed; } bool CU::isMTSAllowed(const CodingUnit &cu, const ComponentID compID) { -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL SizeType tsMaxSize = 1 << cu.cs->sps->getLog2MaxTransformSkipBlockSize(); -#else - SizeType tsMaxSize = 1 << cu.cs->pps->getLog2MaxTransformSkipBlockSize(); -#endif const int maxSize = CU::isIntra( cu ) ? MTS_INTRA_MAX_CU_SIZE : MTS_INTER_MAX_CU_SIZE; const int cuWidth = cu.blocks[0].lumaSize().width; const int cuHeight = cu.blocks[0].lumaSize().height; @@ -4055,11 +3723,7 @@ void TU::setCbfAtDepth(TransformUnit &tu, const ComponentID &compID, const unsig bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) { -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL const int maxSize = tu.cs->sps->getLog2MaxTransformSkipBlockSize(); -#else - const int maxSize = tu.cs->pps->getLog2MaxTransformSkipBlockSize(); -#endif bool tsAllowed = tu.cs->sps->getTransformSkipEnabledFlag(); tsAllowed &= ( !tu.cu->ispMode || !isLuma(compID) ); @@ -4082,13 +3746,6 @@ int TU::getICTMode( const TransformUnit& tu, int jointCbCr ) return g_ictModes[ tu.cs->picHeader->getJointCbCrSignFlag() ][ jointCbCr ]; } -#if !REMOVE_PPS_REXT -bool TU::hasCrossCompPredInfo( const TransformUnit &tu, const ComponentID &compID ) -{ - return (isChroma(compID) && tu.cs->pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf(tu, COMPONENT_Y) && - (!CU::isIntra(*tu.cu) || PU::isChromaIntraModeCrossCheckMode(*tu.cs->getPU(tu.blocks[compID].pos(), toChannelType(compID))))); -} -#endif bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID ) { diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index b51a96028f762c7ff856958c71e1e19a8a92fdc5..2df81f6ee64dbc383fcbb9ea21bd80f622414426 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -66,9 +66,7 @@ namespace CU bool isSameSlice (const CodingUnit &cu, const CodingUnit &cu2); bool isSameTile (const CodingUnit &cu, const CodingUnit &cu2); bool isSameSliceAndTile (const CodingUnit &cu, const CodingUnit &cu2); -#if JVET_O1143_SUBPIC_BOUNDARY bool isSameSubPic (const CodingUnit &cu, const CodingUnit &cu2); -#endif bool isLastSubCUOfCtu (const CodingUnit &cu); uint32_t getCtuAddr (const CodingUnit &cu); int predictQP (const CodingUnit& cu, const int prevQP ); @@ -142,11 +140,7 @@ namespace PU void getIBCMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1); void getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1); int getDistScaleFactor(const int &currPOC, const int &currRefPOC, const int &colPOC, const int &colRefPOC); -#if JVET_Q0297_MER bool isDiffMER (const Position &pos1, const Position &pos2, const unsigned plevel); -#else - bool isDiffMER (const PredictionUnit &pu, const PredictionUnit &pu2); -#endif bool getColocatedMVP (const PredictionUnit &pu, const RefPicList &eRefPicList, const Position &pos, Mv& rcMv, const int &refIdx, bool sbFlag); void fillMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AMVPInfo &amvpInfo ); void fillIBCMvpCand (PredictionUnit &pu, AMVPInfo &amvpInfo); @@ -175,14 +169,8 @@ namespace PU bool isLMCMode ( unsigned mode); bool isLMCModeEnabled (const PredictionUnit &pu, unsigned mode); bool isChromaIntraModeCrossCheckMode(const PredictionUnit &pu); -#if !JVET_Q0806 - void getTriangleMergeCandidates (const PredictionUnit &pu, MergeCtx &triangleMrgCtx); - void spanTriangleMotionInfo ( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1); - int32_t mappingRefPic (const PredictionUnit &pu, int32_t refPicPoc, bool targetRefPicList); -#else void getGeoMergeCandidates (const PredictionUnit &pu, MergeCtx &GeoMrgCtx); void spanGeoMotionInfo ( PredictionUnit &pu, MergeCtx &GeoMrgCtx, const uint8_t splitDir, const uint8_t candIdx0, const uint8_t candIdx1); -#endif bool isAddNeighborMv (const Mv& currMv, Mv* neighborMvs, int numNeighborMv); void getIbcMVPsEncOnly(PredictionUnit &pu, Mv* mvPred, int& nbPred); bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); @@ -199,9 +187,6 @@ namespace TU bool getCbfAtDepth (const TransformUnit &tu, const ComponentID &compID, const unsigned &depth); void setCbfAtDepth ( TransformUnit &tu, const ComponentID &compID, const unsigned &depth, const bool &cbf); bool isTSAllowed (const TransformUnit &tu, const ComponentID compID); -#if !REMOVE_PPS_REXT - bool hasCrossCompPredInfo (const TransformUnit &tu, const ComponentID &compID); -#endif bool needsSqrt2Scale ( const TransformUnit &tu, const ComponentID &compID ); bool needsBlockSizeTrafoScale ( const TransformUnit &tu, const ComponentID &compID ); diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 9a4130a11a652eb1ed15146b0ffece3a6c9f3643..7404213c8fe6da53eb3e1b6cd4f4238d2a756bc9 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -42,9 +42,7 @@ #include "CommonLib/Picture.h" #include "CommonLib/UnitTools.h" //#include "CommonLib/CodingStructure.h" -#if JVET_Q0806 #include <queue> -#endif #define BLOCK_STATS_POLYGON_MIN_POINTS 3 #define BLOCK_STATS_POLYGON_MAX_POINTS 5 @@ -275,95 +273,6 @@ void CDTrace::dtrace_polygon_vector(int k, int poc, const std::vector<Position> dtrace<false>(k, "BlockStat: POC %d @[%s] %s={%4d,%4d}\n", poc, polygonDescription.c_str(), stat_type.c_str(), val_x, val_y); } -#if !JVET_Q0806 -void retrieveTriangularMvInfo(const PredictionUnit& pu, MotionInfo& mi0, MotionInfo& mi1) -{ - int triangleDir = pu.triangleSplitDir; - CMotionBuf mb = pu.getMotionBuf(); - bool foundMv[2] = { false, false }; - bool foundBi = false; - int32_t idxW = (int32_t)(floorLog2(pu.lwidth() ) - MIN_CU_LOG2); - int32_t idxH = (int32_t)(floorLog2(pu.lheight()) - MIN_CU_LOG2); - for (int32_t y = 0; y < mb.height; y++) - { - for (int32_t x = 0; x < mb.width; x++) - { - if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 0 && foundMv[0] == false) - { - mi0.mv[0] = mb.at(x, y).mv[0]; - mi0.mv[1] = mb.at(x, y).mv[1]; - mi0.refIdx[0] = mb.at(x, y).refIdx[0]; - mi0.refIdx[1] = mb.at(x, y).refIdx[1]; - foundMv[0] = true; - } - if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 1 && foundMv[1] == false) - { - mi1.mv[0] = mb.at(x, y).mv[0]; - mi1.mv[1] = mb.at(x, y).mv[1]; - mi1.refIdx[0] = mb.at(x, y).refIdx[0]; - mi1.refIdx[1] = mb.at(x, y).refIdx[1]; - foundMv[1] = true; - } - if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 2 && foundMv[0] == false && foundMv[1] == false) - { - mi0.mv[0] = Mv(0, 0); - mi0.mv[1] = Mv(0, 0); - mi1.mv[0] = Mv(0, 0); - mi1.mv[1] = Mv(0, 0); - mi0.refIdx[0] = -1; - mi0.refIdx[1] = -1; - mi1.refIdx[0] = -1; - mi1.refIdx[1] = -1; - if (mb.at(x, y).interDir == 3) - { - mi0.mv[0] = mb.at(x, y).mv[0]; - mi1.mv[0] = mb.at(x, y).mv[1]; - mi0.refIdx[0] = mb.at(x, y).refIdx[0]; - mi1.refIdx[0] = mb.at(x, y).refIdx[1]; - foundBi = true; - } - } - if ((foundMv[0] == true && foundMv[1] == true) || foundBi == true) - return; - } - } -} -void retrieveTrianglePolygon(const PredictionUnit& pu, std::vector<Position>& triangle0, std::vector<Position>& triangle1, Position& S, Position& E) -{ - TriangleSplit triangleDir = TriangleSplit(pu.triangleSplitDir); - Position TL = pu.Y().topLeft(); - Position TR = pu.Y().topRight(); TR = TR.offset(1, 0); - Position BL = pu.Y().bottomLeft(); BL = BL.offset(0, 1); - Position BR = pu.Y().bottomRight(); BR = BR.offset(1, 1); - - if (triangleDir == TRIANGLE_DIR_135) - { - S = Position(0, 0); - E = Position(pu.Y().width, pu.Y().height); - triangle0.push_back(TL); - triangle0.push_back(TR); - triangle0.push_back(BR); - triangle1.push_back(TL); - triangle1.push_back(BL); - triangle1.push_back(BR); - } - else if (triangleDir == TRIANGLE_DIR_45) - { - S = Position(0, pu.Y().height); - E = Position(pu.Y().width, 0); - triangle0.push_back(TL); - triangle0.push_back(TR); - triangle0.push_back(BL); - triangle1.push_back(TR); - triangle1.push_back(BL); - triangle1.push_back(BR); - } - else - { - CHECK(triangleDir != TRIANGLE_DIR_45 && triangleDir != TRIANGLE_DIR_135, "Unknown triangle type"); - } -} -#else void retrieveGeoPolygons(const CodingUnit& cu, std::vector<Position> (&geoPartitions)[2], Position (&linePositions)[2]) { // adapted code from interpolation filter to find geo partition polygons like this: @@ -542,7 +451,6 @@ void storeGeoMergeCtx(MergeCtx geoMergeCtx) { geoMergeCtxtsOfCurrentCtu.push(geoMergeCtx); } -#endif void writeBlockStatisticsHeader(const SPS *sps) { @@ -678,11 +586,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MVPIdxL1), pu.mvpIdx[REF_PIC_LIST_1]); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::RefIdxL1), pu.refIdx[REF_PIC_LIST_1]); } -#if !JVET_Q0806 - if (!pu.cu->affine && !pu.cu->triangle) -#else if (!pu.cu->affine && !pu.cu->geoFlag) -#endif { if (pu.interDir != 2 /* PRED_L1 */) { @@ -707,29 +611,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MVL1), mv.hor, mv.ver); } } -#if !JVET_Q0806 - else if (pu.cu->triangle) - { - MotionInfo mi[2]; - std::vector<Position> triangleCorners[2]; - Position S, E; - retrieveTrianglePolygon(pu, triangleCorners[0], triangleCorners[1], S, E); - DTRACE_LINE(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::TrianglePartitioning), S.x, S.y, E.x, E.y); - retrieveTriangularMvInfo(pu, mi[0], mi[1]); - for (int triangleIdx = 0; triangleIdx < 2; triangleIdx++) - { - for (int refIdx = 0; refIdx < 2; refIdx++) - { - mi[triangleIdx].mv[refIdx].hor = mi[triangleIdx].mv[refIdx].hor >= 0 ? (mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift); - mi[triangleIdx].mv[refIdx].ver = mi[triangleIdx].mv[refIdx].ver >= 0 ? (mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift); - if (mi[triangleIdx].refIdx[refIdx] != -1) - { - DTRACE_POLYGON_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu.cu->slice->getPOC(), triangleCorners[triangleIdx], GetBlockStatisticName(refIdx==0?BlockStatistic::TriangleMVL0:BlockStatistic::TriangleMVL1), mi[triangleIdx].mv[refIdx].hor, mi[triangleIdx].mv[refIdx].ver); - } - } - } - } -#endif else if (pu.cu->affine) { if (pu.interDir != 2 /* PRED_L1 */) @@ -841,7 +722,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } -#if JVET_Q0806 if (cu.geoFlag) { const uint8_t candIdx0 = cu.firstPU->geoMergeIdx0; @@ -908,7 +788,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } } -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::SMVDFlag), cu.smvdMode); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); @@ -968,20 +847,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::JointCbCr), tu.jointCbCr); } -#if !REMOVE_PPS_REXT - bool lumaOnly = ( cu.chromaFormat == CHROMA_400 || !tu.blocks[COMPONENT_Cb].valid() ); - if( !lumaOnly ) - { - if( TU::hasCrossCompPredInfo( tu, COMPONENT_Cb ) ) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::CompAlphaCb), tu.compAlpha[COMPONENT_Cb] ); - } - if( TU::hasCrossCompPredInfo( tu, COMPONENT_Cr ) ) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::CompAlphaCr), tu.compAlpha[COMPONENT_Cr] ); - } - } -#endif if( !(cu.chromaFormat == CHROMA_400 || (cu.isSepTree() && cu.chType == CHANNEL_TYPE_LUMA)) ) { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); @@ -993,9 +858,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } -#if JVET_Q0806 CHECK(geoMergeCtxtsOfCurrentCtu.size() != 0, "Did not use all pushed back geo merge contexts. Should not be possible!"); -#endif } void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) @@ -1126,11 +989,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MVPIdxL1), pu.mvpIdx[REF_PIC_LIST_1]); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::RefIdxL1), pu.refIdx[REF_PIC_LIST_1]); } -#if !JVET_Q0806 - if (!pu.cu->affine && !pu.cu->triangle) -#else if (!pu.cu->affine && !pu.cu->geoFlag) -#endif { if (pu.interDir != 2 /* PRED_L1 */) { @@ -1155,29 +1014,6 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MVL1), mv.hor, mv.ver); } } -#if !JVET_Q0806 - else if (pu.cu->triangle) - { - MotionInfo mi[2]; - std::vector<Position> triangleCorners[2]; - Position S, E; - retrieveTrianglePolygon(pu, triangleCorners[0], triangleCorners[1], S, E); - DTRACE_LINE(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TrianglePartitioning), S.x, S.y, E.x, E.y); - retrieveTriangularMvInfo(pu, mi[0], mi[1]); - for (int triangleIdx = 0; triangleIdx < 2; triangleIdx++) - { - for (int refIdx = 0; refIdx < 2; refIdx++) - { - mi[triangleIdx].mv[refIdx].hor = mi[triangleIdx].mv[refIdx].hor >= 0 ? (mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift); - mi[triangleIdx].mv[refIdx].ver = mi[triangleIdx].mv[refIdx].ver >= 0 ? (mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift); - if (mi[triangleIdx].refIdx[refIdx] != -1) - { - DTRACE_POLYGON_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu.cu->slice->getPOC(), triangleCorners[triangleIdx], GetBlockStatisticName(refIdx==0?BlockStatistic::TriangleMVL0:BlockStatistic::TriangleMVL1), mi[triangleIdx].mv[refIdx].hor, mi[triangleIdx].mv[refIdx].ver); - } - } - } - } -#endif else { if (pu.interDir != 2 /* PRED_L1 */) diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index a900eec517a7625e704218939fc3615456ba07b2..4637d8be743bedb69c3fb541ea64ace50d081010 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -72,10 +72,6 @@ enum class BlockStatistic { IndependentSliceIdx, LFNSTIdx, JointCbCr, -#if !REMOVE_PPS_REXT - CompAlphaCb, - CompAlphaCr, -#endif RDPCM_Y, RDPCM_Cb, RDPCM_Cr, @@ -120,15 +116,9 @@ enum class BlockStatistic { MMVDMergeIdx, CiipFlag, SMVDFlag, -#if !JVET_Q0806 - TrianglePartitioning, - TriangleMVL0, //<< currently only uni-prediction enabled - TriangleMVL1, //<< currently only uni-prediction enabled -#else GeoPartitioning, GeoMVL0, //<< currently only uni-prediction enabled GeoMVL1, //<< currently only uni-prediction enabled -#endif BCWIndex, // for dual tree // general @@ -177,10 +167,6 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::IndependentSliceIdx, std::tuple<std::string, BlockStatisticType, std::string>{"IndependentSliceIdx", BlockStatisticType::Integer, ""}}, { BlockStatistic::LFNSTIdx, std::tuple<std::string, BlockStatisticType, std::string>{"LFNSTIdx", BlockStatisticType::Integer, "[0, 3]"}}, { BlockStatistic::JointCbCr, std::tuple<std::string, BlockStatisticType, std::string>{"JointCbCr", BlockStatisticType::Flag, ""}}, -#if !REMOVE_PPS_REXT - { BlockStatistic::CompAlphaCb, std::tuple<std::string, BlockStatisticType, std::string>{"CompAlphaCb", BlockStatisticType::Integer, ""}}, - { BlockStatistic::CompAlphaCr, std::tuple<std::string, BlockStatisticType, std::string>{"CompAlphaCr", BlockStatisticType::Integer, ""}}, -#endif { BlockStatistic::RDPCM_Y, std::tuple<std::string, BlockStatisticType, std::string>{"RDPCM_Y", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}}, { BlockStatistic::RDPCM_Cb, std::tuple<std::string, BlockStatisticType, std::string>{"RDPCM_Cb", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}}, { BlockStatistic::RDPCM_Cr, std::tuple<std::string, BlockStatisticType, std::string>{"RDPCM_Cr", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}}, @@ -222,15 +208,9 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::MMVDMergeIdx, std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeIdx", BlockStatisticType::Integer, "[0, 1]"}}, { BlockStatistic::CiipFlag, std::tuple<std::string, BlockStatisticType, std::string>{"CiipFlag", BlockStatisticType::Flag, ""}}, { BlockStatistic::SMVDFlag, std::tuple<std::string, BlockStatisticType, std::string>{"SMVDFlag", BlockStatisticType::Flag, ""}}, -#if !JVET_Q0806 - { BlockStatistic::TrianglePartitioning, std::tuple<std::string, BlockStatisticType, std::string>{"TrianglePartitioning", BlockStatisticType::Line, ""}}, - { BlockStatistic::TriangleMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"}}, - { BlockStatistic::TriangleMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"}}, -#else { BlockStatistic::GeoPartitioning, std::tuple<std::string, BlockStatisticType, std::string>{"GeoPartitioning", BlockStatisticType::Line, ""} }, { BlockStatistic::GeoMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"GeoMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"} }, { BlockStatistic::GeoMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"GeoMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"} }, -#endif { BlockStatistic::BCWIndex, std::tuple<std::string, BlockStatisticType, std::string>{"BCWIndex", BlockStatisticType::Integer, "[0, 4]"} }, // for dual tree { BlockStatistic::Depth_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"Depth_Chroma", BlockStatisticType::Integer, "[0, 10]"}}, // todo: actual limits? @@ -252,10 +232,8 @@ void writeBlockStatisticsHeader(const SPS *sps); void getAndStoreBlockStatistics(const CodingStructure& cs, const UnitArea& ctuArea); void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea); void writeAllCodedData(const CodingStructure& cs, const UnitArea& ctuArea); -#if JVET_Q0806 class MergeCtx; void storeGeoMergeCtx(MergeCtx geoMergeCtx); #endif -#endif #endif // _DTRACE_BLOCKSTATISTICS_H_ diff --git a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h index 30858585761678f3c87cdbb9c4bcc51b3e572a7b..295465d592d39ce3132853dc0484f94b85e26c70 100644 --- a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h +++ b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h @@ -416,7 +416,6 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs process2coeffs(0, pImg3 + 0, pImg4 + 0, pImg1 + 1, pImg2 - 1); process2coeffs(1, pImg1 + 0, pImg2 + 0, pImg1 - 1, pImg2 + 1); process2coeffs(2, pImg0 + 2, pImg0 - 2, pImg0 + 1, pImg0 - 1); -#if JVET_Q0150 bool isNearVBabove = yVb < vbPos && (yVb >= vbPos - 1); bool isNearVBbelow = yVb >= vbPos && (yVb <= vbPos); if (!(isNearVBabove || isNearVBbelow)) @@ -429,10 +428,6 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs accumA = _mm_srai_epi32(accumA, SHIFT + 3); accumB = _mm_srai_epi32(accumB, SHIFT + 3); } -#else - accumA = _mm_srai_epi32(accumA, SHIFT); - accumB = _mm_srai_epi32(accumB, SHIFT); -#endif accumA = _mm_packs_epi32(accumA, accumB); accumA = _mm_add_epi16(accumA, cur); accumA = _mm_min_epi16(mmMax, _mm_max_epi16(accumA, mmMin)); @@ -651,7 +646,6 @@ static void simdFilter7x7Blk(AlfClassifier **classifier, const PelUnitBuf &recDs process2coeffs(5, pImg0 + 2, pImg0 - 2, pImg0 + 1, pImg0 - 1); -#if JVET_Q0150 bool isNearVBabove = yVb < vbPos && (yVb >= vbPos - 1); bool isNearVBbelow = yVb >= vbPos && (yVb <= vbPos); if (!(isNearVBabove || isNearVBbelow)) @@ -664,10 +658,6 @@ static void simdFilter7x7Blk(AlfClassifier **classifier, const PelUnitBuf &recDs accumA = _mm_srai_epi32(accumA, SHIFT + 3); accumB = _mm_srai_epi32(accumB, SHIFT + 3); } -#else - accumA = _mm_srai_epi32(accumA, SHIFT); - accumB = _mm_srai_epi32(accumB, SHIFT); -#endif accumA = _mm_packs_epi32(accumA, accumB); accumA = _mm_add_epi16(accumA, cur); accumA = _mm_min_epi16(mmMax, _mm_max_epi16(accumA, mmMin)); diff --git a/source/Lib/CommonLib/x86/InterpolationFilterX86.h b/source/Lib/CommonLib/x86/InterpolationFilterX86.h index 81608d2a4da059975fd7a81eeb09170b82b0dcc5..c4e093f85baf3f6f1203cab80530e16b5766da1c 100644 --- a/source/Lib/CommonLib/x86/InterpolationFilterX86.h +++ b/source/Lib/CommonLib/x86/InterpolationFilterX86.h @@ -1327,130 +1327,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel } } -#if !JVET_Q0806 -template< X86_VEXT vext > -void xWeightedTriangleBlk_SSE(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) -{ - Pel* dst = predDst.get(compIdx).buf; - Pel* src0 = predSrc0.get(compIdx).buf; - Pel* src1 = predSrc1.get(compIdx).buf; - int32_t strideDst = predDst.get(compIdx).stride; - int32_t strideSrc0 = predSrc0.get(compIdx).stride; - int32_t strideSrc1 = predSrc1.get(compIdx).stride; - - int32_t chromaScaleX = getComponentScaleX(compIdx, pu.chromaFormat); - int32_t chromaScaleY = getComponentScaleY(compIdx, pu.chromaFormat); - int8_t log2WidthY = floorLog2(width << chromaScaleX) - 1; - int8_t log2HeightY = floorLog2(height << chromaScaleY) - 1; - const char log2WeightBase = 3; - const ClpRng clpRng = pu.cu->slice->clpRngs().comp[compIdx]; - const int32_t shiftWeighted = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)) + log2WeightBase; - const int32_t offsetWeighted = (1 << (shiftWeighted - 1)) + (IF_INTERNAL_OFFS << log2WeightBase); - int16_t *weight = g_triangleWeights[splitDir][log2HeightY][log2WidthY]; - int16_t stepY = width << (chromaScaleX + chromaScaleY); - - const __m128i mmEight = _mm_set1_epi16(8); - const __m128i mmOffset = _mm_set1_epi32(offsetWeighted); - const __m128i mmShift = _mm_cvtsi32_si128(shiftWeighted); - const __m128i mmMin = _mm_set1_epi16(clpRng.min); - const __m128i mmMax = _mm_set1_epi16(clpRng.max); - - if (width == 2) - { - const __m128i mask = _mm_set_epi16( (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, 0x0504, 0x0100 ); - for (int y = 0; y < height; y++) - { - __m128i s0 = _mm_cvtsi32_si128(*(uint32_t *) src0); - __m128i s1 = _mm_cvtsi32_si128(*(uint32_t *) src1); - __m128i w0 = _mm_loadl_epi64((__m128i *) (weight)); - if (chromaScaleX == 1) - { - w0 = _mm_shuffle_epi8(w0, mask); - } - __m128i w1 = _mm_sub_epi16(mmEight, w0); - s0 = _mm_unpacklo_epi16(s0, s1); - w0 = _mm_unpacklo_epi16(w0, w1); - s0 = _mm_add_epi32(_mm_madd_epi16(s0, w0), mmOffset); - s0 = _mm_sra_epi32(s0, mmShift); - s0 = _mm_packs_epi32(s0, s0); - s0 = _mm_min_epi16(mmMax, _mm_max_epi16(s0, mmMin)); - - *(uint32_t *) dst = _mm_cvtsi128_si32(s0); - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - weight += stepY; - } - } - else if(width == 4) - { - const __m128i mask = _mm_set_epi16( (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, 0x0D0C, 0x0908, 0x0504, 0x0100 ); - for (int y = 0; y < height; y++) - { - __m128i s0 = _mm_loadl_epi64((__m128i *) (src0)); - __m128i s1 = _mm_loadl_epi64((__m128i *) (src1)); - __m128i w0 = _mm_loadu_si128((__m128i *) (weight)); - if (chromaScaleX == 1) - { - w0 = _mm_shuffle_epi8(w0, mask); - } - __m128i w1 = _mm_sub_epi16(mmEight, w0); - s0 = _mm_unpacklo_epi16(s0, s1); - w0 = _mm_unpacklo_epi16(w0, w1); - s0 = _mm_add_epi32(_mm_madd_epi16(s0, w0), mmOffset); - s0 = _mm_sra_epi32(s0, mmShift); - s0 = _mm_packs_epi32(s0, s0); - s0 = _mm_min_epi16(mmMax, _mm_max_epi16(s0, mmMin)); - _mm_storel_epi64((__m128i *) (dst), s0); - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - weight += stepY; - } - } - else - { - const __m128i mask1 = _mm_set_epi16( 0x0D0C, 0x0908, 0x0504, 0x0100, (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080 ); - const __m128i mask2 = _mm_set_epi16( (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, 0x0D0C, 0x0908, 0x0504, 0x0100 ); - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x += 8) - { - __m128i s0 = _mm_loadu_si128((__m128i *) (src0 + x)); - __m128i s1 = _mm_loadu_si128((__m128i *) (src1 + x)); - - __m128i w0 = _mm_loadu_si128((__m128i *) (weight + (x << chromaScaleX))); - if (chromaScaleX == 1) - { - __m128i w01 = _mm_loadu_si128((__m128i *) (weight + (x << chromaScaleX) + 8)); - w0 = _mm_shuffle_epi8(w0, mask1); - w01 = _mm_shuffle_epi8(w01, mask2); - w0 = _mm_alignr_epi8(w01, w0, 8); - } - __m128i w1 = _mm_sub_epi16(mmEight, w0); - - __m128i s0tmp = _mm_unpacklo_epi16(s0, s1); - __m128i w0tmp = _mm_unpacklo_epi16(w0, w1); - s0tmp = _mm_add_epi32(_mm_madd_epi16(s0tmp, w0tmp), mmOffset); - s0tmp = _mm_sra_epi32(s0tmp, mmShift); - - s0 = _mm_unpackhi_epi16(s0, s1); - w0 = _mm_unpackhi_epi16(w0, w1); - s0 = _mm_add_epi32(_mm_madd_epi16(s0, w0), mmOffset); - s0 = _mm_sra_epi32(s0, mmShift); - - s0 = _mm_packs_epi32(s0tmp, s0); - s0 = _mm_min_epi16(mmMax, _mm_max_epi16(s0, mmMin)); - _mm_storeu_si128((__m128i *) (dst + x), s0); - } - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - weight += stepY; - } - } -} -#else template< X86_VEXT vext > void xWeightedGeoBlk_SSE(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) { @@ -1670,7 +1546,6 @@ void xWeightedGeoBlk_SSE(const PredictionUnit &pu, const uint32_t width, const u } } } -#endif template <X86_VEXT vext> void InterpolationFilter::_initInterpolationFilterX86() @@ -1711,11 +1586,7 @@ void InterpolationFilter::_initInterpolationFilterX86() m_filterCopy[1][0] = simdFilterCopy<vext, true, false>; m_filterCopy[1][1] = simdFilterCopy<vext, true, true>; -#if !JVET_Q0806 - m_weightedTriangleBlk = xWeightedTriangleBlk_SSE<vext>; -#else m_weightedGeoBlk = xWeightedGeoBlk_SSE<vext>; -#endif } template void InterpolationFilter::_initInterpolationFilterX86<SIMDX86>(); diff --git a/source/Lib/CommonLib/x86/RdCostX86.h b/source/Lib/CommonLib/x86/RdCostX86.h index b11df9504448ceb4db9fd248851b1c38ff52736d..fb15970b19347efe72e28885dce403849980c4ec 100644 --- a/source/Lib/CommonLib/x86/RdCostX86.h +++ b/source/Lib/CommonLib/x86/RdCostX86.h @@ -1973,7 +1973,6 @@ static uint32_t xCalcHAD8x16_AVX2( const Pel* piOrg, const Pel* piCur, const int return (sad); } -#if JVET_Q0806 template< X86_VEXT vext > Distortion RdCost::xGetSADwMask_SIMD( const DistParam &rcDtParam ) { @@ -2063,7 +2062,6 @@ Distortion RdCost::xGetSADwMask_SIMD( const DistParam &rcDtParam ) return sum >> DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth); } -#endif template<X86_VEXT vext> Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) @@ -2242,9 +2240,7 @@ void RdCost::_initRdCostX86() m_afpDistortFunc[DF_SAD_INTERMEDIATE_BITDEPTH] = RdCost::xGetSAD_IBD_SIMD<vext>; -#if JVET_Q0806 m_afpDistortFunc[DF_SAD_WITH_MASK] = xGetSADwMask_SIMD<vext>; -#endif } template void RdCost::_initRdCostX86<SIMDX86>(); diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 34474fbc0af5a5788a4efc87a907491b336decd7..139862fb9e70b66fe78c61a2a141441e672cc99f 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -194,7 +194,6 @@ void CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i } } } -#if JVET_Q0795_CCALF if (cs.sps->getCCALFEnabledFlag()) { for ( int compIdx = 1; compIdx < getNumberValidComponents( cs.pcv->chrFormat ); compIdx++ ) @@ -212,7 +211,6 @@ void CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i } } } -#endif if ( CS::isDualITree(cs) && cs.pcv->chrFormat != CHROMA_400 && cs.pcv->maxCUWidth > 64 ) @@ -270,7 +268,6 @@ void CABACReader::readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr) } alfCtbFilterSetIndex[ctuRsAddr] = filtIndex; } -#if JVET_Q0795_CCALF void CABACReader::ccAlfFilterControlIdc(CodingStructure &cs, const ComponentID compID, const int curIdx, uint8_t *filterControlIdc, Position lumaPos, int filterCount) { @@ -307,7 +304,6 @@ void CABACReader::ccAlfFilterControlIdc(CodingStructure &cs, const ComponentID c DTRACE(g_trace_ctx, D_SYNTAX, "ccAlfFilterControlIdc() compID=%d pos=(%d,%d) ctxt=%d, filterCount=%d, idcVal=%d\n", compID, lumaPos.x, lumaPos.y, ctxt, filterCount, idcVal); } -#endif //================================================================================ // clause 7.3.8.3 @@ -481,9 +477,7 @@ void CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU if( cs.slice->getUseChromaQpAdj() && partitioner.currQgChromaEnable() ) { cuCtx.isChromaQpAdjCoded = false; -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET cs.chromaQpAdj = 0; -#endif } // Reset delta QP coding flag and ChromaQPAdjustemt coding flag @@ -497,9 +491,7 @@ void CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU if (cs.slice->getUseChromaQpAdj() && pPartitionerChroma->currQgChromaEnable()) { pCuCtxChroma->isChromaQpAdjCoded = false; -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET cs.chromaQpAdj = 0; -#endif } } @@ -671,7 +663,6 @@ void CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU bool jointPLT = false; if (cu.isSepTree()) { -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) { compBegin = COMPONENT_Y; @@ -680,7 +671,6 @@ void CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU } else { -#endif if (isLuma(partitioner.chType)) { compBegin = COMPONENT_Y; @@ -691,18 +681,12 @@ void CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU compBegin = COMPONENT_Cb; numComp = 2; } -#if JVET_Q0504_PLT_NON444 } -#endif } else { compBegin = COMPONENT_Y; -#if JVET_Q0504_PLT_NON444 numComp = (cu.chromaFormat != CHROMA_400) ? 3 : 1; -#else - numComp = 3; -#endif jointPLT = true; } if (CU::isPLT(cu)) @@ -871,7 +855,6 @@ void CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& } else { -#if JVET_Q0504_PLT_NON444 if( cu.chromaFormat != CHROMA_400 ) { cu_palette_info(cu, COMPONENT_Y, 3, cuCtx); @@ -880,18 +863,10 @@ void CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& { cu_palette_info(cu, COMPONENT_Y, 1, cuCtx); } -#else - cu_palette_info(cu, COMPONENT_Y, 3, cuCtx); -#endif } end_of_ctu(cu, cuCtx); return; } -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - bdpcm_mode( cu, ComponentID( partitioner.chType ) ); - if (!CS::isDualITree(*cu.cs) && isLuma(partitioner.chType)) - bdpcm_mode(cu, ComponentID(CHANNEL_TYPE_CHROMA)); -#endif // --> create PUs @@ -1087,11 +1062,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) cu.predMode = MODE_IBC; } } -#if JVET_Q0629_REMOVAL_PLT_4X4 if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) ) -#else - if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) { @@ -1104,11 +1075,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) if (m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)))) { cu.predMode = MODE_INTRA; -#if JVET_Q0629_REMOVAL_PLT_4X4 if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) ) -#else - if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) { @@ -1141,11 +1108,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) if ( cu.cs->slice->isIntra() || (cu.lwidth() == 4 && cu.lheight() == 4) || cu.isConsIntra() ) { cu.predMode = MODE_INTRA; -#if JVET_Q0629_REMOVAL_PLT_4X4 if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) ) ) ) -#else - if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) { @@ -1156,11 +1119,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) else { cu.predMode = m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))) ? MODE_INTRA : MODE_INTER; -#if JVET_Q0629_REMOVAL_PLT_4X4 if (CU::isIntra(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) ) ) ) -#else - if (CU::isIntra(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) { @@ -1191,19 +1150,11 @@ void CABACReader::bdpcm_mode( CodingUnit& cu, const ComponentID compID ) RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__BDPCM_MODE, cu.block(compID).lumaSize(), compID ); int bdpcmMode; -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 unsigned ctxId = isLuma( compID ) ? 0 : 2; bdpcmMode = m_BinDecoder.decodeBin( Ctx::BDPCMMode(ctxId) ); -#else - bdpcmMode = m_BinDecoder.decodeBin(Ctx::BDPCMMode(0)); -#endif if (bdpcmMode) { -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 bdpcmMode += m_BinDecoder.decodeBin( Ctx::BDPCMMode(ctxId+1) ); -#else - bdpcmMode += m_BinDecoder.decodeBin(Ctx::BDPCMMode(1)); -#endif } if (isLuma(compID)) { @@ -1227,19 +1178,15 @@ void CABACReader::cu_pred_data( CodingUnit &cu ) { if( CU::isIntra( cu ) ) { -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 if( cu.Y().valid() ) { bdpcm_mode(cu, COMPONENT_Y ); } -#endif intra_luma_pred_modes( cu ); -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 if( ( !cu.Y().valid() || (!cu.isSepTree() && cu.Y().valid() ) ) && isChromaEnabled(cu.chromaFormat) ) { bdpcm_mode(cu, ComponentID(CHANNEL_TYPE_CHROMA)); } -#endif intra_chroma_pred_modes( cu ); return; } @@ -1480,13 +1427,11 @@ void CABACReader::intra_chroma_pred_modes( CodingUnit& cu ) return; } -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 if( cu.bdpcmModeChroma ) { cu.firstPU->intraDir[1] = cu.bdpcmModeChroma == 2 ? VER_IDX : HOR_IDX; return; } -#endif PredictionUnit *pu = cu.firstPU; { @@ -1524,15 +1469,6 @@ void CABACReader::intra_chroma_pred_mode(PredictionUnit& pu) } // LM chroma mode -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - if (pu.cu->bdpcmModeChroma) - { - unsigned chromaCandModes[NUM_CHROMA_MODE]; - PU::getIntraChromaCandModes(pu, chromaCandModes); - pu.intraDir[1] = chromaCandModes[0]; - return; - } -#endif if (pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed()) { @@ -1595,9 +1531,7 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; cuCtx.lfnstLastScanPos = false; cuCtx.violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif ChromaCbfs chromaCbfs; if( cu.ispMode && isLuma( partitioner.chType ) ) @@ -1718,30 +1652,21 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ TransformUnit& tu = *cu.firstTU; int curPLTidx = 0; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cu.cs->prevPLT.curPLTSize[compBegin] = cu.cs->prevPLT.curPLTSize[COMPONENT_Y]; -#endif cu.lastPLTSize[compBegin] = cu.cs->prevPLT.curPLTSize[compBegin]; -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE int maxPltSize = cu.isSepTree() ? MAXPLTSIZE_DUALTREE : MAXPLTSIZE; -#endif if (cu.lastPLTSize[compBegin]) { -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE xDecodePLTPredIndicator(cu, maxPltSize, compBegin); -#else - xDecodePLTPredIndicator(cu, MAXPLTSIZE, compBegin); -#endif } for (int idx = 0; idx < cu.lastPLTSize[compBegin]; idx++) { if (cu.reuseflag[compBegin][idx]) { -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) { for( int comp = COMPONENT_Y; comp < MAX_NUM_COMPONENT; comp++ ) @@ -1751,33 +1676,24 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ } else { -#endif for (int comp = compBegin; comp < (compBegin + numComp); comp++) { cu.curPLT[comp][curPLTidx] = cu.cs->prevPLT.curPLT[comp][idx]; } -#if JVET_Q0504_PLT_NON444 } -#endif curPLTidx++; } } uint32_t recievedPLTnum = 0; -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE if (curPLTidx < maxPltSize) -#else - if (curPLTidx < MAXPLTSIZE) -#endif { recievedPLTnum = exp_golomb_eqprob(0); } cu.curPLTSize[compBegin] = curPLTidx + recievedPLTnum; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cu.curPLTSize[COMPONENT_Y] = cu.curPLTSize[compBegin]; -#endif for (int comp = compBegin; comp < (compBegin + numComp); comp++) { for (int idx = curPLTidx; idx < cu.curPLTSize[compBegin]; idx++) @@ -1785,7 +1701,6 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ ComponentID compID = (ComponentID)comp; const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); cu.curPLT[compID][idx] = m_BinDecoder.decodeBinsEP(channelBitDepth); -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) { if( isLuma( cu.chType ) ) @@ -1798,7 +1713,6 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ cu.curPLT[COMPONENT_Y][idx] = 1 << (cu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA) - 1); } } -#endif } } cu.useEscape[compBegin] = true; @@ -1844,9 +1758,7 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ { cuPaletteSubblockInfo(cu, compBegin, numComp, subSetId, prevRunPos, prevRunType); } -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE CHECK(cu.curPLTSize[compBegin] > maxPltSize, " Current palette size is larger than maximum palette size"); -#endif } void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, uint32_t numComp, int subSetId, uint32_t& prevRunPos, unsigned& prevRunType) { @@ -1979,11 +1891,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)comp); if (compID == COMPONENT_Y || compBegin != COMPONENT_Y) { -#if JVET_Q0491_PLT_ESCAPE escapeValue.at(posx, posy) = exp_golomb_eqprob(5); -#else - escapeValue.at(posx, posy) = exp_golomb_eqprob(3); -#endif assert(escapeValue.at(posx, posy) < (1 << (cu.cs->sps->getBitDepth(toChannelType((ComponentID)comp)) + 1))); DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos); } @@ -1991,11 +1899,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u { uint32_t posxC = posx >> scaleX; uint32_t posyC = posy >> scaleY; -#if JVET_Q0491_PLT_ESCAPE escapeValue.at(posxC, posyC) = exp_golomb_eqprob(5); -#else - escapeValue.at(posxC, posyC) = exp_golomb_eqprob(3); -#endif assert(escapeValue.at(posxC, posyC) < (1 << (cu.cs->sps->getBitDepth(toChannelType(compID)) + 1))); DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos); } @@ -2031,10 +1935,8 @@ void CABACReader::xDecodePLTPredIndicator(CodingUnit& cu, uint32_t maxPLTSize, C idx += symbol - 1; } cu.reuseflag[compBegin][idx] = 1; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cu.reuseflag[COMPONENT_Y][idx] = 1; -#endif numPltPredicted++; idx++; } @@ -2121,11 +2023,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) pu.cu->affine = false; pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF; mvd_coding(pu.mvd[REF_PIC_LIST_0]); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pu.cs->sps->getMaxNumIBCMergeCand() == 1) -#else - if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 ) -#endif { pu.mvpIdx[REF_PIC_LIST_0] = 0; } @@ -2299,29 +2197,13 @@ void CABACReader::merge_data( PredictionUnit& pu ) RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__MERGE_FLAG ); -#if JVET_Q0806 const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64; const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE pu.cs->sps->getMaxNumGeoCand() > 1 -#else - pu.cu->cs->picHeader->getMaxNumGeoCand() > 1 -#endif && pu.cu->lwidth() >= GEO_MIN_CU_SIZE && pu.cu->lheight() >= GEO_MIN_CU_SIZE && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth(); if (geoAvailable || ciipAvailable) -#else - const bool triangleAvailable = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - pu.cs->sps->getMaxNumGeoCand() > 1; -#else - pu.cu->cs->picHeader->getMaxNumTriangleCand() > 1; -#endif - const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE; - if (pu.cu->lwidth() * pu.cu->lheight() >= 64 - && (triangleAvailable || ciipAvailable)) -#endif { cu.firstPU->regularMergeFlag = m_BinDecoder.decodeBin(Ctx::RegularMergeFlag(cu.skip ? 0 : 1)); } @@ -2348,29 +2230,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) { pu.mmvdMergeFlag = false; pu.cu->mmvdSkip = false; -#if !JVET_Q0806 - if (triangleAvailable && ciipAvailable) - { - Ciip_flag(pu); - } - else if (ciipAvailable) - { - pu.ciipFlag = true; - } - else - { - pu.ciipFlag = false; - } - if (pu.ciipFlag) - { - pu.intraDir[0] = PLANAR_IDX; - pu.intraDir[1] = DM_CHROMA_IDX; - } - else - { - pu.cu->triangle = true; - } -#else if (geoAvailable && ciipAvailable) { Ciip_flag(pu); @@ -2392,7 +2251,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) { pu.cu->geoFlag = true; } -#endif } } if (pu.mmvdMergeFlag || pu.cu->mmvdSkip) @@ -2432,67 +2290,16 @@ void CABACReader::merge_idx( PredictionUnit& pu ) } else { -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE int numCandminus1 = int(pu.cs->sps->getMaxNumMergeCand()) - 1; -#else - int numCandminus1 = int( pu.cs->picHeader->getMaxNumMergeCand() ) - 1; -#endif pu.mergeIdx = 0; -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__TRIANGLE_INDEX ); - bool splitDir; - uint8_t candIdx0; - uint8_t candIdx1; - splitDir = m_BinDecoder.decodeBinEP(); - auto decodeOneIdx = [this](int numCandminus1) -> uint8_t - { - uint8_t decIdx = 0; - if( numCandminus1 > 0 ) - { - if( this->m_BinDecoder.decodeBin( Ctx::MergeIdx() ) ) - { - decIdx++; - for( ; decIdx < numCandminus1; decIdx++ ) - { - if( !this->m_BinDecoder.decodeBinEP() ) - break; - } - } - } - return decIdx; - }; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - const int maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand(); -#else - const int maxNumTriangleCand = pu.cs->picHeader->getMaxNumTriangleCand(); -#endif - CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates"); - candIdx0 = decodeOneIdx(maxNumTriangleCand - 1); - candIdx1 = decodeOneIdx(maxNumTriangleCand - 2); - candIdx1 += candIdx1 >= candIdx0 ? 1 : 0; - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_split_dir=%d\n", splitDir ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx0=%d\n", candIdx0 ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx1=%d\n", candIdx1 ); - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - return; - } -#else if( pu.cu->geoFlag ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__GEO_INDEX ); uint32_t splitDir = 0; xReadTruncBinCode(splitDir, GEO_NUM_PARTITION_MODE); pu.geoSplitDir = splitDir; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE const int maxNumGeoCand = pu.cs->sps->getMaxNumGeoCand(); -#else - const int maxNumGeoCand = pu.cs->picHeader->getMaxNumGeoCand(); -#endif CHECK(maxNumGeoCand < 2, "Incorrect max number of geo candidates"); CHECK(pu.cu->lheight() > 64 || pu.cu->lwidth() > 64, "Incorrect block size of geo flag"); int numCandminus2 = maxNumGeoCand - 2; @@ -2518,15 +2325,10 @@ void CABACReader::merge_idx( PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx1=%d\n", mergeCand1 ); return; } -#endif if (pu.cu->predMode == MODE_IBC) { -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE numCandminus1 = int(pu.cs->sps->getMaxNumIBCMergeCand()) - 1; -#else - numCandminus1 = int(pu.cs->picHeader->getMaxNumIBCMergeCand()) - 1; -#endif } if( numCandminus1 > 0 ) { @@ -2551,11 +2353,7 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu) RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__MERGE_INDEX); int var0 = 0; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pu.cs->sps->getMaxNumMergeCand() > 1) -#else - if (pu.cs->picHeader->getMaxNumMergeCand() > 1) -#endif { static_assert(MMVD_BASE_MV_NUM == 2, ""); var0 = m_BinDecoder.decodeBin(Ctx::MmvdMergeIdx()); @@ -2998,12 +2796,6 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, Partitioner& { for( ComponentID compID = COMPONENT_Cb; compID <= COMPONENT_Cr; compID = ComponentID( compID + 1 ) ) { -#if !REMOVE_PPS_REXT - if( TU::hasCrossCompPredInfo( tu, compID ) ) - { - cross_comp_pred( tu, compID ); - } -#endif if( tu.cbf[ compID ] ) { residual_coding( tu, compID, cuCtx ); @@ -3092,11 +2884,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& ts_flag ( tu, compID ); explicit_rdpcm_mode( tu, compID ); -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM if( tu.mtsIdx[compID] == MTS_SKIP && !tu.cs->slice->getTSResidualCodingDisabledFlag() ) -#else - if (tu.mtsIdx[compID] == MTS_SKIP) -#endif { residual_codingTS( tu, compID ); return; @@ -3130,18 +2918,10 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; cuCtx.lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; } -#if !JVET_Q0055_MTS_SIGNALLING - if( isLuma(compID) && ( cctx.posX(cctx.scanPosLast()) >= 16 || cctx.posY(cctx.scanPosLast()) >= 16 ) ) - { - cuCtx.violatesMtsCoeffConstraint = true; - } -#endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (isLuma(compID) && tu.mtsIdx[compID] != MTS_SKIP) { cuCtx.mtsLastScanPos |= cctx.scanPosLast() >= 1; } -#endif // parse subblocks const int stateTransTab = ( tu.cs->picHeader->getDepQuantEnabledFlag() ? 32040 : 0 ); @@ -3163,12 +2943,10 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& } residual_coding_subblock( cctx, coeff, stateTransTab, state ); -#if JVET_Q0055_MTS_SIGNALLING if ( isLuma(compID) && cctx.isSigGroup() && ( cctx.cgPosY() > 3 || cctx.cgPosX() > 3 ) ) { cuCtx.violatesMtsCoeffConstraint = true; } -#endif } } @@ -3195,11 +2973,7 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx ) int mtsIdx = tu.mtsIdx[COMPONENT_Y]; // Transform skip flag has already been decoded if( CU::isMTSAllowed( cu, COMPONENT_Y ) && !cuCtx.violatesMtsCoeffConstraint && -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP) -#else - cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) -#endif { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__MTS_FLAGS, tu.blocks[COMPONENT_Y], COMPONENT_Y ); int ctxIdx = 0; @@ -3291,7 +3065,6 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) const bool lumaFlag = cu.isSepTree() ? ( isLuma( cu.chType ) ? true : false ) : true; const bool chromaFlag = cu.isSepTree() ? ( isChroma( cu.chType ) ? true : false ) : true; bool nonZeroCoeffNonTsCorner8x8 = ( lumaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] ) || (chromaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] ); -#if JVET_Q0784_LFNST_COMBINATION bool isTrSkip = false; for (auto &currTU : CU::traverseTUs(cu)) { @@ -3305,9 +3078,6 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) } } } -#else - const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx[COMPONENT_Y] == MTS_SKIP; -#endif if ((!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isTrSkip) { cu.lfnstIdx = 0; @@ -3756,40 +3526,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* } } -#if !REMOVE_PPS_REXT -//================================================================================ -// clause 7.3.8.12 -//-------------------------------------------------------------------------------- -// void cross_comp_pred( tu, compID ) -//================================================================================ - -void CABACReader::cross_comp_pred( TransformUnit& tu, ComponentID compID ) -{ - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__CROSS_COMPONENT_PREDICTION, tu.blocks[compID], compID); - - signed char alpha = 0; - unsigned ctxBase = ( compID == COMPONENT_Cr ? 5 : 0 ); - unsigned symbol = m_BinDecoder.decodeBin( Ctx::CrossCompPred(ctxBase) ); - if( symbol ) - { - // Cross-component prediction alpha is non-zero. - symbol = m_BinDecoder.decodeBin( Ctx::CrossCompPred(ctxBase+1) ); - if( symbol ) - { - // alpha is 2 (symbol=1), 4(symbol=2) or 8(symbol=3). - // Read up to two more bits - symbol += unary_max_symbol( Ctx::CrossCompPred(ctxBase+2), Ctx::CrossCompPred(ctxBase+3), 2 ); - } - alpha = ( 1 << symbol ); - if( m_BinDecoder.decodeBin( Ctx::CrossCompPred(ctxBase+4) ) ) - { - alpha = -alpha; - } - } - DTRACE( g_trace_ctx, D_SYNTAX, "cross_comp_pred() etype=%d pos=(%d,%d) alpha=%d\n", compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.compAlpha[compID] ); - tu.compAlpha[compID] = alpha; -} -#endif //================================================================================ diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index 8d0b2bf0b32d09612aaf2511931c2c260b4d0b9b..a85e9a6c1a852a8a7912beb17de1b4f7beabdd4f 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -70,10 +70,8 @@ public: void readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr); -#if JVET_Q0795_CCALF void ccAlfFilterControlIdc(CodingStructure &cs, const ComponentID compID, const int curIdx, uint8_t *filterControlIdc, Position lumaPos, int filterCount); -#endif // coding (quad)tree (clause 7.3.8.4) void coding_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, Partitioner* pPartitionerChroma = nullptr, CUCtx* pCuCtxChroma = nullptr); @@ -144,10 +142,6 @@ public: void residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* coeff ); void joint_cb_cr ( TransformUnit& tu, const int cbfMask ); -#if !REMOVE_PPS_REXT - // cross component prediction (clause 7.3.8.12) - void cross_comp_pred ( TransformUnit& tu, ComponentID compID ); -#endif private: unsigned unary_max_symbol ( unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol ); diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index e77a5737a3f4054de53fdc00ec7c2a8893115d0f..7101c99c4de57becddacdd3bc1ea1564f3c5cdcc 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -134,7 +134,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) if (currCU.predMode != MODE_INTRA && currCU.predMode != MODE_PLT && currCU.Y().valid()) { xDeriveCUMV(currCU); -#if JVET_Q0806 && K0149_BLOCK_STATISTICS +#if K0149_BLOCK_STATISTICS if(currCU.geoFlag) { storeGeoMergeCtx(m_geoMrgCtx); @@ -241,11 +241,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } } const Slice &slice = *cs.slice; -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#else - bool flag = slice.getPicHeader()->getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#endif if (flag && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (compID != COMPONENT_Y) && (tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr])) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); @@ -291,12 +287,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) { piResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); } -#if !REMOVE_PPS_REXT - if( isChroma(compID) && tu.compAlpha[compID] != 0 ) - { - CrossComponentPrediction::crossComponentPrediction( tu, compID, cs.getResiBuf( tu.Y() ), piResi, piResi, true ); - } -#endif if( !tu.cu->ispMode || !isLuma( compID ) ) { @@ -311,11 +301,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred; #endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#endif { #if REUSE_CU_RESULTS { @@ -332,11 +318,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) #if !KEEP_PRED_AND_RESI_SIGNALS pReco.copyFrom( piPred ); #endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#endif { #if REUSE_CU_RESULTS { @@ -364,11 +346,7 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu) CHECK(tu.cu->ispMode, "adaptive color transform cannot be applied to ISP"); CHECK(pu.intraDir[CHANNEL_TYPE_CHROMA] != DM_CHROMA_IDX, "chroma should use DM mode for adaptive color transform"); -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#else - bool flag = slice.getPicHeader()->getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#endif if (flag && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr])) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); @@ -398,14 +376,6 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu) PelBuf piResi = cs.getResiBuf(area); QpParam cQP(tu, compID); -#if !JVET_Q0820_ACT - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - cQP.Qps[qpIdx] = cQP.Qps[qpIdx] + (compID == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); - cQP.pers[qpIdx] = cQP.Qps[qpIdx] / 6; - cQP.rems[qpIdx] = cQP.Qps[qpIdx] % 6; - } -#endif if (tu.jointCbCr && isChroma(compID)) { @@ -419,14 +389,6 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu) else { QpParam qpCr(tu, COMPONENT_Cr); -#if !JVET_Q0820_ACT - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - qpCr.Qps[qpIdx] = qpCr.Qps[qpIdx] + DELTA_QP_FOR_Co; - qpCr.pers[qpIdx] = qpCr.Qps[qpIdx] / 6; - qpCr.rems[qpIdx] = qpCr.Qps[qpIdx] % 6; - } -#endif m_pcTrQuant->invTransformNxN(tu, COMPONENT_Cr, resiCr, qpCr); } @@ -454,11 +416,7 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu) cs.setDecomp(area); } -#if JVET_Q0820_ACT cs.getResiBuf(tu).colorSpaceConvert(cs.getResiBuf(tu), false, tu.cu->cs->slice->clpRng(COMPONENT_Y)); -#else - cs.getResiBuf(tu).colorSpaceConvert(cs.getResiBuf(tu), false); -#endif for (int i = 0; i < getNumberValidComponents(tu.chromaFormat); i++) { @@ -470,11 +428,7 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu) PelBuf piReco = cs.getRecoBuf(area); PelBuf tmpPred; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#endif { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); tmpPred = m_tmpStorageLCU->getBuf(tmpArea); @@ -484,11 +438,7 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu) piPred.reconstruct(piPred, piResi, tu.cu->cs->slice->clpRng(compID)); piReco.copyFrom(piPred); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#endif { piPred.copyFrom(tmpPred); } @@ -519,7 +469,6 @@ void DecCu::xReconIntraQT( CodingUnit &cu ) } else { -#if JVET_Q0504_PLT_NON444 if( cu.chromaFormat != CHROMA_400 ) { xReconPLT(cu, COMPONENT_Y, 3); @@ -528,9 +477,6 @@ void DecCu::xReconIntraQT( CodingUnit &cu ) { xReconPLT(cu, COMPONENT_Y, 1); } -#else - xReconPLT(cu, COMPONENT_Y, 3); -#endif } return; } @@ -692,44 +638,23 @@ void DecCu::xFillPCMBuffer(CodingUnit &cu) void DecCu::xReconInter(CodingUnit &cu) { -#if !JVET_Q0806 - if( cu.triangle ) - { - const bool splitDir = cu.firstPU->triangleSplitDir; - const uint8_t candIdx0 = cu.firstPU->triangleMergeIdx0; - const uint8_t candIdx1 = cu.firstPU->triangleMergeIdx1; - m_pcInterPred->motionCompensation4Triangle( cu, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); - PU::spanTriangleMotionInfo( *cu.firstPU, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); - } - else -#else if( cu.geoFlag ) { m_pcInterPred->motionCompensationGeo( cu, m_geoMrgCtx ); PU::spanGeoMotionInfo( *cu.firstPU, m_geoMrgCtx, cu.firstPU->geoSplitDir, cu.firstPU->geoMergeIdx0, cu.firstPU->geoMergeIdx1 ); } else -#endif { m_pcIntraPred->geneIntrainterPred(cu); // inter prediction CHECK(CU::isIBC(cu) && cu.firstPU->ciipFlag, "IBC and Ciip cannot be used together"); CHECK(CU::isIBC(cu) && cu.affine, "IBC and Affine cannot be used together"); -#if !JVET_Q0806 - CHECK(CU::isIBC(cu) && cu.triangle, "IBC and triangle cannot be used together"); -#else CHECK(CU::isIBC(cu) && cu.geoFlag, "IBC and geo cannot be used together"); -#endif CHECK(CU::isIBC(cu) && cu.firstPU->mmvdMergeFlag, "IBC and MMVD cannot be used together"); const bool luma = cu.Y().valid(); -#if JVET_Q0438_MONOCHROME_BUGFIXES const bool chroma = isChromaEnabled(cu.chromaFormat) && cu.Cb().valid(); if (luma && (chroma || !isChromaEnabled(cu.chromaFormat))) -#else - const bool chroma = cu.Cb().valid(); - if (luma && chroma) -#endif { m_pcInterPred->motionCompensation(cu); } @@ -746,20 +671,12 @@ void DecCu::xReconInter(CodingUnit &cu) if (cu.firstPU->ciipFlag) { -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { cu.cs->getPredBuf(*cu.firstPU).Y().rspSignal(m_pcReshape->getFwdLUT()); } m_pcIntraPred->geneWeightedPred(COMPONENT_Y, cu.cs->getPredBuf(*cu.firstPU).Y(), *cu.firstPU, m_pcIntraPred->getPredictorPtr2(COMPONENT_Y, 0)); -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(cu.chromaFormat) && cu.chromaSize().width > 2) -#else - if (cu.chromaSize().width > 2) -#endif { m_pcIntraPred->geneWeightedPred(COMPONENT_Cb, cu.cs->getPredBuf(*cu.firstPU).Cb(), *cu.firstPU, m_pcIntraPred->getPredictorPtr2(COMPONENT_Cb, 0)); m_pcIntraPred->geneWeightedPred(COMPONENT_Cr, cu.cs->getPredBuf(*cu.firstPU).Cr(), *cu.firstPU, m_pcIntraPred->getPredictorPtr2(COMPONENT_Cr, 0)); @@ -779,22 +696,14 @@ void DecCu::xReconInter(CodingUnit &cu) { if (cu.colorTransform) { -#if JVET_Q0820_ACT cs.getResiBuf(cu).colorSpaceConvert(cs.getResiBuf(cu), false, cu.cs->slice->clpRng(COMPONENT_Y)); -#else - cs.getResiBuf(cu).colorSpaceConvert(cs.getResiBuf(cu), false); -#endif } #if REUSE_CU_RESULTS const CompArea &area = cu.blocks[COMPONENT_Y]; CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred; #endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { #if REUSE_CU_RESULTS if (cs.pcv->isEncoder) @@ -812,11 +721,7 @@ void DecCu::xReconInter(CodingUnit &cu) cs.getResiBuf( cu ).reconstruct( cs.getPredBuf( cu ), cs.getResiBuf( cu ), cs.slice->clpRngs() ); cs.getRecoBuf( cu ).copyFrom ( cs.getResiBuf( cu ) ); #endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { #if REUSE_CU_RESULTS if (cs.pcv->isEncoder) @@ -829,11 +734,7 @@ void DecCu::xReconInter(CodingUnit &cu) else { cs.getRecoBuf(cu).copyClip(cs.getPredBuf(cu), cs.slice->clpRngs()); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && !cu.firstPU->ciipFlag && !CU::isIBC(cu)) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && !cu.firstPU->ciipFlag && !CU::isIBC(cu)) -#endif { cs.getRecoBuf(cu).get(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT()); } @@ -857,17 +758,6 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) PelBuf resiBuf = cs.getResiBuf(area); QpParam cQP(currTU, compID); -#if !JVET_Q0820_ACT - if (currTU.cu->colorTransform) - { - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - cQP.Qps[qpIdx] = cQP.Qps[qpIdx] + (compID == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); - cQP.pers[qpIdx] = cQP.Qps[qpIdx] / 6; - cQP.rems[qpIdx] = cQP.Qps[qpIdx] % 6; - } - } -#endif if( currTU.jointCbCr && isChroma(compID) ) { @@ -881,17 +771,6 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) else { QpParam qpCr(currTU, COMPONENT_Cr); -#if !JVET_Q0820_ACT - if (currTU.cu->colorTransform) - { - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - qpCr.Qps[qpIdx] = qpCr.Qps[qpIdx] + DELTA_QP_FOR_Co; - qpCr.pers[qpIdx] = qpCr.Qps[qpIdx] / 6; - qpCr.rems[qpIdx] = qpCr.Qps[qpIdx] % 6; - } - } -#endif m_pcTrQuant->invTransformNxN( currTU, COMPONENT_Cr, resiCr, qpCr ); } m_pcTrQuant->invTransformICT( currTU, resiBuf, resiCr ); @@ -909,22 +788,11 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) //===== reconstruction ===== const Slice &slice = *cs.slice; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && isChroma(compID) && (TU::getCbf(currTU, compID) || currTU.jointCbCr) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && currTU.blocks[compID].width * currTU.blocks[compID].height > 4) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && isChroma(compID) && (TU::getCbf(currTU, compID) || currTU.jointCbCr) - && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && currTU.blocks[compID].width * currTU.blocks[compID].height > 4) -#endif { resiBuf.scaleSignal(currTU.getChromaAdj(), 0, currTU.cu->cs->slice->clpRng(compID)); } -#if !REMOVE_PPS_REXT - if( isChroma( compID ) && currTU.compAlpha[compID] != 0 ) - { - CrossComponentPrediction::crossComponentPrediction( currTU, compID, cs.getResiBuf( currTU.Y() ), resiBuf, resiBuf, true ); - } -#endif } void DecCu::xDecodeInterTexture(CodingUnit &cu) @@ -944,11 +812,7 @@ void DecCu::xDecodeInterTexture(CodingUnit &cu) { CodingStructure &cs = *cu.cs; const Slice &slice = *cs.slice; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (compID == COMPONENT_Y) && (currTU.cbf[COMPONENT_Cb] || currTU.cbf[COMPONENT_Cr])) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (compID == COMPONENT_Y) && (currTU.cbf[COMPONENT_Cb] || currTU.cbf[COMPONENT_Cr])) -#endif { const CompArea &areaY = currTU.blocks[COMPONENT_Y]; int adj = m_pcReshape->calculateChromaAdjVpduNei(currTU, areaY); @@ -996,19 +860,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) else { { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - PU::getTriangleMergeCandidates( pu, m_triangleMrgCtx ); - } - else -#else if( pu.cu->geoFlag ) { PU::getGeoMergeCandidates( pu, m_geoMrgCtx ); } else -#endif { if( pu.cu->affine ) { @@ -1123,11 +979,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) { mvd.changeIbcPrecAmvr2Internal(pu.cu->imv); } -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pu.cs->sps->getMaxNumIBCMergeCand() == 1) -#else - if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 ) -#endif { CHECK( pu.mvpIdx[REF_PIC_LIST_0], "mvpIdx for IBC mode should be 0" ); } @@ -1156,15 +1008,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) PU::spanMotionInfo( pu, mrgCtx ); } } -#if !JVET_Q0806 - if( !cu.triangle ) - { - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } - } -#else if( !cu.geoFlag ) { if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) @@ -1172,7 +1015,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) printf( "DECODER: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); } } -#endif if (CU::isIBC(cu)) { const int cuPelX = pu.Y().x; diff --git a/source/Lib/DecoderLib/DecCu.h b/source/Lib/DecoderLib/DecCu.h index c6932f3e91866433cec7aacf29e3530e6b0c01ed..8789afadb46e306d9c6cadc7108d2fd949a7d613 100644 --- a/source/Lib/DecoderLib/DecCu.h +++ b/source/Lib/DecoderLib/DecCu.h @@ -98,11 +98,7 @@ private: MotionInfo m_SubPuMiBuf[(MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1)]; -#if !JVET_Q0806 - MergeCtx m_triangleMrgCtx; -#else MergeCtx m_geoMrgCtx; -#endif }; //! \} diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 86545c8e90f24ea9bf985d5201533a6eed0484c1..c50fbedd251f57ea3313f9232ac350a81e0e26e4 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -44,9 +44,7 @@ #include "CommonLib/UnitTools.h" #include <fstream> -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES #include <set> -#endif #include <stdio.h> #include <fcntl.h> #include "AnnexBread.h" @@ -65,11 +63,7 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri PicList* pcListPic = NULL; static bool bFirstCall = true; /* TODO: MT */ -#if JVET_P0125_EOS_LAYER_SPECIFIC static bool loopFiltered[MAX_VPS_LAYERS] = { false }; /* TODO: MT */ -#else - static bool loopFiltered = false; /* TODO: MT */ -#endif static int iPOCLastDisplay = -MAX_INT; /* TODO: MT */ static std::ifstream* bitstreamFile = nullptr; /* TODO: MT */ @@ -137,11 +131,7 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri read( nalu ); int iSkipFrame = 0; -#if JVET_P0288_PIC_OUTPUT bNewPicture = pcDecLib->decode(nalu, iSkipFrame, iPOCLastDisplay, 0); -#else - bNewPicture = pcDecLib->decode(nalu, iSkipFrame, iPOCLastDisplay); -#endif if( bNewPicture ) { bitstreamFile->clear(); @@ -154,17 +144,9 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri } } -#if JVET_P0125_EOS_LAYER_SPECIFIC if ((bNewPicture || !*bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && !pcDecLib->getFirstSliceInSequence(nalu.m_nuhLayerId)) -#else - if( ( bNewPicture || !*bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && !pcDecLib->getFirstSliceInSequence() ) -#endif { -#if JVET_P0125_EOS_LAYER_SPECIFIC if (!loopFiltered[nalu.m_nuhLayerId] || *bitstreamFile) -#else - if( !loopFiltered || *bitstreamFile ) -#endif { pcDecLib->finishPictureLight( poc, pcListPic ); @@ -242,12 +224,10 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri pcEncPic->slices[i]->setTileGroupAlfEnabledFlag(COMPONENT_Y, pic->slices[i]->getTileGroupAlfEnabledFlag(COMPONENT_Y)); pcEncPic->slices[i]->setTileGroupAlfEnabledFlag(COMPONENT_Cb, pic->slices[i]->getTileGroupAlfEnabledFlag(COMPONENT_Cb)); pcEncPic->slices[i]->setTileGroupAlfEnabledFlag(COMPONENT_Cr, pic->slices[i]->getTileGroupAlfEnabledFlag(COMPONENT_Cr)); -#if JVET_Q0795_CCALF pcEncPic->slices[i]->setTileGroupCcAlfCbApsId(pic->slices[i]->getTileGroupCcAlfCbApsId()); pcEncPic->slices[i]->setTileGroupCcAlfCbEnabledFlag(pic->slices[i]->getTileGroupCcAlfCbEnabledFlag()); pcEncPic->slices[i]->setTileGroupCcAlfCrApsId(pic->slices[i]->getTileGroupCcAlfCrApsId()); pcEncPic->slices[i]->setTileGroupCcAlfCrEnabledFlag(pic->slices[i]->getTileGroupCcAlfCrEnabledFlag()); -#endif } } @@ -288,7 +268,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 ) @@ -296,7 +275,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()) { @@ -359,26 +337,14 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri } -#if JVET_P0125_EOS_LAYER_SPECIFIC loopFiltered[nalu.m_nuhLayerId] = (nalu.m_nalUnitType == NAL_UNIT_EOS); -#else - loopFiltered = ( nalu.m_nalUnitType == NAL_UNIT_EOS ); -#endif if( nalu.m_nalUnitType == NAL_UNIT_EOS ) { -#if JVET_P0125_EOS_LAYER_SPECIFIC pcDecLib->setFirstSliceInSequence(true, nalu.m_nuhLayerId); -#else - pcDecLib->setFirstSliceInSequence( true ); -#endif } } -#if JVET_P0125_EOS_LAYER_SPECIFIC else if ((bNewPicture || !*bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && pcDecLib->getFirstSliceInSequence(nalu.m_nuhLayerId)) -#else - else if( ( bNewPicture || !*bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && pcDecLib->getFirstSliceInSequence() ) -#endif { pcDecLib->setFirstSliceInPicture( true ); } @@ -396,14 +362,10 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri pcDecLib = nullptr; } bFirstCall = true; -#if JVET_P0125_EOS_LAYER_SPECIFIC for (int i = 0; i < MAX_VPS_LAYERS; i++) { loopFiltered[i] = false; } -#else - loopFiltered = false; -#endif iPOCLastDisplay = -MAX_INT; if( bytestream ) @@ -431,10 +393,8 @@ DecLib::DecLib() , m_isFirstGeneralHrd(true) , m_prevGeneralHrdParams() , m_associatedIRAPType(NAL_UNIT_INVALID) -#if JVET_P0978_RPL_RESTRICTIONS , m_associatedIRAPDecodingOrderNumber(0) , m_decodingOrderCounter(0) -#endif , m_pocCRA(0) , m_pocRandomAccess(MAX_INT) , m_lastRasPoc(MAX_INT) @@ -461,21 +421,13 @@ DecLib::DecLib() , m_prevPOC(MAX_INT) , m_prevTid0POC(0) , m_bFirstSliceInPicture(true) -#if JVET_P0125_EOS_LAYER_SPECIFIC , m_firstSliceInSequence{ true } -#else - , m_bFirstSliceInSequence(true) -#endif , m_firstSliceInBitstream(true) , m_prevSliceSkipped(false) , m_skippedPOC(0) , m_lastPOCNoOutputPriorPics(-1) , m_isNoOutputPriorPics(false) -#if SPS_ID_CHECK , m_lastNoOutputBeforeRecoveryFlag( false ) -#else - , m_lastNoIncorrectPicOutputFlag(false) -#endif , m_sliceLmcsApsId(-1) , m_pDecodedSEIOutputStream(NULL) , m_decodedPictureHashSEIEnabled(false) @@ -485,17 +437,9 @@ DecLib::DecLib() , m_debugPOC( -1 ) , m_debugCTU( -1 ) , m_vps( nullptr ) -#if !JVET_Q0346_SCALING_LIST_USED_IN_SH - , m_scalingListUpdateFlag(true) - , m_PreScalingListAPSId(-1) -#endif -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS , m_maxDecSubPicIdx(0) , m_maxDecSliceAddrInSubPic(-1) -#endif -#if JVET_Q0117_PARAMETER_SETS_CLEANUP , m_dci(NULL) -#endif { #if ENABLE_SIMD_OPT_BUFFER g_pelBufOP.initPelBufOpsX86(); @@ -523,13 +467,11 @@ void DecLib::destroy() delete m_apcSlicePilot; m_apcSlicePilot = NULL; -#if JVET_Q0117_PARAMETER_SETS_CLEANUP if( m_dci ) { delete m_dci; m_dci = NULL; } -#endif m_cSliceDecoder.destroy(); } @@ -576,11 +518,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(); @@ -681,16 +619,13 @@ void DecLib::executeLoopFilters() if( cs.sps->getALFEnabledFlag() ) { -#if JVET_Q0795_CCALF m_cALF.getCcAlfFilterParam() = cs.slice->m_ccAlfFilterParam; -#endif // ALF decodes the differentially coded coefficients and stores them in the parameters structure. // Code could be restructured to do directly after parsing. So far we just pass a fresh non-const // copy in case the APS gets used more than once. m_cALF.ALFProcess(cs); } -#if JVET_O1143_SUBPIC_BOUNDARY for (int i = 0; i < cs.pps->getNumSubPics() && m_targetSubPicIdx; i++) { // keep target subpic samples untouched, for other subpics mask their output sample value to 0 @@ -714,7 +649,6 @@ void DecLib::executeLoopFilters() } } } -#endif m_pcPic->cs->slice->stopProcessingTimer(); } @@ -821,10 +755,8 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) poc = pcSlice->getPOC(); rpcListPic = &m_cListPic; m_bFirstSliceInPicture = true; // TODO: immer true? hier ist irgendwas faul -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS m_maxDecSubPicIdx = 0; m_maxDecSliceAddrInSubPic = -1; -#endif m_pcPic->destroyTempBuffers(); m_pcPic->cs->destroyCoeffs(); @@ -938,7 +870,6 @@ void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, c } } -#if JVET_P0125_ASPECT_TID_LAYER_ID_NUH void DecLib::checkTidLayerIdInAccessUnit() { int firstPicTid = m_accessUnitPicInfo.begin()->m_temporalId; @@ -979,8 +910,6 @@ void DecLib::checkTidLayerIdInAccessUnit() CHECK(!isFdNaluLayerIdSameAsVclNaluLayerId, "The nuh_layer_id of a filler data NAL unit shall be equal to the nuh_layer_id of associated VCL NAL unit"); } -#endif -#if JVET_P0125_SEI_CONSTRAINTS void DecLib::checkSEIInAccessUnit() { for (auto &sei : m_accessUnitSeiPayLoadTypes) @@ -1007,7 +936,6 @@ void DecLib::checkSEIInAccessUnit() } } } -#endif /** - Determine if the first VCL NAL unit of a picture is also the first VCL NAL of an Access Unit @@ -1033,13 +961,6 @@ bool DecLib::isSliceNaluFirstInAU( bool newPicture, InputNALUnit &nalu ) return false; } -#if !JVET_Q0819_PH_CHANGES - // check for valid picture header - if(m_picHeader.isValid() == false) - { - return false; - } -#endif // check for layer ID less than or equal to previous picture's layer ID if( nalu.m_nuhLayerId <= m_prevLayerID ) @@ -1051,11 +972,7 @@ bool DecLib::isSliceNaluFirstInAU( bool newPicture, InputNALUnit &nalu ) m_apcSlicePilot->setPicHeader( &m_picHeader ); m_apcSlicePilot->initSlice(); m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_Q0819_PH_CHANGES m_HLSReader.getSlicePoc( m_apcSlicePilot, &m_picHeader, &m_parameterSetManager, m_prevTid0POC ); -#else - m_HLSReader.parseSliceHeaderToPoc( m_apcSlicePilot, &m_picHeader, &m_parameterSetManager, m_prevTid0POC ); -#endif // check for different POC return (m_apcSlicePilot->getPOC() != m_prevPOC); @@ -1102,7 +1019,6 @@ void activateAPS(PicHeader* picHeader, Slice* pSlice, ParameterSetManager& param } } -#if JVET_Q0795_CCALF CcAlfFilterParam &filterParam = pSlice->m_ccAlfFilterParam; // cleanup before copying for ( int filterIdx = 0; filterIdx < MAX_NUM_CC_ALF_FILTERS; filterIdx++ ) @@ -1160,7 +1076,6 @@ void activateAPS(PicHeader* picHeader, Slice* pSlice, ParameterSetManager& param } } } -#endif if (picHeader->getLmcsEnabledFlag() && lmcsAPS == nullptr) { @@ -1180,11 +1095,7 @@ void activateAPS(PicHeader* picHeader, Slice* pSlice, ParameterSetManager& param } picHeader->setLmcsAPS(lmcsAPS); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH if( picHeader->getExplicitScalingListEnabledFlag() && scalingListAPS == nullptr) -#else - if( picHeader->getScalingListPresentFlag() && scalingListAPS == nullptr) -#endif { scalingListAPS = parameterSetManager.getAPS( picHeader->getScalingListAPSId(), SCALING_LIST_APS ); CHECK( scalingListAPS == nullptr, "No SCALING LIST APS present" ); @@ -1230,10 +1141,6 @@ void DecLib::xActivateParameterSets( const int layerId ) THROW("Parameter set activation failed!"); } -#if JVET_O1143_SUBPIC_BOUNDARY && !JVET_Q0044_SLICE_IDX_WITH_SUBPICS - PPS* nonconstPPS = m_parameterSetManager.getPPS(m_picHeader.getPPSId()); - nonconstPPS->initSubPic(*sps); -#endif m_parameterSetManager.getApsMap()->clear(); for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) @@ -1260,11 +1167,7 @@ void DecLib::xActivateParameterSets( const int layerId ) // Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use. m_pcPic = xGetNewPicBuffer( *sps, *pps, m_apcSlicePilot->getTLayer(), layerId ); -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId, *pps); -#else - m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId ); -#endif m_pcPic->finalInit( vps, *sps, *pps, &m_picHeader, apss, lmcsAPS, scalinglistAPS ); m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth ); m_pcPic->cs->createCoeffs((bool)m_pcPic->cs->sps->getPLTMode()); @@ -1294,9 +1197,7 @@ void DecLib::xActivateParameterSets( const int layerId ) m_pcPic->cs->pcv = pps->pcv; // Initialise the various objects for the new set of settings -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int maxDepth = floorLog2(sps->getMaxCUWidth()) - pps->pcv->minCUWidthLog2; -#if JVET_Q0441_SAO_MOD_12_BIT const uint32_t log2SaoOffsetScaleLuma = (uint32_t) std::max(0, sps->getBitDepth(CHANNEL_TYPE_LUMA ) - MAX_SAO_TRUNCATED_BITDEPTH); const uint32_t log2SaoOffsetScaleChroma = (uint32_t) std::max(0, sps->getBitDepth(CHANNEL_TYPE_CHROMA) - MAX_SAO_TRUNCATED_BITDEPTH); m_cSAO.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), @@ -1304,24 +1205,7 @@ void DecLib::xActivateParameterSets( const int layerId ) sps->getMaxCUWidth(), sps->getMaxCUHeight(), maxDepth, log2SaoOffsetScaleLuma, log2SaoOffsetScaleChroma ); -#else - m_cSAO.create(pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), maxDepth, pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA)); -#endif m_cLoopFilter.create(maxDepth); -#else -#if JVET_Q0441_SAO_MOD_12_BIT - const uint32_t log2SaoOffsetScaleLuma = (uint32_t) std::max(0, sps->getBitDepth(CHANNEL_TYPE_LUMA ) - MAX_SAO_TRUNCATED_BITDEPTH); - const uint32_t log2SaoOffsetScaleChroma = (uint32_t) std::max(0, sps->getBitDepth(CHANNEL_TYPE_CHROMA) - MAX_SAO_TRUNCATED_BITDEPTH); - m_cSAO.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), - sps->getChromaFormatIdc(), - sps->getMaxCUWidth(), sps->getMaxCUHeight(), - sps->getMaxCodingDepth(), - log2SaoOffsetScaleLuma, log2SaoOffsetScaleChroma ); -#else - m_cSAO.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale( CHANNEL_TYPE_LUMA ), pps->getPpsRangeExtension().getLog2SaoOffsetScale( CHANNEL_TYPE_CHROMA ) ); -#endif - m_cLoopFilter.create( sps->getMaxCodingDepth() ); -#endif m_cIntraPred.init( sps->getChromaFormatIdc(), sps->getBitDepth( CHANNEL_TYPE_LUMA ) ); m_cInterPred.init( &m_cRdCost, sps->getChromaFormatIdc(), sps->getMaxCUHeight() ); if (sps->getUseLmcs()) @@ -1367,17 +1251,11 @@ void DecLib::xActivateParameterSets( const int layerId ) if( sps->getALFEnabledFlag() ) { -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int maxDepth = floorLog2(sps->getMaxCUWidth()) - sps->getLog2MinCodingBlockSize(); m_cALF.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), maxDepth, sps->getBitDepths().recon); -#else - m_cALF.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), sps->getBitDepths().recon ); -#endif } -#if JVET_Q0795_CCALF pSlice->m_ccAlfFilterControl[0] = m_cALF.getCcAlfControlIdc(COMPONENT_Cb); pSlice->m_ccAlfFilterControl[1] = m_cALF.getCcAlfControlIdc(COMPONENT_Cr); -#endif } else { @@ -1456,10 +1334,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 JVET_P0118_HRD_ASPECTS if (((vps!=nullptr)&&(vps->getVPSGeneralHrdParamsPresentFlag()))||(sps->getGeneralHrdParametersPresentFlag())) { if (((vps != nullptr) && (vps->getVPSGeneralHrdParamsPresentFlag())) && (sps->getGeneralHrdParametersPresentFlag())) @@ -1473,8 +1348,6 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) m_prevGeneralHrdParams = (sps->getGeneralHrdParametersPresentFlag() ? *sps->getGeneralHrdParameters() : *vps->getGeneralHrdParameters()); } m_isFirstGeneralHrd = false; -#endif -#if SPS_ID_CHECK static std::unordered_map<int, int> m_clvssSPSid; if( slice->isClvssPu() && m_bFirstSliceInPicture ) @@ -1483,11 +1356,8 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) } CHECK( m_clvssSPSid[layerId] != pps->getSPSId(), "The value of pps_seq_parameter_set_id shall be the same in all PPSs that are referred to by coded pictures in a CLVS" ); -#endif -#if JVET_Q414_CONSTRAINT_ON_GDR_PIC_FLAG CHECK(sps->getGDREnabledFlag() == false && m_picHeader.getGdrPicFlag(), "When gdr_enabled_flag is equal to 0, the value of gdr_pic_flag shall be equal to 0 "); -#endif if( !sps->getUseWP() ) { CHECK( pps->getUseWP(), "When sps_weighted_pred_flag is equal to 0, the value of pps_weighted_pred_flag shall be equal to 0." ); @@ -1498,15 +1368,9 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) CHECK( pps->getWPBiPred(), "When sps_weighted_bipred_flag is equal to 0, the value of pps_weighted_bipred_flag shall be equal to 0." ); } -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int minCuSize = 1 << sps->getLog2MinCodingBlockSize(); CHECK( ( pps->getPicWidthInLumaSamples() % ( std::max( 8, minCuSize) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); CHECK( ( pps->getPicHeightInLumaSamples() % ( std::max( 8, minCuSize) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#else - CHECK( ( pps->getPicWidthInLumaSamples() % ( std::max( 8, int( sps->getMaxCUWidth() >> ( sps->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); - CHECK( ( pps->getPicHeightInLumaSamples() % ( std::max( 8, int( sps->getMaxCUHeight() >> ( sps->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#endif -#if JVET_Q0043_RPR_and_Subpics if( !sps->getRprEnabledFlag() ) { CHECK( pps->getPicWidthInLumaSamples() != sps->getMaxPicWidthInLumaSamples(), "When res_change_in_clvs_allowed_flag equal to 0, the value of pic_width_in_luma_samples shall be equal to pic_width_max_in_luma_samples." ); @@ -1514,48 +1378,22 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) } if( sps->getRprEnabledFlag() ) { -#if JVET_Q0119_CLEANUPS CHECK( sps->getSubPicInfoPresentFlag() != 0, "When res_change_in_clvs_allowed_flag is equal to 1, the value of subpic_info_present_flag shall be equal to 0." ); -#else - CHECK( sps->getSubPicPresentFlag() != 0, "When res_change_in_clvs_allowed_flag is equal to 1, the value of subpic_info_present_flag shall be equal to 0." ); -#endif } -#if !JVET_Q0399_SCALING_INFERENCE - CHECK( !sps->getRprEnabledFlag() && pps->getScalingWindow().getWindowEnabledFlag(), "When res_change_in_clvs_allowed_flag is equal to 0, the value of scaling_window_flag shall be equal to 0." ); -#endif -#else - if( !sps->getRprEnabledFlag() && sps->getSubPicPresentFlag() ) - { - CHECK( pps->getPicWidthInLumaSamples() != sps->getMaxPicWidthInLumaSamples(), "When subpics_present_flag is equal to 1 or ref_pic_resampling_enabled_flag equal to 0, the value of pic_width_in_luma_samples shall be equal to pic_width_max_in_luma_samples." ); - CHECK( pps->getPicHeightInLumaSamples() != sps->getMaxPicHeightInLumaSamples(), "When subpics_present_flag is equal to 1 or ref_pic_resampling_enabled_flag equal to 0, the value of pic_height_in_luma_samples shall be equal to pic_height_max_in_luma_samples." ); - } -#if !JVET_Q0399_SCALING_INFERENCE - CHECK( !sps->getRprEnabledFlag() && pps->getScalingWindow().getWindowEnabledFlag(), "When ref_pic_resampling_enabled_flag is equal to 0, the value of scaling_window_flag shall be equal to 0." ); -#endif -#endif -#if JVET_Q0417_CONSTRAINT_SPS_VB_PRESENT_FLAG -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG CHECK( sps->getRprEnabledFlag() && sps->getVirtualBoundariesEnabledFlag(), "when the value of res_change_in_clvs_allowed_flag is equal to 1, the value of sps_virtual_boundaries_present_flag shall be equal to 0" ); -#else - CHECK(sps->getRprEnabledFlag() && sps->getLoopFilterAcrossVirtualBoundariesDisabledFlag(), "when the value of res_change_in_clvs_allowed_flag is equal to 1, the value of sps_virtual_boundaries_present_flag shall be equal to 0"); -#endif -#endif if( sps->getCTUSize() + 2 * ( 1 << sps->getLog2MinCodingBlockSize() ) > pps->getPicWidthInLumaSamples() ) { 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 -#if JVET_Q0172_CHROMA_FORMAT_BITDEPTH_CONSTRAINT static std::unordered_map<int, int> m_layerChromaFormat; static std::unordered_map<int, int> m_layerBitDepth; @@ -1565,11 +1403,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) int curLayerChromaFormat = sps->getChromaFormatIdc(); int curLayerBitDepth = sps->getBitDepth(CHANNEL_TYPE_LUMA); -#if SPS_ID_CHECK if( slice->isClvssPu() && m_bFirstSliceInPicture ) -#else - if (m_layerBitDepth[curLayerIdx] == 0) -#endif { m_layerChromaFormat[curLayerIdx] = curLayerChromaFormat; m_layerBitDepth[curLayerIdx] = curLayerBitDepth; @@ -1591,9 +1425,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) } } } -#endif -#if JVET_Q0114_CONSTRAINT_FLAGS if (sps->getProfileTierLevel()->getConstraintInfo()->getOneTilePerPicConstraintFlag()) { CHECK(pps->getNumTiles() != 1, "When one_tile_per_pic_constraint_flag is equal to 1, each picture shall contain only one tile"); @@ -1602,9 +1434,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) { CHECK( pps->getNumSlicesInPic() != 1, "When one_slice_per_pic_constraint_flag is equal to 1, each picture shall contain only one slice"); } -#endif -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS if (sps->getMaxPicWidthInLumaSamples() == pps->getPicWidthInLumaSamples() && sps->getMaxPicHeightInLumaSamples() == pps->getPicHeightInLumaSamples()) { @@ -1615,8 +1445,6 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) CHECK(spsConfWin.getWindowTopOffset() != ppsConfWin.getWindowTopOffset(), "When picture size is equal to maximum picutre size, conformance window top offset in SPS and PPS shall be equal"); CHECK(spsConfWin.getWindowBottomOffset() != ppsConfWin.getWindowBottomOffset(), "When picture size is equal to maximum picutre size, conformance window bottom offset in SPS and PPS shall be equal"); } -#endif -#if JVET_Q0355_DCI_LEVEL_IDC_CONSTRAINT int levelIdcSps = int(sps->getProfileTierLevel()->getLevelIdc()); int maxLevelIdxDci = 0; if (m_dci) @@ -1630,9 +1458,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) } CHECK(levelIdcSps > maxLevelIdxDci, "max level signaled in the DCI shall not be less than the level signaled in the SPS"); } -#endif -#if JVET_Q0157_SUBPICTURE_REORDERING_CONSTRAINT // When the current picture is not the first picture of the CLVS, if the value of SubpicId[ i ] is not equal to the value of SubpicId[ i ] of previous picture in decoding order in the same layer, // the nal_unit_type for all coded slice NAL units of the the subpicture with subpicture index i shall be in the range of IDR_W_RADL to CRA_NUT, inclusive. if( sps->getSubPicInfoPresentFlag() ) @@ -1677,7 +1503,6 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) } } } -#endif } @@ -1698,17 +1523,11 @@ void DecLib::xParsePrefixSEImessages() while (!m_prefixSEINALUs.empty()) { InputNALUnit &nalu=*m_prefixSEINALUs.front(); -#if JVET_P0125_ASPECT_TID_LAYER_ID_NUH m_accessUnitSeiTids.push_back(nalu.m_temporalId); -#endif -#if JVET_P0125_SEI_CONSTRAINTS const SPS *sps = m_parameterSetManager.getActiveSPS(); const VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId()); m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, sps, m_HRD, m_pDecodedSEIOutputStream ); m_accessUnitSeiPayLoadTypes.push_back(std::tuple<NalUnitType, int, SEI::PayloadType>(nalu.m_nalUnitType, nalu.m_nuhLayerId, m_SEIs.back()->payloadType())); -#else - m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, nalu.m_temporalId, m_parameterSetManager.getActiveSPS(), m_HRD, m_pDecodedSEIOutputStream ); -#endif delete m_prefixSEINALUs.front(); m_prefixSEINALUs.pop_front(); } @@ -1717,22 +1536,12 @@ void DecLib::xParsePrefixSEImessages() void DecLib::xDecodePicHeader( InputNALUnit& nalu ) { m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_Q0775_PH_IN_SH m_HLSReader.parsePictureHeader( &m_picHeader, &m_parameterSetManager, true ); -#else - m_HLSReader.parsePictureHeader( &m_picHeader, &m_parameterSetManager); -#endif m_picHeader.setValid(); } bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDisplay ) { -#if !JVET_Q0775_PH_IN_SH - if(m_picHeader.isValid() == false) - { - return false; - } -#endif m_apcSlicePilot->setPicHeader( &m_picHeader ); m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice // it is not associated with picture, sps or pps structures. @@ -1750,28 +1559,17 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); -#if JVET_Q0118_CLEANUPS m_apcSlicePilot->setNalUnitLayerId(nalu.m_nuhLayerId); -#endif m_apcSlicePilot->setTLayer(nalu.m_temporalId); for( auto& naluTemporalId : m_accessUnitNals ) { -#if JVET_Q0117_PARAMETER_SETS_CLEANUP if ( naluTemporalId.first != NAL_UNIT_DCI && naluTemporalId.first != NAL_UNIT_VPS && naluTemporalId.first != NAL_UNIT_SPS && naluTemporalId.first != NAL_UNIT_EOS && naluTemporalId.first != NAL_UNIT_EOB) -#else - if ( - naluTemporalId.first != NAL_UNIT_DPS - && naluTemporalId.first != NAL_UNIT_VPS - && naluTemporalId.first != NAL_UNIT_SPS - && naluTemporalId.first != NAL_UNIT_EOS - && naluTemporalId.first != NAL_UNIT_EOB ) -#endif { CHECK( naluTemporalId.second < nalu.m_temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); @@ -1784,29 +1582,22 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_Q0795_CCALF m_apcSlicePilot->m_ccAlfFilterParam = m_cALF.getCcAlfFilterParam(); -#endif m_HLSReader.parseSliceHeader( m_apcSlicePilot, &m_picHeader, &m_parameterSetManager, m_prevTid0POC ); -#if JVET_P0101_POC_MULTILAYER || JVET_P0097_REMOVE_VPS_DEP_NONSCALABLE_LAYER PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId()); CHECK(pps == 0, "No PPS present"); SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); CHECK(sps == 0, "No SPS present"); VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId()); -#endif -#if JVET_Q0237_STSA_TID_ZERO_DEPLAYER if (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA && vps != nullptr && (vps->getIndependentLayerFlag(nalu.m_nuhLayerId) == 1)) { CHECK(nalu.m_temporalId == 0, "TemporalID of STSA picture shall not be zero in independent layers"); } -#endif -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS int currSubPicIdx = pps->getSubPicIdxFromSubPicId( m_apcSlicePilot->getSliceSubPicId() ); int currSliceAddr = m_apcSlicePilot->getSliceID(); for(int sp = 0; sp < currSubPicIdx; sp++) @@ -1824,15 +1615,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_maxDecSubPicIdx = currSubPicIdx; m_maxDecSliceAddrInSubPic = currSliceAddr; } -#endif -#if JVET_P0097_REMOVE_VPS_DEP_NONSCALABLE_LAYER if ((sps->getVPSId() == 0) && (m_prevLayerID != MAX_INT)) { CHECK(m_prevLayerID != nalu.m_nuhLayerId, "All VCL NAL unit in the CVS shall have the same value of nuh_layer_id " "when sps_video_parameter_set_id is equal to 0"); } -#endif -#if JVET_P0101_POC_MULTILAYER CHECK((sps->getVPSId() > 0) && (vps == 0), "Invalid VPS"); if (vps != nullptr && (vps->getIndependentLayerFlag(nalu.m_nuhLayerId) == 0)) { @@ -1841,11 +1628,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { for (int iRefIdx = 0; iRefIdx < m_apcSlicePilot->getNumRefIdx(REF_PIC_LIST_0) && !pocIsSet; iRefIdx++) { -#if JVET_Q0819_PH_CHANGES if (m_apcSlicePilot->getRefPic(REF_PIC_LIST_0, iRefIdx) && m_apcSlicePilot->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() == (*auNALit).m_POC) -#else - if (m_apcSlicePilot->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() == (*auNALit).m_POC) -#endif { m_apcSlicePilot->setPOC(m_apcSlicePilot->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC()); pocIsSet = true; @@ -1853,11 +1636,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } for (int iRefIdx = 0; iRefIdx < m_apcSlicePilot->getNumRefIdx(REF_PIC_LIST_1) && !pocIsSet; iRefIdx++) { -#if JVET_Q0819_PH_CHANGES if (m_apcSlicePilot->getRefPic(REF_PIC_LIST_1, iRefIdx) && m_apcSlicePilot->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() == (*auNALit).m_POC) -#else - if (m_apcSlicePilot->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() == (*auNALit).m_POC) -#endif { m_apcSlicePilot->setPOC(m_apcSlicePilot->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC()); pocIsSet = true; @@ -1865,7 +1644,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } } } -#endif // update independent slice index uint32_t uiIndependentSliceIdx = 0; @@ -1877,12 +1655,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_apcSlicePilot->setIndependentSliceIdx(uiIndependentSliceIdx); #if K0149_BLOCK_STATISTICS -#if !JVET_P0101_POC_MULTILAYER - PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId()); - CHECK(pps == 0, "No PPS present"); - SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); - CHECK(sps == 0, "No SPS present"); -#endif writeBlockStatisticsHeader(sps); #endif @@ -1902,7 +1674,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); -#if SPS_ID_CHECK if( m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR ) { // Derive NoOutputBeforeRecoveryFlag @@ -1925,41 +1696,12 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_picHeader.setNoOutputBeforeRecoveryFlag( m_picHeader.getHandleGdrAsCvsStartFlag() ); } } -#else - //For inference of NoOutputOfPriorPicsFlag - if (m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) - { -#if JVET_P0125_EOS_LAYER_SPECIFIC - if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence[nalu.m_nuhLayerId]) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsCvsStartFlag()) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR && m_bFirstSliceInSequence[nalu.m_nuhLayerId])) -#else - if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsCvsStartFlag()) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR && m_bFirstSliceInSequence)) -#endif - { - m_apcSlicePilot->setNoIncorrectPicOutputFlag(true); - } -#endif //the inference for NoOutputOfPriorPicsFlag -#if SPS_ID_CHECK if( !m_firstSliceInBitstream && m_picHeader.getNoOutputBeforeRecoveryFlag() ) { m_picHeader.setNoOutputOfPriorPicsFlag( true ); } -#else - if( !m_firstSliceInBitstream && - ( m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR ) && - m_apcSlicePilot->getNoIncorrectPicOutputFlag()) - { - if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) - { - m_picHeader.setNoOutputOfPriorPicsFlag(true); - } - } -#endif else { m_picHeader.setNoOutputOfPriorPicsFlag(false); @@ -1967,13 +1709,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) { -#if SPS_ID_CHECK m_lastNoOutputBeforeRecoveryFlag = m_picHeader.getNoOutputBeforeRecoveryFlag(); -#else - m_lastNoIncorrectPicOutputFlag = m_apcSlicePilot->getNoIncorrectPicOutputFlag(); -#endif } -#if SPS_ID_CHECK if( m_picHeader.getNoOutputOfPriorPicsFlag() ) { @@ -1985,37 +1722,16 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_isNoOutputPriorPics = false; } } -#else - } - if ((m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && m_picHeader.getNoOutputOfPriorPicsFlag()) - { - m_lastPOCNoOutputPriorPics = m_apcSlicePilot->getPOC(); - m_isNoOutputPriorPics = true; - } - else - { - m_isNoOutputPriorPics = false; - } -#endif //For inference of PicOutputFlag -#if SPS_ID_CHECK if( !pps->getMixedNaluTypesInPicFlag() && ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL ) ) -#else - if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL) -#endif { -#if SPS_ID_CHECK if( m_lastNoOutputBeforeRecoveryFlag ) -#else - if (m_lastNoIncorrectPicOutputFlag) -#endif { m_picHeader.setPicOutputFlag(false); } } -#if JVET_P0288_PIC_OUTPUT { PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId()); CHECK(pps == 0, "No PPS present"); @@ -2031,35 +1747,21 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } } } -#endif -#if SPS_ID_CHECK //Reset POC MSB when CRA or GDR has NoOutputBeforeRecoveryFlag equal to 1 if( !pps->getMixedNaluTypesInPicFlag() && ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR ) && m_lastNoOutputBeforeRecoveryFlag ) -#else - if( ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR ) && - m_lastNoIncorrectPicOutputFlag) //Reset POC MSB when CRA or GDR has NoIncorrectPicOutputFlag equal to 1 -#endif { -#if !JVET_P0101_POC_MULTILAYER - PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId()); - CHECK(pps == 0, "No PPS present"); - SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); - CHECK(sps == 0, "No SPS present"); -#endif int iMaxPOClsb = 1 << sps->getBitsForPOC(); m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) ); xUpdatePreviousTid0POC(m_apcSlicePilot); } -#if JVET_P0101_POC_MULTILAYER AccessUnitPicInfo picInfo; picInfo.m_nalUnitType = nalu.m_nalUnitType; picInfo.m_nuhLayerId = nalu.m_nuhLayerId; picInfo.m_temporalId = nalu.m_temporalId; picInfo.m_POC = m_apcSlicePilot->getPOC(); m_accessUnitPicInfo.push_back(picInfo); -#endif // Skip pictures due to random access @@ -2075,11 +1777,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_prevSliceSkipped = false; //we should only get a different poc for a new picture (with CTU address==0) -#if JVET_P0125_EOS_LAYER_SPECIFIC if (m_apcSlicePilot->getPOC() != m_prevPOC && !m_firstSliceInSequence[nalu.m_nuhLayerId] && (m_apcSlicePilot->getFirstCtuRsAddrInSlice() != 0)) -#else - if(m_apcSlicePilot->getPOC() != m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getFirstCtuRsAddrInSlice() != 0)) -#endif { msg( WARNING, "Warning, the first slice of a picture might have been lost!\n"); } @@ -2107,11 +1805,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl int refPicIndex; while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL0(), 0, true, &refPicIndex, m_apcSlicePilot->getNumRefIdx(REF_PIC_LIST_0))) > 0) { -#if SPS_ID_CHECK if( !pps->getMixedNaluTypesInPicFlag() && ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) && m_picHeader.getNoOutputBeforeRecoveryFlag() ) -#else - if ( ( (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) ) && m_apcSlicePilot->getNoIncorrectPicOutputFlag() ) -#endif { if (m_apcSlicePilot->getRPL0()->isInterLayerRefPic(refPicIndex) == 0) { @@ -2125,11 +1819,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL1(), 0, true, &refPicIndex, m_apcSlicePilot->getNumRefIdx(REF_PIC_LIST_1))) > 0) { -#if SPS_ID_CHECK if( !pps->getMixedNaluTypesInPicFlag() && ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) && m_picHeader.getNoOutputBeforeRecoveryFlag() ) -#else - if (((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) && m_apcSlicePilot->getNoIncorrectPicOutputFlag()) -#endif { if (m_apcSlicePilot->getRPL1()->isInterLayerRefPic(refPicIndex) == 0) { @@ -2153,11 +1843,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl // actual decoding starts here xActivateParameterSets( nalu.m_nuhLayerId ); -#if JVET_P0125_EOS_LAYER_SPECIFIC m_firstSliceInSequence[nalu.m_nuhLayerId] = false; -#else - m_bFirstSliceInSequence = false; -#endif m_firstSliceInBitstream = false; Slice* pcSlice = m_pcPic->slices[m_uiSliceSegmentIdx]; @@ -2170,7 +1856,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_pcPic->subLayerNonReferencePictureDueToSTSA = false; -#if JVET_P0978_RPL_RESTRICTIONS if (m_bFirstSliceInPicture) { m_pcPic->setDecodingOrderNumber(m_decodingOrderCounter); @@ -2178,13 +1863,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_pcPic->setPictureType(nalu.m_nalUnitType); } pcSlice->checkCRA(pcSlice->getRPL0(), pcSlice->getRPL1(), m_pocCRA, m_cListPic); -#else - pcSlice->checkCRA(pcSlice->getRPL0(), pcSlice->getRPL1(), m_pocCRA, m_associatedIRAPType, m_cListPic); -#endif pcSlice->constructRefPicList(m_cListPic); -#if JVET_P0978_RPL_RESTRICTIONS pcSlice->checkRPL(pcSlice->getRPL0(), pcSlice->getRPL1(), m_associatedIRAPDecodingOrderNumber, m_cListPic); -#endif pcSlice->checkSTSA(m_cListPic); pcSlice->scaleRefPicList( scaledRefPic, m_pcPic->cs->picHeader, m_parameterSetManager.getAPSs(), m_picHeader.getLmcsAPS(), m_picHeader.getScalingListAPS(), true ); @@ -2301,7 +1981,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl //--------------- pcSlice->setRefPOCList(); -#if JVET_P0124_MIXED_NALU NalUnitInfo naluInfo; naluInfo.m_nalUnitType = nalu.m_nalUnitType; naluInfo.m_nuhLayerId = nalu.m_nuhLayerId; @@ -2309,7 +1988,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl naluInfo.m_POC = pcSlice->getPOC(); xCheckMixedNalUnit(pcSlice, sps, nalu); m_nalUnitInfo[naluInfo.m_nuhLayerId].push_back(naluInfo); -#endif SEIMessages drapSEIs = getSeisByType(m_pcPic->SEIs, SEI::DEPENDENT_RAP_INDICATION ); if (!drapSEIs.empty()) { @@ -2321,7 +1999,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl Quant *quant = m_cTrQuant.getQuant(); -#if JVET_Q0346_SCALING_LIST_USED_IN_SH if (pcSlice->getExplicitScalingListUsed()) { APS* scalingListAPS = pcSlice->getPicHeader()->getScalingListAPS(); @@ -2329,29 +2006,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl quant->setScalingListDec(scalingList); quant->setUseScalingList(true); } -#else - if( pcSlice->getSPS()->getScalingListFlag() ) - { - ScalingList scalingList; - if( pcSlice->getPicHeader()->getScalingListPresentFlag() ) - { - APS* scalingListAPS = pcSlice->getPicHeader()->getScalingListAPS(); - scalingList = scalingListAPS->getScalingList(); - } - else - { - scalingList.setDefaultScalingList(); - } - int scalingListAPSId = pcSlice->getPicHeader()->getScalingListAPSId(); - if (getScalingListUpdateFlag() || (scalingListAPSId != getPreScalingListAPSId())) - { - quant->setScalingListDec(scalingList); - setScalingListUpdateFlag(false); - setPreScalingListAPSId(scalingListAPSId); - } - quant->setUseScalingList( true ); - } -#endif else { quant->setUseScalingList( false ); @@ -2361,11 +2015,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { if (m_bFirstSliceInPicture) m_sliceLmcsApsId = -1; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pcSlice->getLmcsEnabledFlag()) -#else - if (pcSlice->getPicHeader()->getLmcsEnabledFlag()) -#endif { APS* lmcsAPS = pcSlice->getPicHeader()->getLmcsAPS(); if (m_sliceLmcsApsId == -1) @@ -2383,11 +2033,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl memcpy(tInfo.reshaperModelBinCWDelta, sInfo.reshaperModelBinCWDelta, sizeof(int)*(PIC_CODE_CW_BINS)); tInfo.maxNbitsNeededDeltaCW = sInfo.maxNbitsNeededDeltaCW; tInfo.chrResScalingOffset = sInfo.chrResScalingOffset; -#if JVET_Q0346_LMCS_ENABLE_IN_SH tInfo.setUseSliceReshaper(pcSlice->getLmcsEnabledFlag()); -#else - tInfo.setUseSliceReshaper(pcSlice->getPicHeader()->getLmcsEnabledFlag()); -#endif tInfo.setSliceReshapeChromaAdj(pcSlice->getPicHeader()->getLmcsChromaResidualScaleFlag()); tInfo.setSliceReshapeModelPresentFlag(true); } @@ -2398,11 +2044,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl tInfo.setSliceReshapeChromaAdj(false); tInfo.setSliceReshapeModelPresentFlag(false); } -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pcSlice->getLmcsEnabledFlag()) -#else - if (pcSlice->getPicHeader()->getLmcsEnabledFlag()) -#endif { m_cReshaper.constructReshaper(); } @@ -2447,7 +2089,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl return false; } -#if JVET_P0978_RPL_RESTRICTIONS void DecLib::updateAssociatedIRAP() { const NalUnitType pictureType = m_pcPic->getPictureType(); @@ -2458,7 +2099,6 @@ void DecLib::updateAssociatedIRAP() m_associatedIRAPType = pictureType; } } -#endif void DecLib::xDecodeVPS( InputNALUnit& nalu ) { @@ -2471,7 +2111,6 @@ void DecLib::xDecodeVPS( InputNALUnit& nalu ) m_parameterSetManager.storeVPS( m_vps, nalu.getBitstream().getFifo()); } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void DecLib::xDecodeDCI(InputNALUnit& nalu) { m_HLSReader.setBitstream(&nalu.getBitstream()); @@ -2489,18 +2128,6 @@ void DecLib::xDecodeDCI(InputNALUnit& nalu) CHECK( !m_dci->IsIndenticalDCI(dupDCI), "Two signaled DCIs are different"); } } -#else -void DecLib::xDecodeDPS( InputNALUnit& nalu ) -{ - DPS* dps = new DPS(); - m_HLSReader.setBitstream( &nalu.getBitstream() ); - - CHECK( nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0" ); - - m_HLSReader.parseDPS( dps ); - m_parameterSetManager.storeDPS( dps, nalu.getBitstream().getFifo() ); -} -#endif void DecLib::xDecodeSPS( InputNALUnit& nalu ) { @@ -2532,22 +2159,12 @@ void DecLib::xDecodeAPS(InputNALUnit& nalu) aps->setTemporalId(nalu.m_temporalId); aps->setLayerId( nalu.m_nuhLayerId ); m_parameterSetManager.checkAuApsContent( aps, m_accessUnitApsNals ); -#if !JVET_Q0346_SCALING_LIST_USED_IN_SH - if (aps->getAPSType() == SCALING_LIST_APS) - { - setScalingListUpdateFlag(true); - } -#endif // aps will be deleted if it was already stored (and did not changed), // thus, storing it must be last action. m_parameterSetManager.storeAPS(aps, nalu.getBitstream().getFifo()); } -#if JVET_P0288_PIC_OUTPUT bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay, int iTargetOlsIdx) -#else -bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) -#endif { bool ret; // ignore all NAL units of layers > 0 @@ -2558,19 +2175,11 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) { case NAL_UNIT_VPS: xDecodeVPS( nalu ); -#if JVET_P0288_PIC_OUTPUT m_vps->m_targetOlsIdx = iTargetOlsIdx; -#endif return false; -#if JVET_Q0117_PARAMETER_SETS_CLEANUP case NAL_UNIT_DCI: xDecodeDCI( nalu ); return false; -#else - case NAL_UNIT_DPS: - xDecodeDPS( nalu ); - return false; -#endif case NAL_UNIT_SPS: xDecodeSPS( nalu ); return false; @@ -2596,17 +2205,11 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) case NAL_UNIT_SUFFIX_SEI: if (m_pcPic) { -#if JVET_P0125_ASPECT_TID_LAYER_ID_NUH m_accessUnitSeiTids.push_back(nalu.m_temporalId); -#endif -#if JVET_P0125_SEI_CONSTRAINTS const SPS *sps = m_parameterSetManager.getActiveSPS(); const VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId()); m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, sps, m_HRD, m_pDecodedSEIOutputStream ); m_accessUnitSeiPayLoadTypes.push_back(std::tuple<NalUnitType, int, SEI::PayloadType>(nalu.m_nalUnitType, nalu.m_nuhLayerId, m_pcPic->SEIs.back()->payloadType())); -#else - m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->SEIs, nalu.m_nalUnitType, nalu.m_temporalId, m_parameterSetManager.getActiveSPS(), m_HRD, m_pDecodedSEIOutputStream ); -#endif } else { @@ -2728,18 +2331,6 @@ void DecLib::checkNalUnitConstraints( uint32_t naluType ) xCheckNalUnitConstraintFlags( cInfo, naluType ); } -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - if (m_parameterSetManager.getActiveDPS() != NULL) - { - const DPS *dps = m_parameterSetManager.getActiveDPS(); - for (int i=0; i< dps->getNumPTLs(); i++) - { - ProfileTierLevel ptl = dps->getProfileTierLevel(i); - const ConstraintInfo *cInfo = ptl.getConstraintInfo(); - xCheckNalUnitConstraintFlags( cInfo, naluType ); - } - } -#endif } void DecLib::xCheckNalUnitConstraintFlags( const ConstraintInfo *cInfo, uint32_t naluType ) { @@ -2767,7 +2358,6 @@ void DecLib::xCheckNalUnitConstraintFlags( const ConstraintInfo *cInfo, uint32_t "Non-conforming bitstream. no_aps_constraint_flag is equal to 1 but bitstream contains NAL unit of type APS_SUFFIX_NUT."); } } -#if JVET_P0124_MIXED_NALU void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) { if (pcSlice->getPPS()->getMixedNaluTypesInPicFlag()) @@ -2805,12 +2395,8 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) break; } } -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES if (latestIRAPNalUnit != nullptr && ((latestIRAPNalUnit->m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && latestIRAPNalUnit->m_nalUnitType <= NAL_UNIT_CODED_SLICE_IDR_N_LP) || (latestIRAPNalUnit->m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA && pcSlice->getPOC() > latestIRAPNalUnit->m_POC))) -#else - if (latestIRAPNalUnit != nullptr) -#endif { // clear the nalu unit before the latest IRAP slice m_nalUnitInfo[nalu.m_nuhLayerId].erase(m_nalUnitInfo[nalu.m_nuhLayerId].begin(), m_nalUnitInfo[nalu.m_nuhLayerId].begin() + naluIdx); @@ -2855,7 +2441,6 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) // if this is the last slice of the picture, check whether the nalu type of the slices meet the nal unit type constraints if (pcSlice->getPPS()->getNumSlicesInPic() == (m_uiSliceSegmentIdx + 1)) { -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES std::set<NalUnitType> firstSet = { NAL_UNIT_CODED_SLICE_STSA, NAL_UNIT_CODED_SLICE_RADL, NAL_UNIT_CODED_SLICE_RASL, NAL_UNIT_CODED_SLICE_IDR_W_RADL, NAL_UNIT_CODED_SLICE_IDR_N_LP, NAL_UNIT_CODED_SLICE_CRA }; std::set<NalUnitType> secondSet = { NAL_UNIT_CODED_SLICE_TRAIL, NAL_UNIT_CODED_SLICE_RADL, NAL_UNIT_CODED_SLICE_RASL }; @@ -2919,28 +2504,6 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) } CHECK(!allNalsOK || !foundNalInOtherSet, "disallowed mix of nal unit types"); } -#else - int num1stSetSlice = 0; - int num2ndSetSlice = 0; - int num3rdSetSlice = 0; - for (int i = 0; i < pcSlice->getPPS()->getNumSlicesInPic(); i++) - { - NalUnitType naluType = pcSlice->getNalUnitType(); - if (naluType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && naluType <= NAL_UNIT_CODED_SLICE_CRA) - { - num1stSetSlice++; - } - else if ((naluType >= NAL_UNIT_CODED_SLICE_TRAIL && naluType <= NAL_UNIT_RESERVED_VCL_6) || naluType == NAL_UNIT_CODED_SLICE_GDR) - { - num2ndSetSlice++; - } - else - { - num3rdSetSlice++; - } - } - CHECK((num1stSetSlice + num2ndSetSlice) != pcSlice->getPPS()->getNumSlicesInPic() || num3rdSetSlice != 0, "mixed nal unit picture contain more than two nal unit types"); -#endif } } else // all slices shall have the same nal unit type @@ -2955,5 +2518,4 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) CHECK(!sameNalUnitType, "mixed_nalu_types_in_pic_flag is zero, but have different nal unit types"); } } -#endif //! \} diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 051f3e72d59c20211d8e94a7be157097ca021d16..21f6350a4b182d3a6496ed06900f3b7ef3fcba42 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -73,10 +73,8 @@ private: GeneralHrdParams m_prevGeneralHrdParams; NalUnitType m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture -#if JVET_P0978_RPL_RESTRICTIONS int m_associatedIRAPDecodingOrderNumber; ///< Decoding order number of the associated IRAP picture int m_decodingOrderCounter; -#endif int m_pocCRA; ///< POC number of the latest CRA picture int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) int m_lastRasPoc; @@ -117,11 +115,7 @@ private: int m_prevPOC; int m_prevTid0POC; bool m_bFirstSliceInPicture; -#if JVET_P0125_EOS_LAYER_SPECIFIC bool m_firstSliceInSequence[MAX_VPS_LAYERS]; -#else - bool m_bFirstSliceInSequence; -#endif bool m_firstSliceInBitstream; bool m_prevSliceSkipped; int m_skippedPOC; @@ -141,7 +135,6 @@ private: int m_debugCTU; std::vector<std::pair<NalUnitType, int>> m_accessUnitNals; - #if JVET_P0101_POC_MULTILAYER struct AccessUnitPicInfo { NalUnitType m_nalUnitType; ///< nal_unit_type @@ -150,8 +143,6 @@ private: int m_POC; }; std::vector<AccessUnitPicInfo> m_accessUnitPicInfo; - #endif -#if JVET_P0124_MIXED_NALU struct NalUnitInfo { NalUnitType m_nalUnitType; ///< nal_unit_type @@ -160,34 +151,19 @@ private: int m_POC; /// the picture order }; std::vector<NalUnitInfo> m_nalUnitInfo[MAX_VPS_LAYERS]; -#endif std::vector<int> m_accessUnitApsNals; -#if JVET_P0125_ASPECT_TID_LAYER_ID_NUH std::vector<int> m_accessUnitSeiTids; -#endif -#if JVET_P0125_SEI_CONSTRAINTS // NAL unit type, layer ID, and SEI payloadType std::vector<std::tuple<NalUnitType, int, SEI::PayloadType>> m_accessUnitSeiPayLoadTypes; -#endif VPS* m_vps; -#if !JVET_Q0346_SCALING_LIST_USED_IN_SH - bool m_scalingListUpdateFlag; - int m_PreScalingListAPSId; -#endif -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS int m_maxDecSubPicIdx; int m_maxDecSliceAddrInSubPic; -#endif -#if JVET_O1143_SUBPIC_BOUNDARY public: int m_targetSubPicIdx; -#endif -#if JVET_Q0117_PARAMETER_SETS_CLEANUP DCI* m_dci; -#endif public: DecLib(); virtual ~DecLib(); @@ -202,11 +178,7 @@ public: const std::string& cacheCfgFileName #endif ); -#if JVET_P0288_PIC_OUTPUT bool decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay, int iTargetOlsIdx); -#else - bool decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay); -#endif void deletePicBuffer(); void executeLoopFilters(); @@ -214,22 +186,15 @@ public: void finishPictureLight(int& poc, PicList*& rpcListPic ); void checkNoOutputPriorPics (PicList* rpcListPic); void checkNalUnitConstraints( uint32_t naluType ); -#if JVET_P0978_RPL_RESTRICTIONS void updateAssociatedIRAP(); -#endif bool getNoOutputPriorPicsFlag () const { return m_isNoOutputPriorPics; } void setNoOutputPriorPicsFlag (bool val) { m_isNoOutputPriorPics = val; } void setFirstSliceInPicture (bool val) { m_bFirstSliceInPicture = val; } bool getFirstSliceInPicture () const { return m_bFirstSliceInPicture; } -#if JVET_P0125_EOS_LAYER_SPECIFIC bool getFirstSliceInSequence(int layerId) const { return m_firstSliceInSequence[layerId]; } void setFirstSliceInSequence(bool val, int layerId) { m_firstSliceInSequence[layerId] = val; } -#else - bool getFirstSliceInSequence () const { return m_bFirstSliceInSequence; } - void setFirstSliceInSequence (bool val) { m_bFirstSliceInSequence = val; } -#endif void setDecodedSEIMessageOutputStream(std::ostream *pOpStream) { m_pDecodedSEIOutputStream = pOpStream; } uint32_t getNumberOfChecksumErrorsDetected() const { return m_numberOfChecksumErrorsDetected; } @@ -238,35 +203,21 @@ public: int getDebugPOC( ) const { return m_debugPOC; }; void setDebugPOC( int debugPOC ) { m_debugPOC = debugPOC; }; void resetAccessUnitNals() { m_accessUnitNals.clear(); } -#if JVET_P0101_POC_MULTILAYER void resetAccessUnitPicInfo() { m_accessUnitPicInfo.clear(); } -#endif void resetAccessUnitApsNals() { m_accessUnitApsNals.clear(); } -#if JVET_P0125_ASPECT_TID_LAYER_ID_NUH void resetAccessUnitSeiTids() { m_accessUnitSeiTids.clear(); } void checkTidLayerIdInAccessUnit(); -#endif -#if JVET_P0125_SEI_CONSTRAINTS void resetAccessUnitSeiPayLoadTypes() { m_accessUnitSeiPayLoadTypes.clear(); } void checkSEIInAccessUnit(); -#endif 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() { m_cTrQuantScalingList.init(nullptr, MAX_TB_SIZEY, false, false, false, false); } -#if !JVET_Q0346_SCALING_LIST_USED_IN_SH - bool getScalingListUpdateFlag() { return m_scalingListUpdateFlag; } - void setScalingListUpdateFlag(bool b) { m_scalingListUpdateFlag = b; } - int getPreScalingListAPSId() { return m_PreScalingListAPSId; } - void setPreScalingListAPSId(int id) { m_PreScalingListAPSId = id; } -#endif protected: void xUpdateRasInit(Slice* slice); @@ -279,11 +230,7 @@ protected: void xDecodePicHeader( InputNALUnit& nalu ); bool xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDisplay); void xDecodeVPS( InputNALUnit& nalu ); -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void xDecodeDCI( InputNALUnit& nalu ); -#else - void xDecodeDPS( InputNALUnit& nalu ); -#endif void xDecodeSPS( InputNALUnit& nalu ); void xDecodePPS( InputNALUnit& nalu ); void xDecodeAPS(InputNALUnit& nalu); @@ -292,9 +239,7 @@ protected: void xParsePrefixSEIsForUnknownVCLNal(); void xCheckNalUnitConstraintFlags( const ConstraintInfo *cInfo, uint32_t naluType ); -#if JVET_P0124_MIXED_NALU void xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu); -#endif };// END CLASS DEFINITION DecLib diff --git a/source/Lib/DecoderLib/DecSlice.cpp b/source/Lib/DecoderLib/DecSlice.cpp index 9bb2b66c9019c858d3e01d73d266b01dd49a93ba..37b8392c6bcfa7222037002887ebddac43e26c0b 100644 --- a/source/Lib/DecoderLib/DecSlice.cpp +++ b/source/Lib/DecoderLib/DecSlice.cpp @@ -114,12 +114,8 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb } const unsigned widthInCtus = cs.pcv->widthInCtus; -#if JVET_Q0151_Q0205_ENTRYPOINTS const bool wavefrontsEnabled = cs.sps->getEntropyCodingSyncEnabledFlag(); const bool wavefrontsEntryPointPresent = cs.sps->getEntropyCodingSyncEntryPointsPresentFlag(); -#else - const bool wavefrontsEnabled = cs.pps->getEntropyCodingSyncEnabledFlag(); -#endif cabacReader.initBitstream( ppcSubstreams[0] ); cabacReader.initCtxModels( *slice ); @@ -148,7 +144,6 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb const unsigned maxCUSize = sps->getMaxCUWidth(); Position pos( ctuXPosInCtus*maxCUSize, ctuYPosInCtus*maxCUSize) ; UnitArea ctuArea(cs.area.chromaFormat, Area( pos.x, pos.y, maxCUSize, maxCUSize ) ); -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY const SubPic &curSubPic = slice->getPPS()->getSubPicFromPos(pos); // padding/restore at slice level if (slice->getPPS()->getNumSubPics()>=2 && curSubPic.getTreatedAsPicFlag() && ctuIdx==0) @@ -172,7 +167,6 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb } } } -#endif DTRACE_UPDATE( g_trace_ctx, std::make_pair( "ctu", ctuRsAddr ) ); @@ -200,9 +194,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb { // Top is available, so use it. cabacReader.getCtx() = m_entropyCodingSyncContextState; -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU cs.setPrevPLT(m_palettePredictorSyncState); -#endif } pic->m_prevQP[0] = pic->m_prevQP[1] = slice->getSliceQp(); } @@ -236,9 +228,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb if( ctuXPosInCtus == tileXPosInCtus && wavefrontsEnabled ) { m_entropyCodingSyncContextState = cabacReader.getCtx(); -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU cs.storePrevPLT(m_palettePredictorSyncState); -#endif } @@ -257,7 +247,6 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb // (end of slice-segment, end of tile, end of wavefront-CTU-row) unsigned binVal = cabacReader.terminating_bit(); CHECK( !binVal, "Expecting a terminating bit" ); -#if JVET_Q0151_Q0205_ENTRYPOINTS bool isLastTileCtu = (ctuXPosInCtus + 1 == tileXPosInCtus + tileColWidth) && (ctuYPosInCtus + 1 == tileYPosInCtus + tileRowHeight); if( isLastTileCtu || wavefrontsEntryPointPresent ) { @@ -266,14 +255,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb #endif subStrmId++; } -#else -#if DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES - cabacReader.remaining_bytes( true ); -#endif - subStrmId++; -#endif } -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY if (slice->getPPS()->getNumSubPics() >= 2 && curSubPic.getTreatedAsPicFlag() && ctuIdx == (slice->getNumCtuInSlice() - 1)) // for last Ctu in the slice { @@ -295,7 +277,6 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb } } } -#endif } // deallocate all created substreams, including internal buffers. diff --git a/source/Lib/DecoderLib/DecSlice.h b/source/Lib/DecoderLib/DecSlice.h index cd918ed76d3fe28fab725c5efd40965359a4af74..56cc1da07e3c4330a08d298017e8ed94221b9d6c 100644 --- a/source/Lib/DecoderLib/DecSlice.h +++ b/source/Lib/DecoderLib/DecSlice.h @@ -63,9 +63,7 @@ private: DecCu* m_pcCuDecoder; Ctx m_entropyCodingSyncContextState; ///< context storage for state of contexts at the wavefront/WPP/entropy-coding-sync second CTU of tile-row -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU PLTBuf m_palettePredictorSyncState; /// palette predictor storage at wavefront/WPP -#endif public: DecSlice(); diff --git a/source/Lib/DecoderLib/NALread.cpp b/source/Lib/DecoderLib/NALread.cpp index 819bcc25180de163afd088f8e2ff0f93e26f2484..bbcebd40309d8d2d6bc6ec9411e34aff0f5ce7f0 100644 --- a/source/Lib/DecoderLib/NALread.cpp +++ b/source/Lib/DecoderLib/NALread.cpp @@ -167,12 +167,10 @@ void read(InputNALUnit& nalu) bitstream.resetToStart(); readNalUnitHeader(nalu); } -#if JVET_Q0775_PH_IN_SH bool checkPictureHeaderInSliceHeaderFlag(InputNALUnit& nalu) { InputBitstream& bitstream = nalu.getBitstream(); CHECK(bitstream.getByteLocation() != 2, "The picture_header_in_slice_header_flag is the first bit after the NAL unit header"); return (bool)bitstream.read(1); } -#endif //! \} diff --git a/source/Lib/DecoderLib/NALread.h b/source/Lib/DecoderLib/NALread.h index f807fbed75608d03e84197ae2f75534585c8d47b..4a8647b47a9796aafbb7edb89ab04808c726837f 100644 --- a/source/Lib/DecoderLib/NALread.h +++ b/source/Lib/DecoderLib/NALread.h @@ -67,9 +67,7 @@ class InputNALUnit : public NALUnit void read(InputNALUnit& nalu); void readNalUnitHeader(InputNALUnit& nalu); -#if JVET_Q0775_PH_IN_SH bool checkPictureHeaderInSliceHeaderFlag(InputNALUnit & nalu); -#endif //! \} #endif diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 21d429643540883e8e9fd12bf7fea196a84fae43..4fc6b8a0945d582798713a8f2f50b27937a2199a 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -115,22 +115,14 @@ static inline void output_sei_message_header(SEI &sei, std::ostream *pDecodedMes * unmarshal a single SEI message from bitstream bs */ // note: for independent parsing no parameter set should not be required here -#if JVET_P0125_SEI_CONSTRAINTS void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, const uint32_t temporalId, const VPS *vps, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#endif { setBitstream(bs); CHECK(m_pcBitstream->getNumBitsUntilByteAligned(), "Bitstream not aligned"); do { -#if JVET_P0125_SEI_CONSTRAINTS xReadSEImessage(seis, nalUnitType, nuh_layer_id, temporalId, vps, sps, hrd, pDecodedMessageOutputStream); -#else - xReadSEImessage(seis, nalUnitType, temporalId, sps, hrd, pDecodedMessageOutputStream); -#endif /* SEI messages are an integer number of bytes, something has failed * in the parsing if bitstream not byte-aligned */ @@ -141,11 +133,7 @@ void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const Nal xReadRbspTrailingBits(); } -#if JVET_P0125_SEI_CONSTRAINTS void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, const uint32_t temporalId, const VPS *vps, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#endif { #if ENABLE_TRACING xTraceSEIHeader(); @@ -181,9 +169,7 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType SEI *sei = NULL; const SEIBufferingPeriod *bp = NULL; -#if JVET_Q0818_PT_SEI const SEIPictureTiming *pt = NULL; -#endif if(nalUnitType == NAL_UNIT_PREFIX_SEI) { @@ -221,30 +207,18 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType { sei = new SEIPictureTiming; xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, temporalId, *bp, pDecodedMessageOutputStream); -#if JVET_Q0818_PT_SEI hrd.setPictureTimingSEI( (SEIPictureTiming*) sei ); -#endif } } break; -#if JVET_P0190_SCALABLE_NESTING_SEI case SEI::SCALABLE_NESTING: sei = new SEIScalableNesting; -#if JVET_P0125_SEI_CONSTRAINTS xParseSEIScalableNesting((SEIScalableNesting&)*sei, nalUnitType, nuh_layer_id, payloadSize, vps, sps, pDecodedMessageOutputStream); -#else - xParseSEIScalableNesting((SEIScalableNesting&)*sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream); -#endif break; -#endif case SEI::FRAME_FIELD_INFO: sei = new SEIFrameFieldInfo; -#if JVET_Q0818_PT_SEI pt = hrd.getPictureTimingSEI(); xParseSEIFrameFieldinfo((SEIFrameFieldInfo&) *sei, *pt, payloadSize, pDecodedMessageOutputStream); -#else - xParseSEIFrameFieldinfo((SEIFrameFieldInfo&) *sei, payloadSize, pDecodedMessageOutputStream); -#endif break; case SEI::DEPENDENT_RAP_INDICATION: sei = new SEIDependentRAPIndication; @@ -286,11 +260,7 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType break; case SEI::SUBPICTURE_LEVEL_INFO: sei = new SEISubpicureLevelInfo; -#if JVET_Q0630_SUBPIC_LEVEL xParseSEISubpictureLevelInfo((SEISubpicureLevelInfo&) *sei, payloadSize, pDecodedMessageOutputStream); -#else - xParseSEISubpictureLevelInfo((SEISubpicureLevelInfo&) *sei, sps, payloadSize, pDecodedMessageOutputStream); -#endif break; case SEI::SAMPLE_ASPECT_RATIO_INFO: sei = new SEISampleAspectRatioInfo; @@ -487,12 +457,7 @@ void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, uint32_t } -#if JVET_P0190_SCALABLE_NESTING_SEI -#if JVET_P0125_SEI_CONSTRAINTS void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, uint32_t payloadSize, const VPS *vps, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#endif { uint32_t uiCode; SEIMessages seis; @@ -506,7 +471,6 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT { sei_read_uvlc(pDecodedMessageOutputStream, uiCode, "nesting_ols_idx_delta_minus1[i]"); sei.m_nestingOlsIdxDeltaMinus1[i] = uiCode; } -#if JVET_P0125_SEI_CONSTRAINTS for (uint32_t i = 0; i <= sei.m_nestingNumOlssMinus1; i++) { if (i == 0) @@ -531,7 +495,6 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT } } CHECK(lowestLayerId!= nuh_layer_id, "nuh_layer_id is not equal to the lowest layer among Olss that the scalable SEI applies"); -#endif } else { @@ -553,7 +516,6 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT sei_read_flag(pDecodedMessageOutputStream, code, "nesting_zero_bit"); } -#if JVET_P0125_SEI_CONSTRAINTS bool containBPorPTorDUI = false; bool containNoBPorPTorDUI = false; for (auto nestedsei : sei.m_nestedSEIs) @@ -568,16 +530,11 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT } } CHECK(containBPorPTorDUI && containNoBPorPTorDUI, "nested SEI cannot have timing-related SEI and none-timing-related SEI at the same time"); -#endif // read nested SEI messages do { HRD hrd; -#if JVET_P0125_SEI_CONSTRAINTS xReadSEImessage(sei.m_nestedSEIs, nalUnitType, nuh_layer_id, 0, vps, sps, hrd, pDecodedMessageOutputStream); -#else - xReadSEImessage(sei.m_nestedSEIs, nalUnitType, 0, sps, hrd, pDecodedMessageOutputStream); -#endif } while (m_pcBitstream->getNumBitsLeft() > 8); if (pDecodedMessageOutputStream) @@ -585,7 +542,6 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT (*pDecodedMessageOutputStream) << "End of scalable nesting SEI message\n"; } } -#endif void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t payloadSize, const SEIBufferingPeriod& bp, const uint32_t temporalId, std::ostream *pDecodedMessageOutputStream) { uint32_t val; @@ -617,7 +573,6 @@ void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t pay sei.m_duSptCpbRemovalDelayIncrement[i] = 0; } } -#if JVET_Q0221 if (bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag) { sei_read_flag(pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0); @@ -626,9 +581,6 @@ void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t pay { sei.m_dpbOutputDuDelayPresentFlag = false; } -#else - sei_read_flag(pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0); -#endif if(sei.m_dpbOutputDuDelayPresentFlag) { sei_read_code( pDecodedMessageOutputStream, bp.getDpbOutputDelayDuLength(), val, "pic_spt_dpb_output_du_delay"); @@ -657,17 +609,13 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo sei_read_code( pDecodedMessageOutputStream, 5, code, "du_cpb_removal_delay_increment_length_minus1" ); sei.m_duCpbRemovalDelayIncrementLength = code + 1; sei_read_code( pDecodedMessageOutputStream, 5, code, "dpb_output_delay_du_length_minus1" ); sei.m_dpbOutputDelayDuLength = code + 1; sei_read_flag( pDecodedMessageOutputStream, code, "decoding_unit_cpb_params_in_pic_timing_sei_flag" ); sei.m_decodingUnitCpbParamsInPicTimingSeiFlag = code; -#if JVET_Q0221 sei_read_flag(pDecodedMessageOutputStream, code, "decoding_unit_dpb_du_params_in_pic_timing_sei_flag"); sei.m_decodingUnitDpbDuParamsInPicTimingSeiFlag = code; -#endif } else { sei.m_duCpbRemovalDelayIncrementLength = 24; sei.m_dpbOutputDelayDuLength = 24; -#if JVET_Q0221 sei.m_decodingUnitDpbDuParamsInPicTimingSeiFlag = false; -#endif } sei_read_flag( pDecodedMessageOutputStream, code, "concatenation_flag"); @@ -734,7 +682,6 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi sei_read_flag( pDecodedMessageOutputStream, symbol, "cpb_alt_timing_info_present_flag" ); sei.m_cpbAltTimingInfoPresentFlag = symbol; if( sei.m_cpbAltTimingInfoPresentFlag ) { -#if JVET_Q0219_SIGNAL_ALT_BUFFER_DELAY_PARMS sei.m_cpbAltInitialCpbRemovalDelayDelta.resize(bp.m_bpMaxSubLayers); sei.m_cpbAltInitialCpbRemovalOffsetDelta.resize(bp.m_bpMaxSubLayers); sei.m_cpbDelayOffset.resize(bp.m_bpMaxSubLayers); @@ -758,34 +705,13 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi sei_read_code(pDecodedMessageOutputStream, bp.m_initialCpbRemovalDelayLength, sei.m_dpbDelayOffset[i], "dpb_delay_offset[ i ]"); } -#else - sei.m_cpbAltInitialCpbRemovalDelayDelta.resize(bp.m_bpCpbCnt); - sei.m_cpbAltInitialCpbRemovalOffsetDelta.resize(bp.m_bpCpbCnt); - for (int i = 0; i < bp.m_bpCpbCnt; i++) - { - sei_read_code(pDecodedMessageOutputStream, bp.m_initialCpbRemovalDelayLength, symbol, - "cpb_alt_initial_cpb_removal_delay_delta[ i ]"); - sei.m_cpbAltInitialCpbRemovalDelayDelta[i] = symbol; - sei_read_code(pDecodedMessageOutputStream, bp.m_initialCpbRemovalDelayLength, symbol, - "cpb_alt_initial_cpb_removal_offset_delta[ i ]"); - sei.m_cpbAltInitialCpbRemovalOffsetDelta[i] = symbol; - } - sei_read_code(pDecodedMessageOutputStream, bp.m_initialCpbRemovalDelayLength, sei.m_cpbDelayOffset, - "cpb_delay_offset"); - sei_read_code(pDecodedMessageOutputStream, bp.m_initialCpbRemovalDelayLength, sei.m_dpbDelayOffset, - "dpb_delay_offset"); -#endif } } else { sei.m_cpbAltTimingInfoPresentFlag = false; -#if JVET_Q0219_SIGNAL_ALT_BUFFER_DELAY_PARMS sei.m_cpbDelayOffset.resize(bp.m_bpMaxSubLayers, 0); sei.m_dpbDelayOffset.resize(bp.m_bpMaxSubLayers, 0); -#else - sei.m_cpbDelayOffset = sei.m_dpbDelayOffset = 0; -#endif } for( int i = temporalId; i < bp.m_bpMaxSubLayers - 1; i ++ ) @@ -804,7 +730,6 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi } if( sei.m_cpbRemovalDelayDeltaEnabledFlag[ i ] ) { -#if JVET_Q0216 if ((bp.m_numCpbRemovalDelayDeltas - 1) > 0) { sei_read_code(pDecodedMessageOutputStream, ceilLog2(bp.m_numCpbRemovalDelayDeltas), symbol, "cpb_removal_delay_delta_idx[i]"); @@ -814,10 +739,6 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi { sei.m_cpbRemovalDelayDeltaIdx[i] = 0; } -#else - sei_read_code(pDecodedMessageOutputStream, ceilLog2(bp.m_numCpbRemovalDelayDeltas), symbol, "cpb_removal_delay_delta_idx[i]"); - sei.m_cpbRemovalDelayDeltaIdx[i] = symbol; -#endif } else { @@ -828,11 +749,7 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi } sei_read_code( pDecodedMessageOutputStream, bp.m_dpbOutputDelayLength, symbol, "dpb_output_delay" ); sei.m_picDpbOutputDelay = symbol; -#if JVET_Q0221 if ( bp.m_bpDecodingUnitHrdParamsPresentFlag && bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag ) -#else - if (bp.m_bpDecodingUnitHrdParamsPresentFlag) -#endif { sei_read_code( pDecodedMessageOutputStream, bp.getDpbOutputDelayDuLength(), symbol, "pic_dpb_output_du_delay" ); sei.m_picDpbOutputDuDelay = symbol; @@ -874,17 +791,11 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi } } } -#if JVET_Q0818_PT_SEI sei_read_uvlc( pDecodedMessageOutputStream, symbol, "pt_display_elemental_periods_minus1" ); sei.m_ptDisplayElementalPeriodsMinus1 = symbol; -#endif } -#if JVET_Q0818_PT_SEI void SEIReader::xParseSEIFrameFieldinfo(SEIFrameFieldInfo& sei, const SEIPictureTiming& pt, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::xParseSEIFrameFieldinfo(SEIFrameFieldInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) -#endif { output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); @@ -914,10 +825,8 @@ void SEIReader::xParseSEIFrameFieldinfo(SEIFrameFieldInfo& sei, uint32_t payload } sei_read_uvlc( pDecodedMessageOutputStream, symbol, "display_elemental_periods_minus1" ); sei.m_displayElementalPeriodsMinus1 = symbol; -#if JVET_Q0818_PT_SEI if( pt.m_ptDisplayElementalPeriodsMinus1 != sei.m_displayElementalPeriodsMinus1 ) msg( WARNING, "Warning: display_elemental_periods_minus1 is different in picture timing and frame field information SEI messages!"); -#endif } sei_read_code( pDecodedMessageOutputStream, 2, symbol, "source_scan_type" ); sei.m_sourceScanType = symbol; @@ -1300,39 +1209,19 @@ void SEIReader::xParseSEIGeneralizedCubemapProjection(SEIGeneralizedCubemapProje sei_read_flag( pDecodedMessageOutputStream, val, "gcmp_guard_band_flag" ); sei.m_gcmpGuardBandFlag = val; if (sei.m_gcmpGuardBandFlag) { -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE sei_read_code( pDecodedMessageOutputStream, 3, val, "gcmp_guard_band_type" ); sei.m_gcmpGuardBandType = val; sei_read_flag( pDecodedMessageOutputStream, val, "gcmp_guard_band_boundary_exterior_flag" ); sei.m_gcmpGuardBandBoundaryExteriorFlag = val; sei_read_code( pDecodedMessageOutputStream, 4, val, "gcmp_guard_band_samples_minus1" ); sei.m_gcmpGuardBandSamplesMinus1 = val; -#else - sei_read_flag( pDecodedMessageOutputStream, val, "gcmp_guard_band_boundary_type" ); sei.m_gcmpGuardBandBoundaryType = val; - sei_read_code( pDecodedMessageOutputStream, 4, val, "gcmp_guard_band_samples_minus1" ); sei.m_gcmpGuardBandSamplesMinus1 = val; -#endif } } } -#if JVET_Q0630_SUBPIC_LEVEL void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, const SPS *sps, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) -#endif { output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); -#if !JVET_Q0630_SUBPIC_LEVEL - if (sps == nullptr) - { - fprintf (stderr, "no SPS available, not parsing Subpicture level information SEI"); - return; - } -#endif uint32_t val; -#if !JVET_Q0630_SUBPIC_LEVEL - sei_read_code( pDecodedMessageOutputStream, 4, val, "sli_seq_parameter_set_id" ); sei.m_sliSeqParameterSetId = val; -#endif sei_read_code( pDecodedMessageOutputStream, 3, val, "num_ref_levels_minus1" ); sei.m_numRefLevels = val + 1; sei_read_flag( pDecodedMessageOutputStream, val, "explicit_fraction_present_flag" ); sei.m_explicitFractionPresentFlag = val; -#if JVET_Q0630_SUBPIC_LEVEL if (sei.m_explicitFractionPresentFlag) { sei_read_uvlc(pDecodedMessageOutputStream, val, "sli_num_subpics_minus1"); sei.m_numSubpics = val + 1; @@ -1341,7 +1230,6 @@ void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, const S sei_read_flag( pDecodedMessageOutputStream, val, "sli_alignment_zero_bit" ); CHECK (val != 0, "sli_alignment_zero_bit not equal to zero" ); } } -#endif sei.m_refLevelIdc.resize(sei.m_numRefLevels); if (sei.m_explicitFractionPresentFlag) @@ -1354,16 +1242,9 @@ void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, const S sei_read_code( pDecodedMessageOutputStream, 8, val, "ref_level_idc[i]" ); sei.m_refLevelIdc[i] = (Level::Name) val; if( sei.m_explicitFractionPresentFlag ) { -#if !JVET_Q0630_SUBPIC_LEVEL - int numSubPics = sps->getNumSubPics(); - sei.m_refLevelFraction[i].resize(numSubPics); - - for( int j = 0; j < numSubPics; j++ ) -#else sei.m_refLevelFraction[i].resize(sei.m_numSubpics); for( int j = 0; j < sei.m_numSubpics; j++ ) -#endif { sei_read_code( pDecodedMessageOutputStream, 8, val, "ref_level_fraction_minus1[i][j]" ); sei.m_refLevelFraction[i][j]= val; } diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 287c6a287a4ff297b82641f36d25ac84099e688e..00ca7647ccb440052368539dd9141c6aa24330c0 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -55,35 +55,17 @@ class SEIReader: public VLCReader public: SEIReader() {}; virtual ~SEIReader() {}; -#if JVET_P0125_SEI_CONSTRAINTS void parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, const uint32_t temporalId,const VPS *vps, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#else - void parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#endif protected: -#if JVET_P0125_SEI_CONSTRAINTS void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, const uint32_t temporalId, const VPS *vps, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#else - void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#endif void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, uint32_t payloadSize, const SEIBufferingPeriod& bp, const uint32_t temporalId, std::ostream *pDecodedMessageOutputStream); void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIPictureTiming (SEIPictureTiming& sei, uint32_t payloadSize, const uint32_t temporalId, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream); -#if JVET_P0190_SCALABLE_NESTING_SEI -#if JVET_P0125_SEI_CONSTRAINTS void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, uint32_t payloadSize, const VPS *vps, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#else - void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#endif -#endif -#if JVET_Q0818_PT_SEI void xParseSEIFrameFieldinfo (SEIFrameFieldInfo& sei, const SEIPictureTiming& pt, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#else - void xParseSEIFrameFieldinfo (SEIFrameFieldInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#endif void xParseSEIDependentRAPIndication (SEIDependentRAPIndication& sei, uint32_t payLoadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIFramePacking (SEIFramePacking& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIMasteringDisplayColourVolume (SEIMasteringDisplayColourVolume& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); @@ -95,11 +77,7 @@ protected: void xParseSEIOmniViewport (SEIOmniViewport& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIRegionWisePacking (SEIRegionWisePacking& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIGeneralizedCubemapProjection (SEIGeneralizedCubemapProjection &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#if JVET_Q0630_SUBPIC_LEVEL void xParseSEISubpictureLevelInfo (SEISubpicureLevelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#else - void xParseSEISubpictureLevelInfo (SEISubpicureLevelInfo& sei, const SPS *sps, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#endif void xParseSEISampleAspectRatioInfo (SEISampleAspectRatioInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIUserDataRegistered (SEIUserDataRegistered& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIFilmGrainCharacteristics (SEIFilmGrainCharacteristics& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 483e813452feb56ddec014552916060cd78e5895..f8e632e9d5f473dd146222fe72222520bcd65412 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -367,11 +367,7 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl) if (!isLongTerm) { READ_UVLC(code, "abs_delta_poc_st[ listIdx ][ rplsIdx ][ i ]"); -#if JVET_Q0217_PROPOSAL5 if ((!sps->getUseWP() && !sps->getUseWPBiPred()) || (ii == 0)) -#else - if (!sps->getUseWP() && !sps->getUseWPBiPred()) -#endif { code++; } @@ -425,13 +421,10 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_CODE(4, uiCode, "pps_seq_parameter_set_id"); pcPPS->setSPSId (uiCode); -#if SPS_ID_CHECK READ_FLAG( uiCode, "mixed_nalu_types_in_pic_flag" ); pcPPS->setMixedNaluTypesInPicFlag( uiCode == 1 ); -#endif READ_UVLC( uiCode, "pic_width_in_luma_samples" ); pcPPS->setPicWidthInLumaSamples( uiCode ); READ_UVLC( uiCode, "pic_height_in_luma_samples" ); pcPPS->setPicHeightInLumaSamples( uiCode ); -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS READ_FLAG(uiCode, "pps_conformance_window_flag"); if (uiCode != 0) { @@ -441,17 +434,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_UVLC(uiCode, "pps_conf_win_top_offset"); conf.setWindowTopOffset(uiCode); READ_UVLC(uiCode, "pps_conf_win_bottom_offset"); conf.setWindowBottomOffset(uiCode); } -#else - READ_FLAG( uiCode, "conformance_window_flag" ); - if( uiCode != 0 ) - { - Window &conf = pcPPS->getConformanceWindow(); - READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset( uiCode ); - READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset( uiCode ); - READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset( uiCode ); - READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); - } -#endif READ_FLAG( uiCode, "scaling_window_flag" ); if( uiCode != 0 ) { @@ -461,7 +443,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_UVLC( uiCode, "scaling_win_top_offset" ); scalingWindow.setWindowTopOffset( uiCode ); READ_UVLC( uiCode, "scaling_win_bottom_offset" ); scalingWindow.setWindowBottomOffset( uiCode ); } -#if JVET_Q0399_SCALING_INFERENCE else { Window &scalingWindow = pcPPS->getScalingWindow(); @@ -471,17 +452,11 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) scalingWindow.setWindowTopOffset( conf.getWindowTopOffset() ); scalingWindow.setWindowBottomOffset( conf.getWindowBottomOffset() ); } -#endif READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); -#if JVET_Q0119_CLEANUPS READ_FLAG( uiCode, "subpic_id_mapping_in_pps_flag" ); pcPPS->setSubPicIdMappingInPpsFlag( uiCode != 0 ); if( pcPPS->getSubPicIdMappingInPpsFlag() ) -#else - READ_FLAG(uiCode, "pps_subpic_id_signalling_present_flag"); pcPPS->setSubPicIdSignallingPresentFlag( uiCode != 0 ); - if( pcPPS->getSubPicIdSignallingPresentFlag() ) -#endif { READ_UVLC( uiCode, "pps_num_subpics_minus1" ); pcPPS->setNumSubPics( uiCode + 1 ); CHECK( uiCode > MAX_NUM_SUB_PICS-1, "Number of sub-pictures exceeds limit"); @@ -489,9 +464,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_UVLC( uiCode, "pps_subpic_id_len_minus1" ); pcPPS->setSubPicIdLen( uiCode + 1 ); CHECK( uiCode > 15, "Invalid pps_subpic_id_len_minus1 signalled"); -#if JVET_Q0169_SUBPIC_LEN_CONFORM CHECK((1 << pcPPS->getSubPicIdLen()) < pcPPS->getNumSubPics(), "pps_subpic_id_len exceeds valid range"); -#endif for( int picIdx = 0; picIdx < pcPPS->getNumSubPics( ); picIdx++ ) { READ_CODE( pcPPS->getSubPicIdLen( ), uiCode, "pps_subpic_id[i]" ); pcPPS->setSubPicId( picIdx, uiCode ); @@ -518,20 +491,15 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) for( colIdx = 0; colIdx < pcPPS->getNumExpTileColumns(); colIdx++ ) { READ_UVLC( uiCode, "tile_column_width_minus1[i]" ); pcPPS->addTileColumnWidth( uiCode + 1 ); -#if JVET_Q0359_TILE_SIZE_CONSTRAINT CHECK(uiCode > (pcPPS->getPicWidthInCtu()-1), "The value of tile_column_width_minus1[i] shall be in the range of 0 to PicWidthInCtbY-1, inclusive"); -#endif } for( rowIdx = 0; rowIdx < pcPPS->getNumExpTileRows(); rowIdx++ ) { READ_UVLC( uiCode, "tile_row_height_minus1[i]" ); pcPPS->addTileRowHeight( uiCode + 1 ); -#if JVET_Q0359_TILE_SIZE_CONSTRAINT CHECK(uiCode > (pcPPS->getPicHeightInCtu() - 1), "The value of tile_row_height_minus shall be in the range of 0 to PicHeightInCtbY-1, inclusive"); -#endif } pcPPS->initTiles(); // rectangular slice signalling -#if JVET_Q0289_BUGFIX_RECT_SLICE_FLAG if (pcPPS->getNumTiles() > 1) { READ_CODE(1, uiCode, "rect_slice_flag"); @@ -541,19 +509,14 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) uiCode = 1; } pcPPS->setRectSliceFlag(uiCode == 1); -#else - READ_CODE(1, uiCode, "rect_slice_flag"); pcPPS->setRectSliceFlag( uiCode == 1 ); -#endif if (pcPPS->getRectSliceFlag()) { READ_FLAG(uiCode, "single_slice_per_subpic_flag"); pcPPS->setSingleSlicePerSubPicFlag(uiCode == 1); } -#if JVET_Q0218_PROPOSAL3 else { pcPPS->setSingleSlicePerSubPicFlag(0); } -#endif if (pcPPS->getRectSliceFlag() & !(pcPPS->getSingleSlicePerSubPicFlag())) { int32_t tileIdx = 0; @@ -561,7 +524,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_UVLC( uiCode, "num_slices_in_pic_minus1" ); pcPPS->setNumSlicesInPic( uiCode + 1 ); CHECK(pcPPS->getNumSlicesInPic() > MAX_SLICES, "Number of slices in picture exceeds valid range"); -#if JVET_Q0218_PROPOSAL1 if ((pcPPS->getNumSlicesInPic() - 1) > 0) { READ_CODE(1, uiCode, "tile_idx_delta_present_flag"); @@ -571,10 +533,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) { pcPPS->setTileIdxDeltaPresentFlag(0); } -#else - READ_CODE(1, uiCode, "tile_idx_delta_present_flag"); - pcPPS->setTileIdxDeltaPresentFlag(uiCode == 1); -#endif pcPPS->initRectSlices(); // read rectangular slice parameters @@ -583,40 +541,27 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setSliceTileIdx( i, tileIdx ); // complete tiles within a single slice -#if JVET_Q0244 uiCode = 0; if( pcPPS->getNumTileColumns() > 1 ) { READ_UVLC( uiCode, "slice_width_in_tiles_minus1[i]" ); } pcPPS->setSliceWidthInTiles ( i, uiCode + 1 ); -#else - READ_UVLC( uiCode, "slice_width_in_tiles_minus1[i]" ); pcPPS->setSliceWidthInTiles ( i, uiCode + 1 ); -#endif -#if JVET_Q0480_RASTER_RECT_SLICES if( pcPPS->getTileIdxDeltaPresentFlag() || ( (tileIdx % pcPPS->getNumTileColumns()) == 0 ) ) { -#if JVET_Q0244 uiCode = 0; if( pcPPS->getNumTileRows() > 1 ) { READ_UVLC( uiCode, "slice_height_in_tiles_minus1[i]" ); } pcPPS->setSliceHeightInTiles( i, uiCode + 1 ); -#else - READ_UVLC( uiCode, "slice_height_in_tiles_minus1[i]" ); pcPPS->setSliceHeightInTiles( i, uiCode + 1 ); -#endif } else { pcPPS->setSliceHeightInTiles( i, pcPPS->getSliceHeightInTiles(i-1) ); } -#else - READ_UVLC( uiCode, "slice_height_in_tiles_minus1[i]" ); pcPPS->setSliceHeightInTiles( i, uiCode + 1 ); -#endif // multiple slices within a single tile special case -#if JVET_Q0203_MULTI_SLICE_IN_TILE if( pcPPS->getSliceWidthInTiles(i) == 1 && pcPPS->getSliceHeightInTiles(i) == 1 ) { if( pcPPS->getTileRowHeight(tileIdx / pcPPS->getNumTileColumns()) > 1 ) @@ -668,22 +613,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setSliceHeightInCtu(i, pcPPS->getTileRowHeight(tileIdx / pcPPS->getNumTileColumns())); } } -#else - if( pcPPS->getSliceWidthInTiles( i ) == 1 && pcPPS->getSliceHeightInTiles( i ) == 1 ) - { - READ_UVLC( uiCode, "num_slices_in_tile_minus1[i]" ); pcPPS->setNumSlicesInTile( i, uiCode + 1 ); - uint32_t numSlicesInTile = pcPPS->getNumSlicesInTile( i ); - for( int j = 0; j < numSlicesInTile-1; j++ ) - { - READ_UVLC( uiCode, "slice_height_in_ctu_minus1[i]" ); pcPPS->setSliceHeightInCtu( i, uiCode + 1 ); - i++; - pcPPS->setSliceWidthInTiles ( i, 1 ); - pcPPS->setSliceHeightInTiles( i, 1 ); - pcPPS->setNumSlicesInTile ( i, numSlicesInTile ); - pcPPS->setSliceTileIdx ( i, tileIdx ); - } - } -#endif // tile index offset to start of next slice if( i < pcPPS->getNumSlicesInPic()-1 ) @@ -713,9 +642,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_CODE(1, uiCode, "loop_filter_across_slices_enabled_flag"); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode == 1 ); } -#if !JVET_Q0151_Q0205_ENTRYPOINTS - READ_FLAG(uiCode, "entropy_coding_sync_enabled_flag"); pcPPS->setEntropyCodingSyncEnabledFlag(uiCode == 1); -#endif READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); @@ -731,17 +657,11 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - READ_UVLC(uiCode, "log2_transform_skip_max_size_minus2"); - pcPPS->setLog2MaxTransformSkipBlockSize(uiCode + 2); -#endif READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG READ_FLAG(uiCode, "pps_chroma_tool_offsets_present_flag"); pcPPS->setPPSChromaToolFlag(uiCode ? true : false); if (pcPPS->getPPSChromaToolFlag()) { -#endif READ_SVLC( iCode, "pps_cb_qp_offset"); pcPPS->setQpOffset(COMPONENT_Cb, iCode); CHECK( pcPPS->getQpOffset(COMPONENT_Cb) < -12, "Invalid Cb QP offset" ); @@ -807,7 +727,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) } CHECK(pcPPS->getChromaQpOffsetListLen() != tableSizeMinus1 + 1, "Invalid chroma QP offset list length"); } -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG } else { @@ -817,7 +736,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setSliceChromaQpFlag(0); pcPPS->clearChromaQpOffsetList(); } -#endif READ_FLAG( uiCode, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) pcPPS->setUseWP( uiCode==1 ); @@ -831,7 +749,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_FLAG( uiCode, "pps_deblocking_filter_disabled_flag" ); pcPPS->setPPSDeblockingFilterDisabledFlag(uiCode ? true : false ); if(!pcPPS->getPPSDeblockingFilterDisabledFlag()) { -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS READ_SVLC( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode ); CHECK( pcPPS->getDeblockingFilterBetaOffsetDiv2() < -12 || pcPPS->getDeblockingFilterBetaOffsetDiv2() > 12, "Invalid deblocking filter configuration" ); @@ -855,10 +772,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_SVLC( iCode, "pps_cr_tc_offset_div2"); pcPPS->setDeblockingFilterCrTcOffsetDiv2( iCode ); CHECK( pcPPS->getDeblockingFilterCrTcOffsetDiv2() < -12 || pcPPS->getDeblockingFilterCrTcOffsetDiv2() > 12, "Invalid deblocking filter configuration" ); -#else - READ_SVLC ( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode ); - READ_SVLC ( iCode, "pps_tc_offset_div2" ); pcPPS->setDeblockingFilterTcOffsetDiv2( iCode ); -#endif } } else @@ -866,7 +779,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setDeblockingFilterOverrideEnabledFlag(false); } -#if JVET_Q0819_PH_CHANGES READ_FLAG(uiCode, "rpl_info_in_ph_flag"); pcPPS->setRplInfoInPhFlag(uiCode ? true : false); if( pcPPS->getDeblockingFilterOverrideEnabledFlag() ) { @@ -884,38 +796,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setWpInfoInPhFlag(false); } READ_FLAG(uiCode, "qp_delta_info_in_ph_flag"); pcPPS->setQpDeltaInfoInPhFlag(uiCode ? true : false); -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - READ_FLAG( uiCode, "constant_slice_header_params_enabled_flag"); pcPPS->setConstantSliceHeaderParamsEnabledFlag(uiCode); - if ( pcPPS->getConstantSliceHeaderParamsEnabledFlag() ) { - READ_CODE( 2, uiCode, "pps_dep_quant_enabled_idc"); pcPPS->setPPSDepQuantEnabledIdc(uiCode); - READ_CODE( 2, uiCode, "pps_ref_pic_list_sps_idc[0]"); pcPPS->setPPSRefPicListSPSIdc0(uiCode); - READ_CODE( 2, uiCode, "pps_ref_pic_list_sps_idc[1]"); pcPPS->setPPSRefPicListSPSIdc1(uiCode); - READ_CODE( 2, uiCode, "pps_mvd_l1_zero_idc"); pcPPS->setPPSMvdL1ZeroIdc(uiCode); - READ_CODE( 2, uiCode, "pps_collocated_from_l0_idc"); pcPPS->setPPSCollocatedFromL0Idc(uiCode); - READ_UVLC( uiCode, "pps_six_minus_max_num_merge_cand_plus1"); pcPPS->setPPSSixMinusMaxNumMergeCandPlus1(uiCode); -#if !JVET_Q0806 - READ_UVLC( uiCode, "pps_max_num_merge_cand_minus_max_num_triangle_cand_plus1");pcPPS->setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(uiCode); -#else - READ_UVLC(uiCode, "pps_max_num_merge_cand_minus_max_num_gpm_cand_plus1"); pcPPS->setPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1(uiCode); -#endif - } - else - { - pcPPS->setPPSDepQuantEnabledIdc(0); - pcPPS->setPPSRefPicListSPSIdc0(0); - pcPPS->setPPSRefPicListSPSIdc1(0); - pcPPS->setPPSMvdL1ZeroIdc(0); - pcPPS->setPPSCollocatedFromL0Idc(0); - pcPPS->setPPSSixMinusMaxNumMergeCandPlus1(0); -#if !JVET_Q0806 - pcPPS->setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(0); -#else - pcPPS->setPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1(0); -#endif - } -#endif READ_FLAG( uiCode, "picture_header_extension_present_flag"); @@ -927,63 +808,10 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_FLAG( uiCode, "pps_extension_present_flag"); if (uiCode) { -#if !REMOVE_PPS_REXT -#if ENABLE_TRACING || RExt__DECODER_DEBUG_BIT_STATISTICS - static const char *syntaxStrings[]={ "pps_range_extension_flag", - "pps_multilayer_extension_flag", - "pps_extension_6bits[0]", - "pps_extension_6bits[1]", - "pps_extension_6bits[2]", - "pps_extension_6bits[3]", - "pps_extension_6bits[4]", - "pps_extension_6bits[5]" }; -#endif - - bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS]; - for(int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) - { - READ_FLAG( uiCode, syntaxStrings[i] ); - pps_extension_flags[i] = uiCode!=0; - } - - bool bSkipTrailingExtensionBits=false; - for(int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. - { - if (pps_extension_flags[i]) - { - switch (PPSExtensionFlagIndex(i)) - { - case PPS_EXT__REXT: - { - PPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); - CHECK(bSkipTrailingExtensionBits, "Invalid state"); - - READ_FLAG( uiCode, "cross_component_prediction_enabled_flag"); - ppsRangeExtension.setCrossComponentPredictionEnabledFlag(uiCode != 0); -#if !JVET_Q0441_SAO_MOD_12_BIT - READ_UVLC( uiCode, "log2_sao_offset_scale_luma"); - ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, uiCode); - READ_UVLC( uiCode, "log2_sao_offset_scale_chroma"); - ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, uiCode); -#endif - } - break; - default: - bSkipTrailingExtensionBits=true; - break; - } - } - } - if (bSkipTrailingExtensionBits) - { -#endif while ( xMoreRbspData() ) { READ_FLAG( uiCode, "pps_extension_data_flag"); } -#if !REMOVE_PPS_REXT - } -#endif } xReadRbspTrailingBits(); } @@ -1036,7 +864,6 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) READ_FLAG(code, "alf_chroma_new_filter"); param.newFilterFlag[CHANNEL_TYPE_CHROMA] = code; -#if JVET_Q0795_CCALF CcAlfFilterParam ccAlfParam = aps->getCcAlfAPSParam(); READ_FLAG(code, "alf_cc_cb_filter_signal_flag"); ccAlfParam.newCcAlfFilter[COMPONENT_Cb - 1] = code; @@ -1046,16 +873,11 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) && ccAlfParam.newCcAlfFilter[COMPONENT_Cb - 1] == 0 && ccAlfParam.newCcAlfFilter[COMPONENT_Cr - 1] == 0, "bitstream conformance error: one of alf_luma_filter_signal_flag, alf_chroma_filter_signal_flag, " "alf_cross_component_cb_filter_signal_flag, and alf_cross_component_cr_filter_signal_flag shall be nonzero"); -#endif if (param.newFilterFlag[CHANNEL_TYPE_LUMA]) { READ_FLAG(code, "alf_luma_clip"); -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG param.nonLinearFlag[CHANNEL_TYPE_LUMA] = code ? true : false; -#else - param.nonLinearFlag[CHANNEL_TYPE_LUMA][0] = code ? true : false; -#endif READ_UVLC(code, "alf_luma_num_filters_signalled_minus1"); param.numLumaFilters = code + 1; if (param.numLumaFilters > 1) @@ -1075,10 +897,8 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) } if (param.newFilterFlag[CHANNEL_TYPE_CHROMA]) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG READ_FLAG(code, "alf_nonlinear_enable_flag_chroma"); param.nonLinearFlag[CHANNEL_TYPE_CHROMA] = code ? true : false; -#endif if( MAX_NUM_ALF_ALTERNATIVES_CHROMA > 1 ) READ_UVLC( code, "alf_chroma_num_alts_minus1" ); @@ -1089,15 +909,10 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) for( int altIdx=0; altIdx < param.numAlternativesChroma; ++altIdx ) { -#if !JVET_Q0249_ALF_CHROMA_CLIPFLAG - READ_FLAG(code, "alf_nonlinear_enable_flag_chroma"); - param.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] = code ? true : false; -#endif alfFilter( param, true, altIdx ); } } -#if JVET_Q0795_CCALF for (int ccIdx = 0; ccIdx < 2; ccIdx++) { if (ccAlfParam.newCcAlfFilter[ccIdx]) @@ -1150,7 +965,6 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) } } aps->setCcAlfAPSParam(ccAlfParam); -#endif aps->setAlfAPSParam(param); } @@ -1194,7 +1008,6 @@ void HLSyntaxReader::parseScalingListAps( APS* aps ) parseScalingList( &info ); } -#if JVET_Q0042_VUI void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) { #if ENABLE_TRACING @@ -1247,62 +1060,7 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) } } -#else -void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) -{ -#if ENABLE_TRACING - DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n"); -#endif - - - uint32_t symbol; - - READ_FLAG( symbol, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(symbol); - if (pcVUI->getAspectRatioInfoPresentFlag()) - { - READ_FLAG( symbol, "aspect_ratio_constant_flag"); pcVUI->setAspectRatioConstantFlag(symbol); - READ_CODE(8, symbol, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(symbol); - if (pcVUI->getAspectRatioIdc() == 255) - { - READ_CODE(16, symbol, "sar_width"); pcVUI->setSarWidth(symbol); - READ_CODE(16, symbol, "sar_height"); pcVUI->setSarHeight(symbol); - } - } - - READ_FLAG( symbol, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(symbol); - if (pcVUI->getColourDescriptionPresentFlag()) - { - READ_CODE(8, symbol, "colour_primaries"); pcVUI->setColourPrimaries(symbol); - READ_CODE(8, symbol, "transfer_characteristics"); pcVUI->setTransferCharacteristics(symbol); - READ_CODE(8, symbol, "matrix_coeffs"); pcVUI->setMatrixCoefficients(symbol); - READ_FLAG( symbol, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(symbol); - } - - READ_FLAG( symbol, "field_seq_flag"); pcVUI->setFieldSeqFlag(symbol); - - READ_FLAG( symbol, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(symbol); - if (pcVUI->getChromaLocInfoPresentFlag()) - { - if(pcVUI->getFieldSeqFlag()) - { - READ_UVLC( symbol, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(symbol); - READ_UVLC( symbol, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(symbol); - } - else - { - READ_UVLC( symbol, "chroma_sample_loc_type" ); pcVUI->setChromaSampleLocType(symbol); - } - } - - READ_FLAG( symbol, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(symbol); - if (pcVUI->getOverscanInfoPresentFlag()) - { - READ_FLAG( symbol, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(symbol); - } -} -#endif -#if JVET_P0118_HRD_ASPECTS void HLSyntaxReader::parseGeneralHrdParameters(GeneralHrdParams *hrd) { uint32_t symbol; @@ -1326,34 +1084,12 @@ void HLSyntaxReader::parseGeneralHrdParameters(GeneralHrdParams *hrd) READ_UVLC(symbol, "hrd_cpb_cnt_minus1"); hrd->setHrdCpbCntMinus1(symbol); CHECK(symbol > 31,"The value of hrd_cpb_cnt_minus1 shall be in the range of 0 to 31, inclusive"); } -#endif -#if JVET_P0118_HRD_ASPECTS void HLSyntaxReader::parseOlsHrdParameters(GeneralHrdParams * generalHrd, OlsHrdParams *olsHrd, uint32_t firstSubLayer, uint32_t maxNumSubLayersMinus1) { uint32_t symbol; -#else -void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLayer, uint32_t maxNumSubLayersMinus1) -{ - uint32_t symbol; - READ_FLAG( symbol, "general_nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( symbol == 1 ? true : false ); - READ_FLAG( symbol, "general_vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( symbol == 1 ? true : false ); - READ_FLAG( symbol, "general_decoding_unit_hrd_params_present_flag" ); hrd->setGeneralDecodingUnitHrdParamsPresentFlag( symbol == 1 ? true : false ); - - if( hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ) - { - READ_CODE( 8, symbol, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( symbol ); - } - READ_CODE( 4, symbol, "bit_rate_scale" ); hrd->setBitRateScale( symbol ); - READ_CODE( 4, symbol, "cpb_size_scale" ); hrd->setCpbSizeScale( symbol ); - if( hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ) - { - READ_CODE( 4, symbol, "cpb_size_du_scale" ); hrd->setCpbSizeDuScale( symbol ); - } -#endif for( int i = firstSubLayer; i <= maxNumSubLayersMinus1; i ++ ) { -#if JVET_P0118_HRD_ASPECTS OlsHrdParams *hrd = &(olsHrd[i]); READ_FLAG(symbol, "fixed_pic_rate_general_flag"); hrd->setFixedPicRateGeneralFlag(symbol == 1 ? true : false); if (!hrd->getFixedPicRateGeneralFlag()) @@ -1375,69 +1111,27 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLay { READ_FLAG(symbol, "low_delay_hrd_flag"); hrd->setLowDelayHrdFlag(symbol == 1 ? true : false); } -#else - READ_FLAG( symbol, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, symbol == 1 ? true : false ); - if( !hrd->getFixedPicRateFlag( i ) ) - { - READ_FLAG( symbol, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, symbol == 1 ? true : false ); - } - else - { - hrd->setFixedPicRateWithinCvsFlag( i, true ); - } - - hrd->setLowDelayHrdFlag( i, false ); // Inferred to be 0 when not present - hrd->setCpbCntMinus1 ( i, 0 ); // Inferred to be 0 when not present - - if( hrd->getFixedPicRateWithinCvsFlag( i ) ) - { - READ_UVLC( symbol, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, symbol ); - } - else - { - READ_FLAG( symbol, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, symbol == 1 ? true : false ); - } - if (!hrd->getLowDelayHrdFlag( i )) - { - READ_UVLC( symbol, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, symbol ); - } -#endif for( int nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) { -#if JVET_P0118_HRD_ASPECTS if (((nalOrVcl == 0) && (generalHrd->getGeneralNalHrdParametersPresentFlag())) || ((nalOrVcl == 1) && (generalHrd->getGeneralVclHrdParametersPresentFlag()))) { for (int j = 0; j <= (generalHrd->getHrdCpbCntMinus1()); j++) { READ_UVLC(symbol, "bit_rate_value_minus1"); hrd->setBitRateValueMinus1(j, nalOrVcl, symbol); READ_UVLC(symbol, "cpb_size_value_minus1"); hrd->setCpbSizeValueMinus1(j, nalOrVcl, symbol); -#else - if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) - { - for( int j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) - { - READ_UVLC( symbol, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, symbol ); - READ_UVLC( symbol, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, symbol ); -#endif -#if JVET_P0118_HRD_ASPECTS if (generalHrd->getGeneralDecodingUnitHrdParamsPresentFlag()) { READ_UVLC(symbol, "bit_rate_du_value_minus1"); hrd->setDuBitRateValueMinus1(j, nalOrVcl, symbol); READ_UVLC(symbol, "cpb_size_du_value_minus1"); hrd->setDuCpbSizeValueMinus1(j, nalOrVcl, symbol); } READ_FLAG(symbol, "cbr_flag"); hrd->setCbrFlag(j, nalOrVcl, symbol == 1 ? true : false); -#else - READ_FLAG( symbol, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, symbol == 1 ? true : false ); -#endif } } } } for (int i = 0; i < firstSubLayer; i++) { -#if JVET_P0118_HRD_ASPECTS OlsHrdParams* hrdHighestTLayer = &(olsHrd[maxNumSubLayersMinus1]); OlsHrdParams* hrdTemp = &(olsHrd[i]); bool tempFlag = hrdHighestTLayer->getFixedPicRateGeneralFlag(); @@ -1446,21 +1140,12 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLay hrdTemp->setFixedPicRateWithinCvsFlag(tempFlag); uint32_t tempElementDurationInTcMinus1 = hrdHighestTLayer->getElementDurationInTcMinus1(); hrdTemp->setElementDurationInTcMinus1(tempElementDurationInTcMinus1); -#endif for (int nalOrVcl = 0; nalOrVcl < 2; nalOrVcl++) { -#if JVET_P0118_HRD_ASPECTS if (((nalOrVcl == 0) && (generalHrd->getGeneralNalHrdParametersPresentFlag())) || ((nalOrVcl == 1) && (generalHrd->getGeneralVclHrdParametersPresentFlag()))) { for (int j = 0; j <= (generalHrd->getHrdCpbCntMinus1()); j++) -#else - if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) - { - for (int j = 0; j <= (hrd->getCpbCntMinus1(i)); j++) -#endif { -#if JVET_P0118_HRD_ASPECTS uint32_t bitRate = hrdHighestTLayer->getBitRateValueMinus1(j, nalOrVcl); hrdTemp->setBitRateValueMinus1(j, nalOrVcl, bitRate); uint32_t cpbSize = hrdHighestTLayer->getCpbSizeValueMinus1(j, nalOrVcl); @@ -1474,21 +1159,12 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLay } bool flag = hrdHighestTLayer->getCbrFlag(j, nalOrVcl); hrdTemp->setCbrFlag(j, nalOrVcl, flag); -#else - uint32_t bitRate = hrd->getBitRateValueMinus1(maxNumSubLayersMinus1, j, nalOrVcl); - hrd->setBitRateValueMinus1(i, j, nalOrVcl, bitRate); - uint32_t cpbSize = hrd->getCpbSizeValueMinus1(maxNumSubLayersMinus1, j, nalOrVcl); - hrd->setCpbSizeValueMinus1(i, j, nalOrVcl, cpbSize); - bool flag = hrd->getCbrFlag(maxNumSubLayersMinus1, j, nalOrVcl); - hrd->setCbrFlag(i, j, nalOrVcl, flag); -#endif } } } } } -#if JVET_P0117_PTL_SCALABILITY void HLSyntaxReader::dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, SPS *pcSPS) { uint32_t code; @@ -1502,9 +1178,7 @@ void HLSyntaxReader::dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFla pcSPS->setMaxLatencyIncreasePlus1(code, i); } } -#endif -#if JVET_Q0400_EXTRA_BITS void HLSyntaxReader::parseExtraPHBitsStruct( SPS *sps, int numBytes ) { uint32_t symbol; @@ -1534,7 +1208,6 @@ void HLSyntaxReader::parseExtraSHBitsStruct( SPS *sps, int numBytes ) sps->setExtraSHBitPresentFlags(presentFlags); } -#endif void HLSyntaxReader::parseSPS(SPS* pcSPS) { @@ -1544,43 +1217,23 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) xTraceSPSHeader (); #endif -#if JVET_Q0117_PARAMETER_SETS_CLEANUP READ_CODE(4, uiCode, "sps_seq_parameter_set_id"); pcSPS->setSPSId(uiCode); -#else - READ_CODE( 4, uiCode, "sps_decoding_parameter_set_id"); pcSPS->setDecodingParameterSetId( uiCode ); -#endif READ_CODE( 4, uiCode, "sps_video_parameter_set_id" ); pcSPS->setVPSId( uiCode ); READ_CODE(3, uiCode, "sps_max_sub_layers_minus1"); pcSPS->setMaxTLayers (uiCode + 1); CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled"); -#if JVET_P0117_PTL_SCALABILITY READ_CODE(4, uiCode, "sps_reserved_zero_4bits"); CHECK(uiCode != 0, "sps_reserved_zero_4bits not equal to zero"); READ_FLAG(uiCode, "sps_ptl_dpb_hrd_params_present_flag"); pcSPS->setPtlDpbHrdParamsPresentFlag(uiCode); -#else - READ_CODE(5, uiCode, "sps_reserved_zero_5bits"); - CHECK(uiCode != 0, "sps_reserved_zero_5bits not equal to zero"); -#endif -#if JVET_P0117_PTL_SCALABILITY if (pcSPS->getPtlDpbHrdParamsPresentFlag()) { -#endif -#if JVET_Q0786_PTL_only parseProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1); -#else - parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); -#endif -#if JVET_P0117_PTL_SCALABILITY } -#endif READ_FLAG(uiCode, "gdr_enabled_flag"); pcSPS->setGDREnabledFlag(uiCode); -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - READ_CODE(4, uiCode, "sps_seq_parameter_set_id"); pcSPS->setSPSId(uiCode); -#endif READ_CODE(2, uiCode, "chroma_format_idc"); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); if( pcSPS->getChromaFormatIdc() == CHROMA_444 ) @@ -1589,22 +1242,15 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setSeparateColourPlaneFlag( uiCode != 0 ); } -#if JVET_Q0043_RPR_and_Subpics READ_FLAG( uiCode, "res_change_in_clvs_allowed_flag" ); pcSPS->setRprEnabledFlag( uiCode ); -#else - READ_FLAG( uiCode, "ref_pic_resampling_enabled_flag" ); pcSPS->setRprEnabledFlag( uiCode ); -#endif -#if JVET_Q0114_CONSTRAINT_FLAGS if (pcSPS->getProfileTierLevel()->getConstraintInfo()->getNoResChangeInClvsConstraintFlag()) { CHECK(uiCode != 0, "When no_res_change_in_clvs_constraint_flag is equal to 1, res_change_in_clvs_allowed_flag shall be equal to 0"); } -#endif READ_UVLC( uiCode, "pic_width_max_in_luma_samples" ); pcSPS->setMaxPicWidthInLumaSamples( uiCode ); READ_UVLC( uiCode, "pic_height_max_in_luma_samples" ); pcSPS->setMaxPicHeightInLumaSamples( uiCode ); -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS READ_FLAG(uiCode, "sps_conformance_window_flag"); if (uiCode != 0) { @@ -1614,51 +1260,25 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC(uiCode, "sps_conf_win_top_offset"); conf.setWindowTopOffset(uiCode); READ_UVLC(uiCode, "sps_conf_win_bottom_offset"); conf.setWindowBottomOffset(uiCode); } -#endif -#if JVET_Q0265 const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc(); -#endif READ_CODE(2, uiCode, "sps_log2_ctu_size_minus5"); pcSPS->setCTUSize(1 << (uiCode + 5)); CHECK(uiCode > 2, "sps_log2_ctu_size_minus5 must be less than or equal to 2"); unsigned ctbLog2SizeY = uiCode + 5; -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - pcSPS->setMaxCodingDepth(uiCode+3); - pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode+3); -#endif pcSPS->setMaxCUWidth(pcSPS->getCTUSize()); pcSPS->setMaxCUHeight(pcSPS->getCTUSize()); -#if JVET_Q0043_RPR_and_Subpics | JVET_Q0119_CLEANUPS -#if JVET_Q0119_CLEANUPS READ_FLAG( uiCode, "subpic_info_present_flag" ); pcSPS->setSubPicInfoPresentFlag(uiCode); -#else - READ_FLAG( uiCode, "subpic_info_present_flag" ); pcSPS->setSubPicPresentFlag(uiCode); -#endif -#else - READ_FLAG( uiCode, "subpics_present_flag" ); pcSPS->setSubPicPresentFlag(uiCode); -#endif -#if JVET_Q0119_CLEANUPS if (pcSPS->getSubPicInfoPresentFlag()) -#else - if (pcSPS->getSubPicPresentFlag()) -#endif { -#if JVET_Q0119_CLEANUPS READ_UVLC(uiCode, "sps_num_subpics_minus1"); pcSPS->setNumSubPics(uiCode + 1); CHECK(uiCode > (pcSPS->getMaxPicWidthInLumaSamples() / (1 << pcSPS->getCTUSize())) * (pcSPS->getMaxPicHeightInLumaSamples() / (1 << pcSPS->getCTUSize())) - 1, "Invalid sps_num_subpics_minus1 value"); -#else - READ_CODE(8, uiCode, "sps_num_subpics_minus1"); pcSPS->setNumSubPics(uiCode + 1); -#endif -#if JVET_Q0114_CONSTRAINT_FLAGS if (pcSPS->getProfileTierLevel()->getConstraintInfo()->getOneSubpicPerPicConstraintFlag()) { CHECK(uiCode != 0, "When one_subpic_per_pic_constraint_flag is equal to 1, each picture shall contain only one subpicture"); } -#endif -#if JVET_Q0816 if( pcSPS->getNumSubPics() == 1 ) { pcSPS->setSubPicCtuTopLeftX( 0, 0 ); @@ -1670,15 +1290,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } else { -#endif for (int picIdx = 0; picIdx < pcSPS->getNumSubPics(); picIdx++) { -#if JVET_Q0787_SUBPIC -#if JVET_Q0222_SUBPICTURE_SIGNALLING if ((picIdx > 0) && (pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize())) -#else - if (pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize()) -#endif { READ_CODE(ceilLog2((pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), uiCode, "subpic_ctu_top_left_x[ i ]"); pcSPS->setSubPicCtuTopLeftX(picIdx, uiCode); @@ -1687,11 +1301,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { pcSPS->setSubPicCtuTopLeftX(picIdx, 0); } -#if JVET_Q0222_SUBPICTURE_SIGNALLING if ((picIdx > 0) && (pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize())) -#else - if (pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize()) -#endif { READ_CODE(ceilLog2((pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), uiCode, "subpic_ctu_top_left_y[ i ]"); pcSPS->setSubPicCtuTopLeftY(picIdx, uiCode); @@ -1700,72 +1310,31 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { pcSPS->setSubPicCtuTopLeftY(picIdx, 0); } -#if JVET_Q0413_SKIP_LAST_SUBPIC_SIG if (picIdx <pcSPS->getNumSubPics()-1 && pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize()) -#else - if (pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize()) -#endif { READ_CODE(ceilLog2((pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), uiCode, "subpic_width_minus1[ i ]"); pcSPS->setSubPicWidth(picIdx, uiCode + 1); } else { -#if JVET_Q0413_SKIP_LAST_SUBPIC_SIG pcSPS->setSubPicWidth(picIdx, (pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) /pcSPS->getCTUSize() - pcSPS->getSubPicCtuTopLeftX(picIdx)); -#else - pcSPS->setSubPicWidth(picIdx, 1); -#endif } -#if JVET_Q0413_SKIP_LAST_SUBPIC_SIG if (picIdx <pcSPS->getNumSubPics() - 1 && pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize()) -#else - if (pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize()) -#endif { READ_CODE(ceilLog2((pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), uiCode, "subpic_height_minus1[ i ]"); pcSPS->setSubPicHeight(picIdx, uiCode + 1); } else { -#if JVET_Q0413_SKIP_LAST_SUBPIC_SIG pcSPS->setSubPicHeight(picIdx, (pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) /pcSPS->getCTUSize() - pcSPS->getSubPicCtuTopLeftY(picIdx)); -#else - pcSPS->setSubPicHeight(picIdx, 1); -#endif } -#else -#if JVET_Q0222_SUBPICTURE_SIGNALLING - if (picIdx > 0) - { -#endif - READ_CODE(std::max(1, ceilLog2(((pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2(pcSPS->getCTUSize())))), uiCode, "subpic_ctu_top_left_x[ i ]"); - pcSPS->setSubPicCtuTopLeftX(picIdx, uiCode); - READ_CODE(std::max(1, ceilLog2(((pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2(pcSPS->getCTUSize())))), uiCode, "subpic_ctu_top_left_y[ i ]"); - pcSPS->setSubPicCtuTopLeftY(picIdx, uiCode); -#if JVET_Q0222_SUBPICTURE_SIGNALLING - } - else - { - pcSPS->setSubPicCtuTopLeftX(picIdx, 0); - pcSPS->setSubPicCtuTopLeftY(picIdx, 0); - } -#endif - READ_CODE(std::max(1, ceilLog2(((pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2(pcSPS->getCTUSize())))), uiCode, "subpic_width_minus1[ i ]"); - pcSPS->setSubPicWidth(picIdx, uiCode + 1); - READ_CODE(std::max(1, ceilLog2(((pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2(pcSPS->getCTUSize())))), uiCode, "subpic_height_minus1[ i ]"); - pcSPS->setSubPicHeight(picIdx, uiCode + 1); -#endif READ_FLAG(uiCode, "subpic_treated_as_pic_flag[ i ]"); pcSPS->setSubPicTreatedAsPicFlag(picIdx, uiCode); READ_FLAG(uiCode, "loop_filter_across_subpic_enabled_flag[ i ]"); pcSPS->setLoopFilterAcrossSubpicEnabledFlag(picIdx, uiCode); } -#if JVET_Q0816 } -#endif -#if JVET_Q0119_CLEANUPS READ_UVLC( uiCode, "sps_subpic_id_len_minus1" ); pcSPS->setSubPicIdLen( uiCode + 1 ); CHECK( uiCode > 15, "Invalid sps_subpic_id_len_minus1 value" ); CHECK( (1 << (uiCode + 1)) < pcSPS->getNumSubPics(), "Invalid sps_subpic_id_len_minus1 value" ); @@ -1781,13 +1350,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } } } -#endif } else { -#if JVET_Q0119_CLEANUPS pcSPS->setSubPicIdMappingExplicitlySignalledFlag(0); -#endif pcSPS->setNumSubPics(1); pcSPS->setSubPicCtuTopLeftX(0, 0); pcSPS->setSubPicCtuTopLeftY(0, 0); @@ -1795,28 +1361,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setSubPicHeight(0, (pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2(pcSPS->getCTUSize())); } -#if !JVET_Q0119_CLEANUPS - READ_FLAG(uiCode, "sps_subpic_id_present_flag"); pcSPS->setSubPicIdPresentFlag( uiCode != 0 ); - if( pcSPS->getSubPicIdPresentFlag() ) - { - READ_FLAG(uiCode, "sps_subpic_id_signalling_present_flag"); pcSPS->setSubPicIdSignallingPresentFlag( uiCode != 0 ); - if( pcSPS->getSubPicIdSignallingPresentFlag() ) - { - READ_UVLC( uiCode, "sps_subpic_id_len_minus1" ); pcSPS->setSubPicIdLen( uiCode + 1 ); - CHECK( uiCode > 15, "Invalid sps_subpic_id_len_minus1 signalled"); -#if JVET_Q0169_SUBPIC_LEN_CONFORM - CHECK((1 << pcSPS->getSubPicIdLen()) < pcSPS->getNumSubPics(), "sps_subpic_id_len exceeds valid range"); -#endif - for( int picIdx = 0; picIdx < pcSPS->getNumSubPics( ); picIdx++ ) - { - READ_CODE( pcSPS->getSubPicIdLen( ), uiCode, "sps_subpic_id[i]" ); pcSPS->setSubPicId( picIdx, uiCode ); - } - } - } - if( pcSPS->getSubPicIdPresentFlag() == false || pcSPS->getSubPicIdSignallingPresentFlag() == false ) -#else if( !pcSPS->getSubPicIdMappingExplicitlySignalledFlag() || !pcSPS->getSubPicIdMappingInSpsFlag() ) -#endif { for( int picIdx = 0; picIdx < pcSPS->getNumSubPics( ); picIdx++ ) { @@ -1830,20 +1375,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (int) (6*uiCode) ); pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (int) (6*uiCode) ); -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - READ_UVLC( uiCode, "min_qp_prime_ts_minus4" ); - pcSPS->setMinQpPrimeTsMinus4(CHANNEL_TYPE_LUMA, uiCode); - CHECK(uiCode > 48, "Invalid min_qp_prime_ts_minus4 signalled"); - pcSPS->setMinQpPrimeTsMinus4(CHANNEL_TYPE_CHROMA, uiCode); -#endif -#if JVET_Q0151_Q0205_ENTRYPOINTS READ_FLAG( uiCode, "sps_entropy_coding_sync_enabled_flag" ); pcSPS->setEntropyCodingSyncEnabledFlag(uiCode == 1); if (pcSPS->getEntropyCodingSyncEnabledFlag()) { READ_FLAG(uiCode, "sps_wpp_entry_point_offsets_present_flag"); pcSPS->setEntropyCodingSyncEntryPointsPresentFlag(uiCode == 1); } -#endif READ_FLAG( uiCode, "sps_weighted_pred_flag" ); pcSPS->setUseWP( uiCode ? true : false ); READ_FLAG( uiCode, "sps_weighted_bipred_flag" ); pcSPS->setUseWPBiPred( uiCode ? true : false ); @@ -1851,25 +1388,20 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_CODE(4, uiCode, "log2_max_pic_order_cnt_lsb_minus4"); pcSPS->setBitsForPOC( 4 + uiCode ); CHECK(uiCode > 12, "Invalid code"); -#if JVET_P0116_POC_MSB READ_FLAG(uiCode, "sps_poc_msb_flag"); pcSPS->setPocMsbFlag(uiCode ? true : false); if (pcSPS->getPocMsbFlag()) { READ_UVLC(uiCode, "poc_msb_len_minus1"); pcSPS->setPocMsbLen(1 + uiCode); CHECK(uiCode > (32 - ( pcSPS->getBitsForPOC() - 4 )- 5), "The value of poc_msb_len_minus1 shall be in the range of 0 to 32 - log2_max_pic_order_cnt_lsb_minus4 - 5, inclusive"); } -#endif -#if JVET_Q0400_EXTRA_BITS // extra bits are for future extensions, we will read, but ignore them, // unless a meaning is specified in the spec READ_CODE(2, uiCode, "num_extra_ph_bits_bytes"); pcSPS->setNumExtraPHBitsBytes(uiCode); parseExtraPHBitsStruct( pcSPS, uiCode ); READ_CODE(2, uiCode, "num_extra_sh_bits_bytes"); pcSPS->setNumExtraSHBitsBytes(uiCode); parseExtraSHBitsStruct( pcSPS, uiCode ); -#endif -#if JVET_P0117_PTL_SCALABILITY if (pcSPS->getMaxTLayers() - 1 > 0) { READ_FLAG(uiCode, "sps_sublayer_dpb_params_flag"); pcSPS->setSubLayerDpbParamsFlag(uiCode ? true : false); @@ -1878,39 +1410,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { dpb_parameters(pcSPS->getMaxTLayers() - 1, pcSPS->getSubLayerDpbParamsFlag(), pcSPS); } -#else - // KJS: Marakech decision: sub-layers added back - uint32_t subLayerOrderingInfoPresentFlag; - if (pcSPS->getMaxTLayers() > 1) - { - READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); - } - else - { - subLayerOrderingInfoPresentFlag = 0; - } - - for(uint32_t i=0; i <= pcSPS->getMaxTLayers()-1; i++) - { - READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); - pcSPS->setMaxDecPicBuffering( uiCode + 1, i); - READ_UVLC ( uiCode, "sps_max_num_reorder_pics[i]" ); - pcSPS->setNumReorderPics(uiCode, i); - READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); - pcSPS->setMaxLatencyIncreasePlus1( uiCode, i ); - - if (!subLayerOrderingInfoPresentFlag) - { - for (i++; i <= pcSPS->getMaxTLayers()-1; i++) - { - pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); - pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); - pcSPS->setMaxLatencyIncreasePlus1(pcSPS->getMaxLatencyIncreasePlus1(0), i); - } - break; - } - } -#endif READ_FLAG(uiCode, "long_term_ref_pics_flag"); pcSPS->setLongTermRefsPresent(uiCode); READ_FLAG( uiCode, "inter_layer_ref_pics_present_flag" ); pcSPS->setInterLayerPresentFlag( uiCode ); @@ -1973,26 +1472,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) CHECK(uiCode > ctbLog2SizeY - 2, "Invalid log2_min_luma_coding_block_size_minus2 signalled"); CHECK(log2MinCUSize > std::min(6, (int)(ctbLog2SizeY)), "log2_min_luma_coding_block_size_minus2 shall be in the range of 0 to min (4, log2_ctu_size - 2)"); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int minCuSize = 1 << pcSPS->getLog2MinCodingBlockSize(); CHECK( ( pcSPS->getMaxPicWidthInLumaSamples() % ( std::max( 8, minCuSize ) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); CHECK( ( pcSPS->getMaxPicHeightInLumaSamples() % ( std::max( 8, minCuSize ) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#else - CHECK( ( pcSPS->getMaxPicWidthInLumaSamples() % ( std::max( 8, int( pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); - CHECK( ( pcSPS->getMaxPicHeightInLumaSamples() % ( std::max( 8, int( pcSPS->getMaxCUHeight() >> ( pcSPS->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#endif READ_FLAG(uiCode, "partition_constraints_override_enabled_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode); READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_slice_luma"); unsigned minQtLog2SizeIntraY = uiCode + pcSPS->getLog2MinCodingBlockSize(); minQT[0] = 1 << minQtLog2SizeIntraY; -#if !JVET_Q0481_PARTITION_CONSTRAINTS_ORDER - READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_slice"); - unsigned minQtLog2SizeInterY = uiCode + pcSPS->getLog2MinCodingBlockSize(); - minQT[1] = 1 << minQtLog2SizeInterY; - READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_slice"); maxBTD[1] = uiCode; - CHECK(uiCode > 2*(ctbLog2SizeY - log2MinCUSize), "sps_max_mtt_hierarchy_depth_inter_slice shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)"); -#endif READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_slice_luma"); maxBTD[0] = uiCode; CHECK(uiCode > 2 * (ctbLog2SizeY - log2MinCUSize), "sps_max_mtt_hierarchy_depth_intra_slice_luma shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)"); @@ -2004,13 +1491,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_slice_luma"); maxTTSize[0] <<= uiCode; CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "Invalid code"); } -#if JVET_Q0481_PARTITION_CONSTRAINTS_ORDER READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_slice"); unsigned minQtLog2SizeInterY = uiCode + pcSPS->getLog2MinCodingBlockSize(); minQT[1] = 1 << minQtLog2SizeInterY; READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_slice"); maxBTD[1] = uiCode; CHECK(uiCode > 2*(ctbLog2SizeY - log2MinCUSize), "sps_max_mtt_hierarchy_depth_inter_slice shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)"); -#endif maxTTSize[1] = maxBTSize[1] = minQT[1]; if (maxBTD[1] != 0) { @@ -2040,19 +1525,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_max_luma_transform_size_64_flag"); pcSPS->setLog2MaxTbSize( (uiCode ? 1 : 0) + 5 ); -#if JVET_Q0147_JCCR_SIGNALLING -#if JVET_Q0265 if (chromaArrayType != CHROMA_400) -#else - if (pcSPS->getChromaFormatIdc() != CHROMA_400) -#endif { READ_FLAG(uiCode, "sps_joint_cbcr_enabled_flag"); pcSPS->setJointCbCrEnabledFlag(uiCode ? true : false); -#else - READ_FLAG(uiCode, "sps_joint_cbcr_enabled_flag"); pcSPS->setJointCbCrEnabledFlag(uiCode ? true : false); - if (pcSPS->getChromaFormatIdc() != CHROMA_400) - { -#endif ChromaQpMappingTableParams chromaQpMappingTableParams; READ_FLAG(uiCode, "same_qp_table_for_chroma"); chromaQpMappingTableParams.setSameCQPTableForAllChromaFlag(uiCode); int numQpTables = chromaQpMappingTableParams.getSameCQPTableForAllChromaFlag() ? 1 : (pcSPS->getJointCbCrEnabledFlag() ? 3 : 2); @@ -2080,7 +1555,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_sao_enabled_flag" ); pcSPS->setSAOEnabledFlag ( uiCode ? true : false ); READ_FLAG( uiCode, "sps_alf_enabled_flag" ); pcSPS->setALFEnabledFlag ( uiCode ? true : false ); -#if JVET_Q0795_CCALF if (pcSPS->getALFEnabledFlag() && pcSPS->getChromaFormatIdc() != CHROMA_400) { READ_FLAG( uiCode, "sps_ccalf_enabled_flag" ); pcSPS->setCCALFEnabledFlag ( uiCode ? true : false ); @@ -2089,41 +1563,20 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { pcSPS->setCCALFEnabledFlag(false); } -#endif READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false); if (pcSPS->getTransformSkipEnabledFlag()) { -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL READ_UVLC(uiCode, "log2_transform_skip_max_size_minus2"); pcSPS->setLog2MaxTransformSkipBlockSize(uiCode + 2); -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false); -#else - READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 - if( uiCode ) -#else - if (uiCode && pcSPS->getChromaFormatIdc() == CHROMA_444 ) -#endif - { - READ_FLAG(uiCode, "sps_bdpcm_enabled_chroma_flag"); - uiCode++; - } - pcSPS->setBDPCMEnabled(uiCode); -#endif } READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag"); pcSPS->setWrapAroundEnabledFlag( uiCode ? true : false ); if (pcSPS->getWrapAroundEnabledFlag()) { -#if JVET_Q0416_WRAPAROUND_OFFSET READ_UVLC(uiCode, "sps_ref_wraparound_offset"); pcSPS->setWrapAroundOffset((uiCode + 2 + pcSPS->getCTUSize() / (1 << pcSPS->getLog2MinCodingBlockSize()))*(1 << pcSPS->getLog2MinCodingBlockSize())); -#else - READ_UVLC(uiCode, "sps_ref_wraparound_offset_minus1"); pcSPS->setWrapAroundOffset( (uiCode+1)*(1 << pcSPS->getLog2MinCodingBlockSize())); -#endif } READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode); @@ -2180,29 +1633,21 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_explicit_mts_intra_enabled_flag" ); pcSPS->setUseIntraMTS ( uiCode != 0 ); READ_FLAG( uiCode, "sps_explicit_mts_inter_enabled_flag" ); pcSPS->setUseInterMTS ( uiCode != 0 ); } -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); CHECK(MRG_MAX_NUM_CANDS <= uiCode, "Incorrrect max number of merge candidates!"); pcSPS->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); -#endif READ_FLAG(uiCode, "sps_sbt_enabled_flag"); pcSPS->setUseSBT ( uiCode != 0 ); READ_FLAG( uiCode, "sps_affine_enabled_flag" ); pcSPS->setUseAffine ( uiCode != 0 ); if ( pcSPS->getUseAffine() ) { -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE READ_UVLC(uiCode, "five_minus_max_num_subblock_merge_cand"); CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "Incorrrect max number of affine merge candidates!"); pcSPS->setMaxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS - uiCode); -#endif READ_FLAG( uiCode, "sps_affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 ); -#if JVET_Q0444_AMVR_SIGNALLING if( pcSPS->getAMVREnabledFlag()) { -#endif READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); -#if JVET_Q0444_AMVR_SIGNALLING } -#endif READ_FLAG( uiCode, "sps_affine_prof_enabled_flag" ); pcSPS->setUsePROF ( uiCode != 0 ); if (pcSPS->getUsePROF()) { @@ -2212,38 +1657,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setProfControlPresentFlag( false ); } } -#if !JVET_Q0820_ACT -#if JVET_Q0265 - if (chromaArrayType == CHROMA_444) -#else - if (pcSPS->getChromaFormatIdc() == CHROMA_444) -#endif - { - READ_FLAG(uiCode, "sps_act_enabled_flag"); pcSPS->setUseColorTrans(uiCode != 0); - } - else - { - pcSPS->setUseColorTrans(false); - } -#endif -#if JVET_Q0504_PLT_NON444 READ_FLAG( uiCode, "sps_palette_enabled_flag"); pcSPS->setPLTMode ( uiCode != 0 ); -#else - if (pcSPS->getChromaFormatIdc() == CHROMA_444) - { - READ_FLAG( uiCode, "sps_palette_enabled_flag"); pcSPS->setPLTMode ( uiCode != 0 ); - } - else - { - pcSPS->setPLTMode(false); - } -#endif -#if JVET_Q0820_ACT -#if JVET_Q0265 if (chromaArrayType == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6) -#else - if (pcSPS->getChromaFormatIdc() == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6) -#endif { READ_FLAG(uiCode, "sps_act_enabled_flag"); pcSPS->setUseColorTrans(uiCode != 0); } @@ -2251,8 +1666,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { pcSPS->setUseColorTrans(false); } -#endif -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL if (pcSPS->getTransformSkipEnabledFlag() || pcSPS->getPLTMode()) { READ_UVLC(uiCode, "min_qp_prime_ts_minus4"); @@ -2260,10 +1673,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) CHECK(uiCode > 48, "Invalid min_qp_prime_ts_minus4 signalled"); pcSPS->setMinQpPrimeTsMinus4(CHANNEL_TYPE_CHROMA, uiCode); } -#endif READ_FLAG( uiCode, "sps_bcw_enabled_flag" ); pcSPS->setUseBcw( uiCode != 0 ); READ_FLAG(uiCode, "sps_ibc_enabled_flag"); pcSPS->setIBCFlag(uiCode); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pcSPS->getIBCFlag()) { READ_UVLC(uiCode, "six_minus_max_num_ibc_merge_cand"); @@ -2272,7 +1683,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } else pcSPS->setMaxNumIBCMergeCand(0); -#endif // KJS: sps_ciip_enabled_flag READ_FLAG( uiCode, "sps_ciip_enabled_flag" ); pcSPS->setUseCiip ( uiCode != 0 ); @@ -2281,31 +1691,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_fpel_mmvd_enabled_flag" ); pcSPS->setFpelMmvdEnabledFlag ( uiCode != 0 ); } -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - if (pcSPS->getMaxNumMergeCand() >= 2) - { - READ_FLAG(uiCode, "triangle_flag"); - pcSPS->setUseTriangle(uiCode != 0); - if (pcSPS->getUseTriangle() && pcSPS->getMaxNumMergeCand() >= 3) - { - READ_UVLC(uiCode, "max_num_merge_cand_minus_max_num_gpm_cand"); - CHECK(pcSPS->getMaxNumMergeCand() < uiCode, "Incorrrect max number of Triangle candidates!"); - pcSPS->setMaxNumGeoCand((uint32_t)(pcSPS->getMaxNumMergeCand() - uiCode)); - } - else if (pcSPS->getUseTriangle()) - pcSPS->setMaxNumGeoCand(2); - } - else - { - pcSPS->setUseTriangle(0); - pcSPS->setMaxNumGeoCand(0); - } -#else - READ_FLAG( uiCode, "triangle_flag" ); pcSPS->setUseTriangle ( uiCode != 0 ); -#endif -#else -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pcSPS->getMaxNumMergeCand() >= 2) { READ_FLAG(uiCode, "sps_gpm_enabled_flag"); @@ -2324,10 +1709,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setUseGeo(0); pcSPS->setMaxNumGeoCand(0); } -#else - READ_FLAG( uiCode, "sps_gpm_enabled_flag" ); pcSPS->setUseGeo ( uiCode != 0 ); -#endif -#endif READ_FLAG(uiCode, "sps_lmcs_enable_flag"); pcSPS->setUseLmcs(uiCode == 1); READ_FLAG( uiCode, "sps_lfnst_enabled_flag" ); pcSPS->setUseLFNST( uiCode != 0 ); @@ -2347,17 +1728,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } #endif -#if JVET_Q0297_MER READ_UVLC(uiCode, "log2_parallel_merge_level_minus2"); pcSPS->setLog2ParallelMergeLevelMinus2(uiCode); -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH READ_FLAG(uiCode, "sps_explicit_scaling_list_enabled_flag"); pcSPS->setScalingListFlag(uiCode); -#else - READ_FLAG( uiCode, "sps_scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); -#endif -#if DQ_SDH_SIGNALLING READ_FLAG(uiCode, "sps_dep_quant_enabled_flag"); pcSPS->setDepQuantEnabledFlag(uiCode); if (!pcSPS->getDepQuantEnabledFlag()) { @@ -2367,19 +1741,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { pcSPS->setSignDataHidingEnabledFlag(false); } -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG READ_FLAG( uiCode, "sps_virtual_boundaries_enabled_flag" ); pcSPS->setVirtualBoundariesEnabledFlag( uiCode != 0 ); if( pcSPS->getVirtualBoundariesEnabledFlag() ) { READ_FLAG( uiCode, "sps_loop_filter_across_virtual_boundaries_present_flag" ); pcSPS->setVirtualBoundariesPresentFlag( uiCode != 0 ); if( pcSPS->getVirtualBoundariesPresentFlag() ) { -#else - READ_FLAG( uiCode, "sps_loop_filter_across_virtual_boundaries_disabled_present_flag" ); pcSPS->setLoopFilterAcrossVirtualBoundariesDisabledFlag( uiCode != 0 ); - if( pcSPS->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { -#endif READ_CODE( 2, uiCode, "sps_num_ver_virtual_boundaries"); pcSPS->setNumVerVirtualBoundaries( uiCode ); for( unsigned i = 0; i < pcSPS->getNumVerVirtualBoundaries(); i++ ) { @@ -2396,36 +1763,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setNumVerVirtualBoundaries( 0 ); pcSPS->setNumHorVirtualBoundaries( 0 ); } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif -#if JVET_P0117_PTL_SCALABILITY if (pcSPS->getPtlDpbHrdParamsPresentFlag()) { -#endif -#if !JVET_P0118_HRD_ASPECTS - TimingInfo *timingInfo = pcSPS->getTimingInfo(); -#endif -#if JVET_P0118_HRD_ASPECTS READ_FLAG(uiCode, "sps_general_hrd_params_present_flag"); pcSPS->setGeneralHrdParametersPresentFlag(uiCode); -#else - READ_FLAG( uiCode, "general_hrd_parameters_present_flag"); pcSPS->setHrdParametersPresentFlag(uiCode); -#endif -#if JVET_P0118_HRD_ASPECTS if (pcSPS->getGeneralHrdParametersPresentFlag()) -#else - if( pcSPS->getHrdParametersPresentFlag() ) -#endif { -#if !JVET_P0118_HRD_ASPECTS - READ_CODE( 32, uiCode, "num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); - READ_CODE( 32, uiCode, "time_scale"); timingInfo->setTimeScale (uiCode); -#endif -#if JVET_P0118_HRD_ASPECTS parseGeneralHrdParameters(pcSPS->getGeneralHrdParameters()); -#endif -#if JVET_P0118_HRD_ASPECTS if ((pcSPS->getMaxTLayers()-1) > 0) { READ_FLAG(uiCode, "sps_sublayer_cpb_params_present_flag"); pcSPS->setSubLayerParametersPresentFlag(uiCode); @@ -2437,25 +1782,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) uint32_t firstSubLayer = pcSPS->getSubLayerParametersPresentFlag() ? 0 : (pcSPS->getMaxTLayers() - 1); parseOlsHrdParameters(pcSPS->getGeneralHrdParameters(),pcSPS->getOlsHrdParameters(), firstSubLayer, pcSPS->getMaxTLayers() - 1); -#else - READ_FLAG( uiCode, "sub_layer_cpb_parameters_present_flag"); pcSPS->setSubLayerParametersPresentFlag(uiCode); - if (pcSPS->getSubLayerParametersPresentFlag()) - { - parseHrdParameters(pcSPS->getHrdParameters(), 0, pcSPS->getMaxTLayers() - 1); - } - else - { - parseHrdParameters(pcSPS->getHrdParameters(), pcSPS->getMaxTLayers() - 1, pcSPS->getMaxTLayers() - 1); - } -#endif } -#if JVET_P0117_PTL_SCALABILITY } -#endif -#if JVET_Q0042_VUI READ_FLAG( uiCode, "field_seq_flag"); pcSPS->setFieldSeqFlag(uiCode); -#endif READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); @@ -2526,7 +1856,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) xReadRbspTrailingBits(); } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void HLSyntaxReader::parseDCI(DCI* dci) { #if ENABLE_TRACING @@ -2545,11 +1874,7 @@ void HLSyntaxReader::parseDCI(DCI* dci) ptls.resize(numPTLs); for (int i = 0; i < numPTLs; i++) { -#if JVET_Q0786_PTL_only parseProfileTierLevel(&ptls[i], true, 0); -#else - parseProfileTierLevel(&ptls[i], 0); -#endif } dci->setProfileTierLevel(ptls); @@ -2563,48 +1888,6 @@ void HLSyntaxReader::parseDCI(DCI* dci) } xReadRbspTrailingBits(); } -#else -void HLSyntaxReader::parseDPS(DPS* dps) -{ -#if ENABLE_TRACING - xTraceDPSHeader (); -#endif - uint32_t symbol; - - READ_CODE( 4, symbol, "dps_decoding_parameter_set_id" ); - CHECK(symbol == 0, "dps_decoding_parameter_set_id equal to zero is reserved and should not be use in a bitstream"); - dps->setDecodingParameterSetId( symbol ); - - READ_CODE( 3, symbol, "dps_max_sub_layers_minus1" ); dps->setMaxSubLayersMinus1( symbol ); - READ_CODE( 5, symbol, "dps_reserved_zero_5bits" ); CHECK(symbol != 0, "dps_reserved_zero_5bits must be equal to zero"); - - uint32_t numPTLs; - READ_CODE( 4, numPTLs, "dps_num_ptls_minus1" ); - numPTLs += 1; - - std::vector<ProfileTierLevel> ptls; - ptls.resize(numPTLs); - for (int i=0; i<numPTLs; i++) - { -#if JVET_Q0786_PTL_only - parseProfileTierLevel(&ptls[i], true, 0); -#else - parseProfileTierLevel(&ptls[i], dps->getMaxSubLayersMinus1()); -#endif - } - dps->setProfileTierLevel(ptls); - - READ_FLAG( symbol, "dps_extension_flag" ); - if (symbol) - { - while ( xMoreRbspData() ) - { - READ_FLAG( symbol, "dps_extension_data_flag"); - } - } - xReadRbspTrailingBits(); -} -#endif void HLSyntaxReader::parseVPS(VPS* pcVPS) { @@ -2695,7 +1978,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) } } -#if JVET_Q0786_PTL_only pcVPS->deriveOutputLayerSets(); READ_CODE(8, uiCode, "vps_num_ptls_minus1"); pcVPS->setNumPtls(uiCode + 1); for (int i = 0; i < pcVPS->getNumPtls(); i++) @@ -2742,9 +2024,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) else pcVPS->setOlsPtlIdx(i, 0); } -#endif -#if JVET_Q0814_DPB if( !pcVPS->getAllIndependentLayersFlag() ) { READ_UVLC( uiCode, "vps_num_dpb_params" ); pcVPS->m_numDpbParams = uiCode; @@ -2797,9 +2077,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) } } -#if !JVET_Q0786_PTL_only - pcVPS->deriveOutputLayerSets(); -#endif for( int i = 0; i < pcVPS->getTotalNumOLSs(); i++ ) { @@ -2813,8 +2090,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) } } } -#endif -#if JVET_P0118_HRD_ASPECTS if (!pcVPS->getEachLayerIsAnOlsFlag()) { READ_FLAG(uiCode, "vps_general_hrd_params_present_flag"); pcVPS->setVPSGeneralHrdParamsPresentFlag(uiCode); @@ -2876,7 +2151,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) } } } -#endif READ_FLAG(uiCode, "vps_extension_flag"); if (uiCode) @@ -2890,11 +2164,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) xReadRbspTrailingBits(); } -#if JVET_Q0775_PH_IN_SH void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManager *parameterSetManager, bool readRbspTrailingBits ) -#else -void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManager *parameterSetManager ) -#endif { uint32_t uiCode; int iCode; @@ -2905,7 +2175,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag xTracePictureHeader(); #endif -#if JVET_Q0819_PH_CHANGES READ_FLAG(uiCode, "gdr_or_irap_pic_flag"); picHeader->setGdrOrIrapPicFlag(uiCode != 0); if (picHeader->getGdrOrIrapPicFlag()) { @@ -2921,12 +2190,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setPicIntraSliceAllowedFlag(true); } CHECK(picHeader->getPicInterSliceAllowedFlag() == 0 && picHeader->getPicIntraSliceAllowedFlag() == 0, "Invalid picture without intra or inter slice"); -#endif READ_FLAG(uiCode, "non_reference_picture_flag"); picHeader->setNonReferencePictureFlag( uiCode != 0 ); -#if !JVET_Q0819_PH_CHANGES - READ_FLAG(uiCode, "gdr_pic_flag"); picHeader->setGdrPicFlag( uiCode != 0 ); -#endif -#if JVET_Q0819_PH_CHANGES // parameter sets READ_UVLC(uiCode, "ph_pic_parameter_set_id"); picHeader->setPPSId(uiCode); @@ -2941,9 +2205,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag { READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); picHeader->setNoOutputOfPriorPicsFlag(uiCode != 0); } -#else - READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); picHeader->setNoOutputOfPriorPicsFlag( uiCode != 0 ); -#endif if( picHeader->getGdrPicFlag() ) { READ_UVLC(uiCode, "recovery_poc_cnt"); picHeader->setRecoveryPocCnt( uiCode ); @@ -2953,7 +2214,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setRecoveryPocCnt( 0 ); } -#if JVET_Q0400_EXTRA_BITS std::vector<bool> phExtraBitsPresent = sps->getExtraPHBitPresentFlags(); for (int i=0; i< sps->getNumExtraPHBitsBytes() * 8; i++) { @@ -2963,9 +2223,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag READ_FLAG(uiCode, "ph_extra_bit[ i ]"); } } -#endif -#if JVET_P0116_POC_MSB if (sps->getPocMsbFlag()) { READ_FLAG(uiCode, "ph_poc_msb_present_flag"); picHeader->setPocMsbPresentFlag(uiCode != 0); @@ -2975,35 +2233,14 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setPocMsbVal(uiCode); } } -#endif -#if !JVET_Q0819_PH_CHANGES - // parameter sets - READ_UVLC(uiCode, "ph_pic_parameter_set_id"); - picHeader->setPPSId( uiCode ); - pps = parameterSetManager->getPPS(picHeader->getPPSId()); - CHECK(pps==0, "Invalid PPS"); - picHeader->setSPSId( pps->getSPSId() ); - sps = parameterSetManager->getSPS(picHeader->getSPSId()); - CHECK(sps==0, "Invalid SPS"); -#endif -#if JVET_Q0819_PH_CHANGES // alf enable flags and aps IDs -#if JVET_Q0795_CCALF picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, false); picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, false); -#endif if (sps->getALFEnabledFlag()) { -#if JVET_Q0819_PH_CHANGES if (pps->getAlfInfoInPhFlag()) -#else - READ_FLAG(uiCode, "pic_alf_enabled_present_flag"); - picHeader->setAlfEnabledPresentFlag(uiCode != 0); - - if (picHeader->getAlfEnabledPresentFlag()) -#endif { READ_FLAG(uiCode, "ph_alf_enabled_flag"); picHeader->setAlfEnabledFlag(COMPONENT_Y, uiCode); @@ -3032,15 +2269,12 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag { alfChromaIdc = 0; } -#if JVET_Q0358_ALF_NALU_TID_CONSTRAINT picHeader->setAlfChromaIdc(alfChromaIdc); -#endif if (alfChromaIdc) { READ_CODE(3, uiCode, "ph_alf_aps_id_chroma"); picHeader->setAlfApsIdChroma(uiCode); } -#if JVET_Q0795_CCALF if (sps->getCCALFEnabledFlag()) { READ_FLAG(uiCode, "ph_cc_alf_cb_enabled_flag"); @@ -3063,7 +2297,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setCcAlfCrApsId(uiCode); } } -#endif } else { @@ -3115,15 +2348,9 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag // quantization scaling lists if (sps->getScalingListFlag()) { -#if JVET_Q0346_SCALING_LIST_USED_IN_SH READ_FLAG(uiCode, "ph_explicit_scaling_list_enabled_flag"); picHeader->setExplicitScalingListEnabledFlag(uiCode); if (picHeader->getExplicitScalingListEnabledFlag()) -#else - READ_FLAG(uiCode, "ph_scaling_list_present_flag"); - picHeader->setScalingListPresentFlag(uiCode); - if (picHeader->getScalingListPresentFlag()) -#endif { READ_CODE(3, uiCode, "ph_scaling_list_aps_id"); picHeader->setScalingListAPSId(uiCode); @@ -3131,13 +2358,8 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } else { -#if JVET_Q0346_SCALING_LIST_USED_IN_SH picHeader->setExplicitScalingListEnabledFlag(false); -#else - picHeader->setScalingListPresentFlag(false); -#endif } -#endif // initialize tile/slice info for no partitioning case @@ -3156,10 +2378,8 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag pps->setTileIdxDeltaPresentFlag( 0 ); pps->setSliceTileIdx( 0, 0 ); pps->initRectSliceMap(sps); -#if JVET_O1143_SUBPIC_BOUNDARY // when no Pic partition, number of sub picture shall be less than 2 CHECK(pps->getNumSubPics()>=2, "error, no picture partitions, but have equal to or more than 2 sub pictures"); -#endif } else { @@ -3170,72 +2390,17 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } } -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS pps->initSubPic(*sps); -#endif -#if !JVET_Q0119_CLEANUPS - // sub-picture IDs - if( sps->getSubPicIdPresentFlag() ) - { - if( sps->getSubPicIdSignallingPresentFlag() ) - { - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) - { - picHeader->setSubPicId( picIdx, sps->getSubPicId( picIdx ) ); - } - } - else - { - READ_FLAG(uiCode, "ph_subpic_id_signalling_present_flag"); picHeader->setSubPicIdSignallingPresentFlag( uiCode != 0 ); - if( picHeader->getSubPicIdSignallingPresentFlag() ) - { - READ_UVLC( uiCode, "ph_subpic_id_len_minus1" ); picHeader->setSubPicIdLen( uiCode + 1 ); - CHECK( uiCode > 15, "Invalid ph_subpic_id_len_minus1 signalled"); -#if JVET_Q0169_SUBPIC_LEN_CONFORM - CHECK((1 << picHeader->getSubPicIdLen()) < sps->getNumSubPics(), "ph_subpic_id_len exceeds valid range"); -#endif - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) - { - READ_CODE( picHeader->getSubPicIdLen( ), uiCode, "ph_subpic_id[i]" ); picHeader->setSubPicId( picIdx, uiCode ); - } - } - else - { - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) - { - picHeader->setSubPicId( picIdx, pps->getSubPicId( picIdx ) ); - } - } - } - } - else - { - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) - { - picHeader->setSubPicId( picIdx, picIdx ); - } - } -#endif // virtual boundaries -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG if( sps->getVirtualBoundariesEnabledFlag() && !sps->getVirtualBoundariesPresentFlag() ) { READ_FLAG( uiCode, "ph_virtual_boundaries_present_flag" ); picHeader->setVirtualBoundariesPresentFlag( uiCode != 0 ); -#if JVET_Q0210_SUBPIC_VIRTUAL_BOUNDARY_CONSTRAINT CHECK( sps->getSubPicInfoPresentFlag() && picHeader->getVirtualBoundariesPresentFlag(), "When the subpicture info is present, the signalling of the virtual boundary position, if present, shall be in SPS" ); -#endif if( picHeader->getVirtualBoundariesPresentFlag() ) { -#else - if( !sps->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { - READ_FLAG( uiCode, "ph_loop_filter_across_virtual_boundaries_disabled_present_flag" ); picHeader->setLoopFilterAcrossVirtualBoundariesDisabledFlag( uiCode != 0 ); - if( picHeader->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { -#endif READ_CODE( 2, uiCode, "ph_num_ver_virtual_boundaries"); picHeader->setNumVerVirtualBoundaries( uiCode ); for( unsigned i = 0; i < picHeader->getNumVerVirtualBoundaries(); i++ ) { @@ -3255,13 +2420,9 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } else { -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG picHeader->setVirtualBoundariesPresentFlag( sps->getVirtualBoundariesPresentFlag() ); if( picHeader->getVirtualBoundariesPresentFlag() ) { -#else - picHeader->setLoopFilterAcrossVirtualBoundariesDisabledFlag( sps->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ); -#endif picHeader->setNumVerVirtualBoundaries( sps->getNumVerVirtualBoundaries() ); picHeader->setNumHorVirtualBoundaries( sps->getNumHorVirtualBoundaries() ); for( unsigned i = 0; i < 3; i++ ) @@ -3269,23 +2430,9 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setVirtualBoundariesPosX( sps->getVirtualBoundariesPosX(i), i ); picHeader->setVirtualBoundariesPosY( sps->getVirtualBoundariesPosY(i), i ); } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif } -#if !JVET_Q0155_COLOUR_ID - // 4:4:4 colour plane ID - if( sps->getSeparateColourPlaneFlag() ) - { - READ_CODE( 2, uiCode, "colour_plane_id" ); picHeader->setColourPlaneId( uiCode ); - CHECK(uiCode > 2, "colour_plane_id exceeds valid range"); - } - else - { - picHeader->setColourPlaneId( 0 ); - } -#endif // picture output flag if( pps->getOutputFlagPresentFlag() ) @@ -3298,26 +2445,15 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } // reference picture lists -#if JVET_Q0819_PH_CHANGES if (pps->getRplInfoInPhFlag()) -#else - READ_FLAG(uiCode, "pic_rpl_present_flag"); - picHeader->setPicRplPresentFlag(uiCode != 0); - if( picHeader->getPicRplPresentFlag() ) -#endif { bool rplSpsFlag0 = 0; // List0 and List1 for(int listIdx = 0; listIdx < 2; listIdx++) { -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if (sps->getNumRPL(listIdx) > 0 && (listIdx == 0 || (listIdx == 1 && pps->getRpl1IdxPresentFlag()))) -#else - if (sps->getNumRPL(listIdx) > 0 && !pps->getPPSRefPicListSPSIdc(listIdx) && - (listIdx == 0 || (listIdx == 1 && pps->getRpl1IdxPresentFlag()))) -#endif { READ_FLAG(uiCode, "rpl_sps_flag[i]"); } @@ -3325,12 +2461,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag { uiCode = 0; } -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - else if (pps->getRpl1IdxPresentFlag()) - { - uiCode = pps->getPPSRefPicListSPSIdc(listIdx) - 1; - } -#endif else { uiCode = rplSpsFlag0; @@ -3428,7 +2558,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag if (sps->getSplitConsOverrideEnabledFlag()) { READ_FLAG(uiCode, "partition_constraints_override_flag"); picHeader->setSplitConsOverrideFlag( uiCode != 0 ); -#if JVET_Q0819_PH_CHANGES } else { @@ -3443,25 +2572,11 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag if (picHeader->getPicIntraSliceAllowedFlag()) { -#endif if (picHeader->getSplitConsOverrideFlag()) { -#if !JVET_Q0819_PH_CHANGES - unsigned minQT[3] = { 0, 0, 0 }; - unsigned maxBTD[3] = { 0, 0, 0 }; - unsigned maxBTSize[3] = { 0, 0, 0 }; - unsigned maxTTSize[3] = { 0, 0, 0 }; - unsigned ctbLog2SizeY = floorLog2(sps->getCTUSize()); -#endif READ_UVLC(uiCode, "ph_log2_diff_min_qt_min_cb_intra_slice_luma"); unsigned minQtLog2SizeIntraY = uiCode + sps->getLog2MinCodingBlockSize(); minQT[0] = 1 << minQtLog2SizeIntraY; -#if !JVET_Q0819_PH_CHANGES - READ_UVLC(uiCode, "ph_log2_diff_min_qt_min_cb_inter_slice"); - unsigned minQtLog2SizeInterY = uiCode + sps->getLog2MinCodingBlockSize(); - minQT[1] = 1 << minQtLog2SizeInterY; - READ_UVLC(uiCode, "ph_max_mtt_hierarchy_depth_inter_slice"); maxBTD[1] = uiCode; -#endif READ_UVLC(uiCode, "ph_max_mtt_hierarchy_depth_intra_slice_luma"); maxBTD[0] = uiCode; maxTTSize[0] = maxBTSize[0] = minQT[0]; @@ -3473,16 +2588,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "Invalid code"); } -#if !JVET_Q0819_PH_CHANGES - maxTTSize[1] = maxBTSize[1] = minQT[1]; - if (maxBTD[1] != 0) - { - READ_UVLC(uiCode, "ph_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "Invalid code"); - READ_UVLC(uiCode, "ph_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "Invalid code"); - } -#endif if (sps->getUseDualITree()) { READ_UVLC(uiCode, "ph_log2_diff_min_qt_min_cb_intra_slice_chroma"); minQT[2] = 1 << (uiCode + sps->getLog2MinCodingBlockSize()); @@ -3494,66 +2599,29 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag READ_UVLC(uiCode, "ph_log2_diff_max_tt_min_qt_intra_slice_chroma"); maxTTSize[2] <<= uiCode; } } -#if !JVET_Q0819_PH_CHANGES - picHeader->setMinQTSizes(minQT); - picHeader->setMaxMTTHierarchyDepths(maxBTD); - picHeader->setMaxBTSizes(maxBTSize); - picHeader->setMaxTTSizes(maxTTSize); -#endif } } -#if !JVET_Q0819_PH_CHANGES - else - { - picHeader->setSplitConsOverrideFlag(0); - } -#endif -#if !JVET_Q0819_PH_CHANGES - // inherit constraint values from SPS - if (!sps->getSplitConsOverrideEnabledFlag() || !picHeader->getSplitConsOverrideFlag()) - { - picHeader->setMinQTSizes(sps->getMinQTSizes()); - picHeader->setMaxMTTHierarchyDepths(sps->getMaxMTTHierarchyDepths()); - picHeader->setMaxBTSizes(sps->getMaxBTSizes()); - picHeader->setMaxTTSizes(sps->getMaxTTSizes()); - } -#endif -#if JVET_Q0819_PH_CHANGES if (picHeader->getPicIntraSliceAllowedFlag()) { -#endif // delta quantization and chrom and chroma offset if (pps->getUseDQP()) { READ_UVLC( uiCode, "ph_cu_qp_delta_subdiv_intra_slice" ); picHeader->setCuQpDeltaSubdivIntra( uiCode ); -#if !JVET_Q0819_PH_CHANGES - READ_UVLC( uiCode, "ph_cu_qp_delta_subdiv_inter_slice" ); picHeader->setCuQpDeltaSubdivInter( uiCode ); -#endif } else { picHeader->setCuQpDeltaSubdivIntra( 0 ); -#if !JVET_Q0819_PH_CHANGES - picHeader->setCuQpDeltaSubdivInter( 0 ); -#endif } if (pps->getCuChromaQpOffsetListEnabledFlag()) { READ_UVLC( uiCode, "ph_cu_chroma_qp_offset_subdiv_intra_slice" ); picHeader->setCuChromaQpOffsetSubdivIntra( uiCode ); -#if !JVET_Q0819_PH_CHANGES - READ_UVLC( uiCode, "ph_cu_chroma_qp_offset_subdiv_inter_slice" ); picHeader->setCuChromaQpOffsetSubdivInter( uiCode ); -#endif } else { picHeader->setCuChromaQpOffsetSubdivIntra( 0 ); -#if !JVET_Q0819_PH_CHANGES - picHeader->setCuChromaQpOffsetSubdivInter( 0 ); -#endif } -#if JVET_Q0819_PH_CHANGES } @@ -3593,7 +2661,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setCuChromaQpOffsetSubdivInter(0); } -#endif // temporal motion vector prediction if (sps->getSPSTemporalMVPEnabledFlag()) { @@ -3605,12 +2672,10 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setEnableTMVPFlag(false); } -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if (picHeader->getEnableTMVPFlag() && pps->getRplInfoInPhFlag()) { READ_CODE( 1, uiCode, "ph_collocated_from_l0_flag"); picHeader->setPicColFromL0Flag(uiCode); -#if JVET_Q0259_COLLOCATED_PIC_IN_PH if ((picHeader->getPicColFromL0Flag() == 1 && picHeader->getRPL(0)->getNumRefEntries() > 1) || (picHeader->getPicColFromL0Flag() == 0 && picHeader->getRPL(1)->getNumRefEntries() > 1)) { @@ -3621,56 +2686,21 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag { picHeader->setColRefIdx(0); } -#endif } else { picHeader->setPicColFromL0Flag(0); } -#endif // mvd L1 zero flag -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSMvdL1ZeroIdc()) - { - READ_FLAG(uiCode, "mvd_l1_zero_flag"); - } - else - { - uiCode = pps->getPPSMvdL1ZeroIdc() - 1; - } -#else READ_FLAG(uiCode, "mvd_l1_zero_flag"); -#endif picHeader->setMvdL1ZeroFlag( uiCode != 0 ); // merge candidate list size -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSSixMinusMaxNumMergeCandPlus1()) - { - READ_UVLC(uiCode, "pic_six_minus_max_num_merge_cand"); - } - else - { - uiCode = pps->getPPSSixMinusMaxNumMergeCandPlus1() - 1; - } -#else - READ_UVLC(uiCode, "pic_six_minus_max_num_merge_cand"); -#endif - CHECK(MRG_MAX_NUM_CANDS <= uiCode, "Incorrrect max number of merge candidates!"); - picHeader->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); -#endif // subblock merge candidate list size if ( sps->getUseAffine() ) { -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE picHeader->setMaxNumAffineMergeCand(sps->getMaxNumAffineMergeCand()); -#else - READ_UVLC(uiCode, "pic_five_minus_max_num_subblock_merge_cand"); - CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "Incorrrect max number of affine merge candidates!"); - picHeader->setMaxNumAffineMergeCand( AFFINE_MRG_MAX_NUM_CANDS - uiCode ); -#endif } else { @@ -3718,62 +2748,10 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setDisProfFlag(0); } -#if JVET_Q0819_PH_CHANGES if( (pps->getUseWP() || pps->getWPBiPred()) && pps->getWpInfoInPhFlag() ) { parsePredWeightTable(picHeader, sps); } -#endif -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0806 - // triangle merge candidate list size - if (sps->getUseTriangle() && picHeader->getMaxNumMergeCand() >= 2) - { -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1()) - { - READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_triangle_cand"); - } - else - { - uiCode = pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() - 1; - } -#else - READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_triangle_cand"); -#endif - CHECK(picHeader->getMaxNumMergeCand() < uiCode, "Incorrrect max number of triangle candidates!"); - picHeader->setMaxNumTriangleCand((uint32_t)(picHeader->getMaxNumMergeCand() - uiCode)); - } - else - { - picHeader->setMaxNumTriangleCand(0); - } -#else - // geometric merge candidate list size - if (sps->getUseGeo() && picHeader->getMaxNumMergeCand() >= 2) - { -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1()) - { - READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_gpm_cand"); - } - else - { - uiCode = pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1() - 1; - } -#else - READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_gpm_cand"); -#endif - CHECK(picHeader->getMaxNumMergeCand() < uiCode, "Incorrrect max number of gpm candidates!"); - picHeader->setMaxNumGeoCand((uint32_t)(picHeader->getMaxNumMergeCand() - uiCode)); - } - else - { - picHeader->setMaxNumGeoCand(0); - } -#endif -#endif -#if JVET_Q0819_PH_CHANGES } // inherit constraint values from SPS if (!sps->getSplitConsOverrideEnabledFlag() || !picHeader->getSplitConsOverrideFlag()) @@ -3790,28 +2768,13 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setMaxBTSizes(maxBTSize); picHeader->setMaxTTSizes(maxTTSize); } -#endif // ibc merge candidate list size -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - if (sps->getIBCFlag()) - { - READ_UVLC(uiCode, "pic_six_minus_max_num_ibc_merge_cand"); - CHECK(IBC_MRG_MAX_NUM_CANDS <= uiCode, "Incorrrect max number of IBC merge candidates!"); - picHeader->setMaxNumIBCMergeCand(IBC_MRG_MAX_NUM_CANDS - uiCode); - } - else - { - picHeader->setMaxNumIBCMergeCand(0); - } -#endif -#if JVET_Q0819_PH_CHANGES if (pps->getQpDeltaInfoInPhFlag()) { int iCode = 0; READ_SVLC(iCode, "ph_qp_delta"); picHeader->setQpDelta(iCode); } -#endif // joint Cb/Cr sign flag if (sps->getJointCbCrEnabledFlag()) @@ -3827,168 +2790,43 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag // sao enable flags if(sps->getSAOEnabledFlag()) { -#if JVET_Q0819_PH_CHANGES if (pps->getSaoInfoInPhFlag()) -#else - READ_FLAG(uiCode, "pic_sao_enabled_present_flag"); - picHeader->setSaoEnabledPresentFlag(uiCode != 0); - - if (picHeader->getSaoEnabledPresentFlag()) -#endif { -#if JVET_Q0819_PH_CHANGES - READ_FLAG(uiCode, "ph_sao_luma_enabled_flag"); -#else - READ_FLAG(uiCode, "slice_sao_luma_flag"); -#endif - picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, uiCode != 0); - - if (sps->getChromaFormatIdc() != CHROMA_400) - { -#if JVET_Q0819_PH_CHANGES - READ_FLAG(uiCode, "ph_sao_chroma_enabled_flag"); -#else - READ_FLAG(uiCode, "slice_sao_chroma_flag"); -#endif - picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, uiCode != 0); - } - } - else - { - picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, true); - picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, sps->getChromaFormatIdc() != CHROMA_400); - } - } - else - { - picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, false); - picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, false); - } - -#if !JVET_Q0819_PH_CHANGES - // alf enable flags and aps IDs -#if JVET_Q0795_CCALF - picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, false); - picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, false); -#endif - if( sps->getALFEnabledFlag() ) - { - READ_FLAG(uiCode, "pic_alf_enabled_present_flag"); - picHeader->setAlfEnabledPresentFlag(uiCode != 0); - - if (picHeader->getAlfEnabledPresentFlag()) - { - READ_FLAG(uiCode, "pic_alf_enabled_flag"); - picHeader->setAlfEnabledFlag(COMPONENT_Y, uiCode); - - int alfChromaIdc = 0; - if (uiCode) - { - READ_CODE(3, uiCode, "pic_num_alf_aps_ids_luma"); - int numAps = uiCode; - picHeader->setNumAlfAps(numAps); - - std::vector<int> apsId(numAps, -1); - for (int i = 0; i < numAps; i++) - { - READ_CODE(3, uiCode, "pic_alf_aps_id_luma"); - apsId[i] = uiCode; - } - picHeader->setAlfAPSs(apsId); - - if (sps->getChromaFormatIdc() != CHROMA_400) - { - READ_CODE(2, uiCode, "pic_alf_chroma_idc"); - alfChromaIdc = uiCode; - } - else - { - alfChromaIdc = 0; - } - if (alfChromaIdc) - { - READ_CODE(3, uiCode, "pic_alf_aps_id_chroma"); - picHeader->setAlfApsIdChroma(uiCode); - } -#if JVET_Q0795_CCALF - if (sps->getCCALFEnabledFlag()) - { - READ_FLAG(uiCode, "ph_cc_alf_cb_enabled_flag"); - picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, uiCode != 0); - picHeader->setCcAlfCbApsId(-1); - if (picHeader->getCcAlfEnabledFlag(COMPONENT_Cb)) - { - // parse APS ID - READ_CODE(3, uiCode, "ph_cc_alf_cb_aps_id"); - picHeader->setCcAlfCbApsId(uiCode); - } - // Cr - READ_FLAG(uiCode, "ph_cc_alf_cr_enabled_flag"); - picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, uiCode != 0); - picHeader->setCcAlfCrApsId(-1); - if (picHeader->getCcAlfEnabledFlag(COMPONENT_Cr)) - { - // parse APS ID - READ_CODE(3, uiCode, "ph_cc_alf_cr_aps_id"); - picHeader->setCcAlfCrApsId(uiCode); - } - } -#endif - } - else + READ_FLAG(uiCode, "ph_sao_luma_enabled_flag"); + picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, uiCode != 0); + + if (sps->getChromaFormatIdc() != CHROMA_400) { - picHeader->setNumAlfAps(0); + READ_FLAG(uiCode, "ph_sao_chroma_enabled_flag"); + picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, uiCode != 0); } - picHeader->setAlfEnabledFlag(COMPONENT_Cb, alfChromaIdc & 1); - picHeader->setAlfEnabledFlag(COMPONENT_Cr, alfChromaIdc >> 1); } else { - picHeader->setAlfEnabledFlag(COMPONENT_Y, true); - picHeader->setAlfEnabledFlag(COMPONENT_Cb, true); - picHeader->setAlfEnabledFlag(COMPONENT_Cr, true); + picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, true); + picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, sps->getChromaFormatIdc() != CHROMA_400); } } else { - picHeader->setAlfEnabledFlag(COMPONENT_Y, false); - picHeader->setAlfEnabledFlag(COMPONENT_Cb, false); - picHeader->setAlfEnabledFlag(COMPONENT_Cr, false); + picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, false); + picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, false); } -#endif + // dependent quantization -#if DQ_SDH_SIGNALLING if (sps->getDepQuantEnabledFlag()) { -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSDepQuantEnabledIdc()) - { - READ_FLAG(uiCode, "ph_dep_quant_enabled_flag"); - } - else - { - uiCode = pps->getPPSDepQuantEnabledIdc() - 1; - } -#else READ_FLAG(uiCode, "ph_dep_quant_enabled_flag"); -#endif picHeader->setDepQuantEnabledFlag(uiCode != 0); -#if DQ_SDH_SIGNALLING } else { picHeader->setDepQuantEnabledFlag(false); } -#endif // sign data hiding -#if DQ_SDH_SIGNALLING if (sps->getSignDataHidingEnabledFlag() && !picHeader->getDepQuantEnabledFlag()) -#else - if( !picHeader->getDepQuantEnabledFlag() ) -#endif { READ_FLAG( uiCode, "pic_sign_data_hiding_enabled_flag" ); picHeader->setSignDataHidingEnabledFlag( uiCode != 0 ); @@ -4003,14 +2841,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag { if(pps->getDeblockingFilterOverrideEnabledFlag()) { -#if JVET_Q0819_PH_CHANGES if (pps->getDbfInfoInPhFlag()) -#else - READ_FLAG(uiCode, "ph_deblocking_filter_override_present_flag"); - picHeader->setDeblockingFilterOverridePresentFlag(uiCode != 0); - - if( picHeader->getDeblockingFilterOverridePresentFlag() ) -#endif { READ_FLAG ( uiCode, "ph_deblocking_filter_override_flag" ); picHeader->setDeblockingFilterOverrideFlag(uiCode != 0); @@ -4022,15 +2853,11 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } else { -#if !JVET_Q0819_PH_CHANGES - picHeader->setDeblockingFilterOverridePresentFlag(false); -#endif picHeader->setDeblockingFilterOverrideFlag(false); } if(picHeader->getDeblockingFilterOverrideFlag()) { -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS READ_FLAG( uiCode, "ph_deblocking_filter_disabled_flag" ); picHeader->setDeblockingFilterDisable(uiCode != 0); if (!picHeader->getDeblockingFilterDisable()) @@ -4065,34 +2892,16 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag CHECK( picHeader->getDeblockingFilterCrTcOffsetDiv2() < -12 || picHeader->getDeblockingFilterCrTcOffsetDiv2() > 12, "Invalid deblocking filter configuration"); } -#else - READ_FLAG ( uiCode, "pic_deblocking_filter_disabled_flag" ); - picHeader->setDeblockingFilterDisable(uiCode != 0); - if(!picHeader->getDeblockingFilterDisable()) - { - READ_SVLC( iCode, "pic_beta_offset_div2" ); - picHeader->setDeblockingFilterBetaOffsetDiv2(iCode); - CHECK( picHeader->getDeblockingFilterBetaOffsetDiv2() < -6 && - picHeader->getDeblockingFilterBetaOffsetDiv2() > 6, "Invalid deblocking filter configuration"); - - READ_SVLC( iCode, "pic_tc_offset_div2" ); - picHeader->setDeblockingFilterTcOffsetDiv2(iCode); - CHECK (picHeader->getDeblockingFilterTcOffsetDiv2() < -6 && - picHeader->getDeblockingFilterTcOffsetDiv2() > 6, "Invalid deblocking filter configuration"); - } -#endif } else { picHeader->setDeblockingFilterDisable ( pps->getPPSDeblockingFilterDisabledFlag() ); picHeader->setDeblockingFilterBetaOffsetDiv2( pps->getDeblockingFilterBetaOffsetDiv2() ); picHeader->setDeblockingFilterTcOffsetDiv2 ( pps->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS picHeader->setDeblockingFilterCbBetaOffsetDiv2( pps->getDeblockingFilterCbBetaOffsetDiv2() ); picHeader->setDeblockingFilterCbTcOffsetDiv2 ( pps->getDeblockingFilterCbTcOffsetDiv2() ); picHeader->setDeblockingFilterCrBetaOffsetDiv2( pps->getDeblockingFilterCrBetaOffsetDiv2() ); picHeader->setDeblockingFilterCrTcOffsetDiv2 ( pps->getDeblockingFilterCrTcOffsetDiv2() ); -#endif } } else @@ -4100,59 +2909,12 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag picHeader->setDeblockingFilterDisable ( false ); picHeader->setDeblockingFilterBetaOffsetDiv2( 0 ); picHeader->setDeblockingFilterTcOffsetDiv2 ( 0 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS picHeader->setDeblockingFilterCbBetaOffsetDiv2( 0 ); picHeader->setDeblockingFilterCbTcOffsetDiv2 ( 0 ); picHeader->setDeblockingFilterCrBetaOffsetDiv2(0); picHeader->setDeblockingFilterCrTcOffsetDiv2(0); -#endif - } - -#if !JVET_Q0819_PH_CHANGES - // luma mapping / chroma scaling controls - if (sps->getUseLmcs()) - { - READ_FLAG(uiCode, "ph_lmcs_enabled_flag"); - picHeader->setLmcsEnabledFlag(uiCode != 0); - - if (picHeader->getLmcsEnabledFlag()) - { - READ_CODE(2, uiCode, "ph_lmcs_aps_id"); - picHeader->setLmcsAPSId(uiCode); - - if (sps->getChromaFormatIdc() != CHROMA_400) - { - READ_FLAG(uiCode, "ph_chroma_residual_scale_flag"); - picHeader->setLmcsChromaResidualScaleFlag(uiCode != 0); - } - else - { - picHeader->setLmcsChromaResidualScaleFlag(false); - } - } - } - else - { - picHeader->setLmcsEnabledFlag(false); - picHeader->setLmcsChromaResidualScaleFlag(false); } - // quantization scaling lists - if( sps->getScalingListFlag() ) - { - READ_FLAG( uiCode, "pic_scaling_list_present_flag" ); - picHeader->setScalingListPresentFlag( uiCode ); - if( picHeader->getScalingListPresentFlag() ) - { - READ_CODE( 3, uiCode, "pic_scaling_list_aps_id" ); - picHeader->setScalingListAPSId( uiCode ); - } - } - else - { - picHeader->setScalingListPresentFlag( false ); - } -#endif // picture header extension if(pps->getPictureHeaderExtensionPresentFlag()) @@ -4165,17 +2927,12 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } } -#if JVET_Q0775_PH_IN_SH if( readRbspTrailingBits ) { xReadRbspTrailingBits(); } -#else - xReadRbspTrailingBits(); -#endif } -#if JVET_Q0358_ALF_NALU_TID_CONSTRAINT void HLSyntaxReader::checkAlfNaluTidAndPicTid(Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager) { SPS* sps = parameterSetManager->getSPS(picHeader->getSPSId()); @@ -4201,7 +2958,6 @@ void HLSyntaxReader::checkAlfNaluTidAndPicTid(Slice* pcSlice, PicHeader* picHea } } } -#endif void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager, const int prevTid0POC) { uint32_t uiCode; @@ -4212,7 +2968,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par #endif PPS* pps = NULL; SPS* sps = NULL; -#if JVET_Q0775_PH_IN_SH READ_FLAG(uiCode, "picture_header_in_slice_header_flag"); if (uiCode) { @@ -4220,12 +2975,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par parsePictureHeader(picHeader, parameterSetManager, false); picHeader->setValid(); } -#endif CHECK(picHeader==0, "Invalid Picture Header"); CHECK(picHeader->isValid()==false, "Invalid Picture Header"); -#if JVET_Q0358_ALF_NALU_TID_CONSTRAINT checkAlfNaluTidAndPicTid(pcSlice, picHeader, parameterSetManager); -#endif pps = parameterSetManager->getPPS( picHeader->getPPSId() ); //!KS: need to add error handling code here, if PPS is not available CHECK(pps==0, "Invalid PPS"); @@ -4238,19 +2990,12 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par const bool bChroma=(chFmt!=CHROMA_400); // picture order count -#if JVET_Q0819_PH_CHANGES uiCode = picHeader->getPocLsb(); -#else - READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); -#endif -#if JVET_P0116_POC_MSB int iPOClsb = uiCode; int iMaxPOClsb = 1 << sps->getBitsForPOC(); int iPOCmsb; -#endif if (pcSlice->getIdrPicFlag()) { -#if JVET_P0116_POC_MSB if (picHeader->getPocMsbPresentFlag()) { iPOCmsb = picHeader->getPocMsbVal()*iMaxPOClsb; @@ -4260,32 +3005,18 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par iPOCmsb = 0; } pcSlice->setPOC(iPOCmsb + iPOClsb); -#else - pcSlice->setPOC(uiCode); -#endif } else { -#if !JVET_P0116_POC_MSB - int iPOClsb = uiCode; -#endif int iPrevPOC = prevTid0POC; -#if !JVET_P0116_POC_MSB - int iMaxPOClsb = 1 << sps->getBitsForPOC(); -#endif int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); int iPrevPOCmsb = iPrevPOC - iPrevPOClsb; -#if !JVET_P0116_POC_MSB - int iPOCmsb; -#endif -#if JVET_P0116_POC_MSB if (picHeader->getPocMsbPresentFlag()) { iPOCmsb = picHeader->getPocMsbVal()*iMaxPOClsb; } else { -#endif if ((iPOClsb < iPrevPOClsb) && ((iPrevPOClsb - iPOClsb) >= (iMaxPOClsb / 2))) { iPOCmsb = iPrevPOCmsb + iMaxPOClsb; @@ -4298,28 +3029,20 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { iPOCmsb = iPrevPOCmsb; } -#if JVET_P0116_POC_MSB } -#endif pcSlice->setPOC(iPOCmsb + iPOClsb); } -#if JVET_Q0119_CLEANUPS if (sps->getSubPicInfoPresentFlag()) -#else - if (sps->getSubPicPresentFlag()) -#endif { uint32_t bitsSubPicId; bitsSubPicId = sps->getSubPicIdLen(); READ_CODE(bitsSubPicId, uiCode, "slice_subpic_id"); pcSlice->setSliceSubPicId(uiCode); } -#if JVET_Q0119_CLEANUPS else { pcSlice->setSliceSubPicId(0); } -#endif // raster scan slices if(pps->getRectSliceFlag() == 0) @@ -4332,12 +3055,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par int bitsSliceAddress = ceilLog2(pps->getNumTiles()); READ_CODE(bitsSliceAddress, uiCode, "slice_address"); sliceAddr = uiCode; READ_UVLC(uiCode, "num_tiles_in_slice_minus1"); numTilesInSlice = uiCode + 1; -#if JVET_Q0114_CONSTRAINT_FLAGS if (!pps->getRectSliceFlag() && sps->getProfileTierLevel()->getConstraintInfo()->getOneSlicePerPicConstraintFlag()) { CHECK(pps->getNumTiles() != uiCode + 1, "When rect_slice_flag is equal to 0 and one_slice_per_pic_constraint_flag equal to 1, the value of num_tiles_in_slice_minus1 present in each slice header shall be equal to NumTilesInPic - 1"); } -#endif } else { sliceAddr = 0; @@ -4363,19 +3084,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par uint32_t sliceAddr; // slice address is the index of the slice within the current sub-picture -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS uint32_t currSubPicIdx = pps->getSubPicIdxFromSubPicId( pcSlice->getSliceSubPicId() ); SubPic currSubPic = pps->getSubPic(currSubPicIdx); if( currSubPic.getNumSlicesInSubPic() > 1 ) -#else - if( pps->getNumSlicesInPic() > 1 ) -#endif { -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS int bitsSliceAddress = ceilLog2(currSubPic.getNumSlicesInSubPic()); -#else - int bitsSliceAddress = ceilLog2(pps->getNumSlicesInPic()); // change to NumSlicesInSubPic when available -#endif READ_CODE(bitsSliceAddress, uiCode, "slice_address"); sliceAddr = uiCode; CHECK(sliceAddr >= pps->getNumSlicesInPic(), "Invalid slice address"); } @@ -4383,7 +3096,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { sliceAddr = 0; } -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS uint32_t picLevelSliceIdx = sliceAddr; for(int subpic = 0; subpic < currSubPicIdx; subpic++) { @@ -4391,13 +3103,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } pcSlice->setSliceMap( pps->getSliceMap(picLevelSliceIdx) ); pcSlice->setSliceID(picLevelSliceIdx); -#else - pcSlice->setSliceMap( pps->getSliceMap(sliceAddr) ); - pcSlice->setSliceID(sliceAddr); -#endif } -#if JVET_Q0400_EXTRA_BITS std::vector<bool> shExtraBitsPresent = sps->getExtraSHBitPresentFlags(); for (int i=0; i< sps->getNumExtraSHBitsBytes() * 8; i++) { @@ -4407,21 +3114,15 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par READ_FLAG(uiCode, "sh_extra_bit[ i ]"); } } -#endif -#if JVET_Q0819_PH_CHANGES if (picHeader->getPicInterSliceAllowedFlag()) { -#endif READ_UVLC ( uiCode, "slice_type" ); pcSlice->setSliceType((SliceType)uiCode); -#if JVET_Q0118_CLEANUPS VPS *vps = parameterSetManager->getVPS(sps->getVPSId()); if (pcSlice->isIRAP() && (sps->getVPSId() == 0 || vps->getIndependentLayerFlag(vps->getGeneralLayerIdx(pcSlice->getNalUnitLayerId())) == 1)) { CHECK(uiCode != 2, "When nal_unit_type is in the range of IDR_W_RADL to CRA_NUT, inclusive, and vps_independent_layer_flag[ GeneralLayerIdx[ nuh_layer_id ] ] is equal to 1, slice_type shall be equal to 2"); } -#endif -#if JVET_Q0819_PH_CHANGES } else { @@ -4431,9 +3132,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { CHECK(pcSlice->getSliceType() == I_SLICE, "when ph_intra_slice_allowed_flag = 0, no I_Slice is allowed"); } -#endif -#if JVET_Q0819_PH_CHANGES // inherit values from picture header // set default values in case slice overrides are disabled pcSlice->inheritFromPicHeader(picHeader, pps, sps); @@ -4484,7 +3183,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cb, alfChromaIdc & 1); pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cr, alfChromaIdc >> 1); -#if JVET_Q0795_CCALF CcAlfFilterParam &filterParam = pcSlice->m_ccAlfFilterParam; if (sps->getCCALFEnabledFlag() && pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) { @@ -4517,11 +3215,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par pcSlice->setTileGroupCcAlfCbApsId(-1); pcSlice->setTileGroupCcAlfCrApsId(-1); } -#endif } -#endif -#if JVET_Q0155_COLOUR_ID // 4:4:4 colour plane ID if( sps->getSeparateColourPlaneFlag() ) { @@ -4532,19 +3227,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { pcSlice->setColourPlaneId( 0 ); } -#endif -#if !JVET_Q0819_PH_CHANGES - // inherit values from picture header - // set default values in case slice overrides are disabled - pcSlice->inheritFromPicHeader( picHeader, pps, sps ); -#endif -#if JVET_Q0819_PH_CHANGES if( pps->getRplInfoInPhFlag() ) -#else - if (picHeader->getPicRplPresentFlag()) -#endif { pcSlice->setRPL0(picHeader->getRPL0()); pcSlice->setRPL1(picHeader->getRPL1()); @@ -4567,18 +3252,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par if (sps->getNumRPL0() > 0) { -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSRefPicListSPSIdc0()) - { - READ_FLAG(uiCode, "ref_pic_list_sps_flag[0]"); - } - else - { - uiCode = pps->getPPSRefPicListSPSIdc0() - 1; - } -#else READ_FLAG(uiCode, "ref_pic_list_sps_flag[0]"); -#endif } else { @@ -4659,11 +3333,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } //Read L1 related syntax elements -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if (sps->getNumRPL(1) > 0 && pps->getRpl1IdxPresentFlag()) -#else - if (sps->getNumRPL(1) > 0 && pps->getRpl1IdxPresentFlag() && !pps->getPPSRefPicListSPSIdc(1)) -#endif { READ_FLAG(uiCode, "ref_pic_list_sps_flag[1]"); } @@ -4671,12 +3341,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { uiCode = 0; } -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - else if (pps->getRpl1IdxPresentFlag()) - { - uiCode = pps->getPPSRefPicListSPSIdc(1) - 1; - } -#endif else { uiCode = rplSpsFlag0; @@ -4761,11 +3425,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } } -#if JVET_Q0819_PH_CHANGES if( !pps->getRplInfoInPhFlag() && pcSlice->getIdrPicFlag() && !(sps->getIDRRefParamListPresent()) ) -#else - if (!picHeader->getPicRplPresentFlag() && pcSlice->getIdrPicFlag() && !(sps->getIDRRefParamListPresent())) -#endif { pcSlice->setNumRefIdx(REF_PIC_LIST_0, 0); pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); @@ -4857,42 +3517,25 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par if ( picHeader->getEnableTMVPFlag() ) { -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if ( !pps->getRplInfoInPhFlag()) { -#endif if ( pcSlice->getSliceType() == B_SLICE ) { -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSCollocatedFromL0Idc()) - { - READ_FLAG(uiCode, "collocated_from_l0_flag"); - } - else - { - uiCode = pps->getPPSCollocatedFromL0Idc() - 1; - } -#else READ_FLAG(uiCode, "collocated_from_l0_flag"); -#endif pcSlice->setColFromL0Flag(uiCode); } else { pcSlice->setColFromL0Flag( 1 ); } -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS } else { pcSlice->setColFromL0Flag(picHeader->getPicColFromL0Flag()); } -#endif -#if JVET_Q0259_COLLOCATED_PIC_IN_PH if (!pps->getRplInfoInPhFlag()) { -#endif if ( pcSlice->getSliceType() != I_SLICE && ((pcSlice->getColFromL0Flag() == 1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| (pcSlice->getColFromL0Flag() == 0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) @@ -4905,17 +3548,14 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par pcSlice->setColRefIdx(0); } -#if JVET_Q0259_COLLOCATED_PIC_IN_PH } else { pcSlice->setColRefIdx(picHeader->getColRefIdx()); } -#endif } if ( (pps->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) ) { -#if JVET_Q0819_PH_CHANGES if (pps->getWpInfoInPhFlag()) { CHECK(pcSlice->getNumRefIdx(REF_PIC_LIST_0) > picHeader->getNumL0Weights(), "ERROR: Number of active reference picture L0 is greater than the number of weighted prediction signalled in Picture Header"); @@ -4926,9 +3566,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { parsePredWeightTable(pcSlice, sps); } -#else - parsePredWeightTable(pcSlice, sps); -#endif pcSlice->initWpScaling(sps); } else @@ -4947,7 +3584,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } } -#if JVET_Q0819_PH_CHANGES int qpDelta = 0; if (pps->getQpDeltaInfoInPhFlag()) { @@ -4959,10 +3595,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par qpDelta = iCode; } pcSlice->setSliceQp(26 + pps->getPicInitQPMinus26() + qpDelta); -#else - READ_SVLC( iCode, "slice_qp_delta" ); - pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); -#endif pcSlice->setSliceQpBase(pcSlice->getSliceQp()); CHECK( pcSlice->getSliceQp() < -sps->getQpBDOffset(CHANNEL_TYPE_LUMA), "Invalid slice QP delta" ); @@ -5009,11 +3641,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par pcSlice->setUseChromaQpAdj(false); } -#if JVET_Q0819_PH_CHANGES if (sps->getSAOEnabledFlag() && !pps->getSaoInfoInPhFlag()) -#else - if (sps->getSAOEnabledFlag() && !picHeader->getSaoEnabledPresentFlag()) -#endif { READ_FLAG(uiCode, "slice_sao_luma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, (bool)uiCode); @@ -5023,99 +3651,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } } -#if !JVET_Q0819_PH_CHANGES -#if JVET_Q0819_PH_CHANGES - if (sps->getALFEnabledFlag() && !pps->getAlfInfoInPhFlag()) -#else - if (sps->getALFEnabledFlag() && !picHeader->getAlfEnabledPresentFlag()) -#endif - { - READ_FLAG(uiCode, "slice_alf_enabled_flag"); - pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Y, uiCode); - int alfChromaIdc = 0; - if (uiCode) - { - READ_CODE(3, uiCode, "slice_num_alf_aps_ids_luma"); - int numAps = uiCode; - pcSlice->setTileGroupNumAps(numAps); - std::vector<int> apsId(numAps, -1); - for (int i = 0; i < numAps; i++) - { - READ_CODE(3, uiCode, "slice_alf_aps_id_luma"); - apsId[i] = uiCode; - APS* APStoCheckLuma = parameterSetManager->getAPS(apsId[i], ALF_APS); - CHECK(APStoCheckLuma->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA] != 1, "bitstream conformance error, alf_luma_filter_signal_flag shall be equal to 1"); - } - - - pcSlice->setAlfAPSs(apsId); - if (bChroma) - { - READ_CODE(2, uiCode, "slice_alf_chroma_idc"); alfChromaIdc = uiCode; - } - else - { - alfChromaIdc = 0; - } - if (alfChromaIdc) - { - READ_CODE(3, uiCode, "slice_alf_aps_id_chroma"); - pcSlice->setTileGroupApsIdChroma(uiCode); - APS* APStoCheckChroma = parameterSetManager->getAPS(uiCode, ALF_APS); - CHECK(APStoCheckChroma->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_CHROMA] != 1, "bitstream conformance error, alf_chroma_filter_signal_flag shall be equal to 1"); - } - } - else - { - pcSlice->setTileGroupNumAps(0); - } - pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cb, alfChromaIdc & 1); - pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cr, alfChromaIdc >> 1); - -#if JVET_Q0795_CCALF - CcAlfFilterParam &filterParam = pcSlice->m_ccAlfFilterParam; - if (sps->getCCALFEnabledFlag() && pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) - { - READ_FLAG(uiCode, "slice_cc_alf_cb_enabled_flag"); - pcSlice->setTileGroupCcAlfCbEnabledFlag(uiCode); - filterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1] = (uiCode == 1) ? true : false; - pcSlice->setTileGroupCcAlfCbApsId(-1); - if (filterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1]) - { - // parse APS ID - READ_CODE(3, uiCode, "slice_cc_alf_cb_aps_id"); - pcSlice->setTileGroupCcAlfCbApsId(uiCode); - } - // Cr - READ_FLAG(uiCode, "slice_cc_alf_cr_enabled_flag"); - pcSlice->setTileGroupCcAlfCrEnabledFlag(uiCode); - filterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1] = (uiCode == 1) ? true : false; - pcSlice->setTileGroupCcAlfCrApsId(-1); - if (filterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1]) - { - // parse APS ID - READ_CODE(3, uiCode, "slice_cc_alf_cr_aps_id"); - pcSlice->setTileGroupCcAlfCrApsId(uiCode); - } - } - else - { - filterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1] = false; - filterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1] = false; - pcSlice->setTileGroupCcAlfCbApsId(-1); - pcSlice->setTileGroupCcAlfCrApsId(-1); - } -#endif - } -#endif if (pps->getDeblockingFilterControlPresentFlag()) { -#if JVET_Q0819_PH_CHANGES if (pps->getDeblockingFilterOverrideEnabledFlag() && !pps->getDbfInfoInPhFlag()) -#else - if (pps->getDeblockingFilterOverrideEnabledFlag() && !picHeader->getDeblockingFilterOverridePresentFlag()) -#endif { READ_FLAG ( uiCode, "slice_deblocking_filter_override_flag" ); pcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); } @@ -5128,7 +3667,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par READ_FLAG ( uiCode, "slice_deblocking_filter_disabled_flag" ); pcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); if(!pcSlice->getDeblockingFilterDisable()) { -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS READ_SVLC( iCode, "slice_beta_offset_div2" ); pcSlice->setDeblockingFilterBetaOffsetDiv2( iCode ); CHECK( pcSlice->getDeblockingFilterBetaOffsetDiv2() < -12 || pcSlice->getDeblockingFilterBetaOffsetDiv2() > 12, "Invalid deblocking filter configuration"); @@ -5149,14 +3687,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par READ_SVLC( iCode, "slice_cr_tc_offset_div2" ); pcSlice->setDeblockingFilterCrTcOffsetDiv2( iCode ); CHECK( pcSlice->getDeblockingFilterCrTcOffsetDiv2() < -12 || pcSlice->getDeblockingFilterCrTcOffsetDiv2() > 12, "Invalid deblocking filter configuration"); -#else - READ_SVLC( iCode, "slice_beta_offset_div2" ); pcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); - CHECK( pcSlice->getDeblockingFilterBetaOffsetDiv2() < -6 && - pcSlice->getDeblockingFilterBetaOffsetDiv2() > 6, "Invalid deblocking filter configuration"); - READ_SVLC( iCode, "slice_tc_offset_div2" ); pcSlice->setDeblockingFilterTcOffsetDiv2(iCode); - CHECK (pcSlice->getDeblockingFilterTcOffsetDiv2() < -6 && - pcSlice->getDeblockingFilterTcOffsetDiv2() > 6, "Invalid deblocking filter configuration"); -#endif } } else @@ -5164,12 +3694,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par pcSlice->setDeblockingFilterDisable ( picHeader->getDeblockingFilterDisable() ); pcSlice->setDeblockingFilterBetaOffsetDiv2( picHeader->getDeblockingFilterBetaOffsetDiv2() ); pcSlice->setDeblockingFilterTcOffsetDiv2 ( picHeader->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2( picHeader->getDeblockingFilterCbBetaOffsetDiv2() ); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( picHeader->getDeblockingFilterCbTcOffsetDiv2() ); pcSlice->setDeblockingFilterCrBetaOffsetDiv2(picHeader->getDeblockingFilterCrBetaOffsetDiv2()); pcSlice->setDeblockingFilterCrTcOffsetDiv2(picHeader->getDeblockingFilterCrTcOffsetDiv2()); -#endif } } else @@ -5177,20 +3705,15 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par pcSlice->setDeblockingFilterDisable ( false ); pcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); pcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2( 0 ); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( 0 ); pcSlice->setDeblockingFilterCrBetaOffsetDiv2( 0 ); pcSlice->setDeblockingFilterCrTcOffsetDiv2 ( 0 ); -#endif } -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM READ_FLAG(uiCode, "slice_ts_residual_coding_disabled_flag"); pcSlice->setTSResidualCodingDisabledFlag(uiCode != 0); -#endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (picHeader->getLmcsEnabledFlag()) { READ_FLAG(uiCode, "slice_lmcs_enabled_flag"); @@ -5200,8 +3723,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { pcSlice->setLmcsEnabledFlag(false); } -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH if (picHeader->getExplicitScalingListEnabledFlag()) { READ_FLAG(uiCode, "slice_explicit_scaling_list_used_flag"); @@ -5211,7 +3732,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par { pcSlice->setExplicitScalingListUsed(false); } -#endif if( pcSlice->getFirstCtuRsAddrInSlice() == 0 ) { pcSlice->setDefaultClpRng( *sps ); @@ -5230,14 +3750,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par std::vector<uint32_t> entryPointOffset; -#if JVET_Q0151_Q0205_ENTRYPOINTS pcSlice->resetNumberOfSubstream(); pcSlice->setNumSubstream(sps, pps); pcSlice->setNumEntryPoints( sps, pps ); -#else - pcSlice->setNumEntryPoints( pps ); -#endif if( pcSlice->getNumEntryPoints() > 0 ) { uint32_t offsetLenMinus1; @@ -5295,16 +3811,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par return; } -#if JVET_Q0819_PH_CHANGES void HLSyntaxReader::getSlicePoc(Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager, const int prevTid0POC) -#else -void HLSyntaxReader::parseSliceHeaderToPoc (Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager, const int prevTid0POC) -#endif { uint32_t uiCode; -#if JVET_Q0819_PH_CHANGES uint32_t pocLsb; -#endif PPS* pps = NULL; SPS* sps = NULL; @@ -5317,7 +3827,6 @@ void HLSyntaxReader::parseSliceHeaderToPoc (Slice* pcSlice, PicHeader* picHeader //!KS: need to add error handling code here, if SPS is not available CHECK(sps==0, "Invalid SPS"); -#if JVET_Q0819_PH_CHANGES READ_FLAG(uiCode, "picture_header_in_slice_header_flag"); if (uiCode == 0) { @@ -5341,20 +3850,10 @@ void HLSyntaxReader::parseSliceHeaderToPoc (Slice* pcSlice, PicHeader* picHeader // picture order count READ_CODE(sps->getBitsForPOC(), pocLsb, "ph_pic_order_cnt_lsb"); } -#else - // picture order count - READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); -#endif -#if JVET_P0116_POC_MSB -#if !JVET_Q0819_PH_CHANGES - int pocLsb = uiCode; -#endif int maxPocLsb = 1 << sps->getBitsForPOC(); int pocMsb; -#endif if (pcSlice->getIdrPicFlag()) { -#if JVET_P0116_POC_MSB if (picHeader->getPocMsbPresentFlag()) { pocMsb = picHeader->getPocMsbVal()*maxPocLsb; @@ -5364,38 +3863,18 @@ void HLSyntaxReader::parseSliceHeaderToPoc (Slice* pcSlice, PicHeader* picHeader pocMsb = 0; } pcSlice->setPOC(pocMsb + pocLsb); -#else -#if JVET_Q0819_PH_CHANGES - pcSlice->setPOC(pocLsb); -#else - pcSlice->setPOC(uiCode); -#endif -#endif } else { -#if !JVET_P0116_POC_MSB -#if !JVET_Q0819_PH_CHANGES - int pocLsb = uiCode; -#endif -#endif int prevPoc = prevTid0POC; -#if !JVET_P0116_POC_MSB - int maxPocLsb = 1 << sps->getBitsForPOC(); -#endif int prevPocLsb = prevPoc & (maxPocLsb - 1); int prevPocMsb = prevPoc - prevPocLsb; -#if !JVET_P0116_POC_MSB - int pocMsb; -#endif -#if JVET_P0116_POC_MSB if (picHeader->getPocMsbPresentFlag()) { pocMsb = picHeader->getPocMsbVal()*maxPocLsb; } else { -#endif if ((pocLsb < prevPocLsb) && ((prevPocLsb - pocLsb) >= (maxPocLsb / 2))) { pocMsb = prevPocMsb + maxPocLsb; @@ -5408,9 +3887,7 @@ void HLSyntaxReader::parseSliceHeaderToPoc (Slice* pcSlice, PicHeader* picHeader { pocMsb = prevPocMsb; } -#if JVET_P0116_POC_MSB } -#endif pcSlice->setPOC(pocMsb + pocLsb); } } @@ -5422,14 +3899,11 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "general_interlaced_source_flag" ); cinfo->setInterlacedSourceFlag(symbol ? true : false); READ_FLAG(symbol, "general_non_packed_constraint_flag" ); cinfo->setNonPackedConstraintFlag(symbol ? true : false); READ_FLAG(symbol, "general_frame_only_constraint_flag" ); cinfo->setFrameOnlyConstraintFlag(symbol ? true : false); -#if JVET_Q0114_CONSTRAINT_FLAGS READ_FLAG(symbol, "general_non_projected_constraint_flag" ); cinfo->setNonProjectedConstraintFlag(symbol ? true : false); -#endif READ_FLAG(symbol, "intra_only_constraint_flag" ); cinfo->setIntraOnlyConstraintFlag(symbol ? true : false); READ_CODE(4, symbol, "max_bitdepth_constraint_idc" ); cinfo->setMaxBitDepthConstraintIdc(symbol); READ_CODE(2, symbol, "max_chroma_format_constraint_idc" ); cinfo->setMaxChromaFormatConstraintIdc((ChromaFormat)symbol); -#if JVET_Q0114_CONSTRAINT_FLAGS READ_FLAG(symbol, "no_res_change_in_clvs_constraint_flag" ); cinfo->setNoResChangeInClvsConstraintFlag(symbol ? true : false); READ_FLAG(symbol, "one_tile_per_pic_constraint_flag" ); cinfo->setOneTilePerPicConstraintFlag(symbol ? true : false); READ_FLAG(symbol, "one_slice_per_pic_constraint_flag" ); cinfo->setOneSlicePerPicConstraintFlag(symbol ? true : false); @@ -5438,15 +3912,12 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) { CHECK(symbol == 0, "When one_slice_per_pic_constraint_flag is equal to 1, the value of one_subpic_per_pic_constraint_flag shall be equal to 1"); } -#endif READ_FLAG(symbol, "no_qtbtt_dual_tree_intra_constraint_flag" ); cinfo->setNoQtbttDualTreeIntraConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_partition_constraints_override_constraint_flag"); cinfo->setNoPartitionConstraintsOverrideConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sao_constraint_flag"); cinfo->setNoSaoConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_alf_constraint_flag"); cinfo->setNoAlfConstraintFlag(symbol > 0 ? true : false); -#if JVET_Q0795_CCALF READ_FLAG(symbol, "no_ccalf_constraint_flag"); cinfo->setNoCCAlfConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_joint_cbcr_constraint_flag"); cinfo->setNoJointCbCrConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_ref_wraparound_constraint_flag"); cinfo->setNoRefWraparoundConstraintFlag(symbol > 0 ? true : false); @@ -5463,20 +3934,14 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "no_ibc_constraint_flag"); cinfo->setNoIbcConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_ciip_constraint_flag"); cinfo->setNoCiipConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_fpel_mmvd_constraint_flag"); cinfo->setNoFPelMmvdConstraintFlag(symbol > 0 ? true : false); -#if !JVET_Q0806 - READ_FLAG(symbol, "no_triangle_constraint_flag"); cinfo->setNoTriangleConstraintFlag(symbol > 0 ? true : false); -#else READ_FLAG(symbol, "no_gpm_constraint_flag"); cinfo->setNoGeoConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_ladf_constraint_flag"); cinfo->setNoLadfConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_transform_skip_constraint_flag"); cinfo->setNoTransformSkipConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_bdpcm_constraint_flag"); cinfo->setNoBDPCMConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_qp_delta_constraint_flag"); cinfo->setNoQpDeltaConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_dep_quant_constraint_flag"); cinfo->setNoDepQuantConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sign_data_hiding_constraint_flag"); cinfo->setNoSignDataHidingConstraintFlag(symbol > 0 ? true : false); -#if JVET_P0124_MIXED_NALU READ_FLAG(symbol, "no_mixed_nalu_types_in_pic_constraint_flag"); cinfo->setNoMixedNaluTypesInPicConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_trail_constraint_flag"); cinfo->setNoTrailConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_stsa_constraint_flag"); cinfo->setNoStsaConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_rasl_constraint_flag"); cinfo->setNoRaslConstraintFlag(symbol > 0 ? true : false); @@ -5488,30 +3953,18 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) } -#if JVET_Q0786_PTL_only void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, bool profileTierPresentFlag, int maxNumSubLayersMinus1) -#else -void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubLayersMinus1) -#endif { uint32_t symbol; -#if JVET_Q0786_PTL_only if(profileTierPresentFlag) { READ_CODE(7 , symbol, "general_profile_idc" ); ptl->setProfileIdc (Profile::Name(symbol)); READ_FLAG( symbol, "general_tier_flag" ); ptl->setTierFlag (symbol ? Level::HIGH : Level::MAIN); parseConstraintInfo( ptl->getConstraintInfo() ); } -#else - READ_CODE(7 , symbol, "general_profile_idc" ); ptl->setProfileIdc (Profile::Name(symbol)); - READ_FLAG( symbol, "general_tier_flag" ); ptl->setTierFlag (symbol ? Level::HIGH : Level::MAIN); - - parseConstraintInfo( ptl->getConstraintInfo() ); -#endif READ_CODE( 8, symbol, "general_level_idc" ); ptl->setLevelIdc( Level::Name( symbol ) ); -#if JVET_Q0786_PTL_only if(profileTierPresentFlag) { READ_CODE(8, symbol, "num_sub_profiles"); @@ -5522,15 +3975,6 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL READ_CODE(32, symbol, "general_sub_profile_idc[i]"); ptl->setSubProfileIdc(i, symbol); } } -#else - READ_CODE(8, symbol, "num_sub_profiles"); - uint8_t numSubProfiles = symbol; - ptl->setNumSubProfile( numSubProfiles ); - for (int i = 0; i < numSubProfiles; i++) - { - READ_CODE(32, symbol, "general_sub_profile_idc[i]"); ptl->setSubProfileIdc(i, symbol); - } -#endif for (int i = 0; i < maxNumSubLayersMinus1; i++) { @@ -5731,7 +4175,6 @@ void HLSyntaxReader::parsePredWeightTable( Slice* pcSlice, const SPS *sps ) CHECK(uiTotalSignalledWeightFlags>24, "Too many weight flag signalled"); } -#if JVET_Q0819_PH_CHANGES void HLSyntaxReader::parsePredWeightTable(PicHeader *picHeader, const SPS *sps) { WPScalingParam * wp; @@ -5876,7 +4319,6 @@ void HLSyntaxReader::parsePredWeightTable(PicHeader *picHeader, const SPS *sps) } CHECK(totalSignalledWeightFlags > 24, "Too many weight flag signalled"); } -#endif /** decode quantization matrix * \param scalingList quantization matrix information @@ -5886,16 +4328,12 @@ void HLSyntaxReader::parseScalingList(ScalingList* scalingList) uint32_t code; bool scalingListCopyModeFlag; READ_FLAG(code, "scaling_matrix_for_lfnst_disabled_flag"); scalingList->setDisableScalingMatrixForLfnstBlks(code ? true : false); -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 READ_FLAG(code, "scaling_list_chroma_present_flag"); scalingList->setChromaScalingListPresentFlag(code ? true : false); -#endif for (int scalingListId = 0; scalingListId < 28; scalingListId++) { -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 if(scalingList->getChromaScalingListPresentFlag()|| scalingList->isLumaScalingList(scalingListId)) { -#endif READ_FLAG(code, "scaling_list_copy_mode_flag"); scalingListCopyModeFlag = (code) ? true : false; scalingList->setScalingListCopyModeFlag(scalingListId, scalingListCopyModeFlag); @@ -5930,13 +4368,11 @@ void HLSyntaxReader::parseScalingList(ScalingList* scalingList) { decodeScalingList(scalingList, scalingListId, scalingList->getScalingListPreditorModeFlag(scalingListId)); } -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 } else { scalingList->processDefaultMatrix(scalingListId); } -#endif } return; @@ -6018,40 +4454,6 @@ bool HLSyntaxReader::xMoreRbspData() return (cnt>0); } -#if !JVET_Q0210_UEK_REMOVAL -int HLSyntaxReader::alfGolombDecode( const int k, const bool signed_val ) -{ - int numLeadingBits = -1; - uint32_t b = 0; - for (; !b; numLeadingBits++) - { -#if RExt__DECODER_DEBUG_BIT_STATISTICS - xReadFlag( b, "" ); -#else - READ_FLAG( b, "alf_coeff_abs_prefix"); -#endif - } - - int symbol = ( ( 1 << numLeadingBits ) - 1 ) << k; - if ( numLeadingBits + k > 0) - { - uint32_t bins; - READ_CODE( numLeadingBits + k, bins, "alf_coeff_abs_suffix" ); - symbol += bins; - } - - if ( signed_val && symbol != 0 ) - { -#if RExt__DECODER_DEBUG_BIT_STATISTICS - xReadFlag( b, "" ); -#else - READ_FLAG( b, "alf_coeff_sign" ); -#endif - symbol = ( b ) ? -symbol : symbol; - } - return symbol; -} -#endif void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma, const int altIdx ) { @@ -6070,7 +4472,6 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma, const i for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_Q0210_UEK_REMOVAL READ_UVLC( code, isChroma ? "alf_chroma_coeff_abs" : "alf_luma_coeff_abs" ); coeff[ ind * MAX_NUM_ALF_LUMA_COEFF + i ] = code; if( coeff[ ind * MAX_NUM_ALF_LUMA_COEFF + i ] != 0 ) @@ -6078,9 +4479,6 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma, const i READ_FLAG( code, isChroma ? "alf_chroma_coeff_sign" : "alf_luma_coeff_sign" ); coeff[ ind * MAX_NUM_ALF_LUMA_COEFF + i ] = ( code ) ? -coeff[ ind * MAX_NUM_ALF_LUMA_COEFF + i ] : coeff[ ind * MAX_NUM_ALF_LUMA_COEFF + i ]; } -#else - coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = alfGolombDecode( 3 ); -#endif CHECK( isChroma && ( coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] > 127 || coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] < -128 ) , "AlfCoeffC shall be in the range of -128 to 127, inclusive" ); @@ -6088,11 +4486,7 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma, const i } // Clipping values coding -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG if ( alfParam.nonLinearFlag[isChroma] ) -#else - if ( alfParam.nonLinearFlag[isChroma][altIdx] ) -#endif { // Filter coefficients diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h index c51828fc9bd0f71da47e9c65c335e5742d671592..fea43d0ab4ed719da9b0bb0399d924a7b4543e2d 100644 --- a/source/Lib/DecoderLib/VLCReader.h +++ b/source/Lib/DecoderLib/VLCReader.h @@ -157,11 +157,7 @@ protected: public: void setBitstream ( InputBitstream* p ) { m_pcBitstream = p; } void parseVPS ( VPS* pcVPS ); -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void parseDCI ( DCI* dci ); -#else - void parseDPS ( DPS* dps ); -#endif void parseSPS ( SPS* pcSPS ); void parsePPS ( PPS* pcPPS ); void parseAPS ( APS* pcAPS ); @@ -170,58 +166,27 @@ public: void parseScalingListAps ( APS* pcAPS ); void parseVUI ( VUI* pcVUI, SPS* pcSPS ); void parseConstraintInfo (ConstraintInfo *cinfo); -#if JVET_Q0786_PTL_only void parseProfileTierLevel(ProfileTierLevel *ptl, bool profileTierPresentFlag, int maxNumSubLayersMinus1); -#else - void parseProfileTierLevel ( ProfileTierLevel *ptl, int maxNumSubLayersMinus1); -#endif -#if JVET_P0118_HRD_ASPECTS void parseOlsHrdParameters(GeneralHrdParams* generalHrd, OlsHrdParams *olsHrd, uint32_t firstSubLayer, uint32_t tempLevelHigh); -#else - void parseHrdParameters ( HRDParameters *hrd, uint32_t firstSubLayer, uint32_t tempLevelHigh ); -#endif -#if JVET_P0118_HRD_ASPECTS void parseGeneralHrdParameters(GeneralHrdParams *generalHrd); -#endif -#if JVET_Q0775_PH_IN_SH void parsePictureHeader ( PicHeader* picHeader, ParameterSetManager *parameterSetManager, bool readRbspTrailingBits ); -#else - void parsePictureHeader ( PicHeader* picHeader, ParameterSetManager *parameterSetManager ); -#endif -#if JVET_Q0358_ALF_NALU_TID_CONSTRAINT void checkAlfNaluTidAndPicTid(Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager); -#endif void parseSliceHeader ( Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager, const int prevTid0POC ); -#if JVET_Q0819_PH_CHANGES void getSlicePoc ( Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager, const int prevTid0POC ); -#else - void parseSliceHeaderToPoc ( Slice* pcSlice, PicHeader* picHeader, ParameterSetManager *parameterSetManager, const int prevTid0POC ); -#endif void parseTerminatingBit ( uint32_t& ruiBit ); void parseRemainingBytes ( bool noTrailingBytesExpected ); void parsePredWeightTable( Slice* pcSlice, const SPS *sps ); -#if JVET_Q0819_PH_CHANGES void parsePredWeightTable ( PicHeader *picHeader, const SPS *sps ); -#endif void parseScalingList ( ScalingList* scalingList ); void decodeScalingList ( ScalingList *scalingList, uint32_t scalingListId, bool isPredictor); void parseReshaper ( SliceReshapeInfo& sliceReshaperInfo, const SPS* pcSPS, const bool isIntra ); void alfFilter( AlfParam& alfParam, const bool isChroma, const int altIdx ); -#if JVET_Q0795_CCALF void ccAlfFilter( Slice *pcSlice ); -#endif -#if JVET_P0117_PTL_SCALABILITY void dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, SPS *pcSPS); -#endif -#if JVET_Q0400_EXTRA_BITS void parseExtraPHBitsStruct( SPS *sps, int numBytes ); void parseExtraSHBitsStruct( SPS *sps, int numBytes ); -#endif private: -#if !JVET_Q0210_UEK_REMOVAL - int alfGolombDecode( const int k, const bool signed_val=true ); -#endif protected: bool xMoreRbspData(); diff --git a/source/Lib/EncoderLib/AnnexBwrite.h b/source/Lib/EncoderLib/AnnexBwrite.h index 8be7da54117f6ba3baea3dbe5cb8255701acaad7..15668d4a80c0eb4214129fb2582cb95361a45d7b 100644 --- a/source/Lib/EncoderLib/AnnexBwrite.h +++ b/source/Lib/EncoderLib/AnnexBwrite.h @@ -60,11 +60,7 @@ static std::vector<uint32_t> writeAnnexB(std::ostream& out, const AccessUnit& au static const uint8_t start_code_prefix[] = {0,0,0,1}; -#if JVET_Q0117_PARAMETER_SETS_CLEANUP if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_DCI || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_PPS) -#else - if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_DPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_PPS) -#endif { /* From AVC, When any of the following conditions are fulfilled, the diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index c777dae6acf5cba19183840c8d6541389f495540..56f66330b1c3b9a3a89118e2a7804ddf1e33f881 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -187,7 +187,6 @@ void CABACWriter::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i } } -#if JVET_Q0795_CCALF if ( !skipAlf ) { for ( int compIdx = 1; compIdx < getNumberValidComponents( cs.pcv->chrFormat ); compIdx++ ) @@ -205,7 +204,6 @@ void CABACWriter::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i } } } -#endif if ( CS::isDualITree(cs) && cs.pcv->chrFormat != CHROMA_400 && cs.pcv->maxCUWidth > 64 ) { @@ -500,10 +498,8 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione partitioner.exitCurrSplit(); if( chromaNotSplit ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(cs.pcv->chrFormat)) { -#endif CHECK( partitioner.chType != CHANNEL_TYPE_LUMA, "must be luma status" ); partitioner.chType = CHANNEL_TYPE_CHROMA; partitioner.treeType = TREE_C; @@ -512,9 +508,7 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione { coding_tree( cs, partitioner, cuCtx ); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif //recover partitioner.chType = CHANNEL_TYPE_LUMA; @@ -693,7 +687,6 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C } else { -#if JVET_Q0504_PLT_NON444 if( cu.chromaFormat != CHROMA_400 ) { cu_palette_info(cu, COMPONENT_Y, 3, cuCtx); @@ -702,22 +695,10 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C { cu_palette_info(cu, COMPONENT_Y, 1, cuCtx); } -#else - cu_palette_info(cu, COMPONENT_Y, 3, cuCtx); -#endif } end_of_ctu(cu, cuCtx); return; } -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - bdpcm_mode( cu, ComponentID( partitioner.chType ) ); -#if JVET_Q0438_MONOCHROME_BUGFIXES - if (!CS::isDualITree(cs) && isLuma(partitioner.chType) && isChromaEnabled(cu.chromaFormat)) -#else - if (!CS::isDualITree(cs) && isLuma(partitioner.chType)) -#endif - bdpcm_mode(cu, ComponentID(CHANNEL_TYPE_CHROMA)); -#endif // prediction data ( intra prediction modes / reference indexes + motion vectors ) cu_pred_data( cu ); @@ -787,11 +768,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); m_BinEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx)); } -#if JVET_Q0629_REMOVAL_PLT_4X4 if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) ) -#else - if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif { m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0)); } @@ -805,11 +782,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); if (CU::isIntra(cu) || CU::isPLT(cu)) { -#if JVET_Q0629_REMOVAL_PLT_4X4 if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) ) -#else - if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0)); } else @@ -832,20 +805,12 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) || cu.isConsIntra() ) { -#if JVET_Q0629_REMOVAL_PLT_4X4 if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) ) ) ) -#else - if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif m_BinEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0)); return; } m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); -#if JVET_Q0629_REMOVAL_PLT_4X4 if ((CU::isIntra(cu) || CU::isPLT(cu)) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) ) ) ) -#else - if ((CU::isIntra(cu) || CU::isPLT(cu)) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) -#endif { m_BinEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0)); } @@ -853,29 +818,17 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) } void CABACWriter::bdpcm_mode( const CodingUnit& cu, const ComponentID compID ) { -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM if( !cu.cs->sps->getBDPCMEnabledFlag() ) return; -#else - if( cu.cs->sps->getBDPCMEnabled() == 0 ) return; -#endif if( !CU::bdpcmAllowed( cu, compID ) ) return; int bdpcmMode = isLuma(compID) ? cu.bdpcmMode : cu.bdpcmModeChroma; -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 unsigned ctxId = isLuma(compID) ? 0 : 2; m_BinEncoder.encodeBin(bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode(ctxId)); -#else - m_BinEncoder.encodeBin(bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode(0)); -#endif if (bdpcmMode) { -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 m_BinEncoder.encodeBin(bdpcmMode > 1 ? 1 : 0, Ctx::BDPCMMode(ctxId+1)); -#else - m_BinEncoder.encodeBin(bdpcmMode > 1 ? 1 : 0, Ctx::BDPCMMode(1)); -#endif } if (isLuma(compID)) { @@ -892,20 +845,16 @@ void CABACWriter::cu_pred_data( const CodingUnit& cu ) { if( CU::isIntra( cu ) ) { -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 if( cu.Y().valid() ) { bdpcm_mode( cu, COMPONENT_Y ); } -#endif intra_luma_pred_modes ( cu ); -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 if( ( !cu.Y().valid() || ( !cu.isSepTree() && cu.Y().valid() ) ) && isChromaEnabled(cu.chromaFormat) ) { bdpcm_mode( cu, ComponentID(CHANNEL_TYPE_CHROMA) ); } -#endif intra_chroma_pred_modes( cu ); return; } @@ -1270,13 +1219,11 @@ void CABACWriter::intra_chroma_pred_modes( const CodingUnit& cu ) return; } -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 if( cu.bdpcmModeChroma ) { cu.firstPU->intraDir[1] = cu.bdpcmModeChroma == 2 ? VER_IDX : HOR_IDX; return; } -#endif const PredictionUnit* pu = cu.firstPU; intra_chroma_pred_mode( *pu ); @@ -1310,12 +1257,6 @@ void CABACWriter::intra_chroma_lmc_mode(const PredictionUnit& pu) void CABACWriter::intra_chroma_pred_mode(const PredictionUnit& pu) { -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - if (pu.cu->bdpcmModeChroma) - { - return; - } -#endif const unsigned intraDir = pu.intraDir[1]; if (pu.cu->colorTransform) @@ -1390,9 +1331,7 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; cuCtx.lfnstLastScanPos = false; cuCtx.violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif if( cu.ispMode && isLuma( partitioner.chType ) ) { @@ -1510,18 +1449,12 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u TransformUnit& tu = *cu.firstTU; uint32_t indexMaxSize = cu.useEscape[compBegin] ? (cu.curPLTSize[compBegin] + 1) : cu.curPLTSize[compBegin]; -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE int maxPltSize = cu.isSepTree() ? MAXPLTSIZE_DUALTREE : MAXPLTSIZE; -#endif if (cu.lastPLTSize[compBegin]) { -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE xEncodePLTPredIndicator(cu, maxPltSize, compBegin); -#else - xEncodePLTPredIndicator(cu, MAXPLTSIZE, compBegin); -#endif } uint32_t reusedPLTnum = 0; @@ -1530,11 +1463,7 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u if (cu.reuseflag[compBegin][idx]) reusedPLTnum++; } -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE if (reusedPLTnum < maxPltSize) -#else - if (reusedPLTnum < MAXPLTSIZE) -#endif { exp_golomb_eqprob(cu.curPLTSize[compBegin] - reusedPLTnum, 0); } @@ -1588,9 +1517,7 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u { cuPaletteSubblockInfo(cu, compBegin, numComp, subSetId, prevRunPos, prevRunType); } -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE CHECK(cu.curPLTSize[compBegin] > maxPltSize, " Current palette size is larger than maximum palette size"); -#endif } void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBegin, uint32_t numComp, int subSetId, uint32_t& prevRunPos, unsigned& prevRunType) { @@ -1685,22 +1612,14 @@ void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBe PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)comp); if (compID == COMPONENT_Y || compBegin != COMPONENT_Y) { -#if JVET_Q0491_PLT_ESCAPE exp_golomb_eqprob((unsigned)escapeValue.at(posx, posy), 5); -#else - exp_golomb_eqprob((unsigned)escapeValue.at(posx, posy), 3); -#endif DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos); } if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && posy % (1 << scaleY) == 0 && posx % (1 << scaleX) == 0) { uint32_t posxC = posx >> scaleX; uint32_t posyC = posy >> scaleY; -#if JVET_Q0491_PLT_ESCAPE exp_golomb_eqprob((unsigned)escapeValue.at(posxC, posyC), 5); -#else - exp_golomb_eqprob((unsigned)escapeValue.at(posxC, posyC), 3); -#endif DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos); } } @@ -1843,11 +1762,7 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) Mv mvd = pu.mvd[REF_PIC_LIST_0]; mvd.changeIbcPrecInternal2Amvr(pu.cu->imv); mvd_coding(mvd, 0); // already changed to signaling precision -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pu.cs->sps->getMaxNumIBCMergeCand() == 1) -#else - if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 ) -#endif { CHECK( pu.mvpIdx[REF_PIC_LIST_0], "mvpIdx for IBC mode should be 0" ); } @@ -1986,29 +1901,13 @@ void CABACWriter::merge_data(const PredictionUnit& pu) merge_idx(pu); return; } -#if JVET_Q0806 const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64; const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE pu.cs->sps->getMaxNumGeoCand() > 1 -#else - pu.cu->cs->picHeader->getMaxNumGeoCand() > 1 -#endif && pu.cu->lwidth() >= GEO_MIN_CU_SIZE && pu.cu->lheight() >= GEO_MIN_CU_SIZE && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth(); if (geoAvailable || ciipAvailable) -#else - const bool triangleAvailable = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - pu.cs->sps->getMaxNumGeoCand() > 1; -#else - pu.cu->cs->picHeader->getMaxNumTriangleCand() > 1; -#endif - const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE; - if (pu.cu->lwidth() * pu.cu->lheight() >= 64 - && (triangleAvailable || ciipAvailable)) -#endif { m_BinEncoder.encodeBin(pu.regularMergeFlag, Ctx::RegularMergeFlag(pu.cu->skip ? 0 : 1)); } @@ -2030,17 +1929,10 @@ void CABACWriter::merge_data(const PredictionUnit& pu) } else { -#if !JVET_Q0806 - if (triangleAvailable && ciipAvailable) - { - Ciip_flag(pu); - } -#else if (geoAvailable && ciipAvailable) { Ciip_flag(pu); } -#endif merge_idx(pu); } } @@ -2141,55 +2033,6 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) } else { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - bool splitDir = pu.triangleSplitDir; - uint8_t candIdx0 = pu.triangleMergeIdx0; - uint8_t candIdx1 = pu.triangleMergeIdx1; - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_split_dir=%d\n", splitDir ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx0=%d\n", candIdx0 ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx1=%d\n", candIdx1 ); - candIdx1 -= candIdx1 < candIdx0 ? 0 : 1; - auto encodeOneIdx = [this](uint8_t mrgIdx, int numCandminus1) - { - if (numCandminus1 == 0) - { - CHECK(mrgIdx, "Incorrect index!"); - return; - } - if(mrgIdx == 0) - { - this->m_BinEncoder.encodeBin( 0, Ctx::MergeIdx() ); - return; - } - else - { - this->m_BinEncoder.encodeBin( 1, Ctx::MergeIdx() ); - for( unsigned idx = 1; idx < numCandminus1; idx++ ) - { - this->m_BinEncoder.encodeBinEP( mrgIdx == idx ? 0 : 1 ); - if( mrgIdx == idx ) - { - break; - } - } - } - }; - m_BinEncoder.encodeBinEP(splitDir); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - const int maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand(); -#else - const int maxNumTriangleCand = pu.cs->picHeader->getMaxNumTriangleCand(); -#endif - CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates"); - CHECK(candIdx0 >= maxNumTriangleCand, "Incorrect candIdx0"); - CHECK(candIdx1 >= maxNumTriangleCand, "Incorrect candIdx1"); - encodeOneIdx(candIdx0, maxNumTriangleCand - 1); - encodeOneIdx(candIdx1, maxNumTriangleCand - 2); - return; - } -#else if( pu.cu->geoFlag ) { uint8_t splitDir = pu.geoSplitDir; @@ -2200,11 +2043,7 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx1=%d\n", candIdx1 ); xWriteTruncBinCode(splitDir, GEO_NUM_PARTITION_MODE); candIdx1 -= candIdx1 < candIdx0 ? 0 : 1; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE const int maxNumGeoCand = pu.cs->sps->getMaxNumGeoCand(); -#else - const int maxNumGeoCand = pu.cs->picHeader->getMaxNumGeoCand(); -#endif CHECK(maxNumGeoCand < 2, "Incorrect max number of geo candidates"); CHECK(candIdx0 >= maxNumGeoCand, "Incorrect candIdx0"); CHECK(candIdx1 >= maxNumGeoCand, "Incorrect candIdx1"); @@ -2224,18 +2063,11 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) } return; } -#endif int numCandminus1; if (pu.cu->predMode == MODE_IBC) -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE numCandminus1 = int(pu.cs->sps->getMaxNumIBCMergeCand()) - 1; else numCandminus1 = int(pu.cs->sps->getMaxNumMergeCand()) - 1; -#else - numCandminus1 = int(pu.cs->picHeader->getMaxNumIBCMergeCand()) - 1; - else - numCandminus1 = int(pu.cs->picHeader->getMaxNumMergeCand()) - 1; -#endif if( numCandminus1 > 0 ) { if( pu.mergeIdx == 0 ) @@ -2267,11 +2099,7 @@ void CABACWriter::mmvd_merge_idx(const PredictionUnit& pu) var0 = mvpIdx / MMVD_MAX_REFINE_NUM; var1 = (mvpIdx - (var0 * MMVD_MAX_REFINE_NUM)) / 4; var2 = mvpIdx - (var0 * MMVD_MAX_REFINE_NUM) - var1 * 4; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pu.cs->sps->getMaxNumMergeCand() > 1) -#else - if (pu.cs->picHeader->getMaxNumMergeCand() > 1) -#endif { static_assert(MMVD_BASE_MV_NUM == 2, ""); assert(var0 < 2); @@ -2581,21 +2409,14 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, Partiti const CodingUnit& cu = *tu.cu; const UnitArea& area = partitioner.currArea(); const unsigned trDepth = partitioner.currTrDepth; -#if !JVET_Q0438_MONOCHROME_BUGFIXES - const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode; -#endif ChromaCbfs chromaCbfs; CHECK(tu.depth != trDepth, " transform unit should be not be futher partitioned"); // cbf_cb & cbf_cr -#if JVET_Q0438_MONOCHROME_BUGFIXES if (area.chromaFormat != CHROMA_400) { const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode; if (area.blocks[COMPONENT_Cb].valid() && (!cu.isSepTree() || partitioner.chType == CHANNEL_TYPE_CHROMA) && (!cu.ispMode || chromaCbfISP)) -#else - if (area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && (!cu.isSepTree() || partitioner.chType == CHANNEL_TYPE_CHROMA) && (!cu.ispMode || chromaCbfISP)) -#endif { { unsigned cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; @@ -2618,13 +2439,11 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, Partiti { chromaCbfs = ChromaCbfs(false); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } else if (cu.isSepTree()) { chromaCbfs = ChromaCbfs(false); } -#endif if (!isChroma(partitioner.chType)) { @@ -2725,12 +2544,6 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, Partiti { for( ComponentID compID = COMPONENT_Cb; compID <= COMPONENT_Cr; compID = ComponentID( compID + 1 ) ) { -#if !REMOVE_PPS_REXT - if( TU::hasCrossCompPredInfo( tu, compID ) ) - { - cross_comp_pred( tu, compID ); - } -#endif if( cbf[ compID ] ) { residual_coding( tu, compID, &cuCtx ); @@ -2821,11 +2634,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, ts_flag ( tu, compID ); explicit_rdpcm_mode( tu, compID ); -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM if( tu.mtsIdx[compID] == MTS_SKIP && !tu.cs->slice->getTSResidualCodingDisabledFlag() ) -#else - if (tu.mtsIdx[compID] == MTS_SKIP) -#endif { residual_codingTS( tu, compID ); return; @@ -2872,18 +2681,10 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; cuCtx->lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; } -#if !JVET_Q0055_MTS_SIGNALLING - if( cuCtx && isLuma(compID) && ( cctx.posX(cctx.scanPosLast()) >= 16 || cctx.posY(cctx.scanPosLast()) >= 16 ) ) - { - cuCtx->violatesMtsCoeffConstraint = true; - } -#endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (cuCtx && isLuma(compID) && tu.mtsIdx[compID] != MTS_SKIP) { cuCtx->mtsLastScanPos |= cctx.scanPosLast() >= 1; } -#endif // code last coeff position @@ -2910,12 +2711,10 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, } residual_coding_subblock( cctx, coeff, stateTab, state ); -#if JVET_Q0055_MTS_SIGNALLING if ( cuCtx && isLuma(compID) && cctx.isSigGroup() && ( cctx.cgPosY() > 3 || cctx.cgPosX() > 3 ) ) { cuCtx->violatesMtsCoeffConstraint = true; } -#endif } } @@ -2937,11 +2736,7 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx ) int mtsIdx = tu.mtsIdx[COMPONENT_Y]; if( CU::isMTSAllowed( cu, COMPONENT_Y ) && cuCtx && !cuCtx->violatesMtsCoeffConstraint && -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx->mtsLastScanPos && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP) -#else - cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) -#endif { int symbol = mtsIdx != MTS_DCT2_DCT2 ? 1 : 0; int ctxIdx = 0; @@ -3024,7 +2819,6 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) const bool lumaFlag = cu.isSepTree() ? ( isLuma( cu.chType ) ? true : false ) : true; const bool chromaFlag = cu.isSepTree() ? ( isChroma( cu.chType ) ? true : false ) : true; bool nonZeroCoeffNonTsCorner8x8 = ( lumaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] ) || (chromaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] ); -#if JVET_Q0784_LFNST_COMBINATION bool isTrSkip = false; for (auto &currTU : CU::traverseTUs(cu)) { @@ -3038,9 +2832,6 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) } } } -#else - const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx[COMPONENT_Y] == MTS_SKIP; -#endif if( (!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isTrSkip ) { return; @@ -3411,47 +3202,6 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC -#if !REMOVE_PPS_REXT -//================================================================================ -// clause 7.3.8.12 -//-------------------------------------------------------------------------------- -// void cross_comp_pred( tu, compID ) -//================================================================================ - -void CABACWriter::cross_comp_pred( const TransformUnit& tu, ComponentID compID ) -{ - CHECK(!( !isLuma( compID ) ), "Unspecified error"); - signed char alpha = tu.compAlpha[compID]; - unsigned ctxBase = ( compID == COMPONENT_Cr ? 5 : 0 ); - if( alpha == 0 ) - { - m_BinEncoder.encodeBin( 0, Ctx::CrossCompPred( ctxBase ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "cross_comp_pred() etype=%d pos=(%d,%d) alpha=%d\n", compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.compAlpha[compID] ); - return; - } - - static const unsigned log2AbsAlphaMinus1Table[8] = { 0, 1, 1, 2, 2, 2, 3, 3 }; - unsigned sign = ( alpha < 0 ); - if( sign ) - { - alpha = -alpha; - } - CHECK(!( alpha <= 8 ), "Unspecified error"); - m_BinEncoder.encodeBin( 1, Ctx::CrossCompPred(ctxBase) ); - if( alpha > 1) - { - m_BinEncoder.encodeBin( 1, Ctx::CrossCompPred(ctxBase+1) ); - unary_max_symbol( log2AbsAlphaMinus1Table[alpha-1]-1, Ctx::CrossCompPred(ctxBase+2), Ctx::CrossCompPred(ctxBase+3), 2 ); - } - else - { - m_BinEncoder.encodeBin( 0, Ctx::CrossCompPred(ctxBase+1) ); - } - m_BinEncoder.encodeBin( sign, Ctx::CrossCompPred(ctxBase+4) ); - - DTRACE( g_trace_ctx, D_SYNTAX, "cross_comp_pred() etype=%d pos=(%d,%d) alpha=%d\n", compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.compAlpha[compID] ); -} -#endif @@ -3571,7 +3321,6 @@ void CABACWriter::codeAlfCtuEnableFlag( CodingStructure& cs, uint32_t ctuRsAddr, } } -#if JVET_Q0795_CCALF void CABACWriter::codeCcAlfFilterControlIdc(uint8_t idcVal, CodingStructure &cs, const ComponentID compID, const int curIdx, const uint8_t *filterControlIdc, Position lumaPos, const int filterCount) @@ -3612,7 +3361,6 @@ void CABACWriter::codeCcAlfFilterControlIdc(uint8_t idcVal, CodingStructure &cs, } DTRACE( g_trace_ctx, D_SYNTAX, "ccAlfFilterControlIdc() compID=%d pos=(%d,%d) ctxt=%d, filterCount=%d, idcVal=%d\n", compID, lumaPos.x, lumaPos.y, ctxt, filterCount, idcVal ); } -#endif void CABACWriter::code_unary_fixed( unsigned symbol, unsigned ctxId, unsigned unary_max, unsigned fixed ) { diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index cd8dc1ae6a53ba593573f93963f9c82767a9efcc..11d9f655968f5133bac94cd34adf51918cc78739 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -153,10 +153,6 @@ public: void residual_coding_subblockTS( CoeffCodingContext& cctx, const TCoeff* coeff ); void joint_cb_cr ( const TransformUnit& tu, const int cbfMask ); -#if !REMOVE_PPS_REXT - // cross component prediction (clause 7.3.8.12) - void cross_comp_pred ( const TransformUnit& tu, ComponentID compID ); -#endif void codeAlfCtuEnableFlags ( CodingStructure& cs, ChannelType channel, AlfParam* alfParam); void codeAlfCtuEnableFlags ( CodingStructure& cs, ComponentID compID, AlfParam* alfParam); @@ -166,10 +162,8 @@ public: void codeAlfCtuAlternatives ( CodingStructure& cs, ChannelType channel, AlfParam* alfParam); void codeAlfCtuAlternatives ( CodingStructure& cs, ComponentID compID, AlfParam* alfParam); void codeAlfCtuAlternative ( CodingStructure& cs, uint32_t ctuRsAddr, const int compIdx, const AlfParam* alfParam = NULL ); -#if JVET_Q0795_CCALF void codeCcAlfFilterControlIdc(uint8_t idcVal, CodingStructure &cs, const ComponentID compID, const int curIdx, const uint8_t *filterControlIdc, Position lumaPos, const int filterCount); -#endif private: void unary_max_symbol ( unsigned symbol, unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol ); diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index d6e4d15f8511fd54757ae261b07df369d92d0cd8..82b2d9027aa76c235779b2a7be6f03506f6e557e 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -42,7 +42,6 @@ #define AlfCtx(c) SubCtx( Ctx::Alf, c) std::vector<double> EncAdaptiveLoopFilter::m_lumaLevelToWeightPLUT; -#if JVET_Q0795_CCALF #include <algorithm> #if MAX_NUM_CC_ALF_FILTERS>1 @@ -54,7 +53,6 @@ struct FilterIdxCount bool compareCounts(FilterIdxCount a, FilterIdxCount b) { return a.count > b.count; } #endif -#endif void AlfCovariance::getClipMax(const AlfFilterShape& alfShape, int *clip_max) const { @@ -255,7 +253,6 @@ double AlfCovariance::calcErrorForCoeffs( const int *clip, const int *coeff, con return error / factor; } -#if JVET_Q0795_CCALF double AlfCovariance::calcErrorForCcAlfCoeffs(const int* coeff, const int numCoeff, const int bitDepth) const { double factor = 1 << (bitDepth - 1); @@ -274,7 +271,6 @@ double AlfCovariance::calcErrorForCcAlfCoeffs(const int* coeff, const int numCoe return error / factor; } -#endif double AlfCovariance::calculateError( const int *clip, const double *coeff, const int numCoeff ) const { @@ -453,12 +449,10 @@ EncAdaptiveLoopFilter::EncAdaptiveLoopFilter( int& apsIdStart ) m_alfWSSD = 0; -#if JVET_Q0795_CCALF m_alfCovarianceCcAlf[0] = nullptr; m_alfCovarianceCcAlf[1] = nullptr; m_alfCovarianceFrameCcAlf[0] = nullptr; m_alfCovarianceFrameCcAlf[1] = nullptr; -#endif } void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], const int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ) @@ -541,7 +535,6 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co } m_alfCtbFilterSetIndexTmp.resize(m_numCTUsInPic); memset(m_clipDefaultEnc, 0, sizeof(m_clipDefaultEnc)); -#if JVET_Q0795_CCALF m_apsIdCcAlfStart[0] = (int) MAX_NUM_APS; m_apsIdCcAlfStart[1] = (int) MAX_NUM_APS; for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ ) @@ -585,7 +578,6 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co m_buf = new PelBuf( m_bufOrigin, picWidth >> getComponentScaleX(COMPONENT_Cb,chromaFormatIDC), picWidth >> getComponentScaleX(COMPONENT_Cb,chromaFormatIDC), picHeight >> getComponentScaleY(COMPONENT_Cb,chromaFormatIDC) ); m_lumaSwingGreaterThanThresholdCount = new uint64_t[m_numCTUsInPic]; m_chromaSampleCountNearMidPoint = new uint64_t[m_numCTUsInPic]; -#endif } void EncAdaptiveLoopFilter::destroy() @@ -710,7 +702,6 @@ void EncAdaptiveLoopFilter::destroy() m_ctbDistortionUnfilter[comp] = nullptr; } -#if JVET_Q0795_CCALF for (int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++) { int numFilters = MAX_NUM_CC_ALF_FILTERS; @@ -807,7 +798,6 @@ void EncAdaptiveLoopFilter::destroy() delete[] m_chromaSampleCountNearMidPoint; m_chromaSampleCountNearMidPoint = nullptr; } -#endif AdaptiveLoopFilter::destroy(); } @@ -821,7 +811,6 @@ void EncAdaptiveLoopFilter::initCABACEstimator( CABACEncoder* cabacEncoder, CtxC m_CABACEstimator->resetBits(); } -#if JVET_Q0795_CCALF void EncAdaptiveLoopFilter::xSetupCcAlfAPS( CodingStructure &cs ) { if (m_ccAlfFilterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1]) @@ -889,7 +878,6 @@ void EncAdaptiveLoopFilter::xSetupCcAlfAPS( CodingStructure &cs ) cs.slice->setTileGroupCcAlfCrEnabledFlag(false); } } -#endif void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambdas #if ENABLE_QPA @@ -913,9 +901,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda if (alfAPS) { alfAPS->getAlfAPSParam().reset(); -#if JVET_Q0795_CCALF alfAPS->getCcAlfAPSParam().reset(); -#endif alfAPS = nullptr; } } @@ -924,9 +910,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda alfParam.reset(); const TempCtx ctxStart(m_CtxCache, AlfCtx(m_CABACEstimator->getCtx())); -#if JVET_Q0795_CCALF const TempCtx ctxStartCcAlf(m_CtxCache, SubCtx(Ctx::CcAlfFilterControlFlag, m_CABACEstimator->getCtx())); -#endif // set available filter shapes alfParam.filterShapes = m_filterShapes; @@ -1041,9 +1025,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda ); // derive filter (chroma) -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(cs.pcv->chrFormat)) -#endif { alfEncoder( cs, alfParam, orgYuv, recYuv, cs.getRecoBuf(), CHANNEL_TYPE_CHROMA #if ENABLE_QPA @@ -1065,7 +1047,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda alfReconstructor(cs, recYuv); -#if JVET_Q0795_CCALF // Do not transmit CC ALF if it is unchanged if (cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) { @@ -1112,7 +1093,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda m_ccAlfFilterParam.ccAlfCoeff[compIdx - 1], -1); } } -#endif } double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, const int iShapeIdx, ChannelType channel, @@ -1274,15 +1254,9 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam, setCtuAlternativeChroma( m_ctuAlternativeTmp, 0 ); } -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG const int nonLinearFlagMax = ( isLuma( channel ) ? m_encCfg->getUseNonLinearAlfLuma() : m_encCfg->getUseNonLinearAlfChroma()) // For Chroma non linear flag is check for each alternative filter ? 2 : 1; -#else - const int nonLinearFlagMax = - ( isLuma( channel ) ? m_encCfg->getUseNonLinearAlfLuma() : 0 ) // For Chroma non linear flag is check for each alternative filter - ? 2 : 1; -#endif for( int nonLinearFlag = 0; nonLinearFlag < nonLinearFlagMax; nonLinearFlag++ ) { @@ -1292,12 +1266,7 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam, m_alfParamTemp.numAlternativesChroma = numAlternatives; //2. all CTUs are on setEnableFlag( m_alfParamTemp, channel, true ); -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG m_alfParamTemp.nonLinearFlag[channel] = nonLinearFlag; -#else - if (isLuma(channel)) - m_alfParamTemp.nonLinearFlag[channel][0] = nonLinearFlag; -#endif m_CABACEstimator->getCtx() = AlfCtx( ctxStart ); setCtuEnableFlag( m_ctuEnableFlag, channel, 1 ); // all alternatives are on @@ -1377,11 +1346,7 @@ void EncAdaptiveLoopFilter::copyAlfParam( AlfParam& alfParamDst, AlfParam& alfPa alfParamDst.enabledFlag[COMPONENT_Cb] = alfParamSrc.enabledFlag[COMPONENT_Cb]; alfParamDst.enabledFlag[COMPONENT_Cr] = alfParamSrc.enabledFlag[COMPONENT_Cr]; alfParamDst.numAlternativesChroma = alfParamSrc.numAlternativesChroma; -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG alfParamDst.nonLinearFlag[CHANNEL_TYPE_CHROMA] = alfParamSrc.nonLinearFlag[CHANNEL_TYPE_CHROMA]; -#else - memcpy( alfParamDst.nonLinearFlag[CHANNEL_TYPE_CHROMA], alfParamSrc.nonLinearFlag[CHANNEL_TYPE_CHROMA], sizeof( alfParamDst.nonLinearFlag[CHANNEL_TYPE_CHROMA] ) ); -#endif memcpy( alfParamDst.chromaCoeff, alfParamSrc.chromaCoeff, sizeof( alfParamDst.chromaCoeff ) ); memcpy( alfParamDst.chromaClipp, alfParamSrc.chromaClipp, sizeof( alfParamDst.chromaClipp ) ); } @@ -1401,11 +1366,7 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double //get filter coeff if( isLuma( channel ) ) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG std::fill_n(m_alfClipMerged[iShapeIdx][0][0], MAX_NUM_ALF_LUMA_COEFF*MAX_NUM_ALF_CLASSES*MAX_NUM_ALF_CLASSES, m_alfParamTemp.nonLinearFlag[channel] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); -#else - std::fill_n(m_alfClipMerged[iShapeIdx][0][0], MAX_NUM_ALF_LUMA_COEFF*MAX_NUM_ALF_CLASSES*MAX_NUM_ALF_CLASSES, m_alfParamTemp.nonLinearFlag[channel][0] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); -#endif // Reset Merge Tmp Cov m_alfCovarianceMerged[iShapeIdx][MAX_NUM_ALF_CLASSES].reset(AlfNumClippingValues[channel]); m_alfCovarianceMerged[iShapeIdx][MAX_NUM_ALF_CLASSES + 1].reset(AlfNumClippingValues[channel]); @@ -1426,15 +1387,11 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double for( int nonLinearFlag = 0; nonLinearFlag < nonLinearFlagMax; nonLinearFlag++ ) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG int currentNonLinearFlag = m_alfParamTemp.nonLinearFlag[channel] ? 1 : 0; if (nonLinearFlag != currentNonLinearFlag) { continue; } -#else - m_alfParamTemp.nonLinearFlag[channel][altIdx] = nonLinearFlag; -#endif std::fill_n(m_filterClippSet[altIdx], MAX_NUM_ALF_CHROMA_COEFF, nonLinearFlag ? AlfNumClippingValues[CHANNEL_TYPE_CHROMA] / 2 : 0 ); double dist = m_alfCovarianceFrame[channel][iShapeIdx][altIdx].pixAcc + deriveCoeffQuant( m_filterClippSet[altIdx], m_filterCoeffSet[altIdx], m_alfCovarianceFrame[channel][iShapeIdx][altIdx], alfFilterShape, m_NUM_BITS, nonLinearFlag ); @@ -1458,11 +1415,7 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double m_alfParamTemp = bestSliceParam; } uiCoeffBits += lengthUvlc( m_alfParamTemp.numAlternativesChroma-1 ); -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG uiCoeffBits++; -#else - uiCoeffBits += m_alfParamTemp.numAlternativesChroma; // non-linear flags -#endif } if (onlyFilterCost) { @@ -1494,19 +1447,11 @@ int EncAdaptiveLoopFilter::getChromaCoeffRate( AlfParam& alfParam, int altIdx ) // Filter coefficients for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_Q0210_UEK_REMOVAL iBits += lengthUvlc( abs( alfParam.chromaCoeff[ altIdx ][ i ] ) ); // alf_coeff_chroma[altIdx][i] if( ( alfParam.chromaCoeff[ altIdx ][ i ] ) != 0 ) iBits += 1; -#else - iBits += lengthGolomb( alfParam.chromaCoeff[ altIdx ][ i ], 3 ); // alf_coeff_chroma[altIdx][i] -#endif } -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_CHROMA] ) -#else - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] ) -#endif { for (int i = 0; i < alfShape.numCoeff - 1; i++) { @@ -1667,32 +1612,20 @@ int EncAdaptiveLoopFilter::getCostFilterCoeffForce0( AlfFilterShape& alfShape, i { for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_Q0210_UEK_REMOVAL len += lengthUvlc( abs( pDiffQFilterCoeffIntPP[ ind ][ i ] ) ); // alf_coeff_luma_delta[i][j] if( ( abs( pDiffQFilterCoeffIntPP[ ind ][ i ] ) != 0 ) ) len += 1; -#else - len += lengthGolomb( abs( pDiffQFilterCoeffIntPP[ ind ][ i ] ), 3 ); // alf_coeff_luma_delta[i][j] -#endif } } else { for (int i = 0; i < alfShape.numCoeff - 1; i++) { -#if JVET_Q0210_UEK_REMOVAL len += lengthUvlc( 0 ); // alf_coeff_luma_delta[i][j] -#else - len += lengthGolomb( 0, 3 ); // alf_coeff_luma_delta[i][j] -#endif } } } -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ) -#else - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) -#endif { for (int ind = 0; ind < numFilters; ++ind) { @@ -1743,13 +1676,9 @@ int EncAdaptiveLoopFilter::lengthFilterCoeffs( AlfFilterShape& alfShape, const i { for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_Q0210_UEK_REMOVAL bitCnt += lengthUvlc( abs( FilterCoeff[ ind ][ i ] ) ); if( abs( FilterCoeff[ ind ][ i ] ) != 0 ) bitCnt += 1; -#else - bitCnt += lengthGolomb( abs( FilterCoeff[ ind ][ i ] ), 3 ); -#endif } } return bitCnt; @@ -1765,30 +1694,18 @@ double EncAdaptiveLoopFilter::getDistForce0( AlfFilterShape& alfShape, const int bitsVarBin[ind] = 0; for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_Q0210_UEK_REMOVAL bitsVarBin[ ind ] += lengthUvlc( abs( m_filterCoeffSet[ ind ][ i ] ) ); if( abs( m_filterCoeffSet[ ind ][ i ] ) != 0 ) bitsVarBin[ ind ] += 1; -#else - bitsVarBin[ ind ] += lengthGolomb( abs( m_filterCoeffSet[ ind ][ i ] ), 3 ); -#endif } } int zeroBitsVarBin = 0; for (int i = 0; i < alfShape.numCoeff - 1; i++) { -#if JVET_Q0210_UEK_REMOVAL zeroBitsVarBin += lengthUvlc( 0 ); -#else - zeroBitsVarBin += lengthGolomb( 0, 3 ); -#endif } -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ) -#else - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) -#endif { for (int ind = 0; ind < numFilters; ++ind) { @@ -1837,25 +1754,6 @@ int EncAdaptiveLoopFilter::lengthUvlc( int uiCode ) return ( uiLength >> 1 ) + ( ( uiLength + 1 ) >> 1 ); } -#if !JVET_Q0210_UEK_REMOVAL -int EncAdaptiveLoopFilter::lengthGolomb( int coeffVal, int k, bool signed_coeff ) -{ - int numBins = 0; - unsigned int symbol = abs( coeffVal ); - while( symbol >= ( unsigned int ) ( 1 << k ) ) - { - numBins++; - symbol -= 1 << k; - k++; - } - numBins += ( k + 1 ); - if( signed_coeff && coeffVal != 0 ) - { - numBins++; - } - return numBins; -} -#endif double EncAdaptiveLoopFilter::deriveFilterCoeffs( AlfCovariance* cov, AlfCovariance* covMerged, int clipMerged[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_LUMA_COEFF], AlfFilterShape& alfShape, short* filterIndices, int numFilters, double errorTabForce0Coeff[MAX_NUM_ALF_CLASSES][2], AlfParam& alfParam ) { @@ -1955,7 +1853,6 @@ void EncAdaptiveLoopFilter::roundFiltCoeff( int *filterCoeffQuant, double *filte } } -#if JVET_Q0795_CCALF void EncAdaptiveLoopFilter::roundFiltCoeffCCALF( int *filterCoeffQuant, double *filterCoeff, const int numCoeff, const int factor ) { for( int i = 0; i < numCoeff; i++ ) @@ -1976,7 +1873,6 @@ void EncAdaptiveLoopFilter::roundFiltCoeffCCALF( int *filterCoeffQuant, double * filterCoeffQuant[i] = CCALF_SMALL_TAB[best_index] * sign; } } -#endif void EncAdaptiveLoopFilter::mergeClasses( const AlfFilterShape& alfShape, AlfCovariance* cov, AlfCovariance* covMerged, int clipMerged[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_LUMA_COEFF], const int numClasses, short filterIndices[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES] ) { @@ -1997,33 +1893,20 @@ void EncAdaptiveLoopFilter::mergeClasses( const AlfFilterShape& alfShape, AlfCov indexList[i] = i; availableClass[i] = true; covMerged[i] = cov[i]; -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG covMerged[i].numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#else - covMerged[i].numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#endif } // Try merging different covariance matrices // temporal AlfCovariance structure is allocated as the last element in covMerged array, the size of covMerged is MAX_NUM_ALF_CLASSES + 1 AlfCovariance& tmpCov = covMerged[MAX_NUM_ALF_CLASSES]; -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG tmpCov.numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#else - tmpCov.numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#endif // init Clip for( int i = 0; i < numClasses; i++ ) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG std::fill_n(clipMerged[numRemaining-1][i], MAX_NUM_ALF_LUMA_COEFF, m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); if ( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ) -#else - std::fill_n(clipMerged[numRemaining-1][i], MAX_NUM_ALF_LUMA_COEFF, m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); - if ( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) -#endif { err[i] = covMerged[i].optimizeFilterClip( alfShape, clipMerged[numRemaining-1][i] ); } @@ -2054,11 +1937,7 @@ void EncAdaptiveLoopFilter::mergeClasses( const AlfFilterShape& alfShape, AlfCov { tmpClip[l] = (clipMerged[numRemaining-1][i][l] + clipMerged[numRemaining-1][j][l] + 1 ) >> 1; } -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG double errorMerged = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? tmpCov.optimizeFilterClip(alfShape, tmpClip) : tmpCov.calculateError(tmpClip); -#else - double errorMerged = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? tmpCov.optimizeFilterClip( alfShape, tmpClip ) : tmpCov.calculateError( tmpClip ); -#endif double error = errorMerged - error1 - error2; if( error < errorMin ) @@ -2755,11 +2634,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar { int bitNL[2] = { 0, 0 }; double errNL[2] = { 0.0, 0.0 }; -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] = 1; -#else - m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] = 1; -#endif if (m_encCfg->getUseNonLinearAlfLuma()) { errNL[1] = getFilterCoeffAndCost(cs, 0, CHANNEL_TYPE_LUMA, true, 0, bitNL[1], true); @@ -2769,11 +2644,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar { errNL[1] = MAX_DOUBLE; } -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] = 0; -#else - m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] = 0; -#endif errNL[0] = getFilterCoeffAndCost(cs, 0, CHANNEL_TYPE_LUMA, true, 0, bitNL[0], true); int bitsNewFilterTempLuma = bitNL[0]; @@ -2912,10 +2783,8 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar }// for (int numTemporalAps = 0; numTemporalAps < apsIds.size(); numTemporalAps++) }//for (int useNewFilter = 0; useNewFilter <= 1; useNewFilter++) -#if JVET_Q0795_CCALF cs.slice->setTileGroupCcAlfCbApsId(newApsId); cs.slice->setTileGroupCcAlfCrApsId(newApsId); -#endif if (costOff <= costMin) { @@ -2959,10 +2828,8 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } //chroma -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(cs.pcv->chrFormat)) { -#endif m_alfParamTemp = alfParamNewFiltersBest; if( m_alfParamTemp.numAlternativesChroma < 1 ) { @@ -3119,13 +2986,11 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } } -#if JVET_Q0795_CCALF if (newApsIdChroma >= 0) { cs.slice->setTileGroupCcAlfCbApsId(newApsIdChroma); cs.slice->setTileGroupCcAlfCrApsId(newApsIdChroma); } -#endif if (costOff < costMin) { cs.slice->setTileGroupAlfEnabledFlag(COMPONENT_Cb, false); @@ -3152,12 +3017,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar newAPS->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA] = false; } newAPS->getAlfAPSParam().numAlternativesChroma = alfParamNewFilters.numAlternativesChroma; -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG newAPS->getAlfAPSParam().nonLinearFlag[CHANNEL_TYPE_CHROMA] = alfParamNewFilters.nonLinearFlag[CHANNEL_TYPE_CHROMA]; -#else - for( int altIdx = 0; altIdx < MAX_NUM_ALF_ALTERNATIVES_CHROMA; ++altIdx ) - newAPS->getAlfAPSParam().nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] = alfParamNewFilters.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx]; -#endif newAPS->setTemporalId( cs.slice->getTLayer() ); for (int altIdx = 0; altIdx < MAX_NUM_ALF_ALTERNATIVES_CHROMA; ++altIdx ) for (int i = 0; i < MAX_NUM_ALF_CHROMA_COEFF; i++) @@ -3170,9 +3030,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } apss[cs.slice->getTileGroupApsIdChroma()] = m_apsMap->getPS((cs.slice->getTileGroupApsIdChroma() << NUM_APS_TYPE_LEN) + ALF_APS); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif } void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitBuf& recExtBuf) @@ -3366,7 +3224,6 @@ int EncAdaptiveLoopFilter::getMaxNumAlternativesChroma( ) return std::min<int>( m_numCTUsInPic * 2, m_encCfg->getMaxNumAlfAlternativesChroma() ); } -#if JVET_Q0795_CCALF int EncAdaptiveLoopFilter::getCoeffRateCcAlf(short chromaCoeff[MAX_NUM_CC_ALF_FILTERS][MAX_NUM_CC_ALF_CHROMA_COEFF], bool filterEnabled[MAX_NUM_CC_ALF_FILTERS], uint8_t filterCount, ComponentID compID) { int bits = 0; @@ -4362,4 +4219,3 @@ void EncAdaptiveLoopFilter::countChromaSampleValueNearMidPoint(const Pel* chroma chroma += (chromaStride << log2BlockHeight); } } -#endif diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h index 2f10736366dd0dd5b41996e34ef7d130958e9a76..6aad7ca7a7e6952d1f0216cb0d420ea696362fee 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h @@ -203,24 +203,17 @@ struct AlfCovariance double calculateError( const int *clip, const double *coeff ) const { return calculateError(clip, coeff, numCoeff); } double calculateError( const int *clip, const double *coeff, const int numCoeff ) const; double calcErrorForCoeffs( const int *clip, const int *coeff, const int numCoeff, const int bitDepth ) const; -#if JVET_Q0795_CCALF double calcErrorForCcAlfCoeffs(const int* coeff, const int numCoeff, const int bitDepth) const; -#endif void getClipMax(const AlfFilterShape& alfShape, int *clip_max) const; void reduceClipCost(const AlfFilterShape& alfShape, int *clip) const; -#if JVET_Q0795_CCALF int gnsSolveByChol( TE LHS, double* rhs, double *x, int numEq ) const; -#endif private: // Cholesky decomposition int gnsSolveByChol( const int *clip, double *x, int numEq ) const; -#if !JVET_Q0795_CCALF - int gnsSolveByChol( TE LHS, double* rhs, double *x, int numEq ) const; -#endif void gnsBacksubstitution( TE R, double* z, int size, double* A ) const; void gnsTransposeBacksubstitution( TE U, double* rhs, double* x, int order ) const; int gnsCholeskyDec( TE inpMatr, TE outMatr, int numEq ) const; @@ -241,10 +234,8 @@ private: uint8_t* m_ctuEnableFlagTmp[MAX_NUM_COMPONENT]; uint8_t* m_ctuEnableFlagTmp2[MAX_NUM_COMPONENT]; uint8_t* m_ctuAlternativeTmp[MAX_NUM_COMPONENT]; -#if JVET_Q0795_CCALF AlfCovariance*** m_alfCovarianceCcAlf[2]; // [compIdx-1][shapeIdx][ctbAddr][filterIdx] AlfCovariance** m_alfCovarianceFrameCcAlf[2]; // [compIdx-1][shapeIdx][filterIdx] -#endif //for RDO AlfParam m_alfParamTemp; @@ -269,7 +260,6 @@ private: int m_filterTmp[MAX_NUM_ALF_LUMA_COEFF]; int m_clipTmp[MAX_NUM_ALF_LUMA_COEFF]; -#if JVET_Q0795_CCALF int m_apsIdCcAlfStart[2]; short m_bestFilterCoeffSet[MAX_NUM_CC_ALF_FILTERS][MAX_NUM_CC_ALF_CHROMA_COEFF]; @@ -286,7 +276,6 @@ private: uint8_t* m_bestFilterControl; // best saved filter control int m_reuseApsId[2]; bool m_limitCcAlf; -#endif public: EncAdaptiveLoopFilter( int& apsIdStart ); @@ -304,15 +293,10 @@ public: , const double lambdaChromaWeight #endif ); -#if JVET_Q0795_CCALF int getNewCcAlfApsId(CodingStructure &cs, int cIdx); -#endif void initCABACEstimator( CABACEncoder* cabacEncoder, CtxCache* ctxCache, Slice* pcSlice, ParameterSetMap<APS>* apsMap ); void create( const EncCfg* encCfg, const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], const int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); void destroy(); -#if !JVET_Q0210_UEK_REMOVAL - static int lengthGolomb( int coeffVal, int k, bool signed_coeff = true ); -#endif void setApsIdStart( int i) { m_apsIdStart = i; } private: @@ -330,14 +314,12 @@ private: void deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnitBuf& recYuv, CodingStructure& cs ); void getBlkStats(AlfCovariance* alfCovariace, const AlfFilterShape& shape, AlfClassifier** classifier, Pel* org, const int orgStride, Pel* rec, const int recStride, const CompArea& areaDst, const CompArea& area, const ChannelType channel, int vbCTUHeight, int vbPos); void calcCovariance(int ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues], const Pel *rec, const int stride, const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, int vbDistance); -#if JVET_Q0795_CCALF void deriveStatsForCcAlfFiltering(const PelUnitBuf &orgYuv, const PelUnitBuf &recYuv, const int compIdx, const int maskStride, const uint8_t filterIdc, CodingStructure &cs); void getBlkStatsCcAlf(AlfCovariance &alfCovariance, const AlfFilterShape &shape, const PelUnitBuf &orgYuv, const PelUnitBuf &recYuv, const UnitArea &areaDst, const UnitArea &area, const ComponentID compID, const int yPos); void calcCovarianceCcAlf(int ELocal[MAX_NUM_CC_ALF_CHROMA_COEFF][1], const Pel* rec, const int stride, const AlfFilterShape& shape, int vbDistance); -#endif void mergeClasses(const AlfFilterShape& alfShape, AlfCovariance* cov, AlfCovariance* covMerged, int clipMerged[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_LUMA_COEFF], const int numClasses, short filterIndices[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES]); @@ -351,9 +333,7 @@ private: #endif const int numClasses, const int numCoeff, double& distUnfilter ); void roundFiltCoeff( int *filterCoeffQuant, double *filterCoeff, const int numCoeff, const int factor ); -#if JVET_Q0795_CCALF void roundFiltCoeffCCALF( int *filterCoeffQuant, double *filterCoeff, const int numCoeff, const int factor ); -#endif double getDistCoeffForce0( bool* codedVarBins, double errorForce0CoeffTab[MAX_NUM_ALF_CLASSES][2], int* bitsVarBin, int zeroBitsVarBin, const int numFilters); int lengthUvlc( int uiCode ); @@ -378,7 +358,6 @@ private: void setCtuAlternativeChroma( uint8_t* ctuAlts[MAX_NUM_COMPONENT], uint8_t val ); void copyCtuAlternativeChroma( uint8_t* ctuAltsDst[MAX_NUM_COMPONENT], uint8_t* ctuAltsSrc[MAX_NUM_COMPONENT] ); int getMaxNumAlternativesChroma( ); -#if JVET_Q0795_CCALF int getCoeffRateCcAlf(short chromaCoeff[MAX_NUM_CC_ALF_FILTERS][MAX_NUM_CC_ALF_CHROMA_COEFF], bool filterEnabled[MAX_NUM_CC_ALF_FILTERS], uint8_t filterCount, ComponentID compID); void deriveCcAlfFilterCoeff( ComponentID compID, const PelUnitBuf& recYuv, const PelUnitBuf& recYuvExt, short filterCoeff[MAX_NUM_CC_ALF_FILTERS][MAX_NUM_CC_ALF_CHROMA_COEFF], const uint8_t filterIdx ); void computeLog2BlockSizeDistortion(const Pel *org, int orgStride, const Pel *dec, int decStride, int height, @@ -399,7 +378,6 @@ private: void xSetupCcAlfAPS( CodingStructure& cs ); void countLumaSwingGreaterThanThreshold(const Pel* luma, int lumaStride, int height, int width, int log2BlockWidth, int log2BlockHeight, uint64_t* lumaSwingGreaterThanThresholdCount, int lumaCountStride); void countChromaSampleValueNearMidPoint(const Pel* chroma, int chromaStride, int height, int width, int log2BlockWidth, int log2BlockHeight, uint64_t* chromaSampleCountNearMidPoint, int chromaSampleCountNearMidPointStride); -#endif }; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index f06b1c0eb616a21196e7b4b35b0dddcb042fd716..4aab1126d30c0865234004eb42ccaa603a54e47d 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -68,12 +68,10 @@ struct GOPEntry double m_QPFactor; int m_tcOffsetDiv2; int m_betaOffsetDiv2; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int m_CbTcOffsetDiv2; int m_CbBetaOffsetDiv2; int m_CrTcOffsetDiv2; int m_CrBetaOffsetDiv2; -#endif int m_temporalId; bool m_refPic; int8_t m_sliceType; @@ -99,12 +97,10 @@ struct GOPEntry , m_QPFactor(0) , m_tcOffsetDiv2(0) , m_betaOffsetDiv2(0) -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS , m_CbTcOffsetDiv2(0) , m_CbBetaOffsetDiv2(0) , m_CrTcOffsetDiv2(0) , m_CrBetaOffsetDiv2(0) -#endif , m_temporalId(0) , m_refPic(false) , m_sliceType('P') @@ -185,9 +181,7 @@ protected: bool m_noPartitionConstraintsOverrideConstraintFlag; bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; -#if JVET_Q0795_CCALF bool m_noCCAlfConstraintFlag; -#endif bool m_bNoRefWraparoundConstraintFlag; bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; @@ -202,11 +196,7 @@ protected: bool m_noIbcConstraintFlag; bool m_bNoCiipConstraintFlag; bool m_noFPelMmvdConstraintFlag; -#if !JVET_Q0806 - bool m_bNoTriangleConstraintFlag; -#else bool m_noGeoConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; bool m_noBDPCMConstraintFlag; @@ -232,13 +222,11 @@ protected: bool m_progressiveSourceFlag; bool m_interlacedSourceFlag; bool m_nonPackedConstraintFlag; -#if JVET_Q0114_CONSTRAINT_FLAGS bool m_nonProjectedConstraintFlag; bool m_noResChangeInClvsConstraintFlag; bool m_oneTilePerPicConstraintFlag; bool m_oneSlicePerPicConstraintFlag; bool m_oneSubpicPerPicConstraintFlag; -#endif bool m_frameOnlyConstraintFlag; bool m_intraConstraintFlag; @@ -266,20 +254,14 @@ protected: int m_aiPad[2]; bool m_AccessUnitDelimiter; ///< add Access Unit Delimiter NAL units -#if JVET_Q0775_PH_IN_SH bool m_enablePictureHeaderInSliceHeader; ///< Enable Picture Header in Slice Header -#endif int m_iMaxRefPicNum; ///< this is used to mimic the sliding mechanism used by the decoder // TODO: We need to have a common sliding mechanism used by both the encoder and decoder int m_maxTempLayer; ///< Max temporal layer unsigned m_CTUSize; -#if JVET_Q0119_CLEANUPS bool m_subPicInfoPresentFlag; -#else - bool m_subPicPresentFlag; -#endif uint32_t m_numSubPics; std::vector<uint32_t> m_subPicCtuTopLeftX; std::vector<uint32_t> m_subPicCtuTopLeftY; @@ -287,33 +269,21 @@ protected: std::vector<uint32_t> m_subPicHeight; std::vector<bool> m_subPicTreatedAsPicFlag; std::vector<bool> m_loopFilterAcrossSubpicEnabledFlag; -#if JVET_Q0119_CLEANUPS bool m_subPicIdMappingExplicitlySignalledFlag; bool m_subPicIdMappingInSpsFlag; -#else - bool m_subPicIdPresentFlag; - bool m_subPicIdSignallingPresentFlag; -#endif unsigned m_subPicIdLen; std::vector<uint16_t> m_subPicId; bool m_useSplitConsOverride; unsigned m_uiMinQT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma -#if JVET_Q0330_BLOCK_PARTITION unsigned m_uiMaxBT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma unsigned m_uiMaxTT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma -#endif unsigned m_uiMaxMTTHierarchyDepth; unsigned m_uiMaxMTTHierarchyDepthI; unsigned m_uiMaxMTTHierarchyDepthIChroma; bool m_dualITree; unsigned m_maxCUWidth; unsigned m_maxCUHeight; -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX unsigned m_log2MinCUSize; -#else - unsigned m_maxTotalCUDepth; - unsigned m_log2DiffMaxMinCodingBlockSize; -#endif int m_LMChroma; bool m_horCollocatedChromaFlag; @@ -346,11 +316,7 @@ protected: #endif bool m_ciip; -#if !JVET_Q0806 - bool m_Triangle; -#else bool m_Geo; -#endif bool m_allowDisFracMMVD; bool m_AffineAmvr; bool m_HashME; @@ -374,12 +340,8 @@ protected: unsigned m_wrapAroundOffset; // ADD_NEW_TOOL : (encoder lib) add tool enabling flags and associated parameters here -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG bool m_virtualBoundariesEnabledFlag; bool m_virtualBoundariesPresentFlag; -#else - bool m_loopFilterAcrossVirtualBoundariesDisabledFlag; -#endif unsigned m_numVerVirtualBoundaries; unsigned m_numHorVirtualBoundaries; unsigned m_virtualBoundariesPosX[3]; @@ -410,12 +372,10 @@ protected: bool m_loopFilterOffsetInPPS; int m_loopFilterBetaOffsetDiv2; int m_loopFilterTcOffsetDiv2; -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int m_loopFilterCbBetaOffsetDiv2; int m_loopFilterCbTcOffsetDiv2; int m_loopFilterCrBetaOffsetDiv2; int m_loopFilterCrTcOffsetDiv2; -#endif #if W0038_DB_OPT int m_deblockingFilterMetric; #else @@ -485,21 +445,11 @@ protected: bool m_useFastDecisionForMerge; bool m_bUseCbfFastMode; bool m_useEarlySkipDetection; -#if !REMOVE_PPS_REXT - bool m_crossComponentPredictionEnabledFlag; -#endif bool m_reconBasedCrossCPredictionEstimate; -#if !JVET_Q0441_SAO_MOD_12_BIT - uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; -#endif bool m_useTransformSkip; bool m_useTransformSkipFast; bool m_useChromaTS; -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool m_useBDPCM; -#else - int m_useBDPCM; -#endif uint32_t m_log2MaxTransformSkipBlockSize; bool m_transformSkipRotationEnabledFlag; bool m_transformSkipContextEnabledFlag; @@ -534,9 +484,7 @@ protected: //====== Sub-picture and Slices ======== bool m_singleSlicePerSubPicFlag; bool m_entropyCodingSyncEnabledFlag; -#if JVET_Q0151_Q0205_ENTRYPOINTS bool m_entropyCodingSyncEntryPointPresentFlag; ///< flag for the presence of entry points for WPP -#endif HashType m_decodedPictureHashSEIType; @@ -552,9 +500,7 @@ protected: bool m_bpDeltasGOPStructure; bool m_decodingUnitInfoSEIEnabled; -#if JVET_P0190_SCALABLE_NESTING_SEI bool m_scalableNestingSEIEnabled; -#endif bool m_erpSEIEnabled; bool m_erpSEICancelFlag; @@ -616,18 +562,10 @@ protected: std::vector<double> m_gcmpSEIFunctionCoeffV; std::vector<bool> m_gcmpSEIFunctionVAffectedByUFlag; bool m_gcmpSEIGuardBandFlag; -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE uint8_t m_gcmpSEIGuardBandType; bool m_gcmpSEIGuardBandBoundaryExteriorFlag; -#else - bool m_gcmpSEIGuardBandBoundaryType; -#endif uint8_t m_gcmpSEIGuardBandSamplesMinus1; -#if JVET_SUBPIC_LEVEL_CFG EncCfgParam::CfgSEISubpictureLevel m_cfgSubpictureLevelInfoSEI; -#else - bool m_subpicureLevelInfoSEIEnabled; -#endif bool m_sampleAspectRatioInfoSEIEnabled; bool m_sariCancelFlag; bool m_sariPersistenceFlag; @@ -675,20 +613,10 @@ protected: bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) bool m_useWeightedBiPred; //< Use of Bi-directional Weighting Prediction (B_SLICE) WeightedPredictionMethod m_weightedPredictionMethod; -#if JVET_Q0297_MER uint32_t m_log2ParallelMergeLevelMinus2; ///< Parallel merge estimation region -#endif uint32_t m_maxNumMergeCand; ///< Maximum number of merge candidates uint32_t m_maxNumAffineMergeCand; ///< Maximum number of affine merge candidates -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - uint32_t m_maxNumGeoCand; -#else - uint32_t m_maxNumTriangleCand; -#endif -#else uint32_t m_maxNumGeoCand; -#endif uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates ScalingListMode m_useScalingListId; ///< Using quantization matrix i.e. 0=off, 1=default, 2=file. std::string m_scalingListFileName; ///< quantization matrix file name @@ -696,10 +624,8 @@ protected: bool m_sliceLevelDblk; ///< code deblocking filter parameters in slice headers rather than picture header bool m_sliceLevelSao; ///< code SAO parameters in slice headers rather than picture header bool m_sliceLevelAlf; ///< code ALF parameters in slice headers rather than picture header -#if JVET_Q0819_PH_CHANGES bool m_sliceLevelWp; ///< code weighted prediction parameters in slice headers rather than picture header bool m_sliceLevelDeltaQp; ///< code delta in slice headers rather than picture header -#endif bool m_disableScalingMatrixForLfnstBlks; int m_TMVPModeId; bool m_constantSliceHeaderParamsEnabledFlag; @@ -709,11 +635,7 @@ protected: int m_PPSMvdL1ZeroIdc; int m_PPSCollocatedFromL0Idc; uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; -#if !JVET_Q0806 - uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#else uint32_t m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1; -#endif bool m_DepQuantEnabledFlag; bool m_SignDataHidingEnabledFlag; bool m_RCEnableRateControl; @@ -730,17 +652,9 @@ 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; bool m_DCIEnabled; ///< enable Decoding Capability Information (DCI) -#else - DPS m_dps; - bool m_decodingParameterSetEnabled; ///< enable decoding parameter set -#endif bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value bool m_hrdParametersPresentFlag; ///< enable generation of HRD parameters @@ -786,10 +700,8 @@ protected: #endif bool m_alf; ///< Adaptive Loop Filter -#if JVET_Q0795_CCALF bool m_ccalf; int m_ccalfQpThreshold; -#endif #if JVET_O0756_CALCULATE_HDRMETRICS double m_whitePointDeltaE[hdrtoolslib::NB_REF_WHITE]; double m_maxSampleValue; @@ -839,10 +751,8 @@ public: void setNoSaoConstraintFlag(bool bVal) { m_bNoSaoConstraintFlag = bVal; } bool getNoAlfConstraintFlag() const { return m_bNoAlfConstraintFlag; } void setNoAlfConstraintFlag(bool bVal) { m_bNoAlfConstraintFlag = bVal; } -#if JVET_Q0795_CCALF bool getNoCCAlfConstraintFlag() const { return m_noCCAlfConstraintFlag; } void setNoCCAlfConstraintFlag(bool bVal) { m_noCCAlfConstraintFlag = bVal; } -#endif bool getNoRefWraparoundConstraintFlag() const { return m_bNoRefWraparoundConstraintFlag; } void setNoRefWraparoundConstraintFlag(bool bVal) { m_bNoRefWraparoundConstraintFlag = bVal; } bool getNoTemporalMvpConstraintFlag() const { return m_bNoTemporalMvpConstraintFlag; } @@ -871,13 +781,8 @@ public: void setNoCiipConstraintFlag(bool bVal) { m_bNoCiipConstraintFlag = bVal; } bool getNoFPelMmvdConstraintFlag() const { return m_noFPelMmvdConstraintFlag; } void setNoFPelMmvdConstraintFlag(bool bVal) { m_noFPelMmvdConstraintFlag = bVal; } -#if !JVET_Q0806 - bool getNoTriangleConstraintFlag() const { return m_bNoTriangleConstraintFlag; } - void setNoTriangleConstraintFlag(bool bVal) { m_bNoTriangleConstraintFlag = bVal; } -#else bool getNoGeoConstraintFlag() const { return m_noGeoConstraintFlag; } void setNoGeoConstraintFlag(bool bVal) { m_noGeoConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_bNoLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } @@ -987,10 +892,8 @@ public: void setCTUSize ( unsigned u ) { m_CTUSize = u; } void setMinQTSizes ( unsigned* minQT) { m_uiMinQT[0] = minQT[0]; m_uiMinQT[1] = minQT[1]; m_uiMinQT[2] = minQT[2]; } -#if JVET_Q0330_BLOCK_PARTITION void setMaxBTSizes ( unsigned* maxBT) { m_uiMaxBT[0] = maxBT[0]; m_uiMaxBT[1] = maxBT[1]; m_uiMaxBT[2] = maxBT[2]; } void setMaxTTSizes ( unsigned* maxTT) { m_uiMaxTT[0] = maxTT[0]; m_uiMaxTT[1] = maxTT[1]; m_uiMaxTT[2] = maxTT[2]; } -#endif void setMaxMTTHierarchyDepth ( unsigned uiMaxMTTHierarchyDepth, unsigned uiMaxMTTHierarchyDepthI, unsigned uiMaxMTTHierarchyDepthIChroma ) { m_uiMaxMTTHierarchyDepth = uiMaxMTTHierarchyDepth; m_uiMaxMTTHierarchyDepthI = uiMaxMTTHierarchyDepthI; m_uiMaxMTTHierarchyDepthIChroma = uiMaxMTTHierarchyDepthIChroma; } unsigned getMaxMTTHierarchyDepth () const { return m_uiMaxMTTHierarchyDepth; } @@ -1001,11 +904,7 @@ public: bool getUseSplitConsOverride () const { return m_useSplitConsOverride; } void setDualITree ( bool b ) { m_dualITree = b; } bool getDualITree () const { return m_dualITree; } -#if JVET_Q0119_CLEANUPS void setSubPicInfoPresentFlag (bool b) { m_subPicInfoPresentFlag = b; } -#else - void setSubPicPresentFlag (bool b) { m_subPicPresentFlag = b; } -#endif void setNumSubPics ( uint32_t u ) { CHECK( u >= MAX_NUM_SUB_PICS, "Maximum number of subpictures exceeded" ); m_numSubPics = u; m_subPicCtuTopLeftX.resize(m_numSubPics); @@ -1030,22 +929,13 @@ public: void setSubPicTreatedAsPicFlag (const std::vector<bool> &v) { CHECK(v.size()!=m_numSubPics, "number of vector entries must be equal to numSubPics") ;m_subPicTreatedAsPicFlag = v; } void setLoopFilterAcrossSubpicEnabledFlag (const std::vector<bool> &v) { CHECK(v.size()!=m_numSubPics, "number of vector entries must be equal to numSubPics") ;m_loopFilterAcrossSubpicEnabledFlag = v; } -#if JVET_Q0119_CLEANUPS void setSubPicIdMappingExplicitlySignalledFlag (bool b) { m_subPicIdMappingExplicitlySignalledFlag = b; } void setSubPicIdMappingInSpsFlag (bool b) { m_subPicIdMappingInSpsFlag = b; } -#else - void setSubPicIdPresentFlag (bool b) { m_subPicIdPresentFlag = b; } - void setSubPicIdSignallingPresentFlag (bool b) { m_subPicIdSignallingPresentFlag = b; } -#endif void setSubPicIdLen (uint32_t u) { m_subPicIdLen = u; } void setSubPicId (uint32_t b, int i) { m_subPicId[i] = b; } void setSubPicId (const std::vector<uint16_t> &v) { CHECK(v.size()!=m_numSubPics, "number of vector entries must be equal to numSubPics"); m_subPicId = v; } -#if JVET_Q0119_CLEANUPS bool getSubPicInfoPresentFlag () { return m_subPicInfoPresentFlag; } -#else - bool getSubPicPresentFlag () { return m_subPicPresentFlag; } -#endif uint32_t getNumSubPics () { return m_numSubPics; } uint32_t getSubPicCtuTopLeftX (int i) { return m_subPicCtuTopLeftX[i]; } uint32_t getSubPicCtuTopLeftY (int i) { return m_subPicCtuTopLeftY[i]; } @@ -1053,13 +943,8 @@ public: uint32_t getSubPicHeight (int i) { return m_subPicHeight[i]; } bool getSubPicTreatedAsPicFlag (int i) { return m_subPicTreatedAsPicFlag[i]; } uint32_t getLoopFilterAcrossSubpicEnabledFlag (int i) { return m_loopFilterAcrossSubpicEnabledFlag[i]; } -#if JVET_Q0119_CLEANUPS bool getSubPicIdMappingExplicitlySignalledFlag () { return m_subPicIdMappingExplicitlySignalledFlag; } bool getSubPicIdMappingInSpsFlag () { return m_subPicIdMappingInSpsFlag; } -#else - bool getSubPicIdPresentFlag () { return m_subPicIdPresentFlag; } - bool getSubPicIdSignallingPresentFlag () { return m_subPicIdSignallingPresentFlag; } -#endif uint32_t getSubPicIdLen () { return m_subPicIdLen; } uint32_t getSubPicId (int i) { return m_subPicId[i]; } void setLFNST ( bool b ) { m_LFNST = b; } @@ -1125,13 +1010,8 @@ public: void setUseCiip ( bool b ) { m_ciip = b; } bool getUseCiip () const { return m_ciip; } -#if !JVET_Q0806 - void setUseTriangle ( bool b ) { m_Triangle = b; } - bool getUseTriangle () const { return m_Triangle; } -#else void setUseGeo ( bool b ) { m_Geo = b; } bool getUseGeo () const { return m_Geo; } -#endif void setAllowDisFracMMVD ( bool b ) { m_allowDisFracMMVD = b; } bool getAllowDisFracMMVD () const { return m_allowDisFracMMVD; } void setUseHashME ( bool b ) { m_HashME = b; } @@ -1175,15 +1055,10 @@ public: unsigned getWrapAroundOffset () const { return m_wrapAroundOffset; } // ADD_NEW_TOOL : (encoder lib) add access functions here -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG void setVirtualBoundariesEnabledFlag( bool b ) { m_virtualBoundariesEnabledFlag = b; } bool getVirtualBoundariesEnabledFlag() const { return m_virtualBoundariesEnabledFlag; } void setVirtualBoundariesPresentFlag( bool b ) { m_virtualBoundariesPresentFlag = b; } bool getVirtualBoundariesPresentFlag() const { return m_virtualBoundariesPresentFlag; } -#else - void setLoopFilterAcrossVirtualBoundariesDisabledFlag( bool b ) { m_loopFilterAcrossVirtualBoundariesDisabledFlag = b; } - bool getLoopFilterAcrossVirtualBoundariesDisabledFlag() const { return m_loopFilterAcrossVirtualBoundariesDisabledFlag; } -#endif void setNumVerVirtualBoundaries ( unsigned u ) { m_numVerVirtualBoundaries = u; } unsigned getNumVerVirtualBoundaries () const { return m_numVerVirtualBoundaries; } void setNumHorVirtualBoundaries ( unsigned u ) { m_numHorVirtualBoundaries = u; } @@ -1208,14 +1083,8 @@ public: uint32_t getMaxCUWidth () const { return m_maxCUWidth; } void setMaxCUHeight ( uint32_t u ) { m_maxCUHeight = u; } uint32_t getMaxCUHeight () const { return m_maxCUHeight; } -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX void setLog2MinCodingBlockSize ( int n ) { m_log2MinCUSize = n; } int getLog2MinCodingBlockSize () const { return m_log2MinCUSize;} -#else - void setMaxCodingDepth ( uint32_t u ) { m_maxTotalCUDepth = u; } - uint32_t getMaxCodingDepth () const { return m_maxTotalCUDepth; } - void setLog2DiffMaxMinCodingBlockSize( uint32_t u ) { m_log2DiffMaxMinCodingBlockSize = u; } -#endif void setUseEncDbOpt ( bool n ) { m_encDbOpt = n; } bool getUseEncDbOpt () const { return m_encDbOpt; } @@ -1254,12 +1123,10 @@ public: void setLoopFilterOffsetInPPS ( bool b ) { m_loopFilterOffsetInPPS = b; } void setLoopFilterBetaOffset ( int i ) { m_loopFilterBetaOffsetDiv2 = i; } void setLoopFilterTcOffset ( int i ) { m_loopFilterTcOffsetDiv2 = i; } -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS void setLoopFilterCbBetaOffset ( int i ) { m_loopFilterCbBetaOffsetDiv2 = i; } void setLoopFilterCbTcOffset ( int i ) { m_loopFilterCbTcOffsetDiv2 = i; } void setLoopFilterCrBetaOffset ( int i ) { m_loopFilterCrBetaOffsetDiv2 = i; } void setLoopFilterCrTcOffset ( int i ) { m_loopFilterCrTcOffsetDiv2 = i; } -#endif #if W0038_DB_OPT void setDeblockingFilterMetric ( int i ) { m_deblockingFilterMetric = i; } #else @@ -1362,22 +1229,18 @@ public: bool getAccessUnitDelimiter() const { return m_AccessUnitDelimiter; } void setAccessUnitDelimiter(bool val){ m_AccessUnitDelimiter = val; } -#if JVET_Q0775_PH_IN_SH bool getEnablePictureHeaderInSliceHeader() const { return m_enablePictureHeaderInSliceHeader; } void setEnablePictureHeaderInSliceHeader(bool val) { m_enablePictureHeaderInSliceHeader = val; } -#endif //==== Loop/Deblock Filter ======== bool getLoopFilterDisable () { return m_bLoopFilterDisable; } bool getLoopFilterOffsetInPPS () { return m_loopFilterOffsetInPPS; } int getLoopFilterBetaOffset () { return m_loopFilterBetaOffsetDiv2; } int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS int getLoopFilterCbBetaOffset () { return m_loopFilterCbBetaOffsetDiv2; } int getLoopFilterCbTcOffset () { return m_loopFilterCbTcOffsetDiv2; } int getLoopFilterCrBetaOffset () { return m_loopFilterCrBetaOffsetDiv2; } int getLoopFilterCrTcOffset () { return m_loopFilterCrTcOffsetDiv2; } -#endif #if W0038_DB_OPT int getDeblockingFilterMetric () { return m_deblockingFilterMetric; } #else @@ -1448,15 +1311,8 @@ public: void setGopBasedTemporalFilterEnabled(bool flag) { m_gopBasedTemporalFilterEnabled = flag; } bool getGopBasedTemporalFilterEnabled() { return m_gopBasedTemporalFilterEnabled; } -#if !REMOVE_PPS_REXT - bool getCrossComponentPredictionEnabledFlag () const { return m_crossComponentPredictionEnabledFlag; } - void setCrossComponentPredictionEnabledFlag (const bool value) { m_crossComponentPredictionEnabledFlag = value; } -#endif bool getUseReconBasedCrossCPredictionEstimate () const { return m_reconBasedCrossCPredictionEstimate; } void setUseReconBasedCrossCPredictionEstimate (const bool value) { m_reconBasedCrossCPredictionEstimate = value; } -#if !JVET_Q0441_SAO_MOD_12_BIT - void setLog2SaoOffsetScale(ChannelType type, uint32_t uiBitShift) { m_log2SaoOffsetScale[type] = uiBitShift; } -#endif bool getUseTransformSkip () { return m_useTransformSkip; } void setUseTransformSkip ( bool b ) { m_useTransformSkip = b; } @@ -1466,13 +1322,8 @@ public: void setTransformSkipContextEnabledFlag (const bool value) { m_transformSkipContextEnabledFlag = value; } bool getUseChromaTS () { return m_useChromaTS; } void setUseChromaTS (bool b) { m_useChromaTS = b; } -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM bool getUseBDPCM () { return m_useBDPCM; } void setUseBDPCM ( bool b ) { m_useBDPCM = b; } -#else - int getUseBDPCM () { return m_useBDPCM; } - void setUseBDPCM ( int b ) { m_useBDPCM = b; } -#endif bool getUseJointCbCr () { return m_JointCbCrMode; } void setUseJointCbCr (bool b) { m_JointCbCrMode = b; } bool getPersistentRiceAdaptationEnabledFlag () const { return m_persistentRiceAdaptationEnabledFlag; } @@ -1536,9 +1387,7 @@ public: bool getSaoGreedyMergeEnc () { return m_saoGreedyMergeEnc; } void setEntropyCodingSyncEnabledFlag(bool b) { m_entropyCodingSyncEnabledFlag = b; } bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; } -#if JVET_Q0151_Q0205_ENTRYPOINTS void setEntropyCodingSyncEntryPointPresentFlag(bool b) { m_entropyCodingSyncEntryPointPresentFlag = b; } -#endif void setDecodedPictureHashSEIType(HashType m) { m_decodedPictureHashSEIType = m; } HashType getDecodedPictureHashSEIType() const { return m_decodedPictureHashSEIType; } void setBufferingPeriodSEIEnabled(bool b) { m_bufferingPeriodSEIEnabled = b; } @@ -1563,10 +1412,8 @@ public: bool getBpDeltasGOPStructure() const { return m_bpDeltasGOPStructure; } void setDecodingUnitInfoSEIEnabled(bool b) { m_decodingUnitInfoSEIEnabled = b; } bool getDecodingUnitInfoSEIEnabled() const { return m_decodingUnitInfoSEIEnabled; } -#if JVET_P0190_SCALABLE_NESTING_SEI void setScalableNestingSEIEnabled(bool b) { m_scalableNestingSEIEnabled = b; } bool getScalableNestingSEIEnabled() const { return m_scalableNestingSEIEnabled; } -#endif void setErpSEIEnabled(bool b) { m_erpSEIEnabled = b; } bool getErpSEIEnabled() { return m_erpSEIEnabled; } @@ -1688,24 +1535,14 @@ public: bool getGcmpSEIFunctionVAffectedByUFlag(int idx) const { return m_gcmpSEIFunctionVAffectedByUFlag[idx]; } void setGcmpSEIGuardBandFlag(bool b) { m_gcmpSEIGuardBandFlag = b; } bool getGcmpSEIGuardBandFlag() { return m_gcmpSEIGuardBandFlag; } -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE void setGcmpSEIGuardBandType(uint8_t u) { m_gcmpSEIGuardBandType = u; } uint8_t getGcmpSEIGuardBandType() { return m_gcmpSEIGuardBandType; } void setGcmpSEIGuardBandBoundaryExteriorFlag(bool b) { m_gcmpSEIGuardBandBoundaryExteriorFlag = b; } bool getGcmpSEIGuardBandBoundaryExteriorFlag() { return m_gcmpSEIGuardBandBoundaryExteriorFlag; } -#else - void setGcmpSEIGuardBandBoundaryType(bool b) { m_gcmpSEIGuardBandBoundaryType = b; } - bool getGcmpSEIGuardBandBoundaryType() { return m_gcmpSEIGuardBandBoundaryType; } -#endif void setGcmpSEIGuardBandSamplesMinus1( uint8_t u ) { m_gcmpSEIGuardBandSamplesMinus1 = u; } uint8_t getGcmpSEIGuardBandSamplesMinus1() { return m_gcmpSEIGuardBandSamplesMinus1; } -#if JVET_SUBPIC_LEVEL_CFG const EncCfgParam::CfgSEISubpictureLevel getSubpicureLevelInfoSEICfg() const { return m_cfgSubpictureLevelInfoSEI; } void setSubpicureLevelInfoSEICfg(EncCfgParam::CfgSEISubpictureLevel cfg) { m_cfgSubpictureLevelInfoSEI = cfg; } -#else - bool getSubpicureLevelInfoSEIEnabled() const { return m_subpicureLevelInfoSEIEnabled; } - void setSubpicureLevelInfoSEIEnabled(bool val) { m_subpicureLevelInfoSEIEnabled = val; } -#endif bool getSampleAspectRatioInfoSEIEnabled() const { return m_sampleAspectRatioInfoSEIEnabled; } void setSampleAspectRatioInfoSEIEnabled(const bool val) { m_sampleAspectRatioInfoSEIEnabled = val; } bool getSariCancelFlag() const { return m_sariCancelFlag; } @@ -1790,26 +1627,14 @@ public: void setWPBiPred ( bool b ) { m_useWeightedBiPred = b; } bool getUseWP () { return m_useWeightedPred; } bool getWPBiPred () { return m_useWeightedBiPred; } -#if JVET_Q0297_MER void setLog2ParallelMergeLevelMinus2(uint32_t u) { m_log2ParallelMergeLevelMinus2 = u; } uint32_t getLog2ParallelMergeLevelMinus2() { return m_log2ParallelMergeLevelMinus2; } -#endif void setMaxNumMergeCand ( uint32_t u ) { m_maxNumMergeCand = u; } uint32_t getMaxNumMergeCand () { return m_maxNumMergeCand; } void setMaxNumAffineMergeCand ( uint32_t u ) { m_maxNumAffineMergeCand = u; } uint32_t getMaxNumAffineMergeCand () { return m_maxNumAffineMergeCand; } -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - void setMaxNumGeoCand(uint32_t u) { m_maxNumGeoCand = u; } - uint32_t getMaxNumGeoCand() { return m_maxNumGeoCand; } -#else - void setMaxNumTriangleCand ( uint32_t u ) { m_maxNumTriangleCand = u; } - uint32_t getMaxNumTriangleCand () { return m_maxNumTriangleCand; } -#endif -#else void setMaxNumGeoCand ( uint32_t u ) { m_maxNumGeoCand = u; } uint32_t getMaxNumGeoCand () { return m_maxNumGeoCand; } -#endif void setMaxNumIBCMergeCand ( uint32_t u ) { m_maxNumIBCMergeCand = u; } uint32_t getMaxNumIBCMergeCand () { return m_maxNumIBCMergeCand; } void setUseScalingListId ( ScalingListMode u ) { m_useScalingListId = u; } @@ -1824,39 +1649,14 @@ public: bool getSliceLevelSao () { return m_sliceLevelSao; } void setSliceLevelAlf ( bool b ) { m_sliceLevelAlf = b; } bool getSliceLevelAlf () { return m_sliceLevelAlf; } -#if JVET_Q0819_PH_CHANGES void setSliceLevelWp(bool b) { m_sliceLevelWp = b; } bool getSliceLevelWp() { return m_sliceLevelWp; } void setSliceLevelDeltaQp(bool b) { m_sliceLevelDeltaQp = b; } bool getSliceLevelDeltaQp() { return m_sliceLevelDeltaQp; } -#endif void setDisableScalingMatrixForLfnstBlks(bool u) { m_disableScalingMatrixForLfnstBlks = u; } bool getDisableScalingMatrixForLfnstBlks() const { return m_disableScalingMatrixForLfnstBlks; } void setTMVPModeId ( int u ) { m_TMVPModeId = u; } int getTMVPModeId () { return m_TMVPModeId; } -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - void setConstantSliceHeaderParamsEnabledFlag ( bool u ) { m_constantSliceHeaderParamsEnabledFlag = u; } - bool getConstantSliceHeaderParamsEnabledFlag () { return m_constantSliceHeaderParamsEnabledFlag; } - void setPPSDepQuantEnabledIdc ( int u ) { m_PPSDepQuantEnabledIdc = u; } - int getPPSDepQuantEnabledIdc () { return m_PPSDepQuantEnabledIdc; } - void setPPSRefPicListSPSIdc0 ( int u ) { m_PPSRefPicListSPSIdc0 = u; } - int getPPSRefPicListSPSIdc0 () { return m_PPSRefPicListSPSIdc0; } - void setPPSRefPicListSPSIdc1 ( int u ) { m_PPSRefPicListSPSIdc1 = u; } - int getPPSRefPicListSPSIdc1 () { return m_PPSRefPicListSPSIdc1; } - void setPPSMvdL1ZeroIdc ( int u ) { m_PPSMvdL1ZeroIdc = u; } - int getPPSMvdL1ZeroIdc () { return m_PPSMvdL1ZeroIdc; } - void setPPSCollocatedFromL0Idc ( int u ) { m_PPSCollocatedFromL0Idc = u; } - int getPPSCollocatedFromL0Idc () { return m_PPSCollocatedFromL0Idc; } - void setPPSSixMinusMaxNumMergeCandPlus1 ( uint32_t u ) { m_PPSSixMinusMaxNumMergeCandPlus1 = u; } - uint32_t getPPSSixMinusMaxNumMergeCandPlus1 () { return m_PPSSixMinusMaxNumMergeCandPlus1; } -#if !JVET_Q0806 - void setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ( uint32_t u ) { m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = u; } - uint32_t getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 () { return m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; } -#else - void setPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 ( uint32_t u ) { m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 = u; } - uint32_t getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1 () { return m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1; } -#endif -#endif WeightedPredictionMethod getWeightedPredictionMethod() const { return m_weightedPredictionMethod; } void setWeightedPredictionMethod( WeightedPredictionMethod m ) { m_weightedPredictionMethod = m; } void setDepQuantEnabledFlag( bool b ) { m_DepQuantEnabledFlag = b; } @@ -1888,19 +1688,10 @@ 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 void setDCI(DCI *p) { m_dci = *p; } DCI* getDCI() { return &m_dci; } -#else - void setDPS(DPS *p) { m_dps = *p; } - DPS* getDPS() { return &m_dps; } -#endif void setUseRecalculateQPAccordingToLambda (bool b) { m_recalculateQPAccordingToLambda = b; } bool getUseRecalculateQPAccordingToLambda () { return m_recalculateQPAccordingToLambda; } @@ -1911,13 +1702,8 @@ public: bool getHarmonizeGopFirstFieldCoupleEnabled( ) const { return m_bHarmonizeGopFirstFieldCoupleEnabled; } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP bool getDCIEnabled() { return m_DCIEnabled; } void setDCIEnabled(bool i) { m_DCIEnabled = i; } -#else - bool getDecodingParameterSetEnabled() { return m_decodingParameterSetEnabled; } - void setDecodingParameterSetEnabled(bool i) { m_decodingParameterSetEnabled = i; } -#endif bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; } void setHrdParametersPresentFlag(bool i) { m_hrdParametersPresentFlag = i; } bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; } @@ -1962,7 +1748,6 @@ public: bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; } void setNonPackedConstraintFlag(bool b) { m_nonPackedConstraintFlag = b; } -#if JVET_Q0114_CONSTRAINT_FLAGS bool getNonProjectedConstraintFlag() const { return m_nonProjectedConstraintFlag; } void setNonProjectedConstraintFlag(bool b) { m_nonProjectedConstraintFlag = b; } @@ -1977,7 +1762,6 @@ public: bool getOneSubpicPerPicConstraintFlag() const { return m_oneSubpicPerPicConstraintFlag; } void setOneSubpicPerPicConstraintFlag(bool b) { m_oneSubpicPerPicConstraintFlag = b; } -#endif bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } void setFrameOnlyConstraintFlag(bool b) { m_frameOnlyConstraintFlag = b; } @@ -2025,12 +1809,10 @@ public: #endif void setUseALF( bool b ) { m_alf = b; } bool getUseALF() const { return m_alf; } -#if JVET_Q0795_CCALF void setUseCCALF( bool b ) { m_ccalf = b; } bool getUseCCALF() const { return m_ccalf; } void setCCALFQpThreshold( int b ) { m_ccalfQpThreshold = b; } int getCCALFQpThreshold() const { return m_ccalfQpThreshold; } -#endif #if JVET_O0756_CALCULATE_HDRMETRICS void setWhitePointDeltaE( uint32_t index, double value ) { m_whitePointDeltaE[ index ] = value; } double getWhitePointDeltaE( uint32_t index ) const { return m_whitePointDeltaE[ index ]; } diff --git a/source/Lib/EncoderLib/EncCfgParam.h b/source/Lib/EncoderLib/EncCfgParam.h index fb1671afd23d0dbaa8a3992fd0f5692c6ba9c9b4..13e5f839e0312c0d8ecbcab9a233aa56531163a8 100644 --- a/source/Lib/EncoderLib/EncCfgParam.h +++ b/source/Lib/EncoderLib/EncCfgParam.h @@ -44,7 +44,6 @@ namespace EncCfgParam { -#if JVET_SUBPIC_LEVEL_CFG class CfgSEISubpictureLevel { public: @@ -63,7 +62,6 @@ public: int m_numSubpictures; std::vector<int> m_fractions; }; -#endif } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index a402f18d9d26864ffcd945c0b959d3184540ad00..fafc8552492ce4798677cea8094a5c606e633a53 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -59,20 +59,6 @@ //! \{ // ==================================================================================================================== -#if !JVET_Q0806 -EncCu::EncCu() : m_triangleModeTest -{ - TriangleMotionInfo( 0, 1, 0 ), TriangleMotionInfo( 1, 0, 1 ), TriangleMotionInfo( 1, 0, 2 ), TriangleMotionInfo( 0, 0, 1 ), TriangleMotionInfo( 0, 2, 0 ), - TriangleMotionInfo( 1, 0, 3 ), TriangleMotionInfo( 1, 0, 4 ), TriangleMotionInfo( 1, 1, 0 ), TriangleMotionInfo( 0, 3, 0 ), TriangleMotionInfo( 0, 4, 0 ), - TriangleMotionInfo( 0, 0, 2 ), TriangleMotionInfo( 0, 1, 2 ), TriangleMotionInfo( 1, 1, 2 ), TriangleMotionInfo( 0, 0, 4 ), TriangleMotionInfo( 0, 0, 3 ), - TriangleMotionInfo( 0, 1, 3 ), TriangleMotionInfo( 0, 1, 4 ), TriangleMotionInfo( 1, 1, 4 ), TriangleMotionInfo( 1, 1, 3 ), TriangleMotionInfo( 1, 2, 1 ), - TriangleMotionInfo( 1, 2, 0 ), TriangleMotionInfo( 0, 2, 1 ), TriangleMotionInfo( 0, 4, 3 ), TriangleMotionInfo( 1, 3, 0 ), TriangleMotionInfo( 1, 3, 2 ), - TriangleMotionInfo( 1, 3, 4 ), TriangleMotionInfo( 1, 4, 0 ), TriangleMotionInfo( 1, 3, 1 ), TriangleMotionInfo( 1, 2, 3 ), TriangleMotionInfo( 1, 4, 1 ), - TriangleMotionInfo( 0, 4, 1 ), TriangleMotionInfo( 0, 2, 3 ), TriangleMotionInfo( 1, 4, 2 ), TriangleMotionInfo( 0, 3, 2 ), TriangleMotionInfo( 1, 4, 3 ), - TriangleMotionInfo( 0, 3, 1 ), TriangleMotionInfo( 0, 2, 4 ), TriangleMotionInfo( 1, 2, 4 ), TriangleMotionInfo( 0, 4, 2 ), TriangleMotionInfo( 0, 3, 4 ), -} -{} -#else EncCu::EncCu() : m_GeoModeTest { GeoMotionInfo(0, 1), GeoMotionInfo(1, 0),GeoMotionInfo(0, 2), GeoMotionInfo(1, 2), GeoMotionInfo(2, 0), @@ -83,7 +69,6 @@ EncCu::EncCu() : m_GeoModeTest GeoMotionInfo(5, 0), GeoMotionInfo(5, 1),GeoMotionInfo(5, 2), GeoMotionInfo(5, 3), GeoMotionInfo(5, 4) } {} -#endif void EncCu::create( EncCfg* encCfg ) { @@ -151,53 +136,10 @@ void EncCu::create( EncCfg* encCfg ) m_acRealMergeBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); m_acMergeTmpBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); } -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - const unsigned maxNumTriangleCand = encCfg->getMaxNumGeoCand(); -#else - const unsigned maxNumTriangleCand = encCfg->getMaxNumTriangleCand(); -#endif - for (unsigned i = 0; i < maxNumTriangleCand; i++) - { - for (unsigned j = 0; j < maxNumTriangleCand; j++) - { - if (i == j) - continue; - uint8_t idxBits0 = i + (i == maxNumTriangleCand - 1 ? 0 : 1); - uint8_t candIdx1Enc = j - (j > i ? 1 : 0); - uint8_t idxBits1 = candIdx1Enc + (candIdx1Enc == maxNumTriangleCand - 2 ? 0 : 1); - m_triangleIdxBins[1][i][j] = m_triangleIdxBins[0][i][j] = 1 + idxBits0 + idxBits1; - } - } - if (maxNumTriangleCand != 5) - { - // update the table - int index = 0; - for (unsigned i = 0; i < maxNumTriangleCand; i++) - { - for (unsigned j = 0; j < maxNumTriangleCand; j++) - { - if (i == j) - continue; - for (unsigned dir = 0; dir < 2; dir++, index++) - { - m_triangleModeTest[index].m_splitDir = dir; - m_triangleModeTest[index].m_candIdx0 = i; - m_triangleModeTest[index].m_candIdx1 = j; - } - } - } - } - for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) - { - m_acTriangleWeightedBuffer[ui].create( chromaFormat, Area( 0, 0, uiMaxWidth, uiMaxHeight ) ); - } -#else for( unsigned ui = 0; ui < GEO_MAX_TRY_WEIGHTED_SAD; ui++ ) { m_acGeoWeightedBuffer[ui].create( chromaFormat, Area( 0, 0, uiMaxWidth, uiMaxHeight ) ); } -#endif m_CtxBuffer.resize( maxDepth ); m_CurrCtx = 0; @@ -261,17 +203,10 @@ void EncCu::destroy() m_acRealMergeBuffer[ui].destroy(); m_acMergeTmpBuffer[ui].destroy(); } -#if !JVET_Q0806 - for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) - { - m_acTriangleWeightedBuffer[ui].destroy(); - } -#else for (unsigned ui = 0; ui < GEO_MAX_TRY_WEIGHTED_SAD; ui++) { m_acGeoWeightedBuffer[ui].destroy(); } -#endif } @@ -301,10 +236,8 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) m_dataId = tId; #endif m_pcLoopFilter = pcEncLib->getLoopFilter(); -#if JVET_Q0806 m_GeoCostList.init(GEO_NUM_PARTITION_MODE, m_pcEncCfg->getMaxNumGeoCand()); m_AFFBestSATDCost = MAX_DOUBLE; -#endif DecCu::init( m_pcTrQuant, m_pcIntraSearch, m_pcInterSearch ); @@ -325,12 +258,8 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign m_modeCtrl->initCTUEncoding( *cs.slice ); cs.treeType = TREE_D; -#if JVET_Q0504_PLT_NON444 cs.slice->m_mapPltCost[0].clear(); cs.slice->m_mapPltCost[1].clear(); -#else - cs.slice->m_mapPltCost.clear(); -#endif #if ENABLE_SPLIT_PARALLELISM if( m_pcEncCfg->getNumSplitThreads() > 1 ) { @@ -404,12 +333,8 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign tempCS->prevQP[CH_L] = bestCS->prevQP[CH_L] = prevQP[CH_L]; xCompressCU(tempCS, bestCS, partitioner); -#if JVET_Q0504_PLT_NON444 cs.slice->m_mapPltCost[0].clear(); cs.slice->m_mapPltCost[1].clear(); -#else - cs.slice->m_mapPltCost.clear(); -#endif // all signals were already copied during compression if the CTU was split - at this point only the structures are copied to the top level CS const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1; cs.useSubStructure(*bestCS, partitioner.chType, CS::getArea(*bestCS, area, partitioner.chType), copyUnsplitCTUSignals, @@ -624,7 +549,6 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par bool jointPLT = false; if (partitioner.isSepTree( *tempCS )) { -#if JVET_Q0504_PLT_NON444 if( !CS::isDualITree(*tempCS) && partitioner.treeType != TREE_D ) { compBegin = COMPONENT_Y; @@ -633,7 +557,6 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par } else { -#endif if (isLuma(partitioner.chType)) { compBegin = COMPONENT_Y; @@ -644,18 +567,12 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par compBegin = COMPONENT_Cb; numComp = 2; } -#if JVET_Q0504_PLT_NON444 } -#endif } else { compBegin = COMPONENT_Y; -#if JVET_Q0504_PLT_NON444 numComp = (tempCS->area.chromaFormat != CHROMA_400) ? 3 : 1; -#else - numComp = 3; -#endif jointPLT = true; } SplitSeries splitmode = -1; @@ -710,19 +627,11 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par { // TODO M0133 : double check encoder decisions with respect to chroma QG detection and actual encode int lgMinCuSize = sps.getLog2MinCodingBlockSize() + -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX std::max<int>(0, floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize() - int(slice.getCuChromaQpOffsetSubdiv() / 2)); -#else - std::max<int>( 0, sps.getLog2DiffMaxMinCodingBlockSize() - int( slice.getCuChromaQpOffsetSubdiv()/2 ) ); -#endif -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET if( partitioner.currQgChromaEnable() ) { m_cuChromaQpOffsetIdxPlus1 = ( ( uiLPelX >> lgMinCuSize ) + ( uiTPelY >> lgMinCuSize ) ) % ( pps.getChromaQpOffsetListLen() + 1 ); } -#else - m_cuChromaQpOffsetIdxPlus1 = ( ( uiLPelX >> lgMinCuSize ) + ( uiTPelY >> lgMinCuSize ) ) % ( pps.getChromaQpOffsetListLen() + 1 ); -#endif } if( !m_modeCtrl->anyMode() ) @@ -856,29 +765,20 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par if (cu) cu->mmvdSkip = cu->skip == false ? false : cu->mmvdSkip; } -#if !JVET_Q0806 - else if( currTestMode.type == ETM_MERGE_TRIANGLE ) - { - xCheckRDCostMergeTriangle2Nx2N( tempCS, bestCS, partitioner, currTestMode ); - } -#else else if( currTestMode.type == ETM_MERGE_GEO ) { xCheckRDCostMergeGeo2Nx2N( tempCS, bestCS, partitioner, currTestMode ); } -#endif else if( currTestMode.type == ETM_INTRA ) { if (slice.getSPS()->getUseColorTrans() && !CS::isDualITree(*tempCS)) { bool skipSecColorSpace = false; skipSecColorSpace = xCheckRDCostIntra(tempCS, bestCS, partitioner, currTestMode, (m_pcEncCfg->getRGBFormatFlag() ? true : false)); -#if JVET_Q0820_ACT if ((m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING) && !m_pcEncCfg->getRGBFormatFlag()) { skipSecColorSpace = true; } -#endif if (!skipSecColorSpace && !tempCS->firstColorSpaceTestOnly) { xCheckRDCostIntra(tempCS, bestCS, partitioner, currTestMode, (m_pcEncCfg->getRGBFormatFlag() ? false : true)); @@ -1547,10 +1447,8 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, tempCS->picture->cs->getNumCuPuTuOffset( numCuPuTu ); tempCS->picture->cs->useSubStructure( *tempCS, partitioner.chType, CS::getArea( *tempCS, partitioner.currArea(), partitioner.chType ), false, true, false, false ); -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(tempCS->pcv->chrFormat)) { -#endif partitioner.chType = CHANNEL_TYPE_CHROMA; tempCS->treeType = partitioner.treeType = TREE_C; @@ -1575,15 +1473,10 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, tempCSChroma->releaseIntermediateData(); bestCSChroma->releaseIntermediateData(); //tempCS->picture->cs->releaseIntermediateData(); -#if JVET_Q0438_MONOCHROME_BUGFIXES m_CurrCtx--; } -#endif tempCS->picture->cs->clearCuPuTuIdxMap( partitioner.currArea(), numCuPuTu[0], numCuPuTu[1], numCuPuTu[2], numCuPuTu + 3 ); -#if !JVET_Q0438_MONOCHROME_BUGFIXES - m_CurrCtx--; -#endif //recover luma tree status partitioner.chType = CHANNEL_TYPE_LUMA; @@ -1880,15 +1773,6 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS m_CABACEstimator->pred_mode ( cu ); m_CABACEstimator->adaptive_color_transform(cu); m_CABACEstimator->cu_pred_data ( cu ); -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - m_CABACEstimator->bdpcm_mode ( cu, ComponentID(partitioner.chType) ); -#if JVET_Q0438_MONOCHROME_BUGFIXES - if (!CS::isDualITree(*cu.cs) && isLuma(partitioner.chType) && isChromaEnabled(cu.chromaFormat)) -#else - if (!CS::isDualITree(*cu.cs) && isLuma(partitioner.chType)) -#endif - m_CABACEstimator->bdpcm_mode(cu, ComponentID(CHANNEL_TYPE_CHROMA)); -#endif // Encode Coefficients CUCtx cuCtx; @@ -1904,34 +1788,26 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS xEncodeDontSplit( *tempCS, partitioner ); xCheckDQP( *tempCS, partitioner ); -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif // Check if low frequency non-separable transform (LFNST) is too expensive if( lfnstIdx && !cuCtx.lfnstLastScanPos && !cu.ispMode ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES bool cbfAtZeroDepth = cu.isSepTree() ? cu.rootCbf : (tempCS->area.chromaFormat != CHROMA_400 && std::min( cu.firstTU->blocks[ 1 ].width, cu.firstTU->blocks[ 1 ].height ) < 4) ? TU::getCbfAtDepth( *cu.firstTU, COMPONENT_Y, 0 ) : cu.rootCbf; -#else - bool cbfAtZeroDepth = cu.isSepTree() ? cu.rootCbf : std::min( cu.firstTU->blocks[ 1 ].width, cu.firstTU->blocks[ 1 ].height ) < 4 ? TU::getCbfAtDepth( *cu.firstTU, COMPONENT_Y, 0 ) : cu.rootCbf; -#endif if( cbfAtZeroDepth ) { tempCS->cost = MAX_DOUBLE; } } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (isLuma(partitioner.chType) && cu.firstTU->mtsIdx[COMPONENT_Y] > MTS_SKIP) { CHECK(!cuCtx.mtsLastScanPos, "MTS is disallowed to only contain DC coefficient"); } -#endif if( mtsFlag == 0 && lfnstIdx == 0 ) { @@ -2060,13 +1936,11 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { -#if JVET_Q0629_REMOVAL_PLT_4X4 if (((partitioner.currArea().lumaSize().width * partitioner.currArea().lumaSize().height <= 16) && (isLuma(partitioner.chType)) ) || ((partitioner.currArea().chromaSize().width * partitioner.currArea().chromaSize().height <= 16) && (!isLuma(partitioner.chType)) && partitioner.isSepTree(*tempCS) ) ) { return; } -#endif tempCS->initStructData(encTestMode.qp); CodingUnit &cu = tempCS->addCU(CS::getArea(*tempCS, tempCS->area, partitioner.chType), partitioner.chType); partitioner.setCUData(cu); @@ -2097,7 +1971,6 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit } else { -#if JVET_Q0504_PLT_NON444 if( cu.chromaFormat != CHROMA_400 ) { m_pcIntraSearch->PLTSearch(*tempCS, partitioner, COMPONENT_Y, 3); @@ -2106,9 +1979,6 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit { m_pcIntraSearch->PLTSearch(*tempCS, partitioner, COMPONENT_Y, 1); } -#else - m_pcIntraSearch->PLTSearch(*tempCS, partitioner, COMPONENT_Y, 3); -#endif } @@ -2138,7 +2008,6 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit } else { -#if JVET_Q0504_PLT_NON444 if( cu.chromaFormat != CHROMA_400 ) { m_CABACEstimator->cu_palette_info(cu, COMPONENT_Y, 3, cuCtx); @@ -2147,27 +2016,18 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit { m_CABACEstimator->cu_palette_info(cu, COMPONENT_Y, 1, cuCtx); } -#else - m_CABACEstimator->cu_palette_info(cu, COMPONENT_Y, 3, cuCtx); -#endif } tempCS->fracBits = m_CABACEstimator->getEstFracBits(); tempCS->cost = m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist); xEncodeDontSplit(*tempCS, partitioner); xCheckDQP(*tempCS, partitioner); -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif xCalDebCost(*tempCS, partitioner); tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); const Area currCuArea = cu.block(getFirstComponentOfChannel(partitioner.chType)); -#if JVET_Q0504_PLT_NON444 cu.slice->m_mapPltCost[isChroma(partitioner.chType)][currCuArea.pos()][currCuArea.size()] = tempCS->cost; -#else - cu.slice->m_mapPltCost[currCuArea.pos()][currCuArea.size()] = tempCS->cost; -#endif #if WCG_EXT DTRACE_MODE_COST(*tempCS, m_pcRdCost->getLambda(true)); #else @@ -2249,7 +2109,6 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep } } -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET void EncCu::xCheckChromaQPOffset( CodingStructure& cs, Partitioner& partitioner ) { // doesn't apply if CU chroma QP offset is disabled @@ -2304,7 +2163,6 @@ void EncCu::xCheckChromaQPOffset( CodingStructure& cs, Partitioner& partitioner } } -#endif void EncCu::xFillPCMBuffer( CodingUnit &cu ) { const ChromaFormat format = cu.chromaFormat; @@ -2320,11 +2178,7 @@ void EncCu::xFillPCMBuffer( CodingUnit &cu ) const CPelBuf source = tu.cs->getOrgBuf( compArea ); PelBuf destination = tu.getPcmbuf( compID ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (tu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#else - if (tu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#endif { CompArea tmpArea(COMPONENT_Y, compArea.chromaFormat, Position(0, 0), compArea.size()); PelBuf tempOrgBuf = m_tmpStorageLCU->getBuf(tmpArea); @@ -2528,11 +2382,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); cu.skip = false; cu.mmvdSkip = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif //cu.affine cu.predMode = MODE_INTER; //cu.LICFlag @@ -2635,32 +2485,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcIntraSearch->switchBuffer(pu, COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); } pu.cs->getPredBuf(pu).copyFrom(acMergeTmpBuffer[mergeCand]); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (pu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); } m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); // calculate cost -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (pu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getInvLUT()); } distParam.cur = pu.cs->getPredBuf(pu).Y(); Distortion sadValue = distParam.distFunc(distParam); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (pu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); } @@ -2732,11 +2570,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& setMergeBestSATDCost( candCostList[0] ); -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isIntrainterEnabled && isChromaEnabled(pu.cs->pcv->chrFormat)) -#else - if (isIntrainterEnabled) -#endif { pu.ciipFlag = true; for (uint32_t mergeCnt = 0; mergeCnt < uiNumMrgSATDCand; mergeCnt++) @@ -2807,11 +2641,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); cu.skip = false; cu.mmvdSkip = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif //cu.affine cu.predMode = MODE_INTER; //cu.LICFlag @@ -2876,19 +2706,13 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& uint32_t bufIdx = 0; PelBuf tmpBuf = tempCS->getPredBuf(pu).Y(); tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Y()); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (pu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { tmpBuf.rspSignal(m_pcReshape->getFwdLUT()); } m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, bufIdx)); -#if JVET_Q0438_MONOCHROME_BUGFIXES if (isChromaEnabled(pu.chromaFormat)) { -#endif if (pu.chromaSize().width > 2) { tmpBuf = tempCS->getPredBuf(pu).Cb(); @@ -2905,9 +2729,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& tmpBuf = tempCS->getPredBuf(pu).Cr(); tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Cr()); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif } else { @@ -2984,246 +2806,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } -#if !JVET_Q0806 -void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) -{ - const Slice &slice = *tempCS->slice; - const SPS &sps = *tempCS->sps; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - if (sps.getMaxNumGeoCand() < 2) -#else - if (slice.getPicHeader()->getMaxNumTriangleCand() < 2) -#endif - return; - - CHECK( slice.getSliceType() != B_SLICE, "Triangle mode is only applied to B-slices" ); - - tempCS->initStructData( encTestMode.qp ); - - bool trianglecandHasNoResidual[TRIANGLE_MAX_NUM_CANDS]; - for( int mergeCand = 0; mergeCand < TRIANGLE_MAX_NUM_CANDS; mergeCand++ ) - { - trianglecandHasNoResidual[mergeCand] = false; - } - - bool bestIsSkip = false; - uint8_t numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; - uint8_t triangleNumMrgSATDCand = TRIANGLE_MAX_NUM_SATD_CANDS; - PelUnitBuf triangleBuffer[TRIANGLE_MAX_NUM_UNI_CANDS]; - PelUnitBuf triangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; - static_vector<uint8_t, TRIANGLE_MAX_NUM_CANDS> triangleRdModeList; - static_vector<double, TRIANGLE_MAX_NUM_CANDS> tianglecandCostList; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - uint8_t numTriangleCandComb = sps.getMaxNumGeoCand() * (sps.getMaxNumGeoCand() - 1) * 2; -#else - uint8_t numTriangleCandComb = slice.getPicHeader()->getMaxNumTriangleCand() * (slice.getPicHeader()->getMaxNumTriangleCand() - 1) * 2; -#endif - - DistParam distParam; - const bool useHadamard = !tempCS->slice->getDisableSATDForRD(); - m_pcRdCost->setDistParam( distParam, tempCS->getOrgBuf().Y(), m_acMergeBuffer[0].Y(), sps.getBitDepth( CHANNEL_TYPE_LUMA ), COMPONENT_Y, useHadamard ); - - const UnitArea localUnitArea( tempCS->area.chromaFormat, Area( 0, 0, tempCS->area.Y().width, tempCS->area.Y().height) ); - - const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda( ); - - MergeCtx triangleMrgCtx; - { - CodingUnit cu( tempCS->area ); - cu.cs = tempCS; - cu.predMode = MODE_INTER; - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); - cu.triangle = true; - cu.mmvdSkip = false; - cu.BcwIdx = BCW_DEFAULT; - - PredictionUnit pu( tempCS->area ); - pu.cu = &cu; - pu.cs = tempCS; - pu.regularMergeFlag = false; - - PU::getTriangleMergeCandidates( pu, triangleMrgCtx ); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - const uint8_t maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand(); -#else - const uint8_t maxNumTriangleCand = pu.cs->picHeader->getMaxNumTriangleCand(); -#endif - for (uint8_t mergeCand = 0; mergeCand < maxNumTriangleCand; mergeCand++) - { - triangleBuffer[mergeCand] = m_acMergeBuffer[mergeCand].getBuf(localUnitArea); - triangleMrgCtx.setMergeInfo( pu, mergeCand ); - PU::spanMotionInfo( pu, triangleMrgCtx ); - - if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( pu ) ) ) ) - { - // Do not use this mode - tempCS->initStructData( encTestMode.qp ); - return; - } - m_pcInterSearch->motionCompensation( pu, triangleBuffer[mergeCand] ); - } - } - - triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, numTriangleCandComb); - { - CodingUnit &cu = tempCS->addCU( tempCS->area, partitioner.chType ); - - partitioner.setCUData( cu ); - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); - cu.skip = false; - cu.predMode = MODE_INTER; - cu.chromaQpAdj = m_cuChromaQpOffsetIdxPlus1; - cu.qp = encTestMode.qp; - cu.triangle = true; - cu.mmvdSkip = false; - cu.BcwIdx = BCW_DEFAULT; - - PredictionUnit &pu = tempCS->addPU( cu, partitioner.chType ); - - if( abs(floorLog2(cu.lwidth()) - floorLog2(cu.lheight())) >= 2 ) - { - numTriangleCandidate = 30; - } - else - { - numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; - } - - numTriangleCandidate = min(numTriangleCandidate, numTriangleCandComb); - - for( uint8_t mergeCand = 0; mergeCand < numTriangleCandidate; mergeCand++ ) - { - bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; - uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; - uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; - - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - pu.mergeFlag = true; - pu.regularMergeFlag = false; - triangleWeightedBuffer[mergeCand] = m_acTriangleWeightedBuffer[mergeCand].getBuf( localUnitArea ); - triangleBuffer[candIdx0] = m_acMergeBuffer[candIdx0].getBuf( localUnitArea ); - triangleBuffer[candIdx1] = m_acMergeBuffer[candIdx1].getBuf( localUnitArea ); - - m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_LUMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); - distParam.cur = triangleWeightedBuffer[mergeCand].Y(); - - Distortion uiSad = distParam.distFunc( distParam ); - - uint32_t uiBitsCand = m_triangleIdxBins[splitDir][candIdx0][candIdx1]; - - double cost = (double)uiSad + (double)uiBitsCand * sqrtLambdaForFirstPass; - - updateCandList( mergeCand, cost, triangleRdModeList, tianglecandCostList - , triangleNumMrgSATDCand ); - } - - // limit number of candidates using SATD-costs - for( uint8_t i = 0; i < triangleNumMrgSATDCand; i++ ) - { - if( tianglecandCostList[i] > MRG_FAST_RATIO * tianglecandCostList[0] || tianglecandCostList[i] > getMergeBestSATDCost() ) - { - triangleNumMrgSATDCand = i; - break; - } - } - - // perform chroma weighting process -#if JVET_Q0438_MONOCHROME_BUGFIXES - if (isChromaEnabled(pu.chromaFormat)) - { -#endif - for( uint8_t i = 0; i < triangleNumMrgSATDCand; i++ ) - { - uint8_t mergeCand = triangleRdModeList[i]; - bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; - uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; - uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; - - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - pu.mergeFlag = true; - pu.regularMergeFlag = false; - m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_CHROMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); - } -#if JVET_Q0438_MONOCHROME_BUGFIXES - } -#endif - - tempCS->initStructData( encTestMode.qp ); - } - - triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, (uint8_t)triangleRdModeList.size()); - - m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - { - uint8_t iteration; - uint8_t iterationBegin = 0; - iteration = 2; - for (uint8_t noResidualPass = iterationBegin; noResidualPass < iteration; ++noResidualPass) - { - for( uint8_t mrgHADIdx = 0; mrgHADIdx < triangleNumMrgSATDCand; mrgHADIdx++ ) - { - uint8_t mergeCand = triangleRdModeList[mrgHADIdx]; - - if ( ( (noResidualPass != 0) && trianglecandHasNoResidual[mergeCand] ) - || ( (noResidualPass == 0) && bestIsSkip ) ) - { - continue; - } - - bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; - uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; - uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; - - CodingUnit &cu = tempCS->addCU(tempCS->area, partitioner.chType); - - partitioner.setCUData(cu); - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); - cu.skip = false; - cu.predMode = MODE_INTER; - cu.chromaQpAdj = m_cuChromaQpOffsetIdxPlus1; - cu.qp = encTestMode.qp; - cu.triangle = true; - cu.mmvdSkip = false; - cu.BcwIdx = BCW_DEFAULT; - PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType); - - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - pu.mergeFlag = true; - pu.regularMergeFlag = false; - PU::spanTriangleMotionInfo(pu, triangleMrgCtx, splitDir, candIdx0, candIdx1 ); - - if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( *cu.firstPU ) ) ) ) - { - // Do not use this mode - tempCS->initStructData( encTestMode.qp ); - return; - } - tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); - xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, ( noResidualPass == 0 ? &trianglecandHasNoResidual[mergeCand] : NULL ) ); - - if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip) - { - bestIsSkip = bestCS->getCU(partitioner.chType)->rootCbf == 0; - } - tempCS->initStructData(encTestMode.qp); - }// end loop mrgHADIdx - } - } - if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) - { - xCalDebCost( *bestCS, partitioner ); - } -} -#else void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode) { const Slice &slice = *tempCS->slice; @@ -3270,11 +2852,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure const UnitArea localUnitArea(tempCS->area.chromaFormat, Area(0, 0, tempCS->area.Y().width, tempCS->area.Y().height)); const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda(); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE uint8_t maxNumMergeCandidates = cu.cs->sps->getMaxNumGeoCand(); -#else - uint8_t maxNumMergeCandidates = cu.cs->picHeader->getMaxNumGeoCand(); -#endif DistParam distParamWholeBlk; m_pcRdCost->setDistParam(distParamWholeBlk, tempCS->getOrgBuf().Y(), m_acMergeBuffer[0].Y().buf, m_acMergeBuffer[0].Y().stride, sps.getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y); Distortion bestWholeBlkSad = MAX_UINT64; @@ -3506,7 +3084,6 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure xCalDebCost(*bestCS, pm); } } -#endif void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { @@ -3529,9 +3106,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct AffineMergeCtx affineMergeCtx; const SPS &sps = *tempCS->sps; -#if JVET_Q0806 setAFFBestSATDCost(MAX_DOUBLE); -#endif MergeCtx mrgCtx; if ( sps.getSBTMVPEnabledFlag() ) @@ -3672,9 +3247,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct } tempCS->initStructData( encTestMode.qp ); -#if JVET_Q0806 setAFFBestSATDCost(candCostList[0]); -#endif } else @@ -3828,11 +3401,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.mmvdSkip = false; pu.mmvdMergeFlag = false; pu.regularMergeFlag = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif PU::getIBCMergeCandidates(pu, mergeCtx); } @@ -3866,11 +3435,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.chromaQpAdj = m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; cu.mmvdSkip = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif DistParam distParam; const bool bUseHadamard = !cu.slice->getDisableSATDForRD(); PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType); //tempCS->addPU(cu); @@ -3879,11 +3444,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct Picture* refPic = pu.cu->slice->getPic(); const CPelBuf refBuf = refPic->getRecoBuf(pu.blocks[COMPONENT_Y]); const Pel* piRefSrch = refBuf.buf; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (tempCS->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (tempCS->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() ) -#endif { const CompArea &area = cu.blocks[COMPONENT_Y]; CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); @@ -3921,11 +3482,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct Distortion sad = distParam.distFunc(distParam); unsigned int bitsCand = mergeCand + 1; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (mergeCand == tempCS->sps->getMaxNumMergeCand() - 1) -#else - if (mergeCand == tempCS->picHeader->getMaxNumMergeCand() - 1) -#endif { bitsCand--; } @@ -3995,11 +3552,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.mmvdSkip = false; pu.mmvdMergeFlag = false; pu.regularMergeFlag = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif mergeCtx.setMergeInfo(pu, mergeCand); PU::spanMotionInfo(pu, mergeCtx); @@ -4027,9 +3580,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct xCheckDQP(*tempCS, partitioner); } #endif -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif DTRACE_MODE_COST(*tempCS, m_pcRdCost->getLambda()); @@ -4121,9 +3672,7 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best xCheckDQP(*tempCS, partitioner); } #endif -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); if ( m_bestModeUpdated ) @@ -4522,11 +4071,7 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal //Copy current CU's reco to Deblock Pic Buffer const CompArea& curCompArea = currCsArea.block( compId ); picDbBuf.getBuf( curCompArea ).copyFrom( cs.getRecoBuf( curCompArea ) ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma(compId)) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma(compId)) -#endif { picDbBuf.getBuf( curCompArea ).rspSignal( m_pcReshape->getInvLUT() ); } @@ -4536,11 +4081,7 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal { const CompArea& compArea = areaLeft.block(compId); picDbBuf.getBuf( compArea ).copyFrom( cs.picture->getRecoBuf( compArea ) ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma(compId)) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma(compId)) -#endif { picDbBuf.getBuf( compArea ).rspSignal( m_pcReshape->getInvLUT() ); } @@ -4550,11 +4091,7 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal { const CompArea& compArea = areaTop.block( compId ); picDbBuf.getBuf( compArea ).copyFrom( cs.picture->getRecoBuf( compArea ) ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma(compId)) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma(compId)) -#endif { picDbBuf.getBuf( compArea ).rspSignal( m_pcReshape->getInvLUT() ); } @@ -4625,13 +4162,8 @@ Distortion EncCu::getDistortionDb( CodingStructure &cs, CPelBuf org, CPelBuf rec #if WCG_EXT m_pcRdCost->setChromaFormat(cs.sps->getChromaFormatIdc()); CPelBuf orgLuma = cs.picture->getOrigBuf( cs.area.blocks[COMPONENT_Y] ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#else - if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( - m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#endif { if ( compID == COMPONENT_Y && !afterDb && !m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) { @@ -4646,11 +4178,7 @@ Distortion EncCu::getDistortionDb( CodingStructure &cs, CPelBuf org, CPelBuf rec dist += m_pcRdCost->getDistPart( org, reco, cs.sps->getBitDepth( toChannelType( compID ) ), compID, DF_SSE_WTD, &orgLuma ); } } -#if JVET_Q0346_LMCS_ENABLE_IN_SH else if (m_pcEncCfg->getLmcs() && cs.slice->getLmcsEnabledFlag() && cs.slice->isIntra()) //intra slice -#else - else if (m_pcEncCfg->getLmcs() && cs.picHeader->getLmcsEnabledFlag() && cs.slice->isIntra()) //intra slice -#endif { if ( compID == COMPONENT_Y && afterDb ) { @@ -4858,9 +4386,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS xEncodeDontSplit( *tempCS, partitioner ); xCheckDQP( *tempCS, partitioner ); -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif if( NULL != bestHasNonResi && (bestCostInternal > tempCS->cost) ) @@ -5009,9 +4535,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS xEncodeDontSplit( *tempCS, partitioner ); xCheckDQP( *tempCS, partitioner ); -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif if( NULL != bestHasNonResi && ( bestCostInternal > tempCS->cost ) ) { @@ -5143,13 +4667,8 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best CPelBuf org = tempCS->getOrgBuf ( compID ); #if WCG_EXT -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getLmcs() && (tempCS->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( - m_pcEncCfg->getLmcs() && (tempCS->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#endif { const CPelBuf orgLuma = tempCS->getOrgBuf(tempCS->area.blocks[COMPONENT_Y]); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) @@ -5185,9 +4704,7 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best xEncodeDontSplit( *tempCS, partitioner ); xCheckDQP ( *tempCS, partitioner ); -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET xCheckChromaQPOffset( *tempCS, partitioner ); -#endif xCheckBestMode ( tempCS, bestCS, partitioner, cachedMode ); } else diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 91e22c548f69522b0dbbf969aa59974df7ff86d8..882a5ef7fab42f4738754d66da926001415e9879 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -67,17 +67,6 @@ class EncSlice; // ==================================================================================================================== /// CU encoder class -#if !JVET_Q0806 -struct TriangleMotionInfo -{ - uint8_t m_splitDir; - uint8_t m_candIdx0; - uint8_t m_candIdx1; - - TriangleMotionInfo ( uint8_t splitDir, uint8_t candIdx0, uint8_t candIdx1 ): m_splitDir(splitDir), m_candIdx0(candIdx0), m_candIdx1(candIdx1) { } - TriangleMotionInfo() { m_splitDir = m_candIdx0 = m_candIdx1 = 0; } -}; -#else struct GeoMergeCombo { int splitDir; @@ -156,7 +145,6 @@ public: } int numGeoTemplatesInitialized; }; -#endif class EncCu : DecCu @@ -203,13 +191,9 @@ private: PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelStorage m_acRealMergeBuffer[MRG_MAX_NUM_CANDS]; PelStorage m_acMergeTmpBuffer[MRG_MAX_NUM_CANDS]; -#if !JVET_Q0806 - PelStorage m_acTriangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; // to store weighted prediction pixles -#else PelStorage m_acGeoWeightedBuffer[GEO_MAX_TRY_WEIGHTED_SAD]; // to store weighted prediction pixles FastGeoCostList m_GeoCostList; double m_AFFBestSATDCost; -#endif double m_mergeBestSATDCost; MotionInfo m_SubPuMiBuf [( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 )]; @@ -220,12 +204,7 @@ private: #endif int m_bestBcwIdx[2]; double m_bestBcwCost[2]; -#if !JVET_Q0806 - TriangleMotionInfo m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS]; - uint8_t m_triangleIdxBins[2][TRIANGLE_MAX_NUM_UNI_CANDS][TRIANGLE_MAX_NUM_UNI_CANDS]; -#else GeoMotionInfo m_GeoModeTest[GEO_MAX_NUM_CANDS]; -#endif #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU void updateLambda ( Slice* slice, const int dQP, #if WCG_EXT && ER_CHROMA_QP_WCG_PPS @@ -255,10 +234,8 @@ public: void setMergeBestSATDCost(double cost) { m_mergeBestSATDCost = cost; } double getMergeBestSATDCost() { return m_mergeBestSATDCost; } -#if JVET_Q0806 void setAFFBestSATDCost(double cost) { m_AFFBestSATDCost = cost; } double getAFFBestSATDCost() { return m_AFFBestSATDCost; } -#endif IbcHashMap& getIbcHashMap() { return m_ibcHashMap; } EncCfg* getEncCfg() const { return m_pcEncCfg; } @@ -284,9 +261,7 @@ protected: bool xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode, bool adaptiveColorTrans); void xCheckDQP ( CodingStructure& cs, Partitioner& partitioner, bool bKeepCtx = false); -#if JVET_Q0267_RESET_CHROMA_QP_OFFSET void xCheckChromaQPOffset ( CodingStructure& cs, Partitioner& partitioner); -#endif void xFillPCMBuffer ( CodingUnit &cu); void xCheckRDCostHashInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); @@ -298,11 +273,7 @@ protected: void xCheckRDCostMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if !JVET_Q0806 - void xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#else void xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode); -#endif void xEncodeInterResidual( CodingStructure *&tempCS , CodingStructure *&bestCS diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 786e0020c44904fc1dfe906bc4c33104a4d81d13..58d6e0002ac89293733f8fb1898f06113090fef6 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -55,9 +55,7 @@ #include "CommonLib/UnitTools.h" #include "CommonLib/dtrace_codingstruct.h" #include "CommonLib/dtrace_buffer.h" -#if JVET_Q0436_CABAC_ZERO_WORD || JVET_P0188_MINCR #include "CommonLib/ProfileLevelTier.h" -#endif #include "DecoderLib/DecLib.h" @@ -317,7 +315,6 @@ int EncGOP::xWriteVPS (AccessUnit &accessUnit, const VPS *vps) accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP int EncGOP::xWriteDCI(AccessUnit& accessUnit, const DCI* dci) { OutputNALUnit nalu(NAL_UNIT_DCI); @@ -327,24 +324,6 @@ int EncGOP::xWriteDCI(AccessUnit& accessUnit, const DCI* dci) accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#else -int EncGOP::xWriteDPS (AccessUnit &accessUnit, const DPS *dps) -{ - if (dps->getDecodingParameterSetId() !=0) - { - OutputNALUnit nalu(NAL_UNIT_DPS); - m_HLSWriter->setBitstream( &nalu.m_Bitstream ); - CHECK( nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0" ); - m_HLSWriter->codeDPS( dps ); - accessUnit.push_back(new NALUnitEBSP(nalu)); - return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; - } - else - { - return 0; - } -} -#endif int EncGOP::xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId ) { @@ -382,43 +361,23 @@ int EncGOP::xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId, cons return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#if ENABLING_MULTI_SPS int EncGOP::xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst, const int layerIdx) -#else -int EncGOP::xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst) -#endif { int actualTotalBits = 0; if( bSeqFirst ) { -#if ENABLING_MULTI_SPS if (layerIdx == 0) { -#if JVET_Q0117_PARAMETER_SETS_CLEANUP if (m_pcCfg->getDCIEnabled()) { actualTotalBits += xWriteDCI(accessUnit, m_pcEncLib->getDCI()); } -#else - actualTotalBits += xWriteDPS(accessUnit, m_pcEncLib->getDPS()); -#endif if (slice->getSPS()->getVPSId() != 0) { actualTotalBits += xWriteVPS(accessUnit, m_pcEncLib->getVPS()); } } -#else - if (slice->getSPS()->getVPSId() != 0) - { - actualTotalBits += xWriteVPS(accessUnit, m_pcEncLib->getVPS()); - } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP - actualTotalBits += xWriteDCI( accessUnit, m_pcEncLib->getDCI() ); -#else - actualTotalBits += xWriteDPS( accessUnit, m_pcEncLib->getDPS() ); -#endif -#endif if( m_pcEncLib->SPSNeedsWriting( slice->getSPS()->getSPSId() ) ) // Note this assumes that all changes to the SPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). { CHECK( !( bSeqFirst ), "Unspecified error" ); // Implementations that use more than 1 SPS need to be aware of activation issues. @@ -440,11 +399,7 @@ int EncGOP::xWritePicHeader( AccessUnit &accessUnit, PicHeader *picHeader ) m_HLSWriter->setBitstream( &nalu.m_Bitstream ); nalu.m_temporalId = accessUnit.temporalId; nalu.m_nuhLayerId = m_pcEncLib->getLayerId(); -#if JVET_Q0775_PH_IN_SH m_HLSWriter->codePictureHeader( picHeader, true ); -#else - m_HLSWriter->codePictureHeader( picHeader ); -#endif accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } @@ -519,7 +474,6 @@ void EncGOP::xWriteLeadingSEIOrdered (SEIMessages& seiMessages, SEIMessages& duI { AccessUnit::iterator itNalu = accessUnit.begin(); -#if JVET_Q0117_PARAMETER_SETS_CLEANUP while ((itNalu != accessUnit.end()) && ((*itNalu)->m_nalUnitType == NAL_UNIT_ACCESS_UNIT_DELIMITER || (*itNalu)->m_nalUnitType == NAL_UNIT_VPS @@ -527,15 +481,6 @@ void EncGOP::xWriteLeadingSEIOrdered (SEIMessages& seiMessages, SEIMessages& duI || (*itNalu)->m_nalUnitType == NAL_UNIT_SPS || (*itNalu)->m_nalUnitType == NAL_UNIT_PPS )) -#else - while ((itNalu != accessUnit.end()) && - ((*itNalu)->m_nalUnitType == NAL_UNIT_ACCESS_UNIT_DELIMITER - || (*itNalu)->m_nalUnitType == NAL_UNIT_VPS - || (*itNalu)->m_nalUnitType == NAL_UNIT_DPS - || (*itNalu)->m_nalUnitType == NAL_UNIT_SPS - || (*itNalu)->m_nalUnitType == NAL_UNIT_PPS - )) -#endif { itNalu++; } @@ -573,7 +518,6 @@ void EncGOP::xWriteLeadingSEIOrdered (SEIMessages& seiMessages, SEIMessages& duI xClearSEIs(currentMessages, !testWrite); } -#if JVET_P0190_SCALABLE_NESTING_SEI if (m_pcCfg->getScalableNestingSEIEnabled()) { // Scalable nesting SEI must always be the following DU info @@ -581,7 +525,6 @@ void EncGOP::xWriteLeadingSEIOrdered (SEIMessages& seiMessages, SEIMessages& duI xWriteSEISeparately(NAL_UNIT_PREFIX_SEI, currentMessages, accessUnit, itNalu, temporalId, sps); xClearSEIs(currentMessages, !testWrite); } -#endif // And finally everything else one by one @@ -714,11 +657,7 @@ void EncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const SPS m_seiEncoder.initSEIGcmp(sei); seiMessages.push_back(sei); } -#if JVET_SUBPIC_LEVEL_CFG if (m_pcCfg->getSubpicureLevelInfoSEICfg().m_enabled) -#else - if (m_pcCfg->getSubpicureLevelInfoSEIEnabled()) -#endif { SEISubpicureLevelInfo *seiSubpicureLevelInfo = new SEISubpicureLevelInfo; m_seiEncoder.initSEISubpictureLevelInfo(seiSubpicureLevelInfo, sps); @@ -774,14 +713,8 @@ void EncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const SPS void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, Slice *slice) { if ((m_pcCfg->getBufferingPeriodSEIEnabled()) && (slice->isIRAP() || slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && -#if JVET_P0125_SEI_CONSTRAINTS slice->getNalUnitLayerId()==slice->getVPS()->getLayerId(0) && -#endif -#if JVET_P0118_HRD_ASPECTS (slice->getSPS()->getGeneralHrdParametersPresentFlag())) -#else - ( slice->getSPS()->getHrdParametersPresentFlag() ) ) -#endif { SEIBufferingPeriod *bufferingPeriodSEI = new SEIBufferingPeriod(); bool noLeadingPictures = ( (slice->getNalUnitType()!= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (slice->getNalUnitType()!= NAL_UNIT_CODED_SLICE_CRA) )?(true):(false); @@ -790,14 +723,12 @@ void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessage seiMessages.push_back(bufferingPeriodSEI); m_bufferingPeriodSEIPresentInAU = true; -#if JVET_P0190_SCALABLE_NESTING_SEI if (m_pcCfg->getScalableNestingSEIEnabled()) { SEIBufferingPeriod *bufferingPeriodSEIcopy = new SEIBufferingPeriod(); bufferingPeriodSEI->copyTo(*bufferingPeriodSEIcopy); nestedSeiMessages.push_back(bufferingPeriodSEIcopy); } -#endif } @@ -810,7 +741,6 @@ void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessage } -#if JVET_P0190_SCALABLE_NESTING_SEI void EncGOP::xCreateScalableNestingSEI(SEIMessages& seiMessages, SEIMessages& nestedSeiMessages) { SEIMessages tmpMessages; @@ -825,7 +755,6 @@ void EncGOP::xCreateScalableNestingSEI(SEIMessages& seiMessages, SEIMessages& ne tmpMessages.clear(); } } -#endif void EncGOP::xCreateFrameFieldInfoSEI (SEIMessages& seiMessages, Slice *slice, bool isField) @@ -854,18 +783,10 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, return; } -#if JVET_P0118_HRD_ASPECTS const GeneralHrdParams *hrd = slice->getSPS()->getGeneralHrdParameters(); -#else - const HRDParameters *hrd = slice->getSPS()->getHrdParameters(); -#endif // update decoding unit parameters -#if JVET_P0125_SEI_CONSTRAINTS if ((m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled()) && slice->getNalUnitLayerId() == slice->getVPS()->getLayerId(0)) -#else - if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) ) -#endif { int picSptDpbOutputDuDelay = 0; SEIPictureTiming *pictureTimingSEI = new SEIPictureTiming(); @@ -1078,14 +999,12 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, { seiMessages.push_back(pictureTimingSEI); -#if JVET_P0190_SCALABLE_NESTING_SEI if (m_pcCfg->getScalableNestingSEIEnabled()) { SEIPictureTiming *pictureTimingSEIcopy = new SEIPictureTiming(); pictureTimingSEI->copyTo(*pictureTimingSEIcopy); nestedSeiMessages.push_back(pictureTimingSEIcopy); } -#endif } if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ) @@ -1153,11 +1072,7 @@ void EncGOP::xUpdateTimingSEI(SEIPictureTiming *pictureTimingSEI, std::deque<DUD { return; } -#if JVET_P0118_HRD_ASPECTS const GeneralHrdParams *hrd = sps->getGeneralHrdParameters(); -#else - const HRDParameters *hrd = sps->getHrdParameters(); -#endif if( hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ) { int i; @@ -1188,11 +1103,7 @@ void EncGOP::xUpdateTimingSEI(SEIPictureTiming *pictureTimingSEI, std::deque<DUD for( i = ( numDU - 2 ); i >= 0; i -- ) { -#if JVET_P0118_HRD_ASPECTS ui64Tmp = (((duData[numDU - 1].accumBitsDU - duData[i].accumBitsDU) * (sps->getGeneralHrdParameters()->getTimeScale() / sps->getGeneralHrdParameters()->getNumUnitsInTick()) * (hrd->getTickDivisorMinus2() + 2)) / (m_pcCfg->getTargetBitrate())); -#else - ui64Tmp = ( ( ( duData[numDU - 1].accumBitsDU - duData[i].accumBitsDU ) * ( sps->getTimingInfo()->getTimeScale() / sps->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) ); -#endif if( (uint32_t)ui64Tmp > maxDiff ) { tmp ++; @@ -1204,11 +1115,7 @@ void EncGOP::xUpdateTimingSEI(SEIPictureTiming *pictureTimingSEI, std::deque<DUD for( i = ( numDU - 2 ); i >= 0; i -- ) { flag = 0; -#if JVET_P0118_HRD_ASPECTS ui64Tmp = (((duData[numDU - 1].accumBitsDU - duData[i].accumBitsDU) * (sps->getGeneralHrdParameters()->getTimeScale() / sps->getGeneralHrdParameters()->getNumUnitsInTick()) * (hrd->getTickDivisorMinus2() + 2)) / (m_pcCfg->getTargetBitrate())); -#else - ui64Tmp = ( ( ( duData[numDU - 1].accumBitsDU - duData[i].accumBitsDU ) * ( sps->getTimingInfo()->getTimeScale() / sps->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) ); -#endif if( (uint32_t)ui64Tmp > maxDiff ) { @@ -1257,7 +1164,6 @@ void EncGOP::xUpdateDuInfoSEI(SEIMessages &duInfoSeiMessages, SEIPictureTiming * } } -#if JVET_P0188_MINCR static void validateMinCrRequirements(const ProfileLevelTierFeatures &plt, std::size_t numBytesInVclNalUnits, const Picture *pPic, const EncCfg *pCfg) { @@ -1283,9 +1189,7 @@ validateMinCrRequirements(const ProfileLevelTierFeatures &plt, std::size_t numBy } } } -#endif -#if JVET_Q0436_CABAC_ZERO_WORD static void cabac_zero_word_padding(const Slice *const pcSlice, const Picture *const pcPic, @@ -1294,42 +1198,25 @@ cabac_zero_word_padding(const Slice *const pcSlice, std::ostringstream &nalUnitData, const bool cabacZeroWordPaddingEnabled, const ProfileLevelTierFeatures &plt) -#else -static void -cabac_zero_word_padding(Slice *const pcSlice, Picture *const pcPic, const std::size_t binCountsInNalUnits, const std::size_t numBytesInVclNalUnits, std::ostringstream &nalUnitData, const bool cabacZeroWordPaddingEnabled) -#endif { const SPS &sps=*(pcSlice->getSPS()); const ChromaFormat format = sps.getChromaFormatIdc(); const int log2subWidthCxsubHeightC = (::getComponentScaleX(COMPONENT_Cb, format)+::getComponentScaleY(COMPONENT_Cb, format)); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int minCuWidth = 1 << pcSlice->getSPS()->getLog2MinCodingBlockSize(); const int minCuHeight = 1 << pcSlice->getSPS()->getLog2MinCodingBlockSize(); -#else - const int minCuWidth = pcPic->cs->pcv->minCUWidth; - const int minCuHeight = pcPic->cs->pcv->minCUHeight; -#endif const int paddedWidth = ( ( pcSlice->getPPS()->getPicWidthInLumaSamples() + minCuWidth - 1 ) / minCuWidth ) * minCuWidth; const int paddedHeight = ( ( pcSlice->getPPS()->getPicHeightInLumaSamples() + minCuHeight - 1 ) / minCuHeight ) * minCuHeight; const int rawBits = paddedWidth * paddedHeight * (sps.getBitDepth(CHANNEL_TYPE_LUMA) + ((2*sps.getBitDepth(CHANNEL_TYPE_CHROMA))>>log2subWidthCxsubHeightC)); -#if JVET_Q0436_CABAC_ZERO_WORD const int vclByteScaleFactor_x3 = ( 32 + 4 * (plt.getTier()==Level::HIGH ? 1 : 0) ); const std::size_t threshold = (vclByteScaleFactor_x3*numBytesInVclNalUnits/3) + (rawBits/32); // "The value of BinCountsInPicNalUnits shall be less than or equal to vclByteScaleFactor * NumBytesInPicVclNalUnits + ( RawMinCuBits * PicSizeInMinCbsY ) / 32." // binCountsInNalUnits <= vclByteScaleFactor_x3 * numBytesInVclNalUnits / 3 + rawBits / 32. // If it is currently not, then add cabac_zero_words to increase numBytesInVclNalUnits. -#else - const std::size_t threshold = (32/3)*numBytesInVclNalUnits + (rawBits/32); -#endif if (binCountsInNalUnits >= threshold) { // need to add additional cabac zero words (each one accounts for 3 bytes (=00 00 03)) to increase numBytesInVclNalUnits -#if JVET_Q0436_CABAC_ZERO_WORD const std::size_t targetNumBytesInVclNalUnits = ((binCountsInNalUnits - (rawBits/32))*3+vclByteScaleFactor_x3-1)/vclByteScaleFactor_x3; -#else - const std::size_t targetNumBytesInVclNalUnits = ((binCountsInNalUnits - (rawBits/32))*3+31)/32; -#endif if (targetNumBytesInVclNalUnits>numBytesInVclNalUnits) // It should be! { @@ -1922,15 +1809,6 @@ void EncGOP::xPicInitLMCS(Picture *pic, PicHeader *picHeader, Slice *slice) m_pcReshaper->setCTUFlag(false); -#if !JVET_Q0346_LMCS_ENABLE_IN_SH - //reshape original signal - if (m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()) - { - pic->getOrigBuf(COMPONENT_Y).rspSignal(m_pcReshaper->getFwdLUT()); - m_pcReshaper->setSrcReshaped(true); - m_pcReshaper->setRecReshaped(true); - } -#endif } else { @@ -1965,9 +1843,7 @@ void EncGOP::xPicInitLMCS(Picture *pic, PicHeader *picHeader, Slice *slice) //set all necessary information in LMCS APS and picture header picHeader->setLmcsEnabledFlag(m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()); -#if JVET_Q0346_LMCS_ENABLE_IN_SH slice->setLmcsEnabledFlag(m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()); -#endif picHeader->setLmcsChromaResidualScaleFlag(m_pcReshaper->getSliceReshaperInfo().getSliceReshapeChromaAdj() == 1); if (m_pcReshaper->getSliceReshaperInfo().getSliceReshapeModelPresentFlag()) { @@ -2117,11 +1993,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, picHeader->setSPSId( pcPic->cs->pps->getSPSId() ); picHeader->setPPSId( pcPic->cs->pps->getPPSId() ); picHeader->setSplitConsOverrideFlag(false); -#if JVET_Q0819_PH_CHANGES // initial two flags to be false picHeader->setPicInterSliceAllowedFlag(false); picHeader->setPicIntraSliceAllowedFlag(false); -#endif #if ER_CHROMA_QP_WCG_PPS // th this is a hot fix for the choma qp control if( m_pcEncLib->getWCGChromaQPControl().isEnabled() && m_pcEncLib->getSwitchPOC() != -1 ) @@ -2143,11 +2017,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, const int maxCUWidth = pcPic->cs->sps->getMaxCUWidth(); const int maxCUHeight = pcPic->cs->sps->getMaxCUHeight(); const ChromaFormat chromaFormatIDC = pcPic->cs->sps->getChromaFormatIdc(); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX const int maxTotalCUDepth = floorLog2(maxCUWidth) - pcPic->cs->sps->getLog2MinCodingBlockSize(); -#else - const int maxTotalCUDepth = pcPic->cs->sps->getMaxCodingDepth(); -#endif m_pcSliceEncoder->create( picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, maxTotalCUDepth ); @@ -2189,7 +2059,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // Set the nal unit type pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField)); -#if JVET_Q0819_PH_CHANGES // set two flags according to slice type presented in the picture if (pcSlice->getSliceType() != I_SLICE) { @@ -2200,7 +2069,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, picHeader->setPicIntraSliceAllowedFlag(true); } picHeader->setGdrOrIrapPicFlag(picHeader->getGdrPicFlag() || pcSlice->isIRAP()); -#endif if (m_pcCfg->getEfficientFieldIRAPEnabled()) { @@ -2299,11 +2167,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, xCreateExplicitReferencePictureSetFromReference( pcSlice, rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1() ); } -#if JVET_Q0751_MIXED_NAL_UNIT_TYPES pcSlice->applyReferencePictureListBasedMarking( rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1(), pcSlice->getPic()->layerId, *(pcSlice->getPPS())); -#else - pcSlice->applyReferencePictureListBasedMarking( rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1(), pcSlice->getPic()->layerId ); -#endif if(pcSlice->getTLayer() > 0 && !(pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL // Check if not a leading picture @@ -2314,12 +2178,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { bool isSTSA=true; -#if !JVET_Q0156_STSA - if( !m_pcEncLib->getVPS()->getAllIndependentLayersFlag() && m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ) - { - isSTSA = false; - } -#endif for(int ii=0;(ii<m_pcCfg->getGOPSize() && isSTSA==true);ii++) { @@ -2530,16 +2388,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, for( int refIdx = 0; refIdx < pcSlice->getNumRefIdx( REF_PIC_LIST_0 ); refIdx++ ) { -#if JVET_Q0487_SCALING_WINDOW_ISSUES if( pcSlice->getRefPic( REF_PIC_LIST_0, refIdx )->isRefScaled( pcSlice->getPPS() ) == false ) -#else - int refPicWidth = pcSlice->getRefPic( REF_PIC_LIST_0, refIdx )->unscaledPic->cs->pps->getPicWidthInLumaSamples(); - int refPicHeight = pcSlice->getRefPic( REF_PIC_LIST_0, refIdx )->unscaledPic->cs->pps->getPicHeightInLumaSamples(); - int curPicWidth = pcSlice->getPPS()->getPicWidthInLumaSamples(); - int curPicHeight = pcSlice->getPPS()->getPicHeightInLumaSamples(); - - if( refPicWidth == curPicWidth && refPicHeight == curPicHeight ) -#endif { colRefIdxL0 = refIdx; break; @@ -2550,16 +2399,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { for( int refIdx = 0; refIdx < pcSlice->getNumRefIdx( REF_PIC_LIST_1 ); refIdx++ ) { -#if JVET_Q0487_SCALING_WINDOW_ISSUES if( pcSlice->getRefPic( REF_PIC_LIST_1, refIdx )->isRefScaled( pcSlice->getPPS() ) == false ) -#else - int refPicWidth = pcSlice->getRefPic( REF_PIC_LIST_1, refIdx )->unscaledPic->cs->pps->getPicWidthInLumaSamples(); - int refPicHeight = pcSlice->getRefPic( REF_PIC_LIST_1, refIdx )->unscaledPic->cs->pps->getPicHeightInLumaSamples(); - int curPicWidth = pcSlice->getPPS()->getPicWidthInLumaSamples(); - int curPicHeight = pcSlice->getPPS()->getPicHeightInLumaSamples(); - - if( refPicWidth == curPicWidth && refPicHeight == curPicHeight ) -#endif { colRefIdxL1 = refIdx; break; @@ -2582,36 +2422,24 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } const uint32_t uiColFromL0 = refPicL0->slices[0]->getSliceQp() > refPicL1->slices[0]->getSliceQp(); -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS picHeader->setPicColFromL0Flag( uiColFromL0 ); -#endif pcSlice->setColFromL0Flag( uiColFromL0 ); pcSlice->setColRefIdx( uiColFromL0 ? colRefIdxL0 : colRefIdxL1 ); -#if JVET_Q0259_COLLOCATED_PIC_IN_PH picHeader->setColRefIdx( uiColFromL0 ? colRefIdxL0 : colRefIdxL1 ); -#endif } else if( colRefIdxL0 < 0 && colRefIdxL1 >= 0 ) { -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS picHeader->setPicColFromL0Flag( false ); -#endif pcSlice->setColFromL0Flag( false ); pcSlice->setColRefIdx( colRefIdxL1 ); -#if JVET_Q0259_COLLOCATED_PIC_IN_PH picHeader->setColRefIdx( colRefIdxL1 ); -#endif } else if( colRefIdxL0 >= 0 && colRefIdxL1 < 0 ) { -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS picHeader->setPicColFromL0Flag( true ); -#endif pcSlice->setColFromL0Flag( true ); pcSlice->setColRefIdx( colRefIdxL0 ); -#if JVET_Q0259_COLLOCATED_PIC_IN_PH picHeader->setColRefIdx( colRefIdxL0 ); -#endif } else { @@ -2750,11 +2578,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // Allocate some coders, now the number of tiles are known. const uint32_t numberOfCtusInFrame = pcPic->cs->pcv->sizeInCtus; const int numSubstreamsColumns = pcSlice->getPPS()->getNumTileColumns(); -#if JVET_Q0151_Q0205_ENTRYPOINTS const int numSubstreamRows = pcSlice->getSPS()->getEntropyCodingSyncEnabledFlag() ? pcPic->cs->pcv->heightInCtus : (pcSlice->getPPS()->getNumTileRows()); -#else - const int numSubstreamRows = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ? pcPic->cs->pcv->heightInCtus : (pcSlice->getPPS()->getNumTileRows()); -#endif const int numSubstreams = std::max<int> (numSubstreamRows * numSubstreamsColumns, (int) pcPic->cs->pps->getNumSlicesInPic()); std::vector<OutputBitstream> substreamsOut(numSubstreams); @@ -2810,12 +2634,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if( pcSlice->getSPS()->getScalingListFlag() && m_pcCfg->getUseScalingListId() == SCALING_LIST_FILE_READ ) { -#if JVET_Q0346_SCALING_LIST_USED_IN_SH picHeader->setExplicitScalingListEnabledFlag( true ); pcSlice->setExplicitScalingListUsed( true ); -#else - picHeader->setScalingListPresentFlag( true ); -#endif int apsId = std::min<int>( 7, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ); picHeader->setScalingListAPSId( apsId ); @@ -2847,7 +2667,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, for(uint32_t sliceIdx = 0; sliceIdx < pcPic->cs->pps->getNumSlicesInPic(); sliceIdx++ ) { pcSlice->setSliceMap( pcPic->cs->pps->getSliceMap( sliceIdx ) ); -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS if( pcPic->cs->pps->getRectSliceFlag() ) { Position firstCtu; @@ -2866,8 +2685,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setSliceSubPicId( pcPic->cs->pps->getSubPic( subPicIdx ).getSubPicID() ); } -#endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (pcPic->cs->sps->getUseLmcs()) { pcSlice->setLmcsEnabledFlag(picHeader->getLmcsEnabledFlag()); @@ -2888,7 +2705,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } } -#endif m_pcSliceEncoder->precompressSlice( pcPic ); m_pcSliceEncoder->compressSlice ( pcPic, false, false ); @@ -2913,7 +2729,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, CodingStructure& cs = *pcPic->cs; pcSlice = pcPic->slices[0]; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.sps->getUseLmcs() && m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()) { picHeader->setLmcsEnabledFlag(true); @@ -2938,23 +2753,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, m_pcReshaper->setRecReshaped(false); pcPic->getOrigBuf().copyFrom(pcPic->getTrueOrigBuf()); } -#else - if (pcSlice->getSPS()->getUseLmcs() && m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()) - { - picHeader->setLmcsEnabledFlag(true); -#if JVET_Q0346_LMCS_ENABLE_IN_SH - pcSlice->setLmcsEnabledFlag(true); -#endif - int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ); - - picHeader->setLmcsAPSId(apsId); - CHECK((m_pcReshaper->getRecReshaped() == false), "Rec picture is not reshaped!"); - pcPic->getRecoBuf(COMPONENT_Y).rspSignal(m_pcReshaper->getInvLUT()); - m_pcReshaper->setRecReshaped(false); - - pcPic->getOrigBuf().copyFrom(pcPic->getTrueOrigBuf()); - } -#endif // create SAO object based on the picture size if( pcSlice->getSPS()->getSAOEnabledFlag() ) @@ -2962,13 +2760,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, const uint32_t widthInCtus = ( picWidth + maxCUWidth - 1 ) / maxCUWidth; const uint32_t heightInCtus = ( picHeight + maxCUHeight - 1 ) / maxCUHeight; const uint32_t numCtuInFrame = widthInCtus * heightInCtus; -#if JVET_Q0441_SAO_MOD_12_BIT const uint32_t log2SaoOffsetScaleLuma = (uint32_t) std::max(0, pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA ) - MAX_SAO_TRUNCATED_BITDEPTH); const uint32_t log2SaoOffsetScaleChroma = (uint32_t) std::max(0, pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) - MAX_SAO_TRUNCATED_BITDEPTH); -#else - const uint32_t log2SaoOffsetScaleLuma = pcPic->cs->slice->getPPS()->getPpsRangeExtension().getLog2SaoOffsetScale( CHANNEL_TYPE_LUMA ); - const uint32_t log2SaoOffsetScaleChroma = pcPic->cs->slice->getPPS()->getPpsRangeExtension().getLog2SaoOffsetScale( CHANNEL_TYPE_CHROMA ); -#endif m_pcSAO->create( picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, maxTotalCUDepth, log2SaoOffsetScaleLuma, log2SaoOffsetScaleChroma ); m_pcSAO->destroyEncData(); @@ -2978,12 +2771,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if( pcSlice->getSPS()->getScalingListFlag() && m_pcCfg->getUseScalingListId() == SCALING_LIST_FILE_READ ) { -#if JVET_Q0346_SCALING_LIST_USED_IN_SH picHeader->setExplicitScalingListEnabledFlag(true); pcSlice->setExplicitScalingListUsed(true); -#else - picHeader->setScalingListPresentFlag(true); -#endif int apsId = 0; picHeader->setScalingListAPSId( apsId ); } @@ -3014,9 +2803,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, m_pcLoopFilter->loopFilterPic( cs ); CS::setRefinedMotionField(cs); -#if !JVET_Q0795_CCALF - DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 1 ) ) ); -#endif if( pcSlice->getSPS()->getSAOEnabledFlag() ) { @@ -3070,15 +2856,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } pcPic->slices[s]->setAlfAPSs(cs.slice->getAlfAPSs()); pcPic->slices[s]->setTileGroupApsIdChroma(cs.slice->getTileGroupApsIdChroma()); -#if JVET_Q0795_CCALF pcPic->slices[s]->setTileGroupCcAlfCbApsId(cs.slice->getTileGroupCcAlfCbApsId()); pcPic->slices[s]->setTileGroupCcAlfCrApsId(cs.slice->getTileGroupCcAlfCrApsId()); -#endif } } -#if JVET_Q0795_CCALF DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 1 ) ) ); -#endif if (m_pcCfg->getUseCompositeRef() && getPrepareLTRef()) { updateCompositeReference(pcSlice, rcListPic, pocCurr); @@ -3135,11 +2917,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, int layerIdx = m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ); // it is assumed that layerIdx equal to 0 is always present -#if ENABLING_MULTI_SPS actualTotalBits += xWriteParameterSets(accessUnit, pcSlice, writePS, layerIdx); -#else - actualTotalBits += xWriteParameterSets(accessUnit, pcSlice, writePS && !layerIdx); -#endif if (writePS) { // create prefix SEI messages at the beginning of the sequence @@ -3187,11 +2965,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } -#if JVET_Q0795_CCALF if (pcSlice->getSPS()->getALFEnabledFlag() && (pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y) || pcSlice->getTileGroupCcAlfCbEnabledFlag() || pcSlice->getTileGroupCcAlfCrEnabledFlag())) -#else - if (pcSlice->getSPS()->getALFEnabledFlag() && pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) -#endif { for (int apsId = 0; apsId < ALF_CTB_MAX_NUM_APS; apsId++) { @@ -3206,7 +2980,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, *apsMap->allocatePS(apsId) = *aps; //allocate and cpy m_pcALF->setApsIdStart( apsId ); } -#if JVET_Q0795_CCALF else if (pcSlice->getTileGroupCcAlfCbEnabledFlag() && !aps && apsId == pcSlice->getTileGroupCcAlfCbApsId()) { writeAPS = true; @@ -3217,17 +2990,12 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, writeAPS = true; aps = apsMap->getPS((pcSlice->getTileGroupCcAlfCrApsId() << NUM_APS_TYPE_LEN) + ALF_APS); } -#endif if (writeAPS ) { actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); apsMap->clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + ALF_APS); -#if JVET_Q0795_CCALF CHECK(aps != pcSlice->getAlfAPSs()[apsId] && apsId != pcSlice->getTileGroupCcAlfCbApsId() && apsId != pcSlice->getTileGroupCcAlfCrApsId(), "Wrong APS pointer in compressGOP"); -#else - CHECK(aps != pcSlice->getAlfAPSs()[apsId], "Wrong APS pointer in compressGOP"); -#endif } } } @@ -3255,28 +3023,16 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setRPL0idx(pcPic->slices[0]->getRPL0idx()); pcSlice->setRPL1idx(pcPic->slices[0]->getRPL1idx()); -#if SPS_ID_CHECK picHeader->setNoOutputBeforeRecoveryFlag( false ); -#else - pcSlice->setNoIncorrectPicOutputFlag(false); -#endif if (pcSlice->isIRAP()) { if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) { -#if SPS_ID_CHECK picHeader->setNoOutputBeforeRecoveryFlag( true ); -#else - pcSlice->setNoIncorrectPicOutputFlag(true); -#endif } //the inference for NoOutputPriorPicsFlag // KJS: This cannot happen at the encoder -#if SPS_ID_CHECK if( !m_bFirst && ( pcSlice->isIRAP() || pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_GDR ) && picHeader->getNoOutputBeforeRecoveryFlag() ) -#else - if (!m_bFirst && (pcSlice->isIRAP() || pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_GDR) && pcSlice->getNoIncorrectPicOutputFlag()) -#endif { if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_GDR) { @@ -3291,9 +3047,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // code RPL in picture header or slice headers if( !m_pcCfg->getSliceLevelRpl() && (!pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent()) ) { -#if !JVET_Q0819_PH_CHANGES - picHeader->setPicRplPresentFlag(true); -#endif picHeader->setRPL0idx(pcSlice->getRPL0idx()); picHeader->setRPL1idx(pcSlice->getRPL1idx()); picHeader->setRPL0(pcSlice->getRPL0()); @@ -3301,86 +3054,47 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, *picHeader->getLocalRPL0() = *pcSlice->getLocalRPL0(); *picHeader->getLocalRPL1() = *pcSlice->getLocalRPL1(); } -#if !JVET_Q0819_PH_CHANGES - else { - picHeader->setPicRplPresentFlag(false); - } -#endif // code DBLK in picture header or slice headers if( !m_pcCfg->getSliceLevelDblk() ) { -#if !JVET_Q0819_PH_CHANGES - picHeader->setDeblockingFilterOverridePresentFlag(true); -#endif picHeader->setDeblockingFilterOverrideFlag ( pcSlice->getDeblockingFilterOverrideFlag() ); picHeader->setDeblockingFilterDisable ( pcSlice->getDeblockingFilterDisable() ); picHeader->setDeblockingFilterBetaOffsetDiv2 ( pcSlice->getDeblockingFilterBetaOffsetDiv2() ); picHeader->setDeblockingFilterTcOffsetDiv2 ( pcSlice->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS picHeader->setDeblockingFilterCbBetaOffsetDiv2( pcSlice->getDeblockingFilterCbBetaOffsetDiv2() ); picHeader->setDeblockingFilterCbTcOffsetDiv2 ( pcSlice->getDeblockingFilterCbTcOffsetDiv2() ); picHeader->setDeblockingFilterCrBetaOffsetDiv2( pcSlice->getDeblockingFilterCrBetaOffsetDiv2() ); picHeader->setDeblockingFilterCrTcOffsetDiv2 ( pcSlice->getDeblockingFilterCrTcOffsetDiv2() ); -#endif - } -#if !JVET_Q0819_PH_CHANGES - else - { - picHeader->setDeblockingFilterOverridePresentFlag( false ); } -#endif -#if JVET_Q0819_PH_CHANGES if (!m_pcCfg->getSliceLevelDeltaQp()) { picHeader->setQpDelta(pcSlice->getSliceQp() - (pcSlice->getPPS()->getPicInitQPMinus26() + 26)); } -#endif // code SAO parameters in picture header or slice headers if( !m_pcCfg->getSliceLevelSao() ) { -#if !JVET_Q0819_PH_CHANGES - picHeader->setSaoEnabledPresentFlag(true); -#endif picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA )); picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA)); } -#if !JVET_Q0819_PH_CHANGES - else - { - picHeader->setSaoEnabledPresentFlag( false ); - } -#endif // code ALF parameters in picture header or slice headers if( !m_pcCfg->getSliceLevelAlf() ) { -#if !JVET_Q0819_PH_CHANGES - picHeader->setAlfEnabledPresentFlag(true); -#endif picHeader->setAlfEnabledFlag(COMPONENT_Y, pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y ) ); picHeader->setAlfEnabledFlag(COMPONENT_Cb, pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) ); picHeader->setAlfEnabledFlag(COMPONENT_Cr, pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cr) ); picHeader->setNumAlfAps(pcSlice->getTileGroupNumAps()); picHeader->setAlfAPSs(pcSlice->getTileGroupApsIdLuma()); picHeader->setAlfApsIdChroma(pcSlice->getTileGroupApsIdChroma()); -#if JVET_Q0795_CCALF picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, pcSlice->getTileGroupCcAlfCbEnabledFlag()); picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, pcSlice->getTileGroupCcAlfCrEnabledFlag()); picHeader->setCcAlfCbApsId(pcSlice->getTileGroupCcAlfCbApsId()); picHeader->setCcAlfCrApsId(pcSlice->getTileGroupCcAlfCrApsId()); -#endif - } -#if !JVET_Q0819_PH_CHANGES - else - { - picHeader->setAlfEnabledPresentFlag( false ); } -#endif -#if JVET_Q0819_PH_CHANGES // code WP parameters in picture header or slice headers if (!m_pcCfg->getSliceLevelWp()) { @@ -3388,11 +3102,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, picHeader->setNumL0Weights(pcSlice->getNumRefIdx(REF_PIC_LIST_0)); picHeader->setNumL0Weights(pcSlice->getNumRefIdx(REF_PIC_LIST_1)); } -#endif pcPic->cs->picHeader->setPic(pcPic); pcPic->cs->picHeader->setValid(); -#if JVET_Q0775_PH_IN_SH if (pcPic->cs->pps->getNumSlicesInPic() > 1 || !m_pcCfg->getEnablePictureHeaderInSliceHeader()) { pcSlice->setPictureHeaderInSliceHeader(false); @@ -3402,9 +3114,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setPictureHeaderInSliceHeader(true); } -#else - actualTotalBits += xWritePicHeader(accessUnit, pcPic->cs->picHeader); -#endif } pcSlice->setPicHeader( pcPic->cs->picHeader ); @@ -3419,20 +3128,16 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, tmpBitsBeforeWriting = m_HLSWriter->getNumberOfWrittenBits(); -#if JVET_Q0795_CCALF pcSlice->m_ccAlfFilterParam = m_pcALF->getCcAlfFilterParam(); pcSlice->m_ccAlfFilterControl[0] = m_pcALF->getCcAlfControlIdc(COMPONENT_Cb); pcSlice->m_ccAlfFilterControl[1] = m_pcALF->getCcAlfControlIdc(COMPONENT_Cr); -#endif m_HLSWriter->codeSliceHeader( pcSlice ); actualHeadBits += ( m_HLSWriter->getNumberOfWrittenBits() - tmpBitsBeforeWriting ); pcSlice->setFinalized(true); -#if JVET_Q0151_Q0205_ENTRYPOINTS pcSlice->resetNumberOfSubstream( ); pcSlice->setNumSubstream( pcSlice->getSPS(), pcSlice->getPPS() ); -#endif pcSlice->clearSubstreamSizes( ); { uint32_t numBinsCoded = 0; @@ -3448,11 +3153,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // Append substreams... OutputBitstream *pcOut = pcBitstreamRedirect; -#if JVET_Q0151_Q0205_ENTRYPOINTS const int numSubstreamsToCode = pcSlice->getNumberOfSubstream() + 1; -#else - const int numSubstreamsToCode = pcSlice->getNumberOfSubstreamSizes()+1; -#endif for ( uint32_t ui = 0 ; ui < numSubstreamsToCode; ui++ ) { @@ -3476,15 +3177,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && -#if JVET_P0118_HRD_ASPECTS ((pcSlice->getSPS()->getGeneralHrdParameters()->getGeneralNalHrdParametersPresentFlag()) || (pcSlice->getSPS()->getGeneralHrdParameters()->getGeneralVclHrdParametersPresentFlag())) && (pcSlice->getSPS()->getGeneralHrdParameters()->getGeneralDecodingUnitHrdParamsPresentFlag())) -#else - ( ( pcSlice->getSPS()->getHrdParameters()->getNalHrdParametersPresentFlag() ) - || ( pcSlice->getSPS()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) && - ( pcSlice->getSPS()->getHrdParameters()->getGeneralDecodingUnitHrdParamsPresentFlag() ) ) -#endif { uint32_t numNalus = 0; uint32_t numRBSPBytes = 0; @@ -3499,26 +3194,14 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } // end iteration over slices -#if JVET_Q0436_CABAC_ZERO_WORD || JVET_P0188_MINCR { // Check picture level encoding constraints/requirements ProfileLevelTierFeatures profileLevelTierFeatures; profileLevelTierFeatures.extractPTLInformation(*(pcSlice->getSPS())); -#endif -#if JVET_P0188_MINCR validateMinCrRequirements(profileLevelTierFeatures, numBytesInVclNalUnits, pcPic, m_pcCfg); -#endif -#if JVET_Q0436_CABAC_ZERO_WORD // cabac_zero_words processing cabac_zero_word_padding(pcSlice, pcPic, binCountsInNalUnits, numBytesInVclNalUnits, accessUnit.back()->m_nalUnitData, m_pcCfg->getCabacZeroWordPaddingEnabled(), profileLevelTierFeatures); -#else - - // cabac_zero_words processing - cabac_zero_word_padding(pcSlice, pcPic, binCountsInNalUnits, numBytesInVclNalUnits, accessUnit.back()->m_nalUnitData, m_pcCfg->getCabacZeroWordPaddingEnabled()); -#endif -#if JVET_Q0436_CABAC_ZERO_WORD || JVET_P0188_MINCR } -#endif //-- For time output for each slice auto elapsed = std::chrono::steady_clock::now() - beforeTime; @@ -3575,12 +3258,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, xCreateFrameFieldInfoSEI( leadingSeiMessages, pcSlice, isField ); xCreatePictureTimingSEI( m_pcCfg->getEfficientFieldIRAPEnabled() ? effFieldIRAPMap.GetIRAPGOPid() : 0, leadingSeiMessages, nestedSeiMessages, duInfoSeiMessages, pcSlice, isField, duData ); -#if JVET_P0190_SCALABLE_NESTING_SEI if (m_pcCfg->getScalableNestingSEIEnabled()) { xCreateScalableNestingSEI(leadingSeiMessages, nestedSeiMessages); } -#endif xWriteLeadingSEIMessages( leadingSeiMessages, duInfoSeiMessages, accessUnit, pcSlice->getTLayer(), pcSlice->getSPS(), duData ); xWriteDuSEIMessages( duInfoSeiMessages, accessUnit, pcSlice->getTLayer(), pcSlice->getSPS(), duData ); @@ -4274,11 +3955,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni if( ( *it )->m_nalUnitType != NAL_UNIT_PREFIX_SEI && ( *it )->m_nalUnitType != NAL_UNIT_SUFFIX_SEI ) { numRBSPBytes += numRBSPBytes_nal; -#if JVET_Q0117_PARAMETER_SETS_CLEANUP if (it == accessUnit.begin() || (*it)->m_nalUnitType == NAL_UNIT_VPS || (*it)->m_nalUnitType == NAL_UNIT_DCI || (*it)->m_nalUnitType == NAL_UNIT_SPS || (*it)->m_nalUnitType == NAL_UNIT_PPS) -#else - if (it == accessUnit.begin() || (*it)->m_nalUnitType == NAL_UNIT_VPS || (*it)->m_nalUnitType == NAL_UNIT_DPS || (*it)->m_nalUnitType == NAL_UNIT_SPS || (*it)->m_nalUnitType == NAL_UNIT_PPS) -#endif { numRBSPBytes += 4; } @@ -5155,12 +4832,10 @@ void EncGOP::applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ) pcLocalSlice->setDeblockingFilterDisable ( false); pcLocalSlice->setDeblockingFilterBetaOffsetDiv2 ( offset ); pcLocalSlice->setDeblockingFilterTcOffsetDiv2 ( offset ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcLocalSlice->setDeblockingFilterCbBetaOffsetDiv2 ( offset ); pcLocalSlice->setDeblockingFilterCbTcOffsetDiv2 ( offset ); pcLocalSlice->setDeblockingFilterCrBetaOffsetDiv2 ( offset ); pcLocalSlice->setDeblockingFilterCrTcOffsetDiv2 ( offset ); -#endif } } else @@ -5173,12 +4848,10 @@ void EncGOP::applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ) pcLocalSlice->setDeblockingFilterDisable ( pcPPS->getPPSDeblockingFilterDisabledFlag() ); pcLocalSlice->setDeblockingFilterBetaOffsetDiv2( pcPPS->getDeblockingFilterBetaOffsetDiv2() ); pcLocalSlice->setDeblockingFilterTcOffsetDiv2 ( pcPPS->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcLocalSlice->setDeblockingFilterCbBetaOffsetDiv2 ( pcPPS->getDeblockingFilterCbBetaOffsetDiv2() ); pcLocalSlice->setDeblockingFilterCbTcOffsetDiv2 ( pcPPS->getDeblockingFilterCbTcOffsetDiv2() ); pcLocalSlice->setDeblockingFilterCrBetaOffsetDiv2 ( pcPPS->getDeblockingFilterCrBetaOffsetDiv2() ); pcLocalSlice->setDeblockingFilterCrTcOffsetDiv2 ( pcPPS->getDeblockingFilterCrTcOffsetDiv2() ); -#endif } } } @@ -5240,12 +4913,10 @@ void EncGOP::applyDeblockingFilterParameterSelection( Picture* pcPic, const uint pcSlice->setDeblockingFilterDisable ( false); pcSlice->setDeblockingFilterBetaOffsetDiv2( betaOffsetDiv2 ); pcSlice->setDeblockingFilterTcOffsetDiv2 ( tcOffsetDiv2 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2( betaOffsetDiv2 ); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( tcOffsetDiv2 ); pcSlice->setDeblockingFilterCrBetaOffsetDiv2( betaOffsetDiv2 ); pcSlice->setDeblockingFilterCrTcOffsetDiv2 ( tcOffsetDiv2 ); -#endif } // restore reconstruction @@ -5304,12 +4975,10 @@ void EncGOP::applyDeblockingFilterParameterSelection( Picture* pcPic, const uint pcSlice->setDeblockingFilterDisable ( pcPPS->getPPSDeblockingFilterDisabledFlag() ); pcSlice->setDeblockingFilterBetaOffsetDiv2 ( pcPPS->getDeblockingFilterBetaOffsetDiv2() ); pcSlice->setDeblockingFilterTcOffsetDiv2 ( pcPPS->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2 ( pcPPS->getDeblockingFilterBetaOffsetDiv2() ); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( pcPPS->getDeblockingFilterTcOffsetDiv2() ); pcSlice->setDeblockingFilterCrBetaOffsetDiv2 ( pcPPS->getDeblockingFilterBetaOffsetDiv2() ); pcSlice->setDeblockingFilterCrTcOffsetDiv2 ( pcPPS->getDeblockingFilterTcOffsetDiv2() ); -#endif } } else @@ -5321,12 +4990,10 @@ void EncGOP::applyDeblockingFilterParameterSelection( Picture* pcPic, const uint pcSlice->setDeblockingFilterDisable ( false ); pcSlice->setDeblockingFilterBetaOffsetDiv2 ( betaOffsetDiv2Best); pcSlice->setDeblockingFilterTcOffsetDiv2 ( tcOffsetDiv2Best); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2 ( betaOffsetDiv2Best); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( tcOffsetDiv2Best); pcSlice->setDeblockingFilterCrBetaOffsetDiv2 ( betaOffsetDiv2Best); pcSlice->setDeblockingFilterCrTcOffsetDiv2 ( tcOffsetDiv2Best); -#endif } } } diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h index 7c3d28d5cdcb03ade8249aaa49ef74d9568992a4..5a4c51ef8a2f9eac32da5419349f076cc9636ae7 100644 --- a/source/Lib/EncoderLib/EncGOP.h +++ b/source/Lib/EncoderLib/EncGOP.h @@ -306,9 +306,7 @@ protected: void xUpdateDuData(AccessUnit &testAU, std::deque<DUData> &duData); void xUpdateTimingSEI(SEIPictureTiming *pictureTimingSEI, std::deque<DUData> &duData, const SPS *sps); void xUpdateDuInfoSEI(SEIMessages &duInfoSeiMessages, SEIPictureTiming *pictureTimingSEI, int maxSubLayers); -#if JVET_P0190_SCALABLE_NESTING_SEI void xCreateScalableNestingSEI(SEIMessages& seiMessages, SEIMessages& nestedSeiMessages); -#endif void xWriteSEI (NalUnitType naluType, SEIMessages& seiMessages, AccessUnit &accessUnit, AccessUnit::iterator &auPos, int temporalId, const SPS *sps); void xWriteSEISeparately (NalUnitType naluType, SEIMessages& seiMessages, AccessUnit &accessUnit, AccessUnit::iterator &auPos, int temporalId, const SPS *sps); void xClearSEIs(SEIMessages& seiMessages, bool deleteMessages); @@ -318,19 +316,11 @@ protected: void xWriteDuSEIMessages (SEIMessages& duInfoSeiMessages, AccessUnit &accessUnit, int temporalId, const SPS *sps, std::deque<DUData> &duData); int xWriteVPS (AccessUnit &accessUnit, const VPS *vps); -#if JVET_Q0117_PARAMETER_SETS_CLEANUP int xWriteDCI (AccessUnit &accessUnit, const DCI *dci); -#else - int xWriteDPS (AccessUnit &accessUnit, const DPS *dps); -#endif int xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId = 0 ); int xWritePPS( AccessUnit &accessUnit, const PPS *pps, const int layerId = 0 ); int xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId, const bool isPrefixNUT ); -#if ENABLING_MULTI_SPS int xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst, const int layerIdx); -#else - int xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst); -#endif int xWritePicHeader( AccessUnit &accessUnit, PicHeader *picHeader ); void applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ); diff --git a/source/Lib/EncoderLib/EncHRD.cpp b/source/Lib/EncoderLib/EncHRD.cpp index 088bea04d65939f268f5c1db3c8ab530a4e447e6..a9022be55b7268d0db5789a7f2d54b5e9ca9f732 100644 --- a/source/Lib/EncoderLib/EncHRD.cpp +++ b/source/Lib/EncoderLib/EncHRD.cpp @@ -55,7 +55,6 @@ int EncHRD::xCalcScale(int x) } #endif -#if JVET_P0118_HRD_ASPECTS void EncHRD::initHRDParameters(EncCfg* encCfg) { bool useSubCpbParams = encCfg->getNoPicPartitionFlag() == false; @@ -192,138 +191,4 @@ void EncHRD::initHRDParameters(EncCfg* encCfg) } } } -#else -void EncHRD::initHRDParameters (EncCfg* encCfg) -{ - bool useSubCpbParams = encCfg->getNoPicPartitionFlag() == false; - int bitRate = encCfg->getTargetBitrate(); -# if U0132_TARGET_BITS_SATURATION - int cpbSize = encCfg->getCpbSize(); - CHECK(!(cpbSize!=0), "Unspecified error"); // CPB size may not be equal to zero. ToDo: have a better default and check for level constraints - if( !encCfg->getHrdParametersPresentFlag() && !encCfg->getCpbSaturationEnabled() ) -#else - if( !encCfg->getHrdParametersPresentFlag() ) -#endif - { - return; - } - - m_timingInfo.setTimingInfoPresentFlag( true ); - switch( encCfg->getFrameRate() ) - { - case 24: - m_timingInfo.setNumUnitsInTick( 1125000 ); m_timingInfo.setTimeScale ( 27000000 ); - break; - case 25: - m_timingInfo.setNumUnitsInTick( 1080000 ); m_timingInfo.setTimeScale ( 27000000 ); - break; - case 30: - m_timingInfo.setNumUnitsInTick( 900900 ); m_timingInfo.setTimeScale ( 27000000 ); - break; - case 50: - m_timingInfo.setNumUnitsInTick( 540000 ); m_timingInfo.setTimeScale ( 27000000 ); - break; - case 60: - m_timingInfo.setNumUnitsInTick( 450450 ); m_timingInfo.setTimeScale ( 27000000 ); - break; - default: - m_timingInfo.setNumUnitsInTick( 1001 ); m_timingInfo.setTimeScale ( 60000 ); - break; - } - - if (encCfg->getTemporalSubsampleRatio()>1) - { - uint32_t temporalSubsampleRatio = encCfg->getTemporalSubsampleRatio(); - if ( double(m_timingInfo.getNumUnitsInTick()) * temporalSubsampleRatio > std::numeric_limits<uint32_t>::max() ) - { - m_timingInfo.setTimeScale( m_timingInfo.getTimeScale() / temporalSubsampleRatio ); - } - else - { - m_timingInfo.setNumUnitsInTick( m_timingInfo.getNumUnitsInTick() * temporalSubsampleRatio ); - } - } - bool rateCnt = ( bitRate > 0 ); - m_hrdParams.setNalHrdParametersPresentFlag( rateCnt ); - m_hrdParams.setVclHrdParametersPresentFlag( rateCnt ); - useSubCpbParams &= ( m_hrdParams.getNalHrdParametersPresentFlag() || m_hrdParams.getVclHrdParametersPresentFlag() ); - m_hrdParams.setGeneralDecodingUnitHrdParamsPresentFlag( useSubCpbParams ); - - if( m_hrdParams.getGeneralDecodingUnitHrdParamsPresentFlag() ) - { - m_hrdParams.setTickDivisorMinus2( 100 - 2 ); - } - -#if U0132_TARGET_BITS_SATURATION - if (xCalcScale(bitRate) <= 6) - { - m_hrdParams.setBitRateScale(0); - } - else - { - m_hrdParams.setBitRateScale(xCalcScale(bitRate) - 6); - } - - if (xCalcScale(cpbSize) <= 4) - { - m_hrdParams.setCpbSizeScale(0); - } - else - { - m_hrdParams.setCpbSizeScale(xCalcScale(cpbSize) - 4); - } -#else - m_hrdParams.setBitRateScale( 4 ); // in units of 2^( 6 + 4 ) = 1,024 bps - m_hrdParams.setCpbSizeScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit -#endif - - m_hrdParams.setCpbSizeDuScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit - - - // Note: parameters for all temporal layers are initialized with the same values - int i, j; - uint32_t bitrateValue, cpbSizeValue; - uint32_t duCpbSizeValue; - uint32_t duBitRateValue = 0; - - for( i = 0; i < MAX_TLAYER; i ++ ) - { - m_hrdParams.setFixedPicRateFlag( i, 1 ); - m_hrdParams.setPicDurationInTcMinus1( i, 0 ); - m_hrdParams.setLowDelayHrdFlag( i, 0 ); - m_hrdParams.setCpbCntMinus1( i, 0 ); - - //! \todo check for possible PTL violations - // BitRate[ i ] = ( bit_rate_value_minus1[ i ] + 1 ) * 2^( 6 + bit_rate_scale ) - bitrateValue = bitRate / (1 << (6 + m_hrdParams.getBitRateScale()) ); // bitRate is in bits, so it needs to be scaled down - // CpbSize[ i ] = ( cpb_size_value_minus1[ i ] + 1 ) * 2^( 4 + cpb_size_scale ) -#if U0132_TARGET_BITS_SATURATION - cpbSizeValue = cpbSize / (1 << (4 + m_hrdParams.getCpbSizeScale()) ); // using bitRate results in 1 second CPB size -#else - cpbSizeValue = bitRate / (1 << (4 + m_hrdParams.getCpbSizeScale()) ); // using bitRate results in 1 second CPB size -#endif - - - // DU CPB size could be smaller (i.e. bitrateValue / number of DUs), but we don't know - // in how many DUs the slice segment settings will result - duCpbSizeValue = bitrateValue; - duBitRateValue = cpbSizeValue; - - for( j = 0; j < ( m_hrdParams.getCpbCntMinus1( i ) + 1 ); j ++ ) - { - m_hrdParams.setBitRateValueMinus1( i, j, 0, ( bitrateValue - 1 ) ); - m_hrdParams.setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) ); - m_hrdParams.setDuCpbSizeValueMinus1( i, j, 0, ( duCpbSizeValue - 1 ) ); - m_hrdParams.setDuBitRateValueMinus1( i, j, 0, ( duBitRateValue - 1 ) ); - m_hrdParams.setCbrFlag( i, j, 0, false ); - - m_hrdParams.setBitRateValueMinus1( i, j, 1, ( bitrateValue - 1) ); - m_hrdParams.setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); - m_hrdParams.setDuCpbSizeValueMinus1( i, j, 1, ( duCpbSizeValue - 1 ) ); - m_hrdParams.setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); - m_hrdParams.setCbrFlag( i, j, 1, false ); - } - } -} -#endif diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 23298bc1cf7d4b4c41d1d70add4fdfa91bd4381d..9d190f1adba43fc14f63826c65576e02350904c8 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; @@ -131,11 +127,7 @@ void EncLib::create( const int layerId ) m_cInterSearch.cacheAssign( &m_cacheModel ); #endif -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX m_cLoopFilter.create(floorLog2(m_maxCUWidth) - MIN_CU_LOG2); -#else - m_cLoopFilter.create( m_maxTotalCUDepth ); -#endif if (!m_bLoopFilterDisable && m_encDbOpt) { @@ -221,32 +213,17 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) { m_AUWriterIf = auWriterIf; -#if ENABLING_MULTI_SPS SPS &sps0 = *(m_spsMap.allocatePS( m_vps->getGeneralLayerIdx( m_layerId ) )); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues. -#else - SPS &sps0 = *(m_spsMap.allocatePS(0)); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues. -#endif PPS &pps0 = *( m_ppsMap.allocatePS( m_vps->getGeneralLayerIdx( m_layerId ) ) ); APS &aps0 = *( m_apsMap.allocatePS( SCALING_LIST_APS ) ); aps0.setAPSId( 0 ); 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); -#else - int dpsId = getDecodingParameterSetEnabled() ? 1 : 0; - xInitDPS(m_dps, sps0, dpsId); - sps0.setDecodingParameterSetId(m_dps.getDecodingParameterSetId()); -#endif #if ENABLE_SPLIT_PARALLELISM if( omp_get_dynamic() ) { @@ -263,11 +240,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #if U0132_TARGET_BITS_SATURATION if (m_RCCpbSaturationEnabled) { -#if JVET_P0118_HRD_ASPECTS m_cRateCtrl.initHrdParam(sps0.getGeneralHrdParameters(), sps0.getOlsHrdParameters(), m_iFrameRate, m_RCInitialCpbFullness); -#else - m_cRateCtrl.initHrdParam(sps0.getHrdParameters(), m_iFrameRate, m_RCInitialCpbFullness); -#endif } #endif #if ENABLE_SPLIT_PARALLELISM @@ -291,24 +264,12 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) { PPS &pps = *( m_ppsMap.allocatePS( ENC_PPS_ID_RPR ) ); Window& inputScalingWindow = pps0.getScalingWindow(); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int scaledWidth = int( ( pps0.getPicWidthInLumaSamples() - SPS::getWinUnitX( sps0.getChromaFormatIdc() ) * ( inputScalingWindow.getWindowLeftOffset() + inputScalingWindow.getWindowRightOffset() ) ) / m_scalingRatioHor ); -#else - int scaledWidth = int( ( pps0.getPicWidthInLumaSamples() - inputScalingWindow.getWindowLeftOffset() - inputScalingWindow.getWindowRightOffset() ) / m_scalingRatioHor ); -#endif -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX int minSizeUnit = std::max(8, 1 << sps0.getLog2MinCodingBlockSize()); -#else - int minSizeUnit = std::max(8, (int)(sps0.getMaxCUHeight() >> (sps0.getMaxCodingDepth() - 1))); -#endif int temp = scaledWidth / minSizeUnit; int width = ( scaledWidth - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; -#if JVET_Q0487_SCALING_WINDOW_ISSUES int scaledHeight = int( ( pps0.getPicHeightInLumaSamples() - SPS::getWinUnitY( sps0.getChromaFormatIdc() ) * ( inputScalingWindow.getWindowTopOffset() + inputScalingWindow.getWindowBottomOffset() ) ) / m_scalingRatioVer ); -#else - int scaledHeight = int( ( pps0.getPicHeightInLumaSamples() - inputScalingWindow.getWindowTopOffset() - inputScalingWindow.getWindowBottomOffset() ) / m_scalingRatioVer ); -#endif temp = scaledHeight / minSizeUnit; int height = ( scaledHeight - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; @@ -320,14 +281,9 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) pps.setConformanceWindow( conformanceWindow ); Window scalingWindow; -#if JVET_Q0487_SCALING_WINDOW_ISSUES scalingWindow.setWindow( 0, ( width - scaledWidth ) / SPS::getWinUnitX( sps0.getChromaFormatIdc() ), 0, ( height - scaledHeight ) / SPS::getWinUnitY( sps0.getChromaFormatIdc() ) ); -#else - scalingWindow.setWindow( 0, width - scaledWidth, 0, height - scaledHeight ); -#endif pps.setScalingWindow( scalingWindow ); -#if JVET_Q0179_SCALING_WINDOW_SIZE_CONSTRAINT //register the width/height of the current pic into reference SPS if (!sps0.getPPSValidFlag(pps.getPPSId())) { @@ -350,7 +306,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) printf("Potential violation: (curScaledHeight * curSeqMaxPicHeightY) should be greater than or equal to refScaledHeight * (curPicHeightY - max(8, MinCbSizeY)\n"); } } -#endif // disable picture partitioning for scaled RPR pictures (slice/tile config only provided for the original resolution) m_noPicPartitionFlag = true; @@ -406,11 +361,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) &m_cTrQuant[jId], &m_cRdCost[jId], cabacEstimator, -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX getCtxCache( jId ), m_maxCUWidth, m_maxCUHeight, floorLog2(m_maxCUWidth) - m_log2MinCUSize -#else - getCtxCache( jId ), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth -#endif , &m_cReshaper[jId] , sps0.getBitDepth(CHANNEL_TYPE_LUMA) ); @@ -420,11 +371,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_bipredSearchRange, m_motionEstimationSearchMethod, getUseCompositeRef(), -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX m_maxCUWidth, m_maxCUHeight, floorLog2(m_maxCUWidth) - m_log2MinCUSize, &m_cRdCost[jId], cabacEstimator, getCtxCache( jId ) -#else - m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cRdCost[jId], cabacEstimator, getCtxCache( jId ) -#endif , &m_cReshaper[jId] ); @@ -451,11 +398,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) &m_cTrQuant, &m_cRdCost, cabacEstimator, -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX getCtxCache(), m_maxCUWidth, m_maxCUHeight, floorLog2(m_maxCUWidth) - m_log2MinCUSize -#else - getCtxCache(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth -#endif , &m_cReshaper , sps0.getBitDepth(CHANNEL_TYPE_LUMA) ); @@ -465,11 +408,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_bipredSearchRange, m_motionEstimationSearchMethod, getUseCompositeRef(), -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX m_maxCUWidth, m_maxCUHeight, floorLog2(m_maxCUWidth) - m_log2MinCUSize, &m_cRdCost, cabacEstimator, getCtxCache() -#else - m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cRdCost, cabacEstimator, getCtxCache() -#endif , &m_cReshaper ); @@ -499,11 +438,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); @@ -560,9 +495,7 @@ void EncLib::xInitScalingLists( SPS &sps, APS &aps ) { setUseScalingListId( SCALING_LIST_DEFAULT ); } -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 aps.getScalingList().setChromaScalingListPresentFlag((sps.getChromaFormatIdc()!=CHROMA_400)); -#endif quant->setScalingList( &( aps.getScalingList() ), maxLog2TrDynamicRange, sps.getBitDepths() ); quant->setUseScalingList(true); #if ENABLE_SPLIT_PARALLELISM @@ -583,14 +516,10 @@ void EncLib::xInitScalingLists( SPS &sps, APS &aps ) // Prepare delta's: for (uint32_t scalingListId = 0; scalingListId < 28; scalingListId++) { -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 if (aps.getScalingList().getChromaScalingListPresentFlag()||aps.getScalingList().isLumaScalingList(scalingListId)) { -#endif aps.getScalingList().checkPredMode(scalingListId); -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 } -#endif } } } @@ -640,11 +569,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() ) @@ -700,11 +625,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 ); } @@ -728,22 +649,12 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu const PPS *refPPS = m_ppsMap.getPS( 0 ); const Window& curScalingWindow = pPPS->getScalingWindow(); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int curPicWidth = pPPS->getPicWidthInLumaSamples() - SPS::getWinUnitX( pSPS->getChromaFormatIdc() ) * ( curScalingWindow.getWindowLeftOffset() + curScalingWindow.getWindowRightOffset() ); int curPicHeight = pPPS->getPicHeightInLumaSamples() - SPS::getWinUnitY( pSPS->getChromaFormatIdc() ) * ( curScalingWindow.getWindowTopOffset() + curScalingWindow.getWindowBottomOffset() ); -#else - int curPicWidth = pPPS->getPicWidthInLumaSamples() - curScalingWindow.getWindowLeftOffset() - curScalingWindow.getWindowRightOffset(); - int curPicHeight = pPPS->getPicHeightInLumaSamples() - curScalingWindow.getWindowTopOffset() - curScalingWindow.getWindowBottomOffset(); -#endif const Window& refScalingWindow = refPPS->getScalingWindow(); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int refPicWidth = refPPS->getPicWidthInLumaSamples() - SPS::getWinUnitX( pSPS->getChromaFormatIdc() ) * ( refScalingWindow.getWindowLeftOffset() + refScalingWindow.getWindowRightOffset() ); int refPicHeight = refPPS->getPicHeightInLumaSamples() - SPS::getWinUnitY( pSPS->getChromaFormatIdc() ) * ( refScalingWindow.getWindowTopOffset() + refScalingWindow.getWindowBottomOffset() ); -#else - int refPicWidth = refPPS->getPicWidthInLumaSamples() - refScalingWindow.getWindowLeftOffset() - refScalingWindow.getWindowRightOffset(); - int refPicHeight = refPPS->getPicHeightInLumaSamples() - refScalingWindow.getWindowTopOffset() - refScalingWindow.getWindowBottomOffset(); -#endif int xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; int yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; @@ -760,11 +671,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; @@ -899,11 +806,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; @@ -991,13 +894,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() ); @@ -1059,19 +958,13 @@ 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. // set the VPS profile information. -#if !JVET_Q0786_PTL_only - m_vps->setMaxSubLayers( sps.getMaxTLayers() ); -#endif -#if JVET_P0118_HRD_ASPECTS m_vps->m_olsHrdParams.clear(); m_vps->m_olsHrdParams.resize(m_vps->getNumOlsHrdParamsMinus1(), std::vector<OlsHrdParams>(m_vps->getMaxSubLayers())); -#endif ProfileLevelTierFeatures profileLevelTierFeatures; profileLevelTierFeatures.extractPTLInformation( sps ); @@ -1147,18 +1040,7 @@ 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. -#if !JVET_Q0786_PTL_only - vps.setMaxSubLayers(sps.getMaxTLayers()); -#endif -} -#endif -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void EncLib::xInitDCI(DCI& dci, const SPS& sps) { dci.setMaxSubLayersMinus1(sps.getMaxTLayers() - 1); @@ -1167,38 +1049,19 @@ void EncLib::xInitDCI(DCI& dci, const SPS& sps) ptls[0] = *sps.getProfileTierLevel(); dci.setProfileTierLevel(ptls); } -#else -void EncLib::xInitDPS(DPS &dps, const SPS &sps, const int dpsId) -{ - // The SPS must have already been set up. - // set the DPS profile information. - dps.setDecodingParameterSetId(dpsId); - dps.setMaxSubLayersMinus1(sps.getMaxTLayers()-1); - std::vector<ProfileTierLevel> ptls; - ptls.resize(1); - ptls[0] = *sps.getProfileTierLevel(); - dps.setProfileTierLevel(ptls); -} -#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(); cinfo->setProgressiveSourceFlag (m_progressiveSourceFlag); cinfo->setInterlacedSourceFlag (m_interlacedSourceFlag); cinfo->setNonPackedConstraintFlag (m_nonPackedConstraintFlag); -#if JVET_Q0114_CONSTRAINT_FLAGS cinfo->setNonProjectedConstraintFlag(m_nonProjectedConstraintFlag); cinfo->setNoResChangeInClvsConstraintFlag(m_noResChangeInClvsConstraintFlag); cinfo->setOneTilePerPicConstraintFlag(m_oneTilePerPicConstraintFlag); cinfo->setOneSlicePerPicConstraintFlag(m_oneSlicePerPicConstraintFlag); cinfo->setOneSubpicPerPicConstraintFlag(m_oneSubpicPerPicConstraintFlag); -#endif cinfo->setFrameOnlyConstraintFlag (m_frameOnlyConstraintFlag); cinfo->setIntraOnlyConstraintFlag (m_intraConstraintFlag); cinfo->setMaxBitDepthConstraintIdc (m_maxBitDepthConstraintIdc); @@ -1207,9 +1070,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) cinfo->setNoPartitionConstraintsOverrideConstraintFlag(m_noPartitionConstraintsOverrideConstraintFlag); cinfo->setNoSaoConstraintFlag(m_bNoSaoConstraintFlag); cinfo->setNoAlfConstraintFlag(m_bNoAlfConstraintFlag); -#if JVET_Q0795_CCALF cinfo->setNoCCAlfConstraintFlag(m_noCCAlfConstraintFlag); -#endif cinfo->setNoRefWraparoundConstraintFlag(m_bNoRefWraparoundConstraintFlag); cinfo->setNoTemporalMvpConstraintFlag(m_bNoTemporalMvpConstraintFlag); cinfo->setNoSbtmvpConstraintFlag(m_bNoSbtmvpConstraintFlag); @@ -1224,11 +1085,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) cinfo->setNoIbcConstraintFlag(m_noIbcConstraintFlag); cinfo->setNoCiipConstraintFlag(m_bNoCiipConstraintFlag); cinfo->setNoFPelMmvdConstraintFlag(m_noFPelMmvdConstraintFlag); -#if !JVET_Q0806 - cinfo->setNoTriangleConstraintFlag(m_bNoTriangleConstraintFlag); -#else cinfo->setNoGeoConstraintFlag(m_noGeoConstraintFlag); -#endif cinfo->setNoLadfConstraintFlag(m_bNoLadfConstraintFlag); cinfo->setNoTransformSkipConstraintFlag(m_noTransformSkipConstraintFlag); cinfo->setNoBDPCMConstraintFlag(m_noBDPCMConstraintFlag); @@ -1256,11 +1113,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) @@ -1279,67 +1132,31 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setMaxPicWidthInLumaSamples( maxPicWidth ); sps.setMaxPicHeightInLumaSamples( maxPicHeight ); } -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS sps.setConformanceWindow( m_conformanceWindow ); -#endif sps.setMaxCUWidth ( m_maxCUWidth ); sps.setMaxCUHeight ( m_maxCUHeight ); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX sps.setLog2MinCodingBlockSize ( m_log2MinCUSize ); -#else - sps.setMaxCodingDepth ( m_maxTotalCUDepth ); -#endif sps.setChromaFormatIdc ( m_chromaFormatIDC ); -#if !JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX - sps.setLog2DiffMaxMinCodingBlockSize(m_log2DiffMaxMinCodingBlockSize); -#endif sps.setCTUSize ( m_CTUSize ); sps.setSplitConsOverrideEnabledFlag ( m_useSplitConsOverride ); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX // convert the Intra Chroma minQT setting from chroma unit to luma unit m_uiMinQT[2] <<= getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC); -#endif sps.setMinQTSizes ( m_uiMinQT ); sps.setMaxMTTHierarchyDepth ( m_uiMaxMTTHierarchyDepth, m_uiMaxMTTHierarchyDepthI, m_uiMaxMTTHierarchyDepthIChroma ); -#if JVET_Q0330_BLOCK_PARTITION sps.setMaxBTSize( m_uiMaxBT[1], m_uiMaxBT[0], m_uiMaxBT[2] ); sps.setMaxTTSize( m_uiMaxTT[1], m_uiMaxTT[0], m_uiMaxTT[2] ); -#else - unsigned maxBtSize[3], maxTtSize[3]; - memcpy(maxBtSize, m_uiMinQT, sizeof(maxBtSize)); - memcpy(maxTtSize, m_uiMinQT, sizeof(maxTtSize)); - if (m_uiMaxMTTHierarchyDepth) - { - maxBtSize[1] = std::min(m_CTUSize, (unsigned)MAX_BT_SIZE_INTER); - maxTtSize[1] = std::min(m_CTUSize, (unsigned)MAX_TT_SIZE_INTER); - } - if (m_uiMaxMTTHierarchyDepthI) - { - maxBtSize[0] = std::min(m_CTUSize, (unsigned)MAX_BT_SIZE); - maxTtSize[0] = std::min(m_CTUSize, (unsigned)MAX_TT_SIZE); - } - if (m_uiMaxMTTHierarchyDepthIChroma) - { - maxBtSize[2] = std::min(m_CTUSize, (unsigned)MAX_BT_SIZE_C); - maxTtSize[2] = std::min(m_CTUSize, (unsigned)MAX_TT_SIZE_C); - } - sps.setMaxBTSize ( maxBtSize[1], maxBtSize[0], maxBtSize[2] ); - sps.setMaxTTSize ( maxTtSize[1], maxTtSize[0], maxTtSize[2] ); -#endif sps.setIDRRefParamListPresent ( m_idrRefParamList ); sps.setUseDualITree ( m_dualITree ); sps.setUseLFNST ( m_LFNST ); sps.setSBTMVPEnabledFlag ( m_SubPuMvpMode ); sps.setAMVREnabledFlag ( m_ImvMode != IMV_OFF ); sps.setBDOFEnabledFlag ( m_BIO ); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE sps.setMaxNumMergeCand(getMaxNumMergeCand()); sps.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand()); sps.setMaxNumIBCMergeCand(getMaxNumIBCMergeCand()); sps.setMaxNumGeoCand(getMaxNumGeoCand()); -#endif sps.setUseAffine ( m_Affine ); sps.setUseAffineType ( m_AffineType ); sps.setUsePROF ( m_PROF ); @@ -1367,11 +1184,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) #endif sps.setUseCiip ( m_ciip ); -#if !JVET_Q0806 - sps.setUseTriangle ( m_Triangle ); -#else sps.setUseGeo ( m_Geo ); -#endif sps.setUseMMVD ( m_MMVD ); sps.setFpelMmvdEnabledFlag (( m_MMVD ) ? m_allowDisFracMMVD : false); sps.setBdofControlPresentFlag(m_BIO); @@ -1389,33 +1202,14 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setUseLmcs ( m_lmcsEnabled ); sps.setUseMRL ( m_MRL ); sps.setUseMIP ( m_MIP ); -#if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX CHECK(m_log2MinCUSize > std::min(6, floorLog2(sps.getMaxCUWidth())), "log2_min_luma_coding_block_size_minus2 shall be in the range of 0 to min (4, log2_ctu_size - 2)"); -#else - int minCUSize = sps.getMaxCUWidth() >> sps.getLog2DiffMaxMinCodingBlockSize(); - int log2MinCUSize = 0; - while(minCUSize > 1) - { - minCUSize >>= 1; - log2MinCUSize++; - } - - sps.setLog2MinCodingBlockSize(log2MinCUSize); - CHECK(log2MinCUSize > std::min(6, floorLog2(sps.getMaxCUWidth())), "log2_min_luma_coding_block_size_minus2 shall be in the range of 0 to min (4, log2_ctu_size - 2)"); -#endif CHECK(m_uiMaxMTTHierarchyDepth > 2 * (floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize()), "sps_max_mtt_hierarchy_depth_inter_slice shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)"); CHECK(m_uiMaxMTTHierarchyDepthI > 2 * (floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize()), "sps_max_mtt_hierarchy_depth_intra_slice_luma shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)"); CHECK(m_uiMaxMTTHierarchyDepthIChroma > 2 * (floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize()), "sps_max_mtt_hierarchy_depth_intra_slice_chroma shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)"); sps.setTransformSkipEnabledFlag(m_useTransformSkip); -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL sps.setLog2MaxTransformSkipBlockSize(m_log2MaxTransformSkipBlockSize); -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM sps.setBDPCMEnabledFlag(m_useBDPCM); -#else - sps.setBDPCMEnabled(m_useBDPCM); -#endif sps.setSPSTemporalMVPEnabledFlag((getTMVPModeId() == 2 || getTMVPModeId() == 1)); @@ -1428,10 +1222,8 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setMinQpPrimeTsMinus4(ChannelType(channelType), max(0, 6 * (m_bitDepth[channelType] - m_inputBitDepth[channelType]))); } -#if JVET_Q0151_Q0205_ENTRYPOINTS sps.setEntropyCodingSyncEnabledFlag( m_entropyCodingSyncEnabledFlag ); sps.setEntropyCodingSyncEntryPointsPresentFlag( m_entropyCodingSyncEntryPointPresentFlag ); -#endif sps.setUseWP( m_useWeightedPred ); sps.setUseWPBiPred( m_useWeightedBiPred ); @@ -1449,12 +1241,8 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setScalingListFlag ( (m_useScalingListId == SCALING_LIST_OFF) ? 0 : 1 ); sps.setALFEnabledFlag( m_alf ); -#if JVET_Q0795_CCALF sps.setCCALFEnabledFlag( m_ccalf ); -#endif -#if JVET_Q0042_VUI sps.setFieldSeqFlag(false); -#endif sps.setVuiParametersPresentFlag(getVuiParametersPresentFlag()); if (sps.getVuiParametersPresentFlag()) @@ -1469,9 +1257,6 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) pcVUI->setColourPrimaries(getColourPrimaries()); pcVUI->setTransferCharacteristics(getTransferCharacteristics()); pcVUI->setMatrixCoefficients(getMatrixCoefficients()); -#if !JVET_Q0042_VUI - pcVUI->setFieldSeqFlag(false); -#endif pcVUI->setChromaLocInfoPresentFlag(getChromaLocInfoPresentFlag()); pcVUI->setChromaSampleLocTypeTopField(getChromaSampleLocTypeTopField()); pcVUI->setChromaSampleLocTypeBottomField(getChromaSampleLocTypeBottomField()); @@ -1503,11 +1288,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) } if( getBufferingPeriodSEIEnabled() || getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() ) { -#if JVET_P0118_HRD_ASPECTS sps.setGeneralHrdParametersPresentFlag(true); -#else - sps.setHrdParametersPresentFlag( true ); -#endif } // Set up SPS range extension settings @@ -1523,13 +1304,8 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag(m_persistentRiceAdaptationEnabledFlag); sps.getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag(m_cabacBypassAlignmentEnabledFlag); -#if JVET_Q0119_CLEANUPS sps.setSubPicInfoPresentFlag(m_subPicInfoPresentFlag); if (m_subPicInfoPresentFlag) -#else - sps.setSubPicPresentFlag(m_subPicPresentFlag); - if (m_subPicPresentFlag) -#endif { sps.setNumSubPics(m_numSubPics); sps.setSubPicCtuTopLeftX(m_subPicCtuTopLeftX); @@ -1539,7 +1315,6 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setSubPicTreatedAsPicFlag(m_subPicTreatedAsPicFlag); sps.setLoopFilterAcrossSubpicEnabledFlag(m_loopFilterAcrossSubpicEnabledFlag); sps.setSubPicIdLen(m_subPicIdLen); -#if JVET_Q0119_CLEANUPS sps.setSubPicIdMappingExplicitlySignalledFlag(m_subPicIdMappingExplicitlySignalledFlag); if (m_subPicIdMappingExplicitlySignalledFlag) { @@ -1549,19 +1324,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setSubPicId(m_subPicId); } } -#else - sps.setSubPicIdPresentFlag(m_subPicIdPresentFlag); - if (m_subPicIdPresentFlag) - { - sps.setSubPicIdSignallingPresentFlag(m_subPicIdSignallingPresentFlag); - if (m_subPicIdSignallingPresentFlag) - { - sps.setSubPicId(m_subPicId); - } - } -#endif } -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS else //In that case, there is only one subpicture that contains the whole picture { sps.setNumSubPics(1); @@ -1572,14 +1335,8 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) sps.setSubPicTreatedAsPicFlag(0, 1); sps.setLoopFilterAcrossSubpicEnabledFlag(0, 0); sps.setSubPicIdLen(0); -#if JVET_Q0119_CLEANUPS sps.setSubPicIdMappingExplicitlySignalledFlag(false); -#else - sps.setSubPicIdPresentFlag(false); -#endif } -#endif -#if DQ_SDH_SIGNALLING sps.setDepQuantEnabledFlag( m_DepQuantEnabledFlag ); if (!sps.getDepQuantEnabledFlag()) { @@ -1589,18 +1346,11 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) { sps.setSignDataHidingEnabledFlag(false); } -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG sps.setVirtualBoundariesEnabledFlag( m_virtualBoundariesEnabledFlag ); if( sps.getVirtualBoundariesEnabledFlag() ) { sps.setVirtualBoundariesPresentFlag( m_virtualBoundariesPresentFlag ); -#if JVET_Q0210_SUBPIC_VIRTUAL_BOUNDARY_CONSTRAINT CHECK( sps.getSubPicInfoPresentFlag() && sps.getVirtualBoundariesPresentFlag() != 1, "When subpicture signalling if present, the signalling of virtual boundaries, is present, shall be in the SPS" ); -#endif -#else - sps.setLoopFilterAcrossVirtualBoundariesDisabledFlag( m_loopFilterAcrossVirtualBoundariesDisabledFlag ); -#endif sps.setNumVerVirtualBoundaries ( m_numVerVirtualBoundaries ); sps.setNumHorVirtualBoundaries ( m_numHorVirtualBoundaries ); for( unsigned int i = 0; i < m_numVerVirtualBoundaries; i++ ) @@ -1611,104 +1361,36 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps ) { sps.setVirtualBoundariesPosY ( m_virtualBoundariesPosY[i], i ); } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif -#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." ); -#else - sps.setInterLayerPresentFlag( m_vps->getMaxLayers() > 1 && !m_vps->getAllIndependentLayersFlag() ); - - for( int i = 0; i < m_vps->getMaxLayers(); ++i ) - { -#if JVET_Q0786_PTL_only - //Bug fix to make the decoder run with configfile layers.cfg - if(m_vps->getIndependentLayerFlag(i) == 1) - sps.setInterLayerPresentFlag(0); -#endif - 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) - { -#if JVET_Q0786_PTL_only - //Bug fix to make the decoder run with configfile layers.cfg - if(vps.getIndependentLayerFlag(i) == 1) - sps.setInterLayerPresentFlag(0); -#endif - 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() ); -#if JVET_Q0297_MER sps.setLog2ParallelMergeLevelMinus2( m_log2ParallelMergeLevelMinus2 ); -#endif -#if JVET_Q0417_CONSTRAINT_SPS_VB_PRESENT_FLAG -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG CHECK( sps.getRprEnabledFlag() && sps.getVirtualBoundariesEnabledFlag(), "when the value of res_change_in_clvs_allowed_flag is equal to 1, the value of sps_virtual_boundaries_present_flag shall be equal to 0" ); -#else - CHECK(sps.getRprEnabledFlag() && sps.getLoopFilterAcrossVirtualBoundariesDisabledFlag(), "when the value of res_change_in_clvs_allowed_flag is equal to 1, the value of sps_virtual_boundaries_present_flag shall be equal to 0"); -#endif -#endif } void EncLib::xInitHrdParameters(SPS &sps) { m_encHRD.initHRDParameters((EncCfg*) this); -#if JVET_P0118_HRD_ASPECTS GeneralHrdParams *generalHrdParams = sps.getGeneralHrdParameters(); *generalHrdParams = m_encHRD.getGeneralHrdParameters(); OlsHrdParams *olsHrdParams = sps.getOlsHrdParameters(); *olsHrdParams = m_encHRD.getOlsHrdParameters(); -#else - HRDParameters *hrdParams = sps.getHrdParameters(); - *hrdParams = m_encHRD.getHRDParameters(); - - TimingInfo *timingInfo = sps.getTimingInfo(); - *timingInfo = m_encHRD.getTimingInfo(); -#endif } void EncLib::xInitPPS(PPS &pps, const SPS &sps) { // pps ID already initialised. pps.setSPSId(sps.getSPSId()); -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - pps.setConstantSliceHeaderParamsEnabledFlag(getConstantSliceHeaderParamsEnabledFlag()); - pps.setPPSDepQuantEnabledIdc(getPPSDepQuantEnabledIdc()); - pps.setPPSRefPicListSPSIdc0(getPPSRefPicListSPSIdc0()); - pps.setPPSRefPicListSPSIdc1(getPPSRefPicListSPSIdc1()); - pps.setPPSMvdL1ZeroIdc(getPPSMvdL1ZeroIdc()); - pps.setPPSCollocatedFromL0Idc(getPPSCollocatedFromL0Idc()); - pps.setPPSSixMinusMaxNumMergeCandPlus1(getPPSSixMinusMaxNumMergeCandPlus1()); -#if !JVET_Q0806 - pps.setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1()); -#else - pps.setPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1(getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1()); -#endif -#endif pps.setNumSubPics(sps.getNumSubPics()); -#if JVET_Q0119_CLEANUPS pps.setSubPicIdMappingInPpsFlag(false); -#else - pps.setSubPicIdSignallingPresentFlag(false); -#endif pps.setSubPicIdLen(sps.getSubPicIdLen()); for(int picIdx=0; picIdx<pps.getNumSubPics(); picIdx++) { @@ -1727,12 +1409,10 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) bUseDQP = true; } #endif -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG if (sps.getChromaFormatIdc() != CHROMA_400) { pps.setPPSChromaToolFlag (true); } -#endif #if ENABLE_QPA if (getUsePerceptQPA() && !bUseDQP) { @@ -1770,13 +1450,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) { pps.clearChromaQpOffsetList(); } -#if !REMOVE_PPS_REXT - pps.getPpsRangeExtension().setCrossComponentPredictionEnabledFlag(m_crossComponentPredictionEnabledFlag); -#if !JVET_Q0441_SAO_MOD_12_BIT - pps.getPpsRangeExtension().setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA ]); - pps.getPpsRangeExtension().setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA]); -#endif -#endif { int baseQp = 26; if( 16 == getGOPSize() ) @@ -1861,9 +1534,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setSliceChromaQpFlag(m_chromaCbQpOffsetDualTree != 0 || m_chromaCrQpOffsetDualTree != 0 || m_chromaCbCrQpOffsetDualTree != 0); } -#if !JVET_Q0151_Q0205_ENTRYPOINTS - pps.setEntropyCodingSyncEnabledFlag(m_entropyCodingSyncEnabledFlag); -#endif pps.setNoPicPartitionFlag( m_noPicPartitionFlag ); if( m_noPicPartitionFlag == false ) @@ -1887,9 +1557,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) { pps.initRasterSliceMap( m_rasterSliceSize ); } - #if JVET_O1143_SUBPIC_BOUNDARY pps.initSubPic(sps); - #endif pps.setLoopFilterAcrossTilesEnabledFlag( m_bLFCrossTileBoundaryFlag ); pps.setLoopFilterAcrossSlicesEnabledFlag( m_bLFCrossSliceBoundaryFlag ); } @@ -1907,9 +1575,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setTileIdxDeltaPresentFlag( 0 ); pps.setSliceTileIdx( 0, 0 ); pps.initRectSliceMap( &sps ); -#if JVET_O1143_SUBPIC_BOUNDARY pps.initSubPic(sps); -#endif pps.setLoopFilterAcrossTilesEnabledFlag( true ); pps.setLoopFilterAcrossSlicesEnabledFlag( true ); } @@ -1933,27 +1599,22 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) { pps.setDeblockingFilterBetaOffsetDiv2( getLoopFilterBetaOffset() ); pps.setDeblockingFilterTcOffsetDiv2( getLoopFilterTcOffset() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pps.setDeblockingFilterCbBetaOffsetDiv2( getLoopFilterCbBetaOffset() ); pps.setDeblockingFilterCbTcOffsetDiv2( getLoopFilterCbTcOffset() ); pps.setDeblockingFilterCrBetaOffsetDiv2( getLoopFilterCrBetaOffset() ); pps.setDeblockingFilterCrTcOffsetDiv2( getLoopFilterCrTcOffset() ); -#endif } else { pps.setDeblockingFilterBetaOffsetDiv2(0); pps.setDeblockingFilterTcOffsetDiv2(0); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pps.setDeblockingFilterCbBetaOffsetDiv2(0); pps.setDeblockingFilterCbTcOffsetDiv2(0); pps.setDeblockingFilterCrBetaOffsetDiv2(0); pps.setDeblockingFilterCrTcOffsetDiv2(0); -#endif } // deblockingFilterControlPresentFlag is true if any of the settings differ from the inferred values: -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS const bool deblockingFilterControlPresentFlag = pps.getDeblockingFilterOverrideEnabledFlag() || pps.getPPSDeblockingFilterDisabledFlag() || pps.getDeblockingFilterBetaOffsetDiv2() != 0 || @@ -1962,12 +1623,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.getDeblockingFilterCbTcOffsetDiv2() != 0 || pps.getDeblockingFilterCrBetaOffsetDiv2() != 0 || pps.getDeblockingFilterCrTcOffsetDiv2() != 0; -#else - const bool deblockingFilterControlPresentFlag = pps.getDeblockingFilterOverrideEnabledFlag() || - pps.getPPSDeblockingFilterDisabledFlag() || - pps.getDeblockingFilterBetaOffsetDiv2() != 0 || - pps.getDeblockingFilterTcOffsetDiv2() != 0; -#endif pps.setDeblockingFilterControlPresentFlag(deblockingFilterControlPresentFlag); @@ -1999,19 +1654,14 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) CHECK(!(bestPos <= 15), "Unspecified error"); pps.setNumRefIdxL0DefaultActive(bestPos); pps.setNumRefIdxL1DefaultActive(bestPos); -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - pps.setLog2MaxTransformSkipBlockSize(m_log2MaxTransformSkipBlockSize); -#endif pps.setPictureHeaderExtensionPresentFlag(false); -#if JVET_Q0819_PH_CHANGES pps.setRplInfoInPhFlag(getSliceLevelRpl() ? false : true); pps.setDbfInfoInPhFlag(getSliceLevelDblk() ? false : true); pps.setSaoInfoInPhFlag(getSliceLevelSao() ? false : true); pps.setAlfInfoInPhFlag(getSliceLevelAlf() ? false : true); pps.setWpInfoInPhFlag(getSliceLevelWp() ? false : true); pps.setQpDeltaInfoInPhFlag(getSliceLevelDeltaQp() ? false : true); -#endif pps.pcv = new PreCalcValues( sps, pps, true ); pps.setRpl1IdxPresentFlag(sps.getRPL1IdxPresentFlag()); @@ -2027,18 +1677,7 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps picHeader.setPPSId( pps.getPPSId() ); // merge list sizes -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE picHeader.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand()); -#else - picHeader.setMaxNumMergeCand ( getMaxNumMergeCand() ); - picHeader.setMaxNumAffineMergeCand( getMaxNumAffineMergeCand() ); -#if !JVET_Q0806 - picHeader.setMaxNumTriangleCand ( getMaxNumTriangleCand() ); -#else - picHeader.setMaxNumGeoCand ( getMaxNumGeoCand() ); -#endif - picHeader.setMaxNumIBCMergeCand ( getMaxNumIBCMergeCand() ); -#endif // copy partitioning constraints from SPS picHeader.setSplitConsOverrideFlag(false); picHeader.setMinQTSizes( sps.getMinQTSizes() ); @@ -2047,13 +1686,8 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps picHeader.setMaxTTSizes( sps.getMaxTTSizes() ); // quantization -#if DQ_SDH_SIGNALLING picHeader.setDepQuantEnabledFlag( sps.getDepQuantEnabledFlag() ); picHeader.setSignDataHidingEnabledFlag( sps.getSignDataHidingEnabledFlag() ); -#else - picHeader.setDepQuantEnabledFlag( getDepQuantEnabledFlag() ); - picHeader.setSignDataHidingEnabledFlag( getSignDataHidingEnabledFlag() ); -#endif bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false; @@ -2108,32 +1742,18 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps picHeader.setCuChromaQpOffsetSubdivInter(0); } -#if !JVET_Q0119_CLEANUPS - // sub-pictures - picHeader.setSubPicIdSignallingPresentFlag(sps.getSubPicIdSignallingPresentFlag()); - picHeader.setSubPicIdLen(sps.getSubPicIdLen()); - for(i=0; i<sps.getNumSubPics(); i++) { - picHeader.setSubPicId(i, sps.getSubPicId(i)); - } -#endif // virtual boundaries -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG if( sps.getVirtualBoundariesEnabledFlag() ) { picHeader.setVirtualBoundariesPresentFlag( sps.getVirtualBoundariesPresentFlag() ); -#else - picHeader.setLoopFilterAcrossVirtualBoundariesDisabledFlag(sps.getLoopFilterAcrossVirtualBoundariesDisabledFlag()); -#endif picHeader.setNumVerVirtualBoundaries(sps.getNumVerVirtualBoundaries()); picHeader.setNumHorVirtualBoundaries(sps.getNumHorVirtualBoundaries()); for(i=0; i<3; i++) { picHeader.setVirtualBoundariesPosX(sps.getVirtualBoundariesPosX(i), i); picHeader.setVirtualBoundariesPosY(sps.getVirtualBoundariesPosY(i), i); } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif // gradual decoder refresh flag picHeader.setGdrPicFlag(false); @@ -2485,15 +2105,7 @@ int EncCfg::getQPForPicture(const uint32_t gopIndex, const Slice *pSlice) const if (getCostMode()==COST_LOSSLESS_CODING) { -#if JVET_AHG14_LOSSLESS -#if JVET_AHG14_LOSSLESS_ENC_QP_FIX qp = getBaseQP(); -#else - qp = LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP - ( ( pSlice->getSPS()->getBitDepth( CHANNEL_TYPE_LUMA ) - 8 ) * 6 ); -#endif -#else - qp=LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP; -#endif } else { diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index 5a8ba8c87c69b6cddf24cb276fc09c1e8d184f2e..3a2e28cd411067aec421ece8953f45abee848d0f 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -155,32 +155,19 @@ private: #endif int m_picIdInGOP; -#if JVET_Q0814_DPB VPS* m_vps; -#endif public: SPS* getSPS( int spsId ) { return m_spsMap.getPS( spsId ); }; APS** getApss() { return m_apss; } Ctx m_entropyCodingSyncContextState; ///< leave in addition to vector for compatibility -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU PLTBuf m_palettePredictorSyncState; -#endif protected: void xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Picture*& rpcPic, int ppsId ); ///< get picture buffer which will be processed. If ppsId<0, then the ppsMap will be queried for the first match. -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void xInitDCI(DCI& dci, const SPS& sps); ///< initialize Decoding Capability Information (DCI) from encoder options -#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 +286,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/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 80e3cc692bf6a92cb77a2c7bc8baf3c9f1d04d99..332cd533248e492900f787c678ea862cc13c1e36 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1324,20 +1324,12 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add intra modes if( tryIntraRdo ) { -#if JVET_Q0504_PLT_NON444 if (cs.slice->getSPS()->getPLTMode() && (partitioner.treeType != TREE_D || cs.slice->isIRAP() || (cs.area.lwidth() == 4 && cs.area.lheight() == 4)) && getPltEnc()) -#else - if (cs.slice->getSPS()->getPLTMode() && ( cs.slice->isIRAP() || (cs.area.lwidth() == 4 && cs.area.lheight() == 4) ) && getPltEnc() ) -#endif { m_ComprCUCtxList.back().testModes.push_back({ ETM_PALETTE, ETO_STANDARD, qp }); } m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp } ); -#if JVET_Q0504_PLT_NON444 if (cs.slice->getSPS()->getPLTMode() && partitioner.treeType == TREE_D && !cs.slice->isIRAP() && !(cs.area.lwidth() == 4 && cs.area.lheight() == 4) && getPltEnc()) -#else - if (cs.slice->getSPS()->getPLTMode() && !cs.slice->isIRAP() && !(cs.area.lwidth() == 4 && cs.area.lheight() == 4) && getPltEnc() ) -#endif { m_ComprCUCtxList.back().testModes.push_back({ ETM_PALETTE, ETO_STANDARD, qp }); } @@ -1372,17 +1364,10 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add inter modes if( m_pcEncCfg->getUseEarlySkipDetection() ) { -#if !JVET_Q0806 - if( cs.sps->getUseTriangle() && cs.slice->isInterB() ) - { - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp } ); - } -#else if( cs.sps->getUseGeo() && cs.slice->isInterB() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_GEO, ETO_STANDARD, qp } ); } -#endif m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp } ); if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { @@ -1393,17 +1378,10 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru else { m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp } ); -#if !JVET_Q0806 - if( cs.sps->getUseTriangle() && cs.slice->isInterB() ) - { - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp } ); - } -#else if( cs.sps->getUseGeo() && cs.slice->isInterB() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_GEO, ETO_STANDARD, qp } ); } -#endif m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp } ); if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { @@ -1441,11 +1419,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ComprCUCtx& cuECtx = m_ComprCUCtxList.back(); // Fast checks, partitioning depended -#if !JVET_Q0806 - if (cuECtx.isHashPerfectMatch && encTestmode.type != ETM_MERGE_SKIP && encTestmode.type != ETM_INTER_ME && encTestmode.type != ETM_AFFINE && encTestmode.type != ETM_MERGE_TRIANGLE) -#else if (cuECtx.isHashPerfectMatch && encTestmode.type != ETM_MERGE_SKIP && encTestmode.type != ETM_INTER_ME && encTestmode.type != ETM_AFFINE && encTestmode.type != ETM_MERGE_GEO) -#endif { return false; } @@ -1578,11 +1552,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } } } -#if JVET_Q0504_PLT_NON444 if (bestMode.type == ETM_PALETTE && !slice.isIRAP() && partitioner.treeType == TREE_D && !(partitioner.currArea().lumaSize().width == 4 && partitioner.currArea().lumaSize().height == 4)) // inter slice -#else - if (bestMode.type == ETM_PALETTE && !slice.isIRAP() && !( partitioner.currArea().lumaSize().width == 4 && partitioner.currArea().lumaSize().height == 4) ) // inter slice -#endif { return false; } @@ -1598,24 +1568,16 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } else if (encTestmode.type == ETM_PALETTE) { -#if JVET_Q0629_REMOVAL_PLT_4X4 if (partitioner.currArea().lumaSize().width > 64 || partitioner.currArea().lumaSize().height > 64 || ((partitioner.currArea().lumaSize().width * partitioner.currArea().lumaSize().height <= 16) && (isLuma(partitioner.chType)) ) || ((partitioner.currArea().chromaSize().width * partitioner.currArea().chromaSize().height <= 16) && (!isLuma(partitioner.chType)) && partitioner.isSepTree(cs) ) ) -#else - if (partitioner.currArea().lumaSize().width > 64 || partitioner.currArea().lumaSize().height > 64) -#endif { return false; } const Area curr_cu = CS::getArea(cs, cs.area, partitioner.chType).blocks[getFirstComponentOfChannel(partitioner.chType)]; try { -#if JVET_Q0504_PLT_NON444 double stored_cost = slice.m_mapPltCost[isChroma(partitioner.chType)].at(curr_cu.pos()).at(curr_cu.size()); -#else - double stored_cost = slice.m_mapPltCost.at(curr_cu.pos()).at(curr_cu.size()); -#endif if (bestMode.type != ETM_INVALID && stored_cost > cuECtx.bestCS->cost) { return false; @@ -1680,12 +1642,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#if !JVET_Q0806 - if( encTestmode.type == ETM_MERGE_TRIANGLE && ( partitioner.currArea().lumaSize().area() < TRIANGLE_MIN_SIZE || relatedCU.isIntra ) ) - { - return false; - } -#else if( encTestmode.type == ETM_MERGE_GEO && ( partitioner.currArea().lwidth() < GEO_MIN_CU_SIZE || partitioner.currArea().lheight() < GEO_MIN_CU_SIZE || partitioner.currArea().lwidth() > GEO_MAX_CU_SIZE || partitioner.currArea().lheight() > GEO_MAX_CU_SIZE || partitioner.currArea().lwidth() >= 8 * partitioner.currArea().lheight() @@ -1693,7 +1649,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#endif return true; } else if( isModeSplit( encTestmode ) ) @@ -1880,7 +1835,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } if( split == CU_QUAD_SPLIT ) cuECtx.set( DID_QUAD_SPLIT, true ); -#if JVET_Q0297_MER if (cs.sps->getLog2ParallelMergeLevelMinus2()) { const CompArea& area = partitioner.currArea().Y(); @@ -1893,7 +1847,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt if (area.width <= 2 * size && split == CU_TRIV_SPLIT) return false; } } -#endif return true; } else diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index f2b75071dabfb5cdf9ebb21cc73bd6ba0ae26506..0eb7a332980179db841f56498c0982c03568c451 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -59,11 +59,7 @@ enum EncTestModeType ETM_MERGE_SKIP, ETM_INTER_ME, ETM_AFFINE, -#if !JVET_Q0806 - ETM_MERGE_TRIANGLE, -#else ETM_MERGE_GEO, -#endif ETM_INTRA, ETM_PALETTE, ETM_SPLIT_QT, @@ -142,11 +138,7 @@ inline bool isModeInter( const EncTestMode& encTestmode ) // perhaps remove return ( encTestmode.type == ETM_INTER_ME || encTestmode.type == ETM_MERGE_SKIP || encTestmode.type == ETM_AFFINE -#if !JVET_Q0806 - || encTestmode.type == ETM_MERGE_TRIANGLE -#else || encTestmode.type == ETM_MERGE_GEO -#endif || encTestmode.type == ETM_HASH_INTER ); } diff --git a/source/Lib/EncoderLib/EncReshape.cpp b/source/Lib/EncoderLib/EncReshape.cpp index 2660ff0c45c24f95fe217ed793aa7266279a9bf3..471c92393d1d1b7bce57b1e44047faa6fd9c1116 100644 --- a/source/Lib/EncoderLib/EncReshape.cpp +++ b/source/Lib/EncoderLib/EncReshape.cpp @@ -366,18 +366,8 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats) } picY = pcPic->getOrigBuf(COMPONENT_Y); -#if JVET_Q0438_MONOCHROME_BUGFIXES double avgY = 0.0; double varY = 0.0; -#else - PelBuf picU = pcPic->getOrigBuf(COMPONENT_Cb); - PelBuf picV = pcPic->getOrigBuf(COMPONENT_Cr); - const int widthC = picU.width; - const int heightC = picU.height; - const int strideC = picU.stride; - double avgY = 0.0, avgU = 0.0, avgV = 0.0; - double varY = 0.0, varU = 0.0, varV = 0.0; -#endif for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) @@ -387,7 +377,6 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats) } picY.buf += stride; } -#if JVET_Q0438_MONOCHROME_BUGFIXES avgY = avgY / (width * height); varY = varY / (width * height) - avgY * avgY; @@ -400,7 +389,6 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats) const int strideC = picU.stride; double avgU = 0.0, avgV = 0.0; double varU = 0.0, varV = 0.0; -#endif for (int y = 0; y < heightC; y++) { for (int x = 0; x < widthC; x++) @@ -413,14 +401,8 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats) picU.buf += strideC; picV.buf += strideC; } -#if !JVET_Q0438_MONOCHROME_BUGFIXES - avgY = avgY / (width * height); -#endif avgU = avgU / (widthC * heightC); avgV = avgV / (widthC * heightC); -#if !JVET_Q0438_MONOCHROME_BUGFIXES - varY = varY / (width * height) - avgY * avgY; -#endif varU = varU / (widthC * heightC) - avgU * avgU; varV = varV / (widthC * heightC) - avgV * avgV; if (varY > 0) @@ -428,9 +410,7 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats) stats.ratioStdU = sqrt(varU) / sqrt(varY); stats.ratioStdV = sqrt(varV) / sqrt(varY); } -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif } void EncReshape::preAnalyzerLMCS(Picture *pcPic, const uint32_t signalType, const SliceType sliceType, const ReshapeCW& reshapeCW) { diff --git a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp index 97b9241aa1726e0a984f8c93c88cc68ed1e85607..f4be381209941fa3e73b4d616a72cc308b83ec16 100644 --- a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp +++ b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp @@ -1570,7 +1570,6 @@ void EncSampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructu isAboveLeftAvail = (!isAboveLeftAvail) ? false : CU::isSameTile(*cuCurr, *cuAboveLeft); } -#if JVET_O1143_LPF_ACROSS_SUBPIC_BOUNDARY const SubPic& curSubPic = cs.pps->getSubPicFromCU(*cuCurr); if (!curSubPic.getloopFilterAcrossEnabledFlag()) { @@ -1578,7 +1577,6 @@ void EncSampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructu isAboveAvail = (!isAboveAvail) ? false : CU::isSameSubPic(*cuCurr, *cuAbove); isAboveLeftAvail = (!isAboveLeftAvail) ? false : CU::isSameSubPic(*cuCurr, *cuAboveLeft); } -#endif } //! \} diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index b5824a67535255612d6c8a9d65140b2543019972..70cd379898380748f19c7a48d8897f33b19b61fe 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -117,11 +117,7 @@ EncSlice::setUpLambda( Slice* slice, const double dLambda, int iQP) int chromaQPOffset = slice->getPPS()->getQpOffset( compID ) + slice->getSliceChromaQpDelta( compID ); int qpc = slice->getSPS()->getMappedChromaQpValue(compID, iQP) + chromaQPOffset; double tmpWeight = pow( 2.0, ( iQP - qpc ) / 3.0 ); // takes into account of the chroma qp mapping and chroma qp Offset -#if JVET_Q0433_MODIFIED_CHROMA_DIST_WEIGHT if( m_pcCfg->getDepQuantEnabledFlag() ) -#else - if( m_pcCfg->getDepQuantEnabledFlag() && !( m_pcCfg->getLFNST() ) ) -#endif { tmpWeight *= ( m_pcCfg->getGOPSize() >= 8 ? pow( 2.0, 0.1/3.0 ) : pow( 2.0, 0.2/3.0 ) ); // increase chroma weight for dependent quantization (in order to reduce bit rate shift from chroma to luma) } @@ -343,7 +339,6 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr picHeader->setPicOutputFlag(true); } rpcSlice->setPOC( pocCurr ); -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM if( m_pcCfg->getCostMode() == COST_LOSSLESS_CODING ) { rpcSlice->setTSResidualCodingDisabledFlag(true); @@ -352,7 +347,6 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr { rpcSlice->setTSResidualCodingDisabledFlag(false); } -#endif #if SHARP_LUMA_DELTA_QP pcPic->fieldPic = isField; @@ -619,12 +613,10 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr rpcSlice->setDeblockingFilterDisable(false); rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS rpcSlice->setDeblockingFilterCbBetaOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterCbTcOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterCrBetaOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterCrTcOffsetDiv2( 0 ); -#endif } else if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) { @@ -636,23 +628,19 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr { rpcSlice->setDeblockingFilterBetaOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_betaOffsetDiv2 + m_pcCfg->getLoopFilterBetaOffset() ); rpcSlice->setDeblockingFilterTcOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_tcOffsetDiv2 + m_pcCfg->getLoopFilterTcOffset() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS rpcSlice->setDeblockingFilterCbBetaOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_CbBetaOffsetDiv2 + m_pcCfg->getLoopFilterCbBetaOffset() ); rpcSlice->setDeblockingFilterCbTcOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_CbTcOffsetDiv2 + m_pcCfg->getLoopFilterCbTcOffset() ); rpcSlice->setDeblockingFilterCrBetaOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_CrBetaOffsetDiv2 + m_pcCfg->getLoopFilterCrBetaOffset() ); rpcSlice->setDeblockingFilterCrTcOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_CrTcOffsetDiv2 + m_pcCfg->getLoopFilterCrTcOffset() ); -#endif } else { rpcSlice->setDeblockingFilterBetaOffsetDiv2( m_pcCfg->getLoopFilterBetaOffset() ); rpcSlice->setDeblockingFilterTcOffsetDiv2( m_pcCfg->getLoopFilterTcOffset() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS rpcSlice->setDeblockingFilterCbBetaOffsetDiv2( m_pcCfg->getLoopFilterCbBetaOffset() ); rpcSlice->setDeblockingFilterCbTcOffsetDiv2( m_pcCfg->getLoopFilterCbTcOffset() ); rpcSlice->setDeblockingFilterCrBetaOffsetDiv2( m_pcCfg->getLoopFilterCrBetaOffset() ); rpcSlice->setDeblockingFilterCrTcOffsetDiv2( m_pcCfg->getLoopFilterCrTcOffset() ); -#endif } } } @@ -662,12 +650,10 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr rpcSlice->setDeblockingFilterDisable( false ); rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS rpcSlice->setDeblockingFilterCbBetaOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterCbTcOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterCrBetaOffsetDiv2( 0 ); rpcSlice->setDeblockingFilterCrTcOffsetDiv2( 0 ); -#endif } pcPic->layer = temporalId; @@ -1475,7 +1461,6 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons cs.motionLut.lutIbc.resize(0); } -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY const SubPic &curSubPic = pcSlice->getPPS()->getSubPicFromPos(pos); // padding/restore at slice level if (pcSlice->getPPS()->getNumSubPics() >= 2 && curSubPic.getTreatedAsPicFlag() && ctuIdx == 0) @@ -1500,7 +1485,6 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons } } } -#endif if (cs.pps->ctuIsTileColBd( ctuXPosInCtus ) && cs.pps->ctuIsTileRowBd( ctuYPosInCtus )) { pCABACWriter->initCtxModels( *pcSlice ); @@ -1516,9 +1500,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons { // Top is available, we use it. pCABACWriter->getCtx() = pEncLib->m_entropyCodingSyncContextState; -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU cs.setPrevPLT(pEncLib->m_palettePredictorSyncState); -#endif } prevQP[0] = prevQP[1] = pcSlice->getSliceQp(); } @@ -1641,9 +1623,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons if( cs.pps->ctuIsTileColBd( ctuXPosInCtus ) && pEncLib->getEntropyCodingSyncEnabledFlag() ) { pEncLib->m_entropyCodingSyncContextState = pCABACWriter->getCtx(); -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU cs.storePrevPLT(pEncLib->m_palettePredictorSyncState); -#endif } int actualBits = int(cs.fracBits >> SCALE_BITS); @@ -1697,7 +1677,6 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons m_uiPicTotalBits += actualBits; m_uiPicDist = cs.dist; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY // for last Ctu in the slice if (pcSlice->getPPS()->getNumSubPics() >= 2 && curSubPic.getTreatedAsPicFlag() && ctuIdx == (pcSlice->getNumCtuInSlice() - 1)) { @@ -1721,7 +1700,6 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons } } } -#endif } // this is wpp exclusive section @@ -1735,14 +1713,10 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui { Slice *const pcSlice = pcPic->slices[getSliceSegmentIdx()]; -#if JVET_Q0151_Q0205_ENTRYPOINTS const bool wavefrontsEnabled = pcSlice->getSPS()->getEntropyCodingSyncEnabledFlag(); const bool wavefrontsEntryPointsFlag = (wavefrontsEnabled) ? pcSlice->getSPS()->getEntropyCodingSyncEntryPointsPresentFlag() : false; uint32_t substreamSize = 0; pcSlice->resetNumberOfSubstream(); -#else - const bool wavefrontsEnabled = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag(); -#endif // setup coding structure @@ -1793,9 +1767,7 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui { // Top is available, so use it. m_CABACWriter->getCtx() = m_entropyCodingSyncContextState; -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU cs.setPrevPLT(m_palettePredictorSyncState); -#endif } } @@ -1811,9 +1783,7 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui if( cs.pps->ctuIsTileColBd( ctuXPosInCtus ) && wavefrontsEnabled ) { m_entropyCodingSyncContextState = m_CABACWriter->getCtx(); -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU cs.storePrevPLT(m_palettePredictorSyncState); -#endif } // terminate the sub-stream, if required (end of slice-segment, end of tile, end of wavefront-CTU-row): @@ -1830,7 +1800,6 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui if (!isLastCTUsinSlice) //Byte alignment only when it is not the last substream in the slice { // write sub-stream size -#if JVET_Q0151_Q0205_ENTRYPOINTS substreamSize += (pcSubstreams[uiSubStrm].getNumberOfWrittenBits() >> 3) + pcSubstreams[uiSubStrm].countStartCodeEmulations(); pcSlice->increaseNumberOfSubstream(); if( isLastCTUinTile || (isLastCTUinWPP && wavefrontsEntryPointsFlag) ) @@ -1838,9 +1807,6 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui pcSlice->addSubstreamSize(substreamSize); substreamSize = 0; } -#else - pcSlice->addSubstreamSize((pcSubstreams[uiSubStrm].getNumberOfWrittenBits() >> 3) + pcSubstreams[uiSubStrm].countStartCodeEmulations()); -#endif } uiSubStrm++; } diff --git a/source/Lib/EncoderLib/EncSlice.h b/source/Lib/EncoderLib/EncSlice.h index 6c633aa055bdf8f82315e8157820725cf9b059c0..53fadab31876c5ef4cb5a2bc7c38b11907fc423f 100644 --- a/source/Lib/EncoderLib/EncSlice.h +++ b/source/Lib/EncoderLib/EncSlice.h @@ -92,9 +92,7 @@ private: uint32_t m_uiSliceSegmentIdx; Ctx m_entropyCodingSyncContextState; ///< context storage for state of contexts at the wavefront/WPP/entropy-coding-sync second CTU of tile-row SliceType m_encCABACTableIdx; -#if JVET_Q0501_PALETTE_WPP_INIT_ABOVECTU PLTBuf m_palettePredictorSyncState; -#endif #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU int m_gopID; #endif diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index aa95e566d5e18088ec4943bd3742dc1c80c8ec9c..534a75f2daacea5797bbdda4cb27c52b193420f3 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -809,15 +809,10 @@ int InterSearch::xIBCSearchMVChromaRefine(PredictionUnit& pu, ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES if ( (!isChromaEnabled(pu.chromaFormat)) || (!pu.Cb().valid()) ) { return 0; } -#else - if (!pu.Cb().valid()) - return 0; -#endif int bestCandIdx = 0; Distortion sadBest = std::numeric_limits<Distortion>::max(); @@ -1269,11 +1264,7 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, CPelBuf* pcPatternKey = &tmpPattern; PelBuf tmpOrgLuma; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if ((pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#else - if ((pu.cs->picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#endif { const CompArea &area = pu.blocks[COMPONENT_Y]; CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); @@ -1464,11 +1455,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const int bvpIdxBest = 0; cMv.setZero(); Distortion cost = 0; -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pu.cs->sps->getMaxNumIBCMergeCand() == 1) -#else - if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 ) -#endif { iBvpNum = 1; cMvPred[1] = cMvPred[0]; @@ -6171,12 +6158,6 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti const int cbfMask = ( TU::getCbf( currTU, COMPONENT_Cb ) ? 2 : 0) + ( TU::getCbf( currTU, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->joint_cb_cr( currTU, cbfMask ); } -#if !REMOVE_PPS_REXT - if( TU::hasCrossCompPredInfo( currTU, compID ) ) - { - m_CABACEstimator->cross_comp_pred( currTU, compID ); - } -#endif if( TU::getCbf( currTU, compID ) ) { m_CABACEstimator->residual_coding( currTU, compID ); @@ -6491,9 +6472,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par Distortion uiSingleDist = 0; Distortion uiSingleDistComp [3] = { 0, 0, 0 }; uint64_t uiSingleFracBits[3] = { 0, 0, 0 }; -#if !REMOVE_PPS_REXT - TCoeff uiAbsSum [3] = { 0, 0, 0 }; -#endif const TempCtx ctxStart ( m_CtxCache, m_CABACEstimator->getCtx() ); TempCtx ctxBest ( m_CtxCache ); @@ -6509,11 +6487,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const UnitArea relativeUnitArea(tu.chromaFormat, Area(tuPos, tu.Y().size())); const Slice &slice = *cs.slice; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && !(CS::isDualITree(cs) && slice.isIntra() && tu.cu->predMode == MODE_IBC)) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && !(CS::isDualITree(cs) && slice.isIntra() && tu.cu->predMode==MODE_IBC )) -#endif { const CompArea &areaY = tu.blocks[COMPONENT_Y]; int adj = m_pcReshape->calculateChromaAdjVpduNei(tu, areaY); @@ -6553,38 +6527,21 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par continue; } -#if !REMOVE_PPS_REXT - const bool isCrossCPredictionAvailable = TU::hasCrossCompPredInfo( tu, compID ); -#endif -#if !REMOVE_PPS_REXT - int8_t preCalcAlpha = 0; - const CPelBuf lumaResi = csFull->getResiBuf(tu.Y()); - - if (isCrossCPredictionAvailable) - { - csFull->getResiBuf( compArea ).copyFrom( cs.getOrgResiBuf( compArea ) ); - preCalcAlpha = xCalcCrossComponentPredictionAlpha( tu, compID, m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate() ); - } -#endif const bool tsAllowed = TU::isTSAllowed(tu, compID) && (isLuma(compID) || (isChroma(compID) && m_pcEncCfg->getUseChromaTS())); const bool mtsAllowed = CU::isMTSAllowed( *tu.cu, compID ); uint8_t nNumTransformCands = 1 + ( tsAllowed ? 1 : 0 ) + ( mtsAllowed ? 4 : 0 ); // DCT + TS + 4 MTS = 6 tests std::vector<TrMode> trModes; -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING) { nNumTransformCands = 0; } else { -#endif trModes.push_back( TrMode( 0, true ) ); //DCT2 nNumTransformCands = 1; -#if JVET_Q0820_ACT } -#endif //for a SBT-no-residual TU, the RDO process should be called once, in order to get the RD cost if( tsAllowed && !tu.noResidual ) { @@ -6614,41 +6571,16 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } } -#if JVET_Q0820_ACT if (colorTransFlag && (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING)) -#else - if (colorTransFlag) -#endif { m_pcTrQuant->lambdaAdjustColorTrans(true); m_pcRdCost->lambdaAdjustColorTrans(true, compID); } -#if !REMOVE_PPS_REXT - const int crossCPredictionModesToTest = preCalcAlpha != 0 ? 2 : 1; -#endif const int numTransformCandidates = nNumTransformCands; -#if !JVET_Q0695_CHROMA_TS_JCCR - const bool isOneMode = crossCPredictionModesToTest == 1 && numTransformCandidates == 1; - - bool isLastBest = isOneMode; -#endif for( int transformMode = 0; transformMode < numTransformCandidates; transformMode++ ) { -#if !REMOVE_PPS_REXT - for( int crossCPredictionModeId = 0; crossCPredictionModeId < crossCPredictionModesToTest; crossCPredictionModeId++ ) - { - const bool isFirstMode = transformMode == 0 && crossCPredictionModeId == 0; -#if !JVET_Q0695_CHROMA_TS_JCCR - const bool isLastMode = ( transformMode + 1 ) == numTransformCandidates && ( crossCPredictionModeId + 1 ) == crossCPredictionModesToTest; -#endif - const bool bUseCrossCPrediction = crossCPredictionModeId != 0; -#else const bool isFirstMode = transformMode == 0; -#if !JVET_Q0695_CHROMA_TS_JCCR - const bool isLastMode = ( transformMode + 1 ) == numTransformCandidates; -#endif -#endif // copy the original residual into the residual buffer csFull->getResiBuf(compArea).copyFrom(cs.getOrgResiBuf(compArea)); @@ -6656,10 +6588,8 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->resetBits(); { -#if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING ) ) { -#endif if (bestTU.mtsIdx[compID] == MTS_SKIP && m_pcEncCfg->getUseTransformSkipFast()) { continue; @@ -6668,35 +6598,15 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { continue; } -#if JVET_AHG14_LOSSLESS } -#endif tu.mtsIdx[compID] = trModes[transformMode].first; } -#if !REMOVE_PPS_REXT - tu.compAlpha[compID] = bUseCrossCPrediction ? preCalcAlpha : 0; -#endif QpParam cQP(tu, compID); // note: uses tu.transformSkip[compID] -#if !JVET_Q0820_ACT - if (colorTransFlag) - { - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - cQP.Qps[qpIdx] = cQP.Qps[qpIdx] + (compID == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); - cQP.pers[qpIdx] = cQP.Qps[qpIdx] / 6; - cQP.rems[qpIdx] = cQP.Qps[qpIdx] % 6; - } - } -#endif #if RDOQ_CHROMA_LAMBDA m_pcTrQuant->selectLambda(compID); #endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag()) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag()) -#endif { double cRescale = (double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj()); m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale)); @@ -6714,18 +6624,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par Distortion nonCoeffDist = 0; double nonCoeffCost = 0; -#if !REMOVE_PPS_REXT - if (bUseCrossCPrediction) - { - PelBuf resiBuf = csFull->getResiBuf( compArea ); - crossComponentPrediction( tu, compID, lumaResi, resiBuf, resiBuf, false ); - } -#endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && tu.blocks[compID].width * tu.blocks[compID].height > 4) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && tu.blocks[compID].width*tu.blocks[compID].height > 4) -#endif { PelBuf resiBuf = csFull->getResiBuf(compArea); resiBuf.scaleSignal(tu.getChromaAdj(), 1, tu.cu->cs->slice->clpRng(compID)); @@ -6737,14 +6636,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_pcTrQuant->transformNxN( tu, compID, cQP, &trModes, m_pcEncCfg->getMTSInterMaxCand() ); tu.mtsIdx[compID] = trModes[0].first; } -#if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0 ) ) { m_pcTrQuant->transformNxN( tu, compID, cQP, currAbsSum, m_CABACEstimator->getCtx(), true ); } -#else - m_pcTrQuant->transformNxN( tu, compID, cQP, currAbsSum, m_CABACEstimator->getCtx(), true ); -#endif } else { @@ -6756,15 +6651,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const CPelBuf zeroBuf(m_pTempPel, compArea); const CPelBuf orgResi = csFull->getOrgResiBuf( compArea ); -#if !REMOVE_PPS_REXT - if (bUseCrossCPrediction) - { - PelBuf resi = csFull->getResiBuf( compArea ); - crossComponentPrediction( tu, compID, lumaResi, zeroBuf, resi, true ); - nonCoeffDist = m_pcRdCost->getDistPart( orgResi, resi, channelBitDepth, compID, DF_SSE ); - } - else -#endif { nonCoeffDist = m_pcRdCost->getDistPart( zeroBuf, orgResi, channelBitDepth, compID, DF_SSE ); // initialized with zero residual distortion } @@ -6774,12 +6660,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const bool prevCbf = ( compID == COMPONENT_Cr ? tu.cbf[COMPONENT_Cb] : false ); m_CABACEstimator->cbf_comp( *csFull, false, compArea, currDepth, prevCbf ); -#if !REMOVE_PPS_REXT - if( isCrossCPredictionAvailable ) - { - m_CABACEstimator->cross_comp_pred( tu, compID ); - } -#endif } nonCoeffFracBits = m_CABACEstimator->getEstFracBits(); @@ -6805,12 +6685,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par *puiZeroDist += nonCoeffDist; // initialized with zero residual distortion } -#if JVET_AHG14_LOSSLESS if( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0 ) { currAbsSum = 0; } -#endif if (currAbsSum > 0) //if non-zero coefficients are present, a residual needs to be derived for further prediction { @@ -6828,13 +6706,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->joint_cb_cr( tu, cbfMask ); } -#if !REMOVE_PPS_REXT - if( isCrossCPredictionAvailable ) - { - m_CABACEstimator->cross_comp_pred( tu, compID ); - } -#endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND CUCtx cuCtx; cuCtx.isDQPCoded = true; cuCtx.isChromaQpAdjCoded = true; @@ -6847,9 +6718,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } else { -#else - m_CABACEstimator->residual_coding(tu, compID); -#endif currCompFracBits = m_CABACEstimator->getEstFracBits(); @@ -6857,21 +6725,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par CPelBuf orgResiBuf = csFull->getOrgResiBuf(compArea); m_pcTrQuant->invTransformNxN(tu, compID, resiBuf, cQP); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && tu.blocks[compID].width * tu.blocks[compID].height > 4) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && tu.blocks[compID].width*tu.blocks[compID].height > 4) -#endif { resiBuf.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); } -#if !REMOVE_PPS_REXT - if (bUseCrossCPrediction) - { - crossComponentPrediction(tu, compID, lumaResi, resiBuf, resiBuf, true); - } -#endif currCompDist = m_pcRdCost->getDistPart(orgResiBuf, resiBuf, channelBitDepth, compID, DF_SSE); #if WCG_EXT @@ -6879,15 +6737,9 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #else currCompCost = m_pcRdCost->calcRdCost(currCompFracBits, currCompDist); #endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND } -#endif } -#if !REMOVE_PPS_REXT - else if( transformMode > 0 && !bUseCrossCPrediction ) -#else else if( transformMode > 0 ) -#endif { currCompCost = MAX_DOUBLE; } @@ -6916,62 +6768,24 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par currCompCost = nonCoeffCost; } -#if !REMOVE_PPS_REXT - uiAbsSum[compID] = currAbsSum; -#endif uiSingleDistComp[compID] = currCompDist; uiSingleFracBits[compID] = currCompFracBits; minCost[compID] = currCompCost; -#if !REMOVE_PPS_REXT - if (uiAbsSum[compID] == 0) - { - if (bUseCrossCPrediction) - { - const CPelBuf zeroBuf( m_pTempPel, compArea ); - PelBuf resiBuf = csFull->getResiBuf( compArea ); - - crossComponentPrediction( tu, compID, lumaResi, zeroBuf, resiBuf, true ); - } - } -#endif -#if !JVET_Q0695_CHROMA_TS_JCCR - if( !isLastMode || (compID != COMPONENT_Y && !tu.noResidual) ) - { -#endif bestTU.copyComponentFrom( tu, compID ); saveCS.getResiBuf( compArea ).copyFrom( csFull->getResiBuf( compArea ) ); -#if !JVET_Q0695_CHROMA_TS_JCCR - } - - isLastBest = isLastMode; -#endif } if( tu.noResidual ) { CHECK( currCompFracBits > 0 || currAbsSum, "currCompFracBits > 0 when tu noResidual" ); } -#if !REMOVE_PPS_REXT - } -#endif } -#if !JVET_Q0695_CHROMA_TS_JCCR - if( !isLastBest ) - { -#endif // copy component tu.copyComponentFrom( bestTU, compID ); csFull->getResiBuf( compArea ).copyFrom( saveCS.getResiBuf( compArea ) ); -#if !JVET_Q0695_CHROMA_TS_JCCR - } -#endif -#if JVET_Q0820_ACT if (colorTransFlag && (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING)) -#else - if (colorTransFlag) -#endif { m_pcTrQuant->lambdaAdjustColorTrans(false); m_pcRdCost->lambdaAdjustColorTrans(false, compID); @@ -6983,11 +6797,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { PelUnitBuf orgResidual = orgResi->subBuf(relativeUnitArea); PelUnitBuf invColorTransResidual = m_colorTransResiBuf[2].getBuf(relativeUnitArea); -#if JVET_Q0820_ACT csFull->getResiBuf(currArea).colorSpaceConvert(invColorTransResidual, false, slice.clpRng(COMPONENT_Y)); -#else - csFull->getResiBuf(currArea).colorSpaceConvert(invColorTransResidual, false); -#endif for (uint32_t c = 0; c < numTBlocks; c++) { @@ -6997,16 +6807,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } } -#if JVET_Q0438_MONOCHROME_BUGFIXES if ( chroma && isChromaEnabled(tu.chromaFormat) && tu.blocks[COMPONENT_Cb].valid() ) -#else - if ( chroma && tu.blocks[COMPONENT_Cb].valid() ) -#endif { const CompArea& cbArea = tu.blocks[COMPONENT_Cb]; const CompArea& crArea = tu.blocks[COMPONENT_Cr]; bool checkJointCbCr = (sps.getJointCbCrEnabledFlag()) && (!tu.noResidual) && (TU::getCbf(tu, COMPONENT_Cb) || TU::getCbf(tu, COMPONENT_Cr)); -#if JVET_Q0695_CHROMA_TS_JCCR bool checkDCTOnly = (TU::getCbf(tu, COMPONENT_Cb) && tu.mtsIdx[COMPONENT_Cb] == MTS_DCT2_DCT2 && !TU::getCbf(tu, COMPONENT_Cr)) || (TU::getCbf(tu, COMPONENT_Cr) && tu.mtsIdx[COMPONENT_Cr] == MTS_DCT2_DCT2 && !TU::getCbf(tu, COMPONENT_Cb)) || (TU::getCbf(tu, COMPONENT_Cb) && tu.mtsIdx[COMPONENT_Cb] == MTS_DCT2_DCT2 && TU::getCbf(tu, COMPONENT_Cr) && tu.mtsIdx[COMPONENT_Cr] == MTS_DCT2_DCT2); @@ -7014,23 +6819,14 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par bool checkTSOnly = (TU::getCbf(tu, COMPONENT_Cb) && tu.mtsIdx[COMPONENT_Cb] == MTS_SKIP && !TU::getCbf(tu, COMPONENT_Cr)) || (TU::getCbf(tu, COMPONENT_Cr) && tu.mtsIdx[COMPONENT_Cr] == MTS_SKIP && !TU::getCbf(tu, COMPONENT_Cb)) || (TU::getCbf(tu, COMPONENT_Cb) && tu.mtsIdx[COMPONENT_Cb] == MTS_SKIP && TU::getCbf(tu, COMPONENT_Cr) && tu.mtsIdx[COMPONENT_Cr] == MTS_SKIP); -#endif const int channelBitDepth = sps.getBitDepth(toChannelType(COMPONENT_Cb)); -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool reshape = slice.getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && tu.blocks[COMPONENT_Cb].width * tu.blocks[COMPONENT_Cb].height > 4; -#else - bool reshape = slice.getPicHeader()->getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() - && tu.blocks[COMPONENT_Cb].width * tu.blocks[COMPONENT_Cb].height > 4; -#endif double minCostCbCr = minCost[COMPONENT_Cb] + minCost[COMPONENT_Cr]; if (colorTransFlag) { minCostCbCr += minCost[COMPONENT_Y]; // ACT should consider three-component cost } -#if !JVET_Q0695_CHROMA_TS_JCCR - bool isLastBest = false; -#endif CompStorage orgResiCb[4], orgResiCr[4]; // 0:std, 1-3:jointCbCr std::vector<int> jointCbfMasksToTest; @@ -7050,7 +6846,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par for (int cbfMask: jointCbfMasksToTest) { -#if JVET_Q0695_CHROMA_TS_JCCR ComponentID codeCompId = (cbfMask >> 1 ? COMPONENT_Cb : COMPONENT_Cr); ComponentID otherCompId = (codeCompId == COMPONENT_Cr ? COMPONENT_Cb : COMPONENT_Cr); bool tsAllowed = TU::isTSAllowed(tu, codeCompId) && (m_pcEncCfg->getUseChromaTS()); @@ -7081,7 +6876,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { continue; } -#endif TCoeff currAbsSum = 0; uint64_t currCompFracBits = 0; Distortion currCompDistCb = 0; @@ -7089,27 +6883,12 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par double currCompCost = 0; tu.jointCbCr = (uint8_t) cbfMask; -#if !REMOVE_PPS_REXT - tu.compAlpha[COMPONENT_Cb] = tu.compAlpha[COMPONENT_Cr] = 0; -#endif // encoder bugfix: initialize mtsIdx for chroma under JointCbCrMode. -#if JVET_Q0695_CHROMA_TS_JCCR tu.mtsIdx[codeCompId] = trModes[modeId].first; tu.mtsIdx[otherCompId] = MTS_DCT2_DCT2; -#else - tu.mtsIdx[COMPONENT_Cb] = tu.mtsIdx[COMPONENT_Cr] = MTS_DCT2_DCT2; -#endif int codedCbfMask = 0; -#if !JVET_Q0695_CHROMA_TS_JCCR - ComponentID codeCompId = (tu.jointCbCr >> 1 ? COMPONENT_Cb : COMPONENT_Cr); - ComponentID otherCompId = (codeCompId == COMPONENT_Cr ? COMPONENT_Cb : COMPONENT_Cr); -#endif -#if JVET_Q0820_ACT if (colorTransFlag && (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING)) -#else - if (colorTransFlag) -#endif { m_pcTrQuant->lambdaAdjustColorTrans(true); m_pcTrQuant->selectLambda(codeCompId); @@ -7143,24 +6922,12 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par Distortion currCompDistY = MAX_UINT64; QpParam qpCbCr(tu, codeCompId); -#if !JVET_Q0820_ACT - if (colorTransFlag) - { - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - qpCbCr.Qps[qpIdx] = qpCbCr.Qps[qpIdx] + (codeCompId == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); - qpCbCr.pers[qpIdx] = qpCbCr.Qps[qpIdx] / 6; - qpCbCr.rems[qpIdx] = qpCbCr.Qps[qpIdx] % 6; - } - } -#endif tu.getCoeffs(otherCompId).fill(0); // do we need that? TU::setCbfAtDepth(tu, otherCompId, tu.depth, false); PelBuf &codeResi = (codeCompId == COMPONENT_Cr ? crResi : cbResi); TCoeff compAbsSum = 0; -#if JVET_Q0695_CHROMA_TS_JCCR if (numTransformCands > 1) { if (modeId == 0) @@ -7172,7 +6939,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, compAbsSum, m_CABACEstimator->getCtx(), true); } else -#endif m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, compAbsSum, m_CABACEstimator->getCtx()); if (compAbsSum > 0) { @@ -7195,12 +6961,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } currAbsSum = codedCbfMask; -#if JVET_Q0695_CHROMA_TS_JCCR if (!tu.mtsIdx[codeCompId]) { cbfDCT2 = (currAbsSum > 0); } -#endif if (currAbsSum > 0) { m_CABACEstimator->cbf_comp(cs, codedCbfMask >> 1, cbArea, currDepth, false); @@ -7223,11 +6987,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { PelUnitBuf orgResidual = orgResi->subBuf(relativeUnitArea); PelUnitBuf invColorTransResidual = m_colorTransResiBuf[2].getBuf(relativeUnitArea); -#if JVET_Q0820_ACT csFull->getResiBuf(currArea).colorSpaceConvert(invColorTransResidual, false, slice.clpRng(COMPONENT_Y)); -#else - csFull->getResiBuf(currArea).colorSpaceConvert(invColorTransResidual, false); -#endif currCompDistY = m_pcRdCost->getDistPart(orgResidual.bufs[COMPONENT_Y], invColorTransResidual.bufs[COMPONENT_Y], sps.getBitDepth(toChannelType(COMPONENT_Y)), COMPONENT_Y, DF_SSE); currCompDistCb = m_pcRdCost->getDistPart(orgResidual.bufs[COMPONENT_Cb], invColorTransResidual.bufs[COMPONENT_Cb], sps.getBitDepth(toChannelType(COMPONENT_Cb)), COMPONENT_Cb, DF_SSE); @@ -7251,10 +7011,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par // evaluate if( currCompCost < minCostCbCr ) { -#if !REMOVE_PPS_REXT - uiAbsSum[COMPONENT_Cb] = currAbsSum; - uiAbsSum[COMPONENT_Cr] = currAbsSum; -#endif uiSingleDistComp[COMPONENT_Cb] = currCompDistCb; uiSingleDistComp[COMPONENT_Cr] = currCompDistCr; if (colorTransFlag) @@ -7262,10 +7018,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par uiSingleDistComp[COMPONENT_Y] = currCompDistY; } minCostCbCr = currCompCost; -#if !JVET_Q0695_CHROMA_TS_JCCR - isLastBest = (cbfMask == jointCbfMasksToTest.back()); - if (!isLastBest) -#endif { bestTU.copyComponentFrom(tu, COMPONENT_Cb); bestTU.copyComponentFrom(tu, COMPONENT_Cr); @@ -7274,49 +7026,26 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } } -#if !JVET_Q0695_CHROMA_TS_JCCR - if( !isLastBest ) - { - // copy component - tu.copyComponentFrom( bestTU, COMPONENT_Cb ); - tu.copyComponentFrom( bestTU, COMPONENT_Cr ); - csFull->getResiBuf( cbArea ).copyFrom( saveCS.getResiBuf( cbArea ) ); - csFull->getResiBuf( crArea ).copyFrom( saveCS.getResiBuf( crArea ) ); - } -#endif -#if JVET_Q0820_ACT if (colorTransFlag && (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING)) -#else - if (colorTransFlag) -#endif { m_pcTrQuant->lambdaAdjustColorTrans(false); } -#if JVET_Q0695_CHROMA_TS_JCCR } -#endif } -#if JVET_Q0695_CHROMA_TS_JCCR // copy component tu.copyComponentFrom(bestTU, COMPONENT_Cb); tu.copyComponentFrom(bestTU, COMPONENT_Cr); csFull->getResiBuf(cbArea).copyFrom(saveCS.getResiBuf(cbArea)); csFull->getResiBuf(crArea).copyFrom(saveCS.getResiBuf(crArea)); -#endif } m_CABACEstimator->getCtx() = ctxStart; m_CABACEstimator->resetBits(); if( !tu.noResidual ) { -#if JVET_Q0438_MONOCHROME_BUGFIXES static const ComponentID cbf_getComp[MAX_NUM_COMPONENT] = { COMPONENT_Cb, COMPONENT_Cr, COMPONENT_Y }; for( unsigned c = isChromaEnabled(tu.chromaFormat)?0 : 2; c < MAX_NUM_COMPONENT; c++) -#else - static const ComponentID cbf_getComp[3] = { COMPONENT_Cb, COMPONENT_Cr, COMPONENT_Y }; - for( unsigned c = 0; c < numTBlocks; c++) -#endif { const ComponentID compID = cbf_getComp[c]; if (compID == COMPONENT_Y && !luma) @@ -7345,12 +7074,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const int cbfMask = ( TU::getCbf( tu, COMPONENT_Cb ) ? 2 : 0 ) + ( TU::getCbf( tu, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->joint_cb_cr(tu, cbfMask); } -#if !REMOVE_PPS_REXT - if( cs.pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma(compID) && uiAbsSum[COMPONENT_Y] ) - { - m_CABACEstimator->cross_comp_pred( tu, compID ); - } -#endif if( TU::getCbf( tu, compID ) ) { m_CABACEstimator->residual_coding( tu, compID ); @@ -7503,11 +7226,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa cs.getResiBuf().fill(0); { cs.getRecoBuf().copyFrom(cs.getPredBuf() ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) && !cu.firstPU->ciipFlag && !CU::isIBC(cu)) -#else - if (m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) && !cu.firstPU->ciipFlag && !CU::isIBC(cu)) -#endif { cs.getRecoBuf().Y().rspSignal(m_pcReshape->getFwdLUT()); } @@ -7528,13 +7247,8 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa CPelBuf reco = cs.getRecoBuf (compID); CPelBuf org = cs.getOrgBuf (compID); #if WCG_EXT -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( - m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) ) -#endif { const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) @@ -7572,11 +7286,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa if (luma) { cs.getResiBuf().bufs[0].copyFrom(cs.getOrgBuf().bufs[0]); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { const CompArea &areaY = cu.Y(); CompArea tmpArea(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size()); @@ -7591,11 +7301,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa else cs.getResiBuf().bufs[0].subtract(cs.getPredBuf().bufs[0]); } -#if JVET_Q0438_MONOCHROME_BUGFIXES if (chroma && isChromaEnabled(cs.pcv->chrFormat)) -#else - if (chroma) -#endif { cs.getResiBuf().bufs[1].copyFrom(cs.getOrgBuf().bufs[1]); cs.getResiBuf().bufs[2].copyFrom(cs.getOrgBuf().bufs[2]); @@ -7628,11 +7334,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa orgResidual.copyFrom(cs.getResiBuf()); if (colorTransAllowed) { -#if JVET_Q0820_ACT cs.getResiBuf().colorSpaceConvert(colorTransResidual, true, cu.cs->slice->clpRng(COMPONENT_Y)); -#else - cs.getResiBuf().colorSpaceConvert(colorTransResidual, true); -#endif } const TempCtx ctxStart(m_CtxCache, m_CABACEstimator->getCtx()); @@ -7726,11 +7428,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa { cs.getOrgResiBuf().bufs[0].copyFrom(orgResidual.bufs[0]); } -#if JVET_Q0438_MONOCHROME_BUGFIXES if (chroma && isChromaEnabled(cs.pcv->chrFormat)) -#else - if (chroma) -#endif { cs.getOrgResiBuf().bufs[1].copyFrom(orgResidual.bufs[1]); cs.getOrgResiBuf().bufs[2].copyFrom(orgResidual.bufs[2]); @@ -7786,11 +7484,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa bestIter = iter; if (cu.rootCbf && cu.colorTransform) { -#if JVET_Q0820_ACT cs.getResiBuf(curUnitArea).colorSpaceConvert(cs.getResiBuf(curUnitArea), false, cu.cs->slice->clpRng(COMPONENT_Y)); -#else - cs.getResiBuf(curUnitArea).colorSpaceConvert(cs.getResiBuf(curUnitArea), false); -#endif } if (iter != (numAllowedColorSpace - 1)) @@ -7837,11 +7531,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa { cs.getResiBuf().bufs[0].fill(0); // Clear the residual image, if we didn't code it. } -#if JVET_Q0438_MONOCHROME_BUGFIXES if (chroma && isChromaEnabled(cs.pcv->chrFormat)) -#else - if (chroma) -#endif { cs.getResiBuf().bufs[1].fill(0); // Clear the residual image, if we didn't code it. cs.getResiBuf().bufs[2].fill(0); // Clear the residual image, if we didn't code it. @@ -7850,11 +7540,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa if (luma) { -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cu.rootCbf && cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cu.rootCbf && cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { const CompArea &areaY = cu.Y(); CompArea tmpArea(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size()); @@ -7869,21 +7555,13 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa else { cs.getRecoBuf().bufs[0].reconstruct(cs.getPredBuf().bufs[0], cs.getResiBuf().bufs[0], cs.slice->clpRngs().comp[0]); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && !cu.firstPU->ciipFlag && !CU::isIBC(cu)) -#else - if (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && !cu.firstPU->ciipFlag && !CU::isIBC(cu)) -#endif { cs.getRecoBuf().bufs[0].rspSignal(m_pcReshape->getFwdLUT()); } } } -#if JVET_Q0438_MONOCHROME_BUGFIXES if (chroma && isChromaEnabled(cs.pcv->chrFormat)) -#else - if (chroma) -#endif { cs.getRecoBuf().bufs[1].reconstruct(cs.getPredBuf().bufs[1], cs.getResiBuf().bufs[1], cs.slice->clpRngs().comp[1]); cs.getRecoBuf().bufs[2].reconstruct(cs.getPredBuf().bufs[2], cs.getResiBuf().bufs[2], cs.slice->clpRngs().comp[2]); @@ -7903,13 +7581,8 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa CPelBuf org = cs.getOrgBuf (compID); #if WCG_EXT -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( - m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#endif { const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) ) @@ -8071,7 +7744,6 @@ void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& siz int verMax = ( pps.getPicHeightInLumaSamples() + offset - (int)pos.y - 1 ) << mvShift; int verMin = ( -( int ) sps.getMaxCUHeight() - offset - ( int ) pos.y + 1 ) << mvShift; -#if JVET_O1143_MV_ACROSS_SUBPIC_BOUNDARY const SubPic &curSubPic = pps.getSubPicFromPos(pos); if (curSubPic.getTreatedAsPicFlag()) { @@ -8081,7 +7753,6 @@ void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& siz verMax = ((curSubPic.getSubPicBottom() + 1) + offset - (int)pos.y - 1) << mvShift; verMin = (-(int)sps.getMaxCUHeight() - offset - ((int)pos.y - curSubPic.getSubPicTop()) + 1) << mvShift; } -#endif if( sps.getWrapAroundEnabledFlag() ) { int horMax = ( pps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + offset - (int)pos.x - 1 ) << mvShift; diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index f3506532e46be81d22dfae00c6a252668c6af723..126832e4bb3b55d1e06ce8c0cb916bd35d94147a 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -97,11 +97,7 @@ typedef struct } EncAffineMotion; /// encoder search class -#if !REMOVE_PPS_REXT -class InterSearch : public InterPrediction, CrossComponentPrediction, AffineGradientSearch -#else class InterSearch : public InterPrediction, AffineGradientSearch -#endif { private: EncModeCtrl *m_modeCtrl; diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index fcdf7ed4dc883dac2fef5769350c10e81c7e03aa..68806b094714f33829e00772c984dfa34d4e7824 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -387,9 +387,6 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c const TempCtx ctxStartMrlIdx ( m_CtxCache, SubCtx( Ctx::MultiRefLineIdx, m_CABACEstimator->getCtx() ) ); CHECK( !cu.firstPU, "CU has no PUs" ); -#if !REMOVE_PPS_REXT - const bool keepResi = cs.pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() || KEEP_PRED_AND_RESI_SIGNALS; -#endif // variables for saving fast intra modes scan results across multiple LFNST passes bool LFNSTLoadFlag = sps.getUseLFNST() && cu.lfnstIdx != 0; bool LFNSTSaveFlag = sps.getUseLFNST() && cu.lfnstIdx == 0; @@ -449,11 +446,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c } } -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM const bool testBDPCM = sps.getBDPCMEnabledFlag() && CU::bdpcmAllowed(cu, ComponentID(partitioner.chType)) && cu.mtsFlag == 0 && cu.lfnstIdx == 0; -#else - const bool testBDPCM = (sps.getBDPCMEnabled()!=0) && CU::bdpcmAllowed(cu, ComponentID(partitioner.chType)) && cu.mtsFlag == 0 && cu.lfnstIdx == 0; -#endif static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> uiHadModeList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandCostList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandHadList; @@ -519,11 +512,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c DistParam distParamSad; DistParam distParamHad; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (cu.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cu.slice->getPicHeader()->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#endif { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpOrg = m_tmpStorageLCU.getBuf(tmpArea); @@ -1201,21 +1190,12 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c { if (cu.colorTransform) { -#if !REMOVE_PPS_REXT - cs.useSubStructure(*csBest, partitioner.chType, pu, true, true, keepResi, keepResi); -#else cs.useSubStructure(*csBest, partitioner.chType, pu, true, true, KEEP_PRED_AND_RESI_SIGNALS, KEEP_PRED_AND_RESI_SIGNALS); -#endif } else { -#if !REMOVE_PPS_REXT - cs.useSubStructure(*csBest, partitioner.chType, pu.singleChan(CHANNEL_TYPE_LUMA), true, true, keepResi, - keepResi); -#else cs.useSubStructure(*csBest, partitioner.chType, pu.singleChan(CHANNEL_TYPE_LUMA), true, true, KEEP_PRED_AND_RESI_SIGNALS, KEEP_PRED_AND_RESI_SIGNALS); -#endif } } csBest->releaseIntermediateData(); @@ -1444,11 +1424,7 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner if (uiMode < 0) { cu.bdpcmModeChroma = -uiMode; -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 chromaIntraMode = cu.bdpcmModeChroma == 2 ? chromaCandModes[1] : chromaCandModes[2]; -#else - chromaIntraMode = chromaCandModes[0]; -#endif } else { @@ -1580,43 +1556,26 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo TransformUnit &tu = *cs.getTU(partitioner.chType); uint32_t height = cu.block(compBegin).height; uint32_t width = cu.block(compBegin).width; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#else - if (m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#endif { cs.getPredBuf().copyFrom(cs.getOrgBuf()); cs.getPredBuf().Y().rspSignal(m_pcReshape->getFwdLUT()); } -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cs.prevPLT.curPLTSize[compBegin] = cs.prevPLT.curPLTSize[COMPONENT_Y]; -#endif cu.lastPLTSize[compBegin] = cs.prevPLT.curPLTSize[compBegin]; //derive palette derivePLTLossy(cs, partitioner, compBegin, numComp); reorderPLT(cs, partitioner, compBegin, numComp); -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX bool idxExist[MAXPLTSIZE + 1] = { false }; -#endif preCalcPLTIndexRD(cs, partitioner, compBegin, numComp); // Pre-calculate distortions for each pixel double rdCost = MAX_DOUBLE; -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_HORTRAV, rdCost, idxExist); // Optimize palette index map (horizontal scan) -#else - deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_HORTRAV, rdCost); // Optimize palette index map (horizontal scan) -#endif if ((cu.curPLTSize[compBegin] + cu.useEscape[compBegin]) > 1) { -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_VERTRAV, rdCost, idxExist); // Optimize palette index map (vertical scan) -#else - deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_VERTRAV, rdCost); // Optimize palette index map (vertical scan) -#endif } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX // Remove unused palette entries uint8_t newPLTSize = 0; int idxMapping[MAXPLTSIZE + 1]; @@ -1635,7 +1594,6 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo Pel curPLTtmp[MAX_NUM_COMPONENT][MAXPLTSIZE]; int reuseFlagIdx = 0, curPLTtmpIdx = 0, reuseEntrySize = 0; memset(cu.reuseflag[compBegin], false, sizeof(bool) * MAXPLTPREDSIZE); -#if JVET_Q0504_PLT_NON444 int compBeginTmp = compBegin; int numCompTmp = numComp; if( cu.isLocalSepTree() ) @@ -1644,16 +1602,11 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo compBeginTmp = COMPONENT_Y; numCompTmp = (cu.chromaFormat != CHROMA_400) ? 3 : 1; } -#endif for (int curIdx = 0; curIdx < cu.curPLTSize[compBegin]; curIdx++) { if (idxExist[curIdx]) { -#if JVET_Q0504_PLT_NON444 for (int comp = compBeginTmp; comp < (compBeginTmp + numCompTmp); comp++) -#else - for (int comp = compBegin; comp < (compBegin + numComp); comp++) -#endif curPLTtmp[comp][curPLTtmpIdx] = cu.curPLT[comp][curIdx]; // Update reuse flags @@ -1676,10 +1629,8 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo if (match) { cu.reuseflag[compBegin][reuseFlagIdx] = true; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cu.reuseflag[COMPONENT_Y][reuseFlagIdx] = true; -#endif reuseEntrySize++; } } @@ -1689,16 +1640,11 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo cu.reusePLTSize[compBegin] = reuseEntrySize; // update palette table cu.curPLTSize[compBegin] = newPLTSize; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cu.curPLTSize[COMPONENT_Y] = newPLTSize; for (int comp = compBeginTmp; comp < (compBeginTmp + numCompTmp); comp++) -#else - for (int comp = compBegin; comp < (compBegin + numComp); comp++) -#endif memcpy( cu.curPLT[comp], curPLTtmp[comp], sizeof(Pel)*cu.curPLTSize[compBegin]); } -#endif cu.useRotation[compBegin] = m_bestScanRotationMode; int indexMaxSize = cu.useEscape[compBegin] ? (cu.curPLTSize[compBegin] + 1) : cu.curPLTSize[compBegin]; if (indexMaxSize <= 1) @@ -1711,9 +1657,7 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo { for (uint32_t x = 0; x < width; x++) { -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX curPLTIdx.at(x, y) = idxMapping[curPLTIdx.at(x, y)]; -#endif if (curPLTIdx.at(x, y) == cu.curPLTSize[compBegin]) { calcPixelPred(cs, partitioner, y, x, compBegin, numComp); @@ -1752,13 +1696,8 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo CPelBuf reco = cs.getRecoBuf(compID); CPelBuf org = cs.getOrgBuf(compID); #if WCG_EXT -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( - m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()))) -#endif { const CPelBuf orgLuma = cs.getOrgBuf(cs.area.blocks[COMPONENT_Y]); @@ -1827,19 +1766,13 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione CodingUnit &cu = *cs.getCU(partitioner.chType); uint32_t height = cu.block(compBegin).height; uint32_t width = cu.block(compBegin).width; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS bool lossless = (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING); -#endif CPelBuf orgBuf[3]; for (int comp = compBegin; comp < (compBegin + numComp); comp++) { CompArea area = cu.blocks[comp]; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#else - if (m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#endif { orgBuf[comp] = cs.getPredBuf(area); } @@ -1870,16 +1803,13 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione uint8_t pltIdx = 0; double minError = MAX_DOUBLE; uint8_t bestIdx = 0; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS for (uint8_t z = 0; z < cu.curPLTSize[compBegin]; z++) { m_indexError[z][rasPos] = minError; } -#endif while (pltIdx < cu.curPLTSize[compBegin]) { uint64_t sqrtError = 0; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { for (int comp = compBegin; comp < (discardChroma ? 1 : (compBegin + numComp)); comp++) @@ -1896,7 +1826,6 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione } else { -#endif for (int comp = compBegin; comp < (discardChroma ? 1 : (compBegin + numComp)); comp++) { int64_t tmpErr = int64_t(curPel[comp] - cu.curPLT[comp][pltIdx]); @@ -1915,32 +1844,24 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione minError = (double)sqrtError; bestIdx = pltIdx; } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif pltIdx++; } Pel paPixelValue[3], paRecoValue[3]; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (!lossless) { -#endif calcPixelPredRD(cs, partitioner, curPel, paPixelValue, paRecoValue, compBegin, numComp); -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif uint64_t error = 0, rate = 0; for (int comp = compBegin; comp < (discardChroma ? 1 : (compBegin + numComp)); comp++) { -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { rate += m_escapeNumBins[curPel[comp]]; } else { -#endif int64_t tmpErr = int64_t(curPel[comp] - paRecoValue[comp]); if (isChroma((ComponentID)comp)) { @@ -1951,9 +1872,7 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione error += tmpErr*tmpErr; } rate += m_escapeNumBins[paPixelValue[comp]]; // encode quantized escape color -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif } double rdCost = (double)error + m_pcRdCost->getLambda()*(double)rate; m_indexError[cu.curPLTSize[compBegin]][rasPos] = rdCost; @@ -1967,11 +1886,7 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione } } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX void IntraSearch::deriveIndexMap(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, double& dMinCost, bool* idxExist) -#else -void IntraSearch::deriveIndexMap(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, double& dMinCost) -#endif { CodingUnit &cu = *cs.getCU(partitioner.chType); TransformUnit &tu = *cs.getTU(partitioner.chType); @@ -2094,16 +2009,12 @@ void IntraSearch::deriveIndexMap(CodingStructure& cs, Partitioner& partitioner, { cu.useEscape[compBegin] = m_bestEscape; m_bestScanRotationMode = pltScanMode; -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX memset(idxExist, false, sizeof(bool) * (MAXPLTSIZE + 1)); -#endif for (int pos = 0; pos < (width*height); pos++) { runIndex[pos] = checkIndexTable[pos]; runType[pos] = checkRunTable[pos]; -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX idxExist[checkIndexTable[pos]] = true; -#endif } dMinCost = sumRdCost; } @@ -2267,32 +2178,16 @@ double IntraSearch::rateDistOptPLT( rdCost = MAX_DOUBLE; return rdCost; } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX rdCost += m_pcRdCost->getLambda()*(m_truncBinBits[(runIndex > refIndex) ? runIndex - 1 : runIndex][(scanPos == 0) ? (indexMaxValue + 1) : indexMaxValue] << SCALE_BITS); -#else - rdCost += m_pcRdCost->getLambda()*m_truncBinBits[(runIndex > refIndex) ? runIndex - 1 : runIndex][(scanPos == 0) ? (indexMaxValue + 1) : indexMaxValue]; -#endif } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX rdCost += m_indexError[runIndex][m_scanOrder[scanPos].idx] * (1 << SCALE_BITS); -#else - rdCost += m_indexError[runIndex][m_scanOrder[scanPos].idx]; -#endif if (scanPos > 0) { -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX rdCost += m_pcRdCost->getLambda()*( identityFlag ? (IndexfracBits[(dist < RUN_IDX_THRE) ? dist : RUN_IDX_THRE].intBits[1]) : (IndexfracBits[(dist < RUN_IDX_THRE) ? dist : RUN_IDX_THRE].intBits[0] ) ); -#else - rdCost += m_pcRdCost->getLambda()*( identityFlag ? (IndexfracBits[(dist < RUN_IDX_THRE) ? dist : RUN_IDX_THRE].intBits[1] >> SCALE_BITS) : (IndexfracBits[(dist < RUN_IDX_THRE) ? dist : RUN_IDX_THRE].intBits[0] >> SCALE_BITS)); -#endif } if ( !identityFlag && scanPos >= width && prevRunType != PLT_RUN_COPY ) { -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX rdCost += m_pcRdCost->getLambda()*TypefracBits.intBits[runType]; -#else - rdCost += m_pcRdCost->getLambda()*(TypefracBits.intBits[runType] >> SCALE_BITS); -#endif } if (!identityFlag || scanPos == 0) { @@ -2368,30 +2263,20 @@ void IntraSearch::initTBCTable(int bitDepth) memset(m_escapeNumBins, 0, sizeof(uint16_t)*m_symbolSize); for (uint32_t i = 0; i < m_symbolSize; i++) { -#if JVET_Q0491_PLT_ESCAPE m_escapeNumBins[i] = getEpExGolombNumBins(i, 5); -#else - m_escapeNumBins[i] = getEpExGolombNumBins(i, 3); -#endif } } void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, uint32_t yPos, uint32_t xPos, ComponentID compBegin, uint32_t numComp) { CodingUnit &cu = *cs.getCU(partitioner.chType); TransformUnit &tu = *cs.getTU(partitioner.chType); -#if JVET_Q0493_PLT_ENCODER_LOSSLESS bool lossless = (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING); -#endif CPelBuf orgBuf[3]; for (int comp = compBegin; comp < (compBegin + numComp); comp++) { CompArea area = cu.blocks[comp]; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#else - if (m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#endif { orgBuf[comp] = cs.getPredBuf(area); } @@ -2409,10 +2294,8 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u int rightShiftOffset[3]; int invquantiserRightShift[3]; int add[3]; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (!lossless) { -#endif for (uint32_t ch = compBegin; ch < (compBegin + numComp); ch++) { QpParam cQP(tu, ComponentID(ch)); @@ -2425,9 +2308,7 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u invquantiserRightShift[ch] = IQUANT_SHIFT; add[ch] = 1 << (invquantiserRightShift[ch] - 1); } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif uint32_t scaleX = getComponentScaleX(COMPONENT_Cb, cs.sps->getChromaFormatIdc()); uint32_t scaleY = getComponentScaleY(COMPONENT_Cb, cs.sps->getChromaFormatIdc()); @@ -2439,7 +2320,6 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)ch); if (compBegin != COMPONENT_Y || ch == 0) { -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { escapeValue.at(xPos, yPos) = orgBuf[ch].at(xPos, yPos); @@ -2447,20 +2327,16 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u } else { -#endif escapeValue.at(xPos, yPos) = TCoeff(std::max<int>(0, ((orgBuf[ch].at(xPos, yPos) * quantiserScale[ch] + rightShiftOffset[ch]) >> quantiserRightShift[ch]))); assert(escapeValue.at(xPos, yPos) < (1 << (channelBitDepth + 1))); recBuf.at(xPos, yPos) = (((escapeValue.at(xPos, yPos)*g_invQuantScales[0][qpRem[ch]]) << qpPer[ch]) + add[ch]) >> invquantiserRightShift[ch]; recBuf.at(xPos, yPos) = Pel(ClipBD<int>(recBuf.at(xPos, yPos), channelBitDepth));//to be checked -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif } else if (compBegin == COMPONENT_Y && ch > 0 && yPos % (1 << scaleY) == 0 && xPos % (1 << scaleX) == 0) { uint32_t yPosC = yPos >> scaleY; uint32_t xPosC = xPos >> scaleX; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { escapeValue.at(xPosC, yPosC) = orgBuf[ch].at(xPosC, yPosC); @@ -2468,14 +2344,11 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u } else { -#endif escapeValue.at(xPosC, yPosC) = TCoeff(std::max<int>(0, ((orgBuf[ch].at(xPosC, yPosC) * quantiserScale[ch] + rightShiftOffset[ch]) >> quantiserRightShift[ch]))); assert(escapeValue.at(xPosC, yPosC) < (1 << (channelBitDepth + 1))); recBuf.at(xPosC, yPosC) = (((escapeValue.at(xPosC, yPosC)*g_invQuantScales[0][qpRem[ch]]) << qpPer[ch]) + add[ch]) >> invquantiserRightShift[ch]; recBuf.at(xPosC, yPosC) = Pel(ClipBD<int>(recBuf.at(xPosC, yPosC), channelBitDepth));//to be checked -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif } } } @@ -2484,7 +2357,6 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, CodingUnit &cu = *cs.getCU(partitioner.chType); const int channelBitDepth_L = cs.sps->getBitDepth(CHANNEL_TYPE_LUMA); const int channelBitDepth_C = cs.sps->getBitDepth(CHANNEL_TYPE_CHROMA); -#if JVET_Q0493_PLT_ENCODER_LOSSLESS bool lossless = (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING); int pcmShiftRight_L = (channelBitDepth_L - PLT_ENCBITDEPTH); int pcmShiftRight_C = (channelBitDepth_C - PLT_ENCBITDEPTH); @@ -2493,14 +2365,8 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, pcmShiftRight_L = 0; pcmShiftRight_C = 0; } -#else - const int pcmShiftRight_L = (channelBitDepth_L - PLT_ENCBITDEPTH); - const int pcmShiftRight_C = (channelBitDepth_C - PLT_ENCBITDEPTH); -#endif -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE int maxPltSize = cu.isSepTree() ? MAXPLTSIZE_DUALTREE : MAXPLTSIZE; -#endif uint32_t height = cu.block(compBegin).height; uint32_t width = cu.block(compBegin).width; @@ -2509,11 +2375,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, for (int comp = compBegin; comp < (compBegin + numComp); comp++) { CompArea area = cu.blocks[comp]; -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#else - if (m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) -#endif { orgBuf[comp] = cs.getPredBuf(area); } @@ -2523,36 +2385,25 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, } } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX TransformUnit &tu = *cs.getTU(partitioner.chType); QpParam cQP(tu, compBegin); int qp = cQP.Qp(true) - 12; qp = (qp < 0) ? 0 : ((qp > 56) ? 56 : qp); int errorLimit = g_paletteQuant[qp]; -#else - int errorLimit = g_paletteQuant[cu.qp]; -#endif -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { errorLimit = 0; } -#endif uint32_t totalSize = height*width; SortingElement *pelList = new SortingElement[totalSize]; SortingElement element; SortingElement *pelListSort = new SortingElement[MAXPLTSIZE + 1]; -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE uint32_t dictMaxSize = maxPltSize; -#else - uint32_t dictMaxSize = MAXPLTSIZE; -#endif uint32_t idx = 0; int last = -1; uint32_t scaleX = getComponentScaleX(COMPONENT_Cb, cs.sps->getChromaFormatIdc()); uint32_t scaleY = getComponentScaleY(COMPONENT_Cb, cs.sps->getChromaFormatIdc()); -#if JVET_Q0504_PLT_NON444 for (uint32_t y = 0; y < height; y++) { for (uint32_t x = 0; x < width; x++) @@ -2575,7 +2426,6 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, tmpCompBegin = COMPONENT_Y; tmpNumComp = 1; } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS int besti = last, bestSAD = (last == -1) ? MAX_UINT : pelList[last].getSAD(element, cs.sps->getBitDepths(), tmpCompBegin, tmpNumComp, lossless); if (lossless) { @@ -2595,18 +2445,11 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, } else { -#else - int besti = last, bestSAD = (last == -1) ? MAX_UINT : pelList[last].getSAD(element, cs.sps->getBitDepths(), tmpCompBegin, tmpNumComp); -#endif if( bestSAD ) { for (int i = idx - 1; i >= 0; i--) { -#if JVET_Q0493_PLT_ENCODER_LOSSLESS uint32_t sad = pelList[i].getSAD(element, cs.sps->getBitDepths(), tmpCompBegin, tmpNumComp, lossless); -#else - uint32_t sad = pelList[i].getSAD(element, cs.sps->getBitDepths(), tmpCompBegin, tmpNumComp); -#endif if (sad < bestSAD) { bestSAD = sad; @@ -2615,12 +2458,8 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, } } } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } if (besti >= 0 && pelList[besti].almostEqualData(element, errorLimit, cs.sps->getBitDepths(), tmpCompBegin, tmpNumComp, lossless)) -#else - if (besti >= 0 && pelList[besti].almostEqualData(element, errorLimit, cs.sps->getBitDepths(), tmpCompBegin, tmpNumComp)) -#endif { pelList[besti].addElement(element, tmpCompBegin, tmpNumComp); last = besti; @@ -2663,90 +2502,13 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, } } } -#else - for (uint32_t y = 0; y < height; y++) - { - for (uint32_t x = 0; x < width; x++) - { - uint32_t org[3], pX, pY; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - pX = (comp > 0 && compBegin == COMPONENT_Y) ? (x >> scaleX) : x; - pY = (comp > 0 && compBegin == COMPONENT_Y) ? (y >> scaleY) : y; - org[comp] = orgBuf[comp].at(pX, pY); - } - element.setAll(org, compBegin, numComp); -#if JVET_Q0493_PLT_ENCODER_LOSSLESS - int besti = last, bestSAD = (last == -1) ? MAX_UINT : pelList[last].getSAD(element, cs.sps->getBitDepths(), compBegin, numComp, lossless); - if (lossless) - { - if (bestSAD) - { - for (int i = idx - 1; i >= 0; i--) - { - uint32_t sad = pelList[i].getSAD(element, cs.sps->getBitDepths(), compBegin, numComp, lossless); - if (sad == 0) - { - bestSAD = sad; - besti = i; - break; - } - } - } - } - else - { -#else - int besti = last, bestSAD = (last == -1) ? MAX_UINT : pelList[last].getSAD(element, cs.sps->getBitDepths(), compBegin, numComp); -#endif - if (bestSAD) - { - for (int i = idx - 1; i >= 0; i--) - { -#if JVET_Q0493_PLT_ENCODER_LOSSLESS - uint32_t sad = pelList[i].getSAD(element, cs.sps->getBitDepths(), compBegin, numComp, lossless); -#else - uint32_t sad = pelList[i].getSAD(element, cs.sps->getBitDepths(), compBegin, numComp); -#endif - if (sad < bestSAD) - { - bestSAD = sad; - besti = i; - if (!sad) break; - } - } - } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS - } - if (besti >= 0 && pelList[besti].almostEqualData(element, errorLimit, cs.sps->getBitDepths(), compBegin, numComp, lossless)) -#else - if (besti >= 0 && pelList[besti].almostEqualData(element, errorLimit, cs.sps->getBitDepths(), compBegin, numComp)) -#endif - { - pelList[besti].addElement(element, compBegin, numComp); - last = besti; - } - else - { - pelList[idx].copyDataFrom(element, compBegin, numComp); - pelList[idx].setCnt(1); - last = idx; - idx++; - } - } - } -#endif for (int i = 0; i < dictMaxSize; i++) { -#if JVET_Q0504_PLT_NON444 pelListSort[i].setCnt(0, COMPONENT_Y); pelListSort[i].setCnt(0, COMPONENT_Cb); pelListSort[i].setCnt(0, COMPONENT_Cr); pelListSort[i].setCnt(0, MAX_NUM_COMPONENT); -#else - pelListSort[i].setCnt(0); -#endif pelListSort[i].resetAll(compBegin, numComp); } @@ -2754,27 +2516,15 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, dictMaxSize = 1; for (int i = 0; i < idx; i++) { -#if JVET_Q0504_PLT_NON444 if( pelList[i].getCnt(MAX_NUM_COMPONENT) > pelListSort[dictMaxSize - 1].getCnt(MAX_NUM_COMPONENT) ) -#else - if (pelList[i].getCnt() > pelListSort[dictMaxSize - 1].getCnt()) -#endif { int j; for (j = dictMaxSize; j > 0; j--) { -#if JVET_Q0504_PLT_NON444 if (pelList[i].getCnt(MAX_NUM_COMPONENT) > pelListSort[j - 1].getCnt(MAX_NUM_COMPONENT)) -#else - if (pelList[i].getCnt() > pelListSort[j - 1].getCnt() ) -#endif { pelListSort[j].copyAllFrom(pelListSort[j - 1], compBegin, numComp); -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE dictMaxSize = std::min(dictMaxSize + 1, (uint32_t)maxPltSize); -#else - dictMaxSize = std::min(dictMaxSize + 1, (uint32_t)MAXPLTSIZE); -#endif } else { @@ -2793,17 +2543,10 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, } const int plt_lambda_shift = (compBegin > 0) ? pcmShiftRight_C : pcmShiftRight_L; double bitCost = m_pcRdCost->getLambda() / (double) (1 << (2 * plt_lambda_shift)) * numColorBits; -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX bool reuseflag[MAXPLTPREDSIZE] = { false }; int run; double reuseflagCost; -#endif -#if JVET_Q0504_PLT_NON444 -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE for (int i = 0; i < maxPltSize; i++) -#else - for( int i = 0; i < MAXPLTSIZE; i++ ) -#endif { if( pelListSort[i].getCnt(MAX_NUM_COMPONENT) ) { @@ -2856,7 +2599,6 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, cost += (err * err) / (1 << (2 * pcmShiftRight_L)) * pelListSort[i].getCnt(comp); } } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX run = 0; for (int t2 = t; t2 >= 0; t2--) { @@ -2871,7 +2613,6 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, } reuseflagCost = m_pcRdCost->getLambda() / (double)(1 << (2 * plt_lambda_shift)) * getEpExGolombNumBins(run ? run + 1 : run, 0); cost += reuseflagCost; -#endif if( cost < bestCost ) { @@ -2885,9 +2626,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, { cu.curPLT[comp][paletteSize] = cs.prevPLT.curPLT[comp][best]; } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX reuseflag[best] = true; -#endif } } @@ -2935,124 +2674,9 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, break; } } -#else -#if JVET_Q0291_REDUCE_DUALTREE_PLT_SIZE -for (int i = 0; i < maxPltSize; i++) -#else - for (int i = 0; i < MAXPLTSIZE; i++) -#endif - { - if (pelListSort[i].getCnt()) - { - int half = pelListSort[i].getCnt() >> 1; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - cu.curPLT[comp][paletteSize] = (pelListSort[i].getSumData(comp) + half) / pelListSort[i].getCnt(); - } - - int best = -1; - if (errorLimit) - { - double pal[MAX_NUM_COMPONENT], err = 0.0, bestCost = 0.0; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - pal[comp] = pelListSort[i].getSumData(comp) / (double)pelListSort[i].getCnt(); - err = pal[comp] - cu.curPLT[comp][paletteSize]; - if (isChroma((ComponentID) comp)) - { - bestCost += (err * err * PLT_CHROMA_WEIGHTING) / (1 << (2 * pcmShiftRight_C)); - } - else - { - bestCost += (err * err) / (1 << (2 * pcmShiftRight_L)); - } - } - bestCost = bestCost * pelListSort[i].getCnt() + bitCost; - - for (int t = 0; t < cs.prevPLT.curPLTSize[compBegin]; t++) - { - double cost = 0.0; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - err = pal[comp] - cs.prevPLT.curPLT[comp][t]; - if (isChroma((ComponentID) comp)) - { - cost += (err * err * PLT_CHROMA_WEIGHTING) / (1 << (2 * pcmShiftRight_C)); - } - else - { - cost += (err * err) / (1 << (2 * pcmShiftRight_L)); - } - } - cost *= pelListSort[i].getCnt(); -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX - run = 0; - for (int t2 = t-1; t2 >= 0; t2--) - { - if (!reuseflag[t2]) - { - run++; - } - else - { - break; - } - } - reuseflagCost = m_pcRdCost->getLambda() / (double)(1 << (2 * plt_lambda_shift)) * getEpExGolombNumBins(run ? run + 1 : run, 0); - cost += reuseflagCost; -#endif - if (cost < bestCost) - { - best = t; - bestCost = cost; - } - } - if (best != -1) - { - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - cu.curPLT[comp][paletteSize] = cs.prevPLT.curPLT[comp][best]; - } -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX - reuseflag[best] = true; -#endif - } - } - - bool duplicate = false; - if (pelListSort[i].getCnt() == 1 && best == -1) - { - duplicate = true; - } - else - { - for (int t = 0; t<paletteSize; t++) - { - bool duplicateTmp = true; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - duplicateTmp = duplicateTmp && (cu.curPLT[comp][paletteSize] == cu.curPLT[comp][t]); - } - if (duplicateTmp) - { - duplicate = true; - break; - } - } - } - if (!duplicate) paletteSize++; - } - else - { - break; - } - } -#endif cu.curPLTSize[compBegin] = paletteSize; -#if JVET_Q0504_PLT_NON444 if( cu.isLocalSepTree() ) cu.curPLTSize[COMPONENT_Y] = paletteSize; -#endif delete[] pelList; delete[] pelListSort; @@ -3083,15 +2707,6 @@ void IntraSearch::xEncIntraHeader( CodingStructure &cs, Partitioner &partitioner { return; } -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - m_CABACEstimator->bdpcm_mode ( cu, ComponentID(partitioner.chType) ); -#if JVET_Q0438_MONOCHROME_BUGFIXES - if (!CS::isDualITree(cs) && isLuma(partitioner.chType) && isChromaEnabled(cu.chromaFormat)) -#else - if (!CS::isDualITree(cs) && isLuma(partitioner.chType)) -#endif - m_CABACEstimator->bdpcm_mode(cu, ComponentID(CHANNEL_TYPE_CHROMA)); -#endif } PredictionUnit &pu = *cs.getPU(partitioner.currArea().lumaPos(), partitioner.chType); @@ -3101,9 +2716,7 @@ void IntraSearch::xEncIntraHeader( CodingStructure &cs, Partitioner &partitioner { if ( !cu.Y().valid()) m_CABACEstimator->pred_mode( cu ); -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 m_CABACEstimator->bdpcm_mode( cu, COMPONENT_Y ); -#endif m_CABACEstimator->intra_luma_pred_mode( pu ); } } @@ -3116,9 +2729,7 @@ void IntraSearch::xEncIntraHeader( CodingStructure &cs, Partitioner &partitioner if( isFirst ) { -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 m_CABACEstimator->bdpcm_mode( cu, ComponentID(CHANNEL_TYPE_CHROMA) ); -#endif m_CABACEstimator->intra_chroma_pred_mode( pu ); } } @@ -3134,9 +2745,6 @@ void IntraSearch::xEncSubdivCbfQT( CodingStructure &cs, Partitioner &partitioner const bool subdiv = currTU.depth > currDepth; ComponentID compID = partitioner.chType == CHANNEL_TYPE_LUMA ? COMPONENT_Y : COMPONENT_Cb; -#if !JVET_Q0438_MONOCHROME_BUGFIXES - const bool chromaCbfISP = currArea.blocks[COMPONENT_Cb].valid() && currCU.ispMode && !subdiv; -#endif if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { @@ -3147,14 +2755,10 @@ void IntraSearch::xEncSubdivCbfQT( CodingStructure &cs, Partitioner &partitioner CHECK( subdiv && !currCU.ispMode && isLuma( compID ), "No TU subdivision is allowed with QTBT" ); } -#if JVET_Q0438_MONOCHROME_BUGFIXES if (bChroma) { const bool chromaCbfISP = currArea.blocks[COMPONENT_Cb].valid() && currCU.ispMode && !subdiv; if ( !currCU.ispMode || chromaCbfISP ) -#else - if( bChroma && ( !currCU.ispMode || chromaCbfISP ) ) -#endif { const uint32_t numberValidComponents = getNumberValidComponents(currArea.chromaFormat); const uint32_t cbfDepth = ( chromaCbfISP ? currDepth - 1 : currDepth ); @@ -3171,9 +2775,7 @@ void IntraSearch::xEncSubdivCbfQT( CodingStructure &cs, Partitioner &partitioner } } } -#if JVET_Q0438_MONOCHROME_BUGFIXES } -#endif if (subdiv) { @@ -3273,12 +2875,6 @@ void IntraSearch::xEncCoeffQT( CodingStructure &cs, Partitioner &partitioner, co const int cbfMask = ( TU::getCbf( currTU, COMPONENT_Cb ) ? 2 : 0 ) + ( TU::getCbf( currTU, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->joint_cb_cr( currTU, cbfMask ); } -#if !REMOVE_PPS_REXT - if( TU::hasCrossCompPredInfo( currTU, compID ) ) - { - m_CABACEstimator->cross_comp_pred( currTU, compID ); - } -#endif if( TU::getCbf( currTU, compID ) ) { if( isLuma(compID) ) @@ -3340,12 +2936,6 @@ uint64_t IntraSearch::xGetIntraFracBitsQTSingleChromaComponent( CodingStructure const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbfAtDepth( currTU, COMPONENT_Cb, partitioner.currTrDepth ) : false ); m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, partitioner.currTrDepth ), currArea.blocks[compID], partitioner.currTrDepth - 1, prevCbf ); //coeffs coding and cross comp coding -#if !REMOVE_PPS_REXT - if( TU::hasCrossCompPredInfo( currTU, compID ) ) - { - m_CABACEstimator->cross_comp_pred( currTU, compID ); - } -#endif if( TU::getCbf( currTU, compID ) ) { m_CABACEstimator->residual_coding( currTU, compID ); @@ -3358,12 +2948,6 @@ uint64_t IntraSearch::xGetIntraFracBitsQTSingleChromaComponent( CodingStructure uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const ComponentID &compID) { m_CABACEstimator->resetBits(); -#if !REMOVE_PPS_REXT - if( TU::hasCrossCompPredInfo( currTU, compID ) ) - { - m_CABACEstimator->cross_comp_pred( currTU, compID ); - } -#endif // Include Cbf and jointCbCr flags here as we make decisions across components CodingStructure &cs = *currTU.cs; @@ -3402,11 +2986,7 @@ uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const Com return fracBits; } -#if !REMOVE_PPS_REXT -void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &compID, const bool &checkCrossCPrediction, Distortion& ruiDist, const int &default0Save1Load2, uint32_t* numSig, std::vector<TrMode>* trModes, const bool loadTr) -#else void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &compID, Distortion& ruiDist, const int &default0Save1Load2, uint32_t* numSig, std::vector<TrMode>* trModes, const bool loadTr) -#endif { if (!tu.blocks[compID].valid()) { @@ -3418,9 +2998,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp const CompArea &area = tu.blocks[compID]; const SPS &sps = *cs.sps; -#if !REMOVE_PPS_REXT - const PPS &pps = *cs.pps; -#endif const ChannelType chType = toChannelType(compID); const int bitDepth = sps.getBitDepth(chType); @@ -3428,29 +3005,18 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp PelBuf piOrg = cs.getOrgBuf (area); PelBuf piPred = cs.getPredBuf (area); PelBuf piResi = cs.getResiBuf (area); -#if !REMOVE_PPS_REXT - PelBuf piOrgResi = cs.getOrgResiBuf(area); -#endif PelBuf piReco = cs.getRecoBuf (area); const PredictionUnit &pu = *cs.getPU(area.pos(), chType); const uint32_t uiChFinalMode = PU::getFinalIntraMode(pu, chType); -#if !REMOVE_PPS_REXT - const bool bUseCrossCPrediction = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma( compID ) && PU::isChromaIntraModeCrossCheckMode( pu ) && checkCrossCPrediction; - const bool ccUseRecoResi = m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate(); -#endif //===== init availability pattern ===== CHECK( tu.jointCbCr && compID == COMPONENT_Cr, "wrong combination of compID and jointCbCr" ); bool jointCbCr = tu.jointCbCr && compID == COMPONENT_Cb; -#if JVET_Q0695_CHROMA_TS_JCCR || JVET_Q0820_ACT if (compID == COMPONENT_Y) -#else - if (compID == COMPONENT_Y || (isChroma(compID) && tu.cu->bdpcmModeChroma)) -#endif { PelBuf sharedPredTS( m_pSharedPredTransformSkip[compID], area ); if( default0Save1Load2 != 2 ) @@ -3524,20 +3090,12 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp //DTRACE_PEL_BUF( D_PRED, piPred, tu, tu.cu->predMode, COMPONENT_Y ); const Slice &slice = *cs.slice; -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#else - bool flag = slice.getPicHeader()->getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#endif if (isLuma(compID)) { //===== get residual signal ===== piResi.copyFrom( piOrg ); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#endif { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); @@ -3550,21 +3108,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp piResi.subtract( piPred ); } -#if !REMOVE_PPS_REXT - if (pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isLuma(compID)) - { - piOrgResi.copyFrom (piResi); - } - - if (bUseCrossCPrediction) - { - if (xCalcCrossComponentPredictionAlpha(tu, compID, ccUseRecoResi) == 0) - { - return; - } - CrossComponentPrediction::crossComponentPrediction(tu, compID, cs.getResiBuf(tu.Y()), piResi, piResi, false); - } -#endif } //===== transform and quantization ===== @@ -3586,7 +3129,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cResScale*cResScale)); } -#if JVET_Q0438_MONOCHROME_BUGFIXES PelBuf crOrg; PelBuf crPred; PelBuf crResi; @@ -3600,13 +3142,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp crResi = cs.getResiBuf ( crArea ); crReco = cs.getRecoBuf ( crArea ); } -#else - const CompArea &crArea = tu.blocks [ COMPONENT_Cr ]; - PelBuf crOrg = cs.getOrgBuf ( crArea ); - PelBuf crPred = cs.getPredBuf ( crArea ); - PelBuf crResi = cs.getResiBuf ( crArea ); - PelBuf crReco = cs.getRecoBuf ( crArea ); -#endif if ( jointCbCr ) { @@ -3627,14 +3162,10 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp m_pcTrQuant->transformNxN(tu, compID, cQP, trModes, m_pcEncCfg->getMTSIntraMaxCand()); tu.mtsIdx[compID] = trModes->at(0).first; } -#if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0 ) || tu.cu->bdpcmMode != 0 ) { m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); } -#else - m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); -#endif DTRACE( g_trace_ctx, D_TU_ABS_SUM, "%d: comp=%d, abssum=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_TU_ABS_SUM ), compID, uiAbsSum ); @@ -3646,14 +3177,12 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp return; } -#if JVET_AHG14_LOSSLESS if( ( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0 ) && 0 == tu.cu->bdpcmMode ) { uiAbsSum = 0; tu.getCoeffs( compID ).fill( 0 ); TU::setCbfAtDepth( tu, compID, tu.depth, 0 ); } -#endif //--- inverse transform --- if (uiAbsSum > 0) @@ -3682,36 +3211,25 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp if (trModes) { -#if JVET_Q0695_CHROMA_TS_JCCR m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, trModes, m_pcEncCfg->getMTSIntraMaxCand()); tu.mtsIdx[codeCompId] = trModes->at(0).first; if (tu.jointCbCr) { tu.mtsIdx[(codeCompId == COMPONENT_Cr) ? COMPONENT_Cb : COMPONENT_Cr] = MTS_DCT2_DCT2; } -#else - m_pcTrQuant->transformNxN(tu, compID, qpCbCr, trModes, m_pcEncCfg->getMTSIntraMaxCand()); - tu.mtsIdx[compID] = trModes->at(0).first; -#endif } // encoder bugfix: Set loadTr to aovid redundant transform process -#if JVET_AHG14_LOSSLESS if (!(m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0) || tu.cu->bdpcmModeChroma != 0) { m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); } -#else - m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); -#endif -#if JVET_AHG14_LOSSLESS if ((m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0) && 0 == tu.cu->bdpcmModeChroma) { uiAbsSum = 0; tu.getCoeffs(compID).fill(0); TU::setCbfAtDepth(tu, compID, tu.depth, 0); } -#endif DTRACE( g_trace_ctx, D_TU_ABS_SUM, "%d: comp=%d, abssum=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_TU_ABS_SUM ), codeCompId, uiAbsSum ); if( uiAbsSum > 0 ) @@ -3750,22 +3268,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp crResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(COMPONENT_Cr)); } } -#if !REMOVE_PPS_REXT - if (bUseCrossCPrediction) - { - CrossComponentPrediction::crossComponentPrediction(tu, compID, cs.getResiBuf(tu.Y()), piResi, piResi, true); - if( jointCbCr ) - { - CrossComponentPrediction::crossComponentPrediction(tu, COMPONENT_Cr, cs.getResiBuf(tu.Y()), crResi, crResi, true); - } - } -#endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#endif { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0,0), area.size()); PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); @@ -3784,13 +3288,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp //===== update distortion ===== #if WCG_EXT -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() && slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() - && slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#endif { const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) @@ -3845,9 +3344,7 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c m_pcRdCost->setChromaFormat(cs.sps->getChromaFormatIdc()); -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif m_pcTrQuant->lambdaAdjustColorTrans(true); if (jointCbCr) @@ -3860,11 +3357,7 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c m_pcTrQuant->selectLambda(compID); } -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())) && (tu.blocks[compID].width*tu.blocks[compID].height > 4); -#else - bool flag = slice.getPicHeader()->getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())) && (tu.blocks[compID].width*tu.blocks[compID].height > 4); -#endif if (flag && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag()) { int cResScaleInv = tu.getChromaAdj(); @@ -3887,32 +3380,20 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c if (isLuma(compID)) { QpParam cQP(tu, compID); -#if !JVET_Q0820_ACT - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - cQP.Qps[qpIdx] = cQP.Qps[qpIdx] + (compID == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); - cQP.pers[qpIdx] = cQP.Qps[qpIdx] / 6; - cQP.rems[qpIdx] = cQP.Qps[qpIdx] % 6; - } -#endif if (trModes) { m_pcTrQuant->transformNxN(tu, compID, cQP, trModes, m_pcEncCfg->getMTSIntraMaxCand()); tu.mtsIdx[compID] = trModes->at(0).first; } -#if JVET_Q0820_ACT if (!(m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0) || tu.cu->bdpcmMode != 0) -#endif m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); -#if JVET_Q0820_ACT if ((m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0) && tu.cu->bdpcmMode == 0) { uiAbsSum = 0; tu.getCoeffs(compID).fill(0); TU::setCbfAtDepth(tu, compID, tu.depth, 0); } -#endif if (uiAbsSum > 0) { @@ -3928,14 +3409,6 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c int codedCbfMask = 0; ComponentID codeCompId = (tu.jointCbCr ? (tu.jointCbCr >> 1 ? COMPONENT_Cb : COMPONENT_Cr) : compID); QpParam qpCbCr(tu, codeCompId); -#if !JVET_Q0820_ACT - for (int qpIdx = 0; qpIdx < 2; qpIdx++) - { - qpCbCr.Qps[qpIdx] = qpCbCr.Qps[qpIdx] + (codeCompId == COMPONENT_Cr ? DELTA_QP_FOR_Co : DELTA_QP_FOR_Y_Cg); - qpCbCr.pers[qpIdx] = qpCbCr.Qps[qpIdx] / 6; - qpCbCr.rems[qpIdx] = qpCbCr.Qps[qpIdx] % 6; - } -#endif if (tu.jointCbCr) { @@ -3946,7 +3419,6 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c PelBuf& codeResi = (codeCompId == COMPONENT_Cr ? crResi : piResi); uiAbsSum = 0; -#if JVET_Q0820_ACT if (trModes) { m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, trModes, m_pcEncCfg->getMTSIntraMaxCand()); @@ -3960,9 +3432,6 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c { m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); } -#else - m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, uiAbsSum, m_CABACEstimator->getCtx()); -#endif if (uiAbsSum > 0) { m_pcTrQuant->invTransformNxN(tu, codeCompId, codeResi, qpCbCr); @@ -3983,9 +3452,7 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c if (tu.jointCbCr != codedCbfMask) { ruiDist = std::numeric_limits<Distortion>::max(); -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif m_pcTrQuant->lambdaAdjustColorTrans(false); return; } @@ -4003,9 +3470,7 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c } } -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif m_pcTrQuant->lambdaAdjustColorTrans(false); ruiDist += m_pcRdCost->getDistPart(piOrgResi, piResi, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE); @@ -4042,11 +3507,7 @@ bool IntraSearch::xIntraCodingLumaISP(CodingStructure& cs, Partitioner& partitio tu.depth = partitioner.currTrDepth; // Encode TU -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock(tu, COMPONENT_Y, false, singleDistTmpLuma, 0, &numSig); -#else xIntraCodingTUBlock(tu, COMPONENT_Y, singleDistTmpLuma, 0, &numSig); -#endif if (singleDistTmpLuma == MAX_INT) // all zero CBF skip { earlySkipISP = true; @@ -4139,10 +3600,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par bool earlySkipISP = false; uint32_t currDepth = partitioner.currTrDepth; const SPS &sps = *cs.sps; -#if !REMOVE_PPS_REXT - const PPS &pps = *cs.pps; - const bool keepResi = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() || KEEP_PRED_AND_RESI_SIGNALS; -#endif bool bCheckFull = true; bool bCheckSplit = false; bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); @@ -4211,7 +3668,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { nNumTransformCands = 1 + ( tsAllowed ? 1 : 0 ) + ( mtsAllowed ? 4 : 0 ); // DCT + TS + 4 MTS = 6 tests -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING) { nNumTransformCands = 1; @@ -4227,7 +3683,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } else { -#endif trModes.push_back( TrMode( 0, true ) ); //DCT2 if( tsAllowed ) { @@ -4240,9 +3695,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par trModes.push_back( TrMode( i, true ) ); } } -#if JVET_Q0820_ACT } -#endif } CHECK( !tu.Y().valid(), "Invalid TU" ); @@ -4293,10 +3746,8 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } else { -#if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING ) ) { -#endif if( !cbfDCT2 || ( m_pcEncCfg->getUseTransformSkipFast() && bestModeId[ COMPONENT_Y ] == MTS_SKIP)) { break; @@ -4310,9 +3761,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { continue; } -#if JVET_AHG14_LOSSLESS } -#endif tu.mtsIdx[COMPONENT_Y] = trModes[modeId].first; } @@ -4380,11 +3829,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par if( !cu.mtsFlag && checkTransformSkip ) { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig, modeId == 0 ? &trModes : nullptr, true ); -#else xIntraCodingTUBlock( tu, COMPONENT_Y, singleDistTmpLuma, default0Save1Load2, &numSig, modeId == 0 ? &trModes : nullptr, true ); -#endif if( modeId == 0 ) { for( int i = 0; i < 2; i++ ) @@ -4398,22 +3843,14 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } else { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig ); -#else xIntraCodingTUBlock( tu, COMPONENT_Y, singleDistTmpLuma, default0Save1Load2, &numSig ); -#endif } } else { if( nNumTransformCands > 1 ) { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig, modeId == 0 ? &trModes : nullptr, true ); -#else xIntraCodingTUBlock( tu, COMPONENT_Y, singleDistTmpLuma, default0Save1Load2, &numSig, modeId == 0 ? &trModes : nullptr, true ); -#endif if( modeId == 0 ) { for( int i = 0; i < nNumTransformCands; i++ ) @@ -4427,32 +3864,22 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } else { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig ); -#else xIntraCodingTUBlock( tu, COMPONENT_Y, singleDistTmpLuma, default0Save1Load2, &numSig ); -#endif } } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif //----- determine rate and r-d cost ----- if( ( sps.getUseLFNST() ? ( modeId == lastCheckId && modeId != 0 && checkTransformSkip ) : ( trModes[ modeId ].first != 0 ) ) && !TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ) ) { //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif singleCostTmp = MAX_DOUBLE; -#if JVET_Q0820_ACT else { singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, subTuCounter, ispType, &cuCtx); singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma); } -#endif } else { @@ -4464,7 +3891,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { singleTmpFracBits = xGetIntraFracBitsQT( *csFull, partitioner, true, false, subTuCounter, ispType, &cuCtx ); } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (tu.mtsIdx[COMPONENT_Y] > MTS_SKIP) { if (!cuCtx.mtsLastScanPos) @@ -4477,7 +3903,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } } else -#endif singleCostTmp = m_pcRdCost->calcRdCost( singleTmpFracBits, singleDistTmpLuma ); } @@ -4513,11 +3938,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par saveCS.getPredBuf( tu.Y() ).copyFrom( csFull->getPredBuf( tu.Y() ) ); saveCS.getRecoBuf( tu.Y() ).copyFrom( csFull->getRecoBuf( tu.Y() ) ); -#if !REMOVE_PPS_REXT - if( keepResi ) -#else if( KEEP_PRED_AND_RESI_SIGNALS ) -#endif { saveCS.getResiBuf ( tu.Y() ).copyFrom( csFull->getResiBuf ( tu.Y() ) ); saveCS.getOrgResiBuf( tu.Y() ).copyFrom( csFull->getOrgResiBuf( tu.Y() ) ); @@ -4546,11 +3967,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par csFull->getPredBuf( tu.Y() ).copyFrom( saveCS.getPredBuf( tu.Y() ) ); csFull->getRecoBuf( tu.Y() ).copyFrom( saveCS.getRecoBuf( tu.Y() ) ); -#if !REMOVE_PPS_REXT - if( keepResi ) -#else if( KEEP_PRED_AND_RESI_SIGNALS ) -#endif { csFull->getResiBuf ( tu.Y() ).copyFrom( saveCS.getResiBuf ( tu.Y() ) ); csFull->getOrgResiBuf( tu.Y() ).copyFrom( saveCS.getOrgResiBuf( tu.Y() ) ); @@ -4663,9 +4080,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; cuCtx.lfnstLastScanPos = false; cuCtx.violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif //----- determine rate and r-d cost ----- csSplit->fracBits = xGetIntraFracBitsQT( *csSplit, partitioner, true, false, cu.ispMode ? 0 : -1, ispType, &cuCtx ); @@ -4768,11 +4183,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } piResi.copyFrom(piOrg); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#else - if (slice.getPicHeader()->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) -#endif { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); @@ -4784,11 +4195,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti piResi.subtract(piPred); } -#if JVET_Q0820_ACT resiBuf.colorSpaceConvert(orgResiBuf, true, cs.slice->clpRng(COMPONENT_Y)); -#else - resiBuf.colorSpaceConvert(orgResiBuf, true); -#endif // 2. luma residual optimization double dSingleCostLuma = MAX_DOUBLE; @@ -4815,7 +4222,6 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } else { -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING) { nNumTransformCands = 1; @@ -4831,7 +4237,6 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } else { -#endif nNumTransformCands = 1 + (tsAllowed ? 1 : 0) + (mtsAllowed ? 4 : 0); // DCT + TS + 4 MTS = 6 tests trModes.push_back(TrMode(0, true)); //DCT2 @@ -4846,9 +4251,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti trModes.push_back(TrMode(i, true)); } } -#if JVET_Q0820_ACT } -#endif } CodingStructure &saveLumaCS = *m_pSaveCS[0]; @@ -4873,16 +4276,10 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti bool cbfBestModeValid = false; bool cbfDCT2 = true; -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif m_pcRdCost->lambdaAdjustColorTrans(true, COMPONENT_Y); -#if JVET_Q0820_ACT for (int modeId = firstCheckId; modeId <= ((m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING) ? (nNumTransformCands - 1) : lastCheckId); modeId++) -#else - for (int modeId = firstCheckId; modeId <= lastCheckId; modeId++) -#endif { uint8_t transformIndex = modeId; csFull->getResiBuf(tu.Y()).copyFrom(csFull->getOrgResiBuf(tu.Y())); @@ -4903,10 +4300,8 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } else { -#if JVET_AHG14_LOSSLESS if (!(m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING)) { -#endif if (!cbfDCT2 || (m_pcEncCfg->getUseTransformSkipFast() && bestLumaModeId == 1)) { break; @@ -4915,9 +4310,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti { continue; } -#if JVET_AHG14_LOSSLESS } -#endif tu.mtsIdx[COMPONENT_Y] = trModes[modeId].first; } @@ -4994,30 +4387,23 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND CUCtx cuCtx; cuCtx.isDQPCoded = true; cuCtx.isChromaQpAdjCoded = true; -#endif //----- determine rate and r-d cost ----- if ((sps.getUseLFNST() ? (modeId == lastCheckId && modeId != 0 && checkTransformSkip) : (trModes[modeId].first != 0)) && !TU::getCbfAtDepth(tu, COMPONENT_Y, currDepth)) { //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif singleCostTmp = MAX_DOUBLE; -#if JVET_Q0820_ACT else { singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, -1, TU_NO_ISP); singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma, false); } -#endif } else { -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, -1, TU_NO_ISP, &cuCtx); if (tu.mtsIdx[COMPONENT_Y] > MTS_SKIP) @@ -5028,22 +4414,11 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } else { -#if JVET_Q0820_ACT singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma, false); -#else - singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma); -#endif } } else -#else - singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, -1, TU_NO_ISP); -#endif -#if JVET_Q0820_ACT singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma, false); -#else - singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma); -#endif } if (singleCostTmp < dSingleCostLuma) @@ -5075,9 +4450,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } } -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif m_pcRdCost->lambdaAdjustColorTrans(false, COMPONENT_Y); if (sps.getUseLFNST()) @@ -5114,17 +4487,9 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti CompArea& cbArea = tu.blocks[COMPONENT_Cb]; CompArea& crArea = tu.blocks[COMPONENT_Cr]; -#if !JVET_Q0820_ACT - ctxStart = m_CABACEstimator->getCtx(); - m_CABACEstimator->resetBits(); -#endif tu.jointCbCr = 0; -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool doReshaping = (slice.getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (slice.isIntra() || m_pcReshape->getCTUFlag()) && (cbArea.width * cbArea.height > 4)); -#else - bool doReshaping = (slice.getPicHeader()->getLmcsEnabledFlag() && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (slice.isIntra() || m_pcReshape->getCTUFlag()) && (cbArea.width * cbArea.height > 4)); -#endif if (doReshaping) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); @@ -5152,14 +4517,9 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti for (uint32_t c = COMPONENT_Cb; c < ::getNumberValidTBlocks(*csFull->pcv); c++) { const ComponentID compID = ComponentID(c); -#if JVET_Q0820_ACT double dSingleBestCostChroma = MAX_DOUBLE; int bestModeId = -1; -#if JVET_Q0784_LFNST_COMBINATION bool tsAllowed = TU::isTSAllowed(tu, compID) && (m_pcEncCfg->getUseChromaTS()) && !cu.lfnstIdx; -#else - bool tsAllowed = TU::isTSAllowed(tu, compID) && (m_pcEncCfg->getUseChromaTS()); -#endif uint8_t numTransformCands = 1 + (tsAllowed ? 1 : 0); // DCT + TS = 2 tests bool cbfDCT2 = true; @@ -5213,17 +4573,13 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } tu.mtsIdx[compID] = trModes[modeId].first; -#endif Distortion singleDistChroma = 0; -#if JVET_Q0820_ACT if (numTransformCands > 1) { xIntraCodingACTTUBlock(tu, compID, singleDistChroma, modeId == 0 ? &trModes : nullptr, true); } else -#endif xIntraCodingACTTUBlock(tu, compID, singleDistChroma); -#if JVET_Q0820_ACT if (!tu.mtsIdx[compID]) { cbfDCT2 = TU::getCbfAtDepth(tu, compID, currDepth); @@ -5252,20 +4608,13 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) m_pcRdCost->lambdaAdjustColorTrans(false, compID); -#else - xGetIntraFracBitsQTChroma(tu, compID); -#endif } Position tuPos = tu.Y(); tuPos.relativeTo(cu.Y()); const UnitArea relativeUnitArea(tu.chromaFormat, Area(tuPos, tu.Y().size())); PelUnitBuf invColorTransResidual = m_colorTransResiBuf.getBuf(relativeUnitArea); -#if JVET_Q0820_ACT csFull->getResiBuf(tu).colorSpaceConvert(invColorTransResidual, false, cs.slice->clpRng(COMPONENT_Y)); -#else - csFull->getResiBuf(tu).colorSpaceConvert(invColorTransResidual, false); -#endif Distortion totalDist = 0; for (uint32_t c = COMPONENT_Y; c < ::getNumberValidTBlocks(*csFull->pcv); c++) @@ -5279,13 +4628,8 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti piReco.reconstruct(piPred, piResi, cs.slice->clpRng(compID)); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() & slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() - & slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#endif { const CPelBuf orgLuma = csFull->getOrgBuf(csFull->area.blocks[COMPONENT_Y]); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) @@ -5333,22 +4677,11 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti for (int cbfMask : jointCbfMasksToTest) { -#if !JVET_Q0512_ENC_CHROMA_TS_ACT - m_CABACEstimator->getCtx() = ctxStart; - m_CABACEstimator->resetBits(); - - Distortion distTmp = 0; -#endif tu.jointCbCr = (uint8_t)cbfMask; -#if JVET_Q0512_ENC_CHROMA_TS_ACT ComponentID codeCompId = ((cbfMask >> 1) ? COMPONENT_Cb : COMPONENT_Cr); ComponentID otherCompId = ((codeCompId == COMPONENT_Cb) ? COMPONENT_Cr : COMPONENT_Cb); -#if JVET_Q0784_LFNST_COMBINATION bool tsAllowed = TU::isTSAllowed(tu, codeCompId) && (m_pcEncCfg->getUseChromaTS()) && !cu.lfnstIdx; -#else - bool tsAllowed = TU::isTSAllowed(tu, codeCompId) && (m_pcEncCfg->getUseChromaTS()); -#endif uint8_t numTransformCands = 1 + (tsAllowed ? 1 : 0); // DCT + TS = 2 tests bool cbfDCT2 = true; @@ -5373,33 +4706,24 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti tu.mtsIdx[codeCompId] = trModes[modeId].first; tu.mtsIdx[otherCompId] = MTS_DCT2_DCT2; m_CABACEstimator->getCtx() = ctxStart; -#endif csFull->getResiBuf(cbArea).copyFrom(orgResiCb[cbfMask]); csFull->getResiBuf(crArea).copyFrom(orgResiCr[cbfMask]); -#if JVET_Q0512_ENC_CHROMA_TS_ACT if (nNumTransformCands > 1) { xIntraCodingACTTUBlock(tu, COMPONENT_Cb, distTmp, modeId == 0 ? &trModes : nullptr, true); } else -#endif xIntraCodingACTTUBlock(tu, COMPONENT_Cb, distTmp); double costTmp = std::numeric_limits<double>::max(); uint64_t bitsTmp = 0; if (distTmp < std::numeric_limits<Distortion>::max()) { -#if JVET_Q0512_ENC_CHROMA_TS_ACT if (!tu.mtsIdx[codeCompId]) { cbfDCT2 = true; } -#endif -#if JVET_Q0820_ACT csFull->getResiBuf(tu).colorSpaceConvert(invColorTransResidual, false, csFull->slice->clpRng(COMPONENT_Y)); -#else - csFull->getResiBuf(tu).colorSpaceConvert(invColorTransResidual, false); -#endif distTmp = 0; for (uint32_t c = COMPONENT_Y; c < ::getNumberValidTBlocks(*csFull->pcv); c++) { @@ -5411,13 +4735,8 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti PelBuf piResi = invColorTransResidual.bufs[compID]; piReco.reconstruct(piPred, piResi, cs.slice->clpRng(compID)); -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() & slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#else - if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() - & slice.getPicHeader()->getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#endif { const CPelBuf orgLuma = csFull->getOrgBuf(csFull->area.blocks[COMPONENT_Y]); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) @@ -5442,12 +4761,10 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti bitsTmp = xGetIntraFracBitsQT(*csFull, partitioner, true, true, -1, TU_NO_ISP); costTmp = m_pcRdCost->calcRdCost(bitsTmp, distTmp); } -#if JVET_Q0512_ENC_CHROMA_TS_ACT else if (!tu.mtsIdx[codeCompId]) { cbfDCT2 = false; } -#endif if (costTmp < bestCostJointCbCr) { @@ -5455,11 +4772,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti bestDistJointCbCr = distTmp; bestBitsJointCbCr = bitsTmp; bestJointCbCr = tu.jointCbCr; -#if JVET_Q0512_ENC_CHROMA_TS_ACT lastIsBest = (cbfMask == jointCbfMasksToTest.back() && modeId == (numTransformCands - 1)); -#else - lastIsBest = (cbfMask == jointCbfMasksToTest.back()); -#endif // store data if (!lastIsBest) @@ -5473,9 +4786,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti ctxBest = m_CABACEstimator->getCtx(); } } -#if JVET_Q0512_ENC_CHROMA_TS_ACT } -#endif } if (!lastIsBest) @@ -5581,9 +4892,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio bool lumaUsesISP = false; uint32_t currDepth = partitioner.currTrDepth; -#if !REMOVE_PPS_REXT - const PPS &pps = *cs.pps; -#endif ChromaCbfs cbfs ( false ); if (currDepth == currTU.depth) @@ -5664,13 +4972,8 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio resiCr.subtract( piPredCr ); //----- get reshape parameter ---- -#if JVET_Q0346_LMCS_ENABLE_IN_SH bool doReshaping = ( cs.slice->getLmcsEnabledFlag() && cs.picHeader->getLmcsChromaResidualScaleFlag() && (cs.slice->isIntra() || m_pcReshape->getCTUFlag()) && (cbArea.width * cbArea.height > 4) ); -#else - bool doReshaping = ( cs.picHeader->getLmcsEnabledFlag() && cs.picHeader->getLmcsChromaResidualScaleFlag() - && (cs.slice->isIntra() || m_pcReshape->getCTUFlag()) && (cbArea.width * cbArea.height > 4) ); -#endif if( doReshaping ) { const Area area = currTU.Y().valid() ? currTU.Y() : Area(recalcPosition(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].pos()), recalcSize(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].size())); @@ -5680,40 +4983,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio } //----- get cross component prediction parameters ----- -#if !REMOVE_PPS_REXT - bool checkCrossComponentPrediction = PU::isChromaIntraModeCrossCheckMode( pu ) && pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf( currTU, COMPONENT_Y ); - int compAlpha[MAX_NUM_COMPONENT] = { 0, 0, 0 }; - if( checkCrossComponentPrediction ) - { - compAlpha[COMPONENT_Cb] = xCalcCrossComponentPredictionAlpha( currTU, COMPONENT_Cb, m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate() ); - compAlpha[COMPONENT_Cr] = xCalcCrossComponentPredictionAlpha( currTU, COMPONENT_Cr, m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate() ); - if( compAlpha[COMPONENT_Cb] == 0 && compAlpha[COMPONENT_Cr] == 0 ) - { - checkCrossComponentPrediction = false; - } - } - //===== store original residual signals (std and crossCompPred) ===== - CompStorage orgResiCb[5], orgResiCr[5]; // 0:std, 1-3:jointCbCr (placeholder at this stage), 4:crossComp - for( int k = 0; k < (checkCrossComponentPrediction?5:1); k+=4 ) - { - orgResiCb[k].create( cbArea ); - orgResiCr[k].create( crArea ); - if( k >= 4 ) { - CrossComponentPrediction::crossComponentPrediction( currTU, COMPONENT_Cb, cs.getResiBuf(currTU.Y()), resiCb, orgResiCb[k], false); - CrossComponentPrediction::crossComponentPrediction( currTU, COMPONENT_Cr, cs.getResiBuf(currTU.Y()), resiCr, orgResiCr[k], false); - } else - { - orgResiCb[k].copyFrom( resiCb ); - orgResiCr[k].copyFrom( resiCr ); - } - if( doReshaping ) - { - int cResScaleInv = currTU.getChromaAdj(); - orgResiCb[k].scaleSignal( cResScaleInv, 1, currTU.cu->cs->slice->clpRng(COMPONENT_Cb) ); - orgResiCr[k].scaleSignal( cResScaleInv, 1, currTU.cu->cs->slice->clpRng(COMPONENT_Cr) ); - } - } -#else //===== store original residual signals ===== CompStorage orgResiCb[4], orgResiCr[4]; // 0:std, 1-3:jointCbCr (placeholder at this stage) orgResiCb[0].create( cbArea ); @@ -5726,7 +4995,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio orgResiCb[0].scaleSignal( cResScaleInv, 1, currTU.cu->cs->slice->clpRng(COMPONENT_Cb) ); orgResiCr[0].scaleSignal( cResScaleInv, 1, currTU.cu->cs->slice->clpRng(COMPONENT_Cr) ); } -#endif for( uint32_t c = COMPONENT_Cb; c < numTBlocks; c++) { @@ -5737,17 +5005,9 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio int bestModeId = 0; Distortion singleDistCTmp = 0; double singleCostTmp = 0; -#if !REMOVE_PPS_REXT - const int crossCPredictionModesToTest = checkCrossComponentPrediction ? 2 : 1; -#endif -#if JVET_Q0784_LFNST_COMBINATION const bool tsAllowed = TU::isTSAllowed(currTU, compID) && m_pcEncCfg->getUseChromaTS() && !currTU.cu->lfnstIdx; -#else - const bool tsAllowed = TU::isTSAllowed(currTU, compID) && (m_pcEncCfg->getUseChromaTS()); -#endif uint8_t nNumTransformCands = 1 + (tsAllowed ? 1 : 0); // DCT + TS = 2 tests std::vector<TrMode> trModes; -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING) { nNumTransformCands = 1; @@ -5763,24 +5023,17 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio } else { -#endif trModes.push_back(TrMode(0, true)); // DCT2 if (tsAllowed) { trModes.push_back(TrMode(1, true));//TS } -#if JVET_Q0820_ACT } -#endif CHECK(!currTU.Cb().valid(), "Invalid TU"); -#if !REMOVE_PPS_REXT - const int totalModesToTest = crossCPredictionModesToTest * nNumTransformCands; -#else const int totalModesToTest = nNumTransformCands; -#endif bool cbfDCT2 = true; const bool isOneMode = false; maxModesTested = totalModesToTest > maxModesTested ? totalModesToTest : maxModesTested; @@ -5796,17 +5049,8 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio for (int modeId = 0; modeId < nNumTransformCands; modeId++) { -#if !REMOVE_PPS_REXT - for (int crossCPredictionModeId = 0; crossCPredictionModeId < crossCPredictionModesToTest; crossCPredictionModeId++) - { - resiCb.copyFrom( orgResiCb[4*crossCPredictionModeId] ); - resiCr.copyFrom( orgResiCr[4*crossCPredictionModeId] ); - - currTU.compAlpha [compID] = ( crossCPredictionModeId ? compAlpha[compID] : 0 ); -#else resiCb.copyFrom( orgResiCb[0] ); resiCr.copyFrom( orgResiCr[0] ); -#endif currTU.mtsIdx[compID] = currTU.cu->bdpcmModeChroma ? MTS_SKIP : trModes[modeId].first; currModeId++; @@ -5814,10 +5058,8 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio const bool isFirstMode = (currModeId == 1); const bool isLastMode = false; // Always store output to saveCS and tmpTU -#if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING ) ) { -#endif //if DCT2's cbf==0, skip ts search if (!cbfDCT2 && trModes[modeId].first == MTS_SKIP) { @@ -5827,9 +5069,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { continue; } -#if JVET_AHG14_LOSSLESS } -#endif if (!isFirstMode) // if not first mode to be tested { @@ -5840,38 +5080,22 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio if (nNumTransformCands > 1) { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock(currTU, compID, crossCPredictionModeId != 0, singleDistCTmp, default0Save1Load2, nullptr, modeId == 0 ? &trModes : nullptr, true); -#else xIntraCodingTUBlock(currTU, compID, singleDistCTmp, default0Save1Load2, nullptr, modeId == 0 ? &trModes : nullptr, true); -#endif } else { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock(currTU, compID, crossCPredictionModeId != 0, singleDistCTmp, default0Save1Load2); -#else xIntraCodingTUBlock(currTU, compID, singleDistCTmp, default0Save1Load2); -#endif } -#if !REMOVE_PPS_REXT - if (((crossCPredictionModeId == 1) && (currTU.compAlpha[compID] == 0)) || ((currTU.mtsIdx[compID] == MTS_SKIP && !currTU.cu->bdpcmModeChroma) && !TU::getCbf(currTU, compID))) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#else if (((currTU.mtsIdx[compID] == MTS_SKIP && !currTU.cu->bdpcmModeChroma) && !TU::getCbf(currTU, compID))) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#endif { -#if JVET_Q0820_ACT if (m_pcEncCfg->getCostMode() != COST_LOSSLESS_CODING) -#endif singleCostTmp = MAX_DOUBLE; -#if JVET_Q0820_ACT else { uint64_t fracBitsTmp = xGetIntraFracBitsQTChroma(currTU, compID); singleCostTmp = m_pcRdCost->calcRdCost(fracBitsTmp, singleDistCTmp); } -#endif } else if( lumaUsesISP && bestCostSoFar != MAX_DOUBLE && c == COMPONENT_Cb ) { @@ -5927,9 +5151,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio ctxBest = m_CABACEstimator->getCtx(); } } -#if !REMOVE_PPS_REXT - } -#endif } if( lumaUsesISP && dSingleCost > bestCostSoFar && c == COMPONENT_Cb ) @@ -5943,11 +5164,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio } // Done with one component of separate coding of Cr and Cb, just switch to the best Cb contexts if Cr coding is still to be done -#if JVET_Q0820_ACT if ((c == COMPONENT_Cb && bestModeId < totalModesToTest) || (c == COMPONENT_Cb && m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING)) -#else - if ( c == COMPONENT_Cb && bestModeId < totalModesToTest) -#endif { m_CABACEstimator->getCtx() = ctxBest; @@ -5961,15 +5178,11 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio double bestCostCbCr = bestCostCb + bestCostCr; Distortion bestDistCbCr = bestDistCb + bestDistCr; int bestJointCbCr = 0; -#if !JVET_Q0695_CHROMA_TS_JCCR - bool lastIsBest = false; -#endif std::vector<int> jointCbfMasksToTest; if ( cs.sps->getJointCbCrEnabledFlag() && (TU::getCbf(tmpTU, COMPONENT_Cb) || TU::getCbf(tmpTU, COMPONENT_Cr))) { jointCbfMasksToTest = m_pcTrQuant->selectICTCandidates(currTU, orgResiCb, orgResiCr); } -#if JVET_Q0695_CHROMA_TS_JCCR bool checkDCTOnly = (TU::getCbf(tmpTU, COMPONENT_Cb) && tmpTU.mtsIdx[COMPONENT_Cb] == MTS_DCT2_DCT2 && !TU::getCbf(tmpTU, COMPONENT_Cr)) || (TU::getCbf(tmpTU, COMPONENT_Cr) && tmpTU.mtsIdx[COMPONENT_Cr] == MTS_DCT2_DCT2 && !TU::getCbf(tmpTU, COMPONENT_Cb)) || (TU::getCbf(tmpTU, COMPONENT_Cb) && tmpTU.mtsIdx[COMPONENT_Cb] == MTS_DCT2_DCT2 && TU::getCbf(tmpTU, COMPONENT_Cr) && tmpTU.mtsIdx[COMPONENT_Cr] == MTS_DCT2_DCT2); @@ -5982,26 +5195,13 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { CHECK(!checkTSOnly || checkDCTOnly, "bdpcm only allows transform skip"); } -#endif for( int cbfMask : jointCbfMasksToTest ) { -#if !JVET_Q0695_CHROMA_TS_JCCR - Distortion distTmp = 0; -#endif currTU.jointCbCr = (uint8_t)cbfMask; -#if !REMOVE_PPS_REXT - currTU.compAlpha[COMPONENT_Cb] = 0; - currTU.compAlpha[COMPONENT_Cr] = 0; -#endif -#if JVET_Q0695_CHROMA_TS_JCCR ComponentID codeCompId = ((currTU.jointCbCr >> 1) ? COMPONENT_Cb : COMPONENT_Cr); ComponentID otherCompId = ((codeCompId == COMPONENT_Cb) ? COMPONENT_Cr : COMPONENT_Cb); -#if JVET_Q0784_LFNST_COMBINATION bool tsAllowed = TU::isTSAllowed(currTU, codeCompId) && (m_pcEncCfg->getUseChromaTS()) && !currTU.cu->lfnstIdx; -#else - bool tsAllowed = TU::isTSAllowed(currTU, codeCompId) && (m_pcEncCfg->getUseChromaTS()); -#endif uint8_t numTransformCands = 1 + (tsAllowed ? 1 : 0); // DCT + TS = 2 tests bool cbfDCT2 = true; @@ -6032,48 +5232,30 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio Distortion distTmp = 0; currTU.mtsIdx[codeCompId] = currTU.cu->bdpcmModeChroma ? MTS_SKIP : trModes[modeId].first; currTU.mtsIdx[otherCompId] = MTS_DCT2_DCT2; -#else - // encoder bugfix: initialize mtsIdx for chroma under JointCbCrMode. - currTU.mtsIdx[COMPONENT_Cb] = currTU.mtsIdx[COMPONENT_Cr] = MTS_DCT2_DCT2; -#endif m_CABACEstimator->getCtx() = ctxStartTU; resiCb.copyFrom( orgResiCb[cbfMask] ); resiCr.copyFrom( orgResiCr[cbfMask] ); -#if JVET_Q0695_CHROMA_TS_JCCR if (numTransformCands > 1) { -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock(currTU, COMPONENT_Cb, false, distTmp, 0, nullptr, modeId == 0 ? &trModes : nullptr, true); -#else xIntraCodingTUBlock(currTU, COMPONENT_Cb, distTmp, 0, nullptr, modeId == 0 ? &trModes : nullptr, true); -#endif } else -#endif -#if !REMOVE_PPS_REXT - xIntraCodingTUBlock( currTU, COMPONENT_Cb, false, distTmp, 0 ); -#else xIntraCodingTUBlock( currTU, COMPONENT_Cb, distTmp, 0 ); -#endif double costTmp = std::numeric_limits<double>::max(); if( distTmp < std::numeric_limits<Distortion>::max() ) { uint64_t bits = xGetIntraFracBitsQTChroma( currTU, COMPONENT_Cb ); costTmp = m_pcRdCost->calcRdCost( bits, distTmp ); -#if JVET_Q0695_CHROMA_TS_JCCR if (!currTU.mtsIdx[codeCompId]) { cbfDCT2 = true; } -#endif } -#if JVET_Q0695_CHROMA_TS_JCCR else if (!currTU.mtsIdx[codeCompId]) { cbfDCT2 = false; } -#endif if( costTmp < bestCostCbCr ) { @@ -6082,9 +5264,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio bestJointCbCr = currTU.jointCbCr; // store data -#if !JVET_Q0695_CHROMA_TS_JCCR - if( cbfMask != jointCbfMasksToTest.back() ) -#endif { #if KEEP_PRED_AND_RESI_SIGNALS saveCS.getOrgResiBuf(cbArea).copyFrom(cs.getOrgResiBuf(cbArea)); @@ -6105,22 +5284,11 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio ctxBest = m_CABACEstimator->getCtx(); } -#if !JVET_Q0695_CHROMA_TS_JCCR - else - { - lastIsBest = true; - } -#endif } -#if JVET_Q0695_CHROMA_TS_JCCR } -#endif } // Retrieve the best CU data (unless it was the very last one tested) -#if !JVET_Q0695_CHROMA_TS_JCCR - if ( !( maxModesTested == 1 && jointCbfMasksToTest.empty() ) && !lastIsBest ) -#endif { #if KEEP_PRED_AND_RESI_SIGNALS cs.getPredBuf (cbArea).copyFrom(saveCS.getPredBuf (cbArea)); diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index 3a4ba0b4b3a0800933c07549edc327ad1cc8aacb..9209a8b1d509c462e4ac24bf6f18b8eea5abcdc9 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -72,33 +72,20 @@ public: return cnt > other.cnt; } SortingElement() { -#if JVET_Q0504_PLT_NON444 cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0; shift[0] = shift[1] = shift[2] = 0; lastCnt[0] = lastCnt[1] = lastCnt[2] = 0; -#else - cnt = shift = lastCnt = 0; -#endif data[0] = data[1] = data[2] = 0; sumData[0] = sumData[1] = sumData[2] = 0; } -#if JVET_Q0504_PLT_NON444 uint32_t getCnt(int idx) const { return cnt[idx]; } void setCnt(uint32_t val, int idx) { cnt[idx] = val; } -#else - uint32_t getCnt() const { return cnt; } - void setCnt(uint32_t val) { cnt = val; } -#endif int getSumData (int id) const { return sumData[id]; } void resetAll(ComponentID compBegin, uint32_t numComp) { -#if JVET_Q0504_PLT_NON444 shift[0] = shift[1] = shift[2] = 0; lastCnt[0] = lastCnt[1] = lastCnt[2] = 0; -#else - shift = lastCnt = 0; -#endif for (int ch = compBegin; ch < (compBegin + numComp); ch++) { data[ch] = 0; @@ -112,16 +99,11 @@ public: data[ch] = ui[ch]; } } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS bool almostEqualData(SortingElement element, int errorLimit, const BitDepths& bitDepths, ComponentID compBegin, uint32_t numComp, bool lossless) -#else - bool almostEqualData(SortingElement element, int errorLimit, const BitDepths& bitDepths, ComponentID compBegin, uint32_t numComp) -#endif { bool almostEqual = true; for (int comp = compBegin; comp < (compBegin + numComp); comp++) { -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { if ((std::abs(data[comp] - element.data[comp])) > errorLimit) @@ -132,7 +114,6 @@ public: } else { -#endif uint32_t absError = 0; if (isChroma((ComponentID) comp)) { @@ -147,34 +128,24 @@ public: almostEqual = false; break; } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif } return almostEqual; } -#if JVET_Q0493_PLT_ENCODER_LOSSLESS uint32_t getSAD(SortingElement element, const BitDepths &bitDepths, ComponentID compBegin, uint32_t numComp, bool lossless) -#else - uint32_t getSAD(SortingElement element, const BitDepths& bitDepths, ComponentID compBegin, uint32_t numComp) -#endif { uint32_t sumAd = 0; for (int comp = compBegin; comp < (compBegin + numComp); comp++) { ChannelType chType = (comp > 0) ? CHANNEL_TYPE_CHROMA : CHANNEL_TYPE_LUMA; -#if JVET_Q0493_PLT_ENCODER_LOSSLESS if (lossless) { sumAd += (std::abs(data[comp] - element.data[comp])); } else { -#endif sumAd += (std::abs(data[comp] - element.data[comp]) >> (bitDepths.recon[chType] - PLT_ENCBITDEPTH)); -#if JVET_Q0493_PLT_ENCODER_LOSSLESS } -#endif } return sumAd; } @@ -184,37 +155,22 @@ public: { data[comp] = element.data[comp]; sumData[comp] = data[comp]; -#if JVET_Q0504_PLT_NON444 shift[comp] = 0; lastCnt[comp] = 1; -#endif } -#if !JVET_Q0504_PLT_NON444 - shift = 0; lastCnt = 1; -#endif } void copyAllFrom(SortingElement element, ComponentID compBegin, uint32_t numComp) { copyDataFrom(element, compBegin, numComp); -#if !JVET_Q0504_PLT_NON444 - cnt = element.cnt; -#endif for (int comp = compBegin; comp < (compBegin + numComp); comp++) { sumData[comp] = element.sumData[comp]; -#if JVET_Q0504_PLT_NON444 cnt[comp] = element.cnt[comp]; shift[comp] = element.shift[comp]; lastCnt[comp] = element.lastCnt[comp]; -#endif } -#if JVET_Q0504_PLT_NON444 cnt[MAX_NUM_COMPONENT] = element.cnt[MAX_NUM_COMPONENT]; -#else - lastCnt = element.lastCnt; shift = element.shift; -#endif } -#if JVET_Q0504_PLT_NON444 void addElement(const SortingElement& element, ComponentID compBegin, uint32_t numComp) { for (int i = compBegin; i<(compBegin + numComp); i++) @@ -230,41 +186,12 @@ public: } } } -#else - void addElement(const SortingElement& element, ComponentID compBegin, uint32_t numComp) - { - cnt++; - for (int i = compBegin; i<(compBegin + numComp); i++) - { - sumData[i] += element.data[i]; - } - if (cnt>1 && cnt == 2 * lastCnt) - { - uint32_t rnd = 1 << shift; - shift++; - for (int i = compBegin; i<(compBegin + numComp); i++) - { - data[i] = (sumData[i] + rnd) >> shift; - } - lastCnt = cnt; - } - } -#endif private: -#if JVET_Q0504_PLT_NON444 uint32_t cnt[MAX_NUM_COMPONENT+1]; int shift[3], lastCnt[3], data[3], sumData[3]; -#else - uint32_t cnt; - int shift, lastCnt, data[3], sumData[3]; -#endif }; /// encoder search class -#if !REMOVE_PPS_REXT -class IntraSearch : public IntraPrediction, CrossComponentPrediction -#else class IntraSearch : public IntraPrediction -#endif { private: EncModeCtrl *m_modeCtrl; @@ -533,11 +460,7 @@ protected: uint64_t xGetIntraFracBitsQTChroma(TransformUnit& tu, const ComponentID &compID); void xEncCoeffQT ( CodingStructure &cs, Partitioner& pm, const ComponentID compID, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP, CUCtx * cuCtx = nullptr ); -#if !REMOVE_PPS_REXT - void xIntraCodingTUBlock (TransformUnit &tu, const ComponentID &compID, const bool &checkCrossCPrediction, Distortion& ruiDist, const int &default0Save1Load2 = 0, uint32_t* numSig = nullptr, std::vector<TrMode>* trModes=nullptr, const bool loadTr=false ); -#else void xIntraCodingTUBlock (TransformUnit &tu, const ComponentID &compID, Distortion& ruiDist, const int &default0Save1Load2 = 0, uint32_t* numSig = nullptr, std::vector<TrMode>* trModes=nullptr, const bool loadTr=false ); -#endif void xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &compID, Distortion& ruiDist, std::vector<TrMode>* trModes = nullptr, const bool loadTr = false); ChromaCbfs xRecurIntraChromaCodingQT( CodingStructure &cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, const PartSplit ispType = TU_NO_ISP ); @@ -551,11 +474,7 @@ protected: void calcPixelPred ( CodingStructure& cs, Partitioner& partitioner, uint32_t yPos, uint32_t xPos, ComponentID compBegin, uint32_t numComp); void preCalcPLTIndexRD (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); void calcPixelPredRD (CodingStructure& cs, Partitioner& partitioner, Pel* orgBuf, Pel* pixelValue, Pel* recoValue, ComponentID compBegin, uint32_t numComp); -#if JVET_Q0503_Q0712_PLT_ENCODER_IMPROV_BUGFIX void deriveIndexMap (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, double& dCost, bool* idxExist); -#else - void deriveIndexMap (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, double& dCost); -#endif bool deriveSubblockIndexMap(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, PLTScanMode pltScanMode, int minSubPos, int maxSubPos, const BinFracBits& fracBitsPltRunType, const BinFracBits* fracBitsPltIndexINDEX, const BinFracBits* fracBitsPltIndexCOPY, const double minCost, bool useRotate); double rateDistOptPLT (bool RunType, uint8_t RunIndex, bool prevRunType, uint8_t prevRunIndex, uint8_t aboveRunIndex, bool& prevCodedRunType, int& prevCodedRunPos, int scanPos, uint32_t width, int dist, int indexMaxValue, const BinFracBits* IndexfracBits, const BinFracBits& TypefracBits); void initTBCTable (int bitDepth); diff --git a/source/Lib/EncoderLib/RateCtrl.cpp b/source/Lib/EncoderLib/RateCtrl.cpp index 51e5535e45949221993ea830d7feae174aa6b92e..d3d8682746c06f2535dd5f0f1e846b1ea8f03f01 100644 --- a/source/Lib/EncoderLib/RateCtrl.cpp +++ b/source/Lib/EncoderLib/RateCtrl.cpp @@ -1843,7 +1843,6 @@ int RateCtrl::updateCpbState(int actualBits) return cpbState; } -#if JVET_P0118_HRD_ASPECTS void RateCtrl::initHrdParam(const GeneralHrdParams* generalHrd, const OlsHrdParams* olsHrd, int iFrameRate, double fInitialCpbFullness) { m_CpbSaturationEnabled = true; @@ -1852,16 +1851,6 @@ void RateCtrl::initHrdParam(const GeneralHrdParams* generalHrd, const OlsHrdPara m_bufferingRate = (uint32_t)(((olsHrd->getBitRateValueMinus1(0, 0) + 1) << (6 + generalHrd->getBitRateScale())) / iFrameRate); msg(NOTICE, "\nHRD - [Initial CPB state %6d] [CPB Size %6d] [Buffering Rate %6d]\n", m_cpbState, m_cpbSize, m_bufferingRate); } -#else -void RateCtrl::initHrdParam(const HRDParameters* pcHrd, int iFrameRate, double fInitialCpbFullness) -{ - m_CpbSaturationEnabled = true; - m_cpbSize = (pcHrd->getCpbSizeValueMinus1(0, 0, 0) + 1) << (4 + pcHrd->getCpbSizeScale()); - m_cpbState = (uint32_t)(m_cpbSize*fInitialCpbFullness); - m_bufferingRate = (uint32_t)(((pcHrd->getBitRateValueMinus1(0, 0, 0) + 1) << (6 + pcHrd->getBitRateScale())) / iFrameRate); - msg( NOTICE, "\nHRD - [Initial CPB state %6d] [CPB Size %6d] [Buffering Rate %6d]\n", m_cpbState, m_cpbSize, m_bufferingRate); -} -#endif #endif void RateCtrl::destroyRCGOP() diff --git a/source/Lib/EncoderLib/RateCtrl.h b/source/Lib/EncoderLib/RateCtrl.h index 48d5da9c0343cf0ad23de976d80f94f1e7cc5a0e..078c27125017676e874ff296bd96a84bc2c640a5 100644 --- a/source/Lib/EncoderLib/RateCtrl.h +++ b/source/Lib/EncoderLib/RateCtrl.h @@ -354,11 +354,7 @@ public: uint32_t getCpbSize() { return m_cpbSize; } uint32_t getBufferingRate() { return m_bufferingRate; } int updateCpbState(int actualBits); -#if JVET_P0118_HRD_ASPECTS void initHrdParam(const GeneralHrdParams* generalHrd, const OlsHrdParams* olsHrd, int iFrameRate, double fInitialCpbFullness); -#else - void initHrdParam(const HRDParameters* pcHrd, int iFrameRate, double fInitialCpbFullness); -#endif #endif private: diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index ddbcee89a9432e7941828d5a05dc440974840df9..7b03e825d8cc881b0382616fa7ccba7613f01cf0 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -341,14 +341,9 @@ void SEIEncoder::initSEIGcmp(SEIGeneralizedCubemapProjection* seiGeneralizedCube seiGeneralizedCubemapProjection->m_gcmpGuardBandFlag = m_pcCfg->getGcmpSEIGuardBandFlag(); if (seiGeneralizedCubemapProjection->m_gcmpGuardBandFlag) { -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE seiGeneralizedCubemapProjection->m_gcmpGuardBandType = m_pcCfg->getGcmpSEIGuardBandType(); seiGeneralizedCubemapProjection->m_gcmpGuardBandBoundaryExteriorFlag = m_pcCfg->getGcmpSEIGuardBandBoundaryExteriorFlag(); seiGeneralizedCubemapProjection->m_gcmpGuardBandSamplesMinus1 = m_pcCfg->getGcmpSEIGuardBandSamplesMinus1(); -#else - seiGeneralizedCubemapProjection->m_gcmpGuardBandBoundaryType = m_pcCfg->getGcmpSEIGuardBandBoundaryType(); - seiGeneralizedCubemapProjection->m_gcmpGuardBandSamplesMinus1 = m_pcCfg->getGcmpSEIGuardBandSamplesMinus1(); -#endif } } } @@ -376,7 +371,6 @@ void SEIEncoder::initSEISampleAspectRatioInfo(SEISampleAspectRatioInfo* seiSampl } } -#if JVET_P0190_SCALABLE_NESTING_SEI //! initialize scalable nesting SEI message. //! Note: The SEI message structures input into this function will become part of the scalable nesting SEI and will be //! automatically freed, when the nesting SEI is disposed. @@ -412,7 +406,6 @@ void SEIEncoder::initSEIScalableNesting(SEIScalableNesting *scalableNestingSEI, scalableNestingSEI->m_nestedSEIs.push_back((*it)); } } -#endif //! calculate hashes for entire reconstructed picture @@ -621,7 +614,6 @@ void SEIEncoder::initSEIContentColourVolume(SEIContentColourVolume *seiContentCo } void SEIEncoder::initSEISubpictureLevelInfo(SEISubpicureLevelInfo *sei, const SPS *sps) { -#if JVET_SUBPIC_LEVEL_CFG const EncCfgParam::CfgSEISubpictureLevel &cfgSubPicLevel = m_pcCfg->getSubpicureLevelInfoSEICfg(); sei->m_numRefLevels = (int) cfgSubPicLevel.m_refLevels.size(); @@ -641,23 +633,6 @@ void SEIEncoder::initSEISubpictureLevelInfo(SEISubpicureLevelInfo *sei, const SP } } } -#else - // subpicture level information should be specified via config file - // unfortunately the implementation of subpictures is still not available - // TODO: implement config file parameters and intialization - fprintf(stderr, "SEISubpicureLevelInfo depends on subpictures! Initializing to dummy values!\n"); - -#if !JVET_Q0630_SUBPIC_LEVEL - sei->m_sliSeqParameterSetId = sps->getSPSId(); -#else - sei->m_numSubpics = sps->getNumSubPics(); -#endif - sei->m_numRefLevels = 2; - sei->m_refLevelIdc.resize(2); - sei->m_refLevelIdc[0] = Level::LEVEL4; - sei->m_refLevelIdc[1] = Level::LEVEL8_5; - sei->m_explicitFractionPresentFlag = false; -#endif } diff --git a/source/Lib/EncoderLib/SEIEncoder.h b/source/Lib/EncoderLib/SEIEncoder.h index 1ffb088916fcd07e5e3371de07de776c14b0efe4..0506df6ed80780459998d77bf78c9cc72d8c17dd 100644 --- a/source/Lib/EncoderLib/SEIEncoder.h +++ b/source/Lib/EncoderLib/SEIEncoder.h @@ -71,9 +71,7 @@ public: #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI void initSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics *sei); #endif -#if JVET_P0190_SCALABLE_NESTING_SEI void initSEIScalableNesting(SEIScalableNesting *sei, SEIMessages &nestedSEIs); -#endif // trailing SEIs void initDecodedPictureHashSEI(SEIDecodedPictureHash *sei, PelUnitBuf& pic, std::string &rHashString, const BitDepths &bitDepths); void initSEIErp(SEIEquirectangularProjection *sei); diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index ab43c1b21d77a11adcba665604b148df0d9eaeb3..cc18bb9eb142291803562a21ae21219c793edcfc 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -54,11 +54,9 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream &bs, const SEI& sei, const CHECK (bp == nullptr, "Buffering Period need to be initialized in HRD to allow writing of Decoding Unit Information SEI"); xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), *bp, temporalId); break; -#if JVET_P0190_SCALABLE_NESTING_SEI case SEI::SCALABLE_NESTING: xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); break; -#endif case SEI::DECODED_PICTURE_HASH: xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); break; @@ -121,11 +119,7 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream &bs, const SEI& sei, const xWriteSEIContentColourVolume(*static_cast<const SEIContentColourVolume*>(&sei)); break; case SEI::SUBPICTURE_LEVEL_INFO: -#if JVET_Q0630_SUBPIC_LEVEL xWriteSEISubpictureLevelInfo(*static_cast<const SEISubpicureLevelInfo*>(&sei)); -#else - xWriteSEISubpictureLevelInfo(*static_cast<const SEISubpicureLevelInfo*>(&sei), sps); -#endif break; case SEI::SAMPLE_ASPECT_RATIO_INFO: xWriteSEISampleAspectRatioInfo(*static_cast<const SEISampleAspectRatioInfo*>(&sei)); @@ -251,14 +245,10 @@ void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const WRITE_CODE( sei.m_duSptCpbRemovalDelayIncrement[i], bp.getDuCpbRemovalDelayIncrementLength(), "du_spt_cpb_removal_delay_increment[i]"); } } -#if JVET_Q0221 if (bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag) { WRITE_FLAG(sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); } -#else - WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); -#endif if(sei.m_dpbOutputDuDelayPresentFlag) { WRITE_CODE(sei.m_picSptDpbOutputDuDelay, bp.getDpbOutputDelayDuLength(), "pic_spt_dpb_output_du_delay"); @@ -285,9 +275,7 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) CHECK (sei.m_dpbOutputDelayDuLength < 1, "sei.m_dpbOutputDelayDuLength must be > 0"); WRITE_CODE( sei.m_dpbOutputDelayDuLength - 1, 5, "dpb_output_delay_du_length_minus1" ); WRITE_FLAG( sei.m_decodingUnitCpbParamsInPicTimingSeiFlag, "decoding_unit_cpb_params_in_pic_timing_sei_flag" ); -#if JVET_Q0221 WRITE_FLAG(sei.m_decodingUnitDpbDuParamsInPicTimingSeiFlag, "decoding_unit_dpb_du_params_in_pic_timing_sei_flag"); -#endif } WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag"); @@ -346,7 +334,6 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf WRITE_FLAG( sei.m_cpbAltTimingInfoPresentFlag, "cpb_alt_timing_info_present_flag" ); if( sei.m_cpbAltTimingInfoPresentFlag ) { -#if JVET_Q0219_SIGNAL_ALT_BUFFER_DELAY_PARMS for (int i = (bp.m_sublayerInitialCpbRemovalDelayPresentFlag ? 0 : bp.m_bpMaxSubLayers - 1); i <= bp.m_bpMaxSubLayers - 1; ++i) { @@ -360,17 +347,6 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf WRITE_CODE(sei.m_cpbDelayOffset[i], bp.m_initialCpbRemovalDelayLength, "cpb_delay_offset[ i ]"); WRITE_CODE(sei.m_dpbDelayOffset[i], bp.m_initialCpbRemovalDelayLength, "dpb_delay_offset[ i ]"); } -#else - for (int i = 0; i < bp.m_bpCpbCnt; i++) - { - WRITE_CODE(sei.m_cpbAltInitialCpbRemovalDelayDelta[i], bp.m_initialCpbRemovalDelayLength, - "cpb_alt_initial_cpb_removal_delay_delta[ i ]"); - WRITE_CODE(sei.m_cpbAltInitialCpbRemovalOffsetDelta[i], bp.m_initialCpbRemovalDelayLength, - "cpb_alt_initial_cpb_removal_offset_delta[ i ]"); - } - WRITE_CODE(sei.m_cpbDelayOffset, bp.m_initialCpbRemovalDelayLength, "cpb_delay_offset"); - WRITE_CODE(sei.m_dpbDelayOffset, bp.m_initialCpbRemovalDelayLength, "dpb_delay_offset"); -#endif } } for( int i = temporalId; i < bp.m_bpMaxSubLayers - 1; i ++ ) @@ -384,14 +360,10 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf } if( sei.m_cpbRemovalDelayDeltaEnabledFlag[i] ) { -#if JVET_Q0216 if ((bp.m_numCpbRemovalDelayDeltas - 1) > 0) { WRITE_CODE(sei.m_cpbRemovalDelayDeltaIdx[i], ceilLog2(bp.m_numCpbRemovalDelayDeltas), "cpb_removal_delay_delta_idx[i]"); } -#else - WRITE_CODE(sei.m_cpbRemovalDelayDeltaIdx[i], ceilLog2(bp.m_numCpbRemovalDelayDeltas), "cpb_removal_delay_delta_idx[i]"); -#endif } else { @@ -400,11 +372,7 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf } } WRITE_CODE( sei.m_picDpbOutputDelay, bp.m_dpbOutputDelayLength, "dpb_output_delay" ); -#if JVET_Q0221 if (bp.m_bpDecodingUnitHrdParamsPresentFlag && bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag) -#else - if (bp.m_bpDecodingUnitHrdParamsPresentFlag) -#endif { WRITE_CODE( sei.m_picDpbOutputDuDelay, bp.m_dpbOutputDelayDuLength, "pic_dpb_output_du_delay" ); @@ -434,9 +402,7 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf } } } -#if JVET_Q0818_PT_SEI WRITE_UVLC( sei.m_ptDisplayElementalPeriodsMinus1, "pt_display_elemental_periods_minus1" ); -#endif } void SEIWriter::xWriteSEIFrameFieldInfo(const SEIFrameFieldInfo& sei) @@ -469,7 +435,6 @@ void SEIWriter::xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& // intentionally empty } -#if JVET_P0190_SCALABLE_NESTING_SEI void SEIWriter::xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableNesting& sei, const SPS *sps) { WRITE_FLAG(sei.m_nestingOlsFlag, "nesting_ols_flag"); @@ -504,7 +469,6 @@ void SEIWriter::xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableN HRD hrd; writeSEImessages(bs, sei.m_nestedSEIs, sps, hrd, true, 0); } -#endif void SEIWriter::xWriteSEIFramePacking(const SEIFramePacking& sei) { @@ -696,26 +660,15 @@ void SEIWriter::xWriteSEIGeneralizedCubemapProjection(const SEIGeneralizedCubema WRITE_FLAG( sei.m_gcmpGuardBandFlag, "gcmp_guard_band_flag" ); if (sei.m_gcmpGuardBandFlag) { -#if JVET_Q0343_GCMP_GUARD_BAND_TYPE WRITE_CODE( sei.m_gcmpGuardBandType, 3, "gcmp_guard_band_type" ); WRITE_FLAG( sei.m_gcmpGuardBandBoundaryExteriorFlag, "gcmp_guard_band_boundary_exterior_flag" ); -#else - WRITE_FLAG( sei.m_gcmpGuardBandBoundaryType, "gcmp_guard_band_boundary_type" ); -#endif WRITE_CODE( sei.m_gcmpGuardBandSamplesMinus1, 4, "gcmp_guard_band_samples_minus1" ); } } } -#if JVET_Q0630_SUBPIC_LEVEL void SEIWriter::xWriteSEISubpictureLevelInfo(const SEISubpicureLevelInfo &sei) -#else -void SEIWriter::xWriteSEISubpictureLevelInfo(const SEISubpicureLevelInfo &sei, const SPS* sps) -#endif { -#if !JVET_Q0630_SUBPIC_LEVEL - WRITE_CODE( (uint32_t)sei.m_sliSeqParameterSetId, 4, "sli_seq_parameter_set_id"); -#endif CHECK(sei.m_numRefLevels < 1, "SEISubpicureLevelInfo: numRefLevels must be greater than zero"); CHECK(sei.m_numRefLevels != (int)sei.m_refLevelIdc.size(), "SEISubpicureLevelInfo: numRefLevels must be equal to the number of levels"); if (sei.m_explicitFractionPresentFlag) @@ -724,7 +677,6 @@ void SEIWriter::xWriteSEISubpictureLevelInfo(const SEISubpicureLevelInfo &sei, c } WRITE_CODE( (uint32_t)sei.m_numRefLevels - 1, 3, "num_ref_levels_minus1"); WRITE_FLAG( sei.m_explicitFractionPresentFlag, "explicit_fraction_present_flag"); -#if JVET_Q0630_SUBPIC_LEVEL if (sei.m_explicitFractionPresentFlag) { WRITE_UVLC( sei.m_numSubpics -1 , "sli_num_subpics_minus1"); @@ -733,20 +685,14 @@ void SEIWriter::xWriteSEISubpictureLevelInfo(const SEISubpicureLevelInfo &sei, c WRITE_FLAG( 0, "sli_alignment_zero_bit"); } } -#endif for (int i=0; i<sei.m_numRefLevels; i++) { WRITE_CODE( (uint32_t)sei.m_refLevelIdc[i], 8, "ref_level_idc[i]"); if (sei.m_explicitFractionPresentFlag) { -#if !JVET_Q0630_SUBPIC_LEVEL - CHECK(sps->getNumSubPics() != (int)sei.m_refLevelFraction[i].size(), "SEISubpicureLevelInfo: number of fractions differs from number of subpictures"); - for (int j = 0; j < sps->getNumSubPics(); j++) -#else CHECK(sei.m_numSubpics != (int)sei.m_refLevelFraction[i].size(), "SEISubpicureLevelInfo: number of fractions differs from number of subpictures"); for (int j = 0; j < sei.m_numSubpics; j++) -#endif { WRITE_CODE( (uint32_t)sei.m_refLevelFraction[i][j], 8, "ref_level_fraction_minus1[i][j]"); } diff --git a/source/Lib/EncoderLib/SEIwrite.h b/source/Lib/EncoderLib/SEIwrite.h index fe174dbda888accb199b08e3c40002f8775467e1..54315c0d1e7365c82f4ad6a41449385366a8beaf 100644 --- a/source/Lib/EncoderLib/SEIwrite.h +++ b/source/Lib/EncoderLib/SEIwrite.h @@ -59,9 +59,7 @@ protected: void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBufferingPeriod& bp, const uint32_t temporalId); void xWriteSEIFrameFieldInfo(const SEIFrameFieldInfo& sei); void xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& sei); -#if JVET_P0190_SCALABLE_NESTING_SEI void xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableNesting& sei, const SPS *sps); -#endif void xWriteSEIFramePacking(const SEIFramePacking& sei); void xWriteSEIMasteringDisplayColourVolume( const SEIMasteringDisplayColourVolume& sei); #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI @@ -72,11 +70,7 @@ protected: void xWriteSEIOmniViewport (const SEIOmniViewport& sei); void xWriteSEIRegionWisePacking (const SEIRegionWisePacking &sei); void xWriteSEIGeneralizedCubemapProjection (const SEIGeneralizedCubemapProjection &sei); -#if JVET_Q0630_SUBPIC_LEVEL void xWriteSEISubpictureLevelInfo (const SEISubpicureLevelInfo &sei); -#else - void xWriteSEISubpictureLevelInfo (const SEISubpicureLevelInfo &sei, const SPS* sps); -#endif void xWriteSEISampleAspectRatioInfo (const SEISampleAspectRatioInfo &sei); void xWriteSEIUserDataRegistered(const SEIUserDataRegistered& sei); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index a568652a8c51c94742e8d0a1d44e2f5661821956..907d13689e4473b5ae501889f7ed3c1049e71422 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -224,15 +224,9 @@ void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTer prevDelta = rpl->getRefPicIdentifier(ii); } unsigned int absDeltaValue = (deltaValue < 0) ? 0 - deltaValue : deltaValue; -#if JVET_Q0217_PROPOSAL5 if (isForbiddenZeroDeltaPoc || ii == 0) { CHECK(!absDeltaValue, "Zero delta POC is not used without WP or is the 0-th entry"); -#else - if (isForbiddenZeroDeltaPoc) - { - CHECK( !absDeltaValue, "Zero delta POC is not used without WP" ); -#endif WRITE_UVLC( absDeltaValue - 1, "abs_delta_poc_st[ listIdx ][ rplsIdx ][ i ]" ); } else @@ -257,14 +251,11 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC( pcPPS->getPPSId(), "pps_pic_parameter_set_id" ); WRITE_CODE( pcPPS->getSPSId(), 4, "pps_seq_parameter_set_id" ); -#if SPS_ID_CHECK WRITE_FLAG( pcPPS->getMixedNaluTypesInPicFlag() ? 1 : 0, "mixed_nalu_types_in_pic_flag" ); -#endif WRITE_UVLC( pcPPS->getPicWidthInLumaSamples(), "pic_width_in_luma_samples" ); WRITE_UVLC( pcPPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); Window conf = pcPPS->getConformanceWindow(); -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS WRITE_FLAG(conf.getWindowEnabledFlag(), "pps_conformance_window_flag"); if (conf.getWindowEnabledFlag()) { @@ -273,16 +264,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC(conf.getWindowTopOffset(), "pps_conf_win_top_offset"); WRITE_UVLC(conf.getWindowBottomOffset(), "pps_conf_win_bottom_offset"); } -#else - WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_flag" ); - if( conf.getWindowEnabledFlag() ) - { - WRITE_UVLC( conf.getWindowLeftOffset(), "conf_win_left_offset" ); - WRITE_UVLC( conf.getWindowRightOffset(), "conf_win_right_offset" ); - WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); - WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); - } -#endif Window scalingWindow = pcPPS->getScalingWindow(); WRITE_FLAG( scalingWindow.getWindowEnabledFlag(), "scaling_window_flag" ); @@ -295,13 +276,8 @@ void HLSWriter::codePPS( const PPS* pcPPS ) } WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); -#if JVET_Q0119_CLEANUPS WRITE_FLAG( pcPPS->getSubPicIdMappingInPpsFlag() ? 1 : 0, "subpic_id_mapping_in_pps_flag" ); if( pcPPS->getSubPicIdMappingInPpsFlag() ) -#else - WRITE_FLAG(pcPPS->getSubPicIdSignallingPresentFlag(), "pps_subpic_id_signalling_present_flag"); - if( pcPPS->getSubPicIdSignallingPresentFlag() ) -#endif { CHECK(pcPPS->getNumSubPics() < 1, "PPS: NumSubPics cannot be less than 1"); WRITE_UVLC( pcPPS->getNumSubPics() - 1, "pps_num_subpics_minus1" ); @@ -309,9 +285,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) CHECK(pcPPS->getSubPicIdLen() < 1, "PPS: SubPicIdLen cannot be less than 1"); WRITE_UVLC( pcPPS->getSubPicIdLen() - 1, "pps_subpic_id_len_minus1" ); -#if JVET_Q0169_SUBPIC_LEN_CONFORM CHECK((1 << pcPPS->getSubPicIdLen()) < pcPPS->getNumSubPics(), "pps_subpic_id_len exceeds valid range"); -#endif for( int picIdx = 0; picIdx < pcPPS->getNumSubPics( ); picIdx++ ) { WRITE_CODE( pcPPS->getSubPicId(picIdx), pcPPS->getSubPicIdLen( ), "pps_subpic_id[i]" ); @@ -341,14 +315,10 @@ void HLSWriter::codePPS( const PPS* pcPPS ) } // rectangular slice signalling -#if JVET_Q0289_BUGFIX_RECT_SLICE_FLAG if (pcPPS->getNumTiles() > 1) { WRITE_FLAG(pcPPS->getRectSliceFlag() ? 1 : 0, "rect_slice_flag"); } -#else - WRITE_FLAG( pcPPS->getRectSliceFlag( ) ? 1 : 0, "rect_slice_flag"); -#endif if (pcPPS->getRectSliceFlag()) { WRITE_FLAG(pcPPS->getSingleSlicePerSubPicFlag( ) ? 1 : 0, "single_slice_per_subpic_flag"); @@ -356,45 +326,28 @@ void HLSWriter::codePPS( const PPS* pcPPS ) if (pcPPS->getRectSliceFlag() & !(pcPPS->getSingleSlicePerSubPicFlag())) { WRITE_UVLC( pcPPS->getNumSlicesInPic( ) - 1, "num_slices_in_pic_minus1" ); -#if JVET_Q0218_PROPOSAL1 if ((pcPPS->getNumSlicesInPic() - 1) > 0) { WRITE_FLAG(pcPPS->getTileIdxDeltaPresentFlag() ? 1 : 0, "tile_idx_delta_present_flag"); } -#else - WRITE_FLAG(pcPPS->getTileIdxDeltaPresentFlag() ? 1 : 0, "tile_idx_delta_present_flag"); -#endif // write rectangular slice parameters for( int i = 0; i < pcPPS->getNumSlicesInPic()-1; i++ ) { // complete tiles within a single slice -#if JVET_Q0244 if( pcPPS->getNumTileColumns() > 1 ) { -#endif WRITE_UVLC( pcPPS->getSliceWidthInTiles( i ) - 1, "slice_width_in_tiles_minus1[i]" ); -#if JVET_Q0244 } -#endif -#if JVET_Q0480_RASTER_RECT_SLICES if( pcPPS->getTileIdxDeltaPresentFlag() || ( (pcPPS->getSliceTileIdx( i ) % pcPPS->getNumTileColumns()) == 0 ) ) { -#if JVET_Q0244 if( pcPPS->getNumTileRows() > 1 ) { -#endif WRITE_UVLC( pcPPS->getSliceHeightInTiles( i ) - 1, "slice_height_in_tiles_minus1[i]" ); -#if JVET_Q0244 } -#endif } -#else - WRITE_UVLC( pcPPS->getSliceHeightInTiles( i ) - 1, "slice_height_in_tiles_minus1[i]" ); -#endif // multiple slices within a single tile special case -#if JVET_Q0203_MULTI_SLICE_IN_TILE if( pcPPS->getSliceWidthInTiles(i) == 1 && pcPPS->getSliceHeightInTiles(i) == 1 && pcPPS->getTileRowHeight(pcPPS->getSliceTileIdx(i) / pcPPS->getNumTileColumns()) > 1 ) { uint32_t numExpSliceInTile = pcPPS->getNumSlicesInTile(i) - 1; @@ -415,18 +368,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) } i += (pcPPS->getNumSlicesInTile(i) - 1); } -#else - if( pcPPS->getSliceWidthInTiles( i ) == 1 && pcPPS->getSliceHeightInTiles( i ) == 1 ) - { - WRITE_UVLC( pcPPS->getNumSlicesInTile( i ) - 1, "num_slices_in_tile_minus1[i]" ); - uint32_t numSlicesInTile = pcPPS->getNumSlicesInTile( i ); - for( int j = 0; j < numSlicesInTile-1; j++ ) - { - WRITE_UVLC( pcPPS->getSliceHeightInCtu( i ) - 1, "slice_height_in_ctu_minus1[i]" ); - i++; - } - } -#endif // tile index offset to start of next slice if( i < pcPPS->getNumSlicesInPic()-1 ) @@ -445,9 +386,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_FLAG( pcPPS->getLoopFilterAcrossSlicesEnabledFlag(), "loop_filter_across_slices_enabled_flag"); } -#if !JVET_Q0151_Q0205_ENTRYPOINTS - WRITE_FLAG( pcPPS->getEntropyCodingSyncEnabledFlag() ? 1 : 0, "entropy_coding_sync_enabled_flag" ); -#endif WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1, "num_ref_idx_l0_default_active_minus1"); WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); @@ -455,15 +393,10 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - WRITE_UVLC( pcPPS->getLog2MaxTransformSkipBlockSize() - 2, "log2_transform_skip_max_size_minus2"); -#endif WRITE_FLAG( pcPPS->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag" ); -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG WRITE_FLAG(pcPPS->getPPSChromaToolFlag() ? 1 : 0, "pps_chroma_tool_offsets_present_flag"); if (pcPPS->getPPSChromaToolFlag()) { -#endif WRITE_SVLC( pcPPS->getQpOffset(COMPONENT_Cb), "pps_cb_qp_offset" ); WRITE_SVLC( pcPPS->getQpOffset(COMPONENT_Cr), "pps_cr_qp_offset" ); WRITE_FLAG(pcPPS->getJointCbCrQpOffsetPresentFlag() ? 1 : 0, "pps_joint_cbcr_qp_offset_present_flag"); @@ -489,9 +422,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) } } } -#if JVET_Q0420_PPS_CHROMA_TOOL_FLAG } -#endif WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) @@ -505,16 +436,13 @@ void HLSWriter::codePPS( const PPS* pcPPS ) { WRITE_SVLC( pcPPS->getDeblockingFilterBetaOffsetDiv2(), "pps_beta_offset_div2" ); WRITE_SVLC( pcPPS->getDeblockingFilterTcOffsetDiv2(), "pps_tc_offset_div2" ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS WRITE_SVLC( pcPPS->getDeblockingFilterCbBetaOffsetDiv2(), "pps_cb_beta_offset_div2" ); WRITE_SVLC( pcPPS->getDeblockingFilterCbTcOffsetDiv2(), "pps_cb_tc_offset_div2" ); WRITE_SVLC( pcPPS->getDeblockingFilterCrBetaOffsetDiv2(), "pps_cr_beta_offset_div2" ); WRITE_SVLC( pcPPS->getDeblockingFilterCrTcOffsetDiv2(), "pps_cr_tc_offset_div2" ); -#endif } } -#if JVET_Q0819_PH_CHANGES WRITE_FLAG(pcPPS->getRplInfoInPhFlag() ? 1 : 0, "rpl_info_in_ph_flag"); if (pcPPS->getDeblockingFilterOverrideEnabledFlag()) { @@ -527,24 +455,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_FLAG(pcPPS->getWpInfoInPhFlag() ? 1 : 0, "wp_info_in_ph_flag"); } WRITE_FLAG(pcPPS->getQpDeltaInfoInPhFlag() ? 1 : 0, "qp_delta_info_in_ph_flag"); -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - WRITE_FLAG( pcPPS->getConstantSliceHeaderParamsEnabledFlag(), "constant_slice_header_params_enabled_flag"); - if ( pcPPS->getConstantSliceHeaderParamsEnabledFlag() ) { - WRITE_CODE( pcPPS->getPPSDepQuantEnabledIdc(), 2, "pps_dep_quant_enabled_idc"); - WRITE_CODE( pcPPS->getPPSRefPicListSPSIdc0(), 2, "pps_ref_pic_list_sps_idc[0]"); - WRITE_CODE( pcPPS->getPPSRefPicListSPSIdc1(), 2, "pps_ref_pic_list_sps_idc[1]"); - WRITE_CODE( pcPPS->getPPSMvdL1ZeroIdc(), 2, "pps_mvd_l1_zero_idc"); - WRITE_CODE( pcPPS->getPPSCollocatedFromL0Idc(), 2, "pps_collocated_from_l0_idc"); - WRITE_UVLC( pcPPS->getPPSSixMinusMaxNumMergeCandPlus1(), "pps_six_minus_max_num_merge_cand_plus1"); -#if !JVET_Q0806 - WRITE_UVLC( pcPPS->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(), "pps_max_num_merge_cand_minus_max_num_triangle_cand_plus1"); -#else - WRITE_UVLC(pcPPS->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1(), "pps_max_num_merge_cand_minus_max_num_gpm_cand_plus1"); -#endif - } -#endif WRITE_FLAG( pcPPS->getPictureHeaderExtensionPresentFlag() ? 1 : 0, "picture_header_extension_present_flag"); @@ -557,52 +468,10 @@ void HLSWriter::codePPS( const PPS* pcPPS ) if (pps_extension_present_flag) { -#if !REMOVE_PPS_REXT -#if ENABLE_TRACING /*|| RExt__DECODER_DEBUG_BIT_STATISTICS*/ - static const char *syntaxStrings[]={ "pps_range_extension_flag", - "pps_multilayer_extension_flag", - "pps_extension_6bits[0]", - "pps_extension_6bits[1]", - "pps_extension_6bits[2]", - "pps_extension_6bits[3]", - "pps_extension_6bits[4]", - "pps_extension_6bits[5]" }; -#endif - - for(int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) - { - WRITE_FLAG( pps_extension_flags[i]?1:0, syntaxStrings[i] ); - } - - for(int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. - { - if (pps_extension_flags[i]) - { - switch (PPSExtensionFlagIndex(i)) - { - case PPS_EXT__REXT: - { - const PPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); - - WRITE_FLAG((ppsRangeExtension.getCrossComponentPredictionEnabledFlag() ? 1 : 0), "cross_component_prediction_enabled_flag" ); -#if !JVET_Q0441_SAO_MOD_12_BIT - WRITE_UVLC( ppsRangeExtension.getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), "log2_sao_offset_scale_luma" ); - WRITE_UVLC( ppsRangeExtension.getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA), "log2_sao_offset_scale_chroma" ); -#endif - } - break; - default: - CHECK(pps_extension_flags[i]==false, "Unknown PPS extension signalled"); // Should never get here with an active PPS extension flag. - break; - } // switch - } // if flag present - } // loop over PPS flags -#else for(int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) { WRITE_FLAG( pps_extension_flags[i]?1:0, "pps_extension_data_flag" ); } -#endif } // pps_extension_present_flag is non-zero xWriteRbspTrailingBits(); } @@ -639,19 +508,13 @@ void HLSWriter::codeAlfAps( APS* pcAPS ) WRITE_FLAG(param.newFilterFlag[CHANNEL_TYPE_LUMA], "alf_luma_new_filter"); WRITE_FLAG(param.newFilterFlag[CHANNEL_TYPE_CHROMA], "alf_chroma_new_filter"); -#if JVET_Q0795_CCALF CcAlfFilterParam paramCcAlf = pcAPS->getCcAlfAPSParam(); WRITE_FLAG(paramCcAlf.newCcAlfFilter[COMPONENT_Cb - 1], "alf_cc_cb_filter_signal_flag"); WRITE_FLAG(paramCcAlf.newCcAlfFilter[COMPONENT_Cr - 1], "alf_cc_cr_filter_signal_flag"); -#endif if (param.newFilterFlag[CHANNEL_TYPE_LUMA]) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_LUMA], "alf_luma_clip" ); -#else - WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_LUMA][0], "alf_luma_clip" ); -#endif WRITE_UVLC(param.numLumaFilters - 1, "alf_luma_num_filters_signalled_minus1"); if (param.numLumaFilters > 1) @@ -667,20 +530,14 @@ void HLSWriter::codeAlfAps( APS* pcAPS ) } if (param.newFilterFlag[CHANNEL_TYPE_CHROMA]) { -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG WRITE_FLAG(param.nonLinearFlag[CHANNEL_TYPE_CHROMA], "alf_nonlinear_enable_flag_chroma"); -#endif if( MAX_NUM_ALF_ALTERNATIVES_CHROMA > 1 ) WRITE_UVLC( param.numAlternativesChroma - 1, "alf_chroma_num_alts_minus1" ); for( int altIdx=0; altIdx < param.numAlternativesChroma; ++altIdx ) { -#if !JVET_Q0249_ALF_CHROMA_CLIPFLAG - WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx], "alf_nonlinear_enable_flag_chroma" ); -#endif alfFilter(param, true, altIdx); } } -#if JVET_Q0795_CCALF for (int ccIdx = 0; ccIdx < 2; ccIdx++) { if (paramCcAlf.newCcAlfFilter[ccIdx]) @@ -725,7 +582,6 @@ void HLSWriter::codeAlfAps( APS* pcAPS ) } } } -#endif } void HLSWriter::codeLmcsAps( APS* pcAPS ) @@ -763,7 +619,6 @@ void HLSWriter::codeScalingListAps( APS* pcAPS ) codeScalingList( param ); } -#if JVET_Q0042_VUI void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS ) { #if ENABLE_TRACING @@ -810,56 +665,7 @@ void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS ) } } } -#else -void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS ) -{ -#if ENABLE_TRACING - DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n"); -#endif - - - WRITE_FLAG(pcVUI->getAspectRatioInfoPresentFlag(), "aspect_ratio_info_present_flag"); - if (pcVUI->getAspectRatioInfoPresentFlag()) - { - WRITE_FLAG(pcVUI->getAspectRatioConstantFlag(), "aspect_ratio_constant_flag"); - WRITE_CODE(pcVUI->getAspectRatioIdc(), 8, "aspect_ratio_idc" ); - if (pcVUI->getAspectRatioIdc() == 255) - { - WRITE_CODE(pcVUI->getSarWidth(), 16, "sar_width"); - WRITE_CODE(pcVUI->getSarHeight(), 16, "sar_height"); - } - } - WRITE_FLAG(pcVUI->getColourDescriptionPresentFlag(), "colour_description_present_flag"); - if (pcVUI->getColourDescriptionPresentFlag()) - { - WRITE_CODE(pcVUI->getColourPrimaries(), 8, "colour_primaries"); - WRITE_CODE(pcVUI->getTransferCharacteristics(), 8, "transfer_characteristics"); - WRITE_CODE(pcVUI->getMatrixCoefficients(), 8, "matrix_coeffs"); - WRITE_FLAG(pcVUI->getVideoFullRangeFlag(), "video_full_range_flag"); - } - WRITE_FLAG(pcVUI->getFieldSeqFlag(), "field_seq_flag"); - WRITE_FLAG(pcVUI->getChromaLocInfoPresentFlag(), "chroma_loc_info_present_flag"); - if (pcVUI->getChromaLocInfoPresentFlag()) - { - if(pcVUI->getFieldSeqFlag()) - { - WRITE_UVLC(pcVUI->getChromaSampleLocTypeTopField(), "chroma_sample_loc_type_top_field"); - WRITE_UVLC(pcVUI->getChromaSampleLocTypeBottomField(), "chroma_sample_loc_type_bottom_field"); - } - else - { - WRITE_UVLC(pcVUI->getChromaSampleLocType(), "chroma_sample_loc_type"); - } - } - WRITE_FLAG(pcVUI->getOverscanInfoPresentFlag(), "overscan_info_present_flag"); - if (pcVUI->getOverscanInfoPresentFlag()) - { - WRITE_FLAG(pcVUI->getOverscanAppropriateFlag(), "overscan_appropriate_flag"); - } -} -#endif -#if JVET_P0118_HRD_ASPECTS void HLSWriter::codeGeneralHrdparameters(const GeneralHrdParams * hrd) { WRITE_CODE(hrd->getNumUnitsInTick(), 32, "num_units_in_tick"); @@ -880,31 +686,11 @@ void HLSWriter::codeGeneralHrdparameters(const GeneralHrdParams * hrd) } WRITE_UVLC(hrd->getHrdCpbCntMinus1(), "hrd_cpb_cnt_minus1"); } -#endif -#if JVET_P0118_HRD_ASPECTS void HLSWriter::codeOlsHrdParameters(const GeneralHrdParams * generalHrd, const OlsHrdParams *olsHrd, const uint32_t firstSubLayer, const uint32_t maxNumSubLayersMinus1) { -#else -void HLSWriter::codeHrdParameters( const HRDParameters *hrd, const uint32_t firstSubLayer, const uint32_t maxNumSubLayersMinus1) -{ - WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "general_nal_hrd_parameters_present_flag" ); - WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "general_vcl_hrd_parameters_present_flag" ); - WRITE_FLAG( hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ? 1 : 0, "general_decoding_unit_hrd_params_present_flag" ); - if( hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ) - { - WRITE_CODE( hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2" ); - } - WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); - WRITE_CODE( hrd->getCpbSizeScale(), 4, "cpb_size_scale" ); - if( hrd->getGeneralDecodingUnitHrdParamsPresentFlag() ) - { - WRITE_CODE( hrd->getCpbSizeDuScale(), 4, "cpb_size_du_scale" ); - } -#endif for( int i = firstSubLayer; i <= maxNumSubLayersMinus1; i ++ ) { -#if JVET_P0118_HRD_ASPECTS const OlsHrdParams *hrd = &(olsHrd[i]); WRITE_FLAG(hrd->getFixedPicRateGeneralFlag() ? 1 : 0, "fixed_pic_rate_general_flag"); @@ -920,42 +706,13 @@ void HLSWriter::codeHrdParameters( const HRDParameters *hrd, const uint32_t firs { WRITE_FLAG(hrd->getLowDelayHrdFlag() ? 1 : 0, "low_delay_hrd_flag"); } -#else - WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0, "fixed_pic_rate_general_flag"); - bool fixedPixRateWithinCvsFlag = true; - if( !hrd->getFixedPicRateFlag( i ) ) - { - fixedPixRateWithinCvsFlag = hrd->getFixedPicRateWithinCvsFlag( i ); - WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag"); - } - if( fixedPixRateWithinCvsFlag ) - { - WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); - } - else - { - WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag"); - } - if (!hrd->getLowDelayHrdFlag( i )) - { - WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); - } -#endif for( int nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) { -#if JVET_P0118_HRD_ASPECTS if (((nalOrVcl == 0) && (generalHrd->getGeneralNalHrdParametersPresentFlag())) || ((nalOrVcl == 1) && (generalHrd->getGeneralVclHrdParametersPresentFlag()))) { for (int j = 0; j <= (generalHrd->getHrdCpbCntMinus1()); j++) -#else - if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) - { - for( int j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) -#endif { -#if JVET_P0118_HRD_ASPECTS WRITE_UVLC(hrd->getBitRateValueMinus1(j, nalOrVcl), "bit_rate_value_minus1"); WRITE_UVLC(hrd->getCpbSizeValueMinus1(j, nalOrVcl), "cpb_size_value_minus1"); if (generalHrd->getGeneralDecodingUnitHrdParamsPresentFlag()) @@ -964,18 +721,12 @@ void HLSWriter::codeHrdParameters( const HRDParameters *hrd, const uint32_t firs WRITE_UVLC(hrd->getDuCpbSizeValueMinus1(j, nalOrVcl), "cpb_size_du_value_minus1"); } WRITE_FLAG(hrd->getCbrFlag(j, nalOrVcl) ? 1 : 0, "cbr_flag"); -#else - WRITE_UVLC( hrd->getBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_value_minus1"); - WRITE_UVLC( hrd->getCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_value_minus1"); - WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); -#endif } } } } } -#if JVET_P0117_PTL_SCALABILITY void HLSWriter::dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, const SPS *pcSPS) { for (uint32_t i = (subLayerInfoFlag ? 0 : maxSubLayersMinus1); i <= maxSubLayersMinus1; i++) @@ -985,50 +736,29 @@ void HLSWriter::dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, co WRITE_UVLC(pcSPS->getMaxLatencyIncreasePlus1(i), "max_latency_increase_plus1[i]"); } } -#endif void HLSWriter::codeSPS( const SPS* pcSPS ) { #if ENABLE_TRACING xTraceSPSHeader (); #endif -#if JVET_Q0117_PARAMETER_SETS_CLEANUP WRITE_CODE(pcSPS->getSPSId(), 4, "sps_seq_parameter_set_id"); -#else - WRITE_CODE( pcSPS->getDecodingParameterSetId (), 4, "sps_decoding_parameter_set_id" ); -#endif WRITE_CODE( pcSPS->getVPSId(), 4, "sps_video_parameter_set_id" ); CHECK(pcSPS->getMaxTLayers() == 0, "Maximum number of temporal sub-layers is '0'"); WRITE_CODE(pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1"); -#if JVET_P0117_PTL_SCALABILITY WRITE_CODE(0, 4, "sps_reserved_zero_4bits"); WRITE_FLAG(pcSPS->getPtlDpbHrdParamsPresentFlag(), "sps_ptl_dpb_hrd_params_present_flag"); -#else - WRITE_CODE(0, 5, "sps_reserved_zero_5bits"); -#endif -#if JVET_P0117_PTL_SCALABILITY if (pcSPS->getPtlDpbHrdParamsPresentFlag()) { -#endif -#if JVET_Q0786_PTL_only codeProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1); -#else - codeProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); -#endif -#if JVET_P0117_PTL_SCALABILITY } -#endif WRITE_FLAG(pcSPS->getGDREnabledFlag(), "gdr_enabled_flag"); -#if !JVET_Q0117_PARAMETER_SETS_CLEANUP - WRITE_CODE( pcSPS->getSPSId (), 4, "sps_seq_parameter_set_id" ); -#endif WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc"); const ChromaFormat format = pcSPS->getChromaFormatIdc(); -#if JVET_Q0265 const uint32_t separate_colour_plane_flag = pcSPS->getSeparateColourPlaneFlag(); if( format == CHROMA_444 ) { @@ -1037,22 +767,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } const uint32_t chromaArrayType = separate_colour_plane_flag ? 0 : format; -#else - if( format == CHROMA_444 ) - { - WRITE_FLAG( 0, "separate_colour_plane_flag"); - } -#endif -#if JVET_Q0043_RPR_and_Subpics WRITE_FLAG( pcSPS->getRprEnabledFlag(), "res_change_in_clvs_allowed_flag" ); -#else - WRITE_FLAG( pcSPS->getRprEnabledFlag(), "ref_pic_resampling_enabled_flag" ); -#endif WRITE_UVLC( pcSPS->getMaxPicWidthInLumaSamples(), "pic_width_max_in_luma_samples" ); WRITE_UVLC( pcSPS->getMaxPicHeightInLumaSamples(), "pic_height_max_in_luma_samples" ); -#if JVET_Q0260_CONFORMANCE_WINDOW_IN_SPS Window conf = pcSPS->getConformanceWindow(); WRITE_FLAG(conf.getWindowEnabledFlag(), "sps_conformance_window_flag"); if (conf.getWindowEnabledFlag()) @@ -1063,90 +782,39 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_UVLC(conf.getWindowBottomOffset(), "sps_conf_win_bottom_offset"); } -#endif WRITE_CODE(floorLog2(pcSPS->getCTUSize()) - 5, 2, "sps_log2_ctu_size_minus5"); -#if JVET_Q0043_RPR_and_Subpics | JVET_Q0119_CLEANUPS -#if JVET_Q0119_CLEANUPS WRITE_FLAG(pcSPS->getSubPicInfoPresentFlag(), "subpic_info_present_flag"); -#else - WRITE_FLAG(pcSPS->getSubPicPresentFlag(), "subpic_info_present_flag"); -#endif -#else - WRITE_FLAG(pcSPS->getSubPicPresentFlag(), "subpics_present_flag"); -#endif -#if JVET_Q0119_CLEANUPS + if (pcSPS->getSubPicInfoPresentFlag()) -#else - if(pcSPS->getSubPicPresentFlag()) -#endif { CHECK(pcSPS->getNumSubPics() < 1, "SPS: NumSubPics cannot be less than 1"); -#if JVET_Q0119_CLEANUPS WRITE_UVLC(pcSPS->getNumSubPics() - 1, "sps_num_subpics_minus1"); -#else - WRITE_CODE(pcSPS->getNumSubPics() - 1, 8, "sps_num_subpics_minus1"); -#endif -#if JVET_Q0816 if( pcSPS->getNumSubPics() > 1 ) { -#endif for (int picIdx = 0; picIdx < pcSPS->getNumSubPics(); picIdx++) { -#if JVET_Q0787_SUBPIC -#if JVET_Q0222_SUBPICTURE_SIGNALLING if ((picIdx > 0) && (pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize())) -#else - if (pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize()) -#endif { WRITE_CODE( pcSPS->getSubPicCtuTopLeftX(picIdx), ceilLog2(( pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), "subpic_ctu_top_left_x[ i ]" ); } -#if JVET_Q0222_SUBPICTURE_SIGNALLING if ((picIdx > 0) && (pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize())) -#else - if (pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize()) -#endif { WRITE_CODE( pcSPS->getSubPicCtuTopLeftY(picIdx), ceilLog2(( pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), "subpic_ctu_top_left_y[ i ]" ); } -#if JVET_Q0413_SKIP_LAST_SUBPIC_SIG if (picIdx<pcSPS->getNumSubPics()-1 && pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize()) -#else - if (pcSPS->getMaxPicWidthInLumaSamples() > pcSPS->getCTUSize()) -#endif { WRITE_CODE( pcSPS->getSubPicWidth(picIdx) - 1, ceilLog2(( pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), "subpic_width_minus1[ i ]" ); } -#if JVET_Q0413_SKIP_LAST_SUBPIC_SIG if (picIdx<pcSPS->getNumSubPics() - 1 && pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize()) -#else - if (pcSPS->getMaxPicHeightInLumaSamples() > pcSPS->getCTUSize()) -#endif { WRITE_CODE( pcSPS->getSubPicHeight(picIdx) - 1, ceilLog2(( pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) / pcSPS->getCTUSize()), "subpic_height_minus1[ i ]" ); } -#else -#if JVET_Q0222_SUBPICTURE_SIGNALLING - if (picIdx > 0) - { -#endif - WRITE_CODE( pcSPS->getSubPicCtuTopLeftX(picIdx), std::max(1, ceilLog2((( pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2( pcSPS->getCTUSize())))), "subpic_ctu_top_left_x[ i ]" ); - WRITE_CODE( pcSPS->getSubPicCtuTopLeftY(picIdx), std::max(1, ceilLog2((( pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2( pcSPS->getCTUSize())))), "subpic_ctu_top_left_y[ i ]" ); -#if JVET_Q0222_SUBPICTURE_SIGNALLING - } -#endif - WRITE_CODE( pcSPS->getSubPicWidth(picIdx) - 1, std::max(1, ceilLog2((( pcSPS->getMaxPicWidthInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2( pcSPS->getCTUSize())))), "subpic_width_minus1[ i ]" ); - WRITE_CODE( pcSPS->getSubPicHeight(picIdx) - 1, std::max(1, ceilLog2((( pcSPS->getMaxPicHeightInLumaSamples() + pcSPS->getCTUSize() - 1) >> floorLog2( pcSPS->getCTUSize())))), "subpic_height_minus1[ i ]" ); -#endif WRITE_FLAG( pcSPS->getSubPicTreatedAsPicFlag(picIdx), "subpic_treated_as_pic_flag[ i ]" ); WRITE_FLAG( pcSPS->getLoopFilterAcrossSubpicEnabledFlag(picIdx), "loop_filter_across_subpic_enabled_flag[ i ]" ); } -#if JVET_Q0816 } -#endif -#if JVET_Q0119_CLEANUPS CHECK(pcSPS->getSubPicIdLen() < 1, "SPS: SubPicIdLen cannot be less than 1"); WRITE_UVLC(pcSPS->getSubPicIdLen() - 1, "sps_subpic_id_len_minus1"); WRITE_FLAG(pcSPS->getSubPicIdMappingExplicitlySignalledFlag(), "subpic_id_mapping_explicitly_signalled_flag"); @@ -1162,84 +830,36 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } } -#else - } - - WRITE_FLAG( pcSPS->getSubPicIdPresentFlag(), "sps_subpic_id_present_flag"); - if( pcSPS->getSubPicIdPresentFlag() ) - { - WRITE_FLAG(pcSPS->getSubPicIdSignallingPresentFlag(), "sps_subpic_id_signalling_present_flag"); - if( pcSPS->getSubPicIdSignallingPresentFlag() ) - { - WRITE_UVLC( pcSPS->getSubPicIdLen( ) - 1, "sps_subpic_id_len_minus1" ); -#if JVET_Q0169_SUBPIC_LEN_CONFORM - CHECK((1 << pcSPS->getSubPicIdLen()) < pcSPS->getNumSubPics(), "sps_subpic_id_len exceeds valid range"); -#endif - for( int picIdx = 0; picIdx < pcSPS->getNumSubPics( ); picIdx++ ) - { - WRITE_CODE( pcSPS->getSubPicId(picIdx), pcSPS->getSubPicIdLen( ), "sps_subpic_id[i]" ); - } - } - } -#endif WRITE_UVLC( pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) - 8, "bit_depth_minus8" ); -#if !JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL - WRITE_UVLC( pcSPS->getMinQpPrimeTsMinus4(CHANNEL_TYPE_LUMA), "min_qp_prime_ts_minus4" ); -#endif -#if JVET_Q0151_Q0205_ENTRYPOINTS WRITE_FLAG( pcSPS->getEntropyCodingSyncEnabledFlag() ? 1 : 0, "sps_entropy_coding_sync_enabled_flag" ); if (pcSPS->getEntropyCodingSyncEnabledFlag()) { WRITE_FLAG( pcSPS->getEntropyCodingSyncEntryPointsPresentFlag() ? 1 : 0, "sps_wpp_entry_point_offsets_present_flag" ); } -#endif WRITE_FLAG( pcSPS->getUseWP() ? 1 : 0, "sps_weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) WRITE_FLAG( pcSPS->getUseWPBiPred() ? 1 : 0, "sps_weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) WRITE_CODE(pcSPS->getBitsForPOC()-4, 4, "log2_max_pic_order_cnt_lsb_minus4"); -#if JVET_P0116_POC_MSB WRITE_FLAG(pcSPS->getPocMsbFlag() ? 1 : 0, "sps_poc_msb_flag"); if (pcSPS->getPocMsbFlag()) { WRITE_UVLC(pcSPS->getPocMsbLen() - 1, "poc_msb_len_minus1"); } -#endif -#if JVET_Q0400_EXTRA_BITS // extra bits are for future extensions, so these are currently hard coded to not being sent WRITE_CODE(0, 2, "num_extra_ph_bits_bytes"); // extra_ph_bits_struct( num_extra_ph_bits_bytes ) WRITE_CODE(0, 2, "num_extra_sh_bits_bytes"); // extra_sh_bits_struct( num_extra_sh_bits_bytes ) -#endif -#if JVET_P0117_PTL_SCALABILITY if (pcSPS->getMaxTLayers() - 1 > 0) WRITE_FLAG(pcSPS->getSubLayerDpbParamsFlag(), "sps_sublayer_dpb_params_flag"); if (pcSPS->getPtlDpbHrdParamsPresentFlag()) { dpb_parameters(pcSPS->getMaxTLayers() - 1, pcSPS->getSubLayerDpbParamsFlag(), pcSPS); } -#else - // KJS: Marakech decision: sub-layers added back - const bool subLayerOrderingInfoPresentFlag = 1; - if (pcSPS->getMaxTLayers() > 1) - { - WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); - } - for(uint32_t i=0; i <= pcSPS->getMaxTLayers()-1; i++) - { - WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); - WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_max_num_reorder_pics[i]" ); - WRITE_UVLC( pcSPS->getMaxLatencyIncreasePlus1(i), "sps_max_latency_increase_plus1[i]" ); - if (!subLayerOrderingInfoPresentFlag) - { - break; - } - } -#endif CHECK( pcSPS->getMaxCUWidth() != pcSPS->getMaxCUHeight(), "Rectangular CTUs not supported" ); WRITE_FLAG(pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_flag"); WRITE_FLAG( pcSPS->getInterLayerPresentFlag() ? 1 : 0, "inter_layer_ref_pics_present_flag" ); @@ -1276,20 +896,14 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_UVLC(pcSPS->getLog2MinCodingBlockSize() - 2, "log2_min_luma_coding_block_size_minus2"); WRITE_FLAG(pcSPS->getSplitConsOverrideEnabledFlag(), "partition_constraints_override_enabled_flag"); WRITE_UVLC(floorLog2(pcSPS->getMinQTSize(I_SLICE)) - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice_luma"); -#if !JVET_Q0481_PARTITION_CONSTRAINTS_ORDER - WRITE_UVLC(floorLog2(pcSPS->getMinQTSize(B_SLICE)) - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_slice"); - WRITE_UVLC(pcSPS->getMaxMTTHierarchyDepth(), "sps_max_mtt_hierarchy_depth_inter_slice"); -#endif WRITE_UVLC(pcSPS->getMaxMTTHierarchyDepthI(), "sps_max_mtt_hierarchy_depth_intra_slice_luma"); if (pcSPS->getMaxMTTHierarchyDepthI() != 0) { WRITE_UVLC(floorLog2(pcSPS->getMaxBTSizeI()) - floorLog2(pcSPS->getMinQTSize(I_SLICE)), "sps_log2_diff_max_bt_min_qt_intra_slice_luma"); WRITE_UVLC(floorLog2(pcSPS->getMaxTTSizeI()) - floorLog2(pcSPS->getMinQTSize(I_SLICE)), "sps_log2_diff_max_tt_min_qt_intra_slice_luma"); } -#if JVET_Q0481_PARTITION_CONSTRAINTS_ORDER WRITE_UVLC(floorLog2(pcSPS->getMinQTSize(B_SLICE)) - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_slice"); WRITE_UVLC(pcSPS->getMaxMTTHierarchyDepth(), "sps_max_mtt_hierarchy_depth_inter_slice"); -#endif if (pcSPS->getMaxMTTHierarchyDepth() != 0) { WRITE_UVLC(floorLog2(pcSPS->getMaxBTSize()) - floorLog2(pcSPS->getMinQTSize(B_SLICE)), "sps_log2_diff_max_bt_min_qt_inter_slice"); @@ -1308,19 +922,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( (pcSPS->getLog2MaxTbSize() - 5) ? 1 : 0, "sps_max_luma_transform_size_64_flag" ); -#if JVET_Q0147_JCCR_SIGNALLING -#if JVET_Q0265 if (chromaArrayType != CHROMA_400) -#else - if (pcSPS->getChromaFormatIdc() != CHROMA_400) -#endif { WRITE_FLAG(pcSPS->getJointCbCrEnabledFlag(), "sps_joint_cbcr_enabled_flag"); -#else - WRITE_FLAG(pcSPS->getJointCbCrEnabledFlag(), "sps_joint_cbcr_enabled_flag"); - if (pcSPS->getChromaFormatIdc() != CHROMA_400) - { -#endif const ChromaQpMappingTable& chromaQpMappingTable = pcSPS->getChromaQpMappingTable(); WRITE_FLAG(chromaQpMappingTable.getSameCQPTableForAllChromaFlag(), "same_qp_table_for_chroma"); int numQpTables = chromaQpMappingTable.getSameCQPTableForAllChromaFlag() ? 1 : (pcSPS->getJointCbCrEnabledFlag() ? 3 : 2); @@ -1341,56 +945,26 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getSAOEnabledFlag(), "sps_sao_enabled_flag"); WRITE_FLAG( pcSPS->getALFEnabledFlag(), "sps_alf_enabled_flag" ); -#if JVET_Q0795_CCALF if (pcSPS->getALFEnabledFlag() && pcSPS->getChromaFormatIdc() != CHROMA_400) { WRITE_FLAG( pcSPS->getCCALFEnabledFlag(), "sps_ccalf_enabled_flag" ); } -#endif WRITE_FLAG(pcSPS->getTransformSkipEnabledFlag() ? 1 : 0, "sps_transform_skip_enabled_flag"); if (pcSPS->getTransformSkipEnabledFlag()) { -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL WRITE_UVLC(pcSPS->getLog2MaxTransformSkipBlockSize() - 2, "log2_transform_skip_max_size_minus2"); -#endif -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM WRITE_FLAG(pcSPS->getBDPCMEnabledFlag() ? 1 : 0, "sps_bdpcm_enabled_flag"); -#else - WRITE_FLAG(pcSPS->getBDPCMEnabled() ? 1 : 0, "sps_bdpcm_enabled_flag"); -#if JVET_Q0110_Q0785_CHROMA_BDPCM_420 - if( pcSPS->getBDPCMEnabled() ) -#else - if (pcSPS->getBDPCMEnabled() && pcSPS->getChromaFormatIdc() == CHROMA_444) -#endif - { - WRITE_FLAG(pcSPS->getBDPCMEnabled() == BDPCM_LUMACHROMA ? 1 : 0, "sps_bdpcm_enabled_chroma_flag"); - } -#if !JVET_Q0110_Q0785_CHROMA_BDPCM_420 - else - { - CHECK(pcSPS->getBDPCMEnabled() == BDPCM_LUMACHROMA, "BDPCM for chroma can be used for 444 only.") - } -#endif -#endif } else { -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM CHECK(pcSPS->getBDPCMEnabledFlag(), "BDPCM cannot be used when transform skip is disabled"); -#else - CHECK(pcSPS->getBDPCMEnabled()!=0, "BDPCM cannot be used when transform skip is disabled"); -#endif } WRITE_FLAG( pcSPS->getWrapAroundEnabledFlag() ? 1 : 0, "sps_ref_wraparound_enabled_flag" ); if( pcSPS->getWrapAroundEnabledFlag() ) { -#if JVET_Q0416_WRAPAROUND_OFFSET WRITE_UVLC((pcSPS->getWrapAroundOffset() / (1 << pcSPS->getLog2MinCodingBlockSize())) - 2 - pcSPS->getCTUSize()/(1<<pcSPS->getLog2MinCodingBlockSize()), "sps_ref_wraparound_offset"); -#else - WRITE_UVLC( (pcSPS->getWrapAroundOffset()/(1 << pcSPS->getLog2MinCodingBlockSize()))-1, "sps_ref_wraparound_offset_minus1" ); -#endif } WRITE_FLAG( pcSPS->getSPSTemporalMVPEnabledFlag() ? 1 : 0, "sps_temporal_mvp_enabled_flag" ); @@ -1433,67 +1007,40 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUseIntraMTS() ? 1 : 0, "sps_explicit_mts_intra_enabled_flag" ); WRITE_FLAG( pcSPS->getUseInterMTS() ? 1 : 0, "sps_explicit_mts_inter_enabled_flag" ); } -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE CHECK(pcSPS->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported"); WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSPS->getMaxNumMergeCand(), "six_minus_max_num_merge_cand"); -#endif WRITE_FLAG( pcSPS->getUseSBT() ? 1 : 0, "sps_sbt_enabled_flag"); WRITE_FLAG( pcSPS->getUseAffine() ? 1 : 0, "sps_affine_enabled_flag" ); if ( pcSPS->getUseAffine() ) { -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE WRITE_UVLC(AFFINE_MRG_MAX_NUM_CANDS - pcSPS->getMaxNumAffineMergeCand(), "five_minus_max_num_subblock_merge_cand"); -#endif WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0, "sps_affine_type_flag" ); -#if JVET_Q0444_AMVR_SIGNALLING if (pcSPS->getAMVREnabledFlag()) { -#endif WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" ); -#if JVET_Q0444_AMVR_SIGNALLING } -#endif WRITE_FLAG( pcSPS->getUsePROF() ? 1 : 0, "sps_affine_prof_enabled_flag" ); if (pcSPS->getUsePROF()) { WRITE_FLAG(pcSPS->getProfControlPresentFlag() ? 1 : 0, "sps_prof_pic_present_flag" ); } } -#if !JVET_Q0820_ACT - if (pcSPS->getChromaFormatIdc() == CHROMA_444) - { - WRITE_FLAG(pcSPS->getUseColorTrans() ? 1 : 0, "sps_act_enabled_flag"); - } -#endif -#if JVET_Q0504_PLT_NON444 WRITE_FLAG(pcSPS->getPLTMode() ? 1 : 0, "sps_palette_enabled_flag" ); -#else - if (pcSPS->getChromaFormatIdc() == CHROMA_444) - { - WRITE_FLAG(pcSPS->getPLTMode() ? 1 : 0, "sps_palette_enabled_flag" ); - } -#endif -#if JVET_Q0820_ACT if (pcSPS->getChromaFormatIdc() == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6) { WRITE_FLAG(pcSPS->getUseColorTrans() ? 1 : 0, "sps_act_enabled_flag"); } -#endif -#if JVET_Q0183_SPS_TRANSFORM_SKIP_MODE_CONTROL if (pcSPS->getTransformSkipEnabledFlag() || pcSPS->getPLTMode()) { WRITE_UVLC(pcSPS->getMinQpPrimeTsMinus4(CHANNEL_TYPE_LUMA), "min_qp_prime_ts_minus4"); } -#endif WRITE_FLAG( pcSPS->getUseBcw() ? 1 : 0, "sps_bcw_enabled_flag" ); WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "sps_ibc_enabled_flag"); -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pcSPS->getIBCFlag()) { CHECK(pcSPS->getMaxNumIBCMergeCand() > IBC_MRG_MAX_NUM_CANDS, "More IBC merge candidates signalled than supported"); WRITE_UVLC(IBC_MRG_MAX_NUM_CANDS - pcSPS->getMaxNumIBCMergeCand(), "six_minus_max_num_ibc_merge_cand"); } -#endif // KJS: sps_ciip_enabled_flag WRITE_FLAG( pcSPS->getUseCiip() ? 1 : 0, "sps_ciip_enabled_flag" ); @@ -1502,22 +1049,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getFpelMmvdEnabledFlag() ? 1 : 0, "sps_fpel_mmvd_enabled_flag" ); } -#if !JVET_Q0806 -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - if (pcSPS->getMaxNumMergeCand() >= 2) - { - WRITE_FLAG(pcSPS->getUseTriangle() ? 1 : 0, "sps_triangle_enabled_flag"); - if (pcSPS->getUseTriangle() && pcSPS->getMaxNumMergeCand() >= 3) - { - CHECK(pcSPS->getMaxNumMergeCand() < pcSPS->getMaxNumGeoCand(), "Incorrrect max number of Triangle candidates!"); - WRITE_UVLC(pcSPS->getMaxNumMergeCand() - pcSPS->getMaxNumGeoCand(), "max_num_merge_cand_minus_max_num_gpm_cand"); - } - } -#else - WRITE_FLAG( pcSPS->getUseTriangle() ? 1: 0, "sps_triangle_enabled_flag" ); -#endif -#else -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE if (pcSPS->getMaxNumMergeCand() >= 2) { WRITE_FLAG(pcSPS->getUseGeo() ? 1 : 0, "sps_gpm_enabled_flag"); @@ -1527,10 +1058,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_UVLC(pcSPS->getMaxNumMergeCand() - pcSPS->getMaxNumGeoCand(), "max_num_merge_cand_minus_max_num_gpm_cand"); } } -#else - WRITE_FLAG( pcSPS->getUseGeo() ? 1: 0, "sps_gpm_enabled_flag" ); -#endif -#endif WRITE_FLAG(pcSPS->getUseLmcs() ? 1 : 0, "sps_lmcs_enable_flag"); WRITE_FLAG( pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag" ); @@ -1547,34 +1074,24 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } #endif -#if JVET_Q0297_MER WRITE_UVLC(pcSPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); -#endif // KJS: reference picture sets to be replaced // KJS: remove scaling lists? WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "sps_scaling_list_enabled_flag" ); -#if DQ_SDH_SIGNALLING WRITE_FLAG(pcSPS->getDepQuantEnabledFlag(), "sps_dep_quant_enabled_flag"); if (!pcSPS->getDepQuantEnabledFlag()) { WRITE_FLAG(pcSPS->getSignDataHidingEnabledFlag(), "sps_sign_data_hiding_enabled_flag"); } -#endif -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG WRITE_FLAG( pcSPS->getVirtualBoundariesEnabledFlag(), "sps_virtual_boundaries_enabled_flag" ); if( pcSPS->getVirtualBoundariesEnabledFlag() ) { WRITE_FLAG( pcSPS->getVirtualBoundariesPresentFlag(), "sps_loop_filter_across_virtual_boundaries_present_flag" ); if( pcSPS->getVirtualBoundariesPresentFlag() ) { -#else - WRITE_FLAG( pcSPS->getLoopFilterAcrossVirtualBoundariesDisabledFlag(), "sps_loop_filter_across_virtual_boundaries_disabled_present_flag" ); - if( pcSPS->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { -#endif WRITE_CODE( pcSPS->getNumVerVirtualBoundaries(), 2, "sps_num_ver_virtual_boundaries"); for( unsigned i = 0; i < pcSPS->getNumVerVirtualBoundaries(); i++ ) { @@ -1586,63 +1103,23 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_CODE((pcSPS->getVirtualBoundariesPosY(i)>>3), 13, "sps_virtual_boundaries_pos_y"); } } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif -#if JVET_P0117_PTL_SCALABILITY if (pcSPS->getPtlDpbHrdParamsPresentFlag()) { -#endif -#if !JVET_P0118_HRD_ASPECTS - const TimingInfo *timingInfo = pcSPS->getTimingInfo(); -#endif -#if JVET_P0118_HRD_ASPECTS WRITE_FLAG(pcSPS->getGeneralHrdParametersPresentFlag(), "sps_general_hrd_parameters_present_flag"); -#else - WRITE_FLAG(pcSPS->getHrdParametersPresentFlag(), "general_hrd_parameters_present_flag"); -#endif -#if JVET_P0118_HRD_ASPECTS if (pcSPS->getGeneralHrdParametersPresentFlag()) -#else - if( pcSPS->getHrdParametersPresentFlag() ) -#endif { -#if !JVET_P0118_HRD_ASPECTS - WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "num_units_in_tick"); - WRITE_CODE(timingInfo->getTimeScale(), 32, "time_scale"); -#endif -#if JVET_P0118_HRD_ASPECTS codeGeneralHrdparameters(pcSPS->getGeneralHrdParameters()); -#endif -#if JVET_P0118_HRD_ASPECTS if ((pcSPS->getMaxTLayers() - 1) > 0) { WRITE_FLAG(pcSPS->getSubLayerParametersPresentFlag(), "sps_sublayer_cpb_params_present_flag"); } uint32_t firstSubLayer = pcSPS->getSubLayerParametersPresentFlag() ? 0 : (pcSPS->getMaxTLayers() - 1); -#else - WRITE_FLAG(pcSPS->getSubLayerParametersPresentFlag(), "sub_layer_cpb_parameters_present_flag"); -#endif -#if JVET_P0118_HRD_ASPECTS codeOlsHrdParameters(pcSPS->getGeneralHrdParameters(), pcSPS->getOlsHrdParameters(), firstSubLayer, pcSPS->getMaxTLayers() - 1); -#else - if (pcSPS->getSubLayerParametersPresentFlag()) - { - codeHrdParameters(pcSPS->getHrdParameters(), 0, pcSPS->getMaxTLayers() - 1); - } - else - { - codeHrdParameters(pcSPS->getHrdParameters(), pcSPS->getMaxTLayers() - 1, pcSPS->getMaxTLayers() - 1); - } -#endif } -#if JVET_P0117_PTL_SCALABILITY } -#endif -#if JVET_Q0042_VUI WRITE_FLAG(pcSPS->getFieldSeqFlag(), "field_seq_flag"); -#endif WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(), "vui_parameters_present_flag" ); if (pcSPS->getVuiParametersPresentFlag()) { @@ -1711,7 +1188,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } xWriteRbspTrailingBits(); } -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void HLSWriter::codeDCI(const DCI* dci) { #if ENABLE_TRACING @@ -1727,43 +1203,12 @@ void HLSWriter::codeDCI(const DCI* dci) for (int i = 0; i < numPTLs; i++) { ProfileTierLevel ptl = dci->getProfileTierLevel(i); -#if JVET_Q0786_PTL_only codeProfileTierLevel(&ptl, true, 0); -#else - codeProfileTierLevel(&ptl, 0); -#endif } WRITE_FLAG(0, "dci_extension_flag"); xWriteRbspTrailingBits(); } -#else -void HLSWriter::codeDPS( const DPS* dps ) -{ -#if ENABLE_TRACING - xTraceDPSHeader(); -#endif - WRITE_CODE( dps->getDecodingParameterSetId(), 4, "dps_decoding_parameter_set_id" ); - WRITE_CODE( dps->getMaxSubLayersMinus1(), 3, "dps_max_sub_layers_minus1" ); - WRITE_CODE( 0, 5, "dps_reserved_zero_5bits" ); - uint32_t numPTLs = (uint32_t) dps->getNumPTLs(); - CHECK (numPTLs<1, "At least one PTL must be available in DPS"); - - WRITE_CODE( numPTLs - 1, 4, "dps_num_ptls_minus1" ); - - for (int i=0; i< numPTLs; i++) - { - ProfileTierLevel ptl = dps->getProfileTierLevel(i); -#if JVET_Q0786_PTL_only - codeProfileTierLevel( &ptl, true, 0 ); -#else - codeProfileTierLevel( &ptl, dps->getMaxSubLayersMinus1() ); -#endif - } - WRITE_FLAG( 0, "dps_extension_flag" ); - xWriteRbspTrailingBits(); -} -#endif void HLSWriter::codeVPS(const VPS* pcVPS) { #if ENABLE_TRACING @@ -1820,7 +1265,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS) } } -#if JVET_Q0786_PTL_only int totalNumOlss = pcVPS->getTotalNumOLSs(); WRITE_CODE(pcVPS->getNumPtls() - 1, 8, "vps_num_ptls_minus1"); for (int i = 0; i < pcVPS->getNumPtls(); i++) @@ -1846,9 +1290,7 @@ void HLSWriter::codeVPS(const VPS* pcVPS) if(pcVPS->getNumPtls() > 1) WRITE_CODE(pcVPS->getOlsPtlIdx(i), 8, "ols_ptl_idx"); } -#endif -#if JVET_Q0814_DPB if( !pcVPS->getAllIndependentLayersFlag() ) { WRITE_UVLC( pcVPS->m_numDpbParams, "vps_num_dpb_params" ); @@ -1897,8 +1339,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS) } } } -#endif -#if JVET_P0118_HRD_ASPECTS if (!pcVPS->getEachLayerIsAnOlsFlag()) { WRITE_FLAG(pcVPS->getVPSGeneralHrdParamsPresentFlag(), "vps_general_hrd_params_present_flag"); @@ -1931,7 +1371,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS) } } } -#endif WRITE_FLAG(0, "vps_extension_flag"); @@ -1939,11 +1378,7 @@ void HLSWriter::codeVPS(const VPS* pcVPS) xWriteRbspTrailingBits(); } -#if JVET_Q0775_PH_IN_SH void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingBits ) -#else -void HLSWriter::codePictureHeader( PicHeader* picHeader ) -#endif { const PPS* pps = NULL; const SPS* sps = NULL; @@ -1953,7 +1388,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) #endif CodingStructure& cs = *picHeader->getPic()->cs; -#if JVET_Q0819_PH_CHANGES WRITE_FLAG(picHeader->getGdrOrIrapPicFlag(), "gdr_or_irap_pic_flag"); if (picHeader->getGdrOrIrapPicFlag()) { @@ -1965,12 +1399,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) { WRITE_FLAG(picHeader->getPicIntraSliceAllowedFlag(), "ph_intra_slice_allowed_flag"); } -#endif WRITE_FLAG(picHeader->getNonReferencePictureFlag(), "non_reference_picture_flag"); -#if !JVET_Q0819_PH_CHANGES - WRITE_FLAG(picHeader->getGdrPicFlag(), "gdr_pic_flag"); -#endif -#if JVET_Q0819_PH_CHANGES // parameter sets WRITE_UVLC(picHeader->getPPSId(), "ph_pic_parameter_set_id"); pps = cs.slice->getPPS(); @@ -1984,9 +1413,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) { WRITE_FLAG(picHeader->getNoOutputOfPriorPicsFlag(), "no_output_of_prior_pics_flag"); } -#else - WRITE_FLAG(picHeader->getNoOutputOfPriorPicsFlag(), "no_output_of_prior_pics_flag"); -#endif if( picHeader->getGdrPicFlag() ) { WRITE_UVLC(picHeader->getRecoveryPocCnt(), "recovery_poc_cnt"); @@ -1995,14 +1421,11 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) { picHeader->setRecoveryPocCnt( 0 ); } -#if JVET_Q0400_EXTRA_BITS // PH extra bits are not written in the reference encoder // as these bits are reserved for future extensions // for( i = 0; i < NumExtraPhBits; i++ ) // ph_extra_bit[ i ] -#endif -#if JVET_P0116_POC_MSB if (sps->getPocMsbFlag()) { WRITE_FLAG(picHeader->getPocMsbPresentFlag(), "ph_poc_msb_present_flag"); @@ -2011,27 +1434,12 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) WRITE_CODE(picHeader->getPocMsbVal(), sps->getPocMsbLen(), "poc_msb_val"); } } -#endif -#if !JVET_Q0819_PH_CHANGES - // parameter sets - WRITE_UVLC(picHeader->getPPSId(), "ph_pic_parameter_set_id"); - pps = cs.slice->getPPS(); - CHECK(pps==0, "Invalid PPS"); - sps = cs.slice->getSPS(); - CHECK(sps==0, "Invalid SPS"); -#endif -#if JVET_Q0819_PH_CHANGES // alf enable flags and aps IDs if( sps->getALFEnabledFlag() ) { -#if JVET_Q0819_PH_CHANGES if (pps->getAlfInfoInPhFlag()) -#else - WRITE_FLAG(picHeader->getAlfEnabledPresentFlag(), "pic_alf_enabled_present_flag"); - if (picHeader->getAlfEnabledPresentFlag()) -#endif { WRITE_FLAG(picHeader->getAlfEnabledFlag(COMPONENT_Y), "ph_alf_enabled_flag"); if (picHeader->getAlfEnabledFlag(COMPONENT_Y)) @@ -2052,7 +1460,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) { WRITE_CODE(picHeader->getAlfApsIdChroma(), 3, "ph_alf_aps_id_chroma"); } -#if JVET_Q0795_CCALF if (sps->getCCALFEnabledFlag()) { WRITE_FLAG(picHeader->getCcAlfEnabledFlag(COMPONENT_Cb), "ph_cc_alf_cb_enabled_flag"); @@ -2066,7 +1473,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) WRITE_CODE(picHeader->getCcAlfCrApsId(), 3, "ph_cc_alf_cr_aps_id"); } } -#endif } } else @@ -2074,10 +1480,8 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setAlfEnabledFlag(COMPONENT_Y, true); picHeader->setAlfEnabledFlag(COMPONENT_Cb, true); picHeader->setAlfEnabledFlag(COMPONENT_Cr, true); -#if JVET_Q0795_CCALF picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, sps->getCCALFEnabledFlag()); picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, sps->getCCALFEnabledFlag()); -#endif } } else @@ -2085,10 +1489,8 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setAlfEnabledFlag(COMPONENT_Y, false); picHeader->setAlfEnabledFlag(COMPONENT_Cb, false); picHeader->setAlfEnabledFlag(COMPONENT_Cr, false); -#if JVET_Q0795_CCALF picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, false); picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, false); -#endif } // luma mapping / chroma scaling controls @@ -2117,89 +1519,29 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) // quantization scaling lists if( sps->getScalingListFlag() ) { -#if JVET_Q0346_SCALING_LIST_USED_IN_SH WRITE_FLAG( picHeader->getExplicitScalingListEnabledFlag(), "ph_scaling_list_present_flag" ); if( picHeader->getExplicitScalingListEnabledFlag() ) -#else - WRITE_FLAG( picHeader->getScalingListPresentFlag(), "ph_scaling_list_present_flag" ); - if( picHeader->getScalingListPresentFlag() ) -#endif { WRITE_CODE( picHeader->getScalingListAPSId(), 3, "ph_scaling_list_aps_id" ); } } else { -#if JVET_Q0346_SCALING_LIST_USED_IN_SH picHeader->setExplicitScalingListEnabledFlag( false ); -#else - picHeader->setScalingListPresentFlag( false ); -#endif } -#endif -#if !JVET_Q0119_CLEANUPS - // sub-picture IDs - if( sps->getSubPicIdPresentFlag() ) + + // virtual boundaries + if( sps->getVirtualBoundariesEnabledFlag() && !sps->getVirtualBoundariesPresentFlag() ) { - if( sps->getSubPicIdSignallingPresentFlag() ) + WRITE_FLAG( picHeader->getVirtualBoundariesPresentFlag(), "ph_virtual_boundaries_present_flag" ); + if( picHeader->getVirtualBoundariesPresentFlag() ) { - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) + WRITE_CODE(picHeader->getNumVerVirtualBoundaries(), 2, "ph_num_ver_virtual_boundaries"); + for( unsigned i = 0; i < picHeader->getNumVerVirtualBoundaries(); i++ ) { - picHeader->setSubPicId( picIdx, sps->getSubPicId( picIdx ) ); - } - } - else - { - WRITE_FLAG(picHeader->getSubPicIdSignallingPresentFlag(), "ph_subpic_id_signalling_present_flag"); - if( picHeader->getSubPicIdSignallingPresentFlag() ) - { - WRITE_UVLC( picHeader->getSubPicIdLen() - 1, "ph_subpic_id_len_minus1" ); -#if JVET_Q0169_SUBPIC_LEN_CONFORM - CHECK((1 << picHeader->getSubPicIdLen()) < sps->getNumSubPics(), "ph_subpic_id_len exceeds valid range"); -#endif - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) - { - WRITE_CODE(picHeader->getSubPicId(picIdx), picHeader->getSubPicIdLen( ), "ph_subpic_id[i]" ); - } - } - else - { - for( int picIdx = 0; picIdx < pps->getNumSubPics( ); picIdx++ ) - { - picHeader->setSubPicId( picIdx, pps->getSubPicId( picIdx ) ); - } - } - } - } - else - { - for( int picIdx = 0; picIdx < sps->getNumSubPics( ); picIdx++ ) - { - picHeader->setSubPicId( picIdx, picIdx ); - } - } -#endif - - // virtual boundaries -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG - if( sps->getVirtualBoundariesEnabledFlag() && !sps->getVirtualBoundariesPresentFlag() ) - { - WRITE_FLAG( picHeader->getVirtualBoundariesPresentFlag(), "ph_virtual_boundaries_present_flag" ); - if( picHeader->getVirtualBoundariesPresentFlag() ) - { -#else - if( !sps->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { - WRITE_FLAG( picHeader->getLoopFilterAcrossVirtualBoundariesDisabledFlag(), "ph_loop_filter_across_virtual_boundaries_disabled_present_flag" ); - if( picHeader->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) - { -#endif - WRITE_CODE(picHeader->getNumVerVirtualBoundaries(), 2, "ph_num_ver_virtual_boundaries"); - for( unsigned i = 0; i < picHeader->getNumVerVirtualBoundaries(); i++ ) - { - WRITE_CODE(picHeader->getVirtualBoundariesPosX(i) >> 3, 13, "ph_virtual_boundaries_pos_x"); + WRITE_CODE(picHeader->getVirtualBoundariesPosX(i) >> 3, 13, "ph_virtual_boundaries_pos_x"); } WRITE_CODE(picHeader->getNumHorVirtualBoundaries(), 2, "ph_num_hor_virtual_boundaries"); for( unsigned i = 0; i < picHeader->getNumHorVirtualBoundaries(); i++ ) @@ -2209,24 +1551,16 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) } else { -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG picHeader->setVirtualBoundariesPresentFlag( 0 ); -#else - picHeader->setLoopFilterAcrossVirtualBoundariesDisabledFlag( 0 ); -#endif picHeader->setNumVerVirtualBoundaries( 0 ); picHeader->setNumHorVirtualBoundaries( 0 ); } } else { -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG picHeader->setVirtualBoundariesPresentFlag( sps->getVirtualBoundariesPresentFlag() ); if( picHeader->getVirtualBoundariesPresentFlag() ) { -#else - picHeader->setLoopFilterAcrossVirtualBoundariesDisabledFlag( sps->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ); -#endif picHeader->setNumVerVirtualBoundaries( sps->getNumVerVirtualBoundaries() ); picHeader->setNumHorVirtualBoundaries( sps->getNumHorVirtualBoundaries() ); for( unsigned i = 0; i < 3; i++ ) @@ -2234,22 +1568,9 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setVirtualBoundariesPosX( sps->getVirtualBoundariesPosX(i), i ); picHeader->setVirtualBoundariesPosY( sps->getVirtualBoundariesPosY(i), i ); } -#if JVET_Q0246_VIRTUAL_BOUNDARY_ENABLE_FLAG } -#endif } -#if !JVET_Q0155_COLOUR_ID - // 4:4:4 colour plane ID - if( sps->getSeparateColourPlaneFlag() ) - { - WRITE_CODE( picHeader->getColourPlaneId(), 2, "colour_plane_id" ); - } - else - { - picHeader->setColourPlaneId( 0 ); - } -#endif // picture output flag if( pps->getOutputFlagPresentFlag() ) @@ -2262,23 +1583,13 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) } // reference picture lists -#if JVET_Q0819_PH_CHANGES if (pps->getRplInfoInPhFlag()) -#else - WRITE_FLAG(picHeader->getPicRplPresentFlag(), "pic_rpl_present_flag"); - if( picHeader->getPicRplPresentFlag() ) -#endif { // List0 and List1 for(int listIdx = 0; listIdx < 2; listIdx++) { -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if(sps->getNumRPL(listIdx) > 0 && (listIdx == 0 || (listIdx == 1 && pps->getRpl1IdxPresentFlag()))) -#else - if(sps->getNumRPL(listIdx) > 0 && !pps->getPPSRefPicListSPSIdc(listIdx) && - (listIdx == 0 || (listIdx == 1 && pps->getRpl1IdxPresentFlag()))) -#endif { WRITE_FLAG(picHeader->getRPLIdx(listIdx) != -1 ? 1 : 0, "rpl_sps_flag[i]"); } @@ -2343,7 +1654,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) if (sps->getSplitConsOverrideEnabledFlag()) { WRITE_FLAG(picHeader->getSplitConsOverrideFlag(), "partition_constraints_override_flag"); -#if JVET_Q0819_PH_CHANGES } else { @@ -2352,14 +1662,9 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) // Q0781, two-flags if (picHeader->getPicIntraSliceAllowedFlag()) { -#endif if (picHeader->getSplitConsOverrideFlag()) { WRITE_UVLC(floorLog2(picHeader->getMinQTSize(I_SLICE)) - sps->getLog2MinCodingBlockSize(), "ph_log2_diff_min_qt_min_cb_intra_slice_luma"); -#if !JVET_Q0819_PH_CHANGES - WRITE_UVLC(floorLog2(picHeader->getMinQTSize(P_SLICE)) - sps->getLog2MinCodingBlockSize(), "ph_log2_diff_min_qt_min_cb_inter_slice"); - WRITE_UVLC(picHeader->getMaxMTTHierarchyDepth(P_SLICE), "ph_max_mtt_hierarchy_depth_inter_slice"); -#endif WRITE_UVLC(picHeader->getMaxMTTHierarchyDepth(I_SLICE), "ph_max_mtt_hierarchy_depth_intra_slice_luma"); if (picHeader->getMaxMTTHierarchyDepth(I_SLICE) != 0) { @@ -2367,13 +1672,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) WRITE_UVLC(floorLog2(picHeader->getMaxTTSize(I_SLICE)) - floorLog2(picHeader->getMinQTSize(I_SLICE)), "ph_log2_diff_max_tt_min_qt_intra_slice_luma"); } -#if !JVET_Q0819_PH_CHANGES - if (picHeader->getMaxMTTHierarchyDepth(P_SLICE) != 0) - { - WRITE_UVLC(floorLog2(picHeader->getMaxBTSize(P_SLICE)) - floorLog2(picHeader->getMinQTSize(P_SLICE)), "ph_log2_diff_max_bt_min_qt_inter_slice"); - WRITE_UVLC(floorLog2(picHeader->getMaxTTSize(P_SLICE)) - floorLog2(picHeader->getMinQTSize(P_SLICE)), "ph_log2_diff_max_tt_min_qt_inter_slice"); - } -#endif if (sps->getUseDualITree()) { WRITE_UVLC(floorLog2(picHeader->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)) - sps->getLog2MinCodingBlockSize(), "ph_log2_diff_min_qt_min_cb_intra_slice_chroma"); @@ -2386,55 +1684,25 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) } } } -#if !JVET_Q0819_PH_CHANGES - else - { - picHeader->setSplitConsOverrideFlag(0); - } - - // inherit constraint values from SPS - if (!sps->getSplitConsOverrideEnabledFlag() || !picHeader->getSplitConsOverrideFlag()) - { - picHeader->setMinQTSizes(sps->getMinQTSizes()); - picHeader->setMaxMTTHierarchyDepths(sps->getMaxMTTHierarchyDepths()); - picHeader->setMaxBTSizes(sps->getMaxBTSizes()); - picHeader->setMaxTTSizes(sps->getMaxTTSizes()); - } -#endif -#if JVET_Q0819_PH_CHANGES if (picHeader->getPicIntraSliceAllowedFlag()) { -#endif // delta quantization and chrom and chroma offset if (pps->getUseDQP()) { WRITE_UVLC( picHeader->getCuQpDeltaSubdivIntra(), "ph_cu_qp_delta_subdiv_intra_slice" ); -#if !JVET_Q0819_PH_CHANGES - WRITE_UVLC( picHeader->getCuQpDeltaSubdivInter(), "ph_cu_qp_delta_subdiv_inter_slice" ); -#endif } else { picHeader->setCuQpDeltaSubdivIntra( 0 ); -#if !JVET_Q0819_PH_CHANGES - picHeader->setCuQpDeltaSubdivInter( 0 ); -#endif } if (pps->getCuChromaQpOffsetListEnabledFlag()) { WRITE_UVLC( picHeader->getCuChromaQpOffsetSubdivIntra(), "ph_cu_chroma_qp_offset_subdiv_intra_slice" ); -#if !JVET_Q0819_PH_CHANGES - WRITE_UVLC( picHeader->getCuChromaQpOffsetSubdivInter(), "ph_cu_chroma_qp_offset_subdiv_inter_slice" ); -#endif } else { picHeader->setCuChromaQpOffsetSubdivIntra( 0 ); -#if !JVET_Q0819_PH_CHANGES - picHeader->setCuChromaQpOffsetSubdivInter( 0 ); -#endif } -#if JVET_Q0819_PH_CHANGES } @@ -2468,12 +1736,10 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) { picHeader->setCuChromaQpOffsetSubdivInter(0); } -#endif // temporal motion vector prediction if (sps->getSPSTemporalMVPEnabledFlag()) { WRITE_FLAG( picHeader->getEnableTMVPFlag(), "ph_temporal_mvp_enabled_flag" ); -#if JVET_Q0259_COLLOCATED_PIC_IN_PH if (picHeader->getEnableTMVPFlag() && pps->getRplInfoInPhFlag()) { WRITE_CODE(picHeader->getPicColFromL0Flag(), 1, "ph_collocated_from_l0_flag"); @@ -2483,7 +1749,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) WRITE_UVLC(picHeader->getColRefIdx(), "ph_collocated_ref_idx"); } } -#endif } else { @@ -2491,50 +1756,13 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) } // mvd L1 zero flag -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSMvdL1ZeroIdc()) - { - WRITE_FLAG(picHeader->getMvdL1ZeroFlag(), "mvd_l1_zero_flag"); - } - else - { - picHeader->setMvdL1ZeroFlag( pps->getPPSMvdL1ZeroIdc() - 1 ); - } -#else -#if !JVET_Q0259_COLLOCATED_PIC_IN_PH - if (picHeader->getEnableTMVPFlag() && pps->getRplInfoInPhFlag()) - { - WRITE_CODE(picHeader->getPicColFromL0Flag(), 1, "pic_collocated_from_l0_flag"); - } -#endif WRITE_FLAG(picHeader->getMvdL1ZeroFlag(), "mvd_l1_zero_flag"); -#endif // merge candidate list size -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSSixMinusMaxNumMergeCandPlus1()) - { -#endif -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - CHECK(picHeader->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported"); - WRITE_UVLC(MRG_MAX_NUM_CANDS - picHeader->getMaxNumMergeCand(), "pic_six_minus_max_num_merge_cand"); -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - } - else - { - picHeader->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - (pps->getPPSSixMinusMaxNumMergeCandPlus1() - 1)); - } -#endif // subblock merge candidate list size if ( sps->getUseAffine() ) { -#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE picHeader->setMaxNumAffineMergeCand(sps->getMaxNumAffineMergeCand()); -#else - CHECK( picHeader->getMaxNumAffineMergeCand() > AFFINE_MRG_MAX_NUM_CANDS, "More affine merge candidates signalled than supported" ); - WRITE_UVLC(AFFINE_MRG_MAX_NUM_CANDS - picHeader->getMaxNumAffineMergeCand(), "pic_five_minus_max_num_subblock_merge_cand"); -#endif } else { @@ -2581,49 +1809,10 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setDisProfFlag(0); } -#if JVET_Q0819_PH_CHANGES if ((pps->getUseWP() || pps->getWPBiPred()) && pps->getWpInfoInPhFlag()) { xCodePredWeightTable(picHeader, sps); } -#endif -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE -#if !JVET_Q0806 - // triangle merge candidate list size - if (sps->getUseTriangle() && picHeader->getMaxNumMergeCand() >= 2) - { - if (!pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1()) - { - CHECK(picHeader->getMaxNumMergeCand() < picHeader->getMaxNumTriangleCand(), "Incorrrect max number of triangle candidates!"); - WRITE_UVLC(picHeader->getMaxNumMergeCand() - picHeader->getMaxNumTriangleCand(), "pic_max_num_merge_cand_minus_max_num_triangle_cand"); - } - else - { - picHeader->setMaxNumTriangleCand((uint32_t)(picHeader->getMaxNumMergeCand() - (pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() - 1))); - } - } - -#else - // geometric merge candidate list size - if (sps->getUseGeo() && picHeader->getMaxNumMergeCand() >= 2) - { -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1()) - { -#endif - CHECK(picHeader->getMaxNumMergeCand() < picHeader->getMaxNumGeoCand(), "Incorrrect max number of gpm candidates!"); - WRITE_UVLC(picHeader->getMaxNumMergeCand() - picHeader->getMaxNumGeoCand(), "pic_max_num_merge_cand_minus_max_num_gpm_cand"); -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - } - else - { - picHeader->setMaxNumGeoCand((uint32_t)(picHeader->getMaxNumMergeCand() - (pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1() - 1))); - } -#endif - } -#endif -#endif -#if JVET_Q0819_PH_CHANGES } // inherit constraint values from SPS if (!sps->getSplitConsOverrideEnabledFlag() || !picHeader->getSplitConsOverrideFlag()) @@ -2633,21 +1822,11 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setMaxBTSizes(sps->getMaxBTSizes()); picHeader->setMaxTTSizes(sps->getMaxTTSizes()); } -#endif // ibc merge candidate list size -#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE - if (sps->getIBCFlag()) - { - CHECK( picHeader->getMaxNumIBCMergeCand() > IBC_MRG_MAX_NUM_CANDS, "More IBC merge candidates signalled than supported" ); - WRITE_UVLC(IBC_MRG_MAX_NUM_CANDS - picHeader->getMaxNumIBCMergeCand(), "pic_six_minus_max_num_ibc_merge_cand"); - } -#endif -#if JVET_Q0819_PH_CHANGES if (pps->getQpDeltaInfoInPhFlag()) { WRITE_SVLC(picHeader->getQpDelta(), "ph_qp_delta"); } -#endif // joint Cb/Cr sign flag if (sps->getJointCbCrEnabledFlag()) @@ -2662,25 +1841,12 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) // sao enable flags if(sps->getSAOEnabledFlag()) { -#if JVET_Q0819_PH_CHANGES if (pps->getSaoInfoInPhFlag()) -#else - WRITE_FLAG(picHeader->getSaoEnabledPresentFlag(), "pic_sao_enabled_present_flag"); - if (picHeader->getSaoEnabledPresentFlag()) -#endif { -#if JVET_Q0819_PH_CHANGES WRITE_FLAG(picHeader->getSaoEnabledFlag(CHANNEL_TYPE_LUMA), "ph_sao_luma_enabled_flag"); -#else - WRITE_FLAG(picHeader->getSaoEnabledFlag(CHANNEL_TYPE_LUMA), "slice_sao_luma_flag"); -#endif if (sps->getChromaFormatIdc() != CHROMA_400) { -#if JVET_Q0819_PH_CHANGES WRITE_FLAG(picHeader->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "ph_sao_chroma_enabled_flag"); -#else - WRITE_FLAG(picHeader->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "slice_sao_chroma_flag"); -#endif } } else @@ -2695,106 +1861,18 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, false); } -#if !JVET_Q0819_PH_CHANGES - // alf enable flags and aps IDs - if( sps->getALFEnabledFlag() ) - { -#if JVET_Q0819_PH_CHANGES - if (pps->getAlfInfoInPhFlag()) -#else - WRITE_FLAG(picHeader->getAlfEnabledPresentFlag(), "pic_alf_enabled_present_flag"); - if (picHeader->getAlfEnabledPresentFlag()) -#endif - { - WRITE_FLAG(picHeader->getAlfEnabledFlag(COMPONENT_Y), "pic_alf_enabled_flag"); - if (picHeader->getAlfEnabledFlag(COMPONENT_Y)) - { - WRITE_CODE(picHeader->getNumAlfAps(), 3, "pic_num_alf_aps_ids_luma"); - const std::vector<int>& apsId = picHeader->getAlfAPSs(); - for (int i = 0; i < picHeader->getNumAlfAps(); i++) - { - WRITE_CODE(apsId[i], 3, "pic_alf_aps_id_luma"); - } - - const int alfChromaIdc = picHeader->getAlfEnabledFlag(COMPONENT_Cb) + picHeader->getAlfEnabledFlag(COMPONENT_Cr) * 2 ; - if (sps->getChromaFormatIdc() != CHROMA_400) - { - WRITE_CODE(alfChromaIdc, 2, "pic_alf_chroma_idc"); - } - if (alfChromaIdc) - { - WRITE_CODE(picHeader->getAlfApsIdChroma(), 3, "pic_alf_aps_id_chroma"); - } -#if JVET_Q0795_CCALF - if (sps->getCCALFEnabledFlag()) - { - WRITE_FLAG(picHeader->getCcAlfEnabledFlag(COMPONENT_Cb), "ph_cc_alf_cb_enabled_flag"); - if (picHeader->getCcAlfEnabledFlag(COMPONENT_Cb)) - { - WRITE_CODE(picHeader->getCcAlfCbApsId(), 3, "ph_cc_alf_cb_aps_id"); - } - WRITE_FLAG(picHeader->getCcAlfEnabledFlag(COMPONENT_Cr), "ph_cc_alf_cr_enabled_flag"); - if (picHeader->getCcAlfEnabledFlag(COMPONENT_Cr)) - { - WRITE_CODE(picHeader->getCcAlfCrApsId(), 3, "ph_cc_alf_cr_aps_id"); - } - } -#endif - } - } - else - { - picHeader->setAlfEnabledFlag(COMPONENT_Y, true); - picHeader->setAlfEnabledFlag(COMPONENT_Cb, true); - picHeader->setAlfEnabledFlag(COMPONENT_Cr, true); -#if JVET_Q0795_CCALF - picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, sps->getCCALFEnabledFlag()); - picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, sps->getCCALFEnabledFlag()); -#endif - } - } - else - { - picHeader->setAlfEnabledFlag(COMPONENT_Y, false); - picHeader->setAlfEnabledFlag(COMPONENT_Cb, false); - picHeader->setAlfEnabledFlag(COMPONENT_Cr, false); -#if JVET_Q0795_CCALF - picHeader->setCcAlfEnabledFlag(COMPONENT_Cb, false); - picHeader->setCcAlfEnabledFlag(COMPONENT_Cr, false); -#endif - } -#endif // dependent quantization -#if DQ_SDH_SIGNALLING if (sps->getDepQuantEnabledFlag()) { -#endif -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pps->getPPSDepQuantEnabledIdc()) - { - WRITE_FLAG(picHeader->getDepQuantEnabledFlag(), "ph_dep_quant_enabled_flag"); - } - else - { - picHeader->setDepQuantEnabledFlag(pps->getPPSDepQuantEnabledIdc() - 1); - } -#else WRITE_FLAG(picHeader->getDepQuantEnabledFlag(), "ph_dep_quant_enabled_flag"); -#endif -#if DQ_SDH_SIGNALLING } else { picHeader->setDepQuantEnabledFlag(false); } -#endif // sign data hiding -#if DQ_SDH_SIGNALLING if (sps->getSignDataHidingEnabledFlag() && !picHeader->getDepQuantEnabledFlag()) -#else - if( !picHeader->getDepQuantEnabledFlag() ) -#endif { WRITE_FLAG( picHeader->getSignDataHidingEnabledFlag(), "pic_sign_data_hiding_enabled_flag" ); } @@ -2808,12 +1886,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) { if(pps->getDeblockingFilterOverrideEnabledFlag()) { -#if JVET_Q0819_PH_CHANGES if (pps->getDbfInfoInPhFlag()) -#else - WRITE_FLAG(picHeader->getDeblockingFilterOverridePresentFlag(), "pic_deblocking_filter_override_present_flag"); - if( picHeader->getDeblockingFilterOverridePresentFlag() ) -#endif { WRITE_FLAG ( picHeader->getDeblockingFilterOverrideFlag(), "ph_deblocking_filter_override_flag" ); } @@ -2824,15 +1897,11 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) } else { -#if !JVET_Q0819_PH_CHANGES - picHeader->setDeblockingFilterOverridePresentFlag(false); -#endif picHeader->setDeblockingFilterOverrideFlag(false); } if(picHeader->getDeblockingFilterOverrideFlag()) { -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS WRITE_FLAG( picHeader->getDeblockingFilterDisable(), "ph_deblocking_filter_disabled_flag" ); if( !picHeader->getDeblockingFilterDisable() ) { @@ -2843,26 +1912,16 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) WRITE_SVLC( picHeader->getDeblockingFilterCrBetaOffsetDiv2(), "ph_cr_beta_offset_div2" ); WRITE_SVLC( picHeader->getDeblockingFilterCrTcOffsetDiv2(), "ph_cr_tc_offset_div2" ); } -#else - WRITE_FLAG ( picHeader->getDeblockingFilterDisable(), "pic_deblocking_filter_disabled_flag" ); - if(!picHeader->getDeblockingFilterDisable()) - { - WRITE_SVLC( picHeader->getDeblockingFilterBetaOffsetDiv2(), "pic_beta_offset_div2" ); - WRITE_SVLC( picHeader->getDeblockingFilterTcOffsetDiv2(), "pic_tc_offset_div2" ); - } -#endif } else { picHeader->setDeblockingFilterDisable ( pps->getPPSDeblockingFilterDisabledFlag() ); picHeader->setDeblockingFilterBetaOffsetDiv2( pps->getDeblockingFilterBetaOffsetDiv2() ); picHeader->setDeblockingFilterTcOffsetDiv2 ( pps->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS picHeader->setDeblockingFilterCbBetaOffsetDiv2( pps->getDeblockingFilterCbBetaOffsetDiv2() ); picHeader->setDeblockingFilterCbTcOffsetDiv2 ( pps->getDeblockingFilterCbTcOffsetDiv2() ); picHeader->setDeblockingFilterCrBetaOffsetDiv2( pps->getDeblockingFilterCrBetaOffsetDiv2() ); picHeader->setDeblockingFilterCrTcOffsetDiv2 ( pps->getDeblockingFilterCrTcOffsetDiv2() ); -#endif } } else @@ -2870,52 +1929,12 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) picHeader->setDeblockingFilterDisable ( false ); picHeader->setDeblockingFilterBetaOffsetDiv2( 0 ); picHeader->setDeblockingFilterTcOffsetDiv2 ( 0 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS picHeader->setDeblockingFilterCbBetaOffsetDiv2( 0 ); picHeader->setDeblockingFilterCbTcOffsetDiv2 ( 0 ); picHeader->setDeblockingFilterCrBetaOffsetDiv2( 0 ); picHeader->setDeblockingFilterCrTcOffsetDiv2 ( 0 ); -#endif } -#if !JVET_Q0819_PH_CHANGES - // luma mapping / chroma scaling controls - if (sps->getUseLmcs()) - { - WRITE_FLAG(picHeader->getLmcsEnabledFlag(), "ph_lmcs_enabled_flag"); - if (picHeader->getLmcsEnabledFlag()) - { - WRITE_CODE(picHeader->getLmcsAPSId(), 2, "ph_lmcs_aps_id"); - if (sps->getChromaFormatIdc() != CHROMA_400) - { - WRITE_FLAG(picHeader->getLmcsChromaResidualScaleFlag(), "ph_chroma_residual_scale_flag"); - } - else - { - picHeader->setLmcsChromaResidualScaleFlag(false); - } - } - } - else - { - picHeader->setLmcsEnabledFlag(false); - picHeader->setLmcsChromaResidualScaleFlag(false); - } - - // quantization scaling lists - if( sps->getScalingListFlag() ) - { - WRITE_FLAG( picHeader->getScalingListPresentFlag(), "pic_scaling_list_present_flag" ); - if( picHeader->getScalingListPresentFlag() ) - { - WRITE_CODE( picHeader->getScalingListAPSId(), 3, "pic_scaling_list_aps_id" ); - } - } - else - { - picHeader->setScalingListPresentFlag( false ); - } -#endif // picture header extension if(pps->getPictureHeaderExtensionPresentFlag()) @@ -2923,14 +1942,10 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader ) WRITE_UVLC(0,"ph_extension_length"); } -#if JVET_Q0775_PH_IN_SH if ( writeRbspTrailingBits ) { xWriteRbspTrailingBits(); } -#else - xWriteRbspTrailingBits(); -#endif } void HLSWriter::codeSliceHeader ( Slice* pcSlice ) @@ -2940,32 +1955,17 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) #endif CodingStructure& cs = *pcSlice->getPic()->cs; -#if JVET_Q0775_PH_IN_SH PicHeader *picHeader = cs.picHeader; -#else - const PicHeader *picHeader = cs.picHeader; -#endif const ChromaFormat format = pcSlice->getSPS()->getChromaFormatIdc(); const uint32_t numberValidComponents = getNumberValidComponents(format); const bool chromaEnabled = isChromaEnabled(format); -#if JVET_Q0775_PH_IN_SH WRITE_FLAG(pcSlice->getPictureHeaderInSliceHeader() ? 1 : 0, "picture_header_in_slice_header_flag"); if (pcSlice->getPictureHeaderInSliceHeader()) { codePictureHeader(picHeader, false); } -#endif -#if !JVET_Q0819_PH_CHANGES - int pocBits = pcSlice->getSPS()->getBitsForPOC(); - int pocMask = (1 << pocBits) - 1; - WRITE_CODE(pcSlice->getPOC() & pocMask, pocBits, "slice_pic_order_cnt_lsb"); -#endif -#if JVET_Q0119_CLEANUPS if (pcSlice->getSPS()->getSubPicInfoPresentFlag()) -#else - if (pcSlice->getSPS()->getSubPicPresentFlag()) -#endif { uint32_t bitsSubPicId; bitsSubPicId = pcSlice->getSPS()->getSubPicIdLen(); @@ -2987,7 +1987,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) else { // slice address is the index of the slice within the current sub-picture -#if JVET_Q0044_SLICE_IDX_WITH_SUBPICS uint32_t currSubPicIdx = pcSlice->getPPS()->getSubPicIdxFromSubPicId( pcSlice->getSliceSubPicId() ); SubPic currSubPic = pcSlice->getPPS()->getSubPic(currSubPicIdx); if( currSubPic.getNumSlicesInSubPic() > 1 ) @@ -3000,29 +1999,17 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) int bitsSliceAddress = ceilLog2(currSubPic.getNumSlicesInSubPic()); WRITE_CODE( pcSlice->getSliceID() - numSlicesInPreviousSubPics, bitsSliceAddress, "slice_address"); } -#else - if( pcSlice->getPPS()->getNumSlicesInPic() > 1 ) - { - int bitsSliceAddress = ceilLog2(pcSlice->getPPS()->getNumSlicesInPic()); // change to NumSlicesInSubPic when available - WRITE_CODE( pcSlice->getSliceID(), bitsSliceAddress, "slice_address"); - } -#endif } -#if JVET_Q0819_PH_CHANGES if (picHeader->getPicInterSliceAllowedFlag()) { -#endif WRITE_UVLC(pcSlice->getSliceType(), "slice_type"); -#if JVET_Q0819_PH_CHANGES } if (!picHeader->getPicIntraSliceAllowedFlag()) { CHECK(pcSlice->getSliceType() == I_SLICE, "when ph_intra_slice_allowed_flag = 0, no I_Slice is allowed"); } -#endif -#if JVET_Q0819_PH_CHANGES if (pcSlice->getSPS()->getALFEnabledFlag() && !pcSlice->getPPS()->getAlfInfoInPhFlag()) { const int alfEnabled = pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y); @@ -3047,7 +2034,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 3, "slice_alf_aps_id_chroma"); } -#if JVET_Q0795_CCALF if (pcSlice->getSPS()->getCCALFEnabledFlag()) { CcAlfFilterParam &filterParam = pcSlice->m_ccAlfFilterParam; @@ -3065,36 +2051,21 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_CODE(pcSlice->getTileGroupCcAlfCrApsId(), 3, "slice_cc_alf_cr_aps_id"); } } -#endif } } -#endif -#if JVET_Q0155_COLOUR_ID // 4:4:4 colour plane ID if( pcSlice->getSPS()->getSeparateColourPlaneFlag() ) { WRITE_CODE( pcSlice->getColourPlaneId(), 2, "colour_plane_id" ); } -#endif -#if JVET_Q0819_PH_CHANGES if( !pcSlice->getPPS()->getRplInfoInPhFlag() && (!pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent())) -#else - if( !picHeader->getPicRplPresentFlag() && (!pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent()) ) -#endif { //Write L0 related syntax elements if (pcSlice->getSPS()->getNumRPL0() > 0) { -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - if (!pcSlice->getPPS()->getPPSRefPicListSPSIdc0()) - { -#endif WRITE_FLAG(pcSlice->getRPL0idx() != -1 ? 1 : 0, "ref_pic_list_sps_flag[0]"); -#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS - } -#endif } if (pcSlice->getRPL0idx() != -1) { @@ -3134,11 +2105,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } //Write L1 related syntax elements -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if (pcSlice->getSPS()->getNumRPL1() > 0 && pcSlice->getPPS()->getRpl1IdxPresentFlag()) -#else - if (pcSlice->getSPS()->getNumRPL1() > 0 && pcSlice->getPPS()->getRpl1IdxPresentFlag() && !pcSlice->getPPS()->getPPSRefPicListSPSIdc1()) -#endif { WRITE_FLAG(pcSlice->getRPL1idx() != -1 ? 1 : 0, "ref_pic_list_sps_flag[1]"); } @@ -3199,11 +2166,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } } -#if JVET_Q0819_PH_CHANGES if( pcSlice->getPPS()->getRplInfoInPhFlag() || !pcSlice->getIdrPicFlag()|| pcSlice->getSPS()->getIDRRefParamListPresent() ) -#else - if( picHeader->getPicRplPresentFlag() || !pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent() ) -#endif { //check if numrefidxes match the defaults. If not, override @@ -3259,13 +2222,8 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG( encCabacInitFlag ? 1 : 0, "cabac_init_flag" ); } } -#if JVET_Q0259_COLLOCATED_PIC_IN_PH if (pcSlice->getPicHeader()->getEnableTMVPFlag() && !pcSlice->getPPS()->getRplInfoInPhFlag()) -#else - if( pcSlice->getPicHeader()->getEnableTMVPFlag() ) -#endif { -#if JVET_Q0482_REMOVE_CONSTANT_PARAMS if(!pcSlice->getPPS()->getRplInfoInPhFlag()) { if (pcSlice->getSliceType() == B_SLICE) @@ -3273,15 +2231,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG(pcSlice->getColFromL0Flag(), "collocated_from_l0_flag"); } } -#else - if( pcSlice->getSliceType() == B_SLICE ) - { - if (!pcSlice->getPPS()->getPPSCollocatedFromL0Idc()) - { - WRITE_FLAG( pcSlice->getColFromL0Flag(), "collocated_from_l0_flag" ); - } - } -#endif if( pcSlice->getSliceType() != I_SLICE && ( ( pcSlice->getColFromL0Flag() == 1 && pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) > 1 ) || @@ -3293,26 +2242,17 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) if( ( pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType() == P_SLICE ) || ( pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType() == B_SLICE ) ) { -#if JVET_Q0819_PH_CHANGES if( !pcSlice->getPPS()->getWpInfoInPhFlag() ) { xCodePredWeightTable(pcSlice); } -#else - xCodePredWeightTable(pcSlice); -#endif } -#if JVET_Q0819_PH_CHANGES if (!pcSlice->getPPS()->getQpDeltaInfoInPhFlag()) { WRITE_SVLC(pcSlice->getSliceQp() - (pcSlice->getPPS()->getPicInitQPMinus26() + 26), "slice_qp_delta"); } -#else - int iCode = pcSlice->getSliceQp() - (pcSlice->getPPS()->getPicInitQPMinus26() + 26); - WRITE_SVLC( iCode, "slice_qp_delta" ); -#endif if (pcSlice->getPPS()->getSliceChromaQpFlag()) { if (numberValidComponents > COMPONENT_Cb) @@ -3335,11 +2275,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG(pcSlice->getUseChromaQpAdj(), "cu_chroma_qp_offset_enabled_flag"); } -#if JVET_Q0819_PH_CHANGES if (pcSlice->getSPS()->getSAOEnabledFlag() && !pcSlice->getPPS()->getSaoInfoInPhFlag()) -#else - if (pcSlice->getSPS()->getSAOEnabledFlag() && !picHeader->getSaoEnabledPresentFlag()) -#endif { WRITE_FLAG( pcSlice->getSaoEnabledFlag( CHANNEL_TYPE_LUMA ), "slice_sao_luma_flag" ); if( chromaEnabled ) @@ -3348,69 +2284,12 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } } -#if !JVET_Q0819_PH_CHANGES -#if JVET_Q0819_PH_CHANGES - if (pcSlice->getSPS()->getALFEnabledFlag() && !pcSlice->getPPS()->getAlfInfoInPhFlag()) -#else - if (pcSlice->getSPS()->getALFEnabledFlag() && !picHeader->getAlfEnabledPresentFlag()) -#endif - { - const int alfEnabled = pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y); - WRITE_FLAG(alfEnabled, "slice_alf_enabled_flag"); - - if (alfEnabled) - { - WRITE_CODE(pcSlice->getTileGroupNumAps(), 3, "slice_num_alf_aps_ids_luma"); - const std::vector<int>& apsId = pcSlice->getTileGroupApsIdLuma(); - for (int i = 0; i < pcSlice->getTileGroupNumAps(); i++) - { - WRITE_CODE(apsId[i], 3, "slice_alf_aps_id_luma"); - } - - const int alfChromaIdc = pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) + pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cr) * 2 ; - if (chromaEnabled) - { - WRITE_CODE(alfChromaIdc, 2, "slice_alf_chroma_idc"); - } - if (alfChromaIdc) - { - WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 3, "slice_alf_aps_id_chroma"); - } - -#if JVET_Q0795_CCALF - if (pcSlice->getSPS()->getCCALFEnabledFlag()) - { - CcAlfFilterParam &filterParam = pcSlice->m_ccAlfFilterParam; - WRITE_FLAG(filterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1] ? 1 : 0, "slice_cc_alf_cb_enabled_flag"); - if (filterParam.ccAlfFilterEnabled[COMPONENT_Cb - 1]) - { - // write CC ALF Cb APS ID - WRITE_CODE(pcSlice->getTileGroupCcAlfCbApsId(), 3, "slice_cc_alf_cb_aps_id"); - } - // Cr - WRITE_FLAG(filterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1] ? 1 : 0, "slice_cc_alf_cr_enabled_flag"); - if (filterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1]) - { - // write CC ALF Cr APS ID - WRITE_CODE(pcSlice->getTileGroupCcAlfCrApsId(), 3, "slice_cc_alf_cr_aps_id"); - } - } -#endif - } - } -#endif if (pcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) { -#if JVET_Q0819_PH_CHANGES if( pcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag() && !pcSlice->getPPS()->getDbfInfoInPhFlag() ) { WRITE_FLAG(pcSlice->getDeblockingFilterOverrideFlag(), "slice_deblocking_filter_override_flag"); -#else - if (pcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag() && !picHeader->getDeblockingFilterOverridePresentFlag()) - { - WRITE_FLAG(pcSlice->getDeblockingFilterOverrideFlag(), "deblocking_filter_override_flag"); -#endif } else { @@ -3423,12 +2302,10 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { WRITE_SVLC (pcSlice->getDeblockingFilterBetaOffsetDiv2(), "slice_beta_offset_div2"); WRITE_SVLC (pcSlice->getDeblockingFilterTcOffsetDiv2(), "slice_tc_offset_div2"); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS WRITE_SVLC (pcSlice->getDeblockingFilterCbBetaOffsetDiv2(), "slice_cb_beta_offset_div2"); WRITE_SVLC (pcSlice->getDeblockingFilterCbTcOffsetDiv2(), "slice_cb_tc_offset_div2"); WRITE_SVLC (pcSlice->getDeblockingFilterCrBetaOffsetDiv2(), "slice_cr_beta_offset_div2"); WRITE_SVLC (pcSlice->getDeblockingFilterCrTcOffsetDiv2(), "slice_cr_tc_offset_div2"); -#endif } } else @@ -3436,12 +2313,10 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) pcSlice->setDeblockingFilterDisable ( picHeader->getDeblockingFilterDisable() ); pcSlice->setDeblockingFilterBetaOffsetDiv2( picHeader->getDeblockingFilterBetaOffsetDiv2() ); pcSlice->setDeblockingFilterTcOffsetDiv2 ( picHeader->getDeblockingFilterTcOffsetDiv2() ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2( picHeader->getDeblockingFilterCbBetaOffsetDiv2() ); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( picHeader->getDeblockingFilterCbTcOffsetDiv2() ); pcSlice->setDeblockingFilterCrBetaOffsetDiv2( picHeader->getDeblockingFilterCrBetaOffsetDiv2() ); pcSlice->setDeblockingFilterCrTcOffsetDiv2 ( picHeader->getDeblockingFilterCrTcOffsetDiv2() ); -#endif } } else @@ -3449,31 +2324,23 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) pcSlice->setDeblockingFilterDisable ( false ); pcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); pcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); -#if JVET_Q0121_DEBLOCKING_CONTROL_PARAMETERS pcSlice->setDeblockingFilterCbBetaOffsetDiv2( 0 ); pcSlice->setDeblockingFilterCbTcOffsetDiv2 ( 0 ); pcSlice->setDeblockingFilterCrBetaOffsetDiv2( 0 ); pcSlice->setDeblockingFilterCrTcOffsetDiv2 ( 0 ); -#endif } -#if JVET_Q0089_SLICE_LOSSLESS_CODING_CHROMA_BDPCM WRITE_FLAG(pcSlice->getTSResidualCodingDisabledFlag() ? 1 : 0, "slice_ts_residual_coding_disabled_flag"); -#endif -#if JVET_Q0346_LMCS_ENABLE_IN_SH if (picHeader->getLmcsEnabledFlag()) { WRITE_FLAG(pcSlice->getLmcsEnabledFlag(), "slice_lmcs_enabled_flag"); } -#endif -#if JVET_Q0346_SCALING_LIST_USED_IN_SH if (picHeader->getExplicitScalingListEnabledFlag()) { WRITE_FLAG(pcSlice->getExplicitScalingListUsed(), "slice_explicit_scaling_list_used_flag"); } -#endif if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) { @@ -3488,27 +2355,21 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getInterlacedSourceFlag(), "general_interlaced_source_flag" ); WRITE_FLAG(cinfo->getNonPackedConstraintFlag(), "general_non_packed_constraint_flag" ); WRITE_FLAG(cinfo->getFrameOnlyConstraintFlag(), "general_frame_only_constraint_flag" ); -#if JVET_Q0114_CONSTRAINT_FLAGS WRITE_FLAG(cinfo->getNonProjectedConstraintFlag(), "general_non_projected_constraint_flag"); -#endif WRITE_FLAG(cinfo->getIntraOnlyConstraintFlag(), "intra_only_constraint_flag" ); WRITE_CODE(cinfo->getMaxBitDepthConstraintIdc(), 4, "max_bitdepth_constraint_idc" ); WRITE_CODE(cinfo->getMaxChromaFormatConstraintIdc(), 2, "max_chroma_format_constraint_idc" ); -#if JVET_Q0114_CONSTRAINT_FLAGS WRITE_FLAG(cinfo->getNoResChangeInClvsConstraintFlag(), "no_res_change_in_clvs_constraint_flag"); WRITE_FLAG(cinfo->getOneTilePerPicConstraintFlag(), "one_tile_per_pic_constraint_flag"); WRITE_FLAG(cinfo->getOneSlicePerPicConstraintFlag(), "one_slice_per_pic_constraint_flag"); WRITE_FLAG(cinfo->getOneSubpicPerPicConstraintFlag(), "one_subpic_per_pic_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoQtbttDualTreeIntraConstraintFlag() ? 1 : 0, "no_qtbtt_dual_tree_intra_constraint_flag"); WRITE_FLAG(cinfo->getNoPartitionConstraintsOverrideConstraintFlag() ? 1 : 0, "no_partition_constraints_override_constraint_flag"); WRITE_FLAG(cinfo->getNoSaoConstraintFlag() ? 1 : 0, "no_sao_constraint_flag"); WRITE_FLAG(cinfo->getNoAlfConstraintFlag() ? 1 : 0, "no_alf_constraint_flag"); -#if JVET_Q0795_CCALF WRITE_FLAG(cinfo->getNoCCAlfConstraintFlag() ? 1 : 0, "no_ccalf_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoJointCbCrConstraintFlag() ? 1 : 0, "no_joint_cbcr_constraint_flag"); WRITE_FLAG(cinfo->getNoRefWraparoundConstraintFlag() ? 1 : 0, "no_ref_wraparound_constraint_flag"); WRITE_FLAG(cinfo->getNoTemporalMvpConstraintFlag() ? 1 : 0, "no_temporal_mvp_constraint_flag"); @@ -3524,20 +2385,14 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoIbcConstraintFlag() ? 1 : 0, "no_ibc_constraint_flag"); WRITE_FLAG(cinfo->getNoCiipConstraintFlag() ? 1 : 0, "no_ciip_constraint_flag"); WRITE_FLAG(cinfo->getNoFPelMmvdConstraintFlag() ? 1 : 0, "no_fpel_mmvd_constraint_flag"); -#if !JVET_Q0806 - WRITE_FLAG(cinfo->getNoTriangleConstraintFlag() ? 1 : 0, "no_triangle_constraint_flag"); -#else WRITE_FLAG(cinfo->getNoGeoConstraintFlag() ? 1 : 0, "no_gpm_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); WRITE_FLAG(cinfo->getNoTransformSkipConstraintFlag() ? 1 : 0, "no_transform_skip_constraint_flag"); WRITE_FLAG(cinfo->getNoBDPCMConstraintFlag() ? 1 : 0, "no_bdpcm_constraint_flag"); WRITE_FLAG(cinfo->getNoQpDeltaConstraintFlag() ? 1 : 0, "no_qp_delta_constraint_flag"); WRITE_FLAG(cinfo->getNoDepQuantConstraintFlag() ? 1 : 0, "no_dep_quant_constraint_flag"); WRITE_FLAG(cinfo->getNoSignDataHidingConstraintFlag() ? 1 : 0, "no_sign_data_hiding_constraint_flag"); -#if JVET_P0124_MIXED_NALU WRITE_FLAG(cinfo->getNoMixedNaluTypesInPicConstraintFlag() ? 1 : 0, "no_mixed_nalu_types_in_pic_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoTrailConstraintFlag() ? 1 : 0, "no_trail_constraint_flag"); WRITE_FLAG(cinfo->getNoStsaConstraintFlag() ? 1 : 0, "no_stsa_constraint_flag"); WRITE_FLAG(cinfo->getNoRaslConstraintFlag() ? 1 : 0, "no_rasl_constraint_flag"); @@ -3548,29 +2403,17 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoApsConstraintFlag() ? 1 : 0, "no_aps_constraint_flag"); } -#if JVET_Q0786_PTL_only void HLSWriter::codeProfileTierLevel ( const ProfileTierLevel* ptl, bool profileTierPresentFlag, int maxNumSubLayersMinus1 ) -#else -void HLSWriter::codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxNumSubLayersMinus1 ) -#endif { -#if JVET_Q0786_PTL_only if(profileTierPresentFlag) { WRITE_CODE( int(ptl->getProfileIdc()), 7 , "general_profile_idc" ); WRITE_FLAG( ptl->getTierFlag()==Level::HIGH, "general_tier_flag" ); codeConstraintInfo( ptl->getConstraintInfo() ); } -#else - WRITE_CODE( int(ptl->getProfileIdc()), 7 , "general_profile_idc" ); - WRITE_FLAG( ptl->getTierFlag()==Level::HIGH, "general_tier_flag" ); - - codeConstraintInfo( ptl->getConstraintInfo() ); -#endif WRITE_CODE( int( ptl->getLevelIdc() ), 8, "general_level_idc" ); -#if JVET_Q0786_PTL_only if(profileTierPresentFlag) { WRITE_CODE(ptl->getNumSubProfile(), 8, "num_sub_profiles"); @@ -3579,13 +2422,6 @@ void HLSWriter::codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxN WRITE_CODE(ptl->getSubProfileIdc(i) , 32, "general_sub_profile_idc[i]"); } } -#else - WRITE_CODE(ptl->getNumSubProfile(), 8, "num_sub_profiles"); - for (int i = 0; i < ptl->getNumSubProfile(); i++) - { - WRITE_CODE(ptl->getSubProfileIdc(i) , 32, "general_sub_profile_idc[i]"); - } -#endif for (int i = 0; i < maxNumSubLayersMinus1; i++) { @@ -3615,11 +2451,7 @@ void HLSWriter::codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxN */ void HLSWriter::codeTilesWPPEntryPoint( Slice* pSlice ) { -#if JVET_Q0151_Q0205_ENTRYPOINTS pSlice->setNumEntryPoints( pSlice->getSPS(), pSlice->getPPS() ); -#else - pSlice->setNumEntryPoints( pSlice->getPPS() ); -#endif if( pSlice->getNumEntryPoints() == 0 ) { return; @@ -3740,7 +2572,6 @@ void HLSWriter::xCodePredWeightTable( Slice* pcSlice ) } } -#if JVET_Q0819_PH_CHANGES void HLSWriter::xCodePredWeightTable(PicHeader *picHeader, const SPS *sps) { WPScalingParam * wp; @@ -3823,7 +2654,6 @@ void HLSWriter::xCodePredWeightTable(PicHeader *picHeader, const SPS *sps) } CHECK(totalSignalledWeightFlags > 24, "Too many signalled weight flags"); } -#endif /** code quantization matrix * \param scalingList quantization matrix information @@ -3832,15 +2662,11 @@ void HLSWriter::codeScalingList( const ScalingList &scalingList ) { //for each size WRITE_FLAG(scalingList.getDisableScalingMatrixForLfnstBlks(), "scaling_matrix_for_lfnst_disabled_flag"); -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 WRITE_FLAG(scalingList.getChromaScalingListPresentFlag(), "scaling_list_chroma_present_flag"); -#endif for (uint32_t scalingListId = 0; scalingListId < 28; scalingListId++) { -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 if(scalingList.getChromaScalingListPresentFlag()|| scalingList.isLumaScalingList(scalingListId)) { -#endif bool scalingListCopyModeFlag = scalingList.getScalingListCopyModeFlag(scalingListId); WRITE_FLAG(scalingListCopyModeFlag, "scaling_list_copy_mode_flag"); //copy mode if (!scalingListCopyModeFlag)// Copy Mode @@ -3856,9 +2682,7 @@ void HLSWriter::codeScalingList( const ScalingList &scalingList ) //DPCM xCodeScalingList(&scalingList, scalingListId, scalingList.getScalingListPreditorModeFlag(scalingListId)); } -#if JVET_Q0505_CHROAM_QM_SIGNALING_400 } -#endif } return; } @@ -3932,28 +2756,6 @@ bool HLSWriter::xFindMatchingLTRP(Slice* pcSlice, uint32_t *ltrpsIndex, int ltrp return false; } -#if !JVET_Q0210_UEK_REMOVAL -void HLSWriter::alfGolombEncode( int coeff, int k, const bool signed_coeff ) -{ - unsigned int symbol = abs( coeff ); - while ( symbol >= (unsigned int)( 1 << k ) ) - { - symbol -= 1 << k; - k++; - WRITE_FLAG( 0, "alf_coeff_abs_prefix" ); - } - WRITE_FLAG( 1, "alf_coeff_abs_prefix" ); - - if ( k > 0 ) - { - WRITE_CODE( symbol, k, "alf_coeff_abs_suffix" ); - } - if ( signed_coeff && coeff != 0 ) - { - WRITE_FLAG( (coeff < 0) ? 1 : 0, "alf_coeff_sign" ); - } -} -#endif void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma, const int altIdx ) { @@ -3970,24 +2772,16 @@ void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma, const for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_Q0210_UEK_REMOVAL WRITE_UVLC( abs(coeff[ ind* MAX_NUM_ALF_LUMA_COEFF + i ]), isChroma ? "alf_chroma_coeff_abs" : "alf_luma_coeff_abs" ); //alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] if( abs( coeff[ ind* MAX_NUM_ALF_LUMA_COEFF + i ] ) != 0 ) { WRITE_FLAG( ( coeff[ ind* MAX_NUM_ALF_LUMA_COEFF + i ] < 0 ) ? 1 : 0, isChroma ? "alf_chroma_coeff_sign" : "alf_luma_coeff_sign" ); } -#else - alfGolombEncode( coeff[ind* MAX_NUM_ALF_LUMA_COEFF + i], 3 ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#endif } } // Clipping values coding -#if JVET_Q0249_ALF_CHROMA_CLIPFLAG if( alfParam.nonLinearFlag[isChroma] ) -#else - if( alfParam.nonLinearFlag[isChroma][altIdx] ) -#endif { for (int ind = 0; ind < numFilters; ++ind) { diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index 1be9d96c7308fc602108da20754efa0c1480bff0..5f7e135dee057df955294b8c48ccd50c3e4f85b4 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -116,9 +116,7 @@ private: void xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc ); bool xFindMatchingLTRP ( Slice* pcSlice, uint32_t *ltrpsIndex, int ltrpPOC, bool usedFlag ); void xCodePredWeightTable ( Slice* pcSlice ); -#if JVET_Q0819_PH_CHANGES void xCodePredWeightTable ( PicHeader *picHeader, const SPS *sps ); -#endif void xCodeScalingList ( const ScalingList* scalingList, uint32_t scalinListId, bool isPredictor); public: void setBitstream ( OutputBitstream* p ) { m_pcBitIf = p; } @@ -131,43 +129,20 @@ public: void codeLmcsAps ( APS* pcAPS ); void codeScalingListAps ( APS* pcAPS ); void codeVPS ( const VPS* pcVPS ); -#if JVET_Q0117_PARAMETER_SETS_CLEANUP void codeDCI ( const DCI* dci ); -#else - void codeDPS ( const DPS* dps ); -#endif -#if JVET_Q0775_PH_IN_SH void codePictureHeader ( PicHeader* picHeader, bool writeRbspTrailingBits ); -#else - void codePictureHeader ( PicHeader* picHeader ); -#endif void codeSliceHeader ( Slice* pcSlice ); void codeConstraintInfo ( const ConstraintInfo* cinfo ); -#if JVET_Q0786_PTL_only void codeProfileTierLevel ( const ProfileTierLevel* ptl, bool profileTierPresentFlag, int maxNumSubLayersMinus1 ); -#else - void codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxNumSubLayersMinus1 ); -#endif -#if JVET_P0118_HRD_ASPECTS void codeOlsHrdParameters(const GeneralHrdParams * generalHrd, const OlsHrdParams *olsHrd , const uint32_t firstSubLayer, const uint32_t maxNumSubLayersMinus1); -#else - void codeHrdParameters ( const HRDParameters *hrd, const uint32_t firstSubLayer, const uint32_t maxNumSubLayersMinus1); -#endif -#if JVET_P0118_HRD_ASPECTS void codeGeneralHrdparameters(const GeneralHrdParams *hrd); -#endif void codeTilesWPPEntryPoint ( Slice* pSlice ); void codeScalingList ( const ScalingList &scalingList ); void alfFilter( const AlfParam& alfParam, const bool isChroma, const int altIdx ); -#if JVET_P0117_PTL_SCALABILITY void dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, const SPS *pcSPS); -#endif private: -#if !JVET_Q0210_UEK_REMOVAL - void alfGolombEncode( const int coeff, const int k, const bool signed_coeff=true ); -#endif }; //! \} diff --git a/source/Lib/EncoderLib/WeightPredAnalysis.cpp b/source/Lib/EncoderLib/WeightPredAnalysis.cpp index 454be151796ba9dc67a0220e4883c5b5858d1636..c3dcee32888fede40414437e3e98019b6256151b 100644 --- a/source/Lib/EncoderLib/WeightPredAnalysis.cpp +++ b/source/Lib/EncoderLib/WeightPredAnalysis.cpp @@ -98,24 +98,6 @@ void xCalcHistogram(const Pel *pPel, } } -#if !JVET_Q0447_WP_PARAM_ESTIM -static -Distortion xCalcHistDistortion (const std::vector<int> &histogram0, - const std::vector<int> &histogram1) -{ - Distortion distortion = 0; - CHECK(histogram0.size()!=histogram1.size(), "Different histogram sizes"); - const int numElements=int(histogram0.size()); - - // Scan histograms to compute histogram distortion - for (int i = 0; i <= numElements; i++) - { - distortion += (Distortion)(abs(histogram0[i] - histogram1[i])); - } - - return distortion; -} -#endif static void xScaleHistogram(const std::vector<int> &histogramInput, @@ -146,7 +128,6 @@ void xScaleHistogram(const std::vector<int> &histogramInput, } } -#if JVET_Q0447_WP_PARAM_ESTIM static Distortion xCalcHistCumulDistortion(const std::vector<int>& histogram0, const std::vector<int>& histogram1) @@ -166,7 +147,6 @@ Distortion xCalcHistCumulDistortion(const std::vector<int>& histogram0, return distortion; } -#endif static Distortion xSearchHistogram(const std::vector<int> &histogramSource, @@ -202,11 +182,7 @@ Distortion xSearchHistogram(const std::vector<int> &histogramSource, searchOffset++) { xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, searchWeight, searchOffset, bHighPrecision); -#if JVET_Q0447_WP_PARAM_ESTIM const Distortion distortion = xCalcHistCumulDistortion(histogramSource, outputHistogram); -#else - const Distortion distortion = xCalcHistDistortion(histogramSource, outputHistogram); -#endif if (distortion < minDistortion) { @@ -225,11 +201,7 @@ Distortion xSearchHistogram(const std::vector<int> &histogramSource, const int deltaOffset = Clip3( -4*maxOffset, 4*maxOffset-1, (searchOffset - pred) ); // signed 10bit (if !bHighPrecision) const int clippedOffset = Clip3( -1*maxOffset, 1*maxOffset-1, (deltaOffset + pred) ); // signed 8bit (if !bHighPrecision) xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, searchWeight, clippedOffset, bHighPrecision); -#if JVET_Q0447_WP_PARAM_ESTIM const Distortion distortion = xCalcHistCumulDistortion(histogramSource, outputHistogram); -#else - const Distortion distortion = xCalcHistDistortion(histogramSource, outputHistogram); -#endif if (distortion < minDistortion) { @@ -542,7 +514,6 @@ bool WeightPredAnalysis::xSelectWPHistExtClip(Slice *const slice, const int log2 int offsetDef = 0; // calculate SAD costs with/without wp for luma -#if JVET_Q0447_WP_PARAM_ESTIM std::vector<int> histogramOrg; std::vector<int> histogramRef; uint64_t SADnoWP = std::numeric_limits<uint64_t>::max(); @@ -559,12 +530,8 @@ bool WeightPredAnalysis::xSelectWPHistExtClip(Slice *const slice, const int log2 { SADnoWP = (uint64_t)xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, defaultWeight, 0, useHighPrecision, bClipInitialSADWP); } -#else - const int64_t SADnoWP = xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, defaultWeight, 0, useHighPrecision, bClipInitialSADWP); -#endif if (SADnoWP > 0) { -#if JVET_Q0447_WP_PARAM_ESTIM uint64_t SADWP = std::numeric_limits<uint64_t>::max(); if (bUseHistogram && compID == COMPONENT_Y) { @@ -576,31 +543,18 @@ bool WeightPredAnalysis::xSelectWPHistExtClip(Slice *const slice, const int log2 { SADWP = (uint64_t)xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision, bClipInitialSADWP); } -#else - const int64_t SADWP = xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision, bClipInitialSADWP); -#endif const double dRatioSAD = (double)SADWP / (double)SADnoWP; double dRatioSr0SAD = std::numeric_limits<double>::max(); double dRatioSrSAD = std::numeric_limits<double>::max(); if (bUseHistogram) { -#if !JVET_Q0447_WP_PARAM_ESTIM - std::vector<int> histogramOrg;// = pPic->getHistogram(compID); - std::vector<int> histogramRef;// = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getHistogram(compID); -#endif std::vector<int> searchedHistogram; -#if !JVET_Q0447_WP_PARAM_ESTIM - // Compute histograms - xCalcHistogram(pOrg, histogramOrg, width, height, orgStride, 1 << bitDepth); - xCalcHistogram(pRef, histogramRef, width, height, refStride, 1 << bitDepth); -#endif // Do a histogram search around DC WP parameters; resulting distortion and 'searchedHistogram' is discarded xSearchHistogram(histogramOrg, histogramRef, searchedHistogram, bitDepth, log2Denom, weight, offset, useHighPrecision, compID); // calculate updated WP SAD -#if JVET_Q0447_WP_PARAM_ESTIM uint64_t SADSrWP = std::numeric_limits<uint64_t>::max(); if (bUseHistogram && compID == COMPONENT_Y) { @@ -612,9 +566,6 @@ bool WeightPredAnalysis::xSelectWPHistExtClip(Slice *const slice, const int log2 { SADSrWP = (uint64_t)xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision); } -#else - const int64_t SADSrWP = xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision); -#endif dRatioSrSAD = (double)SADSrWP / (double)SADnoWP; if (bDoEnhancement) @@ -622,7 +573,6 @@ bool WeightPredAnalysis::xSelectWPHistExtClip(Slice *const slice, const int log2 // Do the same around the default ones; resulting distortion and 'searchedHistogram' is discarded xSearchHistogram(histogramOrg, histogramRef, searchedHistogram, bitDepth, log2Denom, weightDef, offsetDef, useHighPrecision, compID); // calculate updated WP SAD -#if JVET_Q0447_WP_PARAM_ESTIM uint64_t SADSr0WP = std::numeric_limits<uint64_t>::max(); if (bUseHistogram && compID == COMPONENT_Y) { @@ -634,9 +584,6 @@ bool WeightPredAnalysis::xSelectWPHistExtClip(Slice *const slice, const int log2 { SADSr0WP = (uint64_t)xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weightDef, offsetDef, useHighPrecision); } -#else - const int64_t SADSr0WP = xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weightDef, offsetDef, useHighPrecision); -#endif dRatioSr0SAD = (double)SADSr0WP / (double)SADnoWP; } } diff --git a/source/Lib/Utilities/VideoIOYuv.cpp b/source/Lib/Utilities/VideoIOYuv.cpp index 0385c0dfb29627ccdc422b2e282092a6f8a895e1..a8b9b77183d936def0ac7dd5a35b5efe49822550 100644 --- a/source/Lib/Utilities/VideoIOYuv.cpp +++ b/source/Lib/Utilities/VideoIOYuv.cpp @@ -915,12 +915,8 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp const bool b709Compliance=(bClipToRec709) && (m_bitdepthShift[chType] < 0 && desired_bitdepth >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ const Pel minval = b709Compliance? (( 1 << (desired_bitdepth - 8)) ) : 0; const Pel maxval = b709Compliance? ((0xff << (desired_bitdepth - 8)) -1) : (1 << desired_bitdepth) - 1; -#if JVET_Q0438_MONOCHROME_BUGFIXES const bool processComponent = (size_t)compID < picOrg.bufs.size(); Pel* const dst = processComponent ? picOrg.get(compID).bufAt(0,0) : nullptr; -#else - Pel* const dst = picOrg.get(compID).bufAt(0,0); -#endif #if EXTENSION_360_VIDEO const uint32_t stride444 = picOrg.get(compID).stride; #endif @@ -929,7 +925,6 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp return false; } -#if JVET_Q0438_MONOCHROME_BUGFIXES if (processComponent) { if (! verifyPlane( dst, stride444, width444, height444, pad_h444, pad_v444, compID, format, m_fileBitdepth[chType]) ) @@ -938,17 +933,6 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp } scalePlane( picOrg.get(compID), m_bitdepthShift[chType], minval, maxval); } -#else - if (! verifyPlane( dst, stride444, width444, height444, pad_h444, pad_v444, compID, format, m_fileBitdepth[chType]) ) - { - EXIT("Source image contains values outside the specified bit range!"); - } - - if( (size_t)compID < picOrg.bufs.size() ) - { - scalePlane( picOrg.get(compID), m_bitdepthShift[chType], minval, maxval); - } -#endif } #if EXTENSION_360_VIDEO @@ -1263,22 +1247,12 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe PelStorage upscaledPic; upscaledPic.create( chromaFormatIDC, Area( Position(), Size( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples() ) ) ); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int curPicWidth = sps.getMaxPicWidthInLumaSamples() - SPS::getWinUnitX( sps.getChromaFormatIdc() ) * ( afterScaleWindowFullResolution.getWindowLeftOffset() + afterScaleWindowFullResolution.getWindowRightOffset() ); int curPicHeight = sps.getMaxPicHeightInLumaSamples() - SPS::getWinUnitY( sps.getChromaFormatIdc() ) * ( afterScaleWindowFullResolution.getWindowTopOffset() + afterScaleWindowFullResolution.getWindowBottomOffset() ); -#else - int curPicWidth = sps.getMaxPicWidthInLumaSamples() - afterScaleWindowFullResolution.getWindowLeftOffset() - afterScaleWindowFullResolution.getWindowRightOffset(); - int curPicHeight = sps.getMaxPicHeightInLumaSamples() - afterScaleWindowFullResolution.getWindowTopOffset() - afterScaleWindowFullResolution.getWindowBottomOffset(); -#endif const Window& beforeScalingWindow = pps.getScalingWindow(); -#if JVET_Q0487_SCALING_WINDOW_ISSUES int refPicWidth = pps.getPicWidthInLumaSamples() - SPS::getWinUnitX( sps.getChromaFormatIdc() ) * ( beforeScalingWindow.getWindowLeftOffset() + beforeScalingWindow.getWindowRightOffset() ); int refPicHeight = pps.getPicHeightInLumaSamples() - SPS::getWinUnitY( sps.getChromaFormatIdc() ) * ( beforeScalingWindow.getWindowTopOffset() + beforeScalingWindow.getWindowBottomOffset() ); -#else - int refPicWidth = pps.getPicWidthInLumaSamples() - beforeScalingWindow.getWindowLeftOffset() - beforeScalingWindow.getWindowRightOffset(); - int refPicHeight = pps.getPicHeightInLumaSamples() - beforeScalingWindow.getWindowTopOffset() - beforeScalingWindow.getWindowBottomOffset(); -#endif int xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; int yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight;