diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index 04dac8b388b6667c600f37482c92619f48239b75..c058d6fe8c2493163d0dc40596b7654de627442b 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -112,9 +112,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) "\t2: enable tool statistic\n" "\t3: enable bit and tool statistic\n") #endif -#if JVET_M0445_MCTS_DEC_CHECK ("MCTSCheck", m_mctsCheck, false, "If enabled, the decoder checks for violations of mc_exact_sample_value_match_flag in Temporal MCTS ") -#endif ; po::setDefaults(opts); @@ -151,9 +149,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) } #endif -#if JVET_M0445_MCTS_DEC_CHECK g_mctsDecCheckEnabled = m_mctsCheck; -#endif // Chroma output bit-depth if( m_outputBitDepth[CHANNEL_TYPE_LUMA] != 0 && m_outputBitDepth[CHANNEL_TYPE_CHROMA] == 0 ) { @@ -236,9 +232,7 @@ DecAppCfg::DecAppCfg() , m_bClipOutputVideoToRec709Range(false) , m_packedYUVMode(false) , m_statMode(0) -#if JVET_M0445_MCTS_DEC_CHECK , m_mctsCheck(false) -#endif { for (uint32_t channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++) { diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h index 029ad15ebd4847fafc14c10503c4eaa6ddae05cd..a27a069284084ccdf974feb3f20c2f835f1291dd 100644 --- a/source/App/DecoderApp/DecAppCfg.h +++ b/source/App/DecoderApp/DecAppCfg.h @@ -73,9 +73,7 @@ protected: bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data std::string m_cacheCfgFile; ///< Config file of cache model int m_statMode; ///< Config statistic mode (0 - bit stat, 1 - tool stat, 3 - both) -#if JVET_M0445_MCTS_DEC_CHECK bool m_mctsCheck; -#endif public: DecAppCfg(); diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 2e7dacc9650cf8574e9550b08e517ea33c607cc6..9cdd07a6932cce8b0cf2446c00f5b7d20293a51a 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -121,40 +121,20 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoSaoConstraintFlag ( !m_bUseSAO ); m_cEncLib.setNoAlfConstraintFlag ( !m_alf ); m_cEncLib.setNoPcmConstraintFlag ( !m_usePCM ); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX m_cEncLib.setNoRefWraparoundConstraintFlag ( m_bNoRefWraparoundConstraintFlag ); -#endif m_cEncLib.setNoTemporalMvpConstraintFlag ( m_TMVPModeId ? false : true ); m_cEncLib.setNoSbtmvpConstraintFlag ( m_SubPuMvpMode ? false : true ); m_cEncLib.setNoAmvrConstraintFlag ( m_bNoAmvrConstraintFlag ); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX m_cEncLib.setNoBdofConstraintFlag ( !m_BIO ); -#endif m_cEncLib.setNoCclmConstraintFlag ( m_LMChroma ? false : true ); -#if JVET_M0464_UNI_MTS -#if JVET_M0303_IMPLICIT_MTS m_cEncLib.setNoMtsConstraintFlag ( (m_MTS || m_MTSImplicit) ? false : true ); -#else - m_cEncLib.setNoMtsConstraintFlag ( m_MTS ? false : true ); -#endif -#else -#if JVET_M0303_IMPLICIT_MTS - m_cEncLib.setNoMtsConstraintFlag ( (m_EMT || m_MTSImplicit) ? false : true ); -#else - m_cEncLib.setNoMtsConstraintFlag ( m_EMT ? false : true ); -#endif -#endif m_cEncLib.setNoAffineMotionConstraintFlag ( !m_Affine ); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX m_cEncLib.setNoGbiConstraintFlag ( !m_GBi ); m_cEncLib.setNoMhIntraConstraintFlag ( !m_MHIntra ); m_cEncLib.setNoTriangleConstraintFlag ( !m_Triangle ); -#endif m_cEncLib.setNoLadfConstraintFlag ( !m_LadfEnabed ); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX m_cEncLib.setNoCurrPicRefConstraintFlag ( !m_IBCMode ); m_cEncLib.setNoQpDeltaConstraintFlag ( m_bNoQpDeltaConstraintFlag ); -#endif m_cEncLib.setNoDepQuantConstraintFlag ( !m_depQuantEnabledFlag); m_cEncLib.setNoSignDataHidingConstraintFlag ( !m_signDataHidingEnabledFlag ); @@ -216,13 +196,8 @@ void EncApp::xInitLibCfg() //====== Quality control ======== m_cEncLib.setMaxDeltaQP ( m_iMaxDeltaQP ); -#if JVET_M0113_M0188_QG_SIZE m_cEncLib.setCuQpDeltaSubdiv ( m_cuQpDeltaSubdiv ); m_cEncLib.setCuChromaQpOffsetSubdiv ( m_cuChromaQpOffsetSubdiv ); -#else - m_cEncLib.setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); - m_cEncLib.setDiffCuChromaQpOffsetDepth ( m_diffCuChromaQpOffsetDepth ); -#endif m_cEncLib.setChromaCbQpOffset ( m_cbQpOffset ); m_cEncLib.setChromaCrQpOffset ( m_crQpOffset ); m_cEncLib.setChromaCbQpOffsetDualTree ( m_cbQpOffsetDualTree ); @@ -274,26 +249,13 @@ void EncApp::xInitLibCfg() m_cEncLib.setAffineType ( m_AffineType ); m_cEncLib.setBIO (m_BIO); m_cEncLib.setUseLMChroma ( m_LMChroma ); -#if JVET_M0142_CCLM_COLLOCATED_CHROMA m_cEncLib.setCclmCollocatedChromaFlag ( m_cclmCollocatedChromaFlag ); -#endif -#if JVET_M0464_UNI_MTS m_cEncLib.setIntraMTS ( m_MTS & 1 ); m_cEncLib.setIntraMTSMaxCand ( m_MTSIntraMaxCand ); m_cEncLib.setInterMTS ( ( m_MTS >> 1 ) & 1 ); m_cEncLib.setInterMTSMaxCand ( m_MTSInterMaxCand ); -#else - m_cEncLib.setIntraEMT ( m_EMT & 1 ); - m_cEncLib.setFastIntraEMT ( m_FastEMT & m_EMT & 1 ); - m_cEncLib.setInterEMT ( ( m_EMT >> 1 ) & 1 ); - m_cEncLib.setFastInterEMT ( ( m_FastEMT >> 1 ) & ( m_EMT >> 1 ) & 1 ); -#endif -#if JVET_M0303_IMPLICIT_MTS m_cEncLib.setImplicitMTS ( m_MTSImplicit ); -#endif -#if JVET_M0140_SBT m_cEncLib.setUseSBT ( m_SBT ); -#endif m_cEncLib.setUseCompositeRef ( m_compositeRefEnabled ); m_cEncLib.setUseGBi ( m_GBi ); m_cEncLib.setUseGBiFast ( m_GBiFast ); @@ -311,22 +273,12 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setUseMHIntra ( m_MHIntra ); m_cEncLib.setUseTriangle ( m_Triangle ); -#if JVET_M0253_HASH_ME m_cEncLib.setUseHashME ( m_HashME ); -#endif -#if JVET_M0255_FRACMMVD_SWITCH m_cEncLib.setAllowDisFracMMVD ( m_allowDisFracMMVD ); -#endif -#if JVET_M0246_AFFINE_AMVR m_cEncLib.setUseAffineAmvr ( m_AffineAmvr ); -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT m_cEncLib.setUseAffineAmvrEncOpt ( m_AffineAmvrEncOpt ); -#endif -#if JVET_M0147_DMVR m_cEncLib.setDMVR ( m_DMVR ); -#endif m_cEncLib.setIBCMode ( m_IBCMode ); m_cEncLib.setIBCLocalSearchRangeX ( m_IBCLocalSearchRangeX ); m_cEncLib.setIBCLocalSearchRangeY ( m_IBCLocalSearchRangeY ); @@ -347,9 +299,7 @@ void EncApp::xInitLibCfg() #if MAX_TB_SIZE_SIGNALLING m_cEncLib.setLog2MaxTbSize ( m_log2MaxTbSize ); #endif -#if JVET_M0428_ENC_DB_OPT m_cEncLib.setUseEncDbOpt(m_encDbOpt); -#endif m_cEncLib.setUseFastLCTU ( m_useFastLCTU ); m_cEncLib.setFastInterSearchMode ( m_fastInterSearchMode ); m_cEncLib.setUseEarlyCU ( m_bUseEarlyCU ); @@ -382,9 +332,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures ); m_cEncLib.setPCMLog2MinSize ( m_uiPCMLog2MinSize); m_cEncLib.setUsePCM ( m_usePCM ); -#if JVET_M0102_INTRA_SUBPARTITIONS m_cEncLib.setUseFastISP ( m_useFastISP ); -#endif // set internal bit-depth and constants for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) @@ -485,9 +433,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setSOPDescriptionSEIEnabled ( m_SOPDescriptionSEIEnabled ); m_cEncLib.setScalableNestingSEIEnabled ( m_scalableNestingSEIEnabled ); m_cEncLib.setTMCTSSEIEnabled ( m_tmctsSEIEnabled ); -#if JVET_M0445_MCTS m_cEncLib.setMCTSEncConstraint ( m_MCTSEncConstraint); -#endif m_cEncLib.setTimeCodeSEIEnabled ( m_timeCodeSEIEnabled ); m_cEncLib.setNumberOfTimeSets ( m_timeCodeSEINumTs ); for(int i = 0; i < m_timeCodeSEINumTs; i++) @@ -611,9 +557,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setForceDecodeBitstream1 ( m_forceDecodeBitstream1 ); m_cEncLib.setStopAfterFFtoPOC ( m_stopAfterFFtoPOC ); m_cEncLib.setBs2ModPOCAndType ( m_bs2ModPOCAndType ); -#if JVET_M0055_DEBUG_CTU m_cEncLib.setDebugCTU ( m_debugCTU ); -#endif #if ENABLE_SPLIT_PARALLELISM m_cEncLib.setNumSplitThreads ( m_numSplitThreads ); m_cEncLib.setForceSingleSplitThread ( m_forceSplitSequential ); @@ -625,12 +569,10 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setUseALF ( m_alf ); -#if JVET_M0427_INLOOP_RESHAPER m_cEncLib.setReshaper ( m_lumaReshapeEnable ); m_cEncLib.setReshapeSignalType ( m_reshapeSignalType ); m_cEncLib.setReshapeIntraCMD ( m_intraCMD ); m_cEncLib.setReshapeCW ( m_reshapeCW ); -#endif } void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList @@ -919,9 +861,7 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector<uint32_t>& a #endif case NAL_UNIT_SPS: case NAL_UNIT_PPS: -#if JVET_M0132_APS case NAL_UNIT_APS: -#endif m_essentialBytes += *it_stats; break; default: @@ -938,11 +878,7 @@ void EncApp::printRateSummary() msg( DETAILS,"Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time ); if (m_summaryVerboseness > 0) { -#if JVET_M0132_APS msg(DETAILS, "Bytes for SPS/PPS/APS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); -#else - msg( DETAILS,"Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time ); -#endif } } diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 7a06d647653bfc09f2df8452718e450e4bf2d328..c1c6391d2a9e00f7fbb0ebd2e88d2eeed5dd164a 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -116,28 +116,20 @@ EncAppCfg::EncAppCfg() , m_bNoSaoConstraintFlag(false) , m_bNoAlfConstraintFlag(false) , m_bNoPcmConstraintFlag(false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoRefWraparoundConstraintFlag(false) -#endif , m_bNoTemporalMvpConstraintFlag(false) , m_bNoSbtmvpConstraintFlag(false) , m_bNoAmvrConstraintFlag(false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoBdofConstraintFlag(false) -#endif , m_bNoCclmConstraintFlag(false) , m_bNoMtsConstraintFlag(false) , m_bNoAffineMotionConstraintFlag(false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoGbiConstraintFlag(false) , m_bNoMhIntraConstraintFlag(false) , m_bNoTriangleConstraintFlag(false) -#endif , m_bNoLadfConstraintFlag(false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoCurrPicRefConstraintFlag(false) , m_bNoQpDeltaConstraintFlag(false) -#endif , m_bNoDepQuantConstraintFlag(false) , m_bNoSignDataHidingConstraintFlag(false) #if EXTENSION_360_VIDEO @@ -853,12 +845,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("LMChroma", m_LMChroma, 1, " LMChroma prediction " "\t0: Disable LMChroma\n" "\t1: Enable LMChroma\n") -#if JVET_M0142_CCLM_COLLOCATED_CHROMA ("CclmCollocatedChroma", m_cclmCollocatedChromaFlag, false, "Specifies the location of the top-left downsampled luma sample in cross-component linear model intra prediction relative to the top-left luma sample\n" "\t0: horizontally co-sited, vertically shifted by 0.5 units of luma samples\n" "\t1: collocated\n") -#endif -#if JVET_M0464_UNI_MTS ("MTS", m_MTS, 0, "Multiple Transform Set (MTS)\n" "\t0: Disable MTS\n" "\t1: Enable only Intra MTS\n" @@ -866,24 +855,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "\t3: Enable both Intra & Inter MTS\n") ("MTSIntraMaxCand", m_MTSIntraMaxCand, 3, "Number of additional candidates to test in encoder search for MTS in intra slices\n") ("MTSInterMaxCand", m_MTSInterMaxCand, 4, "Number of additional candidates to test in encoder search for MTS in inter slices\n") -#else - ("EMT,-emt", m_EMT, 0, "Enhanced Multiple Transform (EMT)\n" - "\t0: Disable EMT\n" - "\t1: Enable only Intra EMT\n" - "\t2: Enable only Inter EMT\n" - "\t3: Enable both Intra & Inter EMT\n") - ("EMTFast,-femt", m_FastEMT, 0, "Fast methods for Enhanced Multiple Transform (EMT)\n" - "\t0: Disable fast methods for EMT\n" - "\t1: Enable fast methods only for Intra EMT\n" - "\t2: Enable fast methods only for Inter EMT\n" - "\t3: Enable fast methods for both Intra & Inter EMT\n") -#endif -#if JVET_M0303_IMPLICIT_MTS ("MTSImplicit", m_MTSImplicit, 0, "Enable implicit MTS (when explicit MTS is off)\n") -#endif -#if JVET_M0140_SBT ( "SBT", m_SBT, false, "Enable Sub-Block Transform for inter blocks\n" ) -#endif ("CompositeLTReference", m_compositeRefEnabled, false, "Enable Composite Long Term Reference Frame") ("GBi", m_GBi, false, "Enable Generalized Bi-prediction(GBi)") ("GBiFast", m_GBiFast, false, "Fast methods for Generalized Bi-prediction(GBi)\n") @@ -895,22 +868,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #endif ("MHIntra", m_MHIntra, false, "Enable MHIntra mode") ("Triangle", m_Triangle, false, "Enable triangular shape motion vector prediction (0:off, 1:on)") -#if JVET_M0253_HASH_ME ("HashME", m_HashME, false, "Enable hash motion estimation (0:off, 1:on)") -#endif -#if JVET_M0255_FRACMMVD_SWITCH ("AllowDisFracMMVD", m_allowDisFracMMVD, false, "Disable fractional MVD in MMVD mode adaptively") -#endif -#if JVET_M0246_AFFINE_AMVR ("AffineAmvr", m_AffineAmvr, false, "Eanble AMVR for affine inter mode") -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT ("AffineAmvrEncOpt", m_AffineAmvrEncOpt, false, "Enable encoder optimization of affine AMVR") -#endif -#if JVET_M0147_DMVR ("DMVR", m_DMVR, false, "Decoder-side Motion Vector Refinement") -#endif ( "IBC", m_IBCMode, 0u, "IBCMode (0x1:enabled, 0x0:disabled) [default: disabled]") ( "IBCLocalSearchRangeX", m_IBCLocalSearchRangeX, 128u, "Search range of IBC local search in x direction") ( "IBCLocalSearchRangeY", m_IBCLocalSearchRangeY, 128u, "Search range of IBC local search in y direction") @@ -923,14 +886,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("WrapAroundOffset", m_wrapAroundOffset, 0u, "Offset in luma samples used for computing the horizontal wrap-around position") // ADD_NEW_TOOL : (encoder app) add parsing parameters here -#if JVET_M0428_ENC_DB_OPT ("EncDbOpt", m_encDbOpt, false, "Encoder optimization with deblocking filter") -#endif -#if JVET_M0427_INLOOP_RESHAPER ("LumaReshapeEnable", m_lumaReshapeEnable, false, "Enable Reshaping for Luma Channel") ("ReshapeSignalType", m_reshapeSignalType, 0u, "Input signal type: 0: SDR, 1:PQ, 2:HLG") ("IntraCMD", m_intraCMD, 0u, "IntraChroma MD: 0: none, 1:fixed to default wPSNR weight") -#endif ("LCTUFast", m_useFastLCTU, false, "Fast methods for large CTU") ("FastMrg", m_useFastMrg, false, "Fast methods for inter merge") ("PBIntraFast", m_usePbIntraFast, false, "Fast assertion if the intra mode is probable") @@ -997,13 +956,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #endif ("DeltaQpRD,-dqr", m_uiDeltaQpRD, 0u, "max dQp offset for slice") ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") -#if JVET_M0113_M0188_QG_SIZE ("MaxCuDQPSubdiv,-dqd", m_cuQpDeltaSubdiv, 0, "Maximum subdiv for CU luma Qp adjustment") ("MaxCuChromaQpOffsetSubdiv", m_cuChromaQpOffsetSubdiv, -1, "Maximum subdiv for CU chroma Qp adjustment - set less than 0 to disable") -#else - ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") - ("MaxCUChromaQpAdjustmentDepth", m_diffCuChromaQpOffsetDepth, -1, "Maximum depth for CU chroma Qp adjustment - set less than 0 to disable") -#endif ("FastDeltaQP", m_bFastDeltaQP, false, "Fast Delta QP Algorithm") #if SHARP_LUMA_DELTA_QP ("LumaLevelToDeltaQPMode", lumaLevelToDeltaQPMode, 0u, "Luma based Delta QP 0(default): not used. 1: Based on CTU average, 2: Based on Max luma in CTU") @@ -1061,16 +1015,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SaoLumaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_LUMA], 0, "Specify the luma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP") ("SaoChromaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_CHROMA], 0, "Specify the chroma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP") ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") -#if JVET_M0464_UNI_MTS ("TransformSkipFast", m_useTransformSkipFast, false, "Fast encoder search for transform skipping, winner takes it all mode.") ("TransformSkipLog2MaxSize", m_log2MaxTransformSkipBlockSize, 5U, "Specify transform-skip maximum size. Minimum 2, Maximum 5. (not valid in V1 profiles)") -#else - ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") - ("TransformSkipLog2MaxSize", m_log2MaxTransformSkipBlockSize, 2U, "Specify transform-skip maximum size. Minimum 2. (not valid in V1 profiles)") -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS ("ISPFast", m_useFastISP, false, "Fast encoder search for ISP") -#endif ("ImplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT], false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)") ("ExplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT], false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)") ("ResidualRotation", m_transformSkipRotationEnabledFlag, false, "Enable rotation of transform-skipped and transquant-bypassed TUs through 180 degrees prior to entropy coding (not valid in V1 profiles)") @@ -1328,9 +1275,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #endif ("SEIGreenMetadataType", m_greenMetadataType, 0u, "Value for the green_metadata_type specifies the type of metadata that is present in the SEI message. If green_metadata_type is 1, then metadata enabling quality recovery after low-power encoding is present") ("SEIXSDMetricType", m_xsdMetricType, 0u, "Value for the xsd_metric_type indicates the type of the objective quality metric. PSNR is the only type currently supported") -#if JVET_M0445_MCTS ("MCTSEncConstraint", m_MCTSEncConstraint, false, "For MCTS, constrain motion vectors at tile boundaries") -#endif #if ENABLE_TRACING ("TraceChannelsList", bTracingChannelsList, false, "List all available tracing channels") ("TraceRule", sTracingRule, string( "" ), "Tracing rule (ex: \"D_CABAC:poc==8\" or \"D_REC_CB_LUMA:poc==8\")") @@ -1351,9 +1296,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ForceSingleSplitThread", m_forceSplitSequential, false, "Force single thread execution even if taking the parallelized path") ("NumWppThreads", m_numWppThreads, 1, "Number of threads used to run WPP-style parallelization") ("NumWppExtraLines", m_numWppExtraLines, 0, "Number of additional wpp lines to switch when threads are blocked") -#if JVET_M0055_DEBUG_CTU ("DebugCTU", m_debugCTU, -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC-frame at CTUline containin debug CTU.") -#endif #if ENABLE_WPP_PARALLELISM ("EnsureWppBitEqual", m_ensureWppBitEqual, true, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off") #else @@ -1578,11 +1521,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) !m_enableIntraReferenceSmoothing || m_persistentRiceAdaptationEnabledFlag || m_log2MaxTransformSkipBlockSize!=2; -#if JVET_M0113_M0188_QG_SIZE const bool bUsingChromaQPAdjustment= m_cuChromaQpOffsetSubdiv >= 0; -#else - const bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0; -#endif const bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag; if (m_onePictureOnlyConstraintFlag) { @@ -1902,14 +1841,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } -#if JVET_M0427_INLOOP_RESHAPER m_reshapeCW.binCW.resize(3); m_reshapeCW.rspFps = m_iFrameRate; m_reshapeCW.rspIntraPeriod = m_iIntraPeriod; m_reshapeCW.rspPicSize = m_iSourceWidth*m_iSourceHeight; m_reshapeCW.rspFpsToIp = std::max(16, 16 * (int)(round((double)m_iFrameRate /16.0))); m_reshapeCW.rspBaseQP = m_iQP; -#endif #if ENABLE_TRACING g_trace_ctx = tracing_init(sTracingFile, sTracingRule); if( bTracingChannelsList && g_trace_ctx ) @@ -1940,11 +1877,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) && ((1 << (MAX_TB_LOG2_SIZEY + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320)) #endif { -#if JVET_M0113_M0188_QG_SIZE m_cuQpDeltaSubdiv = 2; -#else - m_iMaxCuDQPDepth = 1; -#endif } #else #if QP_SWITCHING_FOR_PARALLEL @@ -2030,25 +1963,16 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_LMChroma, "LMChroma only allowed with NEXT profile" ); xConfirmPara( m_ImvMode, "IMV is only allowed with NEXT profile" ); xConfirmPara(m_IBCMode, "IBC Mode only allowed with NEXT profile"); -#if JVET_M0253_HASH_ME xConfirmPara( m_HashME, "Hash motion estimation only allowed with NEXT profile" ); -#endif xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" ); -#if JVET_M0464_UNI_MTS xConfirmPara( m_MTS, "MTS only allowed with NEXT profile" ); xConfirmPara( m_MTSIntraMaxCand, "MTS only allowed with NEXT profile" ); xConfirmPara( m_MTSInterMaxCand, "MTS only allowed with NEXT profile" ); -#else - xConfirmPara( m_EMT, "EMT only allowed with NEXT profile" ); - xConfirmPara( m_FastEMT, "EMT only allowed with NEXT profile" ); -#endif xConfirmPara( m_compositeRefEnabled, "Composite Reference Frame is only allowed with NEXT profile" ); xConfirmPara( m_GBi, "GBi is only allowed with NEXT profile" ); xConfirmPara( m_GBiFast, "GBiFast is only allowed with NEXT profile" ); xConfirmPara( m_Triangle, "Triangle is only allowed with NEXT profile" ); -#if JVET_M0147_DMVR xConfirmPara(m_DMVR, "DMVR only allowed with NEXT profile"); -#endif // ADD_NEW_TOOL : (parameter check) add a check for next tools here } else @@ -2134,11 +2058,7 @@ bool EncAppCfg::xCheckParameter() !m_enableIntraReferenceSmoothing || m_persistentRiceAdaptationEnabledFlag || m_log2MaxTransformSkipBlockSize!=2; -#if JVET_M0113_M0188_QG_SIZE const bool bUsingChromaQPTool = m_cuChromaQpOffsetSubdiv >= 0; -#else - const bool bUsingChromaQPTool = m_diffCuChromaQpOffsetDepth >= 0; -#endif const bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag; xConfirmPara((m_chromaFormatConstraint==CHROMA_420 || m_chromaFormatConstraint==CHROMA_400) && bUsingChromaQPTool, "CU Chroma QP adjustment cannot be used for 4:0:0 or 4:2:0 RExt profiles"); @@ -2174,11 +2094,7 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_profile == Profile::MAINSTILLPICTURE && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when main still picture profile is used."); xConfirmPara(m_crossComponentPredictionEnabledFlag==true, "CrossComponentPrediction must not be used for non main-RExt profiles."); -#if JVET_M0464_UNI_MTS xConfirmPara(m_log2MaxTransformSkipBlockSize>=6, "Transform Skip Log2 Max Size must be less or equal to 5."); -#else - xConfirmPara(m_log2MaxTransformSkipBlockSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles."); -#endif xConfirmPara(m_transformSkipRotationEnabledFlag==true, "UseResidualRotation must not be enabled for non main-RExt profiles."); xConfirmPara(m_transformSkipContextEnabledFlag==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles."); xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles."); @@ -2267,16 +2183,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara (m_log2MaxTransformSkipBlockSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)"); -#if !JVET_M0464_UNI_MTS - if (m_log2MaxTransformSkipBlockSize!=2 && m_useTransformSkipFast) - { - msg( WARNING, "***************************************************************************\n"); - msg( WARNING, "** WARNING: Transform skip fast is enabled (which only tests NxN splits),**\n"); - msg( WARNING, "** but transform skip log2 max size is not 2 (4x4) **\n"); - msg( WARNING, "** It may be better to disable transform skip fast mode **\n"); - msg( WARNING, "***************************************************************************\n"); - } -#endif if( m_SubPuMvpMode == 3 && m_maxNumMergeCand < 7 ) { @@ -2310,7 +2216,6 @@ bool EncAppCfg::xCheckParameter() #if SHARP_LUMA_DELTA_QP xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_uiDeltaQpRD > 0, "Luma-level-based Delta QP cannot be used together with slice level multiple-QP optimization\n" ); #endif -#if JVET_M0427_INLOOP_RESHAPER if (m_lumaLevelToDeltaQPMapping.mode && m_lumaReshapeEnable) { msg(WARNING, "For HDR-PQ, reshaper should be used mutual-exclusively with Luma-level-based Delta QP. If use luma DQP, turn reshaper off.\n"); @@ -2333,7 +2238,6 @@ bool EncAppCfg::xCheckParameter() { m_lumaReshapeEnable = false; } -#endif xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); @@ -2383,20 +2287,10 @@ bool EncAppCfg::xCheckParameter() m_maxNumAffineMergeCand = m_SubPuMvpMode; } -#if JVET_M0464_UNI_MTS xConfirmPara( m_MTS < 0 || m_MTS > 3, "MTS must be greater than 0 smaller than 4" ); xConfirmPara( m_MTSIntraMaxCand < 0 || m_MTSIntraMaxCand > 5, "m_MTSIntraMaxCand must be greater than 0 and smaller than 6" ); xConfirmPara( m_MTSInterMaxCand < 0 || m_MTSInterMaxCand > 5, "m_MTSInterMaxCand must be greater than 0 and smaller than 6" ); -#if JVET_M0303_IMPLICIT_MTS xConfirmPara( m_MTS != 0 && m_MTSImplicit != 0, "Both explicit and implicit MTS cannot be enabled at the same time" ); -#endif -#else - xConfirmPara( m_EMT < 0 || m_EMT >3, "EMT must be 0, 1, 2 or 3" ); - xConfirmPara( m_FastEMT < 0 || m_FastEMT >3, "FEMT must be 0, 1, 2 or 3" ); -#if JVET_M0303_IMPLICIT_MTS - xConfirmPara( m_EMT != 0 && m_MTSImplicit != 0, "Both explicit and implicit MTS cannot be enabled at the same time" ); -#endif -#endif if( m_usePCM) { for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) @@ -2879,7 +2773,6 @@ bool EncAppCfg::xCheckParameter() #endif } -#if JVET_M0445_MCTS if ((m_MCTSEncConstraint) && (m_bLFCrossTileBoundaryFlag)) { printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling filtering across tile boundaries!\n"); @@ -2901,7 +2794,6 @@ bool EncAppCfg::xCheckParameter() printf( "Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling BIO!\n" ); m_BIO = false; } -#endif if (m_toneMappingInfoSEIEnabled) { @@ -3105,11 +2997,7 @@ void EncAppCfg::xPrintParameter() #else msg( DETAILS, "QP : %5.2f\n", m_fQP ); #endif -#if JVET_M0113_M0188_QG_SIZE msg( DETAILS, "Max dQP signaling subdiv : %d\n", m_cuQpDeltaSubdiv); -#else - msg( DETAILS, "Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); -#endif msg( DETAILS, "Cb QP Offset (dual tree) : %d (%d)\n", m_cbQpOffset, m_cbQpOffsetDualTree); msg( DETAILS, "Cr QP Offset (dual tree) : %d (%d)\n", m_crQpOffset, m_crQpOffsetDualTree); @@ -3121,11 +3009,7 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "PCM sample bit depth : (Y:%d, C:%d)\n", m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA], m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] ); msg( DETAILS, "Intra reference smoothing : %s\n", (m_enableIntraReferenceSmoothing ? "Enabled" : "Disabled") ); -#if JVET_M0113_M0188_QG_SIZE msg( DETAILS, "cu_chroma_qp_offset_subdiv : %d\n", m_cuChromaQpOffsetSubdiv); -#else - msg( DETAILS, "diff_cu_chroma_qp_offset_depth : %d\n", m_diffCuChromaQpOffsetDepth); -#endif msg( DETAILS, "extended_precision_processing_flag : %s\n", (m_extendedPrecisionProcessingFlag ? "Enabled" : "Disabled") ); msg( DETAILS, "implicit_rdpcm_enabled_flag : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") ); msg( DETAILS, "explicit_rdpcm_enabled_flag : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") ); @@ -3209,9 +3093,7 @@ void EncAppCfg::xPrintParameter() } #endif msg( VERBOSE, "Tiles:%dx%d ", m_numTileColumnsMinus1 + 1, m_numTileRowsMinus1 + 1 ); -#if JVET_M0445_MCTS msg( VERBOSE, "MCTS:%d ", m_MCTSEncConstraint ); -#endif msg( VERBOSE, "CIP:%d ", m_bUseConstrainedIntraPred); msg( VERBOSE, "SAO:%d ", (m_bUseSAO)?(1):(0)); msg( VERBOSE, "ALF:%d ", m_alf ? 1 : 0 ); @@ -3257,20 +3139,12 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "IMV:%d ", m_ImvMode ); msg( VERBOSE, "BIO:%d ", m_BIO ); msg( VERBOSE, "LMChroma:%d ", m_LMChroma ); -#if JVET_M0142_CCLM_COLLOCATED_CHROMA if( m_LMChroma && m_chromaFormatIDC == CHROMA_420 ) { msg( VERBOSE, "CclmCollocatedChroma:%d ", m_cclmCollocatedChromaFlag ); } -#endif -#if JVET_M0464_UNI_MTS msg( VERBOSE, "MTS: %1d(intra) %1d(inter) ", m_MTS & 1, ( m_MTS >> 1 ) & 1 ); -#else - msg( VERBOSE, "EMT: %1d(intra) %1d(inter) ", m_EMT & 1, ( m_EMT >> 1 ) & 1 ); -#endif -#if JVET_M0140_SBT msg( VERBOSE, "SBT:%d ", m_SBT ); -#endif msg( VERBOSE, "CompositeLTReference:%d ", m_compositeRefEnabled); msg( VERBOSE, "GBi:%d ", m_GBi ); msg( VERBOSE, "GBiFast:%d ", m_GBiFast ); @@ -3279,54 +3153,34 @@ void EncAppCfg::xPrintParameter() #endif msg(VERBOSE, "MHIntra:%d ", m_MHIntra); msg( VERBOSE, "Triangle:%d ", m_Triangle ); -#if JVET_M0255_FRACMMVD_SWITCH msg( VERBOSE, "AllowDisFracMMVD:%d ", m_allowDisFracMMVD ); -#endif -#if JVET_M0246_AFFINE_AMVR msg( VERBOSE, "AffineAmvr:%d ", m_AffineAmvr ); -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT m_AffineAmvrEncOpt = m_AffineAmvr ? m_AffineAmvrEncOpt : false; msg( VERBOSE, "AffineAmvrEncOpt:%d ", m_AffineAmvrEncOpt ); -#endif -#if JVET_M0147_DMVR msg(VERBOSE, "DMVR:%d ", m_DMVR); -#endif } msg(VERBOSE, "IBC:%d ", m_IBCMode); -#if JVET_M0253_HASH_ME msg( VERBOSE, "HashME:%d ", m_HashME ); -#endif msg( VERBOSE, "WrapAround:%d ", m_wrapAround); if( m_wrapAround ) { msg( VERBOSE, "WrapAroundOffset:%d ", m_wrapAroundOffset ); } // ADD_NEW_TOOL (add some output indicating the usage of tools) -#if JVET_M0427_INLOOP_RESHAPER msg(VERBOSE, "Reshape:%d ", m_lumaReshapeEnable); if (m_lumaReshapeEnable) { msg(VERBOSE, "(Sigal:%s ", m_reshapeSignalType==0? "SDR" : "HDR-PQ"); msg(VERBOSE, ") "); } -#endif -#if JVET_M0428_ENC_DB_OPT msg(VERBOSE, "EncDbOpt:%d ", m_encDbOpt); -#endif msg( VERBOSE, "\nFAST TOOL CFG: " ); msg( VERBOSE, "LCTUFast:%d ", m_useFastLCTU ); msg( VERBOSE, "FastMrg:%d ", m_useFastMrg ); msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast ); if( m_ImvMode ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast ); -#if JVET_M0464_UNI_MTS if( m_MTS ) msg( VERBOSE, "MTSMaxCand: %1d(intra) %1d(inter) ", m_MTSIntraMaxCand, m_MTSInterMaxCand ); -#else - if( m_EMT ) msg( VERBOSE, "EMTFast: %1d(intra) %1d(inter) ", ( m_FastEMT & m_EMT & 1 ), ( m_FastEMT >> 1 ) & ( m_EMT >> 1 ) & 1 ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS msg( VERBOSE, "ISPFast:%d ", m_useFastISP ); -#endif msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT ); msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc ); msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt ); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index f819cc1ba9e1f7ced7803b44538c340213aee73a..1debceb530f63da624cf1cbce902bb79306ef40b 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -125,28 +125,20 @@ protected: bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; bool m_bNoPcmConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoRefWraparoundConstraintFlag; -#endif bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; bool m_bNoAmvrConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoBdofConstraintFlag; -#endif bool m_bNoCclmConstraintFlag; bool m_bNoMtsConstraintFlag; bool m_bNoAffineMotionConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoGbiConstraintFlag; bool m_bNoMhIntraConstraintFlag; bool m_bNoTriangleConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoCurrPicRefConstraintFlag; bool m_bNoQpDeltaConstraintFlag; -#endif bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -186,9 +178,7 @@ protected: bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM bool m_persistentRiceAdaptationEnabledFlag; ///< control flag for Golomb-Rice parameter adaptation over each slice bool m_cabacBypassAlignmentEnabledFlag; -#if JVET_M0102_INTRA_SUBPARTITIONS bool m_useFastISP; ///< flag for enabling fast methods for ISP -#endif // coding quality #if QP_SWITCHING_FOR_PARALLEL @@ -205,13 +195,8 @@ protected: int* m_aidQP; ///< array of slice QP values int m_iMaxDeltaQP; ///< max. |delta QP| uint32_t m_uiDeltaQpRD; ///< dQP range for multi-pass slice QP optimization -#if JVET_M0113_M0188_QG_SIZE int m_cuQpDeltaSubdiv; ///< Maximum subdiv for CU luma Qp adjustment (0:default) int m_cuChromaQpOffsetSubdiv; ///< If negative, then do not apply chroma qp offsets. -#else - int m_iMaxCuDQPDepth; ///< Max. depth for a minimum CuDQPSize (0:default) - int m_diffCuChromaQpOffsetDepth; ///< If negative, then do not apply chroma qp offsets. -#endif bool m_bFastDeltaQP; ///< Fast Delta QP (false:default) int m_cbQpOffset; ///< Chroma Cb QP Offset (0:default) @@ -251,23 +236,12 @@ protected: bool m_AffineType; bool m_BIO; int m_LMChroma; -#if JVET_M0142_CCLM_COLLOCATED_CHROMA bool m_cclmCollocatedChromaFlag; -#endif -#if JVET_M0464_UNI_MTS int m_MTS; ///< XZ: Multiple Transform Set int m_MTSIntraMaxCand; ///< XZ: Number of additional candidates to test int m_MTSInterMaxCand; ///< XZ: Number of additional candidates to test -#else - int m_EMT; ///< XZ: Enhanced Multiple Transform - int m_FastEMT; ///< XZ: Fast Methods of Enhanced Multiple Transform -#endif -#if JVET_M0303_IMPLICIT_MTS int m_MTSImplicit; -#endif -#if JVET_M0140_SBT bool m_SBT; ///< Sub-Block Transform for inter blocks -#endif bool m_compositeRefEnabled; bool m_GBi; @@ -281,21 +255,11 @@ protected: bool m_MHIntra; bool m_Triangle; -#if JVET_M0253_HASH_ME bool m_HashME; -#endif -#if JVET_M0255_FRACMMVD_SWITCH bool m_allowDisFracMMVD; -#endif -#if JVET_M0246_AFFINE_AMVR bool m_AffineAmvr; -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT bool m_AffineAmvrEncOpt; -#endif -#if JVET_M0147_DMVR bool m_DMVR; -#endif unsigned m_IBCMode; unsigned m_IBCLocalSearchRangeX; @@ -309,15 +273,11 @@ protected: unsigned m_wrapAroundOffset; // ADD_NEW_TOOL : (encoder app) add tool enabling flags and associated parameters here -#if JVET_M0427_INLOOP_RESHAPER bool m_lumaReshapeEnable; uint32_t m_reshapeSignalType; uint32_t m_intraCMD; ReshapeCW m_reshapeCW; -#endif -#if JVET_M0428_ENC_DB_OPT bool m_encDbOpt; -#endif unsigned m_uiMaxCUWidth; ///< max. CU width in pixel unsigned m_uiMaxCUHeight; ///< max. CU height in pixel unsigned m_uiMaxCUDepth; ///< max. CU depth (as specified by command line) @@ -498,9 +458,7 @@ protected: uint32_t m_greenMetadataType; uint32_t m_xsdMetricType; -#if JVET_M0445_MCTS bool m_MCTSEncConstraint; -#endif // weighted prediction bool m_useWeightedPred; ///< Use of weighted prediction in P slices @@ -589,9 +547,7 @@ protected: int m_verbosity; std::string m_decodeBitstreams[2]; ///< filename for decode bitstreams. -#if JVET_M0055_DEBUG_CTU int m_debugCTU; -#endif int m_switchPOC; ///< dbg poc. int m_switchDQP; ///< switch DQP. int m_fastForwardToPOC; ///< get to encoding the specified POC as soon as possible by skipping temporal layers irrelevant for the specified POC diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp index 6987d87becb2de8dd8cec1bd2e125febd3e242aa..d85c356d804143423a7cce3315fd047bfb3f5313 100644 --- a/source/App/Parcat/parcat.cpp +++ b/source/App/Parcat/parcat.cpp @@ -181,9 +181,7 @@ const char * NALU_TYPE[] = "NAL_UNIT_SPS", "NAL_UNIT_PPS", -#if JVET_M0132_APS "NAL_UNIT_APS", -#endif "NAL_UNIT_ACCESS_UNIT_DELIMITER", "NAL_UNIT_EOS", "NAL_UNIT_EOB", @@ -266,9 +264,6 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int int poc = -1; int poc_lsb = -1; int new_poc = -1; -#if PRINT_NALUS - printf("NALU type: %s\n", NALU_TYPE[nalu_type]); -#endif if(nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) { @@ -339,11 +334,7 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int #if HEVC_VPS if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP )) || ((idx>1 && !idr_found) && ( nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS)) #else -#if JVET_M0132_APS if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_APS)) -#else - if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS )) -#endif #endif || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei)) { diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index 3ad7df71f4e380f7ad706562d4b00d74594b72ac..b1aef8429b7e98beaf45a5abfacc7aa74a85e8bb 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -104,13 +104,9 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic { Area blk( xPos, yPos, width, height ); deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk ); -#if JVET_M0277_FIX_PCM_DISABLEFILTER Area blkPCM(xPos, yPos, width, height); resetPCMBlkClassInfo(cs, m_classifier, tmpYuv.get(COMPONENT_Y), blkPCM); m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs ); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y] ); -#endif } for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ ) @@ -123,11 +119,7 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic { Area blk( xPos >> chromaScaleX, yPos >> chromaScaleY, width >> chromaScaleX, height >> chromaScaleY ); -#if JVET_M0277_FIX_PCM_DISABLEFILTER m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs ); -#else - m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx] ); -#endif } } ctuIdx++; @@ -282,7 +274,6 @@ void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const } } } -#if JVET_M0277_FIX_PCM_DISABLEFILTER void AdaptiveLoopFilter::resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk) { if ( !cs.sps->getPCMFilterDisableFlag() ) @@ -332,7 +323,6 @@ void AdaptiveLoopFilter::resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifi } } } -#endif void AdaptiveLoopFilter::deriveClassificationBlk( AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift ) { @@ -506,23 +496,17 @@ void AdaptiveLoopFilter::deriveClassificationBlk( AlfClassifier** classifier, in } template<AlfFilterType filtType> -#if JVET_M0277_FIX_PCM_DISABLEFILTER void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ) -#else -void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng ) -#endif { const bool bChroma = isChroma( compId ); if( bChroma ) { CHECK( filtType != 0, "Chroma needs to have filtType == 0" ); } -#if JVET_M0277_FIX_PCM_DISABLEFILTER const SPS* sps = cs.slice->getSPS(); bool isDualTree =CS::isDualITree(cs); bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); ChromaFormat nChromaFormat = sps->getChromaFormatIdc(); -#endif const CPelBuf srcLuma = recSrc.get( compId ); PelBuf dstLuma = recDst.get( compId ); @@ -589,15 +573,12 @@ void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf { AlfClassifier& cl = pClass[j]; transposeIdx = cl.transposeIdx; -#if JVET_M0277_FIX_PCM_DISABLEFILTER if( isPCMFilterDisabled && cl.classIdx== m_ALF_UNUSED_CLASSIDX && transposeIdx== m_ALF_UNUSED_TRANSPOSIDX ) { continue; } -#endif coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; } -#if JVET_M0277_FIX_PCM_DISABLEFILTER else if( isPCMFilterDisabled ) { int blkX, blkY; @@ -621,7 +602,6 @@ void AdaptiveLoopFilter::filterBlk( AlfClassifier** classifier, const PelUnitBuf continue; } } -#endif if( filtType == ALF_FILTER_7 ) diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.h b/source/Lib/CommonLib/AdaptiveLoopFilter.h index ace34136686489e3e83049e93a41fbe4ae943b62..92928fee096080ce0efaf7ab6c5eaef23aae135e 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.h +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.h @@ -41,9 +41,7 @@ #include "CommonDef.h" #include "Unit.h" -#if JVET_M0277_FIX_PCM_DISABLEFILTER #include "UnitTools.h" -#endif struct AlfClassifier { AlfClassifier() {} @@ -70,10 +68,8 @@ class AdaptiveLoopFilter public: static constexpr int m_NUM_BITS = 8; static constexpr int m_CLASSIFICATION_BLK_SIZE = 32; //non-normative, local buffer size -#if JVET_M0277_FIX_PCM_DISABLEFILTER static constexpr int m_ALF_UNUSED_CLASSIDX = 255; static constexpr int m_ALF_UNUSED_TRANSPOSIDX = 255; -#endif AdaptiveLoopFilter(); virtual ~AdaptiveLoopFilter() {} @@ -84,28 +80,17 @@ public: void destroy(); static void deriveClassificationBlk( AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift ); void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk ); -#if JVET_M0277_FIX_PCM_DISABLEFILTER void resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk); -#endif template<AlfFilterType filtType> -#if JVET_M0277_FIX_PCM_DISABLEFILTER static void filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ); -#else - static void filterBlk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng ); -#endif inline static int getMaxGolombIdx( AlfFilterType filterType ) { return filterType == ALF_FILTER_5 ? 2 : 3; } void( *m_deriveClassificationBlk )( AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift ); -#if JVET_M0277_FIX_PCM_DISABLEFILTER void( *m_filter5x5Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ); void( *m_filter7x7Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ); -#else - void( *m_filter5x5Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng ); - void( *m_filter7x7Blk )( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng ); -#endif #ifdef TARGET_SIMD_X86 void initAdaptiveLoopFilterX86(); diff --git a/source/Lib/CommonLib/BinaryDecisionTree.cpp b/source/Lib/CommonLib/BinaryDecisionTree.cpp deleted file mode 100644 index db6492688bd70ea46f6b41b511cf7d3e4597f400..0000000000000000000000000000000000000000 --- a/source/Lib/CommonLib/BinaryDecisionTree.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* The copyright in this software is being made available under the BSD -* License, included below. This software may be subject to other third party -* and contributor rights, including patent rights, and no such rights are -* granted under this license. -* -* Copyright (c) 2010-2019, ITU/ISO/IEC -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -* THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** \file BinaryDecisionTree.cpp - * \brief defines a binary decision tree that can be used for automated optimal coding of multi-level decisions - */ - -#include "BinaryDecisionTree.h" -#include "CommonDef.h" - -#if !REMOVE_BIN_DECISION_TREE - -#include <algorithm> - -struct DecisionTreeBuilder -{ - DecisionTreeBuilder( unsigned _id, unsigned _depth = 0 ) : left( nullptr ), right( nullptr ), depth( _depth ), id( _id ) { } - - DecisionTreeBuilder* left; - DecisionTreeBuilder* right; - unsigned depth; - - unsigned id; -}; - -DecisionTreeBuilder* decision( unsigned id, unsigned id0, unsigned id1 ) -{ - DecisionTreeBuilder* dtb = new DecisionTreeBuilder( id, 1 ); - dtb->left = new DecisionTreeBuilder( id0 ); - dtb->right = new DecisionTreeBuilder( id1 ); - - return dtb; -} -DecisionTreeBuilder* decision( unsigned id, DecisionTreeBuilder* sub0, unsigned id1 ) -{ - DecisionTreeBuilder* dtb = new DecisionTreeBuilder( id, sub0->depth + 1 ); - dtb->left = sub0; - dtb->right = new DecisionTreeBuilder( id1, sub0->depth ); - - return dtb; -} -DecisionTreeBuilder* decision( unsigned id, DecisionTreeBuilder* sub0, DecisionTreeBuilder* sub1 ) -{ - DecisionTreeBuilder* dtb = new DecisionTreeBuilder( id, std::max( sub0->depth, sub1->depth ) + 1 ); - dtb->left = sub0; - dtb->right = sub1; - - return dtb; -} -DecisionTreeBuilder* decision( unsigned id, unsigned id0, DecisionTreeBuilder* sub1 ) -{ - DecisionTreeBuilder* dtb = new DecisionTreeBuilder( id, sub1->depth + 1 ); - dtb->left = new DecisionTreeBuilder( id0, sub1->depth ); - dtb->right = sub1; - - return dtb; -} - -DecisionTreeTemplate::DecisionTreeTemplate( unsigned _depth ) -{ - depth = _depth; - - unsigned maxIds = 2 * ( 1u << depth ); - - memset( ids, 0xff, maxIds * sizeof( unsigned ) ); - memset( hasSub, true, maxIds * sizeof( bool ) ); - memset( mapping, 0xff, maxIds * sizeof( unsigned ) ); -} - -void compile( DecisionTreeTemplate& dtt, unsigned offset, unsigned depth, DecisionTreeBuilder* dtb ) -{ - dtt.ids[offset] = dtb->id; - - if( dtb->left || dtb->right ) - { - dtt.hasSub[offset] = true; - - if( dtb->right ) - { - compile( dtt, offset + 1, depth - 1, dtb->right ); - } - - if( dtb->left ) - { - compile( dtt, offset + ( 1u << depth ), depth - 1, dtb->left ); - } - } - else - { - dtt.hasSub[offset] = false; - } - - delete dtb; -} - -DecisionTreeTemplate compile( DecisionTreeBuilder *dtb ) -{ - DecisionTreeTemplate dtt( dtb->depth ); - - CHECK( dtt.depth > MAX_DEPTH_DECISION_TREE, "Maximum allowed decision tree depth exceeded" ); - - compile( dtt, 0, dtt.depth, dtb ); - - unsigned maxIds = 2 * ( 1 << dtt.depth ); - - for( unsigned i = 0; i < maxIds; i++ ) - { - if( dtt.ids[i] < maxIds ) - { - dtt.mapping[dtt.ids[i]] = i; - } - } - - return dtt; -} - -DecisionTree::DecisionTree( const DecisionTreeTemplate& _dtt ) : dtt( _dtt ) -{ - unsigned maxIds = 2 * ( 1u << dtt.depth ); - - memset( isAvail, true, maxIds * sizeof( bool ) ); - memset( ctxId, 0, maxIds * sizeof( unsigned ) ); -} - -void DecisionTree::setAvail( unsigned id, bool _isAvail ) -{ - CHECKD( dtt.hasSub[dtt.mapping[id]], "Trying to set availability of a not-endnode element" ); - - isAvail[dtt.mapping[id]] = _isAvail; -} - -void DecisionTree::setCtxId( unsigned id, unsigned _ctxId ) -{ - CHECKD( !dtt.hasSub[dtt.mapping[id]], "Trying to set a context of a endnode element" ); - - // value 0 means coding as EP bin - ctxId[dtt.mapping[id]] = _ctxId + 1; -} - -void DecisionTree::reduce( unsigned offset /*= 0*/, int depth /*= -1 */ ) -{ - if( depth < 0 ) depth = dtt.depth; - - bool avail = false; - - if( !dtt.hasSub[offset] ) return; - - CHECKD( depth == 0, "Inconsistent tree" ); - - reduce( offset + 1, depth - 1 ); - avail |= isAvail[offset + 1]; - - reduce( offset + ( 1u << depth ), depth - 1 ); - avail |= isAvail[offset + ( 1u << depth )]; - - isAvail[offset] = avail; -} - -#endif diff --git a/source/Lib/CommonLib/BinaryDecisionTree.h b/source/Lib/CommonLib/BinaryDecisionTree.h deleted file mode 100644 index 7ab0d6558cd9ece144e9545591a441480d742214..0000000000000000000000000000000000000000 --- a/source/Lib/CommonLib/BinaryDecisionTree.h +++ /dev/null @@ -1,98 +0,0 @@ -/* The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) 2010-2019, ITU/ISO/IEC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file BinaryDecisionTree.h - * \brief declares a binary decision tree that can be used for automated optimal coding of multi-level cascaded decisions - */ - -#ifndef __BINARYDECISIONTREE__ -#define __BINARYDECISIONTREE__ - -#include "CommonDef.h" - -#if !REMOVE_BIN_DECISION_TREE - -#define MAX_DEPTH_DECISION_TREE 5 -#define MAX_NODES_DECISION_TREE ( 2 * ( 1 << MAX_DEPTH_DECISION_TREE ) ) - -// decision tree template describes the trees and contains mappings between node ids and their in-tree positions -struct DecisionTreeTemplate -{ - DecisionTreeTemplate( unsigned _depth ); - - unsigned depth; - unsigned ids [MAX_NODES_DECISION_TREE]; // maps the in-tree position to node-id - bool hasSub [MAX_NODES_DECISION_TREE]; // stores, for each in-tree position, the information if the node is an end-node ('false'), or a decision-node ('true') - unsigned mapping[MAX_NODES_DECISION_TREE]; // maps the node-ids to the in-tree positions -}; - -// decision tree contains sparsity information (node availability) and the context ids needed to encode a decision -// the tree topology described by the decision tree template 'dtt' is used for the tree structure -struct DecisionTree -{ - DecisionTree( const DecisionTreeTemplate& _dtt ); - - const DecisionTreeTemplate &dtt; - bool isAvail[MAX_NODES_DECISION_TREE]; - unsigned ctxId [MAX_NODES_DECISION_TREE]; - - // if an end-node is not available, some coding bins can be skipped - availability of the end-nodes can be set using this function - void setAvail( unsigned id, bool _isAvail ); - // for decision nodes, the context for decision encoding can be set here. don't set any context to code as a EP bin - void setCtxId( unsigned id, unsigned _ctxId ); - // propagate the end-nodes availability across decision nodes (call with default parameters for correct results) - void reduce ( unsigned offset = 0, int depth = -1 ); -}; - -struct DecisionTreeBuilder; - -// use this function to easily create decision trees from the output of decision(...) functions (allows for nice human-readable form) -DecisionTreeTemplate compile( DecisionTreeBuilder *dtb ); - -// parameter naming -// id: name of the node -// id0: name of a direct outcome for the '0'-case -// id1: name of a direct outcome for the '1'-case - -// a simple decision node with two direct outcomes -DecisionTreeBuilder* decision( unsigned id, unsigned id0, unsigned id1 ); -// a decision node with decision sub-tree on the left side (the '0'-case) and a direct outcome on the right (the '1'-case) -DecisionTreeBuilder* decision( unsigned id, DecisionTreeBuilder* sub0, unsigned id1 ); -// a decision node with direct outcome on the left side and a decision sub-tree on the right -DecisionTreeBuilder* decision( unsigned id, DecisionTreeBuilder* sub0, DecisionTreeBuilder* sub1 ); -// a decision with two decision sub-trees -DecisionTreeBuilder* decision( unsigned id, unsigned id0, DecisionTreeBuilder* sub1 ); - -#endif - -#endif diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 3ff5425987ce52d483708900f5067188517d3e86..a773bd30664c756d70014d295fbfdc7e9a0dc726 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -91,30 +91,19 @@ void addBIOAvgCore(const Pel* src0, int src0Stride, const Pel* src1, int src1Str } } -#if JVET_M0063_BDOF_FIX void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth) -#else -void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY) -#endif { Pel* srcTmp = pSrc + srcStride + 1; Pel* gradXTmp = gradX + gradStride + 1; Pel* gradYTmp = gradY + gradStride + 1; -#if JVET_M0063_BDOF_FIX int shift1 = std::max<int>(2, (IF_INTERNAL_PREC - bitDepth)); -#endif for (int y = 0; y < (height - 2 * BIO_EXTEND_SIZE); y++) { for (int x = 0; x < (width - 2 * BIO_EXTEND_SIZE); x++) { -#if JVET_M0063_BDOF_FIX gradYTmp[x] = (srcTmp[x + srcStride] - srcTmp[x - srcStride]) >> shift1; gradXTmp[x] = (srcTmp[x + 1] - srcTmp[x - 1]) >> shift1; -#else - gradYTmp[x] = (srcTmp[x + srcStride] - srcTmp[x - srcStride]) >> 4; - gradXTmp[x] = (srcTmp[x + 1] - srcTmp[x - 1]) >> 4; -#endif } gradXTmp += gradStride; gradYTmp += gradStride; @@ -142,29 +131,17 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr ::memcpy(gradYTmp + (height - 2 * BIO_EXTEND_SIZE)*gradStride, gradYTmp + (height - 2 * BIO_EXTEND_SIZE - 1)*gradStride, sizeof(Pel)*(width)); } -#if JVET_M0063_BDOF_FIX void calcBIOParCore(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, const int bitDepth) -#else -void calcBIOParCore(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG) -#endif { -#if JVET_M0063_BDOF_FIX int shift4 = std::min<int>(8, (bitDepth - 4)); int shift5 = std::min<int>(5, (bitDepth - 7)); -#endif for (int y = 0; y < heightG; y++) { for (int x = 0; x < widthG; x++) { -#if JVET_M0063_BDOF_FIX int temp = (srcY0Temp[x] >> shift4) - (srcY1Temp[x] >> shift4); int tempX = (gradX0[x] + gradX1[x]) >> shift5; int tempY = (gradY0[x] + gradY1[x]) >> shift5; -#else - int temp = (srcY0Temp[x] >> 6) - (srcY1Temp[x] >> 6); - int tempX = (gradX0[x] + gradX1[x]) >> 3; - int tempY = (gradY0[x] + gradY1[x]) >> 3; -#endif dotProductTemp1[x] = tempX * tempX; dotProductTemp2[x] = tempX * tempY; dotProductTemp3[x] = -tempX * temp; @@ -299,10 +276,8 @@ PelBufferOps::PelBufferOps() calcBIOPar = calcBIOParCore; calcBlkGradient = calcBlkGradientCore; -#if JVET_M0147_DMVR copyBuffer = copyBufferCore; padding = paddingCore; -#endif #if ENABLE_SIMD_OPT_GBI removeWeightHighFreq8 = removeWeightHighFreq; removeWeightHighFreq4 = removeWeightHighFreq; @@ -317,7 +292,6 @@ PelBufferOps g_pelBufOP = PelBufferOps(); #endif #endif -#if JVET_M0147_DMVR void copyBufferCore(Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height) { int numBytes = width * sizeof(Pel); @@ -352,7 +326,6 @@ void paddingCore(Pel *ptr, int stride, int width, int height, int padSize) memcpy(ptrTemp2 + (i * stride), (ptrTemp2), numBytes); } } -#endif template<> void AreaBuf<Pel>::addWeightedAvg(const AreaBuf<const Pel> &other1, const AreaBuf<const Pel> &other2, const ClpRng& clpRng, const int8_t gbiIdx) { @@ -383,20 +356,11 @@ void AreaBuf<Pel>::addWeightedAvg(const AreaBuf<const Pel> &other1, const AreaBu #undef ADD_AVG_INC } -#if JVET_M0427_INLOOP_RESHAPER template<> void AreaBuf<Pel>::rspSignal(std::vector<Pel>& pLUT) { Pel* dst = buf; Pel* src = buf; -#if !JVET_M0102_INTRA_SUBPARTITIONS - if (width == 1) - { - THROW("Blocks of width = 1 not supported"); - } - else - { -#endif for (unsigned y = 0; y < height; y++) { for (unsigned x = 0; x < width; x++) @@ -406,9 +370,6 @@ void AreaBuf<Pel>::rspSignal(std::vector<Pel>& pLUT) dst += stride; src += stride; } -#if !JVET_M0102_INTRA_SUBPARTITIONS - } -#endif } template<> @@ -460,7 +421,6 @@ void AreaBuf<Pel>::scaleSignal(const int scale, const bool dir, const ClpRng& cl } } } -#endif template<> void AreaBuf<Pel>::addAvg( const AreaBuf<const Pel> &other1, const AreaBuf<const Pel> &other2, const ClpRng& clpRng) diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index 21584dde076f5c2056803e680d6bd1d285ac65a4..4d34cc3d5e873e3854981dec450c733481c40a59 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -69,18 +69,11 @@ struct PelBufferOps void ( *linTf4 ) ( const Pel* src0, int src0Stride, Pel *dst, int dstStride, int width, int height, int scale, int shift, int offset, const ClpRng& clpRng, bool bClip ); void ( *linTf8 ) ( const Pel* src0, int src0Stride, Pel *dst, int dstStride, int width, int height, int scale, int shift, int offset, const ClpRng& clpRng, bool bClip ); void(*addBIOAvg4) (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng); -#if JVET_M0063_BDOF_FIX void(*bioGradFilter) (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth); void(*calcBIOPar) (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, const int bitDepth); -#else - void(*bioGradFilter) (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY); - void(*calcBIOPar) (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG); -#endif void(*calcBlkGradient)(int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); -#if JVET_M0147_DMVR void(*copyBuffer)(Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height); void(*padding)(Pel *dst, int stride, int width, int height, int padSize); -#endif #if ENABLE_SIMD_OPT_GBI void ( *removeWeightHighFreq8) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height, int shift, int gbiWeight); void ( *removeWeightHighFreq4) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height, int shift, int gbiWeight); @@ -95,10 +88,8 @@ extern PelBufferOps g_pelBufOP; #endif -#if JVET_M0147_DMVR void paddingCore(Pel *ptr, int stride, int width, int height, int padSize); void copyBufferCore(Pel *src, int srcStride, Pel *Dst, int dstStride, int width, int height); -#endif template<typename T> struct AreaBuf : public Size @@ -142,10 +133,8 @@ struct AreaBuf : public Size void toLast ( const ClpRng& clpRng ); -#if JVET_M0427_INLOOP_RESHAPER void rspSignal ( std::vector<Pel>& pLUT ); void scaleSignal ( const int scale, const bool dir , const ClpRng& clpRng); -#endif T computeAvg ( ) const; T& at( const int &x, const int &y ) { return buf[y * stride + x]; } @@ -634,14 +623,6 @@ void AreaBuf<T>::transposedFrom( const AreaBuf<const T> &other ) template<typename T> T AreaBuf <T> ::computeAvg() const { -#if !JVET_M0102_INTRA_SUBPARTITIONS - if (width == 1) - { - THROW("Blocks of width = 1 not supported"); - } - else - { -#endif const T* src = buf; #if ENABLE_QPA int64_t acc = 0; // for picture-wise use in getGlaringColorQPOffset() and applyQPAdaptationChroma() @@ -654,9 +635,6 @@ T AreaBuf <T> ::computeAvg() const #undef AVG_INC #undef AVG_OP return T ((acc + (area() >> 1)) / area()); -#if !JVET_M0102_INTRA_SUBPARTITIONS - } -#endif } #ifndef DONT_UNDEF_SIZE_AWARE_PER_EL_OP diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h index b35013ca264fc26fa1d29d526bea4048c2ebd919..1a47050e37f336b7209d64809ef3940f6111d3c0 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -68,21 +68,15 @@ enum CodingStatisticsType STATS__CABAC_BITS__MVD_EP, STATS__CABAC_BITS__AFFINE_FLAG, STATS__CABAC_BITS__AFFINE_TYPE, -#if JVET_M0102_INTRA_SUBPARTITIONS STATS__CABAC_BITS__ISP_MODE_FLAG, STATS__CABAC_BITS__ISP_SPLIT_FLAG, -#endif STATS__CABAC_BITS__TRANSFORM_SUBDIV_FLAG, STATS__CABAC_BITS__QT_ROOT_CBF, STATS__CABAC_BITS__DELTA_QP_EP, STATS__CABAC_BITS__CHROMA_QP_ADJUSTMENT, STATS__CABAC_BITS__QT_CBF, STATS__CABAC_BITS__CROSS_COMPONENT_PREDICTION, -#if JVET_M0464_UNI_MTS STATS__CABAC_BITS__MTS_FLAGS, -#else - STATS__CABAC_BITS__TRANSFORM_SKIP_FLAGS, -#endif STATS__CABAC_BITS__LAST_SIG_X_Y, STATS__CABAC_BITS__SIG_COEFF_GROUP_FLAG, STATS__CABAC_BITS__SIG_COEFF_MAP_FLAG, @@ -107,20 +101,12 @@ enum CodingStatisticsType STATS__CABAC_BITS__INVALID, STATS__CABAC_BITS__IMV_FLAG, STATS__CABAC_BITS__GBI_IDX, -#if !JVET_M0464_UNI_MTS - STATS__CABAC_BITS__EMT_CU_FLAG, - STATS__CABAC_BITS__EMT_TU_INDEX, -#endif -#if JVET_M0140_SBT STATS__CABAC_BITS__SBT_MODE, -#endif STATS__CABAC_BITS__MH_INTRA_FLAG, STATS__CABAC_BITS__TRIANGLE_FLAG, STATS__CABAC_BITS__TRIANGLE_INDEX, STATS__CABAC_BITS__MULTI_REF_LINE, -#if JVET_M0444_SMVD STATS__CABAC_BITS__SYMMVD_FLAG, -#endif STATS__TOOL_TOTAL_FRAME,// This is a special case and is not included in the report. STATS__TOOL_AFF, STATS__TOOL_EMT, @@ -163,21 +149,15 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__MVD_EP", "CABAC_BITS__AFFINE_FLAG", "CABAC_BITS__AFFINE_TYPE", -#if JVET_M0102_INTRA_SUBPARTITIONS "CABAC_BITS__ISP_MODE_FLAG", "CABAC_BITS__ISP_SPLIT_FLAG", -#endif "CABAC_BITS__TRANSFORM_SUBDIV_FLAG", "CABAC_BITS__QT_ROOT_CBF", "CABAC_BITS__DELTA_QP_EP", "CABAC_BITS__CHROMA_QP_ADJUSTMENT", "CABAC_BITS__QT_CBF", "CABAC_BITS__CROSS_COMPONENT_PREDICTION", -#if JVET_M0464_UNI_MTS "CABAC_BITS__MTS_FLAGS", -#else - "CABAC_BITS__TRANSFORM_SKIP_FLAGS", -#endif "CABAC_BITS__LAST_SIG_X_Y", "CABAC_BITS__SIG_COEFF_GROUP_FLAG", "CABAC_BITS__SIG_COEFF_MAP_FLAG", @@ -202,20 +182,12 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__INVALID", "CABAC_BITS__IMV_FLAG", "CABAC_BITS__GBI_IDX", -#if !JVET_M0464_UNI_MTS - "CABAC_BITS__EMT_CU_FLAG", - "CABAC_BITS__EMT_TU_INDX", -#endif -#if JVET_M0140_SBT "CABAC_BITS__SBT_MODE", -#endif "CABAC_BITS__MH_INTRA_FLAG", "CABAC_BITS__TRIANGLE_FLAG", "CABAC_BITS__TRIANGLE_INDEX", "CABAC_BITS__MULTI_REF_LINE", -#if JVET_M0444_SMVD "CABAC_BITS__SYMMVD_FLAG", -#endif "TOOL_FRAME", "TOOL_AFFINE", "TOOL_EMT", diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 6f57c13a54bd0fc9cbea6147aaf2a53455f2dfad..d45ca4e86b9575af64fe7806abd2d7738d985259 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -62,9 +62,7 @@ CodingStructure::CodingStructure(CUCache& cuCache, PUCache& puCache, TUCache& tu : area () , picture ( nullptr ) , parent ( nullptr ) -#if JVET_M0246_AFFINE_AMVR , bestCS ( nullptr ) -#endif , m_isTuEnc ( false ) , m_cuCache ( cuCache ) , m_puCache ( puCache ) @@ -259,11 +257,7 @@ const PredictionUnit * CodingStructure::getPU( const Position &pos, const Channe } } -#if JVET_M0102_INTRA_SUBPARTITIONS TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType effChType, const int subTuIdx ) -#else -TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType effChType ) -#endif { const CompArea &_blk = area.blocks[effChType]; @@ -276,7 +270,6 @@ TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType ef { const unsigned idx = m_tuIdx[effChType][rsAddr( pos, _blk.pos(), _blk.width, unitScale[effChType] )]; -#if JVET_M0102_INTRA_SUBPARTITIONS if( idx != 0 ) { unsigned extraIdx = 0; @@ -302,19 +295,12 @@ TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType ef } return tus[idx - 1 + extraIdx]; } -#else - if( idx != 0 ) return tus[ idx - 1 ]; -#endif else if( m_isTuEnc ) return parent->getTU( pos, effChType ); else return nullptr; } } -#if JVET_M0102_INTRA_SUBPARTITIONS const TransformUnit * CodingStructure::getTU( const Position &pos, const ChannelType effChType, const int subTuIdx ) const -#else -const TransformUnit * CodingStructure::getTU( const Position &pos, const ChannelType effChType ) const -#endif { const CompArea &_blk = area.blocks[effChType]; @@ -326,7 +312,6 @@ const TransformUnit * CodingStructure::getTU( const Position &pos, const Channel else { const unsigned idx = m_tuIdx[effChType][rsAddr( pos, _blk.pos(), _blk.width, unitScale[effChType] )]; -#if JVET_M0102_INTRA_SUBPARTITIONS if( idx != 0 ) { unsigned extraIdx = 0; @@ -351,9 +336,6 @@ const TransformUnit * CodingStructure::getTU( const Position &pos, const Channel } return tus[idx - 1 + extraIdx]; } -#else - if( idx != 0 ) return tus[idx - 1]; -#endif else if( m_isTuEnc ) return parent->getTU( pos, effChType ); else return nullptr; } @@ -480,9 +462,7 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c tu->UnitArea::operator=( unit ); tu->initData(); tu->next = nullptr; -#if JVET_M0102_INTRA_SUBPARTITIONS tu->prev = nullptr; -#endif tu->cs = this; tu->cu = m_isTuEnc ? cus[0] : getCU( unit.blocks[chType].pos(), chType ); tu->chType = chType; @@ -498,9 +478,7 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c if( prevTU && prevTU->cu == tu->cu ) { prevTU->next = tu; -#if JVET_M0102_INTRA_SUBPARTITIONS tu->prev = prevTU; -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM CHECK( prevTU->cacheId != tu->cacheId, "Inconsintent cacheId between previous and current TU" ); @@ -538,7 +516,6 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c const CompArea &_selfBlk = area.blocks[i]; const CompArea &_blk = tu-> blocks[i]; -#if JVET_M0102_INTRA_SUBPARTITIONS bool isIspTu = tu->cu != nullptr && tu->cu->ispMode && isLuma( _blk.compID ); bool isFirstIspTu = false; @@ -547,16 +524,11 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c isFirstIspTu = CU::isISPFirst( *tu->cu, _blk, getFirstComponentOfChannel( ChannelType( i ) ) ); } if( !isIspTu || isFirstIspTu ) -#endif { const UnitScale& scale = unitScale[_blk.compID]; const Area scaledSelf = scale.scale( _selfBlk ); -#if JVET_M0102_INTRA_SUBPARTITIONS const Area scaledBlk = isIspTu ? scale.scale( tu->cu->blocks[i] ) : scale.scale( _blk ); -#else - const Area scaledBlk = scale.scale( _blk ); -#endif unsigned *idxPtr = m_tuIdx[i] + rsAddr( scaledBlk.pos(), scaledSelf.pos(), scaledSelf.width ); CHECK( *idxPtr, "Overwriting a pre-existing value, should be '0'!" ); AreaBuf<uint32_t>( idxPtr, scaledSelf.width, scaledBlk.size() ).fill( idx ); @@ -776,10 +748,8 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe { CHECK( this == &subStruct, "Trying to init self as sub-structure" ); -#if JVET_M0428_ENC_DB_OPT subStruct.useDbCost = false; subStruct.costDbOffset = 0; -#endif for( uint32_t i = 0; i < subStruct.area.blocks.size(); i++ ) { @@ -802,9 +772,7 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe subStruct.vps = vps; #endif subStruct.pps = pps; -#if JVET_M0132_APS subStruct.aps = aps; -#endif subStruct.slice = slice; subStruct.baseQP = baseQP; subStruct.prevQP[_chType] @@ -866,11 +834,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C if( cpyResi ) picture->getResiBuf( clippedArea ).copyFrom( subResiBuf ); if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf ); -#if JVET_M0483_IBC if (!subStruct.m_isTuEnc && ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && chType != CHANNEL_TYPE_CHROMA)) -#else - if (!subStruct.m_isTuEnc && (!slice->isIntra() && chType != CHANNEL_TYPE_CHROMA)) -#endif { // copy motion buffer MotionBuf ownMB = getMotionBuf ( clippedArea ); @@ -889,9 +853,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C fracBits += subStruct.fracBits; dist += subStruct.dist; cost += subStruct.cost; -#if JVET_M0428_ENC_DB_OPT costDbOffset += subStruct.costDbOffset; -#endif if( parent ) { // allow this to be false at the top level @@ -955,9 +917,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C fracBits += subStruct.fracBits; dist += subStruct.dist; cost += subStruct.cost; -#if JVET_M0428_ENC_DB_OPT costDbOffset += subStruct.costDbOffset; -#endif if( parent ) { // allow this to be false at the top level @@ -1019,9 +979,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel fracBits = other.fracBits; dist = other.dist; cost = other.cost; -#if JVET_M0428_ENC_DB_OPT costDbOffset = other.costDbOffset; -#endif CHECKD( area != other.area, "Incompatible sizes" ); const UnitArea dualITreeArea = CS::getArea( *this, this->area, chType ); @@ -1058,11 +1016,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel pu = *ppu; } -#if JVET_M0483_IBC if (!other.slice->isIntra() || other.slice->getSPS()->getIBCFlag()) -#else - if( !other.slice->isIntra() ) -#endif { // copy motion buffer MotionBuf ownMB = getMotionBuf(); @@ -1104,7 +1058,6 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel // copy data to picture picture->getRecoBuf( area ).copyFrom( recoBuf ); -#if JVET_M0427_INLOOP_RESHAPER if (other.pcv->isEncoder) { CPelUnitBuf predBuf = other.getPredBuf(area); @@ -1114,8 +1067,6 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel } picture->getPredBuf(area).copyFrom(predBuf); } -#endif -#if JVET_M0055_DEBUG_CTU // required for DebugCTU int numCh = ::getNumberValidChannels( area.chromaFormat ); @@ -1125,7 +1076,6 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel memcpy( m_isDecomp[i], other.m_isDecomp[i], sizeof( *m_isDecomp[0] ) * _area ); } -#endif } } @@ -1141,11 +1091,7 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons isLossless = _isLosses; } -#if JVET_M0483_IBC if (!skipMotBuf && (!parent || ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && !m_isTuEnc))) -#else - if( !skipMotBuf && ( !parent || ( ( slice->getSliceType() != I_SLICE ) && !m_isTuEnc ) ) ) -#endif { getMotionBuf() .memset( 0 ); } @@ -1153,13 +1099,9 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons fracBits = 0; dist = 0; cost = MAX_DOUBLE; -#if JVET_M0102_INTRA_SUBPARTITIONS lumaCost = MAX_DOUBLE; -#endif -#if JVET_M0428_ENC_DB_OPT costDbOffset = 0; useDbCost = false; -#endif interHad = std::numeric_limits<Distortion>::max(); } diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index 5846477d8d44e14c0009e94f70687474fe937f85..99556f67dccb85c6a7167cac72e6fb1c3e162d34 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -53,9 +53,7 @@ enum PictureType { PIC_RECONSTRUCTION = 0, PIC_ORIGINAL, -#if JVET_M0427_INLOOP_RESHAPER PIC_TRUE_ORIGINAL, -#endif PIC_PREDICTION, PIC_RESIDUAL, PIC_ORG_RESI, @@ -82,9 +80,7 @@ public: Picture *picture; CodingStructure *parent; -#if JVET_M0246_AFFINE_AMVR CodingStructure *bestCS; -#endif Slice *slice; UnitScale unitScale[MAX_NUM_COMPONENT]; @@ -94,16 +90,12 @@ public: int prevQP[MAX_NUM_CHANNEL_TYPE]; int currQP[MAX_NUM_CHANNEL_TYPE]; int chromaQpAdj; -#if JVET_M0170_MRG_SHARELIST Position sharedBndPos; Size sharedBndSize; -#endif bool isLossless; const SPS *sps; const PPS *pps; -#if JVET_M0132_APS APS * aps; -#endif #if HEVC_VPS const VPS *vps; #endif @@ -132,19 +124,11 @@ public: const CodingUnit *getCU(const Position &pos, const ChannelType _chType) const; const PredictionUnit *getPU(const Position &pos, const ChannelType _chType) const; -#if JVET_M0102_INTRA_SUBPARTITIONS const TransformUnit *getTU(const Position &pos, const ChannelType _chType, const int subTuIdx = -1) const; -#else - const TransformUnit *getTU(const Position &pos, const ChannelType _chType) const; -#endif CodingUnit *getCU(const Position &pos, const ChannelType _chType); PredictionUnit *getPU(const Position &pos, const ChannelType _chType); -#if JVET_M0102_INTRA_SUBPARTITIONS TransformUnit *getTU(const Position &pos, const ChannelType _chType, const int subTuIdx = -1); -#else - TransformUnit *getTU(const Position &pos, const ChannelType _chType); -#endif const CodingUnit *getCU(const ChannelType &_chType) const { return getCU(area.blocks[_chType].pos(), _chType); } const PredictionUnit *getPU(const ChannelType &_chType) const { return getPU(area.blocks[_chType].pos(), _chType); } @@ -182,13 +166,9 @@ public: static_vector<double, NUM_ENC_FEATURES> features; double cost; -#if JVET_M0428_ENC_DB_OPT bool useDbCost; double costDbOffset; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS double lumaCost; -#endif uint64_t fracBits; Distortion dist; Distortion interHad; diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index b6c92dc11ccedeedca3376f62810b99b7b2fee93..6d37b49542cebf6ca0ff73f6b19249b37067d5fb 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -176,11 +176,7 @@ static const int MAXIMUM_INTRA_FILTERED_HEIGHT = 16; static const int MAX_CPB_CNT = 32; ///< Upper bound of (cpb_cnt_minus1 + 1) static const int MAX_NUM_LAYER_IDS = 64; -#if JVET_M0470 static const int COEF_REMAIN_BIN_REDUCTION = 5; ///< indicates the level at which the VLC transitions from Golomb-Rice to TU+EG(k) -#else -static const int COEF_REMAIN_BIN_REDUCTION = 3; ///< indicates the level at which the VLC transitions from Golomb-Rice to TU+EG(k) -#endif static const int CU_DQP_TU_CMAX = 5; ///< max number bins for truncated unary static const int CU_DQP_EG_k = 0; ///< expgolomb order @@ -192,9 +188,7 @@ static const int C2FLAG_NUMBER = 1; ///< maxi static const int MAX_NUM_VPS = 16; static const int MAX_NUM_SPS = 16; static const int MAX_NUM_PPS = 64; -#if JVET_M0132_APS static const int MAX_NUM_APS = 32; //Currently APS ID has 5 bits -#endif static const int MLS_GRP_NUM = 1024; ///< Max number of coefficient groups, max(16, 256) @@ -230,14 +224,9 @@ static const int DM_CHROMA_IDX = NUM_INTRA_MODE; ///< chro static const uint8_t INTER_MODE_IDX = 255; ///< index for inter modes -#if JVET_M0464_UNI_MTS static const uint32_t NUM_TRAFO_MODES_MTS = 6; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128 static const uint32_t MTS_INTRA_MAX_CU_SIZE = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128 static const uint32_t MTS_INTER_MAX_CU_SIZE = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128 -#else -static const uint32_t EMT_INTRA_MAX_CU_WITH_QTBT = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128 -static const uint32_t EMT_INTER_MAX_CU_WITH_QTBT = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128 -#endif static const int NUM_MOST_PROBABLE_MODES = 6; static const int LM_SYMBOL_NUM = (1 + NUM_LMC_MODE); @@ -341,17 +330,12 @@ static const int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS = 8 ; static const uint32_t LUMA_LEVEL_TO_DQP_LUT_MAXSIZE = 1024; ///< max LUT size for QP offset based on luma #endif -#if !JVET_M0464_UNI_MTS -static const int NUM_EMT_CU_FLAG_CTX = 6; ///< number of context models for EMT CU-level flag -#endif -#if JVET_M0147_DMVR static const int DMVR_SUBCU_WIDTH = 16; static const int DMVR_SUBCU_HEIGHT = 16; static const int DMVR_SUBCU_WIDTH_LOG2 = 4; static const int DMVR_SUBCU_HEIGHT_LOG2 = 4; static const int MAX_NUM_SUBCU_DMVR = ((MAX_CU_SIZE * MAX_CU_SIZE) >> (DMVR_SUBCU_WIDTH_LOG2 + DMVR_SUBCU_HEIGHT_LOG2)); static const int DMVR_NUM_ITERATION = 2; -#endif //QTBT high level parameters //for I slice luma CTB configuration para. @@ -418,11 +402,9 @@ static const int TRIANGLE_MAX_NUM_CANDS = 40; static const int TRIANGLE_MAX_NUM_SATD_CANDS = 3; static const int TRIANGLE_MIN_SIZE = 8 * 8; -#if JVET_M0140_SBT static const int SBT_MAX_SIZE = 64; ///< maximum CU size for using SBT static const int SBT_NUM_SL = 10; ///< maximum number of historical PU decision saved for a CU static const int SBT_NUM_RDO = 2; ///< maximum number of SBT mode tried for a PU -#endif static const int IBC_MAX_CAND_SIZE = 16; // max block size for ibc search static const int IBC_NUM_CANDIDATES = 64; ///< Maximum number of candidates to store/test @@ -430,19 +412,15 @@ static const int CHROMA_REFINEMENT_CANDIDATES = 8; /// 8 candidates BV to choose static const int IBC_FAST_METHOD_NOINTRA_IBCCBF0 = 0x01; static const int IBC_FAST_METHOD_BUFFERBV = 0X02; static const int IBC_FAST_METHOD_ADAPTIVE_SEARCHRANGE = 0X04; -#if JVET_M0512_MOTION_BUFFER_COMPRESSION static constexpr int MV_EXPONENT_BITCOUNT = 4; static constexpr int MV_MANTISSA_BITCOUNT = 6; static constexpr int MV_MANTISSA_UPPER_LIMIT = ((1 << (MV_MANTISSA_BITCOUNT - 1)) - 1); static constexpr int MV_MANTISSA_LIMIT = (1 << (MV_MANTISSA_BITCOUNT - 1)); static constexpr int MV_EXPONENT_MASK = ((1 << MV_EXPONENT_BITCOUNT) - 1); -#endif -#if JVET_M0427_INLOOP_RESHAPER static const int PIC_ANALYZE_CW_BINS = 32; static const int PIC_CODE_CW_BINS = 16; static const int FP_PREC = 14; static const int CSCALE_FP_PREC = 11; -#endif // ==================================================================================================================== // Macro functions // ==================================================================================================================== diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index a14e13144479779cb93676cc55c220a82c5552e8..823198497933bde7453070e5204c3111785777d0 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -50,21 +50,11 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp , m_chType (toChannelType(m_compID)) , m_width (tu.block(m_compID).width) , m_height (tu.block(m_compID).height) -#if JVET_M0102_INTRA_SUBPARTITIONS , m_log2CGWidth ( g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0] ) , m_log2CGHeight ( g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1] ) -#else - , m_log2CGWidth ((m_width & 3) || (m_height & 3) ? 1 : 2) - , m_log2CGHeight ((m_width & 3) || (m_height & 3) ? 1 : 2) -#endif , m_log2CGSize (m_log2CGWidth + m_log2CGHeight) -#if JVET_M0257 , m_widthInGroups(std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) >> m_log2CGWidth) , m_heightInGroups(std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_height) >> m_log2CGHeight) -#else - , m_widthInGroups(m_width >> m_log2CGWidth) - , m_heightInGroups(m_height >> m_log2CGHeight) -#endif , m_log2BlockWidth (g_aucLog2[m_width]) , m_log2BlockHeight (g_aucLog2[m_height]) , m_maxNumCoeff (m_width * m_height) @@ -78,31 +68,17 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp #else , m_scanType (SCAN_DIAG) #endif -#if JVET_M0102_INTRA_SUBPARTITIONS , m_scan (g_scanOrder [m_chType][SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )]) , m_scanCG (g_scanOrder [m_chType][SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)]) -#else - , m_scan (g_scanOrder [SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )]) - , m_scanCG (g_scanOrder[SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)]) -#endif , m_CtxSetLastX (Ctx::LastX[m_chType]) , m_CtxSetLastY (Ctx::LastY[m_chType]) -#if JVET_M0257 , m_maxLastPosX(g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) - 1]) , m_maxLastPosY(g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_height) - 1]) -#else - , m_maxLastPosX(g_uiGroupIdx[m_width - 1]) - , m_maxLastPosY(g_uiGroupIdx[m_height - 1]) -#endif , m_lastOffsetX (0) , m_lastOffsetY (0) , m_lastShiftX (0) , m_lastShiftY (0) -#if JVET_M0464_UNI_MTS , m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.mtsIdx==1)) -#else - , m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.transformSkip[m_compID])) -#endif , m_scanPosLast (-1) , m_subSetId (-1) , m_subSetPos (-1) @@ -117,9 +93,6 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp , m_parFlagCtxSet ( Ctx::ParFlag[m_chType] ) , m_gtxFlagCtxSet { Ctx::GtxFlag[m_chType], Ctx::GtxFlag[m_chType+2] } , m_sigCoeffGroupFlag () -#if !JVET_M0464_UNI_MTS - , m_emtNumSigCoeff (0) -#endif { // LOGTODO unsigned log2sizeX = m_log2BlockWidth; @@ -174,7 +147,6 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag ) -#if JVET_M0421_SPLIT_SIG void DeriveCtx::CtxSplit( const CodingStructure& cs, Partitioner& partitioner, unsigned& ctxSpl, unsigned& ctxQt, unsigned& ctxHv, unsigned& ctxHorBt, unsigned& ctxVerBt, bool* _canSplit /*= nullptr */ ) { const Position pos = partitioner.currArea().blocks[partitioner.chType]; @@ -282,56 +254,13 @@ void DeriveCtx::CtxSplit( const CodingStructure& cs, Partitioner& partitioner, u ctxHorBt = ( partitioner.currMtDepth <= 1 ? 1 : 0 ); ctxVerBt = ( partitioner.currMtDepth <= 1 ? 3 : 2 ); } -#else -unsigned DeriveCtx::CtxCUsplit( const CodingStructure& cs, Partitioner& partitioner ) -{ - auto adPartitioner = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ); - if( !adPartitioner ) - { - return 0; - } - - const Position pos = partitioner.currArea().blocks[partitioner.chType]; - const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx(); -#if HEVC_TILES_WPP - const unsigned curTileIdx = cs.picture->tileMap->getTileIdxMap( partitioner.currArea().lumaPos() ); -#endif - unsigned ctxId = 0; - - // get left depth -#if HEVC_TILES_WPP - const CodingUnit* cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), curSliceIdx, curTileIdx, partitioner.chType ); -#else - const CodingUnit* cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), curSliceIdx, partitioner.chType ); -#endif - ctxId = ( cuLeft && cuLeft->qtDepth > partitioner.currQtDepth ) ? 1 : 0; - - // get above depth -#if HEVC_TILES_WPP - const CodingUnit* cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), curSliceIdx, curTileIdx, partitioner.chType ); -#else - const CodingUnit* cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), curSliceIdx, partitioner.chType ); -#endif - - ctxId += ( cuAbove && cuAbove->qtDepth > partitioner.currQtDepth ) ? 1 : 0; - ctxId += partitioner.currQtDepth < 2 ? 0 : 3; - - return ctxId; -} -#endif - -#if JVET_M0102_INTRA_SUBPARTITIONS unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf, const int ispIdx ) { if( ispIdx && isLuma( compID ) ) { return 2 + (int)prevCbCbf; } -#else -unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf ) -{ -#endif if( compID == COMPONENT_Cr ) { return ( prevCbCbf ? 1 : 0 ); @@ -397,56 +326,6 @@ unsigned DeriveCtx::CtxIMVFlag( const CodingUnit& cu ) return ctxId; } -#if !JVET_M0421_SPLIT_SIG -unsigned DeriveCtx::CtxBTsplit(const CodingStructure& cs, Partitioner& partitioner) -{ - const Position pos = partitioner.currArea().blocks[partitioner.chType]; - const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx(); -#if HEVC_TILES_WPP - const unsigned curTileIdx = cs.picture->tileMap->getTileIdxMap( pos ); -#endif - - unsigned ctx = 0; - -#if HEVC_TILES_WPP - const CodingUnit *cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), curSliceIdx, curTileIdx, partitioner.chType ); - const CodingUnit *cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), curSliceIdx, curTileIdx, partitioner.chType ); -#else - const CodingUnit *cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), curSliceIdx, partitioner.chType ); - const CodingUnit *cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), curSliceIdx, partitioner.chType ); -#endif - - { - unsigned widthCurr = partitioner.currArea().blocks[partitioner.chType].width; - unsigned heightCurr = partitioner.currArea().blocks[partitioner.chType].height; - if( cuLeft ) - { - unsigned heightLeft = cuLeft->blocks[partitioner.chType].height; - ctx += ( heightLeft < heightCurr ? 1 : 0 ); - } - if( cuAbove ) - { - unsigned widthAbove = cuAbove->blocks[partitioner.chType].width; - ctx += ( widthAbove < widthCurr ? 1 : 0 ); - } - - if( partitioner.chType == CHANNEL_TYPE_CHROMA ) - { - ctx += 9; - } - else - { - int maxBTSize = cs.pcv->getMaxBtSize( *cs.slice, partitioner.chType ); - int th1 = ( maxBTSize == 128 ) ? 128 : ( ( maxBTSize == 64 ) ? 64 : 64 ); - int th2 = ( maxBTSize == 128 ) ? 1024 : ( ( maxBTSize == 64 ) ? 512 : 256 ); - unsigned int sizeCurr = partitioner.currArea().lumaSize().area(); - ctx += sizeCurr > th2 ? 0 : ( sizeCurr > th1 ? 3 : 6 ); - } - } - return ctx; -} - -#endif unsigned DeriveCtx::CtxTriangleFlag( const CodingUnit& cu ) { const CodingStructure *cs = cu.cs; @@ -461,7 +340,6 @@ unsigned DeriveCtx::CtxTriangleFlag( const CodingUnit& cu ) return ctxId; } -#if JVET_M0502_PRED_MODE_CTX unsigned DeriveCtx::CtxPredModeFlag( const CodingUnit& cu ) { const CodingUnit *cuLeft = cu.cs->getCURestricted(cu.lumaPos().offset(-1, 0), cu, CH_L); @@ -471,9 +349,7 @@ unsigned DeriveCtx::CtxPredModeFlag( const CodingUnit& cu ) return ctxId; } -#endif -#if JVET_M0483_IBC unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu) { const CodingStructure *cs = cu.cs; @@ -485,7 +361,6 @@ unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu) ctxId += (cuAbove && CU::isIBC(*cuAbove)) ? 1 : 0; return ctxId; } -#endif void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) { @@ -506,28 +381,15 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) pu.mvpIdx [REF_PIC_LIST_1] = NOT_VALID; pu.mvpNum [REF_PIC_LIST_0] = NOT_VALID; pu.mvpNum [REF_PIC_LIST_1] = NOT_VALID; -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) { pu.bv = pu.mv[REF_PIC_LIST_0]; pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution } -#else - if (interDirNeighbours[candIdx] == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, mvFieldNeighbours[candIdx << 1].refIdx)->getPOC() == pu.cs->slice->getPOC()) - { - pu.cu->ibc = true; - pu.bv = pu.mv[REF_PIC_LIST_0]; - pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution - } -#endif pu.cu->GBiIdx = ( interDirNeighbours[candIdx] == 3 ) ? GBiIdx[candIdx] : GBI_DEFAULT; -#if JVET_M0068_M0171_MMVD_CLEANUP PU::restrictBiPredMergeCandsOne(pu); -#endif -#if JVET_M0823_MMVD_ENCOPT pu.mmvdEncOptMode = 0; -#endif } void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) { @@ -548,15 +410,11 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) tempIdx = tempIdx - fPosBaseIdx * (MMVD_MAX_REFINE_NUM); fPosStep = tempIdx / 4; fPosPosition = tempIdx - fPosStep * (4); -#if JVET_M0255_FRACMMVD_SWITCH int offset = refMvdCands[fPosStep]; if ( pu.cu->slice->getDisFracMMVD() ) { offset <<= 2; } -#else - const int offset = refMvdCands[fPosStep]; -#endif const int refList0 = mmvdBaseMv[fPosBaseIdx][0].refIdx; const int refList1 = mmvdBaseMv[fPosBaseIdx][1].refIdx; @@ -565,78 +423,36 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) const int poc0 = slice.getRefPOC(REF_PIC_LIST_0, refList0); const int poc1 = slice.getRefPOC(REF_PIC_LIST_1, refList1); const int currPoc = slice.getPOC(); -#if !JVET_M0068_M0171_MMVD_CLEANUP - int refSign = 1; - - if ((poc0 - currPoc) * (currPoc - poc1) > 0) - { - refSign = -1; - } -#endif if (fPosPosition == 0) { tempMv[0] = Mv(offset, 0); -#if !JVET_M0068_M0171_MMVD_CLEANUP - tempMv[1] = Mv(offset * refSign, 0); -#endif } else if (fPosPosition == 1) { tempMv[0] = Mv(-offset, 0); -#if !JVET_M0068_M0171_MMVD_CLEANUP - tempMv[1] = Mv(-offset * refSign, 0); -#endif } else if (fPosPosition == 2) { tempMv[0] = Mv(0, offset); -#if !JVET_M0068_M0171_MMVD_CLEANUP - tempMv[1] = Mv(0, offset * refSign); -#endif } else { tempMv[0] = Mv(0, -offset); -#if !JVET_M0068_M0171_MMVD_CLEANUP - tempMv[1] = Mv(0, -offset * refSign); -#endif } -#if JVET_M0068_M0171_MMVD_CLEANUP if ((poc0 - currPoc) == (poc1 - currPoc)) { tempMv[1] = tempMv[0]; } else if (abs(poc1 - currPoc) > abs(poc0 - currPoc)) -#else - if (abs(poc1 - currPoc) > abs(poc0 - currPoc)) -#endif { const int scale = PU::getDistScaleFactor(currPoc, poc0, currPoc, poc1); -#if JVET_M0068_M0171_MMVD_CLEANUP tempMv[1] = tempMv[0]; tempMv[0] = tempMv[1].scaleMv(scale); -#else - if (scale != 4096) - { - tempMv[0] = tempMv[0].scaleMv(scale); - } -#endif } -#if JVET_M0068_M0171_MMVD_CLEANUP else -#else - else if (abs(poc1 - currPoc) < abs(poc0 - currPoc)) -#endif { const int scale = PU::getDistScaleFactor(currPoc, poc1, currPoc, poc0); -#if JVET_M0068_M0171_MMVD_CLEANUP tempMv[1] = tempMv[0].scaleMv(scale); -#else - if (scale != 4096) - { - tempMv[1] = tempMv[1].scaleMv(scale); - } -#endif } pu.interDir = 3; @@ -708,7 +524,5 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.cu->GBiIdx = (interDirNeighbours[fPosBaseIdx] == 3) ? GBiIdx[fPosBaseIdx] : GBI_DEFAULT; -#if JVET_M0068_M0171_MMVD_CLEANUP PU::restrictBiPredMergeCandsOne(pu); -#endif } diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index 869a7e0b08e63b396651e48f683d44ddc7502460..ea58093d5ba0b6ec9b246dfa93f22fb8dbc7754a 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -70,10 +70,8 @@ public: int cgPosX () const { return m_subSetPosX; } unsigned width () const { return m_width; } unsigned height () const { return m_height; } -#if JVET_M0297_32PT_MTS_ZERO_OUT unsigned log2CGWidth () const { return m_log2CGWidth; } unsigned log2CGHeight () const { return m_log2CGHeight; } -#endif unsigned log2CGSize () const { return m_log2CGSize; } bool extPrec () const { return m_extendedPrecision; } int maxLog2TrDRange () const { return m_maxLog2TrDynamicRange; } @@ -108,11 +106,7 @@ public: const int diag = posX + posY; int numPos = 0; int sumAbs = 0; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS #define UPDATE(x) {int a=abs(x);sumAbs+=std::min(4+(a&1),a);numPos+=!!a;} -#else -#define UPDATE(x) {int a=abs(x);sumAbs+=std::min(2+(a&1),a);numPos+=!!a;} -#endif if( posX < m_width-1 ) { UPDATE( pData[1] ); @@ -188,10 +182,6 @@ public: return std::min(sum, 31); } -#if !JVET_M0464_UNI_MTS - unsigned emtNumSigCoeff() const { return m_emtNumSigCoeff; } - void setEmtNumSigCoeff( unsigned val ) { m_emtNumSigCoeff = val; } -#endif private: // constant @@ -239,9 +229,6 @@ private: CtxSet m_parFlagCtxSet; CtxSet m_gtxFlagCtxSet[2]; std::bitset<MLS_GRP_NUM> m_sigCoeffGroupFlag; -#if !JVET_M0464_UNI_MTS - unsigned m_emtNumSigCoeff; -#endif }; @@ -249,22 +236,16 @@ class CUCtx { public: CUCtx() : isDQPCoded(false), isChromaQpAdjCoded(false), -#if JVET_M0113_M0188_QG_SIZE qgStart(false), -#endif numNonZeroCoeffNonTs(0) {} CUCtx(int _qp) : isDQPCoded(false), isChromaQpAdjCoded(false), -#if JVET_M0113_M0188_QG_SIZE qgStart(false), -#endif numNonZeroCoeffNonTs(0), qp(_qp) {} ~CUCtx() {} public: bool isDQPCoded; bool isChromaQpAdjCoded; -#if JVET_M0113_M0188_QG_SIZE bool qgStart; -#endif uint32_t numNonZeroCoeffNonTs; int8_t qp; // used as a previous(last) QP and for QP prediction }; @@ -309,28 +290,15 @@ public: namespace DeriveCtx { -#if JVET_M0421_SPLIT_SIG void CtxSplit ( const CodingStructure& cs, Partitioner& partitioner, unsigned& ctxSpl, unsigned& ctxQt, unsigned& ctxHv, unsigned& ctxHorBt, unsigned& ctxVerBt, bool* canSplit = nullptr ); -#else -unsigned CtxCUsplit ( const CodingStructure& cs, Partitioner& partitioner ); -unsigned CtxBTsplit ( const CodingStructure& cs, Partitioner& partitioner ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf = false, const int ispIdx = 0 ); -#else -unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf ); -#endif unsigned CtxInterDir ( const PredictionUnit& pu ); unsigned CtxSkipFlag ( const CodingUnit& cu ); unsigned CtxIMVFlag ( const CodingUnit& cu ); unsigned CtxAffineFlag( const CodingUnit& cu ); unsigned CtxTriangleFlag( const CodingUnit& cu ); -#if JVET_M0502_PRED_MODE_CTX unsigned CtxPredModeFlag( const CodingUnit& cu ); -#endif -#if JVET_M0483_IBC unsigned CtxIBCFlag(const CodingUnit& cu); -#endif } #endif // __CONTEXTMODELLING__ diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 566a85793a3ac598ed6de281b603288309d75662..dedb921d422e4b6c6e0f9be24b40316af664802d 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -41,139 +41,6 @@ #include <cstring> #include <limits> -#if !JVET_M0453_CABAC_ENGINE -const uint8_t ProbModelTables::m_NextState[128][2] = -{ - { 2, 1 },{ 0, 3 },{ 4, 0 },{ 1, 5 },{ 6, 2 },{ 3, 7 },{ 8, 4 },{ 5, 9 }, - { 10, 4 },{ 5, 11 },{ 12, 8 },{ 9, 13 },{ 14, 8 },{ 9, 15 },{ 16, 10 },{ 11, 17 }, - { 18, 12 },{ 13, 19 },{ 20, 14 },{ 15, 21 },{ 22, 16 },{ 17, 23 },{ 24, 18 },{ 19, 25 }, - { 26, 18 },{ 19, 27 },{ 28, 22 },{ 23, 29 },{ 30, 22 },{ 23, 31 },{ 32, 24 },{ 25, 33 }, - { 34, 26 },{ 27, 35 },{ 36, 26 },{ 27, 37 },{ 38, 30 },{ 31, 39 },{ 40, 30 },{ 31, 41 }, - { 42, 32 },{ 33, 43 },{ 44, 32 },{ 33, 45 },{ 46, 36 },{ 37, 47 },{ 48, 36 },{ 37, 49 }, - { 50, 38 },{ 39, 51 },{ 52, 38 },{ 39, 53 },{ 54, 42 },{ 43, 55 },{ 56, 42 },{ 43, 57 }, - { 58, 44 },{ 45, 59 },{ 60, 44 },{ 45, 61 },{ 62, 46 },{ 47, 63 },{ 64, 48 },{ 49, 65 }, - { 66, 48 },{ 49, 67 },{ 68, 50 },{ 51, 69 },{ 70, 52 },{ 53, 71 },{ 72, 52 },{ 53, 73 }, - { 74, 54 },{ 55, 75 },{ 76, 54 },{ 55, 77 },{ 78, 56 },{ 57, 79 },{ 80, 58 },{ 59, 81 }, - { 82, 58 },{ 59, 83 },{ 84, 60 },{ 61, 85 },{ 86, 60 },{ 61, 87 },{ 88, 60 },{ 61, 89 }, - { 90, 62 },{ 63, 91 },{ 92, 64 },{ 65, 93 },{ 94, 64 },{ 65, 95 },{ 96, 66 },{ 67, 97 }, - { 98, 66 },{ 67, 99 },{ 100, 66 },{ 67,101 },{ 102, 68 },{ 69,103 },{ 104, 68 },{ 69,105 }, - { 106, 70 },{ 71,107 },{ 108, 70 },{ 71,109 },{ 110, 70 },{ 71,111 },{ 112, 72 },{ 73,113 }, - { 114, 72 },{ 73,115 },{ 116, 72 },{ 73,117 },{ 118, 74 },{ 75,119 },{ 120, 74 },{ 75,121 }, - { 122, 74 },{ 75,123 },{ 124, 76 },{ 77,125 },{ 124, 76 },{ 77,125 },{ 126,126 },{ 127,127 } -}; - -const uint32_t ProbModelTables::m_EstFracBits[128] = -{ - 0x07b23, 0x085f9, 0x074a0, 0x08cbc, 0x06ee4, 0x09354, 0x067f4, 0x09c1b, 0x060b0, 0x0a62a, 0x05a9c, 0x0af5b, 0x0548d, 0x0b955, 0x04f56, 0x0c2a9, - 0x04a87, 0x0cbf7, 0x045d6, 0x0d5c3, 0x04144, 0x0e01b, 0x03d88, 0x0e937, 0x039e0, 0x0f2cd, 0x03663, 0x0fc9e, 0x03347, 0x10600, 0x03050, 0x10f95, - 0x02d4d, 0x11a02, 0x02ad3, 0x12333, 0x0286e, 0x12cad, 0x02604, 0x136df, 0x02425, 0x13f48, 0x021f4, 0x149c4, 0x0203e, 0x1527b, 0x01e4d, 0x15d00, - 0x01c99, 0x166de, 0x01b18, 0x17017, 0x019a5, 0x17988, 0x01841, 0x18327, 0x016df, 0x18d50, 0x015d9, 0x19547, 0x0147c, 0x1a083, 0x0138e, 0x1a8a3, - 0x01251, 0x1b418, 0x01166, 0x1bd27, 0x01068, 0x1c77b, 0x00f7f, 0x1d18e, 0x00eda, 0x1d91a, 0x00e19, 0x1e254, 0x00d4f, 0x1ec9a, 0x00c90, 0x1f6e0, - 0x00c01, 0x1fef8, 0x00b5f, 0x208b1, 0x00ab6, 0x21362, 0x00a15, 0x21e46, 0x00988, 0x2285d, 0x00934, 0x22ea8, 0x008a8, 0x239b2, 0x0081d, 0x24577, - 0x007c9, 0x24ce6, 0x00763, 0x25663, 0x00710, 0x25e8f, 0x006a0, 0x26a26, 0x00672, 0x26f23, 0x005e8, 0x27ef8, 0x005ba, 0x284b5, 0x0055e, 0x29057, - 0x0050c, 0x29bab, 0x004c1, 0x2a674, 0x004a7, 0x2aa5e, 0x0046f, 0x2b32f, 0x0041f, 0x2c0ad, 0x003e7, 0x2ca8d, 0x003ba, 0x2d323, 0x0010c, 0x3bfbb -}; - -const BinFracBits ProbModelTables::m_BinFracBits_128[128] = -{ - {{0x07b23, 0x085f9}}, {{0x085f9, 0x07b23}}, {{0x074a0, 0x08cbc}}, {{0x08cbc, 0x074a0}}, {{0x06ee4, 0x09354}}, {{0x09354, 0x06ee4}}, {{0x067f4, 0x09c1b}}, {{0x09c1b, 0x067f4}}, - {{0x060b0, 0x0a62a}}, {{0x0a62a, 0x060b0}}, {{0x05a9c, 0x0af5b}}, {{0x0af5b, 0x05a9c}}, {{0x0548d, 0x0b955}}, {{0x0b955, 0x0548d}}, {{0x04f56, 0x0c2a9}}, {{0x0c2a9, 0x04f56}}, - {{0x04a87, 0x0cbf7}}, {{0x0cbf7, 0x04a87}}, {{0x045d6, 0x0d5c3}}, {{0x0d5c3, 0x045d6}}, {{0x04144, 0x0e01b}}, {{0x0e01b, 0x04144}}, {{0x03d88, 0x0e937}}, {{0x0e937, 0x03d88}}, - {{0x039e0, 0x0f2cd}}, {{0x0f2cd, 0x039e0}}, {{0x03663, 0x0fc9e}}, {{0x0fc9e, 0x03663}}, {{0x03347, 0x10600}}, {{0x10600, 0x03347}}, {{0x03050, 0x10f95}}, {{0x10f95, 0x03050}}, - {{0x02d4d, 0x11a02}}, {{0x11a02, 0x02d4d}}, {{0x02ad3, 0x12333}}, {{0x12333, 0x02ad3}}, {{0x0286e, 0x12cad}}, {{0x12cad, 0x0286e}}, {{0x02604, 0x136df}}, {{0x136df, 0x02604}}, - {{0x02425, 0x13f48}}, {{0x13f48, 0x02425}}, {{0x021f4, 0x149c4}}, {{0x149c4, 0x021f4}}, {{0x0203e, 0x1527b}}, {{0x1527b, 0x0203e}}, {{0x01e4d, 0x15d00}}, {{0x15d00, 0x01e4d}}, - {{0x01c99, 0x166de}}, {{0x166de, 0x01c99}}, {{0x01b18, 0x17017}}, {{0x17017, 0x01b18}}, {{0x019a5, 0x17988}}, {{0x17988, 0x019a5}}, {{0x01841, 0x18327}}, {{0x18327, 0x01841}}, - {{0x016df, 0x18d50}}, {{0x18d50, 0x016df}}, {{0x015d9, 0x19547}}, {{0x19547, 0x015d9}}, {{0x0147c, 0x1a083}}, {{0x1a083, 0x0147c}}, {{0x0138e, 0x1a8a3}}, {{0x1a8a3, 0x0138e}}, - {{0x01251, 0x1b418}}, {{0x1b418, 0x01251}}, {{0x01166, 0x1bd27}}, {{0x1bd27, 0x01166}}, {{0x01068, 0x1c77b}}, {{0x1c77b, 0x01068}}, {{0x00f7f, 0x1d18e}}, {{0x1d18e, 0x00f7f}}, - {{0x00eda, 0x1d91a}}, {{0x1d91a, 0x00eda}}, {{0x00e19, 0x1e254}}, {{0x1e254, 0x00e19}}, {{0x00d4f, 0x1ec9a}}, {{0x1ec9a, 0x00d4f}}, {{0x00c90, 0x1f6e0}}, {{0x1f6e0, 0x00c90}}, - {{0x00c01, 0x1fef8}}, {{0x1fef8, 0x00c01}}, {{0x00b5f, 0x208b1}}, {{0x208b1, 0x00b5f}}, {{0x00ab6, 0x21362}}, {{0x21362, 0x00ab6}}, {{0x00a15, 0x21e46}}, {{0x21e46, 0x00a15}}, - {{0x00988, 0x2285d}}, {{0x2285d, 0x00988}}, {{0x00934, 0x22ea8}}, {{0x22ea8, 0x00934}}, {{0x008a8, 0x239b2}}, {{0x239b2, 0x008a8}}, {{0x0081d, 0x24577}}, {{0x24577, 0x0081d}}, - {{0x007c9, 0x24ce6}}, {{0x24ce6, 0x007c9}}, {{0x00763, 0x25663}}, {{0x25663, 0x00763}}, {{0x00710, 0x25e8f}}, {{0x25e8f, 0x00710}}, {{0x006a0, 0x26a26}}, {{0x26a26, 0x006a0}}, - {{0x00672, 0x26f23}}, {{0x26f23, 0x00672}}, {{0x005e8, 0x27ef8}}, {{0x27ef8, 0x005e8}}, {{0x005ba, 0x284b5}}, {{0x284b5, 0x005ba}}, {{0x0055e, 0x29057}}, {{0x29057, 0x0055e}}, - {{0x0050c, 0x29bab}}, {{0x29bab, 0x0050c}}, {{0x004c1, 0x2a674}}, {{0x2a674, 0x004c1}}, {{0x004a7, 0x2aa5e}}, {{0x2aa5e, 0x004a7}}, {{0x0046f, 0x2b32f}}, {{0x2b32f, 0x0046f}}, - {{0x0041f, 0x2c0ad}}, {{0x2c0ad, 0x0041f}}, {{0x003e7, 0x2ca8d}}, {{0x2ca8d, 0x003e7}}, {{0x003ba, 0x2d323}}, {{0x2d323, 0x003ba}}, {{0x0010c, 0x3bfbb}}, {{0x3bfbb, 0x0010c}} -}; - -const uint32_t ProbModelTables::m_EstFracProb[128] = -{ - 0x041b5, 0x03df6, 0x04410, 0x03bbc, 0x04636, 0x039a3, 0x048e6, 0x036f6, 0x04bd3, 0x0340c, 0x04e5d, 0x03185, 0x050fa, 0x02eeb, 0x0534b, 0x02c9b, - 0x0557e, 0x02a6a, 0x057b1, 0x02839, 0x059e4, 0x02608, 0x05bba, 0x02433, 0x05d8f, 0x0225e, 0x05f58, 0x02097, 0x060f7, 0x01efa, 0x06288, 0x01d69, - 0x06427, 0x01bcb, 0x06581, 0x01a72, 0x066d4, 0x0191f, 0x0682f, 0x017c6, 0x0693e, 0x016b7, 0x06a80, 0x01576, 0x06b7e, 0x01478, 0x06ca1, 0x01356, - 0x06da2, 0x01255, 0x06e88, 0x01170, 0x06f67, 0x01092, 0x0703e, 0x00fba, 0x07116, 0x00ee3, 0x071b7, 0x00e42, 0x0728f, 0x00d6a, 0x07323, 0x00cd6, - 0x073e9, 0x00c11, 0x0747d, 0x00b7d, 0x0751e, 0x00add, 0x075b2, 0x00a49, 0x0761b, 0x009e0, 0x07697, 0x00964, 0x07719, 0x008e2, 0x07794, 0x00867, - 0x077f1, 0x0080b, 0x0785b, 0x007a1, 0x078c9, 0x00733, 0x07932, 0x006ca, 0x0798f, 0x0066d, 0x079c6, 0x00636, 0x07a23, 0x005da, 0x07a7f, 0x0057d, - 0x07ab7, 0x00546, 0x07afb, 0x00502, 0x07b32, 0x004cb, 0x07b7d, 0x00480, 0x07b9c, 0x00461, 0x07bf8, 0x00405, 0x07c17, 0x003e6, 0x07c55, 0x003a9, - 0x07c8c, 0x00371, 0x07cbf, 0x0033f, 0x07cd0, 0x0032e, 0x07cf6, 0x00308, 0x07d2c, 0x002d1, 0x07d52, 0x002ab, 0x07d71, 0x0028c, 0x07f46, 0x000b5 -}; - -const uint8_t ProbModelTables::m_LPSTable_64_4[64][4] = -{ - { 128, 176, 208, 240 }, - { 128, 167, 197, 227 }, - { 128, 158, 187, 216 }, - { 123, 150, 178, 205 }, - { 116, 142, 169, 195 }, - { 111, 135, 160, 185 }, - { 105, 128, 152, 175 }, - { 100, 122, 144, 166 }, - { 95, 116, 137, 158 }, - { 90, 110, 130, 150 }, - { 85, 104, 123, 142 }, - { 81, 99, 117, 135 }, - { 77, 94, 111, 128 }, - { 73, 89, 105, 122 }, - { 69, 85, 100, 116 }, - { 66, 80, 95, 110 }, - { 62, 76, 90, 104 }, - { 59, 72, 86, 99 }, - { 56, 69, 81, 94 }, - { 53, 65, 77, 89 }, - { 51, 62, 73, 85 }, - { 48, 59, 69, 80 }, - { 46, 56, 66, 76 }, - { 43, 53, 63, 72 }, - { 41, 50, 59, 69 }, - { 39, 48, 56, 65 }, - { 37, 45, 54, 62 }, - { 35, 43, 51, 59 }, - { 33, 41, 48, 56 }, - { 32, 39, 46, 53 }, - { 30, 37, 43, 50 }, - { 29, 35, 41, 48 }, - { 27, 33, 39, 45 }, - { 26, 31, 37, 43 }, - { 24, 30, 35, 41 }, - { 23, 28, 33, 39 }, - { 22, 27, 32, 37 }, - { 21, 26, 30, 35 }, - { 20, 24, 29, 33 }, - { 19, 23, 27, 31 }, - { 18, 22, 26, 30 }, - { 17, 21, 25, 28 }, - { 16, 20, 23, 27 }, - { 15, 19, 22, 25 }, - { 14, 18, 21, 24 }, - { 14, 17, 20, 23 }, - { 13, 16, 19, 22 }, - { 12, 15, 18, 21 }, - { 12, 14, 17, 20 }, - { 11, 14, 16, 19 }, - { 11, 13, 15, 18 }, - { 10, 12, 15, 17 }, - { 10, 12, 14, 16 }, - { 9, 11, 13, 15 }, - { 9, 11, 12, 14 }, - { 8, 10, 12, 14 }, - { 8, 9, 11, 13 }, - { 7, 9, 11, 12 }, - { 7, 9, 10, 12 }, - { 7, 8, 10, 11 }, - { 6, 8, 9, 11 }, - { 6, 7, 9, 10 }, - { 6, 7, 8, 9 }, - { 2, 2, 2, 2 } -}; -#endif const uint8_t ProbModelTables::m_RenormTable_32[32] = { @@ -187,7 +54,6 @@ const uint8_t ProbModelTables::m_RenormTable_32[32] = 1, 1, 1, 1 }; -#if JVET_M0453_CABAC_ENGINE const BinFracBits ProbModelTables::m_binFracBits[256] = { { { 0x0005c, 0x48000 } }, { { 0x00116, 0x3b520 } }, { { 0x001d0, 0x356cb } }, { { 0x0028b, 0x318a9 } }, { { 0x00346, 0x2ea40 } }, { { 0x00403, 0x2c531 } }, { { 0x004c0, 0x2a658 } }, { { 0x0057e, 0x28beb } }, @@ -265,27 +131,15 @@ const uint16_t ProbModelTables::m_inistateToCount[128] = { 29676, 29833, 29982, 30124, 30258, 30385, 30506, 30621, 30730, 30834, 30932, 31025, 31114, 31198, 31277, 31353, 31425, 31493, 31558, 31619, 31678, 31733, 31785, 31835, 31883, 31928, 31970, 32011, 32049, 32086, 32120, 32153 }; -#endif void BinProbModel_Std::init( int qp, int initId ) { int slope = ( ( initId >> 4 ) * 5 ) - 45; int offset = ( ( initId & 15 ) << 3 ) - 16; int inistate = ( ( slope * qp ) >> 4 ) + offset; -#if JVET_M0453_CABAC_ENGINE const int p1 = m_inistateToCount[inistate < 0 ? 0 : inistate > 127 ? 127 : inistate]; m_state[0] = p1 & MASK_0; m_state[1] = p1 & MASK_1; -#else - if( inistate >= 64 ) - { - m_State = ( std::min( 62, inistate - 64 ) << 1 ) + 1; - } - else - { - m_State = ( std::min( 62, 63 - inistate ) << 1 ); - } -#endif } @@ -340,46 +194,24 @@ CtxSet ContextSetCfg::addCtxSet( std::initializer_list<std::initializer_list<uin #define CNU 154 // dummy initialization value for unused context models 'Context model Not Used' -#if JVET_M0453_CABAC_ENGINE std::vector<std::vector<uint8_t>> ContextSetCfg::sm_InitTables(NUMBER_OF_SLICE_TYPES + 1); -#else -std::vector<std::vector<uint8_t>> ContextSetCfg::sm_InitTables( NUMBER_OF_SLICE_TYPES ); -#endif // clang-format off const CtxSet ContextSetCfg::SplitFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0421_SPLIT_SIG // |-------- do split ctx -------------------| { 122, 124, 141, 108, 125, 156, 138, 126, 143, }, { 93, 139, 171, 124, 125, 141, 139, 141, 158, }, { 138, 154, 172, 124, 140, 142, 154, 127, 175, }, -#if JVET_M0453_CABAC_ENGINE { 9, 13, 8, 8, 13, 12, 5, 10, 12, }, -#endif -#else -#if JVET_M0453_CABAC_ENGINE - { 107, 110, 127, 106, 123, 140,}, - { 138, 140, 142, 106, 123, 125,}, - { 152, 126, 159, 150, 138, 126,}, - { 8, 8, 12, 12, 12, 9,}, -#else - { 137, 125, 127, 107, 138, 140, }, - { 138, 111, 143, 107, 138, 140, }, - { 138, 141, 158, 151, 124, 126, }, -#endif -#endif }); -#if JVET_M0421_SPLIT_SIG const CtxSet ContextSetCfg::SplitQtFlag = ContextSetCfg::addCtxSet ({ { 138, 140, 142, 136, 138, 140, }, { 139, 126, 142, 107, 138, 125, }, { 139, 125, 127, 136, 153, 126, }, -#if JVET_M0453_CABAC_ENGINE { 0, 8, 8, 12, 12, 8, }, -#endif }); const CtxSet ContextSetCfg::SplitHvFlag = ContextSetCfg::addCtxSet @@ -387,9 +219,7 @@ const CtxSet ContextSetCfg::SplitHvFlag = ContextSetCfg::addCtxSet { 154, 168, 155, 139, 155, }, { 169, 168, 170, 153, 170, }, { 154, 168, 140, 153, 169, }, -#if JVET_M0453_CABAC_ENGINE { 10, 9, 9, 8, 8, }, -#endif }); const CtxSet ContextSetCfg::Split12Flag = ContextSetCfg::addCtxSet @@ -397,192 +227,95 @@ const CtxSet ContextSetCfg::Split12Flag = ContextSetCfg::addCtxSet { 154, 140, 154, 140, }, { 169, 155, 154, 140, }, { 154, 170, 154, 170, }, -#if JVET_M0453_CABAC_ENGINE { 12, 12, 12, 12, }, -#endif -}); -#else -const CtxSet ContextSetCfg::BTSplitFlag = ContextSetCfg::addCtxSet -({ - // |-------- 1st bin, 9 ctx for luma + 3 ctx for chroma------| |--2nd bin--| |3rd bin| -#if JVET_M0453_CABAC_ENGINE - { 137, 125, 141, 123, 125, 141, 78, 124, 140, CNU, CNU, CNU, 169, 155, 154, 140,}, - { 138, 140, 142, 138, 125, 141, 107, 124, 140, CNU, CNU, CNU, 169, 170, 139, 155,}, - { 139, 141, 157, 124, 111, 142, 138, 139, 141, 153, 140, 156, 154, 169, 139, 155,}, - { 4, 9, 9, 9, 9, 9, 8, 12, 8, 9, 13, 13, 5, 8, 8, 13,}, -#else - { 137, 125, 141, 123, 125, 141, 78, 124, 140, CNU, CNU, CNU, 169, 155, 154, 154, }, - { 123, 140, 156, 138, 125, 141, 122, 124, 140, CNU, CNU, CNU, 169, 155, 139, 169, }, - { 139, 141, 157, 139, 155, 142, 153, 125, 141, 154, 154, 154, 154, 154, 154, 140, }, -#endif }); -#endif const CtxSet ContextSetCfg::SkipFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 197, 214, 216, }, { 197, 198, 185, }, { 40, 138, 154, }, { 5, 8, 8, }, -#else - { 183, 185, 186, }, - { 168, 199, 200, }, - { CNU, CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 111, }, { 111, }, { 153, }, { 5, }, -#else - { 125, }, - { 110, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 138, }, { 154, }, { 153, }, { 8, }, -#else - { 167, }, - { 138, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 120, }, { 122, }, { CNU, }, { 8, }, -#else - { 136, }, - { 167, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::MmvdMergeIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 154, }, { 154, }, { CNU, }, { 10, }, -#else - { 154, }, - { 154, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::MmvdStepMvpIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 213, }, { 244, }, { CNU, }, { 1, }, -#else - { 213, }, - { 169, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::PartSize = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { CNU, CNU, CNU, CNU,}, { CNU, CNU, CNU, CNU,}, { CNU, CNU, CNU, CNU,}, { DWS, DWS, DWS, DWS, } -#else - { 154, 139, 154, 154,}, - { 154, 139, 154, 154,}, - { 184, CNU, CNU, CNU,}, -#endif }); const CtxSet ContextSetCfg::PredMode = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE -#if JVET_M0502_PRED_MODE_CTX { 192, 168, }, { 165, 139, }, { CNU, CNU, }, { 5, 2, }, -#else - { 193,}, - { 151,}, - { CNU,}, - { 1,}, -#endif -#else -#if JVET_M0502_PRED_MODE_CTX - { 178, 178, }, - { 194, 194, }, - { CNU, CNU, }, -#else - { 178, }, - { 194, }, - { CNU, }, -#endif -#endif }); const CtxSet ContextSetCfg::MultiRefLineIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 90, 212, CNU, }, { 118, 212, CNU, }, { 119, 169, CNU, }, { 8, 8, DWS, }, -#else - { 151, 183, CNU, }, - { 165, 183, CNU, }, - { 122, 184, CNU, }, -#endif }); const CtxSet ContextSetCfg::IntraLumaMpmFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 154, }, { 154, }, { 170, }, { 6, }, -#else - { 183, }, - { 154, }, - { 156, }, -#endif }); const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 137, 139, 140,}, { 138, 139, 169,}, { 154, 139, 154,}, { 5, 8, 9,}, -#else - { 152, 139, 154,}, - { 138, 139, 169,}, - { 109, 139, 154,}, -#endif }); const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet @@ -590,141 +323,76 @@ const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet { 154, 154, 154,}, { 154, 154, 154,}, { 154, 154, 154,}, -#if JVET_M0453_CABAC_ENGINE { DWS, DWS, DWS, } -#endif }); const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 111, 125, 110, 94, 192, }, { 126, 111, 110, 94, 208, }, { CNU, CNU, CNU, CNU, CNU, }, { 0, 0, 4, 5, 0, }, -#else - { 111, 110, 95, 78, 193, }, - { 126, 111, 95, 93, 194, }, - { CNU, CNU, CNU, CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::RefPic = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 125, 139, }, { 138, 168, }, { CNU, CNU, }, { 4, 5, }, -#else - { 139, 139, }, - { 138, 168, }, - { CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::AffineFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 179, 169, 171, }, { 180, 168, 155, }, { CNU, CNU, CNU, }, { 8, 5, 4, }, -#else - { 196, 184, 171, }, - { 181, 169, 185, }, - { CNU, CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::AffineType = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 138, }, { 153, }, { CNU, }, { 4, }, -#else - { 123, }, - { 138, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::AffMergeIdx = ContextSetCfg::addCtxSet ( { -#if JVET_M0453_CABAC_ENGINE -#if JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX { 109, }, { 95, }, { CNU, }, { 0, }, -#else - { 109, 168, 168, 153, CNU,}, - { 95, 154, 139, 153, CNU,}, - { CNU, CNU, CNU, CNU, CNU,}, - { 0, 5, 9, 8, DWS,}, -#endif -#else -#if JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - { 123, }, - { 109, }, - { CNU, }, -#else - { 123, 154, 154, 168, CNU, }, - { 109, 154, 139, 168, CNU, }, - { CNU, CNU, CNU, CNU, CNU, }, -#endif -#endif } ); const CtxSet ContextSetCfg::GBiIdx = ContextSetCfg::addCtxSet ({ // 4 ctx for 1st bin; 1 ctx for each of rest bins -#if JVET_M0453_CABAC_ENGINE { 228, CNU, CNU, CNU, 125, 155, 175, }, { 242, CNU, CNU, CNU, 154, 170, 237, }, { CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, { 4, DWS, DWS, DWS, 4, 0, 0, }, -#else - { 199, CNU, CNU, CNU, 124, 169, 127, }, - { 154, CNU, CNU, CNU, 124, 185, 143, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 169, 183, }, { 155, 154, }, { 141, 156, }, { 9, 5, }, -#else - { 169, 183, }, - { 155, 198, }, - { CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 109, }, { 95, }, { 110, }, { 4, }, -#else - { 94, }, - { 95, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::QtCbf[] = { -#if JVET_M0102_INTRA_SUBPARTITIONS -#if JVET_M0453_CABAC_ENGINE ContextSetCfg::addCtxSet ({ { 141, 127, 139, 140, }, @@ -732,54 +400,19 @@ const CtxSet ContextSetCfg::QtCbf[] = { CNU, 111, 124, 111, }, { 1, 5, 9, 8, }, }), -#else - ContextSetCfg::addCtxSet - ({ - { 140, 141, CNU, CNU}, - { 155, 127, CNU, CNU}, - { CNU, 126, CNU, CNU}, - }), -#endif -#else - ContextSetCfg::addCtxSet - ({ -#if JVET_M0453_CABAC_ENGINE - { 155, 127,}, - { 141, 127,}, - { CNU, 126,}, - { 4, 5, }, -#else - { 140, 141, }, - { 155, 127, }, - { CNU, 126, }, -#endif - }), -#endif ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 163, 154, CNU, CNU, CNU, }, { 164, 154, CNU, CNU, CNU, }, { 109, CNU, CNU, CNU, CNU, }, { 5, 8, DWS, DWS, DWS, }, -#else - { 149, 168, CNU, CNU, CNU, }, - { 164, 154, CNU, CNU, CNU, }, - { 109, CNU, CNU, CNU, CNU, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 161, 154, }, { 192, 154, }, { 151, 155, }, { 5, 5, }, -#else - { 192, 153, }, - { 178, 139, }, - { 122, 140, }, -#endif }), }; @@ -787,47 +420,31 @@ const CtxSet ContextSetCfg::SigCoeffGroup[] = { ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 105, 155, }, { 106, 156, }, { 107, 158, }, { 8, 5, }, -#else - { 106, 170, }, - { 121, 141, }, - { 107, 158, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 91, 155, }, { 90, 141, }, { 76, 127, }, { 5, 8, }, -#else - { 91, 140, }, - { 105, 155, }, - { 105, 126, }, -#endif }), ContextSetCfg::addCtxSet ({ { CNU, CNU, }, { CNU, CNU, }, { CNU, CNU, }, -#if JVET_M0453_CABAC_ENGINE { DWS, DWS, } -#endif }), ContextSetCfg::addCtxSet ({ { CNU, CNU, }, { CNU, CNU, }, { CNU, CNU, }, -#if JVET_M0453_CABAC_ENGINE { DWS, DWS, } -#endif }), }; @@ -835,81 +452,45 @@ const CtxSet ContextSetCfg::SigFlag[] = { ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 88, 166, 152, 182, 168, 154, 0, 167, 182, 168, 183, 155, 193, 213, 183, 183, 169, 185, }, { 132, 152, 167, 168, 183, 140, 177, 182, 168, 154, 169, 155, 180, 213, 183, 169, 184, 156, }, { 89, 138, 153, 139, 154, 140, 134, 139, 139, 140, 140, 141, 137, 170, 169, 170, 141, 157, }, { 12, 9, 9, 9, 9, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, }, -#else - { 105, 152, 167, 153, 168, 169, 104, 167, 182, 183, 183, 170, 209, 213, 183, 183, 169, 185, }, - { 119, 152, 167, 168, 183, 140, 134, 182, 168, 183, 169, 185, 166, 228, 183, 198, 184, 156, }, - { 105, 138, 153, 154, 125, 111, 105, 139, 154, 155, 155, 127, 137, 185, 169, 185, 171, 159, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 72, 167, 153, 168, 154, 155, 180, 199, 183, 199, 199, 186, }, { 133, 138, 153, 139, 154, 140, 181, 229, 169, 229, 170, 157, }, { 43, 153, 168, 169, 154, 155, 152, 215, 155, 201, 171, 143, }, { 9, 9, 12, 9, 13, 13, 5, 5, 8, 8, 8, 9, }, -#else - { 148, 167, 153, 168, 154, 140, 166, 199, 183, 199, 199, 172, }, - { 134, 168, 168, 169, 169, 170, 196, 244, 184, 244, 200, 172, }, - { 104, 168, 168, 169, 140, 141, 167, 215, 155, 172, 171, 158, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 152, 156, 201, 186, 186, 187, 182, 248, 188, 232, 188, 205, 182, 223, 223, 223, 223, 223, }, { 123, 142, 157, 172, 172, 218, 138, 249, 248, 248, 219, 223, 139, 223, 223, 223, 223, 223, }, { 93, 142, 157, 143, 188, 175, 138, 238, 205, 238, 253, 237, 139, 223, 223, 223, 223, 253, }, { 9, 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 0, 0, 0, 0, 0, }, -#else - { 152, 127, 173, 201, 187, 173, 197, 203, 188, 217, 188, 189, 182, 223, 223, 223, 223, 223, }, - { 123, 142, 202, 172, 172, 203, 138, 188, 233, 203, 203, 191, 139, 223, 223, 223, 223, 223, }, - { 108, 157, 158, 158, 218, 189, 123, 191, 159, 190, 205, 236, 79, 223, 253, 223, 223, 253, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 182, 171, 143, 158, 172, 189, 183, 223, 223, 223, 223, 223, }, { 168, 156, 173, 216, 172, 219, 169, 223, 223, 223, 223, 223, }, { 152, 173, 157, 187, 204, 253, 170, 223, 223, 223, 223, 223, }, { 8, 9, 12, 8, 8, 8, 4, 0, 2, 2, 2, 2, }, -#else - { 182, 171, 143, 158, 172, 202, 168, 223, 223, 223, 223, 223, }, - { 168, 156, 173, 201, 157, 203, 198, 223, 223, 223, 223, 223, }, - { 152, 173, 157, 187, 189, 251, 170, 223, 223, 253, 223, 223, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 123, 173, 223, 191, 232, 251, 212, 223, 223, 236, 206, 223, 192, 223, 223, 223, 223, 223, }, { 123, 175, 223, 175, 218, 223, 138, 223, 223, 223, 222, 223, 196, 223, 223, 223, 223, 223, }, { 107, 174, 223, 238, 251, 223, 63, 223, 223, 238, 223, 238, 12, 223, 223, 223, 223, 223, }, { 8, 8, 4, 8, 8, 8, 8, 0, 0, 4, 8, 5, 4, 2, 2, 2, 2, 1, }, -#else - { 137, 142, 190, 188, 202, 189, 241, 191, 191, 189, 189, 190, 195, 223, 223, 223, 223, 223, }, - { 123, 187, 191, 173, 173, 248, 138, 191, 191, 191, 203, 191, 196, 223, 223, 223, 223, 223, }, - { 107, 143, 205, 188, 233, 205, 63, 251, 191, 253, 206, 252, 62, 223, 223, 223, 223, 223, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 167, 201, 223, 248, 219, 223, 181, 223, 223, 223, 223, 223, }, { 167, 171, 223, 175, 248, 223, 152, 223, 223, 223, 223, 223, }, { 166, 234, 223, 236, 248, 223, 108, 223, 223, 223, 223, 223, }, { 8, 8, 5, 8, 8, 8, 5, 1, 2, 2, 2, 2, }, -#else - { 167, 200, 175, 188, 174, 175, 196, 223, 223, 223, 223, 223, }, - { 167, 156, 237, 158, 188, 205, 182, 223, 223, 223, 223, 223, }, - { 166, 174, 159, 247, 188, 189, 168, 223, 223, 223, 238, 223, }, -#endif }), }; @@ -918,29 +499,17 @@ const CtxSet ContextSetCfg::ParFlag[] = { ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 121, 105, 136, 152, 138, 183, 90, 122, 167, 153, 168, 135, 152, 153, 168, 139, 151, 153, 139, 168, 154, }, { 121, 119, 136, 137, 138, 153, 104, 122, 138, 153, 139, 106, 138, 153, 168, 139, 137, 153, 168, 139, 139, }, { 121, 135, 137, 152, 138, 153, 91, 137, 138, 153, 139, 151, 138, 153, 139, 139, 138, 168, 139, 154, 139, }, { 8, 9, 12, 13, 13, 13, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 10, 13, 13, 13, 13, }, -#else - { 91, 104, 136, 152, 153, 153, 105, 137, 167, 153, 168, 121, 167, 153, 168, 139, 151, 153, 139, 168, 154, }, - { 106, 134, 151, 152, 138, 168, 120, 137, 138, 153, 139, 136, 138, 153, 168, 139, 137, 153, 168, 139, 139, }, - { 121, 135, 137, 138, 153, 153, 136, 123, 138, 153, 139, 152, 153, 153, 139, 139, 138, 168, 139, 154, 139, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 151, 120, 152, 138, 153, 153, 136, 168, 154, 168, 154, }, { 135, 120, 137, 138, 138, 153, 136, 153, 168, 139, 154, }, { 136, 135, 152, 153, 138, 153, 136, 168, 154, 139, 154, }, { 8, 10, 12, 12, 13, 13, 10, 10, 13, 13, 13, }, -#else - { 135, 135, 152, 138, 153, 124, 151, 168, 169, 153, 139, }, - { 120, 150, 152, 153, 153, 153, 166, 168, 168, 139, 154, }, - { 136, 121, 167, 168, 138, 153, 137, 139, 154, 139, 154, }, -#endif }), }; @@ -948,55 +517,31 @@ const CtxSet ContextSetCfg::GtxFlag[] = { ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 31, 73, 118, 75, 152, 109, 42, 44, 105, 107, 109, 0, 119, 136, 152, 124, 118, 136, 138, 153, 140, }, { 14, 116, 86, 119, 106, 152, 0, 72, 120, 151, 138, 116, 90, 107, 152, 153, 104, 107, 123, 153, 154, }, { 90, 72, 119, 135, 137, 138, 43, 60, 106, 137, 109, 58, 106, 108, 109, 124, 121, 138, 139, 154, 155, }, { 4, 1, 8, 8, 4, 2, 5, 9, 9, 8, 9, 9, 9, 9, 8, 9, 9, 8, 9, 8, 8, }, -#else - { 30, 0, 102, 104, 106, 152, 57, 44, 120, 136, 123, 87, 134, 151, 152, 153, 89, 121, 152, 153, 125, }, - { 88, 0, 102, 149, 150, 152, 101, 103, 150, 151, 138, 102, 105, 122, 167, 153, 90, 107, 123, 153, 154, }, - { 90, 41, 149, 121, 122, 123, 58, 105, 92, 108, 109, 104, 92, 123, 109, 124, 151, 138, 139, 154, 140, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 119, 101, 134, 151, 107, 123, 118, 122, 124, 140, 155, }, { 117, 0, 90, 106, 92, 93, 147, 136, 138, 154, 140, }, { 194, 40, 120, 122, 122, 138, 103, 121, 153, 154, 155, }, { 2, 5, 8, 8, 8, 6, 6, 8, 8, 8, 7, }, -#else - { 102, 101, 90, 107, 122, 93, 118, 121, 153, 125, 140, }, - { 0, 0, 105, 151, 107, 93, 103, 136, 138, 154, 125, }, - { 165, 11, 120, 122, 137, 138, 75, 106, 138, 154, 155, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 43, 177, 181, 168, 154, 170, 133, 167, 139, 154, 155, 164, 153, 154, 169, 155, 181, 183, 169, 185, 186, }, { 101, 133, 137, 153, 139, 140, 134, 138, 139, 154, 155, 136, 153, 154, 140, 170, 138, 154, 155, 170, 186, }, { 134, 120, 123, 153, 139, 140, 92, 124, 154, 125, 111, 138, 154, 140, 155, 141, 154, 140, 185, 171, 143, }, { 8, 5, 9, 9, 12, 9, 9, 10, 13, 12, 10, 9, 10, 10, 10, 10, 8, 9, 8, 8, 10, }, -#else - { 89, 132, 151, 138, 124, 125, 119, 152, 153, 154, 140, 135, 153, 139, 169, 155, 151, 168, 169, 170, 171, }, - { 118, 101, 137, 138, 139, 140, 149, 138, 139, 154, 155, 136, 153, 154, 140, 170, 152, 139, 140, 155, 186, }, - { 135, 120, 108, 153, 139, 140, 151, 153, 139, 125, 140, 123, 154, 140, 155, 126, 139, 140, 170, 156, 142, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 0, 178, 153, 154, 140, 140, 196, 170, 186, 157, 188, }, { 0, 135, 153, 139, 125, 140, 182, 155, 156, 142, 159, }, { 163, 136, 153, 154, 125, 140, 183, 170, 201, 187, 174, }, { 6, 9, 10, 12, 12, 10, 5, 9, 8, 8, 9, }, -#else - { 102, 164, 138, 139, 154, 140, 181, 155, 171, 157, 143, }, - { 132, 136, 153, 154, 140, 155, 167, 155, 156, 142, 173, }, - { 165, 151, 153, 154, 125, 126, 168, 155, 186, 172, 143, }, -#endif }), }; @@ -1004,29 +549,17 @@ const CtxSet ContextSetCfg::LastX[] = { ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 111, 111, 110, 111, 111, 139, 111, 126, 111, 139, 126, 126, 111, 111, 169, 154, 111, 110, 110, 139, CNU, CNU, CNU, CNU, CNU, }, { 125, 110, 109, 125, 125, 123, 111, 111, 95, 123, 126, 111, 110, 95, 169, 154, 140, 139, 139, 138, CNU, CNU, CNU, CNU, CNU, }, { 125, 140, 124, 111, 111, 109, 111, 126, 125, 123, 111, 141, 111, 125, 79, 155, 142, 170, 140, 183, CNU, CNU, CNU, CNU, CNU, }, { 8, 5, 5, 5, 4, 4, 5, 4, 4, 0, 5, 1, 0, 0, 0, 1, 1, 0, 0, 0, DWS, DWS, DWS, DWS, DWS, }, -#else - { 111, 125, 124, 111, 111, 109, 111, 111, 125, 109, 140, 126, 111, 111, 139, 140, 111, 125, 95, 138, CNU, CNU, CNU, CNU, CNU, }, - { 125, 110, 109, 111, 125, 123, 111, 111, 95, 123, 140, 126, 125, 95, 169, 125, 140, 110, 124, 152, CNU, CNU, CNU, CNU, CNU, }, - { 140, 140, 124, 140, 126, 109, 140, 141, 125, 94, 111, 127, 111, 140, 93, 141, 186, 141, 125, 197, CNU, CNU, CNU, CNU, CNU, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 122, 124, 63, CNU, }, { 138, 123, 92, CNU, }, { 138, 108, 47, CNU, }, { 2, 1, 1, DWS, }, -#else - { 123, 109, 63, CNU, }, - { 138, 123, 92, CNU, }, - { 123, 108, 62, CNU, }, -#endif }), }; @@ -1034,111 +567,60 @@ const CtxSet ContextSetCfg::LastY[] = { ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 125, 125, 139, 125, 111, 139, 111, 111, 110, 110, 140, 126, 125, 125, 140, 139, 111, 110, 124, 181, CNU, CNU, CNU, CNU, CNU, }, { 95, 95, 109, 110, 110, 108, 125, 111, 124, 123, 140, 111, 110, 124, 139, 125, 126, 110, 124, 182, CNU, CNU, CNU, CNU, CNU, }, { 110, 110, 109, 125, 111, 123, 111, 126, 95, 108, 111, 127, 111, 95, 78, 169, 157, 141, 125, 138, CNU, CNU, CNU, CNU, CNU, }, { 8, 5, 8, 5, 5, 4, 5, 5, 4, 0, 5, 5, 1, 0, 0, 1, 4, 1, 0, 0, DWS, DWS, DWS, DWS, DWS, }, -#else - { 125, 110, 139, 125, 125, 109, 111, 111, 110, 109, 140, 126, 110, 110, 154, 140, 111, 125, 109, 181, CNU, CNU, CNU, CNU, CNU, }, - { 110, 95, 94, 125, 110, 123, 140, 111, 95, 123, 125, 111, 110, 95, 154, 125, 111, 95, 94, 137, CNU, CNU, CNU, CNU, CNU, }, - { 110, 110, 109, 125, 111, 123, 111, 141, 95, 108, 111, 142, 111, 95, 63, 140, 157, 141, 110, 152, CNU, CNU, CNU, CNU, CNU, }, -#endif }), ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 122, 124, 123, CNU, }, { 108, 123, 121, CNU, }, { 123, 123, 91, CNU, }, { 2, 2, 2, DWS, }, -#else - { 108, 94, 122, CNU, }, - { 108, 93, 92, CNU, }, - { 108, 123, 77, CNU, }, -#endif }), }; const CtxSet ContextSetCfg::MVPIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 153, }, { 168, }, { 168, }, { 10, }, -#else - { 168, }, - { 168, }, - { CNU, }, -#endif }); -#if JVET_M0444_SMVD const CtxSet ContextSetCfg::SmvdFlag = ContextSetCfg::addCtxSet ( { { 154, }, { 125, }, { CNU, }, -#if JVET_M0453_CABAC_ENGINE { 8, }, -#endif } ); -#endif const CtxSet ContextSetCfg::SaoMergeFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 47, }, { 244, }, { 199, }, { 0, }, -#else - { 92, }, - { 214, }, - { 184, }, -#endif }); const CtxSet ContextSetCfg::SaoTypeIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 47, }, { 95, }, { 95, }, { 0, }, -#else - { 77, }, - { 111, }, - { 110, }, -#endif }); -#if !JVET_M0464_UNI_MTS -const CtxSet ContextSetCfg::TransformSkipFlag = ContextSetCfg::addCtxSet -({ -#if JVET_M0453_CABAC_ENGINE - { 154, 13,}, - { 152, 57,}, - { 139, 0,}, - { 4, 1,}, -#else - { 124, 61, }, - { 138, 46, }, - { 109, 42, }, -#endif -}); -#endif const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet ({ { 154,}, { 154,}, { 154,}, -#if JVET_M0453_CABAC_ENGINE { DWS, } -#endif }); const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet @@ -1146,9 +628,7 @@ const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet { 139, 139,}, { 139, 139,}, { CNU, CNU,}, -#if JVET_M0453_CABAC_ENGINE { DWS, DWS, } -#endif }); const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet @@ -1156,76 +636,31 @@ const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet { 139, 139,}, { 139, 139,}, { CNU, CNU,}, -#if JVET_M0453_CABAC_ENGINE { DWS, DWS, } -#endif }); -#if JVET_M0464_UNI_MTS const CtxSet ContextSetCfg::MTSIndex = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { CNU, 155, 155, 140, 140, CNU, 216, 153, 153, 0, CNU, }, { CNU, 155, 155, 140, 140, CNU, 233, 167, 153, 0, CNU, }, { CNU, CNU, 140, 140, 140, CNU, 219, 138, 153, 0, CNU, }, { DWS, 8, 8, 8, 8, DWS, 4, 8, 9, 3, DWS, }, -#else - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, -#endif -}); -#else -const CtxSet ContextSetCfg::EMTTuIndex = ContextSetCfg::addCtxSet -({ -#if JVET_M0453_CABAC_ENGINE - { 122, 136, CNU, CNU,}, - { 151, 150, CNU, CNU,}, - { 121, 136, CNU, CNU,}, - { 9, 9, DWS, DWS,}, -#else - { 153, 138, CNU, CNU, }, - { 138, 167, CNU, CNU, }, - { 167, 123, CNU, CNU, }, -#endif }); -const CtxSet ContextSetCfg::EMTCuFlag = ContextSetCfg::addCtxSet -({ -#if JVET_M0453_CABAC_ENGINE - { 216, 158, 172, 201, 200, CNU,}, - { 202, 158, 158, 158, 187, CNU,}, - { CNU, CNU, 141, 171, 171, CNU,}, - { 9, 8, 9, 8, 8, DWS,}, -#else - { 155, 141, 155, 155, 140, CNU, }, - { 141, 141, 141, 126, 155, CNU, }, - { CNU, CNU, 140, 155, 155, CNU, }, -#endif -}); -#endif - -#if JVET_M0102_INTRA_SUBPARTITIONS const CtxSet ContextSetCfg::ISPMode = ContextSetCfg::addCtxSet ({ { 152, 154, }, { 166, 154, }, { 152, 154, }, -#if JVET_M0453_CABAC_ENGINE { 8, 5, }, -#endif }); -#endif -#if JVET_M0140_SBT const CtxSet ContextSetCfg::SbtFlag = ContextSetCfg::addCtxSet ( { { 168, 183, }, { 197, 183, }, { CNU, CNU, }, -#if JVET_M0453_CABAC_ENGINE { 4, 8, }, -#endif } ); const CtxSet ContextSetCfg::SbtQuadFlag = ContextSetCfg::addCtxSet @@ -1233,9 +668,7 @@ const CtxSet ContextSetCfg::SbtQuadFlag = ContextSetCfg::addCtxSet { 168, }, { 168, }, { CNU, }, -#if JVET_M0453_CABAC_ENGINE { 9, }, -#endif } ); const CtxSet ContextSetCfg::SbtHorFlag = ContextSetCfg::addCtxSet @@ -1243,9 +676,7 @@ const CtxSet ContextSetCfg::SbtHorFlag = ContextSetCfg::addCtxSet { 139, 154, 139, }, { 139, 154, 139, }, { CNU, CNU, CNU, }, -#if JVET_M0453_CABAC_ENGINE { 8, 5, 4, }, -#endif } ); const CtxSet ContextSetCfg::SbtPosFlag = ContextSetCfg::addCtxSet @@ -1253,20 +684,15 @@ const CtxSet ContextSetCfg::SbtPosFlag = ContextSetCfg::addCtxSet { 154, }, { 154, }, { CNU, }, -#if JVET_M0453_CABAC_ENGINE { 13, }, -#endif } ); -#endif const CtxSet ContextSetCfg::CrossCompPred = ContextSetCfg::addCtxSet ({ { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,}, { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,}, { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,}, -#if JVET_M0453_CABAC_ENGINE { DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, } -#endif }); const CtxSet ContextSetCfg::ChromaQpAdjFlag = ContextSetCfg::addCtxSet @@ -1274,9 +700,7 @@ const CtxSet ContextSetCfg::ChromaQpAdjFlag = ContextSetCfg::addCtxSet { 154,}, { 154,}, { 154,}, -#if JVET_M0453_CABAC_ENGINE { DWS, } -#endif }); const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet @@ -1284,127 +708,68 @@ const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet { 154,}, { 154,}, { 154,}, -#if JVET_M0453_CABAC_ENGINE { DWS, } -#endif }); const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE -#if JVET_M0246_AFFINE_AMVR { 212, 199, 215, 180, 183, 242, }, { 213, 229, 244, 166, 198, 244, }, { CNU, CNU, CNU, 152, CNU, CNU, }, { 1, 4, 4, 5, 1, 0, }, -#else - { 227, 214, 230, 195,}, - { 213, 229, 230, 166,}, - { CNU, CNU, CNU, CNU,}, - { 1, 4, 4, 5,}, -#endif -#else -#if JVET_M0246_AFFINE_AMVR - { 212, 214, 230, 182, 212, 214 }, - { 212, 214, 230, 182, 212, 214 }, - { CNU, CNU, CNU, CNU, CNU, CNU }, -#else - { 212, 214, 230, 182, }, - { 212, 214, 230, 182, }, - { CNU, CNU, CNU, CNU, }, -#endif -#endif }); const CtxSet ContextSetCfg::ctbAlfFlag = { ContextSetCfg::addCtxSet ( { -#if JVET_M0453_CABAC_ENGINE { 154, 186, 174, 183, 233, 250, 168, 248, 250, }, { 139, 186, 203, 183, 247, 249, 183, 232, 249, }, { 219, 236, 238, 232, 249, 235, 246, 234, 251, }, { 0, 0, 4, 0, 0, 1, 0, 0, 1, }, -#else - { 138, 141, 173, 122, 170, 203, 151, 170, 203, }, - { 153, 156, 188, 137, 185, 218, 152, 185, 218, }, - { 155, 205, 253, 168, 187, 234, 168, 187, 220, }, -#endif } ) }; const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 225, }, { 197, }, { CNU, }, { 1, }, -#else - { 226, }, - { 227, }, - { CNU, }, -#endif }); const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 156, CNU, CNU, CNU, }, { 156, CNU, CNU, CNU, }, { CNU, CNU, CNU, CNU, }, { 9, DWS, DWS, DWS, }, -#else - { 155, CNU, CNU, CNU, }, - { 141, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 149, 123, 123, }, { 151, 152, 138, }, { CNU, CNU, CNU, }, { 8, 12, 9, }, -#else - { 165, 137, 153, }, - { 106, 122, 138, }, - { CNU, CNU, CNU, }, -#endif }); const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { CNU, }, { CNU, }, { CNU, }, { DWS, }, -#else - { 155, }, - { 126, }, - { CNU, }, -#endif }); // clang-format on -#if JVET_M0483_IBC const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet ({ -#if JVET_M0453_CABAC_ENGINE { 0, 154, 141, }, { 0, 153, 140, }, { 132, 153, 125, }, { 5, 5, 8, }, -#else - { 165, 137, 153, }, - { 106, 122, 138, }, - { CNU, CNU, CNU, }, -#endif }); -#endif const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size(); @@ -1438,19 +803,15 @@ void CtxStore<BinProbModel>::init( int qp, int initId ) const std::vector<uint8_t>& initTable = ContextSetCfg::getInitTable( initId ); CHECK( m_CtxBuffer.size() != initTable.size(), "Size of init table (" << initTable.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." ); -#if JVET_M0453_CABAC_ENGINE const std::vector<uint8_t> &rateInitTable = ContextSetCfg::getInitTable(NUMBER_OF_SLICE_TYPES); CHECK(m_CtxBuffer.size() != rateInitTable.size(), "Size of rate init table (" << rateInitTable.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")."); -#endif int clippedQP = Clip3( 0, MAX_QP, qp ); for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ ) { m_CtxBuffer[k].init( clippedQP, initTable[k] ); -#if JVET_M0453_CABAC_ENGINE m_CtxBuffer[k].setLog2WindowSize(rateInitTable[k]); -#endif } } diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index 2022641030b92ce7cede1d2032a0f1b5e4231547..e52842dead764732f268c30aadecc35b3fe2b18d 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -43,14 +43,12 @@ #include <vector> -#if JVET_M0453_CABAC_ENGINE static constexpr int PROB_BITS = 15; // Nominal number of bits to represent probabilities static constexpr int PROB_BITS_0 = 10; // Number of bits to represent 1st estimate static constexpr int PROB_BITS_1 = 14; // Number of bits to represent 2nd estimate static constexpr int MASK_0 = ~(~0u << PROB_BITS_0) << (PROB_BITS - PROB_BITS_0); static constexpr int MASK_1 = ~(~0u << PROB_BITS_1) << (PROB_BITS - PROB_BITS_1); static constexpr uint8_t DWS = 8; // 0x47 Default window sizes -#endif struct BinFracBits { @@ -68,16 +66,8 @@ enum BPMType class ProbModelTables { protected: -#if JVET_M0453_CABAC_ENGINE static const BinFracBits m_binFracBits[256]; static const uint16_t m_inistateToCount[128]; -#else - static const uint8_t m_NextState [128][2]; // Std - static const uint32_t m_EstFracBits [128]; // Std - static const BinFracBits m_BinFracBits_128 [128]; // Std - static const uint32_t m_EstFracProb [128]; // Std - static const uint8_t m_LPSTable_64_4 [ 64][4]; // Std -#endif static const uint8_t m_RenormTable_32 [ 32]; // Std MP MPI }; @@ -98,7 +88,6 @@ public: class BinProbModel_Std : public BinProbModelBase { public: -#if JVET_M0453_CABAC_ENGINE BinProbModel_Std() { uint16_t half = 1 << (PROB_BITS - 1); @@ -106,13 +95,9 @@ public: m_state[1] = half; m_rate = DWS; } -#else - BinProbModel_Std () : m_State( 0 ) {} -#endif ~BinProbModel_Std () {} public: void init ( int qp, int initId ); -#if JVET_M0453_CABAC_ENGINE void update(unsigned bin) { int rate0 = m_rate >> 4; @@ -141,19 +126,7 @@ public: uint32_t estFracBits(unsigned bin) const { return getFracBitsArray().intBits[bin]; } static uint32_t estFracBitsTrm(unsigned bin) { return (bin ? 0x3bfbb : 0x0010c); } BinFracBits getFracBitsArray() const { return m_binFracBits[state()]; } -#else - void update ( unsigned bin ) { m_State = m_NextState [m_State][bin]; } - static uint8_t getDefaultWinSize () { return uint8_t(0); } - void setLog2WindowSize ( uint8_t log2WindowSize ) {} - void estFracBitsUpdate ( unsigned bin, uint64_t& b ) { b += m_EstFracBits [m_State ^bin]; - m_State = m_NextState[m_State][bin]; - } - uint32_t estFracBits ( unsigned bin ) const { return m_EstFracBits [m_State ^bin]; } - static uint32_t estFracBitsTrm ( unsigned bin ) { return ( bin ? 0x3bfbb : 0x0010c ); } - BinFracBits getFracBitsArray () const { return m_BinFracBits_128 [m_State]; } -#endif public: -#if JVET_M0453_CABAC_ENGINE uint8_t state() const { return (m_state[0] + m_state[1]) >> 8; } uint8_t mps() const { return state() >> 7; } uint8_t getLPS(unsigned range) const @@ -163,45 +136,23 @@ public: q = q ^ 0xff; return ((q >> 2) * (range >> 5) >> 1) + 4; } -#else - uint8_t state () const { return ( m_State >> 1 ); } - uint8_t mps () const { return ( m_State & 1 ); } - uint8_t getLPS ( unsigned range ) const { return m_LPSTable_64_4 [m_State>>1][(range>>6)&3]; } -#endif static uint8_t getRenormBitsLPS ( unsigned LPS ) { return m_RenormTable_32 [LPS>>3]; } static uint8_t getRenormBitsRange( unsigned range ) { return 1; } -#if JVET_M0453_CABAC_ENGINE uint16_t getState() const { return m_state[0] + m_state[1]; } void setState(uint16_t pState) { m_state[0] = (pState >> 1) & MASK_0; m_state[1] = (pState >> 1) & MASK_1; } -#else - uint16_t getState () const { return uint16_t(m_State); } - void setState ( uint16_t pState ) { m_State = uint8_t ( pState); } -#endif public: -#if JVET_M0453_CABAC_ENGINE uint64_t estFracExcessBits(const BinProbModel_Std &r) const { int n = 2 * state() + 1; return ((512 - n) * r.estFracBits(0) + n * r.estFracBits(1) + 256) >> 9; } -#else - uint64_t estFracExcessBits ( const BinProbModel_Std& r ) const - { - return ( ((uint64_t)m_EstFracProb[m_State^0]) * m_EstFracBits[r.m_State^0] - + ((uint64_t)m_EstFracProb[m_State^1]) * m_EstFracBits[r.m_State^1] + ( 1 << ( SCALE_BITS - 1 ) ) ) >> SCALE_BITS; - } -#endif private: -#if JVET_M0453_CABAC_ENGINE uint16_t m_state[2]; uint8_t m_rate; -#else - uint8_t m_State; -#endif }; @@ -245,13 +196,9 @@ class ContextSetCfg public: // context sets: specify offset and size static const CtxSet SplitFlag; -#if JVET_M0421_SPLIT_SIG static const CtxSet SplitQtFlag; static const CtxSet SplitHvFlag; static const CtxSet Split12Flag; -#else - static const CtxSet BTSplitFlag; -#endif static const CtxSet SkipFlag; static const CtxSet MergeFlag; static const CtxSet MergeIdx; @@ -281,24 +228,14 @@ public: static const CtxSet MVPIdx; static const CtxSet SaoMergeFlag; static const CtxSet SaoTypeIdx; -#if JVET_M0464_UNI_MTS static const CtxSet MTSIndex; -#else - static const CtxSet TransformSkipFlag; -#endif static const CtxSet TransquantBypassFlag; static const CtxSet RdpcmFlag; static const CtxSet RdpcmDir; -#if !JVET_M0464_UNI_MTS - static const CtxSet EMTTuIndex; - static const CtxSet EMTCuFlag; -#endif -#if JVET_M0140_SBT static const CtxSet SbtFlag; static const CtxSet SbtQuadFlag; static const CtxSet SbtHorFlag; static const CtxSet SbtPosFlag; -#endif static const CtxSet CrossCompPred; static const CtxSet ChromaQpAdjFlag; static const CtxSet ChromaQpAdjIdc; @@ -309,15 +246,9 @@ public: static const CtxSet MHIntraPredMode; static const CtxSet TriangleFlag; static const CtxSet TriangleIdx; -#if JVET_M0444_SMVD static const CtxSet SmvdFlag; -#endif -#if JVET_M0483_IBC static const CtxSet IBCFlag; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS static const CtxSet ISPMode; -#endif static const unsigned NumberOfContexts; // combined sets for less complex copying diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 256b90e9118fad0a59e8088bdd9151438c122435..8d46daf033252a13f098cbfa59a39d2e13198be8 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -87,10 +87,8 @@ namespace DQIntern NbInfoSbb nextNbInfoSbb; int nextSbbRight; int nextSbbBelow; -#if JVET_M0297_32PT_MTS_ZERO_OUT int posX; int posY; -#endif }; class Rom; @@ -130,13 +128,8 @@ namespace DQIntern Rom() : m_scansInitialized(false) {} ~Rom() { xUninitScanArrays(); } void init () { xInitScanArrays(); } -#if JVET_M0102_INTRA_SUBPARTITIONS const NbInfoSbb* getNbInfoSbb( int hd, int vd, int ch ) const { return m_scanId2NbInfoSbbArray[hd][vd][ch]; } const NbInfoOut* getNbInfoOut( int hd, int vd, int ch ) const { return m_scanId2NbInfoOutArray[hd][vd][ch]; } -#else - const NbInfoSbb* getNbInfoSbb( int hd, int vd ) const { return m_scanId2NbInfoSbbArray[hd][vd]; } - const NbInfoOut* getNbInfoOut( int hd, int vd ) const { return m_scanId2NbInfoOutArray[hd][vd]; } -#endif const TUParameters* getTUPars ( const CompArea& area, const ComponentID compID ) const { return m_tuParameters[g_aucLog2[area.width]][g_aucLog2[area.height]][toChannelType(compID)]; @@ -146,13 +139,8 @@ namespace DQIntern void xUninitScanArrays (); private: bool m_scansInitialized; -#if JVET_M0102_INTRA_SUBPARTITIONS NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; -#else - NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ]; - NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ]; -#endif TUParameters* m_tuParameters [ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; }; @@ -169,7 +157,6 @@ namespace DQIntern uint32_t raster2id[ MAX_CU_SIZE * MAX_CU_SIZE ]; ::memset(raster2id, 0, sizeof(raster2id)); -#if JVET_M0102_INTRA_SUBPARTITIONS for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) { for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) @@ -180,44 +167,22 @@ namespace DQIntern { continue; } -#else - for( int hd = 1; hd <= MAX_CU_DEPTH; hd++ ) - { - for( int vd = 1; vd <= MAX_CU_DEPTH; vd++ ) - { -#endif const uint32_t blockWidth = (1 << hd); const uint32_t blockHeight = (1 << vd); -#if JVET_M0102_INTRA_SUBPARTITIONS const uint32_t log2CGWidth = g_log2SbbSize[ch][hd][vd][0]; const uint32_t log2CGHeight = g_log2SbbSize[ch][hd][vd][1]; -#else - const uint32_t log2CGWidth = (blockWidth & 3) + (blockHeight & 3) > 0 ? 1 : 2; - const uint32_t log2CGHeight = (blockWidth & 3) + (blockHeight & 3) > 0 ? 1 : 2; -#endif const uint32_t groupWidth = 1 << log2CGWidth; const uint32_t groupHeight = 1 << log2CGHeight; const uint32_t groupSize = groupWidth * groupHeight; const CoeffScanType scanType = SCAN_DIAG; const SizeType blkWidthIdx = gp_sizeIdxInfo->idxFrom( blockWidth ); const SizeType blkHeightIdx = gp_sizeIdxInfo->idxFrom( blockHeight ); -#if JVET_M0102_INTRA_SUBPARTITIONS const ScanElement * scanId2RP = g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx]; NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd][ch]; NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd][ch]; -#else - const ScanElement * scanId2RP = g_scanOrder[SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx]; - NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd]; - NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd]; -#endif // consider only non-zero-out region -#if JVET_M0257 const uint32_t blkWidthNZOut = std::min<unsigned>( JVET_C0024_ZERO_OUT_TH, blockWidth ); const uint32_t blkHeightNZOut= std::min<unsigned>( JVET_C0024_ZERO_OUT_TH, blockHeight ); -#else - const uint32_t blkWidthNZOut = blockWidth; - const uint32_t blkHeightNZOut= blockHeight; -#endif const uint32_t totalValues = blkWidthNZOut * blkHeightNZOut; sId2NbSbb = new NbInfoSbb[ totalValues ]; @@ -324,19 +289,10 @@ namespace DQIntern nbOut.maxDist -= scanId; } -#if JVET_M0102_INTRA_SUBPARTITIONS m_tuParameters[hd][vd][ch] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(ch) ); -#else - for( int chId = 0; chId < MAX_NUM_CHANNEL_TYPE; chId++ ) - { - m_tuParameters[hd][vd][chId] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(chId) ); - } -#endif } } -#if JVET_M0102_INTRA_SUBPARTITIONS } -#endif m_scansInitialized = true; } @@ -346,7 +302,6 @@ namespace DQIntern { return; } -#if JVET_M0102_INTRA_SUBPARTITIONS for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) { for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) @@ -371,32 +326,6 @@ namespace DQIntern } } } -#else - for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) - { - for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) - { - NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd]; - NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd]; - if( sId2NbSbb ) - { - delete [] sId2NbSbb; - } - if( sId2NbOut ) - { - delete [] sId2NbOut; - } - for( int chId = 0; chId < MAX_NUM_CHANNEL_TYPE; chId++ ) - { - TUParameters*& tuPars = m_tuParameters[hd][vd][chId]; - if( tuPars ) - { - delete tuPars; - } - } - } - } -#endif m_scansInitialized = false; } @@ -409,31 +338,16 @@ namespace DQIntern m_chType = chType; m_width = width; m_height = height; -#if JVET_M0257 const uint32_t nonzeroWidth = std::min<uint32_t>(JVET_C0024_ZERO_OUT_TH, m_width); const uint32_t nonzeroHeight = std::min<uint32_t>(JVET_C0024_ZERO_OUT_TH, m_height); m_numCoeff = nonzeroWidth * nonzeroHeight; -#else - m_numCoeff = m_width * m_height; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS m_log2SbbWidth = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0]; m_log2SbbHeight = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1]; -#else - const bool no4x4 = ( ( m_width & 3 ) != 0 || ( m_height & 3 ) != 0 ); - m_log2SbbWidth = ( no4x4 ? 1 : 2 ); - m_log2SbbHeight = ( no4x4 ? 1 : 2 ); -#endif m_log2SbbSize = m_log2SbbWidth + m_log2SbbHeight; m_sbbSize = ( 1 << m_log2SbbSize ); m_sbbMask = m_sbbSize - 1; -#if JVET_M0257 m_widthInSbb = nonzeroWidth >> m_log2SbbWidth; m_heightInSbb = nonzeroHeight >> m_log2SbbHeight; -#else - m_widthInSbb = m_width >> m_log2SbbWidth; - m_heightInSbb = m_height >> m_log2SbbHeight; -#endif m_numSbb = m_widthInSbb * m_heightInSbb; #if HEVC_USE_MDCS #error "MDCS is not supported" // use different function... @@ -445,21 +359,12 @@ namespace DQIntern SizeType vsbb = gp_sizeIdxInfo->idxFrom( m_heightInSbb ); SizeType hsId = gp_sizeIdxInfo->idxFrom( m_width ); SizeType vsId = gp_sizeIdxInfo->idxFrom( m_height ); -#if JVET_M0102_INTRA_SUBPARTITIONS m_scanSbbId2SbbPos = g_scanOrder [ chType ][ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ]; m_scanId2BlkPos = g_scanOrder [ chType ][ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ]; int log2W = g_aucLog2[ m_width ]; int log2H = g_aucLog2[ m_height ]; m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H, chType ); m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H, chType ); -#else - m_scanSbbId2SbbPos = g_scanOrder [ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ]; - m_scanId2BlkPos = g_scanOrder [ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ]; - int log2W = g_aucLog2[ m_width ]; - int log2H = g_aucLog2[ m_height ]; - m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H ); - m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H ); -#endif m_scanInfo = new ScanInfo[ m_numCoeff ]; for( int scanIdx = 0; scanIdx < m_numCoeff; scanIdx++ ) { @@ -482,10 +387,8 @@ namespace DQIntern scanInfo.spt = SCAN_SOCSBB; else if( scanInfo.eosbb && scanIdx > 0 && scanIdx < m_numCoeff - m_sbbSize ) scanInfo.spt = SCAN_EOCSBB; -#if JVET_M0297_32PT_MTS_ZERO_OUT scanInfo.posX = m_scanId2BlkPos[scanIdx].x; scanInfo.posY = m_scanId2BlkPos[scanIdx].y; -#endif if( scanIdx ) { const int nextScanIdx = scanIdx - 1; @@ -575,7 +478,6 @@ namespace DQIntern } else { -#if JVET_M0102_INTRA_SUBPARTITIONS BinFracBits bits; bool prevLumaCbf = false; bool lastCbfIsInferred = false; @@ -609,10 +511,6 @@ namespace DQIntern bits = fracBitsAccess.getFracBitsArray(Ctx::QtCbf[compID](DeriveCtx::CtxQtCbf(compID, tu.depth, tu.cbf[COMPONENT_Cb]))); } cbfDeltaBits = lastCbfIsInferred ? 0 : int32_t(bits.intBits[1]) - int32_t(bits.intBits[0]); -#else - BinFracBits bits = fracBitsAccess.getFracBitsArray( Ctx::QtCbf[compID]( DeriveCtx::CtxQtCbf( compID, tu.depth, tu.cbf[COMPONENT_Cb] ) ) ); - cbfDeltaBits = int32_t( bits.intBits[1] ) - int32_t( bits.intBits[0] ); -#endif } static const unsigned prefixCtx[] = { 0, 0, 0, 3, 6, 10, 15, 21 }; @@ -632,11 +530,7 @@ namespace DQIntern const unsigned lastShift = ( compID == COMPONENT_Y ? (log2Size+1)>>2 : Clip3<unsigned>(0,2,size>>3) ); const unsigned lastOffset = ( compID == COMPONENT_Y ? ( prefixCtx[log2Size] ) : 0 ); uint32_t sumFBits = 0; -#if JVET_M0257 unsigned maxCtxId = g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, size) - 1]; -#else - unsigned maxCtxId = g_uiGroupIdx[ size - 1 ]; -#endif for( unsigned ctxId = 0; ctxId < maxCtxId; ctxId++ ) { const BinFracBits bits = fracBitsAccess.getFracBitsArray( ctxSetLast( lastOffset + ( ctxId >> lastShift ) ) ); @@ -644,11 +538,7 @@ namespace DQIntern sumFBits += bits.intBits[1]; } ctxBits [ maxCtxId ] = sumFBits + ( maxCtxId>3 ? ((maxCtxId-2)>>1)<<SCALE_BITS : 0 ) + bitOffset; -#if JVET_M0257 for (unsigned pos = 0; pos < std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, size); pos++) -#else - for( unsigned pos = 0; pos < size; pos++ ) -#endif { lastBits[ pos ] = ctxBits[ g_uiGroupIdx[ pos ] ]; } @@ -793,24 +683,15 @@ namespace DQIntern const int channelBitDepth = sps.getBitDepth( chType ); const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange( chType ); const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange ); -#if JVET_M0464_UNI_MTS const bool clipTransformShift = ( tu.mtsIdx==1 && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#else - const bool clipTransformShift = ( tu.transformSkip[ compID ] && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#endif const int transformShift = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift ); // quant parameters m_QShift = QUANT_SHIFT - 1 + qpPer + transformShift; m_QAdd = -( ( 3 << m_QShift ) >> 1 ); #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( tu, compID ) ? ADJ_DEQUANT_SHIFT : 0 ); m_QScale = ( TU::needsSqrt2Scale( tu, compID ) ? ( g_quantScales[ qpRem ] * 181 ) >> 7 : g_quantScales[ qpRem ] ); -#else - Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( area ) ? ADJ_DEQUANT_SHIFT : 0 ); - m_QScale = ( TU::needsSqrt2Scale( area ) ? ( g_quantScales[ qpRem ] * 181 ) >> 7 : g_quantScales[ qpRem ] ); -#endif #else Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift; m_QScale = g_quantScales [ qpRem ]; @@ -855,11 +736,7 @@ namespace DQIntern #else const CoeffScanType scanType = SCAN_DIAG; #endif -#if JVET_M0102_INTRA_SUBPARTITIONS const ScanElement *scan = g_scanOrder[toChannelType(compID)][SCAN_GROUPED_4x4][scanType][hsId][vsId]; -#else - const ScanElement * scan = g_scanOrder[SCAN_GROUPED_4x4][scanType][hsId][vsId]; -#endif const TCoeff* qCoeff = tu.getCoeffs( compID ).buf; TCoeff* tCoeff = recCoeff.buf; @@ -890,20 +767,11 @@ namespace DQIntern const TCoeff minTCoeff = -( 1 << maxLog2TrDynamicRange ); const TCoeff maxTCoeff = ( 1 << maxLog2TrDynamicRange ) - 1; const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange ); -#if JVET_M0464_UNI_MTS const bool clipTransformShift = ( tu.mtsIdx==1 && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#else - const bool clipTransformShift = ( tu.transformSkip[ compID ] && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#endif const int transformShift = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift ); #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( tu, compID ) ? ADJ_DEQUANT_SHIFT : 0 ); Intermediate_Int invQScale = g_invQuantScales[ qpRem ] * ( TU::needsSqrt2Scale( tu, compID ) ? 181 : 1 ); -#else - Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( area ) ? ADJ_DEQUANT_SHIFT : 0 ); - Intermediate_Int invQScale = g_invQuantScales[ qpRem ] * ( TU::needsSqrt2Scale( area ) ? 181 : 1 ); -#endif #else Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift; Intermediate_Int invQScale = g_invQuantScales[ qpRem ]; @@ -1005,7 +873,6 @@ namespace DQIntern }; #define RICEMAX 32 -#if JVET_M0470 const int32_t g_goRiceBits[4][RICEMAX] = { { 32768, 65536, 98304, 131072, 163840, 196608, 262144, 262144, 327680, 327680, 327680, 327680, 393216, 393216, 393216, 393216, 393216, 393216, 393216, 393216, 458752, 458752, 458752, 458752, 458752, 458752, 458752, 458752, 458752, 458752, 458752, 458752}, @@ -1013,15 +880,6 @@ namespace DQIntern { 98304, 98304, 98304, 98304, 131072, 131072, 131072, 131072, 163840, 163840, 163840, 163840, 196608, 196608, 196608, 196608, 229376, 229376, 229376, 229376, 262144, 262144, 262144, 262144, 327680, 327680, 327680, 327680, 327680, 327680, 327680, 327680}, { 131072, 131072, 131072, 131072, 131072, 131072, 131072, 131072, 163840, 163840, 163840, 163840, 163840, 163840, 163840, 163840, 196608, 196608, 196608, 196608, 196608, 196608, 196608, 196608, 229376, 229376, 229376, 229376, 229376, 229376, 229376, 229376} }; -#else - const int32_t g_goRiceBits[4][RICEMAX] = - { - { 32768, 65536, 98304, 131072, 163840, 196608, 229376, 294912, 294912, 360448, 360448, 360448, 360448, 425984, 425984, 425984, 425984, 425984, 425984, 425984, 425984, 491520, 491520, 491520, 491520, 491520, 491520, 491520, 491520, 491520, 491520, 491520 }, - { 65536, 65536, 98304, 98304, 131072, 131072, 163840, 163840, 196608, 196608, 229376, 229376, 294912, 294912, 294912, 294912, 360448, 360448, 360448, 360448, 360448, 360448, 360448, 360448, 425984, 425984, 425984, 425984, 425984, 425984, 425984, 425984 }, - { 98304, 98304, 98304, 98304, 131072, 131072, 131072, 131072, 163840, 163840, 163840, 163840, 196608, 196608, 196608, 196608, 229376, 229376, 229376, 229376, 262144, 262144, 262144, 262144, 294912, 294912, 294912, 294912, 360448, 360448, 360448, 360448 }, - { 131072, 131072, 131072, 131072, 131072, 131072, 131072, 131072, 163840, 163840, 163840, 163840, 163840, 163840, 163840, 163840, 196608, 196608, 196608, 196608, 196608, 196608, 196608, 196608, 229376, 229376, 229376, 229376, 229376, 229376, 229376, 229376 } - }; -#endif class State { @@ -1038,11 +896,7 @@ namespace DQIntern { m_rdCost = std::numeric_limits<int64_t>::max()>>1; m_numSigSbb = 0; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS m_remRegBins = 4; // just large enough for last scan pos -#else - m_remRegBins = 3; // just large enough for last scan pos -#endif m_refSbbCtxId = -1; m_sigFracBits = m_sigFracBitsArray[ 0 ]; m_coeffFracBits = m_gtxFracBitsArray[ 0 ]; @@ -1056,11 +910,7 @@ namespace DQIntern int64_t rdCostA = m_rdCost + pqDataA.deltaDist; int64_t rdCostB = m_rdCost + pqDataB.deltaDist; int64_t rdCostZ = m_rdCost; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS if( m_remRegBins >= 4 ) -#else - if( m_remRegBins >= 3 ) -#endif { if( pqDataA.absLevel < 4 ) rdCostA += m_coeffFracBits.bits[pqDataA.absLevel]; @@ -1156,7 +1006,6 @@ namespace DQIntern } } -#if JVET_M0297_32PT_MTS_ZERO_OUT inline void checkRdCostSkipSbbZeroOut(Decision &decision) const { int64_t rdCost = m_rdCost + m_sbbFracBits.intBits[0]; @@ -1164,7 +1013,6 @@ namespace DQIntern decision.absLevel = 0; decision.prevId = 4 + m_stateId; } -#endif private: int64_t m_rdCost; @@ -1209,22 +1057,14 @@ namespace DQIntern m_sbbFracBits = prvState->m_sbbFracBits; m_remRegBins = prvState->m_remRegBins - 1; m_goRicePar = prvState->m_goRicePar; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS if( m_remRegBins >= 4 ) -#else - if( m_remRegBins >= 3 ) -#endif { TCoeff rem = (decision.absLevel - 4) >> 1; if( m_goRicePar < 3 && rem > (3<<m_goRicePar)-1 ) { m_goRicePar++; } -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS m_remRegBins -= (decision.absLevel < 2 ? decision.absLevel : 3); -#else - m_remRegBins -= std::min<TCoeff>( decision.absLevel, 2 ); -#endif } ::memcpy( m_absLevelsAndCtxInit, prvState->m_absLevelsAndCtxInit, 48*sizeof(uint8_t) ); } @@ -1234,19 +1074,11 @@ namespace DQIntern m_refSbbCtxId = -1; if ( scanInfo.sbbSize == 4 ) { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK - (decision.absLevel < 2 ? decision.absLevel : 3); -#else - m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK - MAX_NUM_GT2_BINS_2x2SUBBLOCK - std::min<TCoeff>( decision.absLevel, 2 ); -#endif } else { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - (decision.absLevel < 2 ? decision.absLevel : 3); -#else - m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - MAX_NUM_GT2_BINS_4x4SUBBLOCK - std::min<TCoeff>( decision.absLevel, 2 ); -#endif } m_goRicePar = ( ((decision.absLevel - 4) >> 1) > (3<<0)-1 ? 1 : 0 ); ::memset( m_absLevelsAndCtxInit, 0, 48*sizeof(uint8_t) ); @@ -1255,20 +1087,12 @@ namespace DQIntern uint8_t* levels = reinterpret_cast<uint8_t*>(m_absLevelsAndCtxInit); levels[ scanInfo.insidePos ] = (uint8_t)std::min<TCoeff>( 255, decision.absLevel ); -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS if (m_remRegBins >= 4) -#else - if (m_remRegBins >= 3) -#endif { TCoeff tinit = m_absLevelsAndCtxInit[8 + scanInfo.nextInsidePos]; TCoeff sumAbs1 = (tinit >> 3) & 31; TCoeff sumNum = tinit & 7; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS #define UPDATE(k) {TCoeff t=levels[scanInfo.nextNbInfoSbb.inPos[k]]; sumAbs1+=std::min<TCoeff>(4+(t&1),t); sumNum+=!!t; } -#else -#define UPDATE(k) {TCoeff t=levels[scanInfo.nextNbInfoSbb.inPos[k]]; sumAbs1+=std::min<TCoeff>(2+(t&1),t); sumNum+=!!t; } -#endif if (numIPos == 1) { UPDATE(0); @@ -1406,19 +1230,11 @@ namespace DQIntern currState.m_numSigSbb = 0; if (scanInfo.sbbSize == 4) { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS currState.m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK; -#else - currState.m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK - MAX_NUM_GT2_BINS_2x2SUBBLOCK; -#endif } else { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS currState.m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK; -#else - currState.m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - MAX_NUM_GT2_BINS_4x4SUBBLOCK; -#endif } currState.m_goRicePar = 0; currState.m_refSbbCtxId = currState.m_stateId; @@ -1433,11 +1249,7 @@ namespace DQIntern if( nbOut->num ) { TCoeff sumAbs = 0, sumAbs1 = 0, sumNum = 0; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS #define UPDATE(k) {TCoeff t=absLevels[nbOut->outPos[k]]; sumAbs+=t; sumAbs1+=std::min<TCoeff>(4+(t&1),t); sumNum+=!!t; } -#else -#define UPDATE(k) {TCoeff t=absLevels[nbOut->outPos[k]]; sumAbs+=t; sumAbs1+=std::min<TCoeff>(2+(t&1),t); sumNum+=!!t; } -#endif UPDATE(0); if( nbOut->num > 1 ) { @@ -1483,13 +1295,8 @@ namespace DQIntern void dequant ( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP ) const; private: -#if JVET_M0297_32PT_MTS_ZERO_OUT void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut ); void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut ); -#else - void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo ); - void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions ); -#endif private: CommonCtx m_commonCtx; @@ -1527,15 +1334,10 @@ namespace DQIntern #undef DINIT -#if JVET_M0297_32PT_MTS_ZERO_OUT void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut) -#else - void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions) -#endif { ::memcpy( decisions, startDec, 8*sizeof(Decision) ); -#if JVET_M0297_32PT_MTS_ZERO_OUT if( zeroOut ) { if( spt==SCAN_EOCSBB ) @@ -1547,7 +1349,6 @@ namespace DQIntern } return; } -#endif PQData pqData[4]; m_quant.preQuantCoeff( absCoeff, pqData ); @@ -1566,21 +1367,13 @@ namespace DQIntern m_startState.checkRdCostStart( lastOffset, pqData[2], decisions[2] ); } -#if JVET_M0297_32PT_MTS_ZERO_OUT void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut ) -#else - void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo ) -#endif { Decision* decisions = m_trellis[ scanInfo.scanIdx ]; std::swap( m_prevStates, m_currStates ); -#if JVET_M0297_32PT_MTS_ZERO_OUT xDecide( scanInfo.spt, absCoeff, lastOffset(scanInfo.scanIdx), decisions, zeroOut ); -#else - xDecide( scanInfo.spt, absCoeff, lastOffset(scanInfo.scanIdx), decisions); -#endif if( scanInfo.scanIdx ) { @@ -1593,11 +1386,7 @@ namespace DQIntern m_currStates[3].updateStateEOS( scanInfo, m_prevStates, m_skipStates, decisions[3] ); ::memcpy( decisions+4, decisions, 4*sizeof(Decision) ); } -#if JVET_M0297_32PT_MTS_ZERO_OUT else if( !zeroOut ) -#else - else -#endif { switch( scanInfo.nextNbInfoSbb.num ) { @@ -1684,38 +1473,20 @@ namespace DQIntern } m_startState.init(); -#if JVET_M0297_32PT_MTS_ZERO_OUT int effWidth = tuPars.m_width, effHeight = tuPars.m_height; bool zeroOut = false; -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( ( tu.cu->emtFlag && !tu.transformSkip[ compID ] ) || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#else -#if JVET_M0464_UNI_MTS - if( tu.mtsIdx > 1 && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( tu.cu->emtFlag && !tu.transformSkip[compID] && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#endif { effHeight = ( tuPars.m_height == 32 ) ? 16 : tuPars.m_height; effWidth = ( tuPars.m_width == 32 ) ? 16 : tuPars.m_width; zeroOut = ( effHeight < tuPars.m_height || effWidth < tuPars.m_width ); } -#endif //===== populate trellis ===== for( int scanIdx = firstTestPos; scanIdx >= 0; scanIdx-- ) { const ScanInfo& scanInfo = tuPars.m_scanInfo[ scanIdx ]; -#if JVET_M0297_32PT_MTS_ZERO_OUT xDecideAndUpdate( abs( tCoeff[ scanInfo.rasterPos ] ), scanInfo, zeroOut && ( scanInfo.posX >= effWidth || scanInfo.posY >= effHeight ) ); -#else - xDecideAndUpdate( abs( tCoeff[ scanInfo.rasterPos ] ), scanInfo ); -#endif } //===== find best path ===== diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 9fa76e04920175a74b3ddbccb62f436564434aa4..1967564ce5c6593d9ab9dd4fb38c30270c1571a4 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -39,9 +39,7 @@ #include "Buffer.h" #include "UnitTools.h" -#if JVET_M0445_MCTS #include "MCTS.h" -#endif #include <memory.h> #include <algorithm> @@ -85,7 +83,6 @@ InterPrediction::InterPrediction() m_filteredBlockTmp[i][c] = nullptr; } } -#if JVET_M0147_DMVR m_cYuvPredTempDMVRL1 = nullptr; m_cYuvPredTempDMVRL0 = nullptr; for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++) @@ -93,7 +90,6 @@ InterPrediction::InterPrediction() m_cRefSamplesDMVRL0[ch] = nullptr; m_cRefSamplesDMVRL1[ch] = nullptr; } -#endif } InterPrediction::~InterPrediction() @@ -139,7 +135,6 @@ void InterPrediction::destroy() xFree(m_gradY0); m_gradY0 = nullptr; xFree(m_gradX1); m_gradX1 = nullptr; xFree(m_gradY1); m_gradY1 = nullptr; -#if JVET_M0147_DMVR xFree(m_cYuvPredTempDMVRL0); m_cYuvPredTempDMVRL0 = nullptr; xFree(m_cYuvPredTempDMVRL1); @@ -151,7 +146,6 @@ void InterPrediction::destroy() xFree(m_cRefSamplesDMVRL1[ch]); m_cRefSamplesDMVRL1[ch] = nullptr; } -#endif } void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC ) @@ -172,10 +166,8 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC ) { int extWidth = MAX_CU_SIZE + (2 * BIO_EXTEND_SIZE + 2) + 16; int extHeight = MAX_CU_SIZE + (2 * BIO_EXTEND_SIZE + 2) + 1; -#if JVET_M0147_DMVR extWidth = extWidth > (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + 16) ? extWidth : MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + 16; extHeight = extHeight > (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + 1) ? extHeight : MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + 1; -#endif for( uint32_t i = 0; i < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS_SIGNAL; i++ ) { m_filteredBlockTmp[i][c] = ( Pel* ) xMalloc( Pel, ( extWidth + 4 ) * ( extHeight + 7 + 4 ) ); @@ -203,7 +195,6 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC ) m_gradY1 = (Pel*)xMalloc(Pel, BIO_TEMP_BUFFER_SIZE); } -#if JVET_M0147_DMVR if (m_cYuvPredTempDMVRL0 == nullptr && m_cYuvPredTempDMVRL1 == nullptr) { m_cYuvPredTempDMVRL0 = (Pel*)xMalloc(Pel, (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)) * (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION))); @@ -214,7 +205,6 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC ) m_cRefSamplesDMVRL1[ch] = (Pel*)xMalloc(Pel, (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA) * (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA)); } } -#endif #if !JVET_J0090_MEMORY_BANDWITH_MEASURE m_if.initInterpolationFilter( true ); #endif @@ -366,12 +356,8 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R subPu.UnitArea::operator=(UnitArea(pu.chromaFormat, Area(x, y, dx, dy))); subPu = curMi; PelUnitBuf subPredBuf = predBuf.subBuf(UnitAreaRelative(pu, subPu)); -#if JVET_M0823_MMVD_ENCOPT subPu.mmvdEncOptMode = 0; -#endif -#if JVET_M0147_DMVR subPu.mvRefine = false; -#endif motionCompensation(subPu, subPredBuf, eRefPicList); secDim = later - secStep; } @@ -420,11 +406,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& int iRefIdx = pu.refIdx[eRefPicList]; Mv mv[3]; bool isIBC = false; -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) -#else - if (pu.cs->slice->getRefPic(eRefPicList, iRefIdx)->getPOC() == pu.cs->slice->getPOC()) -#endif { isIBC = true; } @@ -459,7 +441,6 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& } else { -#if JVET_M0483_IBC if (isIBC) { xPredInterBlk(compID, pu, pu.cu->slice->getPic(), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng(compID) @@ -474,12 +455,6 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& , isIBC ); } -#else - xPredInterBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx ), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng( compID ) - , bioApplied - , isIBC - ); -#endif } } } @@ -510,27 +485,21 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) } } -#if JVET_M0444_SMVD if (bioApplied && pu.cu->smvdMode) { bioApplied = false; } -#endif if (pu.cu->cs->sps->getUseGBi() && bioApplied && pu.cu->GBiIdx != GBI_DEFAULT) { bioApplied = false; } } -#if JVET_M0823_MMVD_ENCOPT if (pu.mmvdEncOptMode == 2 && pu.mmvdMergeFlag) { bioApplied = false; } -#endif -#if JVET_M0147_DMVR bool dmvrApplied = false; dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); -#endif for (uint32_t refList = 0; refList < NUM_REF_PIC_LIST_01; refList++) { if( pu.refIdx[refList] < 0) @@ -540,13 +509,9 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0); -#if JVET_M0483_IBC CHECK(CU::isIBC(*pu.cu) && eRefPicList != REF_PIC_LIST_0, "Invalid interdir for ibc mode"); CHECK(CU::isIBC(*pu.cu) && pu.refIdx[refList] != MAX_NUM_REF, "Invalid reference index for ibc mode"); CHECK((CU::isInter(*pu.cu) && pu.refIdx[refList] >= slice.getNumRefIdx(eRefPicList)), "Invalid reference index"); -#else - CHECK( pu.refIdx[refList] >= slice.getNumRefIdx( eRefPicList ), "Invalid reference index" ); -#endif m_iRefListIdx = refList; PelUnitBuf pcMbBuf = ( pu.chromaFormat == CHROMA_400 ? @@ -555,10 +520,8 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) if (pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0) { -#if JVET_M0147_DMVR if (dmvrApplied) continue; // mc will happen in processDMVR -#endif xPredInterUni ( pu, eRefPicList, pcMbBuf, true , bioApplied , true, true @@ -582,12 +545,10 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) } } } -#if JVET_M0147_DMVR if (dmvrApplied) { xProcessDMVR(pu, pcYuvPred, slice.clpRngs(), bioApplied); } -#endif CPelUnitBuf srcPred0 = ( pu.chromaFormat == CHROMA_400 ? @@ -606,18 +567,13 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) } else { -#if JVET_M0147_DMVR if (dmvrApplied == false) { -#endif xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied ); -#if JVET_M0147_DMVR } -#endif } } -#if JVET_M0147_DMVR void InterPrediction::xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng , const bool& bioApplied , bool isIBC @@ -627,12 +583,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio , Pel *srcPadBuf , int32_t srcPadStride ) -#else -void InterPrediction::xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng - , const bool& bioApplied - , bool isIBC - ) -#endif { JVET_J0090_SET_REF_PICTURE( refPic, compID ); const ChromaFormat chFmt = pu.chromaFormat; @@ -656,17 +606,14 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio CPelBuf refBuf; { Position offset = pu.blocks[compID].pos().offset( _mv.getHor() >> shiftHor, _mv.getVer() >> shiftVer ); -#if JVET_M0147_DMVR if (dmvrWidth) { refBuf = refPic->getRecoBuf(CompArea(compID, chFmt, offset, Size(dmvrWidth, dmvrHeight))); } else -#endif refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, offset, pu.blocks[compID].size() ) ); } -#if JVET_M0147_DMVR if (NULL != srcPadBuf) { refBuf.buf = srcPadBuf; @@ -677,7 +624,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio width = dmvrWidth; height = dmvrHeight; } -#endif // backup data int backupWidth = width; int backupHeight = height; @@ -696,54 +642,30 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio if( yFrac == 0 ) { -#if JVET_M0147_DMVR m_if.filterHor(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, xFrac, rndRes, chFmt, clpRng, bilinearMC, bilinearMC); -#else - m_if.filterHor(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, xFrac, rndRes, chFmt, clpRng); -#endif } else if( xFrac == 0 ) { -#if JVET_M0147_DMVR m_if.filterVer(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, true, rndRes, chFmt, clpRng, bilinearMC, bilinearMC); -#else - m_if.filterVer(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, true, rndRes, chFmt, clpRng); -#endif } else { -#if JVET_M0147_DMVR PelBuf tmpBuf = dmvrWidth ? PelBuf(m_filteredBlockTmp[0][compID], Size(dmvrWidth, dmvrHeight)) : PelBuf(m_filteredBlockTmp[0][compID], pu.blocks[compID]); if (dmvrWidth == 0) tmpBuf.stride = dstBuf.stride; -#else - PelBuf tmpBuf = PelBuf(m_filteredBlockTmp[0][compID], pu.blocks[compID]); - tmpBuf.stride = dstBuf.stride; -#endif int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; -#if JVET_M0147_DMVR if (bilinearMC) { vFilterSize = NTAPS_BILINEAR; } -#endif -#if JVET_M0147_DMVR m_if.filterHor(compID, (Pel*)refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, chFmt, clpRng, bilinearMC, bilinearMC); -#else - m_if.filterHor(compID, (Pel*)refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, chFmt, clpRng); -#endif JVET_J0090_SET_CACHE_ENABLE( false ); -#if JVET_M0147_DMVR m_if.filterVer(compID, (Pel*)tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng, bilinearMC, bilinearMC); -#else - m_if.filterVer(compID, (Pel*)tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng); -#endif } JVET_J0090_SET_CACHE_ENABLE( true ); if (bioApplied && compID == COMPONENT_Y) { -#if JVET_M0487_INT_EXTEND const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)); const Pel* refPel = refBuf.buf - refBuf.stride - 1; Pel* dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + dstBuf.stride + 1; @@ -774,18 +696,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio Pel val = leftShift_round(refPel[w], shift); dstPel[w] = val - (Pel)IF_INTERNAL_OFFS; } -#else - refBuf.buf = refBuf.buf - refBuf.stride - 1; -#if JVET_M0147_DMVR - if (srcPadBuf) - { - refBuf.buf = srcPadBuf - srcPadStride - 1; - refBuf.stride = srcPadStride; - } -#endif - dstBuf.buf = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + dstBuf.stride + 1; - bioSampleExtendBilinearFilter(refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, width - 2, height - 2, 1, xFrac, yFrac, rndRes, chFmt, clpRng); -#endif // restore data width = backupWidth; @@ -879,12 +789,10 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio iMvScaleTmpHor = iMvScaleHor + iDMvHorX * (iHalfBW + w) + iDMvVerX * (iHalfBH + h); iMvScaleTmpVer = iMvScaleVer + iDMvHorY * (iHalfBW + w) + iDMvVerY * (iHalfBH + h); roundAffineMv(iMvScaleTmpHor, iMvScaleTmpVer, shift); -#if JVET_M0145_AFFINE_MV_CLIP Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer); tmpMv.clipToStorageBitDepth(); iMvScaleTmpHor = tmpMv.getHor(); iMvScaleTmpVer = tmpMv.getVer(); -#endif // clip and scale if (sps.getWrapAroundEnabledFlag()) @@ -897,55 +805,25 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio } else { -#if JVET_M0265_MV_ROUNDING_CLEANUP m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); -#endif iMvScaleTmpHor = std::min<int>(iHorMax, std::max<int>(iHorMin, iMvScaleTmpHor)); iMvScaleTmpVer = std::min<int>(iVerMax, std::max<int>(iVerMin, iMvScaleTmpVer)); -#if !JVET_M0265_MV_ROUNDING_CLEANUP - m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); -#endif } } else { -#if JVET_M0265_MV_ROUNDING_CLEANUP -#if JVET_M0192_AFF_CHROMA_SIMPL - Mv curMv = m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE) * MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)]; - roundAffineMv(curMv.hor, curMv.ver, 1); -#else - Mv curMv = m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE) * MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)]; - roundAffineMv(curMv.hor, curMv.ver, 2); -#endif -#else -#if JVET_M0192_AFF_CHROMA_SIMPL Mv curMv = m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE) * MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)]; roundAffineMv(curMv.hor, curMv.ver, 1); -#else - Mv curMv = (m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE) * MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] + - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] + - Mv(2, 2)); - curMv.set(curMv.getHor() >> 2, curMv.getVer() >> 2); -#endif -#endif if (sps.getWrapAroundEnabledFlag()) { clipMv(curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), sps); } -#if JVET_M0265_MV_ROUNDING_CLEANUP else { curMv.hor = std::min<int>(iHorMax, std::max<int>(iHorMin, curMv.hor)); curMv.ver = std::min<int>(iVerMax, std::max<int>(iVerMin, curMv.ver)); } -#endif iMvScaleTmpHor = curMv.hor; iMvScaleTmpVer = curMv.ver; } @@ -1042,11 +920,7 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf Pel* gradY = (refList == 0) ? m_gradY0 : m_gradY1; Pel* gradX = (refList == 0) ? m_gradX0 : m_gradX1; -#if JVET_M0063_BDOF_FIX xBioGradFilter(dstTempPtr, stridePredMC, widthG, heightG, widthG, gradX, gradY, clipBitDepths.recon[toChannelType(COMPONENT_Y)]); -#else - xBioGradFilter(dstTempPtr, stridePredMC, widthG, heightG, widthG, gradX, gradY); -#endif Pel* padStr = m_filteredBlockTmp[2 + refList][COMPONENT_Y] + 2 * stridePredMC + 2; for (int y = 0; y< height; y++) { @@ -1064,11 +938,7 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf const int bitDepth = clipBitDepths.recon[toChannelType(COMPONENT_Y)]; const int shiftNum = IF_INTERNAL_PREC + 1 - bitDepth; const int offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS; -#if JVET_M0063_BDOF_FIX const int limit = (bitDepth>12)? 2 : ((int)1 << (4 + IF_INTERNAL_PREC - bitDepth - 5)); -#else - const int limit = ((int)1 << (4 + IF_INTERNAL_PREC - bitDepth - 5)); -#endif int* dotProductTemp1 = m_dotProduct1; int* dotProductTemp2 = m_dotProduct2; @@ -1076,11 +946,7 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf int* dotProductTemp5 = m_dotProduct5; int* dotProductTemp6 = m_dotProduct6; -#if JVET_M0063_BDOF_FIX xCalcBIOPar(srcY0Temp, srcY1Temp, gradX0, gradX1, gradY0, gradY1, dotProductTemp1, dotProductTemp2, dotProductTemp3, dotProductTemp5, dotProductTemp6, src0Stride, src1Stride, widthG, widthG, heightG, bitDepth); -#else - xCalcBIOPar(srcY0Temp, srcY1Temp, gradX0, gradX1, gradY0, gradY1, dotProductTemp1, dotProductTemp2, dotProductTemp3, dotProductTemp5, dotProductTemp6, src0Stride, src1Stride, widthG, widthG, heightG); -#endif int xUnit = (width >> 2); int yUnit = (height >> 2); @@ -1142,69 +1008,6 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf } // yu } -#if !JVET_M0487_INT_EXTEND -void InterPrediction::bioSampleExtendBilinearFilter(Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int dim, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng) -{ - Pel const* pSrc = NULL; - Pel* pDst = NULL; - - int vFilterSize = NTAPS_BILINEAR; - int widthTmp = 0; - int heightTmp = 0; - - for (int cand = 0; cand < 4; cand++) // top, left, bottom and right - { - - if (cand == 0) // top - { - pSrc = src; - pDst = dst; - widthTmp = width; - heightTmp = dim; - } - else if (cand == 1) // left - { - pSrc = src + dim*srcStride; - pDst = dst + dim*dstStride; - widthTmp = dim; - heightTmp = height - 2 * dim; - } - else if (cand == 2) // bottom - { - pSrc = src + (height - dim)*srcStride; - pDst = dst + (height - dim)*dstStride; - widthTmp = width; - heightTmp = dim; - } - else if (cand == 3) // right - { - pSrc = src + dim*srcStride + width - dim; - pDst = dst + dim*dstStride + width - dim; - widthTmp = dim; - heightTmp = height - 2 * dim; - } - - if (fracY == 0) - { - m_if.filterHor(COMPONENT_Y, pSrc, srcStride, pDst, dstStride, widthTmp, heightTmp, fracX, isLast, fmt, clpRng, 1); - } - else if (fracX == 0) - { - m_if.filterVer(COMPONENT_Y, pSrc, srcStride, pDst, dstStride, widthTmp, heightTmp, fracY, true, isLast, fmt, clpRng, 1); - } - else - { - PelBuf tmpBuf = PelBuf(m_filteredBlockTmp[0][COMPONENT_Y], Size(width, height)); - tmpBuf.stride = width; - - m_if.filterHor(COMPONENT_Y, pSrc - ((vFilterSize >> 1) - 1) * srcStride, srcStride, tmpBuf.buf, tmpBuf.stride, widthTmp, heightTmp + vFilterSize - 1, fracX, false, fmt, clpRng, 1); - JVET_J0090_SET_CACHE_ENABLE( false ); - m_if.filterVer(COMPONENT_Y, tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, pDst, dstStride, widthTmp, heightTmp, fracY, false, isLast, fmt, clpRng, 1); - JVET_J0090_SET_CACHE_ENABLE( true ); - } - } -} -#endif bool InterPrediction::xCalcBiPredSubBlkDist(const PredictionUnit &pu, const Pel* pYuvSrc0, const int src0Stride, const Pel* pYuvSrc1, const int src1Stride, const BitDepths &clipBitDepths) { @@ -1245,7 +1048,6 @@ void InterPrediction::xAddBIOAvg4(const Pel* src0, int src0Stride, const Pel* sr g_pelBufOP.addBIOAvg4(src0, src0Stride, src1, src1Stride, dst, dstStride, gradX0, gradX1, gradY0, gradY1, gradStride, width, height, tmpx, tmpy, shift, offset, clpRng); } -#if JVET_M0063_BDOF_FIX void InterPrediction::xBioGradFilter(Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth) { g_pelBufOP.bioGradFilter(pSrc, srcStride, width, height, gradStride, gradX, gradY, bitDepth); @@ -1255,17 +1057,6 @@ void InterPrediction::xCalcBIOPar(const Pel* srcY0Temp, const Pel* srcY1Temp, co { g_pelBufOP.calcBIOPar(srcY0Temp, srcY1Temp, gradX0, gradX1, gradY0, gradY1, dotProductTemp1, dotProductTemp2, dotProductTemp3, dotProductTemp5, dotProductTemp6, src0Stride, src1Stride, gradStride, widthG, heightG, bitDepth); } -#else -void InterPrediction::xBioGradFilter(Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY) -{ - g_pelBufOP.bioGradFilter(pSrc, srcStride, width, height, gradStride, gradX, gradY); -} - -void InterPrediction::xCalcBIOPar(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG) -{ - g_pelBufOP.calcBIOPar(srcY0Temp, srcY1Temp, gradX0, gradX1, gradY0, gradY1, dotProductTemp1, dotProductTemp2, dotProductTemp3, dotProductTemp5, dotProductTemp6, src0Stride, src1Stride, gradStride, widthG, heightG); -} -#endif void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize) { @@ -1395,15 +1186,11 @@ void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRef for( auto &pu : CU::traversePUs( cu ) ) { PelUnitBuf predBuf = cu.cs->getPredBuf( pu ); -#if JVET_M0147_DMVR pu.mvRefine = true; -#endif motionCompensation( pu, predBuf, eRefPicList , luma, chroma ); -#if JVET_M0147_DMVR pu.mvRefine = false; -#endif } } @@ -1447,42 +1234,29 @@ void InterPrediction::motionCompensation4Triangle( CodingUnit &cu, MergeCtx &tri PU::spanMotionInfo( pu ); motionCompensation( pu, tmpTriangleBuf ); -#if JVET_M0445_MCTS_DEC_CHECK { if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) { printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); } } -#endif triangleMrgCtx.setMergeInfo( pu, candIdx1 ); PU::spanMotionInfo( pu ); motionCompensation( pu, predBuf ); -#if JVET_M0445_MCTS_DEC_CHECK { if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) { printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); } } -#endif -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, tmpTriangleBuf, predBuf ); -#else - weightedTriangleBlk( pu, PU::getTriangleWeights(pu, triangleMrgCtx, candIdx0, candIdx1), splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, tmpTriangleBuf, predBuf ); -#endif } } -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP void InterPrediction::weightedTriangleBlk( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -#else -void InterPrediction::weightedTriangleBlk( PredictionUnit &pu, bool weights, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -#endif { -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP if( channel == CHANNEL_TYPE_LUMA ) { xWeightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); @@ -1498,30 +1272,9 @@ void InterPrediction::weightedTriangleBlk( PredictionUnit &pu, bool weights, con xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); } -#else - if( channel == CHANNEL_TYPE_LUMA ) - { - xWeightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, weights, predDst, predSrc0, predSrc1 ); - } - else if( channel == CHANNEL_TYPE_CHROMA ) - { - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, weights, predDst, predSrc0, predSrc1 ); - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, weights, predDst, predSrc0, predSrc1 ); - } - else - { - xWeightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, weights, predDst, predSrc0, predSrc1 ); - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, weights, predDst, predSrc0, predSrc1 ); - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, weights, predDst, predSrc0, predSrc1 ); - } -#endif } -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -#else -void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, const bool weights, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -#endif { Pel* dst = predDst .get(compIdx).buf; Pel* src0 = predSrc0.get(compIdx).buf; @@ -1540,23 +1293,14 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint const int32_t ratioWH = (width > height) ? (width / height) : 1; const int32_t ratioHW = (width > height) ? 1 : (height / width); -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP const bool longWeight = (compIdx == COMPONENT_Y) || ( predDst.chromaFormat == CHROMA_444 ); const int32_t weightedLength = longWeight ? 7 : 3; -#else - const Pel* pelWeighted = (compIdx == COMPONENT_Y) ? g_trianglePelWeightedLuma[splitDir][weights] : g_trianglePelWeightedChroma[predDst.chromaFormat == CHROMA_444 ? 0 : 1][splitDir][weights]; - const int32_t weightedLength = (compIdx == COMPONENT_Y) ? g_triangleWeightLengthLuma[weights] : g_triangleWeightLengthChroma[predDst.chromaFormat == CHROMA_444 ? 0 : 1][weights]; -#endif int32_t weightedStartPos = ( splitDir == 0 ) ? ( 0 - (weightedLength >> 1) * ratioWH ) : ( width - ((weightedLength + 1) >> 1) * ratioWH ); int32_t weightedEndPos = weightedStartPos + weightedLength * ratioWH - 1; int32_t weightedPosoffset =( splitDir == 0 ) ? ratioWH : -ratioWH; -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP Pel tmpPelWeighted; int32_t weightIdx; -#else - const Pel* tmpPelWeighted; -#endif int32_t x, y, tmpX, tmpY, tmpWeightedStart, tmpWeightedEnd; for( y = 0; y < height; y+= ratioHW ) @@ -1572,36 +1316,20 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint tmpWeightedStart = std::max((int32_t)0, weightedStartPos); tmpWeightedEnd = std::min(weightedEndPos, (int32_t)(width - 1)); -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP weightIdx = 1; -#else - tmpPelWeighted = pelWeighted; -#endif if( weightedStartPos < 0 ) { -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP weightIdx += abs(weightedStartPos) / ratioWH; -#else - tmpPelWeighted += abs(weightedStartPos) / ratioWH; -#endif } for( x = tmpWeightedStart; x <= tmpWeightedEnd; x+= ratioWH ) { for( tmpX = ratioWH; tmpX > 0; tmpX-- ) { -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP tmpPelWeighted = Clip3( 1, 7, longWeight ? weightIdx : (weightIdx * 2)); tmpPelWeighted = splitDir ? ( 8 - tmpPelWeighted ) : tmpPelWeighted; *dst++ = ClipPel( rightShift( (tmpPelWeighted*(*src0++) + ((8 - tmpPelWeighted) * (*src1++)) + offsetWeighted), shiftWeighted ), clipRng ); -#else - *dst++ = ClipPel( rightShift( ((*tmpPelWeighted)*(*src0++) + ((8 - (*tmpPelWeighted)) * (*src1++)) + offsetWeighted), shiftWeighted ), clipRng ); -#endif } -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP weightIdx ++; -#else - tmpPelWeighted++; -#endif } for( x = weightedEndPos + 1; x < width; x++ ) @@ -1620,7 +1348,6 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint } } -#if JVET_M0147_DMVR void InterPrediction::xPrefetchPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId) { int offset, width, height; @@ -1793,7 +1520,6 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu Mv startMv = mergeMV[refId]; -#if JVET_M0445_MCTS_DEC_CHECK if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvForMCTSConstraint( pu, startMv, MV_PRECISION_INTERNAL ) ) { const Area& tileArea = pu.cs->picture->mctsInfo.getTileArea(); @@ -1801,7 +1527,6 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu pu.lx(), pu.ly(), pu.lwidth(), pu.lheight(), startMv.getHor(), startMv.getVer(), tileArea.topLeft().x, tileArea.topLeft().y, tileArea.bottomRight().x, tileArea.bottomRight().y ); THROW( "MCTS constraint failed!" ); } -#endif for (int compID = 0; compID < MAX_NUM_COMPONENT; compID++) { int mvshiftTemp = mvShift + getComponentScaleX((ComponentID)compID, pu.chromaFormat); @@ -2055,7 +1780,6 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con } } } -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE void InterPrediction::cacheAssign( CacheModel *cache ) { diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 824351800d16f1a19d29f9276b4837c61504ebf6..56b45faa2e72a52c99c526c191a492c71ad7687a 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -63,9 +63,7 @@ class Mv; class InterPrediction : public WeightPrediction { private: -#if JVET_M0170_MRG_SHARELIST int m_shareState; -#endif Distortion m_bioDistThres; Distortion m_bioSubBlkDistThres; @@ -94,7 +92,6 @@ protected: int m_iRefListIdx; PelStorage m_triangleBuf; Mv* m_storedMv; -#if JVET_M0147_DMVR /*buffers for bilinear Filter data for DMVR refinement*/ Pel* m_cYuvPredTempDMVRL0; Pel* m_cYuvPredTempDMVRL1; @@ -110,7 +107,6 @@ protected: Mv(-2, 1), Mv(-1, 1), Mv(0, 1), Mv(1, 1), Mv(2, 1), Mv(-2, 2), Mv(-1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2) }; uint64_t m_SADsArray[((2 * DMVR_NUM_ITERATION) + 1) * ((2 * DMVR_NUM_ITERATION) + 1)]; -#endif Pel* m_gradX0; Pel* m_gradY0; @@ -121,15 +117,11 @@ protected: int rightShiftMSB(int numer, int denom); void applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf &yuvSrc0, const CPelUnitBuf &yuvSrc1, const int &refIdx0, const int &refIdx1, PelUnitBuf &yuvDst, const BitDepths &clipBitDepths); bool xCalcBiPredSubBlkDist(const PredictionUnit &pu, const Pel* yuvSrc0, const int src0Stride, const Pel* yuvSrc1, const int src1Stride, const BitDepths &clipBitDepths); -#if !JVET_M0487_INT_EXTEND - void bioSampleExtendBilinearFilter(Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int dim, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng); -#endif void xPredInterUni ( const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi , const bool& bioApplied , const bool luma, const bool chroma ); void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred ); -#if JVET_M0147_DMVR void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng , const bool& bioApplied , bool isIBC @@ -139,30 +131,15 @@ protected: , Pel *srcPadBuf = NULL , int32_t srcPadStride = 0 ); -#else - void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng - , const bool& bioApplied - , bool isIBC - ); -#endif void xAddBIOAvg4 (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng); -#if JVET_M0063_BDOF_FIX void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth); void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth); -#else - void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY); - void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG); -#endif void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied ); void xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng ); -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#else - void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, const bool weights, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#endif static bool xCheckIdenticalMotion( const PredictionUnit& pu ); @@ -193,12 +170,7 @@ public: ); void motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ); -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP void weightedTriangleBlk ( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#else - void weightedTriangleBlk ( PredictionUnit &pu, bool weights, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#endif -#if JVET_M0147_DMVR void xPrefetchPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId); void xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvSrc0, PelUnitBuf &pcYuvSrc1, PelUnitBuf &pcPad0, PelUnitBuf &pcPad1, const bool bioApplied , const Mv startMV[NUM_REF_PIC_LIST_01] @@ -207,17 +179,14 @@ public: uint64_t xDMVRCost(int bitDepth, Pel* pRef, uint32_t refStride, const Pel* pOrg, uint32_t orgStride, int width, int height); void xinitMC(PredictionUnit& pu, const ClpRngs &clpRngs); void xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, const ClpRngs &clpRngs, const bool bioApplied ); -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE void cacheAssign( CacheModel *cache ); #endif -#if JVET_M0170_MRG_SHARELIST void setShareState(int shareStateIn) {m_shareState = shareStateIn;} #if ENABLE_SPLIT_PARALLELISM int getShareState() const { return m_shareState; } #endif -#endif }; //! \} diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp index 9c7f7dd12234aaf58282c925866695b48ac2dada..01d7c284636a06f205eb5f3c938e7661b6ee8197 100644 --- a/source/Lib/CommonLib/InterpolationFilter.cpp +++ b/source/Lib/CommonLib/InterpolationFilter.cpp @@ -131,7 +131,6 @@ const TFilterCoeff InterpolationFilter::m_bilinearFilter[LUMA_INTERPOLATION_FILT { 4, 60, }, }; -#if JVET_M0147_DMVR const TFilterCoeff InterpolationFilter::m_bilinearFilterPrec4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR] = { { 16, 0, }, @@ -151,7 +150,6 @@ const TFilterCoeff InterpolationFilter::m_bilinearFilterPrec4[LUMA_INTERPOLATION { 2, 14, }, { 1, 15, } }; -#endif // ==================================================================================================================== // Private member functions // ==================================================================================================================== @@ -218,11 +216,7 @@ InterpolationFilter::InterpolationFilter() // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template<bool isFirst, bool isLast> -#if JVET_M0147_DMVR void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool biMCForDMVR) -#else -void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height ) -#endif { int row, col; @@ -248,7 +242,6 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int { const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)); -#if JVET_M0147_DMVR if (biMCForDMVR) { int shift10BitOut, offset; @@ -281,7 +274,6 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int } } else -#endif for (row = 0; row < height; row++) { for (col = 0; col < width; col++) @@ -299,7 +291,6 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int { const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)); -#if JVET_M0147_DMVR if (biMCForDMVR) { int shift10BitOut, offset; @@ -332,7 +323,6 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int } } else -#endif for (row = 0; row < height; row++) { for (col = 0; col < width; col++) @@ -375,11 +365,7 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template<int N, bool isVertical, bool isFirst, bool isLast> -#if JVET_M0147_DMVR void InterpolationFilter::filter(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR) -#else -void InterpolationFilter::filter(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff) -#endif { int row, col; @@ -424,7 +410,6 @@ void InterpolationFilter::filter(const ClpRng& clpRng, Pel const *src, int srcSt offset = (isFirst) ? -IF_INTERNAL_OFFS << shift : 0; } -#if JVET_M0147_DMVR if (biMCForDMVR) { if( isFirst ) @@ -438,7 +423,6 @@ void InterpolationFilter::filter(const ClpRng& clpRng, Pel const *src, int srcSt offset = 1 << (shift - 1); } } -#endif for (row = 0; row < height; row++) { for (col = 0; col < width; col++) @@ -499,36 +483,20 @@ void InterpolationFilter::filter(const ClpRng& clpRng, Pel const *src, int srcSt * \param coeff Pointer to filter taps */ template<int N> -#if JVET_M0147_DMVR void InterpolationFilter::filterHor(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR) -#else -void InterpolationFilter::filterHor(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isLast, TFilterCoeff const *coeff) -#endif { //#if ENABLE_SIMD_OPT_MCIF if( N == 8 ) { -#if JVET_M0147_DMVR m_filterHor[0][1][isLast](clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR); -#else - m_filterHor[0][1][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff ); -#endif } else if( N == 4 ) { -#if JVET_M0147_DMVR m_filterHor[1][1][isLast](clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR); -#else - m_filterHor[1][1][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff ); -#endif } else if( N == 2 ) { -#if JVET_M0147_DMVR m_filterHor[2][1][isLast](clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR); -#else - m_filterHor[2][1][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff ); -#endif } else { @@ -552,36 +520,20 @@ void InterpolationFilter::filterHor(const ClpRng& clpRng, Pel const *src, int sr * \param coeff Pointer to filter taps */ template<int N> -#if JVET_M0147_DMVR void InterpolationFilter::filterVer(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR) -#else -void InterpolationFilter::filterVer(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff) -#endif { //#if ENABLE_SIMD_OPT_MCIF if( N == 8 ) { -#if JVET_M0147_DMVR m_filterVer[0][isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR); -#else - m_filterVer[0][isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff ); -#endif } else if( N == 4 ) { -#if JVET_M0147_DMVR m_filterVer[1][isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR); -#else - m_filterVer[1][isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff ); -#endif } else if( N == 2 ) { -#if JVET_M0147_DMVR m_filterVer[2][isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR); -#else - m_filterVer[2][isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff ); -#endif } else{ THROW( "Invalid tap number" ); @@ -607,49 +559,29 @@ void InterpolationFilter::filterVer(const ClpRng& clpRng, Pel const *src, int sr * \param fmt Chroma format * \param bitDepth Bit depth */ -#if JVET_M0147_DMVR void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR) -#else -void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx ) -#endif { if( frac == 0 ) { -#if JVET_M0147_DMVR m_filterCopy[true][isLast](clpRng, src, srcStride, dst, dstStride, width, height, biMCForDMVR); -#else - m_filterCopy[true][isLast]( clpRng, src, srcStride, dst, dstStride, width, height ); -#endif } else if( isLuma( compID ) ) { CHECK( frac < 0 || frac >= LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction" ); if( nFilterIdx == 1 ) { -#if JVET_M0147_DMVR filterHor<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR); -#else - filterHor<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_bilinearFilter[frac]); -#endif } else { -#if JVET_M0147_DMVR filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac], biMCForDMVR); -#else - filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac] ); -#endif } } else { const uint32_t csx = getComponentScaleX( compID, fmt ); CHECK( frac < 0 || csx >= 2 || ( frac << ( 1 - csx ) ) >= CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction" ); -#if JVET_M0147_DMVR filterHor<NTAPS_CHROMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac << ( 1 - csx )], biMCForDMVR); -#else - filterHor<NTAPS_CHROMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac << ( 1 - csx )] ); -#endif } } @@ -670,49 +602,29 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i * \param fmt Chroma format * \param bitDepth Bit depth */ -#if JVET_M0147_DMVR void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR) -#else -void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx) -#endif { if( frac == 0 ) { -#if JVET_M0147_DMVR m_filterCopy[isFirst][isLast](clpRng, src, srcStride, dst, dstStride, width, height, biMCForDMVR); -#else - m_filterCopy[isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height ); -#endif } else if( isLuma( compID ) ) { CHECK( frac < 0 || frac >= LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction" ); if (nFilterIdx == 1) { -#if JVET_M0147_DMVR filterVer<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR); -#else - filterVer<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilter[frac]); -#endif } else { -#if JVET_M0147_DMVR filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac], biMCForDMVR); -#else - filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac] ); -#endif } } else { const uint32_t csy = getComponentScaleY( compID, fmt ); CHECK( frac < 0 || csy >= 2 || ( frac << ( 1 - csy ) ) >= CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction" ); -#if JVET_M0147_DMVR filterVer<NTAPS_CHROMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac << (1 - csy)], biMCForDMVR); -#else - filterVer<NTAPS_CHROMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac << ( 1 - csy )] ); -#endif } } diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h index be366a5477bc1ad7a38ee3bcf092684a93f93407..21f698e816e67198ffb6b671cda8bb869fdbb1e3 100644 --- a/source/Lib/CommonLib/InterpolationFilter.h +++ b/source/Lib/CommonLib/InterpolationFilter.h @@ -48,10 +48,8 @@ #define IF_INTERNAL_PREC 14 ///< Number of bits for internal precision #define IF_FILTER_PREC 6 ///< Log2 of sum of filter taps #define IF_INTERNAL_OFFS (1<<(IF_INTERNAL_PREC-1)) ///< Offset used internally -#if JVET_M0147_DMVR #define IF_INTERNAL_PREC_BILINEAR 10 ///< Number of bits for internal precision #define IF_FILTER_PREC_BILINEAR 4 ///< Bilinear filter coeff precision so that intermediate value will not exceed 16 bit for SIMD - bit exact -#endif /** * \brief Interpolation filter class */ @@ -60,36 +58,18 @@ class InterpolationFilter static const TFilterCoeff m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps static const TFilterCoeff m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps static const TFilterCoeff m_bilinearFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps -#if JVET_M0147_DMVR static const TFilterCoeff m_bilinearFilterPrec4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps -#endif public: template<bool isFirst, bool isLast> -#if JVET_M0147_DMVR static void filterCopy( const ClpRng& clpRng, const Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool biMCForDMVR); -#else - static void filterCopy( const ClpRng& clpRng, const Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height ); -#endif template<int N, bool isVertical, bool isFirst, bool isLast> -#if JVET_M0147_DMVR static void filter(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); -#else - static void filter(const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff); -#endif template<int N> -#if JVET_M0147_DMVR void filterHor(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR); -#else - void filterHor(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isLast, TFilterCoeff const *coeff); -#endif template<int N> -#if JVET_M0147_DMVR void filterVer(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR); -#else - void filterVer(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff); -#endif protected: #if JVET_J0090_MEMORY_BANDWITH_MEASURE @@ -98,21 +78,9 @@ protected: public: InterpolationFilter(); ~InterpolationFilter() {} -#if JVET_M0147_DMVR void( *m_filterHor[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); -#else - void( *m_filterHor[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff ); -#endif -#if JVET_M0147_DMVR void( *m_filterVer[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); -#else - void( *m_filterVer[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff ); -#endif -#if JVET_M0147_DMVR void( *m_filterCopy[2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool biMCForDMVR); -#else - void( *m_filterCopy[2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height ); -#endif void initInterpolationFilter( bool enable ); #ifdef TARGET_SIMD_X86 @@ -120,16 +88,8 @@ public: template <X86_VEXT vext> void _initInterpolationFilterX86(); #endif -#if JVET_M0147_DMVR void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false); -#else - void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0); -#endif -#if JVET_M0147_DMVR void filterVer(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false); -#else - void filterVer(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0); -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE void cacheAssign( CacheModel *cache ) { m_cacheModel = cache; } #endif diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index da5a61234c02c36857d8b889deff44a74c0ed80d..980b4b546e39b102ac13d102ad8f371057ce6199 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -294,9 +294,7 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co const ChannelType channelType = toChannelType( compID ); const int iWidth = piPred.width; const int iHeight = piPred.height; -#if JVET_M0102_INTRA_SUBPARTITIONS const Size cuSize = Size( pu.cu->blocks[compId].width, pu.cu->blocks[compId].height ); -#endif const uint32_t uiDirMode = PU::getFinalIntraMode( pu, channelType ); @@ -304,14 +302,9 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co CHECK( g_aucLog2[iWidth] > 7, "Size not allowed" ); const int multiRefIdx = (compID == COMPONENT_Y) ? pu.multiRefIdx : 0; -#if JVET_M0102_INTRA_SUBPARTITIONS const bool useISP = pu.cu->ispMode && isLuma( compID ); const int whRatio = useISP ? std::max( unsigned( 1 ), cuSize.width / cuSize.height ) : std::max( 1, iWidth / iHeight ); const int hwRatio = useISP ? std::max( unsigned( 1 ), cuSize.height / cuSize.width ) : std::max( 1, iHeight / iWidth ); -#else - int whRatio = std::max(1, iWidth / iHeight); - int hwRatio = std::max(1, iHeight / iWidth); -#endif const int srcStride = m_topRefLength + 1 + (whRatio + 1) * multiRefIdx; const int srcHStride = m_leftRefLength + 1 + (hwRatio + 1) * multiRefIdx; @@ -325,34 +318,16 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co case(2): case(DIA_IDX): case(VDIA_IDX): -#if JVET_M0102_INTRA_SUBPARTITIONS if (getWideAngle(useISP ? cuSize.width : iWidth, useISP ? cuSize.height : iHeight, uiDirMode) == static_cast<int>(uiDirMode)) // check if uiDirMode is not wide-angle { xPredIntraAng(CPelBuf(ptrSrc, srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps, multiRefIdx, useFilteredPredSamples, useISP, cuSize ); -#else - if (getWideAngle(iWidth, iHeight, uiDirMode) == static_cast<int>(uiDirMode)) // check if uiDirMode is not wide-angle - { - xPredIntraAng(CPelBuf(ptrSrc, srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps - , multiRefIdx - , useFilteredPredSamples); -#endif break; } -#if JVET_M0102_INTRA_SUBPARTITIONS default: xPredIntraAng(CPelBuf(getPredictorPtr(compID, false), srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps, multiRefIdx, useFilteredPredSamples, useISP, cuSize); break; -#else - default: xPredIntraAng(CPelBuf(getPredictorPtr(compID, false), srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps - , multiRefIdx - , useFilteredPredSamples); break; -#endif } bool pdpcCondition = (uiDirMode == PLANAR_IDX || uiDirMode == DC_IDX || uiDirMode == HOR_IDX || uiDirMode == VER_IDX); -#if JVET_M0102_INTRA_SUBPARTITIONS if( pdpcCondition && multiRefIdx == 0 && !useISP ) -#else - if (pdpcCondition && multiRefIdx == 0) -#endif { const CPelBuf srcBuf = CPelBuf(ptrSrc, srcStride, srcStride); PelBuf dstBuf = piPred; @@ -463,20 +438,11 @@ void IntraPrediction::xPredIntraPlanar( const CPelBuf &pSrc, PelBuf &pDst, const { const uint32_t width = pDst.width; const uint32_t height = pDst.height; -#if JVET_M0102_INTRA_SUBPARTITIONS const uint32_t log2W = g_aucLog2[width < 2 ? 2 : width]; const uint32_t log2H = g_aucLog2[height < 2 ? 2 : height]; -#else - const uint32_t log2W = g_aucLog2[ width ]; - const uint32_t log2H = g_aucLog2[ height ]; -#endif int leftColumn[MAX_CU_SIZE + 1], topRow[MAX_CU_SIZE + 1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE]; -#if JVET_M0102_INTRA_SUBPARTITIONS const uint32_t offset = 1 << (log2W + log2H); -#else - const uint32_t offset = width * height; -#endif // Get left and above reference column and row for( int k = 0; k < width + 1; k++ ) @@ -588,28 +554,18 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch , int multiRefIdx , const bool enableBoundaryFilter ) #else -#if JVET_M0102_INTRA_SUBPARTITIONS void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const ChannelType channelType, const uint32_t dirMode, const ClpRng& clpRng, const SPS& sps, int multiRefIdx, const bool useFilteredPredSamples , const bool useISP, const Size cuSize ) -#else -void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const ChannelType channelType, const uint32_t dirMode, const ClpRng& clpRng, const SPS& sps - , int multiRefIdx - , const bool useFilteredPredSamples ) -#endif #endif { int width =int(pDst.width); int height=int(pDst.height); CHECK( !( dirMode > DC_IDX && dirMode < NUM_LUMA_MODE ), "Invalid intra dir" ); -#if JVET_M0102_INTRA_SUBPARTITIONS int predMode = useISP ? getWideAngle( cuSize.width, cuSize.height, dirMode ) : getWideAngle( width, height, dirMode ); -#else - int predMode = getWideAngle(width, height, dirMode); -#endif const bool bIsModeVer = predMode >= DIA_IDX; const int intraPredAngleMode = (bIsModeVer) ? predMode - VER_IDX : -(predMode - HOR_IDX); const int absAngMode = abs(intraPredAngleMode); @@ -633,13 +589,8 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch Pel refAbove[2 * MAX_CU_SIZE + 3 + 33 * MAX_REF_LINE_IDX]; Pel refLeft [2 * MAX_CU_SIZE + 3 + 33 * MAX_REF_LINE_IDX]; -#if JVET_M0102_INTRA_SUBPARTITIONS const int whRatio = useISP ? std::max( unsigned( 1 ), cuSize.width / cuSize.height ) : std::max( 1, width / height ); const int hwRatio = useISP ? std::max( unsigned( 1 ), cuSize.height / cuSize.width ) : std::max( 1, height / width ); -#else - int whRatio = std::max(1, width / height); - int hwRatio = std::max(1, height / width); -#endif // Initialize the Main and Left reference array. if (intraPredAngle < 0) @@ -734,11 +685,7 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch if( isLuma(channelType) ) { Pel p[4]; -#if JVET_M0102_INTRA_SUBPARTITIONS const bool useCubicFilter = useISP ? ( width <= 8 ) : ( !useFilteredPredSamples || multiRefIdx > 0 ); -#else - const bool useCubicFilter = !useFilteredPredSamples || multiRefIdx > 0; -#endif TFilterCoeff const * const f = (useCubicFilter) ? InterpolationFilter::getChromaFilterTable(deltaFract) : g_intraGaussFilter[deltaFract]; int refMainIndex = deltaInt + 1; @@ -782,10 +729,8 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch const int numModes = 8; const int scale = ((g_aucLog2[width] - 2 + g_aucLog2[height] - 2 + 2) >> 2); CHECK(scale < 0 || scale > 31, "PDPC: scale < 0 || scale > 31"); -#if JVET_M0102_INTRA_SUBPARTITIONS if( !useISP ) { -#endif if ((predMode == 2 || predMode == VDIA_IDX) && multiRefIdx == 0) { int wT = 16 >> std::min(31, ((y << 1) >> scale)); @@ -821,17 +766,11 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch if (wL == 0) break; Pel *p = refSide + deltay; -#if JVET_M0238_PDPC_NO_INTERPOLATION Pel left = p[deltaFrac0 >> 5]; -#else - Pel left = (((64 - deltaFrac0) * p[0] + deltaFrac0 * p[1] + 32) >> 6); -#endif pDsty[x] = ClipPel((wL * left + (64 - wL) * pDsty[x] + 32) >> 6, clpRng); } } -#if JVET_M0102_INTRA_SUBPARTITIONS } -#endif } #if HEVC_USE_HOR_VER_PREDFILTERING if( edgeFilter && absAng <= 1 ) @@ -999,11 +938,7 @@ void IntraPrediction::initIntraPatternChType(const CodingUnit &cu, const CompAre Pel *refBufUnfiltered = m_piYuvExt[area.compID][PRED_BUF_UNFILTERED]; Pel *refBufFiltered = m_piYuvExt[area.compID][PRED_BUF_FILTERED]; -#if JVET_M0102_INTRA_SUBPARTITIONS setReferenceArrayLengths( cu.ispMode && isLuma( area.compID ) ? cu.blocks[area.compID] : area ); -#else - setReferenceArrayLengths(area); -#endif // ----- Step 1: unfiltered reference samples ----- xFillReferenceSamples( cs.picture->getRecoBuf( area ), refBufUnfiltered, area, cu ); @@ -1029,25 +964,15 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf const int tuHeight = area.height; const int predSize = m_topRefLength; const int predHSize = m_leftRefLength; -#if JVET_M0102_INTRA_SUBPARTITIONS const int cuWidth = cu.blocks[area.compID].width; const int cuHeight = cu.blocks[area.compID].height; const int whRatio = cu.ispMode && isLuma(area.compID) ? std::max(1, cuWidth / cuHeight) : std::max(1, tuWidth / tuHeight); const int hwRatio = cu.ispMode && isLuma(area.compID) ? std::max(1, cuHeight / cuWidth) : std::max(1, tuHeight / tuWidth); -#else - int whRatio = std::max(1, tuWidth / tuHeight); - int hwRatio = std::max(1, tuHeight / tuWidth); -#endif const int predStride = predSize + 1 + (whRatio + 1) * multiRefIdx; const bool noShift = pcv.noChroma2x2 && area.width == 4; // don't shift on the lowest level (chroma not-split) -#if JVET_M0102_INTRA_SUBPARTITIONS const int unitWidth = tuWidth <= 2 && cu.ispMode && isLuma(area.compID) ? tuWidth : pcv.minCUWidth >> (noShift ? 0 : getComponentScaleX(area.compID, sps.getChromaFormatIdc())); const int unitHeight = tuHeight <= 2 && cu.ispMode && isLuma(area.compID) ? tuHeight : pcv.minCUHeight >> (noShift ? 0 : getComponentScaleY(area.compID, sps.getChromaFormatIdc())); -#else - const int unitWidth = pcv.minCUWidth >> (noShift ? 0 : getComponentScaleX( area.compID, sps.getChromaFormatIdc() )); - const int unitHeight = pcv.minCUHeight >> (noShift ? 0 : getComponentScaleY( area.compID, sps.getChromaFormatIdc() )); -#endif const int totalAboveUnits = (predSize + (unitWidth - 1)) / unitWidth; const int totalLeftUnits = (predHSize + (unitHeight - 1)) / unitHeight; @@ -1363,9 +1288,7 @@ bool IntraPrediction::useFilteredIntraRefSamples( const ComponentID &compID, con if( sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag() ) { return false; } if( !isLuma( chType ) && pu.chromaFormat != CHROMA_444 ) { return false; } -#if JVET_M0102_INTRA_SUBPARTITIONS if( pu.cu->ispMode && isLuma(compID) ) { return false; } -#endif if( !modeSpecific ) { return true; } @@ -1640,7 +1563,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom pDst[i] = ( piSrc[2 * i] * 2 + piSrc[2 * i - 1] + piSrc[2 * i + 1] + 2 ) >> 2; } } -#if JVET_M0142_CCLM_COLLOCATED_CHROMA else if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { piSrc = pRecSrc0 - iRecStride2; @@ -1657,7 +1579,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom + 4 ) >> 3; } } -#endif else { piSrc = pRecSrc0 - iRecStride2; @@ -1687,7 +1608,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom } for (int j = 0; j < uiCHeight + addedLeftBelow; j++) { -#if JVET_M0142_CCLM_COLLOCATED_CHROMA if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { if( j == 0 && !bAboveAvaillable ) @@ -1704,13 +1624,10 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom } else { -#endif pDst[0] = ( ( piSrc[1 ] * 2 + piSrc[0 ] + piSrc[2 ] ) + ( piSrc[1 + iRecStride] * 2 + piSrc[iRecStride] + piSrc[2 + iRecStride] ) + 4 ) >> 3; -#if JVET_M0142_CCLM_COLLOCATED_CHROMA } -#endif piSrc += iRecStride2; pDst += iDstStride; @@ -1723,7 +1640,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { for( int i = 0; i < uiCWidth; i++ ) { -#if JVET_M0142_CCLM_COLLOCATED_CHROMA if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { if( i == 0 && !bLeftAvaillable ) @@ -1751,7 +1667,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom } else { -#endif if( i == 0 && !bLeftAvaillable ) { pDst0[i] = ( pRecSrc0[2 * i] + pRecSrc0[2 * i + iRecStride] + 1 ) >> 1; @@ -1762,9 +1677,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom + pRecSrc0[2 * i + iRecStride] * 2 + pRecSrc0[2 * i + 1 + iRecStride] + pRecSrc0[2 * i - 1 + iRecStride] + 4 ) >> 3; } -#if JVET_M0142_CCLM_COLLOCATED_CHROMA } -#endif } pDst0 += iDstStride; @@ -1932,7 +1845,6 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component if (leftAvailable || aboveAvailable) { -#if JVET_M0064_CCLM_SIMPLIFICATION int diff = maxLuma[0] - minLuma[0]; if (diff > 0) { @@ -1962,19 +1874,6 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component b = minLuma[1]; iShift = 0; } -#else // original - a = 0; - iShift = 16; - int shift = (internalBitDepth > 8) ? internalBitDepth - 9 : 0; - int add = shift ? 1 << (shift - 1) : 0; - int diff = (maxLuma[0] - minLuma[0] + add) >> shift; - if (diff > 0) - { - int div = ((maxLuma[1] - minLuma[1]) * g_aiLMDivTableLow[diff - 1] + 32768) >> 16; - a = (((maxLuma[1] - minLuma[1]) * g_aiLMDivTableHigh[diff - 1] + div + add) >> shift); - } - b = minLuma[1] - ((a * minLuma[0]) >> iShift); -#endif } else { diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h index 63c36a9a91fd63fbc74ad81104eaa133ceaba08e..22a2af108d4bcd2c6549a2758e2d4b08322a3c69 100644 --- a/source/Lib/CommonLib/IntraPrediction.h +++ b/source/Lib/CommonLib/IntraPrediction.h @@ -90,17 +90,11 @@ protected: , int multiRefIdx , const bool enableBoundaryFilter = true ); #else -#if JVET_M0102_INTRA_SUBPARTITIONS void xPredIntraAng ( const CPelBuf &pSrc, PelBuf &pDst, const ChannelType channelType, const uint32_t dirMode, const ClpRng& clpRng, const SPS& sps, int multiRefIdx, const bool useFilteredPredSamples, const bool useISP = false, const Size cuSize = Size( 0, 0 ) ); -#else - void xPredIntraAng ( const CPelBuf &pSrc, PelBuf &pDst, const ChannelType channelType, const uint32_t dirMode, const ClpRng& clpRng, const SPS& sps - , int multiRefIdx - , const bool useFilteredPredSamples ); -#endif #endif Pel xGetPredValDc ( const CPelBuf &pSrc, const Size &dstSize ); diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 0248e1a0103b24f364115696cc02dc26fe16dbc2..2cd1e89ce9fb82af3f2a73b8290912f958be06a9 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -126,19 +126,15 @@ void LoopFilter::create( const unsigned uiMaxCUDepth ) m_aapucBS [edgeDir].resize( numPartitions ); m_aapbEdgeFilter[edgeDir].resize( numPartitions ); } -#if JVET_M0428_ENC_DB_OPT m_enc = false; -#endif } -#if JVET_M0428_ENC_DB_OPT void LoopFilter::initEncPicYuvBuffer(ChromaFormat chromaFormat, int lumaWidth, int lumaHeight) { const UnitArea picArea(chromaFormat, Area(0, 0, lumaWidth, lumaHeight)); m_encPicYuvBuffer.destroy(); m_encPicYuvBuffer.create(picArea); } -#endif void LoopFilter::destroy() { @@ -147,9 +143,7 @@ void LoopFilter::destroy() m_aapucBS [edgeDir].clear(); m_aapbEdgeFilter[edgeDir].clear(); } -#if JVET_M0428_ENC_DB_OPT m_encPicYuvBuffer.destroy(); -#endif } /** @@ -257,13 +251,10 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) const Area area = cu.Y().valid() ? cu.Y() : Area( recalcPosition( cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].pos() ), recalcSize( cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].size() ) ); xSetLoopfilterParam( cu ); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS bool implicitTU = false; -#endif for( auto &currTU : CU::traverseTUs( cu ) ) { const Area& areaTu = cu.Y().valid() ? currTU.block( COMPONENT_Y ) : area; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const bool xOff = currTU.blocks[cu.chType].x != cu.blocks[cu.chType].x; const bool yOff = currTU.blocks[cu.chType].y != cu.blocks[cu.chType].y; if ((yOff != 0) && (edgeDir == EDGE_HOR)) @@ -274,7 +265,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) { implicitTU = true; } -#endif xSetEdgefilterMultiple( cu, EDGE_VER, areaTu, m_stLFCUParam.internalEdge ); xSetEdgefilterMultiple( cu, EDGE_HOR, areaTu, m_stLFCUParam.internalEdge ); } @@ -311,7 +301,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } } } -#if JVET_M0908_CIIP_DB if (cu.firstPU->mhIntraFlag) { const uint32_t dirMode = PU::getFinalIntraMode(*(cu.firstPU), cu.chType); @@ -336,7 +325,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } } } -#endif const unsigned uiPelsInPart = pcv.minCUWidth; @@ -375,7 +363,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) const int maxTsize = MAX_TB_SIZEY; #endif #endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS #if FIX_DB_MAX_TRANSFORM_SIZE int maxFilterLengthQ = 7; int maxFilterLengthP = 7; @@ -386,18 +373,15 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } #else int maxFilterLength = 7; -#endif #endif if (cu.blocks[COMPONENT_Y].valid()) { if (mvSubBlocks) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS #if FIX_DB_MAX_TRANSFORM_SIZE maxFilterLengthQ = std::min(maxFilterLengthQ, 5); #else maxFilterLength = 5; -#endif #endif orthogonalIncrement = subBlockSize / 4; orthogonalLength = (edgeDir == EDGE_HOR) ? cu.blocks[COMPONENT_Y].height / 4 : cu.blocks[COMPONENT_Y].width / 4; @@ -433,7 +417,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) { if (cu.blocks[COMPONENT_Y].valid()) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (edge == 0) { #if FIX_DB_MAX_TRANSFORM_SIZE @@ -469,9 +452,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) xEdgeFilterLuma(cu, edgeDir, edge, 3, 3); } } -#else - xEdgeFilterLuma(cu, edgeDir, edge); -#endif } if (cu.blocks[COMPONENT_Cb].valid() && pcv.chrFormat != CHROMA_400) { @@ -526,16 +506,12 @@ void LoopFilter::xSetLoopfilterParam( const CodingUnit& cu ) m_stLFCUParam.leftEdge = ( 0 < pos.x ) && isAvailable ( cu, *cu.cs->getCU( pos.offset( -1, 0 ), cu.chType ), !slice.getLFCrossSliceBoundaryFlag()); m_stLFCUParam.topEdge = ( 0 < pos.y ) && isAvailable ( cu, *cu.cs->getCU( pos.offset( 0, -1 ), cu.chType ), !slice.getLFCrossSliceBoundaryFlag()); #endif -#if JVET_M0102_INTRA_SUBPARTITIONS m_stLFCUParam.internalEdge &= !cu.ispMode; -#endif } unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const Position& localPos ) const { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS // The boundary strength that is output by the function xGetBoundaryStrengthSingle is a multi component boundary strength that contains boundary strength for luma (bits 0 to 1), cb (bits 2 to 3) and cr (bits 4 to 5). -#endif const Slice& sliceQ = *cu.slice; @@ -550,29 +526,18 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De //-- Set BS for Intra MB : BS = 4 or 3 if( ( MODE_INTRA == cuP.predMode ) || ( MODE_INTRA == cuQ.predMode ) ) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS return (BsSet(2, COMPONENT_Y) + BsSet(2, COMPONENT_Cb) + BsSet(2, COMPONENT_Cr)); -#else - return 2; -#endif } const TransformUnit& tuQ = *cuQ.cs->getTU(posQ, cuQ.chType); const TransformUnit& tuP = *cuP.cs->getTU(posP, cuP.chType); const PreCalcValues& pcv = *cu.cs->pcv; const unsigned rasterIdx = getRasterIdx( Position{ localPos.x, localPos.y }, pcv ); -#if JVET_M0908_CIIP_DB if (m_aapucBS[edgeDir][rasterIdx] && (cuP.firstPU->mhIntraFlag || cuQ.firstPU->mhIntraFlag)) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS return (BsSet(2, COMPONENT_Y) + BsSet(2, COMPONENT_Cb) + BsSet(2, COMPONENT_Cr)); -#else - return 2; -#endif } -#endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS unsigned tmpBs = 0; //-- Set BS for not Intra MB : BS = 2 or 1 or 0 // Y @@ -594,26 +559,15 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De { return tmpBs; } -#else - //-- Set BS for not Intra MB : BS = 2 or 1 or 0 - if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Y) || TU::getCbf(tuP, COMPONENT_Y))) - { - return 1; - } -#endif -#if JVET_M0908_CIIP_DB if ((cuP.firstPU->mhIntraFlag || cuQ.firstPU->mhIntraFlag)) { return 1; } -#endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if ( !cu.Y().valid() ) { return tmpBs; } -#endif // and now the pred const Position& lumaPosQ = Position{ localPos.x, localPos.y }; @@ -624,17 +578,10 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De if (sliceQ.isInterB() || sliceP.isInterB()) { -#if JVET_M0483_IBC const Picture *piRefP0 = (CU::isIBC(cuP) ? sliceP.getPic() : ((0 > miP.refIdx[0]) ? NULL : sliceP.getRefPic(REF_PIC_LIST_0, miP.refIdx[0]))); const Picture *piRefP1 = (CU::isIBC(cuP) ? NULL : ((0 > miP.refIdx[1]) ? NULL : sliceP.getRefPic(REF_PIC_LIST_1, miP.refIdx[1]))); const Picture *piRefQ0 = (CU::isIBC(cuQ) ? sliceQ.getPic() : ((0 > miQ.refIdx[0]) ? NULL : sliceQ.getRefPic(REF_PIC_LIST_0, miQ.refIdx[0]))); const Picture *piRefQ1 = (CU::isIBC(cuQ) ? NULL : ((0 > miQ.refIdx[1]) ? NULL : sliceQ.getRefPic(REF_PIC_LIST_1, miQ.refIdx[1]))); -#else - const Picture *piRefP0 = ( 0 > miP.refIdx[0] ) ? NULL : sliceP.getRefPic( REF_PIC_LIST_0, miP.refIdx[0] ); - const Picture *piRefP1 = ( 0 > miP.refIdx[1] ) ? NULL : sliceP.getRefPic( REF_PIC_LIST_1, miP.refIdx[1] ); - const Picture *piRefQ0 = ( 0 > miQ.refIdx[0] ) ? NULL : sliceQ.getRefPic( REF_PIC_LIST_0, miQ.refIdx[0] ); - const Picture *piRefQ1 = ( 0 > miQ.refIdx[1] ) ? NULL : sliceQ.getRefPic( REF_PIC_LIST_1, miQ.refIdx[1] ); -#endif Mv mvP0, mvP1, mvQ0, mvQ1; if( 0 <= miP.refIdx[0] ) { mvP0 = miP.mv[0]; } @@ -677,44 +624,25 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De { uiBs = 1; } -#if JVET_M0471_LONG_DEBLOCKING_FILTERS return uiBs + tmpBs; -#else - return uiBs; -#endif } // pcSlice->isInterP() -#if JVET_M0483_IBC CHECK(CU::isInter(cuP) && 0 > miP.refIdx[0], "Invalid reference picture list index"); CHECK(CU::isInter(cuP) && 0 > miQ.refIdx[0], "Invalid reference picture list index"); const Picture *piRefP0 = (CU::isIBC(cuP) ? sliceP.getPic() : sliceP.getRefPic(REF_PIC_LIST_0, miP.refIdx[0])); const Picture *piRefQ0 = (CU::isIBC(cuQ) ? sliceQ.getPic() : sliceQ.getRefPic(REF_PIC_LIST_0, miQ.refIdx[0])); -#else - CHECK(0 > miP.refIdx[0], "Invalid reference picture list index"); - CHECK(0 > miQ.refIdx[0], "Invalid reference picture list index"); - const Picture *piRefP0 = sliceP.getRefPic(REF_PIC_LIST_0, miP.refIdx[0]); - const Picture *piRefQ0 = sliceQ.getRefPic(REF_PIC_LIST_0, miQ.refIdx[0]); -#endif if (piRefP0 != piRefQ0) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS return tmpBs + 1; -#else - return 1; -#endif } Mv mvP0 = miP.mv[0]; Mv mvQ0 = miQ.mv[0]; int nThreshold = 1 << MV_FRACTIONAL_BITS_INTERNAL; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS return ( ( abs( mvQ0.getHor() - mvP0.getHor() ) >= nThreshold ) || ( abs( mvQ0.getVer() - mvP0.getVer() ) >= nThreshold ) ) ? (tmpBs + 1) : tmpBs; -#else - return ( ( abs( mvQ0.getHor() - mvP0.getHor() ) >= nThreshold ) || ( abs( mvQ0.getVer() - mvP0.getVer() ) >= nThreshold ) ) ? 1 : 0; -#endif } #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET @@ -747,20 +675,12 @@ void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift, } #endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge, const int initialMaxFilterLengthP, const int initialMaxFilterLengthQ) -#else -void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge) -#endif { const CompArea& lumaArea = cu.block(COMPONENT_Y); const PreCalcValues& pcv = *cu.cs->pcv; -#if JVET_M0428_ENC_DB_OPT PelBuf picYuvRec = m_enc ? m_encPicYuvBuffer.getBuf( lumaArea ) : cu.cs->getRecoBuf( lumaArea ); -#else - PelBuf picYuvRec = cu.cs->getRecoBuf( lumaArea ); -#endif Pel *piSrc = picYuvRec.buf; const int iStride = picYuvRec.stride; Pel *piTmpSrc = piSrc; @@ -814,11 +734,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge pos.y += yoffset; uiBsAbsIdx = getRasterIdx( pos, pcv ); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS uiBs = BsGet(m_aapucBS[edgeDir][uiBsAbsIdx], COMPONENT_Y); -#else - uiBs = m_aapucBS[edgeDir][uiBsAbsIdx]; -#endif if( uiBs ) { @@ -853,7 +769,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge } #endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS bool sidePisLarge = false; bool sideQisLarge = false; int maxFilterLengthP = initialMaxFilterLengthP; @@ -866,7 +781,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge if (sidePisLarge && maxFilterLengthP > 5) { // restrict filter length if sub-blocks are used (e.g affine or ATMVP) -#if JVET_M0908_CIIP_DB bool ciipSubBlock = false; if (cuP.firstPU->mhIntraFlag) { @@ -874,9 +788,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge ciipSubBlock = edgeDir == EDGE_HOR ? dirMode == VER_IDX : dirMode == HOR_IDX; } if (cuP.affine || ciipSubBlock) -#else - if (cuP.affine) -#endif { maxFilterLengthP = std::min(maxFilterLengthP, 5); } @@ -892,7 +803,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge { sidePisLarge = false; } -#endif const int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, int(iQP + DEFAULT_INTRA_TC_OFFSET*(uiBs - 1) + (tcOffsetDiv2 << 1))); const int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1)); @@ -909,7 +819,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge const int dq0 = xCalcDQ(piTmpSrc + iSrcStep*(iIdx*pelsInPart + iBlkIdx * 4 + 0), iOffset); const int dp3 = xCalcDP(piTmpSrc + iSrcStep*(iIdx*pelsInPart + iBlkIdx * 4 + 3), iOffset); const int dq3 = xCalcDQ(piTmpSrc + iSrcStep*(iIdx*pelsInPart + iBlkIdx * 4 + 3), iOffset); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS int dp0L = dp0; int dq0L = dq0; int dp3L = dp3; @@ -974,7 +883,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge } if (!useLongtapFilter) { -#endif const int d0 = dp0 + dq0; const int d3 = dp3 + dq3; @@ -1000,25 +908,18 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge { const bool bFilterP = (dp < iSideThreshold); const bool bFilterQ = (dq < iSideThreshold); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS bool sw = false; if (maxFilterLengthP > 2 && maxFilterLengthQ > 2) { sw = xUseStrongFiltering(piTmpSrc + iSrcStep * (iIdx*pelsInPart + iBlkIdx * 4 + 0), iOffset, 2 * d0, iBeta, iTc) && xUseStrongFiltering(piTmpSrc + iSrcStep * (iIdx*pelsInPart + iBlkIdx * 4 + 3), iOffset, 2 * d3, iBeta, iTc); } -#else - const bool sw = xUseStrongFiltering( piTmpSrc + iSrcStep * ( iIdx*pelsInPart + iBlkIdx * 4 + 0 ), iOffset, 2 * d0, iBeta, iTc ) - && xUseStrongFiltering( piTmpSrc + iSrcStep * ( iIdx*pelsInPart + iBlkIdx * 4 + 3 ), iOffset, 2 * d3, iBeta, iTc ); -#endif for( int i = 0; i < DEBLOCK_SMALLEST_BLOCK / 2; i++ ) { xPelFilterLuma( piTmpSrc + iSrcStep*( iIdx*pelsInPart + iBlkIdx * 4 + i ), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ, clpRng ); } } -#if JVET_M0471_LONG_DEBLOCKING_FILTERS } -#endif } } } @@ -1032,13 +933,8 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed const PreCalcValues& pcv = *cu.cs->pcv; unsigned rasterIdx = getRasterIdx( lumaPos, pcv ); -#if JVET_M0428_ENC_DB_OPT PelBuf picYuvRecCb = m_enc ? m_encPicYuvBuffer.getBuf(cu.block(COMPONENT_Cb)) : cu.cs->getRecoBuf(cu.block(COMPONENT_Cb)); PelBuf picYuvRecCr = m_enc ? m_encPicYuvBuffer.getBuf(cu.block(COMPONENT_Cr)) : cu.cs->getRecoBuf(cu.block(COMPONENT_Cr)); -#else - PelBuf picYuvRecCb = cu.cs->getRecoBuf( cu.block(COMPONENT_Cb) ); - PelBuf picYuvRecCr = cu.cs->getRecoBuf( cu.block(COMPONENT_Cr) ); -#endif Pel *piSrcCb = picYuvRecCb.buf; Pel *piSrcCr = picYuvRecCr.buf; const int iStride = picYuvRecCb.stride; @@ -1056,9 +952,7 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed bool bPartPNoFilter = false; bool bPartQNoFilter = false; const int tcOffsetDiv2 = slice.getDeblockingFilterTcOffsetDiv2(); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const int betaOffsetDiv2 = slice.getDeblockingFilterBetaOffsetDiv2(); -#endif // Vertical Position unsigned uiEdgeNumInCtuVert = rasterIdx % pcv.partsInCtuWidth + iEdge; @@ -1077,11 +971,7 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed unsigned uiNumParts = ( edgeDir == EDGE_VER ) ? lumaSize.height / pcv.minCUHeight : lumaSize.width / pcv.minCUWidth ; int uiNumPelsLuma = pcv.minCUWidth; unsigned uiBsAbsIdx; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS unsigned bS[2]; -#else - unsigned ucBs; -#endif Pel* piTmpSrcCb = piSrcCb; Pel* piTmpSrcCr = piSrcCr; @@ -1119,21 +1009,13 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed pos.y += yoffset; uiBsAbsIdx = getRasterIdx( pos, pcv ); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS unsigned tmpBs = m_aapucBS[edgeDir][uiBsAbsIdx]; tmpBs = m_aapucBS[edgeDir][uiBsAbsIdx]; bS[0] = BsGet(tmpBs, COMPONENT_Cb); bS[1] = BsGet(tmpBs, COMPONENT_Cr); -#else - ucBs = m_aapucBS[edgeDir][uiBsAbsIdx]; -#endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (bS[0] > 0 || bS[1] > 0) -#else - if (ucBs > 1) -#endif { const CodingUnit& cuQ = cu; const CodingUnit& cuP = *cu.cs->getCU( recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, cu.chType, pos.offset( xoffset - uiNumPelsLuma, yoffset - uiNumPelsLuma ) ), cu.chType ); @@ -1169,7 +1051,6 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed bPartQNoFilter = bPartQNoFilter || cuQ.transQuantBypass; } -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const unsigned cuPWidth = cuP.block(COMPONENT_Cb).width; const unsigned cuPHeight = cuP.block(COMPONENT_Cb).height; const unsigned cuQWidth = cuQ.block(COMPONENT_Cb).width; @@ -1182,13 +1063,10 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed largeBoundary = false; } -#endif for( int chromaIdx = 0; chromaIdx < 2; chromaIdx++ ) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if ((bS[chromaIdx] == 2) || (largeBoundary && (bS[chromaIdx] == 1))) { -#endif const ClpRng& clpRng( cu.cs->slice->clpRng( ComponentID( chromaIdx + 1 )) ); const int chromaQPOffset = pps.getQpOffset( ComponentID( chromaIdx + 1 ) ); Pel* piTmpSrcChroma = (chromaIdx == 0) ? piTmpSrcCb : piTmpSrcCr; @@ -1210,14 +1088,9 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed iQP = getScaledChromaQP(iQP, sps.getChromaFormatIdc()); } -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const int iIndexTC = Clip3<int>(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (bS[chromaIdx] - 1) + (tcOffsetDiv2 << 1)); -#else - const int iIndexTC = Clip3<int>( 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*( ucBs - 1 ) + ( tcOffsetDiv2 << 1 ) ); -#endif const int iTc = sm_tcTable[iIndexTC] * iBitdepthScale; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS bool useLongFilter = false; if (largeBoundary) { @@ -1252,15 +1125,7 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed xPelFilterChroma(piTmpSrcChroma + iSrcStep*(step + iIdx*uiLoopLength), iOffset, iTc, false, bPartPNoFilter, bPartQNoFilter, clpRng, largeBoundary); } } -#else - for( unsigned uiStep = 0; uiStep < uiLoopLength; uiStep++ ) - { - xPelFilterChroma( piTmpSrcChroma + iSrcStep*( uiStep + iIdx*uiLoopLength ), iOffset, iTc, bPartPNoFilter, bPartQNoFilter, clpRng ); - } -#endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS } -#endif } } } @@ -1282,7 +1147,6 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed \param bFilterSecondQ decision weak filter/no filter for partQ \param bitDepthLuma luma bit depth */ -#if JVET_M0471_LONG_DEBLOCKING_FILTERS inline void LoopFilter::xBilinearFilter(Pel* srcP, Pel* srcQ, int offset, int refMiddle, int refP, int refQ, int numberPSide, int numberQSide, const int* dbCoeffsP, const int* dbCoeffsQ, int tc) const { int src; @@ -1379,9 +1243,6 @@ inline void LoopFilter::xFilteringPandQ(Pel* src, int offset, int numberPSide, i } inline void LoopFilter::xPelFilterLuma(Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng, bool sidePisLarge, bool sideQisLarge, int maxFilterLengthP, int maxFilterLengthQ) const -#else -inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng ) const -#endif { int delta; @@ -1394,7 +1255,6 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int const Pel m7 = piSrc[ iOffset * 3]; const Pel m0 = piSrc[-iOffset * 4]; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const Pel mP1 = piSrc[-iOffset * 5]; const Pel mP2 = piSrc[-iOffset * 6]; const Pel mP3 = piSrc[-iOffset * 7]; @@ -1402,10 +1262,8 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int const Pel m9 = piSrc[ iOffset * 5]; const Pel m10 = piSrc[ iOffset * 6]; const char tc3[3] = { 3, 2, 1}; -#endif if (sw) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (sidePisLarge || sideQisLarge) { xFilteringPandQ(piSrc, iOffset, sidePisLarge ? maxFilterLengthP : 3, sideQisLarge ? maxFilterLengthQ : 3, tc); @@ -1419,14 +1277,6 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int piSrc[-iOffset * 3] = Clip3(m1 - tc3[2] * tc, m1 + tc3[2] * tc, ((2 * m0 + 3 * m1 + m2 + m3 + m4 + 4) >> 3)); piSrc[iOffset * 2] = Clip3(m6 - tc3[2] * tc, m6 + tc3[2] * tc, ((m3 + m4 + m5 + 3 * m6 + 2 * m7 + 4) >> 3)); } -#else - piSrc[-iOffset] = Clip3( m3 - 2 * tc, m3 + 2 * tc, ( ( m1 + 2 * m2 + 2 * m3 + 2 * m4 + m5 + 4 ) >> 3 ) ); - piSrc[ 0] = Clip3( m4 - 2 * tc, m4 + 2 * tc, ( ( m2 + 2 * m3 + 2 * m4 + 2 * m5 + m6 + 4 ) >> 3 ) ); - piSrc[-iOffset * 2] = Clip3( m2 - 2 * tc, m2 + 2 * tc, ( ( m1 + m2 + m3 + m4 + 2 ) >> 2 ) ); - piSrc[ iOffset] = Clip3( m5 - 2 * tc, m5 + 2 * tc, ( ( m3 + m4 + m5 + m6 + 2 ) >> 2 ) ); - piSrc[-iOffset * 3] = Clip3( m1 - 2 * tc, m1 + 2 * tc, ( ( 2 * m0 + 3 * m1 + m2 + m3 + m4 + 4 ) >> 3 ) ); - piSrc[ iOffset * 2] = Clip3( m6 - 2 * tc, m6 + 2 * tc, ( ( m3 + m4 + m5 + 3 * m6 + 2 * m7 + 4 ) >> 3 ) ); -#endif } else { @@ -1458,7 +1308,6 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int piSrc[-iOffset ] = m3; piSrc[-iOffset * 2] = m2; piSrc[-iOffset * 3] = m1; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (sidePisLarge) { piSrc[-iOffset * 4] = m0; @@ -1466,7 +1315,6 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int piSrc[-iOffset * 6] = mP2; piSrc[-iOffset * 7] = mP3; } -#endif } if(bPartQNoFilter) @@ -1474,7 +1322,6 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int piSrc[ 0 ] = m4; piSrc[ iOffset ] = m5; piSrc[ iOffset * 2] = m6; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (sideQisLarge) { piSrc[iOffset * 3] = m7; @@ -1482,7 +1329,6 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int piSrc[iOffset * 5] = m9; piSrc[iOffset * 6] = m10; } -#endif } } @@ -1496,15 +1342,10 @@ inline void LoopFilter::xPelFilterLuma( Pel* piSrc, const int iOffset, const int \param bPartQNoFilter indicator to disable filtering on partQ \param bitDepthChroma chroma bit depth */ -#if JVET_M0471_LONG_DEBLOCKING_FILTERS inline void LoopFilter::xPelFilterChroma( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng, const bool largeBoundary ) const -#else -inline void LoopFilter::xPelFilterChroma( Pel* piSrc, const int iOffset, const int tc, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng ) const -#endif { int delta; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const Pel m0 = piSrc[-iOffset * 4]; const Pel m1 = piSrc[-iOffset * 3]; const Pel m2 = piSrc[-iOffset * 2]; @@ -1530,37 +1371,23 @@ inline void LoopFilter::xPelFilterChroma( Pel* piSrc, const int iOffset, const i piSrc[0] = ClipPel(m4 - delta, clpRng); } -#else - const Pel m4 = piSrc[ 0 ]; - const Pel m3 = piSrc[-iOffset ]; - const Pel m5 = piSrc[ iOffset ]; - const Pel m2 = piSrc[-iOffset * 2]; - - delta = Clip3( -tc, tc, ( ( ( ( m4 - m3 ) << 2 ) + m2 - m5 + 4 ) >> 3 ) ); - piSrc[-iOffset] = ClipPel( m3 + delta, clpRng ); - piSrc[ 0 ] = ClipPel( m4 - delta, clpRng ); -#endif if( bPartPNoFilter ) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (largeBoundary) { piSrc[-iOffset * 3] = m1; // p2 piSrc[-iOffset * 2] = m2; // p1 } -#endif piSrc[-iOffset] = m3; } if( bPartQNoFilter ) { -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (largeBoundary) { piSrc[iOffset * 1] = m5; // q1 piSrc[iOffset * 2] = m6; // q2 } -#endif piSrc[ 0 ] = m4; } } @@ -1574,25 +1401,16 @@ inline void LoopFilter::xPelFilterChroma( Pel* piSrc, const int iOffset, const i \param tc tc value \param piSrc pointer to picture data */ -#if JVET_M0471_LONG_DEBLOCKING_FILTERS inline bool LoopFilter::xUseStrongFiltering( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc, bool sidePisLarge, bool sideQisLarge, int maxFilterLengthP, int maxFilterLengthQ ) const -#else -inline bool LoopFilter::xUseStrongFiltering( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc ) const -#endif { const Pel m4 = piSrc[ 0 ]; const Pel m3 = piSrc[-iOffset ]; const Pel m7 = piSrc[ iOffset * 3]; const Pel m0 = piSrc[-iOffset * 4]; -#if JVET_M0471_LONG_DEBLOCKING_FILTERS int sp3 = abs(m0 - m3); int sq3 = abs(m7 - m4); const int d_strong = sp3 + sq3; -#else - const int d_strong = abs( m0 - m3 ) + abs( m7 - m4 ); -#endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS if (sidePisLarge || sideQisLarge) { Pel mP4; @@ -1625,7 +1443,6 @@ inline bool LoopFilter::xUseStrongFiltering( Pel* piSrc, const int iOffset, cons return ((sp3 + sq3) < (beta*3 >> 5)) && (d < (beta >> 2)) && (abs(m3 - m4) < ((tc * 5 + 1) >> 1)); } else -#endif return ( ( d_strong < ( beta >> 3 ) ) && ( d < ( beta >> 2 ) ) && ( abs( m3 - m4 ) < ( ( tc * 5 + 1 ) >> 1 ) ) ); } @@ -1639,9 +1456,7 @@ inline int LoopFilter::xCalcDQ( Pel* piSrc, const int iOffset ) const return abs( piSrc[0] - 2 * piSrc[iOffset] + piSrc[iOffset * 2] ); } -#if JVET_M0471_LONG_DEBLOCKING_FILTERS inline unsigned LoopFilter::BsSet(unsigned val, const ComponentID compIdx) const { return (val << (compIdx << 1)); } inline unsigned LoopFilter::BsGet(unsigned val, const ComponentID compIdx) const { return ((val >> (compIdx << 1)) & 3); } -#endif //! \} diff --git a/source/Lib/CommonLib/LoopFilter.h b/source/Lib/CommonLib/LoopFilter.h index 2b6a81f42da40da575d8570dacf51d4f228656a7..6ff62b0ad50a49c1558287c041ff436440e2fcc4 100644 --- a/source/Lib/CommonLib/LoopFilter.h +++ b/source/Lib/CommonLib/LoopFilter.h @@ -58,15 +58,9 @@ private: static_vector<char, MAX_NUM_PARTS_IN_CTU> m_aapucBS [NUM_EDGE_DIR]; ///< Bs for [Ver/Hor][Y/U/V][Blk_Idx] static_vector<bool, MAX_NUM_PARTS_IN_CTU> m_aapbEdgeFilter[NUM_EDGE_DIR]; LFCUParam m_stLFCUParam; ///< status structure -#if JVET_M0428_ENC_DB_OPT PelStorage m_encPicYuvBuffer; bool m_enc; -#endif private: -#if !JVET_M0428_ENC_DB_OPT - /// CU-level deblocking function - void xDeblockCU ( CodingUnit& cu, const DeblockEdgeDir edgeDir ); -#endif // set / get functions void xSetLoopfilterParam ( const CodingUnit& cu ); @@ -80,18 +74,13 @@ private: const Area& area, const bool bValue, const bool EdgeIdx = false ); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS void xEdgeFilterLuma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge, const int initialMaxFilterLengthP, const int initialMaxFilterLengthQ ); -#else - void xEdgeFilterLuma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge ); -#endif void xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge); #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET void deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps ); #endif -#if JVET_M0471_LONG_DEBLOCKING_FILTERS inline void xBilinearFilter ( Pel* srcP, Pel* srcQ, int offset, int refMiddle, int refP, int refQ, int numberPSide, int numberQSide, const int* dbCoeffsP, const int* dbCoeffsQ, int tc ) const; inline void xFilteringPandQ ( Pel* src, int offset, int numberPSide, int numberQSide, int tc ) const; inline void xPelFilterLuma ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng, bool sidePisLarge = false, bool sideQisLarge = false, int maxFilterLengthP = 7, int maxFilterLengthQ = 7 ) const; @@ -99,12 +88,6 @@ private: inline bool xUseStrongFiltering ( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc, bool sidePisLarge = false, bool sideQisLarge = false, int maxFilterLengthP = 7, int maxFilterLengthQ = 7 ) const;//move the computation outside the function inline unsigned BsSet(unsigned val, const ComponentID compIdx) const; inline unsigned BsGet(unsigned val, const ComponentID compIdx) const; -#else - inline void xPelFilterLuma ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng ) const; - inline void xPelFilterChroma ( Pel* piSrc, const int iOffset, const int tc, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng ) const; - - inline bool xUseStrongFiltering ( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc ) const; -#endif inline int xCalcDP ( Pel* piSrc, const int iOffset ) const; inline int xCalcDQ ( Pel* piSrc, const int iOffset ) const; @@ -116,13 +99,11 @@ public: LoopFilter(); ~LoopFilter(); -#if JVET_M0428_ENC_DB_OPT /// CU-level deblocking function void xDeblockCU(CodingUnit& cu, const DeblockEdgeDir edgeDir); void initEncPicYuvBuffer(ChromaFormat chromaFormat, int lumaWidth, int lumaHeight); PelStorage& getDbEncPicYuvBuffer() { return m_encPicYuvBuffer; } void setEnc(bool b) { m_enc = b; } -#endif void create ( const unsigned uiMaxCUDepth ); void destroy (); diff --git a/source/Lib/CommonLib/MCTS.cpp b/source/Lib/CommonLib/MCTS.cpp index c0eede6f918189f68550a1ad009f960a43c60573..dd87fb11bdc1c50df48be97763be4e8ba6522ebb 100644 --- a/source/Lib/CommonLib/MCTS.cpp +++ b/source/Lib/CommonLib/MCTS.cpp @@ -49,7 +49,6 @@ // ==================================================================================================================== // Constructor / destructor / initialize // ==================================================================================================================== -#if JVET_M0445_MCTS void MCTSInfo::init( CodingStructure* cs, int ctuAddr ) { @@ -279,6 +278,5 @@ bool MCTSHelper::checkMvForMCTSConstraint( const PredictionUnit &pu, const Mv& m return checkMvIsNotInRestrictedArea( pu, mv, pu.cs->picture->mctsInfo.getTileAreaSubPelRestricted( pu ), mvPrec ); } -#endif //! \} diff --git a/source/Lib/CommonLib/MotionInfo.h b/source/Lib/CommonLib/MotionInfo.h index f8d51f109ef16fa84b6d57a90488e3fbde45ef54..020323575ff4e0d2cb70e25c9e827457aa7a29cb 100644 --- a/source/Lib/CommonLib/MotionInfo.h +++ b/source/Lib/CommonLib/MotionInfo.h @@ -101,49 +101,21 @@ struct MvField struct MotionInfo { bool isInter; -#if JVET_M0483_IBC bool isIBCmot; -#endif char interDir; uint16_t sliceIdx; Mv mv [ NUM_REF_PIC_LIST_01 ]; int16_t refIdx [ NUM_REF_PIC_LIST_01 ]; -#if JVET_M0264_HMVP_WITH_GBIIDX uint8_t GBiIdx; -#endif Mv bv; -#if JVET_M0483_IBC -#if JVET_M0264_HMVP_WITH_GBIIDX MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { } -#else - MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID } { } -#endif // ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything else -#if JVET_M0264_HMVP_WITH_GBIIDX MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); } -#else - MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ 0, 0 } { CHECKD(i != 0, "The argument for this constructor has to be '0'"); } -#endif -#else -#if JVET_M0264_HMVP_WITH_GBIIDX - MotionInfo() : isInter(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { } -#else - MotionInfo() : isInter(false), interDir( 0 ), sliceIdx( 0 ), refIdx{ NOT_VALID, NOT_VALID } { } -#endif - // ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything else -#if JVET_M0264_HMVP_WITH_GBIIDX - MotionInfo(int i) : isInter(i != 0), interDir(0), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); } -#else - MotionInfo( int i ) : isInter( i != 0 ), interDir( 0 ), sliceIdx( 0 ), refIdx{ 0, 0 } { CHECKD( i != 0, "The argument for this constructor has to be '0'" ); } -#endif -#endif bool operator==( const MotionInfo& mi ) const { if( isInter != mi.isInter ) return false; -#if JVET_M0483_IBC if (isIBCmot != mi.isIBCmot) return false; -#endif if( isInter ) { if( sliceIdx != mi.sliceIdx ) return false; @@ -180,9 +152,7 @@ class GBiMotionParam bool m_readOnlyAffine[2][2][33]; Mv m_mvAffine[2][2][33][3]; Distortion m_distAffine[2][2][33]; -#if JVET_M0247_AFFINE_AMVR_ENCOPT int m_mvpIdx[2][2][33]; -#endif public: @@ -204,9 +174,7 @@ public: memset(m_dist, -1, 2 * 33 * sizeof(Distortion)); memset(m_readOnlyAffine, false, 2 * 2 * 33 * sizeof(bool)); memset(m_distAffine, -1, 2 * 2 * 33 * sizeof(Distortion)); -#if JVET_M0247_AFFINE_AMVR_ENCOPT memset( m_mvpIdx, 0, 2 * 2 * 33 * sizeof( int ) ); -#endif } void setReadMode(bool b, uint32_t uiRefList, uint32_t uiRefIdx) { m_readOnly[uiRefList][uiRefIdx] = b; } @@ -232,42 +200,28 @@ public: Mv& getAffineMv(uint32_t uiRefList, uint32_t uiRefIdx, uint32_t uiAffineMvIdx, int bP4) { return m_mvAffine[bP4][uiRefList][uiRefIdx][uiAffineMvIdx]; } void copyAffineMvFrom(Mv(&racAffineMvs)[3], Distortion uiDist, uint32_t uiRefList, uint32_t uiRefIdx, int bP4 -#if JVET_M0247_AFFINE_AMVR_ENCOPT , const int mvpIdx -#endif ) { memcpy(m_mvAffine[bP4][uiRefList][uiRefIdx], racAffineMvs, 3 * sizeof(Mv)); m_distAffine[bP4][uiRefList][uiRefIdx] = uiDist; -#if JVET_M0247_AFFINE_AMVR_ENCOPT m_mvpIdx[bP4][uiRefList][uiRefIdx] = mvpIdx; -#endif } void copyAffineMvTo(Mv acAffineMvs[3], Distortion& ruiDist, uint32_t uiRefList, uint32_t uiRefIdx, int bP4 -#if JVET_M0247_AFFINE_AMVR_ENCOPT , int& mvpIdx -#endif ) { memcpy(acAffineMvs, m_mvAffine[bP4][uiRefList][uiRefIdx], 3 * sizeof(Mv)); ruiDist = m_distAffine[bP4][uiRefList][uiRefIdx]; -#if JVET_M0247_AFFINE_AMVR_ENCOPT mvpIdx = m_mvpIdx[bP4][uiRefList][uiRefIdx]; -#endif } }; struct LutMotionCand { static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lut; -#if JVET_M0483_IBC static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutIbc; -#endif -#if JVET_M0170_MRG_SHARELIST static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutShare; -#if JVET_M0483_IBC static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutShareIbc; -#endif -#endif }; #endif // __MOTIONINFO__ diff --git a/source/Lib/CommonLib/Mv.h b/source/Lib/CommonLib/Mv.h index c703fe6cb16446c4bdf596dcb89e1ea0d6c79418..51d08d6822ae026c4a8f1725d8b66824cb6e2fdb 100644 --- a/source/Lib/CommonLib/Mv.h +++ b/source/Lib/CommonLib/Mv.h @@ -51,9 +51,7 @@ enum MvPrecision { MV_PRECISION_4PEL = 0, // 4-pel MV_PRECISION_INT = 2, // 1-pel, shift 2 bits from 4-pel -#if JVET_M0246_AFFINE_AMVR MV_PRECISION_HALF = 3, // 1/2-pel -#endif MV_PRECISION_QUARTER = 4, // 1/4-pel (the precision of regular MV difference signaling), shift 4 bits from 4-pel MV_PRECISION_INTERNAL = 6, // 1/16-pel (the precision of internal MV), shift 6 bits from 4-pel }; @@ -168,13 +166,8 @@ public: const Mv scaleMv( int iScale ) const { -#if JVET_M0479_18BITS_MV_CLIP const int mvx = Clip3( -131072, 131071, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 ); const int mvy = Clip3( -131072, 131071, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 ); -#else - const int mvx = Clip3( -32768, 32767, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 ); - const int mvy = Clip3( -32768, 32767, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 ); -#endif return Mv( mvx, mvy ); } @@ -210,20 +203,16 @@ public: roundToPrecision(src, m_amvrPrecision[amvr]); } -#if JVET_M0444_SMVD Mv getSymmvdMv(const Mv& curMvPred, const Mv& tarMvPred) { return Mv(tarMvPred.hor - hor + curMvPred.hor, tarMvPred.ver - ver + curMvPred.ver); } -#endif -#if JVET_M0145_AFFINE_MV_CLIP void clipToStorageBitDepth() { hor = Clip3( -(1 << 17), (1 << 17) - 1, hor ); ver = Clip3( -(1 << 17), (1 << 17) - 1, ver ); } -#endif };// END CLASS DEFINITION MV namespace std diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 4f1abcf415663388846c46652e071d0ddf3c76dc..3736daac0c35d20f22b3ef186b867dce329e2888 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -746,17 +746,13 @@ void Picture::create(const ChromaFormat &_chromaFormat, const Size &size, const if( !_decoder ) { M_BUFS( 0, PIC_ORIGINAL ). create( _chromaFormat, a ); -#if JVET_M0427_INLOOP_RESHAPER M_BUFS( 0, PIC_TRUE_ORIGINAL ). create( _chromaFormat, a ); -#endif } #if !KEEP_PRED_AND_RESI_SIGNALS m_ctuArea = UnitArea( _chromaFormat, Area( Position{ 0, 0 }, Size( _maxCUSize, _maxCUSize ) ) ); #endif -#if JVET_M0253_HASH_ME m_hashMap.clearAll(); -#endif } void Picture::destroy() @@ -772,9 +768,7 @@ void Picture::destroy() { M_BUFS( jId, t ).destroy(); } -#if JVET_M0253_HASH_ME m_hashMap.clearAll(); -#endif if( cs ) { cs->destroy(); @@ -858,14 +852,12 @@ const CPelUnitBuf Picture::getOrigBuf(const UnitArea &unit) const { return getBu PelUnitBuf Picture::getOrigBuf() { return M_BUFS(0, PIC_ORIGINAL); } const CPelUnitBuf Picture::getOrigBuf() const { return M_BUFS(0, PIC_ORIGINAL); } -#if JVET_M0427_INLOOP_RESHAPER PelBuf Picture::getOrigBuf(const ComponentID compID) { return getBuf(compID, PIC_ORIGINAL); } const CPelBuf Picture::getOrigBuf(const ComponentID compID) const { return getBuf(compID, PIC_ORIGINAL); } PelUnitBuf Picture::getTrueOrigBuf() { return M_BUFS(0, PIC_TRUE_ORIGINAL); } const CPelUnitBuf Picture::getTrueOrigBuf() const { return M_BUFS(0, PIC_TRUE_ORIGINAL); } PelBuf Picture::getTrueOrigBuf(const CompArea &blk) { return getBuf(blk, PIC_TRUE_ORIGINAL); } const CPelBuf Picture::getTrueOrigBuf(const CompArea &blk) const { return getBuf(blk, PIC_TRUE_ORIGINAL); } -#endif PelBuf Picture::getPredBuf(const CompArea &blk) { return getBuf(blk, PIC_PREDICTION); } const CPelBuf Picture::getPredBuf(const CompArea &blk) const { return getBuf(blk, PIC_PREDICTION); } PelUnitBuf Picture::getPredBuf(const UnitArea &unit) { return getBuf(unit, PIC_PREDICTION); } @@ -885,11 +877,7 @@ const CPelUnitBuf Picture::getRecoBuf(const UnitArea &unit) const { return g PelUnitBuf Picture::getRecoBuf() { return M_BUFS(scheduler.getSplitPicId(), PIC_RECONSTRUCTION); } const CPelUnitBuf Picture::getRecoBuf() const { return M_BUFS(scheduler.getSplitPicId(), PIC_RECONSTRUCTION); } -#if JVET_M0132_APS void Picture::finalInit(const SPS& sps, const PPS& pps, APS& aps) -#else -void Picture::finalInit( const SPS& sps, const PPS& pps ) -#endif { for( auto &sei : SEIs ) { @@ -925,9 +913,7 @@ void Picture::finalInit( const SPS& sps, const PPS& pps ) cs->picture = this; cs->slice = nullptr; // the slices for this picture have not been set at this point. update cs->slice after swapSliceObject() cs->pps = &pps; -#if JVET_M0132_APS cs->aps = &aps; -#endif #if HEVC_VPS cs->vps = nullptr; #endif @@ -950,9 +936,7 @@ void Picture::allocateNewSlice() slices.push_back(new Slice); Slice& slice = *slices.back(); -#if JVET_M0132_APS slice.setAPS(cs->aps); -#endif slice.setPPS( cs->pps); slice.setSPS( cs->sps); if(slices.size()>=2) @@ -966,17 +950,13 @@ Slice *Picture::swapSliceObject(Slice * p, uint32_t i) { p->setSPS(cs->sps); p->setPPS(cs->pps); -#if JVET_M0132_APS p->setAPS(cs->aps); -#endif Slice * pTmp = slices[i]; slices[i] = p; pTmp->setSPS(0); pTmp->setPPS(0); -#if JVET_M0132_APS pTmp->setAPS(0); -#endif return pTmp; } @@ -1088,20 +1068,12 @@ void Picture::extendPicBorder() PelBuf Picture::getBuf( const ComponentID compID, const PictureType &type ) { -#if JVET_M0427_INLOOP_RESHAPER return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#else - return M_BUFS( ( type == PIC_ORIGINAL ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#endif } const CPelBuf Picture::getBuf( const ComponentID compID, const PictureType &type ) const { -#if JVET_M0427_INLOOP_RESHAPER return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#else - return M_BUFS( ( type == PIC_ORIGINAL ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#endif } PelBuf Picture::getBuf( const CompArea &blk, const PictureType &type ) @@ -1112,11 +1084,7 @@ PelBuf Picture::getBuf( const CompArea &blk, const PictureType &type ) } #if ENABLE_SPLIT_PARALLELISM -#if JVET_M0427_INLOOP_RESHAPER const int jId = ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#else - const int jId = ( type == PIC_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#endif #endif #if !KEEP_PRED_AND_RESI_SIGNALS @@ -1141,11 +1109,7 @@ const CPelBuf Picture::getBuf( const CompArea &blk, const PictureType &type ) co } #if ENABLE_SPLIT_PARALLELISM -#if JVET_M0427_INLOOP_RESHAPER const int jId = ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#else - const int jId = ( type == PIC_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#endif #endif #if !KEEP_PRED_AND_RESI_SIGNALS @@ -1189,11 +1153,7 @@ const CPelUnitBuf Picture::getBuf( const UnitArea &unit, const PictureType &type Pel* Picture::getOrigin( const PictureType &type, const ComponentID compID ) const { #if ENABLE_SPLIT_PARALLELISM -#if JVET_M0427_INLOOP_RESHAPER const int jId = ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#else - const int jId = ( type == PIC_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#endif #endif return M_BUFS( jId, type ).getOrigin( compID ); @@ -1219,7 +1179,6 @@ bool Picture::getSpliceFull() return true; } -#if JVET_M0253_HASH_ME void Picture::addPictureToHashMapForInter() { int picWidth = slices[0]->getSPS()->getPicWidthInLumaSamples(); @@ -1278,4 +1237,3 @@ void Picture::addPictureToHashMapForInter() } } } -#endif diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index 2b7088258926294ee371a01ba9d2278a33137782..dd7ab22326f80a9f7a3776ea526542121a477b70 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -46,12 +46,8 @@ #include "Unit.h" #include "Slice.h" #include "CodingStructure.h" -#if JVET_M0253_HASH_ME #include "Hash.h" -#endif -#if JVET_M0445_MCTS #include "MCTS.h" -#endif #include <deque> #if ENABLE_WPP_PARALLELISM || ENABLE_SPLIT_PARALLELISM @@ -197,14 +193,12 @@ struct Picture : public UnitArea const CPelUnitBuf getOrigBuf(const UnitArea &unit) const; PelUnitBuf getOrigBuf(); const CPelUnitBuf getOrigBuf() const; -#if JVET_M0427_INLOOP_RESHAPER PelBuf getOrigBuf(const ComponentID compID); const CPelBuf getOrigBuf(const ComponentID compID) const; PelUnitBuf getTrueOrigBuf(); const CPelUnitBuf getTrueOrigBuf() const; PelBuf getTrueOrigBuf(const CompArea &blk); const CPelBuf getTrueOrigBuf(const CompArea &blk) const; -#endif PelBuf getPredBuf(const CompArea &blk); const CPelBuf getPredBuf(const CompArea &blk) const; @@ -233,11 +227,7 @@ struct Picture : public UnitArea const CPelUnitBuf getBuf(const UnitArea &unit, const PictureType &type) const; void extendPicBorder(); -#if JVET_M0132_APS void finalInit(const SPS& sps, const PPS& pps, APS& aps); -#else - void finalInit( const SPS& sps, const PPS& pps ); -#endif int getPOC() const { return poc; } void setBorderExtension( bool bFlag) { m_bIsBorderExtended = bFlag;} @@ -276,12 +266,10 @@ public: PelStorage m_bufs[NUM_PIC_TYPES]; #endif -#if JVET_M0253_HASH_ME TComHash m_hashMap; TComHash* getHashMap() { return &m_hashMap; } const TComHash* getHashMap() const { return &m_hashMap; } void addPictureToHashMapForInter(); -#endif CodingStructure* cs; std::deque<Slice*> slices; @@ -294,9 +282,7 @@ public: #if HEVC_TILES_WPP TileMap* tileMap; #endif -#if JVET_M0445_MCTS MCTSInfo mctsInfo; -#endif std::vector<AQpLayer*> aqlayer; #if !KEEP_PRED_AND_RESI_SIGNALS diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 7ff6099b3ab05b775030964e5696822292d96806..04f9edb9eae2d7e52507a5be9c04476cabf2eabf 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -301,11 +301,7 @@ void Quant::dequant(const TransformUnit &tu, CHECK(uiWidth > m_uiMaxTrSize, "Unsupported transformation size"); // Represents scaling through forward transform -#if JVET_M0464_UNI_MTS const bool bClipTransformShiftTo0 = tu.mtsIdx!=1 && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag(); -#else - const bool bClipTransformShiftTo0 = (tu.transformSkip[compID] != 0) && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag(); -#endif const int originalTransformShift = getTransformShift(channelBitDepth, area.size(), maxLog2TrDynamicRange); const int iTransformShift = bClipTransformShiftTo0 ? std::max<int>(0, originalTransformShift) : originalTransformShift; @@ -313,13 +309,8 @@ void Quant::dequant(const TransformUnit &tu, const int QP_rem = cQP.rem; #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT const bool needsScalingCorrection = TU::needsBlockSizeTrafoScale( tu, compID ); const int NEScale = TU::needsSqrt2Scale( tu, compID ) ? 181 : 1; -#else - const bool needsScalingCorrection = TU::needsBlockSizeTrafoScale( tu.block( compID ) ); - const int NEScale = TU::needsSqrt2Scale( tu.blocks[compID] ) ? 181 : 1; -#endif #if HEVC_USE_SCALING_LISTS const int rightShift = (needsScalingCorrection ? 8 : 0 ) + (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); #else @@ -726,11 +717,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const CCoeffBuf &piCoef = pSrc; CoeffBuf piQCoef = tu.getCoeffs(compID); -#if JVET_M0464_UNI_MTS const bool useTransformSkip = tu.mtsIdx==1; -#else - const bool useTransformSkip = tu.transformSkip[compID]; -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); { @@ -772,11 +759,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf int iWHScale = 1; #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT if( TU::needsBlockSizeTrafoScale( tu, compID ) ) -#else - if( TU::needsBlockSizeTrafoScale( rect ) ) -#endif { iTransformShift += ADJ_QUANT_SHIFT; iWHScale = 181; @@ -837,11 +820,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const CCoeffBuf piCoef = pSrc; -#if JVET_M0464_UNI_MTS const bool useTransformSkip = tu.mtsIdx==1; -#else - const bool useTransformSkip = tu.transformSkip[compID]; -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); #if HEVC_USE_SCALING_LISTS @@ -872,11 +851,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff int iWHScale = 1; #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT if( TU::needsBlockSizeTrafoScale( tu, compID ) ) -#else - if( TU::needsBlockSizeTrafoScale( rect ) ) -#endif { iTransformShift += ADJ_QUANT_SHIFT; iWHScale = 181; diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 7a8338133e9f6e36b7702f3ea9623a8b575df082..b844ae48d4320200b8c2457e54fe67991d4af0c7 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -150,11 +150,7 @@ inline uint32_t QuantRDOQ::xGetCodedLevel( double& rd64CodedCost, { double dErr = double( lLevelDouble - ( Intermediate_Int(uiAbsLevel) << iQBits ) ); -#if JVET_M0470 double dCurrCost = dErr * dErr * errorScale + xGetICost( xGetICRate( uiAbsLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, ui16AbsGoRice, true, maxLog2TrDynamicRange ) ); -#else - double dCurrCost = dErr * dErr * errorScale + xGetICost( xGetICRate( uiAbsLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, ui16AbsGoRice, useLimitedPrefixLength, maxLog2TrDynamicRange ) ); -#endif dCurrCost += dCurrCostSig; if( dCurrCost < rd64CodedCost ) @@ -190,20 +186,12 @@ inline int QuantRDOQ::xGetICRate( const uint32_t uiAbsLevel, const bool useLimitedPrefixLength, const int maxLog2TrDynamicRange ) const { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS if( remRegBins < 4 ) -#else - if( remRegBins < 3 ) -#endif { int iRate = int( xGetIEPRate() ); // cost of sign bit uint32_t symbol = ( uiAbsLevel == 0 ? goRiceZero : uiAbsLevel <= goRiceZero ? uiAbsLevel-1 : uiAbsLevel ); uint32_t length; -#if JVET_M0470 const int threshold = COEF_REMAIN_BIN_REDUCTION; -#else - const int threshold = g_auiGoRiceRange[ui16AbsGoRice]; -#endif if( symbol < ( threshold << ui16AbsGoRice ) ) { length = symbol >> ui16AbsGoRice; @@ -239,20 +227,12 @@ inline int QuantRDOQ::xGetICRate( const uint32_t uiAbsLevel, } int iRate = int( xGetIEPRate() ); // cost of sign bit -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS const uint32_t cthres = 4; -#else - const uint32_t cthres = ( remGt2Bins ? 4 : 2 ); -#endif if( uiAbsLevel >= cthres ) { uint32_t symbol = ( uiAbsLevel - cthres ) >> 1; uint32_t length; -#if JVET_M0470 const int threshold = COEF_REMAIN_BIN_REDUCTION; -#else - const int threshold = g_auiGoRiceRange[ui16AbsGoRice]; -#endif if( symbol < ( threshold << ui16AbsGoRice ) ) { length = symbol >> ui16AbsGoRice; @@ -287,14 +267,7 @@ inline int QuantRDOQ::xGetICRate( const uint32_t uiAbsLevel, iRate += fracBitsGt1.intBits[1]; iRate += fracBitsPar.intBits[( uiAbsLevel - 2 ) & 1]; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS iRate += fracBitsGt2.intBits[1]; -#else - if( remGt2Bins ) - { - iRate += fracBitsGt2.intBits[1]; - } -#endif } else if( uiAbsLevel == 1 ) { @@ -408,18 +381,11 @@ void QuantRDOQ::setScalingList(ScalingList *scalingList, const int maxLog2TrDyna #endif #else -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT double QuantRDOQ::xGetErrScaleCoeff( const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth ) -#else -double QuantRDOQ::xGetErrScaleCoeff( SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth ) -#endif { const int iTransformShift = getTransformShift(channelBitDepth, Size(width, height), maxLog2TrDynamicRange); #if HM_QTBT_AS_IN_JEM_QUANT double dErrScale = (double)( 1 << SCALE_BITS ); // Compensate for scaling of bitcount in Lagrange cost function -#if !JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT - bool needsSqrt2 = TU::needsBlockSizeTrafoScale( Size(width, height) );// ( ( (sizeX+sizeY) & 1 ) !=0 ); -#endif double dTransShift = (double)iTransformShift + ( needsSqrt2 ? -0.5 : 0.0 ); dErrScale = dErrScale*pow( 2.0, ( -2.0*dTransShift ) ); // Compensate for scaling through forward transform int QStep = ( needsSqrt2 ? ( ( g_quantScales[qp] * 181 ) >> 7 ) : g_quantScales[qp] ); @@ -573,17 +539,11 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff const CCoeffBuf &piCoef = pSrc; CoeffBuf piQCoef = tu.getCoeffs(compID); -#if JVET_M0464_UNI_MTS const bool useTransformSkip = tu.mtsIdx==1; -#else - const bool useTransformSkip = tu.transformSkip[compID]; -#endif bool useRDOQ = useTransformSkip ? m_useRDOQTS : m_useRDOQ; -#if JVET_M0102_INTRA_SUBPARTITIONS if( !tu.cu->ispMode || !isLuma(compID) ) -#endif { useRDOQ &= uiWidth > 2; useRDOQ &= uiHeight > 2; @@ -627,9 +587,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const bool extendedPrecision = sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag(); const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(chType); -#if JVET_M0102_INTRA_SUBPARTITIONS const bool useIntraSubPartitions = tu.cu->ispMode && isLuma(compID); -#endif /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the * uiLog2TrSize applied in iTransformShift, such that the result is 1/sqrt(2) the required result (i.e. smaller) @@ -639,11 +597,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, // Represents scaling through forward transform int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); -#if JVET_M0464_UNI_MTS if (tu.mtsIdx==1 && extendedPrecision) -#else - if (tu.transformSkip[compID] && extendedPrecision) -#endif { iTransformShift = std::max<int>(0, iTransformShift); } @@ -695,13 +649,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, tu.transformSkip[compID]); #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT const int defaultQuantisationCoefficient = ( TU::needsSqrt2Scale( rect, tu.transformSkip[compID] ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] ); const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem); -#else - const int defaultQuantisationCoefficient = ( TU::needsSqrt2Scale( rect ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] ); - const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem); -#endif #else const double blkErrScale = ( TU::needsQP3Offset( tu, compID ) ? 2.0 : 1.0 ); const int defaultQuantisationCoefficient = g_quantScales[cQP.rem]; @@ -709,13 +658,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, #endif #else //HEVC_USE_SCALING_LISTS #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT const int quantisationCoefficient = ( TU::needsSqrt2Scale( tu, compID ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] ); const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale( tu, compID ), uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth ); -#else - const int quantisationCoefficient = ( TU::needsSqrt2Scale( rect ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] ); - const double errorScale = xGetErrScaleCoeff( uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth ); -#endif #else const double blkErrScale = ( TU::needsQP3Offset( tu, compID ) ? 2.0 : 1.0 ); const int quantisationCoefficient = g_quantScales[cQP.rem]; @@ -742,20 +686,12 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, bool is2x2subblock = ( iCGSizeM1 == 3 ); int remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK ); -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); -#else - int remRegBins = (is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK) - remGt2Bins; -#endif uint32_t goRiceParam = 0; double *pdCostCoeffGroupSig = m_pdCostCoeffGroupSig; memset( pdCostCoeffGroupSig, 0, ( uiMaxNumCoeff >> cctx.log2CGSize() ) * sizeof( double ) ); -#if JVET_M0257 const int iCGNum = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth) * std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight) >> cctx.log2CGSize(); -#else - const int iCGNum = uiWidth * uiHeight >> cctx.log2CGSize(); -#endif int iScanPos; coeffGroupRDStats rdStats; @@ -825,11 +761,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, uint32_t uiGt1Ctx = cctx.greater1CtxIdAbs ( ctxOffset ); uint32_t uiGt2Ctx = cctx.greater2CtxIdAbs ( ctxOffset ); uint32_t goRiceZero = 0; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS if( remRegBins < 4 ) -#else - if( remRegBins < 3 ) -#endif { unsigned sumAbs = cctx.templateAbsSum( iScanPos, piDstCoeff ); goRiceParam = g_auiGoRiceParsCoeff [ sumAbs ]; @@ -853,11 +785,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, &fracBitsSig, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, iQBits, errorScale, 0, extendedPrecision, maxLog2TrDynamicRange ); #if HEVC_USE_SIGN_HIDING -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS sigRateDelta[ uiBlkPos ] = ( remRegBins < 4 ? 0 : fracBitsSig.intBits[1] - fracBitsSig.intBits[0] ); -#else - sigRateDelta[ uiBlkPos ] = ( remRegBins < 3 ? 0 : fracBitsSig.intBits[1] - fracBitsSig.intBits[0] ); -#endif #endif } @@ -876,11 +804,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, } else // uiLevel == 0 { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS if( remRegBins < 4 ) -#else - if( remRegBins < 3 ) -#endif { int rateNow = xGetICRate( uiLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ); rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; @@ -900,32 +824,14 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ) - remGt2Bins; goRiceParam = 0; } -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS else if( remRegBins >= 4 ) -#else - else if( remRegBins >= 3 ) -#endif { -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS const uint32_t baseLevel = 4; -#else - const uint32_t baseLevel = ( remGt2Bins ? 4 : 2 ); -#endif if( goRiceParam < 3 && ((uiLevel-baseLevel)>>1) > (3<<goRiceParam)-1 ) { goRiceParam++; } -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - if( uiLevel >= 2 && remGt2Bins ) - { - remGt2Bins--; - } -#endif -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS remRegBins -= (uiLevel < 2 ? uiLevel : 3) + (iScanPos != iLastScanPos); -#else - remRegBins -= std::min<int>( uiLevel, 2 ) + (iScanPos != iLastScanPos); -#endif } } else @@ -1037,7 +943,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, } else { -#if JVET_M0102_INTRA_SUBPARTITIONS bool previousCbf = tu.cbf[COMPONENT_Cb]; bool lastCbfIsInferred = false; if( useIntraSubPartitions ) @@ -1074,12 +979,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, { d64BestCost = d64BlockUncodedCost; } -#else - BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[compID]( DeriveCtx::CtxQtCbf( rect.compID, tu.depth, tu.cbf[COMPONENT_Cb] ) ) ); - - d64BestCost = d64BlockUncodedCost + xGetICost( fracBitsQtCbf.intBits[0] ); - d64BaseCost += xGetICost( fracBitsQtCbf.intBits[1] ); -#endif } int lastBitsX[LAST_SIGNIFICANT_GROUPS] = { 0 }; @@ -1089,13 +988,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, int dim1 = ( cctx.scanType() == SCAN_VER ? uiHeight : uiWidth ); int dim2 = ( cctx.scanType() == SCAN_VER ? uiWidth : uiHeight ); #else -#if JVET_M0257 int dim1 = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth); int dim2 = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight); -#else - int dim1 = uiWidth; - int dim2 = uiHeight; -#endif #endif int bitsX = 0; int bitsY = 0; @@ -1206,11 +1100,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, int lastCG = -1; int absSum = 0 ; int n ; -#if JVET_M0257 for (int subSet = iCGNum - 1; subSet >= 0; subSet--) -#else - for( int subSet = (uiWidth*uiHeight-1) >> cctx.log2CGSize(); subSet >= 0; subSet-- ) -#endif { int subPos = subSet << cctx.log2CGSize(); int firstNZPosInCG = iCGSizeM1 + 1, lastNZPosInCG = -1; diff --git a/source/Lib/CommonLib/QuantRDOQ.h b/source/Lib/CommonLib/QuantRDOQ.h index 233c10e7f9f518a2e575f213733a287067b5c297..a51bdca698c3c03bada83ab39ef21562d4a4609c 100644 --- a/source/Lib/CommonLib/QuantRDOQ.h +++ b/source/Lib/CommonLib/QuantRDOQ.h @@ -76,11 +76,7 @@ private: void xDestroyScalingList (); void xSetErrScaleCoeff ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp, const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths ); #else -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT double xGetErrScaleCoeff ( const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth); -#else - double xGetErrScaleCoeff ( SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth); -#endif #endif // RDOQ functions diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index cac3f5978d53c0b7825b1b576f5c2bca779859d7..5c753e9537b20670e0eaa897f6c0c4e785ada977 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -335,16 +335,10 @@ void RdCost::setDistParam( DistParam &rcDP, const Pel* pOrg, const Pel* piRefY, rcDP.cur.stride = iRefStride; rcDP.cur.width = width; rcDP.cur.height = height; -#if JVET_M0147_DMVR rcDP.subShift = subShiftMode; -#endif rcDP.step = step; rcDP.maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); -#if JVET_M0147_DMVR CHECK( useHadamard || rcDP.useMR, "only used in xDMVRCost with these default parameters (so far...)" ); -#else - CHECK( useHadamard || rcDP.useMR || subShiftMode > 0, "only used in xDirectMCCost with these default parameters (so far...)" ); -#endif if ( bioApplied ) { rcDP.distFunc = m_afpDistortFunc[ DF_SAD_INTERMEDIATE_BITDEPTH ]; @@ -2866,15 +2860,11 @@ Distortion RdCost::xGetHADs( const DistParam &rcDtParam ) #if WCG_EXT -#if JVET_M0427_INLOOP_RESHAPER uint32_t RdCost::m_signalType = RESHAPE_SIGNAL_NULL; double RdCost::m_chromaWeight = 1.0; int RdCost::m_lumaBD = 10; std::vector<double> RdCost::m_reshapeLumaLevelToWeightPLUT; std::vector<double> RdCost::m_lumaLevelToWeightPLUT; -#else -double RdCost::m_lumaLevelToWeightPLUT[LUMA_LEVEL_TO_DQP_LUT_MAXSIZE]; -#endif void RdCost::saveUnadjustedLambda() { @@ -2907,7 +2897,6 @@ void RdCost::initLumaLevelToWeightTable() } } -#if JVET_M0427_INLOOP_RESHAPER void RdCost::initLumaLevelToWeightTableReshape() { int lutSize = 1 << m_lumaBD; @@ -2987,7 +2976,6 @@ void RdCost::updateReshapeLumaLevelToWeightTable(SliceReshapeInfo &sliceReshape, THROW("updateReshapeLumaLevelToWeightTable not support other signal types!!"); } } -#endif Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, const uint32_t uiShift, const Pel orgLuma) { @@ -3000,7 +2988,6 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con CHECK(org!=orgLuma, ""); } // use luma to get weight -#if JVET_M0427_INLOOP_RESHAPER double weight = 1.0; if (m_signalType == RESHAPE_SIGNAL_SDR) { @@ -3017,15 +3004,8 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con { weight = m_reshapeLumaLevelToWeightPLUT[orgLuma]; } -#else - double weight = m_lumaLevelToWeightPLUT[orgLuma]; -#endif -#if JVET_M0427_INLOOP_RESHAPER // FIXED_PT_WD_CALCULATION int64_t fixedPTweight = (int64_t)(weight * (double)(1 << 16)); Intermediate_Int mse = Intermediate_Int((fixedPTweight*(iTemp*iTemp) + (1 << 15)) >> 16); -#else - Intermediate_Int mse = Intermediate_Int(weight*(double)iTemp*(double)iTemp+0.5); -#endif distortionVal = Distortion( mse >> uiShift); return distortionVal; } diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 28c75f6fa3d31700bba2fc0c5dc9828778158a37..64d2e64595e9ec84e66bf711c55c558a121a5498 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -107,15 +107,11 @@ private: #if WCG_EXT double m_dLambda_unadjusted; // TODO: check is necessary double m_DistScaleUnadjusted; -#if JVET_M0427_INLOOP_RESHAPER static std::vector<double> m_reshapeLumaLevelToWeightPLUT; static std::vector<double> m_lumaLevelToWeightPLUT; static uint32_t m_signalType; static double m_chromaWeight; static int m_lumaBD; -#else - static double m_lumaLevelToWeightPLUT[LUMA_LEVEL_TO_DQP_LUT_MAXSIZE]; -#endif #endif double m_DistScale; double m_dLambdaMotionSAD[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/]; @@ -298,7 +294,6 @@ public: void saveUnadjustedLambda (); void initLumaLevelToWeightTable (); inline double getWPSNRLumaLevelWeight (int val) { return m_lumaLevelToWeightPLUT[val]; } -#if JVET_M0427_INLOOP_RESHAPER void initLumaLevelToWeightTableReshape(); void updateReshapeLumaLevelToWeightTableChromaMD (std::vector<Pel>& ILUT); void restoreReshapeLumaLevelToWeightTable (); @@ -307,7 +302,6 @@ public: void updateReshapeLumaLevelToWeightTable (SliceReshapeInfo &sliceReshape, Pel *wtTable, double cwt); inline std::vector<double>& getLumaLevelWeightTable () { return m_lumaLevelToWeightPLUT; } #endif -#endif private: diff --git a/source/Lib/CommonLib/Reshape.cpp b/source/Lib/CommonLib/Reshape.cpp index 26b02b0fe060b163798c79e2c6372fec83cc6fb3..85f06103e04aba3cdd177062214aed9fc4e2b613 100644 --- a/source/Lib/CommonLib/Reshape.cpp +++ b/source/Lib/CommonLib/Reshape.cpp @@ -38,7 +38,6 @@ #include <stdio.h> #include <string.h> #include <math.h> -#if JVET_M0427_INLOOP_RESHAPER //! \ingroup CommonLib //! \{ @@ -228,7 +227,6 @@ void Reshape::updateChromaScaleLUT() m_chromaAdjHelpLUT[i] = CW_bin_SC_LUT[Clip3((uint16_t)1, (uint16_t)64, (uint16_t)(binCW >> 1)) - 1]; } } -#endif // diff --git a/source/Lib/CommonLib/Reshape.h b/source/Lib/CommonLib/Reshape.h index 26b1f86c072e457fb3d8ea4eff8d9c1ff966b002..5b41c402df91324a1e594f2af792c2c9770321ac 100644 --- a/source/Lib/CommonLib/Reshape.h +++ b/source/Lib/CommonLib/Reshape.h @@ -45,7 +45,6 @@ #include "CommonDef.h" #include "Rom.h" #include "CommonLib/Picture.h" -#if JVET_M0427_INLOOP_RESHAPER //! \ingroup CommonLib //! \{ // ==================================================================================================================== @@ -100,7 +99,6 @@ public: };// END CLASS DEFINITION Reshape //! \} -#endif // #endif // __RESHAPE__ diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index e2ffe15e5ea4a61deeefc70e98ae86c5a5ada561..4e2a4f03376b5894b135f7ae816f5695597635e4 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -51,9 +51,7 @@ #if ENABLE_TRACING CDTrace *g_trace_ctx = NULL; #endif -#if JVET_M0445_MCTS_DEC_CHECK bool g_mctsDecCheckEnabled = false; -#endif //! \ingroup CommonLib @@ -78,9 +76,7 @@ const char* nalUnitTypeToString(NalUnitType type) #endif case NAL_UNIT_SPS: return "SPS"; case NAL_UNIT_PPS: return "PPS"; -#if JVET_M0132_APS case NAL_UNIT_APS: return "APS"; -#endif case NAL_UNIT_ACCESS_UNIT_DELIMITER: return "AUD"; case NAL_UNIT_EOS: return "EOS"; case NAL_UNIT_EOB: return "EOB"; @@ -110,9 +106,7 @@ const char* nalUnitTypeToString(NalUnitType type) #endif case NAL_UNIT_SPS: return "SPS"; case NAL_UNIT_PPS: return "PPS"; -#if JVET_M0132_APS case NAL_UNIT_APS: return "APS"; -#endif case NAL_UNIT_ACCESS_UNIT_DELIMITER: return "AUD"; case NAL_UNIT_EOS: return "EOS"; case NAL_UNIT_EOB: return "EOB"; @@ -211,72 +205,6 @@ public: return rtn; } }; -#if !JVET_M0064_CCLM_SIMPLIFICATION -int g_aiLMDivTableLow[] = { - 0, 0, 21845, 0, 13107, 43690, 18724, 0, 50972, 39321, 53620, 21845, 15123, 9362, 4369, 0, 3855, - 58254, 17246, 52428, 49932, 59578, 25644, 43690, 28835, 40329, 16990, 37449, 56496, 34952, 4228, 0, 61564, 34695, - 29959, 29127, 15941, 41391, 26886, 26214, 28771, 24966, 6096, 29789, 23301, 45590, 25098, 21845, 30761, 47185, 1285, - 20164, 34622, 41263, 36938, 18724, 49439, 61016, 51095, 17476, 23635, 2114, 16644, 0, 16131, 63550, 9781, 50115, - 52238, 14979, 2769, 14563, 49376, 40738, 53302, 20695, 7660, 13443, 37330, 13107, 5663, 14385, 38689, 12483, 771, - 3048, 18832, 47662, 23563, 11650, 11522, 22795, 45100, 12549, 55878, 43690, 41213, 48148, 64212, 23592, 57100, 33410, - 17815, 10082, 9986, 17311, 31849, 53399, 16233, 51237, 27159, 9362, 63216, 57487, 57557, 63276, 8962, 25547, 47362, - 8738, 40621, 11817, 53281, 33825, 18874, 8322, 2064, 0, 2032, 8065, 18009, 31775, 49275, 4890, 29612, 57825, - 23918, 58887, 31589, 7489, 52056, 34152, 19248, 7281, 63728, 57456, 53944, 53137, 54979, 59419, 868, 10347, 22273, - 36598, 53274, 6721, 27967, 51433, 11540, 39321, 3663, 35599, 4020, 39960, 12312, 52112, 28255, 6241, 51575, 33153, - 16479, 1524, 53792, 42184, 32206, 23831, 17031, 11781, 8054, 5825, 5069, 5761, 7878, 11397, 16295, 22550, 30139, - 39042, 49238, 60707, 7891, 21845, 37012, 53374, 5377, 24074, 43912, 64874, 21406, 44564, 3260, 28550, 54882, 16705, - 45075, 8907, 39258, 5041, 37314, 4993, 39135, 8655, 44613, 15924, 53648, 26699, 604, 40884, 16458, 58386, 35585, - 13579, 57895, 37449, 17767, 64376, 46192, 28743, 12019, 61546, 46244, 31638, 17720, 4481, 57448, 45541, 34288, 23681, - 13710, 4369, 61185, 53078, 45578, 38676, 32366, 26640, 21491, 16912, 12896, 9437, 6527, 4161, 2331, 1032, 257, - 0, 255, 1016, 2277, 4032, 6277, 9004, 12210, 15887, 20031, 24637, 29699, 35213, 41173, 47574, 54411, 61680, - 3840, 11959, 20494, 29443, 38801, 48562, 58724, 3744, 14693, 26028, 37746, 49844, 62316, 9624, 22834, 36408, 50342, - 64632, 13737, 28728, 44063, 59740, 10219, 26568, 43249, 60257, 12055, 29709, 47682, 434, 19033, 37941, 57155, 11136, - 30953, 51067, 5938, 26637, 47624, 3360, 24916, 46751, 3328, 25716, 48376, 5770, 28967, 52428, 10616, 34599, 58840, - 17799, 42547, 2010, 27256, 52748, 12947, 38924, 65140, 26056, 52743, 14127, 41277, 3120, 30726, 58555, 21072, 49344, - 12300, 41007, 4394, 33530, 62876, 26896, 56659, 21092, 51264, 16103, 46678, 11915, 42886, 8515, 39875, 5890, 37632, - 4027, 36145, 2912, 35400, 2534, 35385, 2880, 36089, 3939, 37500, 5698, 39605, 8147, 42395, 11275, 45857, 15069, - 49982, 19521, 54758, 24619, 60175, 30353, 688, 36713, 7357, 43690, 14639, 51274, 22522, 59455, 30999, 2688, 40059, - 12037, 49693, 21956, 59894, 32437, 5117, 43471, 16425, 55050, 28273, 1630, 40655, 14275, 53561, 27441, 1449, 41120, - 15382, 55305, 29818, 4453, 44748, 19629, 60166, 35288, 10529, 51425, 26902, 2496, 43742, 19567, 61042, 37095, 13261, - 55074, 31463, 7962, 50106, 26824, 3649, 46117, 23157, 302, 43088, 20442, 63436, 40997, 18660, 61961, 39826, 17792, - 61393, 39557, 17819, 61715, 40171, 18724, 62908, 41651, 20489, 64956, 43980, 23096, 2304, 47139, 26529, 6009, 51115, - 30773, 10519, 55890, 35811, 15819, 61448, 41628, 21892, 2240, 48208, 28724, 9322, 55538, 36301, 17144, 63604, 44608, - 25692, 6855, 53632, 34952, 16349, 63360, 44911, 26539, 8242, 55557, 37410, 19338, 1340, 48951, 31099, 13320, 61149, - 43513, 25949, 8456, 56569, 39216, 21932, 4718, 53109, 36031, 19022, 2080, 50741, 33933, 17191, 516, 49441, 32896, - 16416, 0, -}; -int g_aiLMDivTableHigh[] = { - 65536, 32768, 21845, 16384, 13107, 10922, 9362, 8192, 7281, 6553, 5957, 5461, 5041, 4681, 4369, 4096, 3855, 3640, - 3449, 3276, 3120, 2978, 2849, 2730, 2621, 2520, 2427, 2340, 2259, 2184, 2114, 2048, 1985, 1927, 1872, 1820, - 1771, 1724, 1680, 1638, 1598, 1560, 1524, 1489, 1456, 1424, 1394, 1365, 1337, 1310, 1285, 1260, 1236, 1213, - 1191, 1170, 1149, 1129, 1110, 1092, 1074, 1057, 1040, 1024, 1008, 992, 978, 963, 949, 936, 923, 910, - 897, 885, 873, 862, 851, 840, 829, 819, 809, 799, 789, 780, 771, 762, 753, 744, 736, 728, - 720, 712, 704, 697, 689, 682, 675, 668, 661, 655, 648, 642, 636, 630, 624, 618, 612, 606, - 601, 595, 590, 585, 579, 574, 569, 564, 560, 555, 550, 546, 541, 537, 532, 528, 524, 520, - 516, 512, 508, 504, 500, 496, 492, 489, 485, 481, 478, 474, 471, 468, 464, 461, 458, 455, - 451, 448, 445, 442, 439, 436, 434, 431, 428, 425, 422, 420, 417, 414, 412, 409, 407, 404, - 402, 399, 397, 394, 392, 390, 387, 385, 383, 381, 378, 376, 374, 372, 370, 368, 366, 364, - 362, 360, 358, 356, 354, 352, 350, 348, 346, 344, 343, 341, 339, 337, 336, 334, 332, 330, - 329, 327, 326, 324, 322, 321, 319, 318, 316, 315, 313, 312, 310, 309, 307, 306, 304, 303, - 302, 300, 299, 297, 296, 295, 293, 292, 291, 289, 288, 287, 286, 284, 283, 282, 281, 280, - 278, 277, 276, 275, 274, 273, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, - 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, - 241, 240, 240, 239, 238, 237, 236, 235, 234, 234, 233, 232, 231, 230, 229, 229, 228, 227, - 226, 225, 225, 224, 223, 222, 222, 221, 220, 219, 219, 218, 217, 217, 216, 215, 214, 214, - 213, 212, 212, 211, 210, 210, 209, 208, 208, 207, 206, 206, 205, 204, 204, 203, 202, 202, - 201, 201, 200, 199, 199, 198, 197, 197, 196, 196, 195, 195, 194, 193, 193, 192, 192, 191, - 191, 190, 189, 189, 188, 188, 187, 187, 186, 186, 185, 185, 184, 184, 183, 183, 182, 182, - 181, 181, 180, 180, 179, 179, 178, 178, 177, 177, 176, 176, 175, 175, 174, 174, 173, 173, - 172, 172, 172, 171, 171, 170, 170, 169, 169, 168, 168, 168, 167, 167, 166, 166, 165, 165, - 165, 164, 164, 163, 163, 163, 162, 162, 161, 161, 161, 160, 160, 159, 159, 159, 158, 158, - 157, 157, 157, 156, 156, 156, 155, 155, 154, 154, 154, 153, 153, 153, 152, 152, 152, 151, - 151, 151, 150, 150, 149, 149, 149, 148, 148, 148, 147, 147, 147, 146, 146, 146, 145, 145, - 145, 144, 144, 144, 144, 143, 143, 143, 142, 142, 142, 141, 141, 141, 140, 140, 140, 140, - 139, 139, 139, 138, 138, 138, 137, 137, 137, 137, 136, 136, 136, 135, 135, 135, 135, 134, - 134, 134, 134, 133, 133, 133, 132, 132, 132, 132, 131, 131, 131, 131, 130, 130, 130, 130, - 129, 129, 129, 129, 128, 128, 128, 128, -}; -#endif const int8_t g_GbiLog2WeightBase = 3; const int8_t g_GbiWeightBase = (1 << g_GbiLog2WeightBase); const int8_t g_GbiWeights[GBI_NUM] = { -2, 3, 4, 5, 10 }; @@ -341,7 +269,6 @@ uint32_t deriveWeightIdxBits(uint8_t gbiIdx) // Note: align this with TEncSbac:: return numBits; } -#if JVET_M0102_INTRA_SUBPARTITIONS // define the sbb sizes uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] = { //===== luma ===== @@ -367,7 +294,6 @@ uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] = { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} } }, }; -#endif // initialize ROM variables void initROM() { @@ -399,10 +325,8 @@ void initROM() SizeIndexInfoLog2 sizeInfo; sizeInfo.init(MAX_CU_SIZE); -#if JVET_M0102_INTRA_SUBPARTITIONS for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) { -#endif // initialize scan orders for (uint32_t blockHeightIdx = 0; blockHeightIdx < sizeInfo.numAllHeights(); blockHeightIdx++) { @@ -426,11 +350,7 @@ void initROM() scan = new ScanElement[totalValues]; } -#if JVET_M0102_INTRA_SUBPARTITIONS g_scanOrder[ch][SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan; -#else - g_scanOrder[SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan; -#endif if (scan == nullptr) { @@ -454,24 +374,14 @@ void initROM() //-------------------------------------------------------------------------------------------------- //grouped scan orders -#if JVET_M0102_INTRA_SUBPARTITIONS const uint32_t* log2Sbb = g_log2SbbSize[ch][ g_aucLog2[blockWidth] ][ g_aucLog2[blockHeight] ]; const uint32_t log2CGWidth = log2Sbb[0]; const uint32_t log2CGHeight = log2Sbb[1]; -#else - const uint32_t log2CGWidth = (blockWidth & 3) + (blockHeight & 3) > 0 ? 1 : 2; - const uint32_t log2CGHeight = (blockWidth & 3) + (blockHeight & 3) > 0 ? 1 : 2; -#endif const uint32_t groupWidth = 1 << log2CGWidth; const uint32_t groupHeight = 1 << log2CGHeight; -#if JVET_M0257 const uint32_t widthInGroups = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, blockWidth) >> log2CGWidth; const uint32_t heightInGroups = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, blockHeight) >> log2CGHeight; -#else - const uint32_t widthInGroups = blockWidth >> log2CGWidth; - const uint32_t heightInGroups = blockHeight >> log2CGHeight; -#endif const uint32_t groupSize = groupWidth * groupHeight; const uint32_t totalGroups = widthInGroups * heightInGroups; @@ -482,13 +392,8 @@ void initROM() ScanElement *scan = new ScanElement[totalValues]; -#if JVET_M0102_INTRA_SUBPARTITIONS g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan; -#else - g_scanOrder[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan; -#endif -#if JVET_M0257 if ( blockWidth > JVET_C0024_ZERO_OUT_TH || blockHeight > JVET_C0024_ZERO_OUT_TH ) { for (uint32_t i = 0; i < totalValues; i++) @@ -498,7 +403,6 @@ void initROM() scan[i].y = blockHeight - 1; } } -#endif ScanGenerator fullBlockScan(widthInGroups, heightInGroups, groupWidth, scanType); @@ -530,9 +434,7 @@ void initROM() //-------------------------------------------------------------------------------------------------- } } -#if JVET_M0102_INTRA_SUBPARTITIONS } -#endif for( int idxH = MAX_CU_DEPTH - MIN_CU_LOG2; idxH >= 0; --idxH ) { @@ -562,7 +464,6 @@ void destroyROM() unsigned numWidths = gp_sizeIdxInfo->numAllWidths(); unsigned numHeights = gp_sizeIdxInfo->numAllHeights(); -#if JVET_M0102_INTRA_SUBPARTITIONS for( uint32_t ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) { for( uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++ ) @@ -580,22 +481,6 @@ void destroyROM() } } } -#else - for (uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++) - { - for (uint32_t scanOrderIndex = 0; scanOrderIndex < SCAN_NUMBER_OF_TYPES; scanOrderIndex++) - { - for (uint32_t blockWidthIdx = 0; blockWidthIdx <= numWidths; blockWidthIdx++) - { - for (uint32_t blockHeightIdx = 0; blockHeightIdx <= numHeights; blockHeightIdx++) - { - delete[] g_scanOrder[groupTypeIndex][scanOrderIndex][blockWidthIdx][blockHeightIdx]; - g_scanOrder[groupTypeIndex][scanOrderIndex][blockWidthIdx][blockHeightIdx] = nullptr; - } - } - } - } -#endif delete gp_sizeIdxInfo; gp_sizeIdxInfo = nullptr; @@ -671,23 +556,6 @@ const uint8_t g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE] = { 0, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 6, 8, 10, 12, 13, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 44, 45, 46, 46, 46, 47, 48, 48, 48, 49, 50, 51, 52, 52, 52, 53, 54, 54, 54, 55, 56, 56, 56, 57, 58, 59, 60, DM_CHROMA_IDX }; -#if !REMOVE_BIN_DECISION_TREE -// ==================================================================================================================== -// Decision tree templates -// ==================================================================================================================== - -const DecisionTreeTemplate g_mtSplitDTT = compile( - decision( DTT_SPLIT_DO_SPLIT_DECISION, - /*0*/ DTT_SPLIT_NO_SPLIT, - /*1*/ decision( DTT_SPLIT_HV_DECISION, - /*0*/ decision( DTT_SPLIT_H_IS_BT_12_DECISION, - /*0*/ DTT_SPLIT_TT_HORZ, - /*1*/ DTT_SPLIT_BT_HORZ ), - /*1*/ decision( DTT_SPLIT_V_IS_BT_12_DECISION, - /*0*/ DTT_SPLIT_TT_VERT, - /*1*/ DTT_SPLIT_BT_VERT ) ) ) ); - -#endif // ==================================================================================================================== @@ -706,11 +574,7 @@ UnitScale g_miScaling( MIN_CU_LOG2, MIN_CU_LOG2 ); // ==================================================================================================================== // scanning order table -#if JVET_M0102_INTRA_SUBPARTITIONS ScanElement *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#else -ScanElement *g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#endif const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,24,32,48,64,96 }; const uint32_t g_uiGroupIdx[MAX_TB_SIZEY] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 }; @@ -724,12 +588,6 @@ const uint32_t g_auiGoRicePosCoeff0[3][32] = {1, 1, 1, 1, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16}, {1, 1, 2, 2, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16} }; -#if !JVET_M0470 -const uint32_t g_auiGoRiceRange[MAX_GR_ORDER_RESIDUAL] = -{ - 6, 5, 6, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION -}; -#endif #if HEVC_USE_SCALING_LISTS const char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = @@ -838,67 +696,7 @@ const uint32_t g_scalingListSize [SCALING_LIST_SIZE_NUM] = { 4, 16, 64, 256, 102 const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM] = { 2, 4, 8, 16, 32, 64, 128 }; #endif -#if !JVET_M0328_KEEP_ONE_WEIGHT_GROUP -const Pel g_trianglePelWeightedLuma[TRIANGLE_DIR_NUM][2][7] = -{ - { // TRIANGLE_DIR_135 - { 1, 2, 4, 6, 7, 0, 0 }, - { 1, 2, 3, 4, 5, 6, 7 } - }, - { // TRIANGLE_DIR_45 - { 7, 6, 4, 2, 1, 0, 0 }, - { 7, 6, 5, 4, 3, 2, 1 } - } -}; -const Pel g_trianglePelWeightedChroma[2][TRIANGLE_DIR_NUM][2][7] = -{ - { // 444 format - { // TRIANGLE_DIR_135 - { 1, 2, 4, 6, 7, 0, 0 }, - { 1, 2, 3, 4, 5, 6, 7 } - }, - { // TRIANGLE_DIR_45 - { 7, 6, 4, 2, 1, 0, 0 }, - { 7, 6, 5, 4, 3, 2, 1 } - } - }, - { // 420 format - { // TRIANGLE_DIR_135 - { 1, 4, 7, 0, 0, 0, 0 }, - { 2, 4, 6, 0, 0, 0, 0 } - }, - { // TRIANGLE_DIR_45 - { 7, 4, 1, 0, 0, 0, 0 }, - { 6, 4, 2, 0, 0, 0, 0 } - } - } -}; - -const uint8_t g_triangleWeightLengthLuma[2] = { 5, 7 }; -const uint8_t g_triangleWeightLengthChroma[2][2] = { { 5, 7 }, { 3, 3 } }; -#endif uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -#if !JVET_M0883_TRIANGLE_SIGNALING -const uint8_t g_triangleCombination[TRIANGLE_MAX_NUM_CANDS][3] = -{ - { 0, 1, 0 }, { 1, 0, 1 }, { 1, 0, 2 }, { 0, 0, 1 }, { 0, 2, 0 }, - { 1, 0, 3 }, { 1, 0, 4 }, { 1, 1, 0 }, { 0, 3, 0 }, { 0, 4, 0 }, - { 0, 0, 2 }, { 0, 1, 2 }, { 1, 1, 2 }, { 0, 0, 4 }, { 0, 0, 3 }, - { 0, 1, 3 }, { 0, 1, 4 }, { 1, 1, 4 }, { 1, 1, 3 }, { 1, 2, 1 }, - { 1, 2, 0 }, { 0, 2, 1 }, { 0, 4, 3 }, { 1, 3, 0 }, { 1, 3, 2 }, - { 1, 3, 4 }, { 1, 4, 0 }, { 1, 3, 1 }, { 1, 2, 3 }, { 1, 4, 1 }, - { 0, 4, 1 }, { 0, 2, 3 }, { 1, 4, 2 }, { 0, 3, 2 }, { 1, 4, 3 }, - { 0, 3, 1 }, { 0, 2, 4 }, { 1, 2, 4 }, { 0, 4, 2 }, { 0, 3, 4 }, -}; - -const uint8_t g_triangleIdxBins[TRIANGLE_MAX_NUM_CANDS] = -{ - 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, - 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 -}; -#endif //! \} diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index 8c679c1e838546d0acb273b0eafc71bb8ff5ace7..d896d304dda40320bfb3a39b13f4fa3991d5c397 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -41,8 +41,6 @@ #include "CommonDef.h" #include "Common.h" -#include "BinaryDecisionTree.h" - #include <stdio.h> #include <iostream> @@ -69,14 +67,9 @@ struct ScanElement uint16_t y; }; -#if JVET_M0102_INTRA_SUBPARTITIONS extern uint32_t g_log2SbbSize [2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2]; extern ScanElement *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#else -extern ScanElement - *g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#endif extern const int g_quantScales [SCALING_LIST_REM_NUM]; // Q(QP%6) extern const int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6) @@ -118,9 +111,6 @@ extern const uint8_t g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]; // Mode-Dependent DST Matrices // ==================================================================================================================== -#if !JVET_M0464_UNI_MTS -extern const uint32_t g_EmtSigNumThr; -#endif extern const TMatrixCoeff g_trCoreDCT2P2 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 2][ 2]; extern const TMatrixCoeff g_trCoreDCT2P4 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 4][ 4]; @@ -139,28 +129,6 @@ extern const TMatrixCoeff g_trCoreDST7P8 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 8][ extern const TMatrixCoeff g_trCoreDST7P16 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 16][ 16]; extern const TMatrixCoeff g_trCoreDST7P32 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 32][ 32]; -#if !REMOVE_BIN_DECISION_TREE -// ==================================================================================================================== -// Decision tree templates -// ==================================================================================================================== - -enum SplitDecisionTree -{ - DTT_SPLIT_DO_SPLIT_DECISION = 0, // decision node - DTT_SPLIT_NO_SPLIT = 1, // end-node - DTT_SPLIT_BT_HORZ = 2, // end-node - id same as CU_HORZ_SPLIT - DTT_SPLIT_BT_VERT = 3, // end-node - id same as CU_VERT_SPLIT - DTT_SPLIT_TT_HORZ = 4, // end-node - id same as CU_TRIH_SPLIT - DTT_SPLIT_TT_VERT = 5, // end-node - id same as CU_TRIV_SPLIT - DTT_SPLIT_HV_DECISION, // decision node - DTT_SPLIT_H_IS_BT_12_DECISION, // decision node - DTT_SPLIT_V_IS_BT_12_DECISION, // decision node -}; - -// decision tree for multi-type tree split decision -extern const DecisionTreeTemplate g_mtSplitDTT; - -#endif // ==================================================================================================================== // Misc. @@ -214,10 +182,6 @@ extern const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM]; extern MsgLevel g_verbosity; -#if !JVET_M0064_CCLM_SIMPLIFICATION -extern int g_aiLMDivTableLow[]; -extern int g_aiLMDivTableHigh[]; -#endif extern const int8_t g_GbiLog2WeightBase; extern const int8_t g_GbiWeightBase; @@ -244,21 +208,9 @@ constexpr uint8_t g_tbMax[257] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, //! \} -#if !JVET_M0328_KEEP_ONE_WEIGHT_GROUP -extern const Pel g_trianglePelWeightedLuma[TRIANGLE_DIR_NUM][2][7]; -extern const Pel g_trianglePelWeightedChroma[2][TRIANGLE_DIR_NUM][2][7]; -extern const uint8_t g_triangleWeightLengthLuma[2]; -extern const uint8_t g_triangleWeightLengthChroma[2][2]; -#endif extern uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -#if !JVET_M0883_TRIANGLE_SIGNALING -extern const uint8_t g_triangleCombination[TRIANGLE_MAX_NUM_CANDS][3]; -extern const uint8_t g_triangleIdxBins[TRIANGLE_MAX_NUM_CANDS]; -#endif -#if JVET_M0445_MCTS_DEC_CHECK extern bool g_mctsDecCheckEnabled; -#endif #endif //__TCOMROM__ diff --git a/source/Lib/CommonLib/RomTr.cpp b/source/Lib/CommonLib/RomTr.cpp index 2df3c5a131c9bf299a36c6a32995206b127253f8..f7fcc1ffed168a922f71213e18aa076deb894d03 100644 --- a/source/Lib/CommonLib/RomTr.cpp +++ b/source/Lib/CommonLib/RomTr.cpp @@ -396,23 +396,13 @@ const TMatrixCoeff g_trCoreDCT8P8[TRANSFORM_NUMBER_OF_DIRECTIONS][8][8] = }; const TMatrixCoeff g_trCoreDCT8P16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16] = { -#if JVET_M0497_FAST_DST7 DEFINE_DCT8_P16_MATRIX(88, 88, 87, 85, 81, 77, 73, 68, 62, 55, 48, 40, 33, 25, 17, 8), DEFINE_DCT8_P16_MATRIX(88, 88, 87, 85, 81, 77, 73, 68, 62, 55, 48, 40, 33, 25, 17, 8) -#else - DEFINE_DCT8_P16_MATRIX(90, 89, 87, 83, 81, 77, 72, 66, 62, 56, 49, 41, 33, 25, 17, 9), - DEFINE_DCT8_P16_MATRIX(90, 89, 87, 83, 81, 77, 72, 66, 62, 56, 49, 41, 33, 25, 17, 9) -#endif }; const TMatrixCoeff g_trCoreDCT8P32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32] = { -#if JVET_M0497_FAST_DST7 DEFINE_DCT8_P32_MATRIX(90, 90, 89, 88, 87, 86, 85, 84, 82, 80, 78, 77, 74, 72, 68, 66, 63, 60, 56, 53, 50, 46, 42, 38, 34, 30, 26, 21, 17, 13, 9, 4), DEFINE_DCT8_P32_MATRIX(90, 90, 89, 88, 87, 86, 85, 84, 82, 80, 78, 77, 74, 72, 68, 66, 63, 60, 56, 53, 50, 46, 42, 38, 34, 30, 26, 21, 17, 13, 9, 4) -#else - DEFINE_DCT8_P32_MATRIX(90, 90, 89, 88, 88, 86, 85, 84, 82, 80, 78, 77, 74, 72, 68, 66, 63, 60, 56, 53, 50, 45, 42, 38, 34, 30, 26, 21, 17, 13, 9, 4), - DEFINE_DCT8_P32_MATRIX(90, 90, 89, 88, 88, 86, 85, 84, 82, 80, 78, 77, 74, 72, 68, 66, 63, 60, 56, 53, 50, 45, 42, 38, 34, 30, 26, 21, 17, 13, 9, 4) -#endif }; // DST-7 @@ -428,23 +418,13 @@ const TMatrixCoeff g_trCoreDST7P8[TRANSFORM_NUMBER_OF_DIRECTIONS][8][8] = }; const TMatrixCoeff g_trCoreDST7P16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16] = { -#if JVET_M0497_FAST_DST7 DEFINE_DST7_P16_MATRIX(8, 17, 25, 33, 40, 48, 55, 62, 68, 73, 77, 81, 85, 87, 88, 88), DEFINE_DST7_P16_MATRIX(8, 17, 25, 33, 40, 48, 55, 62, 68, 73, 77, 81, 85, 87, 88, 88) -#else - DEFINE_DST7_P16_MATRIX(9, 17, 25, 33, 41, 49, 56, 62, 66, 72, 77, 81, 83, 87, 89, 90), - DEFINE_DST7_P16_MATRIX(9, 17, 25, 33, 41, 49, 56, 62, 66, 72, 77, 81, 83, 87, 89, 90) -#endif }; const TMatrixCoeff g_trCoreDST7P32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32] = { -#if JVET_M0497_FAST_DST7 DEFINE_DST7_P32_MATRIX(4, 9, 13, 17, 21, 26, 30, 34, 38, 42, 46, 50, 53, 56, 60, 63, 66, 68, 72, 74, 77, 78, 80, 82, 84, 85, 86, 87, 88, 89, 90, 90), DEFINE_DST7_P32_MATRIX(4, 9, 13, 17, 21, 26, 30, 34, 38, 42, 46, 50, 53, 56, 60, 63, 66, 68, 72, 74, 77, 78, 80, 82, 84, 85, 86, 87, 88, 89, 90, 90) -#else - DEFINE_DST7_P32_MATRIX(4, 9, 13, 17, 21, 26, 30, 34, 38, 42, 45, 50, 53, 56, 60, 63, 66, 68, 72, 74, 77, 78, 80, 82, 84, 85, 86, 88, 88, 89, 90, 90), - DEFINE_DST7_P32_MATRIX(4, 9, 13, 17, 21, 26, 30, 34, 38, 42, 45, 50, 53, 56, 60, 63, 66, 68, 72, 74, 77, 78, 80, 82, 84, 85, 86, 88, 88, 89, 90, 90) -#endif }; //-------------------------------------------------------------------------------------------------- diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index c8da4de8e12c0ff4076f91a35dbebea6e1238545..7180629c0ae50656bd64a49f2a1633295a61a223 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -634,17 +634,12 @@ void SampleAdaptiveOffset::xPCMLFDisableProcess(CodingStructure& cs) void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea) { const SPS& sps = *cs.sps; -#if JVET_M0277_FIX_PCM_DISABLEFILTER uint32_t numComponents = CS::isDualITree(cs) ? 1 : m_numberOfComponents; -#endif for( auto &cu : cs.traverseCUs( ctuArea, CH_L ) ) { // restore PCM samples if( ( cu.ipcm && sps.getPCMFilterDisableFlag() ) || CU::isLosslessCoded( cu ) ) { -#if !JVET_M0277_FIX_PCM_DISABLEFILTER - const uint32_t numComponents = m_numberOfComponents; -#endif for( uint32_t comp = 0; comp < numComponents; comp++ ) { @@ -652,7 +647,6 @@ void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea } } } -#if JVET_M0277_FIX_PCM_DISABLEFILTER numComponents = m_numberOfComponents; if (CS::isDualITree(cs) && numComponents) { @@ -668,7 +662,6 @@ void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea } } } -#endif } void SampleAdaptiveOffset::xPCMSampleRestoration(CodingUnit& cu, const ComponentID compID) @@ -683,12 +676,10 @@ void SampleAdaptiveOffset::xPCMSampleRestoration(CodingUnit& cu, const Component PelBuf dstBuf = cu.cs->getRecoBuf( currTU.block(compID) ); dstBuf.copyFrom( pcmBuf ); -#if JVET_M0427_INLOOP_RESHAPER if (cu.slice->getReshapeInfo().getUseSliceReshaper() && isLuma(compID)) { dstBuf.rspSignal(m_pcReshape->getInvLUT()); } -#endif } return; @@ -707,12 +698,10 @@ void SampleAdaptiveOffset::xPCMSampleRestoration(CodingUnit& cu, const Component dstBuf.at(x,y) = (pcmBuf.at(x,y) << uiPcmLeftShiftBit); } } -#if JVET_M0427_INLOOP_RESHAPER if (cu.slice->getReshapeInfo().getUseSliceReshaper() && isLuma(compID)) { dstBuf.rspSignal(m_pcReshape->getInvLUT()); } -#endif } void SampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructure& cs, const Position &pos, diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.h b/source/Lib/CommonLib/SampleAdaptiveOffset.h index 77591fa8d8aa9f28e32fc3bf3bcc01e61d654494..d3141d56ed63f1141f1eb9d08b7883691ef2364e 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.h +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.h @@ -40,9 +40,7 @@ #include "CommonDef.h" #include "Unit.h" -#if JVET_M0427_INLOOP_RESHAPER #include "Reshape.h" -#endif //! \ingroup CommonLib //! \{ @@ -72,9 +70,7 @@ public: void create( int picWidth, int picHeight, ChromaFormat format, uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth, uint32_t lumaBitShift, uint32_t chromaBitShift ); void destroy(); static int getMaxOffsetQVal(const int channelBitDepth) { return (1<<(std::min<int>(channelBitDepth,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; } //Table 9-32, inclusive -#if JVET_M0427_INLOOP_RESHAPER void setReshaper(Reshape * p) { m_pcReshape = p; } -#endif protected: void deriveLoopFilterBoundaryAvailibility(CodingStructure& cs, const Position &pos, bool& isLeftAvail, @@ -97,9 +93,7 @@ protected: void xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea); void xPCMSampleRestoration(CodingUnit& cu, const ComponentID compID); void xReconstructBlkSAOParams(CodingStructure& cs, SAOBlkParam* saoBlkParams); -#if JVET_M0427_INLOOP_RESHAPER Reshape* m_pcReshape; -#endif protected: uint32_t m_offsetStepLog2[MAX_NUM_COMPONENT]; //offset step PelStorage m_tempBuf; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index a0f5c64e02e42cdbdd58013d9d4a9fd01257cf59..f6c45dfc631bffffa8465aadf707495e003dc731 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -74,9 +74,7 @@ Slice::Slice() , m_signDataHidingEnabledFlag ( false ) #endif , m_bCheckLDC ( false ) -#if JVET_M0444_SMVD , m_biDirPred ( false ) -#endif , m_iSliceQpDelta ( 0 ) , m_iDepth ( 0 ) #if HEVC_VPS @@ -92,9 +90,7 @@ Slice::Slice() , m_colRefIdx ( 0 ) , m_maxNumMergeCand ( 0 ) , m_maxNumAffineMergeCand ( 0 ) -#if JVET_M0255_FRACMMVD_SWITCH , m_disFracMMVD ( false ) -#endif , m_uiTLayer ( 0 ) , m_bTLayerSwitchingFlag ( false ) , m_sliceMode ( NO_SLICES ) @@ -140,10 +136,8 @@ Slice::Slice() , m_uiMaxBTSizeIChroma ( 0 ) , m_uiMaxTTSizeIChroma ( 0 ) , m_uiMaxBTSize ( 0 ) -#if JVET_M0132_APS , m_apsId ( -1 ) , m_aps (NULL) -#endif { for(uint32_t i=0; i<NUM_REF_PIC_LIST_01; i++) { @@ -180,14 +174,12 @@ Slice::Slice() m_saoEnabledFlag[ch] = false; } -#if JVET_M0427_INLOOP_RESHAPER m_sliceReshapeInfo.setUseSliceReshaper(false); m_sliceReshapeInfo.setSliceReshapeModelPresentFlag(false); m_sliceReshapeInfo.setSliceReshapeChromaAdj(0); m_sliceReshapeInfo.reshaperModelMinBinIdx = 0; m_sliceReshapeInfo.reshaperModelMaxBinIdx = PIC_CODE_CW_BINS - 1; memset(m_sliceReshapeInfo.reshaperModelBinCWDelta, 0, PIC_CODE_CW_BINS * sizeof(int)); -#endif } Slice::~Slice() @@ -208,11 +200,9 @@ void Slice::initSlice() m_bCheckLDC = false; -#if JVET_M0444_SMVD m_biDirPred = false; m_symRefIdx[0] = -1; m_symRefIdx[1] = -1; -#endif for (uint32_t component = 0; component < MAX_NUM_COMPONENT; component++) { @@ -224,9 +214,7 @@ void Slice::initSlice() m_bFinalized=false; -#if JVET_M0255_FRACMMVD_SWITCH m_disFracMMVD = false; -#endif m_substreamSizes.clear(); m_cabacInitFlag = false; m_enableTMVPFlag = true; @@ -448,15 +436,6 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); } } -#if JVET_M0483_IBC==0 - if (getSPS()->getIBCMode()) - { - RefPicSetLtCurr[NumPicLtCurr] = getPic(); - //getPic()->setIsLongTerm(true); - getPic()->longTerm = true; - NumPicLtCurr++; - } -#endif // ref_pic_list_init Picture* rpsCurrList0[MAX_NUM_REF+1]; Picture* rpsCurrList1[MAX_NUM_REF+1]; @@ -469,13 +448,6 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. if (getRapPicFlag()) { -#if JVET_M0483_IBC==0 - if (getSPS()->getIBCMode()) - { - CHECK(numPicTotalCurr != 1, "Invalid state"); - } - else -#endif CHECK(numPicTotalCurr != 0, "Invalid state"); } @@ -546,13 +518,6 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); } } -#if JVET_M0483_IBC==0 - if (getSPS()->getIBCMode()) - { - m_apcRefPicList[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = getPic(); - m_bIsUsedAsLongTerm[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = true; - } -#endif // For generalized B // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) if( bCopyL0toL1ErrorCase && isInterB() && getNumRefIdx(REF_PIC_LIST_1) == 0) @@ -583,13 +548,6 @@ int Slice::getNumRpsCurrTempList() const numRpsCurrTempList++; } } -#if JVET_M0483_IBC==0 - if (getSPS()->getIBCMode()) - { - return numRpsCurrTempList + 1; - } - else -#endif return numRpsCurrTempList; } @@ -717,9 +675,7 @@ void Slice::decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& if (rpcPic->getPOC() != pocCurr) { rpcPic->referenced = false; -#if JVET_M0253_HASH_ME rpcPic->getHashMap()->clearAll(); -#endif } iterPic++; } @@ -749,9 +705,7 @@ void Slice::decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != m_iLastIDR) { rpcPic->referenced = false; -#if JVET_M0253_HASH_ME rpcPic->getHashMap()->clearAll(); -#endif } iterPic++; } @@ -769,9 +723,7 @@ void Slice::decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) { rpcPic->referenced = false; -#if JVET_M0253_HASH_ME rpcPic->getHashMap()->clearAll(); -#endif } iterPic++; } @@ -816,11 +768,9 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_bCheckLDC = pSrc->m_bCheckLDC; m_iSliceQpDelta = pSrc->m_iSliceQpDelta; -#if JVET_M0444_SMVD m_biDirPred = pSrc->m_biDirPred; m_symRefIdx[0] = pSrc->m_symRefIdx[0]; m_symRefIdx[1] = pSrc->m_symRefIdx[1]; -#endif for (uint32_t component = 0; component < MAX_NUM_COMPONENT; component++) { @@ -902,9 +852,7 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_enableTMVPFlag = pSrc->m_enableTMVPFlag; m_maxNumMergeCand = pSrc->m_maxNumMergeCand; m_maxNumAffineMergeCand = pSrc->m_maxNumAffineMergeCand; -#if JVET_M0255_FRACMMVD_SWITCH m_disFracMMVD = pSrc->m_disFracMMVD; -#endif if( cpyAlmostAll ) m_encCABACTableIdx = pSrc->m_encCABACTableIdx; m_splitConsOverrideFlag = pSrc->m_splitConsOverrideFlag; m_uiMinQTSize = pSrc->m_uiMinQTSize; @@ -919,9 +867,7 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_depQuantEnabledFlag = pSrc->m_depQuantEnabledFlag; m_signDataHidingEnabledFlag = pSrc->m_signDataHidingEnabledFlag; -#if JVET_M0427_INLOOP_RESHAPER m_sliceReshapeInfo = pSrc->m_sliceReshapeInfo; -#endif } @@ -1252,9 +1198,7 @@ void Slice::applyReferencePictureSet( PicList& rcListPic, const ReferencePicture pcPic->referenced = false; pcPic->usedByCurr = false; pcPic->longTerm = false; -#if JVET_M0253_HASH_ME pcPic->getHashMap()->clearAll(); -#endif } // sanity checks @@ -1730,13 +1674,11 @@ void Slice::stopProcessingTimer() unsigned Slice::getMinPictureDistance() const { int minPicDist = MAX_INT; -#if JVET_M0483_IBC if (getSPS()->getIBCFlag()) { minPicDist = 0; } else -#endif if( ! isIntra() ) { const int currPOC = getPOC(); @@ -1815,41 +1757,27 @@ SPS::SPS() , m_bNoSaoConstraintFlag (false) , m_bNoAlfConstraintFlag (false) , m_bNoPcmConstraintFlag (false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoRefWraparoundConstraintFlag(false) -#endif , m_bNoTemporalMvpConstraintFlag(false) , m_bNoSbtmvpConstraintFlag (false) , m_bNoAmvrConstraintFlag (false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoBdofConstraintFlag (false) -#endif , m_bNoCclmConstraintFlag (false) , m_bNoMtsConstraintFlag (false) , m_bNoAffineMotionConstraintFlag(false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoGbiConstraintFlag (false) , m_bNoMhIntraConstraintFlag (false) , m_bNoTriangleConstraintFlag (false) -#endif , m_bNoLadfConstraintFlag (false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_bNoCurrPicRefConstraintFlag(false) , m_bNoQpDeltaConstraintFlag (false) -#endif , m_bNoDepQuantConstraintFlag (false) , m_bNoSignDataHidingConstraintFlag(false) #endif -#if JVET_M0246_AFFINE_AMVR , m_affineAmvrEnabledFlag ( false ) -#endif -#if JVET_M0147_DMVR , m_DMVR ( false ) -#endif -#if JVET_M0140_SBT , m_SBT ( false ) , m_MaxSbtSize ( 32 ) -#endif #if HEVC_VPS , m_VPSId ( 0) #endif @@ -1876,9 +1804,7 @@ SPS::SPS() , m_bPCMFilterDisableFlag (false) , m_sbtmvpEnabledFlag (false) , m_bdofEnabledFlag (false) -#if JVET_M0255_FRACMMVD_SWITCH , m_disFracMmvdEnabledFlag ( false ) -#endif , m_uiBitsForPOC ( 8) , m_numLongTermRefPicSPS ( 0) #if MAX_TB_SIZE_SIGNALLING @@ -1896,24 +1822,13 @@ SPS::SPS() , m_vuiParameters () , m_wrapAroundEnabledFlag (false) , m_wrapAroundOffset ( 0) -#if JVET_M0483_IBC , m_IBCFlag ( 0) -#endif -#if JVET_M0427_INLOOP_RESHAPER , m_lumaReshapeEnable (false) -#endif , m_AMVREnabledFlag ( false ) , m_LMChroma ( false ) -#if JVET_M0142_CCLM_COLLOCATED_CHROMA , m_cclmCollocatedChromaFlag ( false ) -#endif -#if JVET_M0464_UNI_MTS , m_IntraMTS ( false ) , m_InterMTS ( false ) -#else -, m_IntraEMT ( false ) -, m_InterEMT ( false ) -#endif , m_Affine ( false ) , m_AffineType ( false ) , m_MHIntra ( false ) @@ -1924,9 +1839,6 @@ SPS::SPS() , m_LadfQpOffset { 0 } , m_LadfIntervalLowerBound { 0 } #endif -#if !JVET_M0483_IBC -, m_IBCMode ( 0 ) -#endif { for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) { @@ -1965,11 +1877,7 @@ const int SPS::m_winUnitY[]={1,2,1,1}; PPSRExt::PPSRExt() : m_log2MaxTransformSkipBlockSize (2) , m_crossComponentPredictionEnabledFlag(false) -#if JVET_M0113_M0188_QG_SIZE , m_cuChromaQpOffsetSubdiv (0) -#else -, m_diffCuChromaQpOffsetDepth (0) -#endif , m_chromaQpOffsetListLen (0) // m_ChromaQpAdjTableIncludingNullEntry initialized below // m_log2SaoOffsetScale initialized below @@ -1989,11 +1897,7 @@ PPS::PPS() , m_useDQP (false) , m_bConstrainedIntraPred (false) , m_bSliceChromaQpFlag (false) -#if JVET_M0113_M0188_QG_SIZE , m_cuQpDeltaSubdiv (0) -#else -, m_uiMaxCuDQPDepth (0) -#endif , m_chromaCbQpOffset (0) , m_chromaCrQpOffset (0) , m_numRefIdxL0DefaultActive (1) @@ -2026,7 +1930,6 @@ PPS::~PPS() delete pcv; } -#if JVET_M0132_APS APS::APS() : m_APSId(0) { @@ -2035,7 +1938,6 @@ APS::APS() APS::~APS() { } -#endif ReferencePictureSet::ReferencePictureSet() : m_numberOfPictures (0) , m_numberOfNegativePictures (0) @@ -2514,9 +2416,7 @@ ParameterSetManager::ParameterSetManager() : m_spsMap(MAX_NUM_SPS) #endif , m_ppsMap(MAX_NUM_PPS) -#if JVET_M0132_APS , m_apsMap(MAX_NUM_APS) -#endif #if HEVC_VPS , m_activeVPSId(-1) #endif @@ -2627,7 +2527,6 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) return false; } -#if JVET_M0132_APS bool ParameterSetManager::activateAPS(int apsId) { APS *aps = m_apsMap.getPS(apsId); @@ -2648,7 +2547,6 @@ void ParameterSetMap<APS>::setID(APS* parameterSet, const int psId) { parameterSet->setAPSId(psId); } -#endif template <> void ParameterSetMap<PPS>::setID(PPS* parameterSet, const int psId) { @@ -2785,12 +2683,10 @@ void xTracePPSHeader() DTRACE( g_trace_ctx, D_HEADER, "=========== Picture Parameter Set ===========\n" ); } -#if JVET_M0132_APS void xTraceAPSHeader() { DTRACE(g_trace_ctx, D_HEADER, "=========== Adaptation Parameter Set ===========\n"); } -#endif void xTraceSliceHeader() { diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 98ea2df2f904d5c6bf01883b4542e1255a98341d..3ccca6122a9690e81be248ce587ec8d6b9ddcedb 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -208,28 +208,20 @@ class ConstraintInfo bool m_noSaoConstraintFlag; bool m_noAlfConstraintFlag; bool m_noPcmConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_noRefWraparoundConstraintFlag; -#endif bool m_noTemporalMvpConstraintFlag; bool m_noSbtmvpConstraintFlag; bool m_noAmvrConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_noBdofConstraintFlag; -#endif bool m_noCclmConstraintFlag; bool m_noMtsConstraintFlag; bool m_noAffineMotionConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_noGbiConstraintFlag; bool m_noMhIntraConstraintFlag; bool m_noTriangleConstraintFlag; -#endif bool m_noLadfConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_noCurrPicRefConstraintFlag; bool m_noQpDeltaConstraintFlag; -#endif bool m_noDepQuantConstraintFlag; bool m_noSignDataHidingConstraintFlag; @@ -246,28 +238,20 @@ public: , m_noSaoConstraintFlag (false) , m_noAlfConstraintFlag (false) , m_noPcmConstraintFlag (false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_noRefWraparoundConstraintFlag(false) -#endif , m_noTemporalMvpConstraintFlag(false) , m_noSbtmvpConstraintFlag (false) , m_noAmvrConstraintFlag (false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_noBdofConstraintFlag (false) -#endif , m_noCclmConstraintFlag (false) , m_noMtsConstraintFlag (false) , m_noAffineMotionConstraintFlag(false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_noGbiConstraintFlag (false) , m_noMhIntraConstraintFlag (false) , m_noTriangleConstraintFlag (false) -#endif , m_noLadfConstraintFlag (false) -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX , m_noCurrPicRefConstraintFlag(false) , m_noQpDeltaConstraintFlag (false) -#endif , m_noDepQuantConstraintFlag (false) , m_noSignDataHidingConstraintFlag(false) {} @@ -307,42 +291,34 @@ public: void setNoAlfConstraintFlag(bool bVal) { m_noAlfConstraintFlag = bVal; } bool getNoPcmConstraintFlag() const { return m_noPcmConstraintFlag; } void setNoPcmConstraintFlag(bool bVal) { m_noPcmConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoRefWraparoundConstraintFlag() const { return m_noRefWraparoundConstraintFlag; } void setNoRefWraparoundConstraintFlag(bool bVal) { m_noRefWraparoundConstraintFlag = bVal; } -#endif bool getNoTemporalMvpConstraintFlag() const { return m_noTemporalMvpConstraintFlag; } void setNoTemporalMvpConstraintFlag(bool bVal) { m_noTemporalMvpConstraintFlag = bVal; } bool getNoSbtmvpConstraintFlag() const { return m_noSbtmvpConstraintFlag; } void setNoSbtmvpConstraintFlag(bool bVal) { m_noSbtmvpConstraintFlag = bVal; } bool getNoAmvrConstraintFlag() const { return m_noAmvrConstraintFlag; } void setNoAmvrConstraintFlag(bool bVal) { m_noAmvrConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoBdofConstraintFlag() const { return m_noBdofConstraintFlag; } void setNoBdofConstraintFlag(bool bVal) { m_noBdofConstraintFlag = bVal; } -#endif bool getNoCclmConstraintFlag() const { return m_noCclmConstraintFlag; } void setNoCclmConstraintFlag(bool bVal) { m_noCclmConstraintFlag = bVal; } bool getNoMtsConstraintFlag() const { return m_noMtsConstraintFlag; } void setNoMtsConstraintFlag(bool bVal) { m_noMtsConstraintFlag = bVal; } bool getNoAffineMotionConstraintFlag() const { return m_noAffineMotionConstraintFlag; } void setNoAffineMotionConstraintFlag(bool bVal) { m_noAffineMotionConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoGbiConstraintFlag() const { return m_noGbiConstraintFlag; } void setNoGbiConstraintFlag(bool bVal) { m_noGbiConstraintFlag = bVal; } bool getNoMhIntraConstraintFlag() const { return m_noMhIntraConstraintFlag; } void setNoMhIntraConstraintFlag(bool bVal) { m_noMhIntraConstraintFlag = bVal; } bool getNoTriangleConstraintFlag() const { return m_noTriangleConstraintFlag; } void setNoTriangleConstraintFlag(bool bVal) { m_noTriangleConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_noLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_noLadfConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoCurrPicRefConstraintFlag() const { return m_noCurrPicRefConstraintFlag; } void setNoCurrPicRefConstraintFlag(bool bVal) { m_noCurrPicRefConstraintFlag = bVal; } bool getNoQpDeltaConstraintFlag() const { return m_noQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_noQpDeltaConstraintFlag = bVal; } -#endif bool getNoDepQuantConstraintFlag() const { return m_noDepQuantConstraintFlag; } void setNoDepQuantConstraintFlag(bool bVal) { m_noDepQuantConstraintFlag = bVal; } bool getNoSignDataHidingConstraintFlag() const { return m_noSignDataHidingConstraintFlag; } @@ -479,7 +455,6 @@ struct HrdSubLayerInfo uint32_t duBitRateValue [MAX_CPB_CNT][2]; }; -#if JVET_M0427_INLOOP_RESHAPER class SliceReshapeInfo { public: @@ -509,7 +484,6 @@ struct ReshapeCW int rspSliceQP; int rspFpsToIp; }; -#endif class HRD { @@ -1024,42 +998,28 @@ private: bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; bool m_bNoPcmConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoRefWraparoundConstraintFlag; -#endif bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; bool m_bNoAmvrConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoBdofConstraintFlag; -#endif bool m_bNoCclmConstraintFlag; bool m_bNoMtsConstraintFlag; bool m_bNoAffineMotionConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoGbiConstraintFlag; bool m_bNoMhIntraConstraintFlag; bool m_bNoTriangleConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoCurrPicRefConstraintFlag; bool m_bNoQpDeltaConstraintFlag; -#endif bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; #endif -#if JVET_M0246_AFFINE_AMVR bool m_affineAmvrEnabledFlag; -#endif -#if JVET_M0147_DMVR bool m_DMVR; -#endif -#if JVET_M0140_SBT bool m_SBT; uint8_t m_MaxSbtSize; -#endif #if HEVC_VPS int m_VPSId; #endif @@ -1104,9 +1064,7 @@ private: bool m_sbtmvpEnabledFlag; bool m_bdofEnabledFlag; -#if JVET_M0255_FRACMMVD_SWITCH bool m_disFracMmvdEnabledFlag; -#endif uint32_t m_uiBitsForPOC; uint32_t m_numLongTermRefPicSPS; uint32_t m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]; @@ -1148,28 +1106,15 @@ private: bool m_wrapAroundEnabledFlag; unsigned m_wrapAroundOffset; -#if JVET_M0483_IBC unsigned m_IBCFlag; -#endif -#if JVET_M0427_INLOOP_RESHAPER bool m_lumaReshapeEnable; -#endif bool m_AMVREnabledFlag; bool m_LMChroma; -#if JVET_M0142_CCLM_COLLOCATED_CHROMA bool m_cclmCollocatedChromaFlag; -#endif -#if JVET_M0303_IMPLICIT_MTS bool m_MTS; -#endif -#if JVET_M0464_UNI_MTS bool m_IntraMTS; // 18 bool m_InterMTS; // 19 -#else - bool m_IntraEMT; // 18 - bool m_InterEMT; // 19 -#endif bool m_Affine; bool m_AffineType; bool m_GBi; // @@ -1182,9 +1127,6 @@ private: int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS]; #endif -#if !JVET_M0483_IBC - unsigned m_IBCMode; -#endif public: @@ -1212,42 +1154,34 @@ public: void setNoAlfConstraintFlag(bool bVal) { m_bNoAlfConstraintFlag = bVal; } bool getNoPcmConstraintFlag() const { return m_bNoPcmConstraintFlag; } void setNoPcmConstraintFlag(bool bVal) { m_bNoPcmConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoRefWraparoundConstraintFlag() const { return m_bNoRefWraparoundConstraintFlag; } void setNoRefWraparoundConstraintFlag(bool bVal) { m_bNoRefWraparoundConstraintFlag= bVal; } -#endif bool getNoTemporalMvpConstraintFlag() const { return m_bNoTemporalMvpConstraintFlag; } void setNoTemporalMvpConstraintFlag(bool bVal) { m_bNoTemporalMvpConstraintFlag = bVal; } bool getNoSbtmvpConstraintFlag() const { return m_bNoSbtmvpConstraintFlag; } void setNoSbtmvpConstraintFlag(bool bVal) { m_bNoSbtmvpConstraintFlag = bVal; } bool getNoAmvrConstraintFlag() const { return m_bNoAmvrConstraintFlag; } void setNoAmvrConstraintFlag(bool bVal) { m_bNoAmvrConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoBdofConstraintFlag() const { return m_bNoBdofConstraintFlag; } void setNoBdofConstraintFlag(bool bVal) { m_bNoBdofConstraintFlag = bVal; } -#endif bool getNoCclmConstraintFlag() const { return m_bNoCclmConstraintFlag; } void setNoCclmConstraintFlag(bool bVal) { m_bNoCclmConstraintFlag = bVal; } bool getNoMtsConstraintFlag() const { return m_bNoMtsConstraintFlag; } void setNoMtsConstraintFlag(bool bVal) { m_bNoMtsConstraintFlag = bVal; } bool getNoAffineMotionConstraintFlag() const { return m_bNoAffineMotionConstraintFlag; } void setNoAffineMotionConstraintFlag(bool bVal) { m_bNoAffineMotionConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoGbiConstraintFlag() const { return m_bNoGbiConstraintFlag; } void setNoGbiConstraintFlag(bool bVal) { m_bNoGbiConstraintFlag = bVal; } bool getNoMhIntraConstraintFlag() const { return m_bNoMhIntraConstraintFlag; } void setNoMhIntraConstraintFlag(bool bVal) { m_bNoMhIntraConstraintFlag = bVal; } bool getNoTriangleConstraintFlag() const { return m_bNoTriangleConstraintFlag; } void setNoTriangleConstraintFlag(bool bVal) { m_bNoTriangleConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_bNoLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoCurrPicRefConstraintFlag() const { return m_bNoCurrPicRefConstraintFlag; } void setNoCurrPicRefConstraintFlag(bool bVal) { m_bNoCurrPicRefConstraintFlag = bVal; } bool getNoQpDeltaConstraintFlag() const { return m_bNoQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_bNoQpDeltaConstraintFlag = bVal; } -#endif bool getNoDepQuantConstraintFlag() const { return m_bNoDepQuantConstraintFlag; } void setNoDepQuantConstraintFlag(bool bVal) { m_bNoDepQuantConstraintFlag = bVal; } bool getNoSignDataHidingConstraintFlag() const { return m_bNoSignDataHidingConstraintFlag; } @@ -1367,14 +1301,10 @@ public: void setBDOFEnabledFlag(bool b) { m_bdofEnabledFlag = b; } bool getBDOFEnabledFlag() const { return m_bdofEnabledFlag; } -#if JVET_M0255_FRACMMVD_SWITCH bool getDisFracMmvdEnabledFlag() const { return m_disFracMmvdEnabledFlag; } void setDisFracMmvdEnabledFlag( bool b ) { m_disFracMmvdEnabledFlag = b; } -#endif -#if JVET_M0147_DMVR bool getUseDMVR()const { return m_DMVR; } void setUseDMVR(bool b) { m_DMVR = b; } -#endif uint32_t getMaxTLayers() const { return m_uiMaxTLayers; } void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; } @@ -1403,10 +1333,8 @@ public: bool getUseStrongIntraSmoothing() const { return m_useStrongIntraSmoothing; } #endif -#if JVET_M0246_AFFINE_AMVR void setAffineAmvrEnabledFlag( bool val ) { m_affineAmvrEnabledFlag = val; } bool getAffineAmvrEnabledFlag() const { return m_affineAmvrEnabledFlag; } -#endif bool getVuiParametersPresentFlag() const { return m_vuiParametersPresentFlag; } void setVuiParametersPresentFlag(bool b) { m_vuiParametersPresentFlag = b; } VUI* getVuiParameters() { return &m_vuiParameters; } @@ -1426,20 +1354,14 @@ public: bool getWrapAroundEnabledFlag() const { return m_wrapAroundEnabledFlag; } void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; } unsigned getWrapAroundOffset() const { return m_wrapAroundOffset; } -#if JVET_M0427_INLOOP_RESHAPER void setUseReshaper(bool b) { m_lumaReshapeEnable = b; } bool getUseReshaper() const { return m_lumaReshapeEnable; } -#endif -#if JVET_M0483_IBC void setIBCFlag(unsigned IBCFlag) { m_IBCFlag = IBCFlag; } unsigned getIBCFlag() const { return m_IBCFlag; } -#endif -#if JVET_M0140_SBT void setUseSBT( bool b ) { m_SBT = b; } bool getUseSBT() const { return m_SBT; } void setMaxSbtSize( uint8_t val ) { m_MaxSbtSize = val; } uint8_t getMaxSbtSize() const { return m_MaxSbtSize; } -#endif void setAMVREnabledFlag ( bool b ) { m_AMVREnabledFlag = b; } bool getAMVREnabledFlag () const { return m_AMVREnabledFlag; } @@ -1449,30 +1371,15 @@ public: bool getUseAffineType () const { return m_AffineType; } void setUseLMChroma ( bool b ) { m_LMChroma = b; } bool getUseLMChroma () const { return m_LMChroma; } -#if JVET_M0142_CCLM_COLLOCATED_CHROMA void setCclmCollocatedChromaFlag( bool b ) { m_cclmCollocatedChromaFlag = b; } bool getCclmCollocatedChromaFlag() const { return m_cclmCollocatedChromaFlag; } -#endif -#if JVET_M0303_IMPLICIT_MTS void setUseMTS ( bool b ) { m_MTS = b; } bool getUseMTS () const { return m_MTS; } -#if JVET_M0464_UNI_MTS bool getUseImplicitMTS () const { return m_MTS && !m_IntraMTS && !m_InterMTS; } -#else - bool getUseImplicitMTS () const { return m_MTS && !m_IntraEMT && !m_InterEMT; } -#endif -#endif -#if JVET_M0464_UNI_MTS void setUseIntraMTS ( bool b ) { m_IntraMTS = b; } bool getUseIntraMTS () const { return m_IntraMTS; } void setUseInterMTS ( bool b ) { m_InterMTS = b; } bool getUseInterMTS () const { return m_InterMTS; } -#else - void setUseIntraEMT ( bool b ) { m_IntraEMT = b; } - bool getUseIntraEMT () const { return m_IntraEMT; } - void setUseInterEMT ( bool b ) { m_InterEMT = b; } - bool getUseInterEMT () const { return m_InterEMT; } -#endif void setUseGBi ( bool b ) { m_GBi = b; } bool getUseGBi () const { return m_GBi; } #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET @@ -1490,10 +1397,6 @@ public: bool getUseMHIntra () const { return m_MHIntra; } void setUseTriangle ( bool b ) { m_Triangle = b; } bool getUseTriangle () const { return m_Triangle; } -#if !JVET_M0483_IBC - void setIBCMode (unsigned IBCMode) { m_IBCMode = IBCMode; } - unsigned getIBCMode () const { return m_IBCMode; } -#endif }; @@ -1531,11 +1434,7 @@ private: bool m_crossComponentPredictionEnabledFlag; // Chroma QP Adjustments -#if JVET_M0113_M0188_QG_SIZE int m_cuChromaQpOffsetSubdiv; -#else - int m_diffCuChromaQpOffsetDepth; -#endif int m_chromaQpOffsetListLen; // size (excludes the null entry used in the following array). ChromaQpAdj m_ChromaQpAdjTableIncludingNullEntry[1+MAX_QP_OFFSET_LIST_SIZE]; //!< Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise @@ -1561,13 +1460,8 @@ public: void clearChromaQpOffsetList() { m_chromaQpOffsetListLen = 0; } -#if JVET_M0113_M0188_QG_SIZE uint32_t getCuChromaQpOffsetSubdiv () const { return m_cuChromaQpOffsetSubdiv; } void setCuChromaQpOffsetSubdiv ( uint32_t u ) { m_cuChromaQpOffsetSubdiv = u; } -#else - uint32_t getDiffCuChromaQpOffsetDepth () const { return m_diffCuChromaQpOffsetDepth; } - void setDiffCuChromaQpOffsetDepth ( uint32_t u ) { m_diffCuChromaQpOffsetDepth = u; } -#endif bool getChromaQpOffsetListEnabledFlag() const { return getChromaQpOffsetListLen()>0; } int getChromaQpOffsetListLen() const { return m_chromaQpOffsetListLen; } @@ -1605,11 +1499,7 @@ private: bool m_bSliceChromaQpFlag; // slicelevel_chroma_qp_flag // access channel -#if JVET_M0113_M0188_QG_SIZE uint32_t m_cuQpDeltaSubdiv; // cu_qp_delta_subdiv -#else - uint32_t m_uiMaxCuDQPDepth; -#endif int m_chromaCbQpOffset; int m_chromaCrQpOffset; @@ -1677,13 +1567,8 @@ public: bool getSliceChromaQpFlag() const { return m_bSliceChromaQpFlag; } void setSliceChromaQpFlag( bool b ) { m_bSliceChromaQpFlag = b; } -#if JVET_M0113_M0188_QG_SIZE void setCuQpDeltaSubdiv( uint32_t u ) { m_cuQpDeltaSubdiv = u; } uint32_t getCuQpDeltaSubdiv() const { return m_cuQpDeltaSubdiv; } -#else - void setMaxCuDQPDepth( uint32_t u ) { m_uiMaxCuDQPDepth = u; } - uint32_t getMaxCuDQPDepth() const { return m_uiMaxCuDQPDepth; } -#endif void setQpOffset(ComponentID compID, int i ) { @@ -1782,7 +1667,6 @@ public: PPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; } }; -#if JVET_M0132_APS class APS { private: @@ -1799,7 +1683,6 @@ public: void setAlfAPSParam(AlfSliceParam& alfAPSParam) { m_alfAPSParam = alfAPSParam; } const AlfSliceParam& getAlfAPSParam() const { return m_alfAPSParam; } }; -#endif struct WPScalingParam { // Explicit weighted prediction parameters parsed in slice header, @@ -1864,10 +1747,8 @@ private: #endif bool m_bCheckLDC; -#if JVET_M0444_SMVD bool m_biDirPred; int m_symRefIdx[2]; -#endif // Data int m_iSliceQpDelta; @@ -1894,9 +1775,7 @@ private: uint32_t m_colRefIdx; uint32_t m_maxNumMergeCand; uint32_t m_maxNumAffineMergeCand; -#if JVET_M0255_FRACMMVD_SWITCH bool m_disFracMMVD; -#endif double m_lambdas[MAX_NUM_COMPONENT]; bool m_abEqualRef [NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_REF]; @@ -1958,18 +1837,10 @@ private: uint32_t m_uiMaxTTSizeIChroma; uint32_t m_uiMaxBTSize; -#if JVET_M0132_APS int m_apsId; APS* m_aps; -#endif -#if !JVET_M0132_APS - AlfSliceParam m_alfSliceParam; -#else bool m_tileGroupAlfEnabledFlag; -#endif -#if JVET_M0427_INLOOP_RESHAPER SliceReshapeInfo m_sliceReshapeInfo; -#endif public: Slice(); virtual ~Slice(); @@ -1987,12 +1858,10 @@ public: void setPPSId( int PPSId ) { m_iPPSId = PPSId; } int getPPSId() const { return m_iPPSId; } -#if JVET_M0132_APS void setAPS(APS* aps) { m_aps = aps; m_apsId = (aps) ? aps->getAPSId() : -1; } APS* getAPS() { return m_aps; } void setAPSId(int apsId) { m_apsId = apsId; } int getAPSId() const { return m_apsId; } -#endif void setPicOutputFlag( bool b ) { m_PicOutputFlag = b; } bool getPicOutputFlag() const { return m_PicOutputFlag; } void setSaoEnabledFlag(ChannelType chType, bool s) {m_saoEnabledFlag[chType] =s; } @@ -2082,11 +1951,9 @@ public: void setCheckLDC( bool b ) { m_bCheckLDC = b; } void setMvdL1ZeroFlag( bool b) { m_bLMvdL1Zero = b; } -#if JVET_M0444_SMVD void setBiDirPred( bool b, int refIdx0, int refIdx1 ) { m_biDirPred = b; m_symRefIdx[0] = refIdx0; m_symRefIdx[1] = refIdx1; } bool getBiDirPred() const { return m_biDirPred; } int getSymRefIdx( int refList ) const { return m_symRefIdx[refList]; } -#endif bool isIntra() const { return m_eSliceType == I_SLICE; } bool isInterB() const { return m_eSliceType == B_SLICE; } @@ -2160,10 +2027,8 @@ public: uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; } void setMaxNumAffineMergeCand( uint32_t val ) { m_maxNumAffineMergeCand = val; } uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; } -#if JVET_M0255_FRACMMVD_SWITCH void setDisFracMMVD( bool val ) { m_disFracMMVD = val; } bool getDisFracMMVD() const { return m_disFracMMVD; } -#endif void setNoOutputPriorPicsFlag( bool val ) { m_noOutputPriorPicsFlag = val; } bool getNoOutputPriorPicsFlag() const { return m_noOutputPriorPicsFlag; } @@ -2261,18 +2126,11 @@ public: void resetProcessingTime() { m_dProcessingTime = m_iProcessingStartTime = 0; } double getProcessingTime() const { return m_dProcessingTime; } -#if !JVET_M0132_APS - void setAlfSliceParam( AlfSliceParam& alfSliceParam ) { m_alfSliceParam = alfSliceParam; } - AlfSliceParam& getAlfSliceParam() { return m_alfSliceParam; } -#else bool getTileGroupAlfEnabledFlag() const { return m_tileGroupAlfEnabledFlag; } void setTileGroupAlfEnabledFlag(bool b) { m_tileGroupAlfEnabledFlag = b; } -#endif -#if JVET_M0427_INLOOP_RESHAPER const SliceReshapeInfo& getReshapeInfo() const { return m_sliceReshapeInfo; } SliceReshapeInfo& getReshapeInfo() { return m_sliceReshapeInfo; } -#endif protected: Picture* xGetRefPic (PicList& rcListPic, int poc); Picture* xGetLongTermRefPic(PicList& rcListPic, int poc, bool pocHasMsb); @@ -2464,14 +2322,12 @@ public: //! \returns true, if activation is successful bool activatePPS(int ppsId, bool isIRAP); -#if JVET_M0132_APS void storeAPS(APS *aps, const std::vector<uint8_t> &naluData) { m_apsMap.storePS(aps->getAPSId(), aps, &naluData); }; APS* getAPS(int apsId) { return m_apsMap.getPS(apsId); }; bool getAPSChangedFlag(int apsId) const { return m_apsMap.getChangedFlag(apsId); } void clearAPSChangedFlag(int apsId) { m_apsMap.clearChangedFlag(apsId); } APS* getFirstAPS() { return m_apsMap.getFirstPS(); }; bool activateAPS(int apsId); -#endif #if HEVC_VPS const VPS* getActiveVPS()const { return m_vpsMap.getPS(m_activeVPSId); }; #endif @@ -2483,9 +2339,7 @@ protected: #endif ParameterSetMap<SPS> m_spsMap; ParameterSetMap<PPS> m_ppsMap; -#if JVET_M0132_APS ParameterSetMap<APS> m_apsMap; -#endif #if HEVC_VPS int m_activeVPSId; // -1 for nothing active @@ -2580,9 +2434,7 @@ void xTraceVPSHeader(); #endif void xTraceSPSHeader(); void xTracePPSHeader(); -#if JVET_M0132_APS void xTraceAPSHeader(); -#endif void xTraceSliceHeader(); void xTraceAccessUnitDelimiter(); #endif diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index c14a3266b7e82b916500ec422242daef0061f722..8c701503e3009991f614e59fe2978e5dec32badd 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -91,13 +91,11 @@ TrQuant::TrQuant() : m_quant( nullptr ) { // allocate temporary buffers m_plTempCoeff = (TCoeff*) xMalloc( TCoeff, MAX_CU_SIZE * MAX_CU_SIZE ); -#if JVET_M0464_UNI_MTS m_mtsCoeffs = new TCoeff*[ NUM_TRAFO_MODES_MTS ]; for( int i = 0; i < NUM_TRAFO_MODES_MTS; i++ ) { m_mtsCoeffs[i] = (TCoeff*) xMalloc( TCoeff, MAX_CU_SIZE * MAX_CU_SIZE ); } -#endif } TrQuant::~TrQuant() @@ -114,7 +112,6 @@ TrQuant::~TrQuant() xFree( m_plTempCoeff ); m_plTempCoeff = nullptr; } -#if JVET_M0464_UNI_MTS if( m_mtsCoeffs ) { for( int i = 0; i < NUM_TRAFO_MODES_MTS; i++ ) @@ -125,7 +122,6 @@ TrQuant::~TrQuant() delete[] m_mtsCoeffs; m_mtsCoeffs = nullptr; } -#endif } #if ENABLE_SPLIT_PARALLELISM @@ -208,11 +204,7 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel DTRACE_COEFF_BUF( D_TCOEFF, tempCoeff, tu, tu.cu->predMode, compID ); -#if JVET_M0464_UNI_MTS if( isLuma(compID) && tu.mtsIdx == 1 ) -#else - if( tu.transformSkip[compID] ) -#endif { xITransformSkip( tempCoeff, pResi, tu, compID ); } @@ -231,11 +223,7 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf & { const CompArea &area = tu.blocks[compID]; -#if JVET_M0464_UNI_MTS if (CU::isRDPCMEnabled(*tu.cu) && (tu.mtsIdx==1 || tu.cu->transQuantBypass)) -#else - if (CU::isRDPCMEnabled(*tu.cu) && ((tu.transformSkip[compID] != 0) || tu.cu->transQuantBypass)) -#endif { const uint32_t uiWidth = area.width; const uint32_t uiHeight = area.height; @@ -295,27 +283,18 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf & void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer ) { -#if JVET_M0464_UNI_MTS bool mtsActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS() && CU::isInter( *tu.cu ); -#else - bool emtActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraEMT() : tu.cs->sps->getUseInterEMT() && CU::isInter( *tu.cu ); -#endif -#if JVET_M0303_IMPLICIT_MTS bool mtsImplicit = CU::isIntra( *tu.cu ) && tu.cs->sps->getUseImplicitMTS() && compID == COMPONENT_Y; -#endif trTypeHor = DCT2; trTypeVer = DCT2; -#if JVET_M0102_INTRA_SUBPARTITIONS if (tu.cu->ispMode && isLuma(compID)) { TU::getTransformTypeISP(tu, compID, trTypeHor, trTypeVer); return; } -#endif -#if JVET_M0140_SBT if( tu.cu->sbtInfo && compID == COMPONENT_Y ) { uint8_t sbtIdx = tu.cu->getSbtIdx(); @@ -323,13 +302,8 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy if( sbtIdx == SBT_VER_HALF || sbtIdx == SBT_VER_QUAD ) { -#if JVET_M0464_UNI_MTS assert( tu.lwidth() <= MTS_INTER_MAX_CU_SIZE ); if( tu.lheight() > MTS_INTER_MAX_CU_SIZE ) -#else - assert( tu.lwidth() <= EMT_INTER_MAX_CU_WITH_QTBT ); - if( tu.lheight() > EMT_INTER_MAX_CU_WITH_QTBT ) -#endif { trTypeHor = trTypeVer = DCT2; } @@ -341,13 +315,8 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy } else { -#if JVET_M0464_UNI_MTS assert( tu.lheight() <= MTS_INTER_MAX_CU_SIZE ); if( tu.lwidth() > MTS_INTER_MAX_CU_SIZE ) -#else - assert( tu.lheight() <= EMT_INTER_MAX_CU_WITH_QTBT ); - if( tu.lwidth() > EMT_INTER_MAX_CU_WITH_QTBT ) -#endif { trTypeHor = trTypeVer = DCT2; } @@ -359,34 +328,21 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy } return; } -#endif -#if JVET_M0464_UNI_MTS if ( mtsActivated ) -#else - if ( emtActivated ) -#endif { if( compID == COMPONENT_Y ) { -#if JVET_M0464_UNI_MTS if ( tu.mtsIdx > 1 ) { int indHor = ( tu.mtsIdx - 2 ) & 1; int indVer = ( tu.mtsIdx - 2 ) >> 1; -#else - if ( tu.cu->emtFlag ) - { - int indHor = tu.emtIdx & 1; - int indVer = tu.emtIdx >> 1; -#endif trTypeHor = indHor ? DCT8 : DST7; trTypeVer = indVer ? DCT8 : DST7; } } } -#if JVET_M0303_IMPLICIT_MTS else if ( mtsImplicit ) { int width = tu.blocks[compID].width; @@ -401,7 +357,6 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy else if ( width == height && widthDstOk ) trTypeHor = trTypeVer = DST7; } -#endif } void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPelBuf &resi, CoeffBuf &dstCoeff, const int width, const int height ) @@ -409,31 +364,17 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel const unsigned maxLog2TrDynamicRange = tu.cs->sps->getMaxLog2TrDynamicRange( toChannelType( compID ) ); const unsigned bitDepth = tu.cs->sps->getBitDepth( toChannelType( compID ) ); const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_FORWARD]; -#if !JVET_M0102_INTRA_SUBPARTITIONS - const int shift_1st = ((g_aucLog2[width ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; - const int shift_2nd = (g_aucLog2[height]) + TRANSFORM_MATRIX_SHIFT + COM16_C806_TRANS_PREC; -#endif const uint32_t transformWidthIndex = g_aucLog2[width ] - 1; // nLog2WidthMinus1, since transform start from 2-point const uint32_t transformHeightIndex = g_aucLog2[height] - 1; // nLog2HeightMinus1, since transform start from 2-point -#if !JVET_M0297_32PT_MTS_ZERO_OUT - const int skipWidth = width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; - const int skipHeight = height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; -#endif -#if !JVET_M0102_INTRA_SUBPARTITIONS - CHECK( shift_1st < 0, "Negative shift" ); - CHECK( shift_2nd < 0, "Negative shift" ); -#endif int trTypeHor = DCT2; int trTypeVer = DCT2; getTrTypes ( tu, compID, trTypeHor, trTypeVer ); -#if JVET_M0297_32PT_MTS_ZERO_OUT const int skipWidth = ( trTypeHor != DCT2 && width == 32 ) ? 16 : width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; const int skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; -#endif #if RExt__DECODER_DEBUG_TOOL_STATISTICS if ( trTypeHor != DCT2 ) @@ -455,19 +396,16 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( width > 1 && height > 1 ) // 2-D transform { const int shift_1st = ((g_aucLog2[width ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; const int shift_2nd = (g_aucLog2[height]) + TRANSFORM_MATRIX_SHIFT + COM16_C806_TRANS_PREC; CHECK( shift_1st < 0, "Negative shift" ); CHECK( shift_2nd < 0, "Negative shift" ); -#endif TCoeff *tmp = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); fastFwdTrans[trTypeHor][transformWidthIndex ](block, tmp, shift_1st, height, 0, skipWidth); fastFwdTrans[trTypeVer][transformHeightIndex](tmp, dstCoeff.buf, shift_2nd, width, skipWidth, skipHeight); -#if JVET_M0102_INTRA_SUBPARTITIONS } else if( height == 1 ) //1-D horizontal transform { @@ -483,7 +421,6 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel CHECKD( ( transformHeightIndex < 0 ), "There is a problem with the height." ); fastFwdTrans[trTypeVer][transformHeightIndex]( block, dstCoeff.buf, shift, 1, 0, skipHeight ); } -#endif } void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pCoeff, PelBuf &pResidual ) @@ -495,38 +432,20 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_INVERSE]; const TCoeff clipMinimum = -( 1 << maxLog2TrDynamicRange ); const TCoeff clipMaximum = ( 1 << maxLog2TrDynamicRange ) - 1; -#if !JVET_M0102_INTRA_SUBPARTITIONS - const int shift_1st = TRANSFORM_MATRIX_SHIFT + 1 + COM16_C806_TRANS_PREC; // 1 has been added to shift_1st at the expense of shift_2nd - const int shift_2nd = ( TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1 ) - bitDepth + COM16_C806_TRANS_PREC; -#endif const uint32_t transformWidthIndex = g_aucLog2[width ] - 1; // nLog2WidthMinus1, since transform start from 2-point const uint32_t transformHeightIndex = g_aucLog2[height] - 1; // nLog2HeightMinus1, since transform start from 2-point -#if !JVET_M0297_32PT_MTS_ZERO_OUT - const int skipWidth = width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; - const int skipHeight = height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; -#endif -#if !JVET_M0102_INTRA_SUBPARTITIONS - CHECK( shift_1st < 0, "Negative shift" ); - CHECK( shift_2nd < 0, "Negative shift" ); -#endif int trTypeHor = DCT2; int trTypeVer = DCT2; getTrTypes ( tu, compID, trTypeHor, trTypeVer ); -#if JVET_M0297_32PT_MTS_ZERO_OUT const int skipWidth = ( trTypeHor != DCT2 && width == 32 ) ? 16 : width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; const int skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; -#endif -#if !JVET_M0102_INTRA_SUBPARTITIONS - TCoeff *tmp = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); -#endif TCoeff *block = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); -#if JVET_M0102_INTRA_SUBPARTITIONS if( width > 1 && height > 1 ) //2-D transform { const int shift_1st = TRANSFORM_MATRIX_SHIFT + 1 + COM16_C806_TRANS_PREC; // 1 has been added to shift_1st at the expense of shift_2nd @@ -534,10 +453,8 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo CHECK( shift_1st < 0, "Negative shift" ); CHECK( shift_2nd < 0, "Negative shift" ); TCoeff *tmp = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); -#endif fastInvTrans[trTypeVer][transformHeightIndex](pCoeff.buf, tmp, shift_1st, width, skipWidth, skipHeight, clipMinimum, clipMaximum); fastInvTrans[trTypeHor][transformWidthIndex] (tmp, block, shift_2nd, height, 0, skipWidth, clipMinimum, clipMaximum); -#if JVET_M0102_INTRA_SUBPARTITIONS } else if( width == 1 ) //1-D vertical transform { @@ -553,7 +470,6 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo CHECK( ( transformWidthIndex < 0 ), "There is a problem with the width." ); fastInvTrans[trTypeHor][transformWidthIndex]( pCoeff.buf, block, shift + 1, 1, 0, skipWidth, clipMinimum, clipMaximum ); } -#endif Pel *resiBuf = pResidual.buf; int resiStride = pResidual.stride; @@ -587,13 +503,6 @@ void TrQuant::xITransformSkip(const CCoeffBuf &pCoeff, } int iWHScale = 1; -#if HM_QTBT_AS_IN_JEM_QUANT && !JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT - if( TU::needsBlockSizeTrafoScale( area ) ) - { - iTransformShift += ADJ_QUANT_SHIFT; - iWHScale = 181; - } -#endif const bool rotateResidual = TU::isNonTransformedResidualRotated( tu, compID ); @@ -628,12 +537,7 @@ void TrQuant::xQuant(TransformUnit &tu, const ComponentID &compID, const CCoeffB m_quant->quant( tu, compID, pSrc, uiAbsSum, cQP, ctx ); } -#if JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, std::vector<TrMode>* trModes, const int maxCand, double* diagRatio, double* horVerRatio ) -#else -void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, std::vector<TrMode>* trModes, const int maxCand) -#endif { CodingStructure &cs = *tu.cs; const CompArea &rect = tu.blocks[compID]; @@ -656,7 +560,6 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q { tu.mtsIdx = it->first; CoeffBuf tempCoeff( m_mtsCoeffs[tu.mtsIdx], rect ); -#if JVET_M0140_SBT if( tu.noResidual ) { int sumAbs = 0; @@ -664,7 +567,6 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q it++; continue; } -#endif if( isLuma(compID) && tu.mtsIdx == 1 ) { @@ -681,24 +583,18 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q sumAbs += abs( tempCoeff.buf[pos] ); } -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT double scaleSAD=1.0; if (isLuma(compID) && tu.mtsIdx==1 && ((g_aucLog2[width] + g_aucLog2[height]) & 1) == 1 ) { scaleSAD=1.0/1.414213562; // compensate for not scaling transform skip coefficients by 1/sqrt(2) } trCosts.push_back( TrCost( int(sumAbs*scaleSAD), pos++ ) ); -#else - trCosts.push_back( TrCost( sumAbs, pos++ ) ); -#endif it++; } -#if JVET_M0102_INTRA_SUBPARTITIONS // it gets the distribution of the DCT-II coefficients energy, which will be useful to discard ISP tests CoeffBuf coeffsDCT( m_mtsCoeffs[0], rect ); xGetCoeffEnergy( tu, compID, coeffsDCT, diagRatio, horVerRatio ); -#endif int numTests = 0; std::vector<TrCost>::iterator itC = trCosts.begin(); const double fac = facBB[g_aucLog2[std::max(width, height)]-2]; @@ -712,21 +608,8 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q itC++; } } -#endif -#if JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr, double* diagRatio, double* horVerRatio ) -#else -void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr) -#endif -#else -#if JVET_M0102_INTRA_SUBPARTITIONS -void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, double* diagRatio, double* horVerRatio) -#else -void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx) -#endif -#endif { CodingStructure &cs = *tu.cs; const CompArea &rect = tu.blocks[compID]; @@ -736,14 +619,12 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q const CPelBuf resiBuf = cs.getResiBuf(rect); CoeffBuf rpcCoeff = tu.getCoeffs(compID); -#if JVET_M0140_SBT if( tu.noResidual ) { uiAbsSum = 0; TU::setCbfAtDepth( tu, compID, tu.depth, uiAbsSum > 0 ); return; } -#endif RDPCMMode rdpcmMode = RDPCM_OFF; rdpcmNxN(tu, compID, cQP, uiAbsSum, rdpcmMode); @@ -785,21 +666,13 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q CHECK( MAX_TB_SIZEY < uiWidth, "Unsupported transformation size" ); #endif -#if JVET_M0464_UNI_MTS CoeffBuf tempCoeff( loadTr ? m_mtsCoeffs[tu.mtsIdx] : m_plTempCoeff, rect ); -#else - CoeffBuf tempCoeff( m_plTempCoeff, rect ); -#endif DTRACE_PEL_BUF( D_RESIDUALS, resiBuf, tu, tu.cu->predMode, compID ); -#if JVET_M0464_UNI_MTS if( !loadTr ) { if( isLuma(compID) && tu.mtsIdx == 1 ) -#else - if( tu.transformSkip[compID] ) -#endif { xTransformSkip( tu, compID, resiBuf, tempCoeff.buf ); } @@ -807,24 +680,16 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q { xT( tu, compID, resiBuf, tempCoeff, uiWidth, uiHeight ); } -#if JVET_M0464_UNI_MTS } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS //we do this only with the DCT-II coefficients if( isLuma(compID) && -#if JVET_M0464_UNI_MTS !loadTr && tu.mtsIdx == 0 -#else - !tu.cu->emtFlag -#endif ) { //it gets the distribution of the coefficients energy, which will be useful to discard ISP tests xGetCoeffEnergy( tu, compID, tempCoeff, diagRatio, horVerRatio ); } -#endif DTRACE_COEFF_BUF( D_TCOEFF, tempCoeff, tu, tu.cu->predMode, compID ); xQuant( tu, compID, tempCoeff, uiAbsSum, cQP, ctx ); @@ -837,7 +702,6 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q TU::setCbfAtDepth (tu, compID, tu.depth, uiAbsSum > 0); } -#if JVET_M0102_INTRA_SUBPARTITIONS void TrQuant::xGetCoeffEnergy( TransformUnit &tu, const ComponentID &compID, const CoeffBuf& coeffs, double* diagRatio, double* horVerRatio ) { if( nullptr == diagRatio || nullptr == horVerRatio ) return; @@ -872,7 +736,6 @@ void TrQuant::xGetCoeffEnergy( TransformUnit &tu, const ComponentID &compID, con *diagRatio = 0 == wdtE && 0 == hgtE && 0 == diaE ? 1 : double( diaE ) / double( wdtE + hgtE ); } } -#endif void TrQuant::applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const RDPCMMode &mode) { @@ -933,11 +796,7 @@ void TrQuant::applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, co void TrQuant::rdpcmNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, RDPCMMode &rdpcmMode) { -#if JVET_M0464_UNI_MTS if (!CU::isRDPCMEnabled(*tu.cu) || (tu.mtsIdx!=1 && !tu.cu->transQuantBypass)) -#else - if (!CU::isRDPCMEnabled(*tu.cu) || (!tu.transformSkip[compID] && !tu.cu->transQuantBypass)) -#endif { rdpcmMode = RDPCM_OFF; } @@ -1016,13 +875,6 @@ void TrQuant::xTransformSkip(const TransformUnit &tu, const ComponentID &compID, } int iWHScale = 1; -#if HM_QTBT_AS_IN_JEM_QUANT && !JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT - if( TU::needsBlockSizeTrafoScale( rect ) ) - { - iTransformShift -= ADJ_DEQUANT_SHIFT; - iWHScale = 181; - } -#endif const bool rotateResidual = TU::isNonTransformedResidualRotated( tu, compID ); const uint32_t uiSizeMinus1 = ( width * height ) - 1; diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h index 52bf441947871820971825c842479b16883791da..85964c1c8efa973db6ab9f8a842ba46918dca4b9 100644 --- a/source/Lib/CommonLib/TrQuant.h +++ b/source/Lib/CommonLib/TrQuant.h @@ -87,21 +87,8 @@ public: void invTransformNxN (TransformUnit &tu, const ComponentID &compID, PelBuf &pResi, const QpParam &cQPs); -#if JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS void transformNxN ( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, std::vector<TrMode>* trModes, const int maxCand, double* diagRatio = nullptr, double* horVerRatio = nullptr ); void transformNxN ( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr = false, double* diagRatio = nullptr, double* horVerRatio = nullptr ); -#else - void transformNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, std::vector<TrMode>* trModes, const int maxCand); - void transformNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr=false); -#endif -#else -#if JVET_M0102_INTRA_SUBPARTITIONS - void transformNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, double* diagRatio = nullptr, double* horVerRatio = nullptr); -#else - void transformNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx); -#endif -#endif void rdpcmNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, RDPCMMode &rdpcmMode); void applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const RDPCMMode &rdpcmMode); @@ -134,9 +121,7 @@ protected: private: Quant *m_quant; //!< Quantizer -#if JVET_M0464_UNI_MTS TCoeff** m_mtsCoeffs; -#endif // forward Transform @@ -164,14 +149,12 @@ private: const TransformUnit &tu, const ComponentID &component); -#if JVET_M0102_INTRA_SUBPARTITIONS void xGetCoeffEnergy( TransformUnit &tu, const ComponentID &compID, const CoeffBuf &coeffs, double* diagRatio, double* horVerRatio ); -#endif };// END CLASS DEFINITION TrQuant //! \} diff --git a/source/Lib/CommonLib/TrQuant_EMT.cpp b/source/Lib/CommonLib/TrQuant_EMT.cpp index d12b5c39221667729b53ddf14ff502b3ded960d9..78412a87a27187790b7fdf9362da51d229d4ba10 100644 --- a/source/Lib/CommonLib/TrQuant_EMT.cpp +++ b/source/Lib/CommonLib/TrQuant_EMT.cpp @@ -947,7 +947,7 @@ void fastInverseDST7_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int void fastForwardDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[5], b[5], c[5], d[5], t; TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; @@ -1015,7 +1015,7 @@ void fastForwardDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, in void fastInverseDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[5], b[5], c[5], d[5], t; @@ -1074,7 +1074,7 @@ void fastInverseDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, in void fastForwardDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[10][6]; TCoeff t[2]; @@ -1173,7 +1173,7 @@ void fastForwardDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in void fastInverseDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[10][6]; TCoeff t[2]; @@ -1340,7 +1340,7 @@ void fastInverseDCT8_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int void fastForwardDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[5], b[5], c[5], d[5], t; TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0; @@ -1408,7 +1408,7 @@ void fastForwardDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, in void fastInverseDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[5], b[5], c[5], d[5], t; @@ -1465,7 +1465,7 @@ void fastInverseDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, in void fastForwardDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[10][6]; TCoeff t[2]; @@ -1565,7 +1565,7 @@ void fastForwardDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in void fastInverseDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum) { -#if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT +#if !JVET_M0497_MATRIX_MULT int j, k; TCoeff a[10][6]; TCoeff t[2]; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 590811c02975aaec2789de4b53a7115a745c2878..bc180425445f7c099c68df25057fc1cc6c6c5f57 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,147 +50,29 @@ #include <assert.h> #include <cassert> -#define JVET_M0111_WP_GBI 1 // Block level control gbi according to WP - -#define JVET_M0445_MCTS 1 // Motion constrained tile sets -#if JVET_M0445_MCTS -#define JVET_M0445_MCTS_DEC_CHECK 1 // Check at decoder side the MCTS restrictions -#endif - -#define JVET_M0415_WRAPAROUND_HLS 1 // HLS for Wrap-around MC - - #define JCTVC_Y0038_PARAMS 1 -#define JVET_M0600_RATE_CTRL 1 //frame level bit allocation by qdf - -#define JVET_M0451_INTEROPERABILITY_POINT_SYNTAX 1 - -#define JVET_M0428_ENC_DB_OPT 1 // Encoder optimization with deblocking filter - #define JVET_MMVD_OFF_MACRO 0 -#define JVET_M0055_DEBUG_CTU 1 // DebugCTU encoder debug option - -#define JVET_M0297_32PT_MTS_ZERO_OUT 1 // 32 point MTS based on skipping high frequency coefficients - -#define JVET_M0126_HMVP_MRG_PRUNING 1 // HMVP merge candidates pruning simplification - -#define JVET_M0483_IBC 1 // Block level flag signaling and independent IBC mode - -#define JVET_M0102_INTRA_SUBPARTITIONS 1 - -#define JVET_M0303_IMPLICIT_MTS 1 // Implicit transform selection (can be enabled with MTSImplicit encoder config parameter) - #define FIX_DB_MAX_TRANSFORM_SIZE 1 -#define JVET_M0908_CIIP_DB 1 -#define JVET_M0471_LONG_DEBLOCKING_FILTERS 1 -#define JVET_M0427_INLOOP_RESHAPER 1 -#define JVET_M0470 1 // Fixed GR/TU+EG-k transition point, use limited prefix length for escape codes - -#define JVET_M0253_HASH_ME 1 - -#define JVET_M0257 1 // Scan only non zero-out regions of large TUs -#define JVET_M0193_PAIR_AVG_REDUCTION 1 //Use only one pairwise average candidate - -#define JVET_M0281_AMVP_ROUNDING 1 // Perform all AMVP rounding before pruning even AMVR is off -#define JVET_M0117_AMVP_LIST_GEN 1 // AMVP candidate list generation simplification - -#define JVET_M0192_AFF_CHROMA_SIMPL 1 // Affine chroma MV derivation simplification and rounding unification - -#define JVET_M0116_ATMVP_LEFT_NB_FOR_OFFSET 1 // Only use left neighbor for ATMVP offset derivation, from M0273, M0240, M0116, M0338, M0204 - -#define JVET_M0063_BDOF_FIX 1 // BDOF bitdepth bugfix - -#define JVET_M0265_MV_ROUNDING_CLEANUP 1 // Unify MV roundings and make SW/WD allignment -#define JVET_M0883_TRIANGLE_SIGNALING 1 // Using regular merge index signaling for triangle mode - -#define JVET_M0228_REMOVE_CPMV_COMPARE 1 // Remove CPMV comparisons for construnted affine merge candidates from JVET-M0228, M0166, M0477 - -#define JVET_M0145_AFFINE_MV_CLIP 1 // Missing clipping for MV storage in affine - -#define JVET_M0264_HMVP_WITH_GBIIDX 1 // Harmonization between HMVP and GBi - -#define JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX 1 // CE2.2.2 a: one context for subblock Merge index - -#define JVET_M0118_M0185_TRIANGLE_FLAG_FIX 1 // Avoid signaling triangle flag if a CU uses MMVD or CIIP - -#define JVET_M0487_INT_EXTEND 1 // CE9.1.1 b: integer reference samples as 1 extended samples - -#define JVET_M0444_SMVD 1 // SMVD mode - -#define JVET_M0170_MRG_SHARELIST 1 -#if JVET_M0170_MRG_SHARELIST #define MRG_SHARELIST_SHARSIZE 32 -#endif - -#define JVET_M0064_CCLM_SIMPLIFICATION 1 - -#define JVET_M0142_CCLM_COLLOCATED_CHROMA 1 // Adding support for chroma sample location type 2 in CCLM - -#define JVET_M0328_KEEP_ONE_WEIGHT_GROUP 1 -#define JVET_M0479_18BITS_MV_CLIP 1 - -#define JVET_M0497_FAST_DST7 1 -#if JVET_M0497_FAST_DST7 #define JVET_M0497_MATRIX_MULT 0 // 0: Fast method; 1: Matrix multiplication -#endif -#define JVET_M0502_PRED_MODE_CTX 1 -#define JVET_M0140_SBT 1 // Sub-Block transform for Inter blocks -#if JVET_M0140_SBT #define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on -#endif - -#define JVET_M0407_IBC_RANGE 1 // extend IBC search range to some part of left CTU - -#define JVET_M0464_UNI_MTS 1 -#define JVET_M0068_M0171_MMVD_CLEANUP 1 // MMVD cleanup with 1) flip removal, 2) L1 zero vector fix, 3) bi-pred restriction after merge/MMVD -#define JVET_M0255_FRACMMVD_SWITCH 1 // disable fractional MVD in MMVD adaptively -#define JVET_M0854_FRACMMVD_SWITCH_FOR_UHD 1 // disable fractional MVD for UHD pictures -#define JVET_M0823_MMVD_ENCOPT 1 // encoder optimization for MMVD - -#define JVET_M0147_DMVR 1 //Decoder side Motion Vector Refinement - -#define JVET_M0277_FIX_PCM_DISABLEFILTER 1 // Fixes of enabling pcm_loop_filter_disabled_flag with PCM mode -#if JVET_M0277_FIX_PCM_DISABLEFILTER #define FIX_PCM 1 // Fix PCM bugs in VTM3 -#endif #define MAX_TB_SIZE_SIGNALLING 0 -#if JVET_M0464_UNI_MTS typedef std::pair<int, bool> TrMode; typedef std::pair<int, int> TrCost; -#endif - -#define JVET_M0246_AFFINE_AMVR 1 -#if JVET_M0246_AFFINE_AMVR -#define JVET_M0247_AFFINE_AMVR_ENCOPT 1 -#endif -#define JVET_M0421_SPLIT_SIG 1 - -#define JVET_M0173_MOVE_GT2_TO_FIRST_PASS 1 // Moving the gtr2 flag to the first coding pass - -#define REMOVE_BIN_DECISION_TREE 1 - -#define JVET_M0446_M0888_M0905_VPDU_AT_PIC_BOUNDARY 1 - -#define JVET_M0685 1 // clang-format off -#define JVET_M0453_CABAC_ENGINE 1 -#define JVET_M0512_MOTION_BUFFER_COMPRESSION 1 -#define JVET_M0238_PDPC_NO_INTERPOLATION 1 - -#define JVET_M0409_ATMVP_FIX 1 - #define ENABLE_JVET_L0283_MRL 1 // 1: Enable MRL, 0: Disable MRL #define JVET_L0090_PAIR_AVG 1 // Add pairwise average candidates, replace HEVC combined candidates #define REUSE_CU_RESULTS 1 -#if REUSE_CU_RESULTS && JVET_M0102_INTRA_SUBPARTITIONS +#if REUSE_CU_RESULTS #define REUSE_CU_RESULTS_WITH_MULTIPLE_TUS 1 #define MAX_NUM_TUS 4 #endif @@ -252,11 +134,7 @@ typedef std::pair<int, int> TrCost; #endif #endif -#if JVET_M0427_INLOOP_RESHAPER #define WCG_EXT 1 -#else -#define WCG_EXT 0 // part of JEM sharp Luma qp -#endif #define WCG_WPSNR WCG_EXT #if HEVC_TOOLS @@ -275,16 +153,12 @@ typedef std::pair<int, int> TrCost; #define HEVC_TILES_WPP 1 #endif -#if JVET_M0445_MCTS #ifndef HEVC_TILES_WPP #define HEVC_TILES_WPP 1 #endif #if !HEVC_TILES_WPP #error JVET_M0445_MCTS_NEEDS_TILES_ENABLED #endif -#endif - -#define JVET_M0132_APS 1 // APS #define JVET_M0101_HLS 1 // joint HLS syntax @@ -303,7 +177,6 @@ typedef std::pair<int, int> TrCost; #define HM_JEM_CLIP_PEL 1 // *** #define HM_JEM_MERGE_CANDS 0 // *** -#define JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT 1 ///< When 1, do not scale transform skip blocks by sqrt(2) between (I)Transform and (I)Quantizer #endif//JEM_COMP @@ -378,7 +251,6 @@ typedef std::pair<int, int> TrCost; #define W0038_DB_OPT 1 ///< adaptive DB parameter selection, LoopFilterOffsetInPPS and LoopFilterDisable are set to 0 and DeblockingFilterMetric=2; #define W0038_CQP_ADJ 1 ///< chroma QP adjustment based on TL, CQPTLAdjustEnabled is set to 1; -#define JVET_M0113_M0188_QG_SIZE 1 ///< JVET-M0113/M0188 quantization groups based on area #define SHARP_LUMA_DELTA_QP 1 ///< include non-normative LCU deltaQP and normative chromaQP change #define ER_CHROMA_QP_WCG_PPS 1 ///< Chroma QP model for WCG used in Anchor 3.2 #define ENABLE_QPA 1 ///< Non-normative perceptual QP adaptation according to JVET-H0047 and JVET-K0206. Deactivated by default, activated using encoder arguments --PerceptQPA=1 --SliceChromaQPOffsetPeriodicity=1 @@ -462,7 +334,6 @@ enum TransType DCT2_EMT = 4 }; -#if JVET_M0102_INTRA_SUBPARTITIONS enum ISPType { NOT_INTRA_SUBPARTITIONS = 0, @@ -471,9 +342,7 @@ enum ISPType NUM_INTRA_SUBPARTITIONS_MODES = 3, CAN_USE_VER_AND_HORL_SPLITS = 4 }; -#endif -#if JVET_M0140_SBT enum SbtIdx { SBT_OFF_DCT = 0, @@ -504,7 +373,6 @@ enum SbtMode SBT_HOR_Q1 = 7, NUMBER_SBT_MODE }; -#endif enum RDPCMMode { @@ -597,12 +465,8 @@ enum PredMode { MODE_INTER = 0, ///< inter-prediction mode MODE_INTRA = 1, ///< intra-prediction mode -#if JVET_M0483_IBC MODE_IBC = 2, ///< ibc-prediction mode NUMBER_OF_PREDICTION_MODES = 3, -#else - NUMBER_OF_PREDICTION_MODES = 2, -#endif }; /// reference list index @@ -682,7 +546,6 @@ enum DFunc DF_SAD_FULL_NBIT64 = DF_SAD_FULL_NBIT+6, ///< 64xM SAD with full bit usage DF_SAD_FULL_NBIT16N = DF_SAD_FULL_NBIT+7, ///< 16NxM SAD with full bit usage -#if WCG_EXT DF_SSE_WTD = 54, ///< general size SSE DF_SSE2_WTD = DF_SSE_WTD+1, ///< 4xM SSE DF_SSE4_WTD = DF_SSE_WTD+2, ///< 4xM SSE @@ -692,7 +555,6 @@ enum DFunc DF_SSE64_WTD = DF_SSE_WTD+6, ///< 64xM SSE DF_SSE16N_WTD = DF_SSE_WTD+7, ///< 16NxM SSE DF_DEFAULT_ORI = DF_SSE_WTD+8, -#endif DF_SAD_INTERMEDIATE_BITDEPTH = 63, @@ -974,9 +836,7 @@ enum NalUnitType NAL_UNIT_SPS, // 17 NAL_UNIT_PPS, // 18 -#if JVET_M0132_APS NAL_UNIT_APS, // 19 NAL unit type number needs to be reaaranged. -#endif NAL_UNIT_ACCESS_UNIT_DELIMITER, // 20 NAL_UNIT_EOS, // 21 NAL_UNIT_EOB, // 22 @@ -1039,9 +899,7 @@ enum NalUnitType #endif NAL_UNIT_SPS, // 33 NAL_UNIT_PPS, // 34 -#if JVET_M0132_APS NAL_UNIT_APS, //NAL unit type number needs to be reaaranged. -#endif NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35 NAL_UNIT_EOS, // 36 NAL_UNIT_EOB, // 37 @@ -1081,12 +939,7 @@ enum LumaLevelToDQPMode { LUMALVL_TO_DQP_DISABLED = 0, LUMALVL_TO_DQP_AVG_METHOD = 1, // use average of CTU to determine luma level -#if !WCG_EXT - LUMALVL_TO_DQP_MAX_METHOD = 2, // use maximum value of CTU to determine luma level - LUMALVL_TO_DQP_NUM_MODES = 3 -#else LUMALVL_TO_DQP_NUM_MODES = 2 -#endif }; #endif @@ -1112,14 +965,12 @@ enum TriangleSplit TRIANGLE_DIR_NUM }; -#if JVET_M0170_MRG_SHARELIST enum SharedMrgState { NO_SHARE = 0, GEN_ON_SHARED_BOUND = 1, SHARING = 2 }; -#endif ////////////////////////////////////////////////////////////////////////// // Encoder modes to try out ////////////////////////////////////////////////////////////////////////// @@ -1334,7 +1185,6 @@ enum MsgLevel VERBOSE = 5, DETAILS = 6 }; -#if JVET_M0427_INLOOP_RESHAPER enum RESHAPE_SIGNAL_TYPE { RESHAPE_SIGNAL_SDR = 0, @@ -1342,7 +1192,6 @@ enum RESHAPE_SIGNAL_TYPE RESHAPE_SIGNAL_HLG = 2, RESHAPE_SIGNAL_NULL = 100, }; -#endif // --------------------------------------------------------------------------- @@ -1483,7 +1332,6 @@ public: while( first != last ) *it++ = *first++; return const_cast<iterator>( _pos ); } -#if JVET_M0102_INTRA_SUBPARTITIONS && JVET_M0464_UNI_MTS iterator insert( const_iterator _pos, size_t numEl, const T& val ) { //const difference_type numEl = last - first; CHECKD( _size + numEl >= N, "capacity exceeded" ); @@ -1491,7 +1339,6 @@ public: iterator it = const_cast<iterator>( _pos ); _size += numEl; for ( int k = 0; k < numEl; k++) *it++ = val; return const_cast<iterator>( _pos ); } -#endif void erase( const_iterator _pos ) { iterator it = const_cast<iterator>( _pos ) - 1; iterator last = end() - 1; diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index aed894214e8ef54511e2fa2b3df9679bff5ae53e..7ca06ebc69661b066d2539bef29f550becdedc50 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -271,12 +271,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) qp = other.qp; chromaQpAdj = other.chromaQpAdj; rootCbf = other.rootCbf; -#if JVET_M0140_SBT sbtInfo = other.sbtInfo; -#endif -#if !JVET_M0464_UNI_MTS - emtFlag = other.emtFlag; -#endif #if HEVC_TILES_WPP tileIdx = other.tileIdx; #endif @@ -286,19 +281,10 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) for (int i = 0; i<2; i++) refIdxBi[i] = other.refIdxBi[i]; -#if JVET_M0170_MRG_SHARELIST shareParentPos = other.shareParentPos; shareParentSize = other.shareParentSize; -#endif -#if JVET_M0483_IBC==0 - ibc = other.ibc; -#endif -#if JVET_M0444_SMVD smvdMode = other.smvdMode; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS ispMode = other.ispMode; -#endif return *this; } @@ -320,12 +306,7 @@ void CodingUnit::initData() qp = 0; chromaQpAdj = 0; rootCbf = true; -#if JVET_M0140_SBT sbtInfo = 0; -#endif -#if !JVET_M0464_UNI_MTS - emtFlag = 0; -#endif #if HEVC_TILES_WPP tileIdx = 0; #endif @@ -334,23 +315,13 @@ void CodingUnit::initData() GBiIdx = GBI_DEFAULT; for (int i = 0; i < 2; i++) refIdxBi[i] = -1; -#if JVET_M0170_MRG_SHARELIST shareParentPos = Position(-1, -1); shareParentSize.width = -1; shareParentSize.height = -1; -#endif -#if JVET_M0483_IBC==0 - ibc = false; -#endif -#if JVET_M0444_SMVD smvdMode = 0; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS ispMode = 0; -#endif } -#if JVET_M0140_SBT const uint8_t CodingUnit::checkAllowedSbt() const { if( !slice->getSPS()->getUseSBT() ) @@ -359,11 +330,7 @@ const uint8_t CodingUnit::checkAllowedSbt() const } //check on prediction mode -#if JVET_M0483_IBC if( predMode == MODE_INTRA || predMode == MODE_IBC ) //intra or IBC -#else - if( predMode == MODE_INTRA || ibc ) //intra or IBC -#endif { return 0; } @@ -417,7 +384,6 @@ uint8_t CodingUnit::getSbtTuSplit() const assert( sbtTuSplitType <= SBT_HOR_QUAD_POS1_SPLIT && sbtTuSplitType >= SBT_VER_HALF_POS0_SPLIT ); return sbtTuSplitType; } -#endif // --------------------------------------------------------------------------- // prediction unit method definitions @@ -436,24 +402,20 @@ void PredictionUnit::initData() // inter data mergeFlag = false; mergeIdx = MAX_UCHAR; -#if JVET_M0883_TRIANGLE_SIGNALING triangleSplitDir = MAX_UCHAR; triangleMergeIdx0 = MAX_UCHAR; triangleMergeIdx1 = MAX_UCHAR; -#endif mmvdMergeFlag = false; mmvdMergeIdx = MAX_UINT; interDir = MAX_UCHAR; mergeType = MRG_TYPE_DEFAULT_N; bv.setZero(); bvd.setZero(); -#if JVET_M0147_DMVR mvRefine = false; for (uint32_t i = 0; i < MAX_NUM_SUBCU_DMVR; i++) { mvdL0SubPu[i].setZero(); } -#endif for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++) { mvpIdx[i] = MAX_UCHAR; @@ -471,14 +433,10 @@ void PredictionUnit::initData() } } mhIntraFlag = false; -#if JVET_M0170_MRG_SHARELIST shareParentPos = Position(-1, -1); shareParentSize.width = -1; shareParentSize.height = -1; -#endif -#if JVET_M0823_MMVD_ENCOPT mmvdEncOptMode = 0; -#endif } PredictionUnit& PredictionUnit::operator=(const IntraPredictionData& predData) @@ -496,24 +454,20 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) { mergeFlag = predData.mergeFlag; mergeIdx = predData.mergeIdx; -#if JVET_M0883_TRIANGLE_SIGNALING triangleSplitDir = predData.triangleSplitDir ; triangleMergeIdx0 = predData.triangleMergeIdx0 ; triangleMergeIdx1 = predData.triangleMergeIdx1 ; -#endif mmvdMergeFlag = predData.mmvdMergeFlag; mmvdMergeIdx = predData.mmvdMergeIdx; interDir = predData.interDir; mergeType = predData.mergeType; bv = predData.bv; bvd = predData.bvd; -#if JVET_M0147_DMVR mvRefine = predData.mvRefine; for (uint32_t i = 0; i < MAX_NUM_SUBCU_DMVR; i++) { mvdL0SubPu[i] = predData.mvdL0SubPu[i]; } -#endif for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++) { mvpIdx[i] = predData.mvpIdx[i]; @@ -531,10 +485,8 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) } } mhIntraFlag = predData.mhIntraFlag; -#if JVET_M0170_MRG_SHARELIST shareParentPos = predData.shareParentPos; shareParentSize = predData.shareParentSize; -#endif return *this; } @@ -548,24 +500,20 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) mergeFlag = other.mergeFlag; mergeIdx = other.mergeIdx; -#if JVET_M0883_TRIANGLE_SIGNALING triangleSplitDir = other.triangleSplitDir ; triangleMergeIdx0 = other.triangleMergeIdx0 ; triangleMergeIdx1 = other.triangleMergeIdx1 ; -#endif mmvdMergeFlag = other.mmvdMergeFlag; mmvdMergeIdx = other.mmvdMergeIdx; interDir = other.interDir; mergeType = other.mergeType; bv = other.bv; bvd = other.bvd; -#if JVET_M0147_DMVR mvRefine = other.mvRefine; for (uint32_t i = 0; i < MAX_NUM_SUBCU_DMVR; i++) { mvdL0SubPu[i] = other.mvdL0SubPu[i]; } -#endif for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++) { mvpIdx[i] = other.mvpIdx[i]; @@ -583,10 +531,8 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) } } mhIntraFlag = other.mhIntraFlag; -#if JVET_M0170_MRG_SHARELIST shareParentPos = other.shareParentPos; shareParentSize = other.shareParentSize; -#endif return *this; } @@ -657,23 +603,12 @@ void TransformUnit::initData() { cbf[i] = 0; rdpcm[i] = NUMBER_OF_RDPCM_MODES; -#if !JVET_M0464_UNI_MTS - transformSkip[i] = false; -#endif compAlpha[i] = 0; } depth = 0; -#if JVET_M0464_UNI_MTS mtsIdx = 0; -#else - emtIdx = 0; -#endif -#if JVET_M0140_SBT noResidual = false; -#endif -#if JVET_M0427_INLOOP_RESHAPER m_chromaResScaleInv = 0; -#endif } void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf) @@ -703,20 +638,11 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other) cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; -#if !JVET_M0464_UNI_MTS - transformSkip[i] = other.transformSkip[i]; -#endif compAlpha[i] = other.compAlpha[i]; } depth = other.depth; -#if JVET_M0464_UNI_MTS mtsIdx = other.mtsIdx; -#else - emtIdx = other.emtIdx; -#endif -#if JVET_M0140_SBT noResidual = other.noResidual; -#endif return *this; } @@ -733,23 +659,11 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; -#if !JVET_M0464_UNI_MTS - transformSkip[i] = other.transformSkip[i]; -#endif compAlpha[i] = other.compAlpha[i]; depth = other.depth; -#if JVET_M0464_UNI_MTS mtsIdx = isLuma( i ) ? other.mtsIdx : mtsIdx; -#else - if( isLuma( i ) ) - { - emtIdx = other.emtIdx; - } -#endif -#if JVET_M0140_SBT noResidual = other.noResidual; -#endif } CoeffBuf TransformUnit::getCoeffs(const ComponentID id) { return CoeffBuf(m_coeffs[id], blocks[id]); } @@ -758,7 +672,6 @@ const CCoeffBuf TransformUnit::getCoeffs(const ComponentID id) const { return CC PelBuf TransformUnit::getPcmbuf(const ComponentID id) { return PelBuf (m_pcmbuf[id], blocks[id]); } const CPelBuf TransformUnit::getPcmbuf(const ComponentID id) const { return CPelBuf (m_pcmbuf[id], blocks[id]); } -#if JVET_M0140_SBT void TransformUnit::checkTuNoResidual( unsigned idx ) { if( CU::getSbtIdx( cu->sbtInfo ) == SBT_OFF_DCT ) @@ -771,8 +684,5 @@ void TransformUnit::checkTuNoResidual( unsigned idx ) noResidual = true; } } -#endif -#if JVET_M0427_INLOOP_RESHAPER int TransformUnit::getChromaAdj() const { return m_chromaResScaleInv; } void TransformUnit::setChromaAdj(int i) { m_chromaResScaleInv = i; } -#endif \ No newline at end of file diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index ad4eee3b5e29daff548f36e0869ff58db1341cb7..69542a605ebba55693780746e2b43ec17b4dc603 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -308,32 +308,18 @@ struct CodingUnit : public UnitArea bool ipcm; uint8_t imv; bool rootCbf; -#if JVET_M0140_SBT uint8_t sbtInfo; -#endif #if HEVC_TILES_WPP uint32_t tileIdx; -#endif -#if !JVET_M0464_UNI_MTS - uint8_t emtFlag; #endif uint8_t GBiIdx; int refIdxBi[2]; // needed for fast imv mode decisions int8_t imvNumCand; -#if JVET_M0170_MRG_SHARELIST Position shareParentPos; Size shareParentSize; -#endif -#if JVET_M0483_IBC ==0 - bool ibc; -#endif -#if JVET_M0444_SMVD uint8_t smvdMode; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS uint8_t ispMode; -#endif CodingUnit() : chType( CH_L ) { } CodingUnit(const UnitArea &unit); @@ -356,14 +342,12 @@ struct CodingUnit : public UnitArea int64_t cacheId; bool cacheUsed; #endif -#if JVET_M0140_SBT const uint8_t getSbtIdx() const { assert( ( ( sbtInfo >> 0 ) & 0xf ) < NUMBER_SBT_IDX ); return ( sbtInfo >> 0 ) & 0xf; } const uint8_t getSbtPos() const { return ( sbtInfo >> 4 ) & 0x3; } void setSbtIdx( uint8_t idx ) { CHECK( idx >= NUMBER_SBT_IDX, "sbt_idx wrong" ); sbtInfo = ( idx << 0 ) + ( sbtInfo & 0xf0 ); } void setSbtPos( uint8_t pos ) { CHECK( pos >= 4, "sbt_pos wrong" ); sbtInfo = ( pos << 4 ) + ( sbtInfo & 0xcf ); } uint8_t getSbtTuSplit() const; const uint8_t checkAllowedSbt() const; -#endif }; // --------------------------------------------------------------------------- @@ -380,11 +364,9 @@ struct InterPredictionData { bool mergeFlag; uint8_t mergeIdx; -#if JVET_M0883_TRIANGLE_SIGNALING uint8_t triangleSplitDir; uint8_t triangleMergeIdx0; uint8_t triangleMergeIdx1; -#endif bool mmvdMergeFlag; uint32_t mmvdMergeIdx; uint8_t interDir; @@ -394,23 +376,17 @@ struct InterPredictionData Mv mv [NUM_REF_PIC_LIST_01]; int16_t refIdx [NUM_REF_PIC_LIST_01]; MergeType mergeType; -#if JVET_M0147_DMVR bool mvRefine; Mv mvdL0SubPu[MAX_NUM_SUBCU_DMVR]; -#endif Mv mvdAffi [NUM_REF_PIC_LIST_01][3]; Mv mvAffi[NUM_REF_PIC_LIST_01][3]; bool mhIntraFlag; -#if JVET_M0170_MRG_SHARELIST Position shareParentPos; Size shareParentSize; -#endif Mv bv; // block vector for IBC Mv bvd; // block vector difference for IBC -#if JVET_M0823_MMVD_ENCOPT uint8_t mmvdEncOptMode; // 0: no action 1: skip chroma MC for MMVD candidate pre-selection 2: skip chroma MC and BIO for MMVD candidate pre-selection -#endif }; struct PredictionUnit : public UnitArea, public IntraPredictionData, public InterPredictionData @@ -432,10 +408,8 @@ struct PredictionUnit : public UnitArea, public IntraPredictionData, public Inte PredictionUnit& operator=(const MotionInfo& mi); unsigned idx; -#if JVET_M0170_MRG_SHARELIST Position shareParentPos; Size shareParentSize; -#endif PredictionUnit *next; @@ -461,24 +435,13 @@ struct TransformUnit : public UnitArea CodingUnit *cu; CodingStructure *cs; ChannelType chType; - #if JVET_M0427_INLOOP_RESHAPER int m_chromaResScaleInv; -#endif uint8_t depth; -#if JVET_M0464_UNI_MTS uint8_t mtsIdx; -#else - uint8_t emtIdx; -#endif -#if JVET_M0140_SBT bool noResidual; -#endif uint8_t cbf [ MAX_NUM_TBLOCKS ]; RDPCMMode rdpcm [ MAX_NUM_TBLOCKS ]; -#if !JVET_M0464_UNI_MTS - bool transformSkip[ MAX_NUM_TBLOCKS ]; -#endif int8_t compAlpha [ MAX_NUM_TBLOCKS ]; TransformUnit() : chType( CH_L ) { } @@ -489,26 +452,20 @@ struct TransformUnit : public UnitArea unsigned idx; TransformUnit *next; -#if JVET_M0102_INTRA_SUBPARTITIONS TransformUnit *prev; -#endif void init(TCoeff **coeffs, Pel **pcmbuf); TransformUnit& operator=(const TransformUnit& other); void copyComponentFrom (const TransformUnit& other, const ComponentID compID); -#if JVET_M0140_SBT void checkTuNoResidual( unsigned idx ); -#endif CoeffBuf getCoeffs(const ComponentID id); const CCoeffBuf getCoeffs(const ComponentID id) const; PelBuf getPcmbuf(const ComponentID id); const CPelBuf getPcmbuf(const ComponentID id) const; -#if JVET_M0427_INLOOP_RESHAPER int getChromaAdj( ) const; void setChromaAdj(int i); -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM int64_t cacheId; diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index c82867dcc89a1ec30318d2bc9e5658566f1748be..36c65850bbee50ca31c0d0974a9c94f984ee8f53 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -53,10 +53,8 @@ PartLevel::PartLevel() , implicitSplit ( CU_DONT_SPLIT ) , firstSubPartSplit ( CU_DONT_SPLIT ) , canQtSplit ( true ) -#if JVET_M0113_M0188_QG_SIZE , qgEnable ( true ) , qgChromaEnable ( true ) -#endif { } @@ -69,10 +67,8 @@ PartLevel::PartLevel( const PartSplit _split, const Partitioning& _parts ) , implicitSplit ( CU_DONT_SPLIT ) , firstSubPartSplit ( CU_DONT_SPLIT ) , canQtSplit ( true ) -#if JVET_M0113_M0188_QG_SIZE , qgEnable ( true ) , qgChromaEnable ( true ) -#endif { } @@ -85,10 +81,8 @@ PartLevel::PartLevel( const PartSplit _split, Partitioning&& _parts ) , implicitSplit ( CU_DONT_SPLIT ) , firstSubPartSplit ( CU_DONT_SPLIT ) , canQtSplit ( true ) -#if JVET_M0113_M0188_QG_SIZE , qgEnable ( true ) , qgChromaEnable ( true ) -#endif { } @@ -129,11 +123,9 @@ void Partitioner::copyState( const Partitioner& other ) currDepth = other.currDepth; currMtDepth = other.currMtDepth; currTrDepth = other.currTrDepth; -#if JVET_M0113_M0188_QG_SIZE currSubdiv = other.currSubdiv; currQgPos = other.currQgPos; currQgChromaPos = other.currQgChromaPos; -#endif currImplicitBtDepth = other.currImplicitBtDepth; chType = other.chType; @@ -241,11 +233,9 @@ void QTBTPartitioner::initCtu( const UnitArea& ctuArea, const ChannelType _chTyp currBtDepth = 0; currMtDepth = 0; currQtDepth = 0; -#if JVET_M0113_M0188_QG_SIZE currSubdiv = 0; currQgPos = ctuArea.lumaPos(); currQgChromaPos = ctuArea.chromaPos(); -#endif currImplicitBtDepth = 0; chType = _chType; @@ -259,10 +249,8 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur bool isImplicit = isSplitImplicit( split, cs ); bool canQtSplit = canSplit( CU_QUAD_SPLIT, cs ); -#if JVET_M0113_M0188_QG_SIZE bool qgEnable = currQgEnable(); bool qgChromaEnable = currQgChromaEnable(); -#endif switch( split ) { @@ -280,7 +268,6 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur case TU_MAX_TR_SPLIT: m_partStack.push_back( PartLevel( split, PartitionerImpl::getMaxTuTiling( currArea(), cs ) ) ); break; -#if JVET_M0140_SBT case SBT_VER_HALF_POS0_SPLIT: case SBT_VER_HALF_POS1_SPLIT: case SBT_HOR_HALF_POS0_SPLIT: @@ -291,16 +278,13 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur case SBT_HOR_QUAD_POS1_SPLIT: m_partStack.push_back( PartLevel( split, PartitionerImpl::getSbtTuTiling( currArea(), cs, split ) ) ); break; -#endif default: THROW( "Unknown split mode" ); break; } currDepth++; -#if JVET_M0113_M0188_QG_SIZE currSubdiv++; -#endif #if _DEBUG m_currArea = m_partStack.back().parts.front(); #endif @@ -309,12 +293,10 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur { currTrDepth++; } -#if JVET_M0140_SBT else if( split >= SBT_VER_HALF_POS0_SPLIT && split <= SBT_HOR_QUAD_POS1_SPLIT ) { currTrDepth++; } -#endif else { currTrDepth = 0; @@ -330,9 +312,7 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur { // first and last part of triple split are equivalent to double bt split currBtDepth++; -#if JVET_M0113_M0188_QG_SIZE currSubdiv++; -#endif } m_partStack.back().canQtSplit = canQtSplit; } @@ -343,11 +323,8 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur currMtDepth = 0; currBtDepth = 0; currQtDepth++; -#if JVET_M0113_M0188_QG_SIZE currSubdiv++; -#endif } -#if JVET_M0113_M0188_QG_SIZE qgEnable &= (currSubdiv <= cs.pps->getCuQpDeltaSubdiv()); qgChromaEnable &= (currSubdiv <= cs.pps->getPpsRangeExtension().getCuChromaQpOffsetSubdiv()); m_partStack.back().qgEnable = qgEnable; @@ -356,10 +333,8 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur currQgPos = currArea().lumaPos(); if (qgChromaEnable) currQgChromaPos = currArea().chromaPos(); -#endif } -#if JVET_M0421_SPLIT_SIG void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& canQt, bool& canBh, bool& canBv, bool& canTh, bool& canTv ) { const PartSplit implicitSplit = m_partStack.back().checkdIfImplicit ? m_partStack.back().implicitSplit : getImplicitSplit( cs ); @@ -435,10 +410,8 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTv = false; } -#endif bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs ) { -#if JVET_M0421_SPLIT_SIG const CompArea area = currArea().Y(); #if MAX_TB_SIZE_SIGNALLING const unsigned maxTrSize = cs.sps->getMaxTbSize(); @@ -449,32 +422,6 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs bool canNo, canQt, canBh, canTh, canBv, canTv; canSplit( cs, canNo, canQt, canBh, canBv, canTh, canTv ); -#else - const PartSplit implicitSplit = getImplicitSplit( cs ); - - // the minimal and maximal sizes are given in luma samples - const CompArea area = currArea().Y(); - - const unsigned maxBTD = cs.pcv->getMaxBtDepth( *cs.slice, chType ) + currImplicitBtDepth; - const unsigned maxBtSize = cs.pcv->getMaxBtSize( *cs.slice, chType ); - const unsigned minBtSize = cs.pcv->getMinBtSize( *cs.slice, chType ); - const unsigned maxTtSize = cs.pcv->getMaxTtSize( *cs.slice, chType ); - const unsigned minTtSize = cs.pcv->getMinTtSize( *cs.slice, chType ); -#if MAX_TB_SIZE_SIGNALLING - const unsigned maxTrSize = cs.sps->getMaxTbSize(); -#else - const unsigned maxTrSize = MAX_TB_SIZEY; -#endif - - const PartSplit lastSplit = m_partStack.back().split; - const PartSplit parlSplit = lastSplit == CU_TRIH_SPLIT ? CU_HORZ_SPLIT : CU_VERT_SPLIT; - - if( isNonLog2BlockSize( currArea().Y() ) ) - { - return false; - } - -#endif switch( split ) { case CTU_LEVEL: @@ -484,7 +431,6 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs case TU_MAX_TR_SPLIT: return area.width > maxTrSize || area.height > maxTrSize; break; -#if JVET_M0140_SBT case SBT_VER_HALF_POS0_SPLIT: case SBT_VER_HALF_POS1_SPLIT: case SBT_HOR_HALF_POS0_SPLIT: @@ -495,8 +441,6 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs case SBT_HOR_QUAD_POS1_SPLIT: return currTrDepth == 0; break; -#endif -#if JVET_M0421_SPLIT_SIG case CU_QUAD_SPLIT: return canQt; case CU_DONT_SPLIT: @@ -509,99 +453,16 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs return canTh; case CU_TRIV_SPLIT: return canTv; -#else - case CU_QUAD_SPLIT: - { - // don't allow QT-splitting below a BT split - PartSplit lastSplit = m_partStack.back().split; - if( lastSplit != CTU_LEVEL && lastSplit != CU_QUAD_SPLIT ) return false; - - unsigned minQtSize = cs.pcv->getMinQtSize( *cs.slice, chType ); - if( currArea().lwidth() <= minQtSize || currArea().lheight() <= minQtSize ) return false; - - // allowing QT split even if a BT split is implied - if( implicitSplit != CU_DONT_SPLIT ) return true; - - return true; - } - break; - case CU_DONT_SPLIT: - return implicitSplit == CU_DONT_SPLIT; - break; - // general check for BT split, specific checks are done in a separate switch - case CU_HORZ_SPLIT: - case CU_VERT_SPLIT: - { - if( ( lastSplit == CU_TRIH_SPLIT || lastSplit == CU_TRIV_SPLIT ) && currPartIdx() == 1 && split == parlSplit ) - { - return false; - } - if (CS::isDualITree(cs) && (area.width > 64 || area.height > 64)) - { - return false; - } - } - case CU_TRIH_SPLIT: - case CU_TRIV_SPLIT: - { - if (CS::isDualITree(cs) && (area.width > 64 || area.height > 64)) - { - return false; - } - } - if( implicitSplit == split ) return true; - if( implicitSplit != CU_DONT_SPLIT && implicitSplit != split ) return false; -#endif case CU_MT_SPLIT: -#if JVET_M0421_SPLIT_SIG return ( canBh || canTh || canBv || canTv ); -#endif case CU_BT_SPLIT: -#if JVET_M0421_SPLIT_SIG return ( canBh || canBv ); -#else - { - if( currMtDepth >= maxBTD ) return false; - if( ( area.width <= minBtSize && area.height <= minBtSize ) - && ( ( area.width <= minTtSize && area.height <= minTtSize ) ) ) return false; - if( ( area.width > maxBtSize || area.height > maxBtSize ) - && ( ( area.width > maxTtSize || area.height > maxTtSize ) ) ) return false; - if (CS::isDualITree(cs) && (area.width > 64 || area.height > 64)) - { - return false; - } - } -#endif break; default: THROW( "Unknown split mode" ); return false; break; } -#if !JVET_M0421_SPLIT_SIG - // specific check for BT splits - switch( split ) - { - case CU_HORZ_SPLIT: - if( area.height <= minBtSize || area.height > maxBtSize ) return false; - if( area.width > MAX_TB_SIZEY && area.height <= MAX_TB_SIZEY ) return false; - break; - case CU_VERT_SPLIT: - if( area.width <= minBtSize || area.width > maxBtSize ) return false; - if( area.width <= MAX_TB_SIZEY && area.height > MAX_TB_SIZEY ) return false; - break; - case CU_TRIH_SPLIT: - if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize) return false; - if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) return false; - break; - case CU_TRIV_SPLIT: - if( area.width <= 2 * minTtSize || area.width > maxTtSize || area.height > maxTtSize) return false; - if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) return false; - break; - default: - break; - } -#endif return true; } @@ -651,12 +512,10 @@ PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) { split = CU_QUAD_SPLIT; } -#if JVET_M0446_M0888_M0905_VPDU_AT_PIC_BOUNDARY if ((!isBlInPic || !isTrInPic) && (currArea().Y().width > MAX_TB_SIZEY || currArea().Y().height > MAX_TB_SIZEY)) { split = CU_QUAD_SPLIT; } -#endif } m_partStack.back().checkdIfImplicit = true; @@ -675,13 +534,11 @@ void QTBTPartitioner::exitCurrSplit() CHECK( currDepth == 0, "depth is '0', although a split was performed" ); currDepth--; -#if JVET_M0113_M0188_QG_SIZE currSubdiv--; if( currQgEnable() ) currQgPos = currArea().lumaPos(); if( currQgChromaEnable() ) currQgChromaPos = currArea().chromaPos(); -#endif #if _DEBUG m_currArea = m_partStack.back().parts[m_partStack.back().idx]; #endif @@ -698,9 +555,7 @@ void QTBTPartitioner::exitCurrSplit() { CHECK( currBtDepth == 0, "BT depth is '0', athough a TT split was performed" ); currBtDepth--; -#if JVET_M0113_M0188_QG_SIZE currSubdiv--; -#endif } } else if( currSplit == TU_MAX_TR_SPLIT ) @@ -708,22 +563,18 @@ void QTBTPartitioner::exitCurrSplit() CHECK( currTrDepth == 0, "TR depth is '0', although a TU split was performed" ); currTrDepth--; } -#if JVET_M0140_SBT else if( currSplit >= SBT_VER_HALF_POS0_SPLIT && currSplit <= SBT_HOR_QUAD_POS1_SPLIT ) { CHECK( currTrDepth == 0, "TR depth is '0', although a TU split was performed" ); currTrDepth--; } -#endif else { CHECK( currTrDepth > 0, "RQT found with QTBT partitioner" ); CHECK( currQtDepth == 0, "QT depth is '0', although a QT split was performed" ); currQtDepth--; -#if JVET_M0113_M0188_QG_SIZE currSubdiv--; -#endif } } @@ -749,17 +600,13 @@ bool QTBTPartitioner::nextPart( const CodingStructure &cs, bool autoPop /*= fals // adapt the current bt depth if( currIdx == 1 ) currBtDepth--; else currBtDepth++; -#if JVET_M0113_M0188_QG_SIZE if( currIdx == 1 ) currSubdiv--; else currSubdiv++; -#endif } -#if JVET_M0113_M0188_QG_SIZE if( currQgEnable() ) currQgPos = currArea().lumaPos(); if( currQgChromaEnable() ) currQgChromaPos = currArea().chromaPos(); -#endif #if _DEBUG m_currArea = m_partStack.back().parts[currIdx]; #endif @@ -777,7 +624,6 @@ bool QTBTPartitioner::hasNextPart() return ( ( m_partStack.back().idx + 1 ) < m_partStack.back().parts.size() ); } -#if JVET_M0102_INTRA_SUBPARTITIONS void TUIntraSubPartitioner::splitCurrArea( const PartSplit split, const CodingStructure& cs ) { switch( split ) @@ -876,7 +722,6 @@ bool TUIntraSubPartitioner::canSplit( const PartSplit split, const CodingStructu break; } } -#endif ////////////////////////////////////////////////////////////////////////// @@ -1085,7 +930,6 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const } } -#if JVET_M0102_INTRA_SUBPARTITIONS void PartitionerImpl::getTUIntraSubPartitions( Partitioning &sub, const UnitArea &tuArea, const CodingStructure &cs, const PartSplit splitType ) { uint32_t nPartitions; @@ -1140,7 +984,6 @@ void PartitionerImpl::getTUIntraSubPartitions( Partitioning &sub, const UnitArea blkCr = CompArea(); } } -#endif static const int g_maxRtGridSize = 3; @@ -1222,7 +1065,6 @@ Partitioning PartitionerImpl::getMaxTuTiling( const UnitArea &cuArea, const Codi return ret; } -#if JVET_M0140_SBT Partitioning PartitionerImpl::getSbtTuTiling( const UnitArea& cuArea, const CodingStructure &cs, const PartSplit splitType ) { Partitioning ret; @@ -1281,4 +1123,3 @@ Partitioning PartitionerImpl::getSbtTuTiling( const UnitArea& cuArea, const Codi return ret; } -#endif diff --git a/source/Lib/CommonLib/UnitPartitioner.h b/source/Lib/CommonLib/UnitPartitioner.h index b605b6f504cbdfc4070100b817dac0893a6183f2..4fbe68f312f0629ac25932646445a26e74cc0a09 100644 --- a/source/Lib/CommonLib/UnitPartitioner.h +++ b/source/Lib/CommonLib/UnitPartitioner.h @@ -43,11 +43,7 @@ #include "CommonDef.h" static_assert( MAX_CU_TILING_PARTITIONS >= 4, "Minimum required number of partitions for the Partitioning type is 4!" ); -#if JVET_M0102_INTRA_SUBPARTITIONS typedef std::vector <UnitArea> Partitioning; -#else -typedef static_vector<UnitArea, MAX_CU_TILING_PARTITIONS> Partitioning; -#endif ////////////////////////////////////////////////////////////////////////// // PartManager class - manages the partitioning tree @@ -67,12 +63,9 @@ enum PartSplit CU_TRIH_SPLIT, CU_TRIV_SPLIT, TU_MAX_TR_SPLIT, -#if JVET_M0102_INTRA_SUBPARTITIONS TU_NO_ISP, TU_1D_HORZ_SPLIT, TU_1D_VERT_SPLIT, -#endif -#if JVET_M0140_SBT SBT_VER_HALF_POS0_SPLIT, SBT_VER_HALF_POS1_SPLIT, SBT_HOR_HALF_POS0_SPLIT, @@ -81,7 +74,6 @@ enum PartSplit SBT_VER_QUAD_POS1_SPLIT, SBT_HOR_QUAD_POS0_SPLIT, SBT_HOR_QUAD_POS1_SPLIT, -#endif NUM_PART_SPLIT, CU_MT_SPLIT = 1000, ///< dummy element to indicate the MT (multi-type-tree) split CU_BT_SPLIT = 1001, ///< dummy element to indicate the BT split @@ -100,10 +92,8 @@ struct PartLevel PartSplit implicitSplit; PartSplit firstSubPartSplit; bool canQtSplit; -#if JVET_M0113_M0188_QG_SIZE bool qgEnable; bool qgChromaEnable; -#endif PartLevel(); PartLevel( const PartSplit _split, const Partitioning& _parts ); @@ -127,11 +117,9 @@ public: unsigned currTrDepth; unsigned currBtDepth; unsigned currMtDepth; -#if JVET_M0113_M0188_QG_SIZE unsigned currSubdiv; Position currQgPos; Position currQgChromaPos; -#endif unsigned currImplicitBtDepth; ChannelType chType; @@ -142,10 +130,8 @@ public: const UnitArea& currArea () const { return currPartLevel().parts[currPartIdx()]; } const unsigned currPartIdx () const { return currPartLevel().idx; } const PartitioningStack& getPartStack () const { return m_partStack; } -#if JVET_M0113_M0188_QG_SIZE const bool currQgEnable () const { return currPartLevel().qgEnable; } const bool currQgChromaEnable () const { return currPartLevel().qgChromaEnable; } -#endif SplitSeries getSplitSeries () const; @@ -160,9 +146,7 @@ public: virtual void copyState ( const Partitioner& other ); public: -#if JVET_M0421_SPLIT_SIG virtual void canSplit ( const CodingStructure &cs, bool& canNo, bool& canQt, bool& canBh, bool& canBv, bool& canTh, bool& canTv ) = 0; -#endif virtual bool canSplit ( const PartSplit split, const CodingStructure &cs ) = 0; virtual bool isSplitImplicit ( const PartSplit split, const CodingStructure &cs ) = 0; virtual PartSplit getImplicitSplit ( const CodingStructure &cs ) = 0; @@ -183,15 +167,12 @@ public: bool nextPart ( const CodingStructure &cs, bool autoPop = false ); bool hasNextPart (); -#if JVET_M0421_SPLIT_SIG void canSplit ( const CodingStructure &cs, bool& canNo, bool& canQt, bool& canBh, bool& canBv, bool& canTh, bool& canTv ); -#endif bool canSplit ( const PartSplit split, const CodingStructure &cs ); bool isSplitImplicit ( const PartSplit split, const CodingStructure &cs ); PartSplit getImplicitSplit ( const CodingStructure &cs ); }; -#if JVET_M0102_INTRA_SUBPARTITIONS class TUIntraSubPartitioner : public Partitioner { public: @@ -221,7 +202,6 @@ public: bool isSplitImplicit (const PartSplit split, const CodingStructure &cs) { return false; }; //not needed PartSplit getImplicitSplit (const CodingStructure &cs) { return CU_DONT_SPLIT; }; //not needed }; -#endif @@ -239,12 +219,8 @@ namespace PartitionerImpl { Partitioning getCUSubPartitions( const UnitArea &cuArea, const CodingStructure &cs, const PartSplit splitType = CU_QUAD_SPLIT ); Partitioning getMaxTuTiling ( const UnitArea& curArea, const CodingStructure &cs ); -#if JVET_M0102_INTRA_SUBPARTITIONS void getTUIntraSubPartitions( Partitioning &sub, const UnitArea &tuArea, const CodingStructure &cs, const PartSplit splitType ); -#endif -#if JVET_M0140_SBT Partitioning getSbtTuTiling ( const UnitArea& curArea, const CodingStructure &cs, const PartSplit splitType ); -#endif }; #endif diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 89ce790f2ddaba556c807a2000d85c3ff669dac5..534ec8017a984c5543336823cc3209d91520d3f8 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -65,7 +65,6 @@ UnitArea CS::getArea( const CodingStructure &cs, const UnitArea &area, const Cha { return isDualITree( cs ) ? area.singleChan( chType ) : area; } -#if JVET_M0147_DMVR void CS::setRefinedMotionField(CodingStructure &cs) { for (CodingUnit *cu : cs.cus) @@ -97,7 +96,6 @@ void CS::setRefinedMotionField(CodingStructure &cs) } } } -#endif // CU tools bool CU::isIntra(const CodingUnit &cu) @@ -110,12 +108,10 @@ bool CU::isInter(const CodingUnit &cu) return cu.predMode == MODE_INTER; } -#if JVET_M0483_IBC bool CU::isIBC(const CodingUnit &cu) { return cu.predMode == MODE_IBC; } -#endif bool CU::isRDPCMEnabled(const CodingUnit& cu) { @@ -189,7 +185,6 @@ int CU::predictQP( const CodingUnit& cu, const int prevQP ) { const CodingStructure &cs = *cu.cs; -#ifdef JVET_M0685 if ( !cu.blocks[cu.chType].x && !( cu.blocks[cu.chType].y & ( cs.pcv->maxCUHeightMask >> getChannelTypeScaleY( cu.chType, cu.chromaFormat ) ) ) && ( cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType) != NULL ) ) { return ( ( cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType ) )->qp ); @@ -201,32 +196,8 @@ int CU::predictQP( const CodingUnit& cu, const int prevQP ) return ( a + b + 1 ) >> 1; } -#else - // only predict within the same CTU, use HEVC's above+left prediction - const int a = ( cu.blocks[cu.chType].y & ( cs.pcv->maxCUHeightMask >> getChannelTypeScaleY( cu.chType, cu.chromaFormat ) ) ) ? ( cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType ) )->qp : prevQP; - const int b = ( cu.blocks[cu.chType].x & ( cs.pcv->maxCUWidthMask >> getChannelTypeScaleX( cu.chType, cu.chromaFormat ) ) ) ? ( cs.getCU( cu.blocks[cu.chType].pos().offset( -1, 0 ), cu.chType ) )->qp : prevQP; - - return ( a + b + 1 ) >> 1; -#endif } -#if !JVET_M0113_M0188_QG_SIZE -bool CU::isQGStart( const CodingUnit& cu, Partitioner& partitioner ) -{ - int maxDqpDepth = cu.slice->getPPS()->getMaxCuDQPDepth(); - if( partitioner.currDepth >= maxDqpDepth ) - { - PartLevel splitAtMaxDepth = partitioner.getPartStack().at( maxDqpDepth ); - // the parent node of qtDepth + mttDepth == maxDqpDepth - if( splitAtMaxDepth.parts[splitAtMaxDepth.idx].blocks[partitioner.chType].pos() == cu.blocks[partitioner.chType].pos() ) - return true; - else - return false; - } - else - return true; -} -#endif uint32_t CU::getNumPUs( const CodingUnit& cu ) { @@ -272,11 +243,7 @@ bool CU::hasNonTsCodedBlock( const CodingUnit& cu ) { for( uint32_t i = 0; i < ::getNumberValidTBlocks( *cu.cs->pcv ); i++ ) { -#if JVET_M0464_UNI_MTS hasAnyNonTSCoded |= ( currTU.blocks[i].valid() && ( isLuma(ComponentID(i)) ? currTU.mtsIdx != 1 : true ) && TU::getCbf( currTU, ComponentID( i ) ) ); -#else - hasAnyNonTSCoded |= ( currTU.blocks[i].valid() && !currTU.transformSkip[i] && TU::getCbf( currTU, ComponentID( i ) ) ); -#endif } } @@ -294,7 +261,6 @@ uint32_t CU::getNumNonZeroCoeffNonTs( const CodingUnit& cu ) return count; } -#if JVET_M0102_INTRA_SUBPARTITIONS bool CU::divideTuInRows( const CodingUnit &cu ) { CHECK( cu.ispMode != HOR_INTRA_SUBPARTITIONS && cu.ispMode != VER_INTRA_SUBPARTITIONS, "Intra Subpartitions type not recognized!" ); @@ -466,7 +432,6 @@ uint32_t CU::getISPSplitDim( const int width, const int height, const PartSplit CHECK( g_aucLog2[partitionSize] + g_aucLog2[nonSplitDimensionSize] < g_aucLog2[minNumberOfSamplesPerCu], "A partition has less than the minimum amount of samples!" ); return partitionSize; } -#endif PUTraverser CU::traversePUs( CodingUnit& cu ) @@ -495,10 +460,8 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType { const int numMPMs = NUM_MOST_PROBABLE_MODES; const int extendRefLine = (channelType == CHANNEL_TYPE_LUMA) ? pu.multiRefIdx : 0; -#if JVET_M0102_INTRA_SUBPARTITIONS const ISPType ispType = isLuma( channelType ) ? ISPType( pu.cu->ispMode ) : NOT_INTRA_SUBPARTITIONS; const bool isHorSplit = ispType == HOR_INTRA_SUBPARTITIONS; -#endif { int numCand = -1; int leftIntraDir = PLANAR_IDX, aboveIntraDir = PLANAR_IDX; @@ -593,7 +556,6 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType } } } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( ispType != NOT_INTRA_SUBPARTITIONS ) { //default case @@ -702,7 +664,6 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType } } } -#endif else { mpm[0] = leftIntraDir; @@ -1033,15 +994,8 @@ bool PU::xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const #if JVET_L0090_PAIR_AVG bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos -#if JVET_M0483_IBC==0 - , int mmvdList -#endif -#if JVET_M0483_IBC , bool ibcFlag -#endif -#if JVET_M0170_MRG_SHARELIST , bool isShared -#endif ) #else @@ -1050,9 +1004,6 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa ) #endif { -#if JVET_M0483_IBC==0 - int mrgCandIdxIBC = mrgCandIdx; -#endif const Slice& slice = *cs.slice; MotionInfo miNeighbor; bool hasPruned[MRG_MAX_NUM_CANDS]; @@ -1061,19 +1012,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa { hasPruned[subPuMvpPos] = true; } -#if JVET_M0483_IBC -#if JVET_M0170_MRG_SHARELIST auto &lut = ibcFlag ? ( isShared ? cs.motionLut.lutShareIbc : cs.motionLut.lutIbc ) : ( isShared ? cs.motionLut.lutShare : cs.motionLut.lut ); -#else - auto &lut = ibcFlag ? cs.motionLut.lutIbc : cs.motionLut.lut; -#endif -#else -#if JVET_M0170_MRG_SHARELIST - auto &lut = isShared ? cs.motionLut.lutShare : cs.motionLut.lut; -#else - auto &lut = cs.motionLut.lut; -#endif -#endif int num_avai_candInLUT = (int) lut.size(); for (int mrgIdx = 1; mrgIdx <= num_avai_candInLUT; mrgIdx++) @@ -1085,29 +1024,13 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]); } -#if JVET_M0126_HMVP_MRG_PRUNING if (mrgIdx > 2 || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) -#else - if (!xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) -#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; #endif -#if JVET_M0264_HMVP_WITH_GBIIDX mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? miNeighbor.GBiIdx : GBI_DEFAULT; -#endif -#if JVET_M0483_IBC==0 - if (miNeighbor.interDir == 1 && slice.getRefPic(REF_PIC_LIST_0, miNeighbor.refIdx[0])->getPOC() == slice.getPOC()) - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - if(mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxIBC++; - } - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return true; } @@ -1121,7 +1044,6 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa return false; } -#if JVET_M0483_IBC void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx) { const CodingStructure &cs = *pu.cs; @@ -1143,15 +1065,9 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int cnt = 0; -#if JVET_M0170_MRG_SHARELIST const Position posLT = pu.shareParentPos; const Position posRT = pu.shareParentPos.offset(pu.shareParentSize.width - 1, 0); const Position posLB = pu.shareParentPos.offset(0, pu.shareParentSize.height - 1); -#else - const Position posLT = pu.Y().topLeft(); - const Position posRT = pu.Y().topRight(); - const Position posLB = pu.Y().bottomLeft(); -#endif MotionInfo miAbove, miLeft, miAboveLeft, miAboveRight, miBelowLeft; @@ -1208,9 +1124,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const return; } -#if JVET_M0126_HMVP_MRG_PRUNING int spatialCandPos = cnt; -#endif // above right const PredictionUnit *puAboveRight = cs.getPURestricted(posRT.offset(1, -1), pu, pu.chType); @@ -1313,26 +1227,16 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const bool isAvailableSubPu = false; unsigned subPuMvpPos = 0; -#if JVET_M0170_MRG_SHARELIST bool isShared = ((pu.Y().lumaSize().width != pu.shareParentSize.width) || (pu.Y().lumaSize().height != pu.shareParentSize.height)); -#endif #if JVET_L0090_PAIR_AVG bool bFound = addMergeHMVPCand(cs, mrgCtx, canFastExit , mrgCandIdx , maxNumMergeCandMin1, cnt -#if JVET_M0126_HMVP_MRG_PRUNING , spatialCandPos -#else - , cnt -#endif , isAvailableSubPu, subPuMvpPos -#if JVET_M0483_IBC , true -#endif -#if JVET_M0170_MRG_SHARELIST , isShared -#endif ); #else bool bFound = addMergeHMVPCand(slice, mrgCtx, isCandInter, canFastExit @@ -1348,44 +1252,20 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const #if JVET_L0090_PAIR_AVG // pairwise-average candidates -#if JVET_M0193_PAIR_AVG_REDUCTION==0 - const int cutoff = std::min(cnt, 4); - const int end = cutoff * (cutoff - 1) / 2; - constexpr int PRIORITY_LIST0[] = { 0, 0, 1, 0, 1, 2 }; - constexpr int PRIORITY_LIST1[] = { 1, 2, 2, 3, 3, 3 }; - - for (int idx = 0; idx < end && cnt != maxNumMergeCand; idx++) - { - const int i = PRIORITY_LIST0[idx]; - const int j = PRIORITY_LIST1[idx]; -#else if (cnt>1 && cnt <maxNumMergeCand) { -#endif mrgCtx.mvFieldNeighbours[cnt * 2 ].setMvField(Mv(0, 0), NOT_VALID); mrgCtx.mvFieldNeighbours[cnt * 2 + 1].setMvField(Mv(0, 0), NOT_VALID); -#if JVET_M0193_PAIR_AVG_REDUCTION const Mv& MvI = mrgCtx.mvFieldNeighbours[0 * 2].mv; const Mv& MvJ = mrgCtx.mvFieldNeighbours[1 * 2].mv; -#else - const Mv& MvI = mrgCtx.mvFieldNeighbours[i * 2 ].mv; - const Mv& MvJ = mrgCtx.mvFieldNeighbours[j * 2 ].mv; -#endif // average two MVs Mv avgMv = MvI; avgMv += MvJ; mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; -#if JVET_M0265_MV_ROUNDING_CLEANUP roundAffineMv(avgMv.hor, avgMv.ver, 1); avgMv.roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); -#else - avgMv.setHor(avgMv.getHor() / 2); - avgMv.setVer(avgMv.getVer() / 2); - avgMv.setHor((avgMv.getHor() / 16) << 4); - avgMv.setVer((avgMv.getVer() / 16) << 4); -#endif mrgCtx.mvFieldNeighbours[cnt * 2 ].setMvField(avgMv, MAX_NUM_REF); mrgCtx.interDirNeighbours[cnt] = 1; cnt++; @@ -1401,7 +1281,6 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const mrgCtx.numValidMergeCand = cnt; } -#endif void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int mmvdList, @@ -1434,19 +1313,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int cnt = 0; -#if JVET_M0483_IBC==0 - int mrgCandIdxIBC = mrgCandIdx; -#endif -#if JVET_M0170_MRG_SHARELIST const Position posLT = pu.shareParentPos; const Position posRT = pu.shareParentPos.offset(pu.shareParentSize.width - 1, 0); const Position posLB = pu.shareParentPos.offset(0, pu.shareParentSize.height - 1); -#else - const Position posLT = pu.Y().topLeft(); - const Position posRT = pu.Y().topRight(); - const Position posLB = pu.Y().bottomLeft(); -#endif MotionInfo miAbove, miLeft, miAboveLeft, miAboveRight, miBelowLeft; //left @@ -1466,25 +1336,13 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miLeft.interDir; mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puLeft->cu->GBiIdx : GBI_DEFAULT; // get Mv from Left -#if JVET_M0483_IBC==0 - if (puLeft->cu->ibc) - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxIBC++; - } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miLeft.mv[0], miLeft.refIdx[0]); if (slice.isInterB()) { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miLeft.mv[1], miLeft.refIdx[1]); } -#if JVET_M0483_IBC==0 - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return; } @@ -1518,25 +1376,13 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miAbove.interDir; // get Mv from Above mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAbove->cu->GBiIdx : GBI_DEFAULT; -#if JVET_M0483_IBC==0 - if (puAbove->cu->ibc) - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxIBC++; - } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); if( slice.isInterB() ) { mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAbove.mv[1], miAbove.refIdx[1] ); } -#if JVET_M0483_IBC==0 - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return; } @@ -1551,9 +1397,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, return; } -#if JVET_M0126_HMVP_MRG_PRUNING int spatialCandPos = cnt; -#endif // above right const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); @@ -1578,14 +1422,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miAboveRight.interDir; // get Mv from Above-right mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveRight->cu->GBiIdx : GBI_DEFAULT; -#if JVET_M0483_IBC==0 - if (puAboveRight->cu->ibc) - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxIBC++; - } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); if( slice.isInterB() ) @@ -1593,11 +1429,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveRight.mv[1], miAboveRight.refIdx[1] ); } -#if JVET_M0483_IBC==0 - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return; } @@ -1634,14 +1466,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miBelowLeft.interDir; mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puLeftBottom->cu->GBiIdx : GBI_DEFAULT; // get Mv from Bottom-Left -#if JVET_M0483_IBC==0 - if (puLeftBottom->cu->ibc) - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxIBC++; - } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); if( slice.isInterB() ) @@ -1649,11 +1473,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miBelowLeft.mv[1], miBelowLeft.refIdx[1] ); } -#if JVET_M0483_IBC==0 - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return; } @@ -1693,14 +1513,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miAboveLeft.interDir; mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveLeft->cu->GBiIdx : GBI_DEFAULT; // get Mv from Above-Left -#if JVET_M0483_IBC==0 - if (puAboveLeft->cu->ibc) - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxIBC++; - } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveLeft.mv[0], miAboveLeft.refIdx[0] ); if( slice.isInterB() ) @@ -1708,11 +1520,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveLeft.mv[1], miAboveLeft.refIdx[1] ); } -#if JVET_M0483_IBC==0 - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return; } @@ -1731,24 +1539,14 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { //>> MTK colocated-RightBottom // offset the pos to be sure to "point" to the same position the uiAbsPartIdx would've pointed to -#if JVET_M0170_MRG_SHARELIST Position posRB = pu.shareParentPos.offset(pu.shareParentSize.width-3, pu.shareParentSize.height - 3); -#else - Position posRB = pu.Y().bottomRight().offset(-3, -3); -#endif const PreCalcValues& pcv = *cs.pcv; Position posC0; -#if JVET_M0170_MRG_SHARELIST Position posC1 = pu.shareParentPos.offset((pu.shareParentSize.width/2), (pu.shareParentSize.height/2)); -#else - Position posC1 = pu.Y().center(); -#endif bool C0Avail = false; -#if JVET_M0170_MRG_SHARELIST bool C1Avail = (posC1.x < pcv.lumaWidth) && (posC1.y < pcv.lumaHeight); -#endif if (((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight)) { @@ -1784,11 +1582,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int dir = 0; unsigned uiArrayAddr = cnt; bool bExistMV = ( C0Avail && getColocatedMVP(pu, REF_PIC_LIST_0, posC0, cColMv, iRefIdx ) ) -#if JVET_M0170_MRG_SHARELIST || ( C1Avail && getColocatedMVP(pu, REF_PIC_LIST_0, posC1, cColMv, iRefIdx )); -#else - || getColocatedMVP(pu, REF_PIC_LIST_0, posC1, cColMv, iRefIdx ); -#endif if (bExistMV) { @@ -1799,11 +1593,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if (slice.isInterB()) { bExistMV = ( C0Avail && getColocatedMVP(pu, REF_PIC_LIST_1, posC0, cColMv, iRefIdx ) ) -#if JVET_M0170_MRG_SHARELIST || (C1Avail && getColocatedMVP(pu, REF_PIC_LIST_1, posC1, cColMv, iRefIdx ) ); -#else - || getColocatedMVP(pu, REF_PIC_LIST_1, posC1, cColMv, iRefIdx ); -#endif if (bExistMV) { dir |= 2; @@ -1833,11 +1623,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, isCandInter [uiArrayAddr] = true; #endif mrgCtx.GBiIdx[uiArrayAddr] = GBI_DEFAULT; -#if JVET_M0483_IBC==0 - if (mrgCandIdxIBC == cnt && canFastExit) -#else if (mrgCandIdx == cnt && canFastExit) -#endif { return; } @@ -1859,31 +1645,14 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, bool isAvailableSubPu = false; unsigned subPuMvpPos = 0; #if JVET_L0090_PAIR_AVG -#if JVET_M0170_MRG_SHARELIST bool isShared = ((pu.Y().lumaSize().width != pu.shareParentSize.width) || (pu.Y().lumaSize().height != pu.shareParentSize.height)); -#endif bool bFound = addMergeHMVPCand(cs, mrgCtx, canFastExit -#if JVET_M0483_IBC==0 - , (mmvdList != 0 && mrgCandIdx != -1) ? (const int) mrgCandIdxIBC : mrgCandIdx -#else , mrgCandIdx -#endif , maxNumMergeCandMin1, cnt -#if JVET_M0126_HMVP_MRG_PRUNING , spatialCandPos -#else - , cnt -#endif , isAvailableSubPu, subPuMvpPos -#if JVET_M0483_IBC==0 - , mmvdList -#endif -#if JVET_M0483_IBC , CU::isIBC(*pu.cu) -#endif -#if JVET_M0170_MRG_SHARELIST , isShared -#endif ); #else bool bFound = addMergeHMVPCand(slice, mrgCtx, isCandInter, canFastExit @@ -1901,28 +1670,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #if JVET_L0090_PAIR_AVG // pairwise-average candidates { -#if !JVET_M0193_PAIR_AVG_REDUCTION - const int cutoff = std::min( cnt, 4 ); - const int end = cutoff * (cutoff - 1) / 2; - constexpr int PRIORITY_LIST0[] = { 0, 0, 1, 0, 1, 2 }; - constexpr int PRIORITY_LIST1[] = { 1, 2, 2, 3, 3, 3 }; -#endif -#if JVET_M0193_PAIR_AVG_REDUCTION -#if JVET_M0483_IBC if (cnt > 1 && cnt < maxNumMergeCand) -#else - // skip when only 1 candidate is added so far or one is BV and one is MV - if( cnt > 1 && cnt < maxNumMergeCand && !(mrgCtx.mrgTypeNeighbours[0] != mrgCtx.mrgTypeNeighbours[1] && pu.cs->sps->getIBCMode())) -#endif -#else - for( int idx = 0; idx < end && cnt != maxNumMergeCand; idx++ ) -#endif { -#if !JVET_M0193_PAIR_AVG_REDUCTION - const int i = PRIORITY_LIST0[idx]; - const int j = PRIORITY_LIST1[idx]; -#endif mrgCtx.mvFieldNeighbours[cnt * 2].setMvField( Mv( 0, 0 ), NOT_VALID ); mrgCtx.mvFieldNeighbours[cnt * 2 + 1].setMvField( Mv( 0, 0 ), NOT_VALID ); @@ -1930,22 +1680,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, unsigned char interDir = 0; -#if !JVET_M0193_PAIR_AVG_REDUCTION && JVET_M0483_IBC==0 - // skip when one is BV and one is MV - if (mrgCtx.mrgTypeNeighbours[i] != mrgCtx.mrgTypeNeighbours[j] && pu.cs->sps->getIBCMode()) - { - continue; - } -#endif for( int refListId = 0; refListId < (slice.isInterB() ? 2 : 1); refListId++ ) { -#if JVET_M0193_PAIR_AVG_REDUCTION const short refIdxI = mrgCtx.mvFieldNeighbours[0 * 2 + refListId].refIdx; const short refIdxJ = mrgCtx.mvFieldNeighbours[1 * 2 + refListId].refIdx; -#else - const short refIdxI = mrgCtx.mvFieldNeighbours[i * 2 + refListId].refIdx; - const short refIdxJ = mrgCtx.mvFieldNeighbours[j * 2 + refListId].refIdx; -#endif // both MVs are invalid, skip if( (refIdxI == NOT_VALID) && (refIdxJ == NOT_VALID) ) @@ -1957,55 +1695,25 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // both MVs are valid, average these two MVs if( (refIdxI != NOT_VALID) && (refIdxJ != NOT_VALID) ) { -#if JVET_M0193_PAIR_AVG_REDUCTION const Mv& MvI = mrgCtx.mvFieldNeighbours[0 * 2 + refListId].mv; const Mv& MvJ = mrgCtx.mvFieldNeighbours[1 * 2 + refListId].mv; -#else - const Mv& MvI = mrgCtx.mvFieldNeighbours[i * 2 + refListId].mv; - const Mv& MvJ = mrgCtx.mvFieldNeighbours[j * 2 + refListId].mv; -#endif // average two MVs Mv avgMv = MvI; avgMv += MvJ; -#if JVET_M0265_MV_ROUNDING_CLEANUP roundAffineMv(avgMv.hor, avgMv.ver, 1); -#else - avgMv.setHor( avgMv.getHor() / 2 ); - avgMv.setVer( avgMv.getVer() / 2 ); -#endif -#if JVET_M0483_IBC==0 -#if JVET_M0193_PAIR_AVG_REDUCTION - if (mrgCtx.mrgTypeNeighbours[0] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[1] == MRG_TYPE_IBC && pu.cs->sps->getIBCMode()) -#else - if (mrgCtx.mrgTypeNeighbours[i] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[j] == MRG_TYPE_IBC && pu.cs->sps->getIBCMode()) -#endif - { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; - avgMv.setHor((avgMv.getHor() / 16) << 4); - avgMv.setVer((avgMv.getVer() / 16) << 4); - } -#endif mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( avgMv, refIdxI ); } // only one MV is valid, take the only one MV else if( refIdxI != NOT_VALID ) { -#if JVET_M0193_PAIR_AVG_REDUCTION Mv singleMv = mrgCtx.mvFieldNeighbours[0 * 2 + refListId].mv; -#else - Mv singleMv = mrgCtx.mvFieldNeighbours[i * 2 + refListId].mv; -#endif mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( singleMv, refIdxI ); } else if( refIdxJ != NOT_VALID ) { -#if JVET_M0193_PAIR_AVG_REDUCTION Mv singleMv = mrgCtx.mvFieldNeighbours[1 * 2 + refListId].mv; -#else - Mv singleMv = mrgCtx.mvFieldNeighbours[j * 2 + refListId].mv; -#endif mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( singleMv, refIdxJ ); } } @@ -2109,7 +1817,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, } mrgCtx.numValidMergeCand = uiArrayAddr; } -#if JVET_M0147_DMVR bool PU::checkDMVRCondition(const PredictionUnit& pu) { if (pu.cs->sps->getUseDMVR()) @@ -2129,7 +1836,6 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) return false; } } -#endif // for ibc pu validation bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xStartInCU, int yStartInCU, int xBv, int yBv, int ctuSize) { @@ -2174,14 +1880,9 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i } // in the same CTU line -#if JVET_M0407_IBC_RANGE if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2) - 1)) -#else - if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2))) -#endif { -#if JVET_M0407_IBC_RANGE // in the same CTU, or left CTU // if part of ref block is in the left CTU, some area can be referred from the not-yet updated local CTU buffer if ((refLeftX >> ctuSizeLog2) == ((xPos >> ctuSizeLog2) - 1)) @@ -2194,25 +1895,10 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i if (pu.cs->isDecomp(refPosCol64x64, toChannelType(COMPONENT_Y))) return false; } -#endif -#if !JVET_M0407_IBC_RANGE - // in the same CTU, check if the reference block is already coded - const Position refPosLT = pu.Y().topLeft().offset(xBv, yBv); - const Position refPosBR = pu.Y().bottomRight().offset(xBv, yBv); - const ChannelType chType = toChannelType(COMPONENT_Y); - { - if (!pu.cs->isDecomp(refPosBR, chType)) - return false; - if (!pu.cs->isDecomp(refPosLT, chType)) - return false; - } - return true; -#endif } else return false; -#if JVET_M0407_IBC_RANGE // in the same CTU, or valid area from left CTU. Check if the reference block is already coded const Position refPosLT = pu.Y().topLeft().offset(xBv, yBv); const Position refPosBR = pu.Y().bottomRight().offset(xBv, yBv); @@ -2222,7 +1908,6 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i if (!pu.cs->isDecomp(refPosLT, chType)) return false; return true; -#endif }// for ibc pu validation @@ -2245,7 +1930,6 @@ static int xGetDistScaleFactor(const int &iCurrPOC, const int &iCurrRefPOC, cons } } -#if JVET_M0512_MOTION_BUFFER_COMPRESSION int convertMvFixedToFloat(int32_t val) { int sign = val >> 31; @@ -2280,7 +1964,6 @@ int roundMvComp(int x) { return convertMvFloatToFixed(convertMvFixedToFloat(x)); } -#endif int PU::getDistScaleFactor(const int &currPOC, const int &currRefPOC, const int &colPOC, const int &colRefPOC) { @@ -2328,14 +2011,9 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, { for (k = currBaseNum; k < MMVD_BASE_MV_NUM; k++) { -#if JVET_M0068_M0171_MMVD_CLEANUP mrgCtx.mmvdBaseMv[k][0] = MvField(Mv(0, 0), 0); const Slice &slice = *pu.cs->slice; mrgCtx.mmvdBaseMv[k][1] = MvField(Mv(0, 0), (slice.isInterB() ? 0 : -1)); -#else - mrgCtx.mmvdBaseMv[k][0] = MvField(Mv(0, 0), 0); - mrgCtx.mmvdBaseMv[k][0] = MvField(Mv(0, 0), 0); -#endif mrgCtx.GBiIdx[k] = GBI_DEFAULT; mrgCtx.interDirNeighbours[k] = (mrgCtx.mmvdBaseMv[k][0].refIdx >= 0) + (mrgCtx.mmvdBaseMv[k][1].refIdx >= 0) * 2; } @@ -2367,17 +2045,11 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList { return false; } -#if JVET_M0483_IBC if (mi.isIBCmot) { return false; } -#endif -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) -#else - if (eRefPicList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefPicList, refIdx)->getPOC() == pu.cs->slice->getPOC()) -#endif { return false; } @@ -2420,10 +2092,8 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList // Scale the vector. Mv cColMv = mi.mv[eColRefPicList]; -#if JVET_M0512_MOTION_BUFFER_COMPRESSION cColMv.setHor(roundMvComp(cColMv.getHor())); cColMv.setVer(roundMvComp(cColMv.getVer())); -#endif if (bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/) { @@ -2484,11 +2154,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) //left const PredictionUnit *neibLeftPU = NULL; neibLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 0), pu, pu.cs->chType); -#if JVET_M0483_IBC left = (neibLeftPU) ? CU::isIBC(*neibLeftPU->cu) : 0; -#else - left = (neibLeftPU) ? neibLeftPU->cu->ibc : 0; -#endif if (left) { @@ -2500,11 +2166,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) //above const PredictionUnit *neibAbovePU = NULL; neibAbovePU = pu.cs->getPURestricted(posRT.offset(0, -1), pu, pu.cs->chType); -#if JVET_M0483_IBC above = (neibAbovePU) ? CU::isIBC(*neibAbovePU->cu) : 0; -#else - above = (neibAbovePU) ? neibAbovePU->cu->ibc : 0; -#endif if (above) { @@ -2516,11 +2178,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Below Left predictor search const PredictionUnit *neibBelowLeftPU = NULL; neibBelowLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 1), pu, pu.cs->chType); -#if JVET_M0483_IBC unsigned int belowLeft = (neibBelowLeftPU) ? CU::isIBC(*neibBelowLeftPU->cu) : 0; -#else - unsigned int belowLeft = (neibBelowLeftPU) ? neibBelowLeftPU->cu->ibc : 0; -#endif if (belowLeft) { @@ -2533,11 +2191,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Above Right predictor search const PredictionUnit *neibAboveRightPU = NULL; neibAboveRightPU = pu.cs->getPURestricted(posRT.offset(1, -1), pu, pu.cs->chType); -#if JVET_M0483_IBC unsigned int aboveRight = (neibAboveRightPU) ? CU::isIBC(*neibAboveRightPU->cu) : 0; -#else - unsigned int aboveRight = (neibAboveRightPU) ? neibAboveRightPU->cu->ibc : 0; -#endif if (aboveRight) { @@ -2550,11 +2204,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Above Left predictor search const PredictionUnit *neibAboveLeftPU = NULL; neibAboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, pu.cs->chType); -#if JVET_M0483_IBC unsigned int aboveLeft = (neibAboveLeftPU) ? CU::isIBC(*neibAboveLeftPU->cu) : 0; -#else - unsigned int aboveLeft = (neibAboveLeftPU) ? neibAboveLeftPU->cu->ibc : 0; -#endif if (aboveLeft) { @@ -2582,11 +2232,7 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) const PredictionUnit *neibRefPU = NULL; neibRefPU = pu.cs->getPURestricted(pu.lumaPos().offset(offsetX, offsetY), pu, pu.cs->chType); -#if JVET_M0483_IBC bool isIBC = (neibRefPU) ? CU::isIBC(*neibRefPU->cu) : 0; -#else - bool isIBC = (neibRefPU) ? neibRefPU->cu->ibc : 0; -#endif if (isIBC) { derivedMv = neibRefPU->bv; @@ -2595,7 +2241,6 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) return isIBC; } -#if JVET_M0483_IBC /** * Constructs a list of candidates for IBC AMVP (See specification, section "Derivation process for motion vector predictor candidates") */ @@ -2646,20 +2291,10 @@ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo) } } -#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN for( int i = 0; i < pInfo->numCand; i++ ) { pInfo->mvCand[i].roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); } -#else - if (pu.cu->imv != 0) - { - for (int i = 0; i < pInfo->numCand; i++) - { - pInfo->mvCand[i].roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); - } - } -#endif if (pInfo->numCand == 2) { @@ -2688,13 +2323,9 @@ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo) for (Mv &mv : pInfo->mvCand) { mv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if !JVET_M0281_AMVP_ROUNDING && !JVET_M0117_AMVP_LIST_GEN - mv.roundToAmvrSignalPrecision(MV_PRECISION_QUARTER, pu.cu->imv); -#endif } } -#endif /** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates") * \param uiPartIdx @@ -2785,20 +2416,10 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in } } -#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN for( int i = 0; i < pInfo->numCand; i++ ) { pInfo->mvCand[i].roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); } -#else - if( pu.cu->imv != 0) - { - for( int i = 0; i < pInfo->numCand; i++ ) - { - pInfo->mvCand[i].roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); - } - } -#endif if( pInfo->numCand == 2 ) { @@ -2808,11 +2429,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in } } -#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN if( cs.slice->getEnableTMVPFlag() && pInfo->numCand < AMVP_MAX_NUM_CANDS ) -#else - if( cs.slice->getEnableTMVPFlag() ) -#endif { // Get Temporal Motion Predictor const int refIdx_Col = refIdx; @@ -2824,9 +2441,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in Position posC0; bool C0Avail = false; Position posC1 = pu.Y().center(); -#if JVET_M0170_MRG_SHARELIST bool C1Avail = ( posC1.x < pcv.lumaWidth ) && ( posC1.y < pcv.lumaHeight ) ; -#endif Mv cColMv; @@ -2857,36 +2472,10 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in } } -#if JVET_M0170_MRG_SHARELIST if ((C0Avail && getColocatedMVP(pu, eRefPicList, posC0, cColMv, refIdx_Col)) || (C1Avail && getColocatedMVP(pu, eRefPicList, posC1, cColMv, refIdx_Col))) -#else - if ((C0Avail && getColocatedMVP(pu, eRefPicList, posC0, cColMv, refIdx_Col)) || getColocatedMVP(pu, eRefPicList, posC1, cColMv, refIdx_Col)) -#endif { -#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN cColMv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); -#else - if (pu.cu->imv != 0) - { - cColMv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); - } -#endif -#if JVET_M0117_AMVP_LIST_GEN pInfo->mvCand[pInfo->numCand++] = cColMv; -#else - int i = 0; - for (i = 0; i < pInfo->numCand; i++) - { - if (cColMv == pInfo->mvCand[i]) - { - break; - } - } - if (i == pInfo->numCand) - { - pInfo->mvCand[pInfo->numCand++] = cColMv; - } -#endif } } @@ -2911,9 +2500,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in for (Mv &mv : pInfo->mvCand) { mv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if !JVET_M0281_AMVP_ROUNDING && !JVET_M0117_AMVP_LIST_GEN - mv.roundToAmvrSignalPrecision(MV_PRECISION_QUARTER, pu.cu->imv); -#endif } } @@ -2970,36 +2556,28 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r } xInheritedAffineMv( pu, neibPU, eRefPicListIndex, outputAffineMv ); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { -#endif outputAffineMv[0].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); outputAffineMv[1].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } else if ( pu.cu->imv == 2 ) { outputAffineMv[0].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); outputAffineMv[1].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } -#endif affiAMVPInfo.mvCandLT[affiAMVPInfo.numCand] = outputAffineMv[0]; affiAMVPInfo.mvCandRT[affiAMVPInfo.numCand] = outputAffineMv[1]; if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { -#endif outputAffineMv[2].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } else if ( pu.cu->imv == 2 ) { outputAffineMv[2].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } -#endif affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand] = outputAffineMv[2]; } affiAMVPInfo.numCand++; @@ -3064,9 +2642,7 @@ void PU::xInheritedAffineMv( const PredictionUnit &pu, const PredictionUnit* puN roundAffineMv( horTmp, verTmp, shift ); rcMv[0].hor = horTmp; rcMv[0].ver = verTmp; -#if JVET_M0145_AFFINE_MV_CLIP rcMv[0].clipToStorageBitDepth(); -#endif // v1 horTmp = iMvScaleHor + iDMvHorX * (posCurX + curW - posNeiX) + iDMvVerX * (posCurY - posNeiY); @@ -3074,9 +2650,7 @@ void PU::xInheritedAffineMv( const PredictionUnit &pu, const PredictionUnit* puN roundAffineMv( horTmp, verTmp, shift ); rcMv[1].hor = horTmp; rcMv[1].ver = verTmp; -#if JVET_M0145_AFFINE_MV_CLIP rcMv[1].clipToStorageBitDepth(); -#endif // v2 if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) @@ -3086,9 +2660,7 @@ void PU::xInheritedAffineMv( const PredictionUnit &pu, const PredictionUnit* puN roundAffineMv( horTmp, verTmp, shift ); rcMv[2].hor = horTmp; rcMv[2].ver = verTmp; -#if JVET_M0145_AFFINE_MV_CLIP rcMv[2].clipToStorageBitDepth(); -#endif } } @@ -3128,16 +2700,12 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co { for (int i = 0; i < affiAMVPInfo.numCand; i++) { -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif affiAMVPInfo.mvCandLT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); affiAMVPInfo.mvCandRT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); affiAMVPInfo.mvCandLB[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } -#endif } return; } @@ -3189,14 +2757,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co outputAffineMv[1] = amvpInfo1.mvCand[0]; outputAffineMv[2] = amvpInfo2.mvCand[0]; -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { -#endif outputAffineMv[0].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); outputAffineMv[1].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); outputAffineMv[2].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } else if ( pu.cu->imv == 2 ) { @@ -3204,7 +2769,6 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co outputAffineMv[1].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); outputAffineMv[2].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } -#endif if ( cornerMVPattern == 7 || (cornerMVPattern == 3 && pu.cu->affineType == AFFINEMODEL_4PARAM) ) { @@ -3241,9 +2805,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co Position posC0; bool C0Avail = false; Position posC1 = pu.Y().center(); -#if JVET_M0170_MRG_SHARELIST bool C1Avail = ( posC1.x < pcv.lumaWidth ) && ( posC1.y < pcv.lumaHeight ) ; -#endif Mv cColMv; if ( ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight) ) @@ -3273,24 +2835,16 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co } } -#if JVET_M0170_MRG_SHARELIST if ( (C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdxCol )) || (C1Avail && getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdxCol ) ) ) -#else - if ( (C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdxCol )) || getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdxCol ) ) -#endif { -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { -#endif cColMv.roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } else if ( pu.cu->imv == 2 ) { cColMv.roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } -#endif affiAMVPInfo.mvCandLT[affiAMVPInfo.numCand] = cColMv; affiAMVPInfo.mvCandRT[affiAMVPInfo.numCand] = cColMv; affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand] = cColMv; @@ -3313,22 +2867,17 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co for (int i = 0; i < affiAMVPInfo.numCand; i++) { -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif affiAMVPInfo.mvCandLT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); affiAMVPInfo.mvCandRT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); affiAMVPInfo.mvCandLB[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } -#endif } } -#if JVET_M0483_IBC bool PU::addIBCMVPCand(const PredictionUnit &pu, const Position &pos, const MvpDir &eDir, AMVPInfo &info) { CodingStructure &cs = *pu.cs; @@ -3367,7 +2916,6 @@ bool PU::addIBCMVPCand(const PredictionUnit &pu, const Position &pos, const MvpD info.mvCand[info.numCand++] = neibMi.mv[REF_PIC_LIST_0]; return true; } -#endif bool PU::addMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &info ) { @@ -3461,11 +3009,7 @@ bool PU::addMVPCandWithScaling( const PredictionUnit &pu, const RefPicList &eRef neibPU = cs.getPURestricted( neibPos, pu, pu.chType ); -#if JVET_M0483_IBC if (neibPU == NULL || !CU::isInter(*neibPU->cu) || !CU::isInter(*pu.cu)) -#else - if( neibPU == NULL || !CU::isInter( *neibPU->cu ) ) -#endif { return false; } @@ -3516,14 +3060,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const Slice &slice = *(*pu.cs).slice; MotionInfo neibMi; -#if !JVET_M0117_AMVP_LIST_GEN - int i = 0; -#endif -#if JVET_M0483_IBC auto &lut = CU::isIBC(*pu.cu) ? pu.cs->motionLut.lutIbc : pu.cs->motionLut.lut; -#else - auto &lut = pu.cs->motionLut.lut; -#endif int num_avai_candInLUT = (int) lut.size(); int num_allowedCand = std::min(MAX_NUM_HMVP_AVMPCANDS, num_avai_candInLUT); @@ -3533,56 +3070,23 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, { return; } -#if JVET_M0117_AMVP_LIST_GEN neibMi = lut[mrgIdx - 1]; -#else - neibMi = lut[num_avai_candInLUT - mrgIdx]; -#endif for (int predictorSource = 0; predictorSource < 2; predictorSource++) { const RefPicList eRefPicListIndex = (predictorSource == 0) ? eRefPicList : eRefPicList2nd; const int neibRefIdx = neibMi.refIdx[eRefPicListIndex]; -#if JVET_M0483_IBC if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx)))) -#else - if (neibRefIdx >= 0 && currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx)) -#endif { Mv pmv = neibMi.mv[eRefPicListIndex]; -#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN pmv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv); -#else - if (imv != 0) - { - pmv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, imv); - } -#endif -#if JVET_M0117_AMVP_LIST_GEN info.mvCand[info.numCand++] = pmv; if (info.numCand >= AMVP_MAX_NUM_CANDS) { return; } -#else - for (i = 0; i < info.numCand; i++) - { - if (pmv == info.mvCand[i]) - { - break; - } - } - if (i == info.numCand) - { - info.mvCand[info.numCand++] = pmv; - if (info.numCand >= AMVP_MAX_NUM_CANDS) - { - return; - } - } -#endif } } } @@ -3624,11 +3128,7 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], if ( mi[idx0].refIdx[l] >= 0 && mi[idx1].refIdx[l] >= 0 ) { // check same refidx and different mv -#if JVET_M0228_REMOVE_CPMV_COMPARE if ( mi[idx0].refIdx[l] == mi[idx1].refIdx[l]) -#else - if ( mi[idx0].refIdx[l] == mi[idx1].refIdx[l] && mi[idx0].mv[l] != mi[idx1].mv[l] ) -#endif { dir |= (l + 1); refIdx[l] = mi[idx0].refIdx[l]; @@ -3649,11 +3149,7 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], if ( mi[idx0].refIdx[l] >= 0 && mi[idx1].refIdx[l] >= 0 && mi[idx2].refIdx[l] >= 0 ) { // check same refidx and different mv -#if JVET_M0228_REMOVE_CPMV_COMPARE if ( mi[idx0].refIdx[l] == mi[idx1].refIdx[l] && mi[idx0].refIdx[l] == mi[idx2].refIdx[l]) -#else - if ( mi[idx0].refIdx[l] == mi[idx1].refIdx[l] && mi[idx0].refIdx[l] == mi[idx2].refIdx[l] && (mi[idx0].mv[l] != mi[idx1].mv[l] || mi[idx0].mv[l] != mi[idx2].mv[l]) ) -#endif { dir |= (l + 1); refIdx[l] = mi[idx0].refIdx[l]; @@ -3827,9 +3323,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx bool isAvailableSubPu = false; if ( enableSubPuMvp && slice.getEnableTMVPFlag() ) { -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - int cntIBC = 0; -#endif MergeCtx mrgCtx = *affMrgCtx.mrgCtx; bool tmpLICFlag = false; @@ -3838,14 +3331,8 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx int pos = 0; // Get spatial MV -#if JVET_M0116_ATMVP_LEFT_NB_FOR_OFFSET const Position posCurLB = pu.Y().bottomLeft(); MotionInfo miLeft; -#else - const Position posCurRT = pu.Y().topRight(); - const Position posCurLB = pu.Y().bottomLeft(); - MotionInfo miAbove, miLeft, miAboveRight, miBelowLeft; -#endif //left const PredictionUnit* puLeft = cs.getPURestricted( posCurLB.offset( -1, 0 ), pu, pu.chType ); @@ -3857,12 +3344,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mrgCtx.interDirNeighbours[pos] = miLeft.interDir; // get Mv from Left -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - if (puLeft->cu->ibc) - { - cntIBC++; - } -#endif mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miLeft.mv[0], miLeft.refIdx[0] ); if ( slice.isInterB() ) @@ -3872,108 +3353,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx pos++; } -#if !JVET_M0116_ATMVP_LEFT_NB_FOR_OFFSET - // above - const PredictionUnit *puAbove = cs.getPURestricted( posCurRT.offset( 0, -1 ), pu, pu.chType ); - bool isAvailableB1 = puAbove && isDiffMER( pu, *puAbove ) && pu.cu != puAbove->cu && CU::isInter( *puAbove->cu ); - if ( isAvailableB1 ) - { - miAbove = puAbove->getMotionInfo( posCurRT.offset( 0, -1 ) ); - - if ( !isAvailableA1 || (miAbove != miLeft) ) - { - // get Inter Dir - mrgCtx.interDirNeighbours[pos] = miAbove.interDir; - // get Mv from Left -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - if (puAbove->cu->ibc) - { - cntIBC++; - } -#endif - mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); - - if ( slice.isInterB() ) - { - mrgCtx.mvFieldNeighbours[(pos << 1) + 1].setMvField( miAbove.mv[1], miAbove.refIdx[1] ); - } - - pos++; - } - } - - // above right - const PredictionUnit *puAboveRight = cs.getPURestricted( posCurRT.offset( 1, -1 ), pu, pu.chType ); - bool isAvailableB0 = puAboveRight && isDiffMER( pu, *puAboveRight ) && CU::isInter( *puAboveRight->cu ); - if ( isAvailableB0 ) - { - miAboveRight = puAboveRight->getMotionInfo( posCurRT.offset( 1, -1 ) ); - -#if HM_JEM_MERGE_CANDS - if ( (!isAvailableB1 || (miAbove != miAboveRight)) && (!isAvailableA1 || (miLeft != miAboveRight)) ) -#else - if ( !isAvailableB1 || (miAbove != miAboveRight) ) -#endif - { - // get Inter Dir - mrgCtx.interDirNeighbours[pos] = miAboveRight.interDir; - // get Mv from Left -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - if (puAboveRight->cu->ibc) - { - cntIBC++; - } -#endif - mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); - - if ( slice.isInterB() ) - { - mrgCtx.mvFieldNeighbours[(pos << 1) + 1].setMvField( miAboveRight.mv[1], miAboveRight.refIdx[1] ); - } - - pos++; - } - } - - //left bottom - const PredictionUnit *puLeftBottom = cs.getPURestricted( posCurLB.offset( -1, 1 ), pu, pu.chType ); - bool isAvailableA0 = puLeftBottom && isDiffMER( pu, *puLeftBottom ) && CU::isInter( *puLeftBottom->cu ); - if ( isAvailableA0 ) - { - miBelowLeft = puLeftBottom->getMotionInfo( posCurLB.offset( -1, 1 ) ); - -#if HM_JEM_MERGE_CANDS - if ( (!isAvailableA1 || (miBelowLeft != miLeft)) && (!isAvailableB1 || (miBelowLeft != miAbove)) && (!isAvailableB0 || (miBelowLeft != miAboveRight)) ) -#else - if ( !isAvailableA1 || (miBelowLeft != miLeft) ) -#endif - { - // get Inter Dir - mrgCtx.interDirNeighbours[pos] = miBelowLeft.interDir; - // get Mv from Bottom-Left -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - if (puLeftBottom->cu->ibc) - { - cntIBC++; - } -#endif - mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); - - if ( slice.isInterB() ) - { - mrgCtx.mvFieldNeighbours[(pos << 1) + 1].setMvField( miBelowLeft.mv[1], miBelowLeft.refIdx[1] ); - } - pos++; - } - } -#endif mrgCtx.numValidMergeCand = pos; isAvailableSubPu = getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, pos , 0 -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - , cntIBC -#endif ); if ( isAvailableSubPu ) { @@ -4061,9 +3444,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx const PredictionUnit* puNeigh = cs.getPURestricted( pos, pu, pu.chType ); if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_M0483_IBC==0 - && !puNeigh->cu->ibc -#endif ) { isAvailable[0] = true; @@ -4081,9 +3461,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_M0483_IBC==0 - && !puNeigh->cu->ibc -#endif ) { isAvailable[1] = true; @@ -4101,9 +3478,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_M0483_IBC==0 - && !puNeigh->cu->ibc -#endif ) { isAvailable[2] = true; @@ -4293,21 +3667,14 @@ void PU::setAllAffineMv( PredictionUnit& pu, Mv affLT, Mv affRT, Mv affLB, RefPi mvScaleTmpHor = mvScaleHor + deltaMvHorX * (halfBW + w) + deltaMvVerX * (halfBH + h); mvScaleTmpVer = mvScaleVer + deltaMvHorY * (halfBW + w) + deltaMvVerY * (halfBH + h); roundAffineMv( mvScaleTmpHor, mvScaleTmpVer, shift ); -#if JVET_M0145_AFFINE_MV_CLIP Mv curMv(mvScaleTmpHor, mvScaleTmpVer); curMv.clipToStorageBitDepth(); -#endif for ( int y = (h >> MIN_CU_LOG2); y < ((h + blockHeight) >> MIN_CU_LOG2); y++ ) { for ( int x = (w >> MIN_CU_LOG2); x < ((w + blockWidth) >> MIN_CU_LOG2); x++ ) { -#if JVET_M0145_AFFINE_MV_CLIP mb.at(x, y).mv[eRefList] = curMv; -#else - mb.at(x, y).mv[eRefList].hor = mvScaleTmpHor; - mb.at(x, y).mv[eRefList].ver = mvScaleTmpVer; -#endif } } } @@ -4379,10 +3746,8 @@ static bool deriveScaledMotionTemporal( const Slice& slice, iCurrRefPOC = slice.getRefPic(eCurrRefPicList, 0)->getPOC(); // Scale the vector. cColMv = mi.mv[eColRefPicList]; -#if JVET_M0512_MOTION_BUFFER_COMPRESSION cColMv.setHor(roundMvComp(cColMv.getHor())); cColMv.setVer(roundMvComp(cColMv.getVer())); -#endif //pcMvFieldSP[2*iPartition + eCurrRefPicList].getMv(); // Assume always short-term for now iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); @@ -4415,15 +3780,8 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu) bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, bool& LICFlag, const int count , int mmvdList -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - , const int countIBC -#endif ) { -#if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - if (count == countIBC && pu.cs->slice->getSPS()->getIBCMode()) - return false; -#endif const Slice &slice = *pu.cs->slice; const unsigned scale = 4 * std::max<int>(1, 4 * AMVP_DECIMATION_FACTOR / 4); const unsigned mask = ~(scale - 1); @@ -4486,11 +3844,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b // derivation of center motion parameters from the collocated CU const MotionInfo &mi = pColPic->cs->getMotionInfo(centerPos); -#if JVET_M0483_IBC if (mi.isInter && mi.isIBCmot == false) -#else - if (mi.isInter) -#endif { mrgCtx.interDirNeighbours[count] = 0; @@ -4545,12 +3899,8 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b found = false; mi.isInter = true; mi.sliceIdx = slice.getIndependentSliceIdx(); -#if JVET_M0483_IBC mi.isIBCmot = false; if (colMi.isInter && colMi.isIBCmot == false) -#else - if (colMi.isInter && !((colMi.interDir == 1 || colMi.interDir == 3) && (pColPic->cs->slice->getRefPOC(REF_PIC_LIST_0, colMi.refIdx[0]) == pColPic->cs->slice->getPOC()) && pu.cs->sps->getIBCMode())) -#endif { for (unsigned currRefListId = 0; currRefListId < (bBSlice ? 2 : 1); currRefListId++) { @@ -4597,12 +3947,8 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) { MotionInfo mi; -#if JVET_M0483_IBC mi.isInter = !CU::isIntra(*pu.cu); mi.isIBCmot = CU::isIBC(*pu.cu); -#else - mi.isInter = CU::isInter( *pu.cu ); -#endif mi.sliceIdx = pu.cu->slice->getIndependentSliceIdx(); if( mi.isInter ) @@ -4614,11 +3960,7 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) mi.mv[i] = pu.mv[i]; mi.refIdx[i] = pu.refIdx[i]; } -#if JVET_M0483_IBC if (mi.isIBCmot) -#else - if (pu.interDir == 1 && pu.cu->slice->getRefPOC(REF_PIC_LIST_0, pu.refIdx[0]) == pu.cu->slice->getPOC()) -#endif { mi.bv = pu.bv; } @@ -4632,9 +3974,7 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) { MotionInfo &dest = mb.at( x, y ); dest.isInter = mi.isInter; -#if JVET_M0483_IBC dest.isIBCmot = false; -#endif dest.interDir = mi.interDir; dest.sliceIdx = mi.sliceIdx; for( int i = 0; i < NUM_REF_PIC_LIST_01; i++ ) @@ -4689,24 +4029,16 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP pu.mvd[0].changePrecisionAmvr( pu.cu->imv, MV_PRECISION_QUARTER); unsigned mvp_idx = pu.mvpIdx[0]; AMVPInfo amvpInfo; -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) { PU::fillIBCMvpCand(pu, amvpInfo); } else -#endif PU::fillMvpCand(pu, REF_PIC_LIST_0, pu.refIdx[0], amvpInfo); pu.mvpNum[0] = amvpInfo.numCand; pu.mvpIdx[0] = mvp_idx; pu.mv [0] = amvpInfo.mvCand[mvp_idx] + pu.mvd[0]; pu.mv[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_M0483_IBC==0 - if (pu.interDir == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0])->getPOC() == pu.cs->slice->getPOC()) - { - pu.cu->ibc = true; - } -#endif } if (pu.interDir != 1 /* PRED_L0 */) @@ -4731,9 +4063,6 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP PU::getInterMergeCandidates ( pu, mrgCtx , 0 ); -#if !JVET_M0068_M0171_MMVD_CLEANUP - PU::restrictBiPredMergeCands( pu, mrgCtx ); -#endif mrgCtx.setMergeInfo( pu, pu.mergeIdx ); } @@ -4756,7 +4085,6 @@ bool PU::isBiPredFromDifferentDir( const PredictionUnit& pu ) return false; } -#if JVET_M0147_DMVR bool PU::isBiPredFromDifferentDirEqDistPoc(const PredictionUnit& pu) { if (pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0) @@ -4774,7 +4102,6 @@ bool PU::isBiPredFromDifferentDirEqDistPoc(const PredictionUnit& pu) } return false; } -#endif void PU::restrictBiPredMergeCands( const PredictionUnit &pu, MergeCtx& mergeCtx ) { if( PU::isBipredRestriction( pu ) ) @@ -4791,7 +4118,6 @@ void PU::restrictBiPredMergeCands( const PredictionUnit &pu, MergeCtx& mergeCtx } } -#if JVET_M0068_M0171_MMVD_CLEANUP void PU::restrictBiPredMergeCandsOne(PredictionUnit &pu) { if (PU::isBipredRestriction(pu)) @@ -4805,7 +4131,6 @@ void PU::restrictBiPredMergeCandsOne(PredictionUnit &pu) } } } -#endif void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangleMrgCtx ) { @@ -4836,9 +4161,6 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl //left const PredictionUnit* puLeft = cs.getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType ); const bool isAvailableA1 = puLeft && isDiffMER( pu, *puLeft ) && pu.cu != puLeft->cu && CU::isInter( *puLeft->cu ) -#if JVET_M0483_IBC==0 - && !puLeft->cu->ibc -#endif ; if( isAvailableA1 ) { @@ -4855,9 +4177,6 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // above const PredictionUnit *puAbove = cs.getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType ); bool isAvailableB1 = puAbove && isDiffMER( pu, *puAbove ) && pu.cu != puAbove->cu && CU::isInter( *puAbove->cu ) -#if JVET_M0483_IBC==0 - && !puAbove->cu->ibc -#endif ; if( isAvailableB1 ) { @@ -4878,9 +4197,6 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // above right const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); bool isAvailableB0 = puAboveRight && isDiffMER( pu, *puAboveRight ) && CU::isInter( *puAboveRight->cu ) -#if JVET_M0483_IBC==0 - && !puAboveRight->cu->ibc -#endif ; if( isAvailableB0 ) @@ -4902,9 +4218,6 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl //left bottom const PredictionUnit *puLeftBottom = cs.getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType ); bool isAvailableA0 = puLeftBottom && isDiffMER( pu, *puLeftBottom ) && CU::isInter( *puLeftBottom->cu ) -#if JVET_M0483_IBC==0 - && !puLeftBottom->cu->ibc -#endif ; if( isAvailableA0 ) { @@ -4925,9 +4238,6 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // above left const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); bool isAvailableB2 = puAboveLeft && isDiffMER( pu, *puAboveLeft ) && CU::isInter( *puAboveLeft->cu ) -#if JVET_M0483_IBC==0 - && !puAboveLeft->cu->ibc -#endif ; if( isAvailableB2 ) @@ -4955,9 +4265,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl Position posC0; Position posC1 = pu.Y().center(); bool isAvailableC0 = false; -#if JVET_M0170_MRG_SHARELIST bool isAvailableC1 = (posC1.x < pcv.lumaWidth) && (posC1.y < pcv.lumaHeight); -#endif if (((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight)) { @@ -5020,11 +4328,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // C1 temporalMv.interDir = 0; -#if JVET_M0170_MRG_SHARELIST existMV = isAvailableC1 && getColocatedMVP(pu, REF_PIC_LIST_0, posC1, cColMv, refIdx ); -#else - existMV = getColocatedMVP(pu, REF_PIC_LIST_0, posC1, cColMv, refIdx ); -#endif if( existMV ) { temporalMv.isInter = true; @@ -5032,11 +4336,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl temporalMv.mv[0] = cColMv; temporalMv.refIdx[0] = refIdx; } -#if JVET_M0170_MRG_SHARELIST existMV = isAvailableC1 && getColocatedMVP(pu, REF_PIC_LIST_1, posC1, cColMv, refIdx ); -#else - existMV = getColocatedMVP(pu, REF_PIC_LIST_1, posC1, cColMv, refIdx ); -#endif if( existMV ) { temporalMv.interDir |= 2; @@ -5126,13 +4426,8 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl { aveMv = aveMv.scaleMv( distscale ); // scaling to L0 } -#if JVET_M0265_MV_ROUNDING_CLEANUP aveMv = aveMv + candidate[i].mv[0]; roundAffineMv(aveMv.hor, aveMv.ver, 1); -#else - aveMv.setHor( ( aveMv.getHor() + candidate[i].mv[0].getHor() + 1 ) >> 1 ); - aveMv.setVer( ( aveMv.getVer() + candidate[i].mv[0].getVer() + 1 ) >> 1 ); -#endif triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1; triangleMrgCtx.mrgTypeNeighbours [triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].mv = aveMv; @@ -5193,46 +4488,12 @@ bool PU::isUniqueTriangleCandidates( const PredictionUnit &pu, MergeCtx& triangl return true; } -#if !JVET_M0328_KEEP_ONE_WEIGHT_GROUP -bool PU::getTriangleWeights( const PredictionUnit& pu, MergeCtx &triangleMrgCtx, const uint8_t candIdx0, const uint8_t candIdx1 ) -{ - RefPicList refPicListCand0 = triangleMrgCtx.interDirNeighbours[candIdx0] == 1 ? REF_PIC_LIST_0 : REF_PIC_LIST_1; - RefPicList refPicListCand1 = triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ? REF_PIC_LIST_0 : REF_PIC_LIST_1; - int32_t refPicPoc0 = pu.cs->slice->getRefPOC( refPicListCand0, triangleMrgCtx.mvFieldNeighbours[ (candIdx0 << 1) + refPicListCand0 ].refIdx ); - int32_t refPicPoc1 = pu.cs->slice->getRefPOC( refPicListCand1, triangleMrgCtx.mvFieldNeighbours[ (candIdx1 << 1) + refPicListCand1 ].refIdx ); - - if( refPicPoc0 != refPicPoc1 ) - { - // different reference picture - return true; - } - - // same reference picture, but mv difference is larger than 16 pel - int32_t threshold = 16 << 4; - Mv diffMv = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + refPicListCand0].mv - triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + refPicListCand1].mv; - - if( diffMv.getAbsHor() > threshold || diffMv.getAbsVer() > threshold ) - { - return true; - } - - return false; -} -#endif -#if JVET_M0883_TRIANGLE_SIGNALING void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ) -#else -void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const uint8_t mergeIdx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ) -#endif { -#if JVET_M0883_TRIANGLE_SIGNALING pu.triangleSplitDir = splitDir; pu.triangleMergeIdx0 = candIdx0; pu.triangleMergeIdx1 = candIdx1; -#else - pu.mergeIdx = mergeIdx; -#endif MotionBuf mb = pu.getMotionBuf(); MotionInfo biMv; @@ -5365,11 +4626,9 @@ void CU::resetMVDandMV2Int( CodingUnit& cu, InterPrediction *interPred ) Mv mv = pu.mv[0]; Mv mvPred; AMVPInfo amvpInfo; -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) PU::fillIBCMvpCand(pu, amvpInfo); else -#endif PU::fillMvpCand(pu, REF_PIC_LIST_0, pu.refIdx[0], amvpInfo); pu.mvpNum[0] = amvpInfo.numCand; @@ -5409,9 +4668,6 @@ void CU::resetMVDandMV2Int( CodingUnit& cu, InterPrediction *interPred ) PU::getInterMergeCandidates ( pu, mrgCtx , 0 ); -#if !JVET_M0068_M0171_MMVD_CLEANUP - PU::restrictBiPredMergeCands( pu, mrgCtx ); -#endif mrgCtx.setMergeInfo( pu, pu.mergeIdx ); } @@ -5447,7 +4703,6 @@ bool CU::hasSubCUNonZeroMVd( const CodingUnit& cu ) return bNonZeroMvd; } -#if JVET_M0246_AFFINE_AMVR bool CU::hasSubCUNonZeroAffineMVd( const CodingUnit& cu ) { bool nonZeroAffineMvd = false; @@ -5486,7 +4741,6 @@ bool CU::hasSubCUNonZeroAffineMVd( const CodingUnit& cu ) return nonZeroAffineMvd; } -#endif int CU::getMaxNeighboriMVCandNum( const CodingStructure& cs, const Position& pos ) { @@ -5512,7 +4766,6 @@ int CU::getMaxNeighboriMVCandNum( const CodingStructure& cs, const Position& pos return maxImvNumCand; } -#if JVET_M0140_SBT uint8_t CU::getSbtInfo( uint8_t idx, uint8_t pos ) { return ( pos << 4 ) + ( idx << 0 ); @@ -5625,7 +4878,6 @@ bool CU::isSameSbtSize( const uint8_t sbtInfo1, const uint8_t sbtInfo2 ) else return false; } -#endif bool CU::isGBiIdxCoded( const CodingUnit &cu ) { @@ -5635,12 +4887,10 @@ bool CU::isGBiIdxCoded( const CodingUnit &cu ) return false; } -#if JVET_M0483_IBC if (cu.predMode == MODE_IBC) { return false; } -#endif if( cu.predMode == MODE_INTRA || cu.cs->slice->isInterP() ) { @@ -5656,7 +4906,6 @@ bool CU::isGBiIdxCoded( const CodingUnit &cu ) { if( cu.firstPU->interDir == 3 ) { -#if JVET_M0111_WP_GBI WPScalingParam *wp0; WPScalingParam *wp1; int refIdx0 = cu.firstPU->refIdx[REF_PIC_LIST_0]; @@ -5670,7 +4919,6 @@ bool CU::isGBiIdxCoded( const CodingUnit &cu ) { return false; } -#endif return true; } } @@ -5778,7 +5026,6 @@ void TU::setCbfAtDepth(TransformUnit &tu, const ComponentID &compID, const unsig tu.cbf[compID] |= ((cbf ? 1 : 0) << depth); } -#if JVET_M0464_UNI_MTS bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) { bool tsAllowed = compID == COMPONENT_Y; @@ -5786,15 +5033,11 @@ bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) tsAllowed &= tu.cs->pps->getUseTransformSkip(); tsAllowed &= !tu.cu->transQuantBypass; -#if JVET_M0102_INTRA_SUBPARTITIONS tsAllowed &= ( !tu.cu->ispMode || !isLuma(compID) ); -#endif SizeType transformSkipMaxSize = 1 << maxSize; tsAllowed &= tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize; -#if JVET_M0140_SBT tsAllowed &= !tu.cu->sbtInfo; -#endif return tsAllowed; } @@ -5806,31 +5049,14 @@ bool TU::isMTSAllowed(const TransformUnit &tu, const ComponentID compID) mtsAllowed &= CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS() && CU::isInter( *tu.cu ); mtsAllowed &= ( tu.lwidth() <= maxSize && tu.lheight() <= maxSize ); -#if JVET_M0102_INTRA_SUBPARTITIONS mtsAllowed &= !tu.cu->ispMode; -#endif -#if JVET_M0140_SBT mtsAllowed &= !tu.cu->sbtInfo; -#endif return mtsAllowed; } -#else -bool TU::hasTransformSkipFlag(const CodingStructure& cs, const CompArea& area) -{ - uint32_t transformSkipLog2MaxSize = cs.pps->getPpsRangeExtension().getLog2MaxTransformSkipBlockSize(); - - SizeType transformSkipMaxSize = 1 << transformSkipLog2MaxSize; - return area.width <= transformSkipMaxSize && area.height <= transformSkipMaxSize; -} -#endif uint32_t TU::getGolombRiceStatisticsIndex(const TransformUnit &tu, const ComponentID &compID) { -#if JVET_M0464_UNI_MTS const bool transformSkip = tu.mtsIdx==1; -#else - const bool transformSkip = tu.transformSkip[compID]; -#endif const bool transquantBypass = tu.cu->transQuantBypass; //-------- @@ -5903,13 +5129,8 @@ uint32_t TU::getCoefScanIdx(const TransformUnit &tu, const ComponentID &compID) #endif bool TU::hasCrossCompPredInfo( const TransformUnit &tu, const ComponentID &compID ) { -#if JVET_M0483_IBC return (isChroma(compID) && tu.cs->pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf(tu, COMPONENT_Y) && (!CU::isIntra(*tu.cu) || PU::isChromaIntraModeCrossCheckMode(*tu.cs->getPU(tu.blocks[compID].pos(), toChannelType(compID))))); -#else - return ( isChroma(compID) && tu.cs->pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf( tu, COMPONENT_Y ) && - ( CU::isInter(*tu.cu) || PU::isChromaIntraModeCrossCheckMode( *tu.cs->getPU( tu.blocks[compID].pos(), toChannelType( compID ) ) ) ) ); -#endif } uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma, const bool bChroma ) @@ -5917,11 +5138,7 @@ uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma uint32_t count = 0; for( uint32_t i = 0; i < ::getNumberValidTBlocks( *tu.cs->pcv ); i++ ) { -#if JVET_M0464_UNI_MTS if( tu.blocks[i].valid() && ( isLuma(ComponentID(i)) ? tu.mtsIdx !=1 : true ) && TU::getCbf( tu, ComponentID( i ) ) ) -#else - if( tu.blocks[i].valid() && !tu.transformSkip[i] && TU::getCbf( tu, ComponentID( i ) ) ) -#endif { if( isLuma ( tu.blocks[i].compID ) && !bLuma ) continue; if( isChroma( tu.blocks[i].compID ) && !bChroma ) continue; @@ -5937,38 +5154,20 @@ uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma return count; } -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID ) { const Size &size=tu.blocks[compID]; -#if JVET_M0464_UNI_MTS const bool isTransformSkip = tu.mtsIdx==1 && isLuma(compID); -#else - const bool isTransformSkip = tu.transformSkip[compID]; -#endif return (!isTransformSkip) && (((g_aucLog2[size.width] + g_aucLog2[size.height]) & 1) == 1); } -#else -bool TU::needsSqrt2Scale( const Size& size ) -{ - return (((g_aucLog2[size.width] + g_aucLog2[size.height]) & 1) == 1); -} -#endif #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT bool TU::needsBlockSizeTrafoScale( const TransformUnit &tu, const ComponentID &compID ) { return needsSqrt2Scale( tu, compID ) || isNonLog2BlockSize( tu.blocks[compID] ); } #else -bool TU::needsBlockSizeTrafoScale( const Size& size ) -{ - return needsSqrt2Scale( size ) || isNonLog2BlockSize( size ); -} -#endif -#else bool TU::needsQP3Offset(const TransformUnit &tu, const ComponentID &compID) { if( !tu.transformSkip[compID] ) @@ -5980,7 +5179,6 @@ bool TU::needsQP3Offset(const TransformUnit &tu, const ComponentID &compID) #endif -#if JVET_M0102_INTRA_SUBPARTITIONS TransformUnit* TU::getPrevTU( const TransformUnit &tu, const ComponentID compID ) { TransformUnit* prevTU = tu.prev; @@ -6030,7 +5228,6 @@ void TU::getTransformTypeISP( const TransformUnit &tu, const ComponentID compID, typeH = tuArea.width <= 2 || tuArea.width >= 32 ? DCT2 : typeH; typeV = tuArea.height <= 2 || tuArea.height >= 32 ? DCT2 : typeV; } -#endif // other tools diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 682bbed54e726266ab9cb192c57b0a668f3fb689..344bac8fb20b2b0d64a461b0c6841c002166143d 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -49,9 +49,7 @@ namespace CS uint64_t getEstBits ( const CodingStructure &cs ); UnitArea getArea ( const CodingStructure &cs, const UnitArea &area, const ChannelType chType ); bool isDualITree ( const CodingStructure &cs ); -#if JVET_M0147_DMVR void setRefinedMotionField(CodingStructure &cs); -#endif } @@ -60,9 +58,7 @@ namespace CU { bool isIntra (const CodingUnit &cu); bool isInter (const CodingUnit &cu); -#if JVET_M0483_IBC bool isIBC (const CodingUnit &cu); -#endif bool isRDPCMEnabled (const CodingUnit &cu); bool isLosslessCoded (const CodingUnit &cu); uint32_t getIntraSizeIdx (const CodingUnit &cu); @@ -77,9 +73,6 @@ namespace CU uint32_t getCtuAddr (const CodingUnit &cu); int predictQP (const CodingUnit& cu, const int prevQP ); -#if !JVET_M0113_M0188_QG_SIZE - bool isQGStart (const CodingUnit& cu, Partitioner& partitioner ); // check if start of a Quantization Group -#endif uint32_t getNumPUs (const CodingUnit& cu); void addPUs ( CodingUnit& cu); @@ -94,7 +87,6 @@ namespace CU void setGbiIdx (CodingUnit& cu, uint8_t uh); uint8_t deriveGbiIdx (uint8_t gbiLO, uint8_t gbiL1); -#if JVET_M0102_INTRA_SUBPARTITIONS bool divideTuInRows ( const CodingUnit &cu ); bool firstTestISPHorSplit ( const int width, const int height, const ComponentID compID, const CodingUnit *cuLeft = nullptr, const CodingUnit *cuAbove = nullptr ); PartSplit getISPType ( const CodingUnit &cu, const ComponentID compID ); @@ -103,7 +95,6 @@ namespace CU ISPType canUseISPSplit ( const CodingUnit &cu, const ComponentID compID ); ISPType canUseISPSplit ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY ); uint32_t getISPSplitDim ( const int width, const int height, const PartSplit ispType ); -#endif PUTraverser traversePUs ( CodingUnit& cu); TUTraverser traverseTUs ( CodingUnit& cu); @@ -111,13 +102,10 @@ namespace CU cTUTraverser traverseTUs (const CodingUnit& cu); bool hasSubCUNonZeroMVd (const CodingUnit& cu); -#if JVET_M0246_AFFINE_AMVR bool hasSubCUNonZeroAffineMVd ( const CodingUnit& cu ); -#endif int getMaxNeighboriMVCandNum (const CodingStructure& cs, const Position& pos); void resetMVDandMV2Int ( CodingUnit& cu, InterPrediction *interPred ); -#if JVET_M0140_SBT uint8_t getSbtInfo (uint8_t idx, uint8_t pos); uint8_t getSbtIdx (const uint8_t sbtInfo); uint8_t getSbtPos (const uint8_t sbtInfo); @@ -129,7 +117,6 @@ namespace CU bool isMtsMode (const uint8_t sbtInfo); bool isSbtMode (const uint8_t sbtInfo); bool isSameSbtSize (const uint8_t sbtInfo1, const uint8_t sbtInfo2); -#endif } // PU tools namespace PU @@ -141,18 +128,14 @@ namespace PU void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, int mmvdList, const int& mrgCandIdx = -1 ); -#if JVET_M0483_IBC void getIBCMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1); -#endif void getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1); int getDistScaleFactor(const int &currPOC, const int &currRefPOC, const int &colPOC, const int &colRefPOC); bool isDiffMER (const PredictionUnit &pu, const PredictionUnit &pu2); bool getColocatedMVP (const PredictionUnit &pu, const RefPicList &eRefPicList, const Position &pos, Mv& rcMv, const int &refIdx); void fillMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AMVPInfo &amvpInfo ); -#if JVET_M0483_IBC void fillIBCMvpCand (PredictionUnit &pu, AMVPInfo &amvpInfo); bool addIBCMVPCand (const PredictionUnit &pu, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo); -#endif void fillAffineMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AffineAMVPInfo &affiAMVPInfo); bool addMVPCandUnscaled (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo); bool addMVPCandWithScaling (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo); @@ -160,21 +143,11 @@ namespace PU bool xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const MergeCtx mergeCandList, bool hasPruned[MRG_MAX_NUM_CANDS]); #if JVET_L0090_PAIR_AVG bool addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos -#if JVET_M0483_IBC==0 - , int mmvdList -#endif -#if JVET_M0483_IBC , bool ibcFlag -#endif -#if JVET_M0170_MRG_SHARELIST , bool isShared -#endif ); #else bool addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCandInter[MRG_MAX_NUM_CANDS], bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos -#if JVET_M0483_IBC==0 - , int mmvdList -#endif ); #endif void addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicList2nd, const int currRefPOC, AMVPInfo &info, uint8_t imv); @@ -190,21 +163,12 @@ namespace PU ); bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count , int mmvdList -#if !JVET_M0409_ATMVP_FIX -#if JVET_M0483_IBC==0 - , const int countIBC -#endif -#endif ); bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count); bool isBiPredFromDifferentDir (const PredictionUnit &pu); -#if JVET_M0147_DMVR bool isBiPredFromDifferentDirEqDistPoc(const PredictionUnit &pu); -#endif void restrictBiPredMergeCands (const PredictionUnit &pu, MergeCtx& mrgCtx); -#if JVET_M0068_M0171_MMVD_CLEANUP void restrictBiPredMergeCandsOne (PredictionUnit &pu); -#endif bool isLMCMode ( unsigned mode); bool isLMCModeEnabled (const PredictionUnit &pu, unsigned mode); @@ -213,21 +177,12 @@ namespace PU int getNarrowShape (const int width, const int height); void getTriangleMergeCandidates (const PredictionUnit &pu, MergeCtx &triangleMrgCtx); bool isUniqueTriangleCandidates (const PredictionUnit &pu, MergeCtx &triangleMrgCtx); -#if !JVET_M0328_KEEP_ONE_WEIGHT_GROUP - bool getTriangleWeights (const PredictionUnit &pu, MergeCtx &triangleMrgCtx, const uint8_t candIdx0, const uint8_t candIdx1); -#endif -#if JVET_M0883_TRIANGLE_SIGNALING void spanTriangleMotionInfo ( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1); -#else - void spanTriangleMotionInfo ( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const uint8_t mergeIdx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1); -#endif int32_t mappingRefPic (const PredictionUnit &pu, int32_t refPicPoc, bool targetRefPicList); void getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred); bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); bool isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xStartInCU, int yStartInCU, int xBv, int yBv, int ctuSize); -#if JVET_M0147_DMVR bool checkDMVRCondition(const PredictionUnit& pu); -#endif } // TU tools @@ -238,12 +193,8 @@ namespace TU bool getCbf (const TransformUnit &tu, const ComponentID &compID); bool getCbfAtDepth (const TransformUnit &tu, const ComponentID &compID, const unsigned &depth); void setCbfAtDepth ( TransformUnit &tu, const ComponentID &compID, const unsigned &depth, const bool &cbf); -#if JVET_M0464_UNI_MTS bool isTSAllowed (const TransformUnit &tu, const ComponentID compID); bool isMTSAllowed (const TransformUnit &tu, const ComponentID compID); -#else - bool hasTransformSkipFlag (const CodingStructure& cs, const CompArea& area); -#endif uint32_t getGolombRiceStatisticsIndex (const TransformUnit &tu, const ComponentID &compID); #if HEVC_USE_MDCS uint32_t getCoefScanIdx (const TransformUnit &tu, const ComponentID &compID); @@ -251,25 +202,15 @@ namespace TU bool hasCrossCompPredInfo (const TransformUnit &tu, const ComponentID &compID); -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT bool needsSqrt2Scale ( const TransformUnit &tu, const ComponentID &compID ); -#else - bool needsSqrt2Scale ( const Size& size ); -#endif #if HM_QTBT_AS_IN_JEM_QUANT -#if JVET_M0119_NO_TRANSFORM_SKIP_QUANTISATION_ADJUSTMENT bool needsBlockSizeTrafoScale ( const TransformUnit &tu, const ComponentID &compID ); -#else - bool needsBlockSizeTrafoScale ( const Size& size ); -#endif #else bool needsQP3Offset (const TransformUnit &tu, const ComponentID &compID); #endif -#if JVET_M0102_INTRA_SUBPARTITIONS TransformUnit* getPrevTU ( const TransformUnit &tu, const ComponentID compID ); bool getPrevTuCbfAtDepth( const TransformUnit &tu, const ComponentID compID, const int trDepth ); void getTransformTypeISP( const TransformUnit &tu, const ComponentID compID, int &typeH, int &typeV ); -#endif } uint32_t getCtuAddr (const Position& pos, const PreCalcValues &pcv); diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index a0557fd30d6555b0a340149d039fb68cab62572f..c78720917af4ffb15c340e446a649ac0c5d881a7 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -273,11 +273,7 @@ void CDTrace::dtrace_polygon_vector(int k, int poc, const std::vector<Position> void retrieveTriangularMvInfo(const PredictionUnit& pu, MotionInfo& mi0, MotionInfo& mi1) { -#if JVET_M0883_TRIANGLE_SIGNALING int triangleDir = pu.triangleSplitDir; -#else - int triangleDir = g_triangleCombination[pu.mergeIdx][0]; -#endif CMotionBuf mb = pu.getMotionBuf(); bool foundMv[2] = { false, false }; bool foundBi = false; @@ -329,11 +325,7 @@ void retrieveTriangularMvInfo(const PredictionUnit& pu, MotionInfo& mi0, MotionI } void retrieveTrianglePolygon(const PredictionUnit& pu, std::vector<Position>& triangle0, std::vector<Position>& triangle1, Position& S, Position& E) { -#if JVET_M0883_TRIANGLE_SIGNALING TriangleSplit triangleDir = TriangleSplit(pu.triangleSplitDir); -#else - TriangleSplit triangleDir = TriangleSplit(g_triangleCombination[pu.mergeIdx][0]); -#endif Position TL = pu.Y().topLeft(); Position TR = pu.Y().topRight(); TR = TR.offset(1, 0); Position BL = pu.Y().bottomLeft(); BL = BL.offset(0, 1); @@ -445,12 +437,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::SkipFlag), cu.skip); } -#if !JVET_M0464_UNI_MTS - if (!(!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::EMTFlag), cu.emtFlag); - } -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::MMVDSkipFlag), cu.mmvdSkip); } else if( chType == CHANNEL_TYPE_CHROMA ) @@ -468,12 +454,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::TransQuantBypassFlag_Chroma), cu.transQuantBypass); } -#if !JVET_M0464_UNI_MTS - if (!(!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) - { - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::EMTFlag_Chroma), cu.emtFlag); - } -#endif } @@ -680,11 +660,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::RootCbf), cu.rootCbf); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::GBIIndex), cu.GBiIdx); -#if !JVET_M0483_IBC - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IBCFlag), cu.ibc); -#else DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IBCFlag), cu.predMode == MODE_IBC); -#endif } break; case MODE_INTRA: @@ -736,20 +712,12 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) if (tu.Y().valid()) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Y), tu.cbf[COMPONENT_Y]); -#if JVET_M0464_UNI_MTS DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::MTSIdx), tu.mtsIdx); -#else - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Y), tu.transformSkip[COMPONENT_Y]); -#endif } if (!(cu.chromaFormat == CHROMA_400 || (CS::isDualITree(*cu.cs) && cu.chType == CHANNEL_TYPE_LUMA))) { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cr), tu.cbf[COMPONENT_Cr]); -#if !JVET_M0464_UNI_MTS - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Cb), tu.transformSkip[COMPONENT_Cb]); - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Cr), tu.transformSkip[COMPONENT_Cr]); -#endif } } } @@ -1027,45 +995,15 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) if (tu.Y().valid()) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Y), tu.cbf[COMPONENT_Y]); -#if JVET_M0464_UNI_MTS DTRACE_BLOCK_SCALAR( g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName( BlockStatistic::MTSIdx ), tu.mtsIdx ); -#else - if (!(!tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag(*tu.cs, tu.blocks[COMPONENT_Y]) || (isLuma(COMPONENT_Y) && tu.cu->emtFlag))) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Y), tu.transformSkip[COMPONENT_Y]); - } -#endif } if (!(cu.chromaFormat == CHROMA_400 || (CS::isDualITree(*cu.cs) && cu.chType == CHANNEL_TYPE_LUMA))) { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cr), tu.cbf[COMPONENT_Cr]); -#if !JVET_M0464_UNI_MTS - if (!(!tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag(*tu.cs, tu.blocks[COMPONENT_Cb]) || (isLuma(COMPONENT_Cb) && tu.cu->emtFlag))) - { - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Cb), tu.transformSkip[COMPONENT_Cb]); - } - if (!(!tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag(*tu.cs, tu.blocks[COMPONENT_Cr]) || (isLuma(COMPONENT_Cr) && tu.cu->emtFlag))) - { - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Cr), tu.transformSkip[COMPONENT_Cr]); - } -#endif } } } -#if !JVET_M0464_UNI_MTS - if (!(!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) - { - if( isLuma( ChannelType( chType ) ) ) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::EMTFlag), cu.emtFlag); - } - else - { - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::EMTFlag_Chroma), cu.emtFlag); - } - } -#endif } } } diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index 72241ce8ae4f56ea5b04dbcd5d4be5cfd8e7c0bd..56b5adec63f37049fcc7bf518083f0b0c2e40fbf 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -64,14 +64,7 @@ enum class BlockStatistic { QP, SplitSeries, TransQuantBypassFlag, -#if JVET_M0464_UNI_MTS MTSIdx, -#else - EMTFlag, - TransformSkipFlag_Y, - TransformSkipFlag_Cb, - TransformSkipFlag_Cr, -#endif // intra IPCM, @@ -123,9 +116,6 @@ enum class BlockStatistic { QP_Chroma, SplitSeries_Chroma, TransQuantBypassFlag_Chroma, -#if !JVET_M0464_UNI_MTS - EMTFlag_Chroma, // this is called flag, though the type is UChar ?! -#endif // intra IPCM_Chroma, @@ -156,13 +146,7 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::Luma_IntraMode, std::tuple<std::string, BlockStatisticType, std::string>{"Luma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::Chroma_IntraMode, std::tuple<std::string, BlockStatisticType, std::string>{"Chroma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::SkipFlag, std::tuple<std::string, BlockStatisticType, std::string>{"SkipFlag", BlockStatisticType::Flag, ""}}, -#if JVET_M0464_UNI_MTS { BlockStatistic::MTSIdx, std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Y", BlockStatisticType::Integer, ""}}, -#else - { BlockStatistic::TransformSkipFlag_Y, std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Y", BlockStatisticType::Flag, ""}}, - { BlockStatistic::TransformSkipFlag_Cb, std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Cb", BlockStatisticType::Flag, ""}}, - { BlockStatistic::TransformSkipFlag_Cr, std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Cr", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::Depth, std::tuple<std::string, BlockStatisticType, std::string>{"Depth", BlockStatisticType::Integer, "[0, 7]"}}, { BlockStatistic::QT_Depth, std::tuple<std::string, BlockStatisticType, std::string>{"QT_Depth", BlockStatisticType::Integer, "[0, 7]"}}, { BlockStatistic::BT_Depth, std::tuple<std::string, BlockStatisticType, std::string>{"BT_Depth", BlockStatisticType::Integer, "[0, 7]"}}, @@ -189,9 +173,6 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::AffineMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"AffineMVL0", BlockStatisticType::AffineTFVectors, "Scale: 4"}}, { BlockStatistic::AffineMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"AffineMVL1", BlockStatisticType::AffineTFVectors, "Scale: 4"}}, { BlockStatistic::AffineType, std::tuple<std::string, BlockStatisticType, std::string>{"AffineType", BlockStatisticType::Flag, ""} }, -#if !JVET_M0464_UNI_MTS - { BlockStatistic::EMTFlag, std::tuple<std::string, BlockStatisticType, std::string>{"EMTFlag", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::MotionBufL0, std::tuple<std::string, BlockStatisticType, std::string>{"MotionBufL0", BlockStatisticType::Vector, "Scale: 16"}}, { BlockStatistic::MotionBufL1, std::tuple<std::string, BlockStatisticType, std::string>{"MotionBufL1", BlockStatisticType::Vector, "Scale: 16"}}, { BlockStatistic::MultiRefIdx, std::tuple<std::string, BlockStatisticType, std::string>{"MultiRefIdx", BlockStatisticType::Integer, "[0, 1]"}}, @@ -214,9 +195,6 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::QP_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"QP_Chroma", BlockStatisticType::Integer, "[0, 51]"}}, { BlockStatistic::SplitSeries_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"SplitSeries_Chroma", BlockStatisticType::Integer, "[0, " + std::to_string(std::numeric_limits<SplitSeries>::max()) + "]"}}, { BlockStatistic::TransQuantBypassFlag_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"TransQuantBypassFlag_Chroma", BlockStatisticType::Flag, ""}}, -#if !JVET_M0464_UNI_MTS - { BlockStatistic::EMTFlag_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"EMTFlag_Chroma", BlockStatisticType::Integer, "[0, 10]"}}, // todo: actual limits? -#endif { BlockStatistic::IPCM_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"IPCM_Chroma", BlockStatisticType::Flag, ""}}, }; diff --git a/source/Lib/CommonLib/dtrace_next.h b/source/Lib/CommonLib/dtrace_next.h index 23e7ef98e15808b98b6ef11b03b101b055da8ce0..95681319b4d76c2b1a02236fd4dd41ec1b905d4b 100644 --- a/source/Lib/CommonLib/dtrace_next.h +++ b/source/Lib/CommonLib/dtrace_next.h @@ -130,7 +130,6 @@ enum DTRACE_CHANNEL D_QP, // final CU QP at reading/writing stage D_QP_PER_CTU, // final QP per CTU at reading D_MISC, // Miscellaneous - D_DECISIONTREE, // decision tree tracing D_TU_ABS_SUM, D_EST_FRAC_BITS, D_INTRA_COST, //intra cost @@ -232,7 +231,6 @@ inline CDTrace* tracing_init( std::string& sTracingFile, std::string& sTracingRu _CNL_DEF( D_QP ), _CNL_DEF( D_QP_PER_CTU ), _CNL_DEF( D_MISC ), - _CNL_DEF( D_DECISIONTREE ), _CNL_DEF( D_TU_ABS_SUM ), _CNL_DEF( D_EST_FRAC_BITS ), _CNL_DEF( D_INTRA_COST ), diff --git a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h index b4bc2622cd55fff1ee2aa12972184eaacdf092ca..ef368d78f93a25eeccfa57e0481415fda4b588f8 100644 --- a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h +++ b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h @@ -317,11 +317,7 @@ static void simdDeriveClassificationBlk( AlfClassifier** classifier, int** lapla } template<X86_VEXT vext> -#if JVET_M0277_FIX_PCM_DISABLEFILTER static void simdFilter5x5Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ) -#else -static void simdFilter5x5Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng ) -#endif { static const unsigned char mask05[16] = { 8, 9, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const unsigned char mask03[16] = { 4, 5, 2, 3, 0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; @@ -329,12 +325,10 @@ static void simdFilter5x5Blk( AlfClassifier** classifier, const PelUnitBuf &recD const bool bChroma = isChroma( compId ); -#if JVET_M0277_FIX_PCM_DISABLEFILTER const SPS* sps = cs.slice->getSPS(); bool isDualTree = CS::isDualITree(cs); bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); ChromaFormat nChromaFormat = sps->getChromaFormatIdc(); -#endif const CPelBuf srcLuma = recSrc.get( compId ); PelBuf dstLuma = recDst.get( compId ); @@ -412,16 +406,13 @@ static void simdFilter5x5Blk( AlfClassifier** classifier, const PelUnitBuf &recD { AlfClassifier& cl = pClass[j]; transposeIdx = cl.transposeIdx; -#if JVET_M0277_FIX_PCM_DISABLEFILTER if( isPCMFilterDisabled && cl.classIdx == AdaptiveLoopFilter::m_ALF_UNUSED_CLASSIDX && transposeIdx == AdaptiveLoopFilter::m_ALF_UNUSED_TRANSPOSIDX ) { pRec += 4; continue; } -#endif coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; } -#if JVET_M0277_FIX_PCM_DISABLEFILTER else if ( isPCMFilterDisabled ) { int blkX, blkY; @@ -456,7 +447,6 @@ static void simdFilter5x5Blk( AlfClassifier** classifier, const PelUnitBuf &recD continue; } } -#endif __m128i c0, t0 = _mm_setzero_si128(); @@ -610,11 +600,7 @@ static void simdFilter5x5Blk( AlfClassifier** classifier, const PelUnitBuf &recD } template<X86_VEXT vext> -#if JVET_M0277_FIX_PCM_DISABLEFILTER static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ) -#else -static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng ) -#endif { static const unsigned char mask0[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 7, 4, 5, 2, 3 }; static const unsigned char mask00[16] = { 2, 3, 0, 1, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, 1 }; @@ -629,12 +615,10 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD { CHECK( 0, "Chroma doesn't support 7x7" ); } -#if JVET_M0277_FIX_PCM_DISABLEFILTER const SPS* sps = cs.slice->getSPS(); bool isDualTree = CS::isDualITree(cs); bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); ChromaFormat nChromaFormat = sps->getChromaFormatIdc(); -#endif const CPelBuf srcLuma = recSrc.get( compId ); PelBuf dstLuma = recDst.get( compId ); @@ -713,16 +697,13 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD { AlfClassifier& cl = pClass[j]; transposeIdx = cl.transposeIdx; -#if JVET_M0277_FIX_PCM_DISABLEFILTER if ( isPCMFilterDisabled && cl.classIdx == AdaptiveLoopFilter::m_ALF_UNUSED_CLASSIDX && transposeIdx == AdaptiveLoopFilter::m_ALF_UNUSED_TRANSPOSIDX ) { pRec += 4; continue; } -#endif coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; } -#if JVET_M0277_FIX_PCM_DISABLEFILTER else if ( isPCMFilterDisabled ) { int blkX, blkY; @@ -757,7 +738,6 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD continue; } } -#endif __m128i c0, c2, t1, t2; diff --git a/source/Lib/CommonLib/x86/BufferX86.h b/source/Lib/CommonLib/x86/BufferX86.h index 0f10ff83cf6fd5ab2a39fb5b5109af51d1575a8b..00399014c56ec3d9e68b860ab55618e549f06238 100644 --- a/source/Lib/CommonLib/x86/BufferX86.h +++ b/source/Lib/CommonLib/x86/BufferX86.h @@ -128,7 +128,6 @@ void addAvg_SSE( const int16_t* src0, int src0Stride, const int16_t* src1, int s } } -#if JVET_M0147_DMVR template<X86_VEXT vext> void copyBufferSimd(Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height) { @@ -246,7 +245,6 @@ void paddingSimd(Pel *dst, int stride, int width, int height, int padSize) } } -#endif template< X86_VEXT vext > void addBIOAvg4_SSE(const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng) { @@ -281,11 +279,7 @@ void addBIOAvg4_SSE(const Pel* src0, int src0Stride, const Pel* src1, int src1St } template< X86_VEXT vext > -#if JVET_M0063_BDOF_FIX void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth) -#else -void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY) -#endif { __m128i vzero = _mm_setzero_si128(); Pel* srcTmp = src + srcStride + 1; @@ -294,9 +288,7 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri int widthInside = width - 2 * BIO_EXTEND_SIZE; int heightInside = height - 2 * BIO_EXTEND_SIZE; -#if JVET_M0063_BDOF_FIX int shift1 = std::max<int>(2, (14 - bitDepth)); -#endif assert((widthInside & 3) == 0); @@ -311,13 +303,8 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri __m128i mmPixLeft = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(srcTmp + x - 1))); __m128i mmPixRight = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(srcTmp + x + 1))); -#if JVET_M0063_BDOF_FIX __m128i mmGradVer = _mm_sra_epi32(_mm_sub_epi32(mmPixBottom, mmPixTop), _mm_cvtsi32_si128(shift1)); __m128i mmGradHor = _mm_sra_epi32(_mm_sub_epi32(mmPixRight, mmPixLeft), _mm_cvtsi32_si128(shift1)); -#else - __m128i mmGradVer = _mm_srai_epi32(_mm_sub_epi32(mmPixBottom, mmPixTop), 4); - __m128i mmGradHor = _mm_srai_epi32(_mm_sub_epi32(mmPixRight, mmPixLeft), 4); -#endif mmGradVer = _mm_packs_epi32(mmGradVer, vzero); mmGradHor = _mm_packs_epi32(mmGradHor, vzero); @@ -352,41 +339,25 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri } template< X86_VEXT vext > -#if JVET_M0063_BDOF_FIX void calcBIOPar_SSE(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, const int bitDepth) -#else -void calcBIOPar_SSE(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG) -#endif { -#if JVET_M0063_BDOF_FIX int shift4 = std::min<int>(8, (bitDepth - 4)); int shift5 = std::min<int>(5, (bitDepth - 7)); -#endif for (int y = 0; y < heightG; y++) { int x = 0; for (; x < ((widthG >> 3) << 3); x += 8) { -#if JVET_M0063_BDOF_FIX __m128i mmSrcY0Temp = _mm_sra_epi16(_mm_loadu_si128((__m128i*)(srcY0Temp + x)), _mm_cvtsi32_si128(shift4)); __m128i mmSrcY1Temp = _mm_sra_epi16(_mm_loadu_si128((__m128i*)(srcY1Temp + x)), _mm_cvtsi32_si128(shift4)); -#else - __m128i mmSrcY0Temp = _mm_srai_epi16(_mm_loadu_si128((__m128i*)(srcY0Temp + x)), 6); - __m128i mmSrcY1Temp = _mm_srai_epi16(_mm_loadu_si128((__m128i*)(srcY1Temp + x)), 6); -#endif __m128i mmGradX0 = _mm_loadu_si128((__m128i*)(gradX0 + x)); __m128i mmGradX1 = _mm_loadu_si128((__m128i*)(gradX1 + x)); __m128i mmGradY0 = _mm_loadu_si128((__m128i*)(gradY0 + x)); __m128i mmGradY1 = _mm_loadu_si128((__m128i*)(gradY1 + x)); __m128i mmTemp1 = _mm_sub_epi16(mmSrcY1Temp, mmSrcY0Temp); -#if JVET_M0063_BDOF_FIX __m128i mmTempX = _mm_sra_epi16(_mm_add_epi16(mmGradX0, mmGradX1), _mm_cvtsi32_si128(shift5)); __m128i mmTempY = _mm_sra_epi16(_mm_add_epi16(mmGradY0, mmGradY1), _mm_cvtsi32_si128(shift5)); -#else - __m128i mmTempX = _mm_srai_epi16(_mm_add_epi16(mmGradX0, mmGradX1), 3); - __m128i mmTempY = _mm_srai_epi16(_mm_add_epi16(mmGradY0, mmGradY1), 3); -#endif // m_piDotProductTemp1 __m128i mm_b = _mm_mulhi_epi16(mmTempX, mmTempX); @@ -441,26 +412,16 @@ void calcBIOPar_SSE(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX for (; x < ((widthG >> 2) << 2); x += 4) { -#if JVET_M0063_BDOF_FIX __m128i mmSrcY0Temp = _mm_sra_epi16(_mm_loadl_epi64((__m128i*)(srcY0Temp + x)), _mm_cvtsi32_si128(shift4)); __m128i mmSrcY1Temp = _mm_sra_epi16(_mm_loadl_epi64((__m128i*)(srcY1Temp + x)), _mm_cvtsi32_si128(shift4)); -#else - __m128i mmSrcY0Temp = _mm_srai_epi16(_mm_loadl_epi64((__m128i*)(srcY0Temp + x)), 6); - __m128i mmSrcY1Temp = _mm_srai_epi16(_mm_loadl_epi64((__m128i*)(srcY1Temp + x)), 6); -#endif __m128i mmGradX0 = _mm_loadl_epi64((__m128i*)(gradX0 + x)); __m128i mmGradX1 = _mm_loadl_epi64((__m128i*)(gradX1 + x)); __m128i mmGradY0 = _mm_loadl_epi64((__m128i*)(gradY0 + x)); __m128i mmGradY1 = _mm_loadl_epi64((__m128i*)(gradY1 + x)); __m128i mmTemp1 = _mm_sub_epi16(mmSrcY1Temp, mmSrcY0Temp); -#if JVET_M0063_BDOF_FIX __m128i mmTempX = _mm_sra_epi16(_mm_add_epi16(mmGradX0, mmGradX1), _mm_cvtsi32_si128(shift5)); __m128i mmTempY = _mm_sra_epi16(_mm_add_epi16(mmGradY0, mmGradY1), _mm_cvtsi32_si128(shift5)); -#else - __m128i mmTempX = _mm_srai_epi16(_mm_add_epi16(mmGradX0, mmGradX1), 3); - __m128i mmTempY = _mm_srai_epi16(_mm_add_epi16(mmGradY0, mmGradY1), 3); -#endif // m_piDotProductTemp1 __m128i mm_b = _mm_mulhi_epi16(mmTempX, mmTempX); @@ -500,15 +461,9 @@ void calcBIOPar_SSE(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX for (; x < widthG; x++) { -#if JVET_M0063_BDOF_FIX int temp = (srcY0Temp[x] >> shift4) - (srcY1Temp[x] >> shift4); int tempX = (gradX0[x] + gradX1[x]) >> shift5; int tempY = (gradY0[x] + gradY1[x]) >> shift5; -#else - int temp = (srcY0Temp[x] >> 6) - (srcY1Temp[x] >> 6); - int tempX = (gradX0[x] + gradX1[x]) >> 3; - int tempY = (gradY0[x] + gradY1[x]) >> 3; -#endif dotProductTemp1[x] = tempX * tempX; dotProductTemp2[x] = tempX * tempY; dotProductTemp3[x] = -tempX * temp; @@ -967,10 +922,8 @@ void PelBufferOps::_initPelBufOpsX86() calcBIOPar = calcBIOPar_SSE<vext>; calcBlkGradient = calcBlkGradient_SSE<vext>; -#if JVET_M0147_DMVR copyBuffer = copyBufferSimd<vext>; padding = paddingSimd<vext>; -#endif reco8 = reco_SSE<vext, 8>; reco4 = reco_SSE<vext, 4>; diff --git a/source/Lib/CommonLib/x86/InterpolationFilterX86.h b/source/Lib/CommonLib/x86/InterpolationFilterX86.h index 72e2a08f68930c584423aa17251c8ed3b5f14843..59c455d30fc0a5d7a74e7a3c80226ec10056965d 100644 --- a/source/Lib/CommonLib/x86/InterpolationFilterX86.h +++ b/source/Lib/CommonLib/x86/InterpolationFilterX86.h @@ -193,11 +193,7 @@ static void fullPelCopyAVX2( const ClpRng& clpRng, const void*_src, int srcStrid template<X86_VEXT vext, bool isFirst, bool isLast> -#if JVET_M0147_DMVR static void simdFilterCopy( const ClpRng& clpRng, const Pel* src, int srcStride, int16_t* dst, int dstStride, int width, int height, bool biMCForDMVR) -#else -static void simdFilterCopy( const ClpRng& clpRng, const Pel* src, int srcStride, int16_t* dst, int dstStride, int width, int height ) -#endif { #if !HM_JEM_CLIP_PEL if( vext >= AVX2 && ( width % 16 ) == 0 ) @@ -215,11 +211,7 @@ static void simdFilterCopy( const ClpRng& clpRng, const Pel* src, int srcStride, else #endif { //Scalar -#if JVET_M0147_DMVR InterpolationFilter::filterCopy<isFirst, isLast>( clpRng, src, srcStride, dst, dstStride, width, height, biMCForDMVR); -#else - InterpolationFilter::filterCopy<isFirst, isLast>( clpRng, src, srcStride, dst, dstStride, width, height ); -#endif } } @@ -987,7 +979,6 @@ static void simdInterpolateN2_M4( const int16_t* src, int srcStride, int16_t *ds dst += dstStride; } } -#if JVET_M0147_DMVR #ifdef USE_AVX2 static inline __m256i simdInterpolateLuma10Bit2P16(int16_t const *src1, int srcStride, __m256i *mmCoeff, const __m256i & mmOffset, __m128i &mmShift) { @@ -1075,14 +1066,9 @@ static void simdInterpolateN2_10BIT_M4(const int16_t* src, int srcStride, int16_ dst += dstStride; } } -#endif template<X86_VEXT vext, int N, bool isVertical, bool isFirst, bool isLast> -#if JVET_M0147_DMVR static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR) -#else -static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff ) -#endif { int row, col; @@ -1128,7 +1114,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel offset = ( isFirst ) ? -IF_INTERNAL_OFFS << shift : 0; } -#if JVET_M0147_DMVR if (biMCForDMVR) { if( isFirst ) @@ -1142,7 +1127,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel offset = 1 << (shift - 1); } } -#endif if( clpRng.bd <= 10 ) { if( N == 8 && !( width & 0x07 ) ) @@ -1191,7 +1175,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel simdInterpolateVerM4<vext, 4, isLast>( src, srcStride, dst, dstStride, width, height, shift, offset, clpRng, c ); return; } -#if JVET_M0147_DMVR else if (biMCForDMVR) { if (N == 2 && !(width & 0x03)) @@ -1200,7 +1183,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel return; } } -#endif else if( N == 2 && !( width & 0x07 ) ) { simdInterpolateN2_M8<vext, isLast>( src, srcStride, dst, dstStride, cStride, width, height, shift, offset, clpRng, c ); diff --git a/source/Lib/DecoderLib/BinDecoder.cpp b/source/Lib/DecoderLib/BinDecoder.cpp index d86ba85529a7db610aa0eda10d8fde4538d9a277..49b3ea2f3a2d91734b2acdda7f3d881c1673c878 100644 --- a/source/Lib/DecoderLib/BinDecoder.cpp +++ b/source/Lib/DecoderLib/BinDecoder.cpp @@ -182,14 +182,9 @@ unsigned BinDecoderBase::decodeBinsEP( unsigned numBins ) unsigned BinDecoderBase::decodeRemAbsEP( unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) { -#if JVET_M0470 unsigned cutoff = COEF_REMAIN_BIN_REDUCTION; unsigned prefix = 0; useLimitedPrefixLength = true; -#else - unsigned cutoff = g_auiGoRiceRange[ goRicePar ]; - unsigned prefix = 0; -#endif if( useLimitedPrefixLength ) { const unsigned maxPrefix = 32 - maxLog2TrDynamicRange; diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 6949e0d9487985a87273fa011c8a6b0c8cd0d6e7..6a5c179aee44bb4673824c41d683a9ba7a6d3838 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -143,16 +143,10 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i sao( cs, ctuRsAddr ); -#if !JVET_M0132_APS - AlfSliceParam& alfSliceParam = cs.slice->getAlfSliceParam(); - if (cs.sps->getALFEnabledFlag() && (alfSliceParam.enabledFlag[COMPONENT_Y] || alfSliceParam.enabledFlag[COMPONENT_Cb] || alfSliceParam.enabledFlag[COMPONENT_Cr])) - { -#else if (cs.sps->getALFEnabledFlag() && (cs.slice->getTileGroupAlfEnabledFlag())) { CHECK(cs.aps == nullptr, "APS not initialized"); const AlfSliceParam& alfSliceParam = cs.aps->getAlfAPSParam(); -#endif const PreCalcValues& pcv = *cs.pcv; int frame_width_in_ctus = pcv.widthInCtus; @@ -391,20 +385,12 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU bool lastSegment = false; // Reset delta QP coding flag and ChromaQPAdjustemt coding flag -#if JVET_M0113_M0188_QG_SIZE if( pps.getUseDQP() && partitioner.currQgEnable() ) { cuCtx.qgStart = true; cuCtx.isDQPCoded = false; } if( cs.slice->getUseChromaQpAdj() && partitioner.currQgChromaEnable() ) -#else - if( pps.getUseDQP() && partitioner.currDepth <= pps.getMaxCuDQPDepth() ) - { - cuCtx.isDQPCoded = false; - } - if( cs.slice->getUseChromaQpAdj() && partitioner.currDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() ) -#endif { cuCtx.isChromaQpAdjCoded = false; } @@ -412,57 +398,24 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU // Reset delta QP coding flag and ChromaQPAdjustemt coding flag if (CS::isDualITree(cs) && pPartitionerChroma != nullptr) { -#if JVET_M0113_M0188_QG_SIZE if (pps.getUseDQP() && pPartitionerChroma->currQgEnable()) { pCuCtxChroma->qgStart = true; pCuCtxChroma->isDQPCoded = false; } if (cs.slice->getUseChromaQpAdj() && pPartitionerChroma->currQgChromaEnable()) -#else - if (pps.getUseDQP() && pPartitionerChroma->currDepth <= pps.getMaxCuDQPDepth()) - { - pCuCtxChroma->isDQPCoded = false; - } - if (cs.slice->getUseChromaQpAdj() && pPartitionerChroma->currDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth()) -#endif { pCuCtxChroma->isChromaQpAdjCoded = false; } } -#if JVET_M0170_MRG_SHARELIST int startShareThisLevel = 0; -#endif -#if JVET_M0421_SPLIT_SIG const PartSplit splitMode = split_cu_mode( cs, partitioner ); CHECK( !partitioner.canSplit( splitMode, cs ), "Got an invalid split!" ); if( splitMode != CU_DONT_SPLIT ) { -#else - const PartSplit implicitSplit = partitioner.getImplicitSplit( cs ); - - // QT - bool canQtSplit = partitioner.canSplit( CU_QUAD_SPLIT, cs ); - - if( canQtSplit ) - { - // force QT split enabling on the edges and if the current area exceeds maximum transformation size - bool qtSplit = implicitSplit == CU_QUAD_SPLIT; - - // split_cu_flag - if( !qtSplit && implicitSplit != CU_QUAD_SPLIT ) - { - qtSplit = split_cu_flag( cs, partitioner ); - } - - // quad-tree split - if( qtSplit ) - { -#endif -#if JVET_M0170_MRG_SHARELIST const PartSplit split = splitMode; int splitRatio = 1; CHECK(!(split == CU_QUAD_SPLIT || split == CU_HORZ_SPLIT || split == CU_VERT_SPLIT @@ -488,7 +441,6 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU shareParentSize.height = partitioner.currArea().lheight(); } } -#endif if (CS::isDualITree(cs) && pPartitionerChroma != nullptr && (partitioner.currArea().lwidth() >= 64 || partitioner.currArea().lheight() >= 64)) { partitioner.splitCurrArea(CU_QUAD_SPLIT, cs); @@ -568,11 +520,7 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU } else { -#if JVET_M0421_SPLIT_SIG partitioner.splitCurrArea( splitMode, cs ); -#else - partitioner.splitCurrArea( CU_QUAD_SPLIT, cs ); -#endif do { if( !lastSegment && cs.area.blocks[partitioner.chType].contains( partitioner.currArea().blocks[partitioner.chType].pos() ) ) @@ -583,75 +531,11 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU partitioner.exitCurrSplit(); } -#if JVET_M0170_MRG_SHARELIST if (startShareThisLevel == 1) shareStateDec = NO_SHARE; -#endif return lastSegment; -#if !JVET_M0421_SPLIT_SIG - } -#endif } -#if !JVET_M0421_SPLIT_SIG - { - // MT - bool mtSplit = partitioner.canSplit( CU_MT_SPLIT, cs ); - - if( mtSplit ) - { - const PartSplit splitMode = split_cu_mode_mt( cs, partitioner ); - - if( splitMode != CU_DONT_SPLIT ) - { -#if JVET_M0170_MRG_SHARELIST - const PartSplit split = splitMode; - int splitRatio = 1; - CHECK(!(split == CU_QUAD_SPLIT || split == CU_HORZ_SPLIT || split == CU_VERT_SPLIT - || split == CU_TRIH_SPLIT || split == CU_TRIV_SPLIT), "invalid split type"); - splitRatio = (split == CU_HORZ_SPLIT || split == CU_VERT_SPLIT) ? 1 : 2; - - bool isOneChildSmall = (((partitioner.currArea().lwidth())*(partitioner.currArea().lheight())) >> splitRatio) < MRG_SHARELIST_SHARSIZE; - - if ((((partitioner.currArea().lwidth())*(partitioner.currArea().lheight())) > (MRG_SHARELIST_SHARSIZE * 1))) - { - shareStateDec = NO_SHARE; - } - - if (shareStateDec == NO_SHARE)//init state - { - if (isOneChildSmall) - { - shareStateDec = SHARING;//share start state - startShareThisLevel = 1; - - shareParentPos = partitioner.currArea().lumaPos(); - shareParentSize.width = partitioner.currArea().lwidth(); - shareParentSize.height = partitioner.currArea().lheight(); - } - } -#endif - partitioner.splitCurrArea( splitMode, cs ); - - do - { - if( !lastSegment && cs.area.blocks[partitioner.chType].contains( partitioner.currArea().blocks[partitioner.chType].pos() ) ) - { - lastSegment = coding_tree(cs, partitioner, cuCtx); - } - } while( partitioner.nextPart( cs ) ); - - partitioner.exitCurrSplit(); -#if JVET_M0170_MRG_SHARELIST - if (startShareThisLevel == 1) - shareStateDec = NO_SHARE; -#endif - return lastSegment; - } - } - } - -#endif CodingUnit& cu = cs.addCU( CS::getArea( cs, currArea, partitioner.chType ), partitioner.chType ); partitioner.setCUData( cu ); @@ -661,14 +545,9 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU #endif // Predict QP on start of quantization group -#if JVET_M0113_M0188_QG_SIZE if( cuCtx.qgStart ) { cuCtx.qgStart = false; -#else - if( pps.getUseDQP() && !cuCtx.isDQPCoded && CU::isQGStart( cu, partitioner ) ) - { -#endif cuCtx.qp = CU::predictQP( cu, cuCtx.qp ); } @@ -685,22 +564,17 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU cu.chromaQpAdj = cs.chromaQpAdj; //NOTE: CU chroma QP adjustment can be changed by adjustment signaling at TU level // coding unit -#if JVET_M0170_MRG_SHARELIST cu.shareParentPos = (shareStateDec == SHARING) ? shareParentPos : partitioner.currArea().lumaPos(); cu.shareParentSize = (shareStateDec == SHARING) ? shareParentSize : partitioner.currArea().lumaSize(); -#endif bool isLastCtu = coding_unit( cu, partitioner, cuCtx ); DTRACE( g_trace_ctx, D_QP, "x=%d, y=%d, w=%d, h=%d, qp=%d\n", cu.Y().x, cu.Y().y, cu.Y().width, cu.Y().height, cu.qp ); -#if JVET_M0170_MRG_SHARELIST if (startShareThisLevel == 1) shareStateDec = NO_SHARE; -#endif return isLastCtu; } -#if JVET_M0421_SPLIT_SIG PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitioner ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__SPLIT_FLAG, partitioner.currArea().blocks[partitioner.chType].size(), partitioner.chType ); @@ -769,107 +643,6 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio return mode; } -#else -PartSplit CABACReader::split_cu_mode_mt( CodingStructure& cs, Partitioner &partitioner ) -{ - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SPLIT_FLAG ); - - PartSplit mode = CU_DONT_SPLIT; - - unsigned ctxIdBT = DeriveCtx::CtxBTsplit( cs, partitioner ); - - unsigned width = partitioner.currArea().lumaSize().width; - unsigned height = partitioner.currArea().lumaSize().height; - -#if REMOVE_BIN_DECISION_TREE - unsigned btSCtxId = width == height ? 0 : ( width > height ? 1 : 2 ); - - const bool canNo = partitioner.canSplit( CU_DONT_SPLIT, cs ); - const bool canBh = partitioner.canSplit( CU_HORZ_SPLIT, cs ); - const bool canBv = partitioner.canSplit( CU_VERT_SPLIT, cs ); - const bool canTh = partitioner.canSplit( CU_TRIH_SPLIT, cs ); - const bool canTv = partitioner.canSplit( CU_TRIV_SPLIT, cs ); - - bool isSplit = canBh || canBv || canTh || canTv; - - if( canNo && isSplit ) - { - isSplit = m_BinDecoder.decodeBin( Ctx::BTSplitFlag( ctxIdBT ) ); - } - - if( !isSplit ) - { - DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode_mt() ctx=%d split=%d\n", ctxIdBT, mode ); - - return mode; - } - - const bool canHor = canBh || canTh; - bool isVer = canBv || canTv; - - if( isVer && canHor ) - { - isVer = m_BinDecoder.decodeBin( Ctx::BTSplitFlag( 12 + btSCtxId ) ); - } - - const bool can14 = isVer ? canTv : canTh; - bool is12 = isVer ? canBv : canBh; - - if( is12 && can14 ) - { - is12 = m_BinDecoder.decodeBin( Ctx::BTSplitFlag( 15 ) ); - } - - if ( isVer && is12 ) mode = CU_VERT_SPLIT; - else if( isVer && !is12 ) mode = CU_TRIV_SPLIT; - else if( !isVer && is12 ) mode = CU_HORZ_SPLIT; - else mode = CU_TRIH_SPLIT; -#else - DecisionTree dt( g_mtSplitDTT ); - - dt.setAvail( DTT_SPLIT_BT_HORZ, partitioner.canSplit( CU_HORZ_SPLIT, cs ) ); - dt.setAvail( DTT_SPLIT_BT_VERT, partitioner.canSplit( CU_VERT_SPLIT, cs ) ); - - dt.setAvail( DTT_SPLIT_TT_HORZ, partitioner.canSplit( CU_TRIH_SPLIT, cs ) ); - dt.setAvail( DTT_SPLIT_TT_VERT, partitioner.canSplit( CU_TRIV_SPLIT, cs ) ); - dt.setAvail( DTT_SPLIT_NO_SPLIT, partitioner.canSplit( CU_DONT_SPLIT, cs ) ); - - unsigned btSCtxId = width == height ? 0 : ( width > height ? 1 : 2 ); - dt.setCtxId( DTT_SPLIT_DO_SPLIT_DECISION, Ctx::BTSplitFlag( ctxIdBT ) ); // 0- 2 - dt.setCtxId( DTT_SPLIT_HV_DECISION, Ctx::BTSplitFlag( 12 + btSCtxId ) );//12-14 - - dt.setCtxId( DTT_SPLIT_H_IS_BT_12_DECISION, Ctx::BTSplitFlag( 15 ) ); - dt.setCtxId( DTT_SPLIT_V_IS_BT_12_DECISION, Ctx::BTSplitFlag( 15 ) ); - - unsigned id = decode_sparse_dt( dt ); - - mode = id == DTT_SPLIT_NO_SPLIT ? CU_DONT_SPLIT : PartSplit( id ); - -#endif - DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode_mt() ctx=%d split=%d\n", ctxIdBT, mode ); - - return mode; - -} - -bool CABACReader::split_cu_flag( CodingStructure& cs, Partitioner &partitioner ) -{ - // TODO: make maxQTDepth a slice parameter - unsigned maxQTDepth = (g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize(cs.slice->getSliceType(), partitioner.chType)]); - if( partitioner.currDepth == maxQTDepth ) - { - return false; - } - - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE( STATS__CABAC_BITS__SPLIT_FLAG, partitioner.currArea().lumaSize() ); - - unsigned ctxId = DeriveCtx::CtxCUsplit( cs, partitioner ); - bool split = ( m_BinDecoder.decodeBin( Ctx::SplitFlag( ctxId ) ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_flag() ctx=%d split=%d\n", ctxId, split ? 1 : 0 ); - return split; -} - -#endif //================================================================================ // clause 7.3.8.5 @@ -901,11 +674,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& } // skip flag -#if JVET_M0483_IBC if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && cu.Y().valid()) -#else - if (!cs.slice->isIntra() && cu.Y().valid()) -#endif { cu_skip_flag( cu ); } @@ -915,10 +684,8 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& { cs.addTU ( cu, partitioner.chType ); PredictionUnit& pu = cs.addPU( cu, partitioner.chType ); -#if JVET_M0170_MRG_SHARELIST pu.shareParentPos = cu.shareParentPos; pu.shareParentSize = cu.shareParentSize; -#endif MergeCtx mrgCtx; prediction_unit ( pu, mrgCtx ); return end_of_ctu( cu, cuCtx ); @@ -944,9 +711,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& extend_ref_line( cu ); -#if JVET_M0102_INTRA_SUBPARTITIONS isp_mode( cu ); -#endif // prediction data ( intra prediction modes / reference indexes + motion vectors ) cu_pred_data( cu ); @@ -971,7 +736,6 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SKIP_FLAG ); -#if JVET_M0483_IBC if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag()) { cu.skip = false; @@ -991,14 +755,12 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) return; } -#endif unsigned ctxId = DeriveCtx::CtxSkipFlag(cu); unsigned skip = m_BinDecoder.decodeBin( Ctx::SkipFlag(ctxId) ); DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0 ); -#if JVET_M0483_IBC if (skip && cu.cs->slice->getSPS()->getIBCFlag()) { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); @@ -1017,9 +779,6 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) } if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getIBCFlag()) || (skip && !cu.cs->slice->getSPS()->getIBCFlag())) -#else - if( skip ) -#endif { #if JVET_MMVD_OFF_MACRO cu.mmvdSkip = false; @@ -1049,22 +808,16 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) return; } -#if JVET_M0246_AFFINE_AMVR if ( cu.affine ) { return; } -#endif const SPS *sps = cu.cs->sps; unsigned value = 0; unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); -#if JVET_M0483_IBC if (CU::isIBC(cu)) -#else - if (cu.firstPU->interDir == 1 && cu.cs->slice->getRefPic(REF_PIC_LIST_0, cu.firstPU->refIdx[REF_PIC_LIST_0])->getPOC() == cu.cs->slice->getPOC()) // the first bin of IMV flag does need to be signaled in IBC block -#endif value = 1; else value = m_BinDecoder.decodeBin( Ctx::ImvFlag( ctxId ) ); @@ -1081,7 +834,6 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() IMVFlag=%d\n", cu.imv ); } -#if JVET_M0246_AFFINE_AMVR void CABACReader::affine_amvr_mode( CodingUnit& cu, MergeCtx& mrgCtx ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__OTHER ); @@ -1112,13 +864,11 @@ void CABACReader::affine_amvr_mode( CodingUnit& cu, MergeCtx& mrgCtx ) cu.imv = value; DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() IMVFlag=%d\n", cu.imv ); } -#endif void CABACReader::pred_mode( CodingUnit& cu ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__PRED_MODE ); -#if JVET_M0483_IBC if (cu.cs->slice->getSPS()->getIBCFlag()) { if (cu.cs->slice->isIntra()) @@ -1132,11 +882,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) } else { -#if JVET_M0502_PRED_MODE_CTX if (m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)))) -#else - if (m_BinDecoder.decodeBin(Ctx::PredMode())) -#endif { cu.predMode = MODE_INTRA; } @@ -1153,11 +899,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) } else { -#if JVET_M0502_PRED_MODE_CTX if (cu.cs->slice->isIntra() || m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)))) -#else - if (cu.cs->slice->isIntra() || m_BinDecoder.decodeBin(Ctx::PredMode())) -#endif { cu.predMode = MODE_INTRA; } @@ -1166,20 +908,6 @@ void CABACReader::pred_mode( CodingUnit& cu ) cu.predMode = MODE_INTER; } } -#else -#if JVET_M0502_PRED_MODE_CTX - if( cu.cs->slice->isIntra() || m_BinDecoder.decodeBin( Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)) ) ) -#else - if( cu.cs->slice->isIntra() || m_BinDecoder.decodeBin( Ctx::PredMode() ) ) -#endif - { - cu.predMode = MODE_INTRA; - } - else - { - cu.predMode = MODE_INTER; - } -#endif } void CABACReader::pcm_flag( CodingUnit& cu, Partitioner &partitioner ) @@ -1205,29 +933,20 @@ void CABACReader::cu_pred_data( CodingUnit &cu ) } if (!cu.Y().valid()) // dual tree chroma CU { -#if JVET_M0483_IBC cu.predMode = MODE_IBC; -#else - cu.predMode = MODE_INTER; - cu.ibc = true; -#endif return; } MergeCtx mrgCtx; for( auto &pu : CU::traversePUs( cu ) ) { -#if JVET_M0170_MRG_SHARELIST pu.shareParentPos = cu.shareParentPos; pu.shareParentSize = cu.shareParentSize; -#endif prediction_unit( pu, mrgCtx ); } imv_mode ( cu, mrgCtx ); -#if JVET_M0246_AFFINE_AMVR affine_amvr_mode( cu, mrgCtx ); -#endif cu_gbi_flag( cu ); } @@ -1367,11 +1086,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) for( int k = 0; k < numBlocks; k++ ) { CHECK(numBlocks != 1, "not supported yet"); -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.firstPU->multiRefIdx || ( cu.ispMode && isLuma( cu.chType ) ) ) -#else - if (cu.firstPU->multiRefIdx) -#endif { mpmFlag[0] = true; } @@ -1495,11 +1210,7 @@ void CABACReader::intra_chroma_pred_mode( PredictionUnit& pu ) void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& cuCtx ) { -#if JVET_M0483_IBC if (!CU::isIntra(cu)) -#else - if( CU::isInter( cu ) ) -#endif { PredictionUnit& pu = *cu.firstPU; if( !pu.mergeFlag ) @@ -1510,12 +1221,10 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& { cu.rootCbf = true; } -#if JVET_M0140_SBT if( cu.rootCbf ) { sbt_mode( cu ); } -#endif if( !cu.rootCbf ) { TransformUnit& tu = cu.cs->addTU(cu, partitioner.chType); @@ -1532,7 +1241,6 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& } ChromaCbfs chromaCbfs; -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode && isLuma( partitioner.chType ) ) { TUIntraSubPartitioner subTuPartitioner( partitioner ); @@ -1542,9 +1250,6 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& { transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); } -#else - transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); -#endif } void CABACReader::rqt_root_cbf( CodingUnit& cu ) @@ -1556,7 +1261,6 @@ void CABACReader::rqt_root_cbf( CodingUnit& cu ) DTRACE( g_trace_ctx, D_SYNTAX, "rqt_root_cbf() ctx=0 root_cbf=%d pos=(%d,%d)\n", cu.rootCbf ? 1 : 0, cu.lumaPos().x, cu.lumaPos().y ); } -#if JVET_M0140_SBT void CABACReader::sbt_mode( CodingUnit& cu ) { const uint8_t sbtAllowed = cu.checkAllowedSbt(); @@ -1612,7 +1316,6 @@ void CABACReader::sbt_mode( CodingUnit& cu ) DTRACE( g_trace_ctx, D_SYNTAX, "sbt_mode() pos=(%d,%d) sbtInfo=%d\n", cu.lx(), cu.ly(), (int)cu.sbtInfo ); } -#endif bool CABACReader::end_of_ctu( CodingUnit& cu, CUCtx& cuCtx ) @@ -1657,14 +1360,12 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) } if( pu.mergeFlag ) { -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) { merge_idx(pu); } else { -#endif subblock_merge_flag( *pu.cu ); MHIntra_flag(pu); if (pu.mhIntraFlag) @@ -1679,11 +1380,8 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) } else merge_data ( pu ); -#if JVET_M0483_IBC } -#endif } -#if JVET_M0483_IBC else if (CU::isIBC(*pu.cu)) { pu.interDir = 1; @@ -1692,14 +1390,11 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) mvd_coding(pu.mvd[REF_PIC_LIST_0]); mvp_flag(pu, REF_PIC_LIST_0); } -#endif else { inter_pred_idc( pu ); affine_flag ( *pu.cu ); -#if JVET_M0444_SMVD smvd_mode( pu ); -#endif if( pu.interDir != 2 /* PRED_L1 */ ) { @@ -1722,10 +1417,8 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) if( pu.interDir != 1 /* PRED_L0 */ ) { -#if JVET_M0444_SMVD if ( pu.cu->smvdMode != 1 ) { -#endif ref_idx ( pu, REF_PIC_LIST_1 ); if( pu.cu->cs->slice->getMvdL1ZeroFlag() && pu.interDir == 3 /* PRED_BI */ ) { @@ -1747,9 +1440,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) { mvd_coding( pu.mvd[REF_PIC_LIST_1] ); } -#if JVET_M0444_SMVD } -#endif mvp_flag ( pu, REF_PIC_LIST_1 ); } } @@ -1761,19 +1452,16 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) pu.cu->GBiIdx = GBI_DEFAULT; } -#if JVET_M0444_SMVD if ( pu.cu->smvdMode ) { RefPicList eCurRefList = (RefPicList)(pu.cu->smvdMode - 1); pu.mvd[1 - eCurRefList].set( -pu.mvd[eCurRefList].hor, -pu.mvd[eCurRefList].ver ); pu.refIdx[1 - eCurRefList] = pu.cs->slice->getSymRefIdx( 1 - eCurRefList ); } -#endif PU::spanMotionInfo( pu, mrgCtx ); } -#if JVET_M0444_SMVD void CABACReader::smvd_mode( PredictionUnit& pu ) { pu.cu->smvdMode = 0; @@ -1793,7 +1481,6 @@ void CABACReader::smvd_mode( PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "symmvd_flag() symmvd=%d pos=(%d,%d) size=%dx%d\n", pu.cu->smvdMode ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height ); } -#endif void CABACReader::subblock_merge_flag( CodingUnit& cu ) { @@ -1843,13 +1530,11 @@ void CABACReader::merge_flag( PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height ); -#if JVET_M0483_IBC if (pu.mergeFlag && CU::isIBC(*pu.cu)) { pu.mmvdMergeFlag = false; return; } -#endif #if JVET_MMVD_OFF_MACRO pu.mmvdMergeFlag = false; #else @@ -1887,30 +1572,13 @@ void CABACReader::merge_idx( PredictionUnit& pu ) { if ( m_BinDecoder.decodeBin( Ctx::AffMergeIdx() ) ) { -#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - bool useExtCtx = pu.cs->sps->getSBTMVPEnabledFlag(); -#endif pu.mergeIdx++; for ( ; pu.mergeIdx < numCandminus1; pu.mergeIdx++ ) { -#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - if ( useExtCtx ) - { - if ( !m_BinDecoder.decodeBin( Ctx::AffMergeIdx( std::min<int>( pu.mergeIdx, NUM_MERGE_IDX_EXT_CTX - 1 ) ) ) ) - { - break; - } - } - else - { -#endif if ( !m_BinDecoder.decodeBinEP() ) { break; } -#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - } -#endif } } } @@ -1924,7 +1592,6 @@ void CABACReader::merge_idx( PredictionUnit& pu ) if( pu.cu->triangle ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__TRIANGLE_INDEX ); -#if JVET_M0883_TRIANGLE_SIGNALING bool splitDir; uint8_t candIdx0; uint8_t candIdx1; @@ -1955,18 +1622,6 @@ void CABACReader::merge_idx( PredictionUnit& pu ) pu.triangleSplitDir = splitDir; pu.triangleMergeIdx0 = candIdx0; pu.triangleMergeIdx1 = candIdx1; -#else - if( m_BinDecoder.decodeBin( Ctx::TriangleIdx() ) == 0 ) - { - pu.mergeIdx += m_BinDecoder.decodeBinEP(); - } - else - { - pu.mergeIdx += exp_golomb_eqprob( 2 ) + 2; - } - - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx=%d\n", pu.mergeIdx ); -#endif return; } @@ -2092,13 +1747,11 @@ void CABACReader::ref_idx( PredictionUnit &pu, RefPicList eRefList ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__REF_FRM_IDX ); -#if JVET_M0444_SMVD if ( pu.cu->smvdMode ) { pu.refIdx[eRefList] = pu.cs->slice->getSymRefIdx( eRefList ); return; } -#endif int numRef = pu.cs->slice->getNumRefIdx(eRefList); @@ -2278,7 +1931,6 @@ void CABACReader::triangle_mode( CodingUnit& cu ) return; } -#if JVET_M0118_M0185_TRIANGLE_FLAG_FIX if ( cu.firstPU->mmvdMergeFlag || cu.mmvdSkip ) { return; @@ -2288,7 +1940,6 @@ void CABACReader::triangle_mode( CodingUnit& cu ) { return; } -#endif unsigned flag_idx = DeriveCtx::CtxTriangleFlag( cu ); cu.triangle = m_BinDecoder.decodeBin( Ctx::TriangleFlag(flag_idx) ); @@ -2338,83 +1989,46 @@ void CABACReader::pcm_samples( TransformUnit& tu ) // bool cbf_comp ( area, depth ) //================================================================================ -#if JVET_M0102_INTRA_SUBPARTITIONS void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType, const int subTuIdx ) -#else -void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ) -#endif { -#if JVET_M0140_SBT ChromaCbfs chromaCbfsLastDepth; chromaCbfsLastDepth.Cb = chromaCbfs.Cb; chromaCbfsLastDepth.Cr = chromaCbfs.Cr; -#endif const UnitArea& area = partitioner.currArea(); CodingUnit& cu = *cs.getCU( area.blocks[partitioner.chType], partitioner.chType ); const unsigned trDepth = partitioner.currTrDepth; -#if JVET_M0102_INTRA_SUBPARTITIONS int subTuCounter = subTuIdx; -#endif // split_transform_flag bool split = false; split = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); -#if JVET_M0140_SBT if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { split = true; } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS if( !split && cu.ispMode ) { split = partitioner.canSplit( ispType, cs ); } const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode && !split; -#endif // cbf_cb & cbf_cr -#if JVET_M0102_INTRA_SUBPARTITIONS if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) -#else - if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) ) -#endif { -#if JVET_M0102_INTRA_SUBPARTITIONS const int cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; if (chromaCbfs.Cb) { -#if JVET_M0140_SBT if (!(cu.sbtInfo && trDepth == 1)) -#endif chromaCbfs.Cb &= cbf_comp(cs, area.blocks[COMPONENT_Cb], cbfDepth); } if (chromaCbfs.Cr) { -#if JVET_M0140_SBT if (!(cu.sbtInfo && trDepth == 1)) -#endif chromaCbfs.Cr &= cbf_comp(cs, area.blocks[COMPONENT_Cr], cbfDepth, chromaCbfs.Cb); } -#else - if (chromaCbfs.Cb) - { -#if JVET_M0140_SBT - if (!(cu.sbtInfo && trDepth == 1)) -#endif - chromaCbfs.Cb &= cbf_comp(cs, area.blocks[COMPONENT_Cb], trDepth); - } - if (chromaCbfs.Cr) - { -#if JVET_M0140_SBT - if (!(cu.sbtInfo && trDepth == 1)) -#endif - chromaCbfs.Cr &= cbf_comp(cs, area.blocks[COMPONENT_Cr], trDepth, chromaCbfs.Cb); - } -#endif } else if( CS::isDualITree( cs ) ) { @@ -2424,13 +2038,6 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, if( split ) { { -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - if( trDepth == 0 && !cu.ispMode ) emt_cu_flag( cu ); -#else - if( trDepth == 0 ) emt_cu_flag( cu ); -#endif -#endif if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { @@ -2441,18 +2048,14 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, #endif partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( cu.ispMode ) { partitioner.splitCurrArea( ispType, cs ); } -#endif -#if JVET_M0140_SBT else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { partitioner.splitCurrArea( PartSplit( cu.getSbtTuSplit() ), cs ); } -#endif else THROW( "Implicit TU split not available!" ); } @@ -2460,12 +2063,8 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, do { ChromaCbfs subCbfs = chromaCbfs; -#if JVET_M0102_INTRA_SUBPARTITIONS transform_tree( cs, partitioner, cuCtx, subCbfs, ispType, subTuCounter ); subTuCounter += subTuCounter != -1 ? 1 : 0; -#else - transform_tree( cs, partitioner, cuCtx, subCbfs ); -#endif } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); @@ -2475,7 +2074,6 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, const unsigned numTBlocks = getNumberValidTBlocks( *cs.pcv ); unsigned compCbf[3] = { 0, 0, 0 }; -#if JVET_M0102_INTRA_SUBPARTITIONS unsigned cbfDepth = 0; for( auto &currTU : cs.traverseTUs( currArea, partitioner.chType ) ) { @@ -2485,15 +2083,6 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, compCbf[ch] |= ( TU::getCbfAtDepth( currTU, ComponentID( ch ), cbfDepth ) ? 1 : 0 ); } } -#else - for( auto &currTU : cs.traverseTUs( currArea, partitioner.chType ) ) - { - for( unsigned ch = 0; ch < numTBlocks; ch++ ) - { - compCbf[ch] |= ( TU::getCbfAtDepth( currTU, ComponentID( ch ), currDepth + 1 ) ? 1 : 0 ); - } - } -#endif for (auto &currTU: cs.traverseTUs(currArea, partitioner.chType)) { @@ -2509,11 +2098,9 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, { TransformUnit &tu = cs.addTU( CS::getArea( cs, area, partitioner.chType ), partitioner.chType ); unsigned numBlocks = ::getNumberValidTBlocks( *cs.pcv ); -#if JVET_M0140_SBT tu.checkTuNoResidual( partitioner.currPartIdx() ); chromaCbfs.Cb &= !tu.noResidual; chromaCbfs.Cr &= !tu.noResidual; -#endif for( unsigned compID = COMPONENT_Y; compID < numBlocks; compID++ ) { @@ -2532,7 +2119,6 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, { TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, 1 ); } -#if JVET_M0140_SBT else if( cu.sbtInfo && tu.noResidual ) { TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, 0 ); @@ -2542,10 +2128,8 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, assert( !tu.noResidual ); TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, 1 ); } -#endif else { -#if JVET_M0102_INTRA_SUBPARTITIONS bool previousCbf = false; bool rootCbfSoFar = false; bool lastCbfIsInferred = false; @@ -2571,39 +2155,23 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, } } bool cbfY = lastCbfIsInferred ? true : cbf_comp( cs, tu.Y(), trDepth, previousCbf, cu.ispMode ); -#else - bool cbfY = cbf_comp( cs, tu.Y(), trDepth ); -#endif TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, ( cbfY ? 1 : 0 ) ); } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( area.chromaFormat != CHROMA_400 && ( !cu.ispMode || chromaCbfISP ) ) -#else - if( area.chromaFormat != CHROMA_400 ) -#endif { TU::setCbfAtDepth( tu, COMPONENT_Cb, trDepth, ( chromaCbfs.Cb ? 1 : 0 ) ); TU::setCbfAtDepth( tu, COMPONENT_Cr, trDepth, ( chromaCbfs.Cr ? 1 : 0 ) ); } -#if !JVET_M0464_UNI_MTS - if( trDepth == 0 && TU::getCbfAtDepth( tu, COMPONENT_Y, 0 ) ) emt_cu_flag( cu ); -#endif transform_unit( tu, cuCtx, chromaCbfs ); } } -#if JVET_M0102_INTRA_SUBPARTITIONS bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbf, const bool useISP ) { const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbf, useISP && isLuma( area.compID ) ); -#else -bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbCbf ) -{ - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbCbf ); -#endif const CtxSet& ctxSet = Ctx::QtCbf[ area.compID ]; RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__QT_CBF, area.size(), area.compID); @@ -2685,11 +2253,7 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c CodingUnit& cu = *tu.cu; bool lumaOnly = ( cu.chromaFormat == CHROMA_400 || !tu.blocks[COMPONENT_Cb].valid() ); bool cbfLuma = ( tu.cbf[ COMPONENT_Y ] != 0 ); -#if JVET_M0102_INTRA_SUBPARTITIONS bool cbfChroma = ( lumaOnly ? false : ( chromaCbfs.Cb || chromaCbfs.Cr ) ); -#else - bool cbfChroma = ( cu.chromaFormat == CHROMA_400 ? false : ( chromaCbfs.Cb || chromaCbfs.Cr ) ); -#endif if( cbfLuma || cbfChroma ) { @@ -2788,22 +2352,14 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) DTRACE( g_trace_ctx, D_SYNTAX, "residual_coding() etype=%d pos=(%d,%d) size=%dx%d predMode=%d\n", tu.blocks[compID].compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.blocks[compID].width, tu.blocks[compID].height, cu.predMode ); // parse transform skip and explicit rdpcm mode -#if JVET_M0464_UNI_MTS mts_coding ( tu, compID ); -#else - transform_skip_flag( tu, compID ); -#endif explicit_rdpcm_mode( tu, compID ); #if HEVC_USE_SIGN_HIDING // determine sign hiding bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); -#if JVET_M0464_UNI_MTS if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==1 ) -#else - if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.transformSkip[compID] ) -#endif { const ChannelType chType = toChannelType( compID ); const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType ); @@ -2821,82 +2377,30 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) CoeffCodingContext cctx ( tu, compID ); #endif TCoeff* coeff = tu.getCoeffs( compID ).buf; -#if !JVET_M0464_UNI_MTS - unsigned numSig = 0; -#endif // parse last coeff position -#if JVET_M0297_32PT_MTS_ZERO_OUT cctx.setScanPosLast( last_sig_coeff( cctx, tu, compID ) ); -#else - cctx.setScanPosLast( last_sig_coeff( cctx ) ); -#endif // parse subblocks const int stateTransTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; -#if !JVET_M0464_UNI_MTS - bool useEmt = ( cu.cs->sps->getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getUseInterEMT() && cu.predMode == MODE_INTER ); - useEmt = useEmt && isLuma(compID); -#if JVET_M0102_INTRA_SUBPARTITIONS - useEmt = useEmt && !cu.ispMode; -#endif -#if JVET_M0140_SBT - useEmt = useEmt && !cu.sbtInfo; -#endif -#endif for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--) { cctx.initSubblock ( subSetId ); -#if JVET_M0297_32PT_MTS_ZERO_OUT -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( ( tu.cu->emtFlag && !tu.transformSkip[ compID ] ) || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#else -#if JVET_M0464_UNI_MTS - if( tu.mtsIdx > 1 && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( tu.cu->emtFlag && !tu.transformSkip[ compID ] && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#endif { if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) ) || ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) ) { continue; } } -#endif residual_coding_subblock( cctx, coeff, stateTransTab, state ); -#if !JVET_M0464_UNI_MTS - if (useEmt) - { - numSig += cctx.emtNumSigCoeff(); - cctx.setEmtNumSigCoeff( 0 ); - } -#endif } -#if !JVET_M0464_UNI_MTS - if( useEmt && !tu.transformSkip[compID] && compID == COMPONENT_Y && tu.cu->emtFlag ) - { - if( CU::isIntra( *tu.cu ) ) - { - emt_tu_index(tu); - } - else - { - emt_tu_index( tu ); - } - } -#endif } -#if JVET_M0464_UNI_MTS void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) { const CodingUnit &cu = *tu.cu; @@ -2943,114 +2447,7 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) } DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), tu.mtsIdx ); } -#else -void CABACReader::transform_skip_flag( TransformUnit& tu, ComponentID compID ) -{ -#if JVET_M0102_INTRA_SUBPARTITIONS - if( !tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag( *tu.cs, tu.blocks[compID] ) || ( isLuma( compID ) && tu.cu->emtFlag ) || ( tu.cu->ispMode && isLuma( compID ) ) ) -#else - if( !tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag( *tu.cs, tu.blocks[compID] ) || ( isLuma( compID ) && tu.cu->emtFlag ) ) -#endif - { - tu.transformSkip[compID] = false; - return; - } -#if JVET_M0140_SBT - if( tu.cu->sbtInfo ) - { - tu.transformSkip[compID] = false; - return; - } -#endif - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET2( STATS__CABAC_BITS__TRANSFORM_SKIP_FLAGS, compID ); - - bool tskip = m_BinDecoder.decodeBin( Ctx::TransformSkipFlag( toChannelType( compID ) ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "transform_skip_flag() etype=%d pos=(%d,%d) trSkip=%d\n", compID, tu.blocks[compID].x, tu.blocks[compID].y, (int)tskip ); - tu.transformSkip[compID] = tskip; -} - -void CABACReader::emt_tu_index( TransformUnit& tu ) -{ - int maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - int maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - - uint8_t trIdx = 0; - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__EMT_TU_INDEX ); - - if( CU::isIntra( *tu.cu ) && ( tu.cu->Y().width <= maxSizeEmtIntra ) && ( tu.cu->Y().height <= maxSizeEmtIntra ) ) - { - bool uiSymbol1 = m_BinDecoder.decodeBin( Ctx::EMTTuIndex( 0 ) ); - bool uiSymbol2 = m_BinDecoder.decodeBin( Ctx::EMTTuIndex( 1 ) ); - - trIdx = ( uiSymbol2 << 1 ) | ( int ) uiSymbol1; - - DTRACE( g_trace_ctx, D_SYNTAX, "emt_tu_index() etype=%d pos=(%d,%d) emtTrIdx=%d\n", COMPONENT_Y, tu.lx(), tu.ly(), ( int ) trIdx ); - } - if( !CU::isIntra( *tu.cu ) && ( tu.cu->Y().width <= maxSizeEmtInter ) && ( tu.cu->Y().height <= maxSizeEmtInter ) ) - { - bool uiSymbol1 = m_BinDecoder.decodeBin( Ctx::EMTTuIndex( 2 ) ); - bool uiSymbol2 = m_BinDecoder.decodeBin( Ctx::EMTTuIndex( 3 ) ); - - trIdx = ( uiSymbol2 << 1 ) | ( int ) uiSymbol1; - - DTRACE( g_trace_ctx, D_SYNTAX, "emt_tu_index() etype=%d pos=(%d,%d) emtTrIdx=%d\n", COMPONENT_Y, tu.lx(), tu.ly(), ( int ) trIdx ); - } - - tu.emtIdx = trIdx; -} - -void CABACReader::emt_cu_flag( CodingUnit& cu ) -{ -#if JVET_M0102_INTRA_SUBPARTITIONS - if ( CU::isIntra( cu ) && cu.ispMode ) - { - return; - } -#endif -#if JVET_M0140_SBT - if( cu.sbtInfo ) - { - return; - } -#endif - const CodingStructure &cs = *cu.cs; - -#if JVET_M0483_IBC - if (!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType)) -#else - if( !( ( cs.sps->getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) ) -#endif - { - return; - } - - unsigned depth = cu.qtDepth; - const unsigned cuWidth = cu.lwidth(); - const unsigned cuHeight = cu.lheight(); - - int maxSizeEmtIntra, maxSizeEmtInter; - if( depth >= NUM_EMT_CU_FLAG_CTX ) - { - depth = NUM_EMT_CU_FLAG_CTX - 1; - } - maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - - cu.emtFlag = 0; - - const unsigned maxSizeEmt = CU::isIntra( cu ) ? maxSizeEmtIntra : maxSizeEmtInter; - - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__EMT_CU_FLAG ); - if( cuWidth <= maxSizeEmt && cuHeight <= maxSizeEmt ) - { - bool uiCuFlag = m_BinDecoder.decodeBin( Ctx::EMTCuFlag( depth ) ); - cu.emtFlag = uiCuFlag; - DTRACE( g_trace_ctx, D_SYNTAX, "emt_cu_flag() etype=%d pos=(%d,%d) emtCuFlag=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), ( int ) cu.emtFlag ); - } -} -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS void CABACReader::isp_mode( CodingUnit& cu ) { if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm ) @@ -3088,7 +2485,6 @@ void CABACReader::isp_mode( CodingUnit& cu ) } DTRACE( g_trace_ctx, D_SYNTAX, "intra_subPartitions() etype=%d pos=(%d,%d) ispIdx=%d\n", cu.chType, cu.blocks[cu.chType].x, cu.blocks[cu.chType].y, (int)cu.ispMode ); } -#endif void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) { @@ -3096,11 +2492,7 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) tu.rdpcm[compID] = RDPCM_OFF; -#if JVET_M0464_UNI_MTS if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==1 || cu.transQuantBypass ) ) -#else - if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.transformSkip[compID] || cu.transQuantBypass ) ) -#endif { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE( STATS__EXPLICIT_RDPCM_BITS, tu.blocks[tu.chType].lumaSize() ); @@ -3120,32 +2512,15 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) } -#if JVET_M0297_32PT_MTS_ZERO_OUT int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, ComponentID compID ) -#else -int CABACReader::last_sig_coeff( CoeffCodingContext& cctx ) -#endif { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__LAST_SIG_X_Y, Size( cctx.width(), cctx.height() ), cctx.compID() ); unsigned PosLastX = 0, PosLastY = 0; -#if JVET_M0297_32PT_MTS_ZERO_OUT unsigned maxLastPosX = cctx.maxLastPosX(); unsigned maxLastPosY = cctx.maxLastPosY(); -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( ( tu.cu->emtFlag && !tu.transformSkip[ compID ] ) || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#else -#if JVET_M0464_UNI_MTS - if( tu.mtsIdx > 1 && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( tu.cu->emtFlag && !tu.transformSkip[ compID ] && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#endif { maxLastPosX = ( tu.blocks[ compID ].width == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosX; maxLastPosY = ( tu.blocks[ compID ].height == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosY; @@ -3165,22 +2540,6 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx ) break; } } -#else - for( ; PosLastX < cctx.maxLastPosX(); PosLastX++ ) - { - if( ! m_BinDecoder.decodeBin( cctx.lastXCtxId( PosLastX ) ) ) - { - break; - } - } - for( ; PosLastY < cctx.maxLastPosY(); PosLastY++ ) - { - if( ! m_BinDecoder.decodeBin( cctx.lastYCtxId( PosLastY ) ) ) - { - break; - } - } -#endif if( PosLastX > 3 ) { uint32_t uiTemp = 0; @@ -3271,23 +2630,11 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co #endif int numNonZero = 0; bool is2x2subblock = ( cctx.log2CGSize() == 2 ); -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); -#else - int remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK ); - int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ) - remGt2Bins; -#endif int firstPosMode2 = minSubPos - 1; -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - int firstPosMode1 = minSubPos - 1; -#endif int sigBlkPos[ 1 << MLS_CG_SIZE ]; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS for( ; nextSigPos >= minSubPos && remRegBins >= 4; nextSigPos-- ) -#else - for( ; nextSigPos >= minSubPos && remRegBins >= 3; nextSigPos-- ) -#endif { int blkPos = cctx.blockPos( nextSigPos ); unsigned sigFlag = ( !numNonZero && nextSigPos == inferSigPos ); @@ -3316,9 +2663,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co remRegBins--; unsigned parFlag = 0; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS unsigned gt2Flag = 0; -#endif if( gt1Flag ) { RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_par ); @@ -3326,57 +2671,22 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co DTRACE( g_trace_ctx, D_SYNTAX_RESI, "par_flag() bin=%d ctx=%d\n", parFlag, cctx.parityCtxIdAbs( ctxOff ) ); remRegBins--; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_gt2); gt2Flag = m_BinDecoder.decodeBin( cctx.greater2CtxIdAbs( ctxOff ) ); DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2Flag, cctx.greater2CtxIdAbs( ctxOff ) ); remRegBins--; -#else - if( remGt2Bins && !--remGt2Bins ) - { - firstPosMode1 = nextSigPos - 1; - } -#endif } -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS coeff[ blkPos ] += 1 + parFlag + gt1Flag + (gt2Flag << 1); -#else - coeff[ blkPos ] += 1 + parFlag + gt1Flag; -#endif } state = ( stateTransTable >> ((state<<2)+((coeff[blkPos]&1)<<1)) ) & 3; } firstPosMode2 = nextSigPos; -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - firstPosMode1 = ( firstPosMode1 > firstPosMode2 ? firstPosMode1 : firstPosMode2 ); -#endif -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - //===== 2nd PASS: gt2 ===== - for( int scanPos = firstSigPos; scanPos > firstPosMode1; scanPos-- ) - { - TCoeff& tcoeff = coeff[ cctx.blockPos( scanPos ) ]; - if( tcoeff >= 2 ) - { - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt2 ); - uint8_t& ctxOff = ctxOffset[ scanPos - minSubPos ]; - unsigned gt2Flag = m_BinDecoder.decodeBin( cctx.greater2CtxIdAbs(ctxOff) ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2Flag, cctx.greater2CtxIdAbs(ctxOff) ); - tcoeff += (gt2Flag<<1); - } - } -#endif -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS //===== 2nd PASS: Go-rice codes ===== unsigned ricePar = 0; for( int scanPos = firstSigPos; scanPos > firstPosMode2; scanPos-- ) -#else - //===== 3rd PASS: Go-rice codes ===== - unsigned ricePar = 0; - for( int scanPos = firstSigPos; scanPos > firstPosMode1; scanPos-- ) -#endif { TCoeff& tcoeff = coeff[ cctx.blockPos( scanPos ) ]; if( tcoeff >= 4 ) @@ -3391,23 +2701,6 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co } } } -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - for( int scanPos = firstPosMode1; scanPos > firstPosMode2; scanPos-- ) - { - TCoeff& tcoeff = coeff[ cctx.blockPos( scanPos ) ]; - if( tcoeff >= 2 ) - { - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_escs ); - int rem = m_BinDecoder.decodeRemAbsEP( ricePar, cctx.extPrec(), cctx.maxLog2TrDRange() ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, ricePar ); - tcoeff += (rem<<1); - if( ricePar < 3 && rem > (3<<ricePar)-1 ) - { - ricePar++; - } - } - } -#endif //===== coeff bypass ==== for( int scanPos = firstPosMode2; scanPos >= minSubPos; scanPos-- ) @@ -3461,9 +2754,6 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co coeff[ sigBlkPos[k] ] = ( sumAbs & 1 ? -AbsCoeff : AbsCoeff ); } #endif -#if !JVET_M0464_UNI_MTS - cctx.setEmtNumSigCoeff( numNonZero ); -#endif } //================================================================================ @@ -3549,53 +2839,3 @@ unsigned CABACReader::exp_golomb_eqprob( unsigned count ) return symbol; } -#if !REMOVE_BIN_DECISION_TREE -unsigned CABACReader::decode_sparse_dt( DecisionTree& dt ) -{ - dt.reduce(); - - unsigned depth = dt.dtt.depth; - unsigned offset = 0; - - while( dt.dtt.hasSub[offset] ) - { - CHECKD( depth == 0, "Depth is '0' for a decision node in a decision tree" ); - - const unsigned posRight = offset + 1; - const unsigned posLeft = offset + ( 1u << depth ); - - bool isLeft = true; - - if( dt.isAvail[posRight] && dt.isAvail[posLeft] ) - { - // encode the decision as both sub-paths are available - const unsigned ctxId = dt.ctxId[offset]; - - if( ctxId > 0 ) - { - DTRACE( g_trace_ctx, D_DECISIONTREE, "Decision coding using context %d\n", ctxId - 1 ); - isLeft = m_BinDecoder.decodeBin( ctxId - 1 ) == 0; - } - else - { - DTRACE( g_trace_ctx, D_DECISIONTREE, "Decision coding as an EP bin\n" ); - isLeft = m_BinDecoder.decodeBinEP() == 0; - } - } - else if( dt.isAvail[posRight] ) - { - isLeft = false; - } - - DTRACE( g_trace_ctx, D_DECISIONTREE, "Following the tree to the %s sub-node\n", isLeft ? "left" : "right" ); - - offset = isLeft ? posLeft : posRight; - depth--; - } - - CHECKD( dt.isAvail[offset] == false, "The decoded element is not available" ); - DTRACE( g_trace_ctx, D_DECISIONTREE, "Found an end-node of the tree\n" ); - return dt.dtt.ids[offset]; -} - -#endif diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index e0724dac6d9fe647a80ef5751e64e9a051e08898..34559ae1cef1c92edd6119465c3f0ae0d20c8ffe 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -48,11 +48,7 @@ class CABACReader { public: -#if JVET_M0170_MRG_SHARELIST CABACReader(BinDecoderBase& binDecoder) : shareStateDec(0), m_BinDecoder(binDecoder), m_Bitstream(0) {} -#else - CABACReader( BinDecoderBase& binDecoder ) : m_BinDecoder( binDecoder ), m_Bitstream( 0 ) {} -#endif virtual ~CABACReader() {} public: @@ -74,12 +70,7 @@ public: // coding (quad)tree (clause 7.3.8.4) bool coding_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, Partitioner* pPartitionerChroma = nullptr, CUCtx* pCuCtxChroma = nullptr); -#if JVET_M0421_SPLIT_SIG PartSplit split_cu_mode ( CodingStructure& cs, Partitioner& pm ); -#else - bool split_cu_flag ( CodingStructure& cs, Partitioner& pm ); - PartSplit split_cu_mode_mt ( CodingStructure& cs, Partitioner& pm ); -#endif // coding unit (clause 7.3.8.5) bool coding_unit ( CodingUnit& cu, Partitioner& pm, CUCtx& cuCtx ); @@ -96,9 +87,7 @@ public: void intra_chroma_pred_mode ( PredictionUnit& pu ); void cu_residual ( CodingUnit& cu, Partitioner& pm, CUCtx& cuCtx ); void rqt_root_cbf ( CodingUnit& cu ); -#if JVET_M0140_SBT void sbt_mode ( CodingUnit& cu ); -#endif bool end_of_ctu ( CodingUnit& cu, CUCtx& cuCtx ); // prediction unit (clause 7.3.8.6) @@ -110,30 +99,21 @@ public: void merge_idx ( PredictionUnit& pu ); void mmvd_merge_idx(PredictionUnit& pu); void imv_mode ( CodingUnit& cu, MergeCtx& mrgCtx ); -#if JVET_M0246_AFFINE_AMVR void affine_amvr_mode ( CodingUnit& cu, MergeCtx& mrgCtx ); -#endif void inter_pred_idc ( PredictionUnit& pu ); void ref_idx ( PredictionUnit& pu, RefPicList eRefList ); void mvp_flag ( PredictionUnit& pu, RefPicList eRefList ); void MHIntra_flag ( PredictionUnit& pu ); void MHIntra_luma_pred_modes ( CodingUnit& cu ); void triangle_mode ( CodingUnit& cu ); - #if JVET_M0444_SMVD void smvd_mode ( PredictionUnit& pu ); -#endif // pcm samples (clause 7.3.8.7) void pcm_samples ( TransformUnit& tu ); // transform tree (clause 7.3.8.8) -#if JVET_M0102_INTRA_SUBPARTITIONS void transform_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType = TU_NO_ISP, const int subTuIdx = -1 ); bool cbf_comp ( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbCbf = false, const bool useISP = false ); -#else - void transform_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); - bool cbf_comp ( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbCbf = false ); -#endif // mvd coding (clause 7.3.8.9) void mvd_coding ( Mv &rMvd ); @@ -145,22 +125,10 @@ public: // residual coding (clause 7.3.8.11) void residual_coding ( TransformUnit& tu, ComponentID compID ); -#if JVET_M0464_UNI_MTS void mts_coding ( TransformUnit& tu, ComponentID compID ); -#else - void transform_skip_flag ( TransformUnit& tu, ComponentID compID ); - void emt_tu_index ( TransformUnit& tu ); - void emt_cu_flag ( CodingUnit& cu ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS void isp_mode ( CodingUnit& cu ); -#endif void explicit_rdpcm_mode ( TransformUnit& tu, ComponentID compID ); -#if JVET_M0297_32PT_MTS_ZERO_OUT int last_sig_coeff ( CoeffCodingContext& cctx, TransformUnit& tu, ComponentID compID ); -#else - int last_sig_coeff ( CoeffCodingContext& cctx ); -#endif void residual_coding_subblock ( CoeffCodingContext& cctx, TCoeff* coeff, const int stateTransTable, int& state ); // cross component prediction (clause 7.3.8.12) @@ -170,18 +138,13 @@ private: unsigned unary_max_symbol ( unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol ); unsigned unary_max_eqprob ( unsigned maxSymbol ); unsigned exp_golomb_eqprob ( unsigned count ); -#if !REMOVE_BIN_DECISION_TREE - unsigned decode_sparse_dt ( DecisionTree& dt ); -#endif unsigned get_num_bits_read () { return m_BinDecoder.getNumBitsRead(); } void xReadTruncBinCode(uint32_t& symbol, uint32_t maxSymbol); -#if JVET_M0170_MRG_SHARELIST public: int shareStateDec; Position shareParentPos; Size shareParentSize; -#endif private: BinDecoderBase& m_BinDecoder; InputBitstream* m_Bitstream; diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index e862ce8817dd1aa9d6c75b0b30a6a2e0bf32db2a..04b10286a175f9b0967cbd2e742ee4cb0414fc6e 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -62,9 +62,7 @@ DecCu::DecCu() { -#if JVET_M0427_INLOOP_RESHAPER m_tmpStorageLCU = NULL; -#endif } DecCu::~DecCu() @@ -77,7 +75,6 @@ void DecCu::init( TrQuant* pcTrQuant, IntraPrediction* pcIntra, InterPrediction* m_pcIntraPred = pcIntra; m_pcInterPred = pcInter; } -#if JVET_M0427_INLOOP_RESHAPER void DecCu::initDecCuReshaper (Reshape* pcReshape, ChromaFormat chromaFormatIDC) { m_pcReshape = pcReshape; @@ -97,7 +94,6 @@ void DecCu::destoryDecCuReshaprBuf() m_tmpStorageLCU = NULL; } } -#endif // ==================================================================================================================== // Public member functions @@ -107,34 +103,27 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) { const int maxNumChannelType = cs.pcv->chrFormat != CHROMA_400 && CS::isDualITree( cs ) ? 2 : 1; -#if JVET_M0170_MRG_SHARELIST if (!cs.pcv->isEncoder) { m_shareStateDec = NO_SHARE; } bool sharePrepareCondition = ((!cs.pcv->isEncoder) && (!(cs.slice->isIntra()) || cs.slice->getSPS()->getIBCFlag())); -#endif for( int ch = 0; ch < maxNumChannelType; ch++ ) { const ChannelType chType = ChannelType( ch ); -#if JVET_M0170_MRG_SHARELIST Position prevTmpPos; prevTmpPos.x = -1; prevTmpPos.y = -1; -#endif for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, chType ), chType ) ) { -#if JVET_M0170_MRG_SHARELIST if(sharePrepareCondition) { if ((currCU.shareParentPos.x >= 0) && (!(currCU.shareParentPos.x == prevTmpPos.x && currCU.shareParentPos.y == prevTmpPos.y))) { m_shareStateDec = GEN_ON_SHARED_BOUND; cs.motionLut.lutShare = cs.motionLut.lut; -#if JVET_M0483_IBC cs.motionLut.lutShareIbc = cs.motionLut.lutIbc; -#endif } if (currCU.shareParentPos.x < 0) @@ -143,7 +132,6 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) } prevTmpPos = currCU.shareParentPos; } -#endif cs.chType = chType; if (currCU.predMode != MODE_INTRA && currCU.Y().valid()) { @@ -152,9 +140,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) switch( currCU.predMode ) { case MODE_INTER: -#if JVET_M0483_IBC case MODE_IBC: -#endif xReconInter( currCU ); break; case MODE_INTRA: @@ -215,13 +201,8 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) { m_pcIntraPred->predIntraAng( compID, piPred, pu, bUseFilteredPredictions ); } -#if JVET_M0427_INLOOP_RESHAPER const Slice &slice = *cs.slice; -#if JVET_M0483_IBC bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#else - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())); -#endif if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID != COMPONENT_Y)) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); @@ -232,7 +213,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) int adj = m_pcReshape->calculateChromaAdj(avgLuma); tu.setChromaAdj(adj); } -#endif //===== inverse transform ===== PelBuf piResi = cs.getResiBuf( area ); @@ -248,13 +228,11 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } //===== reconstruction ===== -#if JVET_M0427_INLOOP_RESHAPER flag = flag && (tu.blocks[compID].width*tu.blocks[compID].height > 4); if (flag && TU::getCbf(tu, compID) && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj()) { piResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); } -#endif if( isChroma(compID) && tu.compAlpha[compID] != 0 ) { CrossComponentPrediction::crossComponentPrediction( tu, compID, cs.getResiBuf( tu.Y() ), piResi, piResi, true ); @@ -262,7 +240,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) PelBuf pReco = cs.getRecoBuf( area ); -#if JVET_M0102_INTRA_SUBPARTITIONS if( !tu.cu->ispMode || !isLuma( compID ) ) { cs.setDecomp( area ); @@ -271,20 +248,12 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) { cs.setDecomp( tu.cu->blocks[compID] ); } -#else - cs.setDecomp( area ); -#endif -#if JVET_M0427_INLOOP_RESHAPER #if REUSE_CU_RESULTS CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred; #endif -#if JVET_M0483_IBC if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())) && compID == COMPONENT_Y) -#endif { #if REUSE_CU_RESULTS { @@ -293,7 +262,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } #endif } -#endif #if KEEP_PRED_AND_RESI_SIGNALS pReco.reconstruct( piPred, piResi, tu.cu->cs->slice->clpRng( compID ) ); #else @@ -302,12 +270,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) #if !KEEP_PRED_AND_RESI_SIGNALS pReco.copyFrom( piPred ); #endif -#if JVET_M0427_INLOOP_RESHAPER -#if JVET_M0483_IBC if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())) && compID == COMPONENT_Y) -#endif { #if REUSE_CU_RESULTS { @@ -315,14 +278,11 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } #endif } -#endif #if REUSE_CU_RESULTS if( cs.pcv->isEncoder ) { cs.picture->getRecoBuf( area ).copyFrom( pReco ); -#if JVET_M0427_INLOOP_RESHAPER cs.picture->getPredBuf(area).copyFrom(piPred); -#endif } #endif } @@ -453,39 +413,21 @@ void DecCu::xReconInter(CodingUnit &cu) { if( cu.triangle ) { -#if JVET_M0883_TRIANGLE_SIGNALING const bool splitDir = cu.firstPU->triangleSplitDir; const uint8_t candIdx0 = cu.firstPU->triangleMergeIdx0; const uint8_t candIdx1 = cu.firstPU->triangleMergeIdx1; -#else - const uint8_t mergeIdx = cu.firstPU->mergeIdx; - const bool splitDir = g_triangleCombination[mergeIdx][0]; - const uint8_t candIdx0 = g_triangleCombination[mergeIdx][1]; - const uint8_t candIdx1 = g_triangleCombination[mergeIdx][2]; -#endif m_pcInterPred->motionCompensation4Triangle( cu, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); -#if JVET_M0883_TRIANGLE_SIGNALING PU::spanTriangleMotionInfo( *cu.firstPU, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); -#else - PU::spanTriangleMotionInfo( *cu.firstPU, m_triangleMrgCtx, mergeIdx, splitDir, candIdx0, candIdx1 ); -#endif } else { m_pcIntraPred->geneIntrainterPred(cu); // inter prediction -#if JVET_M0483_IBC CHECK(CU::isIBC(cu) && cu.firstPU->mhIntraFlag, "IBC and MHIntra cannot be used together"); CHECK(CU::isIBC(cu) && cu.affine, "IBC and Affine cannot be used together"); CHECK(CU::isIBC(cu) && cu.triangle, "IBC and triangle cannot be used together"); CHECK(CU::isIBC(cu) && cu.firstPU->mmvdMergeFlag, "IBC and MMVD cannot be used together"); -#else - CHECK(cu.ibc && cu.firstPU->mhIntraFlag, "IBC and MHIntra cannot be used together"); - CHECK(cu.ibc && cu.affine, "IBC and Affine cannot be used together"); - CHECK(cu.ibc && cu.triangle, "IBC and triangle cannot be used together"); - CHECK(cu.ibc && cu.firstPU->mmvdMergeFlag, "IBC and MMVD cannot be used together"); -#endif const bool luma = cu.Y().valid(); const bool chroma = cu.Cb().valid(); if (luma && chroma) @@ -503,25 +445,17 @@ void DecCu::xReconInter(CodingUnit &cu) if (!cu.affine && !cu.triangle) { MotionInfo mi = pu.getMotionInfo(); -#if JVET_M0264_HMVP_WITH_GBIIDX mi.GBiIdx = (mi.interDir == 3) ? cu.GBiIdx : GBI_DEFAULT; -#endif -#if JVET_M0483_IBC cu.cs->addMiToLut(CU::isIBC(cu) ? cu.cs->motionLut.lutIbc : cu.cs->motionLut.lut, mi ); -#else - cu.cs->addMiToLut(cu.cs->motionLut.lut, mi); -#endif } } if (cu.firstPU->mhIntraFlag) { -#if JVET_M0427_INLOOP_RESHAPER if (cu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { cu.cs->getPredBuf(*cu.firstPU).Y().rspSignal(m_pcReshape->getFwdLUT()); } -#endif m_pcIntraPred->geneWeightedPred(COMPONENT_Y, cu.cs->getPredBuf(*cu.firstPU).Y(), *cu.firstPU, m_pcIntraPred->getPredictorPtr2(COMPONENT_Y, 0)); m_pcIntraPred->geneWeightedPred(COMPONENT_Cb, cu.cs->getPredBuf(*cu.firstPU).Cb(), *cu.firstPU, m_pcIntraPred->getPredictorPtr2(COMPONENT_Cb, 0)); m_pcIntraPred->geneWeightedPred(COMPONENT_Cr, cu.cs->getPredBuf(*cu.firstPU).Cr(), *cu.firstPU, m_pcIntraPred->getPredictorPtr2(COMPONENT_Cr, 0)); @@ -538,7 +472,6 @@ void DecCu::xReconInter(CodingUnit &cu) if (cu.rootCbf) { -#if JVET_M0427_INLOOP_RESHAPER #if REUSE_CU_RESULTS const CompArea &area = cu.blocks[COMPONENT_Y]; CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); @@ -553,21 +486,15 @@ void DecCu::xReconInter(CodingUnit &cu) tmpPred.copyFrom(cs.getPredBuf(cu).get(COMPONENT_Y)); } #endif -#if JVET_M0483_IBC if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (!cu.firstPU->mhIntraFlag && !cu.ibc ) -#endif cs.getPredBuf(cu).get(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT()); } -#endif #if KEEP_PRED_AND_RESI_SIGNALS cs.getRecoBuf( cu ).reconstruct( cs.getPredBuf( cu ), cs.getResiBuf( cu ), cs.slice->clpRngs() ); #else cs.getResiBuf( cu ).reconstruct( cs.getPredBuf( cu ), cs.getResiBuf( cu ), cs.slice->clpRngs() ); cs.getRecoBuf( cu ).copyFrom ( cs.getResiBuf( cu ) ); #endif -#if JVET_M0427_INLOOP_RESHAPER if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { #if REUSE_CU_RESULTS @@ -577,21 +504,14 @@ void DecCu::xReconInter(CodingUnit &cu) } #endif } -#endif } else { cs.getRecoBuf(cu).copyClip(cs.getPredBuf(cu), cs.slice->clpRngs()); -#if JVET_M0427_INLOOP_RESHAPER -#if JVET_M0483_IBC if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && !cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && !cu.firstPU->mhIntraFlag && !cu.ibc) -#endif { cs.getRecoBuf(cu).get(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT()); } -#endif } DTRACE ( g_trace_ctx, D_TMP, "reco " ); @@ -623,13 +543,11 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) } //===== reconstruction ===== -#if JVET_M0427_INLOOP_RESHAPER const Slice &slice = *cs.slice; if ( slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && isChroma(compID) && TU::getCbf(currTU, compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj() && currTU.blocks[compID].width*currTU.blocks[compID].height > 4 ) { resiBuf.scaleSignal(currTU.getChromaAdj(), 0, currTU.cu->cs->slice->clpRng(compID)); } -#endif if( isChroma( compID ) && currTU.compAlpha[compID] != 0 ) { CrossComponentPrediction::crossComponentPrediction( currTU, compID, cs.getResiBuf( currTU.Y() ), resiBuf, resiBuf, true ); @@ -651,7 +569,6 @@ void DecCu::xDecodeInterTexture(CodingUnit &cu) for( auto& currTU : CU::traverseTUs( cu ) ) { -#if JVET_M0427_INLOOP_RESHAPER CodingStructure &cs = *cu.cs; const Slice &slice = *cs.slice; if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID == COMPONENT_Y)) @@ -661,17 +578,12 @@ void DecCu::xDecodeInterTexture(CodingUnit &cu) CompArea tmpArea(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size()); PelBuf tmpPred = m_tmpStorageLCU->getBuf(tmpArea); tmpPred.copyFrom(predY); -#if JVET_M0483_IBC if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (!cu.firstPU->mhIntraFlag && !cu.ibc) -#endif tmpPred.rspSignal(m_pcReshape->getFwdLUT()); const Pel avgLuma = tmpPred.computeAvg(); int adj = m_pcReshape->calculateChromaAdj(avgLuma); currTU.setChromaAdj(adj); } -#endif xDecodeInterTU( currTU, compID ); } } @@ -703,14 +615,9 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } int fPosBaseIdx = pu.mmvdMergeIdx / MMVD_MAX_REFINE_NUM; -#if JVET_M0170_MRG_SHARELIST pu.shareParentPos = cu.shareParentPos; pu.shareParentSize = cu.shareParentSize; -#endif PU::getInterMergeCandidates(pu, mrgCtx, 1, fPosBaseIdx + 1); -#if !JVET_M0068_M0171_MMVD_CLEANUP - PU::restrictBiPredMergeCands(pu, mrgCtx); -#endif PU::getInterMMVDMergeCandidates(pu, mrgCtx, pu.mmvdMergeIdx ); @@ -764,19 +671,12 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } else { -#if JVET_M0170_MRG_SHARELIST pu.shareParentPos = cu.shareParentPos; pu.shareParentSize = cu.shareParentSize; -#endif -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) PU::getIBCMergeCandidates(pu, mrgCtx, pu.mergeIdx); else -#endif PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.mergeIdx); -#if !JVET_M0068_M0171_MMVD_CLEANUP - PU::restrictBiPredMergeCands(pu, mrgCtx); -#endif mrgCtx.setMergeInfo( pu, pu.mergeIdx ); PU::spanMotionInfo( pu, mrgCtx ); @@ -788,17 +688,9 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) else { #if REUSE_CU_RESULTS -#if JVET_M0246_AFFINE_AMVR if ( cu.imv && !pu.cu->affine && !cu.cs->pcv->isEncoder ) #else - if (cu.imv && !cu.cs->pcv->isEncoder) -#endif -#else -#if JVET_M0246_AFFINE_AMVR if (cu.imv && !pu.cu->affine) -#else - if (cu.imv) -#endif #endif { PU::applyImv(pu, mrgCtx, m_pcInterPred); @@ -821,11 +713,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) // Mv mv[3]; CHECK( pu.refIdx[eRefList] < 0, "Unexpected negative refIdx." ); -#if JVET_M0246_AFFINE_AMVR -#if !JVET_M0055_DEBUG_CTU - Mv tmpMvd[3]; - memcpy( tmpMvd, pu.mvdAffi[eRefList], 3 * sizeof( Mv ) ); -#endif const int imvShift = ( !cu.cs->pcv->isEncoder && pu.cu->imv == 2 ) ? MV_FRACTIONAL_BITS_DIFF : 0; pu.mvdAffi[eRefList][0] <<= imvShift; pu.mvdAffi[eRefList][1] <<= imvShift; @@ -850,29 +737,10 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) mvLB.changePrecision( MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL ); } } -#if !JVET_M0055_DEBUG_CTU //th this leads to different interpretation of mvdAffi at encoder and decoder - memcpy( pu.mvdAffi[eRefList], tmpMvd, 3 * sizeof( Mv ) ); -#endif -#else - Mv mvLT = affineAMVPInfo.mvCandLT[mvp_idx] + pu.mvdAffi[eRefList][0]; - Mv mvRT = affineAMVPInfo.mvCandRT[mvp_idx] + pu.mvdAffi[eRefList][1]; - mvRT += pu.mvdAffi[eRefList][0]; - mvLT.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); - mvRT.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); - - Mv mvLB; - if ( cu.affineType == AFFINEMODEL_6PARAM ) - { - mvLB = affineAMVPInfo.mvCandLB[mvp_idx] + pu.mvdAffi[eRefList][2]; - mvLB += pu.mvdAffi[eRefList][0]; - mvLB.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); - } -#endif PU::setAllAffineMv( pu, mvLT, mvRT, mvLB, eRefList ); } } } -#if JVET_M0483_IBC else if (CU::isIBC(*pu.cu) && pu.interDir == 1) { AMVPInfo amvpInfo; @@ -886,35 +754,17 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) pu.mv[REF_PIC_LIST_0] = amvpInfo.mvCand[pu.mvpIdx[REF_PIC_LIST_0]] + mvd; pu.mv[REF_PIC_LIST_0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); } -#endif else { for ( uint32_t uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) { RefPicList eRefList = RefPicList( uiRefListIdx ); -#if JVET_M0483_IBC if ((pu.cs->slice->getNumRefIdx(eRefList) > 0 || (eRefList == REF_PIC_LIST_0 && CU::isIBC(*pu.cu))) && (pu.interDir & (1 << uiRefListIdx))) -#else - if ( pu.cs->slice->getNumRefIdx( eRefList ) > 0 && ( pu.interDir & ( 1 << uiRefListIdx ) ) ) -#endif { AMVPInfo amvpInfo; PU::fillMvpCand(pu, eRefList, pu.refIdx[eRefList], amvpInfo); pu.mvpNum [eRefList] = amvpInfo.numCand; -#if JVET_M0483_IBC==0 - Mv mvd = pu.mvd[eRefList]; - if (eRefList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefList, pu.refIdx[eRefList])->getPOC() == pu.cs->slice->getPOC()) - { - pu.cu->ibc = true; -#if REUSE_CU_RESULTS - if (!cu.cs->pcv->isEncoder) -#endif - mvd.changePrecision(MV_PRECISION_INT, MV_PRECISION_QUARTER); - } - pu.mv [eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + mvd; -#else pu.mv[eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + pu.mvd[eRefList]; -#endif pu.mv[eRefList].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); } } @@ -922,7 +772,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) PU::spanMotionInfo( pu, mrgCtx ); } } -#if JVET_M0445_MCTS_DEC_CHECK if( !cu.triangle ) { if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) @@ -930,7 +779,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) printf( "DECODER: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); } } -#endif } } //! \} diff --git a/source/Lib/DecoderLib/DecCu.h b/source/Lib/DecoderLib/DecCu.h index 8990dfec0a90fed69e8a1fb9b6004575ec9ccf01..8d70b5f06275284f8d0ba6b91b8726e262c17fbf 100644 --- a/source/Lib/DecoderLib/DecCu.h +++ b/source/Lib/DecoderLib/DecCu.h @@ -48,9 +48,7 @@ #include "CommonLib/InterPrediction.h" #include "CommonLib/IntraPrediction.h" #include "CommonLib/Unit.h" -#if JVET_M0427_INLOOP_RESHAPER #include "CommonLib/Reshape.h" -#endif //! \ingroup DecoderLib //! \{ @@ -70,18 +68,14 @@ public: /// destroy internal buffers void decompressCtu ( CodingStructure& cs, const UnitArea& ctuArea ); -#if JVET_M0427_INLOOP_RESHAPER Reshape* m_pcReshape; Reshape* getReshape () { return m_pcReshape; } void initDecCuReshaper ( Reshape* pcReshape, ChromaFormat chromaFormatIDC) ; void destoryDecCuReshaprBuf(); -#endif -#if JVET_M0170_MRG_SHARELIST void setShareStateDec (int shareStateDecIn) { m_shareStateDec = shareStateDecIn; } #if ENABLE_SPLIT_PARALLELISM int getShareStateDec () const { return m_shareStateDec; } -#endif #endif /// reconstruct Ctu information protected: @@ -98,17 +92,13 @@ protected: void xDecodeInterTU ( TransformUnit& tu, const ComponentID compID ); void xDeriveCUMV ( CodingUnit& cu ); -#if JVET_M0427_INLOOP_RESHAPER PelStorage *m_tmpStorageLCU; -#endif private: TrQuant* m_pcTrQuant; IntraPrediction* m_pcIntraPred; InterPrediction* m_pcInterPred; -#if JVET_M0170_MRG_SHARELIST int m_shareStateDec; -#endif MotionInfo m_SubPuMiBuf[(MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1)]; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 6970b7752711758cbefb5e3cf618a4dcab98b5f2..b3ecdee4e51e98498763894205abc054eb390e97 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -56,11 +56,7 @@ #include "CommonLib/CodingStatistics.h" #endif -#if JVET_M0055_DEBUG_CTU bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::string& bitstreamFileName, bool bDecodeUntilPocFound /* = false */, int debugCTU /* = -1*/, int debugPOC /* = -1*/ ) -#else -bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::string& bitstreamFileName, bool bDecodeUntilPocFound /* = false */ ) -#endif { int poc; PicList* pcListPic = NULL; @@ -95,10 +91,8 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri #endif ); -#if JVET_M0055_DEBUG_CTU pcDecLib->setDebugCTU( debugCTU ); pcDecLib->setDebugPOC( debugPOC ); -#endif pcDecLib->setDecodedPictureHashSEIEnabled( true ); bFirstCall = false; @@ -164,10 +158,8 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri CHECK( expectedPoc != poc, "mismatch in POC - check encoder configuration" ); -#if JVET_M0055_DEBUG_CTU if( debugCTU < 0 || poc != debugPOC ) { -#endif for( int i = 0; i < pic->slices.size(); i++ ) { if( pcEncPic->slices.size() <= i ) @@ -180,13 +172,10 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri } pcEncPic->slices[i]->copySliceInfo( pic->slices[i], false ); } -#if JVET_M0055_DEBUG_CTU } -#endif pcEncPic->cs->slice = pcEncPic->slices.back(); -#if JVET_M0055_DEBUG_CTU if( debugCTU >= 0 && poc == debugPOC ) { pcEncPic->cs->initStructData(); @@ -205,7 +194,6 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri } else { -#endif if ( pic->cs->sps->getSAOEnabledFlag() ) { pcEncPic->copySAO( *pic, 0 ); @@ -220,13 +208,9 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri for( int i = 0; i < pic->slices.size(); i++ ) { -#if JVET_M0132_APS pcEncPic->slices[i]->setAPSId(pic->slices[i]->getAPSId()); pcEncPic->slices[i]->setAPS( pic->slices[i]->getAPS()); pcEncPic->slices[i]->setTileGroupAlfEnabledFlag( pic->slices[i]->getTileGroupAlfEnabledFlag()); -#else - pcEncPic->slices[i]->getAlfSliceParam() = pic->slices[i]->getAlfSliceParam(); -#endif } } @@ -242,9 +226,7 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri { pcEncPic->cs->copyStructure( *pic->cs, CH_C, true, true ); } -#if JVET_M0055_DEBUG_CTU } -#endif goOn = false; // exit the loop return bRet = true; break; @@ -398,9 +380,7 @@ DecLib::DecLib() , m_seiReader() , m_cLoopFilter() , m_cSAO() -#if JVET_M0427_INLOOP_RESHAPER , m_cReshaper() -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE , m_cacheModel() #endif @@ -420,10 +400,8 @@ DecLib::DecLib() , m_numberOfChecksumErrorsDetected(0) , m_warningMessageSkipPicture(false) , m_prefixSEINALUs() -#if JVET_M0055_DEBUG_CTU , m_debugPOC( -1 ) , m_debugCTU( -1 ) -#endif { #if ENABLE_SIMD_OPT_BUFFER g_pelBufOP.initPelBufOpsX86(); @@ -488,10 +466,8 @@ void DecLib::deletePicBuffer ( ) m_cacheModel.reportSequence( ); m_cacheModel.destroy( ); #endif -#if JVET_M0427_INLOOP_RESHAPER m_cCuDecoder.destoryDecCuReshaprBuf(); m_cReshaper.destroy(); -#endif } Picture* DecLib::xGetNewPicBuffer ( const SPS &sps, const PPS &pps, const uint32_t temporalLayer ) @@ -566,7 +542,6 @@ void DecLib::executeLoopFilters() CodingStructure& cs = *m_pcPic->cs; -#if JVET_M0427_INLOOP_RESHAPER if (cs.sps->getUseReshaper() && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) { CHECK((m_cReshaper.getRecReshaped() == false), "Rec picture is not reshaped!"); @@ -574,12 +549,9 @@ void DecLib::executeLoopFilters() m_cReshaper.setRecReshaped(false); m_cSAO.setReshaper(&m_cReshaper); } -#endif // deblocking filter m_cLoopFilter.loopFilterPic( cs ); -#if JVET_M0147_DMVR CS::setRefinedMotionField(cs); -#endif if( cs.sps->getSAOEnabledFlag() ) { m_cSAO.SAOProcess( cs, cs.picture->getSAO() ); @@ -587,7 +559,6 @@ void DecLib::executeLoopFilters() if( cs.sps->getALFEnabledFlag() ) { -#if JVET_M0132_APS if (cs.slice->getTileGroupAlfEnabledFlag()) { // ALF decodes the differentially coded coefficients and stores them in the parameters structure. @@ -597,9 +568,6 @@ void DecLib::executeLoopFilters() AlfSliceParam alfParamCopy = cs.aps->getAlfAPSParam(); m_cALF.ALFProcess(cs, alfParamCopy); } -#else - m_cALF.ALFProcess( cs, cs.slice->getAlfSliceParam() ); -#endif } } @@ -757,13 +725,11 @@ void DecLib::xActivateParameterSets() { if (m_bFirstSliceInPicture) { -#if JVET_M0132_APS APS *aps = m_parameterSetManager.getAPS(m_apcSlicePilot->getAPSId()); // this is a temporary APS object. Do not store this value if (m_apcSlicePilot->getAPSId() != -1) { CHECK(aps == 0, "No APS present"); } -#endif const PPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value CHECK(pps == 0, "No PPS present"); @@ -782,7 +748,6 @@ void DecLib::xActivateParameterSets() THROW("Parameter set activation failed!"); } -#if JVET_M0132_APS if (aps) { m_parameterSetManager.clearAPSChangedFlag(aps->getAPSId()); @@ -791,7 +756,6 @@ void DecLib::xActivateParameterSets() THROW("APS activation failed!"); } } -#endif xParsePrefixSEImessages(); @@ -807,11 +771,7 @@ void DecLib::xActivateParameterSets() m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); -#if JVET_M0132_APS m_pcPic->finalInit(*sps, *pps, *aps); -#else - m_pcPic->finalInit( *sps, *pps ); -#endif m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth ); m_pcPic->cs->createCoeffs(); @@ -825,9 +785,7 @@ void DecLib::xActivateParameterSets() Slice *pSlice = m_pcPic->slices[m_uiSliceSegmentIdx]; // Update the PPS and SPS pointers with the ones of the picture. -#if JVET_M0132_APS aps= pSlice->getAPS(); -#endif pps=pSlice->getPPS(); sps=pSlice->getSPS(); @@ -835,9 +793,7 @@ void DecLib::xActivateParameterSets() m_pcPic->cs->slice = pSlice; m_pcPic->cs->sps = sps; m_pcPic->cs->pps = pps; -#if JVET_M0132_APS m_pcPic->cs->aps = aps; -#endif #if HEVC_VPS m_pcPic->cs->vps = pSlice->getVPS(); #endif @@ -848,12 +804,10 @@ void DecLib::xActivateParameterSets() m_cLoopFilter.create( sps->getMaxCodingDepth() ); m_cIntraPred.init( sps->getChromaFormatIdc(), sps->getBitDepth( CHANNEL_TYPE_LUMA ) ); m_cInterPred.init( &m_cRdCost, sps->getChromaFormatIdc() ); -#if JVET_M0427_INLOOP_RESHAPER if (sps->getUseReshaper()) { m_cReshaper.createDec(sps->getBitDepth(CHANNEL_TYPE_LUMA)); } -#endif bool isField = false; bool isTopField = false; @@ -880,12 +834,10 @@ void DecLib::xActivateParameterSets() // Recursive structure m_cCuDecoder.init( &m_cTrQuant, &m_cIntraPred, &m_cInterPred ); -#if JVET_M0427_INLOOP_RESHAPER if (sps->getUseReshaper()) { m_cCuDecoder.initDecCuReshaper(&m_cReshaper, sps->getChromaFormatIdc()); } -#endif #if MAX_TB_SIZE_SIGNALLING m_cTrQuant.init( nullptr, sps->getMaxTbSize(), false, false, false, false, false ); #else @@ -913,16 +865,12 @@ void DecLib::xActivateParameterSets() const SPS *sps = pSlice->getSPS(); const PPS *pps = pSlice->getPPS(); -#if JVET_M0132_APS APS *aps = pSlice->getAPS(); -#endif // fix Parameter Sets, now that we have the real slice m_pcPic->cs->slice = pSlice; m_pcPic->cs->sps = sps; m_pcPic->cs->pps = pps; -#if JVET_M0132_APS m_pcPic->cs->aps = aps; -#endif #if HEVC_VPS m_pcPic->cs->vps = pSlice->getVPS(); #endif @@ -937,12 +885,10 @@ void DecLib::xActivateParameterSets() { EXIT("Error - a new PPS has been decoded while processing a picture"); } -#if JVET_M0132_APS if (aps && m_parameterSetManager.getAPSChangedFlag(aps->getAPSId())) { EXIT("Error - a new APS has been decoded while processing a picture"); } -#endif xParsePrefixSEImessages(); @@ -1118,13 +1064,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl int iMaxPOClsb = 1 << sps->getBitsForPOC(); m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) ); xUpdatePreviousTid0POC(m_apcSlicePilot); -#if JVET_M0132_APS if (m_apcSlicePilot->getAPSId() != -1) { APS *aps = m_parameterSetManager.getAPS(m_apcSlicePilot->getAPSId()); CHECK(aps == 0, "No APS present"); } -#endif } // Skip pictures due to random access @@ -1272,7 +1216,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->setCheckLDC(bLowDelay); } -#if JVET_M0444_SMVD if ( pcSlice->getCheckLDC() == false && pcSlice->getMvdL1ZeroFlag() == false ) { int currPOC = pcSlice->getPOC(); @@ -1348,7 +1291,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { pcSlice->setBiDirPred( false, -1, -1 ); } -#endif //--------------- pcSlice->setRefPOCList(); @@ -1384,15 +1326,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } #endif -#if JVET_M0483_IBC -#else - if (pcSlice->getSPS()->getIBCMode() && pcSlice->getEnableTMVPFlag()) - { - CHECK(pcSlice->getRefPic(RefPicList(pcSlice->isInterB() ? 1 - pcSlice->getColFromL0Flag() : 0), pcSlice->getColRefIdx())->getPOC() == pcSlice->getPOC(), "curr ref picture cannot be collocated picture"); - } -#endif -#if JVET_M0427_INLOOP_RESHAPER if (pcSlice->getSPS()->getUseReshaper()) { m_cReshaper.copySliceReshaperInfo(m_cReshaper.getSliceReshaperInfo(), pcSlice->getReshapeInfo()); @@ -1404,11 +1338,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { m_cReshaper.setReshapeFlag(false); } -#if JVET_M0483_IBC if ((pcSlice->getSliceType() == I_SLICE) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) -#else - if ((pcSlice->getSliceType() == I_SLICE || (pcSlice->getSliceType() == P_SLICE && pcSlice->getSPS()->getIBCMode())) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) -#endif { m_cReshaper.setCTUFlag(false); m_cReshaper.setRecReshaped(true); @@ -1432,22 +1362,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_cReshaper.setCTUFlag(false); m_cReshaper.setRecReshaped(false); } -#endif // Decode a picture -#if JVET_M0055_DEBUG_CTU m_cSliceDecoder.decompressSlice( pcSlice, &( nalu.getBitstream() ), ( m_pcPic->poc == getDebugPOC() ? getDebugCTU() : -1 ) ); -#else - m_cSliceDecoder.decompressSlice( pcSlice, &(nalu.getBitstream()) ); -#endif m_bFirstSliceInPicture = false; -#if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getIBCMode()) - { - pcSlice->getPic()->longTerm = false; - } -#endif m_uiSliceSegmentIdx++; return false; @@ -1481,7 +1400,6 @@ void DecLib::xDecodePPS( InputNALUnit& nalu ) m_parameterSetManager.storePPS( pps, nalu.getBitstream().getFifo() ); } -#if JVET_M0132_APS void DecLib::xDecodeAPS(InputNALUnit& nalu) { APS* aps = new APS(); @@ -1489,7 +1407,6 @@ void DecLib::xDecodeAPS(InputNALUnit& nalu) m_HLSReader.parseAPS(aps); m_parameterSetManager.storeAPS(aps, nalu.getBitstream().getFifo()); } -#endif bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) { bool ret; @@ -1515,11 +1432,9 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) case NAL_UNIT_PPS: xDecodePPS( nalu ); return false; -#if JVET_M0132_APS case NAL_UNIT_APS: xDecodeAPS(nalu); return false; -#endif case NAL_UNIT_PREFIX_SEI: // Buffer up prefix SEI messages until SPS of associated VCL is known. diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 89a4acc8f2fe1b65691363d09e21016936095e45..1ea3aacf47749403410a6fed3a3c3c4640871773 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -53,20 +53,14 @@ #include "CommonLib/AdaptiveLoopFilter.h" #include "CommonLib/SEI.h" #include "CommonLib/Unit.h" -#if JVET_M0427_INLOOP_RESHAPER #include "CommonLib/Reshape.h" -#endif class InputNALUnit; //! \ingroup DecoderLib //! \{ -#if JVET_M0055_DEBUG_CTU bool tryDecodePicture( Picture* pcPic, const int expectedPoc, const std::string& bitstreamFileName, bool bDecodeUntilPocFound = false, int debugCTU = -1, int debugPOC = -1 ); -#else - bool tryDecodePicture( Picture* pcPic, const int expectedPoc, const std::string& bitstreamFileName, bool bDecodeUntilPocFound = false ); -#endif// ==================================================================================================================== // Class definition // ==================================================================================================================== @@ -100,9 +94,7 @@ private: LoopFilter m_cLoopFilter; SampleAdaptiveOffset m_cSAO; AdaptiveLoopFilter m_cALF; -#if JVET_M0427_INLOOP_RESHAPER Reshape m_cReshaper; ///< reshaper class -#endif // decoder side RD cost computation RdCost m_cRdCost; ///< RD cost computation class #if JVET_J0090_MEMORY_BANDWITH_MEASURE @@ -132,10 +124,8 @@ private: bool m_warningMessageSkipPicture; std::list<InputNALUnit*> m_prefixSEINALUs; /// Buffered up prefix SEI NAL Units. -#if JVET_M0055_DEBUG_CTU int m_debugPOC; int m_debugCTU; -#endif public: DecLib(); virtual ~DecLib(); @@ -166,12 +156,10 @@ public: void setDecodedSEIMessageOutputStream(std::ostream *pOpStream) { m_pDecodedSEIOutputStream = pOpStream; } uint32_t getNumberOfChecksumErrorsDetected() const { return m_numberOfChecksumErrorsDetected; } -#if JVET_M0055_DEBUG_CTU int getDebugCTU( ) const { return m_debugCTU; } void setDebugCTU( int debugCTU ) { m_debugCTU = debugCTU; } int getDebugPOC( ) const { return m_debugPOC; }; void setDebugPOC( int debugPOC ) { m_debugPOC = debugPOC; }; -#endif protected: void xUpdateRasInit(Slice* slice); @@ -185,9 +173,7 @@ protected: #endif void xDecodeSPS( InputNALUnit& nalu ); void xDecodePPS( InputNALUnit& nalu ); -#if JVET_M0132_APS void xDecodeAPS(InputNALUnit& nalu); -#endif #if !JVET_M0101_HLS void xUpdatePreviousTid0POC( Slice *pSlice ) { if ((pSlice->getTLayer()==0) && (pSlice->isReferenceNalu() && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) { m_prevTid0POC=pSlice->getPOC(); } } #else diff --git a/source/Lib/DecoderLib/DecSlice.cpp b/source/Lib/DecoderLib/DecSlice.cpp index de211649ddd3426dbf20c3475d003fe71ff8ca3e..9e3b90fb681a25ecf7b4abe357ae7302b70d4372 100644 --- a/source/Lib/DecoderLib/DecSlice.cpp +++ b/source/Lib/DecoderLib/DecSlice.cpp @@ -70,11 +70,7 @@ void DecSlice::init( CABACDecoder* cabacDecoder, DecCu* pcCuDecoder ) m_pcCuDecoder = pcCuDecoder; } -#if JVET_M0055_DEBUG_CTU void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int debugCTU ) -#else -void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream ) -#endif { //-- For time output for each slice slice->startProcessingTimer(); @@ -91,9 +87,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream ) cs.slice = slice; cs.sps = sps; cs.pps = slice->getPPS(); -#if JVET_M0132_APS cs.aps = slice->getAPS(); -#endif #if HEVC_VPS cs.vps = slice->getVPS(); #endif @@ -239,31 +233,21 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream ) if ((cs.slice->getSliceType() != I_SLICE || cs.sps->getIBCFlag()) && ctuXPosInCtus == 0) { cs.motionLut.lut.resize(0); -#if JVET_M0483_IBC cs.motionLut.lutIbc.resize(0); -#endif -#if JVET_M0170_MRG_SHARELIST cs.motionLut.lutShare.resize(0); -#if JVET_M0483_IBC cs.motionLut.lutShareIbc.resize(0); -#endif -#endif } -#if JVET_M0445_MCTS_DEC_CHECK if( !cs.slice->isIntra() ) { pic->mctsInfo.init( &cs, getCtuAddr( ctuArea.lumaPos(), *( cs.pcv ) ) ); } -#endif -#if JVET_M0055_DEBUG_CTU if( ctuRsAddr == debugCTU ) { isLastCtuOfSliceSegment = true; // get out here break; } -#endif isLastCtuOfSliceSegment = cabacReader.coding_tree_unit( cs, ctuArea, pic->m_prevQP, ctuRsAddr ); m_pcCuDecoder->decompressCtu( cs, ctuArea ); diff --git a/source/Lib/DecoderLib/DecSlice.h b/source/Lib/DecoderLib/DecSlice.h index f4a14e5b7dc24b67b2b593106665f8de6056f851..c34b8a4d570f32472b89dc9a95d367b80d6f24e4 100644 --- a/source/Lib/DecoderLib/DecSlice.h +++ b/source/Lib/DecoderLib/DecSlice.h @@ -77,11 +77,7 @@ public: void create (); void destroy (); -#if JVET_M0055_DEBUG_CTU void decompressSlice ( Slice* slice, InputBitstream* bitstream, int debugCTU ); -#else - void decompressSlice ( Slice* slice, InputBitstream* bitstream ); -#endif }; //! \} diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index dc8b1f81e583caa2b4b2f68a21f14526af6692b1..896ca3944445b54420348ac33381dbe80de66f1f 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -413,21 +413,12 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); if( pcPPS->getUseDQP() ) { -#if JVET_M0113_M0188_QG_SIZE READ_UVLC( uiCode, "cu_qp_delta_subdiv" ); pcPPS->setCuQpDeltaSubdiv( uiCode ); -#else - READ_UVLC( uiCode, "diff_cu_qp_delta_depth" ); - pcPPS->setMaxCuDQPDepth( uiCode ); -#endif } else { -#if JVET_M0113_M0188_QG_SIZE pcPPS->setCuQpDeltaSubdiv( 0 ); -#else - pcPPS->setMaxCuDQPDepth( 0 ); -#endif } READ_SVLC( iCode, "pps_cb_qp_offset"); pcPPS->setQpOffset(COMPONENT_Cb, iCode); @@ -570,19 +561,11 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) if (uiCode == 0) { ppsRangeExtension.clearChromaQpOffsetList(); -#if JVET_M0113_M0188_QG_SIZE ppsRangeExtension.setCuChromaQpOffsetSubdiv(0); -#else - ppsRangeExtension.setDiffCuChromaQpOffsetDepth(0); -#endif } else { -#if JVET_M0113_M0188_QG_SIZE READ_UVLC(uiCode, "cu_chroma_qp_offset_subdiv"); ppsRangeExtension.setCuChromaQpOffsetSubdiv(uiCode); -#else - READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode); -#endif uint32_t tableSizeMinus1 = 0; READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1"); CHECK(tableSizeMinus1 >= MAX_QP_OFFSET_LIST_SIZE, "Table size exceeds maximum"); @@ -624,7 +607,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) xReadRbspTrailingBits(); } -#if JVET_M0132_APS void HLSyntaxReader::parseAPS(APS* aps) { #if ENABLE_TRACING @@ -668,7 +650,6 @@ void HLSyntaxReader::parseAPS(APS* aps) xReadRbspTrailingBits(); } -#endif void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) { @@ -845,7 +826,6 @@ void HLSyntaxReader::parseHrdParameters(HRD *hrd, bool commonInfPresentFlag, uin } } -#if JVET_M0427_INLOOP_RESHAPER void HLSyntaxReader::parseReshaper(SliceReshapeInfo& info, const SPS* pcSPS, const bool isIntra) { unsigned symbol = 0; @@ -882,7 +862,6 @@ void HLSyntaxReader::parseReshaper(SliceReshapeInfo& info, const SPS* pcSPS, con } } } -#endif void HLSyntaxReader::parseSPS(SPS* pcSPS) { uint32_t uiCode; @@ -905,28 +884,20 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG(uiCode, "no_sao_constraint_flag"); pcSPS->setNoSaoConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_alf_constraint_flag"); pcSPS->setNoAlfConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_pcm_constraint_flag"); pcSPS->setNoPcmConstraintFlag(uiCode > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(uiCode, "no_ref_wraparound_constraint_flag"); pcSPS->setNoRefWraparoundConstraintFlag(uiCode > 0 ? true : false); -#endif READ_FLAG(uiCode, "no_temporal_mvp_constraint_flag"); pcSPS->setNoTemporalMvpConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_sbtmvp_constraint_flag"); pcSPS->setNoSbtmvpConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_amvr_constraint_flag"); pcSPS->setNoAmvrConstraintFlag(uiCode > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(uiCode, "no_bdof_constraint_flag"); pcSPS->setNoBdofConstraintFlag(uiCode > 0 ? true : false); -#endif READ_FLAG(uiCode, "no_cclm_constraint_flag"); pcSPS->setNoCclmConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_mts_constraint_flag"); pcSPS->setNoMtsConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_affine_motion_constraint_flag"); pcSPS->setNoAffineMotionConstraintFlag(uiCode > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(uiCode, "no_gbi_constraint_flag"); pcSPS->setNoGbiConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_mh_intra_constraint_flag"); pcSPS->setNoMhIntraConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_triangle_constraint_flag"); pcSPS->setNoTriangleConstraintFlag(uiCode > 0 ? true : false); -#endif READ_FLAG(uiCode, "no_ladf_constraint_flag"); pcSPS->setNoLadfConstraintFlag(uiCode > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(uiCode, "no_curr_pic_ref_constraint_flag"); pcSPS->setNoCurrPicRefConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_qp_delta_constraint_flag"); pcSPS->setNoQpDeltaConstraintFlag(uiCode > 0 ? true : false); -#endif READ_FLAG(uiCode, "no_dep_quant_constraint_flag"); pcSPS->setNoDepQuantConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_sign_data_hiding_constraint_flag"); pcSPS->setNoSignDataHidingConstraintFlag(uiCode > 0 ? true : false); @@ -1097,11 +1068,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if (pcSPS->getWrapAroundEnabledFlag()) { -#if JVET_M0415_WRAPAROUND_HLS READ_UVLC(uiCode, "sps_ref_wraparound_offset_minus1"); pcSPS->setWrapAroundOffset( (uiCode+1)*(1 << pcSPS->getLog2MinCodingBlockSize())); -#else - READ_UVLC(uiCode, "sps_ref_wraparound_offset"); pcSPS->setWrapAroundOffset( uiCode ); -#endif } READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode); @@ -1119,38 +1086,23 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_bdof_enabled_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 ); -#if JVET_M0246_AFFINE_AMVR READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); -#endif -#if JVET_M0147_DMVR READ_FLAG(uiCode, "sps_dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0); -#endif // KJS: sps_cclm_enabled_flag READ_FLAG( uiCode, "lm_chroma_enabled_flag" ); pcSPS->setUseLMChroma ( uiCode != 0 ); -#if JVET_M0142_CCLM_COLLOCATED_CHROMA if ( pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420 ) { READ_FLAG( uiCode, "sps_cclm_collocated_chroma_flag" ); pcSPS->setCclmCollocatedChromaFlag( uiCode != 0 ); } -#endif -#if JVET_M0303_IMPLICIT_MTS READ_FLAG( uiCode, "mts_enabled_flag" ); pcSPS->setUseMTS ( uiCode != 0 ); if ( pcSPS->getUseMTS() ) { -#endif -#if JVET_M0464_UNI_MTS READ_FLAG( uiCode, "mts_intra_enabled_flag" ); pcSPS->setUseIntraMTS ( uiCode != 0 ); READ_FLAG( uiCode, "mts_inter_enabled_flag" ); pcSPS->setUseInterMTS ( uiCode != 0 ); -#else - READ_FLAG( uiCode, "emt_intra_enabled_flag" ); pcSPS->setUseIntraEMT ( uiCode != 0 ); - READ_FLAG( uiCode, "emt_inter_enabled_flag" ); pcSPS->setUseInterEMT ( uiCode != 0 ); -#endif -#if JVET_M0303_IMPLICIT_MTS } -#endif // KJS: sps_affine_enabled_flag READ_FLAG( uiCode, "affine_flag" ); pcSPS->setUseAffine ( uiCode != 0 ); if ( pcSPS->getUseAffine() ) @@ -1158,32 +1110,22 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 ); } READ_FLAG( uiCode, "gbi_flag" ); pcSPS->setUseGBi ( uiCode != 0 ); -#if JVET_M0483_IBC READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode); -#else - READ_FLAG( uiCode, "ibc_flag"); pcSPS->setIBCMode ( uiCode != 0 ); -#endif // KJS: sps_ciip_enabled_flag READ_FLAG( uiCode, "mhintra_flag" ); pcSPS->setUseMHIntra ( uiCode != 0 ); READ_FLAG( uiCode, "triangle_flag" ); pcSPS->setUseTriangle ( uiCode != 0 ); // KJS: not in draft yet -#if JVET_M0255_FRACMMVD_SWITCH READ_FLAG( uiCode, "sps_fracmmvd_disabled_flag" ); pcSPS->setDisFracMmvdEnabledFlag ( uiCode != 0 ); -#endif // KJS: not in draft yet -#if JVET_M0140_SBT READ_FLAG(uiCode, "sbt_enable_flag"); pcSPS->setUseSBT(uiCode != 0); if( pcSPS->getUseSBT() ) { READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(uiCode != 0 ? 64 : 32); } -#endif // KJS: not in draft yet -#if JVET_M0427_INLOOP_RESHAPER READ_FLAG(uiCode, "sps_reshaper_enable_flag"); pcSPS->setUseReshaper(uiCode == 1); -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET READ_FLAG( uiCode, "sps_ladf_enabled_flag" ); pcSPS->setLadfEnabled( uiCode != 0 ); @@ -1686,7 +1628,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para if( sps->getALFEnabledFlag() ) { -#if JVET_M0132_APS READ_FLAG(uiCode, "tile_group_alf_enabled_flag"); if (uiCode) { @@ -1701,9 +1642,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setAPSId(-1); pcSlice->setAPS(nullptr); } -#else - alf( pcSlice->getAlfSliceParam() ); -#endif } if (pcSlice->getIdrPicFlag()) @@ -1920,20 +1858,14 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } } -#if JVET_M0483_IBC if (!pcSlice->isIntra() || sps->getIBCFlag()) { READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); } -#endif if (!pcSlice->isIntra()) { -#if JVET_M0483_IBC==0 - READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); - pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); -#endif if ( sps->getSBTMVPEnabledFlag() && !sps->getUseAffine() ) // ATMVP only { @@ -1949,13 +1881,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para READ_UVLC( uiCode, "five_minus_max_num_affine_merge_cand" ); pcSlice->setMaxNumAffineMergeCand( AFFINE_MRG_MAX_NUM_CANDS - uiCode ); } -#if JVET_M0255_FRACMMVD_SWITCH if ( sps->getDisFracMmvdEnabledFlag() ) { READ_FLAG( uiCode, "tile_group_fracmmvd_disabled_flag" ); pcSlice->setDisFracMMVD( uiCode ? true : false ); } -#endif } READ_SVLC( iCode, "slice_qp_delta" ); @@ -2047,12 +1977,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } pcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); -#if JVET_M0427_INLOOP_RESHAPER if (sps->getUseReshaper()) { parseReshaper(pcSlice->getReshapeInfo(), sps, pcSlice->isIntra()); } -#endif #if HEVC_DEPENDENT_SLICES } #endif @@ -2158,28 +2086,20 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "no_sao_constraint_flag"); cinfo->setNoSaoConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_alf_constraint_flag"); cinfo->setNoAlfConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_pcm_constraint_flag"); cinfo->setNoPcmConstraintFlag(symbol > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(symbol, "no_ref_wraparound_constraint_flag"); cinfo->setNoRefWraparoundConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_temporal_mvp_constraint_flag"); cinfo->setNoTemporalMvpConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sbtmvp_constraint_flag"); cinfo->setNoSbtmvpConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_amvr_constraint_flag"); cinfo->setNoAmvrConstraintFlag(symbol > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(symbol, "no_bdof_constraint_flag"); cinfo->setNoBdofConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_cclm_constraint_flag"); cinfo->setNoCclmConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_mts_constraint_flag"); cinfo->setNoMtsConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_affine_motion_constraint_flag"); cinfo->setNoAffineMotionConstraintFlag(symbol > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(symbol, "no_gbi_constraint_flag"); cinfo->setNoGbiConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_mh_intra_constraint_flag"); cinfo->setNoMhIntraConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_triangle_constraint_flag"); cinfo->setNoTriangleConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_ladf_constraint_flag"); cinfo->setNoLadfConstraintFlag(symbol > 0 ? true : false); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX READ_FLAG(symbol, "no_curr_pic_ref_constraint_flag"); cinfo->setNoCurrPicRefConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_qp_delta_constraint_flag"); cinfo->setNoQpDeltaConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_dep_quant_constraint_flag"); cinfo->setNoDepQuantConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sign_data_hiding_constraint_flag"); cinfo->setNoSignDataHidingConstraintFlag(symbol > 0 ? true : false); } @@ -2602,46 +2522,6 @@ bool HLSyntaxReader::xMoreRbspData() return (cnt>0); } -#if !JVET_M0132_APS -void HLSyntaxReader::alf( AlfSliceParam& alfSliceParam ) -{ - uint32_t code; - READ_FLAG( code, "tile_group_alf_enabled_flag" ); - alfSliceParam.enabledFlag[COMPONENT_Y] = code ? true : false; - - if( !code ) - { - alfSliceParam.enabledFlag[COMPONENT_Cb] = alfSliceParam.enabledFlag[COMPONENT_Cr] = false; - return; - } - - int alfChromaIdc = truncatedUnaryEqProb( 3 ); //alf_chroma_idc - alfSliceParam.enabledFlag[COMPONENT_Cb] = alfChromaIdc >> 1; - alfSliceParam.enabledFlag[COMPONENT_Cr] = alfChromaIdc & 1; - - xReadTruncBinCode( code, MAX_NUM_ALF_CLASSES ); //number_of_filters_minus1 - alfSliceParam.numLumaFilters = code + 1; - if( alfSliceParam.numLumaFilters > 1 ) - { - for( int i = 0; i < MAX_NUM_ALF_CLASSES; i++ ) - { - xReadTruncBinCode( code, alfSliceParam.numLumaFilters ); - alfSliceParam.filterCoeffDeltaIdx[i] = code; - } - } - else - { - memset( alfSliceParam.filterCoeffDeltaIdx, 0, sizeof( alfSliceParam.filterCoeffDeltaIdx ) ); - } - - alfFilter( alfSliceParam, false ); - - if( alfChromaIdc ) - { - alfFilter( alfSliceParam, true ); - } -} -#endif int HLSyntaxReader::alfGolombDecode( const int k ) { diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h index f8be622d458581cef8e8a52be6ed34f7d6c3cd1b..01117b9f861d9c1892180848f638c93bf79b6178 100644 --- a/source/Lib/DecoderLib/VLCReader.h +++ b/source/Lib/DecoderLib/VLCReader.h @@ -152,9 +152,7 @@ public: #endif void parseSPS ( SPS* pcSPS ); void parsePPS ( PPS* pcPPS ); -#if JVET_M0132_APS void parseAPS ( APS* pcAPS); -#endif void parseVUI ( VUI* pcVUI, SPS* pcSPS ); #if !JVET_M0101_HLS void parsePTL ( PTL *rpcPTL, bool profilePresentFlag, int maxNumSubLayersMinus1 ); @@ -173,12 +171,7 @@ public: void parseScalingList ( ScalingList* scalingList ); void decodeScalingList ( ScalingList *scalingList, uint32_t sizeId, uint32_t listId); #endif -#if JVET_M0427_INLOOP_RESHAPER void parseReshaper ( SliceReshapeInfo& sliceReshaperInfo, const SPS* pcSPS, const bool isIntra ); -#endif -#if !JVET_M0132_APS - void alf( AlfSliceParam& alfSliceParam ); -#endif void alfFilter( AlfSliceParam& alfSliceParam, const bool isChroma ); private: diff --git a/source/Lib/EncoderLib/BinEncoder.cpp b/source/Lib/EncoderLib/BinEncoder.cpp index b80f248043c025257609c5e20cd200f323859972..ebad19d3e1a517e3a4cb087e59b9f29abc117329 100644 --- a/source/Lib/EncoderLib/BinEncoder.cpp +++ b/source/Lib/EncoderLib/BinEncoder.cpp @@ -207,12 +207,8 @@ void BinEncoderBase::encodeBinsEP( unsigned bins, unsigned numBins ) void BinEncoderBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) { -#if JVET_M0470 const unsigned threshold = COEF_REMAIN_BIN_REDUCTION << goRicePar; useLimitedPrefixLength = true; -#else - const unsigned threshold = g_auiGoRiceRange[goRicePar] << goRicePar; -#endif if( bins < threshold ) { const unsigned bitMask = ( 1 << goRicePar ) - 1; @@ -256,11 +252,7 @@ void BinEncoderBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool use bins -= delta; delta = 1 << (++length); } -#if JVET_M0470 unsigned numBin = COEF_REMAIN_BIN_REDUCTION + length + 1 - goRicePar; -#else - unsigned numBin = g_auiGoRiceRange[ goRicePar ] + length + 1 - goRicePar; -#endif encodeBinsEP( ( 1 << numBin ) - 2, numBin ); encodeBinsEP( bins, length ); } @@ -447,12 +439,8 @@ BitEstimatorBase::BitEstimatorBase( const BinProbModel* dummy ) void BitEstimatorBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) { -#if JVET_M0470 const unsigned threshold = COEF_REMAIN_BIN_REDUCTION << goRicePar; useLimitedPrefixLength = true; -#else - const unsigned threshold = g_auiGoRiceRange[goRicePar] << goRicePar; -#endif if( bins < threshold ) { m_EstFracBits += BinProbModelBase::estFracBitsEP( ( bins >> goRicePar ) + 1 + goRicePar ); @@ -488,11 +476,7 @@ void BitEstimatorBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool u bins -= delta; delta = 1 << (++length); } -#if JVET_M0470 m_EstFracBits += BinProbModelBase::estFracBitsEP(COEF_REMAIN_BIN_REDUCTION + 1 + (length << 1) - goRicePar); -#else - m_EstFracBits += BinProbModelBase::estFracBitsEP( g_auiGoRiceRange[ goRicePar ] + 1 + ( length << 1 ) - goRicePar ); -#endif } } diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 263a32b04b4c6e7122af51d74df2a473b4b2bf3d..cc7faea2c396aa80f40a856cd35b7d5673afb8ad 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -42,7 +42,6 @@ #include "CommonLib/UnitTools.h" #include "CommonLib/dtrace_buffer.h" -#include "CommonLib/BinaryDecisionTree.h" #include <map> #include <algorithm> @@ -375,46 +374,29 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione const CodingUnit &cu = *cs.getCU( currArea.blocks[partitioner.chType], partitioner.chType ); // Reset delta QP coding flag and ChromaQPAdjustemt coding flag -#if JVET_M0113_M0188_QG_SIZE if( pps.getUseDQP() && partitioner.currQgEnable() ) { cuCtx.qgStart = true; cuCtx.isDQPCoded = false; } if( cs.slice->getUseChromaQpAdj() && partitioner.currQgChromaEnable() ) -#else - if( pps.getUseDQP() && partitioner.currDepth <= pps.getMaxCuDQPDepth() ) - { - cuCtx.isDQPCoded = false; - } - if( cs.slice->getUseChromaQpAdj() && partitioner.currDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() ) -#endif { cuCtx.isChromaQpAdjCoded = false; } // Reset delta QP coding flag and ChromaQPAdjustemt coding flag if (CS::isDualITree(cs) && pPartitionerChroma != nullptr) { -#if JVET_M0113_M0188_QG_SIZE if (pps.getUseDQP() && pPartitionerChroma->currQgEnable()) { pCuCtxChroma->qgStart = true; pCuCtxChroma->isDQPCoded = false; } if (cs.slice->getUseChromaQpAdj() && pPartitionerChroma->currQgChromaEnable()) -#else - if (pps.getUseDQP() && pPartitionerChroma->currDepth <= pps.getMaxCuDQPDepth()) - { - pCuCtxChroma->isDQPCoded = false; - } - if (cs.slice->getUseChromaQpAdj() && pPartitionerChroma->currDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth()) -#endif { pCuCtxChroma->isChromaQpAdjCoded = false; } } -#if JVET_M0421_SPLIT_SIG const PartSplit splitMode = CU::getSplitAtDepth( cu, partitioner.currDepth ); split_cu_mode( splitMode, cs, partitioner ); @@ -423,27 +405,6 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione if( splitMode != CU_DONT_SPLIT ) { -#else - const PartSplit implicitSplit = partitioner.getImplicitSplit( cs ); - - // QT - bool canQtSplit = partitioner.canSplit( CU_QUAD_SPLIT, cs ); - - if( canQtSplit ) - { - // split_cu_flag - bool qtSplit = implicitSplit == CU_QUAD_SPLIT; - - if( !qtSplit && implicitSplit != CU_QUAD_SPLIT ) - { - qtSplit = ( cu.qtDepth > partitioner.currQtDepth ); - split_cu_flag( qtSplit, cs, partitioner ); - } - - // quad-tree split - if( qtSplit ) - { -#endif if (CS::isDualITree(cs) && pPartitionerChroma != nullptr && (partitioner.currArea().lwidth() >= 64 || partitioner.currArea().lheight() >= 64)) { partitioner.splitCurrArea(CU_QUAD_SPLIT, cs); @@ -488,11 +449,7 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione } else { -#if JVET_M0421_SPLIT_SIG partitioner.splitCurrArea( splitMode, cs ); -#else - partitioner.splitCurrArea( CU_QUAD_SPLIT, cs ); -#endif do { @@ -505,48 +462,12 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione partitioner.exitCurrSplit(); } return; -#if !JVET_M0421_SPLIT_SIG - } -#endif } -#if !JVET_M0421_SPLIT_SIG - { - bool mtSplit = partitioner.canSplit( CU_MT_SPLIT, cs ); - - if( mtSplit ) - { - const PartSplit splitMode = CU::getSplitAtDepth( cu, partitioner.currDepth ); - - split_cu_mode_mt( splitMode, cs, partitioner ); - - if( splitMode != CU_DONT_SPLIT ) - { - partitioner.splitCurrArea( splitMode, cs ); - do - { - if( cs.picture->blocks[partitioner.chType].contains( partitioner.currArea().blocks[partitioner.chType].pos() ) ) - { - coding_tree( cs, partitioner, cuCtx ); - } - } while( partitioner.nextPart( cs ) ); - - partitioner.exitCurrSplit(); - return; - } - } - } - -#endif // Predict QP on start of quantization group -#if JVET_M0113_M0188_QG_SIZE if( cuCtx.qgStart ) { cuCtx.qgStart = false; -#else - if( pps.getUseDQP() && !cuCtx.isDQPCoded && CU::isQGStart( cu, partitioner ) ) - { -#endif cuCtx.qp = CU::predictQP( cu, cuCtx.qp ); } @@ -558,7 +479,6 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione DTRACE_BLOCK_REC_COND( ( !isEncoding() ), cs.picture->getRecoBuf( cu ), cu, cu.predMode ); } -#if JVET_M0421_SPLIT_SIG void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& cs, Partitioner& partitioner ) { bool canNo, canQt, canBh, canBv, canTh, canTv; @@ -619,93 +539,6 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode() ctxHv=%d ctx12=%d mode=%d\n", ctxBttHV, isVer ? ctxBttV12 : ctxBttH12, split ); } -#else -void CABACWriter::split_cu_flag( bool split, const CodingStructure& cs, Partitioner& partitioner ) -{ - unsigned maxQTDepth = ( g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize(cs.slice->getSliceType(), partitioner.chType)] ); - if( partitioner.currDepth == maxQTDepth ) - { - return; - } - unsigned ctxId = DeriveCtx::CtxCUsplit( cs, partitioner ); - m_BinEncoder.encodeBin( (split), Ctx::SplitFlag(ctxId) ); - - DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_flag() ctx=%d split=%d\n", ctxId, split ? 1 : 0 ); -} - -void CABACWriter::split_cu_mode_mt(const PartSplit split, const CodingStructure& cs, Partitioner& partitioner) -{ - unsigned ctxIdBT = DeriveCtx::CtxBTsplit( cs, partitioner ); - - unsigned width = partitioner.currArea().lumaSize().width; - unsigned height = partitioner.currArea().lumaSize().height; - -#if REMOVE_BIN_DECISION_TREE - unsigned btSCtxId = width == height ? 0 : ( width > height ? 1 : 2 ); - - const bool canNo = partitioner.canSplit( CU_DONT_SPLIT, cs ); - const bool canBh = partitioner.canSplit( CU_HORZ_SPLIT, cs ); - const bool canBv = partitioner.canSplit( CU_VERT_SPLIT, cs ); - const bool canTh = partitioner.canSplit( CU_TRIH_SPLIT, cs ); - const bool canTv = partitioner.canSplit( CU_TRIV_SPLIT, cs ); - - const bool canSplit = canBh || canBv || canTh || canTv; - const bool isNo = split == CU_DONT_SPLIT; - - if( canNo && canSplit ) - { - m_BinEncoder.encodeBin( !isNo, Ctx::BTSplitFlag( ctxIdBT ) ); - } - - if( isNo ) - { - DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode_mt() ctx=%d split=%d\n", ctxIdBT, split ); - - return; - } - - const bool canHor = canBh || canTh; - const bool canVer = canBv || canTv; - const bool isVer = split == CU_VERT_SPLIT || split == CU_TRIV_SPLIT; - - if( canVer && canHor ) - { - m_BinEncoder.encodeBin( isVer, Ctx::BTSplitFlag( 12 + btSCtxId ) ); - } - - const bool can14 = isVer ? canTv : canTh; - const bool can12 = isVer ? canBv : canBh; - const bool is12 = isVer ? ( split == CU_VERT_SPLIT ) : ( split == CU_HORZ_SPLIT ); - - - if( can12 && can14 ) - { - m_BinEncoder.encodeBin( is12, Ctx::BTSplitFlag( 15 ) ); - } -#else - DecisionTree dt( g_mtSplitDTT ); - - dt.setAvail( DTT_SPLIT_BT_HORZ, partitioner.canSplit( CU_HORZ_SPLIT, cs ) ); - dt.setAvail( DTT_SPLIT_BT_VERT, partitioner.canSplit( CU_VERT_SPLIT, cs ) ); - - dt.setAvail( DTT_SPLIT_TT_HORZ, partitioner.canSplit( CU_TRIH_SPLIT, cs ) ); - dt.setAvail( DTT_SPLIT_TT_VERT, partitioner.canSplit( CU_TRIV_SPLIT, cs ) ); - dt.setAvail( DTT_SPLIT_NO_SPLIT, partitioner.canSplit( CU_DONT_SPLIT, cs ) ); - - unsigned btSCtxId = width == height ? 0 : ( width > height ? 1 : 2 ); - dt.setCtxId( DTT_SPLIT_DO_SPLIT_DECISION, Ctx::BTSplitFlag( ctxIdBT ) ); - dt.setCtxId( DTT_SPLIT_HV_DECISION, Ctx::BTSplitFlag( 12 + btSCtxId ) ); - - dt.setCtxId( DTT_SPLIT_H_IS_BT_12_DECISION, Ctx::BTSplitFlag( 15 ) ); - dt.setCtxId( DTT_SPLIT_V_IS_BT_12_DECISION, Ctx::BTSplitFlag( 15 ) ); - - - encode_sparse_dt( dt, split == CU_DONT_SPLIT ? ( unsigned ) DTT_SPLIT_NO_SPLIT : ( unsigned ) split ); -#endif - - DTRACE(g_trace_ctx, D_SYNTAX, "split_cu_mode_mt() ctx=%d split=%d\n", ctxIdBT, split); -} -#endif //================================================================================ // clause 7.3.8.5 @@ -737,11 +570,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C } // skip flag -#if JVET_M0483_IBC if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && cu.Y().valid()) -#else - if (!cs.slice->isIntra() && cu.Y().valid()) -#endif { cu_skip_flag( cu ); } @@ -787,9 +616,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C #endif extend_ref_line(cu); -#if JVET_M0102_INTRA_SUBPARTITIONS isp_mode( cu ); -#endif // prediction data ( intra prediction modes / reference indexes + motion vectors ) cu_pred_data( cu ); @@ -812,19 +639,16 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) { unsigned ctxId = DeriveCtx::CtxSkipFlag( cu ); -#if JVET_M0483_IBC if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag()) { m_BinEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId)); DTRACE(g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0); return; } -#endif m_BinEncoder.encodeBin( ( cu.skip ), Ctx::SkipFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0 ); -#if JVET_M0483_IBC if (cu.skip && cu.cs->slice->getSPS()->getIBCFlag()) { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); @@ -845,25 +669,13 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0); } #endif -#else -#if !JVET_MMVD_OFF_MACRO - if (cu.skip) - { - m_BinEncoder.encodeBin(cu.mmvdSkip, Ctx::MmvdFlag(0)); - DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0); - } -#endif -#endif } void CABACWriter::pred_mode( const CodingUnit& cu ) { -#if JVET_M0483_IBC if (cu.cs->slice->getSPS()->getIBCFlag()) { -#endif -#if JVET_M0483_IBC if (cu.cs->slice->isIntra()) { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); @@ -871,11 +683,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) } else { -#if JVET_M0502_PRED_MODE_CTX m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); -#else - m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode()); -#endif if (!CU::isIntra(cu)) { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); @@ -889,23 +697,8 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) { return; } -#if JVET_M0502_PRED_MODE_CTX m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); -#else - m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode()); -#endif - } -#else - if( cu.cs->slice->isIntra() ) - { - return; } -#if JVET_M0502_PRED_MODE_CTX - m_BinEncoder.encodeBin( ( CU::isIntra( cu ) ), Ctx::PredMode( DeriveCtx::CtxPredModeFlag( cu ) ) ); -#else - m_BinEncoder.encodeBin( ( CU::isIntra( cu ) ), Ctx::PredMode() ); -#endif -#endif } void CABACWriter::pcm_data( const CodingUnit& cu, Partitioner& partitioner ) @@ -948,9 +741,7 @@ void CABACWriter::cu_pred_data( const CodingUnit& cu ) } imv_mode ( cu ); -#if JVET_M0246_AFFINE_AMVR affine_amvr_mode( cu ); -#endif cu_gbi_flag( cu ); @@ -1138,11 +929,7 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu ) break; } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( pu->multiRefIdx || ( cu.ispMode && isLuma( cu.chType ) ) ) -#else - if (pu->multiRefIdx) -#endif { CHECK(mpm_idx >= numMPMs, "use of non-MPM"); } @@ -1229,11 +1016,7 @@ void CABACWriter::intra_luma_pred_mode( const PredictionUnit& pu ) break; } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( pu.multiRefIdx || ( pu.cu->ispMode && isLuma( pu.cu->chType ) ) ) -#else - if (pu.multiRefIdx) -#endif { CHECK(mpm_idx >= numMPMs, "use of non-MPM"); } @@ -1359,23 +1142,17 @@ void CABACWriter::intra_chroma_pred_mode( const PredictionUnit& pu ) void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, CUCtx& cuCtx ) { -#if JVET_M0483_IBC if (!CU::isIntra(cu)) -#else - if( CU::isInter( cu ) ) -#endif { PredictionUnit& pu = *cu.firstPU; if( !pu.mergeFlag ) { rqt_root_cbf( cu ); } -#if JVET_M0140_SBT if( cu.rootCbf ) { sbt_mode( cu ); } -#endif if( !cu.rootCbf ) { @@ -1385,7 +1162,6 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C ChromaCbfs chromaCbfs; -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode && isLuma( partitioner.chType ) ) { TUIntraSubPartitioner subTuPartitioner( partitioner ); @@ -1395,9 +1171,6 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C { transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); } -#else - transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); -#endif } void CABACWriter::rqt_root_cbf( const CodingUnit& cu ) @@ -1407,7 +1180,6 @@ void CABACWriter::rqt_root_cbf( const CodingUnit& cu ) DTRACE( g_trace_ctx, D_SYNTAX, "rqt_root_cbf() ctx=0 root_cbf=%d pos=(%d,%d)\n", cu.rootCbf ? 1 : 0, cu.lumaPos().x, cu.lumaPos().y ); } -#if JVET_M0140_SBT void CABACWriter::sbt_mode( const CodingUnit& cu ) { uint8_t sbtAllowed = cu.checkAllowedSbt(); @@ -1464,7 +1236,6 @@ void CABACWriter::sbt_mode( const CodingUnit& cu ) DTRACE( g_trace_ctx, D_SYNTAX, "sbt_mode() pos=(%d,%d) sbtInfo=%d\n", cu.lx(), cu.ly(), (int)cu.sbtInfo ); } -#endif void CABACWriter::end_of_ctu( const CodingUnit& cu, CUCtx& cuCtx ) { @@ -1528,13 +1299,11 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) } if( pu.mergeFlag ) { -#if JVET_M0483_IBC if (CU::isIBC(*pu.cu)) { merge_idx(pu); return; } -#endif subblock_merge_flag( *pu.cu ); MHIntra_flag( pu ); if ( pu.mhIntraFlag ) @@ -1549,44 +1318,29 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) else merge_idx ( pu ); } -#if JVET_M0483_IBC else if (CU::isIBC(*pu.cu)) { ref_idx(pu, REF_PIC_LIST_0); mvd_coding(pu.mvd[REF_PIC_LIST_0], pu.cu->imv); mvp_flag(pu, REF_PIC_LIST_0); } -#endif else { -#if JVET_M0246_AFFINE_AMVR int8_t affineMvdShift = pu.cu->imv ? ( pu.cu->imv == 1 ? -1 : 1 ) : 0; -#endif inter_pred_idc( pu ); affine_flag ( *pu.cu ); -#if JVET_M0444_SMVD smvd_mode( pu ); -#endif if( pu.interDir != 2 /* PRED_L1 */ ) { ref_idx ( pu, REF_PIC_LIST_0 ); if ( pu.cu->affine ) { -#if JVET_M0246_AFFINE_AMVR mvd_coding( pu.mvdAffi[REF_PIC_LIST_0][0], affineMvdShift ); mvd_coding( pu.mvdAffi[REF_PIC_LIST_0][1], affineMvdShift ); if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { mvd_coding( pu.mvdAffi[REF_PIC_LIST_0][2], affineMvdShift ); } -#else - mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][0], 0); - mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][1], 0); - if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) - { - mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][2], 0); - } -#endif } else { @@ -1596,45 +1350,31 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) } if( pu.interDir != 1 /* PRED_L0 */ ) { -#if JVET_M0444_SMVD if ( pu.cu->smvdMode != 1 ) { -#endif ref_idx ( pu, REF_PIC_LIST_1 ); if( !pu.cs->slice->getMvdL1ZeroFlag() || pu.interDir != 3 /* PRED_BI */ ) { if ( pu.cu->affine ) { -#if JVET_M0246_AFFINE_AMVR mvd_coding( pu.mvdAffi[REF_PIC_LIST_1][0], affineMvdShift ); mvd_coding( pu.mvdAffi[REF_PIC_LIST_1][1], affineMvdShift ); if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { mvd_coding( pu.mvdAffi[REF_PIC_LIST_1][2], affineMvdShift ); } -#else - mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][0], 0); - mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][1], 0); - if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) - { - mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][2], 0); - } -#endif } else { mvd_coding( pu.mvd[REF_PIC_LIST_1], pu.cu->imv ); } } -#if JVET_M0444_SMVD } -#endif mvp_flag ( pu, REF_PIC_LIST_1 ); } } } -#if JVET_M0444_SMVD void CABACWriter::smvd_mode( const PredictionUnit& pu ) { if ( pu.interDir != 3 || pu.cu->affine ) @@ -1651,7 +1391,6 @@ void CABACWriter::smvd_mode( const PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "symmvd_flag() symmvd=%d pos=(%d,%d) size=%dx%d\n", pu.cu->smvdMode ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height ); } -#endif void CABACWriter::subblock_merge_flag( const CodingUnit& cu ) { @@ -1691,12 +1430,10 @@ void CABACWriter::merge_flag( const PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height ); -#if JVET_M0483_IBC if (pu.mergeFlag && CU::isIBC(*pu.cu)) { return; } -#endif #if !JVET_MMVD_OFF_MACRO if (pu.mergeFlag) { @@ -1714,12 +1451,10 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) { return; } -#if JVET_M0246_AFFINE_AMVR if ( cu.affine ) { return; } -#endif bool bNonZeroMvd = CU::hasSubCUNonZeroMVd( cu ); if( !bNonZeroMvd ) @@ -1728,11 +1463,7 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) } unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); -#if JVET_M0483_IBC if (CU::isIBC(cu) == false) -#else - if (!(cu.firstPU->interDir == 1 && cu.cs->slice->getRefPic(REF_PIC_LIST_0, cu.firstPU->refIdx[REF_PIC_LIST_0])->getPOC() == cu.cs->slice->getPOC())) // the first bin of IMV flag does need to be signaled in IBC block -#endif m_BinEncoder.encodeBin( ( cu.imv > 0 ), Ctx::ImvFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 0), ctxId ); @@ -1745,7 +1476,6 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() IMVFlag=%d\n", cu.imv ); } -#if JVET_M0246_AFFINE_AMVR void CABACWriter::affine_amvr_mode( const CodingUnit& cu ) { const SPS* sps = cu.slice->getSPS(); @@ -1770,7 +1500,6 @@ void CABACWriter::affine_amvr_mode( const CodingUnit& cu ) } DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() IMVFlag=%d\n", cu.imv ); } -#endif void CABACWriter::merge_idx( const PredictionUnit& pu ) { @@ -1788,24 +1517,10 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) } else { -#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - bool useExtCtx = pu.cs->sps->getSBTMVPEnabledFlag(); -#endif m_BinEncoder.encodeBin( 1, Ctx::AffMergeIdx() ); for ( unsigned idx = 1; idx < numCandminus1; idx++ ) { -#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - if ( useExtCtx ) - { - m_BinEncoder.encodeBin( pu.mergeIdx == idx ? 0 : 1, Ctx::AffMergeIdx( std::min<int>( idx, NUM_MERGE_IDX_EXT_CTX - 1 ) ) ); - } - else - { -#endif m_BinEncoder.encodeBinEP( pu.mergeIdx == idx ? 0 : 1 ); -#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX - } -#endif if ( pu.mergeIdx == idx ) { break; @@ -1819,7 +1534,6 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) { if( pu.cu->triangle ) { -#if JVET_M0883_TRIANGLE_SIGNALING bool splitDir = pu.triangleSplitDir; uint8_t candIdx0 = pu.triangleMergeIdx0; uint8_t candIdx1 = pu.triangleMergeIdx1; @@ -1850,20 +1564,6 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) m_BinEncoder.encodeBinEP(splitDir); encodeOneIdx(candIdx0, TRIANGLE_MAX_NUM_UNI_CANDS - 1); encodeOneIdx(candIdx1, TRIANGLE_MAX_NUM_UNI_CANDS - 2); -#else - if( pu.mergeIdx < 2 ) - { - m_BinEncoder.encodeBin( 0, Ctx::TriangleIdx() ); - m_BinEncoder.encodeBinEP( pu.mergeIdx ); - } - else - { - m_BinEncoder.encodeBin( 1, Ctx::TriangleIdx() ); - exp_golomb_eqprob( pu.mergeIdx - 2, 2 ); - } - - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx=%d\n", pu.mergeIdx ); -#endif return; } int numCandminus1 = int( pu.cs->slice->getMaxNumMergeCand() ) - 1; @@ -1975,23 +1675,19 @@ void CABACWriter::inter_pred_idc( const PredictionUnit& pu ) void CABACWriter::ref_idx( const PredictionUnit& pu, RefPicList eRefList ) { -#if JVET_M0444_SMVD if ( pu.cu->smvdMode ) { CHECK( pu.refIdx[eRefList] != pu.cs->slice->getSymRefIdx( eRefList ), "Invalid reference index!\n" ); return; } -#endif int numRef = pu.cs->slice->getNumRefIdx(eRefList); -#if JVET_M0483_IBC if (eRefList == REF_PIC_LIST_0 && pu.cs->sps->getIBCFlag()) { if (CU::isIBC(*pu.cu)) return; } -#endif if( numRef <= 1 ) { @@ -2130,7 +1826,6 @@ void CABACWriter::triangle_mode( const CodingUnit& cu ) return; } -#if JVET_M0118_M0185_TRIANGLE_FLAG_FIX if ( cu.firstPU->mmvdMergeFlag || cu.mmvdSkip ) { return; @@ -2140,7 +1835,6 @@ void CABACWriter::triangle_mode( const CodingUnit& cu ) { return; } -#endif unsigned flag_idx = DeriveCtx::CtxTriangleFlag( cu ); @@ -2191,66 +1885,41 @@ void CABACWriter::pcm_samples( const TransformUnit& tu ) // bool cbf_comp ( cbf, area, depth ) //================================================================================ -#if JVET_M0102_INTRA_SUBPARTITIONS void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partitioner, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType, const int subTuIdx ) -#else -void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partitioner, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ) -#endif { -#if JVET_M0140_SBT ChromaCbfs chromaCbfsLastDepth; chromaCbfsLastDepth.Cb = chromaCbfs.Cb; chromaCbfsLastDepth.Cr = chromaCbfs.Cr; -#endif const UnitArea& area = partitioner.currArea(); -#if JVET_M0102_INTRA_SUBPARTITIONS int subTuCounter = subTuIdx; const TransformUnit& tu = *cs.getTU( area.blocks[partitioner.chType].pos(), partitioner.chType, subTuIdx ); -#else - const TransformUnit& tu = *cs.getTU( area.blocks[partitioner.chType].pos(), partitioner.chType ); -#endif const CodingUnit& cu = *tu.cu; const unsigned trDepth = partitioner.currTrDepth; const bool split = ( tu.depth > trDepth ); -#if JVET_M0102_INTRA_SUBPARTITIONS const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode && !split; -#endif // split_transform_flag if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { CHECK( !split, "transform split implied" ); } -#if JVET_M0140_SBT else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { CHECK( !split, "transform split implied - sbt" ); } -#endif else -#if JVET_M0102_INTRA_SUBPARTITIONS CHECK( split && !cu.ispMode, "transform split not allowed with QTBT" ); -#else - CHECK( split, "transform split not allowed with QTBT" ); -#endif // cbf_cb & cbf_cr -#if JVET_M0102_INTRA_SUBPARTITIONS if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) -#else - if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) ) -#endif { { -#if JVET_M0102_INTRA_SUBPARTITIONS unsigned cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; if( trDepth == 0 || chromaCbfs.Cb || chromaCbfISP ) { chromaCbfs.Cb = TU::getCbfAtDepth( tu, COMPONENT_Cb, trDepth ); -#if JVET_M0140_SBT if( !( cu.sbtInfo && trDepth == 1 ) ) -#endif cbf_comp( cs, chromaCbfs.Cb, area.blocks[COMPONENT_Cb], cbfDepth ); } else @@ -2261,42 +1930,13 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit if( trDepth == 0 || chromaCbfs.Cr || chromaCbfISP ) { chromaCbfs.Cr = TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ); -#if JVET_M0140_SBT if( !( cu.sbtInfo && trDepth == 1 ) ) -#endif cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr], cbfDepth, chromaCbfs.Cb ); } else { CHECK( TU::getCbfAtDepth( tu, COMPONENT_Cr, cbfDepth ) != chromaCbfs.Cr, "incorrect Cr cbf" ); } -#else - if( trDepth == 0 || chromaCbfs.Cb ) - { - chromaCbfs.Cb = TU::getCbfAtDepth( tu, COMPONENT_Cb, trDepth ); -#if JVET_M0140_SBT - if( !( cu.sbtInfo && trDepth == 1 ) ) -#endif - cbf_comp( cs, chromaCbfs.Cb, area.blocks[COMPONENT_Cb], trDepth ); - } - else - { - CHECK( TU::getCbfAtDepth( tu, COMPONENT_Cb, trDepth ) != chromaCbfs.Cb, "incorrect Cb cbf" ); - } - - if( trDepth == 0 || chromaCbfs.Cr ) - { - chromaCbfs.Cr = TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ); -#if JVET_M0140_SBT - if( !( cu.sbtInfo && trDepth == 1 ) ) -#endif - cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr], trDepth, chromaCbfs.Cb ); - } - else - { - CHECK( TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ) != chromaCbfs.Cr, "incorrect Cr cbf" ); - } -#endif } } else if( CS::isDualITree( cs ) ) @@ -2311,13 +1951,6 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit chromaCbfs.Cb = TU::getCbfAtDepth( tu, COMPONENT_Cb, trDepth ); chromaCbfs.Cr = TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ); } -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - if ( trDepth == 0 && !cu.ispMode ) emt_cu_flag( cu ); -#else - if( trDepth == 0 ) emt_cu_flag( cu ); -#endif -#endif if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { @@ -2328,30 +1961,22 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit #endif partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( cu.ispMode ) { partitioner.splitCurrArea( ispType, cs ); } -#endif -#if JVET_M0140_SBT else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { partitioner.splitCurrArea( PartSplit( cu.getSbtTuSplit() ), cs ); } -#endif else THROW( "Implicit TU split not available" ); do { ChromaCbfs subChromaCbfs = chromaCbfs; -#if JVET_M0102_INTRA_SUBPARTITIONS transform_tree( cs, partitioner, cuCtx, subChromaCbfs, ispType, subTuCounter ); subTuCounter += subTuCounter != -1 ? 1 : 0; -#else - transform_tree( cs, partitioner, cuCtx, subChromaCbfs ); -#endif } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); @@ -2366,7 +1991,6 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit { CHECK( !TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), "Luma cbf must be true for inter units with no chroma coeffs" ); } -#if JVET_M0140_SBT else if( cu.sbtInfo && tu.noResidual ) { CHECK( TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), "Luma cbf must be false for inter sbt no-residual tu" ); @@ -2376,10 +2000,8 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit assert( !tu.noResidual ); CHECK( !TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), "Luma cbf must be true for inter sbt residual tu" ); } -#endif else { -#if JVET_M0102_INTRA_SUBPARTITIONS bool previousCbf = false; bool rootCbfSoFar = false; bool lastCbfIsInferred = false; @@ -2408,29 +2030,17 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit { cbf_comp( cs, TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), tu.Y(), trDepth, previousCbf, cu.ispMode ); } -#else - cbf_comp( cs, TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), tu.Y(), trDepth ); -#endif } } -#if !JVET_M0464_UNI_MTS - if( trDepth == 0 && TU::getCbfAtDepth( tu, COMPONENT_Y, 0 ) ) emt_cu_flag( cu ); -#endif transform_unit( tu, cuCtx, chromaCbfs ); } } -#if JVET_M0102_INTRA_SUBPARTITIONS void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbCbf, const bool useISP ) { const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbCbf, useISP && isLuma(area.compID) ); -#else -void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbCbf ) -{ - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbCbf ); -#endif const CtxSet& ctxSet = Ctx::QtCbf[ area.compID ]; m_BinEncoder.encodeBin( cbf, ctxSet( ctxId ) ); @@ -2446,19 +2056,11 @@ void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& //-------------------------------------------------------------------------------- // void mvd_coding( pu, refList ) //================================================================================ -#if JVET_M0246_AFFINE_AMVR void CABACWriter::mvd_coding( const Mv &rMvd, int8_t imv ) -#else -void CABACWriter::mvd_coding( const Mv &rMvd, uint8_t imv ) -#endif { int horMvd = rMvd.getHor(); int verMvd = rMvd.getVer(); -#if JVET_M0246_AFFINE_AMVR if ( imv > 0 ) -#else - if( imv ) -#endif { CHECK( (horMvd % 4) != 0 && (verMvd % 4) != 0, "IMV: MVD is not a multiple of 4" ); horMvd >>= 2; @@ -2526,11 +2128,7 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC bool cbfLuma = ( cbf[ COMPONENT_Y ] != 0 ); bool cbfChroma = false; -#if JVET_M0102_INTRA_SUBPARTITIONS if( !lumaOnly ) -#else - if( cu.chromaFormat != CHROMA_400 ) -#endif { if( tu.blocks[COMPONENT_Cb].valid() ) { @@ -2638,21 +2236,13 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) DTRACE( g_trace_ctx, D_SYNTAX, "residual_coding() etype=%d pos=(%d,%d) size=%dx%d predMode=%d\n", tu.blocks[compID].compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.blocks[compID].width, tu.blocks[compID].height, cu.predMode ); // code transform skip and explicit rdpcm mode -#if JVET_M0464_UNI_MTS mts_coding ( tu, compID ); -#else - transform_skip_flag( tu, compID ); -#endif explicit_rdpcm_mode( tu, compID ); #if HEVC_USE_SIGN_HIDING // determine sign hiding bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); -#if JVET_M0464_UNI_MTS if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==1 ) -#else - if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.transformSkip[compID] ) -#endif { const ChannelType chType = toChannelType( compID ); const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType ); @@ -2670,9 +2260,6 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) CoeffCodingContext cctx ( tu, compID ); #endif const TCoeff* coeff = tu.getCoeffs( compID ).buf; -#if !JVET_M0464_UNI_MTS - unsigned numSig = 0; -#endif // determine and set last coeff position and sig group flags int scanPosLast = -1; @@ -2690,43 +2277,16 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) cctx.setScanPosLast(scanPosLast); // code last coeff position -#if JVET_M0297_32PT_MTS_ZERO_OUT last_sig_coeff( cctx, tu, compID ); -#else - last_sig_coeff( cctx ); -#endif // code subblocks const int stateTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; -#if !JVET_M0464_UNI_MTS - bool useEmt = ( cu.cs->sps->getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getUseInterEMT() && cu.predMode == MODE_INTER ); - useEmt = useEmt && isLuma(compID); -#if JVET_M0102_INTRA_SUBPARTITIONS - useEmt = useEmt && !cu.ispMode; -#endif -#if JVET_M0140_SBT - useEmt = useEmt && !cu.sbtInfo; -#endif -#endif for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--) { cctx.initSubblock ( subSetId, sigGroupFlags[subSetId] ); -#if JVET_M0297_32PT_MTS_ZERO_OUT -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( ( tu.cu->emtFlag && !tu.transformSkip[ compID ] ) || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#else -#if JVET_M0464_UNI_MTS - if( tu.mtsIdx > 1 && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( tu.cu->emtFlag && !tu.transformSkip[ compID ] && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#endif { if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) ) || ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) ) @@ -2734,35 +2294,13 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) continue; } } -#endif residual_coding_subblock( cctx, coeff, stateTab, state ); -#if !JVET_M0464_UNI_MTS - if (useEmt) - { - numSig += cctx.emtNumSigCoeff(); - cctx.setEmtNumSigCoeff( 0 ); - } -#endif } -#if !JVET_M0464_UNI_MTS - if( useEmt && !tu.transformSkip[compID] && compID == COMPONENT_Y && tu.cu->emtFlag ) - { - if( CU::isIntra( *tu.cu ) ) - { - emt_tu_index(tu); - } - else - { - emt_tu_index( tu ); - } - } -#endif } -#if JVET_M0464_UNI_MTS void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID ) { const CodingUnit &cu = *tu.cu; @@ -2808,97 +2346,7 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID ) DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), tu.mtsIdx ); } -#else -void CABACWriter::transform_skip_flag( const TransformUnit& tu, ComponentID compID ) -{ -#if JVET_M0102_INTRA_SUBPARTITIONS - if (!tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag(*tu.cs, tu.blocks[compID]) || (isLuma(compID) && tu.cu->emtFlag) || (tu.cu->ispMode && isLuma(compID))) -#else - if( !tu.cu->cs->pps->getUseTransformSkip() || tu.cu->transQuantBypass || !TU::hasTransformSkipFlag( *tu.cs, tu.blocks[compID] ) || ( isLuma( compID ) && tu.cu->emtFlag ) ) -#endif - { - return; - } -#if JVET_M0140_SBT - if( tu.cu->sbtInfo ) - { - return; - } -#endif - m_BinEncoder.encodeBin( tu.transformSkip[compID], Ctx::TransformSkipFlag(toChannelType(compID)) ); - - DTRACE( g_trace_ctx, D_SYNTAX, "transform_skip_flag() etype=%d pos=(%d,%d) trSkip=%d\n", compID, tu.blocks[compID].x, tu.blocks[compID].y, (int)tu.transformSkip[compID] ); -} - -void CABACWriter::emt_tu_index( const TransformUnit& tu ) -{ - int maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - int maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - - if( CU::isIntra( *tu.cu ) && ( tu.cu->Y().width <= maxSizeEmtIntra ) && ( tu.cu->Y().height <= maxSizeEmtIntra ) ) - { - uint8_t trIdx = tu.emtIdx; - m_BinEncoder.encodeBin( ( trIdx & 1 ) ? 1 : 0, Ctx::EMTTuIndex( 0 ) ); - m_BinEncoder.encodeBin( ( trIdx / 2 ) ? 1 : 0, Ctx::EMTTuIndex( 1 ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "emt_tu_index() etype=%d pos=(%d,%d) emtTrIdx=%d\n", COMPONENT_Y, tu.blocks[COMPONENT_Y].x, tu.blocks[COMPONENT_Y].y, ( int ) tu.emtIdx ); - } - if( !CU::isIntra( *tu.cu ) && ( tu.cu->Y().width <= maxSizeEmtInter ) && ( tu.cu->Y().height <= maxSizeEmtInter ) ) - { - uint8_t trIdx = tu.emtIdx; - m_BinEncoder.encodeBin( ( trIdx & 1 ) ? 1 : 0, Ctx::EMTTuIndex( 2 ) ); - m_BinEncoder.encodeBin( ( trIdx / 2 ) ? 1 : 0, Ctx::EMTTuIndex( 3 ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "emt_tu_index() etype=%d pos=(%d,%d) emtTrIdx=%d\n", COMPONENT_Y, tu.blocks[COMPONENT_Y].x, tu.blocks[COMPONENT_Y].y, ( int ) tu.emtIdx ); - } -} - -//void CABACWriter::emt_cu_flag(const CodingUnit& cu, uint32_t depth, bool codeCuFlag, const int tuWidth,const int tuHeight) -void CABACWriter::emt_cu_flag( const CodingUnit& cu ) -{ -#if JVET_M0102_INTRA_SUBPARTITIONS - if ( CU::isIntra( cu ) && cu.ispMode ) - { - return; - } -#endif -#if JVET_M0140_SBT - if( cu.sbtInfo ) - { - return; - } -#endif - const CodingStructure& cs = *cu.cs; - -#if JVET_M0483_IBC - if (!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType)) -#else - if( !( ( cs.sps->getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) ) -#endif - { - return; - } - - unsigned depth = cu.qtDepth; - const unsigned cuWidth = cu.lwidth(); - const unsigned cuHeight = cu.lheight(); - - if( depth >= NUM_EMT_CU_FLAG_CTX ) - { - depth = NUM_EMT_CU_FLAG_CTX - 1; - } - int maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - int maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - - const unsigned maxSizeEmt = CU::isIntra( cu ) ? maxSizeEmtIntra : maxSizeEmtInter; - - if( cuWidth <= maxSizeEmt && cuHeight <= maxSizeEmt ) - { - m_BinEncoder.encodeBin( cu.emtFlag, Ctx::EMTCuFlag( depth ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "emt_cu_flag() etype=%d pos=(%d,%d) emtCuFlag=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), ( int ) cu.emtFlag ); - } -} -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS void CABACWriter::isp_mode( const CodingUnit& cu ) { if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm ) @@ -2924,16 +2372,11 @@ void CABACWriter::isp_mode( const CodingUnit& cu ) } DTRACE( g_trace_ctx, D_SYNTAX, "intra_subPartitions() etype=%d pos=(%d,%d) ispIdx=%d\n", cu.chType, cu.blocks[cu.chType].x, cu.blocks[cu.chType].y, (int)cu.ispMode ); } -#endif void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID compID ) { const CodingUnit& cu = *tu.cu; -#if JVET_M0464_UNI_MTS if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==1 || cu.transQuantBypass ) ) -#else - if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.transformSkip[compID] || cu.transQuantBypass ) ) -#endif { ChannelType chType = toChannelType( compID ); switch( tu.rdpcm[compID] ) @@ -2953,11 +2396,7 @@ void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID comp } -#if JVET_M0297_32PT_MTS_ZERO_OUT void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx, const TransformUnit& tu, ComponentID compID ) -#else -void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx ) -#endif { unsigned blkPos = cctx.blockPos( cctx.scanPosLast() ); unsigned posX, posY; @@ -2978,38 +2417,20 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx ) unsigned GroupIdxX = g_uiGroupIdx[ posX ]; unsigned GroupIdxY = g_uiGroupIdx[ posY ]; -#if JVET_M0297_32PT_MTS_ZERO_OUT unsigned maxLastPosX = cctx.maxLastPosX(); unsigned maxLastPosY = cctx.maxLastPosY(); -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( ( tu.cu->emtFlag && !tu.transformSkip[ compID ] ) || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#else -#if JVET_M0464_UNI_MTS - if( tu.mtsIdx > 1 && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( tu.cu->emtFlag && !tu.transformSkip[ compID ] && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif -#endif { maxLastPosX = ( tu.blocks[compID].width == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosX; maxLastPosY = ( tu.blocks[compID].height == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosY; } -#endif for( CtxLast = 0; CtxLast < GroupIdxX; CtxLast++ ) { m_BinEncoder.encodeBin( 1, cctx.lastXCtxId( CtxLast ) ); } -#if JVET_M0297_32PT_MTS_ZERO_OUT if( GroupIdxX < maxLastPosX ) -#else - if( GroupIdxX < cctx.maxLastPosX() ) -#endif { m_BinEncoder.encodeBin( 0, cctx.lastXCtxId( CtxLast ) ); } @@ -3017,11 +2438,7 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx ) { m_BinEncoder.encodeBin( 1, cctx.lastYCtxId( CtxLast ) ); } -#if JVET_M0297_32PT_MTS_ZERO_OUT if( GroupIdxY < maxLastPosY ) -#else - if( GroupIdxY < cctx.maxLastPosY() ) -#endif { m_BinEncoder.encodeBin( 0, cctx.lastYCtxId( CtxLast ) ); } @@ -3079,22 +2496,10 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe int numNonZero = 0; unsigned signPattern = 0; bool is2x2subblock = ( cctx.log2CGSize() == 2 ); -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); -#else - int remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK ); - int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ) - remGt2Bins; -#endif int firstPosMode2 = minSubPos - 1; -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - int firstPosMode1 = minSubPos - 1; -#endif -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS for( ; nextSigPos >= minSubPos && remRegBins >= 4; nextSigPos-- ) -#else - for( ; nextSigPos >= minSubPos && remRegBins >= 3; nextSigPos-- ) -#endif { TCoeff Coeff = coeff[ cctx.blockPos( nextSigPos ) ]; unsigned sigFlag = ( Coeff != 0 ); @@ -3133,52 +2538,22 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe remAbsLevel >>= 1; remRegBins--; -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS unsigned gt2 = !!remAbsLevel; m_BinEncoder.encodeBin(gt2, cctx.greater2CtxIdAbs(ctxOff)); DTRACE(g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2, cctx.greater2CtxIdAbs(ctxOff)); remRegBins--; -#else - if( remGt2Bins && !--remGt2Bins ) - { - firstPosMode1 = nextSigPos - 1; - } -#endif } } state = ( stateTransTable >> ((state<<2)+((Coeff&1)<<1)) ) & 3; } firstPosMode2 = nextSigPos; -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - firstPosMode1 = ( firstPosMode1 > firstPosMode2 ? firstPosMode1 : firstPosMode2 ); -#endif -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - //===== 2nd PASS: gt2 ===== - for( int scanPos = firstSigPos; scanPos > firstPosMode1; scanPos-- ) - { - unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] ); - if( absLevel >= 2 ) - { - uint8_t& ctxOff = ctxOffset[ scanPos - minSubPos ]; - unsigned gt2 = ( absLevel >= 4 ); - m_BinEncoder.encodeBin( gt2, cctx.greater2CtxIdAbs(ctxOff) ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2, cctx.greater2CtxIdAbs(ctxOff) ); - } - } -#endif -#if JVET_M0173_MOVE_GT2_TO_FIRST_PASS //===== 2nd PASS: Go-rice codes ===== unsigned ricePar = 0; for( int scanPos = firstSigPos; scanPos > firstPosMode2; scanPos-- ) -#else - //===== 3rd PASS: Go-rice codes ===== - unsigned ricePar = 0; - for( int scanPos = firstSigPos; scanPos > firstPosMode1; scanPos-- ) -#endif { unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] ); if( absLevel >= 4 ) @@ -3192,22 +2567,6 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe } } } -#if !JVET_M0173_MOVE_GT2_TO_FIRST_PASS - for( int scanPos = firstPosMode1; scanPos > firstPosMode2; scanPos-- ) - { - unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] ); - if( absLevel >= 2 ) - { - unsigned rem = ( absLevel - 2 ) >> 1; - m_BinEncoder.encodeRemAbsEP( rem, ricePar, cctx.extPrec(), cctx.maxLog2TrDRange() ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, ricePar ); - if( ricePar < 3 && rem > (3<<ricePar)-1 ) - { - ricePar++; - } - } - } -#endif //===== coeff bypass ==== for( int scanPos = firstPosMode2; scanPos >= minSubPos; scanPos-- ) @@ -3244,9 +2603,6 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe #else m_BinEncoder.encodeBinsEP( signPattern, numNonZero ); #endif -#if !JVET_M0464_UNI_MTS - cctx.setEmtNumSigCoeff(numNonZero); -#endif } @@ -3362,57 +2718,6 @@ void CABACWriter::exp_golomb_eqprob( unsigned symbol, unsigned count ) m_BinEncoder.encodeBinsEP( bins, numBins ); } -#if !REMOVE_BIN_DECISION_TREE -void CABACWriter::encode_sparse_dt( DecisionTree& dt, unsigned toCodeId ) -{ - // propagate the sparsity information from end-nodes to intermediate nodes - dt.reduce(); - - unsigned depth = dt.dtt.depth; - unsigned offset = 0; - - const unsigned encElPos = dt.dtt.mapping[toCodeId]; - - while( dt.dtt.hasSub[offset] ) - { - CHECKD( depth == 0, "Depth is '0' for a decision node in a decision tree" ); - - const unsigned posRight = offset + 1; - const unsigned posLeft = offset + ( 1u << depth ); - - const bool isLeft = encElPos >= posLeft; - - if( dt.isAvail[posRight] && dt.isAvail[posLeft] ) - { - // encode the decision as both sub-paths are available - const unsigned ctxId = dt.ctxId[offset]; - - if( ctxId > 0 ) - { - DTRACE( g_trace_ctx, D_DECISIONTREE, "Decision coding using context %d\n", ctxId - 1 ); - m_BinEncoder.encodeBin( isLeft ? 0 : 1, ctxId - 1 ); - } - else - { - DTRACE( g_trace_ctx, D_DECISIONTREE, "Decision coding as an EP bin\n" ); - m_BinEncoder.encodeBinEP( isLeft ? 0 : 1 ); - } - } - - DTRACE( g_trace_ctx, D_DECISIONTREE, "Following the tree to the %s sub-node\n", isLeft ? "left" : "right" ); - - offset = isLeft ? posLeft : posRight; - depth--; - } - - CHECKD( offset != encElPos, "Encoded a different element than assigned" ); - CHECKD( dt.dtt.ids[offset] != toCodeId, "Encoded a different element than assigned" ); - CHECKD( dt.isAvail[offset] == false, "The encoded element is not available" ); - DTRACE( g_trace_ctx, D_DECISIONTREE, "Found an end-node of the tree\n" ); - return; -} - -#endif void CABACWriter::codeAlfCtuEnableFlags( CodingStructure& cs, ChannelType channel, AlfSliceParam* alfParam) { if( isLuma( channel ) ) @@ -3440,11 +2745,7 @@ void CABACWriter::codeAlfCtuEnableFlags( CodingStructure& cs, ComponentID compID void CABACWriter::codeAlfCtuEnableFlag( CodingStructure& cs, uint32_t ctuRsAddr, const int compIdx, AlfSliceParam* alfParam) { -#if JVET_M0132_APS const AlfSliceParam& alfSliceParam = alfParam ? (*alfParam) : cs.aps->getAlfAPSParam(); -#else - AlfSliceParam& alfSliceParam = alfParam ? (*alfParam) : cs.slice->getAlfSliceParam(); -#endif if( cs.sps->getALFEnabledFlag() && alfSliceParam.enabledFlag[compIdx] ) { diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index ab7ebb08f54bb6a40e53a65456baa0aa6c5ba64f..bebfb8af099a70fe67191e6524c9207ac279cca7 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -82,12 +82,7 @@ public: void sao_offset_pars ( const SAOOffset& ctbPars, ComponentID compID, bool sliceEnabled, int bitDepth ); // coding (quad)tree (clause 7.3.8.4) void coding_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, Partitioner* pPartitionerChroma = nullptr, CUCtx* pCuCtxChroma = nullptr); -#if JVET_M0421_SPLIT_SIG void split_cu_mode ( const PartSplit split, const CodingStructure& cs, Partitioner& pm ); -#else - void split_cu_flag ( bool split, const CodingStructure& cs, Partitioner& pm ); - void split_cu_mode_mt ( const PartSplit split, const CodingStructure& cs, Partitioner& pm ); -#endif // coding unit (clause 7.3.8.5) void coding_unit ( const CodingUnit& cu, Partitioner& pm, CUCtx& cuCtx ); @@ -107,9 +102,7 @@ public: void intra_chroma_pred_mode ( const PredictionUnit& pu ); void cu_residual ( const CodingUnit& cu, Partitioner& pm, CUCtx& cuCtx ); void rqt_root_cbf ( const CodingUnit& cu ); -#if JVET_M0140_SBT void sbt_mode ( const CodingUnit& cu ); -#endif void end_of_ctu ( const CodingUnit& cu, CUCtx& cuCtx ); // prediction unit (clause 7.3.8.6) @@ -120,9 +113,7 @@ public: void merge_idx ( const PredictionUnit& pu ); void mmvd_merge_idx(const PredictionUnit& pu); void imv_mode ( const CodingUnit& cu ); -#if JVET_M0246_AFFINE_AMVR void affine_amvr_mode ( const CodingUnit& cu ); -#endif void inter_pred_idc ( const PredictionUnit& pu ); void ref_idx ( const PredictionUnit& pu, RefPicList eRefList ); void mvp_flag ( const PredictionUnit& pu, RefPicList eRefList ); @@ -130,28 +121,17 @@ public: void MHIntra_flag ( const PredictionUnit& pu ); void MHIntra_luma_pred_modes ( const CodingUnit& cu ); void triangle_mode ( const CodingUnit& cu ); -#if JVET_M0444_SMVD void smvd_mode ( const PredictionUnit& pu ); -#endif // pcm samples (clause 7.3.8.7) void pcm_samples ( const TransformUnit& tu ); // transform tree (clause 7.3.8.8) -#if JVET_M0102_INTRA_SUBPARTITIONS void transform_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType = TU_NO_ISP, const int subTuIdx = -1 ); void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbCbf = false, const bool useISP = false ); -#else - void transform_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); - void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbCbf = false ); -#endif // mvd coding (clause 7.3.8.9) -#if JVET_M0246_AFFINE_AMVR void mvd_coding ( const Mv &rMvd, int8_t imv ); -#else - void mvd_coding ( const Mv &rMvd, uint8_t imv ); -#endif // transform unit (clause 7.3.8.10) void transform_unit ( const TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); void cu_qp_delta ( const CodingUnit& cu, int predQP, const int8_t qp ); @@ -159,22 +139,10 @@ public: // residual coding (clause 7.3.8.11) void residual_coding ( const TransformUnit& tu, ComponentID compID ); -#if JVET_M0464_UNI_MTS void mts_coding ( const TransformUnit& tu, ComponentID compID ); -#else - void transform_skip_flag ( const TransformUnit& tu, ComponentID compID ); - void emt_tu_index ( const TransformUnit& tu ); - void emt_cu_flag ( const CodingUnit& cu ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS void isp_mode ( const CodingUnit& cu ); -#endif void explicit_rdpcm_mode ( const TransformUnit& tu, ComponentID compID ); -#if JVET_M0297_32PT_MTS_ZERO_OUT void last_sig_coeff ( CoeffCodingContext& cctx, const TransformUnit& tu, ComponentID compID ); -#else - void last_sig_coeff ( CoeffCodingContext& cctx ); -#endif void residual_coding_subblock ( CoeffCodingContext& cctx, const TCoeff* coeff, const int stateTransTable, int& state ); // cross component prediction (clause 7.3.8.12) @@ -188,9 +156,6 @@ private: void unary_max_symbol ( unsigned symbol, unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol ); void unary_max_eqprob ( unsigned symbol, unsigned maxSymbol ); void exp_golomb_eqprob ( unsigned symbol, unsigned count ); -#if !REMOVE_BIN_DECISION_TREE - void encode_sparse_dt ( DecisionTree& dt, unsigned toCodeId ); -#endif // statistic unsigned get_num_written_bits() { return m_BinEncoder.getNumWrittenBits(); } diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index f9c1dec61b2ca4c06d58f7c439d2c5f5979cedda..8259f17589ceca365198962e31c3c931e6ba0c66 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -40,9 +40,7 @@ #include "CommonLib/CodingStructure.h" #define AlfCtx(c) SubCtx( Ctx::ctbAlfFlag, c ) -#if JVET_M0427_INLOOP_RESHAPER std::vector<double> EncAdaptiveLoopFilter::m_lumaLevelToWeightPLUT; -#endif EncAdaptiveLoopFilter::EncAdaptiveLoopFilter() : m_CABACEstimator( nullptr ) @@ -59,9 +57,7 @@ EncAdaptiveLoopFilter::EncAdaptiveLoopFilter() m_filterCoeffSet = nullptr; m_diffFilterCoeff = nullptr; -#if JVET_M0427_INLOOP_RESHAPER m_alfWSSD = 0; -#endif } void EncAdaptiveLoopFilter::create( const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], const int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ) @@ -260,10 +256,8 @@ void EncAdaptiveLoopFilter::ALFProcess( CodingStructure& cs, const double *lambd const CPelBuf& recLuma = recYuv.get( COMPONENT_Y ); Area blk( 0, 0, recLuma.width, recLuma.height ); deriveClassification( m_classifier, recLuma, blk ); -#if JVET_M0277_FIX_PCM_DISABLEFILTER Area blkPCM(0, 0, recLuma.width, recLuma.height); resetPCMBlkClassInfo(cs, m_classifier, recLuma, blkPCM); -#endif // get CTB stats for filtering deriveStatsForFiltering( orgYuv, recYuv ); @@ -462,19 +456,11 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfSliceParam& alfS { if( filterType == ALF_FILTER_5 ) { -#if JVET_M0277_FIX_PCM_DISABLEFILTER m_filter5x5Blk( m_classifier, recBuf, recExtBuf, blk, compID, coeff, m_clpRngs.comp[compIdx], cs ); -#else - m_filter5x5Blk( m_classifier, recBuf, recExtBuf, blk, compID, coeff, m_clpRngs.comp[compIdx] ); -#endif } else if( filterType == ALF_FILTER_7 ) { -#if JVET_M0277_FIX_PCM_DISABLEFILTER m_filter7x7Blk( m_classifier, recBuf, recExtBuf, blk, compID, coeff, m_clpRngs.comp[compIdx], cs ); -#else - m_filter7x7Blk( m_classifier, recBuf, recExtBuf, blk, compID, coeff, m_clpRngs.comp[compIdx] ); -#endif } else { @@ -1483,12 +1469,10 @@ void EncAdaptiveLoopFilter::getBlkStats( AlfCovariance* alfCovariace, const AlfF { for( int j = 0; j < area.width; j++ ) { -#if JVET_M0277_FIX_PCM_DISABLEFILTER if( classifier && classifier[area.y + i][area.x + j].classIdx == m_ALF_UNUSED_CLASSIDX && classifier[area.y + i][area.x + j].transposeIdx == m_ALF_UNUSED_TRANSPOSIDX ) { continue; } -#endif std::memset( ELocal, 0, shape.numCoeff * sizeof( int ) ); if( classifier ) { @@ -1497,44 +1481,36 @@ void EncAdaptiveLoopFilter::getBlkStats( AlfCovariance* alfCovariace, const AlfF classIdx = cl.classIdx; } -#if JVET_M0427_INLOOP_RESHAPER double weight = 1.0; if (m_alfWSSD) { weight = m_lumaLevelToWeightPLUT[org[j]]; } -#endif int yLocal = org[j] - rec[j]; calcCovariance( ELocal, rec + j, recStride, shape.pattern.data(), shape.filterLength >> 1, transposeIdx ); for( int k = 0; k < shape.numCoeff; k++ ) { for( int l = k; l < shape.numCoeff; l++ ) { -#if JVET_M0427_INLOOP_RESHAPER if (m_alfWSSD) { alfCovariace[classIdx].E[k][l] += weight * (double)(ELocal[k] * ELocal[l]); } else -#endif alfCovariace[classIdx].E[k][l] += ELocal[k] * ELocal[l]; } -#if JVET_M0427_INLOOP_RESHAPER if (m_alfWSSD) { alfCovariace[classIdx].y[k] += weight * (double)(ELocal[k] * yLocal); } else -#endif alfCovariace[classIdx].y[k] += ELocal[k] * yLocal; } -#if JVET_M0427_INLOOP_RESHAPER if (m_alfWSSD) { alfCovariace[classIdx].pixAcc += weight * (double)(yLocal * yLocal); } else -#endif alfCovariace[classIdx].pixAcc += yLocal * yLocal; } org += orgStride; diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h index 1a0a67a4326c062232722c0b7e1dc9583756a6cc..d2b02d902520a609957a6f9f0a30f953093df072 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h @@ -151,12 +151,10 @@ class EncAdaptiveLoopFilter : public AdaptiveLoopFilter public: static constexpr int m_MAX_SCAN_VAL = 11; static constexpr int m_MAX_EXP_GOLOMB = 16; -#if JVET_M0427_INLOOP_RESHAPER int m_alfWSSD; inline void setAlfWSSD(int alfWSSD) { m_alfWSSD = alfWSSD; } static std::vector<double> m_lumaLevelToWeightPLUT; inline std::vector<double>& getLumaLevelWeightTable() { return m_lumaLevelToWeightPLUT; } -#endif private: AlfCovariance*** m_alfCovariance[MAX_NUM_COMPONENT]; // [compIdx][shapeIdx][ctbAddr][classIdx] diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 8c85c8ba373c163a85a5a735c525391c291dfdbc..41d8a29e4af1b8f928b33957767b91d53da9c68e 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -142,28 +142,20 @@ protected: bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; bool m_bNoPcmConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoRefWraparoundConstraintFlag; -#endif bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; bool m_bNoAmvrConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoBdofConstraintFlag; -#endif bool m_bNoCclmConstraintFlag; bool m_bNoMtsConstraintFlag; bool m_bNoAffineMotionConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoGbiConstraintFlag; bool m_bNoMhIntraConstraintFlag; bool m_bNoTriangleConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool m_bNoCurrPicRefConstraintFlag; bool m_bNoQpDeltaConstraintFlag; -#endif bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -219,26 +211,13 @@ protected: unsigned m_log2DiffMaxMinCodingBlockSize; int m_LMChroma; -#if JVET_M0142_CCLM_COLLOCATED_CHROMA bool m_cclmCollocatedChromaFlag; -#endif -#if JVET_M0464_UNI_MTS int m_IntraMTS; int m_InterMTS; int m_IntraMTSMaxCand; int m_InterMTSMaxCand; -#else - int m_IntraEMT; - int m_InterEMT; - int m_FastIntraEMT; - int m_FastInterEMT; -#endif -#if JVET_M0303_IMPLICIT_MTS int m_ImplicitMTS; -#endif -#if JVET_M0140_SBT bool m_SBT; ///< Sub-Block Transform for inter blocks -#endif int m_SubPuMvpMode; bool m_Affine; bool m_AffineType; @@ -256,21 +235,11 @@ protected: bool m_MHIntra; bool m_Triangle; -#if JVET_M0255_FRACMMVD_SWITCH bool m_allowDisFracMMVD; -#endif -#if JVET_M0246_AFFINE_AMVR bool m_AffineAmvr; -#endif -#if JVET_M0253_HASH_ME bool m_HashME; -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT bool m_AffineAmvrEncOpt; -#endif -#if JVET_M0147_DMVR bool m_DMVR; -#endif unsigned m_IBCMode; unsigned m_IBCLocalSearchRangeX; unsigned m_IBCLocalSearchRangeY; @@ -283,15 +252,11 @@ protected: unsigned m_wrapAroundOffset; // ADD_NEW_TOOL : (encoder lib) add tool enabling flags and associated parameters here -#if JVET_M0427_INLOOP_RESHAPER bool m_lumaReshapeEnable; unsigned m_reshapeSignalType; unsigned m_intraCMD; ReshapeCW m_reshapeCW; -#endif -#if JVET_M0428_ENC_DB_OPT bool m_encDbOpt; -#endif bool m_useFastLCTU; bool m_useFastMrg; bool m_usePbIntraFast; @@ -335,13 +300,8 @@ protected: //====== Quality control ======== int m_iMaxDeltaQP; // Max. absolute delta QP (1:default) -#if JVET_M0113_M0188_QG_SIZE int m_cuQpDeltaSubdiv; // Max. subdivision level for a CuDQP (0:default) int m_cuChromaQpOffsetSubdiv; ///< If negative, then do not apply chroma qp offsets. -#else - int m_iMaxCuDQPDepth; // Max. depth for a minimum CuDQP (0:default) - int m_diffCuChromaQpOffsetDepth; ///< If negative, then do not apply chroma qp offsets. -#endif int m_chromaCbQpOffset; // Chroma Cb QP Offset (0:default) int m_chromaCrQpOffset; // Chroma Cr Qp Offset (0:default) @@ -399,9 +359,7 @@ protected: int* m_aidQP; uint32_t m_uiDeltaQpRD; bool m_bFastDeltaQP; -#if JVET_M0102_INTRA_SUBPARTITIONS bool m_useFastISP; -#endif bool m_bUseConstrainedIntraPred; bool m_bFastUDIUseMPMEnabled; @@ -481,9 +439,7 @@ protected: bool m_SOPDescriptionSEIEnabled; bool m_scalableNestingSEIEnabled; bool m_tmctsSEIEnabled; -#if JVET_M0445_MCTS bool m_MCTSEncConstraint; -#endif bool m_timeCodeSEIEnabled; int m_timeCodeSEINumTs; SEITimeSet m_timeSetArray[MAX_TIMECODE_SEI_SETS]; @@ -596,9 +552,7 @@ protected: int m_switchDQP; ///< dqp applied to switchPOC and subsequent pictures. int m_fastForwardToPOC; ///< bool m_stopAfterFFtoPOC; ///< -#if JVET_M0055_DEBUG_CTU int m_debugCTU; ///< dbg ctu -#endif bool m_bs2ModPOCAndType; @@ -648,42 +602,34 @@ public: void setNoAlfConstraintFlag(bool bVal) { m_bNoAlfConstraintFlag = bVal; } bool getNoPcmConstraintFlag() const { return m_bNoPcmConstraintFlag; } void setNoPcmConstraintFlag(bool bVal) { m_bNoPcmConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoRefWraparoundConstraintFlag() const { return m_bNoRefWraparoundConstraintFlag; } void setNoRefWraparoundConstraintFlag(bool bVal) { m_bNoRefWraparoundConstraintFlag = bVal; } -#endif bool getNoTemporalMvpConstraintFlag() const { return m_bNoTemporalMvpConstraintFlag; } void setNoTemporalMvpConstraintFlag(bool bVal) { m_bNoTemporalMvpConstraintFlag = bVal; } bool getNoSbtmvpConstraintFlag() const { return m_bNoSbtmvpConstraintFlag; } void setNoSbtmvpConstraintFlag(bool bVal) { m_bNoSbtmvpConstraintFlag = bVal; } bool getNoAmvrConstraintFlag() const { return m_bNoAmvrConstraintFlag; } void setNoAmvrConstraintFlag(bool bVal) { m_bNoAmvrConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoBdofConstraintFlag() const { return m_bNoBdofConstraintFlag; } void setNoBdofConstraintFlag(bool bVal) { m_bNoBdofConstraintFlag = bVal; } -#endif bool getNoCclmConstraintFlag() const { return m_bNoCclmConstraintFlag; } void setNoCclmConstraintFlag(bool bVal) { m_bNoCclmConstraintFlag = bVal; } bool getNoMtsConstraintFlag() const { return m_bNoMtsConstraintFlag; } void setNoMtsConstraintFlag(bool bVal) { m_bNoMtsConstraintFlag = bVal; } bool getNoAffineMotionConstraintFlag() const { return m_bNoAffineMotionConstraintFlag; } void setNoAffineMotionConstraintFlag(bool bVal) { m_bNoAffineMotionConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoGbiConstraintFlag() const { return m_bNoGbiConstraintFlag; } void setNoGbiConstraintFlag(bool bVal) { m_bNoGbiConstraintFlag = bVal; } bool getNoMhIntraConstraintFlag() const { return m_bNoMhIntraConstraintFlag; } void setNoMhIntraConstraintFlag(bool bVal) { m_bNoMhIntraConstraintFlag = bVal; } bool getNoTriangleConstraintFlag() const { return m_bNoTriangleConstraintFlag; } void setNoTriangleConstraintFlag(bool bVal) { m_bNoTriangleConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_bNoLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX bool getNoCurrPicRefConstraintFlag() const { return m_bNoCurrPicRefConstraintFlag; } void setNoCurrPicRefConstraintFlag(bool bVal) { m_bNoCurrPicRefConstraintFlag = bVal; } bool getNoQpDeltaConstraintFlag() const { return m_bNoQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_bNoQpDeltaConstraintFlag = bVal; } -#endif bool getNoDepQuantConstraintFlag() const { return m_bNoDepQuantConstraintFlag; } void setNoDepQuantConstraintFlag(bool bVal) { m_bNoDepQuantConstraintFlag = bVal; } bool getNoSignDataHidingConstraintFlag() const { return m_bNoSignDataHidingConstraintFlag; } @@ -757,10 +703,8 @@ public: void setUseLMChroma ( int n ) { m_LMChroma = n; } int getUseLMChroma() const { return m_LMChroma; } -#if JVET_M0142_CCLM_COLLOCATED_CHROMA void setCclmCollocatedChromaFlag ( bool b ) { m_cclmCollocatedChromaFlag = b; } bool getCclmCollocatedChromaFlag () const { return m_cclmCollocatedChromaFlag; } -#endif void setSubPuMvpMode(int n) { m_SubPuMvpMode = n; } bool getSubPuMvpMode() const { return m_SubPuMvpMode; } @@ -772,7 +716,6 @@ public: void setBIO(bool b) { m_BIO = b; } bool getBIO() const { return m_BIO; } -#if JVET_M0464_UNI_MTS void setIntraMTSMaxCand ( unsigned u ) { m_IntraMTSMaxCand = u; } unsigned getIntraMTSMaxCand () const { return m_IntraMTSMaxCand; } void setInterMTSMaxCand ( unsigned u ) { m_InterMTSMaxCand = u; } @@ -781,24 +724,10 @@ public: bool getIntraMTS () const { return m_IntraMTS; } void setInterMTS ( bool b ) { m_InterMTS = b; } bool getInterMTS () const { return m_InterMTS; } -#else - void setFastIntraEMT ( bool b ) { m_FastIntraEMT = b; } - bool getFastIntraEMT () const { return m_FastIntraEMT; } - void setFastInterEMT ( bool b ) { m_FastInterEMT = b; } - bool getFastInterEMT () const { return m_FastInterEMT; } - void setIntraEMT ( bool b ) { m_IntraEMT = b; } - bool getIntraEMT () const { return m_IntraEMT; } - void setInterEMT ( bool b ) { m_InterEMT = b; } - bool getInterEMT () const { return m_InterEMT; } -#endif -#if JVET_M0303_IMPLICIT_MTS void setImplicitMTS ( bool b ) { m_ImplicitMTS = b; } bool getImplicitMTS () const { return m_ImplicitMTS; } -#endif -#if JVET_M0140_SBT void setUseSBT ( bool b ) { m_SBT = b; } bool getUseSBT () const { return m_SBT; } -#endif void setUseCompositeRef (bool b) { m_compositeRefEnabled = b; } bool getUseCompositeRef () const { return m_compositeRefEnabled; } @@ -823,26 +752,16 @@ public: bool getUseMHIntra () const { return m_MHIntra; } void setUseTriangle ( bool b ) { m_Triangle = b; } bool getUseTriangle () const { return m_Triangle; } -#if JVET_M0255_FRACMMVD_SWITCH void setAllowDisFracMMVD ( bool b ) { m_allowDisFracMMVD = b; } bool getAllowDisFracMMVD () const { return m_allowDisFracMMVD; } -#endif -#if JVET_M0253_HASH_ME void setUseHashME ( bool b ) { m_HashME = b; } bool getUseHashME () const { return m_HashME; } -#endif -#if JVET_M0246_AFFINE_AMVR void setUseAffineAmvr ( bool b ) { m_AffineAmvr = b; } bool getUseAffineAmvr () const { return m_AffineAmvr; } -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT void setUseAffineAmvrEncOpt ( bool b ) { m_AffineAmvrEncOpt = b; } bool getUseAffineAmvrEncOpt () const { return m_AffineAmvrEncOpt; } -#endif -#if JVET_M0147_DMVR void setDMVR ( bool b ) { m_DMVR = b; } bool getDMVR () const { return m_DMVR; } -#endif void setIBCMode (unsigned n) { m_IBCMode = n; } unsigned getIBCMode () const { return m_IBCMode; } @@ -866,7 +785,6 @@ public: // ADD_NEW_TOOL : (encoder lib) add access functions here -#if JVET_M0427_INLOOP_RESHAPER void setReshaper ( bool b ) { m_lumaReshapeEnable = b; } bool getReshaper () const { return m_lumaReshapeEnable; } void setReshapeSignalType ( uint32_t signalType ) { m_reshapeSignalType = signalType; } @@ -875,7 +793,6 @@ public: uint32_t getReshapeIntraCMD () { return m_intraCMD; } void setReshapeCW (const ReshapeCW &reshapeCW) { m_reshapeCW = reshapeCW; } const ReshapeCW& getReshapeCW () { return m_reshapeCW; } -#endif void setMaxCUWidth ( uint32_t u ) { m_maxCUWidth = u; } uint32_t getMaxCUWidth () const { return m_maxCUWidth; } void setMaxCUHeight ( uint32_t u ) { m_maxCUHeight = u; } @@ -883,10 +800,8 @@ public: void setMaxCodingDepth ( uint32_t u ) { m_maxTotalCUDepth = u; } uint32_t getMaxCodingDepth () const { return m_maxTotalCUDepth; } void setLog2DiffMaxMinCodingBlockSize( uint32_t u ) { m_log2DiffMaxMinCodingBlockSize = u; } -#if JVET_M0428_ENC_DB_OPT void setUseEncDbOpt ( bool n ) { m_encDbOpt = n; } bool getUseEncDbOpt () const { return m_encDbOpt; } -#endif void setUseFastLCTU ( bool n ) { m_useFastLCTU = n; } bool getUseFastLCTU () const { return m_useFastLCTU; } @@ -928,16 +843,9 @@ public: //====== Quality control ======== void setMaxDeltaQP ( int i ) { m_iMaxDeltaQP = i; } -#if JVET_M0113_M0188_QG_SIZE void setCuQpDeltaSubdiv ( int i ) { m_cuQpDeltaSubdiv = i; } int getCuChromaQpOffsetSubdiv () const { return m_cuChromaQpOffsetSubdiv; } void setCuChromaQpOffsetSubdiv (int value) { m_cuChromaQpOffsetSubdiv = value; } -#else - void setMaxCuDQPDepth ( int i ) { m_iMaxCuDQPDepth = i; } - - int getDiffCuChromaQpOffsetDepth () const { return m_diffCuChromaQpOffsetDepth; } - void setDiffCuChromaQpOffsetDepth (int value) { m_diffCuChromaQpOffsetDepth = value; } -#endif void setChromaCbQpOffset ( int i ) { m_chromaCbQpOffset = i; } void setChromaCrQpOffset ( int i ) { m_chromaCrQpOffset = i; } @@ -1041,11 +949,7 @@ public: //==== Quality control ======== int getMaxDeltaQP () const { return m_iMaxDeltaQP; } -#if JVET_M0113_M0188_QG_SIZE int getCuQpDeltaSubdiv () const { return m_cuQpDeltaSubdiv; } -#else - int getMaxCuDQPDepth () const { return m_iMaxCuDQPDepth; } -#endif bool getUseAdaptiveQP () const { return m_bUseAdaptiveQP; } int getQPAdaptationRange () const { return m_iQPAdaptationRange; } #if ENABLE_QPA @@ -1131,10 +1035,8 @@ public: void setLog2MaxTransformSkipBlockSize ( uint32_t u ) { m_log2MaxTransformSkipBlockSize = u; } bool getIntraSmoothingDisabledFlag () const { return m_intraSmoothingDisabledFlag; } void setIntraSmoothingDisabledFlag (bool bValue) { m_intraSmoothingDisabledFlag=bValue; } -#if JVET_M0102_INTRA_SUBPARTITIONS bool getUseFastISP () { return m_useFastISP; } void setUseFastISP ( bool b ) { m_useFastISP = b; } -#endif const int* getdQPs () const { return m_aidQP; } uint32_t getDeltaQpRD () const { return m_uiDeltaQpRD; } @@ -1286,10 +1188,8 @@ public: bool getScalableNestingSEIEnabled() const { return m_scalableNestingSEIEnabled; } void setTMCTSSEIEnabled(bool b) { m_tmctsSEIEnabled = b; } bool getTMCTSSEIEnabled() { return m_tmctsSEIEnabled; } -#if JVET_M0445_MCTS void setMCTSEncConstraint(bool b) { m_MCTSEncConstraint = b; } bool getMCTSEncConstraint() { return m_MCTSEncConstraint; } -#endif void setTimeCodeSEIEnabled(bool b) { m_timeCodeSEIEnabled = b; } bool getTimeCodeSEIEnabled() { return m_timeCodeSEIEnabled; } void setNumberOfTimeSets(int value) { m_timeCodeSEINumTs = value; } @@ -1534,10 +1434,8 @@ public: bool getStopAfterFFtoPOC() const { return m_stopAfterFFtoPOC; } void setBs2ModPOCAndType( bool b ) { m_bs2ModPOCAndType = b; } bool getBs2ModPOCAndType() const { return m_bs2ModPOCAndType; } -#if JVET_M0055_DEBUG_CTU void setDebugCTU( int i ) { m_debugCTU = i; } int getDebugCTU() const { return m_debugCTU; } -#endif #if ENABLE_SPLIT_PARALLELISM void setNumSplitThreads( int n ) { m_numSplitThreads = n; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 9d198535f918e8b8cbfbc9dc6a2a5d708aeb5167..51f0e938634470972ecb2abdd9c31613eb26202e 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -44,9 +44,7 @@ #include "CommonLib/dtrace_codingstruct.h" #include "CommonLib/Picture.h" #include "CommonLib/UnitTools.h" -#if JVET_M0445_MCTS #include "MCTS.h" -#endif #include "CommonLib/dtrace_buffer.h" @@ -67,7 +65,6 @@ extern std::recursive_mutex g_cache_mutex; // ==================================================================================================================== // Constructor / destructor / create / destroy // ==================================================================================================================== -#if JVET_M0883_TRIANGLE_SIGNALING const TriangleMotionInfo EncCu::m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS] = { TriangleMotionInfo( 0, 1, 0 ), TriangleMotionInfo( 1, 0, 1 ), TriangleMotionInfo( 1, 0, 2 ), TriangleMotionInfo( 0, 0, 1 ), TriangleMotionInfo( 0, 2, 0 ), @@ -79,7 +76,6 @@ const TriangleMotionInfo EncCu::m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS] = TriangleMotionInfo( 0, 4, 1 ), TriangleMotionInfo( 0, 2, 3 ), TriangleMotionInfo( 1, 4, 2 ), TriangleMotionInfo( 0, 3, 2 ), TriangleMotionInfo( 1, 4, 3 ), TriangleMotionInfo( 0, 3, 1 ), TriangleMotionInfo( 0, 2, 4 ), TriangleMotionInfo( 1, 2, 4 ), TriangleMotionInfo( 0, 4, 2 ), TriangleMotionInfo( 0, 3, 4 ), }; -#endif void EncCu::create( EncCfg* encCfg ) { @@ -134,7 +130,6 @@ void EncCu::create( EncCfg* encCfg ) { m_acRealMergeBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); } -#if JVET_M0883_TRIANGLE_SIGNALING for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_UNI_CANDS; ui++ ) { for( unsigned uj = 0; uj < TRIANGLE_MAX_NUM_UNI_CANDS; uj++ ) @@ -147,7 +142,6 @@ void EncCu::create( EncCfg* encCfg ) m_triangleIdxBins[1][ui][uj] = m_triangleIdxBins[0][ui][uj] = 1 + idxBits0 + idxBits1; } } -#endif for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) { m_acTriangleWeightedBuffer[ui].create( chromaFormat, Area( 0, 0, uiMaxWidth, uiMaxHeight ) ); @@ -181,7 +175,7 @@ void EncCu::destroy() delete[] m_pBestCS; m_pBestCS = nullptr; delete[] m_pTempCS; m_pTempCS = nullptr; -#if JVET_M0427_INLOOP_RESHAPER && REUSE_CU_RESULTS +#if REUSE_CU_RESULTS if (m_tmpStorageLCU) { m_tmpStorageLCU->destroy(); @@ -236,38 +230,24 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) m_pcEncLib = pcEncLib; m_dataId = tId; #endif -#if JVET_M0428_ENC_DB_OPT m_pcLoopFilter = pcEncLib->getLoopFilter(); -#endif -#if JVET_M0170_MRG_SHARELIST m_shareState = NO_SHARE; m_pcInterSearch->setShareState(0); setShareStateDec(0); -#endif -#if JVET_M0170_MRG_SHARELIST m_shareBndPosX = -1; m_shareBndPosY = -1; m_shareBndSizeW = 0; m_shareBndSizeH = 0; -#endif -#if REUSE_CU_RESULTS || JVET_M0170_MRG_SHARELIST || JVET_M0427_INLOOP_RESHAPER DecCu::init( m_pcTrQuant, m_pcIntraSearch, m_pcInterSearch ); -#endif m_modeCtrl->init( m_pcEncCfg, m_pcRateCtrl, m_pcRdCost ); m_pcInterSearch->setModeCtrl( m_modeCtrl ); -#if JVET_M0102_INTRA_SUBPARTITIONS m_pcIntraSearch->setModeCtrl( m_modeCtrl ); -#endif -#if JVET_M0255_FRACMMVD_SWITCH if ( ( m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode() ) || m_pcEncCfg->getAllowDisFracMMVD() ) -#else - if (m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode()) -#endif { m_ibcHashMap.init(m_pcEncCfg->getSourceWidth(), m_pcEncCfg->getSourceHeight()); } @@ -279,20 +259,6 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsigned ctuRsAddr, const int prevQP[], const int currQP[] ) { -#if !JVET_M0255_FRACMMVD_SWITCH - if (m_pcEncCfg->getIBCHashSearch() && ctuRsAddr == 0 && cs.slice->getSPS()->getIBCMode()) - { -#if JVET_M0427_INLOOP_RESHAPER - if (cs.slice->getSPS()->getUseReshaper() && m_pcReshape->getCTUFlag()) - cs.picture->getOrigBuf(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT()); -#endif - m_ibcHashMap.rebuildPicHashMap(cs.picture->getOrigBuf()); -#if JVET_M0427_INLOOP_RESHAPER - if (cs.slice->getSPS()->getUseReshaper() && m_pcReshape->getCTUFlag()) - cs.picture->getOrigBuf().copyFrom(cs.picture->getTrueOrigBuf()); -#endif - } -#endif m_modeCtrl->initCTUEncoding( *cs.slice ); #if ENABLE_SPLIT_PARALLELISM @@ -305,9 +271,7 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign #if REUSE_CU_RESULTS BestEncInfoCache* bestCache = dynamic_cast< BestEncInfoCache* >( jobEncCu->m_modeCtrl ); #endif -#if JVET_M0140_SBT SaveLoadEncInfoSbt *sbtCache = dynamic_cast< SaveLoadEncInfoSbt* >( jobEncCu->m_modeCtrl ); -#endif if( cacheCtrl ) { cacheCtrl->init( *cs.slice ); @@ -318,12 +282,10 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign bestCache->init(*cs.slice); } #endif -#if JVET_M0140_SBT if (sbtCache) { sbtCache->init(*cs.slice); } -#endif } } @@ -353,11 +315,7 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign m_ctuIbcSearchRangeX >>= 1; m_ctuIbcSearchRangeY >>= 1; } -#if JVET_M0483_IBC if (cs.slice->getNumRefIdx(REF_PIC_LIST_0) > 0) -#else - if (cs.slice->getNumRefIdx(REF_PIC_LIST_0) > 1) -#endif { m_ctuIbcSearchRangeX >>= 1; m_ctuIbcSearchRangeY >>= 1; @@ -378,11 +336,7 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign xCompressCU( tempCS, bestCS, *partitioner ); // all signals were already copied during compression if the CTU was split - at this point only the structures are copied to the top level CS -#if JVET_M0427_INLOOP_RESHAPER const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1; -#else - const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1 && KEEP_PRED_AND_RESI_SIGNALS; -#endif cs.useSubStructure( *bestCS, partitioner->chType, CS::getArea( *bestCS, area, partitioner->chType ), copyUnsplitCTUSignals, false, false, copyUnsplitCTUSignals ); if (CS::isDualITree (cs) && isChromaEnabled (cs.pcv->chrFormat)) @@ -399,11 +353,7 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign xCompressCU( tempCS, bestCS, *partitioner ); -#if JVET_M0427_INLOOP_RESHAPER const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1; -#else - const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1 && KEEP_PRED_AND_RESI_SIGNALS; -#endif cs.useSubStructure( *bestCS, partitioner->chType, CS::getArea( *bestCS, area, partitioner->chType ), copyUnsplitCTUSignals, false, false, copyUnsplitCTUSignals ); } @@ -581,9 +531,7 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS, std::swap( tempCS, bestCS ); // store temp best CI for next CU coding m_CurrCtx->best = m_CABACEstimator->getCtx(); -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = true; -#endif bestCSUpdated = true; } } @@ -596,7 +544,6 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS, void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner ) { -#if JVET_M0170_MRG_SHARELIST if (m_shareState == NO_SHARE) { tempCS->sharedBndPos = tempCS->area.Y().lumaPos(); @@ -606,7 +553,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par bestCS->sharedBndSize.width = bestCS->area.lwidth(); bestCS->sharedBndSize.height = bestCS->area.lheight(); } -#endif #if ENABLE_SPLIT_PARALLELISM CHECK( m_dataId != tempCS->picture->scheduler.getDataId(), "Working in the wrong dataId!" ); @@ -633,19 +579,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par tempCS->chType = partitioner.chType; bestCS->chType = partitioner.chType; m_modeCtrl->initCULevel( partitioner, *tempCS ); -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getUseInterMTS() ) ) -#else - if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getUseInterEMT() ) ) -#endif { auto slsSbt = dynamic_cast<SaveLoadEncInfoSbt*>( m_modeCtrl ); -#if JVET_M0464_UNI_MTS int maxSLSize = sps.getUseSBT() ? tempCS->slice->getSPS()->getMaxSbtSize() : MTS_INTER_MAX_CU_SIZE; -#else - int maxSLSize = sps.getUseSBT() ? tempCS->slice->getSPS()->getMaxSbtSize() : EMT_INTER_MAX_CU_WITH_QTBT; -#endif slsSbt->resetSaveloadSbt( maxSLSize ); #if ENABLE_SPLIT_PARALLELISM CHECK( tempCS->picture->scheduler.getSplitJobId() != 0, "The SBT search reset need to happen in sequential region." ); @@ -660,7 +597,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par #endif } m_sbtCostSave[0] = m_sbtCostSave[1] = MAX_DOUBLE; -#endif m_CurrCtx->start = m_CABACEstimator->getCtx(); @@ -668,14 +604,9 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par if( slice.getUseChromaQpAdj() ) { -#if JVET_M0113_M0188_QG_SIZE // TODO M0133 : double check encoder decisions with respect to chroma QG detection and actual encode int lgMinCuSize = sps.getLog2MinCodingBlockSize() + std::max<int>( 0, sps.getLog2DiffMaxMinCodingBlockSize() - int( pps.getPpsRangeExtension().getCuChromaQpOffsetSubdiv()/2 ) ); -#else - int lgMinCuSize = sps.getLog2MinCodingBlockSize() + - std::max<int>( 0, sps.getLog2DiffMaxMinCodingBlockSize() - int( pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() ) ); -#endif m_cuChromaQpOffsetIdxPlus1 = ( ( uiLPelX >> lgMinCuSize ) + ( uiTPelY >> lgMinCuSize ) ) % ( pps.getPpsRangeExtension().getChromaQpOffsetListLen() + 1 ); } @@ -692,12 +623,8 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par DTRACE( g_trace_ctx, D_COMMON, "@(%4d,%4d) [%2dx%2d]\n", tempCS->area.lx(), tempCS->area.ly(), tempCS->area.lwidth(), tempCS->area.lheight() ); -#if JVET_M0170_MRG_SHARELIST int startShareThisLevel = 0; -#endif -#if JVET_M0246_AFFINE_AMVR m_pcInterSearch->resetSavedAffineMotion(); -#endif do { @@ -717,11 +644,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU -#if JVET_M0113_M0188_QG_SIZE if (partitioner.currQgEnable() && ( -#else - if (partitioner.currDepth <= pps.getMaxCuDQPDepth() && ( -#endif #if SHARP_LUMA_DELTA_QP (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) || #endif @@ -746,32 +669,22 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { if( ( currTestMode.opts & ETO_IMV ) != 0 ) { -#if JVET_M0246_AFFINE_AMVR tempCS->bestCS = bestCS; xCheckRDCostInterIMV( tempCS, bestCS, partitioner, currTestMode ); tempCS->bestCS = nullptr; -#else - xCheckRDCostInterIMV(tempCS, bestCS, partitioner, currTestMode); -#endif } else { -#if JVET_M0246_AFFINE_AMVR tempCS->bestCS = bestCS; xCheckRDCostInter( tempCS, bestCS, partitioner, currTestMode ); tempCS->bestCS = nullptr; -#else - xCheckRDCostInter( tempCS, bestCS, partitioner, currTestMode ); -#endif } } -#if JVET_M0253_HASH_ME else if (currTestMode.type == ETM_HASH_INTER) { xCheckRDCostHashInter( tempCS, bestCS, partitioner, currTestMode ); } -#endif else if( currTestMode.type == ETM_AFFINE ) { xCheckRDCostAffineMerge2Nx2N( tempCS, bestCS, partitioner, currTestMode ); @@ -820,14 +733,12 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } } while( m_modeCtrl->nextMode( *tempCS, partitioner ) ); -#if JVET_M0170_MRG_SHARELIST if(startShareThisLevel == 1) { m_shareState = NO_SHARE; m_pcInterSearch->setShareState(m_shareState); setShareStateDec(m_shareState); } -#endif ////////////////////////////////////////////////////////////////////////// // Finishing CU @@ -847,17 +758,9 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par // QP from last processed CU for further processing bestCS->prevQP[partitioner.chType] = bestCS->cus.back()->qp; -#if JVET_M0483_IBC if ((!slice.isIntra() || slice.getSPS()->getIBCFlag()) -#else - if (!slice.isIntra() -#endif && bestCS->chType == CHANNEL_TYPE_LUMA -#if JVET_M0483_IBC && bestCS->cus.size() == 1 && (bestCS->cus.back()->predMode == MODE_INTER || bestCS->cus.back()->predMode == MODE_IBC) -#else - && bestCS->cus.size() == 1 && bestCS->cus.back()->predMode == MODE_INTER -#endif && bestCS->area.Y() == (*bestCS->cus.back()).Y() ) { @@ -867,19 +770,11 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par if (!cu.affine && !cu.triangle) { MotionInfo mi = pu.getMotionInfo(); -#if JVET_M0264_HMVP_WITH_GBIIDX mi.GBiIdx = (mi.interDir == 3) ? cu.GBiIdx : GBI_DEFAULT; -#endif -#if JVET_M0483_IBC cu.cs->addMiToLut(CU::isIBC(cu) ? cu.cs->motionLut.lutIbc : cu.cs->motionLut.lut, mi); -#else - cu.cs->addMiToLut(cu.cs->motionLut.lut, mi); -#endif } } -#if JVET_M0427_INLOOP_RESHAPER bestCS->picture->getPredBuf(currCsArea).copyFrom(bestCS->getPredBuf(currCsArea)); -#endif bestCS->picture->getRecoBuf( currCsArea ).copyFrom( bestCS->getRecoBuf( currCsArea ) ); m_modeCtrl->finishCULevel( partitioner ); @@ -1010,14 +905,12 @@ void EncCu::xCompressCUParallel( CodingStructure *&tempCS, CodingStructure *&bes const int wppTId = picture->scheduler.getWppThreadId(); #endif const bool doParallel = !m_pcEncCfg->getForceSingleSplitThread(); -#if 1 #if _MSC_VER && ENABLE_WPP_PARALLELISM #pragma omp parallel for schedule(dynamic,1) num_threads(NUM_SPLIT_THREADS_IF_MSVC) if(doParallel) #else omp_set_num_threads( m_pcEncCfg->getNumSplitThreads() ); #pragma omp parallel for schedule(dynamic,1) if(doParallel) -#endif #endif for( int jId = 1; jId <= numJobs; jId++ ) { @@ -1132,11 +1025,7 @@ void EncCu::copyState( EncCu* other, Partitioner& partitioner, const UnitArea& c CodingStructure* dst = m_pBestCS[wIdx][hIdx]; const CodingStructure* src = other->m_pBestCS[wIdx][hIdx]; bool keepResi = KEEP_PRED_AND_RESI_SIGNALS; -#if JVET_M0427_INLOOP_RESHAPER bool keepPred = true; -#else - bool keepPred = KEEP_PRED_AND_RESI_SIGNALS; -#endif dst->useSubStructure( *src, partitioner.chType, currArea, keepPred, true, keepResi, keepResi ); @@ -1155,15 +1044,12 @@ void EncCu::copyState( EncCu* other, Partitioner& partitioner, const UnitArea& c m_modeCtrl ->copyState( *other->m_modeCtrl, partitioner.currArea() ); m_pcRdCost ->copyState( *other->m_pcRdCost ); m_pcTrQuant ->copyState( *other->m_pcTrQuant ); -#if JVET_M0427_INLOOP_RESHAPER if( m_pcEncCfg->getReshaper() ) { EncReshape *encReshapeThis = dynamic_cast<EncReshape*>( m_pcReshape); EncReshape *encReshapeOther = dynamic_cast<EncReshape*>(other->m_pcReshape); encReshapeThis->copyState( *encReshapeOther ); } -#endif -#if JVET_M0170_MRG_SHARELIST m_shareState = other->m_shareState; m_shareBndPosX = other->m_shareBndPosX; m_shareBndPosY = other->m_shareBndPosY; @@ -1172,7 +1058,6 @@ void EncCu::copyState( EncCu* other, Partitioner& partitioner, const UnitArea& c setShareStateDec( other->getShareStateDec() ); m_pcInterSearch->setShareState( other->m_pcInterSearch->getShareState() ); -#endif m_CABACEstimator->getCtx() = other->m_CABACEstimator->getCtx(); } #endif @@ -1184,7 +1069,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, const bool bIsLosslessMode = false; // False at this level. Next level down may set it to true. const int oldPrevQp = tempCS->prevQP[partitioner.chType]; const auto oldMotionLut = tempCS->motionLut; -#if !JVET_M0113_M0188_QG_SIZE || ENABLE_QPA_SUB_CTU +#if ENABLE_QPA_SUB_CTU const PPS &pps = *tempCS->pps; const uint32_t currDepth = partitioner.currDepth; #endif @@ -1198,64 +1083,29 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_CABACEstimator->getCtx() = m_CurrCtx->start; const TempCtx ctxStartSP( m_CtxCache, SubCtx( Ctx::SplitFlag, m_CABACEstimator->getCtx() ) ); -#if JVET_M0421_SPLIT_SIG const TempCtx ctxStartQt( m_CtxCache, SubCtx( Ctx::SplitQtFlag, m_CABACEstimator->getCtx() ) ); const TempCtx ctxStartHv( m_CtxCache, SubCtx( Ctx::SplitHvFlag, m_CABACEstimator->getCtx() ) ); const TempCtx ctxStart12( m_CtxCache, SubCtx( Ctx::Split12Flag, m_CABACEstimator->getCtx() ) ); -#else - const TempCtx ctxStartBT( m_CtxCache, SubCtx( Ctx::BTSplitFlag, m_CABACEstimator->getCtx() ) ); -#endif m_CABACEstimator->resetBits(); -#if JVET_M0421_SPLIT_SIG m_CABACEstimator->split_cu_mode( split, *tempCS, partitioner ); -#else - if( partitioner.getImplicitSplit( *tempCS ) != CU_QUAD_SPLIT ) - { - if( partitioner.canSplit( CU_QUAD_SPLIT, *tempCS ) ) - { - m_CABACEstimator->split_cu_flag( split == CU_QUAD_SPLIT, *tempCS, partitioner ); - } - if( split != CU_QUAD_SPLIT ) - { - m_CABACEstimator->split_cu_mode_mt( split, *tempCS, partitioner ); - } - } -#endif const double factor = ( tempCS->currQP[partitioner.chType] > 30 ? 1.1 : 1.075 ); -#if JVET_M0428_ENC_DB_OPT tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); if (!tempCS->useDbCost) CHECK(bestCS->costDbOffset != 0, "error"); const double cost = m_pcRdCost->calcRdCost( uint64_t( m_CABACEstimator->getEstFracBits() + ( ( bestCS->fracBits ) / factor ) ), Distortion( bestCS->dist / factor ) ) + bestCS->costDbOffset / factor; -#else - const double cost = m_pcRdCost->calcRdCost( uint64_t( m_CABACEstimator->getEstFracBits() + ( ( bestCS->fracBits ) / factor ) ), Distortion( bestCS->dist / factor ) ); -#endif m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitFlag, ctxStartSP ); -#if JVET_M0421_SPLIT_SIG m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitQtFlag, ctxStartQt ); m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitHvFlag, ctxStartHv ); m_CABACEstimator->getCtx() = SubCtx( Ctx::Split12Flag, ctxStart12 ); -#else - m_CABACEstimator->getCtx() = SubCtx( Ctx::BTSplitFlag, ctxStartBT ); -#endif -#if JVET_M0428_ENC_DB_OPT if (cost > bestCS->cost + bestCS->costDbOffset -#else - if (cost > bestCS->cost -#endif #if ENABLE_QPA_SUB_CTU -#if JVET_M0113_M0188_QG_SIZE || (m_pcEncCfg->getUsePerceptQPA() && !m_pcEncCfg->getUseRateCtrl() && pps.getUseDQP() && (pps.getCuQpDeltaSubdiv() > 0) && (split == CU_HORZ_SPLIT || split == CU_VERT_SPLIT) && (currDepth == 0)) // force quad-split or no split at CTU level -#else - || (m_pcEncCfg->getUsePerceptQPA() && !m_pcEncCfg->getUseRateCtrl() && pps.getUseDQP() && (pps.getMaxCuDQPDepth() > 0) && (split == CU_HORZ_SPLIT || split == CU_VERT_SPLIT) && - (partitioner.currArea().lwidth() == tempCS->pcv->maxCUWidth) && (partitioner.currArea().lheight() == tempCS->pcv->maxCUHeight)) // force quad-split or no split at CTU level -#endif #endif ) { @@ -1263,7 +1113,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, return; } -#if JVET_M0170_MRG_SHARELIST int startShareThisLevel = 0; const uint32_t uiLPelX = tempCS->area.Y().lumaPos().x; const uint32_t uiTPelY = tempCS->area.Y().lumaPos().y; @@ -1288,42 +1137,29 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, startShareThisLevel = 1; } } -#if JVET_M0483_IBC if ((m_shareState == GEN_ON_SHARED_BOUND) && (!slice.isIntra() || slice.getSPS()->getIBCFlag())) -#else - if ((m_shareState == GEN_ON_SHARED_BOUND) && (!slice.isIntra())) -#endif { -#if JVET_M0170_MRG_SHARELIST tempCS->motionLut.lutShare = tempCS->motionLut.lut; -#if JVET_M0483_IBC tempCS->motionLut.lutShareIbc = tempCS->motionLut.lutIbc; -#endif m_shareBndPosX = uiLPelX; m_shareBndPosY = uiTPelY; m_shareBndSizeW = tempCS->area.lwidth(); m_shareBndSizeH = tempCS->area.lheight(); m_shareState = SHARING; -#endif } m_pcInterSearch->setShareState(m_shareState); setShareStateDec(m_shareState); -#endif partitioner.splitCurrArea( split, *tempCS ); -#if JVET_M0113_M0188_QG_SIZE bool qgEnableChildren = partitioner.currQgEnable(); // QG possible at children level -#endif m_CurrCtx++; tempCS->getRecoBuf().fill( 0 ); -#if JVET_M0427_INLOOP_RESHAPER tempCS->getPredBuf().fill(0); -#endif AffineMVInfo tmpMVInfo; bool isAffMVInfoSaved; m_pcInterSearch->savePrevAffMVInfo(0, tmpMVInfo, isAffMVInfoSaved); @@ -1342,7 +1178,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, tempCS->initSubStructure( *tempSubCS, partitioner.chType, subCUArea, false ); tempCS->initSubStructure( *bestSubCS, partitioner.chType, subCUArea, false ); -#if JVET_M0170_MRG_SHARELIST tempSubCS->sharedBndPos.x = (m_shareState == SHARING) ? m_shareBndPosX : tempSubCS->area.Y().lumaPos().x; tempSubCS->sharedBndPos.y = (m_shareState == SHARING) ? m_shareBndPosY : tempSubCS->area.Y().lumaPos().y; tempSubCS->sharedBndSize.width = (m_shareState == SHARING) ? m_shareBndSizeW : tempSubCS->area.lwidth(); @@ -1351,17 +1186,14 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, bestSubCS->sharedBndPos.y = (m_shareState == SHARING) ? m_shareBndPosY : tempSubCS->area.Y().lumaPos().y; bestSubCS->sharedBndSize.width = (m_shareState == SHARING) ? m_shareBndSizeW : tempSubCS->area.lwidth(); bestSubCS->sharedBndSize.height = (m_shareState == SHARING) ? m_shareBndSizeH : tempSubCS->area.lheight(); -#endif xCompressCU( tempSubCS, bestSubCS, partitioner ); if( bestSubCS->cost == MAX_DOUBLE ) { CHECK( split == CU_QUAD_SPLIT, "Split decision reusing cannot skip quad split" ); tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT tempCS->costDbOffset = 0; tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); -#endif m_CurrCtx--; partitioner.exitCurrSplit(); xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); @@ -1371,11 +1203,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, bool keepResi = KEEP_PRED_AND_RESI_SIGNALS; tempCS->useSubStructure( *bestSubCS, partitioner.chType, CS::getArea( *tempCS, subCUArea, partitioner.chType ), KEEP_PRED_AND_RESI_SIGNALS, true, keepResi, keepResi ); -#if JVET_M0113_M0188_QG_SIZE if( partitioner.currQgEnable() ) -#else - if(currDepth < pps.getMaxCuDQPDepth()) -#endif { tempCS->prevQP[partitioner.chType] = bestSubCS->prevQP[partitioner.chType]; } @@ -1387,14 +1215,12 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, partitioner.exitCurrSplit(); -#if JVET_M0170_MRG_SHARELIST if (startShareThisLevel == 1) { m_shareState = NO_SHARE; m_pcInterSearch->setShareState(m_shareState); setShareStateDec(m_shareState); } -#endif m_CurrCtx--; @@ -1428,18 +1254,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, { m_CABACEstimator->resetBits(); -#if JVET_M0421_SPLIT_SIG m_CABACEstimator->split_cu_mode( split, *tempCS, partitioner ); -#else - if( partitioner.canSplit( CU_QUAD_SPLIT, *tempCS ) ) - { - m_CABACEstimator->split_cu_flag( split == CU_QUAD_SPLIT, *tempCS, partitioner ); - } - if( split != CU_QUAD_SPLIT ) - { - m_CABACEstimator->split_cu_mode_mt( split, *tempCS, partitioner ); - } -#endif tempCS->fracBits += m_CABACEstimator->getEstFracBits(); // split bits } @@ -1448,9 +1263,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, tempCS->cost = m_pcRdCost->calcRdCost( tempCS->fracBits, tempCS->dist ); // Check Delta QP bits for splitted structure -#if JVET_M0113_M0188_QG_SIZE if( !qgEnableChildren ) // check at deepest QG level only -#endif xCheckDQP( *tempCS, partitioner, true ); // If the configuration being tested exceeds the maximum number of bytes for a slice / slice-segment, then @@ -1488,18 +1301,14 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, #endif { bestCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT bestCS->costDbOffset = 0; -#endif } } -#if JVET_M0428_ENC_DB_OPT else { bestCS->costDbOffset = 0; } tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); -#endif // RD check for sub partitioned coding structure. xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); @@ -1517,46 +1326,15 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { -#if !JVET_M0464_UNI_MTS - double bestInterCost = m_modeCtrl->getBestInterCost(); - double costSize2Nx2NemtFirstPass = m_modeCtrl->getEmtSize2Nx2NFirstPassCost(); - bool skipSecondEmtPass = m_modeCtrl->getSkipSecondEMTPass(); - const SPS &sps = *tempCS->sps; -#endif const PPS &pps = *tempCS->pps; -#if !JVET_M0464_UNI_MTS - const CodingUnit *bestCU = bestCS->getCU( partitioner.chType ); - const int maxSizeEMT = EMT_INTRA_MAX_CU_WITH_QTBT; - uint8_t considerEmtSecondPass = ( sps.getUseIntraEMT() && isLuma( partitioner.chType ) && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT ) ? 1 : 0; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS bool useIntraSubPartitions = false; double maxCostAllowedForChroma = MAX_DOUBLE; -#if JVET_M0464_UNI_MTS const CodingUnit *bestCU = bestCS->getCU( partitioner.chType ); -#endif -#endif Distortion interHad = m_modeCtrl->getInterHad(); -#if JVET_M0464_UNI_MTS { -#else - for( uint8_t emtCuFlag = 0; emtCuFlag <= considerEmtSecondPass; emtCuFlag++ ) - { - //Possible early EMT tests interruptions - //2) Second EMT pass. This "if clause" is necessary because of the NSST and PDPC "for loops". - if( emtCuFlag && skipSecondEmtPass ) - { - continue; - } - //3) if interHad is 0, only try further modes if some intra mode was already better than inter - if( m_pcEncCfg->getUsePbIntraFast() && !tempCS->slice->isIntra() && bestCU && CU::isInter( *bestCS->getCU( partitioner.chType ) ) && interHad == 0 ) - { - continue; - } -#endif tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); @@ -1574,24 +1352,16 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; //cu.ipcm = false; -#if !JVET_M0464_UNI_MTS - cu.emtFlag = emtCuFlag; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS cu.ispMode = NOT_INTRA_SUBPARTITIONS; -#endif CU::addPUs( cu ); tempCS->interHad = interHad; -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif if( isLuma( partitioner.chType ) ) { -#if JVET_M0102_INTRA_SUBPARTITIONS //the Intra SubPartitions mode uses the value of the best cost so far (luma if it is the fast version) to avoid test non-necessary lines const double bestCostSoFar = CS::isDualITree( *tempCS ) ? m_modeCtrl->getBestCostWithoutSplitFlags() : bestCU && bestCU->predMode == MODE_INTRA ? bestCS->lumaCost : bestCS->cost; m_pcIntraSearch->estIntraPredLumaQT( cu, partitioner, bestCostSoFar ); @@ -1606,9 +1376,6 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC maxCostAllowedForChroma = bestCS->cost < MAX_DOUBLE ? bestCS->cost - tempCS->lumaCost : MAX_DOUBLE; } } -#else - m_pcIntraSearch->estIntraPredLumaQT( cu, partitioner ); -#endif if (m_pcEncCfg->getUsePbIntraFast() && tempCS->dist == std::numeric_limits<Distortion>::max() && tempCS->interHad == 0) @@ -1616,39 +1383,25 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC interHad = 0; // JEM assumes only perfect reconstructions can from now on beat the inter mode m_modeCtrl->enforceInterHad( 0 ); -#if JVET_M0464_UNI_MTS return; -#else - continue; -#endif } if( !CS::isDualITree( *tempCS ) ) { cu.cs->picture->getRecoBuf( cu.Y() ).copyFrom( cu.cs->getRecoBuf( COMPONENT_Y ) ); -#if JVET_M0427_INLOOP_RESHAPER cu.cs->picture->getPredBuf(cu.Y()).copyFrom(cu.cs->getPredBuf(COMPONENT_Y)); -#endif } } if( tempCS->area.chromaFormat != CHROMA_400 && ( partitioner.chType == CHANNEL_TYPE_CHROMA || !CS::isDualITree( *tempCS ) ) ) { -#if JVET_M0102_INTRA_SUBPARTITIONS TUIntraSubPartitioner subTuPartitioner( partitioner ); m_pcIntraSearch->estIntraPredChromaQT( cu, ( !useIntraSubPartitions || ( CS::isDualITree( *cu.cs ) && !isLuma( CHANNEL_TYPE_CHROMA ) ) ) ? partitioner : subTuPartitioner, maxCostAllowedForChroma ); if( useIntraSubPartitions && !cu.ispMode ) { //At this point the temp cost is larger than the best cost. Therefore, we can already skip the remaining calculations -#if JVET_M0464_UNI_MTS return; -#else - continue; -#endif } -#else - m_pcIntraSearch->estIntraPredChromaQT( cu, partitioner ); -#endif } cu.rootCbf = false; @@ -1666,11 +1419,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC m_CABACEstimator->cu_transquant_bypass_flag( cu ); } -#if JVET_M0483_IBC if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag()) -#else - if( !cu.cs->slice->isIntra() -#endif && cu.Y().valid() ) { @@ -1679,9 +1428,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC m_CABACEstimator->pred_mode ( cu ); m_CABACEstimator->pcm_data ( cu, partitioner ); m_CABACEstimator->extend_ref_line( cu ); -#if JVET_M0102_INTRA_SUBPARTITIONS m_CABACEstimator->isp_mode ( cu ); -#endif m_CABACEstimator->cu_pred_data ( cu ); // Encode Coefficients @@ -1693,32 +1440,19 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC tempCS->fracBits = m_CABACEstimator->getEstFracBits(); tempCS->cost = m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist); -#if JVET_M0102_INTRA_SUBPARTITIONS -#if !JVET_M0464_UNI_MTS - double bestIspCost = cu.ispMode ? CS::isDualITree(*tempCS) ? tempCS->cost : tempCS->lumaCost : MAX_DOUBLE; -#endif const double tmpCostWithoutSplitFlags = tempCS->cost; -#endif xEncodeDontSplit( *tempCS, partitioner ); xCheckDQP( *tempCS, partitioner ); -#if JVET_M0102_INTRA_SUBPARTITIONS if( tempCS->cost < bestCS->cost ) { m_modeCtrl->setBestCostWithoutSplitFlags( tmpCostWithoutSplitFlags ); } -#endif -#if JVET_M0428_ENC_DB_OPT xCalDebCost( *tempCS, partitioner ); tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); -#endif -#if !JVET_M0464_UNI_MTS - // we save the cost of the modes for the first EMT pass - if( !emtCuFlag ) static_cast< double& >( costSize2Nx2NemtFirstPass ) = tempCS->cost; -#endif #if WCG_EXT DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); @@ -1727,35 +1461,6 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC #endif xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - //we decide to skip the second emt pass or not according to the ISP results - if (considerEmtSecondPass && cu.ispMode && !emtCuFlag && tempCS->slice->isIntra()) - { - double bestCostDct2NoIsp = m_modeCtrl->getEmtFirstPassNoIspCost(); - CHECKD(bestCostDct2NoIsp <= bestIspCost, "wrong cost!"); - double nSamples = (double)(cu.lwidth() << g_aucLog2[cu.lheight()]); - double threshold = 1 + 1.4 / sqrt(nSamples); - if (bestCostDct2NoIsp > bestIspCost*threshold) - { - skipSecondEmtPass = true; - m_modeCtrl->setSkipSecondEMTPass(true); - break; - } - } -#endif - //now we check whether the second pass of SIZE_2Nx2N and the whole Intra SIZE_NxN should be skipped or not - if( !emtCuFlag && !tempCS->slice->isIntra() && bestCU && bestCU->predMode != MODE_INTRA && m_pcEncCfg->getFastInterEMT() ) - { - const double thEmtInterFastSkipIntra = 1.4; // Skip checking Intra if "2Nx2N using DCT2" is worse than best Inter mode - if( costSize2Nx2NemtFirstPass > thEmtInterFastSkipIntra * bestInterCost ) - { - skipSecondEmtPass = true; - m_modeCtrl->setSkipSecondEMTPass( true ); - break; - } - } -#endif } //for emtCuFlag } @@ -1793,11 +1498,7 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P m_CABACEstimator->cu_transquant_bypass_flag( cu ); } -#if JVET_M0483_IBC if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag()) -#else - if( !cu.cs->slice->isIntra() -#endif && cu.Y().valid() ) { @@ -1814,10 +1515,8 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P xCheckDQP( *tempCS, partitioner ); -#if JVET_M0428_ENC_DB_OPT xCalDebCost( *tempCS, partitioner ); tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); -#endif #if WCG_EXT DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); @@ -1842,23 +1541,11 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep return; } -#if JVET_M0113_M0188_QG_SIZE if( !partitioner.currQgEnable() ) // do not consider split or leaf/not leaf QG condition (checked by caller) -#else - // partitioner.currDepth != cs.pps->getMaxCuDQPDepth() means we are not at leaf QG level (condition needed to call predictQP only once per QG) - if( bKeepCtx && partitioner.currDepth != cs.pps->getMaxCuDQPDepth() ) -#endif { return; } -#if !JVET_M0113_M0188_QG_SIZE - // not split or implicit, and deeper than QG (never happens with JVET_M0113_M0188_QG_SIZE) - if( !bKeepCtx && partitioner.currDepth > cs.pps->getMaxCuDQPDepth() ) - { - return; - } -#endif CodingUnit* cuFirst = cs.getCU( partitioner.chType ); @@ -1926,7 +1613,6 @@ void EncCu::xFillPCMBuffer( CodingUnit &cu ) const CPelBuf source = tu.cs->getOrgBuf( compArea ); PelBuf destination = tu.getPcmbuf( compID ); -#if JVET_M0427_INLOOP_RESHAPER if (tu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) { CompArea tmpArea(COMPONENT_Y, compArea.chromaFormat, Position(0, 0), compArea.size()); @@ -1936,12 +1622,10 @@ void EncCu::xFillPCMBuffer( CodingUnit &cu ) destination.copyFrom(tempOrgBuf); } else -#endif destination.copyFrom( source ); } } } -#if JVET_M0253_HASH_ME void EncCu::xCheckRDCostHashInter( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { bool isPerfectMatch = false; @@ -1958,9 +1642,6 @@ void EncCu::xCheckRDCostHashInter( CodingStructure *&tempCS, CodingStructure *&b cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; -#if !JVET_M0483_IBC - cu.ibc = false; -#endif CU::addPUs(cu); cu.mmvdSkip = false; cu.firstPU->mmvdMergeFlag = false; @@ -1969,28 +1650,17 @@ void EncCu::xCheckRDCostHashInter( CodingStructure *&tempCS, CodingStructure *&b { double equGBiCost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif -#if JVET_M0464_UNI_MTS xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 0 , 0 , &equGBiCost -#else - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 0 - , 1 - , 0 - , &equGBiCost -#endif ); -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif } tempCS->initStructData(encTestMode.qp, encTestMode.lossless); @@ -2000,7 +1670,6 @@ void EncCu::xCheckRDCostHashInter( CodingStructure *&tempCS, CodingStructure *&b } m_modeCtrl->setIsHashPerfectMatch(isPerfectMatch); } -#endif void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { @@ -2019,9 +1688,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& mergeCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); } -#if JVET_M0147_DMVR Mv refinedMvdL0[MAX_NUM_PARTS_IN_CTU][MRG_MAX_NUM_CANDS]; -#endif setMergeBestSATDCost( MAX_DOUBLE ); { @@ -2037,16 +1704,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& PredictionUnit pu( tempCS->area ); pu.cu = &cu; pu.cs = tempCS; -#if JVET_M0170_MRG_SHARELIST pu.shareParentPos = tempCS->sharedBndPos; pu.shareParentSize = tempCS->sharedBndSize; -#endif PU::getInterMergeCandidates(pu, mergeCtx , 0 ); -#if !JVET_M0068_M0171_MMVD_CLEANUP - PU::restrictBiPredMergeCands(pu, mergeCtx); -#endif PU::getInterMMVDMergeCandidates(pu, mergeCtx); } bool candHasNoResidual[MRG_MAX_NUM_CANDS + MMVD_ADD_NUM]; @@ -2109,11 +1771,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) { -#if JVET_M0483_IBC if (slice.getSPS()->getIBCFlag()) -#else - if (slice.getSPS()->getIBCMode()) -#endif { ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx(); bestIsSkip = blkCache->isSkip(tempCS->area) && cuECtx.bestCU; @@ -2163,38 +1821,21 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcRdCost->setDistParam (distParam, tempCS->getOrgBuf().Y(), m_acMergeBuffer[0].Y(), sps.getBitDepth (CHANNEL_TYPE_LUMA), COMPONENT_Y, bUseHadamard); const UnitArea localUnitArea( tempCS->area.chromaFormat, Area( 0, 0, tempCS->area.Y().width, tempCS->area.Y().height) ); -#if JVET_M0483_IBC==0 - uint32_t ibcCand = 0; - uint32_t numValidMv = mergeCtx.numValidMergeCand; -#endif for( uint32_t uiMergeCand = 0; uiMergeCand < mergeCtx.numValidMergeCand; uiMergeCand++ ) { -#if JVET_M0483_IBC==0 - if ((mergeCtx.interDirNeighbours[uiMergeCand] == 1 || mergeCtx.interDirNeighbours[uiMergeCand] == 3) && tempCS->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[uiMergeCand << 1].refIdx)->getPOC() == tempCS->slice->getPOC()) - { - ibcCand++; - numValidMv--; - continue; - } -#endif mergeCtx.setMergeInfo( pu, uiMergeCand ); PU::spanMotionInfo( pu, mergeCtx ); -#if JVET_M0147_DMVR pu.mvRefine = true; -#endif distParam.cur = singleMergeTempBuffer->Y(); m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer); acMergeBuffer[uiMergeCand] = m_acRealMergeBuffer[uiMergeCand].getBuf(localUnitArea); acMergeBuffer[uiMergeCand].copyFrom(*singleMergeTempBuffer); -#if JVET_M0147_DMVR pu.mvRefine = false; -#endif if( mergeCtx.interDirNeighbours[uiMergeCand] == 3 && mergeCtx.mrgTypeNeighbours[uiMergeCand] == MRG_TYPE_DEFAULT_N ) { mergeCtx.mvFieldNeighbours[2*uiMergeCand].mv = pu.mv[0]; mergeCtx.mvFieldNeighbours[2*uiMergeCand+1].mv = pu.mv[1]; -#if JVET_M0147_DMVR { int dx, dy, i, j, num = 0; dy = std::min<int>(pu.lumaSize().height, DMVR_SUBCU_HEIGHT); @@ -2211,7 +1852,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } } -#endif } Distortion uiSad = distParam.distFunc(distParam); @@ -2241,18 +1881,8 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& swap(singleMergeTempBuffer, acMergeTempBuffer[insertPos]); } } -#if JVET_M0483_IBC==0 - CHECK(std::min(uiMergeCand + 1 - ibcCand, uiNumMrgSATDCand) != RdModeList.size(), ""); -#else CHECK(std::min(uiMergeCand + 1, uiNumMrgSATDCand) != RdModeList.size(), ""); -#endif } -#if JVET_M0483_IBC==0 - if (numValidMv < uiNumMrgSATDCand) - uiNumMrgSATDCand = numValidMv; - if (numValidMv == 0) - return; -#endif if (isIntrainterEnabled) { @@ -2269,19 +1899,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& // save the to-be-tested merge candidates uint32_t MHIntraMergeCand[NUM_MRG_SATD_CAND]; -#if JVET_M0483_IBC==0 - for (uint32_t mergeCnt = 0; mergeCnt < std::min(NUM_MRG_SATD_CAND, (const int) uiNumMrgSATDCand); mergeCnt++) -#else for (uint32_t mergeCnt = 0; mergeCnt < std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand); mergeCnt++) -#endif { MHIntraMergeCand[mergeCnt] = RdModeList[mergeCnt]; } -#if JVET_M0483_IBC==0 - for (uint32_t mergeCnt = 0; mergeCnt < std::min( std::min(NUM_MRG_SATD_CAND, (const int)uiNumMrgSATDCand), 4); mergeCnt++) -#else for (uint32_t mergeCnt = 0; mergeCnt < std::min(std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand), 4); mergeCnt++) -#endif { uint32_t mergeCand = MHIntraMergeCand[mergeCnt]; acMergeBuffer[mergeCand] = m_acRealMergeBuffer[mergeCand].getBuf(localUnitArea); @@ -2321,29 +1943,23 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcIntraSearch->switchBuffer(pu, COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); } pu.cs->getPredBuf(pu).copyFrom(acMergeBuffer[mergeCand]); -#if JVET_M0427_INLOOP_RESHAPER if (pu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); } -#endif m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); // calculate cost -#if JVET_M0427_INLOOP_RESHAPER if (pu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getInvLUT()); } -#endif distParam.cur = pu.cs->getPredBuf(pu).Y(); Distortion sadValue = distParam.distFunc(distParam); -#if JVET_M0427_INLOOP_RESHAPER if (pu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); } -#endif m_CABACEstimator->getCtx() = SubCtx(Ctx::MHIntraPredMode, ctxStartIntraMode); uint64_t fracModeBits = m_pcIntraSearch->xFracModeBitsIntra(pu, pu.intraDir[0], CHANNEL_TYPE_LUMA); double cost = (double)sadValue + (double)(bitsCand + 1) * sqrtLambdaForFirstPass + (double)fracModeBits * sqrtLambdaForFirstPassIntra; @@ -2372,9 +1988,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& cu.mmvdSkip = true; int tempNum = 0; tempNum = MMVD_ADD_NUM; -#if !JVET_M0823_MMVD_ENCOPT - bool allowDirection[4] = { true, true, true, true }; -#endif for (uint32_t mergeCand = mergeCtx.numValidMergeCand; mergeCand < mergeCtx.numValidMergeCand + tempNum; mergeCand++) { const int mmvdMergeCand = mergeCand - mergeCtx.numValidMergeCand; @@ -2384,22 +1997,8 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& int bitsCand = 0; int baseIdx; int refineStep; -#if !JVET_M0823_MMVD_ENCOPT - int direction; -#endif baseIdx = mmvdMergeCand / MMVD_MAX_REFINE_NUM; refineStep = (mmvdMergeCand - (baseIdx * MMVD_MAX_REFINE_NUM)) / 4; -#if !JVET_M0823_MMVD_ENCOPT - direction = (mmvdMergeCand - baseIdx * MMVD_MAX_REFINE_NUM - refineStep * 4) % 4; - if (refineStep == 0) - { - allowDirection[direction] = true; - } - if (allowDirection[direction] == false) - { - continue; - } -#endif bitsBaseIdx = baseIdx + 1; if (baseIdx == MMVD_BASE_MV_NUM - 1) { @@ -2418,29 +2017,18 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& mergeCtx.setMmvdMergeCandiInfo(pu, mmvdMergeCand); PU::spanMotionInfo(pu, mergeCtx); -#if JVET_M0147_DMVR pu.mvRefine = true; -#endif distParam.cur = singleMergeTempBuffer->Y(); -#if JVET_M0823_MMVD_ENCOPT pu.mmvdEncOptMode = (refineStep > 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); pu.mmvdEncOptMode = 0; -#else - m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer); -#endif -#if JVET_M0147_DMVR // store the refined MV pu.mvRefine = false; -#endif Distortion uiSad = distParam.distFunc(distParam); double cost = (double)uiSad + (double)bitsCand * sqrtLambdaForFirstPass; -#if !JVET_M0823_MMVD_ENCOPT - allowDirection[direction] = cost > 1.3 * candCostList[0] ? 0 : 1; -#endif insertPos = -1; updateDoubleCandList(mergeCand, cost, RdModeList, candCostList, RdModeList2, (uint32_t)NUM_LUMA_MODE, uiNumMrgSATDCand, &insertPos); if (insertPos != -1) @@ -2502,15 +2090,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } } -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif -#if !JVET_M0253_HASH_ME - const uint32_t iteration = encTestMode.lossless ? 1 : 2; - - // 2. Pass: check candidates using full RD test - for( uint32_t uiNoResidualPass = 0; uiNoResidualPass < iteration; uiNoResidualPass++ ) -#else uint32_t iteration; uint32_t iterationBegin = m_modeCtrl->getIsHashPerfectMatch() ? 1 : 0; if (encTestMode.lossless) @@ -2523,19 +2103,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& iteration = 2; } for (uint32_t uiNoResidualPass = iterationBegin; uiNoResidualPass < iteration; ++uiNoResidualPass) -#endif { for( uint32_t uiMrgHADIdx = 0; uiMrgHADIdx < uiNumMrgSATDCand; uiMrgHADIdx++ ) { uint32_t uiMergeCand = RdModeList[uiMrgHADIdx]; -#if JVET_M0483_IBC==0 - if(uiMergeCand < mergeCtx.numValidMergeCand) - if ((mergeCtx.interDirNeighbours[uiMergeCand] == 1 || mergeCtx.interDirNeighbours[uiMergeCand] == 3) && tempCS->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[uiMergeCand << 1].refIdx)->getPOC() == tempCS->slice->getPOC()) - { - continue; - } -#endif if (uiNoResidualPass != 0 && uiMergeCand >= (MRG_MAX_NUM_CANDS + MMVD_ADD_NUM)) // intrainter does not support skip mode { @@ -2594,7 +2166,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } PU::spanMotionInfo( pu, mergeCtx ); -#if JVET_M0445_MCTS && JVET_M0147_DMVR if( m_pcEncCfg->getMCTSEncConstraint() ) { bool isDMVR = PU::checkDMVRCondition( pu ); @@ -2605,10 +2176,8 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& continue; } } -#endif if( mrgTempBufSet ) { -#if JVET_M0147_DMVR { int dx, dy, i, j, num = 0; dy = std::min<int>(pu.lumaSize().height, DMVR_SUBCU_HEIGHT); @@ -2625,18 +2194,15 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } } -#endif if (pu.mhIntraFlag) { uint32_t bufIdx = (pu.intraDir[0] > 1) ? (pu.intraDir[0] == HOR_IDX ? 2 : 3) : pu.intraDir[0]; PelBuf tmpBuf = tempCS->getPredBuf(pu).Y(); tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Y()); -#if JVET_M0427_INLOOP_RESHAPER if (pu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { tmpBuf.rspSignal(m_pcReshape->getFwdLUT()); } -#endif m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, bufIdx)); tmpBuf = tempCS->getPredBuf(pu).Cb(); tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cb()); @@ -2647,13 +2213,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } else { -#if JVET_M0823_MMVD_ENCOPT if (uiMergeCand >= mergeCtx.numValidMergeCand && uiMergeCand < MRG_MAX_NUM_CANDS + MMVD_ADD_NUM) { pu.mmvdEncOptMode = 0; m_pcInterSearch->motionCompensation(pu); } else -#endif if (uiNoResidualPass != 0 && uiMergeCand < mergeCtx.numValidMergeCand && RdModeList[uiMrgHADIdx] >= (MRG_MAX_NUM_CANDS + MMVD_ADD_NUM)) { tempCS->getPredBuf().copyFrom(acMergeBuffer[uiMergeCand]); @@ -2666,13 +2230,9 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } else { -#if JVET_M0147_DMVR pu.mvRefine = true; -#endif m_pcInterSearch->motionCompensation( pu ); -#if JVET_M0147_DMVR pu.mvRefine = false; -#endif } if (!cu.mmvdSkip && !pu.mhIntraFlag && uiNoResidualPass != 0) { @@ -2680,21 +2240,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& isTestSkipMerge[uiMergeCand] = true; } -#if JVET_M0464_UNI_MTS xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, uiNoResidualPass, uiNoResidualPass == 0 ? &candHasNoResidual[uiMrgHADIdx] : NULL ); -#else - xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, uiNoResidualPass - , 1 - , uiNoResidualPass == 0 ? &candHasNoResidual[uiMrgHADIdx] : NULL); -#endif if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip && !pu.mhIntraFlag) { -#if JVET_M0445_MCTS bestIsSkip = !bestCS->cus.empty() && bestCS->getCU( partitioner.chType )->rootCbf == 0; -#else - bestIsSkip = bestCS->getCU( partitioner.chType )->rootCbf == 0; -#endif } tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); }// end loop uiMrgHADIdx @@ -2730,12 +2280,10 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } } -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif } void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) @@ -2804,14 +2352,12 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru triangleMrgCtx.setMergeInfo( pu, mergeCand ); PU::spanMotionInfo( pu, triangleMrgCtx ); -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( pu ) ) ) ) { // Do not use this mode tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); return; } -#endif m_pcInterSearch->motionCompensation( pu, triangleBuffer[mergeCand] ); } } @@ -2856,42 +2402,24 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru for( uint8_t mergeCand = 0; mergeCand < numTriangleCandidate; mergeCand++ ) { -#if JVET_M0883_TRIANGLE_SIGNALING bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; -#else - bool splitDir = g_triangleCombination[mergeCand][0]; - uint8_t candIdx0 = g_triangleCombination[mergeCand][1]; - uint8_t candIdx1 = g_triangleCombination[mergeCand][2]; -#endif -#if JVET_M0883_TRIANGLE_SIGNALING pu.triangleSplitDir = splitDir; pu.triangleMergeIdx0 = candIdx0; pu.triangleMergeIdx1 = candIdx1; -#else - pu.mergeIdx = mergeCand; -#endif pu.mergeFlag = true; triangleWeightedBuffer[mergeCand] = m_acTriangleWeightedBuffer[mergeCand].getBuf( localUnitArea ); triangleBuffer[candIdx0] = m_acMergeBuffer[candIdx0].getBuf( localUnitArea ); triangleBuffer[candIdx1] = m_acMergeBuffer[candIdx1].getBuf( localUnitArea ); -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_LUMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); -#else - m_pcInterSearch->weightedTriangleBlk( pu, PU::getTriangleWeights(pu, triangleMrgCtx, candIdx0, candIdx1), splitDir, CHANNEL_TYPE_LUMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); -#endif distParam.cur = triangleWeightedBuffer[mergeCand].Y(); Distortion uiSad = distParam.distFunc( distParam ); -#if JVET_M0883_TRIANGLE_SIGNALING uint32_t uiBitsCand = m_triangleIdxBins[splitDir][candIdx0][candIdx1]; -#else - uint32_t uiBitsCand = g_triangleIdxBins[mergeCand]; -#endif double cost = (double)uiSad + (double)uiBitsCand * sqrtLambdaForFirstPass; @@ -2915,42 +2443,22 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru for( uint8_t i = 0; i < triangleNumMrgSATDCand; i++ ) { uint8_t mergeCand = triangleRdModeList[i]; -#if JVET_M0883_TRIANGLE_SIGNALING bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; -#else - bool splitDir = g_triangleCombination[mergeCand][0]; - uint8_t candIdx0 = g_triangleCombination[mergeCand][1]; - uint8_t candIdx1 = g_triangleCombination[mergeCand][2]; -#endif -#if JVET_M0883_TRIANGLE_SIGNALING pu.triangleSplitDir = splitDir; pu.triangleMergeIdx0 = candIdx0; pu.triangleMergeIdx1 = candIdx1; -#else - pu.mergeIdx = mergeCand; -#endif pu.mergeFlag = true; -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_CHROMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); -#else - m_pcInterSearch->weightedTriangleBlk( pu, PU::getTriangleWeights(pu, triangleMrgCtx, candIdx0, candIdx1), splitDir, CHANNEL_TYPE_CHROMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); -#endif } tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); } -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif { -#if !JVET_M0253_HASH_ME - const uint8_t iteration = encTestMode.lossless ? 1 : 2; - for( uint8_t noResidualPass = 0; noResidualPass < iteration; noResidualPass++ ) -#else uint8_t iteration; uint8_t iterationBegin = m_modeCtrl->getIsHashPerfectMatch() ? 1 : 0; if (encTestMode.lossless) @@ -2963,7 +2471,6 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru iteration = 2; } for (uint8_t noResidualPass = iterationBegin; noResidualPass < iteration; ++noResidualPass) -#endif { for( uint8_t mrgHADIdx = 0; mrgHADIdx < triangleNumMrgSATDCand; mrgHADIdx++ ) { @@ -2975,15 +2482,9 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru continue; } -#if JVET_M0883_TRIANGLE_SIGNALING bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; -#else - bool splitDir = g_triangleCombination[mergeCand][0]; - uint8_t candIdx0 = g_triangleCombination[mergeCand][1]; - uint8_t candIdx1 = g_triangleCombination[mergeCand][2]; -#endif CodingUnit &cu = tempCS->addCU(tempCS->area, partitioner.chType); @@ -3002,29 +2503,19 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru cu.GBiIdx = GBI_DEFAULT; PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType); -#if JVET_M0883_TRIANGLE_SIGNALING pu.triangleSplitDir = splitDir; pu.triangleMergeIdx0 = candIdx0; pu.triangleMergeIdx1 = candIdx1; -#else - pu.mergeIdx = mergeCand; -#endif pu.mergeFlag = true; -#if JVET_M0883_TRIANGLE_SIGNALING PU::spanTriangleMotionInfo(pu, triangleMrgCtx, splitDir, candIdx0, candIdx1 ); -#else - PU::spanTriangleMotionInfo(pu, triangleMrgCtx, mergeCand, splitDir, candIdx0, candIdx1 ); -#endif -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( *cu.firstPU ) ) ) ) { // Do not use this mode tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); return; } -#endif if( tempBufSet ) { tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); @@ -3034,18 +2525,10 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru triangleBuffer[candIdx0] = m_acMergeBuffer[candIdx0].getBuf( localUnitArea ); triangleBuffer[candIdx1] = m_acMergeBuffer[candIdx1].getBuf( localUnitArea ); PelUnitBuf predBuf = tempCS->getPredBuf(); -#if JVET_M0328_KEEP_ONE_WEIGHT_GROUP m_pcInterSearch->weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); -#else - m_pcInterSearch->weightedTriangleBlk( pu, PU::getTriangleWeights(pu, triangleMrgCtx, candIdx0, candIdx1), splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); -#endif } -#if JVET_M0464_UNI_MTS xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, ( noResidualPass == 0 ? &trianglecandHasNoResidual[mergeCand] : NULL ) ); -#else - xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, true, ( (noResidualPass == 0 ) ? &trianglecandHasNoResidual[mergeCand] : NULL ) ); -#endif if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip) { @@ -3055,12 +2538,10 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru }// end loop mrgHADIdx } } -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif } void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) @@ -3074,9 +2555,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct { return; } -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif const Slice &slice = *tempCS->slice; CHECK( slice.getSliceType() == I_SLICE, "Affine Merge modes not available for I-slices" ); @@ -3238,12 +2717,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct } } -#if !JVET_M0253_HASH_ME - const uint32_t iteration = encTestMode.lossless ? 1 : 2; - - // 2. Pass: check candidates using full RD test - for ( uint32_t uiNoResidualPass = 0; uiNoResidualPass < iteration; uiNoResidualPass++ ) -#else uint32_t iteration; uint32_t iterationBegin = m_modeCtrl->getIsHashPerfectMatch() ? 1 : 0; if (encTestMode.lossless) @@ -3256,7 +2729,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct iteration = 2; } for (uint32_t uiNoResidualPass = iterationBegin; uiNoResidualPass < iteration; ++uiNoResidualPass) -#endif { for ( uint32_t uiMrgHADIdx = 0; uiMrgHADIdx < uiNumMrgSATDCand; uiMrgHADIdx++ ) { @@ -3306,14 +2778,12 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct PU::spanMotionInfo( pu ); } -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( *cu.firstPU ) ) ) ) { // Do not use this mode tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); return; } -#endif if ( mrgTempBufSet ) { tempCS->getPredBuf().copyFrom( acMergeBuffer[uiMergeCand] ); @@ -3323,11 +2793,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct m_pcInterSearch->motionCompensation( pu ); } -#if JVET_M0464_UNI_MTS xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, uiNoResidualPass, ( uiNoResidualPass == 0 ? &candHasNoResidual[uiMergeCand] : NULL ) ); -#else - xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, uiNoResidualPass, true, ((uiNoResidualPass == 0) ? &candHasNoResidual[uiMergeCand] : NULL) ); -#endif if ( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) { @@ -3367,12 +2833,10 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct } } } -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif } ////////////////////////////////////////////////////////////////////////////////////////////// // ibc merge/skip mode check @@ -3400,12 +2864,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct // first get merge candidates CodingUnit cu(tempCS->area); cu.cs = tempCS; -#if JVET_M0483_IBC cu.predMode = MODE_IBC; -#else - cu.predMode = MODE_INTER; - cu.ibc = true; -#endif cu.slice = tempCS->slice; #if HEVC_TILES_WPP cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); @@ -3416,17 +2875,9 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.mmvdSkip = false; pu.mmvdMergeFlag = false; cu.triangle = false; -#if JVET_M0170_MRG_SHARELIST pu.shareParentPos = tempCS->sharedBndPos; pu.shareParentSize = tempCS->sharedBndSize; -#endif -#if JVET_M0483_IBC PU::getIBCMergeCandidates(pu, mergeCtx); -#else - PU::getInterMergeCandidates(pu, mergeCtx - , 0 - ); -#endif } int candHasNoResidual[MRG_MAX_NUM_CANDS]; @@ -3457,12 +2908,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); #endif cu.skip = false; -#if JVET_M0483_IBC cu.predMode = MODE_IBC; -#else - cu.predMode = MODE_INTER; - cu.ibc = true; -#endif cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; @@ -3475,7 +2921,6 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct Picture* refPic = pu.cu->slice->getPic(); const CPelBuf refBuf = refPic->getRecoBuf(pu.blocks[COMPONENT_Y]); const Pel* piRefSrch = refBuf.buf; -#if JVET_M0427_INLOOP_RESHAPER if (tempCS->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { const CompArea &area = cu.blocks[COMPONENT_Y]; @@ -3486,25 +2931,12 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct m_pcRdCost->setDistParam(distParam, tmpLuma, refBuf, sps.getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y, bUseHadamard); } else -#endif m_pcRdCost->setDistParam(distParam, tempCS->getOrgBuf().Y(), refBuf, sps.getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y, bUseHadamard); int refStride = refBuf.stride; const UnitArea localUnitArea(tempCS->area.chromaFormat, Area(0, 0, tempCS->area.Y().width, tempCS->area.Y().height)); int numValidBv = mergeCtx.numValidMergeCand; for (unsigned int mergeCand = 0; mergeCand < mergeCtx.numValidMergeCand; mergeCand++) { -#if JVET_M0483_IBC==0 - if (mergeCtx.interDirNeighbours[mergeCand] != 1) - { - numValidBv--; - continue; - } - if (tempCS->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[mergeCand << 1].refIdx)->getPOC() != tempCS->slice->getPOC()) - { - numValidBv--; - continue; - } -#endif mergeCtx.setMergeInfo(pu, mergeCand); // set bv info in merge mode const int cuPelX = pu.Y().x; const int cuPelY = pu.Y().y; @@ -3557,9 +2989,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct tempCS->dist = 0; tempCS->fracBits = 0; tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT tempCS->costDbOffset = 0; -#endif tempCS->initStructData(encTestMode.qp, encTestMode.lossless); return; } @@ -3570,45 +3000,18 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct const unsigned int iteration = encTestMode.lossless ? 1 : 2; -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif // 2. Pass: check candidates using full RD test for (unsigned int numResidualPass = 0; numResidualPass < iteration; numResidualPass++) { for (unsigned int mrgHADIdx = 0; mrgHADIdx < numMrgSATDCand; mrgHADIdx++) { unsigned int mergeCand = RdModeList[mrgHADIdx]; -#if JVET_M0483_IBC==0 - if (mergeCtx.interDirNeighbours[mergeCand] != 1) - { - continue; - } - if (tempCS->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[mergeCand << 1].refIdx)->getPOC() != tempCS->slice->getPOC()) - { - continue; - } -#endif if (!(numResidualPass == 1 && candHasNoResidual[mergeCand] == 1)) { if (!(bestIsSkip && (numResidualPass == 0))) { -#if JVET_M0464_UNI_MTS { -#else - unsigned char considerEmtSecondPass = 0; - bool skipSecondEmtPass = true; - bool hasResidual[2] = { false, false }; - double emtCost[2] = { MAX_DOUBLE, MAX_DOUBLE }; - - // CU-level optimization - for (unsigned char emtCuFlag = 0; emtCuFlag <= considerEmtSecondPass; emtCuFlag++) - { - if (m_pcEncCfg->getFastInterEMT() && emtCuFlag && skipSecondEmtPass) - { - continue; - } -#endif // first get merge candidates CodingUnit &cu = tempCS->addCU(CS::getArea(*tempCS, tempCS->area, (const ChannelType)partitioner.chType), (const ChannelType)partitioner.chType); @@ -3619,21 +3022,11 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); #endif cu.skip = false; -#if JVET_M0483_IBC cu.predMode = MODE_IBC; -#else - cu.predMode = MODE_INTER; - cu.ibc = true; -#endif cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; -#if !JVET_M0464_UNI_MTS - cu.emtFlag = false; -#endif -#if JVET_M0140_SBT cu.sbtInfo = 0; -#endif PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType);// tempCS->addPU(cu); pu.intraDir[0] = DC_IDX; // set intra pred for ibc block @@ -3658,34 +3051,18 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct xCheckDQP (*tempCS, partitioner); #else // this if-check is redundant -#if JVET_M0113_M0188_QG_SIZE if (tempCS->pps->getUseDQP() && partitioner.currQgEnable()) -#else - if (tempCS->pps->getUseDQP() && (partitioner.currDepth) <= tempCS->pps->getMaxCuDQPDepth()) -#endif { xCheckDQP(*tempCS, partitioner); } #endif -#if !JVET_M0464_UNI_MTS - hasResidual[emtCuFlag] = cu.rootCbf; - emtCost[emtCuFlag] = tempCS->cost; -#endif DTRACE_MODE_COST(*tempCS, m_pcRdCost->getLambda()); xCheckBestMode(tempCS, bestCS, partitioner, encTestMode); tempCS->initStructData(encTestMode.qp, encTestMode.lossless); } -#if !JVET_M0464_UNI_MTS - if (numResidualPass == 0 && (emtCost[0] <= emtCost[1] ? !hasResidual[0] : !hasResidual[1])) - - { - // If no residual when allowing for one, then set mark to not try case where residual is forced to 0 - candHasNoResidual[mergeCand] = 1; - } -#endif if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip) { @@ -3698,12 +3075,10 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct } } } -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif } void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) @@ -3715,9 +3090,7 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best tempCS->initStructData(encTestMode.qp, encTestMode.lossless); -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif CodingUnit &cu = tempCS->addCU(CS::getArea(*tempCS, tempCS->area, partitioner.chType), partitioner.chType); @@ -3727,27 +3100,16 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); #endif cu.skip = false; -#if JVET_M0483_IBC cu.predMode = MODE_IBC; -#else - cu.predMode = MODE_INTER; -#endif cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; -#if JVET_M0483_IBC==0 - cu.ibc = true; -#endif cu.imv = 0; -#if JVET_M0140_SBT cu.sbtInfo = 0; -#endif CU::addPUs(cu); -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif PredictionUnit& pu = *cu.firstPU; cu.mmvdSkip = false; @@ -3757,11 +3119,7 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best pu.intraDir[1] = PLANAR_IDX; // set intra pred for ibc block pu.interDir = 1; // use list 0 for IBC mode -#if JVET_M0483_IBC pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF; // last idx in the list -#else - pu.refIdx[REF_PIC_LIST_0] = pu.cs->slice->getNumRefIdx(REF_PIC_LIST_0) - 1; // last idx in the list -#endif if (partitioner.chType == CHANNEL_TYPE_LUMA) { @@ -3774,94 +3132,31 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best // MC m_pcInterSearch->motionCompensation(pu, REF_PIC_LIST_0, true, chroma); -#if JVET_M0464_UNI_MTS { -#else - double bestCost = bestCS->cost; - unsigned char considerEmtSecondPass = 0; - bool skipSecondEmtPass = true; - double emtFirstPassCost = MAX_DOUBLE; - - // CU-level optimization - - for (unsigned char emtCuFlag = 0; emtCuFlag <= considerEmtSecondPass; emtCuFlag++) - { - if (m_pcEncCfg->getFastInterEMT() && emtCuFlag && skipSecondEmtPass) - { - continue; - } - - tempCS->getCU(tempCS->chType)->emtFlag = emtCuFlag; -#endif m_pcInterSearch->encodeResAndCalcRdInterCU(*tempCS, partitioner, false, true, chroma); -#if !JVET_M0464_UNI_MTS - if (m_pcEncCfg->getFastInterEMT()) - { - emtFirstPassCost = (!emtCuFlag) ? tempCS->cost : emtFirstPassCost; - } -#endif xEncodeDontSplit(*tempCS, partitioner); #if ENABLE_QPA_SUB_CTU xCheckDQP (*tempCS, partitioner); #else // this if-check is redundant -#if JVET_M0113_M0188_QG_SIZE if (tempCS->pps->getUseDQP() && partitioner.currQgEnable()) -#else - if (tempCS->pps->getUseDQP() && (partitioner.currDepth) <= tempCS->pps->getMaxCuDQPDepth()) -#endif { xCheckDQP(*tempCS, partitioner); } #endif -#if JVET_M0428_ENC_DB_OPT tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); if ( m_bestModeUpdated ) { xCalDebCost( *tempCS, partitioner ); } -#endif DTRACE_MODE_COST(*tempCS, m_pcRdCost->getLambda()); xCheckBestMode(tempCS, bestCS, partitioner, encTestMode); -#if !JVET_M0464_UNI_MTS - //now we check whether the second pass should be skipped or not - if (!emtCuFlag && considerEmtSecondPass) - { - static const double thresholdToSkipEmtSecondPass = 1.1; // Skip checking EMT transforms - if (m_pcEncCfg->getFastInterEMT() && (!cu.firstTU->cbf[COMPONENT_Y] || emtFirstPassCost > bestCost * thresholdToSkipEmtSecondPass)) - { - skipSecondEmtPass = true; - } - else //EMT will be checked - { - if (bestCost == bestCS->cost) //The first EMT pass didn't become the bestCS, so we clear the TUs generated - { - tempCS->clearTUs(); - } - else - { - tempCS->initStructData(bestCS->currQP[bestCS->chType], bestCS->isLossless); - - tempCS->copyStructure(*bestCS, partitioner.chType); - tempCS->getPredBuf().copyFrom(bestCS->getPredBuf()); - } - - //we need to restart the distortion for the new tempCS, the bit count and the cost - tempCS->dist = 0; - tempCS->fracBits = 0; - tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT - tempCS->costDbOffset = 0; -#endif - } - } -#endif } } // bValid @@ -3870,9 +3165,7 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best tempCS->dist = 0; tempCS->fracBits = 0; tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT tempCS->costDbOffset = 0; -#endif } } // chroma CU ibc comp @@ -3923,13 +3216,11 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best xEncodeDontSplit(*tempCS, partitioner); xCheckDQP(*tempCS, partitioner); -#if JVET_M0428_ENC_DB_OPT tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); if ( m_bestModeUpdated ) { xCalDebCost( *tempCS, partitioner ); } -#endif DTRACE_MODE_COST(*tempCS, m_pcRdCost->getLambda()); @@ -3940,9 +3231,7 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best tempCS->dist = 0; tempCS->fracBits = 0; tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT tempCS->costDbOffset = 0; -#endif } } } @@ -3974,9 +3263,7 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC double curBestCost = bestCS->cost; double equGBiCost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif for( int gbiLoopIdx = 0; gbiLoopIdx < gbiLoopNum; gbiLoopIdx++ ) { @@ -4042,16 +3329,9 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC } } -#if JVET_M0464_UNI_MTS xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, 0 , 0 , &equGBiCost -#else - xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, 0 - , 1 - , 0 - , &equGBiCost -#endif ); if( g_GbiSearchOrder[gbiLoopIdx] == GBI_DEFAULT ) @@ -4078,12 +3358,10 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC break; } } // for( UChar gbiLoopIdx = 0; gbiLoopIdx < gbiLoopNum; gbiLoopIdx++ ) -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif } @@ -4098,9 +3376,7 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be CHECK( iIMV != 1 && iIMV != 2 && iIMV != 3, "Unsupported IMV Mode" ); // Fast 4-Pel Mode -#if JVET_M0428_ENC_DB_OPT m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; -#endif EncTestMode encTestModeBase = encTestMode; // copy for clearing non-IMV options encTestModeBase.opts = EncTestModeOpts( encTestModeBase.opts & ETO_IMV ); // clear non-IMV options (is that intended?) @@ -4116,9 +3392,7 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be gbiLoopNum = 1; } -#if JVET_M0246_AFFINE_AMVR bool validMode = false; -#endif double curBestCost = bestCS->cost; double equGBiCost = MAX_DOUBLE; @@ -4173,27 +3447,19 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be CU::addPUs( cu ); cu.imv = iIMV > 1 ? 2 : 1; -#if !JVET_M0464_UNI_MTS - cu.emtFlag = false; -#endif bool testGbi; uint8_t gbiIdx; -#if JVET_M0246_AFFINE_AMVR bool affineAmvrEanbledFlag = cu.slice->getSPS()->getAffineAmvrEnabledFlag(); -#endif cu.GBiIdx = g_GbiSearchOrder[gbiLoopIdx]; gbiIdx = cu.GBiIdx; testGbi = (gbiIdx != GBI_DEFAULT); -#if JVET_M0246_AFFINE_AMVR cu.firstPU->interDir = 10; -#endif m_pcInterSearch->predInterSearch( cu, partitioner ); -#if JVET_M0246_AFFINE_AMVR if ( cu.firstPU->interDir <= 3 ) { gbiIdx = CU::getValidGbiIdx(cu); @@ -4202,18 +3468,13 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be { return false; } -#else - gbiIdx = CU::getValidGbiIdx(cu); -#endif -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() && ( ( cu.firstPU->refIdx[L0] < 0 && cu.firstPU->refIdx[L1] < 0 ) || ( !( MCTSHelper::checkMvBufferForMCTSConstraint( *cu.firstPU ) ) ) ) ) { // Do not use this mode tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); continue; } -#endif if( testGbi && gbiIdx == GBI_DEFAULT ) // Enabled GBi but the search results is uni. { tempCS->initStructData(encTestMode.qp, encTestMode.lossless); @@ -4230,11 +3491,7 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be } } -#if JVET_M0246_AFFINE_AMVR if ( !CU::hasSubCUNonZeroMVd( cu ) && !CU::hasSubCUNonZeroAffineMVd( cu ) ) -#else - if( !CU::hasSubCUNonZeroMVd( cu ) ) -#endif { if (m_modeCtrl->useModeResult(encTestModeBase, tempCS, partitioner)) { @@ -4242,7 +3499,6 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be // store temp best CI for next CU coding m_CurrCtx->best = m_CABACEstimator->getCtx(); } -#if JVET_M0246_AFFINE_AMVR if ( affineAmvrEanbledFlag ) { tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); @@ -4252,21 +3508,11 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be { return false; } -#else - return false; -#endif } -#if JVET_M0464_UNI_MTS xEncodeInterResidual( tempCS, bestCS, partitioner, encTestModeBase, 0 , 0 , &equGBiCost -#else - xEncodeInterResidual( tempCS, bestCS, partitioner, encTestModeBase, 0 - , true - , 0 - , &equGBiCost -#endif ); tempCS->initStructData(encTestMode.qp, encTestMode.lossless); @@ -4289,26 +3535,17 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be { break; } -#if JVET_M0246_AFFINE_AMVR validMode = true; -#endif } // for( UChar gbiLoopIdx = 0; gbiLoopIdx < gbiLoopNum; gbiLoopIdx++ ) -#if JVET_M0428_ENC_DB_OPT if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) { xCalDebCost( *bestCS, partitioner ); } -#endif -#if JVET_M0246_AFFINE_AMVR return tempCS->slice->getSPS()->getAffineAmvrEnabledFlag() ? validMode : true; -#else - return true; -#endif } -#if JVET_M0428_ENC_DB_OPT void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool calDist ) { if ( cs.cost == MAX_DOUBLE ) @@ -4359,13 +3596,8 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal //deblock neighbour pixels const Size lumaSize = cu->Y().valid() ? cu->Y().size() : recalcSize( format, cu->chType, CHANNEL_TYPE_LUMA, cu->blocks[cu->chType].size() ); -#if JVET_M0471_LONG_DEBLOCKING_FILTERS const int verOffset = lumaPos.y > 7 ? 8 : 4; const int horOffset = lumaPos.x > 7 ? 8 : 4; -#else - const int verOffset = 4; - const int horOffset = 4; -#endif const UnitArea areaTop( format, Area( lumaPos.x, lumaPos.y - verOffset, lumaSize.width, verOffset ) ); const UnitArea areaLeft( format, Area( lumaPos.x - horOffset, lumaPos.y, horOffset, lumaSize.height ) ); for ( int compIdx = compStr; compIdx <= compEnd; compIdx++ ) @@ -4375,36 +3607,30 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal //Copy current CU's reco to Deblock Pic Buffer const CompArea& curCompArea = currCsArea.block( compId ); picDbBuf.getBuf( curCompArea ).copyFrom( cs.getRecoBuf( curCompArea ) ); -#if JVET_M0427_INLOOP_RESHAPER if ( cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma( compId ) ) { picDbBuf.getBuf( curCompArea ).rspSignal( m_pcReshape->getInvLUT() ); } -#endif //left neighbour if ( leftEdgeAvai ) { const CompArea& compArea = areaLeft.block(compId); picDbBuf.getBuf( compArea ).copyFrom( cs.picture->getRecoBuf( compArea ) ); -#if JVET_M0427_INLOOP_RESHAPER if ( cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma( compId ) ) { picDbBuf.getBuf( compArea ).rspSignal( m_pcReshape->getInvLUT() ); } -#endif } //top neighbour if ( topEdgeAvai ) { const CompArea& compArea = areaTop.block( compId ); picDbBuf.getBuf( compArea ).copyFrom( cs.picture->getRecoBuf( compArea ) ); -#if JVET_M0427_INLOOP_RESHAPER if ( cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getSliceReshaperInfo().getUseSliceReshaper() && isLuma( compId ) ) { picDbBuf.getBuf( compArea ).rspSignal( m_pcReshape->getInvLUT() ); } -#endif } } @@ -4469,14 +3695,9 @@ Distortion EncCu::getDistortionDb( CodingStructure &cs, CPelBuf org, CPelBuf rec Distortion dist = 0; #if WCG_EXT CPelBuf orgLuma = cs.picture->getOrigBuf( cs.area.blocks[COMPONENT_Y] ); -#if JVET_M0427_INLOOP_RESHAPER if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getReshaper() && ( cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() ) ) ) -#else - if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) -#endif { -#if JVET_M0427_INLOOP_RESHAPER if ( compID == COMPONENT_Y && !afterDb && !m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) { CompArea tmpArea( COMPONENT_Y, cs.area.chromaFormat, Position( 0, 0 ), compArea.size() ); @@ -4486,12 +3707,10 @@ Distortion EncCu::getDistortionDb( CodingStructure &cs, CPelBuf org, CPelBuf rec dist += m_pcRdCost->getDistPart( org, tmpRecLuma, cs.sps->getBitDepth( toChannelType( compID ) ), compID, DF_SSE_WTD, &orgLuma ); } else -#endif { dist += m_pcRdCost->getDistPart( org, reco, cs.sps->getBitDepth( toChannelType( compID ) ), compID, DF_SSE_WTD, &orgLuma ); } } -#if JVET_M0427_INLOOP_RESHAPER else if ( m_pcEncCfg->getReshaper() && cs.slice->getReshapeInfo().getUseSliceReshaper() && cs.slice->isIntra() ) //intra slice { if ( compID == COMPONENT_Y && afterDb ) @@ -4507,7 +3726,6 @@ Distortion EncCu::getDistortionDb( CodingStructure &cs, CPelBuf org, CPelBuf rec dist += m_pcRdCost->getDistPart( org, reco, cs.sps->getBitDepth(toChannelType( compID ) ), compID, DF_SSE ); } } -#endif else #endif { @@ -4515,9 +3733,7 @@ Distortion EncCu::getDistortionDb( CodingStructure &cs, CPelBuf org, CPelBuf rec } return dist; } -#endif -#if JVET_M0464_UNI_MTS void EncCu::xEncodeInterResidual( CodingStructure *&tempCS , CodingStructure *&bestCS , Partitioner &partitioner @@ -4525,13 +3741,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS , int residualPass , bool* bestHasNonResi , double* equGBiCost -#else -void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode, int residualPass - , CodingStructure* imvCS - , int emtMode - , bool* bestHasNonResi - , double* equGBiCost -#endif ) { if( residualPass == 1 && encTestMode.lossless ) @@ -4542,23 +3751,11 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be CodingUnit* cu = tempCS->getCU( partitioner.chType ); double bestCostInternal = MAX_DOUBLE; double bestCost = bestCS->cost; -#if JVET_M0140_SBT double bestCostBegin = bestCS->cost; CodingUnit* prevBestCU = bestCS->getCU( partitioner.chType ); uint8_t prevBestSbt = ( prevBestCU == nullptr ) ? 0 : prevBestCU->sbtInfo; -#endif -#if !JVET_M0464_UNI_MTS - const SPS& sps = *tempCS->sps; - const int maxSizeEMT = EMT_INTER_MAX_CU_WITH_QTBT; -#endif bool swapped = false; // avoid unwanted data copy bool reloadCU = false; -#if !JVET_M0464_UNI_MTS - const bool considerEmtSecondPass = emtMode && sps.getUseInterEMT() && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT; - - int minEMTMode = 0; - int maxEMTMode = (considerEmtSecondPass?1:0); -#endif // Not allow very big |MVd| to avoid CABAC crash caused by too large MVd. Normally no impact on coding performance. const int maxMvd = 1 << 15; @@ -4587,12 +3784,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be } } } -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS const bool mtsAllowed = tempCS->sps->getUseInterMTS() && CU::isInter( *cu ) && partitioner.currArea().lwidth() <= MTS_INTER_MAX_CU_SIZE && partitioner.currArea().lheight() <= MTS_INTER_MAX_CU_SIZE; -#else - const bool mtsAllowed = considerEmtSecondPass; -#endif uint8_t sbtAllowed = cu->checkAllowedSbt(); uint8_t numRDOTried = 0; Distortion sbtOffDist = 0; @@ -4635,16 +3827,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be m_pcInterSearch->setHistBestTrs( histBestSbt, histBestTrs ); } } -#endif -#if !JVET_M0464_UNI_MTS - if( emtMode == 2 ) - { - minEMTMode = maxEMTMode = (cu->emtFlag?1:0); - } - - for( int curEmtMode = minEMTMode; curEmtMode <= maxEMTMode; curEmtMode++ ) -#endif { if( reloadCU ) { @@ -4672,72 +3855,23 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be tempCS->dist = 0; tempCS->fracBits = 0; tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT tempCS->costDbOffset = 0; -#endif } reloadCU = true; // enable cu reloading cu->skip = false; -#if !JVET_M0464_UNI_MTS - cu->emtFlag = curEmtMode; -#endif -#if JVET_M0140_SBT cu->sbtInfo = 0; -#endif const bool skipResidual = residualPass == 1; -#if JVET_M0140_SBT // skip DCT-2 and EMT if historical best transform mode is SBT if( skipResidual || histBestSbt == MAX_UCHAR || !CU::isSbtMode( histBestSbt ) ) { -#endif m_pcInterSearch->encodeResAndCalcRdInterCU( *tempCS, partitioner, skipResidual ); -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS numRDOTried += mtsAllowed ? 2 : 1; -#else - numRDOTried++; -#endif -#endif xEncodeDontSplit( *tempCS, partitioner ); xCheckDQP( *tempCS, partitioner ); -#if !JVET_M0140_SBT //harmonize with GBI fast algorithm (move the code to the end of this function) - if( ETM_INTER_ME == encTestMode.type ) - { - if( equGBiCost != NULL ) - { - if( tempCS->cost < (*equGBiCost) && cu->GBiIdx == GBI_DEFAULT ) - { - (*equGBiCost) = tempCS->cost; - } - } - else - { - CHECK(equGBiCost == NULL, "equGBiCost == NULL"); - } - if( tempCS->slice->getCheckLDC() && !cu->imv && cu->GBiIdx != GBI_DEFAULT && tempCS->cost < m_bestGbiCost[1] ) - { - if( tempCS->cost < m_bestGbiCost[0] ) - { - m_bestGbiCost[1] = m_bestGbiCost[0]; - m_bestGbiCost[0] = tempCS->cost; - m_bestGbiIdx[1] = m_bestGbiIdx[0]; - m_bestGbiIdx[0] = cu->GBiIdx; - } - else - { - m_bestGbiCost[1] = tempCS->cost; - m_bestGbiIdx[1] = cu->GBiIdx; - } - } - } -#endif -#if !JVET_M0464_UNI_MTS - double emtFirstPassCost = tempCS->cost; -#endif if( NULL != bestHasNonResi && (bestCostInternal > tempCS->cost) ) { bestCostInternal = tempCS->cost; @@ -4750,43 +3884,20 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be if (tempCS->getPU(partitioner.chType)->mhIntraFlag) { tempCS->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT tempCS->costDbOffset = 0; -#endif return; } } -#if JVET_M0140_SBT -#if JVET_M0464_UNI_MTS currBestCost = tempCS->cost; sbtOffCost = tempCS->cost; sbtOffDist = tempCS->dist; sbtOffRootCbf = cu->rootCbf; currBestSbt = CU::getSbtInfo( cu->firstTU->mtsIdx > 1 ? SBT_OFF_MTS : SBT_OFF_DCT, 0 ); currBestTrs = cu->firstTU->mtsIdx; -#else - if( curEmtMode == 0 ) - { - currBestCost = tempCS->cost; - sbtOffCost = tempCS->cost; - sbtOffDist = tempCS->dist; - sbtOffRootCbf = cu->rootCbf; - } - else - { - if( tempCS->cost < currBestCost ) - { - currBestSbt = CU::getSbtInfo(SBT_OFF_MTS, 0); - currBestTrs = cu->firstTU->emtIdx; - currBestCost = tempCS->cost; - } - } -#endif if( cu->lwidth() <= MAX_TB_SIZEY && cu->lheight() <= MAX_TB_SIZEY ) { CHECK( tempCS->tus.size() != 1, "tu must be only one" ); } -#endif #if WCG_EXT DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); @@ -4795,44 +3906,12 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be #endif xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); -#if !JVET_M0464_UNI_MTS - //now we check whether the second pass should be skipped or not -#if JVET_M0140_SBT - if( !curEmtMode && maxEMTMode && !CU::isMtsMode(histBestSbt) ) -#else - if( !curEmtMode && maxEMTMode ) -#endif - { - const double thresholdToSkipEmtSecondPass = 1.1; // Skip checking EMT transforms - const bool bCond1 = !cu->firstTU->cbf[COMPONENT_Y]; - - const bool bCond3 = emtFirstPassCost > ( bestCost * thresholdToSkipEmtSecondPass ); - - if( m_pcEncCfg->getFastInterEMT() && (bCond1 || bCond3 ) ) - { - maxEMTMode = 0; // do not test EMT - } - } -#endif -#if JVET_M0140_SBT // skip DCT-2 and EMT } -#endif -#if JVET_M0140_SBT //RDO for SBT -#if !JVET_M0464_UNI_MTS // skip EMT - if( histBestSbt != MAX_UCHAR && !CU::isMtsMode(histBestSbt) ) - { - maxEMTMode = 0; - } -#endif uint8_t numSbtRdo = CU::numSbtModeRdo( sbtAllowed ); //early termination if all SBT modes are not allowed //normative -#if JVET_M0464_UNI_MTS if( !sbtAllowed || skipResidual ) -#else - if( !sbtAllowed || skipResidual || cu->emtFlag ) -#endif { numSbtRdo = 0; } @@ -4925,9 +4004,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be tempCS->dist = 0; tempCS->fracBits = 0; tempCS->cost = MAX_DOUBLE; -#if !JVET_M0464_UNI_MTS - cu->emtFlag = curEmtMode; -#endif cu->skip = false; //set SBT info @@ -4952,11 +4028,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be if( tempCS->cost < currBestCost ) { currBestSbt = cu->sbtInfo; -#if JVET_M0464_UNI_MTS currBestTrs = tempCS->tus[cu->sbtInfo ? cu->getSbtPos() : 0]->mtsIdx; -#else - currBestTrs = tempCS->tus[cu->sbtInfo ? cu->getSbtPos() : 0]->emtIdx; -#endif assert( currBestTrs == 0 || currBestTrs == 1 ); currBestCost = tempCS->cost; } @@ -4974,16 +4046,12 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be m_sbtCostSave[0] = sbtOffCost; m_sbtCostSave[1] = currBestCost; } -#endif } //end emt loop -#if JVET_M0140_SBT if( histBestSbt == MAX_UCHAR && doPreAnalyzeResi && numRDOTried > 1 ) { slsSbt->saveBestSbt( cu->cs->area, (uint32_t)( curPuSse >> slShift ), currBestSbt, currBestTrs ); } -#endif -#if JVET_M0140_SBT //harmonize with GBI fast algorithm (move the code here) tempCS->cost = currBestCost; if( ETM_INTER_ME == encTestMode.type ) { @@ -5014,7 +4082,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be } } } -#endif } @@ -5022,20 +4089,7 @@ void EncCu::xEncodeDontSplit( CodingStructure &cs, Partitioner &partitioner ) { m_CABACEstimator->resetBits(); -#if JVET_M0421_SPLIT_SIG m_CABACEstimator->split_cu_mode( CU_DONT_SPLIT, cs, partitioner ); -#else - { - if( partitioner.canSplit( CU_QUAD_SPLIT, cs ) ) - { - m_CABACEstimator->split_cu_flag( false, cs, partitioner ); - } - if( partitioner.canSplit( CU_MT_SPLIT, cs ) ) - { - m_CABACEstimator->split_cu_mode_mt( CU_DONT_SPLIT, cs, partitioner ); - } - } -#endif cs.fracBits += m_CABACEstimator->getEstFracBits(); // split bits cs.cost = m_pcRdCost->calcRdCost( cs.fracBits, cs.dist ); @@ -5052,10 +4106,8 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best if( bestEncCache->setCsFrom( *tempCS, cachedMode, partitioner ) ) { CodingUnit& cu = *tempCS->cus.front(); -#if JVET_M0170_MRG_SHARELIST cu.shareParentPos = tempCS->sharedBndPos; cu.shareParentSize = tempCS->sharedBndSize; -#endif partitioner.setCUData( cu ); if( CU::isIntra( cu ) ) @@ -5069,7 +4121,6 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best } Distortion finalDistortion = 0; -#if JVET_M0428_ENC_DB_OPT tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); if ( m_pcEncCfg->getUseEncDbOpt() ) { @@ -5078,7 +4129,6 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best } else { -#endif const SPS &sps = *tempCS->sps; const int numValidComponents = getNumberValidComponents( tempCS->area.chromaFormat ); @@ -5095,15 +4145,10 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best CPelBuf org = tempCS->getOrgBuf ( compID ); #if WCG_EXT -#if JVET_M0427_INLOOP_RESHAPER if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getReshaper() && (tempCS->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()))) -#else - if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) -#endif { const CPelBuf orgLuma = tempCS->getOrgBuf(tempCS->area.blocks[COMPONENT_Y]); -#if JVET_M0427_INLOOP_RESHAPER if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) { const CompArea &area = cu.blocks[COMPONENT_Y]; @@ -5114,16 +4159,13 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best finalDistortion += m_pcRdCost->getDistPart(org, tmpRecLuma, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE_WTD, &orgLuma); } else -#endif finalDistortion += m_pcRdCost->getDistPart( org, reco, sps.getBitDepth( toChannelType( compID ) ), compID, DF_SSE_WTD, &orgLuma ); } else #endif finalDistortion += m_pcRdCost->getDistPart( org, reco, sps.getBitDepth( toChannelType( compID ) ), compID, DF_SSE ); } -#if JVET_M0428_ENC_DB_OPT } -#endif m_CABACEstimator->getCtx() = m_CurrCtx->start; m_CABACEstimator->resetBits(); diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index a1938e7b4fda50120b05e937ecd058a9e64e9e19..270137a9c39d678262b51686370beced278c8648 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -46,13 +46,9 @@ #include "CommonLib/Unit.h" #include "CommonLib/UnitPartitioner.h" #include "CommonLib/IbcHashMap.h" -#if JVET_M0428_ENC_DB_OPT #include "CommonLib/LoopFilter.h" -#endif -#if REUSE_CU_RESULTS || JVET_M0170_MRG_SHARELIST || JVET_M0427_INLOOP_RESHAPER #include "DecoderLib/DecCu.h" -#endif #include "CABACWriter.h" #include "IntraSearch.h" @@ -71,7 +67,6 @@ class EncSlice; // ==================================================================================================================== /// CU encoder class -#if JVET_M0883_TRIANGLE_SIGNALING struct TriangleMotionInfo { uint8_t m_splitDir; @@ -80,16 +75,11 @@ struct TriangleMotionInfo TriangleMotionInfo ( uint8_t splitDir, uint8_t candIdx0, uint8_t candIdx1 ): m_splitDir(splitDir), m_candIdx0(candIdx0), m_candIdx1(candIdx1) { } }; -#endif class EncCu -#if REUSE_CU_RESULTS || JVET_M0170_MRG_SHARELIST || JVET_M0427_INLOOP_RESHAPER : DecCu -#endif { private: -#if JVET_M0428_ENC_DB_OPT bool m_bestModeUpdated; -#endif struct CtxPair { Ctx start; @@ -118,21 +108,17 @@ private: TrQuant* m_pcTrQuant; RdCost* m_pcRdCost; EncSlice* m_pcSliceEncoder; -#if JVET_M0428_ENC_DB_OPT LoopFilter* m_pcLoopFilter; -#endif CABACWriter* m_CABACEstimator; RateCtrl* m_pcRateCtrl; IbcHashMap m_ibcHashMap; EncModeCtrl *m_modeCtrl; -#if JVET_M0170_MRG_SHARELIST int m_shareState; uint32_t m_shareBndPosX; uint32_t m_shareBndPosY; SizeType m_shareBndSizeW; SizeType m_shareBndSizeH; -#endif PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelStorage m_acRealMergeBuffer[MRG_MAX_NUM_CANDS]; @@ -147,23 +133,17 @@ private: #endif int m_bestGbiIdx[2]; double m_bestGbiCost[2]; -#if JVET_M0883_TRIANGLE_SIGNALING static const TriangleMotionInfo m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS]; uint8_t m_triangleIdxBins[2][TRIANGLE_MAX_NUM_UNI_CANDS][TRIANGLE_MAX_NUM_UNI_CANDS]; -#endif #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU void updateLambda ( Slice* slice, const int dQP, const bool updateRdCostLambda ); #endif -#if JVET_M0140_SBT double m_sbtCostSave[2]; -#endif public: /// copy parameters from encoder class void init ( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int jId = 0 ) ); -#if JVET_M0427_INLOOP_RESHAPER void setDecCuReshaperInEncCU(EncReshape* pcReshape, ChromaFormat chromaFormatIDC) { initDecCuReshaper((Reshape*) pcReshape, chromaFormatIDC); } -#endif /// create internal buffers void create ( EncCfg* encCfg ); @@ -180,19 +160,15 @@ public: void setMergeBestSATDCost(double cost) { m_mergeBestSATDCost = cost; } double getMergeBestSATDCost() { return m_mergeBestSATDCost; } -#if JVET_M0255_FRACMMVD_SWITCH IbcHashMap& getIbcHashMap() { return m_ibcHashMap; } EncCfg* getEncCfg() const { return m_pcEncCfg; } -#endif ~EncCu(); protected: -#if JVET_M0428_ENC_DB_OPT void xCalDebCost ( CodingStructure &cs, Partitioner &partitioner, bool calDist = false ); Distortion getDistortionDb ( CodingStructure &cs, CPelBuf org, CPelBuf reco, ComponentID compID, const CompArea& compArea, bool afterDb ); -#endif void xCompressCU ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm ); #if ENABLE_SPLIT_PARALLELISM @@ -211,9 +187,7 @@ protected: void xCheckDQP ( CodingStructure& cs, Partitioner& partitioner, bool bKeepCtx = false); void xFillPCMBuffer ( CodingUnit &cu); -#if JVET_M0253_HASH_ME void xCheckRDCostHashInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#endif void xCheckRDCostAffineMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); void xCheckRDCostInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); @@ -224,7 +198,6 @@ protected: void xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if JVET_M0464_UNI_MTS void xEncodeInterResidual( CodingStructure *&tempCS , CodingStructure *&bestCS , Partitioner &partitioner @@ -233,13 +206,6 @@ protected: , bool* bestHasNonResi = NULL , double* equGBiCost = NULL ); -#else - void xEncodeInterResidual ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode, int residualPass = 0 - , int emtMode = 1 - , bool* bestHasNonResi = NULL - , double* equGBiCost = NULL - ); -#endif #if REUSE_CU_RESULTS void xReuseCachedResult ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &Partitioner ); #endif diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 7d687a17e4d7ea3b6058065e154ff038e0dbcfa0..9618b0b34520bf2cdcf3db64dc1c2e6c33c9c668 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -178,7 +178,6 @@ void EncGOP::init ( EncLib* pcEncLib ) m_AUWriterIf = pcEncLib->getAUWriterIf(); #if WCG_EXT -#if JVET_M0427_INLOOP_RESHAPER if (m_pcCfg->getReshaper()) { pcEncLib->getRdCost()->setReshapeInfo(m_pcCfg->getReshapeSignalType(), m_pcCfg->getBitDepth(CHANNEL_TYPE_LUMA)); @@ -188,10 +187,6 @@ void EncGOP::init ( EncLib* pcEncLib ) { pcEncLib->getRdCost()->setReshapeInfo(RESHAPE_SIGNAL_PQ, m_pcCfg->getBitDepth(CHANNEL_TYPE_LUMA)); pcEncLib->getRdCost()->initLumaLevelToWeightTableReshape(); -#else - pcEncLib->getRdCost()->initLumaLevelToWeightTable(); -#endif -#if JVET_M0427_INLOOP_RESHAPER } pcEncLib->getALF()->getLumaLevelWeightTable() = pcEncLib->getRdCost()->getLumaLevelWeightTable(); int alfWSSD = 0; @@ -201,10 +196,7 @@ void EncGOP::init ( EncLib* pcEncLib ) } pcEncLib->getALF()->setAlfWSSD(alfWSSD); #endif -#endif -#if JVET_M0427_INLOOP_RESHAPER m_pcReshaper = pcEncLib->getReshaper(); -#endif } #if HEVC_VPS @@ -237,7 +229,6 @@ int EncGOP::xWritePPS (AccessUnit &accessUnit, const PPS *pps) return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#if JVET_M0132_APS int EncGOP::xWriteAPS(AccessUnit &accessUnit, APS *aps) { OutputNALUnit nalu(NAL_UNIT_APS); @@ -246,7 +237,6 @@ int EncGOP::xWriteAPS(AccessUnit &accessUnit, APS *aps) accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#endif int EncGOP::xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst) { @@ -1246,7 +1236,6 @@ void trySkipOrDecodePicture( bool& decPic, bool& encPic, const EncCfg& cfg, Pict else { // update decode decision -#if JVET_M0055_DEBUG_CTU bool dbgCTU = cfg.getDebugCTU() != -1 && cfg.getSwitchPOC() == pcPic->getPOC(); if( ( bDecode1stPart = ( cfg.getSwitchPOC() != pcPic->getPOC() ) || dbgCTU ) && ( bDecode1stPart = tryDecodePicture( pcPic, pcPic->getPOC(), cfg.getDecodeBitstream( 0 ), false, cfg.getDebugCTU(), cfg.getSwitchPOC() ) ) ) @@ -1262,13 +1251,6 @@ void trySkipOrDecodePicture( bool& decPic, bool& encPic, const EncCfg& cfg, Pict decPic = bDecode1stPart; return; } -#else - if( ( bDecode1stPart = ( cfg.getSwitchPOC() != pcPic->getPOC() )) && ( bDecode1stPart = tryDecodePicture( pcPic, pcPic->getPOC(), cfg.getDecodeBitstream( 0 ), false ) ) ) - { - decPic = bDecode1stPart; - return; - } -#endif else if( pcPic->getPOC() ) { // reset decoder if used and not required any further @@ -1513,12 +1495,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setSliceType(I_SLICE); } -#if JVET_M0483_IBC ==0 - if (pcSlice->getSliceType() == I_SLICE && pcSlice->getSPS()->getIBCMode()) - { - pcSlice->setSliceType(P_SLICE); - } -#endif // Set the nal unit type pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField)); #if !JVET_M0101_HLS @@ -1720,22 +1696,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (m_pcCfg->getUseCompositeRef() && getPrepareLTRef()) { arrangeCompositeReference(pcSlice, rcListPic, pocCurr); } -#if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getIBCMode()) - { - if (m_pcCfg->getIntraPeriod() > 0 && pcSlice->getPOC() % m_pcCfg->getIntraPeriod() == 0) - { - pcSlice->setNumRefIdx(REF_PIC_LIST_0, 0); - pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); - } - - pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0) + 1); - } -#endif // Set reference list pcSlice->setRefPicList ( rcListPic ); -#if JVET_M0253_HASH_ME if (m_pcCfg->getUseHashME()) { PicList::iterator iterPic = rcListPic.begin(); @@ -1802,7 +1765,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } } -#endif if( m_pcCfg->getUseAMaxBT() ) { if( !pcSlice->isIRAP() ) @@ -1856,12 +1818,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setSliceType ( P_SLICE ); } -#if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getIBCMode() && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 1) - { - m_pcSliceEncoder->setEncCABACTableIdx(P_SLICE); - } -#endif xUpdateRasInit( pcSlice ); if ( pcSlice->getPendingRasInit() ) @@ -1940,11 +1896,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } // disable TMVP when current picture is the only ref picture -#if JVET_M0483_IBC if (pcSlice->isIRAP() && pcSlice->getSPS()->getIBCFlag()) -#else - if (pcSlice->isIRAP() && pcSlice->getSPS()->getIBCMode()) -#endif { pcSlice->setEnableTMVPFlag(0); } @@ -1958,24 +1910,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, bool bGPBcheck=false; if ( pcSlice->getSliceType() == B_SLICE) { -#if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getIBCMode()) - { - if (pcSlice->getNumRefIdx(RefPicList(0)) - 1 == pcSlice->getNumRefIdx(RefPicList(1))) - { - bGPBcheck = true; - for (int i = 0; i < pcSlice->getNumRefIdx(RefPicList(1)); i++) - { - if (pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i)) - { - bGPBcheck = false; - break; - } - } - } - } - else -#endif if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) ) { bGPBcheck=true; @@ -2002,7 +1936,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->slices[pcSlice->getSliceSegmentIdx()]->setMvdL1ZeroFlag(pcSlice->getMvdL1ZeroFlag()); #endif -#if JVET_M0444_SMVD if ( pcSlice->getCheckLDC() == false && pcSlice->getMvdL1ZeroFlag() == false ) { int currPOC = pcSlice->getPOC(); @@ -2076,7 +2009,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setBiDirPred( false, -1, -1 ); } -#endif double lambda = 0.0; int actualHeadBits = 0; @@ -2218,11 +2150,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->m_uEnerHpCtu.resize (numberOfCtusInFrame); pcPic->m_iOffsetCtu.resize (numberOfCtusInFrame); #if ENABLE_QPA_SUB_CTU -#if JVET_M0113_M0188_QG_SIZE if (pcSlice->getPPS()->getUseDQP() && pcSlice->getPPS()->getCuQpDeltaSubdiv() > 0) -#else - if (pcSlice->getPPS()->getUseDQP() && pcSlice->getPPS()->getMaxCuDQPDepth() > 0) -#endif { const PreCalcValues &pcv = *pcPic->cs->pcv; #if MAX_TB_SIZE_SIGNALLING @@ -2244,13 +2172,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if( pcSlice->getSPS()->getALFEnabledFlag() ) { pcPic->resizeAlfCtuEnableFlag( numberOfCtusInFrame ); -#if JVET_M0132_APS // reset the APS ALF parameters AlfSliceParam newALFParam; pcSlice->getAPS()->setAlfAPSParam(newALFParam); -#else - std::memset( pcSlice->getAlfSliceParam().enabledFlag, false, sizeof( pcSlice->getAlfSliceParam().enabledFlag ) ); -#endif } bool decPic = false; @@ -2270,7 +2194,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setSliceChromaQpDelta(COMPONENT_Cr, m_pcCfg->getChromaCrQpOffsetDualTree()); m_pcSliceEncoder->setUpLambda(pcSlice, pcSlice->getLambdas()[0], pcSlice->getSliceQp()); } -#if JVET_M0427_INLOOP_RESHAPER if (pcSlice->getSPS()->getUseReshaper()) { m_pcReshaper->getReshapeCW()->rspTid = pcSlice->getTLayer() + (pcSlice->isIntra() ? 0 : 1); @@ -2281,30 +2204,18 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) { -#if JVET_M0483_IBC m_pcReshaper->preAnalyzerHDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree()); -#else - m_pcReshaper->preAnalyzerHDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree(), m_pcCfg->getIBCMode()); -#endif } else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR) { -#if JVET_M0483_IBC m_pcReshaper->preAnalyzerSDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree()); -#else - m_pcReshaper->preAnalyzerSDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree(), m_pcCfg->getIBCMode()); -#endif } else { THROW("Reshaper for other signal currently not defined!"); } -#if JVET_M0483_IBC if (pcSlice->getSliceType() == I_SLICE ) -#else - if (pcSlice->getSliceType() == I_SLICE || (pcSlice->getSliceType() == P_SLICE && m_pcCfg->getIBCMode())) -#endif { if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) { @@ -2371,7 +2282,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { m_pcReshaper->setCTUFlag(false); } -#endif if( encPic ) // now compress (trial encode) the various slice segments (slices, and dependent slices) @@ -2446,7 +2356,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, CodingStructure& cs = *pcPic->cs; pcSlice = pcPic->slices[0]; -#if JVET_M0427_INLOOP_RESHAPER if (pcSlice->getSPS()->getUseReshaper() && m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()) { CHECK((m_pcReshaper->getRecReshaped() == false), "Rec picture is not reshaped!"); @@ -2455,7 +2364,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->getOrigBuf().copyFrom(pcPic->getTrueOrigBuf()); } -#endif // SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas if( pcSlice->getSPS()->getSAOEnabledFlag() && m_pcCfg->getSaoCtuBoundary() ) @@ -2482,9 +2390,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, m_pcLoopFilter->loopFilterPic( cs ); -#if JVET_M0147_DMVR CS::setRefinedMotionField(cs); -#endif DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 1 ) ) ); if( pcSlice->getSPS()->getSAOEnabledFlag() ) @@ -2521,14 +2427,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, #endif alfSliceParam ); //assign ALF slice header -#if JVET_M0132_APS pcPic->cs->aps->setAlfAPSParam(alfSliceParam); -#else - for( int s = 0; s< uiNumSliceSegments; s++ ) - { - pcPic->slices[s]->setAlfSliceParam( alfSliceParam ); - } -#endif } if (m_pcCfg->getUseCompositeRef() && getPrepareLTRef()) { @@ -2600,7 +2499,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { xWriteAccessUnitDelimiter(accessUnit, pcSlice); } -#if JVET_M0132_APS if (pcSlice->getSPS()->getALFEnabledFlag() && pcSlice->getAPS()->getAlfAPSParam().enabledFlag[COMPONENT_Y]) { pcSlice->setTileGroupAlfEnabledFlag(true); @@ -2611,7 +2509,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setTileGroupAlfEnabledFlag(false); } -#endif // reset presence of BP SEI indication m_bufferingPeriodSEIPresentInAU = false; @@ -2828,9 +2725,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 0 ) ) ); pcPic->reconstructed = true; -#if JVET_M0483_IBC ==0 - pcPic->longTerm = false; -#endif m_bFirst = false; m_iNumPicCoded++; if (!(m_pcCfg->getUseCompositeRef() && isEncodeLtRef)) @@ -2859,11 +2753,7 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool const bool useWPSNR = m_pcEncLib->getUseWPSNR(); #endif #if WCG_WPSNR -#if JVET_M0427_INLOOP_RESHAPER const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getReshaper() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ); -#else - const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled(); -#endif #endif if( m_pcCfg->getDecodeBitstream(0).empty() && m_pcCfg->getDecodeBitstream(1).empty() && !m_pcCfg->useFastForwardToPOC() ) @@ -3204,11 +3094,7 @@ uint64_t EncGOP::xFindDistortionPlane(const CPelBuf& pic0, const CPelBuf& pic1, double EncGOP::xFindDistortionPlaneWPSNR(const CPelBuf& pic0, const CPelBuf& pic1, const uint32_t rshift, const CPelBuf& picLuma0, ComponentID compID, const ChromaFormat chfmt ) { -#if JVET_M0427_INLOOP_RESHAPER const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getReshaper() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ); -#else - const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled(); -#endif if (!useLumaWPSNR) { return 0; @@ -3341,21 +3227,13 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni const CPelUnitBuf& pic = cPicD; CHECK(!(conversion == IPCOLOURSPACE_UNCHANGED), "Unspecified error"); // const CPelUnitBuf& org = (conversion != IPCOLOURSPACE_UNCHANGED) ? pcPic->getPicYuvTrueOrg()->getBuf() : pcPic->getPicYuvOrg()->getBuf(); -#if JVET_M0427_INLOOP_RESHAPER const CPelUnitBuf& org = sps.getUseReshaper() ? pcPic->getTrueOrigBuf() : pcPic->getOrigBuf(); -#else - const CPelUnitBuf& org = pcPic->getOrigBuf(); -#endif #if ENABLE_QPA const bool useWPSNR = m_pcEncLib->getUseWPSNR(); #endif double dPSNR[MAX_NUM_COMPONENT]; #if WCG_WPSNR -#if JVET_M0427_INLOOP_RESHAPER const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getReshaper() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ); -#else - const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled(); -#endif double dPSNRWeighted[MAX_NUM_COMPONENT]; double MSEyuvframeWeighted[MAX_NUM_COMPONENT]; #endif diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h index 29af605d641e8a2f8e8afe978d1d2ad2f23d777d..f0c85ca4d8afe14efe94d85bf611499c3565564f 100644 --- a/source/Lib/EncoderLib/EncGOP.h +++ b/source/Lib/EncoderLib/EncGOP.h @@ -47,9 +47,7 @@ #include "CommonLib/NAL.h" #include "EncSampleAdaptiveOffset.h" #include "EncAdaptiveLoopFilter.h" -#if JVET_M0427_INLOOP_RESHAPER #include "EncReshape.h" -#endif #include "EncSlice.h" #include "VLCWriter.h" #include "CABACWriter.h" @@ -142,9 +140,7 @@ private: //--Adaptive Loop filter EncSampleAdaptiveOffset* m_pcSAO; EncAdaptiveLoopFilter* m_pcALF; -#if JVET_M0427_INLOOP_RESHAPER EncReshape* m_pcReshaper; -#endif RateCtrl* m_pcRateCtrl; // indicate sequence first bool m_bSeqFirst; @@ -281,9 +277,7 @@ protected: #endif int xWriteSPS (AccessUnit &accessUnit, const SPS *sps); int xWritePPS (AccessUnit &accessUnit, const PPS *pps); -#if JVET_M0132_APS int xWriteAPS(AccessUnit &accessUnit, APS *aps); -#endif int xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst); void applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 1b6579b0452bd5c37cd03a10a737e3a5aea4ee07..dcc383dc2ce7716b14edc62e0450bbb045d32ef4 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -60,9 +60,7 @@ EncLib::EncLib() : m_spsMap( MAX_NUM_SPS ) , m_ppsMap( MAX_NUM_PPS ) -#if JVET_M0132_APS , m_apsMap( MAX_NUM_APS ) -#endif , m_AUWriterIf( nullptr ) #if JVET_J0090_MEMORY_BANDWITH_MEASURE , m_cacheModel() @@ -87,9 +85,7 @@ void EncLib::create () { // initialize global variables initROM(); -#if JVET_M0253_HASH_ME TComHash::initBlockSizeToIndex(); -#endif m_iPOCLast = m_compositeRefEnabled ? -2 : -1; // create processing unit classes m_cGOPEncoder. create( ); @@ -133,18 +129,15 @@ void EncLib::create () } m_cLoopFilter.create( m_maxTotalCUDepth ); -#if JVET_M0428_ENC_DB_OPT if ( !m_bLoopFilterDisable ) { m_cLoopFilter.initEncPicYuvBuffer( m_chromaFormatIDC, getSourceWidth(), getSourceHeight() ); } -#endif if( m_alf ) { m_cEncALF.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, m_bitDepth, m_inputBitDepth ); } -#if JVET_M0427_INLOOP_RESHAPER #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM m_cReshaper = new EncReshape[m_numCuEncStacks]; #endif @@ -159,7 +152,6 @@ void EncLib::create () m_cReshaper.createEnc( getSourceWidth(), getSourceHeight(), m_maxCUWidth, m_maxCUHeight, m_bitDepth[COMPONENT_Y]); #endif } -#endif if ( m_RCEnableRateControl ) { m_cRateCtrl.init(m_framesToBeEncoded, m_RCTargetBitrate, (int)((double)m_iFrameRate / m_temporalSubsampleRatio + 0.5), m_iGOPSize, m_iSourceWidth, m_iSourceHeight, @@ -189,7 +181,6 @@ void EncLib::destroy () m_cEncSAO. destroy(); m_cLoopFilter. destroy(); m_cRateCtrl. destroy(); -#if JVET_M0427_INLOOP_RESHAPER #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM for (int jId = 0; jId < m_numCuEncStacks; jId++) { @@ -198,7 +189,6 @@ void EncLib::destroy () #else m_cReshaper. destroy(); #endif -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM for( int jId = 0; jId < m_numCuEncStacks; jId++ ) { @@ -234,9 +224,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) SPS &sps0=*(m_spsMap.allocatePS(0)); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues. PPS &pps0=*(m_ppsMap.allocatePS(0)); -#if JVET_M0132_APS APS &aps0=*(m_apsMap.allocatePS(0)); -#endif // initialize SPS xInitSPS(sps0); @@ -274,10 +262,8 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) // initialize PPS xInitPPS(pps0, sps0); -#if JVET_M0132_APS // initialize APS xInitAPS(aps0); -#endif xInitRPS(sps0, isFieldCoding); #if ER_CHROMA_QP_WCG_PPS @@ -333,9 +319,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) &m_cRdCost[jId], cabacEstimator, getCtxCache( jId ), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth -#if JVET_M0427_INLOOP_RESHAPER , &m_cReshaper[jId] -#endif ); m_cInterSearch[jId].init( this, &m_cTrQuant[jId], @@ -344,9 +328,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_motionEstimationSearchMethod, getUseCompositeRef(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cRdCost[jId], cabacEstimator, getCtxCache( jId ) -#if JVET_M0427_INLOOP_RESHAPER , &m_cReshaper[jId] -#endif ); // link temporary buffets from intra search with inter search to avoid unnecessary memory overhead @@ -378,9 +360,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) &m_cRdCost, cabacEstimator, getCtxCache(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth -#if JVET_M0427_INLOOP_RESHAPER , &m_cReshaper -#endif ); m_cInterSearch.init( this, &m_cTrQuant, @@ -389,9 +369,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_motionEstimationSearchMethod, getUseCompositeRef(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cRdCost, cabacEstimator, getCtxCache() -#if JVET_M0427_INLOOP_RESHAPER , &m_cReshaper -#endif ); // link temporary buffets from intra search with inter search to avoid unneccessary memory overhead @@ -421,11 +399,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) Picture *picBg = new Picture; picBg->create(sps0.getChromaFormatIdc(), Size(sps0.getPicWidthInLumaSamples(), sps0.getPicHeightInLumaSamples()), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false); picBg->getRecoBuf().fill(0); -#if JVET_M0132_APS picBg->finalInit(sps0, pps0, aps0); -#else - picBg->finalInit(sps0, pps0); -#endif picBg->allocateNewSlice(); picBg->createSpliceIdx(pps0.pcv->sizeInCtus); m_cGOPEncoder.setPicBg(picBg); @@ -576,12 +550,8 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru const SPS *sps = m_spsMap.getPS(pps->getSPSId()); picCurr->M_BUFS(0, PIC_ORIGINAL).copyFrom(m_cGOPEncoder.getPicBg()->getRecoBuf()); -#if JVET_M0132_APS APS *aps = m_apsMap.getPS(0); picCurr->finalInit(*sps, *pps, *aps); -#else - picCurr->finalInit(*sps, *pps); -#endif picCurr->poc = m_iPOCLast - 1; m_iPOCLast -= 2; if (getUseAdaptiveQP()) @@ -628,16 +598,10 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru const SPS *pSPS=m_spsMap.getPS(pPPS->getSPSId()); pcPicCurr->M_BUFS( 0, PIC_ORIGINAL ).swap( *pcPicYuvOrg ); -#if JVET_M0427_INLOOP_RESHAPER pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL ).swap(*cPicYuvTrueOrg ); -#endif -#if JVET_M0132_APS APS *pAPS = m_apsMap.getPS(0); pcPicCurr->finalInit(*pSPS, *pPPS, *pAPS); -#else - pcPicCurr->finalInit( *pSPS, *pPPS ); -#endif } pcPicCurr->poc = m_iPOCLast; @@ -732,12 +696,8 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTr const PPS *pPPS=(ppsID<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsID); const SPS *pSPS=m_spsMap.getPS(pPPS->getSPSId()); -#if JVET_M0132_APS APS *pAPS = m_apsMap.getPS(0); pcField->finalInit(*pSPS, *pPPS, *pAPS); -#else - pcField->finalInit( *pSPS, *pPPS ); -#endif } pcField->poc = m_iPOCLast; @@ -832,11 +792,7 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict rpcPic->create( sps.getChromaFormatIdc(), Size( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples()), sps.getMaxCUWidth(), sps.getMaxCUWidth()+16, false ); if ( getUseAdaptiveQP() ) { -#if JVET_M0113_M0188_QG_SIZE const uint32_t iMaxDQPLayer = pps.getCuQpDeltaSubdiv()/2+1; -#else - const uint32_t iMaxDQPLayer = pps.getMaxCuDQPDepth()+1; -#endif rpcPic->aqlayer.resize( iMaxDQPLayer ); for (uint32_t d = 0; d < iMaxDQPLayer; d++) { @@ -850,9 +806,7 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict rpcPic->setBorderExtension( false ); rpcPic->reconstructed = false; rpcPic->referenced = true; -#if JVET_M0253_HASH_ME rpcPic->getHashMap()->clearAll(); -#endif m_iPOCLast += (m_compositeRefEnabled ? 2 : 1); m_iNumPicRcvd++; @@ -890,28 +844,20 @@ void EncLib::xInitSPS(SPS &sps) sps.setNoSaoConstraintFlag(m_bNoSaoConstraintFlag); sps.setNoAlfConstraintFlag(m_bNoAlfConstraintFlag); sps.setNoPcmConstraintFlag(m_bNoPcmConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX sps.setNoRefWraparoundConstraintFlag(m_bNoRefWraparoundConstraintFlag); -#endif sps.setNoTemporalMvpConstraintFlag(m_bNoTemporalMvpConstraintFlag); sps.setNoSbtmvpConstraintFlag(m_bNoSbtmvpConstraintFlag); sps.setNoAmvrConstraintFlag(m_bNoAmvrConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX sps.setNoBdofConstraintFlag(m_bNoBdofConstraintFlag); -#endif sps.setNoCclmConstraintFlag(m_bNoCclmConstraintFlag); sps.setNoMtsConstraintFlag(m_bNoMtsConstraintFlag); sps.setNoAffineMotionConstraintFlag(m_bNoAffineMotionConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX sps.setNoGbiConstraintFlag(m_bNoGbiConstraintFlag); sps.setNoMhIntraConstraintFlag(m_bNoMhIntraConstraintFlag); sps.setNoTriangleConstraintFlag(m_bNoTriangleConstraintFlag); -#endif sps.setNoLadfConstraintFlag(m_bNoLadfConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX sps.setNoCurrPicRefConstraintFlag(m_bNoCurrPicRefConstraintFlag); sps.setNoQpDeltaConstraintFlag(m_bNoQpDeltaConstraintFlag); -#endif sps.setNoDepQuantConstraintFlag(m_bNoDepQuantConstraintFlag); sps.setNoSignDataHidingConstraintFlag(m_bNoSignDataHidingConstraintFlag); @@ -954,28 +900,20 @@ void EncLib::xInitSPS(SPS &sps) cinfo->setNoSaoConstraintFlag(m_bNoSaoConstraintFlag); cinfo->setNoAlfConstraintFlag(m_bNoAlfConstraintFlag); cinfo->setNoPcmConstraintFlag(m_bNoPcmConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX cinfo->setNoRefWraparoundConstraintFlag(m_bNoRefWraparoundConstraintFlag); -#endif cinfo->setNoTemporalMvpConstraintFlag(m_bNoTemporalMvpConstraintFlag); cinfo->setNoSbtmvpConstraintFlag(m_bNoSbtmvpConstraintFlag); cinfo->setNoAmvrConstraintFlag(m_bNoAmvrConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX cinfo->setNoBdofConstraintFlag(m_bNoBdofConstraintFlag); -#endif cinfo->setNoCclmConstraintFlag(m_bNoCclmConstraintFlag); cinfo->setNoMtsConstraintFlag(m_bNoMtsConstraintFlag); cinfo->setNoAffineMotionConstraintFlag(m_bNoAffineMotionConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX cinfo->setNoGbiConstraintFlag(m_bNoGbiConstraintFlag); cinfo->setNoMhIntraConstraintFlag(m_bNoMhIntraConstraintFlag); cinfo->setNoTriangleConstraintFlag(m_bNoTriangleConstraintFlag); -#endif cinfo->setNoLadfConstraintFlag(m_bNoLadfConstraintFlag); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX cinfo->setNoCurrPicRefConstraintFlag(m_bNoCurrPicRefConstraintFlag); cinfo->setNoQpDeltaConstraintFlag(m_bNoQpDeltaConstraintFlag); -#endif cinfo->setNoDepQuantConstraintFlag(m_bNoDepQuantConstraintFlag); cinfo->setNoSignDataHidingConstraintFlag(m_bNoSignDataHidingConstraintFlag); @@ -1008,29 +946,15 @@ void EncLib::xInitSPS(SPS &sps) sps.setUseAffine ( m_Affine ); sps.setUseAffineType ( m_AffineType ); sps.setUseLMChroma ( m_LMChroma ? true : false ); -#if JVET_M0142_CCLM_COLLOCATED_CHROMA sps.setCclmCollocatedChromaFlag( m_cclmCollocatedChromaFlag ); -#endif -#if JVET_M0464_UNI_MTS -#if JVET_M0303_IMPLICIT_MTS sps.setUseMTS ( m_IntraMTS || m_InterMTS || m_ImplicitMTS ); -#endif sps.setUseIntraMTS ( m_IntraMTS ); sps.setUseInterMTS ( m_InterMTS ); -#else -#if JVET_M0303_IMPLICIT_MTS - sps.setUseMTS ( m_IntraEMT || m_InterEMT || m_ImplicitMTS ); -#endif - sps.setUseIntraEMT ( m_IntraEMT ); - sps.setUseInterEMT ( m_InterEMT ); -#endif -#if JVET_M0140_SBT sps.setUseSBT ( m_SBT ); if( sps.getUseSBT() ) { sps.setMaxSbtSize ( m_iSourceWidth >= 1920 ? 64 : 32 ); } -#endif sps.setUseGBi ( m_GBi ); #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET sps.setLadfEnabled ( m_LadfEnabled ); @@ -1048,27 +972,15 @@ void EncLib::xInitSPS(SPS &sps) sps.setUseMHIntra ( m_MHIntra ); sps.setUseTriangle ( m_Triangle ); -#if JVET_M0255_FRACMMVD_SWITCH sps.setDisFracMmvdEnabledFlag ( m_allowDisFracMMVD ); -#endif -#if JVET_M0246_AFFINE_AMVR sps.setAffineAmvrEnabledFlag ( m_AffineAmvr ); -#endif -#if JVET_M0147_DMVR sps.setUseDMVR ( m_DMVR ); -#endif -#if JVET_M0483_IBC sps.setIBCFlag ( m_IBCMode); -#else - sps.setIBCMode (m_IBCMode); -#endif sps.setWrapAroundEnabledFlag ( m_wrapAround ); sps.setWrapAroundOffset ( m_wrapAroundOffset ); // ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here -#if JVET_M0427_INLOOP_RESHAPER sps.setUseReshaper ( m_lumaReshapeEnable ); -#endif int minCUSize = sps.getMaxCUWidth() >> sps.getLog2DiffMaxMinCodingBlockSize(); int log2MinCUSize = 0; while(minCUSize > 1) @@ -1372,11 +1284,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setSPSId(sps.getSPSId()); pps.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); -#if JVET_M0113_M0188_QG_SIZE bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false; -#else - bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false; -#endif if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP()) { @@ -1392,11 +1300,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) #if ENABLE_QPA if (getUsePerceptQPA() && !bUseDQP) { -#if JVET_M0113_M0188_QG_SIZE CHECK( m_cuQpDeltaSubdiv != 0, "max. delta-QP subdiv must be zero!" ); -#else - CHECK( m_iMaxCuDQPDepth != 0, "max. delta-QP depth must be zero!" ); -#endif bUseDQP = (getBaseQP() < 38) && (getSourceWidth() > 512 || getSourceHeight() > 320); } #endif @@ -1410,51 +1314,29 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) if ( m_RCEnableRateControl ) { pps.setUseDQP(true); -#if JVET_M0113_M0188_QG_SIZE pps.setCuQpDeltaSubdiv( 0 ); -#else - pps.setMaxCuDQPDepth( 0 ); -#endif } else if(bUseDQP) { pps.setUseDQP(true); -#if JVET_M0113_M0188_QG_SIZE pps.setCuQpDeltaSubdiv( m_cuQpDeltaSubdiv ); -#else - pps.setMaxCuDQPDepth( m_iMaxCuDQPDepth ); -#endif } else { pps.setUseDQP(false); -#if JVET_M0113_M0188_QG_SIZE pps.setCuQpDeltaSubdiv( 0 ); -#else - pps.setMaxCuDQPDepth( 0 ); -#endif } -#if JVET_M0113_M0188_QG_SIZE if ( m_cuChromaQpOffsetSubdiv >= 0 ) { pps.getPpsRangeExtension().setCuChromaQpOffsetSubdiv(m_cuChromaQpOffsetSubdiv); -#else - if ( m_diffCuChromaQpOffsetDepth >= 0 ) - { - pps.getPpsRangeExtension().setDiffCuChromaQpOffsetDepth(m_diffCuChromaQpOffsetDepth); -#endif pps.getPpsRangeExtension().clearChromaQpOffsetList(); pps.getPpsRangeExtension().setChromaQpOffsetListEntry(1, 6, 6); /* todo, insert table entries from command line (NB, 0 should not be touched) */ } else { -#if JVET_M0113_M0188_QG_SIZE pps.getPpsRangeExtension().setCuChromaQpOffsetSubdiv(0); -#else - pps.getPpsRangeExtension().setDiffCuChromaQpOffsetDepth(0); -#endif pps.getPpsRangeExtension().clearChromaQpOffsetList(); } pps.getPpsRangeExtension().setCrossComponentPredictionEnabledFlag(m_crossComponentPredictionEnabledFlag); @@ -1593,13 +1475,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) } } CHECK(!(bestPos <= 15), "Unspecified error"); -#if JVET_M0483_IBC==0 - if (sps.getIBCMode()) - { - pps.setNumRefIdxL0DefaultActive(bestPos + 1); - } - else -#endif pps.setNumRefIdxL0DefaultActive(bestPos); pps.setNumRefIdxL1DefaultActive(bestPos); pps.setTransquantBypassEnabledFlag(getTransquantBypassEnabledFlag()); @@ -1620,12 +1495,10 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.pcv = new PreCalcValues( sps, pps, true ); } -#if JVET_M0132_APS void EncLib::xInitAPS(APS &aps) { //Do nothing now } -#endif //Function for initializing m_RPSList, a list of ReferencePictureSet, based on the GOPEntry objects read from the config file. void EncLib::xInitRPS(SPS &sps, bool isFieldCoding) { @@ -1998,14 +1871,12 @@ void EncLib::setParamSetChanged(int spsId, int ppsId) m_spsMap.setChangedFlag(spsId); } #endif -#if JVET_M0132_APS bool EncLib::APSNeedsWriting(int apsId) { bool isChanged = m_apsMap.getChangedFlag(apsId); m_apsMap.clearChangedFlag(apsId); return isChanged; } -#endif bool EncLib::PPSNeedsWriting(int ppsId) { diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index d579e219d4b806bc72056bc2904e40fd8e1d0b19..137b70ffac0be012c8204ba6099d8a931fe6ac97 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -53,9 +53,7 @@ #include "InterSearch.h" #include "IntraSearch.h" #include "EncSampleAdaptiveOffset.h" -#if JVET_M0427_INLOOP_RESHAPER #include "EncReshape.h" -#endif #include "EncAdaptiveLoopFilter.h" #include "RateCtrl.h" @@ -101,12 +99,10 @@ private: CABACEncoder m_CABACEncoder; #endif -#if JVET_M0427_INLOOP_RESHAPER #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM EncReshape *m_cReshaper; ///< reshaper class #else EncReshape m_cReshaper; ///< reshaper class -#endif #endif // processing unit @@ -120,9 +116,7 @@ private: // SPS ParameterSetMap<SPS> m_spsMap; ///< SPS. This is the base value. This is copied to PicSym ParameterSetMap<PPS> m_ppsMap; ///< PPS. This is the base value. This is copied to PicSym -#if JVET_M0132_APS ParameterSetMap<APS> m_apsMap; ///< APS. This is the base value. This is copied to PicSym -#endif // RD cost computation #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM RdCost *m_cRdCost; ///< RD cost computation class @@ -157,9 +151,7 @@ protected: #endif void xInitSPS (SPS &sps); ///< initialize SPS from encoder options void xInitPPS (PPS &pps, const SPS &sps); ///< initialize PPS from encoder options -#if JVET_M0132_APS void xInitAPS (APS &aps); ///< initialize APS from encoder options -#endif #if HEVC_USE_SCALING_LISTS void xInitScalingLists (SPS &sps, PPS &pps); ///< initialize scaling lists #endif @@ -230,27 +222,21 @@ public: #if JCTVC_Y0038_PARAMS void setParamSetChanged(int spsId, int ppsId); #endif -#if JVET_M0132_APS bool APSNeedsWriting(int apsId); -#endif bool PPSNeedsWriting(int ppsId); bool SPSNeedsWriting(int spsId); const PPS* getPPS( int Id ) { return m_ppsMap.getPS( Id); } -#if JVET_M0132_APS const APS* getAPS(int Id) { return m_apsMap.getPS(Id); } -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM void setNumCuEncStacks( int n ) { m_numCuEncStacks = n; } int getNumCuEncStacks() const { return m_numCuEncStacks; } #endif -#if JVET_M0427_INLOOP_RESHAPER #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM EncReshape* getReshaper( int jId = 0 ) { return &m_cReshaper[jId]; } #else EncReshape* getReshaper() { return &m_cReshaper; } -#endif #endif // ------------------------------------------------------------------------------------------------------------------- // encoder function diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 9f95ace76e714e6fb85c6e937c700e8e6f233a79..0c8a5f7c6d4711c90895a3dd1cceb67cad5563a9 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -132,11 +132,7 @@ void EncModeCtrl::setBest( CodingStructure& cs ) } } -#if JVET_M0113_M0188_QG_SIZE void EncModeCtrl::xGetMinMaxQP( int& minQP, int& maxQP, const CodingStructure& cs, const Partitioner &partitioner, const int baseQP, const SPS& sps, const PPS& pps, const PartSplit splitMode ) -#else -void EncModeCtrl::xGetMinMaxQP( int& minQP, int& maxQP, const CodingStructure& cs, const Partitioner &partitioner, const int baseQP, const SPS& sps, const PPS& pps, const bool splitMode ) -#endif { if( m_pcEncCfg->getUseRateCtrl() ) { @@ -145,7 +141,6 @@ void EncModeCtrl::xGetMinMaxQP( int& minQP, int& maxQP, const CodingStructure& c return; } -#if JVET_M0113_M0188_QG_SIZE const unsigned subdivIncr = (splitMode == CU_QUAD_SPLIT) ? 2 : (splitMode == CU_BT_SPLIT) ? 1 : 0; const bool qgEnable = partitioner.currQgEnable(); // QG possible at current level const bool qgEnableChildren = qgEnable && ((partitioner.currSubdiv + subdivIncr) <= pps.getCuQpDeltaSubdiv()) && (subdivIncr > 0); // QG possible at next level @@ -167,65 +162,13 @@ void EncModeCtrl::xGetMinMaxQP( int& minQP, int& maxQP, const CodingStructure& c minQP = cs.currQP[partitioner.chType]; maxQP = cs.currQP[partitioner.chType]; } -#else - const uint32_t currDepth = partitioner.currDepth; - - if( !splitMode ) - { - if( currDepth <= pps.getMaxCuDQPDepth() ) - { - int deltaQP = m_pcEncCfg->getMaxDeltaQP(); - minQP = Clip3( -sps.getQpBDOffset( CHANNEL_TYPE_LUMA ), MAX_QP, baseQP - deltaQP ); - maxQP = Clip3( -sps.getQpBDOffset( CHANNEL_TYPE_LUMA ), MAX_QP, baseQP + deltaQP ); - } -#if ENABLE_QPA_SUB_CTU - else if (pps.getUseDQP() && pps.getMaxCuDQPDepth() > 0 && (!CS::isDualITree (cs) || isLuma (partitioner.chType))) - { - minQP = baseQP; - maxQP = baseQP; - } -#endif - else - { - minQP = cs.currQP[partitioner.chType]; - maxQP = cs.currQP[partitioner.chType]; - } - } - else - { - if( currDepth == pps.getMaxCuDQPDepth() ) - { - int deltaQP = m_pcEncCfg->getMaxDeltaQP(); - minQP = Clip3( -sps.getQpBDOffset( CHANNEL_TYPE_LUMA ), MAX_QP, baseQP - deltaQP ); - maxQP = Clip3( -sps.getQpBDOffset( CHANNEL_TYPE_LUMA ), MAX_QP, baseQP + deltaQP ); - } - else if (currDepth < pps.getMaxCuDQPDepth() -#if ENABLE_QPA_SUB_CTU - || (pps.getUseDQP() && pps.getMaxCuDQPDepth() > 0 && (!CS::isDualITree (cs) || isLuma (partitioner.chType))) -#endif - ) - { - minQP = baseQP; - maxQP = baseQP; - } - else - { - minQP = cs.currQP[partitioner.chType]; - maxQP = cs.currQP[partitioner.chType]; - } - } -#endif } int EncModeCtrl::xComputeDQP( const CodingStructure &cs, const Partitioner &partitioner ) { Picture* picture = cs.picture; -#if JVET_M0113_M0188_QG_SIZE unsigned uiAQDepth = std::min( partitioner.currSubdiv/2, ( uint32_t ) picture->aqlayer.size() - 1 ); -#else - unsigned uiAQDepth = std::min( partitioner.currDepth, ( uint32_t ) picture->aqlayer.size() - 1 ); -#endif AQpLayer* pcAQLayer = picture->aqlayer[uiAQDepth]; double dMaxQScale = pow( 2.0, m_pcEncCfg->getQPAdaptationRange() / 6.0 ); @@ -531,7 +474,6 @@ bool CacheBlkInfoCtrl::getMv( const UnitArea& area, const RefPicList refPicList, return m_codedCUInfo[idx1][idx2][idx3][idx4]->validMv[refPicList][iRefIdx]; } -#if JVET_M0140_SBT void SaveLoadEncInfoSbt::init( const Slice &slice ) { m_sliceSbt = &slice; @@ -636,7 +578,6 @@ void SaveLoadEncInfoSbt::resetSaveloadSbt( int maxSbtSize ) } } } -#endif bool CacheBlkInfoCtrl::getInter(const UnitArea& area) { @@ -662,9 +603,7 @@ uint8_t CacheBlkInfoCtrl::getGbiIdx(const UnitArea& area) #if REUSE_CU_RESULTS static bool isTheSameNbHood( const CodingUnit &cu, const CodingStructure& cs, const Partitioner &partitioner -#if JVET_M0170_MRG_SHARELIST , const PredictionUnit &pu, int picW, int picH -#endif ) { if( cu.chType != partitioner.chType ) @@ -686,7 +625,6 @@ static bool isTheSameNbHood( const CodingUnit &cu, const CodingStructure& cs, co const UnitArea &cmnAnc = ps[i - 1].parts[ps[i - 1].idx]; const UnitArea cuArea = CS::getArea( cs, cu, partitioner.chType ); -#if JVET_M0170_MRG_SHARELIST bool sharedListReuseMode = true; if( pu.mergeFlag == true && @@ -711,7 +649,6 @@ static bool isTheSameNbHood( const CodingUnit &cu, const CodingStructure& cs, co sharedListReuseMode = true; } //#endif -#endif for( int i = 0; i < cmnAnc.blocks.size(); i++ ) { @@ -720,12 +657,10 @@ static bool isTheSameNbHood( const CodingUnit &cu, const CodingStructure& cs, co return false; } } -#if JVET_M0170_MRG_SHARELIST if(!sharedListReuseMode) { return false; } -#endif return true; @@ -982,20 +917,10 @@ bool BestEncInfoCache::isValid( const CodingStructure& cs, const Partitioner& pa if( encInfo.cu.qp != qp ) return false; if( cs.picture->poc != encInfo.poc || CS::getArea( cs, cs.area, partitioner.chType ) != CS::getArea( cs, encInfo.cu, partitioner.chType ) || !isTheSameNbHood( encInfo.cu, cs, partitioner -#if JVET_M0170_MRG_SHARELIST , encInfo.pu, (cs.picture->Y().width), (cs.picture->Y().height) -#endif ) -#if JVET_M0483_IBC || CU::isIBC(encInfo.cu) -#else - || encInfo.cu.ibc -#endif -#if JVET_M0113_M0188_QG_SIZE || partitioner.currQgEnable() || cs.currQP[partitioner.chType] != encInfo.cu.qp -#else - || partitioner.currDepth <= cs.pps->getMaxCuDQPDepth() || cs.currQP[partitioner.chType] != encInfo.cu.qp -#endif ) { return false; @@ -1014,15 +939,9 @@ bool BestEncInfoCache::setCsFrom( CodingStructure& cs, EncTestMode& testMode, co BestEncodingInfo& encInfo = *m_bestEncInfo[idx1][idx2][idx3][idx4]; if( cs.picture->poc != encInfo.poc || CS::getArea( cs, cs.area, partitioner.chType ) != CS::getArea( cs, encInfo.cu, partitioner.chType ) || !isTheSameNbHood( encInfo.cu, cs, partitioner -#if JVET_M0170_MRG_SHARELIST , encInfo.pu, (cs.picture->Y().width), (cs.picture->Y().height) -#endif ) -#if JVET_M0113_M0188_QG_SIZE || partitioner.currQgEnable() || cs.currQP[partitioner.chType] != encInfo.cu.qp -#else - || partitioner.currDepth <= cs.pps->getMaxCuDQPDepth() || cs.currQP[partitioner.chType] != encInfo.cu.qp -#endif ) { return false; @@ -1151,9 +1070,7 @@ void EncModeCtrlMTnoRQT::create( const EncCfg& cfg ) #if REUSE_CU_RESULTS BestEncInfoCache::create( cfg.getChromaFormatIdc() ); #endif -#if JVET_M0140_SBT SaveLoadEncInfoSbt::create(); -#endif } void EncModeCtrlMTnoRQT::destroy() @@ -1162,9 +1079,7 @@ void EncModeCtrlMTnoRQT::destroy() #if REUSE_CU_RESULTS BestEncInfoCache::destroy(); #endif -#if JVET_M0140_SBT SaveLoadEncInfoSbt::destroy(); -#endif } void EncModeCtrlMTnoRQT::initCTUEncoding( const Slice &slice ) @@ -1173,9 +1088,7 @@ void EncModeCtrlMTnoRQT::initCTUEncoding( const Slice &slice ) #if REUSE_CU_RESULTS BestEncInfoCache::init( slice ); #endif -#if JVET_M0140_SBT SaveLoadEncInfoSbt::init( slice ); -#endif CHECK( !m_ComprCUCtxList.empty(), "Mode list is not empty at the beginning of a CTU" ); @@ -1198,18 +1111,6 @@ void EncModeCtrlMTnoRQT::initCTUEncoding( const Slice &slice ) } } -#if ENABLE_QPA_SUB_CTU && !JVET_M0113_M0188_QG_SIZE -static Position getMaxLumaDQPDepthPos (const CodingStructure &cs, const Partitioner &partitioner) -{ - if (partitioner.currDepth <= cs.pps->getMaxCuDQPDepth()) - { - return partitioner.currArea().lumaPos(); - } - const PartLevel splitAtMaxDepth = partitioner.getPartStack().at (cs.pps->getMaxCuDQPDepth()); - // the parent node of qtDepth + mttDepth == maxDqpDepth - return splitAtMaxDepth.parts[splitAtMaxDepth.idx].lumaPos(); -} -#endif void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStructure& cs ) { @@ -1274,21 +1175,13 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru baseQP = Clip3(-cs.sps->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, baseQP + xComputeDQP(cs, partitioner)); } #if ENABLE_QPA_SUB_CTU -#if JVET_M0113_M0188_QG_SIZE else if (m_pcEncCfg->getUsePerceptQPA() && !m_pcEncCfg->getUseRateCtrl() && cs.pps->getUseDQP() && cs.pps->getCuQpDeltaSubdiv() > 0) -#else - else if (m_pcEncCfg->getUsePerceptQPA() && !m_pcEncCfg->getUseRateCtrl() && cs.pps->getUseDQP() && cs.pps->getMaxCuDQPDepth() > 0) -#endif { const PreCalcValues &pcv = *cs.pcv; if ((partitioner.currArea().lwidth() < pcv.maxCUWidth) && (partitioner.currArea().lheight() < pcv.maxCUHeight) && cs.picture) { -#if JVET_M0113_M0188_QG_SIZE const Position &pos = partitioner.currQgPos; -#else - const Position &pos = getMaxLumaDQPDepthPos (cs, partitioner); -#endif #if MAX_TB_SIZE_SIGNALLING const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min (cs.sps->getMaxTbSize(), pcv.maxCUWidth)]; #else @@ -1303,11 +1196,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru #if SHARP_LUMA_DELTA_QP if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) { -#if JVET_M0113_M0188_QG_SIZE if (partitioner.currQgEnable()) -#else - if (partitioner.currDepth <= cs.pps->getMaxCuDQPDepth()) -#endif { m_lumaQPOffset = calculateLumaDQP (cs.getOrgBuf (clipArea (cs.area.Y(), cs.picture->Y()))); } @@ -1318,11 +1207,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru int minQP = baseQP; int maxQP = baseQP; -#if JVET_M0113_M0188_QG_SIZE xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, CU_QUAD_SPLIT ); -#else - xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, true ); -#endif bool checkIbc = true; if (cs.chType == CHANNEL_TYPE_CHROMA) { @@ -1377,11 +1262,9 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru } } -#if JVET_M0113_M0188_QG_SIZE int minQPq = minQP; int maxQPq = maxQP; xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, CU_BT_SPLIT ); -#endif if( partitioner.canSplit( CU_VERT_SPLIT, cs ) ) { // add split modes @@ -1412,11 +1295,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru if( cuECtx.get<bool>( QT_BEFORE_BT ) ) { -#if JVET_M0113_M0188_QG_SIZE for( int qp = maxQPq; qp >= minQPq; qp-- ) -#else - for( int qp = maxQP; qp >= minQP; qp-- ) -#endif { m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_QT, ETO_STANDARD, qp, false } ); } @@ -1424,11 +1303,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back( { ETM_POST_DONT_SPLIT } ); -#if JVET_M0113_M0188_QG_SIZE xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, CU_DONT_SPLIT ); -#else - xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, false ); -#endif bool useLossless = false; int lowestQP = minQP; @@ -1462,11 +1337,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, ETO_STANDARD, qp, lossless } ); m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp, lossless } ); // add ibc mode to intra path -#if JVET_M0483_IBC if (cs.sps->getIBCFlag() && checkIbc) -#else - if (cs.sps->getIBCMode() && checkIbc ) -#endif { m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC, ETO_STANDARD, qp, lossless }); if (cs.chType == CHANNEL_TYPE_LUMA) @@ -1483,11 +1354,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru { const int qp = std::max( qpLoop, lowestQP ); const bool lossless = useLossless && qpLoop == minQP; -#if JVET_M0246_AFFINE_AMVR if( m_pcEncCfg->getIMV() || m_pcEncCfg->getUseAffineAmvr() ) -#else - if( m_pcEncCfg->getIMV() ) -#endif { int imv = m_pcEncCfg->getIMV4PelFast() ? 3 : 2; m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, EncTestModeOpts( imv << ETO_IMV_SHIFT ), qp, lossless } ); @@ -1520,7 +1387,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } } -#if JVET_M0253_HASH_ME if (m_pcEncCfg->getUseHashME()) { if ((cs.area.lwidth() == cs.area.lheight() && cs.area.lwidth() <= 64 && cs.area.lwidth() >= 4) || (cs.area.lwidth() == 4 && cs.area.lheight() == 8) || (cs.area.lwidth() == 8 && cs.area.lheight() == 4)) @@ -1528,7 +1394,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back({ ETM_HASH_INTER, ETO_STANDARD, qp, lossless }); } } -#endif } } @@ -1552,12 +1417,10 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ComprCUCtx& cuECtx = m_ComprCUCtxList.back(); // Fast checks, partitioning depended -#if JVET_M0253_HASH_ME if (cuECtx.isHashPerfectMatch && encTestmode.type != ETM_MERGE_SKIP && encTestmode.type != ETM_AFFINE && encTestmode.type != ETM_MERGE_TRIANGLE) { return false; } -#endif // if early skip detected, skip all modes checking but the splits if( cuECtx.earlySkip && m_pcEncCfg->getUseEarlySkipDetection() && !isModeSplit( encTestmode ) && !( isModeInter( encTestmode ) ) ) @@ -1642,34 +1505,16 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt return false; } -#if JVET_M0483_IBC if (m_pcEncCfg->getUsePbIntraFast() && (!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && !interHadActive(cuECtx) && cuECtx.bestCU && !CU::isIntra(*cuECtx.bestCU)) -#else - if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && !interHadActive( cuECtx ) && cuECtx.bestCU && CU::isInter( *cuECtx.bestCU ) ) -#endif { return false; } // INTRA MODES -#if JVET_M0483_IBC if (cs.sps->getIBCFlag() && !cuECtx.bestTU) -#else - if (cs.sps->getIBCMode() && !cuECtx.bestTU) -#endif return true; - #if !JVET_M0445_MCTS - CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" ); - - if( !( slice.isIRAP() || bestMode.type == ETM_INTRA || -#else if( !( slice.isIRAP() || bestMode.type == ETM_INTRA || !cuECtx.bestTU || -#endif -#if JVET_M0483_IBC ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && (!relatedCU.isInter || !relatedCU.isIBC) && ( -#else - ( ( !m_pcEncCfg->getDisableIntraPUsInInterSlices() ) && !relatedCU.isInter && ( -#endif ( cuECtx.bestTU->cbf[0] != 0 ) || ( ( numComp > COMPONENT_Cb ) && cuECtx.bestTU->cbf[1] != 0 ) || ( ( numComp > COMPONENT_Cr ) && cuECtx.bestTU->cbf[2] != 0 ) // avoid very complex intra if it is unlikely @@ -1691,11 +1536,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt if( !cs.slice->isIRAP() && m_pcEncCfg->getUsePbIntraFast() ) { CodingUnit* bestCU = cuECtx.bestCU; -#if JVET_M0483_IBC if (bestCU && !CU::isIntra(*bestCU)) -#else - if( bestCU && CU::isInter( *bestCU ) ) -#endif { DistParam distParam; const bool useHad = !bestCU->transQuantBypass; @@ -1731,11 +1572,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt else if (encTestmode.type == ETM_IBC || encTestmode.type == ETM_IBC_MERGE) { // IBC MODES -#if JVET_M0483_IBC return sps.getIBCFlag() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; -#else - return sps.getIBCMode() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; -#endif } else if( isModeInter( encTestmode ) ) { @@ -1775,9 +1612,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt if (imvOpt == 3 && cuECtx.get<double>(BEST_NO_IMV_COST) * 1.06 < cuECtx.get<double>(BEST_IMV_COST)) { -#if JVET_M0246_AFFINE_AMVR if ( !m_pcEncCfg->getUseAffineAmvr() ) -#endif return false; } } @@ -1801,11 +1636,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ////////////////////////////////////////////////////////////////////////// int skipScore = 0; -#if JVET_M0483_IBC if ((!slice.isIntra() || slice.getSPS()->getIBCFlag()) && cuECtx.get<bool>(IS_BEST_NOSPLIT_SKIP)) -#else - if( !slice.isIntra() && cuECtx.get<bool>( IS_BEST_NOSPLIT_SKIP ) ) -#endif { for( int i = 2; i < m_ComprCUCtxList.size(); i++ ) { @@ -1900,7 +1731,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt const CodingUnit *cuBR = bestCS->cus.back(); unsigned height = partitioner.currArea().lumaSize().height; -#if JVET_M0483_IBC if (bestCU && ((bestCU->btDepth == 0 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getIBCFlag()) ? 3 : 2)) || (bestCU->btDepth == 1 && cuBR && cuBR->btDepth == 1 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getIBCFlag()) ? 4 : 3))) && (width <= MAX_TB_SIZEY && height <= MAX_TB_SIZEY) @@ -1908,15 +1738,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#else - if( bestCU && ( ( bestCU->btDepth == 0 && maxBTD >= ( slice.isIntra() ? 3 : 2 ) ) - || ( bestCU->btDepth == 1 && cuBR && cuBR->btDepth == 1 && maxBTD >= ( slice.isIntra() ? 4 : 3 ) ) ) - && ( width <= MAX_TB_SIZEY && height <= MAX_TB_SIZEY ) - && cuECtx.get<bool>( DID_HORZ_SPLIT ) && cuECtx.get<bool>( DID_VERT_SPLIT ) ) - { - return false; - } -#endif } if( m_pcEncCfg->getUseEarlyCU() && bestCS->cost != MAX_DOUBLE && bestCU && bestCU->skip ) { @@ -2021,7 +1842,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt #endif relatedCU.GBiIdx = bestCU->GBiIdx; } -#if JVET_M0483_IBC else if (CU::isIBC(*bestCU)) { relatedCU.isIBC = true; @@ -2029,7 +1849,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt relatedCU.isSkip |= bestCU->skip; #endif } -#endif else if( CU::isIntra( *bestCU ) ) { relatedCU.isIntra = true; @@ -2071,23 +1890,6 @@ bool EncModeCtrlMTnoRQT::useModeResult( const EncTestMode& encTestmode, CodingSt { cuECtx.set( BEST_TRIV_SPLIT_COST, tempCS->cost ); } -#if !JVET_M0464_UNI_MTS - else if( encTestmode.type == ETM_INTRA ) - { - const CodingUnit cu = *tempCS->getCU( partitioner.chType ); - - if( !cu.emtFlag ) - { - cuECtx.bestEmtSize2Nx2N1stPass = tempCS->cost; - } -#if JVET_M0102_INTRA_SUBPARTITIONS - if (!cu.ispMode) - { - cuECtx.bestCostEmtFirstPassNoIsp = tempCS->cost; - } -#endif - } -#endif if( m_pcEncCfg->getIMV4PelFast() && m_pcEncCfg->getIMV() && encTestmode.type == ETM_INTER_ME ) { @@ -2145,19 +1947,7 @@ bool EncModeCtrlMTnoRQT::useModeResult( const EncTestMode& encTestmode, CodingSt } // for now just a simple decision based on RD-cost or choose tempCS if bestCS is not yet coded -#if JVET_M0428_ENC_DB_OPT -#if JVET_M0445_MCTS if( tempCS->features[ENC_FT_RD_COST] != MAX_DOUBLE && ( !cuECtx.bestCS || ( ( tempCS->features[ENC_FT_RD_COST] + ( tempCS->useDbCost ? tempCS->costDbOffset : 0 ) ) < ( cuECtx.bestCS->features[ENC_FT_RD_COST] + ( tempCS->useDbCost ? cuECtx.bestCS->costDbOffset : 0 ) ) ) ) ) -#else - if( !cuECtx.bestCS || ( ( tempCS->features[ENC_FT_RD_COST] + ( tempCS->useDbCost ? tempCS->costDbOffset : 0 ) ) < ( cuECtx.bestCS->features[ENC_FT_RD_COST] + ( tempCS->useDbCost ? cuECtx.bestCS->costDbOffset : 0 ) ) ) ) -#endif -#else -#if JVET_M0445_MCTS - if( tempCS->features[ENC_FT_RD_COST] != MAX_DOUBLE && ( !cuECtx.bestCS || tempCS->features[ENC_FT_RD_COST] < cuECtx.bestCS->features[ENC_FT_RD_COST] ) ) -#else - if( !cuECtx.bestCS || tempCS->features[ENC_FT_RD_COST] < cuECtx.bestCS->features[ENC_FT_RD_COST] ) -#endif -#endif { cuECtx.bestCS = tempCS; cuECtx.bestCU = tempCS->cus[0]; @@ -2189,9 +1979,7 @@ void EncModeCtrlMTnoRQT::copyState( const EncModeCtrl& other, const UnitArea& ar #if REUSE_CU_RESULTS this->BestEncInfoCache ::copyState( *pOther, area ); #endif -#if JVET_M0140_SBT this->SaveLoadEncInfoSbt ::copyState( *pOther ); -#endif m_skipThreshold = pOther->m_skipThreshold; } @@ -2233,11 +2021,7 @@ int EncModeCtrlMTnoRQT::getNumParallelJobs( const CodingStructure &cs, Partition bool EncModeCtrlMTnoRQT::isParallelSplit( const CodingStructure &cs, Partitioner& partitioner ) const { if( partitioner.getImplicitSplit( cs ) != CU_DONT_SPLIT || cs.picture->scheduler.getSplitJobId() != 0 ) return false; -#if JVET_M0113_M0188_QG_SIZE if( cs.pps->getUseDQP() && partitioner.currQgEnable() ) return false; -#else - if( cs.pps->getUseDQP() && partitioner.currDepth <= cs.pps->getMaxCuDQPDepth() ) return false; -#endif const int numJobs = getNumParallelJobs( cs, partitioner ); const int numPxl = partitioner.currArea().Y().area(); const int parlAt = m_pcEncCfg->getNumSplitThreads() <= 3 ? 1024 : 256; diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index f7d6c11e4bd23fe57ff86c24f14d3e4068ffa339..f8ae006d18aa7f44f82aa8df76e972259d5a5f44 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -54,9 +54,7 @@ enum EncTestModeType { -#if JVET_M0253_HASH_ME ETM_HASH_INTER, -#endif ETM_MERGE_SKIP, ETM_INTER_ME, ETM_AFFINE, @@ -140,9 +138,7 @@ inline bool isModeInter( const EncTestMode& encTestmode ) // perhaps remove || encTestmode.type == ETM_MERGE_SKIP || encTestmode.type == ETM_AFFINE || encTestmode.type == ETM_MERGE_TRIANGLE -#if JVET_M0253_HASH_ME || encTestmode.type == ETM_HASH_INTER -#endif ); } @@ -184,33 +180,20 @@ struct ComprCUCtx , testModes ( ) , lastTestMode ( ) , earlySkip ( false ) -#if JVET_M0253_HASH_ME , isHashPerfectMatch ( false ) -#endif , bestCS ( nullptr ) , bestCU ( nullptr ) , bestTU ( nullptr ) , extraFeatures ( ) , extraFeaturesd( ) , bestInterCost ( MAX_DOUBLE ) -#if !JVET_M0464_UNI_MTS - , bestEmtSize2Nx2N1stPass - ( MAX_DOUBLE ) - , skipSecondEMTPass - ( false ) -#endif , interHad (std::numeric_limits<Distortion>::max()) #if ENABLE_SPLIT_PARALLELISM , isLevelSplitParallel ( false ) #endif -#if JVET_M0102_INTRA_SUBPARTITIONS , bestCostWithoutSplitFlags( MAX_DOUBLE ) -#if !JVET_M0464_UNI_MTS - , bestCostEmtFirstPassNoIsp( MAX_DOUBLE ) -#endif -#endif { getAreaIdx( cs.area.Y(), *cs.pcv, cuX, cuY, cuW, cuH ); partIdx = ( ( cuX << 8 ) | cuY ); @@ -228,29 +211,18 @@ struct ComprCUCtx std::vector<EncTestMode> testModes; EncTestMode lastTestMode; bool earlySkip; -#if JVET_M0253_HASH_ME bool isHashPerfectMatch; -#endif CodingStructure *bestCS; CodingUnit *bestCU; TransformUnit *bestTU; static_vector<int64_t, 30> extraFeatures; static_vector<double, 30> extraFeaturesd; double bestInterCost; -#if !JVET_M0464_UNI_MTS - double bestEmtSize2Nx2N1stPass; - bool skipSecondEMTPass; -#endif Distortion interHad; #if ENABLE_SPLIT_PARALLELISM bool isLevelSplitParallel; #endif -#if JVET_M0102_INTRA_SUBPARTITIONS double bestCostWithoutSplitFlags; -#if !JVET_M0464_UNI_MTS - double bestCostEmtFirstPassNoIsp; -#endif -#endif template<typename T> T get( int ft ) const { return typeid(T) == typeid(double) ? (T&)extraFeaturesd[ft] : T(extraFeatures[ft]); } template<typename T> void set( int ft, T val ) { extraFeatures [ft] = int64_t( val ); } @@ -310,10 +282,8 @@ public: EncTestMode currTestMode () const; EncTestMode lastTestMode () const; void setEarlySkipDetected (); -#if JVET_M0253_HASH_ME void setIsHashPerfectMatch( bool b ) { m_ComprCUCtxList.back().isHashPerfectMatch = b; } bool getIsHashPerfectMatch() { return m_ComprCUCtxList.back().isHashPerfectMatch; } -#endif virtual void setBest ( CodingStructure& cs ); bool anyMode () const; @@ -329,27 +299,12 @@ public: double getBestInterCost () const { return m_ComprCUCtxList.back().bestInterCost; } Distortion getInterHad () const { return m_ComprCUCtxList.back().interHad; } void enforceInterHad ( Distortion had ) { m_ComprCUCtxList.back().interHad = had; } -#if !JVET_M0464_UNI_MTS - double getEmtSize2Nx2NFirstPassCost () const { return m_ComprCUCtxList.back().bestEmtSize2Nx2N1stPass; } - bool getSkipSecondEMTPass () const { return m_ComprCUCtxList.back().skipSecondEMTPass; } - void setSkipSecondEMTPass ( bool b ) { m_ComprCUCtxList.back().skipSecondEMTPass = b; } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS double getBestCostWithoutSplitFlags () const { return m_ComprCUCtxList.back().bestCostWithoutSplitFlags; } void setBestCostWithoutSplitFlags ( double cost ) { m_ComprCUCtxList.back().bestCostWithoutSplitFlags = cost; } -#if !JVET_M0464_UNI_MTS - double getEmtFirstPassNoIspCost () const { return m_ComprCUCtxList.back().bestCostEmtFirstPassNoIsp; } - void setEmtFirstPassNoIspCost ( double cost ) { m_ComprCUCtxList.back().bestCostEmtFirstPassNoIsp = cost; } -#endif -#endif protected: void xExtractFeatures ( const EncTestMode encTestmode, CodingStructure& cs ); -#if JVET_M0113_M0188_QG_SIZE void xGetMinMaxQP ( int& iMinQP, int& iMaxQP, const CodingStructure& cs, const Partitioner &pm, const int baseQP, const SPS& sps, const PPS& pps, const PartSplit splitMode ); -#else - void xGetMinMaxQP ( int& iMinQP, int& iMaxQP, const CodingStructure& cs, const Partitioner &pm, const int baseQP, const SPS& sps, const PPS& pps, const bool splitMode ); -#endif int xComputeDQP ( const CodingStructure &cs, const Partitioner &pm ); }; @@ -357,7 +312,6 @@ protected: ////////////////////////////////////////////////////////////////////////// // some utility interfaces that expose some functionality that can be used without concerning about which particular controller is used ////////////////////////////////////////////////////////////////////////// -#if JVET_M0140_SBT struct SaveLoadStructSbt { uint8_t numPuInfoStored; @@ -392,7 +346,6 @@ public: void copyState(const SaveLoadEncInfoSbt& other); #endif }; -#endif static const int MAX_STORED_CU_INFO_REFS = 4; @@ -402,9 +355,7 @@ struct CodedCUInfo bool isIntra; bool isSkip; bool isMMVDSkip; -#if JVET_M0483_IBC bool isIBC; -#endif bool validMv[NUM_REF_PIC_LIST_01][MAX_STORED_CU_INFO_REFS]; Mv saveMv [NUM_REF_PIC_LIST_01][MAX_STORED_CU_INFO_REFS]; @@ -531,9 +482,7 @@ class EncModeCtrlMTnoRQT : public EncModeCtrl, public CacheBlkInfoCtrl #if REUSE_CU_RESULTS , public BestEncInfoCache #endif -#if JVET_M0140_SBT , public SaveLoadEncInfoSbt -#endif { enum ExtraFeatures { diff --git a/source/Lib/EncoderLib/EncReshape.cpp b/source/Lib/EncoderLib/EncReshape.cpp index 638eb2dd2e84fb95db0f6ef440d146cbc5f17d14..b09eb70d244916af5572a5b95c31fb7b701393bb 100644 --- a/source/Lib/EncoderLib/EncReshape.cpp +++ b/source/Lib/EncoderLib/EncReshape.cpp @@ -38,7 +38,6 @@ #include <stdio.h> #include <string.h> #include <math.h> -#if JVET_M0427_INLOOP_RESHAPER //! \ingroup EncLib //! \{ @@ -107,11 +106,7 @@ void EncReshape::destroy() \param pcPic describe pointer of current coding picture \param sliceType describe the slice type */ -#if JVET_M0483_IBC void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT) -#else -void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC) -#endif { if (m_lumaBD >= 10) { @@ -123,18 +118,10 @@ void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const } else { -#if JVET_M0483_IBC if (sliceType == I_SLICE ) { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; } -#else - if (sliceType == I_SLICE || (sliceType == P_SLICE && isIBC)) { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; } -#endif else { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = false; } } -#if JVET_M0483_IBC if (sliceType == I_SLICE && isDualT) { m_sliceReshapeInfo.enableChromaAdj = 0; } -#else - if ((sliceType == I_SLICE || (sliceType == P_SLICE && isIBC)) && isDualT) { m_sliceReshapeInfo.enableChromaAdj = 0; } -#endif else { m_sliceReshapeInfo.enableChromaAdj = 1; } } else @@ -150,21 +137,13 @@ void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const \param sliceType describe the slice type \param reshapeCW describe some input info */ -#if JVET_M0483_IBC void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT) -#else -void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC) -#endif { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; m_sliceReshapeInfo.sliceReshaperEnableFlag = true; int modIP = pcPic->getPOC() - pcPic->getPOC() / reshapeCW.rspFpsToIp * reshapeCW.rspFpsToIp; -#if JVET_M0483_IBC if (sliceType == I_SLICE || (reshapeCW.rspIntraPeriod == -1 && modIP == 0)) -#else - if (sliceType == I_SLICE || (reshapeCW.rspIntraPeriod == -1 && modIP == 0) || (sliceType == P_SLICE && isIBC)) -#endif { if (m_sliceReshapeInfo.sliceReshaperModelPresentFlag == true) { @@ -481,11 +460,7 @@ void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const } m_chromaAdj = m_sliceReshapeInfo.enableChromaAdj; -#if JVET_M0483_IBC if (sliceType == I_SLICE && isDualT) -#else - if ((sliceType == I_SLICE || (sliceType == P_SLICE && isIBC)) && isDualT) -#endif { m_sliceReshapeInfo.enableChromaAdj = 0; } @@ -1303,6 +1278,5 @@ void EncReshape::copyState(const EncReshape &other) m_reshapeLUTSize = other.m_reshapeLUTSize; } #endif -#endif // //! \} diff --git a/source/Lib/EncoderLib/EncReshape.h b/source/Lib/EncoderLib/EncReshape.h index f570a7867d4945cfe0b67f0ceba742ed7757208c..6e4871866a05ae33047cd22d06befe504902211c 100644 --- a/source/Lib/EncoderLib/EncReshape.h +++ b/source/Lib/EncoderLib/EncReshape.h @@ -42,7 +42,6 @@ #pragma once #endif // _MSC_VER > 1000 #include "CommonLib/Reshape.h" -#if JVET_M0427_INLOOP_RESHAPER //! \ingroup EncoderLib //! \{ @@ -82,13 +81,8 @@ public: bool getSrcReshaped() { return m_srcReshaped; } void setSrcReshaped(bool b) { m_srcReshaped = b; } -#if JVET_M0483_IBC void preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT); void preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT); -#else - void preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC); - void preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC); -#endif void bubbleSortDsd(double *array, int * idx, int n); void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void swap(double *xp, double *yp) { double temp = *xp; *xp = *yp; *yp = temp; } @@ -107,4 +101,3 @@ public: //! \} #endif -#endif diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index f2186981fac0c37ba4cac66b75861af46f2a29a8..82a08fa1206a03c52f5cfc86d14083ac13faa76d 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -602,11 +602,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr #endif if(rpcSlice->getPPS()->getSliceChromaQpFlag()) { -#if JVET_M0483_IBC const bool bUseIntraOrPeriodicOffset = (rpcSlice->isIntra() && !rpcSlice->getSPS()->getIBCFlag()) || (m_pcCfg->getSliceChromaOffsetQpPeriodicity() > 0 && (rpcSlice->getPOC() % m_pcCfg->getSliceChromaOffsetQpPeriodicity()) == 0); -#else - const bool bUseIntraOrPeriodicOffset = rpcSlice->isIntra() || (m_pcCfg->getSliceChromaOffsetQpPeriodicity() > 0 && (rpcSlice->getPOC() % m_pcCfg->getSliceChromaOffsetQpPeriodicity()) == 0); -#endif int cbQP = bUseIntraOrPeriodicOffset ? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(false) : m_pcCfg->getGOPEntry(iGOPid).m_CbQPoffset; int crQP = bUseIntraOrPeriodicOffset ? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(true) : m_pcCfg->getGOPEntry(iGOPid).m_CrQPoffset; @@ -1044,7 +1040,7 @@ static bool applyQPAdaptation (Picture* const pcPic, Slice* const pcSlice, pcPic->m_iOffsetCtu[ctuRsAddr] = (Pel)iQPAdapt; // adapted QPs -#if ENABLE_QPA_SUB_CTU && JVET_M0113_M0188_QG_SIZE +#if ENABLE_QPA_SUB_CTU if (pcv.widthInCtus > 1 && pcSlice->getPPS()->getCuQpDeltaSubdiv() == 0) // reduce local DQP rate peaks #elif ENABLE_QPA_SUB_CTU if (pcv.widthInCtus > 1 && pcSlice->getPPS()->getMaxCuDQPDepth() == 0) // reduce local DQP rate peaks @@ -1092,11 +1088,7 @@ static int applyQPAdaptationSubCtu (CodingStructure &cs, const UnitArea ctuArea, const int bitDepth = cs.slice->getSPS()->getBitDepth (CHANNEL_TYPE_LUMA); // overall image bit-depth const int adaptedCtuQP = pcPic ? pcPic->m_iOffsetCtu[ctuAddr] : cs.slice->getSliceQpBase(); -#if JVET_M0113_M0188_QG_SIZE if (!pcPic || cs.pps->getCuQpDeltaSubdiv() == 0) return adaptedCtuQP; -#else - if (!pcPic || cs.pps->getMaxCuDQPDepth() == 0) return adaptedCtuQP; -#endif for (unsigned addr = 0; addr < cs.picture->m_subCtuQP.size(); addr++) { @@ -1467,11 +1459,7 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c cs.pcv = pcSlice->getPPS()->pcv; cs.fracBits = 0; -#if JVET_M0055_DEBUG_CTU if( startCtuTsAddr == 0 && ( pcSlice->getPOC() != m_pcCfg->getSwitchPOC() || -1 == m_pcCfg->getDebugCTU() ) ) -#else - if( startCtuTsAddr == 0 ) -#endif { cs.initStructData (pcSlice->getSliceQp(), pcSlice->getPPS()->getTransquantBypassEnabledFlag()); } @@ -1548,7 +1536,6 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c } -#if JVET_M0255_FRACMMVD_SWITCH void EncSlice::checkDisFracMmvd( Picture* pcPic, uint32_t startCtuTsAddr, uint32_t boundingCtuTsAddr ) { CodingStructure& cs = *pcPic->cs; @@ -1588,14 +1575,11 @@ void EncSlice::checkDisFracMmvd( Picture* pcPic, uint32_t startCtuTsAddr, uint32 { pcSlice->setDisFracMMVD( true ); } -#if JVET_M0854_FRACMMVD_SWITCH_FOR_UHD if (!pcSlice->getDisFracMMVD()) { bool useIntegerMVD = (pcPic->lwidth()*pcPic->lheight() > 1920 * 1080); pcSlice->setDisFracMMVD( useIntegerMVD ); } -#endif } -#endif void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, const bool bFastDeltaQP, uint32_t startCtuTsAddr, uint32_t boundingCtuTsAddr, EncLib* pEncLib ) { @@ -1646,50 +1630,24 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons #if HEVC_DEPENDENT_SLICES } #endif -#if JVET_M0255_FRACMMVD_SWITCH if ( pcSlice->getSPS()->getDisFracMmvdEnabledFlag() || -#if JVET_M0483_IBC (pcSlice->getSPS()->getIBCFlag() && m_pcCuEncoder->getEncCfg()->getIBCHashSearch())) -#else - ( pcSlice->getSPS()->getIBCMode() && m_pcCuEncoder->getEncCfg()->getIBCHashSearch() ) ) -#endif { -#if JVET_M0427_INLOOP_RESHAPER -#if JVET_M0483_IBC if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCFlag()) -#else - if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCMode()) -#endif cs.picture->getOrigBuf(COMPONENT_Y).rspSignal(m_pcLib->getReshaper()->getFwdLUT()); -#endif m_pcCuEncoder->getIbcHashMap().rebuildPicHashMap( cs.picture->getOrigBuf() ); -#if JVET_M0427_INLOOP_RESHAPER -#if JVET_M0483_IBC if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCFlag()) -#else - if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCMode()) -#endif cs.picture->getOrigBuf().copyFrom(cs.picture->getTrueOrigBuf()); -#endif } checkDisFracMmvd( pcPic, startCtuTsAddr, boundingCtuTsAddr ); -#endif // for every CTU in the slice segment (may terminate sooner if there is a byte limit on the slice-segment) for( uint32_t ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr; ctuTsAddr++ ) { -#if JVET_M0055_DEBUG_CTU #if HEVC_TILES_WPP const int32_t ctuRsAddr = tileMap.getCtuTsToRsAddrMap( ctuTsAddr ); #else const int32_t ctuRsAddr = ctuTsAddr; #endif -#else -#if HEVC_TILES_WPP - const uint32_t ctuRsAddr = tileMap.getCtuTsToRsAddrMap(ctuTsAddr); -#else - const uint32_t ctuRsAddr = ctuTsAddr; -#endif -#endif #if HEVC_TILES_WPP // update CABAC state @@ -1703,21 +1661,13 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons const UnitArea ctuArea( cs.area.chromaFormat, Area( pos.x, pos.y, pcv.maxCUWidth, pcv.maxCUHeight ) ); DTRACE_UPDATE( g_trace_ctx, std::make_pair( "ctu", ctuRsAddr ) ); -#if JVET_M0055_DEBUG_CTU if( pCfg->getSwitchPOC() != pcPic->poc || -1 == pCfg->getDebugCTU() ) -#endif if ((cs.slice->getSliceType() != I_SLICE || cs.sps->getIBCFlag()) && ctuXPosInCtus == 0) { cs.motionLut.lut.resize(0); -#if JVET_M0483_IBC cs.motionLut.lutIbc.resize(0); -#endif -#if JVET_M0170_MRG_SHARELIST cs.motionLut.lutShare.resize(0); -#if JVET_M0483_IBC cs.motionLut.lutShareIbc.resize(0); -#endif -#endif } #if ENABLE_WPP_PARALLELISM @@ -1825,7 +1775,6 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons resetGbiCodingOrder(false, cs); m_pcInterSearch->initWeightIdxBits(); } -#if JVET_M0427_INLOOP_RESHAPER if (pcSlice->getSPS()->getUseReshaper()) { m_pcCuEncoder->setDecCuReshaperInEncCU(m_pcLib->getReshaper(), pcSlice->getSPS()->getChromaFormatIdc()); @@ -1837,17 +1786,12 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons } #endif } -#endif -#if JVET_M0445_MCTS if( !cs.slice->isIntra() && pCfg->getMCTSEncConstraint() ) { pcPic->mctsInfo.init( &cs, ctuRsAddr ); } -#endif -#if JVET_M0055_DEBUG_CTU if (pCfg->getSwitchPOC() != pcPic->poc || ctuRsAddr >= pCfg->getDebugCTU()) -#endif #if ENABLE_WPP_PARALLELISM pEncLib->getCuEncoder( dataId )->compressCtu( cs, ctuArea, ctuRsAddr, prevQP, currQP ); #else @@ -1925,13 +1869,11 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons double actualLambda = pRdCost->getLambda(); int numberOfEffectivePixels = 0; -#if JVET_M0600_RATE_CTRL int numberOfSkipPixel = 0; for (auto &cu : cs.traverseCUs(ctuArea, CH_L)) { numberOfSkipPixel += cu.skip*cu.lumaSize().area(); } -#endif for( auto &cu : cs.traverseCUs( ctuArea, CH_L ) ) { @@ -1941,9 +1883,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons break; } } -#if JVET_M0600_RATE_CTRL double skipRatio = (double)numberOfSkipPixel / ctuArea.lumaSize().area(); -#endif CodingUnit* cu = cs.getCU( ctuArea.lumaPos(), CH_L ); if ( numberOfEffectivePixels == 0 ) @@ -1955,13 +1895,8 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons actualQP = cu->qp; } pRdCost->setLambda(oldLambda, pcSlice->getSPS()->getBitDepths()); -#if JVET_M0600_RATE_CTRL pRateCtrl->getRCPic()->updateAfterCTU(pRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, skipRatio, pcSlice->isIRAP() ? 0 : pCfg->getLCULevelRC()); -#else - pRateCtrl->getRCPic()->updateAfterCTU( pRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, - pcSlice->isIRAP() ? 0 : pCfg->getLCULevelRC() ); -#endif } #if ENABLE_QPA && !ENABLE_QPA_SUB_CTU else if (pCfg->getUsePerceptQPA() && pcSlice->getPPS()->getUseDQP()) diff --git a/source/Lib/EncoderLib/EncSlice.h b/source/Lib/EncoderLib/EncSlice.h index 7314ca287c92b95f69de9f5cba362641ea72994b..3b802180ef35b0b7902c35a3710e2374bfc1c54c 100644 --- a/source/Lib/EncoderLib/EncSlice.h +++ b/source/Lib/EncoderLib/EncSlice.h @@ -146,9 +146,7 @@ public: static #endif void encodeCtus ( Picture* pcPic, const bool bCompressEntireSlice, const bool bFastDeltaQP, uint32_t startCtuTsAddr, uint32_t boundingCtuTsAddr, EncLib* pcEncLib ); -#if JVET_M0255_FRACMMVD_SWITCH void checkDisFracMmvd ( Picture* pcPic, uint32_t startCtuTsAddr, uint32_t boundingCtuTsAddr ); -#endif // misc. functions void setSearchRange ( Slice* pcSlice ); ///< set ME range adaptively diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 5126a46370a55ce73ba2ba116e6230d527882b3e..dd85f3c41916f7b352698f6d45d73c6c28279c28 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -45,9 +45,7 @@ #include "CommonLib/UnitTools.h" #include "CommonLib/dtrace_next.h" #include "CommonLib/dtrace_buffer.h" -#if JVET_M0445_MCTS #include "CommonLib/MCTS.h" -#endif #include "EncModeCtrl.h" #include "EncLib.h" @@ -92,9 +90,7 @@ InterSearch::InterSearch() , m_pFullCS (nullptr) , m_pcEncCfg (nullptr) , m_pcTrQuant (nullptr) -#if JVET_M0427_INLOOP_RESHAPER , m_pcReshape (nullptr) -#endif , m_iSearchRange (0) , m_bipredSearchRange (0) , m_motionEstimationSearchMethod(MESEARCH_FULL) @@ -116,10 +112,8 @@ InterSearch::InterSearch() m_affMVList = nullptr; m_affMVListSize = 0; m_affMVListIdx = 0; -#if JVET_M0140_SBT m_histBestSbt = MAX_UCHAR; m_histBestMtsIdx = MAX_UCHAR; -#endif } @@ -199,9 +193,7 @@ void InterSearch::init( EncCfg* pcEncCfg, RdCost* pcRdCost, CABACWriter* CABACEstimator, CtxCache* ctxCache -#if JVET_M0427_INLOOP_RESHAPER , EncReshape* pcReshape -#endif ) { CHECK(m_isInitialized, "Already initialized"); @@ -215,9 +207,7 @@ void InterSearch::init( EncCfg* pcEncCfg, m_CABACEstimator = CABACEstimator; m_CtxCache = ctxCache; m_useCompositeRef = useCompositeRef; -#if JVET_M0427_INLOOP_RESHAPER m_pcReshape = pcReshape; -#endif for( uint32_t iDir = 0; iDir < MAX_NUM_REF_LIST_ADAPT_SR; iDir++ ) { @@ -264,7 +254,6 @@ void InterSearch::init( EncCfg* pcEncCfg, m_isInitialized = true; } -#if JVET_M0246_AFFINE_AMVR void InterSearch::resetSavedAffineMotion() { for ( int i = 0; i < 2; i++ ) @@ -315,7 +304,6 @@ void InterSearch::storeAffineMotion( Mv acAffineMv[2][3], int16_t affineRefIdx[2 m_affineMotion.affine4ParaAvail = true; } } -#endif inline void InterSearch::xTZSearchHelp( IntTZSearchStruct& rcStruct, const int iSearchX, const int iSearchY, const uint8_t ucPointNr, const uint32_t uiDistance ) { @@ -710,12 +698,10 @@ Distortion InterSearch::xPatternRefinement( const CPelBuf* pcPatternKey, const Mv* pcMvRefine = (iFrac == 2 ? s_acMvRefineH : s_acMvRefineQ); for (uint32_t i = 0; i < 9; i++) { -#if JVET_M0253_HASH_ME if (m_skipFracME && i > 0) { break; } -#endif Mv cMvTest = pcMvRefine[i]; cMvTest += baseRefMv; @@ -833,11 +819,7 @@ int InterSearch::xIBCSearchMVChromaRefine(PredictionUnit& pu, pu.mv[0] = cMVCand[cand]; pu.mv[0].changePrecision(MV_PRECISION_INT, MV_PRECISION_INTERNAL); pu.interDir = 1; -#if JVET_M0483_IBC pu.refIdx[0] = pu.cs->slice->getNumRefIdx(REF_PIC_LIST_0); // last idx in the list -#else - pu.refIdx[0] = pu.cs->slice->getNumRefIdx(REF_PIC_LIST_0) - 1; // last idx in the list -#endif PelUnitBuf predBufTmp = m_tmpPredStorage[REF_PIC_LIST_0].getBuf(UnitAreaRelative(*pu.cu, pu)); motionCompensation(pu, predBufTmp, REF_PIC_LIST_0); @@ -1291,7 +1273,6 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, CPelBuf tmpPattern = pBuf->Y(); CPelBuf* pcPatternKey = &tmpPattern; -#if JVET_M0427_INLOOP_RESHAPER if ((pu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag())) { const CompArea &area = pu.blocks[COMPONENT_Y]; @@ -1301,7 +1282,6 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, tmpOrgLuma.rspSignal(m_pcReshape->getFwdLUT()); pcPatternKey = (CPelBuf*)&tmpOrgLuma; } -#endif m_lumaClpRng = pu.cs->slice->clpRng(COMPONENT_Y); Picture* refPic = pu.cu->slice->getPic(); @@ -1369,11 +1349,6 @@ void InterSearch::xSetIntraSearchRange(PredictionUnit& pu, int iRoiWidth, int iR bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const int localSearchRangeX, const int localSearchRangeY, IbcHashMap& ibcHashMap) { -#if JVET_M0483_IBC==0 - // check only no greater than IBC_MAX_CAND_SIZE - if (cu.Y().width > IBC_MAX_CAND_SIZE || cu.Y().height > IBC_MAX_CAND_SIZE) - return false; -#endif Mv cMvSrchRngLT; Mv cMvSrchRngRB; @@ -1389,20 +1364,12 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const /// ibc search pu.cu->imv = 2; AMVPInfo amvpInfo4Pel; -#if JVET_M0483_IBC PU::fillIBCMvpCand(pu, amvpInfo4Pel); -#else - PU::fillMvpCand(pu, REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0], amvpInfo4Pel); -#endif pu.cu->imv = 0;// (Int)cu.cs->sps->getUseIMV(); // set as IMV=0 initially Mv cMv, cMvPred[2]; AMVPInfo amvpInfo; -#if JVET_M0483_IBC PU::fillIBCMvpCand(pu, amvpInfo); -#else - PU::fillMvpCand(pu, REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0], amvpInfo); -#endif cMvPred[0].set(amvpInfo.mvCand[0].getHor() >> (2), amvpInfo.mvCand[0].getVer() >> (2)); // store in full pel accuracy, shift before use in search cMvPred[1].set(amvpInfo.mvCand[1].getHor() >> (2), amvpInfo.mvCand[1].getVer() >> (2)); @@ -1499,11 +1466,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const if (!cu.cs->sps->getAMVREnabledFlag()) pu.mvd[REF_PIC_LIST_0] >>= (2); -#if JVET_M0483_IBC pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF; -#else - pu.refIdx[REF_PIC_LIST_0] = pu.cs->slice->getNumRefIdx(REF_PIC_LIST_0) - 1; -#endif pu.mv[REF_PIC_LIST_0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); m_ctuRecord[cu.lumaPos()][cu.lumaSize()].bvRecord[pu.bv] = cost; @@ -1586,7 +1549,6 @@ void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, } -#if JVET_M0253_HASH_ME void InterSearch::addToSortList(std::list<BlockHash>& listBlockHash, std::list<int>& listCost, int cost, const BlockHash& blockHash) { std::list<BlockHash>::iterator itBlockHash = listBlockHash.begin(); @@ -1716,12 +1678,6 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi RefPicList eRefPicList = (refList == 0) ? REF_PIC_LIST_0 : REF_PIC_LIST_1; int refPicNumber = pu.cu->slice->getNumRefIdx(eRefPicList); -#if !JVET_M0483_IBC - if (pu.cs->slice->getSPS()->getIBCFlag() && eRefPicList == REF_PIC_LIST_0) - { - refPicNumber--; - } -#endif for (int refIdx = 0; refIdx < refPicNumber; refIdx++) { @@ -1914,7 +1870,6 @@ bool InterSearch::predInterHashSearch(CodingUnit& cu, Partitioner& partitioner, return true; } -#endif //! search of the best candidate for inter prediction @@ -1945,11 +1900,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) AMVPInfo aacAMVPInfo[2][33]; int iRefIdx[2]={0,0}; //If un-initialized, may cause SEGV in bi-directional prediction iterative stage. -#if JVET_M0445_MCTS int iRefIdxBi[2] = { -1, -1 }; -#else - int iRefIdxBi[2]; -#endif uint32_t uiMbBits[3] = {1, 1, 0}; @@ -1957,9 +1908,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uint32_t uiLastModeTemp = 0; int iRefStart, iRefEnd; -#if JVET_M0444_SMVD int symMode = 0; -#endif int bestBiPRefIdxL1 = 0; int bestBiPMvpL1 = 0; @@ -1973,19 +1922,14 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) CHECK(!cu.firstPU, "CU does not contain any PUs"); uint32_t puIdx = 0; auto &pu = *cu.firstPU; -#if JVET_M0111_WP_GBI WPScalingParam *wp0; WPScalingParam *wp1; int tryBipred = 0; -#endif -#if JVET_M0246_AFFINE_AMVR bool checkAffine = pu.cu->imv == 0 || pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag(); bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getAMVREnabledFlag() && pu.cu->imv <= (pu.cu->slice->getSPS()->getAMVREnabledFlag() ? IMV_4PEL : 0)); CodingUnit *bestCU = pu.cu->cs->bestCS != nullptr ? pu.cu->cs->bestCS->getCU( CHANNEL_TYPE_LUMA ) : nullptr; -#if JVET_M0444_SMVD bool trySmvd = ( bestCU != nullptr && pu.cu->imv == 2 && checkAffine ) ? ( !bestCU->firstPU->mergeFlag && !bestCU->affine ) : true; -#endif if ( pu.cu->imv && bestCU != nullptr && checkAffine ) { checkAffine = !( bestCU->firstPU->mergeFlag || !bestCU->affine ); @@ -1995,7 +1939,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) { checkNonAffine = m_affineMotion.hevcCost[1] < m_affineMotion.hevcCost[0] * 1.06f; } -#endif { // motion estimation only evaluates luma component @@ -2040,24 +1983,13 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) m_pcRdCost->selectMotionLambda( cu.transQuantBypass ); unsigned imvShift = pu.cu->imv << 1; -#if JVET_M0246_AFFINE_AMVR if ( checkNonAffine ) { -#endif // Uni-directional prediction for ( int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); -#if JVET_M0483_IBC==0 - int refPicNumber = cs.slice->getNumRefIdx(eRefPicList); - if (cs.slice->getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) - { - refPicNumber--; - } - for (int iRefIdxTemp = 0; iRefIdxTemp < refPicNumber; iRefIdxTemp++) -#else for (int iRefIdxTemp = 0; iRefIdxTemp < cs.slice->getNumRefIdx(eRefPicList); iRefIdxTemp++) -#endif { uiBitsTemp = uiMbBits[iRefList]; if ( cs.slice->getNumRefIdx(eRefPicList) > 1 ) @@ -2142,11 +2074,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getUseAffine() -#if JVET_M0246_AFFINE_AMVR && checkAffine -#else - && cu.imv == 0 -#endif && (gbiIdx == GBI_DEFAULT || m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) ) { @@ -2157,12 +2085,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) && (cu.slice->getCheckLDC() || gbiIdx == GBI_DEFAULT || !m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) ) { -#if JVET_M0445_MCTS bool doBiPred = true; -#endif -#if JVET_M0111_WP_GBI tryBipred = 1; -#endif cMvBi[0] = cMv[0]; cMvBi[1] = cMv[1]; iRefIdxBi[0] = iRefIdx[0]; @@ -2186,7 +2110,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.refIdx[REF_PIC_LIST_1] = iRefIdxBi[1]; pu.mvpIdx[REF_PIC_LIST_1] = bestBiPMvpL1; -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { Mv restrictedMv = pu.mv[REF_PIC_LIST_1]; @@ -2200,7 +2123,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) doBiPred = false; } } -#endif PelUnitBuf predBufTmp = m_tmpPredStorage[REF_PIC_LIST_1].getBuf( UnitAreaRelative(cu, pu) ); motionCompensation( pu, predBufTmp, REF_PIC_LIST_1 ); @@ -2229,10 +2151,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; } -#if JVET_M0445_MCTS if( doBiPred ) { -#endif // 4-times iteration (default) int iNumIter = 4; @@ -2288,12 +2208,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) iRefStart = 0; iRefEnd = cs.slice->getNumRefIdx(eRefPicList)-1; -#if JVET_M0483_IBC==0 - if (cs.slice->getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) - { - iRefEnd--; - } -#endif for (int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++) { if( m_pcEncCfg->getUseGBiFast() && (gbiIdx != GBI_DEFAULT) @@ -2313,12 +2227,10 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } } uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; -#if JVET_M0444_SMVD if ( cs.slice->getBiDirPred() ) { uiBitsTemp += 1; // add one bit for symmetrical MVD mode } -#endif // call ME xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], &amvp[eRefPicList] ); xMotionEstimation ( pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList], true ); @@ -2363,18 +2275,11 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) break; } } // for loop-iter -#if JVET_M0445_MCTS } -#endif cu.refIdxBi[0] = iRefIdxBi[0]; cu.refIdxBi[1] = iRefIdxBi[1]; -#if JVET_M0444_SMVD -#if JVET_M0246_AFFINE_AMVR if ( cs.slice->getBiDirPred() && trySmvd ) -#else - if ( cs.slice->getBiDirPred() ) -#endif { Distortion symCost; Mv cMvPredSym[2]; @@ -2461,13 +2366,11 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) symCost += m_pcRdCost->getCost(bits); cTarMvField.setMvField(cCurMvField.mv.getSymmvdMv(cMvPredSym[curRefList], cMvPredSym[tarRefList]), refIdxTar); -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { if( !( MCTSHelper::checkMvForMCTSConstraint( pu, cCurMvField.mv ) && MCTSHelper::checkMvForMCTSConstraint( pu, cTarMvField.mv ) ) ) symCost = std::numeric_limits<Distortion>::max(); } -#endif // save results if ( symCost < uiCostBi ) { @@ -2485,7 +2388,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) cMvPredBi[tarRefList][iRefIdxBi[tarRefList]] = cMvPredSym[tarRefList]; } } -#endif } // if (B_SLICE) @@ -2509,7 +2411,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) iRefIdx[1] = refIdxValidList1; uiBits [1] = bitsValidList1; uiCost [1] = costValidList1; -#if JVET_M0111_WP_GBI if (cu.cs->pps->getWPBiPred() == true && tryBipred && (gbiIdx != GBI_DEFAULT)) { CHECK(iRefIdxBi[0]<0, "Invalid picture reference index"); @@ -2523,7 +2424,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) enforceGBiPred = false; } } -#endif if( enforceGBiPred ) { uiCost[0] = uiCost[1] = MAX_UINT; @@ -2547,9 +2447,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvpNum[REF_PIC_LIST_1] = aaiMvpNum[1][iRefIdxBi[1]]; pu.interDir = 3; -#if JVET_M0444_SMVD pu.cu->smvdMode = symMode; -#endif } else if ( uiCost[0] <= uiCost[1] ) { @@ -2580,15 +2478,9 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } uiHevcCost = ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) ? uiCostBi : ( ( uiCost[0] <= uiCost[1] ) ? uiCost[0] : uiCost[1] ); -#if JVET_M0246_AFFINE_AMVR } -#endif if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getUseAffine() -#if JVET_M0246_AFFINE_AMVR && checkAffine -#else - && cu.imv == 0 -#endif && (gbiIdx == GBI_DEFAULT || m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) ) { @@ -2597,9 +2489,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uint32_t uiMRGIndex = pu.mergeIdx; bool bMergeFlag = pu.mergeFlag; uint32_t uiInterDir = pu.interDir; -#if JVET_M0444_SMVD int iSymMode = cu.smvdMode; -#endif Mv cMvd[2]; uint32_t uiMvpIdx[2], uiMvpNum[2]; @@ -2622,12 +2512,10 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffineCost, cMvHevcTemp, acMvAffine4Para, refIdx4Para, gbiIdx, enforceGBiPred, ((cu.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0)); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { storeAffineMotion( pu.mvAffi, pu.refIdx, AFFINEMODEL_4PARAM, gbiIdx ); } -#endif if ( cu.slice->getSPS()->getUseAffineType() ) { @@ -2664,12 +2552,10 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffine6Cost, cMvHevcTemp, acMvAffine4Para, refIdx4Para, gbiIdx, enforceGBiPred, ((cu.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0)); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { storeAffineMotion( pu.mvAffi, pu.refIdx, AFFINEMODEL_6PARAM, gbiIdx ); } -#endif // reset to 4 parameter affine inter mode if ( uiAffineCost <= uiAffine6Cost ) @@ -2705,7 +2591,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uiAffineCost += m_pcRdCost->getCost( 1 ); // add one bit for affine_type } -#if JVET_M0445_MCTS if( uiAffineCost < uiHevcCost ) { if( m_pcEncCfg->getMCTSEncConstraint() && !MCTSHelper::checkMvBufferForMCTSConstraint( pu ) ) @@ -2713,7 +2598,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uiAffineCost = std::numeric_limits<Distortion>::max(); } } -#endif if ( uiHevcCost <= uiAffineCost ) { // set hevc me result @@ -2721,9 +2605,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mergeFlag = bMergeFlag; pu.mergeIdx = uiMRGIndex; pu.interDir = uiInterDir; -#if JVET_M0444_SMVD cu.smvdMode = iSymMode; -#endif pu.mv [REF_PIC_LIST_0] = cHevcMvField[0].mv; pu.refIdx[REF_PIC_LIST_0] = cHevcMvField[0].refIdx; pu.mv [REF_PIC_LIST_1] = cHevcMvField[1].mv; @@ -2737,9 +2619,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } else { -#if JVET_M0444_SMVD cu.smvdMode = 0; -#endif CHECK( !cu.affine, "Wrong." ); uiLastMode = uiLastModeTemp; } @@ -2760,12 +2640,10 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) // MC PelUnitBuf predBuf = pu.cs->getPredBuf(pu); -#if JVET_M0246_AFFINE_AMVR if ( gbiIdx == GBI_DEFAULT || !m_affineMotion.affine4ParaAvail || !m_affineMotion.affine6ParaAvail ) { m_affineMotion.hevcCost[pu.cu->imv] = uiHevcCost; } -#endif motionCompensation( pu, predBuf, REF_PIC_LIST_X ); puIdx++; } @@ -2775,7 +2653,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) return; } -#if JVET_M0246_AFFINE_AMVR uint32_t InterSearch::xCalcAffineMVBits( PredictionUnit& pu, Mv acMvTemp[3], Mv acMvPred[3], bool mvHighPrec ) { int mvNum = pu.cu->affineType ? 3 : 2; @@ -2807,7 +2684,6 @@ uint32_t InterSearch::xCalcAffineMVBits( PredictionUnit& pu, Mv acMvTemp[3], Mv return bitsTemp; } -#endif // AMVP void InterSearch::xEstimateMvPredAMVP( PredictionUnit& pu, PelUnitBuf& origBuf, RefPicList eRefPicList, int iRefIdx, Mv& rcMvPred, AMVPInfo& rAMVPInfo, bool bFilled, Distortion* puiDistBiP ) @@ -3003,16 +2879,12 @@ Distortion InterSearch::xGetAffineTemplateCost( PredictionUnit& pu, PelUnitBuf& const bool bi = pu.cu->slice->testWeightPred() && pu.cu->slice->getSliceType()==P_SLICE; Mv mv[3]; memcpy(mv, acMvCand, sizeof(mv)); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif mv[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); mv[1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); mv[2].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_M0246_AFFINE_AMVR } -#endif xPredAffineBlk(COMPONENT_Y, pu, picRef, mv, predBuf, bi, pu.cu->slice->clpRng(COMPONENT_Y)); if( bi ) { @@ -3106,11 +2978,9 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref { setWpScalingDistParam(iRefIdxPred, eRefPicList, pu.cu->slice); } -#if JVET_M0253_HASH_ME m_currRefPicList = eRefPicList; m_currRefPicIndex = iRefIdxPred; m_skipFracME = false; -#endif // Do integer search if( ( m_motionEstimationSearchMethod == MESEARCH_FULL ) || bBi || bQTBTMV ) { @@ -3152,7 +3022,6 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref // sub-pel refinement for sub-pel resolution if( pu.cu->imv == 0 ) { -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { Area curTileAreaSubPelRestricted = pu.cs->picture->mctsInfo.getTileAreaSubPelRestricted( pu ); @@ -3166,7 +3035,6 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref MCTSHelper::clipMvToArea( rcMv, pu.Y(), curTileAreaSubPelRestricted, *pu.cs->sps, 0 ); } } -#endif xPatternSearchFracDIF( pu, eRefPicList, iRefIdxPred, cStruct, rcMv, cMvHalf, cMvQter, ruiCost ); m_pcRdCost->setCostScale( 0 ); rcMv <<= 2; @@ -3202,7 +3070,6 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu, Mv mvTL(cFPMvPred.getHor() - (iSrchRng << iMvShift), cFPMvPred.getVer() - (iSrchRng << iMvShift)); Mv mvBR(cFPMvPred.getHor() + (iSrchRng << iMvShift), cFPMvPred.getVer() + (iSrchRng << iMvShift)); -#if JVET_M0445_MCTS if (m_pcEncCfg->getMCTSEncConstraint()) { MCTSHelper::clipMvToArea( mvTL, pu.Y(), pu.cs->picture->mctsInfo.getTileArea(), *pu.cs->sps ); @@ -3217,14 +3084,6 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu, pu.cu->lumaSize(), *pu.cs->sps ); } -#else - xClipMv( mvTL, pu.cu->lumaPos(), - pu.cu->lumaSize(), - *pu.cs->sps ); - xClipMv( mvBR, pu.cu->lumaPos(), - pu.cu->lumaSize(), - *pu.cs->sps ); -#endif mvTL.divideByPowerOf2( iMvShift ); mvBR.divideByPowerOf2( iMvShift ); @@ -3368,13 +3227,11 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, int iSearchRange = m_iSearchRange; rcMv.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { MCTSHelper::clipMvToArea( rcMv, pu.Y(), pu.cs->picture->mctsInfo.getTileArea(), *pu.cs->sps ); } else -#endif clipMv( rcMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); @@ -3411,13 +3268,11 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, { Mv integerMv2Nx2NPred = *pIntegerMv2Nx2NPred; integerMv2Nx2NPred.changePrecision(MV_PRECISION_INT, MV_PRECISION_INTERNAL); -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { MCTSHelper::clipMvToArea( integerMv2Nx2NPred, pu.Y(), pu.cs->picture->mctsInfo.getTileArea(), *pu.cs->sps ); } else -#endif clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); @@ -3439,7 +3294,6 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, , cStruct ); } -#if JVET_M0253_HASH_ME if (m_pcEncCfg->getUseHashME()) { int width = pu.cu->lumaSize().width; @@ -3463,7 +3317,6 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, } } } -#endif // start search int iDist = 0; @@ -3721,7 +3574,6 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, ); } -#if JVET_M0253_HASH_ME if (m_pcEncCfg->getUseHashME()) { int width = pu.cu->lumaSize().width; @@ -3746,7 +3598,6 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, } } } -#endif // Initial search int iBestX = cStruct.iBestX; @@ -3870,7 +3721,6 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& cTestMv[iMVPIdx] += cBaseMvd[iMVPIdx]; cTestMv[iMVPIdx] += amvpInfo.mvCand[iMVPIdx]; -#if JVET_M0445_MCTS // MCTS and IMV if( m_pcEncCfg->getMCTSEncConstraint() ) { @@ -3885,22 +3735,17 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& continue; } } -#endif if ( iMVPIdx == 0 || cTestMv[0] != cTestMv[1]) { Mv cTempMV = cTestMv[iMVPIdx]; -#if JVET_M0445_MCTS if( !m_pcEncCfg->getMCTSEncConstraint() ) { -#endif cTempMV.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); clipMv(cTempMV, pu.cu->lumaPos(), pu.cu->lumaSize(), sps); cTempMV.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0445_MCTS } -#endif m_cDistParam.cur.buf = cStruct.piRefY + cStruct.iRefStride * (cTempMV.getVer() >> 2) + (cTempMV.getHor() >> 2); uiDist = uiSATD = (Distortion) (m_cDistParam.distFunc( m_cDistParam ) * fWeight); } @@ -3923,13 +3768,11 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& } } } -#if JVET_M0445_MCTS if( uiBestDist == std::numeric_limits<Distortion>::max() ) { ruiCost = std::numeric_limits<Distortion>::max(); return; } -#endif rcMv = cBestMv; rcMvPred = amvpInfo.mvCand[iBestMVPIdx]; @@ -3965,7 +3808,6 @@ void InterSearch::xPatternSearchFracDIF( // Reference pattern initialization (integer scale) int iOffset = rcMvInt.getHor() + rcMvInt.getVer() * cStruct.iRefStride; CPelBuf cPatternRoi(cStruct.piRefY + iOffset, cStruct.iRefStride, *cStruct.pcPatternKey); -#if JVET_M0253_HASH_ME if (m_skipFracME) { Mv baseRefMv(0, 0); @@ -3976,7 +3818,6 @@ void InterSearch::xPatternSearchFracDIF( ruiCost = xPatternRefinement(cStruct.pcPatternKey, baseRefMv, 1, rcMvQter, !bIsLosslessCoded); return; } -#endif if (cStruct.imvShift || (m_useCompositeRef && cStruct.zeroMV)) @@ -4006,7 +3847,6 @@ void InterSearch::xPatternSearchFracDIF( ruiCost = xPatternRefinement( cStruct.pcPatternKey, baseRefMv, 1, rcMvQter, !bIsLosslessCoded ); } -#if JVET_M0444_SMVD Distortion InterSearch::xGetSymmetricCost( PredictionUnit& pu, PelUnitBuf& origBuf, RefPicList eCurRefPicList, const MvField& cCurMvField, MvField& cTarMvField, int gbiIdx ) { Distortion cost = std::numeric_limits<Distortion>::max(); @@ -4103,13 +3943,11 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& MvField mvCand = mvCurCenter, mvPair; mvCand.mv += mvOffset; -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { if( !( MCTSHelper::checkMvForMCTSConstraint( pu, mvCand.mv ) ) ) continue; // Skip this this pos } -#endif // get MVD cost m_pcRdCost->setPredictor( rcMvCurPred ); m_pcRdCost->setCostScale( 0 ); @@ -4119,13 +3957,11 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& // get MVD pair and set target MV mvPair.refIdx = rTarMvField.refIdx; mvPair.mv.set( rcMvTarPred.hor - (mvCand.mv.hor - rcMvCurPred.hor), rcMvTarPred.ver - (mvCand.mv.ver - rcMvCurPred.ver) ); -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { if( !( MCTSHelper::checkMvForMCTSConstraint( pu, mvPair.mv ) ) ) continue; // Skip this this pos } -#endif uiCost += xGetSymmetricCost( pu, origBuf, eRefPicList, mvCand, mvPair, gbiIdx ); if ( uiCost < uiMinCost ) { @@ -4166,7 +4002,6 @@ void InterSearch::xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& or ruiCost = xSymmeticRefineMvSearch( pu, origBuf, rcMvCurPred, rcMvTarPred, eRefPicList, rCurMvField, rTarMvField, ruiCost, 2, nSearchStepShift, nDiamondRound, gbiIdx ); ruiCost = xSymmeticRefineMvSearch( pu, origBuf, rcMvCurPred, rcMvTarPred, eRefPicList, rCurMvField, rTarMvField, ruiCost, 0, nSearchStepShift, nCrossRound, gbiIdx ); } -#endif // JVET_M0444_SMVD void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, PelUnitBuf& origBuf, @@ -4236,15 +4071,11 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, uint32_t bitsValidList1 = MAX_UINT; Distortion costValidList1 = std::numeric_limits<Distortion>::max(); Mv mvHevc[3]; -#if JVET_M0246_AFFINE_AMVR const bool changeToHighPrec = pu.cu->imv != 1; const bool affineAmvrEnabled = pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag(); -#endif -#if JVET_M0111_WP_GBI int tryBipred = 0; WPScalingParam *wp0; WPScalingParam *wp1; -#endif xGetBlkBits( slice.isInterP(), puIdx, lastMode, uiMbBits); pu.cu->affine = true; @@ -4259,16 +4090,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, for ( int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); -#if JVET_M0483_IBC==0 - int refPicNumber = slice.getNumRefIdx(eRefPicList); - if (slice.getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) - { - refPicNumber--; - } - for (int iRefIdxTemp = 0; iRefIdxTemp < refPicNumber; iRefIdxTemp++) -#else for (int iRefIdxTemp = 0; iRefIdxTemp < slice.getNumRefIdx(eRefPicList); iRefIdxTemp++) -#endif { // Get RefIdx bits uiBitsTemp = uiMbBits[iRefList]; @@ -4283,12 +4105,10 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, // Do Affine AMVP xEstimateAffineAMVP( pu, affiAMVPInfoTemp[eRefPicList], origBuf, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], &biPDistTemp ); -#if JVET_M0246_AFFINE_AMVR if ( affineAmvrEnabled ) { biPDistTemp += m_pcRdCost->getCost( xCalcAffineMVBits( pu, cMvPred[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp] ) ); } -#endif aaiMvpIdx[iRefList][iRefIdxTemp] = pu.mvpIdx[eRefPicList]; aaiMvpNum[iRefList][iRefIdxTemp] = pu.mvpNum[eRefPicList];; if ( pu.cu->affineType == AFFINEMODEL_6PARAM && refIdx4Para[iRefList] != iRefIdxTemp ) @@ -4301,7 +4121,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, for ( int i=0; i<3; i++ ) { mvHevc[i] = hevcMv[iRefList][iRefIdxTemp]; -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 1 ) { mvHevc[i].changePrecision( MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL ); @@ -4310,14 +4129,12 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { mvHevc[i].roundToPrecision( MV_PRECISION_QUARTER, MV_PRECISION_INT ); } -#endif } PelUnitBuf predBuf = m_tmpStorageLCU.getBuf( UnitAreaRelative(*pu.cu, pu) ); Distortion uiCandCost = xGetAffineTemplateCost(pu, origBuf, predBuf, mvHevc, aaiMvpIdx[iRefList][iRefIdxTemp], AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdxTemp); -#if JVET_M0246_AFFINE_AMVR if ( affineAmvrEnabled ) { uiCandCost += m_pcRdCost->getCost( xCalcAffineMVBits( pu, mvHevc, cMvPred[iRefList][iRefIdxTemp] ) ); @@ -4350,7 +4167,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, memcpy( mvHevc, mvFour, 3 * sizeof( Mv ) ); } } -#endif if (pu.cu->affineType == AFFINEMODEL_4PARAM && m_affMVListSize && (!pu.cu->cs->sps->getUseGBi() || gbiIdx == GBI_DEFAULT) @@ -4394,49 +4210,35 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, vy = mvScaleVer + dMvHorY * (pu.Y().x - mvInfo->x) + dMvVerY * (pu.Y().y - mvInfo->y); roundAffineMv(vx, vy, shift); mvTmp[0] = Mv(vx, vy); -#if JVET_M0145_AFFINE_MV_CLIP mvTmp[0].clipToStorageBitDepth(); -#endif clipMv(mvTmp[0], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 2 ) { mvTmp[0].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } else if ( pu.cu->imv == 0 ) -#endif mvTmp[0].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); vx = mvScaleHor + dMvHorX * (pu.Y().x + pu.Y().width - mvInfo->x) + dMvVerX * (pu.Y().y - mvInfo->y); vy = mvScaleVer + dMvHorY * (pu.Y().x + pu.Y().width - mvInfo->x) + dMvVerY * (pu.Y().y - mvInfo->y); roundAffineMv(vx, vy, shift); mvTmp[1] = Mv(vx, vy); -#if JVET_M0145_AFFINE_MV_CLIP mvTmp[1].clipToStorageBitDepth(); -#endif clipMv(mvTmp[1], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { mvTmp[1].roundToPrecision( MV_PRECISION_INTERNAL, pu.cu->imv == 2 ? MV_PRECISION_INT : MV_PRECISION_QUARTER ); mvTmp[0].changePrecision( MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER ); mvTmp[1].changePrecision( MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER ); } -#else - mvTmp[1].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); - mvTmp[0].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); - mvTmp[1].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#endif Distortion tmpCost = xGetAffineTemplateCost(pu, origBuf, predBuf, mvTmp, aaiMvpIdx[iRefList][iRefIdxTemp], AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdxTemp); -#if JVET_M0246_AFFINE_AMVR if ( affineAmvrEnabled ) { tmpCost += m_pcRdCost->getCost( xCalcAffineMVBits( pu, mvTmp, cMvPred[iRefList][iRefIdxTemp] ) ); } -#endif if (tmpCost < uiCandCost) { uiCandCost = tmpCost; @@ -4447,26 +4249,18 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { Mv mvFour[3]; -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif mvAffine4Para[iRefList][iRefIdxTemp][0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); mvAffine4Para[iRefList][iRefIdxTemp][1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_M0246_AFFINE_AMVR } -#endif mvFour[0] = mvAffine4Para[iRefList][iRefIdxTemp][0]; mvFour[1] = mvAffine4Para[iRefList][iRefIdxTemp][1]; -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif mvAffine4Para[iRefList][iRefIdxTemp][0].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); mvAffine4Para[iRefList][iRefIdxTemp][1].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } -#endif int shift = MAX_CU_DEPTH; int vx2 = (mvFour[0].getHor() << shift) - ((mvFour[1].getVer() - mvFour[0].getVer()) << (shift + g_aucLog2[pu.lheight()] - g_aucLog2[pu.lwidth()])); int vy2 = (mvFour[0].getVer() << shift) + ((mvFour[1].getHor() - mvFour[0].getHor()) << (shift + g_aucLog2[pu.lheight()] - g_aucLog2[pu.lwidth()])); @@ -4474,37 +4268,25 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, vy2 >>= shift; mvFour[2].hor = vx2; mvFour[2].ver = vy2; -#if JVET_M0145_AFFINE_MV_CLIP mvFour[2].clipToStorageBitDepth(); -#endif -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { mvFour[0].roundToPrecision( MV_PRECISION_INTERNAL, pu.cu->imv == 2 ? MV_PRECISION_INT : MV_PRECISION_QUARTER ); mvFour[1].roundToPrecision( MV_PRECISION_INTERNAL, pu.cu->imv == 2 ? MV_PRECISION_INT : MV_PRECISION_QUARTER ); mvFour[2].roundToPrecision( MV_PRECISION_INTERNAL, pu.cu->imv == 2 ? MV_PRECISION_INT : MV_PRECISION_QUARTER ); } -#else - mvFour[2].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#endif for (int i = 0; i < 3; i++) { -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { mvFour[i].changePrecision( MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER ); } -#else - mvFour[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#endif } Distortion uiCandCostInherit = xGetAffineTemplateCost( pu, origBuf, predBuf, mvFour, aaiMvpIdx[iRefList][iRefIdxTemp], AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdxTemp ); -#if JVET_M0246_AFFINE_AMVR if ( affineAmvrEnabled ) { uiCandCostInherit += m_pcRdCost->getCost( xCalcAffineMVBits( pu, mvFour, cMvPred[iRefList][iRefIdxTemp] ) ); } -#endif if ( uiCandCostInherit < uiCandCost ) { uiCandCost = uiCandCostInherit; @@ -4544,22 +4326,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, uiCostTemp = uiCostTempL0[iList1ToList0Idx]; uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[iList1ToList0Idx] ); -#if JVET_M0246_AFFINE_AMVR uiBitsTemp += xCalcAffineMVBits( pu, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp] ); -#else - for (int iVerIdx = 0; iVerIdx < mvNum; iVerIdx++) - { - m_pcRdCost->setPredictor( cMvPred[iRefList][iRefIdxTemp][iVerIdx] ); - const int shift = 0; - Mv secondPred; - if ( iVerIdx != 0 ) - { - secondPred = cMvPred[iRefList][iRefIdxTemp][iVerIdx] + (cMvTemp[1][iRefIdxTemp][0] - cMvPred[1][iRefIdxTemp][0]); - m_pcRdCost->setPredictor( secondPred ); - } - uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp][iVerIdx].getHor()>>shift, cMvTemp[1][iRefIdxTemp][iVerIdx].getVer()>>shift, 0 ); - } -#endif /*calculate the correct cost*/ uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); DTRACE( g_trace_ctx, D_COMMON, " (%d) uiCostTemp=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiCostTemp ); @@ -4567,34 +4334,26 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, else { xAffineMotionEstimation( pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp -#if JVET_M0247_AFFINE_AMVR_ENCOPT , aaiMvpIdx[iRefList][iRefIdxTemp], affiAMVPInfoTemp[eRefPicList] -#endif ); } } else { xAffineMotionEstimation( pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp -#if JVET_M0247_AFFINE_AMVR_ENCOPT , aaiMvpIdx[iRefList][iRefIdxTemp], affiAMVPInfoTemp[eRefPicList] -#endif ); } if(pu.cu->cs->sps->getUseGBi() && pu.cu->GBiIdx == GBI_DEFAULT && pu.cu->slice->isInterB()) { m_uniMotions.setReadModeAffine(true, (uint8_t)iRefList, (uint8_t)iRefIdxTemp, pu.cu->affineType); m_uniMotions.copyAffineMvFrom(cMvTemp[iRefList][iRefIdxTemp], uiCostTemp - m_pcRdCost->getCost(uiBitsTemp), (uint8_t)iRefList, (uint8_t)iRefIdxTemp, pu.cu->affineType -#if JVET_M0247_AFFINE_AMVR_ENCOPT , aaiMvpIdx[iRefList][iRefIdxTemp] -#endif ); } // Set best AMVP Index xCopyAffineAMVPInfo( affiAMVPInfoTemp[eRefPicList], aacAffineAMVPInfo[iRefList][iRefIdxTemp] ); -#if JVET_M0247_AFFINE_AMVR_ENCOPT if ( pu.cu->imv != 2 || !m_pcEncCfg->getUseAffineAmvrEncOpt() ) -#endif xCheckBestAffineMVP( pu, affiAMVPInfoTemp[eRefPicList], eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); if ( iRefList == 0 ) @@ -4628,11 +4387,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, if ( pu.cu->affineType == AFFINEMODEL_4PARAM ) { ::memcpy( mvAffine4Para, cMvTemp, sizeof( cMvTemp ) ); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 && ( !pu.cu->cs->sps->getUseGBi() || gbiIdx == GBI_DEFAULT ) ) -#else - if (!pu.cu->cs->sps->getUseGBi() || gbiIdx == GBI_DEFAULT) -#endif { AffineMVInfo *affMVInfo = m_affMVList + m_affMVListIdx; @@ -4666,9 +4421,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, // Bi-directional prediction if ( slice.isInterB() && !PU::isBipredRestriction(pu) ) { -#if JVET_M0111_WP_GBI tryBipred = 1; -#endif // Set as best list0 and list1 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; @@ -4678,9 +4431,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, ::memcpy( aaiMvpIdxBi, aaiMvpIdx, sizeof(aaiMvpIdx) ); uint32_t uiMotBits[2]; -#if JVET_M0445_MCTS bool doBiPred = true; -#endif if ( slice.getMvdL1ZeroFlag() ) // GPB, list 1 only use Mvp { @@ -4697,7 +4448,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, ::memcpy( cMvTemp[1][bestBiPRefIdxL1], pcMvTemp, sizeof(Mv)*3 ); iRefIdxBi[1] = bestBiPRefIdxL1; -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { Area curTileAreaRestricted; @@ -4717,14 +4467,9 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } } } -#endif // Get list1 prediction block PU::setAllAffineMv( pu, cMvBi[1][0], cMvBi[1][1], cMvBi[1][2], REF_PIC_LIST_1 -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); pu.refIdx[REF_PIC_LIST_1] = iRefIdxBi[1]; @@ -4753,10 +4498,8 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; } -#if JVET_M0445_MCTS if( doBiPred ) { -#endif // 4-times iteration (default) int iNumIter = 4; // fast encoder setting or GPB: only one iteration @@ -4793,11 +4536,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, if( iIter == 0 && !slice.getMvdL1ZeroFlag() ) { PU::setAllAffineMv( pu, aacMv[1-iRefList][0], aacMv[1-iRefList][1], aacMv[1-iRefList][2], RefPicList(1-iRefList) -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); pu.refIdx[1-iRefList] = iRefIdx[1-iRefList]; @@ -4817,12 +4556,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, iRefStart = 0; iRefEnd = slice.getNumRefIdx(eRefPicList) - 1; -#if JVET_M0483_IBC==0 - if (slice.getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) - { - iRefEnd--; - } -#endif for ( int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) { if ( pu.cu->affineType == AFFINEMODEL_6PARAM && refIdx4Para[iRefList] != iRefIdxTemp ) @@ -4850,14 +4583,10 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, // call Affine ME xAffineMotionEstimation( pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, -#if JVET_M0247_AFFINE_AMVR_ENCOPT aaiMvpIdxBi[iRefList][iRefIdxTemp], aacAffineAMVPInfo[iRefList][iRefIdxTemp], -#endif true ); xCopyAffineAMVPInfo( aacAffineAMVPInfo[iRefList][iRefIdxTemp], affiAMVPInfoTemp[eRefPicList] ); -#if JVET_M0247_AFFINE_AMVR_ENCOPT if ( pu.cu->imv != 2 || !m_pcEncCfg->getUseAffineAmvrEncOpt() ) -#endif xCheckBestAffineMVP( pu, affiAMVPInfoTemp[eRefPicList], eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); if ( uiCostTemp < uiCostBi ) @@ -4875,11 +4604,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { // Set motion PU::setAllAffineMv( pu, cMvBi[iRefList][0], cMvBi[iRefList][1], cMvBi[iRefList][2], eRefPicList -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); pu.refIdx[eRefPicList] = iRefIdxBi[eRefPicList]; PelUnitBuf predBufTmp = m_tmpPredStorage[iRefList].getBuf( UnitAreaRelative(*pu.cu, pu) ); @@ -4904,9 +4629,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, break; } } // for loop-iter -#if JVET_M0445_MCTS } -#endif } // if (B_SLICE) pu.mv [REF_PIC_LIST_0] = Mv(); @@ -4931,7 +4654,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, iRefIdx[1] = refIdxValidList1; uiBits[1] = bitsValidList1; uiCost[1] = costValidList1; -#if JVET_M0111_WP_GBI if (pu.cs->pps->getWPBiPred() == true && tryBipred && (gbiIdx != GBI_DEFAULT)) { CHECK(iRefIdxBi[0]<0, "Invalid picture reference index"); @@ -4945,7 +4667,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, enforceGBiPred = false; } } -#endif if( enforceGBiPred ) { uiCost[0] = uiCost[1] = MAX_UINT; @@ -4958,18 +4679,10 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, affineCost = uiCostBi; PU::setAllAffineMv( pu, cMvBi[0][0], cMvBi[0][1], cMvBi[0][2], REF_PIC_LIST_0 -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); PU::setAllAffineMv( pu, cMvBi[1][0], cMvBi[1][1], cMvBi[1][2], REF_PIC_LIST_1 -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); pu.refIdx[REF_PIC_LIST_0] = iRefIdxBi[0]; pu.refIdx[REF_PIC_LIST_1] = iRefIdxBi[1]; @@ -4998,11 +4711,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, affineCost = uiCost[0]; PU::setAllAffineMv( pu, aacMv[0][0], aacMv[0][1], aacMv[0][2], REF_PIC_LIST_0 -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); pu.refIdx[REF_PIC_LIST_0] = iRefIdx[0]; @@ -5025,11 +4734,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, affineCost = uiCost[1]; PU::setAllAffineMv( pu, aacMv[1][0], aacMv[1][1], aacMv[1][2], REF_PIC_LIST_1 -#if JVET_M0246_AFFINE_AMVR , changeToHighPrec -#else - , true -#endif ); pu.refIdx[REF_PIC_LIST_1] = iRefIdx[1]; @@ -5138,25 +4843,8 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin int iBestMVPIdx = riMVPIdx; // Get origin MV bits -#if JVET_M0246_AFFINE_AMVR Mv tmpPredMv[3]; int iOrgMvBits = xCalcAffineMVBits( pu, acMv, acMvPred ); -#else - int iOrgMvBits = 0; - for ( int iVerIdx = 0; iVerIdx < mvNum; iVerIdx++ ) - { - m_pcRdCost->setPredictor ( acMvPred[iVerIdx] ); - const int shift = 0; - - Mv secondPred; - if ( iVerIdx != 0 ) - { - secondPred = acMvPred[iVerIdx] + (acMv[0] - acMvPred[0]); - m_pcRdCost->setPredictor( secondPred ); - } - iOrgMvBits += m_pcRdCost->getBitsOfVectorWithPredictor( acMv[iVerIdx].getHor()>>shift, acMv[iVerIdx].getVer()>>shift, 0 ); - } -#endif iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS]; int iBestMvBits = iOrgMvBits; @@ -5166,7 +4854,6 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin { continue; } -#if JVET_M0246_AFFINE_AMVR tmpPredMv[0] = affineAMVPInfo.mvCandLT[iMVPIdx]; tmpPredMv[1] = affineAMVPInfo.mvCandRT[iMVPIdx]; if ( mvNum == 3 ) @@ -5174,23 +4861,6 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin tmpPredMv[2] = affineAMVPInfo.mvCandLB[iMVPIdx]; } int iMvBits = xCalcAffineMVBits( pu, acMv, tmpPredMv ); -#else - int iMvBits = 0; - for ( int iVerIdx = 0; iVerIdx < mvNum; iVerIdx++ ) - { - m_pcRdCost->setPredictor( iVerIdx == 2 ? affineAMVPInfo.mvCandLB[iMVPIdx] : - (iVerIdx == 1 ? affineAMVPInfo.mvCandRT[iMVPIdx] : affineAMVPInfo.mvCandLT[iMVPIdx]) ); - const int shift = 0; - - Mv secondPred; - if ( iVerIdx != 0 ) - { - secondPred = (iVerIdx == 1 ? affineAMVPInfo.mvCandRT[iMVPIdx] : affineAMVPInfo.mvCandLB[iMVPIdx]) + (acMv[0] - affineAMVPInfo.mvCandLT[iMVPIdx]); - m_pcRdCost->setPredictor( secondPred ); - } - iMvBits += m_pcRdCost->getBitsOfVectorWithPredictor( acMv[iVerIdx].getHor()>>shift, acMv[iVerIdx].getVer()>>shift, 0 ); - } -#endif iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS]; if (iMvBits < iBestMvBits) @@ -5220,25 +4890,19 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, Mv acMv[3], uint32_t& ruiBits, Distortion& ruiCost, -#if JVET_M0247_AFFINE_AMVR_ENCOPT int& mvpIdx, const AffineAMVPInfo& aamvpi, -#endif bool bBi) { if( pu.cu->cs->sps->getUseGBi() && pu.cu->GBiIdx != GBI_DEFAULT && !bBi && xReadBufferedAffineUniMv(pu, eRefPicList, iRefIdxPred, acMvPred, acMv, ruiBits, ruiCost -#if JVET_M0247_AFFINE_AMVR_ENCOPT , mvpIdx, aamvpi -#endif ) ) { return; } -#if JVET_M0247_AFFINE_AMVR_ENCOPT uint32_t dirBits = ruiBits - m_auiMVPIdxCost[mvpIdx][aamvpi.numCand]; int bestMvpIdx = mvpIdx; -#endif const int width = pu.Y().width; const int height = pu.Y().height; @@ -5270,16 +4934,12 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, // Set start Mv position, use input mv as started search mv Mv acMvTemp[3]; ::memcpy( acMvTemp, acMv, sizeof(Mv)*3 ); -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif acMvTemp[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); acMvTemp[1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); acMvTemp[2].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_M0246_AFFINE_AMVR } -#endif // Set delta mv // malloc buffer int iParaNum = pu.cu->affineType ? 7 : 5; @@ -5302,7 +4962,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, uint32_t uiBitsBest = 0; // do motion compensation with origin mv -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { Area curTileAreaRestricted = pu.cs->picture->mctsInfo.getTileAreaSubPelRestricted( pu ); @@ -5314,7 +4973,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, } } else -#endif clipMv( acMvTemp[0], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); @@ -5327,7 +4985,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, pu.cu->lumaSize(), *pu.cs->sps ); } -#if JVET_M0246_AFFINE_AMVR int mvdPrecision = ( pu.cu->imv == 1 ) ? 2 : 0; if ( pu.cu->imv == 2 ) { @@ -5338,7 +4995,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, acMvTemp[2].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } } -#endif xPredAffineBlk( COMPONENT_Y, pu, refPic, acMvTemp, predBuf, false, pu.cs->slice->clpRng( COMPONENT_Y ) ); // get error @@ -5347,7 +5003,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, // get cost with mv m_pcRdCost->setCostScale(0); uiBitsBest = ruiBits; -#if JVET_M0247_AFFINE_AMVR_ENCOPT if ( pu.cu->imv == 2 && m_pcEncCfg->getUseAffineAmvrEncOpt() ) { uiBitsBest = dirBits + xDetermineBestMvp( pu, acMvTemp, mvpIdx, aamvpi ); @@ -5357,34 +5012,10 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, } else { -#endif DTRACE( g_trace_ctx, D_COMMON, " (%d) xx uiBitsBest=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiBitsBest ); -#if JVET_M0246_AFFINE_AMVR uiBitsBest += xCalcAffineMVBits( pu, acMvTemp, acMvPred, pu.cu->imv != 1 ); DTRACE( g_trace_ctx, D_COMMON, " (%d) yy uiBitsBest=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiBitsBest ); -#if JVET_M0247_AFFINE_AMVR_ENCOPT - } -#endif -#else - for ( int i = 0; i < mvNum; i++ ) - { - DTRACE( g_trace_ctx, D_COMMON, "#mvPredForBits=(%d,%d) \n", acMvPred[i].getHor(), acMvPred[i].getVer() ); - m_pcRdCost->setPredictor( acMvPred[i] ); - DTRACE( g_trace_ctx, D_COMMON, "#mvForBits=(%d,%d) \n", acMvTemp[i].getHor(), acMvTemp[i].getVer() ); - Mv mv0 = acMvTemp[0]; - mv0.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); - const int shift = MV_FRACTIONAL_BITS_DIFF; - Mv secondPred; - if ( i != 0 ) - { - secondPred.hor = acMvPred[i].hor + mv0.hor - acMvPred[0].hor; - secondPred.ver = acMvPred[i].ver + mv0.ver - acMvPred[0].ver; - m_pcRdCost->setPredictor( secondPred ); - } - uiBitsBest += m_pcRdCost->getBitsOfVectorWithPredictor( acMvTemp[i].getHor()>>shift, acMvTemp[i].getVer()>>shift, 0 ); - DTRACE( g_trace_ctx, D_COMMON, " (%d) yy uiBitsBest=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiBitsBest ); } -#endif uiCostBest = (Distortion)( floor( fWeight * (double)uiCostBest ) + (double)m_pcRdCost->getCost( uiBitsBest ) ); DTRACE( g_trace_ctx, D_COMMON, " (%d) uiBitsBest=%d, uiCostBest=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiBitsBest, uiCostBest ); @@ -5393,9 +5024,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, const int bufStride = pBuf->Y().stride; const int predBufStride = predBuf.Y().stride; -#if JVET_M0247_AFFINE_AMVR_ENCOPT Mv prevIterMv[7][3]; -#endif int iIterTime; if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { @@ -5412,9 +5041,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, } for ( int iter=0; iter<iIterTime; iter++ ) // iterate loop { -#if JVET_M0247_AFFINE_AMVR_ENCOPT memcpy( prevIterMv[iter], acMvTemp, sizeof( Mv ) * 3 ); -#endif /********************************************************************************* * use gradient to update mv *********************************************************************************/ @@ -5483,7 +5110,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, dDeltaMv[1] = dAffinePara[1] * width + dAffinePara[0]; dDeltaMv[3] = -dAffinePara[3] * width + dAffinePara[2]; } -#if JVET_M0246_AFFINE_AMVR int mvShift = MV_FRACTIONAL_BITS_DIFF - mvdPrecision; int multiShift = 1 << ( MV_FRACTIONAL_BITS_DIFF + mvdPrecision ); @@ -5494,35 +5120,17 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, { acDeltaMv[2] = Mv( ( int ) ( dDeltaMv[4] * multiShift + SIGN( dDeltaMv[4] ) * 0.5 ) << mvShift, ( int ) ( dDeltaMv[5] * multiShift + SIGN( dDeltaMv[5] ) * 0.5 ) << mvShift ); } -#else - acDeltaMv[0] = Mv( (int)(dDeltaMv[0] * 4 + SIGN( dDeltaMv[0] ) * 0.5) << MV_FRACTIONAL_BITS_DIFF, (int)(dDeltaMv[2] * 4 + SIGN( dDeltaMv[2] ) * 0.5) << MV_FRACTIONAL_BITS_DIFF - ); - acDeltaMv[1] = Mv( (int)(dDeltaMv[1] * 4 + SIGN( dDeltaMv[1] ) * 0.5) << MV_FRACTIONAL_BITS_DIFF, (int)(dDeltaMv[3] * 4 + SIGN( dDeltaMv[3] ) * 0.5) << MV_FRACTIONAL_BITS_DIFF - ); - - if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) - { - acDeltaMv[2] = Mv( (int)(dDeltaMv[4] * 4 + SIGN( dDeltaMv[4] ) * 0.5) << MV_FRACTIONAL_BITS_DIFF, (int)(dDeltaMv[5] * 4 + SIGN( dDeltaMv[5] ) * 0.5) << MV_FRACTIONAL_BITS_DIFF - ); - } -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT if ( !m_pcEncCfg->getUseAffineAmvrEncOpt() ) { -#endif bool bAllZero = false; for ( int i = 0; i < mvNum; i++ ) { -#if JVET_M0246_AFFINE_AMVR Mv deltaMv = acDeltaMv[i]; if ( pu.cu->imv == 2 ) { deltaMv.roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_HALF ); } if ( deltaMv.getHor() != 0 || deltaMv.getVer() != 0 ) -#else - if ( acDeltaMv[i].getHor() != 0 || acDeltaMv[i].getVer() != 0 ) -#endif { bAllZero = false; break; @@ -5532,49 +5140,33 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, if ( bAllZero ) break; -#if JVET_M0247_AFFINE_AMVR_ENCOPT } -#endif // do motion compensation with updated mv for ( int i = 0; i < mvNum; i++ ) { acMvTemp[i] += acDeltaMv[i]; -#if JVET_M0479_18BITS_MV_CLIP acMvTemp[i].hor = Clip3( -131072, 131071, acMvTemp[i].hor ); acMvTemp[i].ver = Clip3( -131072, 131071, acMvTemp[i].ver ); -#else - acMvTemp[i].hor = Clip3( -32768, 32767, acMvTemp[i].hor ); - acMvTemp[i].ver = Clip3( -32768, 32767, acMvTemp[i].ver ); -#endif -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) { -#endif acMvTemp[i].roundToPrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } else if ( pu.cu->imv == 2 ) { acMvTemp[i].roundToPrecision( MV_PRECISION_INTERNAL, MV_PRECISION_INT ); } -#endif -#if JVET_M0445_MCTS if( m_pcEncCfg->getMCTSEncConstraint() ) { MCTSHelper::clipMvToArea( acMvTemp[i], pu.cu->Y(), pu.cs->picture->mctsInfo.getTileAreaSubPelRestricted( pu ), *pu.cs->sps ); } else { -#endif clipMv(acMvTemp[i], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#if JVET_M0445_MCTS } -#endif } -#if JVET_M0247_AFFINE_AMVR_ENCOPT if ( m_pcEncCfg->getUseAffineAmvrEncOpt() ) { bool identical = false; @@ -5594,7 +5186,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, break; } } -#endif xPredAffineBlk( COMPONENT_Y, pu, refPic, acMvTemp, predBuf, false, pu.cu->slice->clpRng( COMPONENT_Y ) ); @@ -5605,8 +5196,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, // get cost with mv m_pcRdCost->setCostScale(0); uint32_t uiBitsTemp = ruiBits; -#if JVET_M0246_AFFINE_AMVR -#if JVET_M0247_AFFINE_AMVR_ENCOPT if ( pu.cu->imv == 2 && m_pcEncCfg->getUseAffineAmvrEncOpt() ) { uiBitsTemp = dirBits + xDetermineBestMvp( pu, acMvTemp, bestMvpIdx, aamvpi ); @@ -5618,26 +5207,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, { uiBitsTemp += xCalcAffineMVBits( pu, acMvTemp, acMvPred, pu.cu->imv != 1 ); } -#else - uiBitsTemp += xCalcAffineMVBits( pu, acMvTemp, acMvPred, pu.cu->imv != 1 ); -#endif -#else - for ( int i = 0; i < mvNum; i++ ) - { - m_pcRdCost->setPredictor( acMvPred[i] ); - Mv mv0 = acMvTemp[0]; - mv0.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); - const int shift = MV_FRACTIONAL_BITS_DIFF; - Mv secondPred; - if ( i != 0 ) - { - secondPred.hor = acMvPred[i].hor + mv0.hor - acMvPred[0].hor; - secondPred.ver = acMvPred[i].ver + mv0.ver - acMvPred[0].ver; - m_pcRdCost->setPredictor( secondPred ); - } - uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( acMvTemp[i].getHor()>>shift, acMvTemp[i].getVer()>>shift, 0 ); - } -#endif uiCostTemp = (Distortion)( floor( fWeight * (double)uiCostTemp ) + (double)m_pcRdCost->getCost( uiBitsTemp ) ); // store best cost and mv @@ -5646,9 +5215,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, uiCostBest = uiCostTemp; uiBitsBest = uiBitsTemp; memcpy( acMv, acMvTemp, sizeof(Mv) * 3 ); -#if JVET_M0247_AFFINE_AMVR_ENCOPT mvpIdx = bestMvpIdx; -#endif } } @@ -5660,25 +5227,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, // get cost with mv m_pcRdCost->setCostScale(0); uint32_t bitsTemp = ruiBits; -#if JVET_M0246_AFFINE_AMVR bitsTemp += xCalcAffineMVBits( pu, ctrlPtMv, acMvPred, pu.cu->imv != 1 ); -#else - for (int i = 0; i < mvNum; i++) - { - m_pcRdCost->setPredictor(acMvPred[i]); - Mv mv0 = ctrlPtMv[0]; - mv0.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); - const int shift = MV_FRACTIONAL_BITS_DIFF; - Mv secondPred; - if (i != 0) - { - secondPred.hor = acMvPred[i].hor + mv0.hor - acMvPred[0].hor; - secondPred.ver = acMvPred[i].ver + mv0.ver - acMvPred[0].ver; - m_pcRdCost->setPredictor(secondPred); - } - bitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor(ctrlPtMv[i].getHor() >> shift, ctrlPtMv[i].getVer() >> shift, 0); - } -#endif costTemp = (Distortion)(floor(fWeight * (double)costTemp) + (double)m_pcRdCost->getCost(bitsTemp)); // store best cost and mv if (costTemp < uiCostBest) @@ -5691,7 +5240,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, if (uiCostBest <= AFFINE_ME_LIST_MVP_TH*m_hevcCost) { -#if JVET_M0247_AFFINE_AMVR_ENCOPT //search 8 nearest neighbors; integer distance int testPos[8][2] = { { -1, 0 },{ 0, -1 },{ 0, 1 },{ 1, 0 },{ -1, -1 },{ -1, 1 },{ 1, 1 },{ 1, -1 } }; const uint32_t mvShift = pu.cu->imv == 1 ? 0 : ( pu.cu->imv == 2 ? ( MV_FRACTIONAL_BITS_DIFF << 1 ) : MV_FRACTIONAL_BITS_DIFF ); @@ -5739,19 +5287,14 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, } } } -#endif Mv mvPredTmp[3] = { acMvPred[0], acMvPred[1], acMvPred[2] }; -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif mvPredTmp[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); mvPredTmp[1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); mvPredTmp[2].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_M0246_AFFINE_AMVR } -#endif Mv mvME[3]; ::memcpy(mvME, acMv, sizeof(Mv) * 3); Mv dMv = mvME[0] - mvPredTmp[0]; @@ -5800,38 +5343,26 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, { int testPos[4][2] = { { -1, 0 },{ 0, -1 },{ 0, 1 },{ 1, 0 } }; Mv centerMv[3]; -#if JVET_M0246_AFFINE_AMVR const uint32_t mvShift = pu.cu->imv == 1 ? 0 : ( pu.cu->imv == 2 ? ( MV_FRACTIONAL_BITS_DIFF << 1 ) : MV_FRACTIONAL_BITS_DIFF ); -#endif ::memcpy(centerMv, acMv, sizeof(Mv) * 3); acMvTemp[0] = centerMv[0]; for (int i = 0; i < 4; i++) { -#if JVET_M0246_AFFINE_AMVR acMvTemp[1].set( centerMv[1].getHor() + ( testPos[i][0] << mvShift ), centerMv[1].getVer() + ( testPos[i][1] << mvShift ) ); -#else - acMvTemp[1].set(centerMv[1].getHor() + (testPos[i][0] << MV_FRACTIONAL_BITS_DIFF), centerMv[1].getVer() + (testPos[i][1] << MV_FRACTIONAL_BITS_DIFF)); -#endif checkCPMVRdCost(acMvTemp); } } } } -#if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv != 1 ) { -#endif acMv[0].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); acMv[1].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); acMv[2].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); -#if JVET_M0246_AFFINE_AMVR } -#endif -#if JVET_M0247_AFFINE_AMVR_ENCOPT acMvPred[0] = aamvpi.mvCandLT[mvpIdx]; acMvPred[1] = aamvpi.mvCandRT[mvpIdx]; acMvPred[2] = aamvpi.mvCandLB[mvpIdx]; -#endif // free buffer for (int i = 0; i<iParaNum; i++) @@ -5925,24 +5456,18 @@ void InterSearch::xExtDIFUpSamplingH( CPelBuf* pattern ) const ChromaFormat chFmt = m_currChromaFormat; m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[0][0], intStride, width + 1, height + filterSize, 0 << MV_FRACTIONAL_BITS_DIFF, false, chFmt, clpRng); -#if JVET_M0253_HASH_ME if (!m_skipFracME) { -#endif m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[2][0], intStride, width + 1, height + filterSize, 2 << MV_FRACTIONAL_BITS_DIFF, false, chFmt, clpRng); -#if JVET_M0253_HASH_ME } -#endif intPtr = m_filteredBlockTmp[0][0] + halfFilterSize * intStride + 1; dstPtr = m_filteredBlock[0][0][0]; m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng); -#if JVET_M0253_HASH_ME if (m_skipFracME) { return; } -#endif intPtr = m_filteredBlockTmp[0][0] + (halfFilterSize - 1) * intStride + 1; dstPtr = m_filteredBlock[2][0][0]; @@ -6188,12 +5713,10 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti { CHECK( !bSubdiv, "Not performing the implicit TU split" ); } -#if JVET_M0140_SBT else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { CHECK( !bSubdiv, "Not performing the implicit TU split - sbt" ); } -#endif else { CHECK( bSubdiv, "transformsplit not supported" ); @@ -6208,27 +5731,19 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti if( firstCbfOfCU || TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth - 1 ) ) { const bool chroma_cbf = TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ); -#if JVET_M0140_SBT if( !( cu.sbtInfo && currDepth == 1 ) ) -#endif m_CABACEstimator->cbf_comp( cs, chroma_cbf, currArea.blocks[COMPONENT_Cb], currDepth ); } if( firstCbfOfCU || TU::getCbfAtDepth( currTU, COMPONENT_Cr, currDepth - 1 ) ) { const bool chroma_cbf = TU::getCbfAtDepth( currTU, COMPONENT_Cr, currDepth ); -#if JVET_M0140_SBT if( !( cu.sbtInfo && currDepth == 1 ) ) -#endif m_CABACEstimator->cbf_comp( cs, chroma_cbf, currArea.blocks[COMPONENT_Cr], currDepth, TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ) ); } } } -#if JVET_M0140_SBT if( !bSubdiv && !( cu.sbtInfo && currTU.noResidual ) ) -#else - if( !bSubdiv ) -#endif { m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, COMPONENT_Y, currDepth ), currArea.Y(), currDepth ); } @@ -6259,12 +5774,10 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti { partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0140_SBT else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { partitioner.splitCurrArea( PartSplit( cu.getSbtTuSplit() ), cs ); } -#endif else THROW( "Implicit TU split not available!" ); @@ -6278,7 +5791,6 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti } } -#if JVET_M0140_SBT void InterSearch::calcMinDistSbt( CodingStructure &cs, const CodingUnit& cu, const uint8_t sbtAllowed ) { if( !sbtAllowed ) @@ -6523,7 +6035,6 @@ uint8_t InterSearch::skipSbtByRDCost( int width, int height, int mtDepth, uint8_ } return MAX_UCHAR; } -#endif void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &partitioner, Distortion *puiZeroDist /*= NULL*/ , const bool luma, const bool chroma @@ -6531,21 +6042,16 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { const UnitArea& currArea = partitioner.currArea(); const SPS &sps = *cs.sps; -#if !JVET_M0464_UNI_MTS - const PPS &pps = *cs.pps; -#endif const uint32_t numValidComp = getNumberValidComponents( sps.getChromaFormatIdc() ); const uint32_t numTBlocks = getNumberValidTBlocks ( *cs.pcv ); const CodingUnit &cu = *cs.getCU(partitioner.chType); const unsigned currDepth = partitioner.currTrDepth; bool bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); -#if JVET_M0140_SBT if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { bCheckFull = false; } -#endif bool bCheckSplit = !bCheckFull; // get temporary data @@ -6571,16 +6077,9 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { TransformUnit &tu = csFull->addTU(CS::isDualITree(cs) ? cu : currArea, partitioner.chType); tu.depth = currDepth; -#if JVET_M0464_UNI_MTS tu.mtsIdx = 0; -#else - tu.emtIdx = 0; -#endif -#if JVET_M0140_SBT tu.checkTuNoResidual( partitioner.currPartIdx() ); -#endif -#if JVET_M0427_INLOOP_RESHAPER const Slice &slice = *cs.slice; if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && slice.getReshapeInfo().getSliceReshapeChromaAdj()) { @@ -6589,22 +6088,14 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par CompArea tmpArea(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size()); PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); tmpPred.copyFrom(piPredY); -#if JVET_M0483_IBC if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (!cu.firstPU->mhIntraFlag && !cu.ibc) -#endif tmpPred.rspSignal(m_pcReshape->getFwdLUT()); const Pel avgLuma = tmpPred.computeAvg(); int adj = m_pcReshape->calculateChromaAdj(avgLuma); tu.setChromaAdj(adj); } -#endif double minCost [MAX_NUM_TBLOCKS]; -#if !JVET_M0464_UNI_MTS - bool checkTransformSkip [MAX_NUM_TBLOCKS]; -#endif m_CABACEstimator->resetBits(); @@ -6631,25 +6122,12 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par continue; const CompArea& compArea = tu.blocks[compID]; const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); -#if !JVET_M0464_UNI_MTS - checkTransformSkip[compID] = false; -#endif if( !tu.blocks[compID].valid() ) { continue; } -#if !JVET_M0464_UNI_MTS - checkTransformSkip[compID] = pps.getUseTransformSkip() && TU::hasTransformSkipFlag( *tu.cs, tu.blocks[compID] ) && !cs.isLossless; - if( isLuma(compID) ) - { - checkTransformSkip[compID] &= !tu.cu->emtFlag; - } -#if JVET_M0140_SBT - checkTransformSkip[compID] &= !tu.cu->sbtInfo; -#endif -#endif const bool isCrossCPredictionAvailable = TU::hasCrossCompPredInfo( tu, compID ); @@ -6662,24 +6140,17 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par preCalcAlpha = xCalcCrossComponentPredictionAlpha( tu, compID, m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate() ); } -#if JVET_M0464_UNI_MTS const bool tsAllowed = TU::isTSAllowed ( tu, compID ); const bool mtsAllowed = TU::isMTSAllowed( tu, compID ); uint8_t nNumTransformCands = 1 + ( tsAllowed ? 1 : 0 ) + ( mtsAllowed ? 4 : 0 ); // DCT + TS + 4 MTS = 6 tests std::vector<TrMode> trModes; trModes.push_back( TrMode( 0, true ) ); //DCT2 -#if JVET_M0140_SBT nNumTransformCands = 1; //for a SBT-no-residual TU, the RDO process should be called once, in order to get the RD cost if( tsAllowed && !tu.noResidual ) -#else - if( tsAllowed ) -#endif { trModes.push_back( TrMode( 1, true ) ); -#if JVET_M0140_SBT nNumTransformCands++; -#endif } #if APPLY_SBT_SL_ON_MTS @@ -6697,28 +6168,14 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { #endif trModes.push_back( TrMode( i, true ) ); -#if JVET_M0140_SBT nNumTransformCands++; -#endif #if APPLY_SBT_SL_ON_MTS } #endif } } -#endif const int crossCPredictionModesToTest = preCalcAlpha != 0 ? 2 : 1; -#if JVET_M0464_UNI_MTS const int numTransformCandidates = nNumTransformCands; -#else -#if JVET_M0140_SBT - const int numEmtTransformCandidates = isLuma(compID) && tu.cu->emtFlag && sps.getUseInterEMT() && (m_histBestMtsIdx == MAX_UCHAR || !sps.getUseSBT()) ? 4 : 1; - const int numTransformCandidates = tu.noResidual ? 1 : (checkTransformSkip[compID] ? (numEmtTransformCandidates + 1) : numEmtTransformCandidates); -#else - const int numEmtTransformCandidates = isLuma(compID) && tu.cu->emtFlag && sps.getUseInterEMT() ? 4 : 1; - const int numTransformCandidates = checkTransformSkip[compID] ? ( numEmtTransformCandidates + 1 ) : numEmtTransformCandidates; -#endif - int lastTransformModeIndex = numTransformCandidates - 1; //lastTransformModeIndex is the mode for transformSkip (if transformSkip is active) -#endif const bool isOneMode = crossCPredictionModesToTest == 1 && numTransformCandidates == 1; bool isLastBest = isOneMode; @@ -6736,7 +6193,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->getCtx() = ctxStart; m_CABACEstimator->resetBits(); -#if JVET_M0464_UNI_MTS if( isLuma( compID ) ) { if( bestTU.mtsIdx == 1 && m_pcEncCfg->getUseTransformSkipFast() ) @@ -6749,14 +6205,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } tu.mtsIdx = trModes[transformMode].first; } -#else -#if JVET_M0140_SBT - if( isLuma( compID ) ) tu.emtIdx = (m_histBestMtsIdx == MAX_UCHAR || !sps.getUseSBT()) ? transformMode : m_histBestMtsIdx; -#else - if( isLuma( compID ) ) tu.emtIdx = transformMode; -#endif - tu.transformSkip[compID] = checkTransformSkip[compID] && transformMode == lastTransformModeIndex; -#endif tu.compAlpha[compID] = bUseCrossCPrediction ? preCalcAlpha : 0; const QpParam cQP(tu, compID); // note: uses tu.transformSkip[compID] @@ -6764,13 +6212,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #if RDOQ_CHROMA_LAMBDA m_pcTrQuant->selectLambda(compID); #endif -#if JVET_M0427_INLOOP_RESHAPER if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj()) { double cRescale = round((double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj())); m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale)); } -#endif TCoeff currAbsSum = 0; uint64_t currCompFracBits = 0; Distortion currCompDist = 0; @@ -6784,14 +6230,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par PelBuf resiBuf = csFull->getResiBuf( compArea ); crossComponentPrediction( tu, compID, lumaResi, resiBuf, resiBuf, false ); } -#if JVET_M0427_INLOOP_RESHAPER if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj() && tu.blocks[compID].width*tu.blocks[compID].height > 4 ) { PelBuf resiBuf = csFull->getResiBuf(compArea); resiBuf.scaleSignal(tu.getChromaAdj(), 1, tu.cu->cs->slice->clpRng(compID)); } -#endif -#if JVET_M0464_UNI_MTS if( nNumTransformCands > 1 ) { if( transformMode == 0 ) @@ -6805,9 +6248,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { m_pcTrQuant->transformNxN( tu, compID, cQP, currAbsSum, m_CABACEstimator->getCtx() ); } -#else - m_pcTrQuant->transformNxN(tu, compID, cQP, currAbsSum, m_CABACEstimator->getCtx()); -#endif if (isFirstMode || (currAbsSum == 0)) { @@ -6825,10 +6265,8 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par nonCoeffDist = m_pcRdCost->getDistPart( zeroBuf, orgResi, channelBitDepth, compID, DF_SSE ); // initialized with zero residual distortion } -#if JVET_M0140_SBT if( !tu.noResidual ) { -#endif const bool prevCbf = ( compID == COMPONENT_Cr ? tu.cbf[COMPONENT_Cb] : false ); m_CABACEstimator->cbf_comp( *csFull, false, compArea, currDepth, prevCbf ); @@ -6836,9 +6274,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { m_CABACEstimator->cross_comp_pred( tu, compID ); } -#if JVET_M0140_SBT } -#endif nonCoeffFracBits = m_CABACEstimator->getEstFracBits(); #if WCG_EXT @@ -6879,12 +6315,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par CPelBuf orgResiBuf = csFull->getOrgResiBuf(compArea); m_pcTrQuant->invTransformNxN(tu, compID, resiBuf, cQP); -#if JVET_M0427_INLOOP_RESHAPER if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj() && tu.blocks[compID].width*tu.blocks[compID].height > 4 ) { resiBuf.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); } -#endif if (bUseCrossCPrediction) { @@ -6904,11 +6338,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par nonCoeffCost = MAX_DOUBLE; } } -#if JVET_M0464_UNI_MTS else if( transformMode > 0 && !bUseCrossCPrediction ) -#else - else if( ( transformMode == lastTransformModeIndex ) && checkTransformSkip[compID] && !bUseCrossCPrediction ) -#endif { currCompCost = MAX_DOUBLE; } @@ -6922,11 +6352,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } // evaluate -#if JVET_M0464_UNI_MTS if( ( currCompCost < minCost[compID] ) || ( transformMode == 1 && currCompCost == minCost[compID] ) ) -#else - if( ( currCompCost < minCost[compID] ) || ( transformMode == lastTransformModeIndex && checkTransformSkip[compID] && currCompCost == minCost[compID] ) ) -#endif { // copy component if (isFirstMode && ((nonCoeffCost < currCompCost) || (currAbsSum == 0))) // check for forced null @@ -6964,12 +6390,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par isLastBest = isLastMode; } -#if JVET_M0140_SBT if( tu.noResidual ) { CHECK( currCompFracBits > 0 || currAbsSum, "currCompFracBits > 0 when tu noResidual" ); } -#endif } } @@ -6983,10 +6407,8 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->getCtx() = ctxStart; m_CABACEstimator->resetBits(); -#if JVET_M0140_SBT if( !tu.noResidual ) { -#endif static const ComponentID cbf_getComp[3] = { COMPONENT_Cb, COMPONENT_Cr, COMPONENT_Y }; for( unsigned c = 0; c < numTBlocks; c++) { @@ -7001,9 +6423,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->cbf_comp( *csFull, TU::getCbfAtDepth( tu, compID, currDepth ), tu.blocks[compID], currDepth, prevCbf ); } } -#if JVET_M0140_SBT } -#endif for (uint32_t ch = 0; ch < numValidComp; ch++) { @@ -7025,12 +6445,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par uiSingleDist += uiSingleDistComp[compID]; } } -#if JVET_M0140_SBT if( tu.noResidual ) { CHECK( m_CABACEstimator->getEstFracBits() > 0, "no residual TU's bits shall be 0" ); } -#endif csFull->fracBits += m_CABACEstimator->getEstFracBits(); csFull->dist += uiSingleDist; @@ -7056,12 +6474,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0140_SBT else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { partitioner.splitCurrArea( PartSplit( cu.getSbtTuSplit() ), cs ); } -#endif else THROW( "Implicit TU split not available!" ); @@ -7072,12 +6488,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par ); csSplit->cost = m_pcRdCost->calcRdCost( csSplit->fracBits, csSplit->dist ); -#if !JVET_M0464_UNI_MTS - if( csFull && csSplit->cost >= csFull->cost && m_pcEncCfg->getFastInterEMT() ) - { - break; - } -#endif } while( partitioner.nextPart( *csSplit ) ); partitioner.exitCurrSplit(); @@ -7085,12 +6495,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par unsigned anyCbfSet = 0; unsigned compCbf[3] = { 0, 0, 0 }; -#if JVET_M0464_UNI_MTS if( !bCheckFull ) -#else - bool isSplit = bCheckFull ? false : true; - if( !bCheckFull || ( csSplit->cost < csFull->cost && m_pcEncCfg->getFastInterEMT() ) || !m_pcEncCfg->getFastInterEMT() ) -#endif { for( auto &currTU : csSplit->traverseTUs( currArea, partitioner.chType ) ) { @@ -7142,21 +6547,9 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { cs.useSubStructure( *csSplit, partitioner.chType, currArea, false, false, false, true ); cs.cost = csSplit->cost; -#if !JVET_M0464_UNI_MTS - isSplit = true; -#endif } } -#if !JVET_M0464_UNI_MTS - if( ( !isSplit && m_pcEncCfg->getFastInterEMT() ) || ( !m_pcEncCfg->getFastInterEMT() && !( !bCheckFull || ( anyCbfSet && csSplit->cost < csFull->cost ) ) ) ) - { - CHECK( !bCheckFull, "Error!" ); - cs.useSubStructure( *csFull, partitioner.chType, currArea, false, false, false, true ); - cs.cost = csFull->cost; - m_CABACEstimator->getCtx() = ctxBest; - } -#endif if( csSplit && csFull ) { @@ -7181,22 +6574,14 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa { cu.skip = true; cu.rootCbf = false; -#if JVET_M0140_SBT CHECK( cu.sbtInfo != 0, "sbtInfo shall be 0 if CU has no residual" ); -#endif cs.getResiBuf().fill(0); { cs.getRecoBuf().copyFrom(cs.getPredBuf() ); -#if JVET_M0427_INLOOP_RESHAPER -#if JVET_M0483_IBC if (m_pcEncCfg->getReshaper() && (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) && !cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (m_pcEncCfg->getReshaper() && (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) && !cu.firstPU->mhIntraFlag && !cu.ibc) -#endif { cs.getRecoBuf().Y().rspSignal(m_pcReshape->getFwdLUT()); } -#endif } @@ -7214,15 +6599,10 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa CPelBuf reco = cs.getRecoBuf (compID); CPelBuf org = cs.getOrgBuf (compID); #if WCG_EXT -#if JVET_M0427_INLOOP_RESHAPER if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getReshaper() && (cs.slice->getReshapeInfo().getUseSliceReshaper()&& m_pcReshape->getCTUFlag()))) -#else - if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) -#endif { const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); -#if JVET_M0427_INLOOP_RESHAPER if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) { const CompArea &areaY = cu.Y(); @@ -7233,7 +6613,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa distortion += m_pcRdCost->getDistPart(org, tmpRecLuma, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE_WTD, &orgLuma); } else -#endif distortion += m_pcRdCost->getDistPart( org, reco, sps.getBitDepth( toChannelType( compID ) ), compID, DF_SSE_WTD, &orgLuma ); } else @@ -7251,14 +6630,12 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa PredictionUnit &pu = *cs.getPU( partitioner.chType ); m_CABACEstimator->cu_skip_flag ( cu ); -#if JVET_M0483_IBC if (CU::isIBC(cu)) { m_CABACEstimator->merge_idx(pu); } else { -#endif m_CABACEstimator->subblock_merge_flag( cu ); m_CABACEstimator->triangle_mode ( cu ); if (cu.mmvdSkip) @@ -7267,9 +6644,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa } else m_CABACEstimator->merge_idx ( pu ); -#if JVET_M0483_IBC } -#endif cs.dist = distortion; cs.fracBits = m_CABACEstimator->getEstFracBits(); @@ -7282,7 +6657,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa if (luma) { cs.getResiBuf().bufs[0].copyFrom(cs.getOrgBuf().bufs[0]); -#if JVET_M0427_INLOOP_RESHAPER if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { const CompArea &areaY = cu.Y(); @@ -7290,17 +6664,12 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); tmpPred.copyFrom(cs.getPredBuf(COMPONENT_Y)); -#if JVET_M0483_IBC if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (!cu.firstPU->mhIntraFlag && !cu.ibc) -#endif tmpPred.rspSignal(m_pcReshape->getFwdLUT()); cs.getResiBuf(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT()); cs.getResiBuf(COMPONENT_Y).subtract(tmpPred); } else -#endif cs.getResiBuf().bufs[0].subtract(cs.getPredBuf().bufs[0]); } if (chroma) @@ -7354,9 +6723,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa if (zeroCost < cs.cost || !cu.rootCbf) { -#if JVET_M0140_SBT cu.sbtInfo = 0; -#endif cu.rootCbf = false; cs.clearTUs(); @@ -7392,7 +6759,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa if (luma) { -#if JVET_M0427_INLOOP_RESHAPER if (cu.rootCbf && cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { const CompArea &areaY = cu.Y(); @@ -7400,30 +6766,19 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); tmpPred.copyFrom(cs.getPredBuf(COMPONENT_Y)); -#if JVET_M0483_IBC if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (!cu.firstPU->mhIntraFlag && !cu.ibc) -#endif tmpPred.rspSignal(m_pcReshape->getFwdLUT()); cs.getRecoBuf(COMPONENT_Y).reconstruct(tmpPred, cs.getResiBuf(COMPONENT_Y), cs.slice->clpRng(COMPONENT_Y)); } else { -#endif cs.getRecoBuf().bufs[0].reconstruct(cs.getPredBuf().bufs[0], cs.getResiBuf().bufs[0], cs.slice->clpRngs().comp[0]); -#if JVET_M0427_INLOOP_RESHAPER -#if JVET_M0483_IBC if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && !cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && !cu.firstPU->mhIntraFlag && !cu.ibc) -#endif { cs.getRecoBuf().bufs[0].rspSignal(m_pcReshape->getFwdLUT()); } } -#endif } if (chroma) { @@ -7445,15 +6800,10 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa CPelBuf org = cs.getOrgBuf (compID); #if WCG_EXT -#if JVET_M0427_INLOOP_RESHAPER if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( m_pcEncCfg->getReshaper() && (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() ) ) ) -#else - if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) -#endif { const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); -#if JVET_M0427_INLOOP_RESHAPER if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) ) { const CompArea &areaY = cu.Y(); @@ -7464,7 +6814,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa finalDistortion += m_pcRdCost->getDistPart(org, tmpRecLuma, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE_WTD, &orgLuma); } else -#endif finalDistortion += m_pcRdCost->getDistPart(org, reco, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE_WTD, &orgLuma); } else @@ -7561,24 +6910,18 @@ bool InterSearch::xReadBufferedUniMv(PredictionUnit& pu, RefPicList eRefPicList, } bool InterSearch::xReadBufferedAffineUniMv(PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv acMvPred[3], Mv acMv[3], uint32_t& ruiBits, Distortion& ruiCost -#if JVET_M0247_AFFINE_AMVR_ENCOPT , int& mvpIdx, const AffineAMVPInfo& aamvpi -#endif ) { if (m_uniMotions.isReadModeAffine((uint32_t)eRefPicList, (uint32_t)iRefIdx, pu.cu->affineType)) { m_uniMotions.copyAffineMvTo(acMv, ruiCost, (uint32_t)eRefPicList, (uint32_t)iRefIdx, pu.cu->affineType -#if JVET_M0247_AFFINE_AMVR_ENCOPT , mvpIdx -#endif ); m_pcRdCost->setCostScale(0); -#if JVET_M0247_AFFINE_AMVR_ENCOPT acMvPred[0] = aamvpi.mvCandLT[mvpIdx]; acMvPred[1] = aamvpi.mvCandRT[mvpIdx]; acMvPred[2] = aamvpi.mvCandLB[mvpIdx]; -#endif uint32_t uiMvBits = 0; for (int iVerIdx = 0; iVerIdx<(pu.cu->affineType ? 3 : 2); iVerIdx++) @@ -7630,7 +6973,6 @@ void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& siz rcMv.setVer( std::min( verMax, std::max( verMin, rcMv.getVer() ) ) ); } -#if JVET_M0247_AFFINE_AMVR_ENCOPT uint32_t InterSearch::xDetermineBestMvp( PredictionUnit& pu, Mv acMvTemp[3], int& mvpIdx, const AffineAMVPInfo& aamvpi ) { bool mvpUpdated = false; @@ -7651,9 +6993,7 @@ uint32_t InterSearch::xDetermineBestMvp( PredictionUnit& pu, Mv acMvTemp[3], int CHECK( !mvpUpdated, "xDetermineBestMvp() error" ); return minBits; } -#endif -#if JVET_M0444_SMVD void InterSearch::symmvdCheckBestMvp( PredictionUnit& pu, PelUnitBuf& origBuf, @@ -7732,4 +7072,3 @@ void InterSearch::symmvdCheckBestMvp( } } } -#endif diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index a5cad5ba46beacaa58e907cb9f76de1944af5c2f..d2a4bccb923c67ab42365efd82543acc3aa8f095 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -52,14 +52,10 @@ #include "CommonLib/AffineGradientSearch.h" #include "CommonLib/IbcHashMap.h" -#if JVET_M0253_HASH_ME #include "CommonLib/Hash.h" -#endif #include <unordered_map> #include <vector> -#if JVET_M0427_INLOOP_RESHAPER #include "EncReshape.h" -#endif //! \ingroup EncoderLib //! \{ @@ -82,7 +78,6 @@ struct AffineMVInfo int x, y, w, h; }; -#if JVET_M0246_AFFINE_AMVR typedef struct { Mv acMvAffine4Para[2][2]; @@ -94,7 +89,6 @@ typedef struct bool affine4ParaAvail; bool affine6ParaAvail; } EncAffineMotion; -#endif /// encoder search class class InterSearch : public InterPrediction, CrossComponentPrediction, AffineGradientSearch @@ -123,18 +117,14 @@ private: int m_affMVListSize; int m_affMVListMaxSize; Distortion m_hevcCost; -#if JVET_M0246_AFFINE_AMVR EncAffineMotion m_affineMotion; -#endif protected: // interface to option EncCfg* m_pcEncCfg; // interface to classes TrQuant* m_pcTrQuant; -#if JVET_M0427_INLOOP_RESHAPER EncReshape* m_pcReshape; -#endif // ME parameters int m_iSearchRange; @@ -147,11 +137,9 @@ protected: CtxCache* m_CtxCache; DistParam m_cDistParam; -#if JVET_M0253_HASH_ME RefPicList m_currRefPicList; int m_currRefPicIndex; bool m_skipFracME; -#endif // Misc. Pel *m_pTempPel; @@ -165,13 +153,11 @@ protected: unsigned int m_numBVs, m_numBV16s; Mv m_acBVs[IBC_NUM_CANDIDATES]; bool m_useCompositeRef; -#if JVET_M0140_SBT Distortion m_estMinDistSbt[NUMBER_SBT_MODE + 1]; // estimated minimum SSE value of the PU if using a SBT mode uint8_t m_sbtRdoOrder[NUMBER_SBT_MODE]; // order of SBT mode in RDO bool m_skipSbtAll; // to skip all SBT modes for the current PU uint8_t m_histBestSbt; // historical best SBT mode for PU of certain SSE values uint8_t m_histBestMtsIdx; // historical best MTS idx for PU of certain SSE values -#endif public: InterSearch(); @@ -189,14 +175,11 @@ public: RdCost* pcRdCost, CABACWriter* CABACEstimator, CtxCache* ctxCache -#if JVET_M0427_INLOOP_RESHAPER , EncReshape* m_pcReshape -#endif ); void destroy (); -#if JVET_M0140_SBT void calcMinDistSbt ( CodingStructure &cs, const CodingUnit& cu, const uint8_t sbtAllowed ); uint8_t skipSbtByRDCost ( int width, int height, int mtDepth, uint8_t sbtIdx, uint8_t sbtPos, double bestCost, Distortion distSbtOff, double costSbtOff, bool rootCbfSbtOff ); bool getSkipSbtAll () { return m_skipSbtAll; } @@ -206,7 +189,6 @@ public: void initTuAnalyzer () { m_estMinDistSbt[NUMBER_SBT_MODE] = std::numeric_limits<uint64_t>::max(); m_skipSbtAll = false; } void setHistBestTrs ( uint8_t sbtInfo, uint8_t mtsIdx ) { m_histBestSbt = sbtInfo; m_histBestMtsIdx = mtsIdx; } void initSbtRdoOrder ( uint8_t sbtMode ) { m_sbtRdoOrder[0] = sbtMode; m_estMinDistSbt[0] = m_estMinDistSbt[sbtMode]; } -#endif void setTempBuffers (CodingStructure ****pSlitCS, CodingStructure ****pFullCS, CodingStructure **pSaveCS ); void resetCtuRecord () { m_ctuRecord.clear(); } @@ -246,10 +228,8 @@ public: m_affMVListSize = std::min(m_affMVListSize + 1, m_affMVListMaxSize); } } -#if JVET_M0246_AFFINE_AMVR void resetSavedAffineMotion(); void storeAffineMotion( Mv acAffineMv[2][3], int16_t affineRefIdx[2], EAffineModel affineType, int gbiIdx ); -#endif protected: /// sub-function for motion vector refinement used in fractional-pel accuracy @@ -305,13 +285,11 @@ public: void xIBCEstimation ( PredictionUnit& pu, PelUnitBuf& origBuf, Mv *pcMvPred, Mv &rcMv, Distortion &ruiCost, const int localSearchRangeX, const int localSearchRangeY); void xIBCSearchMVCandUpdate ( Distortion uiSad, int x, int y, Distortion* uiSadBestCand, Mv* cMVCand); int xIBCSearchMVChromaRefine( PredictionUnit& pu, int iRoiWidth, int iRoiHeight, int cuPelX, int cuPelY, Distortion* uiSadBestCand, Mv* cMVCand); -#if JVET_M0253_HASH_ME void addToSortList(std::list<BlockHash>& listBlockHash, std::list<int>& listCost, int cost, const BlockHash& blockHash); bool predInterHashSearch(CodingUnit& cu, Partitioner& partitioner, bool& isPerfectMatch); bool xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPicList, int& bestRefIndex, Mv& bestMv, Mv& bestMvd, int& bestMVPIndex, bool& isPerfectMatch); int xHashInterPredME(const PredictionUnit& pu, RefPicList currRefPicList, int currRefPicIndex, Mv bestMv[5]); void selectMatchesInter(const MapIterator& itBegin, int count, std::list<BlockHash>& vecBlockHash, const BlockHash& currBlockHash); -#endif protected: // ------------------------------------------------------------------------------------------------------------------- @@ -348,9 +326,7 @@ protected: RefPicList eRefPicList, int iRefIdx ); -#if JVET_M0246_AFFINE_AMVR uint32_t xCalcAffineMVBits ( PredictionUnit& pu, Mv mvCand[3], Mv mvPred[3], bool mvHighPrec = false ); -#endif void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); uint32_t xGetMvpIdxBits ( int iIdx, int iNum ); @@ -452,10 +428,8 @@ protected: Mv acMv[3], uint32_t& ruiBits, Distortion& ruiCost, -#if JVET_M0247_AFFINE_AMVR_ENCOPT int& mvpIdx, const AffineAMVPInfo& aamvpi, -#endif bool bBi = false ); @@ -473,19 +447,15 @@ protected: void xCopyAffineAMVPInfo ( AffineAMVPInfo& src, AffineAMVPInfo& dst ); void xCheckBestAffineMVP ( PredictionUnit &pu, AffineAMVPInfo &affineAMVPInfo, RefPicList eRefPicList, Mv acMv[3], Mv acMvPred[3], int& riMVPIdx, uint32_t& ruiBits, Distortion& ruiCost ); -#if JVET_M0444_SMVD Distortion xGetSymmetricCost( PredictionUnit& pu, PelUnitBuf& origBuf, RefPicList eCurRefPicList, const MvField& cCurMvField, MvField& cTarMvField , int gbiIdx ); Distortion xSymmeticRefineMvSearch( PredictionUnit& pu, PelUnitBuf& origBuf, Mv& rcMvCurPred, Mv& rcMvTarPred , RefPicList eRefPicList, MvField& rCurMvField, MvField& rTarMvField, Distortion uiMinCost, int searchPattern, int nSearchStepShift, uint32_t uiMaxSearchRounds , int gbiIdx ); void xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& origBuf, Mv& rcMvCurPred, Mv& rcMvTarPred, RefPicList eRefPicList, MvField& rCurMvField, MvField& rTarMvField, Distortion& ruiCost, int gbiIdx ); -#endif bool xReadBufferedAffineUniMv ( PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv acMvPred[3], Mv acMv[3], uint32_t& ruiBits, Distortion& ruiCost -#if JVET_M0247_AFFINE_AMVR_ENCOPT , int& mvpIdx, const AffineAMVPInfo& aamvpi -#endif ); double xGetMEDistortionWeight ( uint8_t gbiIdx, RefPicList eRefPicList); bool xReadBufferedUniMv ( PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv& pcMvPred, Mv& rcMv, uint32_t& ruiBits, Distortion& ruiCost); @@ -496,7 +466,6 @@ public: void resetBufferedUniMotions () { m_uniMotions.reset(); } uint32_t getWeightIdxBits ( uint8_t gbiIdx ) { return m_estWeightIdxBits[gbiIdx]; } void initWeightIdxBits (); -#if JVET_M0444_SMVD void symmvdCheckBestMvp( PredictionUnit& pu, PelUnitBuf& origBuf, @@ -509,14 +478,11 @@ public: Distortion& bestCost, bool skip = false ); -#endif protected: void xExtDIFUpSamplingH ( CPelBuf* pcPattern ); void xExtDIFUpSamplingQ ( CPelBuf* pcPatternKey, Mv halfPelRef ); -#if JVET_M0247_AFFINE_AMVR_ENCOPT uint32_t xDetermineBestMvp ( PredictionUnit& pu, Mv acMvTemp[3], int& mvpIdx, const AffineAMVPInfo& aamvpi ); -#endif // ------------------------------------------------------------------------------------------------------------------- // compute symbol bits // ------------------------------------------------------------------------------------------------------------------- diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 2d11fecc58fd1c1d2238f06a4f52166b7bb484bf..4e2852e5fdb03188ddb80fea56aa73d2a2da0a73 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -60,9 +60,7 @@ IntraSearch::IntraSearch() , m_pcEncCfg (nullptr) , m_pcTrQuant (nullptr) , m_pcRdCost (nullptr) -#if JVET_M0427_INLOOP_RESHAPER , m_pcReshape (nullptr) -#endif , m_CABACEstimator(nullptr) , m_CtxCache (nullptr) , m_isInitialized (false) @@ -152,9 +150,7 @@ void IntraSearch::destroy() m_pSharedPredTransformSkip[ch] = nullptr; } -#if JVET_M0427_INLOOP_RESHAPER m_tmpStorageLCU.destroy(); -#endif m_isInitialized = false; } @@ -174,9 +170,7 @@ void IntraSearch::init( EncCfg* pcEncCfg, const uint32_t maxCUWidth, const uint32_t maxCUHeight, const uint32_t maxTotalCUDepth -#if JVET_M0427_INLOOP_RESHAPER , EncReshape* pcReshape -#endif ) { CHECK(m_isInitialized, "Already initialized"); @@ -185,16 +179,12 @@ void IntraSearch::init( EncCfg* pcEncCfg, m_pcRdCost = pcRdCost; m_CABACEstimator = CABACEstimator; m_CtxCache = ctxCache; -#if JVET_M0427_INLOOP_RESHAPER m_pcReshape = pcReshape; -#endif const ChromaFormat cform = pcEncCfg->getChromaFormatIdc(); IntraPrediction::init( cform, pcEncCfg->getBitDepth( CHANNEL_TYPE_LUMA ) ); -#if JVET_M0427_INLOOP_RESHAPER m_tmpStorageLCU.create(UnitArea(cform, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); -#endif for( uint32_t ch = 0; ch < MAX_NUM_TBLOCKS; ch++ ) { @@ -276,11 +266,7 @@ void IntraSearch::init( EncCfg* pcEncCfg, // INTRA PREDICTION ////////////////////////////////////////////////////////////////////////// -#if JVET_M0102_INTRA_SUBPARTITIONS void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, const double bestCostSoFar ) -#else -void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) -#endif { CodingStructure &cs = *cu.cs; const SPS &sps = *cs.sps; @@ -304,36 +290,9 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) uint32_t extraModes = 0; // add two extra modes, which would be used after uiMode <= DC_IDX is removed for cu.nsstIdx == 3 -#if !JVET_M0464_UNI_MTS - const int width = partitioner.currArea().lwidth(); - const int height = partitioner.currArea().lheight(); - - // Marking EMT usage for faster EMT - // 0: EMT is either not applicable for current CU (cuWidth > EMT_INTRA_MAX_CU or cuHeight > EMT_INTRA_MAX_CU), not active in the config file or the fast decision algorithm is not used in this case - // 1: EMT fast algorithm can be applied for the current CU, and the DCT2 is being checked - // 2: EMT is being checked for current CU. Stored results of DCT2 can be utilized for speedup - uint8_t emtUsageFlag = 0; - const int maxSizeEMT = EMT_INTRA_MAX_CU_WITH_QTBT; - if( width <= maxSizeEMT && height <= maxSizeEMT && sps.getUseIntraEMT() ) - { - emtUsageFlag = cu.emtFlag == 1 ? 2 : 1; - } - - bool isAllIntra = m_pcEncCfg->getIntraPeriod() == 1; - - if( width * height < 64 && !isAllIntra ) - { - emtUsageFlag = 0; //this forces the recalculation of the candidates list. Why is this necessary? (to be checked) - } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS -#if JVET_M0464_UNI_MTS const int width = partitioner.currArea().lwidth(); const int height = partitioner.currArea().lheight(); int nOptionsForISP = NUM_INTRA_SUBPARTITIONS_MODES; -#else - int nOptionsForISP = cu.emtFlag == 0 ? NUM_INTRA_SUBPARTITIONS_MODES : 1; -#endif double bestCurrentCost = bestCostSoFar; int ispOptions[NUM_INTRA_SUBPARTITIONS_MODES] = { 0 }; @@ -386,7 +345,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) m_intraModeHorVerRatio .clear(); m_intraModeTestedNormalIntra.clear(); } -#endif static_vector<uint32_t, FAST_UDI_MAX_RDMODE_NUM> uiHadModeList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandCostList; @@ -396,9 +354,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) static_vector<int, FAST_UDI_MAX_RDMODE_NUM>* nullList = NULL; auto &pu = *cu.firstPU; -#if !JVET_M0464_UNI_MTS - int puIndex = 0; -#endif { CandHadList.clear(); CandCostList.clear(); @@ -418,9 +373,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) numModesForFullRD = numModesAvailable; #endif -#if !JVET_M0464_UNI_MTS - if( emtUsageFlag != 2 ) -#endif { // this should always be true CHECK( !pu.Y().valid(), "PU is not valid" ); @@ -445,7 +397,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) const bool bUseHadamard = cu.transQuantBypass == 0; -#if JVET_M0427_INLOOP_RESHAPER if (cu.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); @@ -455,7 +406,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) m_pcRdCost->setDistParam(distParam, tmpOrg, piPred, sps.getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y, bUseHadamard); } else -#endif m_pcRdCost->setDistParam(distParam, piOrg, piPred, sps.getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y, bUseHadamard); distParam.applyWeight = false; @@ -565,14 +515,12 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) } } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( nOptionsForISP > 1 ) { //we save the list with no mrl modes to keep only the Hadamard selected modes (no mpms) m_rdModeListWithoutMrl.resize( numModesForFullRD ); std::copy_n( uiRdModeList.begin(), numModesForFullRD, m_rdModeListWithoutMrl.begin() ); } -#endif #if ENABLE_JVET_L0283_MRL pu.multiRefIdx = 1; const int numMPMs = NUM_MOST_PROBABLE_MODES; @@ -645,7 +593,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) uiRdModeList.push_back( mostProbableMode ); } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( nOptionsForISP > 1 ) { //we add the ISP MPMs to the list without mrl modes @@ -674,7 +621,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) } cu.ispMode = NOT_INTRA_SUBPARTITIONS; } -#endif } } else @@ -684,50 +630,8 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) uiRdModeList.push_back( i ); } } -#if !JVET_M0464_UNI_MTS - if( emtUsageFlag == 1 ) - { - // Store the modes to be checked with RD - m_savedNumRdModes[puIndex] = numModesForFullRD; - std::copy_n( uiRdModeList.begin(), numModesForFullRD, m_savedRdModeList[puIndex] ); - std::copy_n(extendRefList.begin(), numModesForFullRD, m_savedExtendRefList[puIndex]); - } -#endif - } -#if !JVET_M0464_UNI_MTS - else //emtUsage = 2 (here we potentially reduce the number of modes that will be full-RD checked) - { - if( isAllIntra && m_pcEncCfg->getFastIntraEMT() ) - { - double thresholdSkipMode = 1.0 + 1.4 / sqrt( ( double ) ( width*height ) ); - - numModesForFullRD = 0; - - // Skip checking the modes with much larger R-D cost than the best mode - for( int i = 0; i < m_savedNumRdModes[puIndex]; i++ ) - { - if( m_modeCostStore[puIndex][i] <= thresholdSkipMode * m_bestModeCostStore[puIndex] ) - { - uiRdModeList.push_back( m_savedRdModeList[puIndex][i] ); - extendRefList.push_back(m_savedExtendRefList[puIndex][i]); - numModesForFullRD++; - } - } - } - else //this is necessary because we skip the candidates list calculation, since it was already obtained for the DCT-II. Now we load it - { - // Restore the modes to be checked with RD - numModesForFullRD = m_savedNumRdModes[puIndex]; - uiRdModeList.resize( numModesForFullRD ); - std::copy_n( m_savedRdModeList[puIndex], m_savedNumRdModes[puIndex], uiRdModeList.begin() ); - CandCostList.resize(numModesForFullRD); - extendRefList.resize(numModesForFullRD); - std::copy_n(m_savedExtendRefList[puIndex], m_savedNumRdModes[puIndex], extendRefList.begin()); - } } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS if( nOptionsForISP > 1 ) // we remove the non-MPMs from the ISP lists { static_vector< uint32_t, FAST_UDI_MAX_RDMODE_NUM > uiRdModeListCopyHor = m_rdModeListWithoutMrlHor; @@ -763,7 +667,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) } cu.ispMode = NOT_INTRA_SUBPARTITIONS; } -#endif CHECK( numModesForFullRD != uiRdModeList.size(), "Inconsistent state!" ); @@ -771,35 +674,27 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) // after this point, don't use numModesForFullRD // PBINTRA fast -#if JVET_M0464_UNI_MTS if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && uiRdModeList.size() < numModesAvailable ) -#else - if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && uiRdModeList.size() < numModesAvailable && emtUsageFlag != 2 ) -#endif { if( CandHadList.size() < 3 || CandHadList[2] > cs.interHad * PBINTRA_RATIO ) { uiRdModeList.resize( std::min<size_t>( uiRdModeList.size(), 2 ) ); -#if JVET_M0102_INTRA_SUBPARTITIONS extendRefList.resize( std::min<size_t>( extendRefList.size(), 2 ) ); if( nOptionsForISP > 1 ) { m_rdModeListWithoutMrlHor.resize( std::min<size_t>( m_rdModeListWithoutMrlHor.size(), 2 ) ); m_rdModeListWithoutMrlVer.resize( std::min<size_t>( m_rdModeListWithoutMrlVer.size(), 2 ) ); } -#endif } if( CandHadList.size() < 2 || CandHadList[1] > cs.interHad * PBINTRA_RATIO ) { uiRdModeList.resize( std::min<size_t>( uiRdModeList.size(), 1 ) ); -#if JVET_M0102_INTRA_SUBPARTITIONS extendRefList.resize( std::min<size_t>( extendRefList.size(), 1 ) ); if( nOptionsForISP > 1 ) { m_rdModeListWithoutMrlHor.resize( std::min<size_t>( m_rdModeListWithoutMrlHor.size(), 1 ) ); m_rdModeListWithoutMrlVer.resize( std::min<size_t>( m_rdModeListWithoutMrlVer.size(), 1 ) ); } -#endif } if( CandHadList.size() < 1 || CandHadList[0] > cs.interHad * PBINTRA_RATIO ) { @@ -815,7 +710,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) } } -#if JVET_M0102_INTRA_SUBPARTITIONS && JVET_M0464_UNI_MTS if ( nOptionsForISP > 1 ) { //we create a single full RD list that includes all intra modes using regular intra, MRL and ISP @@ -852,7 +746,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) } } CHECKD(uiRdModeList.size() != extendRefList.size(),"uiRdModeList and extendRefList do not have the same size!"); -#endif //===== check modes (using r-d costs) ===== uint32_t uiBestPUMode = 0; @@ -868,12 +761,10 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) // just to be sure numModesForFullRD = ( int ) uiRdModeList.size(); -#if JVET_M0102_INTRA_SUBPARTITIONS PartSplit intraSubPartitionsProcOrder = TU_NO_ISP; int bestNormalIntraModeIndex = -1; uint8_t bestIspOption = NOT_INTRA_SUBPARTITIONS; TUIntraSubPartitioner subTuPartitioner( partitioner ); -#if JVET_M0464_UNI_MTS bool ispHorAllZeroCbfs = false, ispVerAllZeroCbfs = false; for (uint32_t uiMode = 0; uiMode < numModesForFullRD; uiMode++) @@ -882,21 +773,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) uint32_t uiOrgMode = uiRdModeList[uiMode]; cu.ispMode = extendRefList[uiMode] > MRL_NUM_REF_LINES ? extendRefList[uiMode] - MRL_NUM_REF_LINES : NOT_INTRA_SUBPARTITIONS; -#else - if ( !cu.ispMode && !cu.emtFlag ) - { - m_modeCtrl->setEmtFirstPassNoIspCost( MAX_DOUBLE ); - } - - for( uint32_t ispOptionIdx = 0; ispOptionIdx < nOptionsForISP; ispOptionIdx++ ) - { - cu.ispMode = ispOptions[ispOptionIdx]; - int numModesForFullRDispOption = cu.ispMode == NOT_INTRA_SUBPARTITIONS ? numModesForFullRD : cu.ispMode == HOR_INTRA_SUBPARTITIONS ? (int)m_rdModeListWithoutMrlHor.size() : (int)m_rdModeListWithoutMrlVer.size(); - for( uint32_t uiMode = 0; uiMode < numModesForFullRDispOption; uiMode++ ) - { - // set luma prediction mode - uint32_t uiOrgMode = cu.ispMode == NOT_INTRA_SUBPARTITIONS ? uiRdModeList[uiMode] : cu.ispMode == HOR_INTRA_SUBPARTITIONS ? m_rdModeListWithoutMrlHor[uiMode] : m_rdModeListWithoutMrlVer[uiMode]; -#endif pu.intraDir[0] = uiOrgMode; int multiRefIdx = 0; @@ -905,12 +781,10 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) { intraSubPartitionsProcOrder = CU::getISPType( cu, COMPONENT_Y ); bool tuIsDividedInRows = CU::divideTuInRows( cu ); -#if JVET_M0464_UNI_MTS if ( ( tuIsDividedInRows && ispHorAllZeroCbfs ) || ( !tuIsDividedInRows && ispVerAllZeroCbfs ) ) { continue; } -#endif if( m_intraModeDiagRatio.at( bestNormalIntraModeIndex ) > 1.25 ) { continue; @@ -926,17 +800,6 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) pu.multiRefIdx = multiRefIdx; CHECK( pu.multiRefIdx && ( pu.intraDir[0] == DC_IDX || pu.intraDir[0] == PLANAR_IDX ), "ERL" ); } -#else - for (uint32_t uiMode = 0; uiMode < numModesForFullRD; uiMode++) - { - // set luma prediction mode - uint32_t uiOrgMode = uiRdModeList[uiMode]; - - pu.intraDir[0] = uiOrgMode; - int multiRefIdx = extendRefList[uiMode]; - pu.multiRefIdx = multiRefIdx; - CHECK(pu.multiRefIdx && (pu.intraDir[0] == DC_IDX || pu.intraDir[0] == PLANAR_IDX), "ERL"); -#endif // set context models @@ -945,23 +808,17 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) // determine residual for partition cs.initSubStructure( *csTemp, partitioner.chType, cs.area, true ); -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode ) { xRecurIntraCodingLumaQT( *csTemp, subTuPartitioner, bestCurrentCost, 0, intraSubPartitionsProcOrder ); } else { -#if JVET_M0464_UNI_MTS xRecurIntraCodingLumaQT( *csTemp, partitioner, bestIspOption ? bestCurrentCost : MAX_DOUBLE, -1, TU_NO_ISP, bestIspOption ); -#else - xRecurIntraCodingLumaQT( *csTemp, partitioner, MAX_DOUBLE, -1 ); -#endif } if( cu.ispMode && !csTemp->cus[0]->firstTU->cbf[COMPONENT_Y] ) { -#if JVET_M0464_UNI_MTS if ( cu.ispMode == HOR_INTRA_SUBPARTITIONS ) { ispHorAllZeroCbfs |= ( m_pcEncCfg->getUseFastISP() && csTemp->tus[0]->lheight() > 2 && csTemp->cost >= bestCurrentCost ); @@ -970,27 +827,11 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) { ispVerAllZeroCbfs |= ( m_pcEncCfg->getUseFastISP() && csTemp->tus[0]->lwidth() > 2 && csTemp->cost >= bestCurrentCost ); } -#endif csTemp->cost = MAX_DOUBLE; -#if JVET_M0428_ENC_DB_OPT csTemp->costDbOffset = 0; -#endif } -#else - xRecurIntraCodingLumaQT( *csTemp, partitioner ); -#endif -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - if (emtUsageFlag == 1 && m_pcEncCfg->getFastIntraEMT() && !cu.ispMode) -#else - if( emtUsageFlag == 1 && m_pcEncCfg->getFastIntraEMT() ) -#endif - { - m_modeCostStore[puIndex][uiMode] = csTemp->cost; //cs.cost; - } -#endif DTRACE( g_trace_ctx, D_INTRA_COST, "IntraCost T %f (%d) \n", csTemp->cost, uiOrgMode ); @@ -1001,20 +842,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) uiBestPUMode = uiOrgMode; bestExtendRef = multiRefIdx; -#if JVET_M0102_INTRA_SUBPARTITIONS bestIspOption = cu.ispMode; -#endif -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - if (emtUsageFlag == 1 && m_pcEncCfg->getFastIntraEMT() && !cu.ispMode) -#else - if( ( emtUsageFlag == 1 ) && m_pcEncCfg->getFastIntraEMT() ) -#endif - { - m_bestModeCostStore[puIndex] = csBest->cost; //cs.cost; - } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS if( csBest->cost < bestCurrentCost ) { bestCurrentCost = csBest->cost; @@ -1023,27 +851,13 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) { bestNormalIntraModeIndex = uiMode; } -#endif } csTemp->releaseIntermediateData(); } // Mode loop -#if JVET_M0102_INTRA_SUBPARTITIONS -#if !JVET_M0464_UNI_MTS - if (!cu.ispMode && !cu.emtFlag) - { - m_modeCtrl->setEmtFirstPassNoIspCost(csBest->cost); - } - } -#endif cu.ispMode = bestIspOption; -#endif -#if JVET_M0427_INLOOP_RESHAPER cs.useSubStructure(*csBest, partitioner.chType, pu.singleChan(CHANNEL_TYPE_LUMA), true, true, keepResi, keepResi); -#else - cs.useSubStructure( *csBest, partitioner.chType, pu.singleChan( CHANNEL_TYPE_LUMA ), KEEP_PRED_AND_RESI_SIGNALS, true, keepResi, keepResi ); -#endif csBest->releaseIntermediateData(); //=== update PU data ==== pu.intraDir[0] = uiBestPUMode; @@ -1054,11 +868,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) m_CABACEstimator->getCtx() = ctxStart; } -#if JVET_M0102_INTRA_SUBPARTITIONS void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner, const double maxCostAllowed ) -#else -void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) -#endif { const ChromaFormat format = cu.chromaFormat; const uint32_t numberValidComponents = getNumberValidComponents(format); @@ -1067,12 +877,10 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) cs.setDecomp( cs.area.Cb(), false ); -#if JVET_M0102_INTRA_SUBPARTITIONS double bestCostSoFar = maxCostAllowed; bool lumaUsesISP = !CS::isDualITree( *cu.cs ) && cu.ispMode; PartSplit ispType = lumaUsesISP ? CU::getISPType( cu, COMPONENT_Y ) : TU_NO_ISP; CHECK( cu.ispMode && bestCostSoFar < 0, "bestCostSoFar must be positive!" ); -#endif auto &pu = *cu.firstPU; @@ -1097,13 +905,11 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) saveCS.area.repositionTo( cs.area ); saveCS.clearTUs(); -#if JVET_M0102_INTRA_SUBPARTITIONS if( !CS::isDualITree( cs ) && cu.ispMode ) { saveCS.clearCUs(); saveCS.clearPUs(); } -#endif if( CS::isDualITree( cs ) ) { @@ -1124,7 +930,6 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) std::vector<TransformUnit*> orgTUs; -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP ) { CodingUnit& auxCU = saveCS.addCU( cu, partitioner.chType ); @@ -1132,29 +937,22 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) saveCS.sps = cu.cs->sps; saveCS.addPU( *cu.firstPU, partitioner.chType ); } -#endif // create a store for the TUs for( const auto &ptu : cs.tus ) { // for split TUs in HEVC, add the TUs without Chroma parts for correct setting of Cbfs -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP || pu.contains( *ptu, CHANNEL_TYPE_CHROMA ) ) -#else - if( pu.contains( *ptu, CHANNEL_TYPE_CHROMA ) ) -#endif { saveCS.addTU( *ptu, partitioner.chType ); orgTUs.push_back( ptu ); } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP ) { saveCS.clearCUs(); } -#endif // SATD pre-selecting. int satdModeList[NUM_CHROMA_MODE]; int64_t satdSortedCost[NUM_CHROMA_MODE]; @@ -1278,38 +1076,28 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) //----- chroma coding ----- pu.intraDir[1] = chromaIntraMode; -#if JVET_M0102_INTRA_SUBPARTITIONS xRecurIntraChromaCodingQT( cs, partitioner, bestCostSoFar, ispType ); if( lumaUsesISP && cs.dist == MAX_UINT ) { continue; } -#else - xRecurIntraChromaCodingQT( cs, partitioner ); -#endif if (cs.pps->getUseTransformSkip()) { m_CABACEstimator->getCtx() = ctxStart; } -#if JVET_M0102_INTRA_SUBPARTITIONS uint64_t fracBits = xGetIntraFracBitsQT( cs, partitioner, false, true, -1, ispType ); -#else - uint64_t fracBits = xGetIntraFracBitsQT( cs, partitioner, false, true ); -#endif Distortion uiDist = cs.dist; double dCost = m_pcRdCost->calcRdCost( fracBits, uiDist - baseDist ); //----- compare ----- if( dCost < dBestCost ) { -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP && dCost < bestCostSoFar ) { bestCostSoFar = dCost; } -#endif for( uint32_t i = getFirstComponentOfChannel( CHANNEL_TYPE_CHROMA ); i < numberValidComponents; i++ ) { const CompArea &area = pu.blocks[i]; @@ -1319,10 +1107,8 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) saveCS.getPredBuf ( area ).copyFrom( cs.getPredBuf ( area ) ); saveCS.getResiBuf ( area ).copyFrom( cs.getResiBuf ( area ) ); #endif -#if JVET_M0427_INLOOP_RESHAPER saveCS.getPredBuf ( area ).copyFrom( cs.getPredBuf (area ) ); cs.picture->getPredBuf( area ).copyFrom( cs.getPredBuf (area ) ); -#endif cs.picture->getRecoBuf( area ).copyFrom( cs.getRecoBuf( area ) ); for( uint32_t j = 0; j < saveCS.tus.size(); j++ ) @@ -1346,10 +1132,8 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) cs.getPredBuf ( area ).copyFrom( saveCS.getPredBuf( area ) ); cs.getResiBuf ( area ).copyFrom( saveCS.getResiBuf( area ) ); #endif -#if JVET_M0427_INLOOP_RESHAPER cs.getPredBuf ( area ).copyFrom( saveCS.getPredBuf( area ) ); cs.picture->getPredBuf( area ).copyFrom( cs.getPredBuf ( area ) ); -#endif cs.picture->getRecoBuf( area ).copyFrom( cs. getRecoBuf( area ) ); @@ -1366,12 +1150,10 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) //----- restore context models ----- m_CABACEstimator->getCtx() = ctxStart; -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP && bestCostSoFar >= maxCostAllowed ) { cu.ispMode = 0; } -#endif } void IntraSearch::IPCMSearch(CodingStructure &cs, Partitioner& partitioner) @@ -1393,9 +1175,7 @@ void IntraSearch::IPCMSearch(CodingStructure &cs, Partitioner& partitioner) cs.cost = 0; cs.setDecomp(cs.area); -#if JVET_M0427_INLOOP_RESHAPER cs.picture->getPredBuf(cs.area).copyFrom(cs.getPredBuf()); -#endif } void IntraSearch::xEncPCM(CodingStructure &cs, Partitioner& partitioner, const ComponentID &compID) @@ -1413,7 +1193,6 @@ void IntraSearch::xEncPCM(CodingStructure &cs, Partitioner& partitioner, const C CPelBuf orgBuf = cs.getOrgBuf ( area ); CHECK(pcmShiftRight < 0, "Negative shift"); -#if JVET_M0427_INLOOP_RESHAPER CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tempOrgBuf = m_tmpStorageLCU.getBuf(tmpArea); tempOrgBuf.copyFrom(orgBuf); @@ -1421,17 +1200,12 @@ void IntraSearch::xEncPCM(CodingStructure &cs, Partitioner& partitioner, const C { tempOrgBuf.rspSignal(m_pcReshape->getFwdLUT()); } -#endif for (uint32_t uiY = 0; uiY < pcmBuf.height; uiY++) { for (uint32_t uiX = 0; uiX < pcmBuf.width; uiX++) { // Encode -#if JVET_M0427_INLOOP_RESHAPER pcmBuf.at(uiX, uiY) = tempOrgBuf.at(uiX, uiY) >> pcmShiftRight; -#else - pcmBuf.at(uiX, uiY) = orgBuf.at(uiX, uiY) >> pcmShiftRight; -#endif // Reconstruction recBuf.at(uiX, uiY) = pcmBuf.at(uiX, uiY) << pcmShiftRight; } @@ -1442,30 +1216,18 @@ void IntraSearch::xEncPCM(CodingStructure &cs, Partitioner& partitioner, const C // Intra search // ------------------------------------------------------------------------------------------------------------------- -#if JVET_M0102_INTRA_SUBPARTITIONS void IntraSearch::xEncIntraHeader( CodingStructure &cs, Partitioner &partitioner, const bool &bLuma, const bool &bChroma, const int subTuIdx ) -#else -void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, const bool &bLuma, const bool &bChroma) -#endif { CodingUnit &cu = *cs.getCU( partitioner.chType ); if (bLuma) { -#if JVET_M0102_INTRA_SUBPARTITIONS bool isFirst = cu.ispMode ? subTuIdx == 0 : partitioner.currArea().lumaPos() == cs.area.lumaPos(); -#else - bool isFirst = partitioner.currArea().lumaPos() == cs.area.lumaPos(); -#endif // CU header if( isFirst ) { -#if JVET_M0483_IBC if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) -#else - if( !cs.slice->isIntra() -#endif && cu.Y().valid() ) { @@ -1485,9 +1247,7 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, } } m_CABACEstimator->extend_ref_line(cu); -#if JVET_M0102_INTRA_SUBPARTITIONS m_CABACEstimator->isp_mode ( cu ); -#endif } PredictionUnit &pu = *cs.getPU(partitioner.currArea().lumaPos(), partitioner.chType); @@ -1514,29 +1274,17 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, } } -#if JVET_M0102_INTRA_SUBPARTITIONS void IntraSearch::xEncSubdivCbfQT( CodingStructure &cs, Partitioner &partitioner, const bool &bLuma, const bool &bChroma, const int subTuIdx, const PartSplit ispType ) { const UnitArea &currArea = partitioner.currArea(); int subTuCounter = subTuIdx; TransformUnit &currTU = *cs.getTU( currArea.blocks[partitioner.chType], partitioner.chType, subTuCounter ); CodingUnit &currCU = *currTU.cu; -#else -void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner, const bool &bLuma, const bool &bChroma) -{ - const UnitArea &currArea = partitioner.currArea(); - TransformUnit &currTU = *cs.getTU( currArea.blocks[partitioner.chType], partitioner.chType ); -#if !JVET_M0464_UNI_MTS - CodingUnit &currCU = *currTU.cu; -#endif -#endif uint32_t currDepth = partitioner.currTrDepth; const bool subdiv = currTU.depth > currDepth; -#if JVET_M0102_INTRA_SUBPARTITIONS ComponentID compID = partitioner.chType == CHANNEL_TYPE_LUMA ? COMPONENT_Y : COMPONENT_Cb; const bool chromaCbfISP = currArea.blocks[COMPONENT_Cb].valid() && currCU.ispMode && !subdiv; -#endif if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { @@ -1544,39 +1292,22 @@ void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner, } else { -#if JVET_M0102_INTRA_SUBPARTITIONS CHECK( subdiv && !currCU.ispMode && isLuma( compID ), "No TU subdivision is allowed with QTBT" ); } if( bChroma && ( !currCU.ispMode || chromaCbfISP ) ) -#else - CHECK( subdiv, "No TU subdivision is allowed with QTBT" ); - } - - if (bChroma) -#endif { const uint32_t numberValidComponents = getNumberValidComponents(currArea.chromaFormat); -#if JVET_M0102_INTRA_SUBPARTITIONS const uint32_t cbfDepth = ( chromaCbfISP ? currDepth - 1 : currDepth ); -#endif for (uint32_t ch = COMPONENT_Cb; ch < numberValidComponents; ch++) { const ComponentID compID = ComponentID(ch); -#if JVET_M0102_INTRA_SUBPARTITIONS if( currDepth == 0 || TU::getCbfAtDepth( currTU, compID, currDepth - 1 ) || chromaCbfISP ) -#else - if( currDepth == 0 || TU::getCbfAtDepth( currTU, compID, currDepth - 1 ) ) -#endif { const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ) : false ); -#if JVET_M0102_INTRA_SUBPARTITIONS m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, currDepth ), currArea.blocks[compID], cbfDepth, prevCbf ); -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, currDepth ), currArea.blocks[compID], currDepth, prevCbf ); -#endif } } @@ -1584,52 +1315,31 @@ void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner, if (subdiv) { -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - if (!currCU.ispMode && isLuma( compID ) && currDepth == 0 && bLuma) m_CABACEstimator->emt_cu_flag( currCU ); -#else - if( currDepth == 0 && bLuma ) m_CABACEstimator->emt_cu_flag( currCU ); -#endif -#endif if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( currCU.ispMode && isLuma( compID ) ) { partitioner.splitCurrArea( ispType, cs ); } -#endif else THROW( "Cannot perform an implicit split!" ); do { -#if JVET_M0102_INTRA_SUBPARTITIONS xEncSubdivCbfQT( cs, partitioner, bLuma, bChroma, subTuCounter, ispType ); subTuCounter += subTuCounter != -1 ? 1 : 0; -#else - xEncSubdivCbfQT( cs, partitioner, bLuma, bChroma ); -#endif } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); } else { -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - if (!currCU.ispMode && isLuma( compID ) && currDepth == 0 && bLuma && TU::getCbfAtDepth( currTU, COMPONENT_Y, 0) ) m_CABACEstimator->emt_cu_flag( currCU ); -#else - if( currDepth == 0 && bLuma && TU::getCbfAtDepth( currTU, COMPONENT_Y, 0 ) ) m_CABACEstimator->emt_cu_flag( currCU ); -#endif -#endif //===== Cbfs ===== if (bLuma) { -#if JVET_M0102_INTRA_SUBPARTITIONS bool previousCbf = false; bool lastCbfIsInferred = false; if( ispType != TU_NO_ISP ) @@ -1658,27 +1368,16 @@ void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner, { m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, COMPONENT_Y, currDepth ), currTU.Y(), currTU.depth, previousCbf, currCU.ispMode ); } -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, COMPONENT_Y, currDepth ), currTU.Y(), currTU.depth ); -#endif } } } -#if JVET_M0102_INTRA_SUBPARTITIONS void IntraSearch::xEncCoeffQT( CodingStructure &cs, Partitioner &partitioner, const ComponentID compID, const int subTuIdx, const PartSplit ispType ) -#else -void IntraSearch::xEncCoeffQT(CodingStructure &cs, Partitioner &partitioner, const ComponentID &compID) -#endif { const UnitArea &currArea = partitioner.currArea(); -#if JVET_M0102_INTRA_SUBPARTITIONS int subTuCounter = subTuIdx; TransformUnit &currTU = *cs.getTU( currArea.blocks[partitioner.chType], partitioner.chType, subTuIdx ); -#else - TransformUnit &currTU = *cs.getTU( currArea.blocks[partitioner.chType], partitioner.chType ); -#endif uint32_t currDepth = partitioner.currTrDepth; const bool subdiv = currTU.depth > currDepth; @@ -1688,23 +1387,17 @@ void IntraSearch::xEncCoeffQT(CodingStructure &cs, Partitioner &partitioner, con { partitioner.splitCurrArea(TU_MAX_TR_SPLIT, cs); } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( currTU.cu->ispMode ) { partitioner.splitCurrArea( ispType, cs ); } -#endif else THROW("Implicit TU split not available!"); do { -#if JVET_M0102_INTRA_SUBPARTITIONS xEncCoeffQT( cs, partitioner, compID, subTuCounter, ispType ); subTuCounter += subTuCounter != -1 ? 1 : 0; -#else - xEncCoeffQT( cs, partitioner, compID ); -#endif } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); @@ -1724,47 +1417,28 @@ void IntraSearch::xEncCoeffQT(CodingStructure &cs, Partitioner &partitioner, con } } -#if JVET_M0102_INTRA_SUBPARTITIONS uint64_t IntraSearch::xGetIntraFracBitsQT( CodingStructure &cs, Partitioner &partitioner, const bool &bLuma, const bool &bChroma, const int subTuIdx, const PartSplit ispType ) -#else -uint64_t IntraSearch::xGetIntraFracBitsQT( CodingStructure &cs, Partitioner &partitioner, const bool &bLuma, const bool &bChroma ) -#endif { m_CABACEstimator->resetBits(); -#if JVET_M0102_INTRA_SUBPARTITIONS xEncIntraHeader( cs, partitioner, bLuma, bChroma, subTuIdx ); xEncSubdivCbfQT( cs, partitioner, bLuma, bChroma, subTuIdx, ispType ); -#else - xEncIntraHeader( cs, partitioner, bLuma, bChroma ); - xEncSubdivCbfQT( cs, partitioner, bLuma, bChroma ); -#endif if( bLuma ) { -#if JVET_M0102_INTRA_SUBPARTITIONS xEncCoeffQT( cs, partitioner, COMPONENT_Y, subTuIdx, ispType ); -#else - xEncCoeffQT( cs, partitioner, COMPONENT_Y ); -#endif } if( bChroma ) { -#if JVET_M0102_INTRA_SUBPARTITIONS xEncCoeffQT( cs, partitioner, COMPONENT_Cb, subTuIdx, ispType ); xEncCoeffQT( cs, partitioner, COMPONENT_Cr, subTuIdx, ispType ); -#else - xEncCoeffQT( cs, partitioner, COMPONENT_Cb ); - xEncCoeffQT( cs, partitioner, COMPONENT_Cr ); -#endif } uint64_t fracBits = m_CABACEstimator->getEstFracBits(); return fracBits; } -#if JVET_M0102_INTRA_SUBPARTITIONS uint64_t IntraSearch::xGetIntraFracBitsQTSingleChromaComponent( CodingStructure &cs, Partitioner &partitioner, const ComponentID compID ) { m_CABACEstimator->resetBits(); @@ -1796,7 +1470,6 @@ uint64_t IntraSearch::xGetIntraFracBitsQTSingleChromaComponent( CodingStructure uint64_t fracBits = m_CABACEstimator->getEstFracBits(); return fracBits; } -#endif uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const ComponentID &compID) { @@ -1815,11 +1488,7 @@ uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const Com return fracBits; } -#if JVET_M0464_UNI_MTS void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &compID, const bool &checkCrossCPrediction, Distortion& ruiDist, const int &default0Save1Load2, uint32_t* numSig, std::vector<TrMode>* trModes, const bool loadTr) -#else -void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &compID, const bool &checkCrossCPrediction, Distortion& ruiDist, const int &default0Save1Load2, uint32_t* numSig ) -#endif { if (!tu.blocks[compID].valid()) { @@ -1846,9 +1515,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp const bool bUseCrossCPrediction = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma( compID ) && PU::isChromaIntraModeCrossCheckMode( pu ) && checkCrossCPrediction; const bool ccUseRecoResi = m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate(); -#if JVET_M0102_INTRA_SUBPARTITIONS const bool ispSplitIsAllowed = CU::canUseISPSplit( *tu.cu, compID ); -#endif //===== init availability pattern ===== @@ -1888,13 +1555,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp DTRACE( g_trace_ctx, D_PRED, "@(%4d,%4d) [%2dx%2d] IMode=%d\n", tu.lx(), tu.ly(), tu.lwidth(), tu.lheight(), uiChFinalMode ); //DTRACE_PEL_BUF( D_PRED, piPred, tu, tu.cu->predMode, COMPONENT_Y ); -#if JVET_M0427_INLOOP_RESHAPER const Slice &slice = *cs.slice; -#if JVET_M0483_IBC bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#else - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())); -#endif if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && isChroma(compID)) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); @@ -1905,10 +1567,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp int adj = m_pcReshape->calculateChromaAdj(avgLuma); tu.setChromaAdj(adj); } -#endif //===== get residual signal ===== piResi.copyFrom( piOrg ); -#if JVET_M0427_INLOOP_RESHAPER if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && compID==COMPONENT_Y) { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); @@ -1918,7 +1578,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp piResi.subtract(tmpPred); } else -#endif piResi.subtract( piPred ); if (pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isLuma(compID)) @@ -1946,7 +1605,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp m_pcTrQuant->selectLambda(compID); #endif -#if JVET_M0427_INLOOP_RESHAPER flag =flag && (tu.blocks[compID].width*tu.blocks[compID].height > 4); if (flag && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj() ) { @@ -1955,48 +1613,23 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cResScale*cResScale)); piResi.scaleSignal(cResScaleInv, 1, tu.cu->cs->slice->clpRng(compID)); } -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS double diagRatio = 0, horVerRatio = 0; -#endif -#if JVET_M0464_UNI_MTS if( trModes ) { -#if JVET_M0102_INTRA_SUBPARTITIONS m_pcTrQuant->transformNxN( tu, compID, cQP, trModes, CU::isIntra( *tu.cu ) ? m_pcEncCfg->getIntraMTSMaxCand() : m_pcEncCfg->getInterMTSMaxCand(), ispSplitIsAllowed ? &diagRatio : nullptr, ispSplitIsAllowed ? &horVerRatio : nullptr ); -#else - m_pcTrQuant->transformNxN( tu, compID, cQP, trModes, CU::isIntra( *tu.cu ) ? m_pcEncCfg->getIntraMTSMaxCand() : m_pcEncCfg->getInterMTSMaxCand() ); -#endif tu.mtsIdx = trModes->at(0).first; } -#if JVET_M0102_INTRA_SUBPARTITIONS m_pcTrQuant->transformNxN( tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr, &diagRatio, &horVerRatio ); -#else - m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); -#endif -#else -#if JVET_M0102_INTRA_SUBPARTITIONS - m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), ispSplitIsAllowed ? &diagRatio : nullptr, ispSplitIsAllowed ? &horVerRatio : nullptr); -#else - m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx()); -#endif -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS if (!tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && -#if JVET_M0464_UNI_MTS tu.mtsIdx == 0 -#else - !tu.cu->emtFlag -#endif ) { m_intraModeDiagRatio .push_back(diagRatio); m_intraModeHorVerRatio .push_back(horVerRatio); m_intraModeTestedNormalIntra.push_back((int)uiChFinalMode); } -#endif DTRACE( g_trace_ctx, D_TU_ABS_SUM, "%d: comp=%d, abssum=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_TU_ABS_SUM ), compID, uiAbsSum ); @@ -2013,18 +1646,15 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } //===== reconstruction ===== -#if JVET_M0427_INLOOP_RESHAPER if (flag && uiAbsSum > 0 && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj() ) { piResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); } -#endif if (bUseCrossCPrediction) { CrossComponentPrediction::crossComponentPrediction(tu, compID, cs.getResiBuf(tu.Y()), piResi, piResi, true); } -#if JVET_M0427_INLOOP_RESHAPER if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) { CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0,0), area.size()); @@ -2033,20 +1663,14 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp piReco.reconstruct(tmpPred, piResi, cs.slice->clpRng(compID)); } else -#endif piReco.reconstruct(piPred, piResi, cs.slice->clpRng( compID )); //===== update distortion ===== #if WCG_EXT -#if JVET_M0427_INLOOP_RESHAPER if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getReshaper() && slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) -#else - if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) -#endif { const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); -#if JVET_M0427_INLOOP_RESHAPER if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) { CompArea tmpArea1(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); @@ -2056,7 +1680,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp ruiDist += m_pcRdCost->getDistPart(piOrg, tmpRecLuma, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE_WTD, &orgLuma); } else -#endif ruiDist += m_pcRdCost->getDistPart(piOrg, piReco, bitDepth, compID, DF_SSE_WTD, &orgLuma); } else @@ -2066,25 +1689,12 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } } -#if JVET_M0102_INTRA_SUBPARTITIONS -#if JVET_M0464_UNI_MTS void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &partitioner, const double bestCostSoFar, const int subTuIdx, const PartSplit ispType, const bool ispIsCurrentWinnder ) -#else -void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &partitioner, const double bestCostSoFar, const int subTuIdx, const PartSplit ispType ) -#endif { int subTuCounter = subTuIdx; const UnitArea &currArea = partitioner.currArea(); const CodingUnit &cu = *cs.getCU( currArea.lumaPos(), partitioner.chType ); bool earlySkipISP = false; -#else -void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &partitioner ) -{ - const UnitArea &currArea = partitioner.currArea(); -#if !JVET_M0464_UNI_MTS - const CodingUnit &cu = *cs.getCU(currArea.lumaPos(), partitioner.chType); -#endif -#endif uint32_t currDepth = partitioner.currTrDepth; const PPS &pps = *cs.pps; const bool keepResi = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() || KEEP_PRED_AND_RESI_SIGNALS; @@ -2093,33 +1703,17 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); bCheckSplit = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode ) { bCheckSplit = partitioner.canSplit( ispType, cs ); bCheckFull = !bCheckSplit; } -#endif uint32_t numSig = 0; -#if JVET_M0464_UNI_MTS double dSingleCost = MAX_DOUBLE; Distortion uiSingleDistLuma = 0; uint64_t singleFracBits = 0; int bestModeId[MAX_NUM_COMPONENT] = { 0, 0, 0 }; -#else - bool checkInitTrDepth = false, checkInitTrDepthTransformSkipWinner = false; - - double dSingleCost = MAX_DOUBLE; - Distortion uiSingleDistLuma = 0; - uint64_t singleFracBits = 0; - bool checkTransformSkip = pps.getUseTransformSkip(); - int bestModeId[MAX_NUM_COMPONENT] = {0, 0, 0}; - uint8_t nNumTransformCands = cu.emtFlag ? 4 : 1; //4 is the number of transforms of emt - bool isAllIntra = m_pcEncCfg->getIntraPeriod() == 1; - - uint8_t numTransformIndexCands = nNumTransformCands; -#endif const TempCtx ctxStart ( m_CtxCache, m_CABACEstimator->getCtx() ); TempCtx ctxBest ( m_CtxCache ); @@ -2143,7 +1737,6 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par TransformUnit &tu = csFull->addTU( CS::getArea( *csFull, currArea, partitioner.chType ), partitioner.chType ); tu.depth = currDepth; -#if JVET_M0464_UNI_MTS const bool tsAllowed = TU::isTSAllowed ( tu, COMPONENT_Y ); const bool mtsAllowed = TU::isMTSAllowed( tu, COMPONENT_Y ); uint8_t nNumTransformCands = 1 + ( tsAllowed ? 1 : 0 ) + ( mtsAllowed ? 4 : 0 ); // DCT + TS + 4 MTS = 6 tests @@ -2162,22 +1755,6 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } CHECK( !tu.Y().valid(), "Invalid TU" ); -#else - checkTransformSkip &= TU::hasTransformSkipFlag( *tu.cs, tu.Y() ); - checkTransformSkip &= !cu.transQuantBypass; - checkTransformSkip &= !cu.emtFlag; -#if JVET_M0102_INTRA_SUBPARTITIONS - checkTransformSkip &= !cu.ispMode; -#endif - - CHECK( !tu.Y().valid(), "Invalid TU" ); - - //this prevents transformSkip from being checked because we already know it's not the best mode - checkTransformSkip = ( checkInitTrDepth && !checkInitTrDepthTransformSkipWinner ) ? false : checkTransformSkip; - - - CHECK( checkInitTrDepthTransformSkipWinner && !checkTransformSkip, "Transform Skip must be enabled if it was the winner in the previous call of xRecurIntraCodingLumaQT!" ); -#endif CodingStructure &saveCS = *m_pSaveCS[0]; @@ -2188,14 +1765,8 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par double singleCostTmp = 0; int firstCheckId = 0; -#if JVET_M0464_UNI_MTS int lastCheckId = trModes[nNumTransformCands-1].first; bool isNotOnlyOneMode = nNumTransformCands != 1; -#else - //we add the EMT candidates to the loop. TransformSkip will still be the last one to be checked (when modeId == lastCheckId) as long as checkTransformSkip is true - int lastCheckId = numTransformIndexCands - ( firstCheckId + 1 ) + ( int ) checkTransformSkip; - bool isNotOnlyOneMode = lastCheckId != firstCheckId && !checkInitTrDepthTransformSkipWinner; -#endif if( isNotOnlyOneMode ) { @@ -2206,17 +1777,10 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par tmpTU = &saveCS.addTU(currArea, partitioner.chType); } -#if JVET_M0464_UNI_MTS bool cbfDCT2 = true; -#else - bool cbfBestMode = false; -#endif -#if JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS double bestDCT2cost = MAX_DOUBLE; double threshold = m_pcEncCfg->getUseFastISP() && !cu.ispMode && ispIsCurrentWinnder && nNumTransformCands > 1 ? 1 + 1.4 / sqrt( cu.lwidth() * cu.lheight() ) : 1; -#endif for( int modeId = firstCheckId; modeId < nNumTransformCands; modeId++ ) { if( !cbfDCT2 || ( m_pcEncCfg->getUseTransformSkipFast() && bestModeId[COMPONENT_Y] == 1 ) ) @@ -2227,38 +1791,12 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { continue; } -#if JVET_M0102_INTRA_SUBPARTITIONS //we compare the DCT-II cost against the best ISP cost so far (except for TS) if ( m_pcEncCfg->getUseFastISP() && !cu.ispMode && ispIsCurrentWinnder && trModes[modeId].first != 0 && ( trModes[modeId].first != 1 || !tsAllowed ) && bestDCT2cost > bestCostSoFar * threshold ) { continue; } -#endif tu.mtsIdx = trModes[modeId].first; -#else - for( int modeId = firstCheckId; modeId <= lastCheckId; modeId++ ) - { - if( checkInitTrDepthTransformSkipWinner ) - { - //If this is a full RQT call and the winner of the first call (checkFirst=true) was transformSkip, then we skip the first iteration of the loop, since transform skip always comes at the end - if( modeId == firstCheckId ) - { - continue; - } - } - - uint8_t transformIndex = modeId; - - - if( ( transformIndex < lastCheckId ) || ( ( transformIndex == lastCheckId ) && !checkTransformSkip ) ) //we avoid this if the mode is transformSkip - { - // Skip checking other transform candidates if zero CBF is encountered and it is the best transform so far - if( m_pcEncCfg->getFastIntraEMT() && isAllIntra && transformIndex && !cbfBestMode ) - { - continue; - } - } -#endif if ((modeId != firstCheckId) && isNotOnlyOneMode) { @@ -2268,11 +1806,7 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par int default0Save1Load2 = 0; singleDistTmpLuma = 0; -#if JVET_M0464_UNI_MTS if( modeId == firstCheckId && nNumTransformCands > 1 ) -#else - if (modeId == firstCheckId && modeId != lastCheckId && !checkInitTrDepthTransformSkipWinner ) -#endif { default0Save1Load2 = 1; } @@ -2280,13 +1814,10 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { default0Save1Load2 = 2; } -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode ) { default0Save1Load2 = 0; } -#endif -#if JVET_M0464_UNI_MTS if( nNumTransformCands > 1 ) { xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig, modeId == 0 ? &trModes : nullptr, true ); @@ -2305,37 +1836,15 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig ); } -#else - if (cu.emtFlag) - { - tu.emtIdx = transformIndex; - } - if( !checkTransformSkip ) - { - tu.transformSkip[COMPONENT_Y] = false; - } - else - { - tu.transformSkip[COMPONENT_Y] = modeId == lastCheckId; - } - - xIntraCodingTUBlock( tu, COMPONENT_Y, false, singleDistTmpLuma, default0Save1Load2, &numSig ); -#endif //----- determine rate and r-d cost ----- -#if JVET_M0464_UNI_MTS if( ( trModes[modeId].first != 0 && !TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ) ) ) -#else - //the condition (transformIndex != DCT2_EMT) seems to be irrelevant, since DCT2_EMT=7 and the highest value of transformIndex is 4 - if( ( modeId == lastCheckId && checkTransformSkip && !TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ) ) ) -#endif { //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. singleCostTmp = MAX_DOUBLE; } else { -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode && m_pcRdCost->calcRdCost( csFull->fracBits, csFull->dist + singleDistTmpLuma ) > bestCostSoFar ) { earlySkipISP = true; @@ -2344,18 +1853,13 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { singleTmpFracBits = xGetIntraFracBitsQT( *csFull, partitioner, true, false, subTuCounter, ispType ); } -#else - singleTmpFracBits = xGetIntraFracBitsQT( *csFull, partitioner, true, false ); -#endif singleCostTmp = m_pcRdCost->calcRdCost( singleTmpFracBits, singleDistTmpLuma ); } -#if JVET_M0102_INTRA_SUBPARTITIONS && JVET_M0464_UNI_MTS if ( !cu.ispMode && nNumTransformCands > 1 && modeId == firstCheckId ) { bestDCT2cost = singleCostTmp; } -#endif if (singleCostTmp < dSingleCost) { @@ -2363,22 +1867,15 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par uiSingleDistLuma = singleDistTmpLuma; singleFracBits = singleTmpFracBits; -#if JVET_M0464_UNI_MTS bestModeId[COMPONENT_Y] = trModes[modeId].first; if( trModes[modeId].first == 0 ) { cbfDCT2 = TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ); } -#else - bestModeId[COMPONENT_Y] = modeId; - cbfBestMode = TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ); -#endif if( bestModeId[COMPONENT_Y] != lastCheckId ) { -#if KEEP_PRED_AND_RESI_SIGNALS || JVET_M0427_INLOOP_RESHAPER saveCS.getPredBuf( tu.Y() ).copyFrom( csFull->getPredBuf( tu.Y() ) ); -#endif saveCS.getRecoBuf( tu.Y() ).copyFrom( csFull->getRecoBuf( tu.Y() ) ); if( keepResi ) @@ -2396,9 +1893,7 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par if( bestModeId[COMPONENT_Y] != lastCheckId ) { -#if KEEP_PRED_AND_RESI_SIGNALS || JVET_M0427_INLOOP_RESHAPER csFull->getPredBuf( tu.Y() ).copyFrom( saveCS.getPredBuf( tu.Y() ) ); -#endif csFull->getRecoBuf( tu.Y() ).copyFrom( saveCS.getRecoBuf( tu.Y() ) ); if( keepResi ) @@ -2441,22 +1936,15 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode ) { partitioner.splitCurrArea( ispType, *csSplit ); } -#endif do { -#if JVET_M0102_INTRA_SUBPARTITIONS xRecurIntraCodingLumaQT( *csSplit, partitioner, bestCostSoFar, subTuCounter, ispType ); subTuCounter += subTuCounter != -1 ? 1 : 0; -#else - xRecurIntraCodingLumaQT( *csSplit, partitioner ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS if( !cu.ispMode ) { csSplit->setDecomp( partitioner.currArea().Y() ); @@ -2465,11 +1953,7 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { csSplit->setDecomp( cu.Y() ); } -#else - csSplit->setDecomp( partitioner.currArea().Y() ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS uiSplitCbfLuma |= TU::getCbfAtDepth( *csSplit->getTU( partitioner.currArea().lumaPos(), partitioner.chType, subTuCounter - 1 ), COMPONENT_Y, partitioner.currTrDepth ); if( cu.ispMode ) { @@ -2494,9 +1978,6 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } } } -#else - uiSplitCbfLuma |= TU::getCbfAtDepth( *csSplit->getTU( partitioner.currArea().lumaPos(), partitioner.chType ), COMPONENT_Y, partitioner.currTrDepth ); -#endif @@ -2518,11 +1999,7 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par m_CABACEstimator->getCtx() = ctxStart; //----- determine rate and r-d cost ----- -#if JVET_M0102_INTRA_SUBPARTITIONS csSplit->fracBits = xGetIntraFracBitsQT( *csSplit, partitioner, true, false, cu.ispMode ? 0 : -1, ispType ); -#else - csSplit->fracBits = xGetIntraFracBitsQT(*csSplit, partitioner, true, false); -#endif //--- update cost --- csSplit->cost = m_pcRdCost->calcRdCost(csSplit->fracBits, csSplit->dist); @@ -2534,12 +2011,9 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { // otherwise this would've happened in useSubStructure cs.picture->getRecoBuf( currArea.Y() ).copyFrom( cs.getRecoBuf( currArea.Y() ) ); -#if JVET_M0427_INLOOP_RESHAPER cs.picture->getPredBuf( currArea.Y() ).copyFrom( cs.getPredBuf( currArea.Y() ) ); -#endif } -#if JVET_M0102_INTRA_SUBPARTITIONS if( cu.ispMode && earlySkipISP ) { cs.cost = MAX_DOUBLE; @@ -2548,17 +2022,10 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { cs.cost = m_pcRdCost->calcRdCost( cs.fracBits, cs.dist ); } -#else - cs.cost = m_pcRdCost->calcRdCost( cs.fracBits, cs.dist ); -#endif } } -#if JVET_M0102_INTRA_SUBPARTITIONS ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitioner& partitioner, const double bestCostSoFar, const PartSplit ispType ) -#else -ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partitioner& partitioner) -#endif { UnitArea currArea = partitioner.currArea(); const bool keepResi = cs.sps->getUseLMChroma() || KEEP_PRED_AND_RESI_SIGNALS; @@ -2567,17 +2034,8 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition TransformUnit &currTU = *cs.getTU( currArea.chromaPos(), CHANNEL_TYPE_CHROMA ); const PredictionUnit &pu = *cs.getPU( currArea.chromaPos(), CHANNEL_TYPE_CHROMA ); -#if !JVET_M0464_UNI_MTS -#if JVET_M0102_INTRA_SUBPARTITIONS - const TransformUnit &currTULuma = CS::isDualITree( cs ) ? *cs.picture->cs->getTU(currArea.lumaPos(), CHANNEL_TYPE_LUMA, 0 ) : currTU; -#else - const TransformUnit &currTULuma = CS::isDualITree( cs ) ? *cs.picture->cs->getTU( currArea.lumaPos(), CHANNEL_TYPE_LUMA ) : currTU; -#endif -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS bool lumaUsesISP = !CS::isDualITree( cs ) && currTU.cu->ispMode; -#endif uint32_t currDepth = partitioner.currTrDepth; const PPS &pps = *cs.pps; ChromaCbfs cbfs ( false ); @@ -2589,29 +2047,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition return cbfs; } -#if !JVET_M0464_UNI_MTS - bool checkTransformSkip = pps.getUseTransformSkip(); - checkTransformSkip &= TU::hasTransformSkipFlag( *currTU.cs, partitioner.currArea().Cb() ); - - if( m_pcEncCfg->getUseTransformSkipFast() ) - { - checkTransformSkip &= TU::hasTransformSkipFlag( *currTU.cs, partitioner.currArea().Y() ); - - if( checkTransformSkip && cs.pcv->noChroma2x2 ) - { - int nbLumaSkip = currTULuma.transformSkip[0] ? 1 : 0; - - { - // the chroma blocks are co-located with the last luma block, so backwards references are needed - nbLumaSkip += cs.getTU( currTULuma.Y().topLeft().offset( -1, 0 ), partitioner.chType )->transformSkip[0] ? 1 : 0; - nbLumaSkip += cs.getTU( currTULuma.Y().topLeft().offset( -1, -1 ), partitioner.chType )->transformSkip[0] ? 1 : 0; - nbLumaSkip += cs.getTU( currTULuma.Y().topLeft().offset( 0, -1 ), partitioner.chType )->transformSkip[0] ? 1 : 0; - } - - checkTransformSkip &= ( nbLumaSkip > 0 ); - } - } -#endif CodingStructure &saveCS = *m_pSaveCS[1]; saveCS.pcv = cs.pcv; @@ -2619,7 +2054,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition saveCS.area.repositionTo( cs.area ); saveCS.initStructData( MAX_INT, false, true ); -#if JVET_M0102_INTRA_SUBPARTITIONS if( !CS::isDualITree( cs ) && currTU.cu->ispMode ) { saveCS.clearCUs(); @@ -2629,7 +2063,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition saveCS.clearPUs(); saveCS.addPU( *currTU.cu->firstPU, partitioner.chType ); } -#endif TransformUnit &tmpTU = saveCS.addTU(currArea, partitioner.chType); @@ -2652,12 +2085,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition const bool checkCrossComponentPrediction = PU::isChromaIntraModeCrossCheckMode( pu ) && pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf( currTU, COMPONENT_Y ); const int crossCPredictionModesToTest = checkCrossComponentPrediction ? 2 : 1; -#if JVET_M0464_UNI_MTS const int totalModesToTest = crossCPredictionModesToTest; -#else - const int transformSkipModesToTest = checkTransformSkip ? 2 : 1; - const int totalModesToTest = crossCPredictionModesToTest * transformSkipModesToTest; -#endif const bool isOneMode = (totalModesToTest == 1); int currModeId = 0; @@ -2671,16 +2099,10 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition ctxStart = m_CABACEstimator->getCtx(); } -#if !JVET_M0464_UNI_MTS - for (int transformSkipModeId = 0; transformSkipModeId < transformSkipModesToTest; transformSkipModeId++) -#endif { for (int crossCPredictionModeId = 0; crossCPredictionModeId < crossCPredictionModesToTest; crossCPredictionModeId++) { currTU.compAlpha [compID] = 0; -#if !JVET_M0464_UNI_MTS - currTU.transformSkip[compID] = transformSkipModeId; -#endif currModeId++; @@ -2691,11 +2113,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition { default0Save1Load2 = 0; } -#if JVET_M0464_UNI_MTS else if (!isOneMode && (crossCPredictionModeId == 0)) -#else - else if (!isOneMode && (transformSkipModeId == 0) && (crossCPredictionModeId == 0)) -#endif { default0Save1Load2 = 1; //save prediction on first mode } @@ -2713,15 +2131,10 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition xIntraCodingTUBlock( currTU, compID, crossCPredictionModeId != 0, singleDistCTmp, default0Save1Load2 ); -#if JVET_M0464_UNI_MTS if( ( ( crossCPredictionModeId == 1 ) && ( currTU.compAlpha[compID] == 0 ) ) ) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#else - if( ( ( crossCPredictionModeId == 1 ) && ( currTU.compAlpha[compID] == 0 ) ) || ( ( transformSkipModeId == 1 ) && !TU::getCbf( currTU, compID ) ) ) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#endif { singleCostTmp = MAX_DOUBLE; } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( lumaUsesISP && bestCostSoFar != MAX_DOUBLE && c == COMPONENT_Cb ) { uint64_t fracBitsTmp = xGetIntraFracBitsQTSingleChromaComponent( cs, partitioner, ComponentID( c ) ); @@ -2731,7 +2144,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition m_CABACEstimator->getCtx() = ctxStart; } } -#endif else if( !isOneMode ) { uint64_t fracBitsTmp = xGetIntraFracBitsQTChroma( currTU, compID ); @@ -2750,9 +2162,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition saveCS.getPredBuf (area).copyFrom(cs.getPredBuf (area)); saveCS.getOrgResiBuf(area).copyFrom(cs.getOrgResiBuf(area)); #endif -#if JVET_M0427_INLOOP_RESHAPER saveCS.getPredBuf (area).copyFrom(cs.getPredBuf (area)); -#endif if( keepResi ) { saveCS.getResiBuf (area).copyFrom(cs.getResiBuf (area)); @@ -2767,7 +2177,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition } } -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP && dSingleCost > bestCostSoFar && c == COMPONENT_Cb ) { //Luma + Cb cost is already larger than the best cost, so we don't need to test Cr @@ -2776,7 +2185,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition break; //return cbfs; } -#endif if (bestModeId < totalModesToTest) { @@ -2784,9 +2192,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition cs.getPredBuf (area).copyFrom(saveCS.getPredBuf (area)); cs.getOrgResiBuf(area).copyFrom(saveCS.getOrgResiBuf(area)); #endif -#if JVET_M0427_INLOOP_RESHAPER cs.getPredBuf (area).copyFrom(saveCS.getPredBuf (area)); -#endif if( keepResi ) { cs.getResiBuf (area).copyFrom(saveCS.getResiBuf (area)); @@ -2798,9 +2204,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition m_CABACEstimator->getCtx() = ctxBest; } -#if JVET_M0427_INLOOP_RESHAPER cs.picture->getPredBuf(area).copyFrom(cs.getPredBuf(area)); -#endif cs.picture->getRecoBuf(area).copyFrom(cs.getRecoBuf(area)); cbfs.cbf(compID) = TU::getCbf(currTU, compID); @@ -2817,22 +2221,16 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition { partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } -#if JVET_M0102_INTRA_SUBPARTITIONS else if( currTU.cu->ispMode ) { partitioner.splitCurrArea( ispType, cs ); } -#endif else THROW( "Implicit TU split not available" ); do { -#if JVET_M0102_INTRA_SUBPARTITIONS ChromaCbfs subCbfs = xRecurIntraChromaCodingQT( cs, partitioner, bestCostSoFar, ispType ); -#else - ChromaCbfs subCbfs = xRecurIntraChromaCodingQT( cs, partitioner ); -#endif for( uint32_t ch = COMPONENT_Cb; ch < numValidTBlocks; ch++ ) { @@ -2843,18 +2241,15 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition partitioner.exitCurrSplit(); -#if JVET_M0102_INTRA_SUBPARTITIONS if( lumaUsesISP && cs.dist == MAX_UINT ) { return cbfs; } -#endif { cbfs.Cb |= SplitCbfs.Cb; cbfs.Cr |= SplitCbfs.Cr; -#if JVET_M0102_INTRA_SUBPARTITIONS if( !lumaUsesISP ) { for( auto &ptu : cs.tus ) @@ -2866,16 +2261,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition } } } -#else - for( auto &ptu : cs.tus ) - { - if( currArea.Cb().contains( ptu->Cb() ) || ( !ptu->Cb().valid() && currArea.Y().contains( ptu->Y() ) ) ) - { - TU::setCbfAtDepth( *ptu, COMPONENT_Cb, currDepth, SplitCbfs.Cb ); - TU::setCbfAtDepth( *ptu, COMPONENT_Cr, currDepth, SplitCbfs.Cr ); - } - } -#endif } } diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index f4dd9f19457017f76348d9c2cf1f725bccf13861..6350f8076c3f9767b35c686a37e75a35edac4900 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -48,9 +48,7 @@ #include "CommonLib/TrQuant.h" #include "CommonLib/Unit.h" #include "CommonLib/RdCost.h" -#if JVET_M0427_INLOOP_RESHAPER #include "EncReshape.h" -#endif //! \ingroup EncoderLib //! \{ @@ -65,9 +63,7 @@ class EncModeCtrl; class IntraSearch : public IntraPrediction, CrossComponentPrediction { private: -#if JVET_M0102_INTRA_SUBPARTITIONS EncModeCtrl *m_modeCtrl; -#endif Pel* m_pSharedPredTransformSkip[MAX_NUM_TBLOCKS]; XUCache m_unitCache; @@ -81,13 +77,6 @@ private: CodingStructure **m_pSaveCS; //cost variables for the EMT algorithm and new modes list -#if !JVET_M0464_UNI_MTS - double m_bestModeCostStore[4]; // RD cost of the best mode for each PU using DCT2 - double m_modeCostStore [4][NUM_LUMA_MODE]; // RD cost of each mode for each PU using DCT2 - uint32_t m_savedRdModeList [4][NUM_LUMA_MODE], m_savedNumRdModes[4]; - int m_savedExtendRefList[4][NUM_LUMA_MODE]; -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS static_vector<uint32_t, FAST_UDI_MAX_RDMODE_NUM> m_rdModeListWithoutMrl; static_vector<uint32_t, FAST_UDI_MAX_RDMODE_NUM> m_rdModeListWithoutMrlHor; static_vector<uint32_t, FAST_UDI_MAX_RDMODE_NUM> m_rdModeListWithoutMrlVer; @@ -95,10 +84,7 @@ private: static_vector<double, FAST_UDI_MAX_RDMODE_NUM> m_intraModeDiagRatio; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> m_intraModeHorVerRatio; static_vector<int, FAST_UDI_MAX_RDMODE_NUM> m_intraModeTestedNormalIntra; -#endif -#if JVET_M0427_INLOOP_RESHAPER PelStorage m_tmpStorageLCU; -#endif protected: // interface to option EncCfg* m_pcEncCfg; @@ -106,9 +92,7 @@ protected: // interface to classes TrQuant* m_pcTrQuant; RdCost* m_pcRdCost; -#if JVET_M0427_INLOOP_RESHAPER EncReshape* m_pcReshape; -#endif // RD computation CABACWriter* m_CABACEstimator; @@ -129,9 +113,7 @@ public: const uint32_t maxCUWidth, const uint32_t maxCUHeight, const uint32_t maxTotalCUDepth -#if JVET_M0427_INLOOP_RESHAPER , EncReshape* m_pcReshape -#endif ); void destroy (); @@ -140,19 +122,12 @@ public: CodingStructure****getFullCSBuf () { return m_pFullCS; } CodingStructure **getSaveCSBuf () { return m_pSaveCS; } -#if JVET_M0102_INTRA_SUBPARTITIONS void setModeCtrl ( EncModeCtrl *modeCtrl ) { m_modeCtrl = modeCtrl; } -#endif public: -#if JVET_M0102_INTRA_SUBPARTITIONS void estIntraPredLumaQT ( CodingUnit &cu, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE ); void estIntraPredChromaQT ( CodingUnit &cu, Partitioner& pm, const double maxCostAllowed = MAX_DOUBLE ); -#else - void estIntraPredLumaQT ( CodingUnit &cu, Partitioner& pm ); - void estIntraPredChromaQT (CodingUnit &cu, Partitioner& pm); -#endif void IPCMSearch (CodingStructure &cs, Partitioner& partitioner); uint64_t xFracModeBitsIntra (PredictionUnit &pu, const uint32_t &uiMode, const ChannelType &compID); @@ -168,43 +143,19 @@ protected: // Intra search // ------------------------------------------------------------------------------------------------------------------- -#if JVET_M0102_INTRA_SUBPARTITIONS void xEncIntraHeader ( CodingStructure &cs, Partitioner& pm, const bool &luma, const bool &chroma, const int subTuIdx = -1 ); void xEncSubdivCbfQT ( CodingStructure &cs, Partitioner& pm, const bool &luma, const bool &chroma, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP ); uint64_t xGetIntraFracBitsQT ( CodingStructure &cs, Partitioner& pm, const bool &luma, const bool &chroma, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP ); uint64_t xGetIntraFracBitsQTSingleChromaComponent( CodingStructure &cs, Partitioner& pm, const ComponentID compID ); -#else - void xEncIntraHeader (CodingStructure &cs, Partitioner& pm, const bool &bLuma, const bool &bChroma); - void xEncSubdivCbfQT (CodingStructure &cs, Partitioner& pm, const bool &bLuma, const bool &bChroma); - uint64_t xGetIntraFracBitsQT (CodingStructure &cs, Partitioner& pm, const bool &bLuma, const bool &bChroma); -#endif uint64_t xGetIntraFracBitsQTChroma(TransformUnit& tu, const ComponentID &compID); -#if JVET_M0102_INTRA_SUBPARTITIONS void xEncCoeffQT ( CodingStructure &cs, Partitioner& pm, const ComponentID compID, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP ); -#else - void xEncCoeffQT (CodingStructure &cs, Partitioner& pm, const ComponentID &compID); -#endif -#if JVET_M0464_UNI_MTS void xIntraCodingTUBlock (TransformUnit &tu, const ComponentID &compID, const bool &checkCrossCPrediction, Distortion& ruiDist, const int &default0Save1Load2 = 0, uint32_t* numSig = nullptr, std::vector<TrMode>* trModes=nullptr, const bool loadTr=false ); -#else - void xIntraCodingTUBlock (TransformUnit &tu, const ComponentID &compID, const bool &checkCrossCPrediction, Distortion& ruiDist, const int &default0Save1Load2 = 0, uint32_t* numSig = nullptr ); -#endif -#if JVET_M0102_INTRA_SUBPARTITIONS ChromaCbfs xRecurIntraChromaCodingQT( CodingStructure &cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, const PartSplit ispType = TU_NO_ISP ); -#if JVET_M0464_UNI_MTS void xRecurIntraCodingLumaQT ( CodingStructure &cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP, const bool ispIsCurrentWinnder = false ); -#else - void xRecurIntraCodingLumaQT ( CodingStructure &cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP ); -#endif -#else - ChromaCbfs xRecurIntraChromaCodingQT (CodingStructure &cs, Partitioner& pm); - - void xRecurIntraCodingLumaQT ( CodingStructure &cs, Partitioner& pm ); -#endif void encPredIntraDPCM( const ComponentID &compID, PelBuf &pOrg, PelBuf &pDst, const uint32_t &uiDirMode ); diff --git a/source/Lib/EncoderLib/RateCtrl.cpp b/source/Lib/EncoderLib/RateCtrl.cpp index 528237dbde2f8c7c1ced49507eb45679945d20ab..da6c26d849c4f665402d2456c7ab9522e1d39fa5 100644 --- a/source/Lib/EncoderLib/RateCtrl.cpp +++ b/source/Lib/EncoderLib/RateCtrl.cpp @@ -142,9 +142,7 @@ void EncRCSeq::create( int totalFrames, int targetBitrate, int frameRate, int GO m_picPara[i].m_alpha = 0.0; m_picPara[i].m_beta = 0.0; m_picPara[i].m_validPix = -1; -#if JVET_M0600_RATE_CTRL m_picPara[i].m_skipRatio = 0.0; -#endif } if ( m_useLCUSeparateModel ) @@ -158,9 +156,7 @@ void EncRCSeq::create( int totalFrames, int targetBitrate, int frameRate, int GO m_LCUPara[i][j].m_alpha = 0.0; m_LCUPara[i][j].m_beta = 0.0; m_LCUPara[i][j].m_validPix = -1; -#if JVET_M0600_RATE_CTRL m_LCUPara[i][j].m_skipRatio = 0.0; -#endif } } } @@ -408,7 +404,6 @@ void EncRCGOP::create( EncRCSeq* encRCSeq, int numPic ) lambdaRatio[13] = lambdaLev4 / lambdaLev1; lambdaRatio[14] = lambdaLev5 / lambdaLev1; lambdaRatio[15] = lambdaLev5 / lambdaLev1; -#if JVET_M0600_RATE_CTRL const double qdfParaLev2A = 0.5847; const double qdfParaLev2B = -0.0782; const double qdfParaLev3A = 0.5468; @@ -450,7 +445,6 @@ void EncRCGOP::create( EncRCSeq* encRCSeq, int numPic ) lambdaRatio[13] = lambdaLev4 / lambdaLev1; lambdaRatio[14] = lambdaLev5 / lambdaLev1; lambdaRatio[15] = lambdaLev5 / lambdaLev1; -#endif } } @@ -1057,11 +1051,7 @@ int EncRCPic::getLCUEstQP( double lambda, int clipPicQP ) return estQP; } -#if JVET_M0600_RATE_CTRL void EncRCPic::updateAfterCTU(int LCUIdx, int bits, int QP, double lambda, double skipRatio, bool updateLCUParameter) -#else -void EncRCPic::updateAfterCTU( int LCUIdx, int bits, int QP, double lambda, bool updateLCUParameter ) -#endif { m_LCUs[LCUIdx].m_actualBits = bits; m_LCUs[LCUIdx].m_QP = QP; @@ -1102,9 +1092,7 @@ void EncRCPic::updateAfterCTU( int LCUIdx, int bits, int QP, double lambda, bool TRCParameter rcPara; rcPara.m_alpha = alpha; rcPara.m_beta = beta; -#if JVET_M0600_RATE_CTRL rcPara.m_skipRatio = skipRatio; -#endif if (QP == g_RCInvalidQPValue && m_encRCSeq->getAdaptiveBits() == 1) { rcPara.m_validPix = 0; @@ -1145,9 +1133,7 @@ void EncRCPic::updateAfterCTU( int LCUIdx, int bits, int QP, double lambda, bool TRCParameter rcPara; rcPara.m_alpha = alpha; rcPara.m_beta = beta; -#if JVET_M0600_RATE_CTRL rcPara.m_skipRatio = skipRatio; -#endif if (QP == g_RCInvalidQPValue && m_encRCSeq->getAdaptiveBits() == 1) { rcPara.m_validPix = 0; @@ -1260,7 +1246,6 @@ void EncRCPic::updateAfterPicture( int actualHeaderBits, int actualTotalBits, do double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; -#if JVET_M0600_RATE_CTRL //calculate the skipRatio of picture double skipRatio = 0; int numOfSkipPixel = 0; for (int LCUIdx = 0; LCUIdx < m_numberOfLCU; LCUIdx++) @@ -1268,7 +1253,6 @@ void EncRCPic::updateAfterPicture( int actualHeaderBits, int actualTotalBits, do numOfSkipPixel += int(m_encRCSeq->getLCUPara(m_frameLevel, LCUIdx).m_skipRatio*m_LCUs[LCUIdx].m_numberOfPixel); } skipRatio = (double)numOfSkipPixel / (double)m_numberOfPixel; -#endif if (isIRAP) { @@ -1293,9 +1277,7 @@ void EncRCPic::updateAfterPicture( int actualHeaderBits, int actualTotalBits, do TRCParameter rcPara; rcPara.m_alpha = alpha; rcPara.m_beta = beta; -#if JVET_M0600_RATE_CTRL rcPara.m_skipRatio = skipRatio; -#endif double avgMSE = getPicMSE(); double updatedK = picActualBpp * averageLambda / avgMSE; double updatedC = avgMSE / pow(picActualBpp, -updatedK); @@ -1330,9 +1312,7 @@ void EncRCPic::updateAfterPicture( int actualHeaderBits, int actualTotalBits, do TRCParameter rcPara; rcPara.m_alpha = alpha; rcPara.m_beta = beta; -#if JVET_M0600_RATE_CTRL rcPara.m_skipRatio = skipRatio; -#endif double picActualBpp = (double)m_picActualBits / (double)m_validPixelsInPic; double avgMSE = getPicMSE(); diff --git a/source/Lib/EncoderLib/RateCtrl.h b/source/Lib/EncoderLib/RateCtrl.h index 3b3e2a1b1ca10f8f14655fe47ba8d438cd470348..09e84409f6444d836277cba90bbdcc239c695853 100644 --- a/source/Lib/EncoderLib/RateCtrl.h +++ b/source/Lib/EncoderLib/RateCtrl.h @@ -93,9 +93,7 @@ struct TRCParameter double m_alpha; double m_beta; int m_validPix; -#if JVET_M0600_RATE_CTRL double m_skipRatio; -#endif }; class EncRCSeq @@ -242,11 +240,7 @@ public: double getLCUEstLambdaAndQP(double bpp, int clipPicQP, int *estQP); double getLCUEstLambda( double bpp ); int getLCUEstQP( double lambda, int clipPicQP ); -#if JVET_M0600_RATE_CTRL void updateAfterCTU(int LCUIdx, int bits, int QP, double lambda, double skipRatio, bool updateLCUParameter = true); -#else - void updateAfterCTU( int LCUIdx, int bits, int QP, double lambda, bool updateLCUParameter = true ); -#endif void updateAfterPicture( int actualHeaderBits, int actualTotalBits, double averageQP, double averageLambda, bool isIRAP); void addToPictureLsit( list<EncRCPic*>& listPreviousPictures ); diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index 6ecc3e20810d7afe759c770fd7e68a9a380b8ae9..748036209ad0e43a8a787e61b85fd30de2ee90cf 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -359,7 +359,6 @@ void SEIEncoder::initSEITempMotionConstrainedTileSets (SEITempMotionConstrainedT if(pps->getTilesEnabledFlag()) { -#if JVET_M0445_MCTS if (m_pcCfg->getMCTSEncConstraint()) { sei->m_mc_all_tiles_exact_sample_value_match_flag = true; @@ -370,7 +369,6 @@ void SEIEncoder::initSEITempMotionConstrainedTileSets (SEITempMotionConstrainedT } else { -#endif sei->m_mc_all_tiles_exact_sample_value_match_flag = false; sei->m_each_tile_one_tile_set_flag = false; sei->m_limited_tile_set_display_flag = false; @@ -391,9 +389,7 @@ void SEIEncoder::initSEITempMotionConstrainedTileSets (SEITempMotionConstrainedT sei->tileSetData(i).m_mcts_tier_level_idc_present_flag = false; } } -#if JVET_M0445_MCTS } -#endif else { CHECK(!(!"Tile is not enabled"), "Unspecified error"); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 1b19fdff28b1a4fe6a0f0e9f7b4927d241351781..ae81af9f9443f6563f4e755aa4395baf944be319 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -233,11 +233,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_FLAG( pcPPS->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag" ); if ( pcPPS->getUseDQP() ) { -#if JVET_M0113_M0188_QG_SIZE WRITE_UVLC( pcPPS->getCuQpDeltaSubdiv(), "cu_qp_delta_subdiv" ); -#else - WRITE_UVLC( pcPPS->getMaxCuDQPDepth(), "diff_cu_qp_delta_depth" ); -#endif } WRITE_SVLC( pcPPS->getQpOffset(COMPONENT_Cb), "pps_cb_qp_offset" ); @@ -345,11 +341,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_FLAG(uint32_t(ppsRangeExtension.getChromaQpOffsetListEnabledFlag()), "chroma_qp_offset_list_enabled_flag" ); if (ppsRangeExtension.getChromaQpOffsetListEnabledFlag()) { -#if JVET_M0113_M0188_QG_SIZE WRITE_UVLC(ppsRangeExtension.getCuChromaQpOffsetSubdiv(), "cu_chroma_qp_offset_subdiv"); -#else - WRITE_UVLC(ppsRangeExtension.getDiffCuChromaQpOffsetDepth(), "diff_cu_chroma_qp_offset_depth"); -#endif WRITE_UVLC(ppsRangeExtension.getChromaQpOffsetListLen() - 1, "chroma_qp_offset_list_len_minus1"); /* skip zero index */ for (int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx < ppsRangeExtension.getChromaQpOffsetListLen(); cuChromaQpOffsetIdx++) @@ -373,7 +365,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) xWriteRbspTrailingBits(); } -#if JVET_M0132_APS void HLSWriter::codeAPS( APS* pcAPS) { #if ENABLE_TRACING @@ -403,7 +394,6 @@ void HLSWriter::codeAPS( APS* pcAPS) } xWriteRbspTrailingBits(); } -#endif void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS ) { #if ENABLE_TRACING @@ -563,7 +553,6 @@ void HLSWriter::codeHrdParameters( const HRD *hrd, bool commonInfPresentFlag, ui } } -#if JVET_M0427_INLOOP_RESHAPER void HLSWriter::codeReshaper(const SliceReshapeInfo& pSliceReshaperInfo, const SPS* pcSPS, const bool isIntra) { WRITE_FLAG(pSliceReshaperInfo.getSliceReshapeModelPresentFlag() ? 1 : 0, "tile_group_reshaper_model_present_flag"); @@ -595,7 +584,6 @@ void HLSWriter::codeReshaper(const SliceReshapeInfo& pSliceReshaperInfo, const S if (!(pcSPS->getUseDualITree() && isIntra)) WRITE_FLAG(pSliceReshaperInfo.getSliceReshapeChromaAdj(), "tile_group_reshaper_chroma_residual_scale_flag"); }; -#endif // #if JVET_M0427_INLOOP_RESHAPER void HLSWriter::codeSPS( const SPS* pcSPS ) { @@ -616,28 +604,20 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG(pcSPS->getNoSaoConstraintFlag() ? 1 : 0, "no_sao_constraint_flag"); WRITE_FLAG(pcSPS->getNoAlfConstraintFlag() ? 1 : 0, "no_alf_constraint_flag"); WRITE_FLAG(pcSPS->getNoPcmConstraintFlag() ? 1 : 0, "no_pcm_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(pcSPS->getNoRefWraparoundConstraintFlag() ? 1 : 0, "no_ref_wraparound_constraint_flag"); -#endif WRITE_FLAG(pcSPS->getNoTemporalMvpConstraintFlag() ? 1 : 0, "no_temporal_mvp_constraint_flag"); WRITE_FLAG(pcSPS->getNoSbtmvpConstraintFlag() ? 1 : 0, "no_sbtmvp_constraint_flag"); WRITE_FLAG(pcSPS->getNoAmvrConstraintFlag() ? 1 : 0, "no_amvr_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(pcSPS->getNoBdofConstraintFlag() ? 1 : 0, "no_bdof_constraint_flag"); -#endif WRITE_FLAG(pcSPS->getNoCclmConstraintFlag() ? 1 : 0, "no_cclm_constraint_flag"); WRITE_FLAG(pcSPS->getNoMtsConstraintFlag() ? 1 : 0, "no_mts_constraint_flag"); WRITE_FLAG(pcSPS->getNoAffineMotionConstraintFlag() ? 1 : 0, "no_affine_motion_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(pcSPS->getNoGbiConstraintFlag() ? 1 : 0, "no_gbi_constraint_flag"); WRITE_FLAG(pcSPS->getNoMhIntraConstraintFlag() ? 1 : 0, "no_mh_intra_constraint_flag"); WRITE_FLAG(pcSPS->getNoTriangleConstraintFlag() ? 1 : 0, "no_triangle_constraint_flag"); -#endif WRITE_FLAG(pcSPS->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(pcSPS->getNoCurrPicRefConstraintFlag() ? 1 : 0, "no_curr_pic_ref_constraint_flag"); WRITE_FLAG(pcSPS->getNoQpDeltaConstraintFlag() ? 1 : 0, "no_qp_delta_constraint_flag"); -#endif WRITE_FLAG(pcSPS->getNoDepQuantConstraintFlag() ? 1 : 0, "no_dep_quant_constraint_flag"); WRITE_FLAG(pcSPS->getNoSignDataHidingConstraintFlag() ? 1 : 0, "no_sign_data_hiding_constraint_flag"); @@ -749,11 +729,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getWrapAroundEnabledFlag() ? 1 : 0, "sps_ref_wraparound_enabled_flag" ); if( pcSPS->getWrapAroundEnabledFlag() ) { -#if JVET_M0415_WRAPAROUND_HLS WRITE_UVLC( (pcSPS->getWrapAroundOffset()/(1 << pcSPS->getLog2MinCodingBlockSize()))-1, "sps_ref_wraparound_offset_minus1" ); -#else - WRITE_UVLC( pcSPS->getWrapAroundOffset(), "sps_ref_wraparound_offset" ); -#endif } WRITE_FLAG( pcSPS->getSPSTemporalMVPEnabledFlag() ? 1 : 0, "sps_temporal_mvp_enabled_flag" ); @@ -767,38 +743,23 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" ); -#if JVET_M0246_AFFINE_AMVR WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" ); -#endif -#if JVET_M0147_DMVR WRITE_FLAG( pcSPS->getUseDMVR() ? 1 : 0, "sps_dmvr_enable_flag" ); -#endif // KJS: sps_cclm_enabled_flag WRITE_FLAG( pcSPS->getUseLMChroma() ? 1 : 0, "lm_chroma_enabled_flag" ); -#if JVET_M0142_CCLM_COLLOCATED_CHROMA if ( pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420 ) { WRITE_FLAG( pcSPS->getCclmCollocatedChromaFlag() ? 1 : 0, "sps_cclm_collocated_chroma_flag" ); } -#endif -#if JVET_M0303_IMPLICIT_MTS WRITE_FLAG( pcSPS->getUseMTS() ? 1 : 0, "mts_enabled_flag" ); if ( pcSPS->getUseMTS() ) { -#endif -#if JVET_M0464_UNI_MTS WRITE_FLAG( pcSPS->getUseIntraMTS() ? 1 : 0, "mts_intra_enabled_flag" ); WRITE_FLAG( pcSPS->getUseInterMTS() ? 1 : 0, "mts_inter_enabled_flag" ); -#else - WRITE_FLAG( pcSPS->getUseIntraEMT() ? 1 : 0, "emt_intra_enabled_flag" ); - WRITE_FLAG( pcSPS->getUseInterEMT() ? 1 : 0, "emt_inter_enabled_flag" ); -#endif -#if JVET_M0303_IMPLICIT_MTS } -#endif // KJS: sps_affine_enabled_flag WRITE_FLAG( pcSPS->getUseAffine() ? 1 : 0, "affine_flag" ); if ( pcSPS->getUseAffine() ) @@ -806,11 +767,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0, "affine_type_flag" ); } WRITE_FLAG( pcSPS->getUseGBi() ? 1 : 0, "gbi_flag" ); -#if JVET_M0483_IBC WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "ibc_flag"); -#else - WRITE_FLAG(pcSPS->getIBCMode() ? 1 : 0, "ibc_flag" ); -#endif // KJS: sps_ciip_enabled_flag WRITE_FLAG( pcSPS->getUseMHIntra() ? 1 : 0, "mhintra_flag" ); @@ -818,21 +775,15 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUseTriangle() ? 1: 0, "triangle_flag" ); // KJS: not in draft yet -#if JVET_M0255_FRACMMVD_SWITCH WRITE_FLAG( pcSPS->getDisFracMmvdEnabledFlag() ? 1 : 0, "sps_fracmmvd_disabled_flag" ); -#endif // KJS: not in draft yet -#if JVET_M0140_SBT WRITE_FLAG( pcSPS->getUseSBT() ? 1 : 0, "sbt_enable_flag"); if( pcSPS->getUseSBT() ) { WRITE_FLAG(pcSPS->getMaxSbtSize() == 64 ? 1 : 0, "max_sbt_size_64_flag"); } -#endif // KJS: not in draft yet -#if JVET_M0427_INLOOP_RESHAPER WRITE_FLAG(pcSPS->getUseReshaper() ? 1 : 0, "sps_reshaper_enable_flag"); -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET WRITE_FLAG( pcSPS->getLadfEnabled() ? 1 : 0, "sps_ladf_enabled_flag" ); @@ -1232,16 +1183,12 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) if( pcSlice->getSPS()->getALFEnabledFlag() ) { -#if JVET_M0132_APS const int alfEnabled = pcSlice->getAPS()->getAlfAPSParam().enabledFlag[COMPONENT_Y] ? 1 : 0; WRITE_FLAG( alfEnabled, "tile_group_alf_enabled_flag"); if (alfEnabled) { WRITE_CODE(pcSlice->getAPSId(), 5, "tile_group_aps_id"); } -#else - alf( pcSlice->getAlfSliceParam() ); -#endif } //check if numrefidxes match the defaults. If not, override @@ -1394,19 +1341,13 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } } } -#if JVET_M0483_IBC if (!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) { CHECK(pcSlice->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported"); WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand"); } -#endif if( !pcSlice->isIntra() ) { -#if JVET_M0483_IBC==0 - CHECK( pcSlice->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported" ); - WRITE_UVLC( MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand" ); -#endif if ( pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getUseAffine() ) // ATMVP only { @@ -1423,12 +1364,10 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) CHECK( pcSlice->getMaxNumAffineMergeCand() > AFFINE_MRG_MAX_NUM_CANDS, "More affine merge candidates signalled than supported" ); WRITE_UVLC( AFFINE_MRG_MAX_NUM_CANDS - pcSlice->getMaxNumAffineMergeCand(), "five_minus_max_num_affine_merge_cand" ); } -#if JVET_M0255_FRACMMVD_SWITCH if ( pcSlice->getSPS()->getDisFracMmvdEnabledFlag() ) { WRITE_FLAG( pcSlice->getDisFracMMVD(), "tile_group_fracmmvd_disabled_flag" ); } -#endif } int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); WRITE_SVLC( iCode, "slice_qp_delta" ); @@ -1475,12 +1414,10 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag"); } -#if JVET_M0427_INLOOP_RESHAPER if (pcSlice->getSPS()->getUseReshaper()) { codeReshaper(pcSlice->getReshapeInfo(), pcSlice->getSPS(), pcSlice->isIntra()); } -#endif #if HEVC_DEPENDENT_SLICES } #endif @@ -1508,28 +1445,20 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoSaoConstraintFlag() ? 1 : 0, "no_sao_constraint_flag"); WRITE_FLAG(cinfo->getNoAlfConstraintFlag() ? 1 : 0, "no_alf_constraint_flag"); WRITE_FLAG(cinfo->getNoPcmConstraintFlag() ? 1 : 0, "no_pcm_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(cinfo->getNoRefWraparoundConstraintFlag() ? 1 : 0, "no_ref_wraparound_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoTemporalMvpConstraintFlag() ? 1 : 0, "no_temporal_mvp_constraint_flag"); WRITE_FLAG(cinfo->getNoSbtmvpConstraintFlag() ? 1 : 0, "no_sbtmvp_constraint_flag"); WRITE_FLAG(cinfo->getNoAmvrConstraintFlag() ? 1 : 0, "no_amvr_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(cinfo->getNoBdofConstraintFlag() ? 1 : 0, "no_bdof_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoCclmConstraintFlag() ? 1 : 0, "no_cclm_constraint_flag"); WRITE_FLAG(cinfo->getNoMtsConstraintFlag() ? 1 : 0, "no_mts_constraint_flag"); WRITE_FLAG(cinfo->getNoAffineMotionConstraintFlag() ? 1 : 0, "no_affine_motion_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(cinfo->getNoGbiConstraintFlag() ? 1 : 0, "no_gbi_constraint_flag"); WRITE_FLAG(cinfo->getNoMhIntraConstraintFlag() ? 1 : 0, "no_mh_intra_constraint_flag"); WRITE_FLAG(cinfo->getNoTriangleConstraintFlag() ? 1 : 0, "no_triangle_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); -#if JVET_M0451_INTEROPERABILITY_POINT_SYNTAX WRITE_FLAG(cinfo->getNoCurrPicRefConstraintFlag() ? 1 : 0, "no_curr_pic_ref_constraint_flag"); WRITE_FLAG(cinfo->getNoQpDeltaConstraintFlag() ? 1 : 0, "no_qp_delta_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoDepQuantConstraintFlag() ? 1 : 0, "no_dep_quant_constraint_flag"); WRITE_FLAG(cinfo->getNoSignDataHidingConstraintFlag() ? 1 : 0, "no_sign_data_hiding_constraint_flag"); } @@ -1864,35 +1793,6 @@ bool HLSWriter::xFindMatchingLTRP(Slice* pcSlice, uint32_t *ltrpsIndex, int ltrp return false; } -#if !JVET_M0132_APS -void HLSWriter::alf( const AlfSliceParam& alfSliceParam ) -{ - WRITE_FLAG( alfSliceParam.enabledFlag[COMPONENT_Y], "tile_group_alf_enabled_flag" ); - if( !alfSliceParam.enabledFlag[COMPONENT_Y] ) - { - return; - } - - const int alfChromaIdc = alfSliceParam.enabledFlag[COMPONENT_Cb] * 2 + alfSliceParam.enabledFlag[COMPONENT_Cr]; - truncatedUnaryEqProb( alfChromaIdc, 3 ); // alf_chroma_idc - - xWriteTruncBinCode( alfSliceParam.numLumaFilters - 1, MAX_NUM_ALF_CLASSES ); //number_of_filters_minus1 - if( alfSliceParam.numLumaFilters > 1 ) - { - for( int i = 0; i < MAX_NUM_ALF_CLASSES; i++ ) - { - xWriteTruncBinCode( (uint32_t)alfSliceParam.filterCoeffDeltaIdx[i], alfSliceParam.numLumaFilters ); //filter_coeff_delta[i] - } - } - - alfFilter( alfSliceParam, false ); - - if( alfChromaIdc ) - { - alfFilter( alfSliceParam, true ); - } -} -#endif void HLSWriter::alfGolombEncode( int coeff, int k ) { diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index a3956f2dd56e4c37cd1200ec41e404a6447b23ba..2ec729bde447451bb29916fcabeaaa337a05bb17 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -125,9 +125,7 @@ public: void codeVUI ( const VUI *pcVUI, const SPS* pcSPS ); void codeSPS ( const SPS* pcSPS ); void codePPS ( const PPS* pcPPS ); -#if JVET_M0132_APS void codeAPS ( APS* pcAPS); -#endif #if HEVC_VPS void codeVPS ( const VPS* pcVPS ); #endif @@ -147,9 +145,6 @@ public: void codeScalingList ( const ScalingList &scalingList ); #endif -#if !JVET_M0132_APS - void alf( const AlfSliceParam& alfSliceParam ); -#endif void alfFilter( const AlfSliceParam& alfSliceParam, const bool isChroma ); private: @@ -157,9 +152,7 @@ private: void alfGolombEncode( const int coeff, const int k ); void truncatedUnaryEqProb( int symbol, int maxSymbol ); -#if JVET_M0427_INLOOP_RESHAPER void codeReshaper ( const SliceReshapeInfo& pSliceReshaperInfo, const SPS* pcSPS, const bool isIntra); -#endif }; //! \}