diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index af6001159ffe7fba15f126189d7f047300bc99bb..29979a27479e5c121b56ae9c2104c2827a67c959 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1220,10 +1220,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setReshapeIntraCMD ( m_intraCMD ); m_cEncLib.setReshapeCW ( m_reshapeCW ); m_cEncLib.setReshapeCSoffset ( m_CSoffset ); -#if JVET_X0143_ALF_APS_CHANGES m_cEncLib.setMaxNumALFAPS (m_maxNumAlfAps); m_cEncLib.setConstantJointCbCrSignFlag (m_constantJointCbCrSignFlag); -#endif #if JVET_O0756_CALCULATE_HDRMETRICS for (int i=0; i<hdrtoolslib::NB_REF_WHITE; i++) { diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index fe7ea3b8d3453a5abf1ed579b34d37426098d791..c8798ab248527a535865e96deedb6fca69671f87 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1612,10 +1612,8 @@ 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.") ("AlfTrueOrg", m_alfTrueOrg, true, "Using true original samples for ALF optimization when MCTF is enabled\n") ( "ALF", m_alf, true, "Adaptive Loop Filter\n" ) -#if JVET_X0143_ALF_APS_CHANGES ("MaxNumALFAPS", m_maxNumAlfAps, 8, "Maximum number of ALF APSs" ) ("ConstantJointCbCrSignFlag", m_constantJointCbCrSignFlag, 0, "Constant JointCbCr sign flag" ) -#endif ("ALFStrengthLuma", m_alfStrengthLuma, 1.0, "Adaptive Loop Filter strength for luma. The parameter scales the magnitudes of the ALF filter coefficients for luma. Valid range is 0.0 <= ALFStrengthLuma <= 1.0") ("ALFAllowPredefinedFilters", m_alfAllowPredefinedFilters, true, "Allow use of predefined filters for ALF") ("CCALFStrength", m_ccalfStrength, 1.0, "Cross-component Adaptive Loop Filter strength. The parameter scales the magnitudes of the CCALF filter coefficients. Valid range is 0.0 <= CCALFStrength <= 1.0") @@ -3167,9 +3165,7 @@ bool EncAppCfg::xCheckParameter() bool check_failed = false; /* abort if there is a fatal configuration problem */ #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) -#if JVET_X0143_ALF_APS_CHANGES xConfirmPara(m_maxNumAlfAps > ALF_CTB_MAX_NUM_APS, "The number of ALF APSs should not be more than ALF_CTB_MAX_NUM_APS"); -#endif if( m_depQuantEnabledFlag ) { @@ -3525,12 +3521,10 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_ccalf, "CCALF cannot be enabled when ALF is disabled" ); } -#if JVET_X0143_ALF_APS_CHANGES if (m_maxNumAlfAps == 0) { xConfirmPara(m_ccalf, "CCALF cannot be enabled when ALF APS is disabled"); } -#endif xConfirmPara( m_sourceWidth % SPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); xConfirmPara( m_sourceHeight % SPS::getWinUnitY(m_chromaFormatIDC) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); @@ -4657,10 +4651,8 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "SAO:%d ", (m_bUseSAO)?(1):(0)); msg( VERBOSE, "ALF:%d ", m_alf ? 1 : 0 ); msg( VERBOSE, "CCALF:%d ", m_ccalf ? 1 : 0 ); -#if JVET_X0143_ALF_APS_CHANGES msg(VERBOSE, "MaxNumALFAPS", m_maxNumAlfAps); msg(VERBOSE, "ConstantJointCbCrSignFlag", m_constantJointCbCrSignFlag); -#endif msg( VERBOSE, "WPP:%d ", (int)m_useWeightedPred); msg( VERBOSE, "WPB:%d ", (int)m_useWeightedBiPred); msg( VERBOSE, "PME:%d ", m_log2ParallelMergeLevel); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index dd82b5ea8d97a36c4f8c4ed0e393ae309775add0..d3eab60769f96c3ab7ab02c2e3bcbb470e4c837a 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -820,10 +820,8 @@ protected: bool m_bs2ModPOCAndType; bool m_forceDecodeBitstream1; -#if JVET_X0143_ALF_APS_CHANGES int m_maxNumAlfAps; int m_constantJointCbCrSignFlag; -#endif bool m_alf; ///< Adaptive Loop Filter bool m_alfTrueOrg; double m_alfStrengthLuma; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 86771dec7db7c31d4a5b65c5763590b0ce5a1611..4bd3a1a302c4bbac967ac952e8a43b350d24fec4 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -53,7 +53,6 @@ // clang-format off //########### place macros to be removed in next cycle below this line ############### -#define JVET_X0143_ALF_APS_CHANGES 1 #define JVET_X0143_ALF_APS_ID_OFFSET 0 // A value between 0 to 7 inclusive. This macro should be kept, or to be defined as a configuration parameter if possible. #define JVET_X0143_MERGER_FIXES 1 #define JVET_X0143_EXTRACTOR_FIXES 1 diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index 480aa23e340f3f6106b2998a1dea1d09ab83e188..07235faf3442b62a4cbdaa160bf138196e64e90f 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -884,11 +884,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda if( !layerIdx && ( cs.slice->getPendingRasInit() || cs.slice->isIDRorBLA() || ( cs.slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_encCfg->getCraAPSreset() ) ) ) { memset(cs.slice->getAlfAPSs(), 0, sizeof(*cs.slice->getAlfAPSs())*ALF_CTB_MAX_NUM_APS); -#if JVET_X0143_ALF_APS_CHANGES m_apsIdStart = m_encCfg->getMaxNumALFAPS(); -#else - m_apsIdStart = ALF_CTB_MAX_NUM_APS; -#endif m_apsMap->clearActive(); for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) @@ -1021,11 +1017,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda ); // derive filter (chroma) -#if JVET_X0143_ALF_APS_CHANGES if (!(m_encCfg->getMaxNumALFAPS() == 0) && isChromaEnabled(cs.pcv->chrFormat)) // Find ALF parameters for chroma if ALF APS is enabled -#else - if (isChromaEnabled(cs.pcv->chrFormat)) -#endif { alfEncoder( cs, alfParam, orgYuv, recYuv, cs.getRecoBuf(), CHANNEL_TYPE_CHROMA #if ENABLE_QPA @@ -2555,30 +2547,17 @@ void EncAdaptiveLoopFilter::setCtuEnableFlag( uint8_t** ctuFlags, ChannelType ch std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, int &newApsId) { APS** apss = cs.slice->getAlfAPSs(); -#if JVET_X0143_ALF_APS_CHANGES for (int i = 0; i < m_encCfg->getMaxNumALFAPS(); i++) -#else - for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) -#endif { apss[i] = m_apsMap->getPS((i << NUM_APS_TYPE_LEN) + ALF_APS); } std::vector<int> result; int apsIdChecked = 0, curApsId = m_apsIdStart; -#if JVET_X0143_ALF_APS_CHANGES if (curApsId < m_encCfg->getMaxNumALFAPS()) -#else - if (curApsId < ALF_CTB_MAX_NUM_APS) -#endif { -#if JVET_X0143_ALF_APS_CHANGES while ((apsIdChecked < m_encCfg->getMaxNumALFAPS()) && !cs.slice->isIRAP() && (result.size() < m_encCfg->getMaxNumALFAPS()) && !cs.slice->getPendingRasInit()) -#else - while (apsIdChecked < ALF_CTB_MAX_NUM_APS && !cs.slice->isIRAP() && result.size() < ALF_CTB_MAX_NUM_APS - && !cs.slice->getPendingRasInit()) -#endif { APS* curAPS = cs.slice->getAlfAPSs()[curApsId]; @@ -2587,11 +2566,7 @@ std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, i result.push_back(curApsId); } apsIdChecked++; -#if JVET_X0143_ALF_APS_CHANGES curApsId = (curApsId + 1) % m_encCfg->getMaxNumALFAPS(); -#else - curApsId = (curApsId + 1) % ALF_CTB_MAX_NUM_APS; -#endif } } cs.slice->setNumAlfApsIdsLuma((int)result.size()); @@ -2599,17 +2574,9 @@ std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, i newApsId = m_apsIdStart - 1; if (newApsId < 0) { -#if JVET_X0143_ALF_APS_CHANGES newApsId = m_encCfg->getMaxNumALFAPS() - 1; -#else - newApsId = ALF_CTB_MAX_NUM_APS - 1; -#endif } -#if JVET_X0143_ALF_APS_CHANGES CHECK(newApsId >= m_encCfg->getMaxNumALFAPS(), "Wrong APS index assignment in getAvaiApsIdsLuma"); -#else - CHECK(newApsId >= ALF_CTB_MAX_NUM_APS, "Wrong APS index assignment in getAvaiApsIdsLuma"); -#endif return result; } void EncAdaptiveLoopFilter::initDistortion() @@ -2684,17 +2651,11 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar int numIter = useNewFilter ? 2 : 1; for (int numTemporalAps = 0; numTemporalAps <= apsIds.size(); numTemporalAps++) { -#if JVET_X0143_ALF_APS_CHANGES if ((m_encCfg->getMaxNumALFAPS()==0) && ((numTemporalAps + useNewFilter) > 0)) { continue; } -#endif -#if JVET_X0143_ALF_APS_CHANGES if (numTemporalAps + useNewFilter > std::min(ALF_CTB_MAX_NUM_APS - 1, m_encCfg->getMaxNumALFAPS())) -#else - if (numTemporalAps + useNewFilter >= ALF_CTB_MAX_NUM_APS) -#endif { continue; } @@ -2939,11 +2900,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } //chroma -#if JVET_X0143_ALF_APS_CHANGES if (!(m_encCfg->getMaxNumALFAPS() == 0) && isChromaEnabled(cs.pcv->chrFormat)) // Find ALF parameters for chroma if ALF APS is enabled. -#else - if (isChromaEnabled(cs.pcv->chrFormat)) -#endif { m_alfParamTemp = alfParamNewFiltersBest; if (m_alfParamTemp.numAlternativesChroma < 1) @@ -2968,21 +2925,13 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar int curId = m_apsIdStart; // Do not assign ALF APS for chroma if any new APS ID is not avaiable -#if JVET_X0143_ALF_APS_CHANGES int counter = m_encCfg->getMaxNumALFAPS(); while ((newApsIdChroma < 0) && ((counter--))) -#else - while (newApsIdChroma < 0) -#endif { curId--; if (curId < 0) { -#if JVET_X0143_ALF_APS_CHANGES curId = m_encCfg->getMaxNumALFAPS() - 1; -#else - curId = ALF_CTB_MAX_NUM_APS - 1; -#endif } if (std::find(bestApsIds.begin(), bestApsIds.end(), curId) == bestApsIds.end()) { @@ -2990,11 +2939,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } } } -#if JVET_X0143_ALF_APS_CHANGES for (int curApsId = 0; curApsId < m_encCfg->getMaxNumALFAPS(); curApsId++) -#else - for (int curApsId = 0; curApsId < ALF_CTB_MAX_NUM_APS; curApsId++) -#endif { const bool reuseExistingAPS = curApsId != newApsIdChroma; @@ -3643,28 +3588,17 @@ void EncAdaptiveLoopFilter::determineControlIdcValues(CodingStructure &cs, const std::vector<int> EncAdaptiveLoopFilter::getAvailableCcAlfApsIds(CodingStructure& cs, ComponentID compID) { APS** apss = cs.slice->getAlfAPSs(); -#if JVET_X0143_ALF_APS_CHANGES for (int i = 0; i < m_encCfg->getMaxNumALFAPS(); i++) -#else - for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) -#endif { apss[i] = m_apsMap->getPS((i << NUM_APS_TYPE_LEN) + ALF_APS); } std::vector<int> result; int apsIdChecked = 0, curApsId = m_apsIdStart; -#if JVET_X0143_ALF_APS_CHANGES if (curApsId < m_encCfg->getMaxNumALFAPS()) { while ((apsIdChecked < m_encCfg->getMaxNumALFAPS()) && !cs.slice->isIRAP() && (result.size() < m_encCfg->getMaxNumALFAPS()) && !cs.slice->getPendingRasInit()) -#else - if (curApsId < ALF_CTB_MAX_NUM_APS) - { - while (apsIdChecked < ALF_CTB_MAX_NUM_APS && !cs.slice->isIRAP() && result.size() < ALF_CTB_MAX_NUM_APS - && !cs.slice->getPendingRasInit()) -#endif { APS* curAPS = cs.slice->getAlfAPSs()[curApsId]; if (curAPS && curAPS->getLayerId() == cs.slice->getPic()->layerId @@ -3673,11 +3607,7 @@ std::vector<int> EncAdaptiveLoopFilter::getAvailableCcAlfApsIds(CodingStructure& result.push_back(curApsId); } apsIdChecked++; -#if JVET_X0143_ALF_APS_CHANGES curApsId = (curApsId + 1) % m_encCfg->getMaxNumALFAPS(); -#else - curApsId = (curApsId + 1) % ALF_CTB_MAX_NUM_APS; -#endif } } return result; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index b56139655f100b406848476f114072183ea02fa8..b9d6e14a8ad9975c0de8a6d0ec7f1f51b16ab7dd 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -863,10 +863,8 @@ protected: CfgVPSParameters m_cfgVPSParameters; -#if JVET_X0143_ALF_APS_CHANGES int m_maxNumAlfAps; bool m_constantJointCbCrSignFlag; -#endif bool m_alf; ///< Adaptive Loop Filter bool m_alfTrueOrg; double m_alfStrengthLuma; @@ -2303,12 +2301,10 @@ public: void setDebugCTU( int i ) { m_debugCTU = i; } int getDebugCTU() const { return m_debugCTU; } -#if JVET_X0143_ALF_APS_CHANGES void setMaxNumALFAPS(int n) { m_maxNumAlfAps = n; } int getMaxNumALFAPS() const { return m_maxNumAlfAps; } void setConstantJointCbCrSignFlag(bool b) { m_constantJointCbCrSignFlag = b; } int getConstantJointCbCrSignFlag() const { return m_constantJointCbCrSignFlag; } -#endif void setUseALF( bool b ) { m_alf = b; } bool getUseALF() const { return m_alf; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index a39bfbf010134c8eaa41fd3712e6c69111f1ce6c..414010f64ceb9b368616be26d5f23941f404a063 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -3161,11 +3161,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } if (pcSlice->getSPS()->getJointCbCrEnabledFlag()) { -#if JVET_X0143_ALF_APS_CHANGES if (m_pcCfg->getConstantJointCbCrSignFlag()) pcPic->cs->picHeader->setJointCbCrSignFlag(m_pcCfg->getConstantJointCbCrSignFlag()-1); else -#endif m_pcSliceEncoder->setJointCbCrModes(*pcPic->cs, Position(0, 0), pcPic->cs->area.lumaSize()); } if (!pcSlice->getSPS()->getSpsRangeExtension().getReverseLastSigCoeffEnabledFlag() || pcSlice->getSliceQp() > 12) @@ -3566,20 +3564,12 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // Get active ALF APSs from picture/slice header const std::vector<int> sliceApsIdsLuma = pcSlice->getAlfApsIdsLuma(); -#if JVET_X0143_ALF_APS_CHANGES m_pcALF->setApsIdStart(m_pcCfg->getMaxNumALFAPS()); -#else - m_pcALF->setApsIdStart( ALF_CTB_MAX_NUM_APS ); -#endif ParameterSetMap<APS>* apsMap = m_pcEncLib->getApsMap(); apsMap->clearActive(); -#if JVET_X0143_ALF_APS_CHANGES for (int apsId = 0; apsId < m_pcCfg->getMaxNumALFAPS(); apsId++) -#else - for( int apsId = 0; apsId < ALF_CTB_MAX_NUM_APS; apsId++ ) -#endif { int psId = ( apsId << NUM_APS_TYPE_LEN ) + ALF_APS; APS* aps = apsMap->getPS( psId ); @@ -3621,11 +3611,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // Assign tne correct APS to slice and emulate the setting of ALF start APS ID int changedApsId = -1; -#if JVET_X0143_ALF_APS_CHANGES for (int apsId = m_pcCfg->getMaxNumALFAPS() - 1; apsId >= 0; apsId--) -#else - for (int apsId = ALF_CTB_MAX_NUM_APS - 1; apsId >= 0; apsId--) -#endif { ParameterSetMap<APS>* apsMap = m_pcEncLib->getApsMap(); int psId = ( apsId << NUM_APS_TYPE_LEN ) + ALF_APS; @@ -3796,11 +3782,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcSlice->getSPS()->getALFEnabledFlag() && (pcSlice->getAlfEnabledFlag(COMPONENT_Y) || pcSlice->getCcAlfCbEnabledFlag() || pcSlice->getCcAlfCrEnabledFlag())) { -#if JVET_X0143_ALF_APS_CHANGES for (int apsId = 0; apsId < m_pcCfg->getMaxNumALFAPS(); apsId++) -#else - for (int apsId = 0; apsId < ALF_CTB_MAX_NUM_APS; apsId++) -#endif { ParameterSetMap<APS> *apsMap = m_pcEncLib->getApsMap(); diff --git a/source/Lib/Utilities/program_options_lite.h b/source/Lib/Utilities/program_options_lite.h index 2b01e5eeec9afe501d35d29888fc1578b6299aae..a925b569b6028a204c97ae31ddb4e853d2f5d7d1 100644 --- a/source/Lib/Utilities/program_options_lite.h +++ b/source/Lib/Utilities/program_options_lite.h @@ -39,16 +39,13 @@ #define JVET_O0549_ENCODER_ONLY_FILTER_POL 1 // JVET-O0549: Encoder-only GOP-based temporal filter. Program Options Lite related changes. #define JVET_X0048_X0103_FILM_GRAIN 1 // JVET-X0048-X0103: SMPTE RDD-5 based film grain analysis and synthesis model for film grain characterstics (FGC) SEI -#if JVET_X0048_X0103_FILM_GRAIN #include <vector> -#endif #ifndef __PROGRAM_OPTIONS_LITE__ #define __PROGRAM_OPTIONS_LITE__ //! \ingroup TAppCommon //! \{ -#if JVET_X0048_X0103_FILM_GRAIN using namespace std; template <class T> @@ -74,7 +71,6 @@ struct SMultiValueInput istream& readValues(std::istream &in); }; -#endif namespace df {