diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 96e0179dd1df44618720fea752472ce3c022550b..753c36bf608cedd935fa9e95203d399b261ccd23 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -838,9 +838,7 @@ uint32_t DecApp::decode() } #endif -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING m_cDecLib.applyNnPostFilter(); -#endif xFlushOutput( pcListPic ); diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 1c58a602b2507e9ae7eedaee0a5d7ce4c38da760..17120c27c1526770a2d3c0f8446ecfaab72bbd83 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -274,11 +274,9 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setPsnrThresholdRPR (m_psnrThresholdRPR, m_psnrThresholdRPR2, m_psnrThresholdRPR3); m_cEncLib.setQpOffsetRPR (m_qpOffsetRPR, m_qpOffsetRPR2, m_qpOffsetRPR3); m_cEncLib.setQpOffsetChromaRPR (m_qpOffsetChromaRPR, m_qpOffsetChromaRPR2, m_qpOffsetChromaRPR3); -#if JVET_AC0096 m_cEncLib.setRprFunctionalityTestingEnabledFlag (m_rprFunctionalityTestingEnabledFlag); m_cEncLib.setRprSwitchingSegmentSize (m_rprSwitchingSegmentSize); m_cEncLib.setRprPopulatePPSatIntraFlag (m_rprPopulatePPSatIntraFlag); -#endif m_cEncLib.setRprEnabled (m_rprEnabledFlag); m_cEncLib.setResChangeInClvsEnabled ( m_resChangeInClvsEnabled ); m_cEncLib.setSwitchPocPeriod ( m_switchPocPeriod ); @@ -758,7 +756,6 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setLadfIntervalLowerBound(m_ladfIntervalLowerBound[k], k); } } -#if JVET_AC0096 if (m_rprFunctionalityTestingEnabledFlag) { for (int k = 0; k < m_rprSwitchingListSize; k++) @@ -768,7 +765,6 @@ void EncApp::xInitLibCfg( int layerIdx ) } m_cEncLib.setRprSwitchingListSize(m_rprSwitchingListSize); } -#endif m_cEncLib.setUseCiip ( m_ciip ); m_cEncLib.setUseGeo ( m_Geo ); m_cEncLib.setUseHashMECfgEnable (m_HashME); @@ -822,14 +818,12 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); m_cEncLib.setUseEarlySkipDetection ( m_useEarlySkipDetection ); m_cEncLib.setUseFastMerge ( m_useFastMrg ); -#if JVET_AC0139_UNIFIED_MERGE m_cEncLib.setMaxMergeRdCandNumTotal ( m_maxMergeRdCandNumTotal ); m_cEncLib.setMergeRdCandQuotaRegular ( m_mergeRdCandQuotaRegular ); m_cEncLib.setMergeRdCandQuotaRegularSmallBlk ( m_mergeRdCandQuotaRegularSmallBlk ); m_cEncLib.setMergeRdCandQuotaSubBlk ( m_mergeRdCandQuotaSubBlk); m_cEncLib.setMergeRdCandQuotaCiip ( m_mergeRdCandQuotaCiip ); m_cEncLib.setMergeRdCandQuotaGpm ( m_mergeRdCandQuotaGpm ); -#endif m_cEncLib.setUsePbIntraFast ( m_usePbIntraFast ); m_cEncLib.setUseAMaxBT ( m_useAMaxBT ); m_cEncLib.setUseE0023FastEnc ( m_e0023FastEnc ); @@ -1187,7 +1181,6 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setNNPostFilterSEICharacteristicsPropertyPresentFlag( m_nnPostFilterSEICharacteristicsPropertyPresentFlag[i], i); if (m_cEncLib.getNNPostFilterSEICharacteristicsPropertyPresentFlag(i)) { -#if JVET_AC0353_NNPFC_BASE_FLAG m_cEncLib.setNNPostFilterSEICharacteristicsBaseFlag (m_nnPostFilterSEICharacteristicsBaseFlag[i], i); if (!m_nnPostFilterSEICharacteristicsBaseFlag[i]) { @@ -1202,80 +1195,49 @@ void EncApp::xInitLibCfg( int layerIdx ) } CHECK(!baseFilterExist, "No base filter found! Cannot have an update filter without base filter.") } -#endif m_cEncLib.setNNPostFilterSEICharacteristicsPurpose (m_nnPostFilterSEICharacteristicsPurpose[i], i); -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if ((m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0) -#else - if (m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) == 2 || m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) == 4) -#endif { m_cEncLib.setNNPostFilterSEICharacteristicsOutSubCFlag(m_nnPostFilterSEICharacteristicsOutSubCFlag[i], i); } -#if JVET_AC0154 if ((m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) & NNPC_PurposeType::COLOURIZATION) != 0) { m_cEncLib.setNNPostFilterSEICharacteristicsOutColourFormatIdc(ChromaFormat(m_nnPostFilterSEICharacteristicsOutColourFormatIdc[i]), i); } -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if ((m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) & NNPC_PurposeType::RESOLUTION_UPSAMPLING) != 0) -#else - if (m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) == 3 || m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) == 4) -#endif { m_cEncLib.setNNPostFilterSEICharacteristicsPicWidthInLumaSamples (m_nnPostFilterSEICharacteristicsPicWidthInLumaSamples[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsPicHeightInLumaSamples (m_nnPostFilterSEICharacteristicsPicHeightInLumaSamples[i], i); } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if ((m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) & NNPC_PurposeType::FRAME_RATE_UPSAMPLING) != 0) -#else - if (m_cEncLib.getNNPostFilterSEICharacteristicsPurpose(i) == 5) -#endif { -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE m_cEncLib.setNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1(m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[i], i); -#else - m_cEncLib.setNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2(m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[i], i); -#endif m_cEncLib.setNNPostFilterSEICharacteristicsNumberInterpolatedPictures( m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[i], i); -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE m_cEncLib.setNNPostFilterSEICharacteristicsInputPicOutputFlag( m_nnPostFilterSEICharacteristicsInputPicOutputFlag[i], i); -#endif } m_cEncLib.setNNPostFilterSEICharacteristicsComponentLastFlag (m_nnPostFilterSEICharacteristicsComponentLastFlag[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsInpFormatIdc (m_nnPostFilterSEICharacteristicsInpFormatIdc[i], i); if (m_cEncLib.getNNPostFilterSEICharacteristicsInpFormatIdc(i) == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH m_cEncLib.setNNPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8(m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8(m_nnPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8[i], i); -#else - m_cEncLib.setNNPostFilterSEICharacteristicsInpTensorBitDepthMinus8 (m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[i], i); -#endif } m_cEncLib.setNNPostFilterSEICharacteristicsInpOrderIdc (m_nnPostFilterSEICharacteristicsInpOrderIdc[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsOutFormatIdc (m_nnPostFilterSEICharacteristicsOutFormatIdc[i], i); if (m_cEncLib.getNNPostFilterSEICharacteristicsOutFormatIdc(i) == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH m_cEncLib.setNNPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8(m_nnPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8(m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[i], i); -#else - m_cEncLib.setNNPostFilterSEICharacteristicsOutTensorBitDepthMinus8 (m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[i], i); -#endif } m_cEncLib.setNNPostFilterSEICharacteristicsOutOrderIdc (m_nnPostFilterSEICharacteristicsOutOrderIdc[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsConstantPatchSizeFlag ( m_nnPostFilterSEICharacteristicsConstantPatchSizeFlag[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsPatchWidthMinus1 ( m_nnPostFilterSEICharacteristicsPatchWidthMinus1[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsPatchHeightMinus1 ( m_nnPostFilterSEICharacteristicsPatchHeightMinus1[i], i); -#if JVET_AC0344_NNPFC_PATCH if (m_nnPostFilterSEICharacteristicsConstantPatchSizeFlag[i] == 0) { m_cEncLib.setNNPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1(m_nnPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1(m_nnPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1[i], i); } -#endif m_cEncLib.setNNPostFilterSEICharacteristicsOverlap ( m_nnPostFilterSEICharacteristicsOverlap[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsPaddingType ( m_nnPostFilterSEICharacteristicsPaddingType[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsLumaPadding (m_nnPostFilterSEICharacteristicsLumaPadding[i], i); @@ -1311,11 +1273,7 @@ void EncApp::xInitLibCfg( int layerIdx ) } } m_cEncLib.setNnPostFilterSEIActivationEnabled (m_nnPostFilterSEIActivationEnabled); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING m_cEncLib.setNnPostFilterSEIActivationTargetId(m_nnPostFilterSEIActivationTargetId); -#else - m_cEncLib.setNnPostFilterSEIActivationId (m_nnPostFilterSEIActivationId); -#endif m_cEncLib.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); m_cEncLib.setEntryPointPresentFlag ( m_entryPointPresentFlag ); m_cEncLib.setTMVPModeId ( m_TMVPModeId ); @@ -1361,11 +1319,7 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setPoSEIEnabled (m_poSEIEnabled); m_cEncLib.setPoSEIPayloadType (m_poSEIPayloadType); m_cEncLib.setPoSEIProcessingOrder (m_poSEIProcessingOrder); -#if JVET_AC0058_SEI m_cEncLib.setPoSEIPrefixByte (m_poSEIPrefixByte); -#else - m_cEncLib.setPoSEINumofSeiMessages (m_numofSEIMessages); -#endif @@ -1875,12 +1829,10 @@ bool EncApp::encode() return keepDoing; } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void EncApp::applyNnPostFilter() { m_cEncLib.applyNnPostFilter(); } -#endif // ==================================================================================================================== // Protected member functions @@ -1930,11 +1882,7 @@ void EncApp::xWriteOutput(int numEncoded, std::list<PelUnitBuf *> &recBufList) const int layerId = getVPS() ? getVPS()->getGeneralLayerIdx(m_cEncLib.getLayerId()) : 0; const SPS& sps = *m_cEncLib.getSPS(layerId); int ppsID = layerId; -#if JVET_AC0096 if ((m_gopBasedRPREnabledFlag && (m_cEncLib.getBaseQP() >= m_cEncLib.getGOPBasedRPRQPThreshold())) || m_rprFunctionalityTestingEnabledFlag) -#else - if (m_gopBasedRPREnabledFlag && (m_cEncLib.getBaseQP() >= m_cEncLib.getGOPBasedRPRQPThreshold())) -#endif { const PPS& pps1 = *m_cEncLib.getPPS(ENC_PPS_ID_RPR); const PPS& pps2 = *m_cEncLib.getPPS(ENC_PPS_ID_RPR2); diff --git a/source/App/EncoderApp/EncApp.h b/source/App/EncoderApp/EncApp.h index c9f0cde8024f712596d05a445a8303261b2935bd..d9b35e91b927b327f3ba77b86eaf21f0990b42a3 100644 --- a/source/App/EncoderApp/EncApp.h +++ b/source/App/EncoderApp/EncApp.h @@ -123,9 +123,7 @@ public: void destroyLib(); bool encodePrep( bool& eos ); bool encode(); ///< main encoding function -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void applyNnPostFilter(); -#endif void outputAU( const AccessUnit& au ); @@ -145,9 +143,7 @@ public: FeatureCounterStruct getFeatureCounter(){return m_cEncLib.getFeatureCounter();} void featureToFile(std::ofstream& featureFile,int feature[MAX_CU_DEPTH+1][MAX_CU_DEPTH+1], std::string featureName); #endif -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING bool getNNPostFilterEnabled() { return m_cEncLib.getNNPostFilterSEICharacteristicsEnabled() || m_cEncLib.getNnPostFilterSEIActivationEnabled(); } -#endif };// END CLASS DEFINITION EncApp //! \} diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 1b938833a1eef84257e88a283f3536ffc19ac500..8b41b7a4a6a6b129b3b1c9e277fd9d2fe14d78b8 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -712,12 +712,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<unsigned> cfg_virtualBoundariesPosX (0, std::numeric_limits<uint32_t>::max(), 0, 3); SMultiValueInput<unsigned> cfg_virtualBoundariesPosY (0, std::numeric_limits<uint32_t>::max(), 0, 3); -#if JVET_AC0096 const int defaultRprSwitchingResolutionOrderList[12] = { 1, 0, 2, 0, 3, 0, 1, 0, 2, 0, 3, 0 }; const int defaultRprSwitchingQPOffsetOrderList[12] = { -2, 0, -4, 0, -6, 0, -2, 0, -4, 0, -6, 0 }; SMultiValueInput<int> cfg_rprSwitchingResolutionOrderList(0, 3, 0, MAX_RPR_SWITCHING_ORDER_LIST_SIZE, defaultRprSwitchingResolutionOrderList, 12); SMultiValueInput<int> cfg_rprSwitchingQPOffsetOrderList(-MAX_QP, MAX_QP, 0, MAX_RPR_SWITCHING_ORDER_LIST_SIZE, defaultRprSwitchingQPOffsetOrderList, 12); -#endif SMultiValueInput<uint32_t> cfg_SubProfile(0, std::numeric_limits<uint8_t>::max(), 0, std::numeric_limits<uint8_t>::max()); SMultiValueInput<uint32_t> cfg_subPicCtuTopLeftX(0, std::numeric_limits<uint32_t>::max(), 0, MAX_NUM_SUB_PICS); @@ -749,23 +747,17 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<uint16_t> cfg_poSEIPayloadType (0, 65535, 0, 256*2); SMultiValueInput<uint16_t> cfg_poSEIProcessingOrder(0, 65535, 0, 65536); -#if JVET_AC0058_SEI SMultiValueInput<uint16_t> cfg_poSEINumofPrefixByte(0, 255, 0, 256); SMultiValueInput<uint16_t> cfg_poSEIPrefixByte (0, 255, 0, 256); -#endif SMultiValueInput<int32_t> cfg_postFilterHintSEIValues(INT32_MIN + 1, INT32_MAX, 1 * 1 * 1, 15 * 15 * 3); std::vector<SMultiValueInput<uint32_t>> cfg_nnPostFilterSEICharacteristicsInterpolatedPicturesList; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE std::vector<SMultiValueInput<bool>> cfg_nnPostFilterSEICharacteristicsInputPicOutputFlagList; -#endif for (int i = 0; i < MAX_NUM_NN_POST_FILTERS; i++) { cfg_nnPostFilterSEICharacteristicsInterpolatedPicturesList.push_back(SMultiValueInput<uint32_t>(0, std::numeric_limits<uint32_t>::max(), 1, 0)); -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE cfg_nnPostFilterSEICharacteristicsInputPicOutputFlagList.push_back(SMultiValueInput<bool>(0, 1, 1, 0)); -#endif } #if ENABLE_TRACING @@ -1085,14 +1077,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("IntraCMD", m_intraCMD, 0u, "IntraChroma MD: 0: none, 1:fixed to default wPSNR weight") ("LCTUFast", m_useFastLCTU, false, "Fast methods for large CTU") ("FastMrg", m_useFastMrg, false, "Fast methods for inter merge") -#if JVET_AC0139_UNIFIED_MERGE ("MaxMergeRdCandNumTotal", m_maxMergeRdCandNumTotal, 15, "Max total number of merge candidates in full RD checking") ("MergeRdCandQuotaRegular", m_mergeRdCandQuotaRegular, NUM_MRG_SATD_CAND, "Quota of regular merge candidates in full RD checking") ("MergeRdCandQuotaRegularSmallBlk", m_mergeRdCandQuotaRegularSmallBlk, NUM_MRG_SATD_CAND, "Quota of regular merge candidates in full RD checking for blocks < 64 luma samples") ("MergeRdCandQuotaSubBlk", m_mergeRdCandQuotaSubBlk, NUM_AFF_MRG_SATD_CAND, "Quota of sub-block merge candidates in full RD checking") ("MergeRdCandQuotaCiip", m_mergeRdCandQuotaCiip, 1, "Quota of CIIP merge candidates in full RD checking") ("MergeRdCandQuotaGpm", m_mergeRdCandQuotaGpm, GEO_MAX_TRY_WEIGHTED_SATD, "Quota of GPM merge candidates in full RD checking") -#endif ("PBIntraFast", m_usePbIntraFast, false, "Fast assertion if the intra mode is probable") ("AMaxBT", m_useAMaxBT, false, "Adaptive maximal BT-size") ("E0023FastEnc", m_e0023FastEnc, true, "Fast encoding setting for QTBT (proposal E0023)") @@ -1624,10 +1614,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SEIPOEnabled", m_poSEIEnabled, false, "Specifies whether SEI processing order is applied or not") ("SEIPOPayLoadType", cfg_poSEIPayloadType, cfg_poSEIPayloadType, "List of payloadType for processing") ("SEIPOProcessingOrder", cfg_poSEIProcessingOrder, cfg_poSEIProcessingOrder, "List of payloadType processing order") -#if JVET_AC0058_SEI ("SEIPONumofPrefixByte", cfg_poSEINumofPrefixByte, cfg_poSEINumofPrefixByte, "List of number of prefix bytes") ("SEIPOPrefixByte", cfg_poSEIPrefixByte, cfg_poSEIPrefixByte, "List of prefix bytes") -#endif ("SEIPostFilterHintEnabled", m_postFilterHintSEIEnabled, false, "Control generation of post-filter Hint SEI message") ("SEIPostFilterHintCancelFlag", m_postFilterHintSEICancelFlag, false, "Specifies the persistence of any previous post-filter Hint SEI message in output order") ("SEIPostFilterHintPersistenceFlag", m_postFilterHintSEIPersistenceFlag, false, "Specifies the persistence of the post-filter Hint SEI message for the current layer") @@ -1686,14 +1674,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("QpOffsetChromaRPR", m_qpOffsetChromaRPR, -6, "QP offset for RPR (-6 for 0.5x)") ("QpOffsetChromaRPR2", m_qpOffsetChromaRPR2, -4, "QP offset for RPR2 (-4 for 2/3x)") ("QpOffsetChromaRPR3", m_qpOffsetChromaRPR3, -2, "QP offset for RPR3 (-2 for 4/5x)") -#if JVET_AC0096 ("RPRFunctionalityTesting", m_rprFunctionalityTestingEnabledFlag, false, "Enables RPR functionality testing") ("RPRSwitchingResolutionOrderList", cfg_rprSwitchingResolutionOrderList, cfg_rprSwitchingResolutionOrderList, "Order of resolutions for each segment in RPR functionality testing where 0,1,2,3 corresponds to full resolution,4/5,2/3 and 1/2") ("RPRSwitchingQPOffsetOrderList", cfg_rprSwitchingQPOffsetOrderList, cfg_rprSwitchingQPOffsetOrderList, "Order of QP offset for each segment in RPR functionality testing, where the QP is modified according to the given offset") ("RPRSwitchingSegmentSize", m_rprSwitchingSegmentSize, 32, "Segment size with same resolution") ("RPRSwitchingTime", m_rprSwitchingTime, 0.0, "Segment switching time in seconds, when non-zero it defines the segment size according to frame rate (a multiple of 8)") ("RPRPopulatePPSatIntra", m_rprPopulatePPSatIntraFlag, false, "Populate all PPS which can be used in the sequence at the Intra, e.g. full-res, 4/5, 2/3 and 1/2") -#endif ( "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" ) @@ -1772,11 +1758,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) propertyPresentFlag << "SEINNPFCPropertyPresentFlag" << i; opts.addOptions()(propertyPresentFlag.str(), m_nnPostFilterSEICharacteristicsPropertyPresentFlag[i], false, "Specifies whether the filter purpose, input formatting, output formatting and complexity are present in the Neural Network Post Filter Characteristics SEI message"); -#if JVET_AC0353_NNPFC_BASE_FLAG std::ostringstream nnpfcBaseFlag; nnpfcBaseFlag << "SEINNPFCBaseFlag" << i; opts.addOptions()(nnpfcBaseFlag.str(), m_nnPostFilterSEICharacteristicsBaseFlag[i], false, "Specifies whether the filter is a base filter or not"); -#endif std::ostringstream purpose; purpose << "SEINNPFCPurpose" << i; @@ -1786,11 +1770,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) outSubWidthCFlag << "SEINNPFCOutSubCFlag" << i; opts.addOptions()(outSubWidthCFlag.str(), m_nnPostFilterSEICharacteristicsOutSubCFlag[i], false, "Specifies output chroma format when upsampling"); -#if JVET_AC0154 std::ostringstream outColourFormatIdc; outColourFormatIdc << "SEINNPFCOutColourFormatIdc" << i; opts.addOptions()(outColourFormatIdc.str(), m_nnPostFilterSEICharacteristicsOutColourFormatIdc[i], 1u, "Specifies output chroma format for colourization purpose"); -#endif std::ostringstream picWidthInLumaSamples; picWidthInLumaSamples << "SEINNPFCPicWidthInLumaSamples" << i; @@ -1800,7 +1782,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) picHeightInLumaSamples << "SEINNPFCPicHeightInLumaSamples" << i; opts.addOptions()(picHeightInLumaSamples.str(), m_nnPostFilterSEICharacteristicsPicHeightInLumaSamples[i], 0u, "Specifies the vertical luma sample counts of the output picture in the Neural Network Post Filter Characteristics SEI message"); -#if JVET_AC0061_TENSOR_BITDEPTH std::ostringstream inpTensorBitDepthLumaMinus8; inpTensorBitDepthLumaMinus8 << "SEINNPFCInpTensorBitDepthLumaMinusEight" << i; opts.addOptions()(inpTensorBitDepthLumaMinus8.str(), m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[i], 0u, "Specifies the bit depth of the input tensor luma minus 8 in the Neural Network Post Filter Characteristics SEI message"); @@ -1816,15 +1797,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) std::ostringstream outTensorBitDepthChromaMinus8; outTensorBitDepthChromaMinus8 << "SEINNPFCOutTensorBitDepthChromaMinusEight" << i; opts.addOptions()(outTensorBitDepthChromaMinus8.str(), m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[i], 0u, "Specifies the bit depth of the output tensor chroma minus 8 in the Neural Network Post Filter Characteristics SEI message"); -#else - std::ostringstream inpTensorBitDepthMinus8; - inpTensorBitDepthMinus8 << "SEINNPFCInpTensorBitDepthMinus8" << i; - opts.addOptions()(inpTensorBitDepthMinus8.str(), m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[i], 0u, "Specifies the bit depth of the input tensor minus 8 in the Neural Network Post Filter Characteristics SEI message"); - - std::ostringstream outTensorBitDepthMinus8; - outTensorBitDepthMinus8 << "SEINNPFCOutTensorBitDepthMinus8" << i; - opts.addOptions()(outTensorBitDepthMinus8.str(), m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[i], 0u, "Specifies the bit depth of the output tensor minus 8 in the Neural Network Post Filter Characteristics SEI message"); -#endif std::ostringstream componentLastFlag; componentLastFlag << "SEINNPFCComponentLastFlag" << i; @@ -1877,7 +1849,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) patchHeightMinus1 << "SEINNPFCPatchHeightMinus1" << i; opts.addOptions()(patchHeightMinus1.str(), m_nnPostFilterSEICharacteristicsPatchHeightMinus1[i], 0u, "Specifies the vertical sample counts of a patch in the Neural Network Post Filter Characteristics SEI message"); -#if JVET_AC0344_NNPFC_PATCH std::ostringstream extendedPatchWidthCdDeltaMinus1; extendedPatchWidthCdDeltaMinus1 << "SEINNPFCExtendedPatchWidthCdDeltaMinus1" << i; opts.addOptions()(extendedPatchWidthCdDeltaMinus1.str(), m_nnPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1[i], 0u, "Specifies the extended horizontal sample counts of a patch in the Neural Network Post Filter Characteristics SEI message"); @@ -1885,7 +1856,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) std::ostringstream extendedPatchHeightCdDeltaMinus1; extendedPatchHeightCdDeltaMinus1 << "SEINNPFCExtendedPatchHeightCdDeltaMinus1" << i; opts.addOptions()(extendedPatchHeightCdDeltaMinus1.str(), m_nnPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1[i], 0u, "Specifies the extended vertical sample counts of a patch in the Neural Network Post Filter Characteristics SEI message"); -#endif std::ostringstream overlap; overlap << "SEINNPFCOverlap" << i; @@ -1949,28 +1919,17 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "Specifies the NNR bitstream in the Neural Network Post Filter Characteristics SEI message"); std::ostringstream numberDecodedInputPics; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE numberDecodedInputPics << "SEINNPFCNumberInputDecodedPicsMinusOne" << i; opts.addOptions()(numberDecodedInputPics.str(), m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[i], 0u, "Specifies the number of decoded output pictures used as input for the post processing filter"); -#else - numberDecodedInputPics << "SEINNPFCNumberInputDecodedPicsMinusTwo" << i; - opts.addOptions()(numberDecodedInputPics.str(), m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[i], 0u, "Specifies the number of decoded output pictures used as input for the post processing filter"); -#endif std::ostringstream numberInterpolatedPics; numberInterpolatedPics << "SEINNPFCNumberInterpolatedPics" << i; opts.addOptions()(numberInterpolatedPics.str(), cfg_nnPostFilterSEICharacteristicsInterpolatedPicturesList[i], cfg_nnPostFilterSEICharacteristicsInterpolatedPicturesList[i], "Number of pictures to interpolate"); -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE std::ostringstream InputPicOutputFlag; InputPicOutputFlag << "SEINNPFCInputPicOutputFlag" << i; opts.addOptions()(InputPicOutputFlag.str(), cfg_nnPostFilterSEICharacteristicsInputPicOutputFlagList[i], cfg_nnPostFilterSEICharacteristicsInputPicOutputFlagList[i], "Indicates whether NNPF will generate a corresponding output picture for the input picture"); -#endif opts.addOptions()("SEINNPostFilterActivationEnabled", m_nnPostFilterSEIActivationEnabled, false, "Control use of the Neural Network Post Filter SEI on current picture"); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING opts.addOptions()("SEINNPostFilterActivationTargetId", m_nnPostFilterSEIActivationTargetId, 0u, "Target id of the Neural Network Post Filter on current picture"); -#else - opts.addOptions()("SEINNPostFilterActivationId", m_nnPostFilterSEIActivationId , 0u, "Id of the Neural Network Post Filter on current picture"); -#endif opts.addOptions()("SEINNPostFilterActivationCancelFlag", m_nnPostFilterSEIActivationCancelFlag, false, "Control use of the target neural network post filter established by any previous NNPFA SEI message"); opts.addOptions()("SEINNPostFilterActivationPersistenceFlag", m_nnPostFilterSEIActivationPersistenceFlag, false, "Specifies the persistence of the target neural-network post-processing filter for the current layer"); } @@ -1988,11 +1947,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_scalingRatioVer = 2.0; } } -#if JVET_AC0096 m_resChangeInClvsEnabled = m_scalingRatioHor != 1.0 || m_scalingRatioVer != 1.0 || m_gopBasedRPREnabledFlag || m_rprFunctionalityTestingEnabledFlag; -#else - m_resChangeInClvsEnabled = m_scalingRatioHor != 1.0 || m_scalingRatioVer != 1.0 || m_gopBasedRPREnabledFlag; -#endif m_resChangeInClvsEnabled = m_resChangeInClvsEnabled && m_rprEnabledFlag; if( m_constrainedRaslEncoding ) @@ -2496,23 +2451,17 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[i].push_back(0); } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE for(int j=0; j<m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[i].size(); ++j) { CHECK(m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[i][j] > 63, "The value of nnpfc_interpolated_pics[i] shall be in the range of 0 to 63, inclusive"); } CHECK(int(m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[i].size()) < int(m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[i]) - 1, "Number Interpolated Pictures List must be greater than number of decoder pictures list"); -#else - CHECK(m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[i].size() < m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[i], "Number Interpolated Pictures List must be greater than number of decoder pictures list"); -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE m_nnPostFilterSEICharacteristicsInputPicOutputFlag[i] = cfg_nnPostFilterSEICharacteristicsInputPicOutputFlagList[i].values; if (m_nnPostFilterSEICharacteristicsInputPicOutputFlag[i].size() == 0) { m_nnPostFilterSEICharacteristicsInputPicOutputFlag[i].push_back(0); } -#endif } if (isY4mFileExt(m_inputFileName)) @@ -2880,7 +2829,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_cuChromaQpOffsetList[i].u.comp.jointCbCrOffset = cfg_cbCrQpOffsetList.values.size() ? cfg_cbCrQpOffsetList.values[i] : 0; } -#if JVET_AC0096 if (m_rprFunctionalityTestingEnabledFlag) { m_upscaledOutput = 2; @@ -2904,7 +2852,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_rprSwitchingSegmentSize = segmentSize; } } -#endif if ( m_LadfEnabed ) { CHECK(m_ladfNumIntervals != cfg_ladfQpOffset.values.size(), @@ -3506,7 +3453,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { assert(cfg_poSEIPayloadType.values.size() > 1); assert(cfg_poSEIProcessingOrder.values.size() == cfg_poSEIPayloadType.values.size()); -#if JVET_AC0058_SEI m_poSEIPayloadType.resize((uint32_t) cfg_poSEIPayloadType.values.size()); m_poSEIProcessingOrder.resize((uint32_t) cfg_poSEIPayloadType.values.size()); m_poSEIPrefixByte.resize((uint32_t) cfg_poSEIPayloadType.values.size()); @@ -3547,24 +3493,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) // Error check, to avoid all SEI messages share the same PayloadOrder assert(!std::equal(cfg_poSEIProcessingOrder.values.begin() + 1, cfg_poSEIProcessingOrder.values.end(), cfg_poSEIProcessingOrder.values.begin())); -#else - m_numofSEIMessages = (uint32_t)cfg_poSEIPayloadType.values.size(); - m_poSEIPayloadType.resize(m_numofSEIMessages); - m_poSEIProcessingOrder.resize(m_numofSEIMessages); - for (uint32_t i = 0; i < m_numofSEIMessages; i++) - { - m_poSEIPayloadType[i] = cfg_poSEIPayloadType.values[i]; - m_poSEIProcessingOrder[i] = (uint16_t)cfg_poSEIProcessingOrder.values[i]; - //Error check, to avoid same PayloadType with different PayloadOrder - for (uint32_t j = 0; j < i; j++) - { - if (m_poSEIPayloadType[j] == m_poSEIPayloadType[i]) - { - assert(m_poSEIProcessingOrder[j]== m_poSEIProcessingOrder[i]); - } - } - } -#endif assert(m_poSEIPayloadType.size() > 0); assert(m_poSEIProcessingOrder.size() == m_poSEIPayloadType.size()); } @@ -4091,7 +4019,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_maxNumAffineMergeCand < (m_sbTmvpEnableFlag ? 1 : 0), "MaxNumAffineMergeCand must be greater than 0 when SbTMVP is enabled"); xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." ); -#if JVET_AC0139_UNIFIED_MERGE constexpr int maxCandNum = NUM_MRG_SATD_CAND + 1 + NUM_AFF_MRG_SATD_CAND + GEO_MAX_TRY_WEIGHTED_SATD; // Note: maxCandNum=15 is an empirical value for the number of candidate in RD checking // Limit maximum value of MaxMergeRdCandNumTotal to maxCandNum. Larger values are not expected to be beneficial @@ -4103,7 +4030,6 @@ bool EncAppCfg::xCheckParameter() || m_mergeRdCandQuotaCiip < 0 || m_mergeRdCandQuotaCiip > maxCandNum || m_mergeRdCandQuotaGpm < 0 || m_mergeRdCandQuotaGpm > maxCandNum, "MaxMergeRdCandNumReguar, MaxMergeRdCandNumReguarSmallBlk, MaxMergeRdCandNumSubBlk, MaxMergeRdCandNumCiip, and MaxMergeRdCandNumGpm must be between 0 and 15, inclusive"); -#endif if ( m_Affine == 0 ) { m_maxNumAffineMergeCand = m_sbTmvpEnableFlag ? 1 : 0; @@ -5040,18 +4966,11 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_nnPostFilterSEICharacteristicsId[i] > MAX_NNPFC_ID, "SEINNPFCId must be in the range of 0 to 2^32-2"); xConfirmPara(m_nnPostFilterSEICharacteristicsModeIdc[i] > 255, "SEINNPFCModeIdc must be in the range of 0 to 255"); xConfirmPara(m_nnPostFilterSEICharacteristicsPurpose[i] > 1023, "SEINNPFCPurpose must be in the range of 0 to 1023"); - #if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE xConfirmPara(m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[i] > 63, "SEINNPFCNumberInputDecodedPicturesMinus1 must be in the range of 0 to 63"); - #endif -#if JVET_AC0061_TENSOR_BITDEPTH xConfirmPara(m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[i] > 24, "SEINNPFCInpTensorBitDepthLumaMinus8 must be in the range of 0 to 24"); xConfirmPara(m_nnPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8[i] > 24, "SEINNPFCInpTensorBitDepthChromaMinus8 must be in the range of 0 to 24"); xConfirmPara(m_nnPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8[i] > 24, "SEINNPFCOutTensorBitDepthLumaMinus8 must be in the range of 0 to 24"); xConfirmPara(m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[i] > 24, "SEINNPFCOutTensorBitDepthChromaMinus8 must be in the range of 0 to 24"); -#else - xConfirmPara(m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[i] > 24, "SEINNPFCInpTensorBitDepthMinus8 must be in the range of 0 to 24"); - xConfirmPara(m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[i] > 24, "SEINNPFCOutTensorBitDepthMinus8 must be in the range of 0 to 24"); -#endif xConfirmPara(m_nnPostFilterSEICharacteristicsInpFormatIdc[i] > 255, "SEINNPFCInpFormatIdc must be in the range of 0 to 255"); xConfirmPara(m_nnPostFilterSEICharacteristicsInpOrderIdc[i] > 255, "SEINNPFCInpOrderIdc must be in the range of 0 to 255"); xConfirmPara(m_nnPostFilterSEICharacteristicsColPrimaries[i] > 255, "m_nnPostFilterSEICharacteristicsColPrimaries must in the range 0 to 255"); @@ -5065,22 +4984,14 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_nnPostFilterSEICharacteristicsPaddingType[i] > (1 << 4) - 1, "SEINNPostFilterPaddingType must be in the range of 0 to 2^4-1"); xConfirmPara(m_nnPostFilterSEICharacteristicsLog2ParameterBitLengthMinus3[i] > 3, "SEINNPFCLog2ParameterBitLengthMinus3 must be in the range of 0 to 3"); xConfirmPara(m_nnPostFilterSEICharacteristicsNumParametersIdc[i] > 52, "SEINNPFCNumParametersIdc must be in the range of 0 to 52"); -#if JVET_AC0154 xConfirmPara(m_nnPostFilterSEICharacteristicsTotalKilobyteSize[i] > (uint32_t) (((uint64_t) 1 << 32) - 2), "SEINNPFCTotalKilobyteSize must be in the range of 0 to 2^32-2"); xConfirmPara(m_nnPostFilterSEICharacteristicsNumKmacOperationsIdc[i] > (uint32_t) (((uint64_t) 1 << 32) - 2), "SEICharacteristicsNumKmacOperationsIdc must be in the range of 0 to 2^32-2"); -#else - xConfirmPara(m_nnPostFilterSEICharacteristicsTotalKilobyteSize[i] > (uint32_t) (((uint64_t) 1 << 32) - 1), "SEINNPFCTotalKilobyteSize must be in the range of 0 to 2^32-1"); -#endif } } if (m_nnPostFilterSEIActivationEnabled) { -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING xConfirmPara(m_nnPostFilterSEIActivationTargetId > MAX_NNPFA_ID, "SEINNPostFilterActivationTargetId must be in the range of 0 to 2^32-2"); -#else - xConfirmPara(m_nnPostFilterSEIActivationId > MAX_NNPFA_ID, "SEINNPostFilterActivationId must be in the range of 0 to 2^32-2"); -#endif } if (m_phaseIndicationSEIEnabledFullResolution) @@ -5481,12 +5392,10 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "\nFAST TOOL CFG: " ); msg( VERBOSE, "LCTUFast:%d ", m_useFastLCTU ); msg( VERBOSE, "FastMrg:%d ", m_useFastMrg ); -#if JVET_AC0139_UNIFIED_MERGE msg( VERBOSE, "MaxMergeRdCandNumTotal:%d MergeRdCandQuotaRegular:%d MergeRdCandQuotaRegularSmallBlk:%d ", m_maxMergeRdCandNumTotal, m_mergeRdCandQuotaRegular, m_mergeRdCandQuotaRegularSmallBlk); msg( VERBOSE, "MergeRdCandQuotaSubBlk:%d MergeRdCandQuotaCiip:%d MergeRdCandQuotaGpm:%d ", m_mergeRdCandQuotaSubBlk, m_mergeRdCandQuotaCiip, m_mergeRdCandQuotaGpm); -#endif msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast ); if( m_ImvMode ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast ); if (m_mtsMode) @@ -5508,30 +5417,16 @@ void EncAppCfg::xPrintParameter() if (m_resChangeInClvsEnabled) { -#if !JVET_AC0096 - msg( VERBOSE, "RPR:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor, m_scalingRatioVer, m_switchPocPeriod ); -#endif -#if JVET_AC0096 if (m_gopBasedRPREnabledFlag || m_rprFunctionalityTestingEnabledFlag) -#else - if (m_gopBasedRPREnabledFlag) -#endif { -#if JVET_AC0096 msg(VERBOSE, "RPR:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor, m_scalingRatioVer, m_rprFunctionalityTestingEnabledFlag ? m_rprSwitchingSegmentSize : m_gopSize); msg(VERBOSE, "RPR2:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor2, m_scalingRatioVer2, m_rprFunctionalityTestingEnabledFlag ? m_rprSwitchingSegmentSize : m_gopSize); msg(VERBOSE, "RPR3:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor3, m_scalingRatioVer3, m_rprFunctionalityTestingEnabledFlag ? m_rprSwitchingSegmentSize : m_gopSize); -#else - msg(VERBOSE, "RPR2:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor2, m_scalingRatioVer2, m_switchPocPeriod); - msg(VERBOSE, "RPR3:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor3, m_scalingRatioVer3, m_switchPocPeriod); -#endif } -#if JVET_AC0096 else { msg(VERBOSE, "RPR:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor, m_scalingRatioVer, m_switchPocPeriod); } -#endif } else { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index f84e446fdcccb369bd906ed7e584c131e3889557..64029f899451a34311c0add5ad77f075495ba490 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -423,14 +423,12 @@ protected: bool m_usePbIntraFast; bool m_useAMaxBT; bool m_useFastMrg; -#if JVET_AC0139_UNIFIED_MERGE int m_maxMergeRdCandNumTotal; int m_mergeRdCandQuotaRegular; int m_mergeRdCandQuotaRegularSmallBlk; int m_mergeRdCandQuotaSubBlk; int m_mergeRdCandQuotaCiip; int m_mergeRdCandQuotaGpm; -#endif bool m_e0023FastEnc; bool m_contentBasedFastQtbt; bool m_useNonLinearAlfLuma; @@ -736,25 +734,16 @@ protected: uint32_t m_nnPostFilterSEICharacteristicsId[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsModeIdc[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEICharacteristicsPropertyPresentFlag[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0353_NNPFC_BASE_FLAG bool m_nnPostFilterSEICharacteristicsBaseFlag[MAX_NUM_NN_POST_FILTERS]; -#endif uint32_t m_nnPostFilterSEICharacteristicsPurpose[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEICharacteristicsOutSubCFlag[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0154 uint32_t m_nnPostFilterSEICharacteristicsOutColourFormatIdc[MAX_NUM_NN_POST_FILTERS]; -#endif uint32_t m_nnPostFilterSEICharacteristicsPicWidthInLumaSamples[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPicHeightInLumaSamples[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0061_TENSOR_BITDEPTH uint32_t m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[MAX_NUM_NN_POST_FILTERS]; -#else - uint32_t m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[MAX_NUM_NN_POST_FILTERS]; - uint32_t m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[MAX_NUM_NN_POST_FILTERS]; -#endif bool m_nnPostFilterSEICharacteristicsComponentLastFlag[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsInpFormatIdc[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsAuxInpIdc[MAX_NUM_NN_POST_FILTERS]; @@ -768,10 +757,8 @@ protected: bool m_nnPostFilterSEICharacteristicsConstantPatchSizeFlag[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPatchWidthMinus1[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPatchHeightMinus1[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0344_NNPFC_PATCH uint32_t m_nnPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1[MAX_NUM_NN_POST_FILTERS]; -#endif uint32_t m_nnPostFilterSEICharacteristicsOverlap[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPaddingType[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsLumaPadding[MAX_NUM_NN_POST_FILTERS]; @@ -788,31 +775,17 @@ protected: uint32_t m_nnPostFilterSEICharacteristicsTotalKilobyteSize[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEIActivationEnabled; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING uint32_t m_nnPostFilterSEIActivationTargetId; -#else - uint32_t m_nnPostFilterSEIActivationId; -#endif - #if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE uint32_t m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[MAX_NUM_NN_POST_FILTERS]; - #else - uint32_t m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[MAX_NUM_NN_POST_FILTERS]; - #endif std::vector<uint32_t> m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE std::vector<bool> m_nnPostFilterSEICharacteristicsInputPicOutputFlag[MAX_NUM_NN_POST_FILTERS]; -#endif bool m_nnPostFilterSEIActivationCancelFlag; bool m_nnPostFilterSEIActivationPersistenceFlag; bool m_poSEIEnabled; std::vector<uint16_t> m_poSEIPayloadType; std::vector<uint16_t> m_poSEIProcessingOrder; -#if JVET_AC0058_SEI std::vector<std::vector<uint8_t>> m_poSEIPrefixByte; -#else - uint32_t m_numofSEIMessages; -#endif bool m_postFilterHintSEIEnabled; @@ -992,7 +965,6 @@ protected: int m_qpOffsetChromaRPR; int m_qpOffsetChromaRPR2; int m_qpOffsetChromaRPR3; -#if JVET_AC0096 int m_rprSwitchingResolutionOrderList[MAX_RPR_SWITCHING_ORDER_LIST_SIZE]; int m_rprSwitchingQPOffsetOrderList[MAX_RPR_SWITCHING_ORDER_LIST_SIZE]; int m_rprSwitchingListSize; @@ -1000,7 +972,6 @@ protected: bool m_rprPopulatePPSatIntraFlag; int m_rprSwitchingSegmentSize; double m_rprSwitchingTime; -#endif bool m_resChangeInClvsEnabled; bool m_refMetricsEnabled; double m_fractionOfFrames; ///< encode a fraction of the frames as specified in FramesToBeEncoded diff --git a/source/App/EncoderApp/encmain.cpp b/source/App/EncoderApp/encmain.cpp index 4df085a773a7147b25ec7e6330176f4959483c84..a0329ef1d556c7183365ca26c114314a08411d82 100644 --- a/source/App/EncoderApp/encmain.cpp +++ b/source/App/EncoderApp/encmain.cpp @@ -318,7 +318,6 @@ int main(int argc, char* argv[]) } } } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING for( auto & encApp : pcEncApp ) { if (encApp->getNNPostFilterEnabled()) @@ -326,7 +325,6 @@ int main(int argc, char* argv[]) encApp->applyNnPostFilter(); } } -#endif // ending time clock_t endClock = clock(); auto endTime = std::chrono::steady_clock::now(); diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 052c0dba35e6e0a477e8fac6c12a6ef84f7d832a..492534f550c723c4ab33e999354ed77235cd92ba 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -462,9 +462,7 @@ static constexpr int MAX_FILTER_SIZE = NTAPS_LUMA > NTAPS_CHROMA ? NTAPS_LUM static constexpr int MAX_LADF_INTERVALS = 5; /// max number of luma adaptive deblocking filter qp offset intervals -#if JVET_AC0096 static constexpr int MAX_RPR_SWITCHING_ORDER_LIST_SIZE = 32; /// max number of pre-defined RPR switching segments -#endif static constexpr int ATMVP_SUB_BLOCK_SIZE = 3; ///< sub-block size for ATMVP static constexpr int GEO_MAX_NUM_UNI_CANDS = 6; static constexpr int GEO_MAX_NUM_CANDS = GEO_MAX_NUM_UNI_CANDS * (GEO_MAX_NUM_UNI_CANDS - 1); diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index c8c19cde6ac8061c3ba31c644e7e7fb7c0cee803..7502e87d1951395ecfa132b6d524aa19bb03a728 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -2264,11 +2264,7 @@ bool InterPrediction::xPredInterBlkRPR(const ScalingRatio scalingRatio, const PP return scaled; } -#if JVET_AC0139_UNIFIED_MERGE void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) const -#else -void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) -#endif { CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" ); pu.regularMergeFlag = !(pu.ciipFlag || pu.cu->geoFlag); diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index c0c77819b08174ea2e48200c569ea512956f2d23..8c6aa55a9c4ca0a8b37e1d8482a40f9157cc9745 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -88,11 +88,7 @@ public: void getMmvdDeltaMv(const Slice& slice, const MmvdIdx candIdx, Mv deltaMv[NUM_REF_PIC_LIST_01]) const; bool mmvdUseAltHpelIf[MmvdIdx::BASE_MV_NUM]; bool useAltHpelIf [ MRG_MAX_NUM_CANDS ]; -#if JVET_AC0139_UNIFIED_MERGE void setMergeInfo( PredictionUnit& pu, int candIdx ) const; -#else - void setMergeInfo( PredictionUnit& pu, int candIdx ); -#endif }; class AffineMergeCtx diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index ca64f4b96f540eef7aba152a6ea26085935fe2c1..278bbd8eb817a5723ca52d671d6632fe1e74e5b7 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -94,9 +94,7 @@ struct Picture : public UnitArea void createColourTransfProcessor(bool firstPictureInSequence, SEIColourTransformApply* ctiCharacteristics, PelStorage* ctiBuf, int width, int height, ChromaFormat fmt, int bitDepth); PelUnitBuf getDisplayBuf(); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIMessages m_nnpfcActivated; -#endif #if JVET_Z0120_SII_SEI_PROCESSING void copyToPic(const SPS *sps, PelStorage *pcPicYuvSrc, PelStorage *pcPicYuvDst); diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index e693ae86f4a5d2480a0099465948a2f672d7f627..f3132e32162422b7229f23ff9535ac9cb1a45bd5 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -550,7 +550,6 @@ const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) } } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIShutterIntervalInfo::SEIShutterIntervalInfo(const SEIShutterIntervalInfo& sei) { m_siiEnabled = sei.m_siiEnabled; @@ -566,11 +565,7 @@ SEIProcessingOrderInfo::SEIProcessingOrderInfo(const SEIProcessingOrderInfo& sei m_posEnabled = sei.m_posEnabled; m_posPayloadType = sei.m_posPayloadType; m_posProcessingOrder = sei.m_posProcessingOrder; -#if JVET_AC0058_SEI m_posPrefixByte = sei.m_posPrefixByte; -#else - m_posNumofSeiMessages = sei.m_posNumofSeiMessages; -#endif } SEIEquirectangularProjection::SEIEquirectangularProjection(const SEIEquirectangularProjection& sei) @@ -1074,20 +1069,13 @@ SEINeuralNetworkPostFilterCharacteristics::SEINeuralNetworkPostFilterCharacteris m_outSubCFlag = sei.m_outSubCFlag; m_outSubWidthC = sei.m_outSubWidthC; m_outSubHeightC = sei.m_outSubHeightC; -#if JVET_AC0154 m_outColourFormatIdc = sei.m_outColourFormatIdc; -#endif m_picWidthInLumaSamples = sei.m_picWidthInLumaSamples; m_picHeightInLumaSamples = sei.m_picHeightInLumaSamples; -#if JVET_AC0061_TENSOR_BITDEPTH m_inpTensorBitDepthLumaMinus8 = sei.m_inpTensorBitDepthLumaMinus8; m_inpTensorBitDepthChromaMinus8 = sei.m_inpTensorBitDepthChromaMinus8; m_outTensorBitDepthLumaMinus8 = sei.m_outTensorBitDepthLumaMinus8; m_outTensorBitDepthChromaMinus8 = sei.m_outTensorBitDepthChromaMinus8; -#else - m_inpTensorBitDepthMinus8 = sei.m_inpTensorBitDepthMinus8; - m_outTensorBitDepthMinus8 = sei.m_outTensorBitDepthMinus8; -#endif m_componentLastFlag = sei.m_componentLastFlag; m_inpFormatIdc = sei.m_inpFormatIdc; m_auxInpIdc = sei.m_auxInpIdc; @@ -1101,10 +1089,8 @@ SEINeuralNetworkPostFilterCharacteristics::SEINeuralNetworkPostFilterCharacteris m_constantPatchSizeFlag = sei.m_constantPatchSizeFlag; m_patchWidthMinus1 = sei.m_patchWidthMinus1; m_patchHeightMinus1 = sei.m_patchHeightMinus1; -#if JVET_AC0344_NNPFC_PATCH m_extendedPatchWidthCdDeltaMinus1 = sei.m_extendedPatchWidthCdDeltaMinus1; m_extendedPatchHeightCdDeltaMinus1 = sei.m_extendedPatchHeightCdDeltaMinus1; -#endif m_overlap = sei.m_overlap; m_paddingType = sei.m_paddingType; m_lumaPadding = sei.m_lumaPadding; @@ -1123,15 +1109,9 @@ SEINeuralNetworkPostFilterCharacteristics::SEINeuralNetworkPostFilterCharacteris m_numParametersIdc = sei.m_numParametersIdc; m_numKmacOperationsIdc = sei.m_numKmacOperationsIdc; m_totalKilobyteSize = sei.m_totalKilobyteSize; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE m_numberInputDecodedPicturesMinus1 = sei.m_numberInputDecodedPicturesMinus1; -#else - m_numberInputDecodedPicturesMinus2 = sei.m_numberInputDecodedPicturesMinus2; -#endif m_numberInterpolatedPictures = sei.m_numberInterpolatedPictures; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE m_inputPicOutputFlag = sei.m_inputPicOutputFlag; -#endif } SEINeuralNetworkPostFilterActivation::SEINeuralNetworkPostFilterActivation( @@ -1171,15 +1151,10 @@ SEINeuralNetworkPostFilterCharacteristics* getSuperResolutionNnpfc(const SEIMess for (auto sei: seiList) { auto *nnpfcSEI = (SEINeuralNetworkPostFilterCharacteristics *) sei; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if ((nnpfcSEI->m_purpose & NNPC_PurposeType::RESOLUTION_UPSAMPLING) != 0) -#else - if (nnpfcSEI->m_purpose == 4) -#endif { return nnpfcSEI; } } return nullptr; } -#endif diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 58f48aca035601f487e669f44360b983480fe58f..83bf547914729eaf84bbf8b8f8ef18effa10ae32 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -126,9 +126,7 @@ class SEIFillerPayload : public SEI public: PayloadType payloadType() const { return PayloadType::FILLER_PAYLOAD; } SEIFillerPayload() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIFillerPayload(const SEIFillerPayload& sei) {} -#endif virtual ~SEIFillerPayload() {} }; @@ -138,9 +136,7 @@ class SEIShutterIntervalInfo : public SEI public: PayloadType payloadType() const { return PayloadType::SHUTTER_INTERVAL_INFO; } SEIShutterIntervalInfo() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIShutterIntervalInfo(const SEIShutterIntervalInfo& sei); -#endif virtual ~SEIShutterIntervalInfo() {} bool m_siiEnabled; @@ -156,19 +152,13 @@ class SEIProcessingOrderInfo : public SEI public: PayloadType payloadType() const { return PayloadType::SEI_PROCESSING_ORDER; } SEIProcessingOrderInfo() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIProcessingOrderInfo(const SEIProcessingOrderInfo& sei); -#endif virtual ~SEIProcessingOrderInfo() {} bool m_posEnabled; std::vector<uint16_t> m_posPayloadType; std::vector<uint16_t> m_posProcessingOrder; -#if JVET_AC0058_SEI std::vector<std::vector<uint8_t>> m_posPrefixByte; -#else - uint32_t m_posNumofSeiMessages; -#endif }; class SEIEquirectangularProjection : public SEI @@ -177,9 +167,7 @@ public: PayloadType payloadType() const { return PayloadType::EQUIRECTANGULAR_PROJECTION; } SEIEquirectangularProjection() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIEquirectangularProjection(const SEIEquirectangularProjection& sei); -#endif virtual ~SEIEquirectangularProjection() {} bool m_erpCancelFlag; @@ -196,9 +184,7 @@ public: PayloadType payloadType() const { return PayloadType::SPHERE_ROTATION; } SEISphereRotation() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEISphereRotation(const SEISphereRotation& sei); -#endif virtual ~SEISphereRotation() {} bool m_sphereRotationCancelFlag; @@ -214,9 +200,7 @@ public: PayloadType payloadType() const { return PayloadType::OMNI_VIEWPORT; } SEIOmniViewport() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIOmniViewport(const SEIOmniViewport& sei); -#endif virtual ~SEIOmniViewport() {} struct OmniViewport @@ -240,9 +224,7 @@ class SEIRegionWisePacking : public SEI public: PayloadType payloadType() const { return PayloadType::REGION_WISE_PACKING; } SEIRegionWisePacking() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIRegionWisePacking(const SEIRegionWisePacking& sei); -#endif virtual ~SEIRegionWisePacking() {} bool m_rwpCancelFlag; bool m_rwpPersistenceFlag; @@ -276,9 +258,7 @@ public: PayloadType payloadType() const { return PayloadType::GENERALIZED_CUBEMAP_PROJECTION; } SEIGeneralizedCubemapProjection() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIGeneralizedCubemapProjection(const SEIGeneralizedCubemapProjection& sei); -#endif virtual ~SEIGeneralizedCubemapProjection() {} bool m_gcmpCancelFlag; @@ -309,9 +289,7 @@ public: , m_sdiViewIdLenMinus1 (0) { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIScalabilityDimensionInfo(const SEIScalabilityDimensionInfo& sei); -#endif virtual ~SEIScalabilityDimensionInfo() {} bool isSDISameContent(SEIScalabilityDimensionInfo* sdiB); @@ -332,9 +310,7 @@ class SEIMultiviewAcquisitionInfo : public SEI public: PayloadType payloadType() const { return PayloadType::MULTIVIEW_ACQUISITION_INFO; } SEIMultiviewAcquisitionInfo ( ) { }; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIMultiviewAcquisitionInfo(const SEIMultiviewAcquisitionInfo& sei); -#endif ~SEIMultiviewAcquisitionInfo( ) { }; SEI* getCopy( ) const { return new SEIMultiviewAcquisitionInfo(*this); }; bool isMAISameContent(SEIMultiviewAcquisitionInfo* maiB); @@ -430,9 +406,7 @@ class SEIMultiviewViewPosition : public SEI public: PayloadType payloadType() const { return PayloadType::MULTIVIEW_VIEW_POSITION; } SEIMultiviewViewPosition() { }; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIMultiviewViewPosition(const SEIMultiviewViewPosition& sei); -#endif ~SEIMultiviewViewPosition() { }; bool isMVPSameContent(SEIMultiviewViewPosition* mvpB); @@ -454,9 +428,7 @@ public: , m_aciClipFlag (false) , m_aciClipTypeFlag (false) {}; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIAlphaChannelInfo(const SEIAlphaChannelInfo& sei); -#endif virtual ~SEIAlphaChannelInfo() {}; bool m_aciCancelFlag; @@ -486,9 +458,7 @@ public: , m_driDisparityRefViewId (0) , m_driDepthNonlinearRepresentationNumMinus1 (0) {}; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIDepthRepresentationInfo(const SEIDepthRepresentationInfo& sei); -#endif virtual ~SEIDepthRepresentationInfo() {}; bool m_driZNearFlag; @@ -510,9 +480,7 @@ class SEISampleAspectRatioInfo : public SEI public: PayloadType payloadType() const { return PayloadType::SAMPLE_ASPECT_RATIO_INFO; } SEISampleAspectRatioInfo() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEISampleAspectRatioInfo(const SEISampleAspectRatioInfo& sei); -#endif virtual ~SEISampleAspectRatioInfo() {} bool m_sariCancelFlag; bool m_sariPersistenceFlag; @@ -526,9 +494,7 @@ class SEIPhaseIndication : public SEI public: PayloadType payloadType() const { return PayloadType::PHASE_INDICATION; } SEIPhaseIndication() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIPhaseIndication(const SEIPhaseIndication& sei); -#endif virtual ~SEIPhaseIndication() {} int m_horPhaseNum; int m_horPhaseDenMinus1; @@ -544,15 +510,9 @@ public: PayloadType payloadType() const { return PayloadType::USER_DATA_UNREGISTERED; } SEIuserDataUnregistered() -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING : userData(nullptr) -#else - : userData(0) -#endif {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIuserDataUnregistered(const SEIuserDataUnregistered& sei); -#endif virtual ~SEIuserDataUnregistered() { @@ -570,9 +530,7 @@ public: PayloadType payloadType() const { return PayloadType::DECODED_PICTURE_HASH; } SEIDecodedPictureHash() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIDecodedPictureHash(const SEIDecodedPictureHash& sei); -#endif virtual ~SEIDecodedPictureHash() {} HashType method; @@ -586,9 +544,7 @@ class SEIDependentRAPIndication : public SEI public: PayloadType payloadType() const { return PayloadType::DEPENDENT_RAP_INDICATION; } SEIDependentRAPIndication() { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIDependentRAPIndication(const SEIDependentRAPIndication& sei) {} -#endif virtual ~SEIDependentRAPIndication() { } }; @@ -627,9 +583,7 @@ public: ::memset(m_cpbRemovalDelayDelta, 0, sizeof(m_cpbRemovalDelayDelta)); ::memset(m_dpbOutputTidOffset, 0, sizeof(m_dpbOutputTidOffset)); } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIBufferingPeriod(const SEIBufferingPeriod& sei); -#endif virtual ~SEIBufferingPeriod() {} void setDuCpbRemovalDelayIncrementLength( uint32_t value ) { m_duCpbRemovalDelayIncrementLength = value; } @@ -684,9 +638,7 @@ public: ::memset(m_cpbRemovalDelayDeltaIdx, 0, sizeof(m_cpbRemovalDelayDeltaIdx)); ::memset(m_auCpbRemovalDelay, 0, sizeof(m_auCpbRemovalDelay)); } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIPictureTiming(const SEIPictureTiming& sei); -#endif virtual ~SEIPictureTiming() { } @@ -728,9 +680,7 @@ public: ::memset(m_duiSubLayerDelaysPresentFlag, 0, sizeof(m_duiSubLayerDelaysPresentFlag)); ::memset(m_duSptCpbRemovalDelayIncrement, 0, sizeof(m_duSptCpbRemovalDelayIncrement)); } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei); -#endif virtual ~SEIDecodingUnitInfo() {} int m_decodingUnitIdx; bool m_duiSubLayerDelaysPresentFlag[MAX_TLAYER]; @@ -756,9 +706,7 @@ public: , m_sourceScanType(0) , m_duplicateFlag(false) {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIFrameFieldInfo(const SEIFrameFieldInfo& sei); -#endif virtual ~SEIFrameFieldInfo() {} bool m_fieldPicFlag; @@ -779,9 +727,7 @@ public: PayloadType payloadType() const { return PayloadType::FRAME_PACKING; } SEIFramePacking() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIFramePacking(const SEIFramePacking& sei); -#endif virtual ~SEIFramePacking() {} int m_arrangementId; @@ -810,9 +756,7 @@ public: PayloadType payloadType() const { return PayloadType::DISPLAY_ORIENTATION; } SEIDisplayOrientation() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIDisplayOrientation(const SEIDisplayOrientation& sei); -#endif virtual ~SEIDisplayOrientation() {} bool m_doCancelFlag; @@ -826,9 +770,7 @@ public: PayloadType payloadType() const { return PayloadType::GREEN_METADATA; } SEIGreenMetadata() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIGreenMetadata(const SEIGreenMetadata& sei) {} -#endif virtual ~SEIGreenMetadata() {} }; @@ -838,9 +780,7 @@ class SEIGreenMetadataInfo : public SEI public: PayloadType payloadType() const { return PayloadType::GREEN_METADATA; } SEIGreenMetadataInfo() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIGreenMetadataInfo(const SEIGreenMetadataInfo& sei); -#endif virtual ~SEIGreenMetadataInfo() {} int m_greenMetadataType =-1; @@ -874,9 +814,7 @@ class SEIParameterSetsInclusionIndication : public SEI public: PayloadType payloadType() const { return PayloadType::PARAMETER_SETS_INCLUSION_INDICATION; } SEIParameterSetsInclusionIndication() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIParameterSetsInclusionIndication(const SEIParameterSetsInclusionIndication& sei); -#endif virtual ~SEIParameterSetsInclusionIndication() {} int m_selfContainedClvsFlag; @@ -887,9 +825,7 @@ class SEIMasteringDisplayColourVolume : public SEI public: PayloadType payloadType() const { return PayloadType::MASTERING_DISPLAY_COLOUR_VOLUME; } SEIMasteringDisplayColourVolume() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIMasteringDisplayColourVolume(const SEIMasteringDisplayColourVolume& sei); -#endif virtual ~SEIMasteringDisplayColourVolume() {} SEIMasteringDisplay values; @@ -921,9 +857,7 @@ public: , m_snSubpicIdLen (0) , m_snNumSEIs(0) {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIScalableNesting(const SEIScalableNesting& sei); -#endif virtual ~SEIScalableNesting() { @@ -959,9 +893,7 @@ public: SEIAlternativeTransferCharacteristics() : m_preferredTransferCharacteristics(18) { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIAlternativeTransferCharacteristics(const SEIAlternativeTransferCharacteristics& sei); -#endif virtual ~SEIAlternativeTransferCharacteristics() {} @@ -973,9 +905,7 @@ public: PayloadType payloadType() const { return PayloadType::USER_DATA_REGISTERED_ITU_T_T35; } SEIUserDataRegistered() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIUserDataRegistered(const SEIUserDataRegistered& sei); -#endif virtual ~SEIUserDataRegistered() {} uint16_t m_ituCountryCode; @@ -988,9 +918,7 @@ public: PayloadType payloadType() const { return PayloadType::FILM_GRAIN_CHARACTERISTICS; } SEIFilmGrainCharacteristics() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIFilmGrainCharacteristics(const SEIFilmGrainCharacteristics& sei); -#endif virtual ~SEIFilmGrainCharacteristics() {} bool m_filmGrainCharacteristicsCancelFlag; @@ -1029,9 +957,7 @@ class SEIContentLightLevelInfo : public SEI public: PayloadType payloadType() const { return PayloadType::CONTENT_LIGHT_LEVEL_INFO; } SEIContentLightLevelInfo() { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIContentLightLevelInfo(const SEIContentLightLevelInfo& sei); -#endif virtual ~SEIContentLightLevelInfo() { } @@ -1044,9 +970,7 @@ class SEIAmbientViewingEnvironment : public SEI public: PayloadType payloadType() const { return PayloadType::AMBIENT_VIEWING_ENVIRONMENT; } SEIAmbientViewingEnvironment() { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIAmbientViewingEnvironment(const SEIAmbientViewingEnvironment& sei); -#endif virtual ~SEIAmbientViewingEnvironment() { } @@ -1060,9 +984,7 @@ class SEIColourTransformInfo : public SEI public: PayloadType payloadType() const { return PayloadType::COLOUR_TRANSFORM_INFO; } SEIColourTransformInfo() { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIColourTransformInfo(const SEIColourTransformInfo& sei); -#endif virtual ~SEIColourTransformInfo() { } uint16_t m_id; @@ -1084,9 +1006,7 @@ class SEIContentColourVolume : public SEI public: PayloadType payloadType() const { return PayloadType::CONTENT_COLOUR_VOLUME; } SEIContentColourVolume() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIContentColourVolume(const SEIContentColourVolume& sei); -#endif virtual ~SEIContentColourVolume() {} bool m_ccvCancelFlag; @@ -1117,9 +1037,7 @@ public: , m_sliMaxSublayers(1) , m_sliSublayerInfoPresentFlag(false) {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEISubpicureLevelInfo(const SEISubpicureLevelInfo& sei); -#endif virtual ~SEISubpicureLevelInfo() {} int m_numRefLevels; @@ -1139,9 +1057,7 @@ public: PayloadType payloadType() const { return PayloadType::SEI_MANIFEST; } SEIManifest() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIManifest(const SEIManifest& sei); -#endif virtual ~SEIManifest() {} enum SEIManifestDescription @@ -1164,9 +1080,7 @@ public: PayloadType payloadType() const { return PayloadType::SEI_PREFIX_INDICATION; } SEIPrefixIndication() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIPrefixIndication(const SEIPrefixIndication& sei); -#endif virtual ~SEIPrefixIndication() {} PayloadType m_prefixSeiPayloadType; @@ -1183,12 +1097,10 @@ class SEIAnnotatedRegions : public SEI public: PayloadType payloadType() const { return PayloadType::ANNOTATED_REGIONS; } SEIAnnotatedRegions() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIAnnotatedRegions(const SEIAnnotatedRegions& sei) { copyFrom(sei); } -#endif virtual ~SEIAnnotatedRegions() {} void copyFrom(const SEIAnnotatedRegions &seiAnnotatedRegions) @@ -1256,9 +1168,7 @@ public: PayloadType payloadType() const { return PayloadType::EXTENDED_DRAP_INDICATION; } SEIExtendedDrapIndication() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIExtendedDrapIndication(const SEIExtendedDrapIndication& sei); -#endif virtual ~SEIExtendedDrapIndication() {} int m_edrapIndicationRapIdMinus1; @@ -1273,9 +1183,7 @@ class SEIConstrainedRaslIndication : public SEI public: PayloadType payloadType() const { return PayloadType::CONSTRAINED_RASL_ENCODING; } SEIConstrainedRaslIndication() { } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIConstrainedRaslIndication(const SEIConstrainedRaslIndication& sei) {} -#endif virtual ~SEIConstrainedRaslIndication() { } }; @@ -1286,9 +1194,7 @@ public: PayloadType payloadType() const { return PayloadType::VDI_SEI_ENVELOPE; } SEIVDISeiEnvelope() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIVDISeiEnvelope(const SEIVDISeiEnvelope& sei) {} -#endif virtual ~SEIVDISeiEnvelope() {} }; @@ -1301,26 +1207,17 @@ public: , m_modeIdc(0) , m_propertyPresentFlag(false) , m_purpose(0) -#if JVET_AC0353_NNPFC_BASE_FLAG , m_baseFlag(false) -#endif , m_outSubCFlag(0) , m_outSubWidthC(1) , m_outSubHeightC(1) -#if JVET_AC0154 , m_outColourFormatIdc(ChromaFormat::_420) -#endif , m_picWidthInLumaSamples(0) , m_picHeightInLumaSamples(0) -#if JVET_AC0061_TENSOR_BITDEPTH , m_inpTensorBitDepthLumaMinus8(0) , m_inpTensorBitDepthChromaMinus8(0) , m_outTensorBitDepthLumaMinus8(0) , m_outTensorBitDepthChromaMinus8(0) -#else - , m_inpTensorBitDepthMinus8(0) - , m_outTensorBitDepthMinus8(0) -#endif , m_componentLastFlag(false) , m_inpFormatIdc(0) , m_auxInpIdc(0) @@ -1334,10 +1231,8 @@ public: , m_constantPatchSizeFlag(false) , m_patchWidthMinus1(0) , m_patchHeightMinus1(0) -#if JVET_AC0344_NNPFC_PATCH , m_extendedPatchWidthCdDeltaMinus1(0) , m_extendedPatchHeightCdDeltaMinus1(0) -#endif , m_overlap(0) , m_paddingType(0) , m_lumaPadding(0) @@ -1353,9 +1248,7 @@ public: , m_numKmacOperationsIdc(0) , m_totalKilobyteSize(0) {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEINeuralNetworkPostFilterCharacteristics(const SEINeuralNetworkPostFilterCharacteristics& sei); -#endif ~SEINeuralNetworkPostFilterCharacteristics() override { @@ -1370,26 +1263,17 @@ public: uint32_t m_modeIdc; bool m_propertyPresentFlag; uint32_t m_purpose; -#if JVET_AC0353_NNPFC_BASE_FLAG bool m_baseFlag; -#endif bool m_outSubCFlag; uint8_t m_outSubWidthC; uint8_t m_outSubHeightC; - #if JVET_AC0154 ChromaFormat m_outColourFormatIdc; - #endif uint32_t m_picWidthInLumaSamples; uint32_t m_picHeightInLumaSamples; -#if JVET_AC0061_TENSOR_BITDEPTH uint32_t m_inpTensorBitDepthLumaMinus8; uint32_t m_inpTensorBitDepthChromaMinus8; uint32_t m_outTensorBitDepthLumaMinus8; uint32_t m_outTensorBitDepthChromaMinus8; -#else - uint32_t m_inpTensorBitDepthMinus8; - uint32_t m_outTensorBitDepthMinus8; -#endif bool m_componentLastFlag; uint32_t m_inpFormatIdc; uint32_t m_auxInpIdc; @@ -1403,10 +1287,8 @@ public: bool m_constantPatchSizeFlag; uint32_t m_patchWidthMinus1; uint32_t m_patchHeightMinus1; -#if JVET_AC0344_NNPFC_PATCH uint32_t m_extendedPatchWidthCdDeltaMinus1; uint32_t m_extendedPatchHeightCdDeltaMinus1; -#endif uint32_t m_overlap; uint32_t m_paddingType; uint32_t m_lumaPadding; @@ -1422,15 +1304,9 @@ public: uint32_t m_numParametersIdc; uint32_t m_numKmacOperationsIdc; uint32_t m_totalKilobyteSize; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE uint32_t m_numberInputDecodedPicturesMinus1; -#else - uint32_t m_numberInputDecodedPicturesMinus2; -#endif std::vector<uint32_t> m_numberInterpolatedPictures; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE std::vector<bool> m_inputPicOutputFlag; -#endif }; class SEINeuralNetworkPostFilterActivation : public SEI @@ -1438,25 +1314,15 @@ class SEINeuralNetworkPostFilterActivation : public SEI public: PayloadType payloadType() const { return PayloadType::NEURAL_NETWORK_POST_FILTER_ACTIVATION; } SEINeuralNetworkPostFilterActivation() -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING : m_targetId(0) -#else - : m_id(0) -#endif , m_cancelFlag(false) , m_persistenceFlag(false) {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEINeuralNetworkPostFilterActivation(const SEINeuralNetworkPostFilterActivation& sei); -#endif virtual ~SEINeuralNetworkPostFilterActivation() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING uint32_t m_targetId; -#else - uint32_t m_id; -#endif bool m_cancelFlag; bool m_persistenceFlag; }; @@ -1467,9 +1333,7 @@ public: PayloadType payloadType() const { return PayloadType::POST_FILTER_HINT; } SEIPostFilterHint() {} -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIPostFilterHint(const SEIPostFilterHint& sei); -#endif virtual ~SEIPostFilterHint() {} bool m_filterHintCancelFlag; @@ -1481,10 +1345,8 @@ public: std::vector<int> m_filterHintValues; // values stored in linear array, [ ( ( component * sizeY + y ) * SizeX ) + x ] }; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEINeuralNetworkPostFilterCharacteristics* getNnpfcWithGivenId(const SEIMessages &seiList, uint32_t nnpfaTargetId); SEINeuralNetworkPostFilterCharacteristics* getSuperResolutionNnpfc(const SEIMessages &seiList); -#endif //! \} diff --git a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp index 2a43735a3d13215b4903f890e07b1deaeb86f1ca..0470b3558c9d2cd08173e836386d60f3d9bd4833 100644 --- a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp +++ b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp @@ -37,7 +37,6 @@ #include "SEINeuralNetworkPostFiltering.h" -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEINeuralNetworkPostFiltering::SEINeuralNetworkPostFiltering() : m_picList() @@ -112,11 +111,7 @@ void SEINeuralNetworkPostFiltering::filterPictures(PicList& picList) for (auto sei : currCodedPic->m_nnpfcActivated) { auto currNnpfc = (SEINeuralNetworkPostFilterCharacteristics*) sei; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE bool pictureRateUpsamplingFlag = (currNnpfc->m_purpose & NNPC_PurposeType::FRAME_RATE_UPSAMPLING) != 0; -#else - bool pictureRateUpsamplingFlag = currNnpfc->m_purpose == 5; -#endif if (pictureRateUpsamplingFlag) { uint32_t sourceWidth = pps->getPicWidthInLumaSamples() @@ -159,11 +154,7 @@ void SEINeuralNetworkPostFiltering::findFrameRateUpSamplingInputPics( Picture* currCodedPic, const SEINeuralNetworkPostFilterCharacteristics* frameRateUpsamplingNnpfc, uint32_t sourceWidth, uint32_t sourceHeight, uint32_t croppedWidth, uint32_t croppedHeight) { -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE uint32_t numInputPics = frameRateUpsamplingNnpfc->m_numberInputDecodedPicturesMinus1 + 1; -#else - int numInputPics = frameRateUpsamplingNnpfc->m_numberInputDecodedPicturesMinus2 + 2; -#endif std::vector<uint32_t> inputPicPoc(numInputPics, 0); uint32_t currPicPOC = currCodedPic->getPOC(); @@ -204,11 +195,7 @@ void SEINeuralNetworkPostFiltering::findFrameRateUpSamplingInputPics( for (auto sei : inputPic->m_nnpfcActivated) { const auto *inputNnpfc = (SEINeuralNetworkPostFilterCharacteristics*)sei; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if ((inputNnpfc->m_purpose & NNPC_PurposeType::RESOLUTION_UPSAMPLING) != 0) -#else - if (nnpfc->m_purpose == 4) -#endif { CHECK(inputNnpfc->m_picWidthInLumaSamples != croppedWidth || inputNnpfc->m_picHeightInLumaSamples != croppedHeight, "Input picture shall have a super resolution NNPF activated"); inputPicUsesNnpfResolutionAdaptation = true; @@ -220,4 +207,3 @@ void SEINeuralNetworkPostFiltering::findFrameRateUpSamplingInputPics( } } } -#endif diff --git a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h index 0205bb1eb8d182f62080e12ec9030216f9cde571..a09aa36c72b2401f7faa953f628a039deac978e6 100644 --- a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h +++ b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h @@ -44,7 +44,6 @@ #include "SEI.h" #include "PictureParameterSet.h" -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING #include <map> typedef std::vector<Picture*> PicVector; @@ -69,4 +68,3 @@ public: }; #endif -#endif diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 0bee174db3b2f306d1de4ffacc2649dba8658e8f..e547758b1c91699f05c2095ad88bc30c4d639223 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -56,16 +56,6 @@ //########### place macros to be removed in next cycle below this line ############### -#define JVET_AC0139_UNIFIED_MERGE 1 -#define JVET_AC0096 1 -#define JVET_AC0058_SEI 1 -#define JVET_AC0154 1 -#define JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE 1 -#define JVET_AC0061_TENSOR_BITDEPTH 1 -#define JVET_AC0062_CONSTRAINT_CHECK 1 -#define JVET_AC0344_NNPFC_PATCH 1 -#define JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING 1 -#define JVET_AC0353_NNPFC_BASE_FLAG 1 //########### place macros to be be kept below this line ############### @@ -770,7 +760,6 @@ enum NNPC_PaddingType FIXED_PADDING = 4 }; -#if JVET_AC0154 enum NNPC_PurposeType { UNKONWN = 0, @@ -781,17 +770,6 @@ enum NNPC_PurposeType BIT_DEPTH_UPSAMPLING = 16, COLOURIZATION = 32 }; -#else -enum NNPC_PurposeType -{ - UNKONWN = 0, - VISUAL_QUALITY_IMPROVEMENT = 1, - CHROMA_UPSAMPLING = 2, - INCREASE_PICT_DIMENSION_WITHOUT_CHROMA_UPSAMPLING = 3, - INCREASE_PICT_DIMENSION_WITH_CHROMA_UPSMAPLING = 4, - FRAME_RATE_UPSAMPLING = 5 -}; -#endif enum POST_FILTER_MODE { diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 008059c3577e1c1bfd1d3253edb6ee772bb18588..735da98264f69f0272a66b99b8bb07d515a2ba3d 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -4035,7 +4035,6 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, c return true; } -#if JVET_AC0139_UNIFIED_MERGE void PU::spanMotionInfo(PredictionUnit &pu, const MergeCtx &mrgCtx) { spanMotionInfo(pu, mrgCtx.subPuMvpMiBuf); @@ -4043,10 +4042,6 @@ void PU::spanMotionInfo(PredictionUnit &pu, const MergeCtx &mrgCtx) void PU::spanMotionInfo(PredictionUnit &pu, const MotionBuf& subPuMvpMiBuf) { -#else -void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) -{ -#endif MotionBuf mb = pu.getMotionBuf(); if (!pu.mergeFlag || pu.mergeType == MergeType::DEFAULT_N || pu.mergeType == MergeType::IBC) @@ -4102,13 +4097,8 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) } else if (pu.mergeType == MergeType::SUBPU_ATMVP) { -#if JVET_AC0139_UNIFIED_MERGE CHECK(subPuMvpMiBuf.area() == 0 || !subPuMvpMiBuf.buf, "Buffer not initialized"); mb.copyFrom(subPuMvpMiBuf); -#else - CHECK(mrgCtx.subPuMvpMiBuf.area() == 0 || !mrgCtx.subPuMvpMiBuf.buf, "Buffer not initialized"); - mb.copyFrom(mrgCtx.subPuMvpMiBuf); -#endif } else { diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 99634b1f1fe9c357d0fdeb2a1ac4854c103a99cc..322b5456cfd72b1c064b5118b1b36a972a644520 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -178,9 +178,7 @@ namespace PU bool addAffineMVPCandUnscaled ( const PredictionUnit &pu, const RefPicList &refPicList, const int &refIdx, const Position &pos, const MvpDir &dir, AffineAMVPInfo &affiAmvpInfo ); bool isBipredRestriction (const PredictionUnit &pu); void spanMotionInfo ( PredictionUnit &pu, const MergeCtx &mrgCtx = MergeCtx() ); -#if JVET_AC0139_UNIFIED_MERGE void spanMotionInfo ( PredictionUnit &pu, const MotionBuf& subPuMvpMiBuf); -#endif void applyImv(PredictionUnit &pu, MergeCtx &mrgCtx, InterPrediction *interPred = nullptr); #if GDR_ENABLED void getAffineControlPointCand(const PredictionUnit& pu, MotionInfo mi[4], bool isAvailable[4], int verIdx[4], int8_t bcwIdx, int modelIdx, int verNum, AffineMergeCtx& affMrgCtx, bool isEncodeGdrClean, bool modelSolid[6]); diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 19e9cfe9fe0d06a4a1d7ebf81bb3f831a1428ea9..4b8236ad84eb2042a3d075bd23304afd90a02973 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -739,7 +739,6 @@ void DecLib::executeLoopFilters() m_pcPic->cs->slice->stopProcessingTimer(); } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void DecLib::applyNnPostFilter() { if(m_cListPic.empty()) @@ -748,7 +747,6 @@ void DecLib::applyNnPostFilter() } m_nnPostFiltering.filterPictures(m_cListPic); } -#endif void DecLib::finishPictureLight(int& poc, PicList*& rpcListPic ) { diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index f156339b972a3d13ab716a79729427bb7b3b828c..44d0c43a14e4613c005555dcf88847759088faee 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -54,9 +54,7 @@ #include "CommonLib/SEI.h" #include "CommonLib/Unit.h" #include "CommonLib/Reshape.h" -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING #include "CommonLib/SEINeuralNetworkPostFiltering.h" -#endif class InputNALUnit; @@ -231,9 +229,7 @@ private: int m_lastGdrPoc; int m_lastGdrRecoveryPocCnt; #endif -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEINeuralNetworkPostFiltering m_nnPostFiltering; -#endif public: int m_targetSubPicIdx; @@ -366,9 +362,7 @@ public: void setShutterFilterFlag(bool value) { m_ShutterFilterEnable = value; } #endif -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void applyNnPostFilter(); -#endif protected: diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 88a7417aadb15f577fe55f5f50a51de500f74a92..c427ede5c2f48e511a4eab908cd4edd750ebd39d 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -222,7 +222,6 @@ void SEIReader::getSEIDecodingUnitInfoDuiIdx(InputBitstream* bs, const NalUnitTy } } -#if JVET_AC0353_NNPFC_BASE_FLAG bool SEIReader::xCheckNnpfcSeiMsg(uint32_t seiId, bool baseFlag, const std::vector<int> nnpfcValueList) { if (baseFlag) @@ -252,7 +251,6 @@ bool SEIReader::xCheckNnpfcSeiMsg(uint32_t seiId, bool baseFlag, const std::vect } return true; } -#endif bool 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) { @@ -479,14 +477,10 @@ bool SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType xParseSEINNPostFilterCharacteristics((SEINeuralNetworkPostFilterCharacteristics &) *sei, payloadSize, sps, pDecodedMessageOutputStream); -#if JVET_AC0353_NNPFC_BASE_FLAG if (xCheckNnpfcSeiMsg( ((SEINeuralNetworkPostFilterCharacteristics*)sei)->m_id, ((SEINeuralNetworkPostFilterCharacteristics*)sei)->m_baseFlag, nnpfcValues) ) { nnpfcValues.push_back(((SEINeuralNetworkPostFilterCharacteristics*)sei)->m_id); } -#else - nnpfcValues.push_back(((SEINeuralNetworkPostFilterCharacteristics*)sei)->m_id); -#endif break; case SEI::PayloadType::NEURAL_NETWORK_POST_FILTER_ACTIVATION: sei = new SEINeuralNetworkPostFilterActivation; @@ -693,14 +687,9 @@ void SEIReader::xParseSEIShutterInterval(SEIShutterIntervalInfo& sei, uint32_t p void SEIReader::xParseSEIProcessingOrder(SEIProcessingOrderInfo& sei, uint32_t payloadSize, std::ostream *decodedMessageOutputStream) { uint32_t i,b; -#if JVET_AC0058_SEI uint32_t numMaxSeiMessages, val; -#else - uint32_t NumSEIMessages, val; -#endif output_sei_message_header(sei, decodedMessageOutputStream, payloadSize); -#if JVET_AC0058_SEI //Since each entry is at least 4 bytes (2 byte "sei_payloadType" + 2 byte "sei_payloadOrder"), //the maximum number of entry is payloadSize/4 numMaxSeiMessages = payloadSize / 4; @@ -730,20 +719,6 @@ void SEIReader::xParseSEIProcessingOrder(SEIProcessingOrderInfo& sei, uint32_t p sei.m_posPayloadType.resize(i); sei.m_posProcessingOrder.resize(i); sei.m_posPrefixByte.resize(i); -#else - // Here payload is in Bytes, Since "sei_payloadType" is 2 Bytes + "sei_payloadOrder" is 1 Byte so total = 3 Bytes - // To get Number of SEI messages, just do payloadSize/3 - NumSEIMessages = payloadSize / 3; - sei.m_posPayloadType.resize(NumSEIMessages); - sei.m_posProcessingOrder.resize(NumSEIMessages); - for(i=0,b=0; b < payloadSize; i++,b+=3) - { - sei_read_code(decodedMessageOutputStream, 16, val, "sei_payloadType[i]"); - sei.m_posPayloadType[i] = val; - sei_read_code(decodedMessageOutputStream, 16, val, "sei_processingOrder[i]"); - sei.m_posProcessingOrder[i] = val; - } -#endif CHECK(i<2, "An SEI processing order SEI message shall contain at least two pairs sei_payloadType[i] and sei_processingOrder[i]"); } @@ -2784,11 +2759,9 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); uint32_t val; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE sei_read_code(pDecodedMessageOutputStream, 16, val, "nnpfc_purpose"); sei.m_purpose = val; CHECK(sei.m_purpose >= 64 && sei.m_purpose <= 65535, "Reserved nnpfc_purpose value"); -#endif sei_read_uvlc( pDecodedMessageOutputStream, val, "nnpfc_id" ); sei.m_id = val; @@ -2819,14 +2792,8 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC if (sei.m_propertyPresentFlag) { -#if JVET_AC0353_NNPFC_BASE_FLAG sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_base_flag"); sei.m_baseFlag = val; -#endif -#if !JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_purpose"); - sei.m_purpose = val; -#endif ChromaFormat chromaFormatIdc = sps->getChromaFormatIdc(); uint8_t subWidthC; @@ -2847,16 +2814,10 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC subHeightC = 1; } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_number_of_input_pictures_minus1"); sei.m_numberInputDecodedPicturesMinus1 = val; -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei.m_purpose & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0) -#else - if(sei.m_purpose == 2 || sei.m_purpose == 4) -#endif { sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_out_sub_c_flag"); sei.m_outSubCFlag = val; @@ -2875,23 +2836,10 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei.m_outSubHeightC = 1; } } -#if !JVET_AC0154 - else - { - sei.m_outSubWidthC = subWidthC; - sei.m_outSubHeightC = subHeightC; - } -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE CHECK(((subWidthC == 1) && (subHeightC == 1)) && ((sei.m_purpose & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0), "If SubWidthC is equal to 1 and SubHeightC is equal to 1, nnpfc_purpose & 0x02 shall be equal to 0"); -#else - CHECK(((subWidthC == 1) && (subHeightC == 1)) && ((sei.m_purpose == 2) || (sei.m_purpose == 4)), - "If SubWidthC is equal to 1 and SubHeightC is equal to 1, nnpfc_purpose shall not be equal to 2 or 4"); -#endif -#if JVET_AC0154 if((sei.m_purpose & NNPC_PurposeType::COLOURIZATION) != 0) { CHECK(((chromaFormatIdc != ChromaFormat::_400) || (sei.m_purpose & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0), @@ -2911,13 +2859,8 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei.m_outSubWidthC = subWidthC; sei.m_outSubHeightC = subHeightC; } -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei.m_purpose & NNPC_PurposeType::RESOLUTION_UPSAMPLING) != 0) -#else - if(sei.m_purpose == 3 || sei.m_purpose == 4) -#endif { sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_pic_width_in_luma_samples"); sei.m_picWidthInLumaSamples = val; @@ -2925,21 +2868,10 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei.m_picHeightInLumaSamples = val; } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei.m_purpose & NNPC_PurposeType::FRAME_RATE_UPSAMPLING) != 0) -#else - if(sei.m_purpose == NNPC_PurposeType::FRAME_RATE_UPSAMPLING) -#endif { -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE CHECK(sei.m_numberInputDecodedPicturesMinus1 <= 0, "If nnpfc_purpose is FRAME_RATE_UPSAMPLING, nnpfc_num_input_pics_minus1 shall be greater than 0"); sei.m_numberInterpolatedPictures.resize(sei.m_numberInputDecodedPicturesMinus1); -#else - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_number_of_input_pictures_minus2"); - sei.m_numberInputDecodedPicturesMinus2 = val; - sei.m_numberInterpolatedPictures.resize(sei.m_numberInputDecodedPicturesMinus2 + 1); -#endif -#if JVET_AC0154 bool allZeroFlag = false; for (int i = 0; i < sei.m_numberInterpolatedPictures.size(); i++) { @@ -2951,21 +2883,12 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC } } CHECK(!allZeroFlag, "At least one value of nnpfc_interpolated_pics[i] shall be greater than 0"); -#else - for (int i = 0; i < sei.m_numberInterpolatedPictures.size(); i++) - { - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_interpolated_pictures"); - sei.m_numberInterpolatedPictures[i] = val; - } -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE for (int i = 0; i <= sei.m_numberInterpolatedPictures.size(); i++) { sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_input_pic_output_flag"); sei.m_inputPicOutputFlag[i] = val; } -#endif } sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_component_last_flag"); @@ -2976,15 +2899,10 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC if (sei.m_inpFormatIdc == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_inp_tensor_bitdepth_luma_minus8"); sei.m_inpTensorBitDepthLumaMinus8 = val; sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_inp_tensor_bitdepth_chroma_minus8"); sei.m_inpTensorBitDepthChromaMinus8 = val; -#else - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_inp_tensor_bitdepth_minus8"); - sei.m_inpTensorBitDepthMinus8 = val; -#endif } sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_inp_order_idc"); sei.m_inpOrderIdc = val; @@ -3008,35 +2926,23 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC if (sei.m_outFormatIdc == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_out_tensor_bitdepth_luma_minus8"); sei.m_outTensorBitDepthLumaMinus8 = val; sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_out_tensor_bitdepth_chroma_minus8"); sei.m_outTensorBitDepthChromaMinus8 = val; -#else - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_out_tensor_bitdepth_minus8"); - sei.m_outTensorBitDepthMinus8 = val; -#endif } sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_out_order_idc"); sei.m_outOrderIdc = val; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE CHECK(((sei.m_purpose & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0) && (sei.m_outOrderIdc == 3), "When nnpfc_purpose & 0x02 is not equal to 0, nnpfc_out_order_idc shall not be equal to 3.") -#endif -#if JVET_AC0344_NNPFC_PATCH sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_overlap"); sei.m_overlap = val; -#endif -#if JVET_AC0344_NNPFC_PATCH if (sei.m_constantPatchSizeFlag) { -#endif sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_constant_patch_size_flag"); sei.m_constantPatchSizeFlag = val; -#if JVET_AC0344_NNPFC_PATCH } else { @@ -3046,10 +2952,6 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_extended_patch_height_cd_delta_minus1"); sei.m_extendedPatchHeightCdDeltaMinus1 = val; } -#else - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_overlap"); - sei.m_overlap = val; -#endif sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_patch_width_minus1"); sei.m_patchWidthMinus1 = val; @@ -3107,10 +3009,8 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC } int payloadBytesRemaining = getBitstream()->getNumBitsLeft() / 8; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING sei.m_payloadLength = payloadBytesRemaining; sei.m_payloadByte = new char[sei.m_payloadLength]; -#endif int code; std::string filename = "payloadByte" + std::to_string(sei.m_id) + ".nnr"; @@ -3120,9 +3020,7 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC for (int i = 0; i < payloadBytesRemaining; i++) { sei_read_scode ( pDecodedMessageOutputStream, 8, code, "nnpfc_payload_byte[i]"); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING sei.m_payloadByte[i] = (char)code; -#endif outFile.write((char*)&code, 1); } outFile.close(); @@ -3134,15 +3032,9 @@ void SEIReader::xParseSEINNPostFilterActivation(SEINeuralNetworkPostFilterActiva output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); uint32_t val; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING sei_read_uvlc( pDecodedMessageOutputStream, val, "nnpfa_target_id" ); sei.m_targetId =val; CHECK((sei.m_targetId >= 256 && sei.m_targetId <= 511) || (sei.m_targetId >= (1<<31) && sei.m_targetId <= MAX_NNPFA_ID), "Reserved nnpfa_target_id value, shall ignore the SEI message"); -#else - sei_read_uvlc( pDecodedMessageOutputStream, val, "nnpfa_id" ); - sei.m_id =val; - CHECK((sei.m_id >= 256 && sei.m_id <= 511) || (sei.m_id >= (1<<31) && sei.m_id <= MAX_NNPFA_ID), "Reserved nnpfa_id value, shall ignore the SEI message"); -#endif sei_read_flag( pDecodedMessageOutputStream, val, "nnpfa_cancel_flag" ); sei.m_cancelFlag = val; diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index c700b59ef4c79ce200abaef4ea7779ecee19f6f1..e98f96b54bdcdff44bd59770c18669957a0c5248 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -63,9 +63,7 @@ public: std::vector<int> nnpfcValues; protected: -#if JVET_AC0353_NNPFC_BASE_FLAG bool xCheckNnpfcSeiMsg (uint32_t seiId, bool baseFlag, const std::vector<int> nnpfcValueList); -#endif bool 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); void xParseSEIFillerPayload (SEIFillerPayload &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index ecfdfeea11b81af5370df2fe324cdea1e7de2e35..ece6e4a32adaf845e86c603a995cbfe9d480297b 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -402,14 +402,12 @@ protected: bool m_encDbOpt; bool m_useFastLCTU; bool m_useFastMrg; -#if JVET_AC0139_UNIFIED_MERGE int m_maxMergeRdCandNumTotal; int m_mergeRdCandQuotaRegular; int m_mergeRdCandQuotaRegularSmallBlk; int m_mergeRdCandQuotaSubBlk; int m_mergeRdCandQuotaCiip; int m_mergeRdCandQuotaGpm; -#endif bool m_usePbIntraFast; bool m_useAMaxBT; bool m_e0023FastEnc; @@ -694,25 +692,16 @@ protected: uint32_t m_nnPostFilterSEICharacteristicsId[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsModeIdc[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEICharacteristicsPropertyPresentFlag[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0353_NNPFC_BASE_FLAG bool m_nnPostFilterSEICharacteristicsBaseFlag[MAX_NUM_NN_POST_FILTERS]; -#endif uint32_t m_nnPostFilterSEICharacteristicsPurpose[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEICharacteristicsOutSubCFlag[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0154 ChromaFormat m_nnPostFilterSEICharacteristicsOutColourFormatIdc[MAX_NUM_NN_POST_FILTERS]; -#endif uint32_t m_nnPostFilterSEICharacteristicsPicWidthInLumaSamples[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPicHeightInLumaSamples[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0061_TENSOR_BITDEPTH uint32_t m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[MAX_NUM_NN_POST_FILTERS]; -#else - uint32_t m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[MAX_NUM_NN_POST_FILTERS]; - uint32_t m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[MAX_NUM_NN_POST_FILTERS]; -#endif bool m_nnPostFilterSEICharacteristicsComponentLastFlag[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsInpFormatIdc[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsAuxInpIdc[MAX_NUM_NN_POST_FILTERS]; @@ -726,10 +715,8 @@ protected: bool m_nnPostFilterSEICharacteristicsConstantPatchSizeFlag[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPatchWidthMinus1[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPatchHeightMinus1[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0344_NNPFC_PATCH uint32_t m_nnPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1[MAX_NUM_NN_POST_FILTERS]; -#endif uint32_t m_nnPostFilterSEICharacteristicsOverlap[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsPaddingType[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsLumaPadding[MAX_NUM_NN_POST_FILTERS]; @@ -744,22 +731,12 @@ protected: uint32_t m_nnPostFilterSEICharacteristicsNumParametersIdc[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsNumKmacOperationsIdc[MAX_NUM_NN_POST_FILTERS]; uint32_t m_nnPostFilterSEICharacteristicsTotalKilobyteSize[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE uint32_t m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[MAX_NUM_NN_POST_FILTERS]; -#else - uint32_t m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[MAX_NUM_NN_POST_FILTERS]; -#endif std::vector<uint32_t> m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[MAX_NUM_NN_POST_FILTERS]; -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE std::vector<bool> m_nnPostFilterSEICharacteristicsInputPicOutputFlag[MAX_NUM_NN_POST_FILTERS]; -#endif bool m_nnPostFilterSEIActivationEnabled; -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING uint32_t m_nnPostFilterSEIActivationTargetId; -#else - uint32_t m_nnPostFilterSEIActivationId; -#endif bool m_nnPostFilterSEIActivationCancelFlag; bool m_nnPostFilterSEIActivationPersistenceFlag; @@ -891,12 +868,8 @@ protected: bool m_poSEIEnabled; std::vector<uint16_t> m_poSEIPayloadType; std::vector<uint16_t> m_poSEIProcessingOrder; -#if JVET_AC0058_SEI //std::vector<uint16_t> m_poSEINumofPrefixByte; std::vector<std::vector<uint8_t>> m_poSEIPrefixByte; -#else - uint32_t m_numofSEIMessages; -#endif bool m_postFilterHintSEIEnabled; bool m_postFilterHintSEICancelFlag; bool m_postFilterHintSEIPersistenceFlag; @@ -1046,7 +1019,6 @@ protected: int m_qpOffsetChromaRPR; int m_qpOffsetChromaRPR2; int m_qpOffsetChromaRPR3; -#if JVET_AC0096 int m_rprSwitchingResolutionOrderList[MAX_RPR_SWITCHING_ORDER_LIST_SIZE]; int m_rprSwitchingQPOffsetOrderList[MAX_RPR_SWITCHING_ORDER_LIST_SIZE]; int m_rprSwitchingListSize; @@ -1054,7 +1026,6 @@ protected: bool m_rprPopulatePPSatIntraFlag; int m_rprSwitchingSegmentSize; double m_rprSwitchingTime; -#endif bool m_rprEnabledFlag; bool m_resChangeInClvsEnabled; int m_switchPocPeriod; @@ -1561,7 +1532,6 @@ public: bool getUseFastLCTU () const { return m_useFastLCTU; } void setUseFastMerge ( bool n ) { m_useFastMrg = n; } bool getUseFastMerge () const { return m_useFastMrg; } -#if JVET_AC0139_UNIFIED_MERGE void setMaxMergeRdCandNumTotal ( int n ) { m_maxMergeRdCandNumTotal = n;} int getMaxMergeRdCandNumTotal () const { return m_maxMergeRdCandNumTotal;} void setMergeRdCandQuotaRegular ( int n ) { m_mergeRdCandQuotaRegular = n;} @@ -1574,7 +1544,6 @@ public: int getMergeRdCandQuotaCiip () const { return m_mergeRdCandQuotaCiip;} void setMergeRdCandQuotaGpm ( int n ) { m_mergeRdCandQuotaGpm = n;} int getMergeRdCandQuotaGpm () const { return m_mergeRdCandQuotaGpm;} -#endif void setUsePbIntraFast ( bool n ) { m_usePbIntraFast = n; } bool getUsePbIntraFast () const { return m_usePbIntraFast; } void setUseAMaxBT ( bool n ) { m_useAMaxBT = n; } @@ -1924,24 +1893,19 @@ public: uint32_t getNNPostFilterSEICharacteristicsModeIdc(int filterIdx) const { return m_nnPostFilterSEICharacteristicsModeIdc[filterIdx]; } void setNNPostFilterSEICharacteristicsPropertyPresentFlag(bool propertyPresentFlag, int filterIdx) { m_nnPostFilterSEICharacteristicsPropertyPresentFlag[filterIdx] = propertyPresentFlag; } bool getNNPostFilterSEICharacteristicsPropertyPresentFlag(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPropertyPresentFlag[filterIdx]; } -#if JVET_AC0353_NNPFC_BASE_FLAG void setNNPostFilterSEICharacteristicsBaseFlag(bool baseFlag, int filterIdx) { m_nnPostFilterSEICharacteristicsBaseFlag[filterIdx] = baseFlag; } bool getNNPostFilterSEICharacteristicsBaseFlag(int filterIdx) const { return m_nnPostFilterSEICharacteristicsBaseFlag[filterIdx]; } -#endif void setNNPostFilterSEICharacteristicsPurpose(uint32_t purpose, int filterIdx) { m_nnPostFilterSEICharacteristicsPurpose[filterIdx] = purpose; } uint32_t getNNPostFilterSEICharacteristicsPurpose(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPurpose[filterIdx]; } void setNNPostFilterSEICharacteristicsOutSubCFlag(bool SubCFlag, int filterIdx) { m_nnPostFilterSEICharacteristicsOutSubCFlag[filterIdx] = SubCFlag; } bool getNNPostFilterSEICharacteristicsOutSubCFlag(int filterIdx) const { return m_nnPostFilterSEICharacteristicsOutSubCFlag[filterIdx]; } -#if JVET_AC0154 void setNNPostFilterSEICharacteristicsOutColourFormatIdc(ChromaFormat outColourFormatIdc, int filterIdx) { m_nnPostFilterSEICharacteristicsOutColourFormatIdc[filterIdx] = outColourFormatIdc; } ChromaFormat getNNPostFilterSEICharacteristicsOutColourFormatIdc(int filterIdx) const { return m_nnPostFilterSEICharacteristicsOutColourFormatIdc[filterIdx]; } -#endif void setNNPostFilterSEICharacteristicsPicWidthInLumaSamples(uint32_t picWidthInLumaSamples, int filterIdx) { m_nnPostFilterSEICharacteristicsPicWidthInLumaSamples[filterIdx] = picWidthInLumaSamples; } uint32_t getNNPostFilterSEICharacteristicsPicWidthInLumaSamples(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPicWidthInLumaSamples[filterIdx]; } void setNNPostFilterSEICharacteristicsPicHeightInLumaSamples(uint32_t picHeightInLumaSamples, int filterIdx) { m_nnPostFilterSEICharacteristicsPicHeightInLumaSamples[filterIdx] = picHeightInLumaSamples; } uint32_t getNNPostFilterSEICharacteristicsPicHeightInLumaSamples(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPicHeightInLumaSamples[filterIdx]; } -#if JVET_AC0061_TENSOR_BITDEPTH void setNNPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8(uint32_t inpTensorBitDepthLumaMinus8, int filterIdx) { m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[filterIdx] = inpTensorBitDepthLumaMinus8; } uint32_t getNNPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8(int filterIdx) const { return m_nnPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8[filterIdx]; } void setNNPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8(uint32_t inpTensorBitDepthChromaMinus8, int filterIdx) { m_nnPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8[filterIdx] = inpTensorBitDepthChromaMinus8; } @@ -1950,12 +1914,6 @@ public: uint32_t getNNPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8(int filterIdx) const { return m_nnPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8[filterIdx]; } void setNNPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8(uint32_t outTensorBitDepthChromaMinus8, int filterIdx) { m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[filterIdx] = outTensorBitDepthChromaMinus8; } uint32_t getNNPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8(int filterIdx) const { return m_nnPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8[filterIdx]; } -#else - void setNNPostFilterSEICharacteristicsInpTensorBitDepthMinus8(uint32_t inpTensorBitDepthMinus8, int filterIdx) { m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[filterIdx] = inpTensorBitDepthMinus8; } - uint32_t getNNPostFilterSEICharacteristicsInpTensorBitDepthMinus8(int filterIdx) const { return m_nnPostFilterSEICharacteristicsInpTensorBitDepthMinus8[filterIdx]; } - void setNNPostFilterSEICharacteristicsOutTensorBitDepthMinus8(uint32_t outTensorBitDepthMinus8, int filterIdx) { m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[filterIdx] = outTensorBitDepthMinus8; } - uint32_t getNNPostFilterSEICharacteristicsOutTensorBitDepthMinus8(int filterIdx) const { return m_nnPostFilterSEICharacteristicsOutTensorBitDepthMinus8[filterIdx]; } -#endif void setNNPostFilterSEICharacteristicsAuxInpIdc(uint32_t auxInpIdc, int filterIdx) { m_nnPostFilterSEICharacteristicsAuxInpIdc[filterIdx] = auxInpIdc; @@ -1993,12 +1951,10 @@ public: void setNNPostFilterSEICharacteristicsPatchWidthMinus1(uint32_t patchWidthMinus1, int filterIdx) { m_nnPostFilterSEICharacteristicsPatchWidthMinus1[filterIdx] = patchWidthMinus1; } uint32_t getNNPostFilterSEICharacteristicsPatchWidthMinus1(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPatchWidthMinus1[filterIdx]; } void setNNPostFilterSEICharacteristicsPatchHeightMinus1(uint32_t patchHeightMinus1, int filterIdx) { m_nnPostFilterSEICharacteristicsPatchHeightMinus1[filterIdx] = patchHeightMinus1; } -#if JVET_AC0344_NNPFC_PATCH void setNNPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1(uint32_t extendedPatchWidthCdDeltaMinus1, int filterIdx) { m_nnPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1[filterIdx] = extendedPatchWidthCdDeltaMinus1; } uint32_t getNNPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1(int filterIdx) const { return m_nnPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1[filterIdx]; } void setNNPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1(uint32_t extendedPatchHeightCdDeltaMinus1, int filterIdx) { m_nnPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1[filterIdx] = extendedPatchHeightCdDeltaMinus1; } uint32_t getNNPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1(int filterIdx) const { return m_nnPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1[filterIdx]; } -#endif uint32_t getNNPostFilterSEICharacteristicsPatchHeightMinus1(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPatchHeightMinus1[filterIdx]; } void setNNPostFilterSEICharacteristicsOverlap(uint32_t overlap, int filterIdx) { m_nnPostFilterSEICharacteristicsOverlap[filterIdx] = overlap; } uint32_t getNNPostFilterSEICharacteristicsOverlap(int filterIdx) const { return m_nnPostFilterSEICharacteristicsOverlap[filterIdx]; } @@ -2031,28 +1987,16 @@ public: void setNNPostFilterSEICharacteristicsPayloadFilename(std::string payloadFilename, int filterIdx) { m_nnPostFilterSEICharacteristicsPayloadFilename[filterIdx] = payloadFilename; } std::string getNNPostFilterSEICharacteristicsPayloadFilename(int filterIdx) const { return m_nnPostFilterSEICharacteristicsPayloadFilename[filterIdx]; } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE void setNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1(uint32_t value, int filterIdx) { m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[filterIdx] = value; } uint32_t getNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1(int filterIdx) const { return m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1[filterIdx]; } -#else - void setNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2(uint32_t value, int filterIdx) { m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[filterIdx] = value; } - uint32_t getNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2(int filterIdx) const { return m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[filterIdx]; } -#endif void setNNPostFilterSEICharacteristicsNumberInterpolatedPictures(std::vector<uint32_t> value, int filterIdx) { m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[filterIdx] = value; } const std::vector<uint32_t>& getNNPostFilterSEICharacteristicsNumberInterpolatedPictures(int filterIdx) { return m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[filterIdx]; } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE void setNNPostFilterSEICharacteristicsInputPicOutputFlag(std::vector<bool> value, int filterIdx) { m_nnPostFilterSEICharacteristicsInputPicOutputFlag[filterIdx] = value; } const std::vector<bool>& getNNPostFilterSEICharacteristicsInputPicOutputFlag(int filterIdx) { return m_nnPostFilterSEICharacteristicsInputPicOutputFlag[filterIdx]; } -#endif void setNnPostFilterSEIActivationEnabled(bool enabledFlag) { m_nnPostFilterSEIActivationEnabled = enabledFlag; } bool getNnPostFilterSEIActivationEnabled() const { return m_nnPostFilterSEIActivationEnabled; } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void setNnPostFilterSEIActivationTargetId(uint32_t targetId) { m_nnPostFilterSEIActivationTargetId = targetId; } uint32_t getNnPostFilterSEIActivationTargetId() const { return m_nnPostFilterSEIActivationTargetId; } -#else - void setNnPostFilterSEIActivationId(uint32_t id) { m_nnPostFilterSEIActivationId = id; } - uint32_t getNnPostFilterSEIActivationId() const { return m_nnPostFilterSEIActivationId; } -#endif void setNnPostFilterSEIActivationCancelFlag(bool cancelFlag) { m_nnPostFilterSEIActivationCancelFlag = cancelFlag; } bool getNnPostFilterSEIActivationCancelFlag() const { return m_nnPostFilterSEIActivationCancelFlag;} void setNnPostFilterSEIActivationPersistenceFlag(bool persistenceFlag) { m_nnPostFilterSEIActivationPersistenceFlag = persistenceFlag; } @@ -2552,14 +2496,9 @@ public: uint16_t getPoSEIPayloadType(uint16_t idx) const { return m_poSEIPayloadType[idx]; } void setPoSEIProcessingOrder(const std::vector<uint16_t>& b) { m_poSEIProcessingOrder = b; } uint16_t getPoSEIProcessingOrder(uint16_t idx) const { return m_poSEIProcessingOrder[idx]; } -#if JVET_AC0058_SEI uint32_t getPoSEIPayloadTypeSize() const { return (uint32_t)m_poSEIPayloadType.size(); } void setPoSEIPrefixByte(const std::vector<std::vector<uint8_t>>& b) { m_poSEIPrefixByte = b; } std::vector<uint8_t> getPoSEIPrefixByte(uint16_t idx) const { return m_poSEIPrefixByte[idx]; } -#else - uint32_t getPoSEINumofSeiMessages() const { return m_numofSEIMessages; } - void setPoSEINumofSeiMessages(uint32_t i) { m_numofSEIMessages = i; } -#endif void setPostFilterHintSEIEnabled(bool b) { m_postFilterHintSEIEnabled = b; } bool getPostFilterHintSEIEnabled() { return m_postFilterHintSEIEnabled; } void setPostFilterHintSEICancelFlag(bool b) { m_postFilterHintSEICancelFlag = b; } @@ -2850,7 +2789,6 @@ public: int getQpOffsetChromaRPR() const { return m_qpOffsetChromaRPR; } int getQpOffsetChromaRPR2() const { return m_qpOffsetChromaRPR2; } int getQpOffsetChromaRPR3() const { return m_qpOffsetChromaRPR3; } -#if JVET_AC0096 bool getRprFunctionalityTestingEnabledFlag() const { return m_rprFunctionalityTestingEnabledFlag; } void setRprFunctionalityTestingEnabledFlag(bool flag) { m_rprFunctionalityTestingEnabledFlag = flag; } bool getRprPopulatePPSatIntraFlag() const { return m_rprPopulatePPSatIntraFlag; } @@ -2877,7 +2815,6 @@ public: } return num; } -#endif void setResChangeInClvsEnabled(bool b) { m_resChangeInClvsEnabled = b; } bool isResChangeInClvsEnabled() const { return m_resChangeInClvsEnabled; } void setRefLayerMetricsEnabled(bool b) { m_refLayerMetricsEnabled = b; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 12026cbab9add9a9e19d4ecb57f85267f4dd08f8..9d2ee3127956e69985c362ed31159eb4ada8fc64 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -83,9 +83,7 @@ void EncCu::create( EncCfg* encCfg ) m_pBestCS2 = new CodingStructure** [numWidths]; m_pelUnitBufPool.initPelUnitBufPool(chromaFormat, uiMaxWidth, uiMaxHeight); -#if JVET_AC0139_UNIFIED_MERGE m_mergeItemList.init(encCfg->getMaxMergeRdCandNumTotal(), chromaFormat, uiMaxWidth, uiMaxHeight); -#endif for( unsigned w = 0; w < numWidths; w++ ) { @@ -130,12 +128,6 @@ void EncCu::create( EncCfg* encCfg ) m_modeCtrl = new EncModeCtrlMTnoRQT(); m_modeCtrl->create( *encCfg ); -#if !JVET_AC0139_UNIFIED_MERGE - for (auto &buf: m_geoWeightedBuffers) - { - buf.create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); - } -#endif m_ctxBuffer.resize(maxDepth); m_CurrCtx = 0; @@ -203,12 +195,6 @@ void EncCu::destroy() delete m_modeCtrl; m_modeCtrl = nullptr; -#if !JVET_AC0139_UNIFIED_MERGE - for (auto &buf: m_geoWeightedBuffers) - { - buf.destroy(); - } -#endif } EncCu::~EncCu() @@ -790,14 +776,6 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par splitRdCostBest[CTU_LEVEL] = bestCS->cost; tempCS->splitRdCostBest = splitRdCostBest; } -#if !JVET_AC0139_UNIFIED_MERGE - else if( currTestMode.type == ETM_AFFINE ) - { - xCheckRDCostAffineMerge2Nx2N( tempCS, bestCS, partitioner, currTestMode ); - splitRdCostBest[CTU_LEVEL] = bestCS->cost; - tempCS->splitRdCostBest = splitRdCostBest; - } -#endif #if REUSE_CU_RESULTS else if( currTestMode.type == ETM_RECO_CACHED ) { @@ -808,11 +786,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par #endif else if( currTestMode.type == ETM_MERGE_SKIP ) { -#if JVET_AC0139_UNIFIED_MERGE xCheckRDCostUnifiedMerge(tempCS, bestCS, partitioner, currTestMode); -#else - xCheckRDCostMerge2Nx2N(tempCS, bestCS, partitioner, currTestMode); -#endif CodingUnit* cu = bestCS->getCU(partitioner.chType); if (cu) { @@ -821,14 +795,6 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par splitRdCostBest[CTU_LEVEL] = bestCS->cost; tempCS->splitRdCostBest = splitRdCostBest; } -#if !JVET_AC0139_UNIFIED_MERGE - else if( currTestMode.type == ETM_MERGE_GEO ) - { - xCheckRDCostMergeGeo2Nx2N( tempCS, bestCS, partitioner, currTestMode ); - splitRdCostBest[CTU_LEVEL] = bestCS->cost; - tempCS->splitRdCostBest = splitRdCostBest; - } -#endif else if( currTestMode.type == ETM_INTRA ) { if (slice.getSPS()->getUseColorTrans() && !CS::isDualITree(*tempCS)) @@ -2019,1400 +1985,170 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep } - CodingUnit* cuFirst = cs.getCU( partitioner.chType ); - - CHECK( !cuFirst, "No CU available" ); - - bool hasResidual = false; - for( const auto &cu : cs.cus ) - { - //not include the chroma CU because chroma CU is decided based on corresponding luma QP and deltaQP is not signaled at chroma CU - if( cu->rootCbf && !isChroma( cu->chType )) - { - hasResidual = true; - break; - } - } - - int predQP = CU::predictQP(*cuFirst, cs.prevQP[partitioner.chType]); - - if( hasResidual ) - { - TempCtx ctxTemp(m_ctxPool); - if (!bKeepCtx) - { - ctxTemp = SubCtx(Ctx::DeltaQP, m_CABACEstimator->getCtx()); - } - - m_CABACEstimator->resetBits(); - m_CABACEstimator->cu_qp_delta( *cuFirst, predQP, cuFirst->qp ); - - cs.fracBits += m_CABACEstimator->getEstFracBits(); // dQP bits - cs.cost = m_pcRdCost->calcRdCost(cs.fracBits, cs.dist); - - if (!bKeepCtx) - { - m_CABACEstimator->getCtx() = SubCtx(Ctx::DeltaQP, ctxTemp); - } - - // NOTE: reset QPs for CUs without residuals up to first coded CU - for( const auto &cu : cs.cus ) - { - //not include the chroma CU because chroma CU is decided based on corresponding luma QP and deltaQP is not signaled at chroma CU - if( cu->rootCbf && !isChroma( cu->chType )) - { - break; - } - cu->qp = predQP; - } - } - else - { - // No residuals: reset CU QP to predicted value - for( const auto &cu : cs.cus ) - { - cu->qp = predQP; - } - } -} - -void EncCu::xCheckChromaQPOffset( CodingStructure& cs, Partitioner& partitioner ) -{ - // doesn't apply if CU chroma QP offset is disabled - if( !cs.slice->getUseChromaQpAdj() ) - { - return; - } - - // doesn't apply to luma CUs - if( partitioner.isSepTree(cs) && isLuma(partitioner.chType) ) - { - return; - } - - // check cost only at cQG top-level (everything below shall not be influenced by adj coding: it occurs only once) - if( !partitioner.currQgChromaEnable() ) - { - return; - } - - // check if chroma is coded or not - bool isCoded = false; - for( auto &cu : cs.cus ) - { - SizeType channelWidth = !cu->isSepTree() ? cu->lwidth() : cu->chromaSize().width; - SizeType channelHeight = !cu->isSepTree() ? cu->lheight() : cu->chromaSize().height; - - for( const TransformUnit &tu : CU::traverseTUs(*cu) ) - { - if( tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr] || channelWidth > 64 || channelHeight > 64) - { - isCoded = true; - break; - } - } - if (isCoded) - { - // estimate cost for coding cu_chroma_qp_offset - TempCtx ctxTempAdjFlag(m_ctxPool); - TempCtx ctxTempAdjIdc(m_ctxPool); - ctxTempAdjFlag = SubCtx( Ctx::ChromaQpAdjFlag, m_CABACEstimator->getCtx() ); - ctxTempAdjIdc = SubCtx( Ctx::ChromaQpAdjIdc, m_CABACEstimator->getCtx() ); - m_CABACEstimator->resetBits(); - m_CABACEstimator->cu_chroma_qp_offset( *cu ); - cs.fracBits += m_CABACEstimator->getEstFracBits(); - cs.cost = m_pcRdCost->calcRdCost(cs.fracBits, cs.dist); - m_CABACEstimator->getCtx() = SubCtx( Ctx::ChromaQpAdjFlag, ctxTempAdjFlag ); - m_CABACEstimator->getCtx() = SubCtx( Ctx::ChromaQpAdjIdc, ctxTempAdjIdc ); - break; - } - else - { - // chroma QP adj is forced to 0 for leading uncoded CUs - cu->chromaQpAdj = 0; - } - } -} - -void EncCu::xCheckRDCostHashInter( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) -{ - bool isPerfectMatch = false; - - tempCS->initStructData(encTestMode.qp); - m_pcInterSearch->resetBufferedUniMotions(); - m_pcInterSearch->setAffineModeSelected(false); - 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::addPUs(cu); - cu.mmvdSkip = false; - cu.firstPU->mmvdMergeFlag = false; - - if (m_pcInterSearch->predInterHashSearch(cu, partitioner, isPerfectMatch)) - { - double equBcwCost = MAX_DOUBLE; - - m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 0, 0, &equBcwCost); - - if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) - { - xCalDebCost( *bestCS, partitioner ); - } - } - tempCS->initStructData(encTestMode.qp); - int minSize = std::min(cu.lwidth(), cu.lheight()); - if (minSize < 64) - { - isPerfectMatch = false; - } - m_modeCtrl->setIsHashPerfectMatch(isPerfectMatch); -} - -int getDmvrMvdNum(const PredictionUnit& pu) -{ - int dx = std::max<int>(pu.lwidth() >> DMVR_SUBCU_WIDTH_LOG2, 1); - int dy = std::max<int>(pu.lheight() >> DMVR_SUBCU_HEIGHT_LOG2, 1); - return(dx * dy); -} - -#if !JVET_AC0139_UNIFIED_MERGE -void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) -{ - const Slice &slice = *tempCS->slice; - - CHECK( slice.getSliceType() == I_SLICE, "Merge modes not available for I-slices" ); - - tempCS->initStructData( encTestMode.qp ); - - MergeCtx mergeCtx; - const SPS &sps = *tempCS->sps; - -#if GDR_ENABLED - bool isEncodeGdrClean = false; - CodingStructure *cs; -#endif - if (sps.getSbTMVPEnabledFlag()) - { - Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() ); - mergeCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); - } - - Mv refinedMvdL0[MRG_MAX_NUM_CANDS][MAX_NUM_SUBCU_DMVR]; - setMergeBestSATDCost( MAX_DOUBLE ); - - PredictionUnit* pu = getPuForInterPrediction(tempCS); - PU::getInterMergeCandidates(*pu, mergeCtx, 0); - PU::getInterMMVDMergeCandidates(*pu, mergeCtx); - pu->regularMergeFlag = true; - -#if GDR_ENABLED - cs = pu->cs; - isEncodeGdrClean = cs->sps->getGDREnabledFlag() && cs->pcv->isEncoder - && ((cs->picture->gdrParam.inGdrInterval && cs->isClean(pu->Y().topRight(), ChannelType::LUMA)) - || (cs->picture->gdrParam.verBoundary == -1)); -#endif - - bool candHasNoResidual[MRG_MAX_NUM_CANDS + MmvdIdx::ADD_NUM]; - for (uint32_t ui = 0; ui < MRG_MAX_NUM_CANDS + MmvdIdx::ADD_NUM; ui++) - { - candHasNoResidual[ui] = false; - } - - bool bestIsSkip = false; - bool bestIsMMVDSkip = true; - PelUnitBufVector<MRG_MAX_NUM_CANDS+1> rdOrderedMrgPredBuf(m_pelUnitBufPool); - PelUnitBufVector<MRG_MAX_NUM_CANDS> mrgPredBufNoCiip(m_pelUnitBufPool); - PelUnitBufVector<MRG_MAX_NUM_CANDS> mrgPredBufNoMvRefine(m_pelUnitBufPool); - int insertPos; - const int numDmvrMvd = getDmvrMvdNum(*pu); - unsigned numMergeSatdCand = mergeCtx.numValidMergeCand + MmvdIdx::ADD_NUM; - - struct ModeInfo - { - uint32_t mergeCand; - bool isRegularMerge; - bool isMMVD; - bool isCIIP; - ModeInfo() : mergeCand(0), isRegularMerge(false), isMMVD(false), isCIIP(false) {} - ModeInfo(const uint32_t mergeCand, const bool isRegularMerge, const bool isMMVD, const bool isCIIP) : - mergeCand(mergeCand), isRegularMerge(isRegularMerge), isMMVD(isMMVD), isCIIP(isCIIP) {} - }; - - static_vector<ModeInfo, MRG_MAX_NUM_CANDS + MmvdIdx::ADD_NUM> rdModeList; - - const UnitArea localUnitArea(tempCS->area.chromaFormat, Area(0, 0, tempCS->area.Y().width, tempCS->area.Y().height)); - for (int i = 0; i < mergeCtx.numValidMergeCand; i++) - { - rdModeList.push_back(ModeInfo(i, true, false, false)); - rdOrderedMrgPredBuf.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - mrgPredBufNoCiip.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - mrgPredBufNoMvRefine.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - } - rdOrderedMrgPredBuf.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - PelUnitBuf*& singleMergeTempBuffer = rdOrderedMrgPredBuf.back(); - - if (tempCS->sps->getUseMMVD()) - { - const int numMmvdCand = std::min<int>(MmvdIdx::BASE_MV_NUM, mergeCtx.numValidMergeCand) * MmvdIdx::MAX_REFINE_NUM; - for (int i = 0; i < numMmvdCand; i++) - { - rdModeList.push_back(ModeInfo(i, false, true, false)); - } - } - - bool mrgTempBufSet = false; - - bool isIntrainterEnabled = sps.getUseCiip(); - if (bestCS->area.lwidth() * bestCS->area.lheight() < 64 || bestCS->area.lwidth() >= MAX_CU_SIZE || bestCS->area.lheight() >= MAX_CU_SIZE) - { - isIntrainterEnabled = false; - } - bool isTestSkipMerge[MRG_MAX_NUM_CANDS]; // record if the merge candidate has tried skip mode - for (uint32_t idx = 0; idx < MRG_MAX_NUM_CANDS; idx++) - { - isTestSkipMerge[idx] = false; - } - if( m_pcEncCfg->getUseFastMerge() || isIntrainterEnabled) - { - numMergeSatdCand = NUM_MRG_SATD_CAND; - if (isIntrainterEnabled) - { - numMergeSatdCand += 1; - } - bestIsSkip = false; - - if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) - { - if (slice.getSPS()->getIBCFlag()) - { - ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx(); - bestIsSkip = blkCache->isSkip(tempCS->area) && cuECtx.bestCU; - } - else - bestIsSkip = blkCache->isSkip( tempCS->area ); - bestIsMMVDSkip = blkCache->isMMVDSkip(tempCS->area); - } - - if (isIntrainterEnabled) // always perform low complexity check - { - bestIsSkip = false; - } - - static_vector<double, MRG_MAX_NUM_CANDS + MmvdIdx::ADD_NUM> candCostList; - - // 1. Pass: get SATD-cost for selected candidates and reduce their count - if( !bestIsSkip ) - { - rdModeList.clear(); - mrgTempBufSet = true; - const TempCtx ctxStart(m_ctxPool, m_CABACEstimator->getCtx()); - - const double sqrtLambdaForFirstPassIntra = m_pcRdCost->getMotionLambda( ) * FRAC_BITS_SCALE; - partitioner.setCUData( *pu->cu ); - - DistParam distParam; - const bool bUseHadamard = !tempCS->slice->getDisableSATDForRD(); - m_pcRdCost->setDistParam(distParam, tempCS->getOrgBuf().Y(), singleMergeTempBuffer->Y(), - sps.getBitDepth(ChannelType::LUMA), COMPONENT_Y, bUseHadamard); - - const UnitArea localUnitArea( tempCS->area.chromaFormat, Area( 0, 0, tempCS->area.Y().width, tempCS->area.Y().height) ); - for( uint32_t uiMergeCand = 0; uiMergeCand < mergeCtx.numValidMergeCand; uiMergeCand++ ) - { - mergeCtx.setMergeInfo( *pu, uiMergeCand ); - - PU::spanMotionInfo(*pu, mergeCtx); - distParam.cur = singleMergeTempBuffer->Y(); - m_pcInterSearch->motionCompensation(*pu, *singleMergeTempBuffer, REF_PIC_LIST_X, true, true, - mrgPredBufNoMvRefine[uiMergeCand], false); - mrgPredBufNoCiip[uiMergeCand]->copyFrom(*singleMergeTempBuffer); - if (mergeCtx.interDirNeighbours[uiMergeCand] == 3) - { - mergeCtx.mvFieldNeighbours[uiMergeCand][0].mv = pu->mv[0]; - mergeCtx.mvFieldNeighbours[uiMergeCand][1].mv = pu->mv[1]; - if (PU::checkDMVRCondition(*pu)) - { - std::copy_n(pu->mvdL0SubPu, numDmvrMvd, refinedMvdL0[uiMergeCand]); - } - } - - Distortion uiSad = distParam.distFunc(distParam); - m_CABACEstimator->getCtx() = ctxStart; - uint64_t fracBits = m_pcInterSearch->xCalcPuMeBits(*pu); - double cost = (double)uiSad + (double)fracBits * sqrtLambdaForFirstPassIntra; - insertPos = -1; - -#if GDR_ENABLED - // Non-RD cost for regular merge - if (isEncodeGdrClean) - { - bool isSolid = true; - bool isValid = true; - - for (const auto l: { REF_PIC_LIST_0, REF_PIC_LIST_1 }) - { - const int refIdx = mergeCtx.mvFieldNeighbours[uiMergeCand][l].refIdx; - - if (refIdx >= 0) - { - Mv mv = mergeCtx.mvFieldNeighbours[uiMergeCand][l].mv; - - mergeCtx.mvValid[uiMergeCand][l] = cs->isClean(pu->Y().bottomRight(), mv, l, refIdx); - - isSolid &= mergeCtx.mvSolid[uiMergeCand][l]; - isValid &= mergeCtx.mvValid[uiMergeCand][l]; - } - } - - if (!isValid || !isSolid) - { - cost = MAX_DOUBLE; - } - } -#endif - updateCandList(ModeInfo(uiMergeCand, true, false, false), cost, rdModeList, candCostList, numMergeSatdCand, - &insertPos); - if (insertPos != -1) - { - if (insertPos == rdModeList.size() - 1) - { - std::swap(singleMergeTempBuffer, rdOrderedMrgPredBuf[insertPos]); - } - else - { - for (uint32_t i = uint32_t(rdModeList.size()) - 1; i > insertPos; i--) - { - std::swap(rdOrderedMrgPredBuf[i - 1], rdOrderedMrgPredBuf[i]); - } - std::swap(singleMergeTempBuffer, rdOrderedMrgPredBuf[insertPos]); - } - } -#if !GDR_ENABLED - CHECK(std::min(uiMergeCand + 1, numMergeSatdCand) != rdModeList.size(), ""); -#endif - } - - if (isIntrainterEnabled) - { - // prepare for Intra bits calculation - pu->ciipFlag = true; - - // save the to-be-tested merge candidates - uint32_t CiipMergeCand[NUM_MRG_SATD_CAND]; - for (uint32_t mergeCnt = 0; mergeCnt < std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand); mergeCnt++) - { - CiipMergeCand[mergeCnt] = rdModeList[mergeCnt].mergeCand; - } - for (uint32_t mergeCnt = 0; mergeCnt < std::min(std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand), 4); mergeCnt++) - { - uint32_t mergeCand = CiipMergeCand[mergeCnt]; - - // estimate merge bits - mergeCtx.setMergeInfo(*pu, mergeCand); - - // first round - pu->intraDir[ChannelType::LUMA] = PLANAR_IDX; - uint32_t intraCnt = 0; - // generate intrainter Y prediction - if (mergeCnt == 0) - { - m_pcIntraSearch->initIntraPatternChType(*pu->cu, pu->Y()); - m_pcIntraSearch->predIntraAng(COMPONENT_Y, pu->cs->getPredBuf(*pu).Y(), *pu); - m_pcIntraSearch->switchBuffer(*pu, COMPONENT_Y, pu->cs->getPredBuf(*pu).Y(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); - } - pu->cs->getPredBuf(*pu).copyFrom(*mrgPredBufNoMvRefine[mergeCand]); - if (pu->cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) - { - pu->cs->getPredBuf(*pu).Y().rspSignal(m_pcReshape->getFwdLUT()); - } - m_pcIntraSearch->geneWeightedPred(pu->cs->getPredBuf(*pu).Y(), *pu, - m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); - - // calculate cost - if (pu->cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) - { - pu->cs->getPredBuf(*pu).Y().rspSignal(m_pcReshape->getInvLUT()); - } - distParam.cur = pu->cs->getPredBuf(*pu).Y(); - Distortion sadValue = distParam.distFunc(distParam); - if (pu->cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) - { - pu->cs->getPredBuf(*pu).Y().rspSignal(m_pcReshape->getFwdLUT()); - } - m_CABACEstimator->getCtx() = ctxStart; - pu->regularMergeFlag = false; - uint64_t fracBits = m_pcInterSearch->xCalcPuMeBits(*pu); - double cost = (double)sadValue + (double)fracBits * sqrtLambdaForFirstPassIntra; -#if GDR_ENABLED - // Non-RD cost for CIIP merge - if (isEncodeGdrClean) - { - bool isSolid = true; - bool isValid = true; - - for (const auto l: { REF_PIC_LIST_0, REF_PIC_LIST_1 }) - { - if (mergeCtx.mvFieldNeighbours[mergeCand][l].refIdx >= 0) - { - Mv mv = mergeCtx.mvFieldNeighbours[mergeCand][l].mv; - int refIdx = mergeCtx.mvFieldNeighbours[mergeCand][l].refIdx; - - mergeCtx.mvValid[mergeCand][l] = cs->isClean(pu->Y().bottomRight(), mv, l, refIdx); - - isSolid &= mergeCtx.mvSolid[mergeCand][l]; - isValid &= mergeCtx.mvValid[mergeCand][l]; - } - } - - if (!isValid || !isSolid) - { - cost = MAX_DOUBLE; - } - } -#endif - - insertPos = -1; - updateCandList(ModeInfo(mergeCand, false, false, true), cost, rdModeList, candCostList, numMergeSatdCand, - &insertPos); - if (insertPos != -1) - { - for (int i = int(rdModeList.size()) - 1; i > insertPos; i--) - { - std::swap(rdOrderedMrgPredBuf[i - 1], rdOrderedMrgPredBuf[i]); - } - std::swap(singleMergeTempBuffer, rdOrderedMrgPredBuf[insertPos]); - } - } - pu->ciipFlag = false; - } - if ( pu->cs->sps->getUseMMVD() ) - { - pu->cu->mmvdSkip = true; - pu->regularMergeFlag = true; - const int tempNum = (mergeCtx.numValidMergeCand > 1) ? MmvdIdx::ADD_NUM : MmvdIdx::ADD_NUM >> 1; - for (int mmvdMergeCand = 0; mmvdMergeCand < tempNum; mmvdMergeCand++) - { - MmvdIdx mmvdIdx; - mmvdIdx.val = mmvdMergeCand; - - if (mmvdIdx.pos.step >= m_pcEncCfg->getMmvdDisNum()) - { - continue; - } -#if GDR_ENABLED - if (isEncodeGdrClean) - { - pu->mvSolid[REF_PIC_LIST_0] = true; - pu->mvSolid[REF_PIC_LIST_1] = true; - - pu->mvValid[REF_PIC_LIST_0] = true; - pu->mvValid[REF_PIC_LIST_1] = true; - } -#endif - mergeCtx.setMmvdMergeCandiInfo(*pu, mmvdIdx); - - PU::spanMotionInfo(*pu, mergeCtx); - distParam.cur = singleMergeTempBuffer->Y(); - pu->mmvdEncOptMode = (mmvdIdx.pos.step > 2 ? 2 : 1); - CHECK(!pu->mmvdMergeFlag, "MMVD merge should be set"); - // Don't do chroma MC here - m_pcInterSearch->motionCompensation(*pu, *singleMergeTempBuffer, REF_PIC_LIST_X, true, false, nullptr, false); - pu->mmvdEncOptMode = 0; - Distortion uiSad = distParam.distFunc(distParam); - - m_CABACEstimator->getCtx() = ctxStart; - uint64_t fracBits = m_pcInterSearch->xCalcPuMeBits(*pu); - double cost = (double)uiSad + (double)fracBits * sqrtLambdaForFirstPassIntra; - insertPos = -1; - -#if GDR_ENABLED - if (isEncodeGdrClean) - { - bool isSolid = true; - bool isValid = true; - - if (pu->refIdx[0] >= 0) - { - isSolid = isSolid && pu->mvSolid[0]; - isValid = isValid && pu->mvValid[0]; - } - - if (pu->refIdx[1] >= 0) - { - isSolid = isSolid && pu->mvSolid[1]; - isValid = isValid && pu->mvValid[1]; - } - - if (!isSolid || !isValid) - { - cost = MAX_DOUBLE; - } - } -#endif - updateCandList(ModeInfo(mmvdMergeCand, false, true, false), cost, rdModeList, candCostList, numMergeSatdCand, - &insertPos); - if (insertPos != -1) - { - for (int i = int(rdModeList.size()) - 1; i > insertPos; i--) - { - std::swap(rdOrderedMrgPredBuf[i - 1], rdOrderedMrgPredBuf[i]); - } - std::swap(singleMergeTempBuffer, rdOrderedMrgPredBuf[insertPos]); - } - } - } - // Try to limit number of candidates using SATD-costs - numMergeSatdCand = updateRdCheckingNum(MRG_FAST_RATIO * candCostList[0], numMergeSatdCand, candCostList); - - setMergeBestSATDCost( candCostList[0] ); - - if (isIntrainterEnabled && isChromaEnabled(pu->cs->pcv->chrFormat)) - { - pu->ciipFlag = true; - for (uint32_t mergeCnt = 0; mergeCnt < numMergeSatdCand; mergeCnt++) - { - if (rdModeList[mergeCnt].isCIIP) - { - pu->intraDir[ChannelType::LUMA] = PLANAR_IDX; - pu->intraDir[ChannelType::CHROMA] = DM_CHROMA_IDX; - if (pu->chromaSize().width == 2) - { - continue; - } - uint32_t bufIdx = 0; - m_pcIntraSearch->initIntraPatternChType(*pu->cu, pu->Cb()); - m_pcIntraSearch->predIntraAng(COMPONENT_Cb, pu->cs->getPredBuf(*pu).Cb(), *pu); - m_pcIntraSearch->switchBuffer(*pu, COMPONENT_Cb, pu->cs->getPredBuf(*pu).Cb(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cb, bufIdx)); - - m_pcIntraSearch->initIntraPatternChType(*pu->cu, pu->Cr()); - m_pcIntraSearch->predIntraAng(COMPONENT_Cr, pu->cs->getPredBuf(*pu).Cr(), *pu); - m_pcIntraSearch->switchBuffer(*pu, COMPONENT_Cr, pu->cs->getPredBuf(*pu).Cr(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cr, bufIdx)); - } - } - pu->ciipFlag = false; - } - - tempCS->initStructData( encTestMode.qp ); - m_CABACEstimator->getCtx() = ctxStart; - } - else - { - if (bestIsMMVDSkip) - { - numMergeSatdCand = - mergeCtx.numValidMergeCand + ((mergeCtx.numValidMergeCand > 1) ? MmvdIdx::ADD_NUM : MmvdIdx::ADD_NUM >> 1); - } - else - { - numMergeSatdCand = mergeCtx.numValidMergeCand; - } - } - } - m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - uint32_t iteration; - uint32_t iterationBegin = 0; - iteration = 2; - for (uint32_t noResidualPass = iterationBegin; noResidualPass < iteration; ++noResidualPass) - { - for (uint32_t mrgHadIdx = 0; mrgHadIdx < numMergeSatdCand; mrgHadIdx++) - { - uint32_t uiMergeCand = rdModeList[mrgHadIdx].mergeCand; - - if (noResidualPass != 0 && rdModeList[mrgHadIdx].isCIIP) // intrainter does not support skip mode - { - if (isTestSkipMerge[uiMergeCand]) - { - continue; - } - } - - if (((noResidualPass != 0) && candHasNoResidual[mrgHadIdx]) || ((noResidualPass == 0) && bestIsSkip)) - { - continue; - } - - // first get merge candidates - pu = getPuForInterPrediction(tempCS); - partitioner.setCUData(*pu->cu); - - if (noResidualPass == 0 && rdModeList[mrgHadIdx].isCIIP) - { - pu->cu->mmvdSkip = false; - mergeCtx.setMergeInfo(*pu, uiMergeCand); - pu->ciipFlag = true; - pu->regularMergeFlag = false; - pu->intraDir[ChannelType::LUMA] = PLANAR_IDX; - CHECK(pu->intraDir[ChannelType::LUMA] < 0 || pu->intraDir[ChannelType::LUMA] > (NUM_LUMA_MODE - 1), - "out of intra mode"); - pu->intraDir[ChannelType::CHROMA] = DM_CHROMA_IDX; - } - else if (rdModeList[mrgHadIdx].isMMVD) - { - pu->cu->mmvdSkip = true; - pu->regularMergeFlag = true; - MmvdIdx mmvdIdx; - mmvdIdx.val = uiMergeCand; - mergeCtx.setMmvdMergeCandiInfo(*pu, mmvdIdx); - } - else - { - pu->cu->mmvdSkip = false; - pu->regularMergeFlag = true; - mergeCtx.setMergeInfo(*pu, uiMergeCand); - } - PU::spanMotionInfo( *pu, mergeCtx ); - - if( m_pcEncCfg->getMCTSEncConstraint() ) - { - bool isDMVR = PU::checkDMVRCondition( *pu ); - if( ( isDMVR && MCTSHelper::isRefBlockAtRestrictedTileBoundary( *pu ) ) || ( !isDMVR && !( MCTSHelper::checkMvBufferForMCTSConstraint( *pu ) ) ) ) - { - // Do not use this mode - tempCS->initStructData( encTestMode.qp ); - continue; - } - } - if( mrgTempBufSet ) - { - if (PU::checkDMVRCondition(*pu)) - { - std::copy_n(refinedMvdL0[uiMergeCand], numDmvrMvd, pu->mvdL0SubPu); - } - if (pu->ciipFlag) - { - uint32_t bufIdx = 0; - PelBuf tmpBuf = tempCS->getPredBuf(*pu).Y(); - tmpBuf.copyFrom(mrgPredBufNoMvRefine[uiMergeCand]->Y()); - if (pu->cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) - { - tmpBuf.rspSignal(m_pcReshape->getFwdLUT()); - } - m_pcIntraSearch->geneWeightedPred(tmpBuf, *pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, bufIdx)); - if (isChromaEnabled(pu->chromaFormat)) - { - if (pu->chromaSize().width > 2) - { - tmpBuf = tempCS->getPredBuf(*pu).Cb(); - tmpBuf.copyFrom(mrgPredBufNoMvRefine[uiMergeCand]->Cb()); - m_pcIntraSearch->geneWeightedPred(tmpBuf, *pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cb, bufIdx)); - tmpBuf = tempCS->getPredBuf(*pu).Cr(); - tmpBuf.copyFrom(mrgPredBufNoMvRefine[uiMergeCand]->Cr()); - m_pcIntraSearch->geneWeightedPred(tmpBuf, *pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cr, bufIdx)); - } - else - { - tmpBuf = tempCS->getPredBuf(*pu).Cb(); - tmpBuf.copyFrom(mrgPredBufNoMvRefine[uiMergeCand]->Cb()); - tmpBuf = tempCS->getPredBuf(*pu).Cr(); - tmpBuf.copyFrom(mrgPredBufNoMvRefine[uiMergeCand]->Cr()); - } - } - } - else - { - if (rdModeList[mrgHadIdx].isMMVD) - { - pu->mmvdEncOptMode = 0; - m_pcInterSearch->motionCompensatePu(*pu, REF_PIC_LIST_X, true, true); - } - else if (noResidualPass != 0 && rdModeList[mrgHadIdx].isCIIP) - { - tempCS->getPredBuf().copyFrom(*mrgPredBufNoCiip[uiMergeCand]); - } - else - { - tempCS->getPredBuf().copyFrom(*rdOrderedMrgPredBuf[mrgHadIdx]); - } - } - } - else - { - m_pcInterSearch->motionCompensatePu(*pu, REF_PIC_LIST_X, true, true); - } - if (!pu->cu->mmvdSkip && !pu->ciipFlag && noResidualPass != 0) - { - CHECK(uiMergeCand >= mergeCtx.numValidMergeCand, "out of normal merge"); - isTestSkipMerge[uiMergeCand] = true; - } - -#if GDR_ENABLED - if (isEncodeGdrClean) - { - bool isSolid = true; - bool isValid = true; - - if (pu->refIdx[0] >= 0) - { - isSolid = isSolid && pu->mvSolid[0]; - isValid = isValid && pu->mvValid[0]; - } - - if (pu->refIdx[1] >= 0) - { - isSolid = isSolid && pu->mvSolid[1]; - isValid = isValid && pu->mvValid[1]; - } - - if (isSolid && isValid) - { - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, noResidualPass, - noResidualPass == 0 ? &candHasNoResidual[mrgHadIdx] : nullptr); - } - } - else - { - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, noResidualPass, - noResidualPass == 0 ? &candHasNoResidual[mrgHadIdx] : nullptr); - } -#else - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, noResidualPass, - noResidualPass == 0 ? &candHasNoResidual[mrgHadIdx] : nullptr); -#endif - - if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip && !pu->ciipFlag) - { - bestIsSkip = !bestCS->cus.empty() && bestCS->getCU( partitioner.chType )->rootCbf == 0; - } - tempCS->initStructData( encTestMode.qp ); - } // end loop mrgHadIdx - - if (noResidualPass == 0 && m_pcEncCfg->getUseEarlySkipDetection()) - { - checkEarlySkip(bestCS, partitioner); - } - } - if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) - { - xCalDebCost( *bestCS, partitioner ); - } -} - -void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode) -{ - const Slice &slice = *tempCS->slice; - CHECK(slice.getSliceType() == I_SLICE, "Merge modes not available for I-slices"); - - tempCS->initStructData(encTestMode.qp); - - MergeCtx mergeCtx; - const SPS &sps = *tempCS->sps; - - if (sps.getSbTMVPEnabledFlag()) - { - Size bufSize = g_miScaling.scale(tempCS->area.lumaSize()); - mergeCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize); - } - - PredictionUnit* pu = getPuForInterPrediction(tempCS); - pm.setCUData(*pu->cu); - -#if GDR_ENABLED - CodingStructure &cs = *pu->cs; - const bool isEncodeGdrClean = - cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder - && ((cs.picture->gdrParam.inGdrInterval && cs.isClean(pu->Y().topRight(), ChannelType::LUMA)) - || (cs.picture->gdrParam.verBoundary == -1)); -#endif - - pu->mergeFlag = true; - pu->regularMergeFlag = false; - pu->cu->geoFlag = true; - PU::getGeoMergeCandidates(*pu, mergeCtx); - - const int bitsForPartitionIdx = floorLog2(GEO_NUM_PARTITION_MODE); - PelUnitBufVector<MRG_MAX_NUM_CANDS> geoBuffer(m_pelUnitBufPool); - PelUnitBufVector<MRG_MAX_NUM_CANDS> geoTempBuf(m_pelUnitBufPool); - DistParam distParam; - - const UnitArea localUnitArea(tempCS->area.chromaFormat, Area(0, 0, tempCS->area.Y().width, tempCS->area.Y().height)); - const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda(); - uint8_t maxNumMergeCandidates = pu->cs->sps->getMaxNumGeoCand(); - DistParam distParamWholeBlk; - // the third arguments to setDistParam is dummy and will be updated before being used - m_pcRdCost->setDistParam(distParamWholeBlk, tempCS->getOrgBuf().Y(), tempCS->getOrgBuf().Y(), - sps.getBitDepth(ChannelType::LUMA), COMPONENT_Y); - Distortion bestWholeBlkSad = MAX_UINT64; - double bestWholeBlkCost = MAX_DOUBLE; - Distortion sadWholeBlk[GEO_MAX_NUM_UNI_CANDS]; - int pocMrg[GEO_MAX_NUM_UNI_CANDS]; - Mv mergeMv[GEO_MAX_NUM_UNI_CANDS]; - bool isSkipThisCand[GEO_MAX_NUM_UNI_CANDS]; - - for (int i = 0; i < maxNumMergeCandidates; i++) - { - isSkipThisCand[i] = false; - } - for (uint8_t mergeCand = 0; mergeCand < maxNumMergeCandidates; mergeCand++) - { - geoBuffer.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - geoTempBuf.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - mergeCtx.setMergeInfo(*pu, mergeCand); - - const int listIdx = mergeCtx.mvFieldNeighbours[mergeCand][0].refIdx == -1 ? 1 : 0; - const auto refPicList = RefPicList(listIdx); - const int refIdx = mergeCtx.mvFieldNeighbours[mergeCand][listIdx].refIdx; - - pocMrg[mergeCand] = tempCS->slice->getRefPic(refPicList, refIdx)->getPOC(); - mergeMv[mergeCand] = mergeCtx.mvFieldNeighbours[mergeCand][listIdx].mv; - - for (int i = 0; i < mergeCand; i++) - { - if (pocMrg[mergeCand] == pocMrg[i] && mergeMv[mergeCand] == mergeMv[i]) - { - isSkipThisCand[mergeCand] = true; - break; - } - } - - PU::spanMotionInfo(*pu, mergeCtx); - if (m_pcEncCfg->getMCTSEncConstraint() && (!(MCTSHelper::checkMvBufferForMCTSConstraint(*pu)))) - { - tempCS->initStructData(encTestMode.qp); - return; - } - m_pcInterSearch->motionCompensation(*pu, *geoBuffer[mergeCand], REF_PIC_LIST_X); - geoTempBuf[mergeCand]->Y().copyFrom(geoBuffer[mergeCand]->Y()); - geoTempBuf[mergeCand]->Y().roundToOutputBitdepth(geoTempBuf[mergeCand]->Y(), pu->cs->slice->clpRng(COMPONENT_Y)); - distParamWholeBlk.cur = geoTempBuf[mergeCand]->Y(); - sadWholeBlk[mergeCand] = distParamWholeBlk.distFunc(distParamWholeBlk); -#if GDR_ENABLED - bool allOk = (sadWholeBlk[mergeCand] < bestWholeBlkSad); - if (isEncodeGdrClean) - { - bool isSolid = mergeCtx.mvSolid[mergeCand][listIdx]; - bool isValid = mergeCtx.mvValid[mergeCand][listIdx]; - allOk = allOk && isSolid && isValid; - } -#endif -#if GDR_ENABLED - if (allOk) -#else - if (sadWholeBlk[mergeCand] < bestWholeBlkSad) -#endif - { - bestWholeBlkSad = sadWholeBlk[mergeCand]; - int bitsCand = mergeCand + 1; - bestWholeBlkCost = (double)bestWholeBlkSad + (double)bitsCand * sqrtLambdaForFirstPass; - } - } - - bool allCandsAreSame = true; - for (uint8_t mergeCand = 1; mergeCand < maxNumMergeCandidates; mergeCand++) - { - allCandsAreSame &= isSkipThisCand[mergeCand]; - } - if (allCandsAreSame) - { - return; - } - - const int wIdx = floorLog2(pu->lwidth()) - GEO_MIN_CU_LOG2; - const int hIdx = floorLog2(pu->lheight()) - GEO_MIN_CU_LOG2; - - for (int splitDir = 0; splitDir < GEO_NUM_PARTITION_MODE; splitDir++) - { - int maskStride = 0, maskStride2 = 0; - int stepX = 1; - Pel *sadMask; - - const int angle = g_geoParams[splitDir].angleIdx; - - const int16_t *wOffset = g_weightOffset[splitDir][hIdx][wIdx]; - - if (g_angle2mirror[angle] == 2) - { - maskStride = -GEO_WEIGHT_MASK_SIZE; - maskStride2 = -(int)pu->lwidth(); - sadMask = &g_globalGeoEncSADmask[g_angle2mask[angle]] - [(GEO_WEIGHT_MASK_SIZE - 1 - wOffset[1]) * GEO_WEIGHT_MASK_SIZE + wOffset[0]]; - } - else if (g_angle2mirror[angle] == 1) - { - stepX = -1; - maskStride2 = pu->lwidth(); - maskStride = GEO_WEIGHT_MASK_SIZE; - - sadMask = &g_globalGeoEncSADmask[g_angle2mask[angle]] - [wOffset[1] * GEO_WEIGHT_MASK_SIZE + (GEO_WEIGHT_MASK_SIZE - 1 - wOffset[0])]; - } - else - { - maskStride = GEO_WEIGHT_MASK_SIZE; - maskStride2 = -(int)pu->lwidth(); - - sadMask = &g_globalGeoEncSADmask[g_angle2mask[angle]][wOffset[1] * GEO_WEIGHT_MASK_SIZE + wOffset[0]]; - } - - for (uint8_t mergeCand = 0; mergeCand < maxNumMergeCandidates; mergeCand++) - { - m_pcRdCost->setDistParam(distParam, tempCS->getOrgBuf().Y(), geoTempBuf[mergeCand]->Y().buf, - geoTempBuf[mergeCand]->Y().stride, sadMask, maskStride, stepX, maskStride2, - sps.getBitDepth(ChannelType::LUMA), COMPONENT_Y); - const Distortion sadLarge = distParam.distFunc(distParam); - const Distortion sadSmall = sadWholeBlk[mergeCand] - sadLarge; - - const int bitsCand = mergeCand + 1; - - const double cost0 = (double) sadLarge + (double) bitsCand * sqrtLambdaForFirstPass; - const double cost1 = (double) sadSmall + (double) bitsCand * sqrtLambdaForFirstPass; - - m_geoCostList.insert(splitDir, 0, mergeCand, cost0); - m_geoCostList.insert(splitDir, 1, mergeCand, cost1); - } - } - - GeoComboCostList &comboList = m_comboList; - comboList.list.clear(); - - for (int geoMotionIdx = 0; geoMotionIdx < maxNumMergeCandidates * (maxNumMergeCandidates - 1); geoMotionIdx++) - { - const MergeIdxPair mergeIdxPair = m_geoModeTest[geoMotionIdx]; - -#if GDR_ENABLED - if (isEncodeGdrClean) - { - if (!mergeCtx.mvSolid[mergeIdxPair[0]][0] || !mergeCtx.mvSolid[mergeIdxPair[0]][1] || !mergeCtx.mvSolid[mergeIdxPair[1]][0] - || !mergeCtx.mvSolid[mergeIdxPair[1]][1] || !mergeCtx.mvValid[mergeIdxPair[0]][0] || !mergeCtx.mvValid[mergeIdxPair[0]][1] - || !mergeCtx.mvValid[mergeIdxPair[1]][0] || !mergeCtx.mvValid[mergeIdxPair[1]][1]) - { - // don't insert candidate into comboList so we don't have to test for cleanliness later - continue; - } - } -#endif - - for (int splitDir = 0; splitDir < GEO_NUM_PARTITION_MODE; splitDir++) - { - double tempCost = m_geoCostList.getCost(splitDir, mergeIdxPair); - - if (tempCost > bestWholeBlkCost) - { - continue; - } - - tempCost = tempCost + (double) bitsForPartitionIdx * sqrtLambdaForFirstPass; - comboList.list.push_back(GeoMergeCombo(splitDir, mergeIdxPair, tempCost)); - } - } - if (comboList.list.empty()) - { - return; - } - comboList.sortByCost(); - - bool bestIsSkip = false; - - static_vector<uint8_t, GEO_MAX_TRY_WEIGHTED_SAD> geoRdModeList; - static_vector<double, GEO_MAX_TRY_WEIGHTED_SAD> geocandCostList; - - DistParam distParamSAD2; - const bool useHadamard = !tempCS->slice->getDisableSATDForRD(); - // the third arguments to setDistParam is dummy and will be updated before being used - m_pcRdCost->setDistParam(distParamSAD2, tempCS->getOrgBuf().Y(), tempCS->getOrgBuf().Y(), - sps.getBitDepth(ChannelType::LUMA), COMPONENT_Y, useHadamard); - - const int geoNumMrgSadCand = std::min(GEO_MAX_TRY_WEIGHTED_SAD, (int) comboList.list.size()); - int geoNumMrgSatdCand = std::min(GEO_MAX_TRY_WEIGHTED_SATD, (int) comboList.list.size()); - - for (int candidateIdx = 0; candidateIdx < geoNumMrgSadCand; candidateIdx++) - { - const int splitDir = comboList.list[candidateIdx].splitDir; - const int mergeCand0 = comboList.list[candidateIdx].mergeIdx[0]; - const int mergeCand1 = comboList.list[candidateIdx].mergeIdx[1]; - - PelUnitBuf geoBuf = m_geoWeightedBuffers[candidateIdx].getBuf(localUnitArea); - m_pcInterSearch->weightedGeoBlk(*pu, splitDir, ChannelType::LUMA, geoBuf, *geoBuffer[mergeCand0], - *geoBuffer[mergeCand1]); - distParamSAD2.cur = geoBuf.Y(); - Distortion sad = distParamSAD2.distFunc(distParamSAD2); - - int mvBits = 0; - mvBits += 1 + mergeCand0; - mvBits += 1 + mergeCand1 - (mergeCand1 < mergeCand0 ? 0 : 1); + CodingUnit* cuFirst = cs.getCU( partitioner.chType ); - const double updateCost = (double) sad + (double) (bitsForPartitionIdx + mvBits) * sqrtLambdaForFirstPass; + CHECK( !cuFirst, "No CU available" ); - comboList.list[candidateIdx].cost = updateCost; - updateCandList((uint8_t) candidateIdx, updateCost, geoRdModeList, geocandCostList, geoNumMrgSatdCand); + bool hasResidual = false; + for( const auto &cu : cs.cus ) + { + //not include the chroma CU because chroma CU is decided based on corresponding luma QP and deltaQP is not signaled at chroma CU + if( cu->rootCbf && !isChroma( cu->chType )) + { + hasResidual = true; + break; + } } - const double threshold = std::min(geocandCostList[0] * MRG_FAST_RATIO, - std::min(getMergeBestSATDCost(), getAFFBestSATDCost())); - geoNumMrgSatdCand = updateRdCheckingNum(threshold, geoNumMrgSatdCand, geocandCostList); + int predQP = CU::predictQP(*cuFirst, cs.prevQP[partitioner.chType]); - if (isChromaEnabled(pu->chromaFormat)) + if( hasResidual ) { - // Generate chroma predictions - for (int i = 0; i < geoNumMrgSatdCand; i++) + TempCtx ctxTemp(m_ctxPool); + if (!bKeepCtx) { - const int candidateIdx = geoRdModeList[i]; - const int splitDir = comboList.list[candidateIdx].splitDir; - const MergeIdxPair mergeCand = comboList.list[candidateIdx].mergeIdx; - - PelUnitBuf geoBuf = m_geoWeightedBuffers[candidateIdx].getBuf(localUnitArea); - m_pcInterSearch->weightedGeoBlk(*pu, splitDir, ChannelType::CHROMA, geoBuf, *geoBuffer[mergeCand[0]], - *geoBuffer[mergeCand[1]]); + ctxTemp = SubCtx(Ctx::DeltaQP, m_CABACEstimator->getCtx()); } - } - std::array<bool, GEO_MAX_TRY_WEIGHTED_SAD> geocandHasNoResidual; - geocandHasNoResidual.fill(false); + m_CABACEstimator->resetBits(); + m_CABACEstimator->cu_qp_delta( *cuFirst, predQP, cuFirst->qp ); - m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - tempCS->initStructData(encTestMode.qp); - uint8_t iteration = 2; - uint8_t iterationBegin = 0; + cs.fracBits += m_CABACEstimator->getEstFracBits(); // dQP bits + cs.cost = m_pcRdCost->calcRdCost(cs.fracBits, cs.dist); - for (uint8_t noResidualPass = iterationBegin; noResidualPass < iteration; ++noResidualPass) - { - for (uint8_t mrgHADIdx = 0; mrgHADIdx < geoNumMrgSatdCand; mrgHADIdx++) + if (!bKeepCtx) { - uint8_t candidateIdx = geoRdModeList[mrgHADIdx]; - if (noResidualPass != 0 ? geocandHasNoResidual[candidateIdx] : bestIsSkip) - { - continue; - } - pu = getPuForInterPrediction(tempCS); - pm.setCUData(*pu->cu); - pu->mergeFlag = true; - pu->regularMergeFlag = false; - pu->geoSplitDir = comboList.list[candidateIdx].splitDir; - pu->geoMergeIdx = comboList.list[candidateIdx].mergeIdx; - pu->mmvdMergeFlag = false; - pu->mmvdMergeIdx.val = MmvdIdx::INVALID; - pu->cu->geoFlag = true; - - PU::spanGeoMotionInfo(*pu, mergeCtx, pu->geoSplitDir, pu->geoMergeIdx); - PelUnitBuf geoBuf = m_geoWeightedBuffers[candidateIdx].getBuf(localUnitArea); - tempCS->getPredBuf().copyFrom(geoBuf); - - xEncodeInterResidual(tempCS, bestCS, pm, encTestMode, noResidualPass, - (noResidualPass == 0 ? &geocandHasNoResidual[candidateIdx] : nullptr)); - - if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip) + m_CABACEstimator->getCtx() = SubCtx(Ctx::DeltaQP, ctxTemp); + } + + // NOTE: reset QPs for CUs without residuals up to first coded CU + for( const auto &cu : cs.cus ) + { + //not include the chroma CU because chroma CU is decided based on corresponding luma QP and deltaQP is not signaled at chroma CU + if( cu->rootCbf && !isChroma( cu->chType )) { - bestIsSkip = bestCS->getCU(pm.chType)->rootCbf == 0; + break; } - tempCS->initStructData(encTestMode.qp); + cu->qp = predQP; } } - if (m_bestModeUpdated && bestCS->cost != MAX_DOUBLE) + else { - xCalDebCost(*bestCS, pm); + // No residuals: reset CU QP to predicted value + for( const auto &cu : cs.cus ) + { + cu->qp = predQP; + } } } -void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) +void EncCu::xCheckChromaQPOffset( CodingStructure& cs, Partitioner& partitioner ) { - if( m_modeCtrl->getFastDeltaQp() ) - { - return; - } - - if ( bestCS->area.lumaSize().width < 8 || bestCS->area.lumaSize().height < 8 ) + // doesn't apply if CU chroma QP offset is disabled + if( !cs.slice->getUseChromaQpAdj() ) { return; } -#if GDR_ENABLED - CodingStructure *cs; - bool isEncodeGdrClean = false; -#endif - m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - const Slice &slice = *tempCS->slice; - - CHECK( slice.getSliceType() == I_SLICE, "Affine Merge modes not available for I-slices" ); - tempCS->initStructData( encTestMode.qp ); - - AffineMergeCtx affineMergeCtx; - const SPS &sps = *tempCS->sps; - if (sps.getMaxNumAffineMergeCand() == 0) + // doesn't apply to luma CUs + if( partitioner.isSepTree(cs) && isLuma(partitioner.chType) ) { return; } - setAFFBestSATDCost(MAX_DOUBLE); - - MergeCtx mrgCtx; - if (sps.getSbTMVPEnabledFlag()) - { - Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() ); - mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); - affineMergeCtx.mrgCtx = &mrgCtx; - } - - PredictionUnit* pu = getPuForInterPrediction(tempCS); - partitioner.setCUData(*pu->cu); - pu->regularMergeFlag = false; - pu->cu->affine = true; -#if GDR_ENABLED - cs = pu->cs; - isEncodeGdrClean = cs->sps->getGDREnabledFlag() && cs->pcv->isEncoder - && ((cs->picture->gdrParam.inGdrInterval && cs->isClean(pu->Y().topRight(), ChannelType::LUMA)) - || (cs->picture->gdrParam.verBoundary == -1)); -#endif - PU::getAffineMergeCand(*pu, affineMergeCtx); - - if (affineMergeCtx.numValidMergeCand <= 0) + // check cost only at cQG top-level (everything below shall not be influenced by adj coding: it occurs only once) + if( !partitioner.currQgChromaEnable() ) { return; } - bool candHasNoResidual[AFFINE_MRG_MAX_NUM_CANDS]; - for ( uint32_t ui = 0; ui < affineMergeCtx.numValidMergeCand; ui++ ) - { - candHasNoResidual[ui] = false; - } - - bool bestIsSkip = false; - bool mrgTempBufSet = false; - uint32_t numMergeSatdCand = affineMergeCtx.numValidMergeCand; - PelUnitBufVector<AFFINE_MRG_MAX_NUM_CANDS> mrgPredBuf(m_pelUnitBufPool); - - static_vector<uint32_t, AFFINE_MRG_MAX_NUM_CANDS> rdModeList; - - for ( uint32_t i = 0; i < AFFINE_MRG_MAX_NUM_CANDS; i++ ) - { - rdModeList.push_back(i); - } - - if ( m_pcEncCfg->getUseFastMerge() ) + // check if chroma is coded or not + bool isCoded = false; + for( auto &cu : cs.cus ) { - numMergeSatdCand = std::min(NUM_AFF_MRG_SATD_CAND, affineMergeCtx.numValidMergeCand); - bestIsSkip = false; - - if ( auto blkCache = dynamic_cast<CacheBlkInfoCtrl*>(m_modeCtrl) ) - { - bestIsSkip = blkCache->isSkip( tempCS->area ); - } - - static_vector<double, AFFINE_MRG_MAX_NUM_CANDS> candCostList; + SizeType channelWidth = !cu->isSepTree() ? cu->lwidth() : cu->chromaSize().width; + SizeType channelHeight = !cu->isSepTree() ? cu->lheight() : cu->chromaSize().height; - // 1. Pass: get SATD-cost for selected candidates and reduce their count - if ( !bestIsSkip ) + for( const TransformUnit &tu : CU::traverseTUs(*cu) ) { - rdModeList.clear(); - mrgTempBufSet = true; - const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda( ); - - DistParam distParam; - const bool bUseHadamard = !tempCS->slice->getDisableSATDForRD(); - // the third arguments to setDistParam is dummy and will be updated before being used - m_pcRdCost->setDistParam(distParam, tempCS->getOrgBuf().Y(), tempCS->getOrgBuf().Y(), - sps.getBitDepth(ChannelType::LUMA), COMPONENT_Y, bUseHadamard); - - const UnitArea localUnitArea( tempCS->area.chromaFormat, Area( 0, 0, tempCS->area.Y().width, tempCS->area.Y().height ) ); - - for ( uint32_t uiMergeCand = 0; uiMergeCand < affineMergeCtx.numValidMergeCand; uiMergeCand++ ) + if( tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr] || channelWidth > 64 || channelHeight > 64) { - mrgPredBuf.push_back(m_pelUnitBufPool.getPelUnitBuf(localUnitArea)); - - // set merge information - pu->interDir = affineMergeCtx.interDirNeighbours[uiMergeCand]; - pu->mergeFlag = true; - pu->regularMergeFlag = false; - pu->mergeIdx = uiMergeCand; - pu->cu->affineType = affineMergeCtx.affineType[uiMergeCand]; - pu->cu->bcwIdx = affineMergeCtx.bcwIdx[uiMergeCand]; - - pu->mergeType = affineMergeCtx.mergeType[uiMergeCand]; - if (pu->mergeType == MergeType::SUBPU_ATMVP) - { - pu->refIdx[0] = affineMergeCtx.mvFieldNeighbours[uiMergeCand][0][0].refIdx; - pu->refIdx[1] = affineMergeCtx.mvFieldNeighbours[uiMergeCand][0][1].refIdx; - PU::spanMotionInfo( *pu, mrgCtx ); - } - else - { - PU::setAllAffineMvField(*pu, affineMergeCtx.mvFieldNeighbours[uiMergeCand], REF_PIC_LIST_0); - PU::setAllAffineMvField(*pu, affineMergeCtx.mvFieldNeighbours[uiMergeCand], REF_PIC_LIST_1); - - PU::spanMotionInfo( *pu ); - } - -#if GDR_ENABLED - if (isEncodeGdrClean) - { - Mv zero = Mv(0, 0); - const bool isValid = cs->isSubPuClean(*pu, &zero); - for (auto &c: affineMergeCtx.mvValid[uiMergeCand]) - { - c[0] = isValid; - c[1] = isValid; - } - } -#endif - distParam.cur = mrgPredBuf[uiMergeCand]->Y(); - - m_pcInterSearch->motionCompensation(*pu, *mrgPredBuf[uiMergeCand], REF_PIC_LIST_X, true, false, nullptr, false); - - Distortion uiSad = distParam.distFunc( distParam ); - uint32_t uiBitsCand = uiMergeCand + 1; - if ( uiMergeCand == tempCS->picHeader->getMaxNumAffineMergeCand() - 1 ) - { - uiBitsCand--; - } - double cost = (double)uiSad + (double)uiBitsCand * sqrtLambdaForFirstPass; -#if GDR_ENABLED - if (isEncodeGdrClean) - { - bool isSolid0 = affineMergeCtx.isSolid(uiMergeCand, REF_PIC_LIST_0); - bool isSolid1 = affineMergeCtx.isSolid(uiMergeCand, REF_PIC_LIST_1); - bool isValid0 = affineMergeCtx.isValid(uiMergeCand, REF_PIC_LIST_0); - bool isValid1 = affineMergeCtx.isValid(uiMergeCand, REF_PIC_LIST_1); - - if (!isSolid0 || !isSolid1 || !isValid0 || !isValid1) - { - cost = MAX_DOUBLE; - } - } -#endif - updateCandList(uiMergeCand, cost, rdModeList, candCostList, numMergeSatdCand); - - CHECK(std::min(uiMergeCand + 1, numMergeSatdCand) != rdModeList.size(), ""); + isCoded = true; + break; } - - // Try to limit number of candidates using SATD-costs - numMergeSatdCand = updateRdCheckingNum(MRG_FAST_RATIO * candCostList[0], numMergeSatdCand, candCostList); - - tempCS->initStructData( encTestMode.qp ); - setAFFBestSATDCost(candCostList[0]); - + } + if (isCoded) + { + // estimate cost for coding cu_chroma_qp_offset + TempCtx ctxTempAdjFlag(m_ctxPool); + TempCtx ctxTempAdjIdc(m_ctxPool); + ctxTempAdjFlag = SubCtx( Ctx::ChromaQpAdjFlag, m_CABACEstimator->getCtx() ); + ctxTempAdjIdc = SubCtx( Ctx::ChromaQpAdjIdc, m_CABACEstimator->getCtx() ); + m_CABACEstimator->resetBits(); + m_CABACEstimator->cu_chroma_qp_offset( *cu ); + cs.fracBits += m_CABACEstimator->getEstFracBits(); + cs.cost = m_pcRdCost->calcRdCost(cs.fracBits, cs.dist); + m_CABACEstimator->getCtx() = SubCtx( Ctx::ChromaQpAdjFlag, ctxTempAdjFlag ); + m_CABACEstimator->getCtx() = SubCtx( Ctx::ChromaQpAdjIdc, ctxTempAdjIdc ); + break; } else { - numMergeSatdCand = affineMergeCtx.numValidMergeCand; + // chroma QP adj is forced to 0 for leading uncoded CUs + cu->chromaQpAdj = 0; } } +} - uint32_t iteration; - uint32_t iterationBegin = 0; - iteration = 2; - for (uint32_t noResidualPass = iterationBegin; noResidualPass < iteration; ++noResidualPass) - { - for (uint32_t mrgHadIdx = 0; mrgHadIdx < numMergeSatdCand; mrgHadIdx++) - { - uint32_t uiMergeCand = rdModeList[mrgHadIdx]; - - if (((noResidualPass != 0) && candHasNoResidual[uiMergeCand]) || ((noResidualPass == 0) && bestIsSkip)) - { - continue; - } - - // first get merge candidates - pu = getPuForInterPrediction(tempCS); - partitioner.setCUData(*pu->cu); - - // set merge information - pu->mergeFlag = true; - pu->mergeIdx = uiMergeCand; - pu->interDir = affineMergeCtx.interDirNeighbours[uiMergeCand]; - pu->cu->affineType = affineMergeCtx.affineType[uiMergeCand]; - pu->cu->bcwIdx = affineMergeCtx.bcwIdx[uiMergeCand]; - pu->cu->affine = true; - pu->mergeType = affineMergeCtx.mergeType[uiMergeCand]; - if (pu->mergeType == MergeType::SUBPU_ATMVP) - { - pu->refIdx[0] = affineMergeCtx.mvFieldNeighbours[uiMergeCand][0][0].refIdx; - pu->refIdx[1] = affineMergeCtx.mvFieldNeighbours[uiMergeCand][0][1].refIdx; - PU::spanMotionInfo( *pu, mrgCtx ); - } - else - { - PU::setAllAffineMvField(*pu, affineMergeCtx.mvFieldNeighbours[uiMergeCand], REF_PIC_LIST_0); - PU::setAllAffineMvField(*pu, affineMergeCtx.mvFieldNeighbours[uiMergeCand], REF_PIC_LIST_1); - - PU::spanMotionInfo( *pu ); - } +void EncCu::xCheckRDCostHashInter( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) +{ + bool isPerfectMatch = false; - if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( *pu ) ) ) ) - { - // Do not use this mode - tempCS->initStructData( encTestMode.qp ); - return; - } - if ( mrgTempBufSet ) - { - tempCS->getPredBuf().copyFrom(*mrgPredBuf[uiMergeCand], true, false); // Copy Luma Only - m_pcInterSearch->motionCompensatePu(*pu, REF_PIC_LIST_X, false, true); - } - else - { - m_pcInterSearch->motionCompensatePu(*pu, REF_PIC_LIST_X, true, true); - } + tempCS->initStructData(encTestMode.qp); + m_pcInterSearch->resetBufferedUniMotions(); + m_pcInterSearch->setAffineModeSelected(false); + CodingUnit &cu = tempCS->addCU(tempCS->area, partitioner.chType); -#if GDR_ENABLED - if (isEncodeGdrClean) - { - if (bestIsSkip) - { - Mv zero = Mv(0, 0); - const bool isValid = cs->isSubPuClean(*pu, &zero); - for (auto &c: affineMergeCtx.mvValid[uiMergeCand]) - { - c[0] = isValid; - c[1] = isValid; - } - } + 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::addPUs(cu); + cu.mmvdSkip = false; + cu.firstPU->mmvdMergeFlag = false; - const bool isSolid0 = affineMergeCtx.isSolid(uiMergeCand, REF_PIC_LIST_0); - const bool isSolid1 = affineMergeCtx.isSolid(uiMergeCand, REF_PIC_LIST_1); - const bool isValid0 = affineMergeCtx.isValid(uiMergeCand, REF_PIC_LIST_0); - const bool isValid1 = affineMergeCtx.isValid(uiMergeCand, REF_PIC_LIST_1); + if (m_pcInterSearch->predInterHashSearch(cu, partitioner, isPerfectMatch)) + { + double equBcwCost = MAX_DOUBLE; - if (isSolid0 && isSolid1 && isValid0 && isValid1) - { - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, noResidualPass, - (noResidualPass == 0 ? &candHasNoResidual[uiMergeCand] : nullptr)); - } - } - else - { - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, noResidualPass, - (noResidualPass == 0 ? &candHasNoResidual[uiMergeCand] : nullptr)); - } -#else - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, noResidualPass, - (noResidualPass == 0 ? &candHasNoResidual[uiMergeCand] : nullptr)); -#endif + m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - if ( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) - { -#if GDR_ENABLED - if (bestCS->getCU(partitioner.chType)) - { - bestIsSkip = bestCS->getCU(partitioner.chType)->rootCbf == 0; - } - else - { - bestIsSkip = false; - } -#else - bestIsSkip = bestCS->getCU(partitioner.chType)->rootCbf == 0; -#endif - } - tempCS->initStructData( encTestMode.qp ); - } // end loop mrgHadIdx + xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 0, 0, &equBcwCost); - if (noResidualPass == 0 && m_pcEncCfg->getUseEarlySkipDetection()) + if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { - checkEarlySkip(bestCS, partitioner); + xCalDebCost( *bestCS, partitioner ); } } - if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) + tempCS->initStructData(encTestMode.qp); + int minSize = std::min(cu.lwidth(), cu.lheight()); + if (minSize < 64) { - xCalDebCost( *bestCS, partitioner ); + isPerfectMatch = false; } + m_modeCtrl->setIsHashPerfectMatch(isPerfectMatch); +} + +int getDmvrMvdNum(const PredictionUnit& pu) +{ + int dx = std::max<int>(pu.lwidth() >> DMVR_SUBCU_WIDTH_LOG2, 1); + int dy = std::max<int>(pu.lheight() >> DMVR_SUBCU_HEIGHT_LOG2, 1); + return(dx * dy); } -#else void EncCu::xCheckRDCostUnifiedMerge(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { const Slice &slice = *tempCS->slice; @@ -3681,7 +2417,6 @@ void EncCu::xCheckRDCostUnifiedMerge(CodingStructure *&tempCS, CodingStructure * xCalDebCost(*bestCS, partitioner); } } -#endif ////////////////////////////////////////////////////////////////////////////////////////////// // ibc merge/skip mode check @@ -4051,7 +2786,6 @@ PredictionUnit* EncCu::getPuForInterPrediction(CodingStructure* cs) return pu; } -#if JVET_AC0139_UNIFIED_MERGE void EncCu::generateMergePrediction(const UnitArea& unitArea, MergeItem* mergeItem, PredictionUnit& pu, bool luma, bool chroma, PelUnitBuf& dstBuf, bool finalRd, bool forceNoResidual, PelUnitBuf* predBuf1, PelUnitBuf* predBuf2) { @@ -4163,23 +2897,13 @@ double EncCu::calcLumaCost4MergePrediction(const TempCtx& ctxStart, const PelUni double cost = (double)dist + (double)fracBits * lambda; return cost; } -#endif -#if JVET_AC0139_UNIFIED_MERGE unsigned int EncCu::updateRdCheckingNum(double threshold, unsigned int numMergeSatdCand) -#else -template<size_t N> -unsigned int EncCu::updateRdCheckingNum(double threshold, unsigned int numMergeSatdCand, static_vector<double, N>& costList) -#endif { for (uint32_t i = 0; i < numMergeSatdCand; i++) { -#if JVET_AC0139_UNIFIED_MERGE const auto mergeItem = m_mergeItemList.getMergeItemInList(i); if (mergeItem == nullptr || mergeItem->cost > threshold) -#else - if (costList[i] > threshold) -#endif { numMergeSatdCand = i; break; @@ -4219,7 +2943,6 @@ void EncCu::checkEarlySkip(const CodingStructure* bestCS, const Partitioner &par } } -#if JVET_AC0139_UNIFIED_MERGE template <size_t N> void EncCu::addRegularCandsToPruningList(const MergeCtx& mergeCtx, const UnitArea& localUnitArea, double sqrtLambdaForFirstPassIntra, const TempCtx& ctxStart, int numDmvrMvd, Mv dmvrL0Mvd[MRG_MAX_NUM_CANDS][MAX_NUM_SUBCU_DMVR], @@ -4576,7 +3299,6 @@ bool EncCu::prepareGpmComboList(const MergeCtx& mergeCtx, const UnitArea& localU comboList.sortByCost(); return true; } -#endif void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { @@ -5784,7 +4506,6 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best } #endif -#if JVET_AC0139_UNIFIED_MERGE MergeItem::MergeItem() { @@ -6084,6 +4805,5 @@ void MergeItemList::resetList(size_t maxTrackingNum) m_list.reserve(maxTrackingNum); m_maxTrackingNum = maxTrackingNum; } -#endif //! \} diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 48a6ecd29fb384d57f2d8d3fd257e6852d366500..bad107bc973dc6d412bbf99fb8913a1188b3bed2 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -136,7 +136,6 @@ public: } }; -#if JVET_AC0139_UNIFIED_MERGE class MergeItem { private: @@ -221,7 +220,6 @@ public: size_t size() { return m_list.size(); } }; -#endif class EncCu : DecCu @@ -262,9 +260,6 @@ private: RateCtrl* m_pcRateCtrl; IbcHashMap m_ibcHashMap; EncModeCtrl *m_modeCtrl; -#if !JVET_AC0139_UNIFIED_MERGE - std::array<PelStorage, GEO_MAX_TRY_WEIGHTED_SAD> m_geoWeightedBuffers; // weighted prediction pixels -#endif FastGeoCostList m_geoCostList; double m_AFFBestSATDCost; @@ -289,9 +284,7 @@ private: double m_sbtCostSave[2]; GeoComboCostList m_comboList; -#if JVET_AC0139_UNIFIED_MERGE MergeItemList m_mergeItemList; -#endif public: /// copy parameters from encoder class @@ -344,26 +337,14 @@ protected: void xCheckChromaQPOffset ( CodingStructure& cs, Partitioner& partitioner); void xCheckRDCostHashInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if !JVET_AC0139_UNIFIED_MERGE - void xCheckRDCostAffineMerge2Nx2N - ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); -#endif void xCheckRDCostInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); bool xCheckRDCostInterAmvr(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode &encTestMode, double &bestIntPelCost); void xEncodeDontSplit ( CodingStructure &cs, Partitioner &partitioner); -#if !JVET_AC0139_UNIFIED_MERGE - void xCheckRDCostMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#endif -#if JVET_AC0139_UNIFIED_MERGE void xCheckRDCostUnifiedMerge ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#endif -#if !JVET_AC0139_UNIFIED_MERGE - void xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode); -#endif void xEncodeInterResidual(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode &encTestMode, int residualPass = 0, bool *bestHasNonResi = nullptr, double *equBcwCost = nullptr); @@ -387,7 +368,6 @@ protected: void xCheckPLT ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); PredictionUnit* getPuForInterPrediction(CodingStructure* cs); -#if JVET_AC0139_UNIFIED_MERGE unsigned int updateRdCheckingNum(double threshold, unsigned int numMergeSatdCand); void generateMergePrediction(const UnitArea& unitArea, MergeItem* mergeItem, PredictionUnit& pu, bool luma, bool chroma, @@ -412,10 +392,6 @@ protected: template<size_t N> bool prepareGpmComboList(const MergeCtx& mergeCtx, const UnitArea& localUnitArea, double sqrtLambdaForFirstPass, GeoComboCostList& comboList, PelUnitBufVector<N>& geoBuffer, PredictionUnit* pu); -#else - template<size_t N> - unsigned int updateRdCheckingNum(double threshold, unsigned int numMergeSatdCand, static_vector<double, N>& costList); -#endif void checkEarlySkip(const CodingStructure* bestCS, const Partitioner &partitioner); }; diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 975ba7da815b24d93f8c6adb8ec51261b3bd2e25..1ca8f4dffbc6267578742022058f167bdd1ffdb2 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -427,7 +427,6 @@ int EncGOP::xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool if( newPPS ) // Note this assumes that all changes to the PPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). { -#if JVET_AC0096 if (m_pcEncLib->getRprPopulatePPSatIntraFlag()) { if (slice->isIntra()) @@ -463,9 +462,6 @@ int EncGOP::xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool { actualTotalBits += xWritePPS(accessUnit, slice->getPPS(), m_pcEncLib->getLayerId()); } -#else - actualTotalBits += xWritePPS( accessUnit, slice->getPPS(), m_pcEncLib->getLayerId() ); -#endif } return actualTotalBits; @@ -2476,15 +2472,10 @@ void EncGOP::compressGOP(int pocLast, int numPicRcvd, PicList &rcListPic, std::l pcPic->allocateNewSlice(); m_pcSliceEncoder->setSliceSegmentIdx(0); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING const NalUnitType naluType = getNalUnitType(pocCurr, m_iLastIDR, isField); pcPic->setPictureType(naluType); m_pcSliceEncoder->initEncSlice(pcPic, pocLast, pocCurr, gopId, pcSlice, isField, isEncodeLtRef, m_pcEncLib->getLayerId(), naluType); -#else - m_pcSliceEncoder->initEncSlice(pcPic, pocLast, pocCurr, gopId, pcSlice, isField, isEncodeLtRef, - m_pcEncLib->getLayerId(), getNalUnitType(pocCurr, m_iLastIDR, isField)); -#endif DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "poc", pocCurr ) ) ); DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 0 ) ) ); @@ -4455,7 +4446,6 @@ void EncGOP::compressGOP(int pocLast, int numPicRcvd, PicList &rcListPic, std::l xCreateScalableNestingSEI(leadingSeiMessages, nestedSeiMessages, targetOLS, targetLayers, subpicIDs, maxSubpicIdInPic); } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEIMessages seiMessages = getSeisByType(leadingSeiMessages, SEI::PayloadType::NEURAL_NETWORK_POST_FILTER_CHARACTERISTICS); for (auto it = seiMessages.cbegin(); it != seiMessages.cend(); it++) { @@ -4473,7 +4463,6 @@ void EncGOP::compressGOP(int pocLast, int numPicRcvd, PicList &rcListPic, std::l { pcPic->SEIs.push_back(new SEIFramePacking(*(SEIFramePacking*) *it)); } -#endif xWriteLeadingSEIMessages( leadingSeiMessages, duInfoSeiMessages, accessUnit, pcSlice->getTLayer(), pcSlice->getSPS(), duData ); xWriteDuSEIMessages( duInfoSeiMessages, accessUnit, pcSlice->getTLayer(), duData ); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index f6662261137c60d49a98d4e404b81c4369c5bb15..6afc28b8e2e1a1eed82619e15d30e5b28677ae2b 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -283,11 +283,7 @@ void EncLib::init(AUWriterIf *auWriterIf) pps.setWrapAroundOffset ( 0 ); } } -#if JVET_AC0096 if (m_resChangeInClvsEnabled && ((m_gopBasedRPREnabledFlag && (m_iQP >= getGOPBasedRPRQPThreshold())) || m_rprFunctionalityTestingEnabledFlag)) -#else - if (m_resChangeInClvsEnabled && m_gopBasedRPREnabledFlag && (m_iQP >= getGOPBasedRPRQPThreshold())) -#endif { PPS& pps = *(m_ppsMap.allocatePS(ENC_PPS_ID_RPR2)); Window& inputScalingWindow = pps0.getScalingWindow(); @@ -362,11 +358,7 @@ void EncLib::init(AUWriterIf *auWriterIf) pps.setWrapAroundOffset(0); } } -#if JVET_AC0096 if (m_resChangeInClvsEnabled && ((m_gopBasedRPREnabledFlag && (m_iQP >= getGOPBasedRPRQPThreshold())) || m_rprFunctionalityTestingEnabledFlag)) -#else - if (m_resChangeInClvsEnabled && m_gopBasedRPREnabledFlag && (getBaseQP() >= getGOPBasedRPRQPThreshold())) -#endif { PPS& pps = *(m_ppsMap.allocatePS(ENC_PPS_ID_RPR3)); Window& inputScalingWindow = pps0.getScalingWindow(); @@ -760,7 +752,6 @@ bool EncLib::encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *cPicYuv } } -#if JVET_AC0096 if (m_resChangeInClvsEnabled && m_rprFunctionalityTestingEnabledFlag) { const int poc = m_pocLast + (m_compositeRefEnabled ? 2 : 1); @@ -783,12 +774,7 @@ bool EncLib::encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *cPicYuv ppsID = m_gopRprPpsId; } } -#endif -#if JVET_AC0096 if (m_resChangeInClvsEnabled && m_intraPeriod == -1 && !m_gopBasedRPREnabledFlag && !m_rprFunctionalityTestingEnabledFlag) -#else - if (m_resChangeInClvsEnabled && m_intraPeriod == -1 && !m_gopBasedRPREnabledFlag) -#endif { const int poc = m_pocLast + (m_compositeRefEnabled ? 2 : 1); @@ -1104,7 +1090,6 @@ bool EncLib::encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBu return false; } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void EncLib::applyNnPostFilter() { if(m_cListPic.empty()) @@ -1113,7 +1098,6 @@ void EncLib::applyNnPostFilter() } m_nnPostFiltering.filterPictures(m_cListPic); } -#endif // ==================================================================================================================== // Protected member functions @@ -1470,11 +1454,7 @@ void EncLib::xInitSPS( SPS& sps ) { int maxPicWidth = std::max(m_sourceWidth, (int)((double)m_sourceWidth / m_scalingRatioHor + 0.5)); int maxPicHeight = std::max(m_sourceHeight, (int)((double)m_sourceHeight / m_scalingRatioVer + 0.5)); -#if JVET_AC0096 if (m_gopBasedRPREnabledFlag || m_rprFunctionalityTestingEnabledFlag) -#else - if (m_gopBasedRPREnabledFlag) -#endif { maxPicWidth = std::max(maxPicWidth, (int)((double)m_sourceWidth / m_scalingRatioHor2 + 0.5)); maxPicHeight = std::max(maxPicHeight, (int)((double)m_sourceHeight / m_scalingRatioVer2 + 0.5)); @@ -1932,11 +1912,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) { pps.setSliceChromaQpFlag(m_chromaCbQpOffsetDualTree != 0 || m_chromaCrQpOffsetDualTree != 0 || m_chromaCbCrQpOffsetDualTree != 0); } -#if JVET_AC0096 if (m_gopBasedRPREnabledFlag || m_rprFunctionalityTestingEnabledFlag) -#else - if (m_gopBasedRPREnabledFlag) -#endif { bool isRprPPS = false; for (int nr = 0; nr < NUM_RPR_PPS; nr++) @@ -2641,14 +2617,12 @@ int EncCfg::getQPForPicture(const uint32_t gopIndex, const Slice *pSlice) const qp += EncCfg::m_qpOffsetRPR3; } } -#if JVET_AC0096 if (!m_gopBasedRPREnabledFlag && m_rprFunctionalityTestingEnabledFlag) { int currPoc = pSlice->getPOC() + m_frameSkip; int rprSegment = EncCfg::getRprSwitchingSegment(currPoc); qp += EncCfg::m_rprSwitchingQPOffsetOrderList[rprSegment]; } -#endif } qp = Clip3( -lumaQpBDOffset, MAX_QP, qp ); return qp; diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index 0558dfa560d2801d85ede10a53feb001b502b102..37e61c75abd2408b952e0a1e88bd703184110711 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -58,9 +58,7 @@ #include "EncAdaptiveLoopFilter.h" #include "RateCtrl.h" -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING #include "CommonLib/SEINeuralNetworkPostFiltering.h" -#endif class EncLibCommon; @@ -139,9 +137,7 @@ private: std::string m_GMFAFile; #endif -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING SEINeuralNetworkPostFiltering m_nnPostFiltering; -#endif public: SPS* getSPS( int spsId ) { return m_spsMap.getPS( spsId ); }; APS** getApss() { return m_apss; } @@ -252,9 +248,7 @@ public: bool encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, int &numEncoded, bool isTff); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING void applyNnPostFilter(); -#endif void printSummary(bool isField) { diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 5443c382c8d92f7de54df4a382a882d51b615646..9048542ba88677afba8c3548ee8a74317b9a5854 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1362,37 +1362,13 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add inter modes if( m_pcEncCfg->getUseEarlySkipDetection() ) { -#if !JVET_AC0139_UNIFIED_MERGE - 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 !JVET_AC0139_UNIFIED_MERGE - if (cs.sps->getUseAffine() || (cs.sps->getSbTMVPEnabledFlag() && cs.slice->getPicHeader()->getEnableTMVPFlag())) - { - m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp } ); - } -#endif m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp } ); } else { m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp } ); -#if !JVET_AC0139_UNIFIED_MERGE - 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 !JVET_AC0139_UNIFIED_MERGE - if (cs.sps->getUseAffine() || (cs.sps->getSbTMVPEnabledFlag() && cs.slice->getPicHeader()->getEnableTMVPFlag())) - { - m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp } ); - } -#endif } if (getUseHashME()) { @@ -1425,11 +1401,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ComprCUCtx& cuECtx = m_ComprCUCtxList.back(); // Fast checks, partitioning depended -#if JVET_AC0139_UNIFIED_MERGE if (cuECtx.isHashPerfectMatch && encTestmode.type != ETM_MERGE_SKIP && encTestmode.type != ETM_INTER_ME) -#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; } @@ -1654,19 +1626,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } } -#if !JVET_AC0139_UNIFIED_MERGE - if ( encTestmode.type == ETM_AFFINE && relatedCU.isIntra ) - { - return false; - } - 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() - || partitioner.currArea().lheight() >= 8 * partitioner.currArea().lwidth() ) ) - { - return false; - } -#endif return true; } else if( isModeSplit( encTestmode ) ) diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index 3aaac954b764b2bd60d411d144162f3d3e524606..c643ea12ba0a00656c326bd62093090ae3a91fb3 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -58,10 +58,6 @@ enum EncTestModeType ETM_HASH_INTER, ETM_MERGE_SKIP, ETM_INTER_ME, -#if !JVET_AC0139_UNIFIED_MERGE - ETM_AFFINE, - ETM_MERGE_GEO, -#endif ETM_INTRA, ETM_PALETTE, ETM_SPLIT_QT, @@ -173,10 +169,6 @@ inline bool isModeInter( const EncTestMode& encTestmode ) // perhaps remove { return ( encTestmode.type == ETM_INTER_ME || encTestmode.type == ETM_MERGE_SKIP -#if !JVET_AC0139_UNIFIED_MERGE - || encTestmode.type == ETM_AFFINE - || encTestmode.type == ETM_MERGE_GEO -#endif || encTestmode.type == ETM_HASH_INTER ); } @@ -499,37 +491,6 @@ void removeInterME() } } -#if !JVET_AC0139_UNIFIED_MERGE -void removeAffine() -{ - int n = (int)m_ComprCUCtxList.back().testModes.size(); - for (int j = 0; j < n; j++) - { - const EncTestMode etm = m_ComprCUCtxList.back().testModes[j]; - if (etm.type == ETM_AFFINE) - { - m_ComprCUCtxList.back().testModes.erase(m_ComprCUCtxList.back().testModes.begin() + j); - j--; - n--; - } - } -} - -void removeMergeGeo() -{ - int n = (int)m_ComprCUCtxList.back().testModes.size(); - for (int j = 0; j < n; j++) - { - const EncTestMode etm = m_ComprCUCtxList.back().testModes[j]; - if (etm.type == ETM_MERGE_GEO) - { - m_ComprCUCtxList.back().testModes.erase(m_ComprCUCtxList.back().testModes.begin() + j); - j--; - n--; - } - } -} -#endif void removeIntra() { @@ -553,15 +514,9 @@ bool anyPredModeLeft() { const EncTestMode etm = m_ComprCUCtxList.back().testModes[j]; -#if JVET_AC0139_UNIFIED_MERGE if (etm.type == ETM_HASH_INTER || etm.type == ETM_MERGE_SKIP || etm.type == ETM_INTER_ME || etm.type == ETM_INTRA || etm.type == ETM_PALETTE || etm.type == ETM_IBC || etm.type == ETM_IBC_MERGE) -#else - if (etm.type == ETM_HASH_INTER || etm.type == ETM_MERGE_SKIP || etm.type == ETM_INTER_ME || etm.type == ETM_AFFINE - || etm.type == ETM_MERGE_GEO || etm.type == ETM_INTRA || etm.type == ETM_PALETTE || etm.type == ETM_IBC - || etm.type == ETM_IBC_MERGE) -#endif { return true; } @@ -732,50 +687,6 @@ void forceQTonlyMode() } } -#if !JVET_AC0139_UNIFIED_MERGE -const char* printType(EncTestModeType type) -{ - char *ret; - - switch (type) { - case 0: ret = strdup("Hash"); break; - case 1: ret = strdup("Mkip"); break; - case 2: ret = strdup("Inter"); break; - case 3: ret = strdup("Affi"); break; - case 4: ret = strdup("Tria"); break; - case 5: ret = strdup("Intra"); break; - case 6: ret = strdup("Palet"); break; - - case 7: ret = strdup("QT"); break; - case 8: ret = strdup("BTH"); break; - case 9: ret = strdup("BTV"); break; - case 10: ret = strdup("TTH"); break; - case 11: ret = strdup("TTV"); break; - case 12: ret = strdup("|"); break; - case 13: ret = strdup("CACHE"); break; - case 14: ret = strdup("IMV"); break; - case 15: ret = strdup("IBC"); break; - case 16: ret = strdup("IBCM"); break; - default: - ret = strdup("INVALID"); - } - - return ret; -} - -void printMode() -{ - // remove all inter or split to force make intra - int n = (int)m_ComprCUCtxList.back().testModes.size(); - printf("-:["); - for (int j = 0; j < n; j++) - { - const EncTestMode etm = m_ComprCUCtxList.back().testModes[j]; - printf(" %s", printType(etm.type)); - } - printf("]\n"); -} -#endif #endif protected: diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index 1d10f304b10368604b0cb621df4c42ad73e8890e..2269b0a25a7ce0259f9ce4a099a86c3cece7a518 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -532,18 +532,13 @@ void EncSlice::initEncSlice(Picture *pcPic, const int pocLast, const int pocCurr int crQP = bUseIntraOrPeriodicOffset ? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(true) : m_pcCfg->getGOPEntry(gopId).m_CrQPoffset; // adjust chroma QP such that it corresponds to the luma QP change when encoding in reduced resolution -#if JVET_AC0096 if (m_pcCfg->getGOPBasedRPREnabledFlag() || m_pcCfg->getRprFunctionalityTestingEnabledFlag()) -#else - if (m_pcCfg->getGOPBasedRPREnabledFlag()) -#endif { auto mappedQpDelta = [&](ComponentID c, int qpOffset) -> int { const int mappedQpBefore = rpcSlice->getSPS()->getMappedChromaQpValue(c, qp - qpOffset); const int mappedQpAfter = rpcSlice->getSPS()->getMappedChromaQpValue(c, qp); return mappedQpBefore - mappedQpAfter + qpOffset; }; -#if JVET_AC0096 if (m_pcCfg->getRprFunctionalityTestingEnabledFlag()) { int currPoc = rpcSlice->getPOC() + m_pcCfg->getFrameSkip(); @@ -553,7 +548,6 @@ void EncSlice::initEncSlice(Picture *pcPic, const int pocLast, const int pocCurr } else { -#endif if (rpcSlice->getPPS()->getPPSId() == ENC_PPS_ID_RPR) // ScalingRatioHor/ScalingRatioVer { cbQP += mappedQpDelta(COMPONENT_Cb, m_pcCfg->getQpOffsetChromaRPR()); @@ -569,9 +563,7 @@ void EncSlice::initEncSlice(Picture *pcPic, const int pocLast, const int pocCurr cbQP += mappedQpDelta(COMPONENT_Cb, m_pcCfg->getQpOffsetChromaRPR3()); crQP += mappedQpDelta(COMPONENT_Cr, m_pcCfg->getQpOffsetChromaRPR3()); } -#if JVET_AC0096 } -#endif } int cbCrQP = (cbQP + crQP) >> 1; // use floor of average chroma QP offset for joint-Cb/Cr coding diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index 0fbd9ef7f6dca7efb0da6017d5db415d1485c8d9..3cf8e4631070d4be066923dd1df9dd20ef9414e7 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -612,7 +612,6 @@ void SEIEncoder::initSEIProcessingOrderInfo(SEIProcessingOrderInfo *seiProcessin assert(seiProcessingOrderInfo != nullptr); -#if JVET_AC0058_SEI seiProcessingOrderInfo->m_posEnabled = m_pcCfg->getPoSEIEnabled(); seiProcessingOrderInfo->m_posPayloadType.resize(m_pcCfg->getPoSEIPayloadTypeSize()); seiProcessingOrderInfo->m_posProcessingOrder.resize(m_pcCfg->getPoSEIPayloadTypeSize()); @@ -626,18 +625,6 @@ void SEIEncoder::initSEIProcessingOrderInfo(SEIProcessingOrderInfo *seiProcessin seiProcessingOrderInfo->m_posPrefixByte[i] = m_pcCfg->getPoSEIPrefixByte(i); } } -#else - uint32_t numSEIMessages = m_pcCfg->getPoSEINumofSeiMessages(); - seiProcessingOrderInfo->m_posNumofSeiMessages = numSEIMessages; - seiProcessingOrderInfo->m_posEnabled = m_pcCfg->getPoSEIEnabled(); - seiProcessingOrderInfo->m_posPayloadType.resize(numSEIMessages); - seiProcessingOrderInfo->m_posProcessingOrder.resize(numSEIMessages); - for (uint32_t i = 0; i < numSEIMessages; i++) - { - seiProcessingOrderInfo->m_posPayloadType[i] = m_pcCfg->getPoSEIPayloadType(i); - seiProcessingOrderInfo->m_posProcessingOrder[i] = m_pcCfg->getPoSEIProcessingOrder(i); - } -#endif } void SEIEncoder::initSEIPostFilterHint(SEIPostFilterHint *seiPostFilterHint) @@ -1312,9 +1299,7 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP { CHECK(!(m_isInitialized), "Unspecified error"); CHECK(!(sei != nullptr), "Unspecified error"); -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE sei->m_purpose = m_pcCfg->getNNPostFilterSEICharacteristicsPurpose(filterIdx); -#endif sei->m_id = m_pcCfg->getNNPostFilterSEICharacteristicsId(filterIdx); sei->m_modeIdc = m_pcCfg->getNNPostFilterSEICharacteristicsModeIdc(filterIdx); if (sei->m_modeIdc == POST_FILTER_MODE::URI) @@ -1325,39 +1310,20 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP sei->m_propertyPresentFlag = m_pcCfg->getNNPostFilterSEICharacteristicsPropertyPresentFlag(filterIdx); if (sei->m_propertyPresentFlag) { -#if JVET_AC0353_NNPFC_BASE_FLAG sei->m_baseFlag = m_pcCfg->getNNPostFilterSEICharacteristicsBaseFlag(filterIdx); -#endif -#if !JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE - sei->m_purpose = m_pcCfg->getNNPostFilterSEICharacteristicsPurpose(filterIdx); -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE sei->m_numberInputDecodedPicturesMinus1 = m_pcCfg->getNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus1(filterIdx); -#endif -#if JVET_AC0062_CONSTRAINT_CHECK CHECK(sei->m_numberInputDecodedPicturesMinus1 > 63, "m_numberInputDecodedPicturesMinus1 shall be in the range of 0 to 63"); -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei->m_purpose & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0) -#else - if(sei->m_purpose == 2 || sei->m_purpose == 4) -#endif { sei->m_outSubCFlag = m_pcCfg->getNNPostFilterSEICharacteristicsOutSubCFlag(filterIdx); } -#if JVET_AC0154 if((sei->m_purpose & NNPC_PurposeType::COLOURIZATION) != 0) { sei->m_outColourFormatIdc = m_pcCfg->getNNPostFilterSEICharacteristicsOutColourFormatIdc(filterIdx); } -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei->m_purpose & NNPC_PurposeType::RESOLUTION_UPSAMPLING) != 0) -#else - if(sei->m_purpose == 3 || sei->m_purpose == 4) -#endif { sei->m_picWidthInLumaSamples = m_pcCfg->getNNPostFilterSEICharacteristicsPicWidthInLumaSamples(filterIdx); sei->m_picHeightInLumaSamples = m_pcCfg->getNNPostFilterSEICharacteristicsPicHeightInLumaSamples(filterIdx); @@ -1392,32 +1358,19 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP CHECK(!(sei->m_picWidthInLumaSamples >= croppedWidth && sei->m_picWidthInLumaSamples <= croppedWidth * 16 - 1), "m_picWidthInLumaSamples shall be in the range of croppedWidth to croppedWidth * 16 - 1"); CHECK(!(sei->m_picHeightInLumaSamples >= croppedHeight && sei->m_picHeightInLumaSamples <= croppedHeight * 16 - 1), "m_picHeightInLumaSamples shall be in the range of croppedHeight to croppedHeight * 16 - 1"); } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei->m_purpose & NNPC_PurposeType::FRAME_RATE_UPSAMPLING) != 0) -#else - if (sei->m_purpose == NNPC_PurposeType::FRAME_RATE_UPSAMPLING) -#endif { -#if !JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE - sei->m_numberInputDecodedPicturesMinus2 = m_pcCfg->getNNPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2(filterIdx); -#endif sei->m_numberInterpolatedPictures = m_pcCfg->getNNPostFilterSEICharacteristicsNumberInterpolatedPictures(filterIdx); -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE sei->m_inputPicOutputFlag = m_pcCfg->getNNPostFilterSEICharacteristicsInputPicOutputFlag(filterIdx); CHECK(sei->m_numberInputDecodedPicturesMinus1 <= 0, "If nnpfc_purpose is FRAME_RATE_UPSAMPLING, m_numberInputDecodedPicturesMinus1 shall be greater than 0"); -#endif } sei->m_componentLastFlag = m_pcCfg->getNNPostFilterSEICharacteristicsComponentLastFlag(filterIdx); sei->m_inpFormatIdc = m_pcCfg->getNNPostFilterSEICharacteristicsInpFormatIdc(filterIdx); if (sei->m_inpFormatIdc == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH sei->m_inpTensorBitDepthLumaMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8(filterIdx); sei->m_inpTensorBitDepthChromaMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsInpTensorBitDepthChromaMinus8(filterIdx); -#else - sei->m_outTensorBitDepthMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsOutTensorBitDepthMinus8(filterIdx); -#endif } sei->m_inpOrderIdc = m_pcCfg->getNNPostFilterSEICharacteristicsInpOrderIdc(filterIdx); @@ -1433,24 +1386,18 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP sei->m_outFormatIdc = m_pcCfg->getNNPostFilterSEICharacteristicsOutFormatIdc(filterIdx); if (sei->m_outFormatIdc == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH sei->m_outTensorBitDepthLumaMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8(filterIdx); sei->m_outTensorBitDepthChromaMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsOutTensorBitDepthChromaMinus8(filterIdx); -#else - sei->m_outTensorBitDepthMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsOutTensorBitDepthMinus8(filterIdx); -#endif } sei->m_outOrderIdc = m_pcCfg->getNNPostFilterSEICharacteristicsOutOrderIdc(filterIdx); sei->m_constantPatchSizeFlag = m_pcCfg->getNNPostFilterSEICharacteristicsConstantPatchSizeFlag(filterIdx); sei->m_patchWidthMinus1 = m_pcCfg->getNNPostFilterSEICharacteristicsPatchWidthMinus1(filterIdx); sei->m_patchHeightMinus1 = m_pcCfg->getNNPostFilterSEICharacteristicsPatchHeightMinus1(filterIdx); -#if JVET_AC0344_NNPFC_PATCH if (sei->m_constantPatchSizeFlag == 0) { sei->m_extendedPatchWidthCdDeltaMinus1 = m_pcCfg->getNNPostFilterSEICharacteristicsExtendedPatchWidthCdDeltaMinus1(filterIdx); sei->m_extendedPatchHeightCdDeltaMinus1 = m_pcCfg->getNNPostFilterSEICharacteristicsExtendedPatchHeightCdDeltaMinus1(filterIdx); } -#endif sei->m_overlap = m_pcCfg->getNNPostFilterSEICharacteristicsOverlap(filterIdx); sei->m_paddingType = m_pcCfg->getNNPostFilterSEICharacteristicsPaddingType(filterIdx); sei->m_lumaPadding = m_pcCfg->getNNPostFilterSEICharacteristicsLumaPadding(filterIdx); @@ -1467,11 +1414,7 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP sei->m_totalKilobyteSize = m_pcCfg->getNNPostFilterSEICharacteristicsTotalKilobyteSize(filterIdx); } } -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING if (sei->m_modeIdc == POST_FILTER_MODE::ISO_IEC_15938_17) -#else - if (sei->m_modeIdc == 1) -#endif { const std::string payloadFilename = m_pcCfg->getNNPostFilterSEICharacteristicsPayloadFilename(filterIdx); std::ifstream bitstreamFile(payloadFilename.c_str(), std::ifstream::in | std::ifstream::binary); @@ -1494,11 +1437,7 @@ void SEIEncoder::initSEINeuralNetworkPostFilterActivation(SEINeuralNetworkPostFi { CHECK(!(m_isInitialized), "Unspecified error"); CHECK(!(sei != nullptr), "Unspecified error"); -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING sei->m_targetId = m_pcCfg->getNnPostFilterSEIActivationTargetId(); -#else - sei->m_id = m_pcCfg->getNnPostFilterSEIActivationId(); -#endif sei->m_cancelFlag = m_pcCfg->getNnPostFilterSEIActivationCancelFlag(); if(!sei->m_cancelFlag) { diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 636cec9ef03ddefcabade2270eeb908916da87f2..f75a68907baa0ee6530ac3b96a2434cfbacea04d 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -1545,7 +1545,6 @@ void SEIWriter::xWriteSEIShutterInterval(const SEIShutterIntervalInfo &sei) void SEIWriter::xWriteSEIProcessingOrder(const SEIProcessingOrderInfo &sei) { -#if JVET_AC0058_SEI CHECK(sei.m_posPayloadType.size() < 2, "An SEI processing order SEI message shall contain at least two pairs sei_payloadType[i] and sei_processingOrder[i]"); for (uint32_t i = 0; i < sei.m_posPayloadType.size(); i++) { @@ -1561,14 +1560,6 @@ void SEIWriter::xWriteSEIProcessingOrder(const SEIProcessingOrderInfo &sei) xWriteCode(sei.m_posProcessingOrder[i], 16, "po_sei_processing_order[i]"); } } -#else - CHECK(sei.m_posNumofSeiMessages < 2, "An SEI processing order SEI message shall contain at least two pairs sei_payloadType[i] and sei_processingOrder[i]"); - for (uint32_t i=0; i < sei.m_posNumofSeiMessages; i++) - { - xWriteCode(sei.m_posPayloadType[i], 16, "po_sei_payload_type[i]"); - xWriteCode(sei.m_posProcessingOrder[i], 16, "po_sei_processing_order[i]"); - } -#endif } void SEIWriter::xWriteSEIConstrainedRaslIndication(const SEIConstrainedRaslIndication& /*sei*/) @@ -1690,9 +1681,7 @@ void SEIWriter::xWriteSEIGreenMetadataInfo(const SEIGreenMetadataInfo& sei) void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralNetworkPostFilterCharacteristics &sei) { -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE xWriteCode(sei.m_purpose, 16, "nnpfc_purpose"); -#endif xWriteUvlc(sei.m_id, "nnpfc_id"); xWriteUvlc(sei.m_modeIdc, "nnpfc_mode_idc"); if (sei.m_modeIdc == POST_FILTER_MODE::URI) @@ -1707,47 +1696,25 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralN xWriteFlag(sei.m_propertyPresentFlag, "nnpfc_property_present_flag"); if (sei.m_propertyPresentFlag) { -#if JVET_AC0353_NNPFC_BASE_FLAG xWriteFlag(sei.m_baseFlag, "nnpfc_base_flag"); -#endif -#if !JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE - xWriteUvlc(sei.m_purpose, "nnpfc_purpose"); -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE xWriteUvlc(sei.m_numberInputDecodedPicturesMinus1, "nnpfc_number_of_input_pictures_minus1"); -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei.m_purpose & NNPC_PurposeType::CHROMA_UPSAMPLING) != 0) -#else - if(sei.m_purpose == 2 || sei.m_purpose == 4) -#endif { xWriteFlag(sei.m_outSubCFlag, "nnpfc_out_sub_c_flag"); } -#if JVET_AC0154 if((sei.m_purpose & NNPC_PurposeType::COLOURIZATION) != 0) { xWriteCode(uint32_t(sei.m_outColourFormatIdc), 2, "nnpfc_out_colour_format_idc"); } -#endif -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei.m_purpose & NNPC_PurposeType::RESOLUTION_UPSAMPLING) != 0) -#else - if(sei.m_purpose == 3 || sei.m_purpose == 4) -#endif { xWriteUvlc(sei.m_picWidthInLumaSamples, "nnpfc_pic_width_in_luma_samples"); xWriteUvlc(sei.m_picHeightInLumaSamples, "nnpfc_pic_height_in_luma_samples"); } -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE if((sei.m_purpose & NNPC_PurposeType::FRAME_RATE_UPSAMPLING) != 0) -#else - if (sei.m_purpose == NNPC_PurposeType::FRAME_RATE_UPSAMPLING) -#endif { -#if JVET_AC0127_BIT_MASKING_NNPFC_PURPOSE for (int i = 0; i < sei.m_numberInputDecodedPicturesMinus1; ++i) { xWriteUvlc(sei.m_numberInterpolatedPictures[i], "nnpfc_interpolated_pictures"); @@ -1756,25 +1723,14 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralN { xWriteFlag(sei.m_inputPicOutputFlag[i], "nnpfc_input_pic_output_flag"); } -#else - xWriteUvlc(sei.m_numberInputDecodedPicturesMinus2, "nnpfc_number_of_input_pictures_minus2"); - for (int i = 0; i <= sei.m_numberInputDecodedPicturesMinus2; ++i) - { - xWriteUvlc(sei.m_numberInterpolatedPictures[i], "nnpfc_interpolated_pictures"); - } -#endif } xWriteFlag(sei.m_componentLastFlag, "nnpfc_component_last_flag"); xWriteUvlc(sei.m_inpFormatIdc, "nnpfc_inp_format_idc"); if (sei.m_inpFormatIdc == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH xWriteUvlc(sei.m_inpTensorBitDepthLumaMinus8, "nnpfc_inp_tensor_bitdepth_luma_minus8"); xWriteUvlc(sei.m_inpTensorBitDepthChromaMinus8, "nnpfc_inp_tensor_bitdepth_chroma_minus8"); -#else - xWriteUvlc(sei.m_inpTensorBitDepthMinus8, "nnpfc_inp_tensor_bitdepth_minus8"); -#endif } xWriteUvlc(sei.m_inpOrderIdc, "nnpfc_inp_order_idc"); xWriteUvlc(sei.m_auxInpIdc, "nnpfc_aux_inp_idc"); @@ -1789,35 +1745,23 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralN xWriteUvlc(sei.m_outFormatIdc, "nnpfc_out_format_idc"); if (sei.m_outFormatIdc == 1) { -#if JVET_AC0061_TENSOR_BITDEPTH xWriteUvlc(sei.m_outTensorBitDepthLumaMinus8, "nnpfc_out_tensor_bitdepth_luma_minus8"); xWriteUvlc(sei.m_outTensorBitDepthChromaMinus8, "nnpfc_out_tensor_bitdepth_chroma_minus8"); -#else - xWriteUvlc(sei.m_outTensorBitDepthMinus8, "nnpfc_out_tensor_bitdepth_minus8"); -#endif } xWriteUvlc(sei.m_outOrderIdc, "nnpfc_out_order_idc"); -#if JVET_AC0344_NNPFC_PATCH xWriteUvlc(sei.m_overlap, "nnpfc_overlap"); -#endif xWriteFlag(sei.m_constantPatchSizeFlag, "nnpfc_constant_patch_size_flag"); -#if JVET_AC0344_NNPFC_PATCH if (sei.m_constantPatchSizeFlag) { -#endif xWriteUvlc(sei.m_patchWidthMinus1, "nnpfc_patch_width_minus1"); xWriteUvlc(sei.m_patchHeightMinus1, "nnpfc_patch_height_minus1"); -#if JVET_AC0344_NNPFC_PATCH } else { xWriteUvlc(sei.m_extendedPatchWidthCdDeltaMinus1, "extended_nnpfc_patch_width_cd_delta_minus1"); xWriteUvlc(sei.m_extendedPatchHeightCdDeltaMinus1, "extended_nnpfc_patch_height_cd_delta_minus1"); } -#else - xWriteUvlc(sei.m_overlap, "nnpfc_overlap"); -#endif xWriteUvlc(sei.m_paddingType, "nnpfc_padding_type"); if (sei.m_paddingType == NNPC_PaddingType::FIXED_PADDING) { @@ -1855,11 +1799,7 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralN void SEIWriter::xWriteSEINeuralNetworkPostFilterActivation(const SEINeuralNetworkPostFilterActivation &sei) { -#if JVET_AC0074_USE_OF_NNPFC_FOR_PIC_RATE_UPSAMPLING xWriteUvlc(sei.m_targetId, "nnpfa_target_id"); -#else - xWriteUvlc(sei.m_id, "nnpfa_id"); -#endif xWriteFlag(sei.m_cancelFlag, "nnpfa_cancel_flag"); if(!sei.m_cancelFlag) {