diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index c75ed2eab705965d6ab3c9819223e1cdc23a95f0..ccbf1c2fbecd6e56c922354052181912730bd373 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -445,11 +445,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); #endif -#if JVET_K0072 m_cEncLib.setDepQuantEnabledFlag ( m_depQuantEnabledFlag); #if HEVC_USE_SIGN_HIDING m_cEncLib.setSignDataHidingEnabledFlag ( m_signDataHidingEnabledFlag); -#endif #endif m_cEncLib.setUseRateCtrl ( m_RCEnableRateControl ); m_cEncLib.setTargetBitrate ( m_RCTargetBitrate ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index afade6541bd36a4a1a484b0265e44f0d65b8b47c..9ac6d57ed9a914bf97a23b16af00af54bad8534a 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1057,15 +1057,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile") ("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.") #endif -#if JVET_K0072 ("DepQuant", m_depQuantEnabledFlag, true ) #if HEVC_USE_SIGN_HIDING ("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, false ) -#endif -#else -#if HEVC_USE_SIGN_HIDING - ("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, true) -#endif #endif ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") /* Misc. */ @@ -1963,7 +1957,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_SubPuMvpLog2Size < MIN_CU_LOG2, "SubPuMvpLog2Size must be 2 or greater." ); xConfirmPara( m_SubPuMvpLog2Size > 6, "SubPuMvpLog2Size must be 6 or smaller." ); #endif -#if JVET_K0072 if( m_depQuantEnabledFlag ) { xConfirmPara( !m_useRDOQ || !m_useRDOQTS, "RDOQ and RDOQTS must be equal to 1 if dependent quantization is enabled" ); @@ -1971,7 +1964,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_signDataHidingEnabledFlag, "SignHideFlag must be equal to 0 if dependent quantization is enabled" ); #endif } -#endif #if !JVET_K0220_ENC_CTRL xConfirmPara( m_useSaveLoadEncInfo && !m_QTBT, "Encoder decision saving can only be applied with QTBT" ); #endif @@ -2029,9 +2021,6 @@ bool EncAppCfg::xCheckParameter() } #endif -#if JVET_K0072 -#else -#endif xConfirmPara( m_useAMaxBT && !m_QTBT, "AMaxBT can only be used with QTBT!" ); @@ -3158,9 +3147,7 @@ void EncAppCfg::xPrintParameter() #endif msg( VERBOSE, "TMVPMode:%d ", m_TMVPModeId ); -#if JVET_K0072 msg( VERBOSE, " DQ:%d ", m_depQuantEnabledFlag); -#endif #if HEVC_USE_SIGN_HIDING msg( VERBOSE, " SignBitHidingFlag:%d ", m_signDataHidingEnabledFlag); #endif @@ -3192,9 +3179,6 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "IMV:%d ", m_ImvMode ); if( !m_QTBT ) msg( VERBOSE, "IMVMaxCand:%d ", m_ImvMaxCand ); #endif -#if JVET_K0072 -#else -#endif #if JVET_K0346 || JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC msg(VERBOSE, "HighPrecMv:%d ", m_highPrecisionMv); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 55a2a0f0da6554192944b41bd146e1e944a01dc8..11a80172b71a86106aa239c407b6400d80c41ed7 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -429,11 +429,9 @@ protected: uint32_t m_maxNumMergeCand; ///< Max number of merge candidates int m_TMVPModeId; -#if JVET_K0072 bool m_depQuantEnabledFlag; #if HEVC_USE_SIGN_HIDING bool m_signDataHidingEnabledFlag; -#endif #endif bool m_RCEnableRateControl; ///< enable rate control or not int m_RCTargetBitrate; ///< target bitrate when rate control is enabled diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h index 2265e28900f57751e5212be7fafb7bcead8202da..57fd73d87e73c202e05015aedbccca33dc37f929 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -101,9 +101,7 @@ enum CodingStatisticsType STATS__CABAC_BITS__AFFINE_TYPE, #endif #endif -#if JVET_K0072 STATS__CABAC_BITS__PAR_FLAG, -#endif STATS__CABAC_BITS__ALF, #if JVET_K0357_AMVR STATS__CABAC_BITS__IMV_FLAG, @@ -164,9 +162,7 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__LAST_SIG_X_Y", "CABAC_BITS__SIG_COEFF_GROUP_FLAG", "CABAC_BITS__SIG_COEFF_MAP_FLAG", -#if JVET_K0072 "CABAC_BITS__PAR_FLAG", -#endif "CABAC_BITS__GT1_FLAG", "CABAC_BITS__GT2_FLAG", "CABAC_BITS__SIGN_BIT", diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index c9589b85c0cfd3e26bed416688c0a1502dc6dc76..f929799b8252cea38dfd1726e5c045e99b0c7f0f 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -40,178 +40,6 @@ #include "CodingStructure.h" #include "Picture.h" -#if JVET_K0072 -#else -#if !HM_QTBT_AS_IN_JEM_CONTEXT -static const uint8_t spat_bypass_luma_all [] = { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27 }; -static const uint8_t spat_bypass_chroma_all [] = { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 }; -static const uint8_t spat_4x4_diag_all [] = { 0, 2, 1, 6, 3, 4, 7, 6, 4, 5, 7, 8, 5, 8, 8, 8 }; -static const uint8_t spat_4x4_hor_all [] = { 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8 }; -static const uint8_t spat_4x4_ver_all [] = { 0, 2, 6, 7, 1, 3, 6, 7, 4, 4, 8, 8, 5, 5, 8, 8 }; -static const uint8_t spat_8x8_luma_diag_first_pat0 [] = { 0, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_luma_diag_first_pat1 [] = { 0, 10, 11, 9, 10, 11, 9, 9, 10, 11, 9, 9, 10, 9, 9, 9 }; -static const uint8_t spat_8x8_luma_diag_first_pat2 [] = { 0, 11, 10, 11, 10, 9, 11, 10, 9, 9, 10, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_luma_diag_first_pat3 [] = { 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_8x8_luma_diag_other_pat0 [] = { 14, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_8x8_luma_diag_other_pat1 [] = { 14, 13, 14, 12, 13, 14, 12, 12, 13, 14, 12, 12, 13, 12, 12, 12 }; -static const uint8_t spat_8x8_luma_diag_other_pat2 [] = { 14, 14, 13, 14, 13, 12, 14, 13, 12, 12, 13, 12, 12, 12, 12, 12 }; -static const uint8_t spat_8x8_luma_diag_other_pat3 [] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_8x8_luma_hor_first_pat0 [] = { 0, 16, 16, 15, 16, 16, 15, 15, 16, 15, 15, 15, 15, 15, 15, 15 }; -static const uint8_t spat_8x8_luma_hor_first_pat1 [] = { 0, 17, 17, 17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 15 }; -static const uint8_t spat_8x8_luma_hor_first_pat2 [] = { 0, 16, 15, 15, 17, 16, 15, 15, 17, 16, 15, 15, 17, 16, 15, 15 }; -static const uint8_t spat_8x8_luma_hor_first_pat3 [] = { 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 }; -static const uint8_t spat_8x8_luma_hor_other_pat0 [] = { 20, 19, 19, 18, 19, 19, 18, 18, 19, 18, 18, 18, 18, 18, 18, 18 }; -static const uint8_t spat_8x8_luma_hor_other_pat1 [] = { 20, 20, 20, 20, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18 }; -static const uint8_t spat_8x8_luma_hor_other_pat2 [] = { 20, 19, 18, 18, 20, 19, 18, 18, 20, 19, 18, 18, 20, 19, 18, 18 }; -static const uint8_t spat_8x8_luma_hor_other_pat3 [] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; -static const uint8_t spat_8x8_luma_ver_first_pat0 [] = { 0, 16, 16, 15, 16, 16, 15, 15, 16, 15, 15, 15, 15, 15, 15, 15 }; -static const uint8_t spat_8x8_luma_ver_first_pat1 [] = { 0, 16, 15, 15, 17, 16, 15, 15, 17, 16, 15, 15, 17, 16, 15, 15 }; -static const uint8_t spat_8x8_luma_ver_first_pat2 [] = { 0, 17, 17, 17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 15 }; -static const uint8_t spat_8x8_luma_ver_first_pat3 [] = { 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 }; -static const uint8_t spat_8x8_luma_ver_other_pat0 [] = { 20, 19, 19, 18, 19, 19, 18, 18, 19, 18, 18, 18, 18, 18, 18, 18 }; -static const uint8_t spat_8x8_luma_ver_other_pat1 [] = { 20, 19, 18, 18, 20, 19, 18, 18, 20, 19, 18, 18, 20, 19, 18, 18 }; -static const uint8_t spat_8x8_luma_ver_other_pat2 [] = { 20, 20, 20, 20, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18 }; -static const uint8_t spat_8x8_luma_ver_other_pat3 [] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; -static const uint8_t spat_nxn_luma_diag_first_pat0 [] = { 0, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_diag_first_pat1 [] = { 0, 22, 23, 21, 22, 23, 21, 21, 22, 23, 21, 21, 22, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_diag_first_pat2 [] = { 0, 23, 22, 23, 22, 21, 23, 22, 21, 21, 22, 21, 21, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_diag_first_pat3 [] = { 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 }; -static const uint8_t spat_nxn_luma_diag_other_pat0 [] = { 26, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_diag_other_pat1 [] = { 26, 25, 26, 24, 25, 26, 24, 24, 25, 26, 24, 24, 25, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_diag_other_pat2 [] = { 26, 26, 25, 26, 25, 24, 26, 25, 24, 24, 25, 24, 24, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_diag_other_pat3 [] = { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26 }; -static const uint8_t spat_nxn_luma_hor_first_pat0 [] = { 0, 22, 22, 21, 22, 22, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_hor_first_pat1 [] = { 0, 23, 23, 23, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_hor_first_pat2 [] = { 0, 22, 21, 21, 23, 22, 21, 21, 23, 22, 21, 21, 23, 22, 21, 21 }; -static const uint8_t spat_nxn_luma_hor_first_pat3 [] = { 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 }; -static const uint8_t spat_nxn_luma_hor_other_pat0 [] = { 26, 25, 25, 24, 25, 25, 24, 24, 25, 24, 24, 24, 24, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_hor_other_pat1 [] = { 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_hor_other_pat2 [] = { 26, 25, 24, 24, 26, 25, 24, 24, 26, 25, 24, 24, 26, 25, 24, 24 }; -static const uint8_t spat_nxn_luma_hor_other_pat3 [] = { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26 }; -static const uint8_t spat_nxn_luma_ver_first_pat0 [] = { 0, 22, 22, 21, 22, 22, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_ver_first_pat1 [] = { 0, 22, 21, 21, 23, 22, 21, 21, 23, 22, 21, 21, 23, 22, 21, 21 }; -static const uint8_t spat_nxn_luma_ver_first_pat2 [] = { 0, 23, 23, 23, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21 }; -static const uint8_t spat_nxn_luma_ver_first_pat3 [] = { 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 }; -static const uint8_t spat_nxn_luma_ver_other_pat0 [] = { 26, 25, 25, 24, 25, 25, 24, 24, 25, 24, 24, 24, 24, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_ver_other_pat1 [] = { 26, 25, 24, 24, 26, 25, 24, 24, 26, 25, 24, 24, 26, 25, 24, 24 }; -static const uint8_t spat_nxn_luma_ver_other_pat2 [] = { 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24 }; -static const uint8_t spat_nxn_luma_ver_other_pat3 [] = { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26 }; -static const uint8_t spat_8x8_chroma_diag_first_pat0[] = { 0, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_diag_first_pat1[] = { 0, 10, 11, 9, 10, 11, 9, 9, 10, 11, 9, 9, 10, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_diag_first_pat2[] = { 0, 11, 10, 11, 10, 9, 11, 10, 9, 9, 10, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_diag_first_pat3[] = { 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_8x8_chroma_diag_other_pat0[] = { 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_diag_other_pat1[] = { 11, 10, 11, 9, 10, 11, 9, 9, 10, 11, 9, 9, 10, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_diag_other_pat2[] = { 11, 11, 10, 11, 10, 9, 11, 10, 9, 9, 10, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_diag_other_pat3[] = { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_8x8_chroma_hor_first_pat0 [] = { 0, 10, 10, 9, 10, 10, 9, 9, 10, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_hor_first_pat1 [] = { 0, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_hor_first_pat2 [] = { 0, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9 }; -static const uint8_t spat_8x8_chroma_hor_first_pat3 [] = { 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_8x8_chroma_hor_other_pat0 [] = { 11, 10, 10, 9, 10, 10, 9, 9, 10, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_hor_other_pat1 [] = { 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_hor_other_pat2 [] = { 11, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9 }; -static const uint8_t spat_8x8_chroma_hor_other_pat3 [] = { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_8x8_chroma_ver_first_pat0 [] = { 0, 10, 10, 9, 10, 10, 9, 9, 10, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_ver_first_pat1 [] = { 0, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9 }; -static const uint8_t spat_8x8_chroma_ver_first_pat2 [] = { 0, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_ver_first_pat3 [] = { 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_8x8_chroma_ver_other_pat0 [] = { 11, 10, 10, 9, 10, 10, 9, 9, 10, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_ver_other_pat1 [] = { 11, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9, 11, 10, 9, 9 }; -static const uint8_t spat_8x8_chroma_ver_other_pat2 [] = { 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9 }; -static const uint8_t spat_8x8_chroma_ver_other_pat3 [] = { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; -static const uint8_t spat_nxn_chroma_diag_first_pat0[] = { 0, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_diag_first_pat1[] = { 0, 13, 14, 12, 13, 14, 12, 12, 13, 14, 12, 12, 13, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_diag_first_pat2[] = { 0, 14, 13, 14, 13, 12, 14, 13, 12, 12, 13, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_diag_first_pat3[] = { 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_nxn_chroma_diag_other_pat0[] = { 14, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_diag_other_pat1[] = { 14, 13, 14, 12, 13, 14, 12, 12, 13, 14, 12, 12, 13, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_diag_other_pat2[] = { 14, 14, 13, 14, 13, 12, 14, 13, 12, 12, 13, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_diag_other_pat3[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_nxn_chroma_hor_first_pat0 [] = { 0, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_hor_first_pat1 [] = { 0, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_hor_first_pat2 [] = { 0, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12 }; -static const uint8_t spat_nxn_chroma_hor_first_pat3 [] = { 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_nxn_chroma_hor_other_pat0 [] = { 14, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_hor_other_pat1 [] = { 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_hor_other_pat2 [] = { 14, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12 }; -static const uint8_t spat_nxn_chroma_hor_other_pat3 [] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_nxn_chroma_ver_first_pat0 [] = { 0, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_ver_first_pat1 [] = { 0, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12 }; -static const uint8_t spat_nxn_chroma_ver_first_pat2 [] = { 0, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_ver_first_pat3 [] = { 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_nxn_chroma_ver_other_pat0 [] = { 14, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_ver_other_pat1 [] = { 14, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12, 14, 13, 12, 12 }; -static const uint8_t spat_nxn_chroma_ver_other_pat2 [] = { 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12 }; -static const uint8_t spat_nxn_chroma_ver_other_pat3 [] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; -static const uint8_t spat_cg2_chroma_diag_first_pat0[] = { 0, 13, 13, 12 }; -static const uint8_t spat_cg2_chroma_diag_first_pat1[] = { 0, 13, 14, 13 }; -static const uint8_t spat_cg2_chroma_diag_first_pat2[] = { 0, 14, 13, 13 }; -static const uint8_t spat_cg2_chroma_diag_first_pat3[] = { 0, 14, 14, 14 }; -static const uint8_t spat_cg2_chroma_diag_other_pat0[] = { 14, 13, 13, 12 }; -static const uint8_t spat_cg2_chroma_diag_other_pat1[] = { 14, 13, 14, 13 }; -static const uint8_t spat_cg2_chroma_diag_other_pat2[] = { 14, 14, 13, 13 }; -static const uint8_t spat_cg2_chroma_diag_other_pat3[] = { 14, 14, 14, 14 }; -static const uint8_t spat_cg2_chroma_hor_first_pat0 [] = { 0, 13, 13, 12 }; -static const uint8_t spat_cg2_chroma_hor_first_pat1 [] = { 0, 14, 13, 13 }; -static const uint8_t spat_cg2_chroma_hor_first_pat2 [] = { 0, 13, 14, 13 }; -static const uint8_t spat_cg2_chroma_hor_first_pat3 [] = { 0, 14, 14, 14 }; -static const uint8_t spat_cg2_chroma_hor_other_pat0 [] = { 14, 13, 13, 12 }; -static const uint8_t spat_cg2_chroma_hor_other_pat1 [] = { 14, 14, 13, 13 }; -static const uint8_t spat_cg2_chroma_hor_other_pat2 [] = { 14, 13, 14, 13 }; -static const uint8_t spat_cg2_chroma_hor_other_pat3 [] = { 14, 14, 14, 14 }; -static const uint8_t spat_cg2_chroma_ver_first_pat0 [] = { 0, 13, 13, 12 }; -static const uint8_t spat_cg2_chroma_ver_first_pat1 [] = { 0, 13, 14, 13 }; -static const uint8_t spat_cg2_chroma_ver_first_pat2 [] = { 0, 14, 13, 13 }; -static const uint8_t spat_cg2_chroma_ver_first_pat3 [] = { 0, 14, 14, 14 }; -static const uint8_t spat_cg2_chroma_ver_other_pat0 [] = { 14, 13, 13, 12 }; -static const uint8_t spat_cg2_chroma_ver_other_pat1 [] = { 14, 13, 14, 13 }; -static const uint8_t spat_cg2_chroma_ver_other_pat2 [] = { 14, 14, 13, 13 }; -static const uint8_t spat_cg2_chroma_ver_other_pat3 [] = { 14, 14, 14, 14 }; - -static const uint8_t* spat_bypass_luma [] = { spat_bypass_luma_all, spat_bypass_luma_all, spat_bypass_luma_all, spat_bypass_luma_all, spat_bypass_luma_all, spat_bypass_luma_all, spat_bypass_luma_all, spat_bypass_luma_all }; -static const uint8_t* spat_4x4_luma_diag [] = { spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all }; -static const uint8_t* spat_4x4_luma_hor [] = { spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all }; -static const uint8_t* spat_4x4_luma_ver [] = { spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all }; -static const uint8_t* spat_8x8_luma_diag [] = { spat_8x8_luma_diag_first_pat0, spat_8x8_luma_diag_first_pat1, spat_8x8_luma_diag_first_pat2, spat_8x8_luma_diag_first_pat3, spat_8x8_luma_diag_other_pat0, spat_8x8_luma_diag_other_pat1, spat_8x8_luma_diag_other_pat2, spat_8x8_luma_diag_other_pat3 } ; -static const uint8_t* spat_8x8_luma_hor [] = { spat_8x8_luma_hor_first_pat0, spat_8x8_luma_hor_first_pat1, spat_8x8_luma_hor_first_pat2, spat_8x8_luma_hor_first_pat3, spat_8x8_luma_hor_other_pat0, spat_8x8_luma_hor_other_pat1, spat_8x8_luma_hor_other_pat2, spat_8x8_luma_hor_other_pat3 }; -static const uint8_t* spat_8x8_luma_ver [] = { spat_8x8_luma_ver_first_pat0, spat_8x8_luma_ver_first_pat1, spat_8x8_luma_ver_first_pat2, spat_8x8_luma_ver_first_pat3, spat_8x8_luma_ver_other_pat0, spat_8x8_luma_ver_other_pat1, spat_8x8_luma_ver_other_pat2, spat_8x8_luma_ver_other_pat3 }; -static const uint8_t* spat_nxn_luma_diag [] = { spat_nxn_luma_diag_first_pat0, spat_nxn_luma_diag_first_pat1, spat_nxn_luma_diag_first_pat2, spat_nxn_luma_diag_first_pat3, spat_nxn_luma_diag_other_pat0, spat_nxn_luma_diag_other_pat1, spat_nxn_luma_diag_other_pat2, spat_nxn_luma_diag_other_pat3 }; -static const uint8_t* spat_nxn_luma_hor [] = { spat_nxn_luma_hor_first_pat0, spat_nxn_luma_hor_first_pat1, spat_nxn_luma_hor_first_pat2, spat_nxn_luma_hor_first_pat3, spat_nxn_luma_hor_other_pat0, spat_nxn_luma_hor_other_pat1, spat_nxn_luma_hor_other_pat2, spat_nxn_luma_hor_other_pat3 }; -static const uint8_t* spat_nxn_luma_ver [] = { spat_nxn_luma_ver_first_pat0, spat_nxn_luma_ver_first_pat1, spat_nxn_luma_ver_first_pat2, spat_nxn_luma_ver_first_pat3, spat_nxn_luma_ver_other_pat0, spat_nxn_luma_ver_other_pat1, spat_nxn_luma_ver_other_pat2, spat_nxn_luma_ver_other_pat3 }; -static const uint8_t* spat_bypass_chroma [] = { spat_bypass_chroma_all, spat_bypass_chroma_all, spat_bypass_chroma_all, spat_bypass_chroma_all, spat_bypass_chroma_all, spat_bypass_chroma_all, spat_bypass_chroma_all, spat_bypass_chroma_all }; -static const uint8_t* spat_4x4_chroma_diag[] = { spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all, spat_4x4_diag_all }; -static const uint8_t* spat_4x4_chroma_hor [] = { spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all, spat_4x4_hor_all }; -static const uint8_t* spat_4x4_chroma_ver [] = { spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all, spat_4x4_ver_all }; -static const uint8_t* spat_8x8_chroma_diag[] = { spat_8x8_chroma_diag_first_pat0, spat_8x8_chroma_diag_first_pat1, spat_8x8_chroma_diag_first_pat2, spat_8x8_chroma_diag_first_pat3, spat_8x8_chroma_diag_other_pat0, spat_8x8_chroma_diag_other_pat1, spat_8x8_chroma_diag_other_pat2, spat_8x8_chroma_diag_other_pat3 }; -static const uint8_t* spat_8x8_chroma_hor [] = { spat_8x8_chroma_hor_first_pat0, spat_8x8_chroma_hor_first_pat1, spat_8x8_chroma_hor_first_pat2, spat_8x8_chroma_hor_first_pat3, spat_8x8_chroma_hor_other_pat0, spat_8x8_chroma_hor_other_pat1, spat_8x8_chroma_hor_other_pat2, spat_8x8_chroma_hor_other_pat3 }; -static const uint8_t* spat_8x8_chroma_ver [] = { spat_8x8_chroma_ver_first_pat0, spat_8x8_chroma_ver_first_pat1, spat_8x8_chroma_ver_first_pat2, spat_8x8_chroma_ver_first_pat3, spat_8x8_chroma_ver_other_pat0, spat_8x8_chroma_ver_other_pat1, spat_8x8_chroma_ver_other_pat2, spat_8x8_chroma_ver_other_pat3 }; -static const uint8_t* spat_nxn_chroma_diag[] = { spat_nxn_chroma_diag_first_pat0, spat_nxn_chroma_diag_first_pat1, spat_nxn_chroma_diag_first_pat2, spat_nxn_chroma_diag_first_pat3, spat_nxn_chroma_diag_other_pat0, spat_nxn_chroma_diag_other_pat1, spat_nxn_chroma_diag_other_pat2, spat_nxn_chroma_diag_other_pat3 }; -static const uint8_t* spat_nxn_chroma_hor [] = { spat_nxn_chroma_hor_first_pat0, spat_nxn_chroma_hor_first_pat1, spat_nxn_chroma_hor_first_pat2, spat_nxn_chroma_hor_first_pat3, spat_nxn_chroma_hor_other_pat0, spat_nxn_chroma_hor_other_pat1, spat_nxn_chroma_hor_other_pat2, spat_nxn_chroma_hor_other_pat3 }; -static const uint8_t* spat_nxn_chroma_ver [] = { spat_nxn_chroma_ver_first_pat0, spat_nxn_chroma_ver_first_pat1, spat_nxn_chroma_ver_first_pat2, spat_nxn_chroma_ver_first_pat3, spat_nxn_chroma_ver_other_pat0, spat_nxn_chroma_ver_other_pat1, spat_nxn_chroma_ver_other_pat2, spat_nxn_chroma_ver_other_pat3 }; -static const uint8_t* spat_cg2_chroma_diag[] = { spat_cg2_chroma_diag_first_pat0, spat_cg2_chroma_diag_first_pat1, spat_cg2_chroma_diag_first_pat2, spat_cg2_chroma_diag_first_pat3, spat_cg2_chroma_diag_other_pat0, spat_cg2_chroma_diag_other_pat1, spat_cg2_chroma_diag_other_pat2, spat_cg2_chroma_diag_other_pat3 }; -static const uint8_t* spat_cg2_chroma_hor [] = { spat_cg2_chroma_hor_first_pat0, spat_cg2_chroma_hor_first_pat1, spat_cg2_chroma_hor_first_pat2, spat_cg2_chroma_hor_first_pat3, spat_cg2_chroma_hor_other_pat0, spat_cg2_chroma_hor_other_pat1, spat_cg2_chroma_hor_other_pat2, spat_cg2_chroma_hor_other_pat3 }; -static const uint8_t* spat_cg2_chroma_ver [] = { spat_cg2_chroma_ver_first_pat0, spat_cg2_chroma_ver_first_pat1, spat_cg2_chroma_ver_first_pat2, spat_cg2_chroma_ver_first_pat3, spat_cg2_chroma_ver_other_pat0, spat_cg2_chroma_ver_other_pat1, spat_cg2_chroma_ver_other_pat2, spat_cg2_chroma_ver_other_pat3 }; - -static const uint8_t** spat_sig_ctx[2][5][3] = -{ - { - { spat_bypass_luma, spat_bypass_luma, spat_bypass_luma }, - { spat_4x4_luma_diag, spat_4x4_luma_hor, spat_4x4_luma_ver }, - { spat_8x8_luma_diag, spat_8x8_luma_hor, spat_8x8_luma_ver }, - { spat_nxn_luma_diag, spat_nxn_luma_hor, spat_nxn_luma_ver }, - { nullptr, nullptr, nullptr } - }, - { - { spat_bypass_chroma, spat_bypass_chroma, spat_bypass_chroma }, - { spat_4x4_chroma_diag, spat_4x4_chroma_hor, spat_4x4_chroma_ver }, - { spat_8x8_chroma_diag, spat_8x8_chroma_hor, spat_8x8_chroma_ver }, - { spat_nxn_chroma_diag, spat_nxn_chroma_hor, spat_nxn_chroma_ver }, - { spat_cg2_chroma_diag, spat_cg2_chroma_hor, spat_cg2_chroma_ver } - } -}; -#endif -#endif #if HEVC_USE_SIGN_HIDING CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID component, bool signHide) @@ -231,16 +59,8 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp , m_log2BlockHeight (g_aucLog2[m_height]) , m_log2BlockSize ((m_log2BlockWidth + m_log2BlockHeight)>>1) , m_maxNumCoeff (m_width * m_height) -#if JVET_K0072 -#else - , m_AlignFlag (tu.cs->sps->getSpsRangeExtension().getCabacBypassAlignmentEnabledFlag()) -#endif #if HEVC_USE_SIGN_HIDING , m_signHiding (signHide) -#endif -#if JVET_K0072 -#else - , m_useGoRiceParAdapt (tu.cs->sps->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag()) #endif , m_extendedPrecision (tu.cs->sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag()) , m_maxLog2TrDynamicRange (tu.cs->sps->getMaxLog2TrDynamicRange(m_chType)) @@ -262,14 +82,6 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp , m_lastShiftX (0) , m_lastShiftY (0) , m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.transformSkip[m_compID])) -#if JVET_K0072 -#else - , m_SigBlockType (m_TrafoBypass ? 0 : m_width == 4 && m_height == 4 ? 1 : m_width == 8 && m_height == 8 ? 2 : m_log2CGSize==2 ? 4 : 3 ) -#if !HM_QTBT_AS_IN_JEM_CONTEXT - , m_SigScanPatternBase (spat_sig_ctx[m_chType][m_SigBlockType][m_scanType]) -#endif - , m_sigCtxSet (Ctx::SigFlag[m_chType]) -#endif , m_scanPosLast (-1) , m_subSetId (-1) , m_subSetPos (-1) @@ -278,25 +90,12 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp , m_minSubPos (-1) , m_maxSubPos (-1) , m_sigGroupCtxId (-1) -#if JVET_K0072 , m_tmplCpSum1 (-1) , m_tmplCpDiag (-1) , m_sigFlagCtxSet { Ctx::SigFlag[m_chType], Ctx::SigFlag[m_chType+2], Ctx::SigFlag[m_chType+4] } , m_parFlagCtxSet ( Ctx::ParFlag[m_chType] ) , m_gtxFlagCtxSet { Ctx::GtxFlag[m_chType], Ctx::GtxFlag[m_chType+2] } -#else -#if !HM_QTBT_AS_IN_JEM_CONTEXT - , m_sigScanCtxId (0) -#endif - , m_gt1FlagCtxSet (0, 0) - , m_gt2FlagCtxId (-1) - , m_currentGolombRiceStatistic(-1) - , m_prevGt2 (false) -#endif , m_sigCoeffGroupFlag () -#if JVET_K0072 -#else -#endif , m_emtNumSigCoeff (0) { // LOGTODO @@ -343,9 +142,6 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp const_cast<int&>(m_lastShiftX) = (log2sizeX + 1) >> 2; const_cast<int&>(m_lastShiftY) = (log2sizeY + 1) >> 2; } -#if JVET_K0072 -#else -#endif } void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag ) @@ -360,105 +156,14 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag ) { m_sigCoeffGroupFlag.set ( m_subSetPos ); } -#if JVET_K0072 unsigned CGPosY = m_subSetPosY; unsigned CGPosX = m_subSetPosX; unsigned sigRight = unsigned( ( CGPosX + 1 ) < m_widthInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + 1 ] : false ); unsigned sigLower = unsigned( ( CGPosY + 1 ) < m_heightInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + m_widthInGroups ] : false ); m_sigGroupCtxId = Ctx::SigCoeffGroup[m_chType]( sigRight | sigLower ); -#else - unsigned CGPosY = 0; - unsigned CGPosX = 0; - unsigned sigRight = 0; - unsigned sigLower = 0; - { - CGPosY = m_subSetPosY; - CGPosX = m_subSetPosX; - sigRight = unsigned( ( CGPosX + 1 ) < m_widthInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + 1 ] : false ); - sigLower = unsigned( ( CGPosY + 1 ) < m_heightInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + m_widthInGroups ] : false ); - } - const unsigned ctxSet = m_prevGt2 + ( m_chType == CHANNEL_TYPE_LUMA ? ( m_subSetId > 0 ? 2 : 0 ) : 4 ); - m_sigGroupCtxId = Ctx::SigCoeffGroup[m_chType]( sigRight | sigLower ); - m_gt1FlagCtxSet = Ctx::GreaterOneFlag[ ctxSet ]; - m_gt2FlagCtxId = Ctx::GreaterTwoFlag( ctxSet ); -#if HM_QTBT_AS_IN_JEM_CONTEXT - m_sigCGPattern = sigRight + ( sigLower << 1 ); -#else - m_sigScanCtxId = m_SigScanPatternBase[ sigRight + ( sigLower << 1 ) + ( m_subSetId ? 4 : 0 ) ] - m_minSubPos; -#endif - -#endif } -#if JVET_K0072 -#else -#if HM_QTBT_AS_IN_JEM_CONTEXT // ctx modeling for subblocks != 4x4 -unsigned CoeffCodingContext::sigCtxId( int scanPos ) const -{ - int offset = 0; // DC - - if( m_SigBlockType == 0 ) // bypass - { - offset = ( m_chType == CHANNEL_TYPE_LUMA ? 27 : 15 ); - } - else if( scanPos ) - { - const unsigned posY = m_scanPosY[ scanPos ]; - const unsigned posX = m_scanPosX[ scanPos ]; - - if( m_SigBlockType == 1 ) // 4x4 - { - // const unsigned ctxIndMap4x4[16] = { 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8 }; - offset = ctxIndMap4x4[ ( posY << 2 ) + posX ]; - } - else - { - int cnt = 0; - switch( m_sigCGPattern ) - { - case 0: - { - unsigned posIS = ( posX & 3 ) + ( posY & 3 ); - cnt = ( posIS >= 3 ? 0 : posIS >= 1 ? 1 : 2 ); - } - break; - case 1: - { - unsigned posIS = ( posY & 3 ); - cnt = ( posIS >= 2 ? 0 : posIS >= 1 ? 1 : 2 ); - } - break; - case 2: - { - unsigned posIS = ( posX & 3 ); - cnt = ( posIS >= 2 ? 0 : posIS >= 1 ? 1 : 2 ); - } - break; - case 3: - { - cnt = 2; - } - break; - default: - THROW( "sig pattern must be in range [0;3]" ); - } - offset = ( m_chType == CHANNEL_TYPE_LUMA && ( posX > 3 || posY > 3 ) ? 3 : 0 ) + cnt; - - if( m_SigBlockType == 2 ) // 8x8 - { - offset += ( m_scanType != SCAN_DIAG && m_chType == CHANNEL_TYPE_LUMA ? 15 : 9 ); - } - else // NxN - { - offset += ( m_chType == CHANNEL_TYPE_LUMA ? 21 : 12 ); - } - } - } - return m_sigCtxSet( offset ); -} -#endif -#endif unsigned DeriveCtx::CtxCUsplit( const CodingStructure& cs, Partitioner& partitioner ) @@ -513,25 +218,15 @@ unsigned DeriveCtx::CtxCUsplit( const CodingStructure& cs, Partitioner& partitio } #if ENABLE_BMS -#if JVET_K0072 unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf ) #else -unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth ) -#endif -#else -#if JVET_K0072 unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const bool prevCbCbf ) -#else -unsigned DeriveCtx::CtxQtCbf( const ComponentID compID ) -#endif #endif { -#if JVET_K0072 if( compID == COMPONENT_Cr ) { return ( prevCbCbf ? 1 : 0 ); } -#endif #if ENABLE_BMS if( isChroma( compID ) ) { diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index 6d234252a677ae428ada384a0099b572491d6a59..95bc012dc63d8da67a5b47f3f0fa886e5c4c9c79 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -62,13 +62,6 @@ public: void resetSigGroup () { m_sigCoeffGroupFlag.reset( m_subSetPos ); } void setSigGroup () { m_sigCoeffGroupFlag.set( m_subSetPos ); } void setScanPosLast ( int posLast ) { m_scanPosLast = posLast; } -#if JVET_K0072 -#else - void setGt2Flag ( bool gt2Flag ) { m_prevGt2 = gt2Flag; } - void setGoRiceStats ( unsigned GRStats ) { m_currentGolombRiceStatistic = GRStats; } - void incGoRiceStats () { m_currentGolombRiceStatistic++; } - void decGoRiceStats () { m_currentGolombRiceStatistic--; } -#endif public: ComponentID compID () const { return m_compID; } int subSetId () const { return m_subSetId; } @@ -81,18 +74,9 @@ public: unsigned log2BlockWidth () const { return m_log2BlockWidth; } unsigned log2BlockHeight () const { return m_log2BlockHeight; } unsigned log2BlockSize () const { return m_log2BlockSize; } -#if JVET_K0072 -#else - bool updGoRiceStats () const { return m_useGoRiceParAdapt; } -#endif bool extPrec () const { return m_extendedPrecision; } int maxLog2TrDRange () const { return m_maxLog2TrDynamicRange; } unsigned maxNumCoeff () const { return m_maxNumCoeff; } -#if JVET_K0072 -#else - unsigned currGoRiceStats () const { return m_currentGolombRiceStatistic; } - bool alignFlag () const { return m_AlignFlag; } -#endif int scanPosLast () const { return m_scanPosLast; } int minSubPos () const { return m_minSubPos; } int maxSubPos () const { return m_maxSubPos; } @@ -114,24 +98,7 @@ public: unsigned lastXCtxId ( unsigned posLastX ) const { return m_CtxSetLastX( m_lastOffsetX + ( posLastX >> m_lastShiftX ) ); } unsigned lastYCtxId ( unsigned posLastY ) const { return m_CtxSetLastY( m_lastOffsetY + ( posLastY >> m_lastShiftY ) ); } unsigned sigGroupCtxId () const { return m_sigGroupCtxId; } -#if JVET_K0072 -#else -#if HM_QTBT_AS_IN_JEM_CONTEXT // ctx modeling for subblocks != 4x4 - unsigned sigCtxId ( int scanPos ) const; -#else - unsigned sigCtxId ( int scanPos ) const { return m_sigCtxSet( m_sigScanCtxId[ scanPos ] ); } -#endif - unsigned greater1CtxId ( int gt1Ctx ) const { return m_gt1FlagCtxSet( gt1Ctx ); } - unsigned greater2CtxId () const { return m_gt2FlagCtxId; } - - unsigned sigGroupCtxIdOfs() const - { - return Ctx::SigCoeffGroup[ m_chType + 2 ]( 0 ); - } -#endif - -#if JVET_K0072 unsigned sigCtxIdAbs( int scanPos, const TCoeff* coeff, const int state ) { const uint32_t posY = m_scanPosY[ scanPos ]; @@ -219,217 +186,6 @@ public: return r; } -#else - unsigned sigCtxId ( int scanPos, - const TCoeff* coeff, - int strd = 0 ) - { - const uint32_t posY = m_scanPosY[scanPos]; - const uint32_t posX = m_scanPosX[scanPos]; - - strd = strd == 0 ? m_width : strd; - const TCoeff *pData = coeff + posX + posY * strd; - const int widthM1 = m_width - 1; - const int heightM1 = m_height - 1; - const int diag = posX + posY; - - int numPos = 0; - - if( posX < widthM1 ) - { - numPos += pData[ 1 ] != 0; - if( posX < widthM1 - 1 ) - { - numPos += pData[ 2 ] != 0; - } - if( posY < heightM1 ) - { - numPos += pData[ m_width + 1 ] != 0; - } - } - if( posY < heightM1 ) - { - numPos += pData[ m_width ] != 0; - if( posY < heightM1 - 1 ) - { - numPos += pData[ 2 * m_width ] != 0; - } - } - - const int ctxIdx = std::min( numPos, 5 ); - int ctxOfs = diag < 2 ? 6 : 0; - - if( m_chType == CHANNEL_TYPE_LUMA ) - { - ctxOfs += diag < 5 ? 6 : 0; - } - - if( m_log2BlockSize > 2 && m_chType == CHANNEL_TYPE_LUMA ) - { - ctxOfs += 18 << std::min( 1, ( (int)m_log2BlockSize - 3 ) ); - } - - return m_sigCtxSet( ctxOfs + ctxIdx ); - } - - unsigned sigCtxIdOfs() const - { - return m_sigCtxSet( 0 ); - } - - unsigned greater1CtxId( int scanPos, - const TCoeff* coeff, - int strd = 0 ) - { - const uint32_t posY = m_scanPosY[scanPos]; - const uint32_t posX = m_scanPosX[scanPos]; - - strd = strd == 0 ? m_width : strd; - const TCoeff *pData = coeff + posX + posY * strd; - const int widthM1 = m_width - 1; - const int heightM1 = m_height - 1; - const int diag = posX + posY; - - int numPos = 0; - - if( posX < widthM1 ) - { - numPos += abs( pData[ 1 ] ) > 1; - if( posX < widthM1 - 1 ) - { - numPos += abs( pData[ 2 ] ) > 1; - } - if( posY < heightM1 ) - { - numPos += abs( pData[ m_width + 1 ] ) > 1; - } - } - if( posY < heightM1 ) - { - numPos += abs( pData[ m_width ] ) > 1; - if( posY < heightM1 - 1 ) - { - numPos += abs( pData[ 2 * m_width ] ) > 1; - } - } - - const int ctxIdx = std::min( numPos, 4 ) + 1; - int ctxOfs = 0; - - if( m_chType == CHANNEL_TYPE_LUMA ) - { - ctxOfs += diag < 3 ? 10 : ( diag < 10 ? 5 : 0 ); - } - - return m_gt1FlagCtxSet( ctxOfs + ctxIdx ); - } - - unsigned greater1CtxIdOfs() const - { - return m_gt1FlagCtxSet( 0 ); - } - - unsigned greater2CtxId( int scanPos, - const TCoeff* coeff, - int strd = 0 ) - { - const uint32_t posY = m_scanPosY[ scanPos ]; - const uint32_t posX = m_scanPosX[ scanPos ]; - - strd = strd == 0 ? m_width : strd; - const TCoeff *pData = coeff + posX + posY * strd; - const int widthM1 = m_width - 1; - const int heightM1 = m_height - 1; - const int diag = posX + posY; - - int numPos = 0; - - if( posX < widthM1 ) - { - numPos += abs( pData[ 1 ] ) > 2; - if( posX < widthM1 - 1 ) - { - numPos += abs( pData[ 2 ] ) > 2; - } - if( posY < heightM1 ) - { - numPos += abs( pData[ m_width + 1 ] ) > 2; - } - } - if( posY < heightM1 ) - { - numPos += abs( pData[ m_width ] ) > 2; - if( posY < heightM1 - 1 ) - { - numPos += abs( pData[ 2 * m_width ] ) > 2; - } - } - - const int ctxIdx = std::min( numPos, 4 ) + 1; - int ctxOfs = 0; - - if( m_chType == CHANNEL_TYPE_LUMA ) - { - ctxOfs += diag < 3 ? 10 : ( diag < 10 ? 5 : 0 ); - } - - return m_gt1FlagCtxSet( ctxOfs + ctxIdx ); - } - - unsigned GoRicePar ( int scanPos, - const TCoeff* coeff, - int strd = 0 ) - { - const uint32_t posY = m_scanPosY[ scanPos ]; - const uint32_t posX = m_scanPosX[ scanPos ]; - - strd = strd == 0 ? m_width : strd; - const TCoeff *pData = coeff + posX + posY * strd; - const int widthM1 = m_width - 1; - const int heightM1 = m_height - 1; -// const int diag = posX + posY; - - int numPos = 0; - int sumAbs = 0; - - if( posX < widthM1 ) - { - sumAbs += abs( pData[ 1 ] ); - numPos += pData[ 1 ] != 0; - if( posX < widthM1 - 1 ) - { - sumAbs += abs( pData[ 2 ] ); - numPos += pData[ 2 ] != 0; - } - if( posY < heightM1 ) - { - sumAbs += abs( pData[ m_width + 1 ] ); - numPos += pData[ m_width + 1 ] != 0; - } - } - if( posY < heightM1 ) - { - sumAbs += abs( pData[ m_width ] ); - numPos += pData[ m_width ] != 0; - if( posY < heightM1 - 1 ) - { - sumAbs += abs( pData[ 2 * m_width ] ); - numPos += pData[ 2 * m_width ] != 0; - } - } - - unsigned val = sumAbs - numPos; - unsigned order = 0; - for( order = 0; order < MAX_GR_ORDER_RESIDUAL; order++ ) - { - if( ( 1 << ( order + 3 ) ) > ( val + 4 ) ) - { - break; - } - } - return ( order == MAX_GR_ORDER_RESIDUAL ? ( MAX_GR_ORDER_RESIDUAL - 1 ) : order ); - } -#endif unsigned emtNumSigCoeff() const { return m_emtNumSigCoeff; } void setEmtNumSigCoeff( unsigned val ) { m_emtNumSigCoeff = val; } @@ -449,16 +205,8 @@ private: const unsigned m_log2BlockHeight; const unsigned m_log2BlockSize; const unsigned m_maxNumCoeff; -#if JVET_K0072 -#else - const bool m_AlignFlag; -#endif #if HEVC_USE_SIGN_HIDING const bool m_signHiding; -#endif -#if JVET_K0072 -#else - const bool m_useGoRiceParAdapt; #endif const bool m_extendedPrecision; const int m_maxLog2TrDynamicRange; @@ -476,14 +224,6 @@ private: const int m_lastShiftX; const int m_lastShiftY; const bool m_TrafoBypass; -#if JVET_K0072 -#else - const int m_SigBlockType; -#if !HM_QTBT_AS_IN_JEM_CONTEXT - const uint8_t** m_SigScanPatternBase; -#endif - CtxSet m_sigCtxSet; -#endif // modified int m_scanPosLast; int m_subSetId; @@ -493,27 +233,12 @@ private: int m_minSubPos; int m_maxSubPos; unsigned m_sigGroupCtxId; -#if JVET_K0072 int m_tmplCpSum1; int m_tmplCpDiag; CtxSet m_sigFlagCtxSet[3]; CtxSet m_parFlagCtxSet; CtxSet m_gtxFlagCtxSet[2]; -#else -#if HM_QTBT_AS_IN_JEM_CONTEXT - int m_sigCGPattern; -#else - const uint8_t* m_sigScanCtxId; -#endif - CtxSet m_gt1FlagCtxSet; - unsigned m_gt2FlagCtxId; - unsigned m_currentGolombRiceStatistic; - bool m_prevGt2; -#endif std::bitset<MLS_GRP_NUM> m_sigCoeffGroupFlag; -#if JVET_K0072 -#else -#endif unsigned m_emtNumSigCoeff; }; @@ -558,17 +283,9 @@ namespace DeriveCtx unsigned CtxCUsplit ( const CodingStructure& cs, Partitioner& partitioner ); unsigned CtxBTsplit ( const CodingStructure& cs, Partitioner& partitioner ); #if ENABLE_BMS -#if JVET_K0072 unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf ); #else -unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth ); -#endif -#else -#if JVET_K0072 unsigned CtxQtCbf ( const ComponentID compID, const bool prevCbCbf ); -#else -unsigned CtxQtCbf ( const ComponentID compID ); -#endif #endif unsigned CtxInterDir ( const PredictionUnit& pu ); unsigned CtxSkipFlag ( const CodingUnit& cu ); diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 259407e48e6019a910ac4a0b3a9f5c19acac1c94..6d84519bf1acbe8e24194408667688486b8671a4 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -407,14 +407,12 @@ const CtxSet ContextSetCfg::QtCbf[] = { 149, 107, 167, 154, 154, }, { 94, 138, 182, 154, 154, }, }), -#if JVET_K0072 ContextSetCfg::addCtxSet ({ { 149, 149, }, { 149, 149, }, { 94, 94, }, }), -#endif }; const CtxSet ContextSetCfg::SigCoeffGroup[] = @@ -447,7 +445,6 @@ const CtxSet ContextSetCfg::SigCoeffGroup[] = const CtxSet ContextSetCfg::SigFlag[] = { -#if JVET_K0072 ContextSetCfg::addCtxSet ({ { 106, 167, 182, 124, 139, 169, 134, 167, 197, 183, 183, 184, 209, 198, 168, 168, 183, 170, CNU, CNU, }, @@ -484,36 +481,9 @@ const CtxSet ContextSetCfg::SigFlag[] = { 167, 155, 159, 157, 157, 158, 182, 223, 223, 223, 223, 223, }, { 181, 159, 143, 232, 143, 173, 169, 237, 223, 223, 238, 253, }, }), -#else - ContextSetCfg::addCtxSet - ({ - { 170, 154, 139, 153, 139, 123, 123, 63, 124, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 140, }, - { 155, 154, 139, 153, 139, 123, 123, 63, 153, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 140, }, - { 111, 111, 125, 110, 110, 94, 124, 108, 124, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 141, }, - }), - ContextSetCfg::addCtxSet - ({ - { 170, 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140, 140, }, - { 170, 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140, 140, }, - { 140, 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111, 111, }, - }), - ContextSetCfg::addCtxSet - ({ - { 107, 139, 154, 140, 140, 141, 108, 154, 125, 155, 126, 127, 139, 155, 155, 141, 156, 143, 107, 139, 154, 140, 140, 141, 108, 154, 125, 155, 126, 127, 139, 155, 155, 141, 156, 143, 107, 139, 154, 140, 140, 141, 108, 154, 125, 155, 126, 127, 139, 155, 155, 141, 156, 143, }, - { 121, 167, 153, 139, 154, 140, 137, 168, 139, 154, 169, 155, 167, 169, 169, 184, 199, 156, 121, 167, 153, 139, 154, 140, 137, 168, 139, 154, 169, 155, 167, 169, 169, 184, 199, 156, 121, 167, 153, 139, 154, 140, 137, 168, 139, 154, 169, 155, 167, 169, 169, 184, 199, 156, }, - { 152, 139, 154, 154, 169, 155, 182, 154, 169, 184, 155, 141, 168, 214, 199, 170, 170, 171, 152, 139, 154, 154, 169, 155, 182, 154, 169, 184, 155, 141, 168, 214, 199, 170, 170, 171, 152, 139, 154, 154, 169, 155, 182, 154, 169, 184, 155, 141, 168, 214, 199, 170, 170, 171, }, - }), - ContextSetCfg::addCtxSet - ({ - { 137, 154, 154, 155, 155, 156, 124, 185, 156, 171, 142, 158, }, - { 136, 153, 139, 154, 125, 140, 122, 154, 184, 185, 171, 157, }, - { 167, 154, 169, 140, 155, 141, 153, 171, 185, 156, 171, 172, }, - }), -#endif }; -#if JVET_K0072 const CtxSet ContextSetCfg::ParFlag[] = { ContextSetCfg::addCtxSet @@ -557,7 +527,6 @@ const CtxSet ContextSetCfg::GtxFlag[] = { 147, 73, 164, 151, 107, 109, 120, 152, 140, 185, 111, }, }), }; -#endif const CtxSet ContextSetCfg::LastX[] = { @@ -591,67 +560,6 @@ const CtxSet ContextSetCfg::LastY[] = }), }; -#if JVET_K0072 -#else -const CtxSet ContextSetCfg::GreaterOneFlag[] = -{ - ContextSetCfg::addCtxSet - ({ - { 154, 196, 167, 167, }, - { 154, 196, 196, 167, }, - { 140, 92, 137, 138, }, - }), - ContextSetCfg::addCtxSet - ({ - { 154, 152, 167, 182, }, - { 154, 152, 167, 182, }, - { 140, 152, 138, 139, }, - }), - ContextSetCfg::addCtxSet - ({ - { 182, 134, 149, 136, }, - { 182, 134, 149, 136, }, - { 153, 74, 149, 92, }, - }), - ContextSetCfg::addCtxSet - ({ - { 153, 121, 136, 122, }, - { 153, 121, 136, 137, }, - { 139, 107, 122, 152, }, - }), - ContextSetCfg::addCtxSet - ({ - { 169, 208, 166, 167, }, - { 169, 194, 166, 167, }, - { 140, 179, 166, 182, }, - }), - ContextSetCfg::addCtxSet - ({ - { 154, 152, 167, 182, }, - { 154, 167, 137, 182, }, - { 140, 227, 122, 197, }, - }), - ContextSetCfg::addCtxSet - ({ - { 121, 135, 123, 124, 139, 125, 92, 124, 154, 125, 155, 138, 169, 155, 170, 156, }, - { 165, 75, 152, 153, 139, 154, 121, 138, 139, 154, 140, 167, 183, 169, 170, 156, }, - { 196, 105, 152, 153, 139, 154, 136, 138, 139, 169, 140, 196, 183, 169, 170, 171, }, - }), - ContextSetCfg::addCtxSet - ({ - { 166, 152, 140, 170, 171, 157, }, - { 193, 181, 169, 170, 171, 172, }, - { 195, 181, 169, 170, 156, 157, }, - }), -}; - -const CtxSet ContextSetCfg::GreaterTwoFlag = ContextSetCfg::addCtxSet -({ - { 107, 167, 91, 107, 107, 167,}, - { 107, 167, 91, 122, 107, 167,}, - { 138, 153, 136, 167, 152, 152,}, -}); -#endif const CtxSet ContextSetCfg::MVPIdx = ContextSetCfg::addCtxSet ({ diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index a7dc3ad292dccfb88d1bf27a743e335cdd3000f3..5dd4b3d33265b503352c5efa6a97dc50099ac854 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -175,26 +175,13 @@ public: static const CtxSet Mvd; static const CtxSet TransSubdivFlag; static const CtxSet QtRootCbf; -#if JVET_K0072 static const CtxSet QtCbf [3]; // [ channel ] -#else - static const CtxSet QtCbf [2]; // [ ChannelType ] -#endif static const CtxSet SigCoeffGroup [4]; // [ ChannelType ] -#if JVET_K0072 -#else - static const CtxSet SigFlag [4]; // [ ChannelType ] -#endif static const CtxSet LastX [2]; // [ ChannelType ] static const CtxSet LastY [2]; // [ ChannelType ] -#if JVET_K0072 static const CtxSet SigFlag [6]; // [ ChannelType + State ] static const CtxSet ParFlag [2]; // [ ChannelType ] static const CtxSet GtxFlag [4]; // [ ChannelType + x ] -#else - static const CtxSet GreaterOneFlag [8]; // [ ContextSet ] - static const CtxSet GreaterTwoFlag; -#endif static const CtxSet MVPIdx; static const CtxSet SaoMergeFlag; static const CtxSet SaoTypeIdx; diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 9f34357e7182bb28fb993957dda1b16be3a5b0ee..74fbda0365866447cc3048e5b42217626cec74ea 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -41,7 +41,6 @@ -#if JVET_K0072 namespace DQIntern @@ -1432,6 +1431,5 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo } } -#endif diff --git a/source/Lib/CommonLib/DepQuant.h b/source/Lib/CommonLib/DepQuant.h index cbfde31a1b019c9a29e0f9f6fc320f69f39fb07d..b15fdabd6219eb05b59a782ca2fe7f5ee02b5ba1 100644 --- a/source/Lib/CommonLib/DepQuant.h +++ b/source/Lib/CommonLib/DepQuant.h @@ -45,7 +45,6 @@ -#if JVET_K0072 class DepQuant : public QuantRDOQ @@ -62,7 +61,6 @@ private: }; -#endif #endif // __DEPQUANT__ diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 44459de1e7a81ba405ceef287e5ca06b7a26b9b3..bfc4a55f6d799e3671e550fdffbae17beb8d6ea2 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -430,9 +430,6 @@ void Quant::dequant(const TransformUnit &tu, void Quant::init( uint32_t uiMaxTrSize, bool bUseRDOQ, bool bUseRDOQTS, -#if JVET_K0072 -#else -#endif #if T0196_SELECTIVE_RDOQ bool useSelectiveRDOQ #endif @@ -448,9 +445,6 @@ void Quant::init( uint32_t uiMaxTrSize, #if T0196_SELECTIVE_RDOQ m_useSelectiveRDOQ = useSelectiveRDOQ; #endif -#if JVET_K0072 -#else -#endif } #if ENABLE_SPLIT_PARALLELISM @@ -721,12 +715,6 @@ void Quant::xDestroyScalingList() void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx) { const SPS &sps = *tu.cs->sps; -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - const PPS &pps = *tu.cs->pps; -#endif -#endif const CompArea &rect = tu.blocks[compID]; #if HEVC_USE_SCALING_LISTS || HEVC_USE_SIGN_HIDING const uint32_t uiWidth = rect.width; @@ -742,11 +730,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf { #if HEVC_USE_SIGN_HIDING -#if JVET_K0072 CoeffCodingContext cctx(tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag()); -#else - CoeffCodingContext cctx(tu, compID, pps.getSignDataHidingEnabledFlag()); -#endif #else CoeffCodingContext cctx(tu, compID); #endif diff --git a/source/Lib/CommonLib/Quant.h b/source/Lib/CommonLib/Quant.h index 66d7a0721ddd66dcd1eef5370a779939911ba8b5..eed6e4445e6f4ca1740a1ac038bea270db05f665 100644 --- a/source/Lib/CommonLib/Quant.h +++ b/source/Lib/CommonLib/Quant.h @@ -92,9 +92,6 @@ public: virtual void init( uint32_t uiMaxTrSize, bool useRDOQ = false, bool useRDOQTS = false, -#if JVET_K0072 -#else -#endif #if T0196_SELECTIVE_RDOQ bool useSelectiveRDOQ = false #endif @@ -150,9 +147,6 @@ protected: #if T0196_SELECTIVE_RDOQ bool m_useSelectiveRDOQ; #endif -#if JVET_K0072 -#else -#endif #if HEVC_USE_SCALING_LISTS private: void xInitScalingList ( const Quant* other ); diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 22c0776a27fb4529090982e7b60e29c414d4e10b..27e82af18ccb6ab9a9bb1068698a3ccba60829e2 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -103,7 +103,6 @@ QuantRDOQ::~QuantRDOQ() * * This method calculates the best quantized transform level for a given scan position. */ -#if JVET_K0072 inline uint32_t QuantRDOQ::xGetCodedLevel( double& rd64CodedCost, double& rd64CodedCost0, double& rd64CodedCostSig, @@ -160,65 +159,6 @@ inline uint32_t QuantRDOQ::xGetCodedLevel( double& rd64CodedCost, return uiBestAbsLevel; } -#else -inline uint32_t QuantRDOQ::xGetCodedLevel ( double& rd64CodedCost, - double& rd64CodedCost0, - double& rd64CodedCostSig, - Intermediate_Int lLevelDouble, - uint32_t uiMaxAbsLevel, - const BinFracBits* fracBitsSig, - const BinFracBits& fracBitsOne, - const BinFracBits& fracBitsAbs, - uint16_t ui16AbsGoRice, - uint32_t c1Idx, - uint32_t c2Idx, - int iQBits, - double errorScale, - bool bLast, - bool useLimitedPrefixLength, - const int maxLog2TrDynamicRange - ) const -{ - double dCurrCostSig = 0; - uint32_t uiBestAbsLevel = 0; - - if( !bLast && uiMaxAbsLevel < 3 ) - { - rd64CodedCostSig = xGetRateSigCoef( *fracBitsSig, 0 ); - rd64CodedCost = rd64CodedCost0 + rd64CodedCostSig; - if( uiMaxAbsLevel == 0 ) - { - return uiBestAbsLevel; - } - } - else - { - rd64CodedCost = MAX_DOUBLE; - } - - if( !bLast ) - { - dCurrCostSig = xGetRateSigCoef( *fracBitsSig, 1 ); - } - - uint32_t uiMinAbsLevel = ( uiMaxAbsLevel > 1 ? uiMaxAbsLevel - 1 : 1 ); - for( int uiAbsLevel = uiMaxAbsLevel; uiAbsLevel >= uiMinAbsLevel ; uiAbsLevel-- ) - { - double dErr = double( lLevelDouble - ( Intermediate_Int(uiAbsLevel) << iQBits ) ); - double dCurrCost = dErr * dErr * errorScale + xGetICost( xGetICRate( uiAbsLevel, fracBitsOne, fracBitsAbs, ui16AbsGoRice, c1Idx, c2Idx, useLimitedPrefixLength, maxLog2TrDynamicRange ) ); - dCurrCost += dCurrCostSig; - - if( dCurrCost < rd64CodedCost ) - { - uiBestAbsLevel = uiAbsLevel; - rd64CodedCost = dCurrCost; - rd64CodedCostSig = dCurrCostSig; - } - } - - return uiBestAbsLevel; -} -#endif /** Calculates the cost for specific absolute transform level * \param uiAbsLevel scaled quantized level @@ -231,7 +171,6 @@ inline uint32_t QuantRDOQ::xGetCodedLevel ( double& rd64CodedCost, * \param maxLog2TrDynamicRange * \returns cost of given absolute transform level */ -#if JVET_K0072 inline int QuantRDOQ::xGetICRate( const uint32_t uiAbsLevel, const BinFracBits& fracBitsPar, const BinFracBits& fracBitsGt1, @@ -311,84 +250,6 @@ inline int QuantRDOQ::xGetICRate( const uint32_t uiAbsLevel, } return iRate; } -#else -inline int QuantRDOQ::xGetICRate ( const uint32_t uiAbsLevel, - const BinFracBits& fracBitsOne, - const BinFracBits& fracBitsAbs, - const uint16_t ui16AbsGoRice, - const uint32_t c1Idx, - const uint32_t c2Idx, - const bool useLimitedPrefixLength, - const int maxLog2TrDynamicRange - ) const -{ - int iRate = int(xGetIEPRate()); // cost of sign bit - uint32_t baseLevel = (c1Idx < C1FLAG_NUMBER) ? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; - - if ( uiAbsLevel >= baseLevel ) - { - uint32_t symbol = uiAbsLevel - baseLevel; - uint32_t length; - const int threshold = COEF_REMAIN_BIN_REDUCTION; - if( symbol < ( threshold << ui16AbsGoRice ) ) - { - length = symbol>>ui16AbsGoRice; - iRate += (length+1+ui16AbsGoRice)<< SCALE_BITS; - } - else if (useLimitedPrefixLength) - { - const uint32_t maximumPrefixLength = (32 - (COEF_REMAIN_BIN_REDUCTION + maxLog2TrDynamicRange)); - - uint32_t prefixLength = 0; - uint32_t suffix = (symbol >> ui16AbsGoRice) - COEF_REMAIN_BIN_REDUCTION; - - while ((prefixLength < maximumPrefixLength) && (suffix > ((2 << prefixLength) - 2))) - { - prefixLength++; - } - - const uint32_t suffixLength = (prefixLength == maximumPrefixLength) ? (maxLog2TrDynamicRange - ui16AbsGoRice) : (prefixLength + 1/*separator*/); - - iRate += (COEF_REMAIN_BIN_REDUCTION + prefixLength + suffixLength + ui16AbsGoRice) << SCALE_BITS; - } - else - { - length = ui16AbsGoRice; - symbol = symbol - ( threshold << ui16AbsGoRice); - while (symbol >= (1<<length)) - { - symbol -= (1<<(length++)); - } - iRate += (threshold+length+1-ui16AbsGoRice+length)<< SCALE_BITS; - } - - if (c1Idx < C1FLAG_NUMBER) - { - iRate += fracBitsOne.intBits[1]; - - if (c2Idx < C2FLAG_NUMBER) - { - iRate += fracBitsAbs.intBits[1]; - } - } - } - else if( uiAbsLevel == 1 ) - { - iRate += fracBitsOne.intBits[0]; - } - else if( uiAbsLevel == 2 ) - { - iRate += fracBitsOne.intBits[1]; - iRate += fracBitsAbs.intBits[0]; - } - else - { - iRate = 0; - } - - return iRate; -} -#endif inline double QuantRDOQ::xGetRateSigCoeffGroup( const BinFracBits& fracBitsSigCG, unsigned uiSignificanceCoeffGroup ) const { @@ -696,12 +557,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const FracBitsAccess& fracBits = ctx.getFracBitsAcess(); const SPS &sps = *tu.cs->sps; -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - const PPS &pps = *tu.cs->pps; -#endif -#endif const CompArea &rect = tu.blocks[compID]; const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; @@ -725,12 +580,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, iTransformShift = std::max<int>(0, iTransformShift); } -#if JVET_K0072 -#else - const bool bUseGolombRiceParameterAdaptation = sps.getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag(); - const uint32_t initialGolombRiceParameter = ctx.getGRAdaptStats(TU::getGolombRiceStatisticsIndex(tu, compID)) >> 2; - uint32_t uiGoRiceParam = initialGolombRiceParameter; -#endif double d64BlockUncodedCost = 0; const uint32_t uiLog2BlockWidth = g_aucLog2[uiWidth]; #if HEVC_USE_SCALING_LISTS @@ -768,9 +617,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, memset( m_deltaU, 0, sizeof( TCoeff ) * uiMaxNumCoeff ); #endif -#if JVET_K0072 -#else -#endif const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits @@ -805,31 +651,16 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const TCoeff entropyCodingMaximum = (1 << maxLog2TrDynamicRange) - 1; #if HEVC_USE_SIGN_HIDING -#if JVET_K0072 CoeffCodingContext cctx(tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag()); -#else - CoeffCodingContext cctx(tu, compID, pps.getSignDataHidingEnabledFlag()); -#endif #else CoeffCodingContext cctx(tu, compID); #endif const int iCGSizeM1 = (1 << cctx.log2CGSize()) - 1; int iCGLastScanPos = -1; -#if JVET_K0072 -#else - int c1 = 1; - int c2 = 0; -#endif double d64BaseCost = 0; int iLastScanPos = -1; -#if JVET_K0072 -#else - uint32_t c1Idx = 0; - uint32_t c2Idx = 0; - int baseLevel; -#endif double *pdCostCoeffGroupSig = m_pdCostCoeffGroupSig; memset( pdCostCoeffGroupSig, 0, ( uiMaxNumCoeff >> cctx.log2CGSize() ) * sizeof( double ) ); @@ -891,23 +722,14 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, uint32_t uiPosY = cctx.posY( iScanPos ); uint32_t uiPosX = cctx.posX( iScanPos ); DTRACE( g_trace_ctx, D_RDOQ, "%d [%d][%d][%2d:%2d][%2d:%2d]", DTRACE_GET_COUNTER( g_trace_ctx, D_RDOQ ), iScanPos, uiBlkPos, uiCGPosX, uiCGPosY, uiPosX, uiPosY ); -#if JVET_K0072 -#else - DTRACE( g_trace_ctx, D_RDOQ, " c1: %d, c2: %d, c1Idx: %d, c2Idx: %d\n", c1, c2, c1Idx, c2Idx ); -#endif #endif //===== coefficient level estimation ===== unsigned ctxIdSig = 0; if( iScanPos != iLastScanPos ) { -#if JVET_K0072 ctxIdSig = cctx.sigCtxIdAbs( iScanPos, piDstCoeff, 0 ); -#else - ctxIdSig = cctx.sigCtxId( iScanPos ); -#endif } uint32_t uiLevel; -#if JVET_K0072 uint8_t ctxOffset = cctx.ctxOffsetAbs (); uint32_t uiParCtx = cctx.parityCtxIdAbs ( ctxOffset ); uint32_t uiGt1Ctx = cctx.greater1CtxIdAbs ( ctxOffset ); @@ -917,41 +739,19 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const BinFracBits fracBitsPar = fracBits.getFracBitsArray( uiParCtx ); const BinFracBits fracBitsGt1 = fracBits.getFracBitsArray( uiGt1Ctx ); const BinFracBits fracBitsGt2 = fracBits.getFracBitsArray( uiGt2Ctx ); -#else -#if ENABLE_TRACING - uint32_t uiOneCtx = cctx.greater1CtxId( c1 ); - uint32_t uiAbsCtx = cctx.greater2CtxId(); -#endif - const BinFracBits fracBitsOne = fracBits.getFracBitsArray( cctx.greater1CtxId( c1 ) ); - const BinFracBits fracBitsAbs = fracBits.getFracBitsArray( cctx.greater2CtxId() ); - - DTRACE_COND( ( uiMaxAbsLevel != 0 ), g_trace_ctx, D_RDOQ_MORE, " One=%d Abs=%d", uiOneCtx, uiAbsCtx ); -#endif if( iScanPos == iLastScanPos ) { -#if JVET_K0072 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, nullptr, fracBitsPar, fracBitsGt1, fracBitsGt2, uiGoRiceParam, iQBits, errorScale, 1, extendedPrecision, maxLog2TrDynamicRange ); -#else - uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], - lLevelDouble, uiMaxAbsLevel, nullptr, fracBitsOne, fracBitsAbs, - uiGoRiceParam, c1Idx, c2Idx, iQBits, errorScale, 1, extendedPrecision, maxLog2TrDynamicRange ); -#endif } else { DTRACE_COND( ( uiMaxAbsLevel != 0 ), g_trace_ctx, D_RDOQ_MORE, " uiCtxSig=%d", ctxIdSig ); const BinFracBits fracBitsSig = fracBits.getFracBitsArray( ctxIdSig ); -#if JVET_K0072 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, &fracBitsSig, fracBitsPar, fracBitsGt1, fracBitsGt2, uiGoRiceParam, iQBits, errorScale, 0, extendedPrecision, maxLog2TrDynamicRange ); -#else - uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], - lLevelDouble, uiMaxAbsLevel, &fracBitsSig, fracBitsOne, fracBitsAbs, - uiGoRiceParam, c1Idx, c2Idx, iQBits, errorScale, 0, extendedPrecision, maxLog2TrDynamicRange ); -#endif #if HEVC_USE_SIGN_HIDING sigRateDelta[ uiBlkPos ] = fracBitsSig.intBits[1] - fracBitsSig.intBits[0]; #endif @@ -966,66 +766,18 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, if( uiLevel > 0 ) { -#if JVET_K0072 int rateNow = xGetICRate( uiLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, uiGoRiceParam, extendedPrecision, maxLog2TrDynamicRange ); rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsPar, fracBitsGt1, fracBitsGt2, uiGoRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, fracBitsPar, fracBitsGt1, fracBitsGt2, uiGoRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; -#else - int rateNow = xGetICRate( uiLevel, fracBitsOne, fracBitsAbs, uiGoRiceParam, c1Idx, c2Idx, extendedPrecision, maxLog2TrDynamicRange ); - rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsOne, fracBitsAbs, uiGoRiceParam, c1Idx, c2Idx, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; - rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, fracBitsOne, fracBitsAbs, uiGoRiceParam, c1Idx, c2Idx, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; -#endif } else // uiLevel == 0 { -#if JVET_K0072 rateIncUp [ uiBlkPos ] = fracBitsPar.intBits[ 0 ] + fracBitsGt1.intBits[ 0 ]; -#else - rateIncUp [ uiBlkPos ] = fracBitsOne.intBits[ 0 ]; -#endif } #endif piDstCoeff[ uiBlkPos ] = uiLevel; d64BaseCost += pdCostCoeff [ iScanPos ]; -#if JVET_K0072 -#else - baseLevel = (c1Idx < C1FLAG_NUMBER) ? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; - if( uiLevel >= baseLevel ) - { - if (uiLevel > 3*(1<<uiGoRiceParam)) - { - uiGoRiceParam = bUseGolombRiceParameterAdaptation ? (uiGoRiceParam + 1) : (std::min<uint32_t>((uiGoRiceParam + 1), 4)); - } - } - if ( uiLevel >= 1) - { - c1Idx ++; - } - - //===== update bin model ===== - if( uiLevel > 1 ) - { - c1 = 0; - c2 += (c2 < 2); - c2Idx ++; - } - else if( (c1 < 3) && (c1 > 0) && uiLevel) - { - c1++; - } - - //===== context set update ===== - if( ( (iScanPos & iCGSizeM1) == 0 ) && ( iScanPos > 0 ) ) - { - cctx.setGt2Flag( c1 == 0 ); - c1 = 1; - c2 = 0; - c1Idx = 0; - c2Idx = 0; - uiGoRiceParam = initialGolombRiceParameter; - } -#endif } else { @@ -1141,17 +893,9 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, else { #if ENABLE_BMS -#if JVET_K0072 BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[compID]( DeriveCtx::CtxQtCbf( rect.compID, tu.depth, tu.cbf[COMPONENT_Cb] ) ) ); #else - BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[chType]( DeriveCtx::CtxQtCbf( rect.compID, tu.depth ) ) ); -#endif -#else -#if JVET_K0072 BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[compID]( DeriveCtx::CtxQtCbf( rect.compID, tu.cbf[COMPONENT_Cb] ) ) ); -#else - BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[chType]( DeriveCtx::CtxQtCbf( rect.compID ) ) ); -#endif #endif d64BestCost = d64BlockUncodedCost + xGetICost( fracBitsQtCbf.intBits[0] ); diff --git a/source/Lib/CommonLib/QuantRDOQ.h b/source/Lib/CommonLib/QuantRDOQ.h index f86106167f90059c4414a783d6e8786c6708b366..71cccd5a597d390f3d49429a0f57eb382da2b1be 100644 --- a/source/Lib/CommonLib/QuantRDOQ.h +++ b/source/Lib/CommonLib/QuantRDOQ.h @@ -82,7 +82,6 @@ private: // RDOQ functions void xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx &ctx); -#if JVET_K0072 inline uint32_t xGetCodedLevel( double& rd64CodedCost, double& rd64CodedCost0, double& rd64CodedCostSig, @@ -105,34 +104,6 @@ private: const uint16_t ui16AbsGoRice, const bool useLimitedPrefixLength, const int maxLog2TrDynamicRange ) const; -#else - inline uint32_t xGetCodedLevel ( double& rd64CodedCost, - double& rd64CodedCost0, - double& rd64CodedCostSig, - Intermediate_Int lLevelDouble, - uint32_t uiMaxAbsLevel, - const BinFracBits* fracBitsSig, - const BinFracBits& fracBitsOne, - const BinFracBits& fracBitsAbs, - uint16_t ui16AbsGoRice, - uint32_t c1Idx, - uint32_t c2Idx, - int iQBits, - double errorScale, - bool bLast, - bool useLimitedPrefixLength, - const int maxLog2TrDynamicRange - ) const; - inline int xGetICRate ( const uint32_t uiAbsLevel, - const BinFracBits& fracBitsOne, - const BinFracBits& fracBitsAbs, - const uint16_t ui16AbsGoRice, - const uint32_t c1Idx, - const uint32_t c2Idx, - const bool useLimitedPrefixLength, - const int maxLog2TrDynamicRange - ) const; -#endif inline double xGetRateLast ( const int* lastBitsX, const int* lastBitsY, unsigned PosX, unsigned PosY ) const; diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 1a123d4b6b24516dc963df6402ba2a440046102b..fa1fd5cea7aa9359953298cf6ddd695382d8ab8a 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -604,7 +604,6 @@ const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,2 const uint32_t g_uiGroupIdx[MAX_TU_SIZE] = { 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 ,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12 ,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13 }; -#if JVET_K0072 const uint32_t g_auiGoRicePars[ 32 ] = { 0, 0, 0, 0, @@ -612,7 +611,6 @@ const uint32_t g_auiGoRicePars[ 32 ] = 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 }; -#endif 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 diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index 410a307599efaa9429e49171cd63c85f4152d244..9122911f7e9cfcb515e4bd43092806de64692643 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -94,9 +94,7 @@ extern const uint32_t ctxIndMap4x4[4*4]; extern const uint32_t g_uiGroupIdx[ MAX_TU_SIZE ]; extern const uint32_t g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ]; -#if JVET_K0072 extern const uint32_t g_auiGoRicePars [ 32 ]; -#endif extern const uint32_t g_auiGoRiceRange[ MAX_GR_ORDER_RESIDUAL ]; //!< maximum value coded with Rice codes // ==================================================================================================================== diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 01f19defe4dc6034f87eb2d3ae5d4d93c5ff3334..c21822cfd5695101d31bbb8df8d604a19bdebfc5 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -68,12 +68,10 @@ Slice::Slice() , m_deblockingFilterBetaOffsetDiv2( 0 ) , m_deblockingFilterTcOffsetDiv2 ( 0 ) , m_pendingRasInit ( false ) -#if JVET_K0072 , m_depQuantEnabledFlag ( false ) #if HEVC_USE_SIGN_HIDING , m_signDataHidingEnabledFlag ( false ) #endif -#endif , m_bCheckLDC ( false ) , m_iSliceQpDelta ( 0 ) , m_iDepth ( 0 ) @@ -1654,9 +1652,6 @@ SPSNext::SPSNext( SPS& sps ) #if JVET_K0357_AMVR , m_IMV ( false ) #endif -#if JVET_K0072 -#else -#endif #if JVET_K0346 || JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC , m_highPrecMv ( false ) @@ -1688,9 +1683,6 @@ SPSNext::SPSNext( SPS& sps ) #endif #if JVET_K0357_AMVR , m_ImvMode ( IMV_OFF ) -#endif -#if JVET_K0072 -#else #endif , m_MTTMode ( 0 ) #if JVET_K0157 @@ -1816,12 +1808,6 @@ PPS::PPS() , m_numTileColumnsMinus1 (0) , m_numTileRowsMinus1 (0) #endif -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING -, m_signDataHidingEnabledFlag (false) -#endif -#endif , m_cabacInitPresentFlag (false) , m_sliceHeaderExtensionPresentFlag (false) , m_loopFilterAcrossSlicesEnabledFlag(false) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index c805570a362e34b8e6fa4967e238d0c3274bb33b..3c53b3e4b8bc3320212b95f1b1336a8895cc212b 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -805,9 +805,6 @@ private: #if JVET_K0357_AMVR bool m_IMV; // 9 #endif -#if JVET_K0072 -#else -#endif #if JVET_K0346 || JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC bool m_highPrecMv; @@ -847,9 +844,6 @@ private: #if JVET_K0357_AMVR //imv ImvMode m_ImvMode; -#endif -#if JVET_K0072 -#else #endif // multi type tree (QTBT + triple split) unsigned m_MTTMode; @@ -889,9 +883,6 @@ public: bool getUseAffineType () const { return m_AffineType; } #endif #endif -#if JVET_K0072 -#else -#endif #if JVET_K0346 || JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC void setUseHighPrecMv(bool b) { m_highPrecMv = b; } @@ -945,9 +936,6 @@ public: ImvMode getImvMode () const { return m_ImvMode; } #endif -#if JVET_K0072 -#else -#endif // multi type tree @@ -1307,12 +1295,6 @@ private: std::vector<int> m_tileRowHeight; #endif -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - bool m_signDataHidingEnabledFlag; -#endif -#endif bool m_cabacInitPresentFlag; bool m_sliceHeaderExtensionPresentFlag; @@ -1420,13 +1402,6 @@ public: uint32_t getTileRowHeight(uint32_t rowIdx) const { return m_tileRowHeight[rowIdx]; } #endif -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - void setSignDataHidingEnabledFlag( bool b ) { m_signDataHidingEnabledFlag = b; } - bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; } -#endif -#endif void setCabacInitPresentFlag( bool flag ) { m_cabacInitPresentFlag = flag; } bool getCabacInitPresentFlag() const { return m_cabacInitPresentFlag; } void setDeblockingFilterControlPresentFlag( bool val ) { m_deblockingFilterControlPresentFlag = val; } @@ -1518,11 +1493,9 @@ private: int m_aiNumRefIdx [NUM_REF_PIC_LIST_01]; // for multiple reference of current slice bool m_pendingRasInit; -#if JVET_K0072 bool m_depQuantEnabledFlag; #if HEVC_USE_SIGN_HIDING bool m_signDataHidingEnabledFlag; -#endif #endif bool m_bCheckLDC; @@ -1717,13 +1690,11 @@ public: void setMaxBTSize(int i) { m_uiMaxBTSize = i; } uint32_t getMaxBTSize() const { return m_uiMaxBTSize; } -#if JVET_K0072 void setDepQuantEnabledFlag( bool b ) { m_depQuantEnabledFlag = b; } bool getDepQuantEnabledFlag() const { return m_depQuantEnabledFlag; } #if HEVC_USE_SIGN_HIDING void setSignDataHidingEnabledFlag( bool b ) { m_signDataHidingEnabledFlag = b; } bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; } -#endif #endif void initEqualRef(); diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index c2d697fc6c2b96e3d47c1f7279b59246c2a5d9f3..1e6987c6ce7414d8a6afe3c61d6d5223912b0d1e 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -51,9 +51,7 @@ #include <memory.h> #include "QuantRDOQ.h" -#if JVET_K0072 #include "DepQuant.h" -#endif #if RExt__DECODER_DEBUG_TOOL_STATISTICS #include "CommonLib/CodingStatistics.h" @@ -270,9 +268,6 @@ void TrQuant::init( const Quant* otherQuant, const bool bUseRDOQTS, #if T0196_SELECTIVE_RDOQ const bool useSelectiveRDOQ, -#endif -#if JVET_K0072 -#else #endif const bool bEnc, const bool useTransformSkipFast, @@ -287,27 +282,16 @@ void TrQuant::init( const Quant* otherQuant, delete m_quant; m_quant = nullptr; -#if JVET_K0072 if( bUseRDOQ || !bEnc ) { m_quant = new DepQuant( otherQuant, bEnc ); } -#else - if( bUseRDOQ ) - { - m_quant = new QuantRDOQ( otherQuant ); - } -#endif else m_quant = new Quant( otherQuant ); if( m_quant ) { -#if JVET_K0072 m_quant->init( uiMaxTrSize, bUseRDOQ, bUseRDOQTS, useSelectiveRDOQ ); -#else - m_quant->init( uiMaxTrSize, bUseRDOQ, bUseRDOQTS, useSelectiveRDOQ ); -#endif } } diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h index 672c34a4adb879d4777c0ff106f98f07118408f6..e63083c09440b9869c872908db0947dfe18a0ff4 100644 --- a/source/Lib/CommonLib/TrQuant.h +++ b/source/Lib/CommonLib/TrQuant.h @@ -73,9 +73,6 @@ public: const bool bUseRDOQTS = false, #if T0196_SELECTIVE_RDOQ const bool useSelectiveRDOQ = false, -#endif -#if JVET_K0072 -#else #endif const bool bEnc = false, const bool useTransformSkipFast = false, diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 1ee58abbe17b99dc8a93ac4305f80de9c918e395..c8716aaa110dad5c6e94a6e4e3e0843e2b26390a 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -59,7 +59,6 @@ -#define JVET_K0072 1 #define JVET_K0122 1 // CE3-related: Alternative techniques for DC mode without division // Test 2: Samples are taken only along with a longer side @@ -182,7 +181,7 @@ #define HEVC_VPS 1 #define HEVC_DEPENDENT_SLICES 1 #define HEVC_TILES_WPP 1 -#elif JVET_K0072 +#else #define HEVC_USE_SIGN_HIDING 1 #endif diff --git a/source/Lib/DecoderLib/BinDecoder.cpp b/source/Lib/DecoderLib/BinDecoder.cpp index 42120ec7c1134cb2d21f8f7477c5fadb371238d8..1945e4f5000ddb73b164b19a55e274233248881b 100644 --- a/source/Lib/DecoderLib/BinDecoder.cpp +++ b/source/Lib/DecoderLib/BinDecoder.cpp @@ -180,17 +180,9 @@ unsigned BinDecoderBase::decodeBinsEP( unsigned numBins ) return bins; } -#if JVET_K0072 unsigned BinDecoderBase::decodeRemAbsEP( unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) -#else -unsigned BinDecoderBase::decodeRemAbsEP( unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange, bool altRC ) -#endif { -#if JVET_K0072 unsigned cutoff = g_auiGoRiceRange[ goRicePar ]; -#else - unsigned cutoff = altRC ? g_auiGoRiceRange[ goRicePar ] : COEF_REMAIN_BIN_REDUCTION; -#endif unsigned prefix = 0; if( useLimitedPrefixLength ) { diff --git a/source/Lib/DecoderLib/BinDecoder.h b/source/Lib/DecoderLib/BinDecoder.h index 127ee342839c256c74bf8a180b4dd1ad9ea36471..832fc5f4b0aa6f2eff05609ae35ea0c6fb410ff3 100644 --- a/source/Lib/DecoderLib/BinDecoder.h +++ b/source/Lib/DecoderLib/BinDecoder.h @@ -71,11 +71,7 @@ public: public: unsigned decodeBinEP (); unsigned decodeBinsEP ( unsigned numBins ); -#if JVET_K0072 unsigned decodeRemAbsEP ( unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ); -#else - unsigned decodeRemAbsEP ( unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange, bool altRC = false ); -#endif unsigned decodeBinTrm (); unsigned decodeBinsPCM ( unsigned numBins ); void align (); diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 9b21034ab8d3ac4fb956f818ab6297a1562eb9fb..f25f7e48d5b7ebdbee142ddc9407cd725732a630 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -1478,17 +1478,9 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, if( chromaCbfs.Cr ) { #if ENABLE_BMS -#if JVET_K0072 chromaCbfs.Cr &= cbf_comp( cs, area.blocks[COMPONENT_Cr], trDepth, chromaCbfs.Cb ); #else - chromaCbfs.Cr &= cbf_comp( cs, area.blocks[COMPONENT_Cr], trDepth ); -#endif -#else -#if JVET_K0072 chromaCbfs.Cr &= cbf_comp( cs, area.blocks[COMPONENT_Cr], chromaCbfs.Cb ); -#else - chromaCbfs.Cr &= cbf_comp( cs, area.blocks[COMPONENT_Cr] ); -#endif #endif } } @@ -1631,34 +1623,17 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, } #if ENABLE_BMS -#if JVET_K0072 bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbCbf ) #else -bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned depth ) -#endif -#else -#if JVET_K0072 bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, const bool prevCbCbf ) -#else -bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area ) -#endif #endif { -#if JVET_K0072 #if ENABLE_BMS const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbCbf ); #else const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, prevCbCbf ); #endif const CtxSet& ctxSet = Ctx::QtCbf[ area.compID ]; -#else -#if ENABLE_BMS - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth ); -#else - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID ); -#endif - const CtxSet& ctxSet = Ctx::QtCbf[ toChannelType(area.compID) ]; -#endif RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__QT_CBF, area.size(), area.compID); @@ -1793,28 +1768,18 @@ void CABACReader::transform_unit_qtbt( TransformUnit& tu, CUCtx& cuCtx, ChromaCb if( !lumaOnly ) { -#if JVET_K0072 bool prevCbf = false; -#endif for( ComponentID compID = COMPONENT_Cb; compID <= COMPONENT_Cr; compID = ComponentID( compID + 1 ) ) { bool cbf = false; #if ENABLE_BMS -#if JVET_K0072 cbf = cbf_comp( *tu.cs, tu.blocks[compID], tu.depth, prevCbf ); prevCbf = cbf; -#else - cbf = cbf_comp( *tu.cs, tu.blocks[compID], tu.depth ); -#endif chromaCbfs.cbf( compID ) = cbf; TU::setCbfAtDepth( tu, compID, tu.depth, cbf ? 1 : 0 ); #else -#if JVET_K0072 cbf = cbf_comp( *tu.cs, tu.blocks[compID], prevCbf ); prevCbf = cbf; -#else - cbf = cbf_comp( *tu.cs, tu.blocks[compID] ); -#endif chromaCbfs.cbf( compID ) = cbf; TU::setCbf( tu, compID, cbf ); #endif @@ -1953,11 +1918,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) #if HEVC_USE_SIGN_HIDING // determine sign hiding -#if JVET_K0072 bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); -#else - bool signHiding = ( cu.cs->pps->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); -#endif if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.transformSkip[compID] ) { const ChannelType chType = toChannelType( compID ); @@ -1976,22 +1937,14 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) CoeffCodingContext cctx ( tu, compID ); #endif TCoeff* coeff = tu.getCoeffs( compID ).buf; -#if JVET_K0072 -#else - unsigned& GRStats = m_BinDecoder.getCtx().getGRAdaptStats( TU::getGolombRiceStatisticsIndex( tu, compID ) ); -#endif unsigned numSig = 0; // parse last coeff position cctx.setScanPosLast( last_sig_coeff( cctx ) ); // parse subblocks -#if JVET_K0072 const int stateTransTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; -#else - cctx.setGoRiceStats( GRStats ); -#endif bool useEmt = ( cu.cs->sps->getSpsNext().getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getSpsNext().getUseInterEMT() && cu.predMode != MODE_INTRA ); useEmt = useEmt && isLuma(compID); @@ -1999,11 +1952,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--) { cctx.initSubblock ( subSetId ); -#if JVET_K0072 residual_coding_subblock( cctx, coeff, stateTransTab, state ); -#else - residual_coding_subblock( cctx, coeff ); -#endif if (useEmt) { numSig += cctx.emtNumSigCoeff(); @@ -2011,10 +1960,6 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) } } -#if JVET_K0072 -#else - GRStats = cctx.currGoRiceStats(); -#endif #if HM_EMT_NSST_AS_IN_JEM if( useEmt && !tu.transformSkip[compID] && compID == COMPONENT_Y && tu.cu->emtFlag ) @@ -2233,7 +2178,6 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx ) -#if JVET_K0072 void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* coeff, const int stateTransTable, int& state ) { // NOTE: All coefficients of the subblock must be set to zero before calling this function @@ -2386,220 +2330,6 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co cctx.setEmtNumSigCoeff( numNonZero ); } -#else - -void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* coeff ) -{ - // NOTE: All coefficients of the subblock must be set to zero before calling this function -#if RExt__DECODER_DEBUG_BIT_STATISTICS - CodingStatisticsClassType ctype_group ( STATS__CABAC_BITS__SIG_COEFF_GROUP_FLAG, cctx.width(), cctx.height(), cctx.compID() ); - CodingStatisticsClassType ctype_map ( STATS__CABAC_BITS__SIG_COEFF_MAP_FLAG, cctx.width(), cctx.height(), cctx.compID() ); - CodingStatisticsClassType ctype_gt1 ( STATS__CABAC_BITS__GT1_FLAG, cctx.width(), cctx.height(), cctx.compID() ); - CodingStatisticsClassType ctype_gt2 ( STATS__CABAC_BITS__GT2_FLAG, cctx.width(), cctx.height(), cctx.compID() ); -#endif - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_group ); - - //===== init ===== - const int maxSbbSize = 1 << cctx.log2CGSize(); - const int minSubPos = cctx.minSubPos(); - const bool isLast = cctx.isLast(); - int nextSigPos = ( isLast ? cctx.scanPosLast() : cctx.maxSubPos() ); - - //===== decode significant_coeffgroup_flag ===== - bool sigGroup = ( isLast || !minSubPos ); - if( !sigGroup ) - { - sigGroup = m_BinDecoder.decodeBin( cctx.sigGroupCtxId() ); - } - if( sigGroup ) - { - cctx.setSigGroup(); - } - else - { - return; - } - - { - //===== decode significant_coeff_flag's ===== - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_map ); - const int inferSigPos = ( cctx.isNotFirst() ? minSubPos : -1 ); - unsigned numNonZero = 0; -#if HEVC_USE_SIGN_HIDING - int firstNZPos = maxSbbSize; - int lastNZPos = -1; -#endif - int sigBlkPos [ 1 << MLS_CG_SIZE ]; - if( isLast ) - { -#if HEVC_USE_SIGN_HIDING - firstNZPos = nextSigPos; - lastNZPos = nextSigPos; -#endif - sigBlkPos[ numNonZero++ ] = cctx.blockPos( nextSigPos-- ); - } - for( ; nextSigPos >= minSubPos; nextSigPos-- ) - { - unsigned sigFlag = ( !numNonZero && nextSigPos == inferSigPos ); - if( !sigFlag ) - { - sigFlag = m_BinDecoder.decodeBin( cctx.sigCtxId( nextSigPos ) ); - } - if( sigFlag ) - { - sigBlkPos [ numNonZero++ ] = cctx.blockPos( nextSigPos ); -#if HEVC_USE_SIGN_HIDING - firstNZPos = nextSigPos; - lastNZPos = std::max<int>( lastNZPos, nextSigPos ); -#endif - } - } - - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 ); - - //===== decode abs_greater1_flag's ===== - int absCoeff [ 1 << MLS_CG_SIZE ]; - const unsigned numGt1Flags = std::min<unsigned>( numNonZero, C1FLAG_NUMBER ); - int gt2FlagIdx = maxSbbSize; - bool escapeData = false; - uint16_t ctxGt1Id = 1; - for( unsigned k = 0; k < numGt1Flags; k++ ) - { - if( m_BinDecoder.decodeBin( cctx.greater1CtxId( ctxGt1Id ) ) ) - { - absCoeff[ k ] = 2; - ctxGt1Id = 0; - if( gt2FlagIdx < maxSbbSize ) - { - escapeData = true; - } - else - { - gt2FlagIdx = k; - } - } - else - { - absCoeff[ k ] = 1; - if( ctxGt1Id && ctxGt1Id < 3 ) - { - ctxGt1Id++; - } - } - } - for( unsigned k = numGt1Flags; k < numNonZero; k++ ) - { - absCoeff[ k ] = 1; - escapeData = true; - } - cctx.setGt2Flag( ctxGt1Id == 0 ); - - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt2 ); - - //===== decode abs_greater2_flag ===== - if( gt2FlagIdx < maxSbbSize ) - { - if( m_BinDecoder.decodeBin( cctx.greater2CtxId() ) ) - { - absCoeff[ gt2FlagIdx ]++; - escapeData = true; - } - } - - //===== align data ===== - if( escapeData && cctx.alignFlag() ) - { - m_BinDecoder.align(); - } - - #if RExt__DECODER_DEBUG_BIT_STATISTICS - const bool alignGroup = escapeData && cctx.alignFlag(); - CodingStatisticsClassType ctype_signs( ( alignGroup ? STATS__CABAC_BITS__ALIGNED_SIGN_BIT : STATS__CABAC_BITS__SIGN_BIT ), cctx.width(), cctx.height(), cctx.compID() ); - CodingStatisticsClassType ctype_escs ( ( alignGroup ? STATS__CABAC_BITS__ALIGNED_ESCAPE_BITS : STATS__CABAC_BITS__ESCAPE_BITS ), cctx.width(), cctx.height(), cctx.compID() ); - #endif - - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_signs ); - - //===== decode sign's ===== -#if HEVC_USE_SIGN_HIDING - const unsigned numSigns = ( cctx.hideSign( firstNZPos, lastNZPos ) ? numNonZero - 1 : numNonZero ); - unsigned signPattern = m_BinDecoder.decodeBinsEP( numSigns ) << ( 32 - numSigns ); -#else - unsigned signPattern = m_BinDecoder.decodeBinsEP( numNonZero ) << ( 32 - numNonZero ); -#endif - - //===== decode remaining absolute values ===== - if( escapeData ) - { - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_escs ); - - bool updateGoRiceStats = cctx.updGoRiceStats(); - unsigned GoRicePar = cctx.currGoRiceStats() >> 2; - unsigned MaxGoRicePar = ( updateGoRiceStats ? std::numeric_limits<unsigned>::max() : 4 ); - int baseLevel = 3; - for( int k = 0; k < numNonZero; k++ ) - { - if( absCoeff[ k ] == baseLevel ) - { - int remAbs = m_BinDecoder.decodeRemAbsEP( GoRicePar, cctx.extPrec(), cctx.maxLog2TrDRange() ); - absCoeff[ k ] = baseLevel + remAbs; - - // update rice parameter - if( absCoeff[ k ] > ( 3 << GoRicePar ) && GoRicePar < MaxGoRicePar ) - { - GoRicePar++; - } - if( updateGoRiceStats ) - { - unsigned initGoRicePar = cctx.currGoRiceStats() >> 2; - if( remAbs >= ( 3 << initGoRicePar) ) - { - cctx.incGoRiceStats(); - } - else if( cctx.currGoRiceStats() > 0 && ( remAbs << 1 ) < ( 1 << initGoRicePar ) ) - { - cctx.decGoRiceStats(); - } - updateGoRiceStats = false; - } - } - if( k > C1FLAG_NUMBER - 2 ) - { - baseLevel = 1; - } - else if( baseLevel == 3 && absCoeff[ k ] > 1 ) - { - baseLevel = 2; - } - } - } - - //===== set final coefficents ===== - int sumAbs = 0; -#if HEVC_USE_SIGN_HIDING - for( unsigned k = 0; k < numSigns; k++ ) -#else - for( unsigned k = 0; k < numNonZero; k++ ) -#endif - { - int AbsCoeff = absCoeff[k]; - sumAbs += AbsCoeff; - coeff[ sigBlkPos[k] ] = ( signPattern & ( 1u << 31 ) ? -AbsCoeff : AbsCoeff ); - signPattern <<= 1; - } -#if HEVC_USE_SIGN_HIDING - if( numNonZero > numSigns ) - { - int k = numSigns; - int AbsCoeff = absCoeff[k]; - sumAbs += AbsCoeff; - coeff[ sigBlkPos[k] ] = ( sumAbs & 1 ? -AbsCoeff : AbsCoeff ); - } -#endif - cctx.setEmtNumSigCoeff( numNonZero ); - } -} -#endif diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index f012cb2160e7d8326f44ff54bc3d3a2f7ec26fcc..a982c0c8be7ef804a853ad78f82bd05315cf2aa7 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -113,17 +113,9 @@ public: // transform tree (clause 7.3.8.8) void transform_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); #if ENABLE_BMS -#if JVET_K0072 bool cbf_comp ( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbCbf = false ); #else - bool cbf_comp ( CodingStructure& cs, const CompArea& area, unsigned depth ); -#endif -#else -#if JVET_K0072 bool cbf_comp ( CodingStructure& cs, const CompArea& area, const bool prevCbCbf = false ); -#else - bool cbf_comp ( CodingStructure& cs, const CompArea& area ); -#endif #endif // mvd coding (clause 7.3.8.9) @@ -147,11 +139,7 @@ public: void emt_cu_flag ( CodingUnit& cu ); void explicit_rdpcm_mode ( TransformUnit& tu, ComponentID compID ); int last_sig_coeff ( CoeffCodingContext& cctx ); -#if JVET_K0072 void residual_coding_subblock ( CoeffCodingContext& cctx, TCoeff* coeff, const int stateTransTable, int& state ); -#else - void residual_coding_subblock ( CoeffCodingContext& cctx, TCoeff* coeff ); -#endif // cross component prediction (clause 7.3.8.12) void cross_comp_pred ( TransformUnit& tu, ComponentID compID ); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 19e0cfcdfc8a4bdf8f381a6c677db53784a7ff7a..66bd7a7f37edbfc2fb9313224e920cebfb7e679c 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -394,12 +394,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - READ_FLAG ( uiCode, "sign_data_hiding_enabled_flag" ); pcPPS->setSignDataHidingEnabledFlag( uiCode ); -#endif -#endif READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); @@ -802,9 +796,6 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) #if JVET_K0357_AMVR READ_FLAG( symbol, "imv_enable_flag" ); spsNext.setUseIMV ( symbol != 0 ); #endif -#if JVET_K0072 -#else -#endif #if JVET_K0346 || JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC READ_FLAG( symbol, "high_precision_motion_vectors" ); spsNext.setUseHighPrecMv(symbol != 0); @@ -885,9 +876,6 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) READ_UVLC( symbol, "mtt_mode_minus1" ); spsNext.setMTTMode( symbol + 1 ); } -#if JVET_K0072 -#else -#endif // ADD_NEW_TOOL : (sps extension parser) read tool enabling flags and associated parameters here } @@ -1673,7 +1661,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para parsePredWeightTable(pcSlice, sps); pcSlice->initWpScaling(sps); } -#if JVET_K0072 READ_FLAG( uiCode, "dep_quant_enable_flag" ); pcSlice->setDepQuantEnabledFlag( uiCode != 0 ); #if HEVC_USE_SIGN_HIDING @@ -1682,7 +1669,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para READ_FLAG( uiCode, "sign_data_hiding_enable_flag" ); pcSlice->setSignDataHidingEnabledFlag( uiCode != 0 ); } -#endif #endif if( sps->getSpsNext().getUseQTBT() ) { diff --git a/source/Lib/EncoderLib/BinEncoder.cpp b/source/Lib/EncoderLib/BinEncoder.cpp index f6d03b229aecfd91fdf5a0b18f1b9cbc814f9a19..3fc5af13e5206d5442a36fda8a6ab7a0bba9fb21 100644 --- a/source/Lib/EncoderLib/BinEncoder.cpp +++ b/source/Lib/EncoderLib/BinEncoder.cpp @@ -205,17 +205,9 @@ void BinEncoderBase::encodeBinsEP( unsigned bins, unsigned numBins ) } } -#if JVET_K0072 void BinEncoderBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) -#else -void BinEncoderBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange, bool altRC ) -#endif { -#if JVET_K0072 const unsigned threshold = g_auiGoRiceRange[ goRicePar ] << goRicePar; -#else - const unsigned threshold = ( altRC ? g_auiGoRiceRange[ goRicePar ] : COEF_REMAIN_BIN_REDUCTION ) << goRicePar; -#endif if( bins < threshold ) { const unsigned bitMask = ( 1 << goRicePar ) - 1; @@ -259,11 +251,7 @@ void BinEncoderBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool use bins -= delta; delta = 1 << (++length); } -#if JVET_K0072 unsigned numBin = g_auiGoRiceRange[ goRicePar ] + length + 1 - goRicePar; -#else - unsigned numBin = ( altRC ? g_auiGoRiceRange[ goRicePar ] : COEF_REMAIN_BIN_REDUCTION ) + length + 1 - goRicePar; -#endif encodeBinsEP( ( 1 << numBin ) - 2, numBin ); encodeBinsEP( bins, length ); } @@ -448,17 +436,9 @@ BitEstimatorBase::BitEstimatorBase( const BinProbModel* dummy ) m_EstFracBits = 0; } -#if JVET_K0072 void BitEstimatorBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) -#else -void BitEstimatorBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange, bool altRC ) -#endif { -#if JVET_K0072 const unsigned threshold = g_auiGoRiceRange[ goRicePar ] << goRicePar; -#else - const unsigned threshold = ( altRC ? g_auiGoRiceRange[ goRicePar ] : COEF_REMAIN_BIN_REDUCTION ) << goRicePar; -#endif if( bins < threshold ) { m_EstFracBits += BinProbModelBase::estFracBitsEP( ( bins >> goRicePar ) + 1 + goRicePar ); @@ -494,11 +474,7 @@ void BitEstimatorBase::encodeRemAbsEP( unsigned bins, unsigned goRicePar, bool u bins -= delta; delta = 1 << (++length); } -#if JVET_K0072 m_EstFracBits += BinProbModelBase::estFracBitsEP( g_auiGoRiceRange[ goRicePar ] + 1 + ( length << 1 ) - goRicePar ); -#else - m_EstFracBits += BinProbModelBase::estFracBitsEP( ( altRC ? g_auiGoRiceRange[ goRicePar ] : COEF_REMAIN_BIN_REDUCTION ) + 1 + ( length << 1 ) - goRicePar ); -#endif } } diff --git a/source/Lib/EncoderLib/BinEncoder.h b/source/Lib/EncoderLib/BinEncoder.h index fb4a4a32e1acef38409b746f113932460a5c7f02..d0cdd59b83120fce37a094564d298b8e8d2b1713 100644 --- a/source/Lib/EncoderLib/BinEncoder.h +++ b/source/Lib/EncoderLib/BinEncoder.h @@ -116,18 +116,10 @@ public: virtual void encodeBin ( unsigned bin, unsigned ctxId ) = 0; virtual void encodeBinEP ( unsigned bin ) = 0; virtual void encodeBinsEP ( unsigned bins, unsigned numBins ) = 0; -#if JVET_K0072 virtual void encodeRemAbsEP ( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) = 0; -#else - virtual void encodeRemAbsEP ( unsigned bins, - unsigned goRicePar, - bool useLimitedPrefixLength, - int maxLog2TrDynamicRange, - bool altResiComp = false ) = 0; -#endif virtual void encodeBinTrm ( unsigned bin ) = 0; virtual void encodeBinsPCM ( unsigned bins, unsigned numBins ) = 0; virtual void align () = 0; @@ -189,18 +181,10 @@ public: public: void encodeBinEP ( unsigned bin ); void encodeBinsEP ( unsigned bins, unsigned numBins ); -#if JVET_K0072 void encodeRemAbsEP ( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ); -#else - void encodeRemAbsEP ( unsigned bins, - unsigned goRicePar, - bool useLimitedPrefixLength, - int maxLog2TrDynamicRange, - bool altResiComp = false ); -#endif void encodeBinTrm ( unsigned bin ); void encodeBinsPCM ( unsigned bins, unsigned numBins ); void align (); @@ -265,18 +249,10 @@ public: public: void encodeBinEP ( unsigned bin ) { m_EstFracBits += BinProbModelBase::estFracBitsEP (); } void encodeBinsEP ( unsigned bins, unsigned numBins ) { m_EstFracBits += BinProbModelBase::estFracBitsEP ( numBins ); } -#if JVET_K0072 void encodeRemAbsEP ( unsigned bins, unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ); -#else - void encodeRemAbsEP ( unsigned bins, - unsigned goRicePar, - bool useLimitedPrefixLength, - int maxLog2TrDynamicRange, - bool altResiComp = false ); -#endif void encodeBinsPCM ( unsigned bins, unsigned numBins ) { m_EstFracBits += BinProbModelBase::estFracBitsEP ( numBins ); } void align (); void pcmAlignBits (); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 584968ec5e50fac41759a555dd2f01242d3538bf..69f2fa2809047d578e8e5f5a26dcc2c79919cc59 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1485,18 +1485,10 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit { #if ENABLE_BMS chromaCbfs.Cr = TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ); -#if JVET_K0072 cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr], trDepth, chromaCbfs.Cb ); -#else - cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr], trDepth ); -#endif #else chromaCbfs.Cr = TU::getCbf( tu, COMPONENT_Cr ); -#if JVET_K0072 cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr], chromaCbfs.Cb ); -#else - cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr] ); -#endif #endif } #if ENABLE_BMS @@ -1591,34 +1583,17 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit } #if ENABLE_BMS -#if JVET_K0072 void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbCbf ) #else -void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth ) -#endif -#else -#if JVET_K0072 void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area, const bool prevCbCbf ) -#else -void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area ) -#endif #endif { -#if JVET_K0072 #if ENABLE_BMS const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbCbf ); #else const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, prevCbCbf ); #endif const CtxSet& ctxSet = Ctx::QtCbf[ area.compID ]; -#else -#if ENABLE_BMS - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth ); -#else - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID ); -#endif - const CtxSet& ctxSet = Ctx::QtCbf[ toChannelType(area.compID) ]; -#endif m_BinEncoder.encodeBin( cbf, ctxSet( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "cbf_comp() etype=%d pos=(%d,%d) ctx=%d cbf=%d\n", area.compID, area.x, area.y, ctxId, cbf ); @@ -1777,25 +1752,15 @@ void CABACWriter::transform_unit_qtbt( const TransformUnit& tu, CUCtx& cuCtx, Ch if( !lumaOnly ) { -#if JVET_K0072 bool prevCbf = false; -#endif for( ComponentID compID = COMPONENT_Cb; compID <= COMPONENT_Cr; compID = ComponentID( compID + 1 ) ) { #if ENABLE_BMS -#if JVET_K0072 cbf_comp( *tu.cs, tu.cbf[compID] != 0, tu.blocks[compID], tu.depth, prevCbf ); prevCbf = (tu.cbf[compID] != 0); #else - cbf_comp( *tu.cs, tu.cbf[compID] != 0, tu.blocks[compID], tu.depth ); -#endif -#else -#if JVET_K0072 cbf_comp( *tu.cs, tu.cbf[compID] != 0, tu.blocks[compID], prevCbf ); prevCbf = (tu.cbf[compID] != 0); -#else - cbf_comp( *tu.cs, tu.cbf[compID] != 0, tu.blocks[compID] ); -#endif #endif chromaCbfs.cbf( compID ) = tu.cbf[compID] != 0; @@ -1928,11 +1893,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) #if HEVC_USE_SIGN_HIDING // determine sign hiding -#if JVET_K0072 bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); -#else - bool signHiding = ( cu.cs->pps->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); -#endif if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.transformSkip[compID] ) { const ChannelType chType = toChannelType( compID ); @@ -1951,10 +1912,6 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) CoeffCodingContext cctx ( tu, compID ); #endif const TCoeff* coeff = tu.getCoeffs( compID ).buf; -#if JVET_K0072 -#else - unsigned& GRStats = m_BinEncoder.getCtx().getGRAdaptStats( TU::getGolombRiceStatisticsIndex( tu, compID ) ); -#endif unsigned numSig = 0; // determine and set last coeff position and sig group flags @@ -1976,23 +1933,15 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) last_sig_coeff( cctx ); // code subblocks -#if JVET_K0072 const int stateTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; -#else - cctx.setGoRiceStats( GRStats ); -#endif bool useEmt = ( cu.cs->sps->getSpsNext().getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getSpsNext().getUseInterEMT() && cu.predMode != MODE_INTRA ); useEmt = useEmt && isLuma(compID); for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--) { cctx.initSubblock ( subSetId, sigGroupFlags[subSetId] ); -#if JVET_K0072 residual_coding_subblock( cctx, coeff, stateTab, state ); -#else - residual_coding_subblock( cctx, coeff ); -#endif if (useEmt) { @@ -2001,10 +1950,6 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) } } -#if JVET_K0072 -#else - GRStats = cctx.currGoRiceStats(); -#endif #if HM_EMT_NSST_AS_IN_JEM if( useEmt && !tu.transformSkip[compID] && compID == COMPONENT_Y && tu.cu->emtFlag ) @@ -2196,7 +2141,6 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx ) -#if JVET_K0072 void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoeff* coeff, const int stateTransTable, int& state ) { //===== init ===== @@ -2320,183 +2264,6 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe cctx.setEmtNumSigCoeff(numNonZero); } -#else - -void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoeff* coeff ) -{ - //===== init ===== - const int maxSbbSize = 1 << cctx.log2CGSize(); - const int minSubPos = cctx.minSubPos(); - const bool isLast = cctx.isLast(); - int nextSigPos = ( isLast ? cctx.scanPosLast() : cctx.maxSubPos() ); - - //===== encode significant_coeffgroup_flag ===== - if( !isLast && cctx.isNotFirst() ) - { - if( cctx.isSigGroup() ) - { - m_BinEncoder.encodeBin( 1, cctx.sigGroupCtxId() ); - } - else - { - m_BinEncoder.encodeBin( 0, cctx.sigGroupCtxId() ); - return; - } - } - - { - //===== encode significant_coeff_flag's ===== - const int inferSigPos = ( cctx.isNotFirst() ? minSubPos : -1 ); - unsigned numNonZero = 0; -#if HEVC_USE_SIGN_HIDING - int firstNZPos = maxSbbSize; - int lastNZPos = -1; -#endif - int absCoeff [ 1 << MLS_CG_SIZE ]; - unsigned signPattern = 0; - if( isLast ) - { -#if HEVC_USE_SIGN_HIDING - firstNZPos = nextSigPos; - lastNZPos = std::max<int>( lastNZPos, nextSigPos ); -#endif - TCoeff Coeff = coeff[ cctx.blockPos( nextSigPos-- ) ]; - absCoeff[ numNonZero++ ] = ( Coeff > 0 ? Coeff : ( signPattern++, -Coeff ) ); - } - for( ; nextSigPos >= minSubPos; nextSigPos-- ) - { - TCoeff Coeff = coeff[ cctx.blockPos( nextSigPos ) ]; - unsigned sigFlag = ( Coeff != 0 ); - if( numNonZero || nextSigPos != inferSigPos ) - { - m_BinEncoder.encodeBin( sigFlag, cctx.sigCtxId( nextSigPos ) ); - } - if( sigFlag ) - { -#if HEVC_USE_SIGN_HIDING - firstNZPos = nextSigPos; - lastNZPos = std::max<int>( lastNZPos, nextSigPos ); -#endif - signPattern <<= 1; - absCoeff[ numNonZero++ ] = ( Coeff > 0 ? Coeff : ( signPattern++, -Coeff ) ); - } - } - - - //===== decode abs_greater1_flag's ===== - const unsigned numGt1Flags = std::min<unsigned>( numNonZero, C1FLAG_NUMBER ); - int gt2FlagIdx = maxSbbSize; - bool escapeData = false; - uint16_t ctxGt1Id = 1; - for( unsigned k = 0; k < numGt1Flags; k++ ) - { - if( absCoeff[ k ] > 1 ) - { - m_BinEncoder.encodeBin( 1, cctx.greater1CtxId( ctxGt1Id ) ); - ctxGt1Id = 0; - if( gt2FlagIdx < maxSbbSize ) - { - escapeData = true; - } - else - { - gt2FlagIdx = k; - } - } - else - { - m_BinEncoder.encodeBin( 0, cctx.greater1CtxId( ctxGt1Id ) ); - if( ctxGt1Id && ctxGt1Id < 3 ) - { - ctxGt1Id++; - } - } - } - escapeData = escapeData || ( numGt1Flags < numNonZero ); - cctx.setGt2Flag( ctxGt1Id == 0 ); - - - //===== decode abs_greater2_flag ===== - if( gt2FlagIdx < maxSbbSize ) - { - if( absCoeff[ gt2FlagIdx ] > 2 ) - { - m_BinEncoder.encodeBin( 1, cctx.greater2CtxId() ); - escapeData = true; - } - else - { - m_BinEncoder.encodeBin( 0, cctx.greater2CtxId() ); - } - } - - - //===== align data ===== - if( escapeData && cctx.alignFlag() ) - { - m_BinEncoder.align(); - } - - - //===== decode sign's ===== -#if HEVC_USE_SIGN_HIDING - unsigned numSigns = numNonZero; - if( cctx.hideSign( firstNZPos, lastNZPos ) ) - { - numSigns --; - signPattern >>= 1; - } - m_BinEncoder.encodeBinsEP( signPattern, numSigns ); -#else - m_BinEncoder.encodeBinsEP( signPattern, numNonZero ); -#endif - - //===== decode remaining absolute values ===== - if( escapeData ) - { - bool updateGoRiceStats = cctx.updGoRiceStats(); - unsigned GoRicePar = cctx.currGoRiceStats() >> 2; - unsigned MaxGoRicePar = ( updateGoRiceStats ? std::numeric_limits<unsigned>::max() : 4 ); - int baseLevel = 3; - for( int k = 0; k < numNonZero; k++ ) - { - if( absCoeff[ k ] >= baseLevel ) - { - int remAbs = absCoeff[ k ] - baseLevel; - m_BinEncoder.encodeRemAbsEP( remAbs, GoRicePar, cctx.extPrec(), cctx.maxLog2TrDRange() ); - - // update rice parameter - if( absCoeff[ k ] > ( 3 << GoRicePar ) ) - { - GoRicePar = std::min<unsigned>( MaxGoRicePar, GoRicePar + 1 ); - } - if( updateGoRiceStats ) - { - unsigned initGoRicePar = cctx.currGoRiceStats() >> 2; - if( remAbs >= ( 3 << initGoRicePar) ) - { - cctx.incGoRiceStats(); - } - else if( cctx.currGoRiceStats() > 0 && ( remAbs << 1 ) < ( 1 << initGoRicePar ) ) - { - cctx.decGoRiceStats(); - } - updateGoRiceStats = false; - } - } - if( k > C1FLAG_NUMBER - 2 ) - { - baseLevel = 1; - } - else if( baseLevel == 3 && absCoeff[ k ] > 1 ) - { - baseLevel = 2; - } - } - } - } -} -#endif diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index 8e5f4dd18829d06d39360bfb28b411135fe259e5..7894e8e4a2991260682955f26183e196104235cb 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -135,17 +135,9 @@ public: // transform tree (clause 7.3.8.8) void transform_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); #if ENABLE_BMS -#if JVET_K0072 void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbCbf = false ); #else - void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth ); -#endif -#else -#if JVET_K0072 void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, const bool prevCbCbf = false ); -#else - void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area ); -#endif #endif #if JVET_K0357_AMVR @@ -173,11 +165,7 @@ public: void emt_cu_flag ( const CodingUnit& cu ); void explicit_rdpcm_mode ( const TransformUnit& tu, ComponentID compID ); void last_sig_coeff ( CoeffCodingContext& cctx ); -#if JVET_K0072 void residual_coding_subblock ( CoeffCodingContext& cctx, const TCoeff* coeff, const int stateTransTable, int& state ); -#else - void residual_coding_subblock ( CoeffCodingContext& cctx, const TCoeff* coeff ); -#endif // cross component prediction (clause 7.3.8.12) void cross_comp_pred ( const TransformUnit& tu, ComponentID compID ); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index e87c61fa32ce2e1049bee0e340f2f9feeb8ccb22..003c475f83c597edfd8433bc5f6a004e9176d32c 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -437,9 +437,7 @@ protected: std::string m_scalingListFileName; ///< quantization matrix file name #endif int m_TMVPModeId; -#if JVET_K0072 bool m_DepQuantEnabledFlag; -#endif bool m_SignDataHidingEnabledFlag; bool m_RCEnableRateControl; int m_RCTargetBitrate; @@ -1147,10 +1145,8 @@ public: int getTMVPModeId () { return m_TMVPModeId; } WeightedPredictionMethod getWeightedPredictionMethod() const { return m_weightedPredictionMethod; } void setWeightedPredictionMethod( WeightedPredictionMethod m ) { m_weightedPredictionMethod = m; } -#if JVET_K0072 void setDepQuantEnabledFlag( bool b ) { m_DepQuantEnabledFlag = b; } bool getDepQuantEnabledFlag() { return m_DepQuantEnabledFlag; } -#endif #if HEVC_USE_SIGN_HIDING void setSignDataHidingEnabledFlag( bool b ) { m_SignDataHidingEnabledFlag = b; } bool getSignDataHidingEnabledFlag() { return m_SignDataHidingEnabledFlag; } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 9f98c91521bd4a1c470651939a5c98f940b3216c..70cb6a94b4f91d3c54ab59813babf0581d6f0059 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -288,9 +288,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_useRDOQTS, #if T0196_SELECTIVE_RDOQ m_useSelectiveRDOQ, -#endif -#if JVET_K0072 -#else #endif true, m_useTransformSkipFast @@ -324,9 +321,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_useRDOQTS, #if T0196_SELECTIVE_RDOQ m_useSelectiveRDOQ, -#endif -#if JVET_K0072 -#else #endif true, m_useTransformSkipFast @@ -877,9 +871,6 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setImvMode ( ImvMode(m_ImvMode) ); sps.getSpsNext().setUseIMV ( m_ImvMode != IMV_OFF ); #endif -#if JVET_K0072 -#else -#endif #if JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC sps.getSpsNext().setUseHighPrecMv ( m_highPrecMv ); @@ -1347,12 +1338,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setUseWP( m_useWeightedPred ); pps.setWPBiPred( m_useWeightedBiPred ); pps.setOutputFlagPresentFlag( false ); -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - pps.setSignDataHidingEnabledFlag(getSignDataHidingEnabledFlag()); -#endif -#endif if ( getDeblockingFilterMetric() ) { diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index f19cb8895c7a95e80861e633437ef8027bd3a1c6..893e7b8bef9a9b9a0e3ae846100fcc9bcf85711e 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -119,12 +119,10 @@ EncSlice::setUpLambda( Slice* slice, const double dLambda, int iQP) int chromaQPOffset = slice->getPPS()->getQpOffset( compID ) + slice->getSliceChromaQpDelta( compID ); int qpc = ( iQP + chromaQPOffset < 0 ) ? iQP : getScaledChromaQP( iQP + chromaQPOffset, m_pcCfg->getChromaFormatIdc() ); double tmpWeight = pow( 2.0, ( iQP - qpc ) / 3.0 ); // takes into account of the chroma qp mapping and chroma qp Offset -#if JVET_K0072 if( m_pcCfg->getDepQuantEnabledFlag() ) { tmpWeight *= ( m_pcCfg->getGOPSize() >= 8 ? pow( 2.0, 0.1/3.0 ) : pow( 2.0, 0.2/3.0 ) ); // increase chroma weight for dependent quantization (in order to reduce bit rate shift from chroma to luma) } -#endif m_pcRdCost->setDistortionWeight( compID, tmpWeight ); #if ENABLE_WPP_PARALLELISM for( int jId = 1; jId < ( m_pcLib->getNumWppThreads() + m_pcLib->getNumWppExtraLines() ); jId++ ) @@ -302,12 +300,10 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr rpcSlice->setPicOutputFlag( true ); #endif rpcSlice->setPOC( pocCurr ); -#if JVET_K0072 rpcSlice->setDepQuantEnabledFlag( m_pcCfg->getDepQuantEnabledFlag() ); #if HEVC_USE_SIGN_HIDING rpcSlice->setSignDataHidingEnabledFlag( m_pcCfg->getSignDataHidingEnabledFlag() ); #endif -#endif #if SHARP_LUMA_DELTA_QP pcPic->fieldPic = isField; @@ -826,12 +822,10 @@ double EncSlice::calculateLambda( const Slice* slice, iQP = Clip3( -slice->getSPS()->getQpBDOffset( CHANNEL_TYPE_LUMA ), MAX_QP, (int) floor( dQP + 0.5 ) ); -#if JVET_K0072 if( m_pcCfg->getDepQuantEnabledFlag() ) { dLambda *= pow( 2.0, 0.25/3.0 ); // slight lambda adjustment for dependent quantization (due to different slope of quantizer) } -#endif // NOTE: the lambda modifiers that are sometimes applied later might be best always applied in here. return dLambda; diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index fdd0543b42ea11261e2dc997df3683c0dd80cf4c..4d6a81485433086d0906a76de8515c637022daef 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -4402,11 +4402,7 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti if( firstCbfOfCU || TU::getCbfAtDepth( currTU, COMPONENT_Cr, currDepth - 1 ) ) { const bool chroma_cbf = TU::getCbfAtDepth( currTU, COMPONENT_Cr, currDepth ); -#if JVET_K0072 m_CABACEstimator->cbf_comp( cs, chroma_cbf, currArea.blocks[COMPONENT_Cr], currDepth, TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ) ); -#else - m_CABACEstimator->cbf_comp( cs, chroma_cbf, currArea.blocks[COMPONENT_Cr], currDepth ); -#endif } } } @@ -4417,11 +4413,7 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti } #else m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, COMPONENT_Cb ), currArea.blocks[COMPONENT_Cb] ); -#if JVET_K0072 m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, COMPONENT_Cr ), currArea.blocks[COMPONENT_Cr], TU::getCbf( currTU, COMPONENT_Cb ) ); -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, COMPONENT_Cr ), currArea.blocks[COMPONENT_Cr] ); -#endif } m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, COMPONENT_Y ), currArea.Y() ); @@ -4635,19 +4627,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par nonCoeffDist = m_pcRdCost->getDistPart( zeroBuf, orgResi, channelBitDepth, compID, DF_SSE ); // initialized with zero residual distortion } -#if JVET_K0072 const bool prevCbf = ( compID == COMPONENT_Cr ? tu.cbf[COMPONENT_Cb] : false ); #if ENABLE_BMS m_CABACEstimator->cbf_comp( *csFull, false, compArea, currDepth, prevCbf ); #else m_CABACEstimator->cbf_comp( *csFull, false, compArea, prevCbf ); -#endif -#else -#if ENABLE_BMS - m_CABACEstimator->cbf_comp( *csFull, false, compArea, currDepth ); -#else - m_CABACEstimator->cbf_comp( *csFull, false, compArea ); -#endif #endif if( isCrossCPredictionAvailable ) @@ -4679,19 +4663,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->resetBits(); } -#if JVET_K0072 const bool prevCbf = ( compID == COMPONENT_Cr ? tu.cbf[COMPONENT_Cb] : false ); #if ENABLE_BMS m_CABACEstimator->cbf_comp( *csFull, true, compArea, currDepth, prevCbf ); #else m_CABACEstimator->cbf_comp( *csFull, true, compArea, prevCbf ); -#endif -#else -#if ENABLE_BMS - m_CABACEstimator->cbf_comp( *csFull, true, compArea, currDepth ); -#else - m_CABACEstimator->cbf_comp( *csFull, true, compArea ); -#endif #endif if( isCrossCPredictionAvailable ) @@ -4798,19 +4774,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par if( tu.blocks[compID].valid() ) { #if ENABLE_BMS -#if JVET_K0072 const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbfAtDepth( tu, COMPONENT_Cb, currDepth ) : false ); m_CABACEstimator->cbf_comp( *csFull, TU::getCbfAtDepth( tu, compID, currDepth ), tu.blocks[compID], currDepth, prevCbf ); #else - m_CABACEstimator->cbf_comp( *csFull, TU::getCbfAtDepth( tu, compID, currDepth ), tu.blocks[compID], currDepth ); -#endif -#else -#if JVET_K0072 const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbf( tu, COMPONENT_Cb ) : false ); m_CABACEstimator->cbf_comp( *csFull, TU::getCbf( tu, compID ), tu.blocks[compID], prevCbf ); -#else - m_CABACEstimator->cbf_comp( *csFull, TU::getCbf( tu, compID ), tu.blocks[compID] ); -#endif #endif } } diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 3431153b472e28a702d2a8f5e78cbe8c3025cd70..7d0b0d6e41093a6756c0b90b81308b579ce3d4f4 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -973,21 +973,13 @@ void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner, #if ENABLE_BMS if( currDepth == 0 || TU::getCbfAtDepth( currTU, compID, currDepth - 1 ) ) { -#if JVET_K0072 const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ) : false ); m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, currDepth ), currArea.blocks[compID], currDepth, prevCbf ); -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, currDepth ), currArea.blocks[compID], currDepth ); -#endif } #else -#if JVET_K0072 const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbf( currTU, COMPONENT_Cb ) : false ); m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, compID ), currArea.blocks[compID], prevCbf ); -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, compID ), currArea.blocks[compID] ); -#endif #endif } } diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 20371635c96e74d054442a1d889ffdd7bc7bec60..f57532132680de75c1e525eb2ad9412258099f92 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -223,12 +223,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) #endif WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits"); -#if JVET_K0072 -#else -#if HEVC_USE_SIGN_HIDING - WRITE_FLAG( pcPPS->getSignDataHidingEnabledFlag(), "sign_data_hiding_enabled_flag" ); -#endif -#endif WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1, "num_ref_idx_l0_default_active_minus1"); WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); @@ -542,9 +536,6 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) #if JVET_K0357_AMVR WRITE_FLAG( spsNext.getUseIMV() ? 1 : 0, "imv_enable_flag" ); #endif -#if JVET_K0072 -#else -#endif #if JVET_K0346 || JVET_K_AFFINE #if !REMOVE_MV_ADAPT_PREC WRITE_FLAG( spsNext.getUseHighPrecMv() ? 1 : 0, "high_precision_motion_vectors"); @@ -612,9 +603,6 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) { WRITE_UVLC( spsNext.getMTTMode() - 1, "mtt_mode_minus1" ); } -#if JVET_K0072 -#else -#endif // ADD_NEW_TOOL : (sps extension writer) write tool enabling flags and associated parameters here } @@ -1191,7 +1179,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { xCodePredWeightTable( pcSlice ); } -#if JVET_K0072 WRITE_FLAG( pcSlice->getDepQuantEnabledFlag() ? 1 : 0, "dep_quant_enable_flag" ); #if HEVC_USE_SIGN_HIDING if( !pcSlice->getDepQuantEnabledFlag() ) @@ -1202,7 +1189,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { CHECK( pcSlice->getSignDataHidingEnabledFlag(), "sign data hiding not supported when dependent quantization is enabled" ); } -#endif #endif if( pcSlice->getSPS()->getSpsNext().getUseQTBT() ) {