From 0371b893e01ea7acc4cbef9603a9b1daf016736c Mon Sep 17 00:00:00 2001 From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de> Date: Sun, 26 Apr 2020 20:12:17 +0200 Subject: [PATCH] remove macro JVET_Q0806 --- source/App/EncoderApp/EncApp.cpp | 15 - source/App/EncoderApp/EncAppCfg.cpp | 26 -- source/App/EncoderApp/EncAppCfg.h | 12 - source/Lib/CommonLib/Buffer.cpp | 2 - source/Lib/CommonLib/Buffer.h | 6 - source/Lib/CommonLib/CodingStatistics.h | 10 - source/Lib/CommonLib/CommonDef.h | 8 - source/Lib/CommonLib/ContextModelling.cpp | 8 - source/Lib/CommonLib/InterPrediction.cpp | 93 ----- source/Lib/CommonLib/InterPrediction.h | 12 - source/Lib/CommonLib/InterpolationFilter.cpp | 102 ------ source/Lib/CommonLib/InterpolationFilter.h | 9 - source/Lib/CommonLib/RdCost.cpp | 6 - source/Lib/CommonLib/RdCost.h | 12 - source/Lib/CommonLib/Rom.cpp | 65 ---- source/Lib/CommonLib/Rom.h | 7 - source/Lib/CommonLib/Slice.cpp | 7 - source/Lib/CommonLib/Slice.h | 22 -- source/Lib/CommonLib/TypeDef.h | 13 - source/Lib/CommonLib/Unit.cpp | 32 -- source/Lib/CommonLib/Unit.h | 10 - source/Lib/CommonLib/UnitTools.cpp | 162 --------- source/Lib/CommonLib/UnitTools.h | 6 - .../Lib/CommonLib/dtrace_blockstatistics.cpp | 150 -------- source/Lib/CommonLib/dtrace_blockstatistics.h | 14 - .../CommonLib/x86/InterpolationFilterX86.h | 129 ------- source/Lib/CommonLib/x86/RdCostX86.h | 4 - source/Lib/DecoderLib/CABACReader.cpp | 72 ---- source/Lib/DecoderLib/DecCu.cpp | 36 +- source/Lib/DecoderLib/DecCu.h | 4 - source/Lib/DecoderLib/VLCReader.cpp | 25 -- source/Lib/EncoderLib/CABACWriter.cpp | 61 ---- source/Lib/EncoderLib/EncCfg.h | 31 -- source/Lib/EncoderLib/EncCu.cpp | 319 ------------------ source/Lib/EncoderLib/EncCu.h | 27 -- source/Lib/EncoderLib/EncLib.cpp | 8 - source/Lib/EncoderLib/EncModeCtrl.cpp | 25 -- source/Lib/EncoderLib/EncModeCtrl.h | 8 - source/Lib/EncoderLib/VLCWriter.cpp | 16 - 39 files changed, 1 insertion(+), 1573 deletions(-) diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 834230c711..57a673def6 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -261,11 +261,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoIbcConstraintFlag ( m_IBCMode ? false : true ); m_cEncLib.setNoCiipConstraintFlag ( !m_ciip ); m_cEncLib.setNoFPelMmvdConstraintFlag ( !(m_MMVD && m_allowDisFracMMVD) ); -#if !JVET_Q0806 - m_cEncLib.setNoTriangleConstraintFlag ( !m_Triangle ); -#else m_cEncLib.setNoGeoConstraintFlag ( !m_Geo ); -#endif m_cEncLib.setNoLadfConstraintFlag ( !m_LadfEnabed ); m_cEncLib.setNoTransformSkipConstraintFlag ( !m_useTransformSkip ); m_cEncLib.setNoBDPCMConstraintFlag ( !m_useBDPCM ); @@ -461,11 +457,7 @@ void EncApp::xInitLibCfg() } #endif m_cEncLib.setUseCiip ( m_ciip ); -#if !JVET_Q0806 - m_cEncLib.setUseTriangle ( m_Triangle ); -#else m_cEncLib.setUseGeo ( m_Geo ); -#endif m_cEncLib.setUseHashME ( m_HashME ); m_cEncLib.setAllowDisFracMMVD ( m_allowDisFracMMVD ); @@ -561,11 +553,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setMaxNumMergeCand ( m_maxNumMergeCand ); m_cEncLib.setMaxNumAffineMergeCand ( m_maxNumAffineMergeCand ); -#if !JVET_Q0806 - m_cEncLib.setMaxNumGeoCand(m_maxNumGeoCand); -#else m_cEncLib.setMaxNumGeoCand ( m_maxNumGeoCand ); -#endif m_cEncLib.setMaxNumIBCMergeCand ( m_maxNumIBCMergeCand ); //====== Weighted Prediction ======== @@ -753,9 +741,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setSliceLevelWp ( m_sliceLevelWp ); m_cEncLib.setSliceLevelDeltaQp ( m_sliceLevelDeltaQp ); m_cEncLib.setSliceLevelAlf ( m_sliceLevelAlf ); -#if !JVET_Q0806 -#else -#endif m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); m_cEncLib.setDisableScalingMatrixForLfnstBlks ( m_disableScalingMatrixForLfnstBlks); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index a308aeff5d..bf32a7c53e 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -102,11 +102,7 @@ EncAppCfg::EncAppCfg() , m_noIbcConstraintFlag(false) , m_bNoCiipConstraintFlag(false) , m_noFPelMmvdConstraintFlag(false) -#if !JVET_Q0806 -, m_bNoTriangleConstraintFlag(false) -#else , m_noGeoConstraintFlag(false) -#endif , m_bNoLadfConstraintFlag(false) , m_noTransformSkipConstraintFlag(false) , m_noBDPCMConstraintFlag(false) @@ -893,11 +889,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("LadfIntervalLowerBound", cfg_LadfIntervalLowerBound, cfg_LadfIntervalLowerBound, "LADF lower bound for 2nd lowest interval") #endif ("CIIP", m_ciip, false, "Enable CIIP mode") -#if !JVET_Q0806 - ("Triangle", m_Triangle, false, "Enable triangular shape motion vector prediction (0:off, 1:on)") -#else ("Geo", m_Geo, false, "Enable geometric partitioning mode (0:off, 1:on)") -#endif ("HashME", m_HashME, false, "Enable hash motion estimation (0:off, 1:on)") ("AllowDisFracMMVD", m_allowDisFracMMVD, false, "Disable fractional MVD in MMVD mode adaptively") @@ -1120,11 +1112,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, false, "Enable sign hiding" ) ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") ("MaxNumAffineMergeCand", m_maxNumAffineMergeCand, 5u, "Maximum number of affine merge candidates") -#if !JVET_Q0806 - ("MaxNumGeoCand", m_maxNumGeoCand, 5u, "Maximum number of geometric partitioning mode candidates") -#else ("MaxNumGeoCand", m_maxNumGeoCand, 5u, "Maximum number of geometric partitioning mode candidates") -#endif ("MaxNumIBCMergeCand", m_maxNumIBCMergeCand, 6u, "Maximum number of IBC merge candidates") /* Misc. */ ("SEIDecodedPictureHash,-dph", tmpDecodedPictureHashSEIMappedType, 0, "Control generation of decode picture hash SEI messages\n" @@ -2617,15 +2605,9 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_log2MaxTbSize < 5, "Log2MaxTbSize must be 5 or greater." ); xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); xConfirmPara( m_maxNumMergeCand > MRG_MAX_NUM_CANDS, "MaxNumMergeCand must be no more than MRG_MAX_NUM_CANDS." ); -#if !JVET_Q0806 - xConfirmPara(m_maxNumGeoCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS."); - xConfirmPara(m_maxNumGeoCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand."); - xConfirmPara(0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0."); -#else xConfirmPara( m_maxNumGeoCand > GEO_MAX_NUM_UNI_CANDS, "MaxNumGeoCand must be no more than GEO_MAX_NUM_UNI_CANDS." ); xConfirmPara( m_maxNumGeoCand > m_maxNumMergeCand, "MaxNumGeoCand must be no more than MaxNumMergeCand." ); xConfirmPara( 0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumGeoCand must be no less than 2 unless MaxNumGeoCand is 0." ); -#endif xConfirmPara( m_maxNumIBCMergeCand < 1, "MaxNumIBCMergeCand must be 1 or greater." ); xConfirmPara( m_maxNumIBCMergeCand > IBC_MRG_MAX_NUM_CANDS, "MaxNumIBCMergeCand must be no more than IBC_MRG_MAX_NUM_CANDS." ); xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." ); @@ -3625,11 +3607,7 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "Max Num Merge Candidates : %d\n", m_maxNumMergeCand ); msg( DETAILS, "Max Num Affine Merge Candidates : %d\n", m_maxNumAffineMergeCand ); -#if !JVET_Q0806 - msg(DETAILS, "Max Num Triangle Merge Candidates : %d\n", m_maxNumGeoCand); -#else msg( DETAILS, "Max Num Geo Merge Candidates : %d\n", m_maxNumGeoCand ); -#endif msg( DETAILS, "Max Num IBC Merge Candidates : %d\n", m_maxNumIBCMergeCand ); msg( DETAILS, "\n"); @@ -3702,11 +3680,7 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "LADF:%d ", m_LadfEnabed ); #endif msg(VERBOSE, "CIIP:%d ", m_ciip); -#if !JVET_Q0806 - msg( VERBOSE, "Triangle:%d ", m_Triangle ); -#else msg( VERBOSE, "Geo:%d ", m_Geo ); -#endif m_allowDisFracMMVD = m_MMVD ? m_allowDisFracMMVD : false; if ( m_MMVD ) msg(VERBOSE, "AllowDisFracMMVD:%d ", m_allowDisFracMMVD); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 198ec0b19e..4a18c1cf11 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -156,11 +156,7 @@ protected: bool m_noIbcConstraintFlag; bool m_bNoCiipConstraintFlag; bool m_noFPelMmvdConstraintFlag; -#if !JVET_Q0806 - bool m_bNoTriangleConstraintFlag; -#else bool m_noGeoConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; bool m_noBDPCMConstraintFlag; @@ -322,11 +318,7 @@ protected: #endif bool m_ciip; -#if !JVET_Q0806 - bool m_Triangle; -#else bool m_Geo; -#endif bool m_HashME; bool m_allowDisFracMMVD; bool m_AffineAmvr; @@ -612,11 +604,7 @@ protected: uint32_t m_log2ParallelMergeLevel; ///< Parallel merge estimation region uint32_t m_maxNumMergeCand; ///< Max number of merge candidates uint32_t m_maxNumAffineMergeCand; ///< Max number of affine merge candidates -#if !JVET_Q0806 uint32_t m_maxNumGeoCand; -#else - uint32_t m_maxNumGeoCand; -#endif uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates bool m_sliceLevelRpl; ///< code reference picture lists in slice headers rather than picture header diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 03d2b4f0f6..aaa870866c 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -553,7 +553,6 @@ void AreaBuf<Pel>::copyClip( const AreaBuf<const Pel> &src, const ClpRng& clpRng } } -#if JVET_Q0806 template<> void AreaBuf<Pel>::roundToOutputBitdepth( const AreaBuf<const Pel> &src, const ClpRng& clpRng ) { @@ -583,7 +582,6 @@ void AreaBuf<Pel>::roundToOutputBitdepth( const AreaBuf<const Pel> &src, const C #undef RND_INC } } -#endif template<> diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index bf88a7e562..5719f521c8 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -110,9 +110,7 @@ struct AreaBuf : public Size void memset ( const int val ); void copyFrom ( const AreaBuf<const T> &other ); -#if JVET_Q0806 void roundToOutputBitdepth(const AreaBuf<const T> &src, const ClpRng& clpRng); -#endif void reconstruct ( const AreaBuf<const T> &pred, const AreaBuf<const T> &resi, const ClpRng& clpRng); void copyClip ( const AreaBuf<const T> &src, const ClpRng& clpRng); @@ -767,9 +765,7 @@ struct UnitBuf void fill ( const T &val ); void copyFrom ( const UnitBuf<const T> &other, const bool lumaOnly = false, const bool chromaOnly = false ); -#if JVET_Q0806 void roundToOutputBitdepth(const UnitBuf<const T> &src, const ClpRngs& clpRngs); -#endif void reconstruct ( const UnitBuf<const T> &pred, const UnitBuf<const T> &resi, const ClpRngs& clpRngs ); void copyClip ( const UnitBuf<const T> &src, const ClpRngs& clpRngs, const bool lumaOnly = false, const bool chromaOnly = false ); void subtract ( const UnitBuf<const T> &other ); @@ -845,7 +841,6 @@ void UnitBuf<T>::copyClip(const UnitBuf<const T> &src, const ClpRngs &clpRngs, c } -#if JVET_Q0806 template<typename T> void UnitBuf<T>::roundToOutputBitdepth(const UnitBuf<const T> &src, const ClpRngs& clpRngs) { @@ -856,7 +851,6 @@ void UnitBuf<T>::roundToOutputBitdepth(const UnitBuf<const T> &src, const ClpRng bufs[i].roundToOutputBitdepth(src.bufs[i], clpRngs.comp[i]); } } -#endif template<typename T> void UnitBuf<T>::reconstruct(const UnitBuf<const T> &pred, const UnitBuf<const T> &resi, const ClpRngs& clpRngs) diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h index 34e1567366..1dac08f648 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -112,13 +112,8 @@ enum CodingStatisticsType STATS__CABAC_BITS__BCW_IDX, STATS__CABAC_BITS__SBT_MODE, STATS__CABAC_BITS__MH_INTRA_FLAG, -#if !JVET_Q0806 - STATS__CABAC_BITS__TRIANGLE_FLAG, - STATS__CABAC_BITS__TRIANGLE_INDEX, -#else STATS__CABAC_BITS__GEO_FLAG, STATS__CABAC_BITS__GEO_INDEX, -#endif STATS__CABAC_BITS__MULTI_REF_LINE, STATS__CABAC_BITS__SYMMVD_FLAG, STATS__CABAC_BITS__BDPCM_MODE, @@ -210,13 +205,8 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__BCW_IDX", "CABAC_BITS__SBT_MODE", "CABAC_BITS__MH_INTRA_FLAG", -#if !JVET_Q0806 - "CABAC_BITS__TRIANGLE_FLAG", - "CABAC_BITS__TRIANGLE_INDEX", -#else "CABAC_BITS__GEO_FLAG", "CABAC_BITS__GEO_INDEX", -#endif "CABAC_BITS__MULTI_REF_LINE", "CABAC_BITS__SYMMVD_FLAG", "CABAC_BITS__BDPCM_MODE", diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 92fc823cfa..2fa1f4a5e5 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -418,13 +418,6 @@ static const int MAX_LADF_INTERVALS = 5; /// max n static const int NTAPS_BILINEAR = 2; ///< Number of taps for bilinear filter static const int ATMVP_SUB_BLOCK_SIZE = 3; ///< sub-block size for ATMVP -#if !JVET_Q0806 -static const int TRIANGLE_MAX_NUM_UNI_CANDS = 6; -static const int TRIANGLE_MAX_NUM_CANDS_MEM = 7; -static const int TRIANGLE_MAX_NUM_CANDS = TRIANGLE_MAX_NUM_UNI_CANDS * (TRIANGLE_MAX_NUM_UNI_CANDS - 1) * 2; -static const int TRIANGLE_MAX_NUM_SATD_CANDS = 3; -static const int TRIANGLE_MIN_SIZE = 8 * 8; -#else static const int GEO_MAX_NUM_UNI_CANDS = 6; static const int GEO_MAX_NUM_CANDS = GEO_MAX_NUM_UNI_CANDS * (GEO_MAX_NUM_UNI_CANDS - 1); static const int GEO_MIN_CU_LOG2 = 3; @@ -440,7 +433,6 @@ static const int GEO_WEIGHT_MASK_SIZE = 3 * (GEO_MAX_CU_SIZE >> 3) * 2 + GEO_MAX static const int GEO_MV_MASK_SIZE = GEO_WEIGHT_MASK_SIZE >> 2; static const int GEO_MAX_TRY_WEIGHTED_SAD = 60; static const int GEO_MAX_TRY_WEIGHTED_SATD = 8; -#endif static const int SBT_MAX_SIZE = 64; ///< maximum CU size for using SBT static const int SBT_NUM_SL = 10; ///< maximum number of historical PU decision saved for a CU diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index 6913c4d54f..5eccb4993f 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -320,19 +320,11 @@ unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu) void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) { CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" ); -#if !JVET_Q0806 - pu.regularMergeFlag = !(pu.ciipFlag || pu.cu->triangle); -#else pu.regularMergeFlag = !(pu.ciipFlag || pu.cu->geoFlag); -#endif pu.mergeFlag = true; pu.mmvdMergeFlag = false; pu.interDir = interDirNeighbours[candIdx]; -#if !JVET_Q0806 - pu.cu->imv = (!pu.cu->triangle && useAltHpelIf[candIdx]) ? IMV_HPEL : 0; -#else pu.cu->imv = (!pu.cu->geoFlag && useAltHpelIf[candIdx]) ? IMV_HPEL : 0; -#endif pu.mergeIdx = candIdx; pu.mergeType = mrgTypeNeighbours[candIdx]; pu.mv [REF_PIC_LIST_0] = mvFieldNeighbours[(candIdx << 1) + 0].mv; diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index a3ee4adb0c..bf09938168 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -126,12 +126,8 @@ void InterPrediction::destroy() } } -#if !JVET_Q0806 - m_triangleBuf.destroy(); -#else m_geoPartBuf[0].destroy(); m_geoPartBuf[1].destroy(); -#endif m_colorTransResiBuf[0].destroy(); m_colorTransResiBuf[1].destroy(); m_colorTransResiBuf[2].destroy(); @@ -197,12 +193,8 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC, cons } } -#if !JVET_Q0806 - m_triangleBuf.create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); -#else m_geoPartBuf[0].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); m_geoPartBuf[1].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); -#endif m_colorTransResiBuf[0].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); m_colorTransResiBuf[1].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); m_colorTransResiBuf[2].create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE))); @@ -635,11 +627,7 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co } else { -#if !JVET_Q0806 - xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle -#else xPredInterUni(pu, eRefPicList, pcMbBuf, pu.cu->geoFlag -#endif , bioApplied , luma, chroma ); @@ -654,21 +642,13 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[1][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvPred.Cr())) ); const bool lumaOnly = luma && !chroma; const bool chromaOnly = !luma && chroma; -#if !JVET_Q0806 - if( !pu.cu->triangle && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->BcwIdx==BCW_DEFAULT) -#else if( !pu.cu->geoFlag && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->BcwIdx == BCW_DEFAULT) -#endif { xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred, lumaOnly, chromaOnly ); if (yuvPredTmp) yuvPredTmp->copyFrom(pcYuvPred); } -#if !JVET_Q0806 - else if( !pu.cu->triangle && pps.getUseWP() && slice.getSliceType() == P_SLICE ) -#else else if( !pu.cu->geoFlag && pps.getUseWP() && slice.getSliceType() == P_SLICE ) -#endif { xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred, lumaOnly, chromaOnly ); if (yuvPredTmp) @@ -1438,38 +1418,22 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB } else if( iRefIdx0 >= 0 && iRefIdx1 < 0 ) { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - pcYuvDst.copyFrom( pcYuvSrc0 ); - } - else -#else if( pu.cu->geoFlag ) { pcYuvDst.copyFrom( pcYuvSrc0 ); } else -#endif pcYuvDst.copyClip( pcYuvSrc0, clpRngs, lumaOnly, chromaOnly ); if (yuvDstTmp) yuvDstTmp->copyFrom( pcYuvDst, lumaOnly, chromaOnly ); } else if( iRefIdx0 < 0 && iRefIdx1 >= 0 ) { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - pcYuvDst.copyFrom( pcYuvSrc1 ); - } - else -#else if( pu.cu->geoFlag ) { pcYuvDst.copyFrom( pcYuvSrc1 ); } else -#endif pcYuvDst.copyClip( pcYuvSrc1, clpRngs, lumaOnly, chromaOnly ); if (yuvDstTmp) yuvDstTmp->copyFrom(pcYuvDst, lumaOnly, chromaOnly); @@ -1655,62 +1619,6 @@ int InterPrediction::rightShiftMSB(int numer, int denom) return numer >> floorLog2(denom); } -#if !JVET_Q0806 -void InterPrediction::motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ) -{ - for( auto &pu : CU::traversePUs( cu ) ) - { - const UnitArea localUnitArea( cu.cs->area.chromaFormat, Area( 0, 0, pu.lwidth(), pu.lheight() ) ); - PelUnitBuf tmpTriangleBuf = m_triangleBuf.getBuf( localUnitArea ); - PelUnitBuf predBuf = cu.cs->getPredBuf( pu ); - - triangleMrgCtx.setMergeInfo( pu, candIdx0 ); - PU::spanMotionInfo( pu ); - motionCompensation( pu, tmpTriangleBuf ); - - { - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } - } - - triangleMrgCtx.setMergeInfo( pu, candIdx1 ); - PU::spanMotionInfo( pu ); - motionCompensation( pu, predBuf ); - - { - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER_TRIANGLE_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } - } - weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, tmpTriangleBuf, predBuf ); - } -} - -void InterPrediction::weightedTriangleBlk( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -{ - if( channel == CHANNEL_TYPE_LUMA ) - { - m_if.weightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); - } - else if( channel == CHANNEL_TYPE_CHROMA ) - { - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); - } - else - { - m_if.weightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); - if (isChromaEnabled(pu.chromaFormat)) - { - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); - m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); - } - } -} -#else void InterPrediction::motionCompensationGeo( CodingUnit &cu, MergeCtx &geoMrgCtx ) { const uint8_t splitDir = cu.firstPU->geoSplitDir; @@ -1763,7 +1671,6 @@ void InterPrediction::weightedGeoBlk( PredictionUnit &pu, const uint8_t splitDir } } } -#endif void InterPrediction::xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId, bool forLuma) { diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index a7455d4618..6b67d430fb 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -81,11 +81,7 @@ protected: RdCost* m_pcRdCost; int m_iRefListIdx; -#if !JVET_Q0806 - PelStorage m_triangleBuf; -#else PelStorage m_geoPartBuf[2]; -#endif Mv* m_storedMv; /*buffers for bilinear Filter data for DMVR refinement*/ Pel* m_cYuvPredTempDMVRL0; @@ -142,9 +138,6 @@ protected: void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, const bool lumaOnly = false, const bool chromaOnly = false, PelUnitBuf* yuvDstTmp = NULL ); void xPredAffineBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const bool genChromaMv = false, const std::pair<int, int> scalingRatio = SCALE_1X ); -#if !JVET_Q0806 - void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#endif static bool xCheckIdenticalMotion( const PredictionUnit& pu ); @@ -177,13 +170,8 @@ public: , const bool luma = true, const bool chroma = true ); -#if !JVET_Q0806 - void motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ); - void weightedTriangleBlk ( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#else void motionCompensationGeo(CodingUnit &cu, MergeCtx &GeoMrgCtx); void weightedGeoBlk(PredictionUnit &pu, const uint8_t splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif void xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId, bool forLuma); void xPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId); void xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvSrc0, PelUnitBuf &pcYuvSrc1, PelUnitBuf &pcPad0, PelUnitBuf &pcPad1, const bool bioApplied diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp index bcc155a62a..ba76ca68f3 100644 --- a/source/Lib/CommonLib/InterpolationFilter.cpp +++ b/source/Lib/CommonLib/InterpolationFilter.cpp @@ -369,11 +369,7 @@ InterpolationFilter::InterpolationFilter() m_filterCopy[1][0] = filterCopy<true, false>; m_filterCopy[1][1] = filterCopy<true, true>; -#if !JVET_Q0806 - m_weightedTriangleBlk = xWeightedTriangleBlk; -#else m_weightedGeoBlk = xWeightedGeoBlk; -#endif } @@ -886,103 +882,6 @@ void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, in } } -#if !JVET_Q0806 -void InterpolationFilter::xWeightedTriangleBlk( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -{ - Pel* dst = predDst .get(compIdx).buf; - Pel* src0 = predSrc0.get(compIdx).buf; - Pel* src1 = predSrc1.get(compIdx).buf; - int32_t strideDst = predDst .get(compIdx).stride - width; - int32_t strideSrc0 = predSrc0.get(compIdx).stride - width; - int32_t strideSrc1 = predSrc1.get(compIdx).stride - width; - - const char log2WeightBase = 3; - const ClpRng clipRng = pu.cu->slice->clpRngs().comp[compIdx]; - const int32_t clipbd = clipRng.bd; - const int32_t shiftDefault = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)); - const int32_t offsetDefault = (1<<(shiftDefault-1)) + IF_INTERNAL_OFFS; - const int32_t shiftWeighted = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)) + log2WeightBase; - const int32_t offsetWeighted = (1 << (shiftWeighted - 1)) + (IF_INTERNAL_OFFS << log2WeightBase); - int32_t stepX = 1 << getComponentScaleX(compIdx, pu.chromaFormat); - int32_t stepY = 1 << getComponentScaleY(compIdx, pu.chromaFormat); - - int32_t widthY = width << getComponentScaleX(compIdx, pu.chromaFormat); - int32_t heightY = height << getComponentScaleY(compIdx, pu.chromaFormat); - - int32_t ratioWH = (widthY > heightY) ? (widthY / heightY) : 1; - int32_t ratioHW = (widthY > heightY) ? 1 : (heightY / widthY); - - int32_t weightedLength = 7; - int32_t weightedStartPos = (splitDir == 0) ? (0 - (weightedLength >> 1) * ratioWH) : (widthY - ((weightedLength + 1) >> 1) * ratioWH); - int32_t weightedEndPos = weightedStartPos + weightedLength * ratioWH - 1; - int32_t weightedPosoffset = ( splitDir == 0 ) ? ratioWH : -ratioWH; - - Pel tmpPelWeighted; - int32_t weightIdx; - int32_t x, y, tmpX, tmpY, tmpWeightedStart, tmpWeightedEnd; - for (y = 0; y < heightY; y += ratioHW) - { - if (y % stepY != 0) - { - weightedStartPos += weightedPosoffset; - weightedEndPos += weightedPosoffset; - continue; - } - for (tmpY = ratioHW; tmpY > 0; tmpY -= stepY) - { - for (x = 0; x < weightedStartPos; x += stepX) - { - *dst++ = ClipPel( rightShift( (splitDir == 0 ? *src1 : *src0) + offsetDefault, shiftDefault), clipRng ); - src0++; - src1++; - } - - tmpWeightedStart = std::max((int32_t)0, weightedStartPos); - tmpWeightedEnd = std::min(weightedEndPos, (int32_t)(widthY - 1)); - weightIdx = 1; - if( weightedStartPos < 0 ) - { - weightIdx += abs(weightedStartPos) / ratioWH; - } - for( x = tmpWeightedStart; x <= tmpWeightedEnd; x+= ratioWH ) - { - if (x % stepX != 0) - { - weightIdx++; - continue; - } - - for (tmpX = ratioWH; tmpX > 0; tmpX -= stepX) - { - tmpPelWeighted = Clip3(1, 7, weightIdx); - tmpPelWeighted = splitDir ? ( 8 - tmpPelWeighted ) : tmpPelWeighted; - *dst++ = ClipPel( rightShift( (tmpPelWeighted*(*src0++) + ((8 - tmpPelWeighted) * (*src1++)) + offsetWeighted), shiftWeighted ), clipRng ); - } - weightIdx ++; - } - - int32_t start = ((weightedEndPos + 1) % stepX != 0) ? (weightedEndPos + 2) : (weightedEndPos + 1); - for (x = start; x < widthY; x += stepX) - { - *dst++ = ClipPel( rightShift( (splitDir == 0 ? *src0 : *src1) + offsetDefault, shiftDefault ), clipRng ); - src0++; - src1++; - } - - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - } - weightedStartPos += weightedPosoffset; - weightedEndPos += weightedPosoffset; - } -} - -void InterpolationFilter::weightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) -{ - m_weightedTriangleBlk(pu, width, height, compIdx, splitDir, predDst, predSrc0, predSrc1); -} -#else void InterpolationFilter::weightedGeoBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) { m_weightedGeoBlk(pu, width, height, compIdx, splitDir, predDst, predSrc0, predSrc1); @@ -1040,7 +939,6 @@ void InterpolationFilter::xWeightedGeoBlk(const PredictionUnit &pu, const uint32 weight += stepY; } } -#endif /** * \brief turn on SIMD fuc diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h index 304c960626..58a811c38d 100644 --- a/source/Lib/CommonLib/InterpolationFilter.h +++ b/source/Lib/CommonLib/InterpolationFilter.h @@ -81,13 +81,8 @@ public: template<int N> void filterVer(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR); -#if !JVET_Q0806 - static void xWeightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); - void weightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#else static void xWeightedGeoBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); void weightedGeoBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif protected: #if JVET_J0090_MEMORY_BANDWITH_MEASURE static CacheModel* m_cacheModel; @@ -98,11 +93,7 @@ public: void( *m_filterHor[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); void( *m_filterVer[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); void( *m_filterCopy[2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool biMCForDMVR); -#if !JVET_Q0806 - void( *m_weightedTriangleBlk )(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#else void( *m_weightedGeoBlk )(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif void initInterpolationFilter( bool enable ); #ifdef TARGET_SIMD_X86 diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index 23daece512..aaa02545a2 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -201,9 +201,7 @@ void RdCost::init() m_afpDistortFunc[DF_SAD_INTERMEDIATE_BITDEPTH] = RdCost::xGetSAD; -#if JVET_Q0806 m_afpDistortFunc[DF_SAD_WITH_MASK] = RdCost::xGetSADwMask; -#endif #if ENABLE_SIMD_OPT_DIST #ifdef TARGET_SIMD_X86 @@ -318,7 +316,6 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRef rcDP.subShift = 1; } } -#if JVET_Q0806 else if( subShiftMode == 3 ) { if (rcDP.org.height > 8 ) @@ -326,7 +323,6 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRef rcDP.subShift = 1; } } -#endif } void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, ComponentID compID, bool useHadamard ) @@ -3462,7 +3458,6 @@ Distortion RdCost::xGetMRHADs( const DistParam &rcDtParam ) return m_afpDistortFunc[DF_HAD]( modDistParam ); } -#if JVET_Q0806 void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY, int iRefStride, const Pel* mask, int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID) { rcDP.bitDepth = bitDepth; @@ -3525,5 +3520,4 @@ Distortion RdCost::xGetSADwMask( const DistParam& rcDtParam ) sum <<= subShift; return (sum >> distortionShift ); } -#endif //! \} diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 7d10e131ab..fb5cd351c7 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -72,12 +72,10 @@ public: #if WCG_EXT CPelBuf orgLuma; #endif -#if JVET_Q0806 const Pel* mask; int maskStride; int stepX; int maskStride2; -#endif int step; FpDistFunc distFunc; int bitDepth; @@ -97,12 +95,10 @@ public: int cShiftY; DistParam() : org(), cur(), -#if JVET_Q0806 mask( nullptr ), maskStride( 0 ), stepX(0), maskStride2(0), -#endif step( 1 ), bitDepth( 0 ), useMR( false ), applyWeight( false ), isBiPred( false ), wpCur( nullptr ), compID( MAX_NUM_COMPONENT ), maximumDistortionForEarlyExit( std::numeric_limits<Distortion>::max() ), subShift( 0 ) , cShiftX(-1), cShiftY(-1) { } @@ -180,9 +176,7 @@ public: void setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY , int iRefStride, int bitDepth, ComponentID compID, int subShiftMode = 0, int step = 1, bool useHadamard = false ); void setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, ComponentID compID, bool useHadamard = false ); void setDistParam( DistParam &rcDP, const Pel* pOrg, const Pel* piRefY, int iOrgStride, int iRefStride, int bitDepth, ComponentID compID, int width, int height, int subShiftMode = 0, int step = 1, bool useHadamard = false, bool bioApplied = false ); -#if JVET_Q0806 void setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY, int iRefStride, const Pel* mask, int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID); -#endif double getMotionLambda ( ) { return m_dLambdaMotionSAD; } void selectMotionLambda ( ) { m_motionLambda = getMotionLambda( ); } @@ -367,9 +361,7 @@ private: static Distortion xGetSAD48 ( const DistParam& pcDtParam ); static Distortion xGetSAD_full ( const DistParam& pcDtParam ); -#if JVET_Q0806 static Distortion xGetSADwMask ( const DistParam& pcDtParam ); -#endif static Distortion xGetMRSAD ( const DistParam& pcDtParam ); static Distortion xGetMRSAD4 ( const DistParam& pcDtParam ); @@ -409,11 +401,9 @@ private: template<X86_VEXT vext> static Distortion xGetHADs_SIMD ( const DistParam& pcDtParam ); -#if JVET_Q0806 template< X86_VEXT vext > static Distortion xGetSADwMask_SIMD( const DistParam& pcDtParam ); #endif -#endif public: @@ -423,9 +413,7 @@ public: Distortion getDistPart( const CPelBuf &org, const CPelBuf &cur, int bitDepth, const ComponentID compID, DFunc eDFunc ); #endif -#if JVET_Q0806 Distortion getDistPart(const CPelBuf &org, const CPelBuf &cur, const Pel* mask, int bitDepth, const ComponentID compID, DFunc eDFunc); -#endif };// END CLASS DEFINITION RdCost //! \} diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 6a3425e959..2ce823a75c 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -403,53 +403,7 @@ void initROM() } } -#if !JVET_Q0806 - for( int idxH = MAX_CU_DEPTH - MIN_CU_LOG2; idxH >= 0; --idxH ) - { - for( int idxW = MAX_CU_DEPTH - MIN_CU_LOG2; idxW >= 0; --idxW ) - { - int numW = 1 << idxW; - int numH = 1 << idxH; - int ratioW = std::max( 0, idxW - idxH ); - int ratioH = std::max( 0, idxH - idxW ); - int sum = std::max( (numW >> ratioW), (numH >> ratioH) ) - 1; - for( int y = 0; y < numH; y++ ) - { - int idxY = y >> ratioH; - for( int x = 0; x < numW; x++ ) - { - int idxX = x >> ratioW; - g_triangleMvStorage[TRIANGLE_DIR_135][idxH][idxW][y][x] = (idxX == idxY) ? 2 : (idxX > idxY ? 0 : 1); - g_triangleMvStorage[TRIANGLE_DIR_45][idxH][idxW][y][x] = (idxX + idxY == sum) ? 2 : (idxX + idxY > sum ? 1 : 0); - } - } - } - } - - for (int idxH = 0; idxH < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxH) - { - for (int idxW = 0; idxW < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxW) - { - const int nCbH = 1 << (idxH + 1); - const int nCbW = 1 << (idxW + 1); - const int nCbR = (nCbW > nCbH) ? nCbW / nCbH : nCbH / nCbW; - - // let SIMD can read at least 64-bit when at last row - g_triangleWeights[0][idxH][idxW] = new int16_t[nCbH * nCbW + 4]; - g_triangleWeights[1][idxH][idxW] = new int16_t[nCbH * nCbW + 4]; - for (int y = 0; y < nCbH; y++) - { - for (int x = 0; x < nCbW; x++) - { - g_triangleWeights[0][idxH][idxW][y*nCbW + x] = (nCbW > nCbH) ? Clip3(0, 8, x / nCbR - y + 4) : Clip3(0, 8, x - y / nCbR + 4); - g_triangleWeights[1][idxH][idxW][y*nCbW + x] = (nCbW > nCbH) ? Clip3(0, 8, nCbH - 1 - x / nCbR - y + 4) : Clip3(0, 8, nCbW - 1 - x - y / nCbR + 4); - } - } - } - } -#else initGeoTemplate(); -#endif ::memset(g_isReusedUniMVsFilled, 0, sizeof(g_isReusedUniMVsFilled)); @@ -487,18 +441,6 @@ void destroyROM() delete gp_sizeIdxInfo; gp_sizeIdxInfo = nullptr; -#if !JVET_Q0806 - for (int idxH = 0; idxH < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxH) - { - for (int idxW = 0; idxW < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxW) - { - delete[] g_triangleWeights[0][idxH][idxW]; - delete[] g_triangleWeights[1][idxH][idxW]; - g_triangleWeights[0][idxH][idxW] = nullptr; - g_triangleWeights[1][idxH][idxW] = nullptr; - } - } -#else for( int modeIdx = 0; modeIdx < GEO_NUM_PARTITION_MODE; modeIdx++ ) { delete[] g_GeoParams[modeIdx]; @@ -512,7 +454,6 @@ void destroyROM() g_globalGeoWeights [i] = nullptr; g_globalGeoEncSADmask[i] = nullptr; } -#endif } // ==================================================================================================================== @@ -738,10 +679,6 @@ const uint32_t g_scalingListSize [SCALING_LIST_SIZE_NUM] = { 1, 4, 16, 64, 256, const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -#if !JVET_Q0806 -uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -int16_t *g_triangleWeights[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; -#endif Mv g_reusedUniMVs[32][32][8][8][2][33]; bool g_isReusedUniMVsFilled[32][32][8][8]; @@ -750,7 +687,6 @@ uint16_t g_paletteQuant[57]; uint8_t g_paletteRunTopLut [5] = { 0, 1, 1, 2, 2 }; uint8_t g_paletteRunLeftLut[5] = { 0, 1, 2, 3, 4 }; -#if JVET_Q0806 void initGeoTemplate() { g_GeoParams = new int16_t*[GEO_NUM_PARTITION_MODE]; @@ -831,5 +767,4 @@ int16_t g_weightOffset [GEO_NUM_PARTITION_MODE][GEO_NUM_CU_SIZE][GEO_NUM int8_t g_angle2mask[GEO_NUM_ANGLES] = { 0, -1, 1, 2, 3, 4, -1, -1, 5, -1, -1, 4, 3, 2, 1, -1, 0, -1, 1, 2, 3, 4, -1, -1, 5, -1, -1, 4, 3, 2, 1, -1 }; int8_t g_Dis[GEO_NUM_ANGLES] = { 8, 8, 8, 8, 4, 4, 2, 1, 0, -1, -2, -4, -4, -8, -8, -8, -8, -8, -8, -8, -4, -4, -2, -1, 0, 1, 2, 4, 4, 8, 8, 8 }; int8_t g_angle2mirror[GEO_NUM_ANGLES] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2 }; -#endif //! \} diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index 38c1f55ac1..e3b7fa5905 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -205,11 +205,6 @@ constexpr uint8_t g_tbMax[257] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, //! \} -#if !JVET_Q0806 -extern uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -// 7-tap/3-tap, direction, 2/4/8/16/32/64/128 -extern int16_t *g_triangleWeights[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; -#endif extern bool g_mctsDecCheckEnabled; @@ -223,7 +218,6 @@ extern uint8_t g_paletteRunLeftLut[5]; const int g_IBCBufferSize = 256 * 128; -#if JVET_Q0806 void initGeoTemplate(); extern int16_t** g_GeoParams; extern int16_t* g_globalGeoWeights [GEO_NUM_PRESTORED_MASK]; @@ -232,6 +226,5 @@ extern int16_t g_weightOffset [GEO_NUM_PARTITION_MODE][GEO_NUM_CU_SIZE][ extern int8_t g_angle2mask [GEO_NUM_ANGLES]; extern int8_t g_Dis[GEO_NUM_ANGLES]; extern int8_t g_angle2mirror[GEO_NUM_ANGLES]; -#endif #endif //__TCOMROM__ diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 96e541f058..d53870da77 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2436,11 +2436,7 @@ SPS::SPS() , m_AffineType ( false ) , m_PROF ( false ) , m_ciip ( false ) -#if !JVET_Q0806 -, m_Triangle ( false ) -#else , m_Geo ( false ) -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET , m_LadfEnabled ( false ) , m_LadfNumIntervals ( 0 ) @@ -3983,9 +3979,6 @@ bool operator == (const ConstraintInfo& op1, const ConstraintInfo& o if( op1.m_noIbcConstraintFlag != op2.m_noIbcConstraintFlag ) return false; if( op1.m_noCiipConstraintFlag != op2.m_noCiipConstraintFlag ) return false; if( op1.m_noFPelMmvdConstraintFlag != op2.m_noFPelMmvdConstraintFlag ) return false; -#if !JVET_Q0806 - if( op1.m_noTriangleConstraintFlag != op2.m_noTriangleConstraintFlag ) return false; -#endif if( op1.m_noLadfConstraintFlag != op2.m_noLadfConstraintFlag ) return false; if( op1.m_noTransformSkipConstraintFlag != op2.m_noTransformSkipConstraintFlag ) return false; if( op1.m_noBDPCMConstraintFlag != op2.m_noBDPCMConstraintFlag ) return false; diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 6ab09f9a70..b99a394fc7 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -271,11 +271,7 @@ class ConstraintInfo bool m_noIbcConstraintFlag; bool m_noCiipConstraintFlag; bool m_noFPelMmvdConstraintFlag; -#if !JVET_Q0806 - bool m_noTriangleConstraintFlag; -#else bool m_noGeoConstraintFlag; -#endif bool m_noLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; bool m_noBDPCMConstraintFlag; @@ -328,11 +324,7 @@ public: , m_noIbcConstraintFlag (false) , m_noCiipConstraintFlag (false) , m_noFPelMmvdConstraintFlag (false) -#if !JVET_Q0806 - , m_noTriangleConstraintFlag (false) -#else , m_noGeoConstraintFlag (false) -#endif , m_noLadfConstraintFlag (false) , m_noTransformSkipConstraintFlag(false) , m_noBDPCMConstraintFlag (false) @@ -433,13 +425,8 @@ public: void setNoCiipConstraintFlag(bool bVal) { m_noCiipConstraintFlag = bVal; } bool getNoFPelMmvdConstraintFlag() const { return m_noFPelMmvdConstraintFlag; } void setNoFPelMmvdConstraintFlag(bool bVal) { m_noFPelMmvdConstraintFlag = bVal; } -#if !JVET_Q0806 - bool getNoTriangleConstraintFlag() const { return m_noTriangleConstraintFlag; } - void setNoTriangleConstraintFlag(bool bVal) { m_noTriangleConstraintFlag = bVal; } -#else bool getNoGeoConstraintFlag() const { return m_noGeoConstraintFlag; } void setNoGeoConstraintFlag(bool bVal) { m_noGeoConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_noLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_noLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } @@ -1358,11 +1345,7 @@ private: bool m_PROF; bool m_bcw; // bool m_ciip; -#if !JVET_Q0806 - bool m_Triangle; -#else bool m_Geo; -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET bool m_LadfEnabled; int m_LadfNumIntervals; @@ -1723,13 +1706,8 @@ void setCCALFEnabledFlag( bool b ) void setUseCiip ( bool b ) { m_ciip = b; } bool getUseCiip () const { return m_ciip; } -#if !JVET_Q0806 - void setUseTriangle ( bool b ) { m_Triangle = b; } - bool getUseTriangle () const { return m_Triangle; } -#else void setUseGeo ( bool b ) { m_Geo = b; } bool getUseGeo () const { return m_Geo; } -#endif void setUseMRL ( bool b ) { m_MRL = b; } bool getUseMRL () const { return m_MRL; } void setUseMIP ( bool b ) { m_MIP = b; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 7102b6f4c4..9b8b74858a 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -148,7 +148,6 @@ -#define JVET_Q0806 1 // Geo related adoptions (JVET-Q0059, JVET-Q0077, JVET-Q0123, JVET-Q0188, JVET-Q0242_GEO, JVET-Q0309, JVET-Q0365 and JVET-Q0370) #define JVET_Q0055_MTS_SIGNALLING 1 // JVET-Q0055: Check for transform coefficients outside the 16x16 area #define JVET_Q0480_RASTER_RECT_SLICES 1 // JVET-Q0480: Eliminate redundant slice height syntax when in raster rectangular slice mode (tile_idx_delta_present_flag == 0) @@ -681,12 +680,8 @@ enum DFunc DF_SAD_INTERMEDIATE_BITDEPTH = 63, -#if JVET_Q0806 DF_SAD_WITH_MASK = 64, DF_TOTAL_FUNCTIONS = 65 -#else - DF_TOTAL_FUNCTIONS = 64 -#endif }; /// motion vector predictor direction used in AMVP @@ -963,14 +958,6 @@ enum MergeType NUM_MRG_TYPE // 5 }; -#if !JVET_Q0806 -enum TriangleSplit -{ - TRIANGLE_DIR_135 = 0, - TRIANGLE_DIR_45, - TRIANGLE_DIR_NUM -}; -#endif ////////////////////////////////////////////////////////////////////////// // Encoder modes to try out diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 536fb2e5d7..d8a76884e1 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -266,11 +266,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) affine = other.affine; affineType = other.affineType; colorTransform = other.colorTransform; -#if !JVET_Q0806 - triangle = other.triangle; -#else geoFlag = other.geoFlag; -#endif bdpcmMode = other.bdpcmMode; bdpcmModeChroma = other.bdpcmModeChroma; qp = other.qp; @@ -330,11 +326,7 @@ void CodingUnit::initData() affine = false; affineType = 0; colorTransform = false; -#if !JVET_Q0806 - triangle = false; -#else geoFlag = false; -#endif bdpcmMode = 0; bdpcmModeChroma = 0; qp = 0; @@ -471,12 +463,6 @@ const uint8_t CodingUnit::checkAllowedSbt() const { return 0; } -#if !JVET_Q0806 - if( triangle ) - { - return 0; - } -#endif uint8_t sbtAllowed = 0; int cuWidth = lwidth(); @@ -543,15 +529,9 @@ void PredictionUnit::initData() mergeFlag = false; regularMergeFlag = false; mergeIdx = MAX_UCHAR; -#if !JVET_Q0806 - triangleSplitDir = MAX_UCHAR; - triangleMergeIdx0 = MAX_UCHAR; - triangleMergeIdx1 = MAX_UCHAR; -#else geoSplitDir = MAX_UCHAR; geoMergeIdx0 = MAX_UCHAR; geoMergeIdx1 = MAX_UCHAR; -#endif mmvdMergeFlag = false; mmvdMergeIdx = MAX_UINT; interDir = MAX_UCHAR; @@ -600,15 +580,9 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) mergeFlag = predData.mergeFlag; regularMergeFlag = predData.regularMergeFlag; mergeIdx = predData.mergeIdx; -#if !JVET_Q0806 - triangleSplitDir = predData.triangleSplitDir ; - triangleMergeIdx0 = predData.triangleMergeIdx0 ; - triangleMergeIdx1 = predData.triangleMergeIdx1 ; -#else geoSplitDir = predData.geoSplitDir; geoMergeIdx0 = predData.geoMergeIdx0; geoMergeIdx1 = predData.geoMergeIdx1; -#endif mmvdMergeFlag = predData.mmvdMergeFlag; mmvdMergeIdx = predData.mmvdMergeIdx; interDir = predData.interDir; @@ -652,15 +626,9 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) mergeFlag = other.mergeFlag; regularMergeFlag = other.regularMergeFlag; mergeIdx = other.mergeIdx; -#if !JVET_Q0806 - triangleSplitDir = other.triangleSplitDir ; - triangleMergeIdx0 = other.triangleMergeIdx0 ; - triangleMergeIdx1 = other.triangleMergeIdx1 ; -#else geoSplitDir = other.geoSplitDir; geoMergeIdx0 = other.geoMergeIdx0; geoMergeIdx1 = other.geoMergeIdx1; -#endif mmvdMergeFlag = other.mmvdMergeFlag; mmvdMergeIdx = other.mmvdMergeIdx; interDir = other.interDir; diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 3e2a24f6c7..74dcd47a29 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -309,11 +309,7 @@ struct CodingUnit : public UnitArea bool affine; int affineType; bool colorTransform; -#if !JVET_Q0806 - bool triangle; -#else bool geoFlag; -#endif int bdpcmMode; int bdpcmModeChroma; uint8_t imv; @@ -388,15 +384,9 @@ struct InterPredictionData bool mergeFlag; bool regularMergeFlag; uint8_t mergeIdx; -#if !JVET_Q0806 - uint8_t triangleSplitDir; - uint8_t triangleMergeIdx0; - uint8_t triangleMergeIdx1; -#else uint8_t geoSplitDir; uint8_t geoMergeIdx0; uint8_t geoMergeIdx1; -#endif bool mmvdMergeFlag; uint32_t mmvdMergeIdx; uint8_t interDir; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index ae03f31687..648e22bb9d 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -263,11 +263,7 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) { const PredictionUnit& pu = *cu.firstPU; -#if !JVET_Q0806 - if (!cu.triangle && !cu.affine && !isToBeDone ) -#else if (!cu.geoFlag && !cu.affine && !isToBeDone) -#endif { MotionInfo mi = pu.getMotionInfo(); @@ -3210,163 +3206,6 @@ void PU::restrictBiPredMergeCandsOne(PredictionUnit &pu) } } -#if !JVET_Q0806 -void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangleMrgCtx ) -{ - MergeCtx tmpMergeCtx; - - const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand(); - - triangleMrgCtx.numValidMergeCand = 0; - - for (int32_t i = 0; i < TRIANGLE_MAX_NUM_UNI_CANDS; i++) - { - triangleMrgCtx.BcwIdx[i] = BCW_DEFAULT; - triangleMrgCtx.interDirNeighbours[i] = 0; - triangleMrgCtx.mrgTypeNeighbours[i] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours[(i << 1)].refIdx = NOT_VALID; - triangleMrgCtx.mvFieldNeighbours[(i << 1) + 1].refIdx = NOT_VALID; - triangleMrgCtx.mvFieldNeighbours[(i << 1)].mv = Mv(); - triangleMrgCtx.mvFieldNeighbours[(i << 1) + 1].mv = Mv(); - triangleMrgCtx.useAltHpelIf[i] = false; - } - - PU::getInterMergeCandidates(pu, tmpMergeCtx, 0); - - for (int32_t i = 0; i < maxNumMergeCand; i++) - { - int parity = i & 1; - if (tmpMergeCtx.interDirNeighbours[i] & (0x01 + parity)) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1 + parity; - triangleMrgCtx.mrgTypeNeighbours[triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].mv = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].mv; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].refIdx = -1; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].refIdx; - triangleMrgCtx.numValidMergeCand++; - if (triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS) - { - return; - } - continue; - } - - if (tmpMergeCtx.interDirNeighbours[i] & (0x02 - parity)) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 2 - parity; - triangleMrgCtx.mrgTypeNeighbours[triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].mv = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].mv; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + !parity].refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].refIdx; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + parity].refIdx = -1; - triangleMrgCtx.numValidMergeCand++; - if (triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS) - { - return; - } - } - } -} - -void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ) -{ - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - MotionBuf mb = pu.getMotionBuf(); - - MotionInfo biMv; - biMv.isInter = true; - biMv.sliceIdx = pu.cs->slice->getIndependentSliceIdx(); - - if( triangleMrgCtx.interDirNeighbours[candIdx0] == 1 && triangleMrgCtx.interDirNeighbours[candIdx1] == 2 ) - { - biMv.interDir = 3; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].mv; - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].refIdx; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; - } - else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 2 && triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ) - { - biMv.interDir = 3; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].mv; - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv; - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].refIdx; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx; - } - else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 1 && triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ) - { - biMv.interDir = 1; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].mv; - biMv.mv[1] = Mv(0, 0); - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].refIdx; - biMv.refIdx[1] = -1; - } - else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 2 && triangleMrgCtx.interDirNeighbours[candIdx1] == 2 ) - { - biMv.interDir = 2; - biMv.mv[0] = Mv(0, 0); - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - biMv.refIdx[0] = -1; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; - } - - int32_t idxW = (int32_t)(floorLog2(pu.lwidth() ) - MIN_CU_LOG2); - int32_t idxH = (int32_t)(floorLog2(pu.lheight()) - MIN_CU_LOG2); - for( int32_t y = 0; y < mb.height; y++ ) - { - for( int32_t x = 0; x < mb.width; x++ ) - { - if( g_triangleMvStorage[splitDir][idxH][idxW][y][x] == 2 ) - { - mb.at( x, y ).isInter = true; - mb.at( x, y ).interDir = biMv.interDir; - mb.at( x, y ).refIdx[0] = biMv.refIdx[0]; - mb.at( x, y ).refIdx[1] = biMv.refIdx[1]; - mb.at( x, y ).mv [0] = biMv.mv [0]; - mb.at( x, y ).mv [1] = biMv.mv [1]; - mb.at( x, y ).sliceIdx = biMv.sliceIdx; - } - else if( g_triangleMvStorage[splitDir][idxH][idxW][y][x] == 0 ) - { - mb.at( x, y ).isInter = true; - mb.at( x, y ).interDir = triangleMrgCtx.interDirNeighbours[candIdx0]; - mb.at( x, y ).refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].refIdx; - mb.at( x, y ).refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx; - mb.at( x, y ).mv [0] = triangleMrgCtx.mvFieldNeighbours[ candIdx0 << 1 ].mv; - mb.at( x, y ).mv [1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv; - mb.at( x, y ).sliceIdx = biMv.sliceIdx; - } - else - { - mb.at( x, y ).isInter = true; - mb.at( x, y ).interDir = triangleMrgCtx.interDirNeighbours[candIdx1]; - mb.at( x, y ).refIdx[0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].refIdx; - mb.at( x, y ).refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; - mb.at( x, y ).mv [0] = triangleMrgCtx.mvFieldNeighbours[ candIdx1 << 1 ].mv; - mb.at( x, y ).mv [1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - mb.at( x, y ).sliceIdx = biMv.sliceIdx; - } - } - } -} - -int32_t PU::mappingRefPic( const PredictionUnit &pu, int32_t refPicPoc, bool targetRefPicList ) -{ - int32_t numRefIdx = pu.cs->slice->getNumRefIdx( (RefPicList)targetRefPicList ); - - for( int32_t i = 0; i < numRefIdx; i++ ) - { - if( pu.cs->slice->getRefPOC( (RefPicList)targetRefPicList, i ) == refPicPoc ) - { - return i; - } - } - return -1; -} -#else void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) { MergeCtx tmpMergeCtx; @@ -3525,7 +3364,6 @@ void PU::spanGeoMotionInfo( PredictionUnit &pu, MergeCtx &geoMrgCtx, const uint8 } } } -#endif bool CU::hasSubCUNonZeroMVd( const CodingUnit& cu ) { diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 30534d6fc6..3279c7a7f1 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -169,14 +169,8 @@ namespace PU bool isLMCMode ( unsigned mode); bool isLMCModeEnabled (const PredictionUnit &pu, unsigned mode); bool isChromaIntraModeCrossCheckMode(const PredictionUnit &pu); -#if !JVET_Q0806 - void getTriangleMergeCandidates (const PredictionUnit &pu, MergeCtx &triangleMrgCtx); - void spanTriangleMotionInfo ( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1); - int32_t mappingRefPic (const PredictionUnit &pu, int32_t refPicPoc, bool targetRefPicList); -#else void getGeoMergeCandidates (const PredictionUnit &pu, MergeCtx &GeoMrgCtx); void spanGeoMotionInfo ( PredictionUnit &pu, MergeCtx &GeoMrgCtx, const uint8_t splitDir, const uint8_t candIdx0, const uint8_t candIdx1); -#endif bool isAddNeighborMv (const Mv& currMv, Mv* neighborMvs, int numNeighborMv); void getIbcMVPsEncOnly(PredictionUnit &pu, Mv* mvPred, int& nbPred); bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 9a4130a11a..fb3535ce94 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -42,9 +42,7 @@ #include "CommonLib/Picture.h" #include "CommonLib/UnitTools.h" //#include "CommonLib/CodingStructure.h" -#if JVET_Q0806 #include <queue> -#endif #define BLOCK_STATS_POLYGON_MIN_POINTS 3 #define BLOCK_STATS_POLYGON_MAX_POINTS 5 @@ -275,95 +273,6 @@ void CDTrace::dtrace_polygon_vector(int k, int poc, const std::vector<Position> dtrace<false>(k, "BlockStat: POC %d @[%s] %s={%4d,%4d}\n", poc, polygonDescription.c_str(), stat_type.c_str(), val_x, val_y); } -#if !JVET_Q0806 -void retrieveTriangularMvInfo(const PredictionUnit& pu, MotionInfo& mi0, MotionInfo& mi1) -{ - int triangleDir = pu.triangleSplitDir; - CMotionBuf mb = pu.getMotionBuf(); - bool foundMv[2] = { false, false }; - bool foundBi = false; - int32_t idxW = (int32_t)(floorLog2(pu.lwidth() ) - MIN_CU_LOG2); - int32_t idxH = (int32_t)(floorLog2(pu.lheight()) - MIN_CU_LOG2); - for (int32_t y = 0; y < mb.height; y++) - { - for (int32_t x = 0; x < mb.width; x++) - { - if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 0 && foundMv[0] == false) - { - mi0.mv[0] = mb.at(x, y).mv[0]; - mi0.mv[1] = mb.at(x, y).mv[1]; - mi0.refIdx[0] = mb.at(x, y).refIdx[0]; - mi0.refIdx[1] = mb.at(x, y).refIdx[1]; - foundMv[0] = true; - } - if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 1 && foundMv[1] == false) - { - mi1.mv[0] = mb.at(x, y).mv[0]; - mi1.mv[1] = mb.at(x, y).mv[1]; - mi1.refIdx[0] = mb.at(x, y).refIdx[0]; - mi1.refIdx[1] = mb.at(x, y).refIdx[1]; - foundMv[1] = true; - } - if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 2 && foundMv[0] == false && foundMv[1] == false) - { - mi0.mv[0] = Mv(0, 0); - mi0.mv[1] = Mv(0, 0); - mi1.mv[0] = Mv(0, 0); - mi1.mv[1] = Mv(0, 0); - mi0.refIdx[0] = -1; - mi0.refIdx[1] = -1; - mi1.refIdx[0] = -1; - mi1.refIdx[1] = -1; - if (mb.at(x, y).interDir == 3) - { - mi0.mv[0] = mb.at(x, y).mv[0]; - mi1.mv[0] = mb.at(x, y).mv[1]; - mi0.refIdx[0] = mb.at(x, y).refIdx[0]; - mi1.refIdx[0] = mb.at(x, y).refIdx[1]; - foundBi = true; - } - } - if ((foundMv[0] == true && foundMv[1] == true) || foundBi == true) - return; - } - } -} -void retrieveTrianglePolygon(const PredictionUnit& pu, std::vector<Position>& triangle0, std::vector<Position>& triangle1, Position& S, Position& E) -{ - TriangleSplit triangleDir = TriangleSplit(pu.triangleSplitDir); - Position TL = pu.Y().topLeft(); - Position TR = pu.Y().topRight(); TR = TR.offset(1, 0); - Position BL = pu.Y().bottomLeft(); BL = BL.offset(0, 1); - Position BR = pu.Y().bottomRight(); BR = BR.offset(1, 1); - - if (triangleDir == TRIANGLE_DIR_135) - { - S = Position(0, 0); - E = Position(pu.Y().width, pu.Y().height); - triangle0.push_back(TL); - triangle0.push_back(TR); - triangle0.push_back(BR); - triangle1.push_back(TL); - triangle1.push_back(BL); - triangle1.push_back(BR); - } - else if (triangleDir == TRIANGLE_DIR_45) - { - S = Position(0, pu.Y().height); - E = Position(pu.Y().width, 0); - triangle0.push_back(TL); - triangle0.push_back(TR); - triangle0.push_back(BL); - triangle1.push_back(TR); - triangle1.push_back(BL); - triangle1.push_back(BR); - } - else - { - CHECK(triangleDir != TRIANGLE_DIR_45 && triangleDir != TRIANGLE_DIR_135, "Unknown triangle type"); - } -} -#else void retrieveGeoPolygons(const CodingUnit& cu, std::vector<Position> (&geoPartitions)[2], Position (&linePositions)[2]) { // adapted code from interpolation filter to find geo partition polygons like this: @@ -542,7 +451,6 @@ void storeGeoMergeCtx(MergeCtx geoMergeCtx) { geoMergeCtxtsOfCurrentCtu.push(geoMergeCtx); } -#endif void writeBlockStatisticsHeader(const SPS *sps) { @@ -678,11 +586,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MVPIdxL1), pu.mvpIdx[REF_PIC_LIST_1]); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::RefIdxL1), pu.refIdx[REF_PIC_LIST_1]); } -#if !JVET_Q0806 - if (!pu.cu->affine && !pu.cu->triangle) -#else if (!pu.cu->affine && !pu.cu->geoFlag) -#endif { if (pu.interDir != 2 /* PRED_L1 */) { @@ -707,29 +611,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MVL1), mv.hor, mv.ver); } } -#if !JVET_Q0806 - else if (pu.cu->triangle) - { - MotionInfo mi[2]; - std::vector<Position> triangleCorners[2]; - Position S, E; - retrieveTrianglePolygon(pu, triangleCorners[0], triangleCorners[1], S, E); - DTRACE_LINE(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::TrianglePartitioning), S.x, S.y, E.x, E.y); - retrieveTriangularMvInfo(pu, mi[0], mi[1]); - for (int triangleIdx = 0; triangleIdx < 2; triangleIdx++) - { - for (int refIdx = 0; refIdx < 2; refIdx++) - { - mi[triangleIdx].mv[refIdx].hor = mi[triangleIdx].mv[refIdx].hor >= 0 ? (mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift); - mi[triangleIdx].mv[refIdx].ver = mi[triangleIdx].mv[refIdx].ver >= 0 ? (mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift); - if (mi[triangleIdx].refIdx[refIdx] != -1) - { - DTRACE_POLYGON_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu.cu->slice->getPOC(), triangleCorners[triangleIdx], GetBlockStatisticName(refIdx==0?BlockStatistic::TriangleMVL0:BlockStatistic::TriangleMVL1), mi[triangleIdx].mv[refIdx].hor, mi[triangleIdx].mv[refIdx].ver); - } - } - } - } -#endif else if (pu.cu->affine) { if (pu.interDir != 2 /* PRED_L1 */) @@ -841,7 +722,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } -#if JVET_Q0806 if (cu.geoFlag) { const uint8_t candIdx0 = cu.firstPU->geoMergeIdx0; @@ -908,7 +788,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } } -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::SMVDFlag), cu.smvdMode); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); @@ -993,9 +872,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } -#if JVET_Q0806 CHECK(geoMergeCtxtsOfCurrentCtu.size() != 0, "Did not use all pushed back geo merge contexts. Should not be possible!"); -#endif } void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) @@ -1126,11 +1003,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MVPIdxL1), pu.mvpIdx[REF_PIC_LIST_1]); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::RefIdxL1), pu.refIdx[REF_PIC_LIST_1]); } -#if !JVET_Q0806 - if (!pu.cu->affine && !pu.cu->triangle) -#else if (!pu.cu->affine && !pu.cu->geoFlag) -#endif { if (pu.interDir != 2 /* PRED_L1 */) { @@ -1155,29 +1028,6 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MVL1), mv.hor, mv.ver); } } -#if !JVET_Q0806 - else if (pu.cu->triangle) - { - MotionInfo mi[2]; - std::vector<Position> triangleCorners[2]; - Position S, E; - retrieveTrianglePolygon(pu, triangleCorners[0], triangleCorners[1], S, E); - DTRACE_LINE(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TrianglePartitioning), S.x, S.y, E.x, E.y); - retrieveTriangularMvInfo(pu, mi[0], mi[1]); - for (int triangleIdx = 0; triangleIdx < 2; triangleIdx++) - { - for (int refIdx = 0; refIdx < 2; refIdx++) - { - mi[triangleIdx].mv[refIdx].hor = mi[triangleIdx].mv[refIdx].hor >= 0 ? (mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].hor + nOffset) >> nShift); - mi[triangleIdx].mv[refIdx].ver = mi[triangleIdx].mv[refIdx].ver >= 0 ? (mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift : -((-mi[triangleIdx].mv[refIdx].ver + nOffset) >> nShift); - if (mi[triangleIdx].refIdx[refIdx] != -1) - { - DTRACE_POLYGON_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu.cu->slice->getPOC(), triangleCorners[triangleIdx], GetBlockStatisticName(refIdx==0?BlockStatistic::TriangleMVL0:BlockStatistic::TriangleMVL1), mi[triangleIdx].mv[refIdx].hor, mi[triangleIdx].mv[refIdx].ver); - } - } - } - } -#endif else { if (pu.interDir != 2 /* PRED_L1 */) diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index a900eec517..8c5adea5e3 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -120,15 +120,9 @@ enum class BlockStatistic { MMVDMergeIdx, CiipFlag, SMVDFlag, -#if !JVET_Q0806 - TrianglePartitioning, - TriangleMVL0, //<< currently only uni-prediction enabled - TriangleMVL1, //<< currently only uni-prediction enabled -#else GeoPartitioning, GeoMVL0, //<< currently only uni-prediction enabled GeoMVL1, //<< currently only uni-prediction enabled -#endif BCWIndex, // for dual tree // general @@ -222,15 +216,9 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::MMVDMergeIdx, std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeIdx", BlockStatisticType::Integer, "[0, 1]"}}, { BlockStatistic::CiipFlag, std::tuple<std::string, BlockStatisticType, std::string>{"CiipFlag", BlockStatisticType::Flag, ""}}, { BlockStatistic::SMVDFlag, std::tuple<std::string, BlockStatisticType, std::string>{"SMVDFlag", BlockStatisticType::Flag, ""}}, -#if !JVET_Q0806 - { BlockStatistic::TrianglePartitioning, std::tuple<std::string, BlockStatisticType, std::string>{"TrianglePartitioning", BlockStatisticType::Line, ""}}, - { BlockStatistic::TriangleMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"}}, - { BlockStatistic::TriangleMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"}}, -#else { BlockStatistic::GeoPartitioning, std::tuple<std::string, BlockStatisticType, std::string>{"GeoPartitioning", BlockStatisticType::Line, ""} }, { BlockStatistic::GeoMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"GeoMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"} }, { BlockStatistic::GeoMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"GeoMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"} }, -#endif { BlockStatistic::BCWIndex, std::tuple<std::string, BlockStatisticType, std::string>{"BCWIndex", BlockStatisticType::Integer, "[0, 4]"} }, // for dual tree { BlockStatistic::Depth_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"Depth_Chroma", BlockStatisticType::Integer, "[0, 10]"}}, // todo: actual limits? @@ -252,10 +240,8 @@ void writeBlockStatisticsHeader(const SPS *sps); void getAndStoreBlockStatistics(const CodingStructure& cs, const UnitArea& ctuArea); void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea); void writeAllCodedData(const CodingStructure& cs, const UnitArea& ctuArea); -#if JVET_Q0806 class MergeCtx; void storeGeoMergeCtx(MergeCtx geoMergeCtx); #endif -#endif #endif // _DTRACE_BLOCKSTATISTICS_H_ diff --git a/source/Lib/CommonLib/x86/InterpolationFilterX86.h b/source/Lib/CommonLib/x86/InterpolationFilterX86.h index 81608d2a4d..c4e093f85b 100644 --- a/source/Lib/CommonLib/x86/InterpolationFilterX86.h +++ b/source/Lib/CommonLib/x86/InterpolationFilterX86.h @@ -1327,130 +1327,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel } } -#if !JVET_Q0806 -template< X86_VEXT vext > -void xWeightedTriangleBlk_SSE(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) -{ - Pel* dst = predDst.get(compIdx).buf; - Pel* src0 = predSrc0.get(compIdx).buf; - Pel* src1 = predSrc1.get(compIdx).buf; - int32_t strideDst = predDst.get(compIdx).stride; - int32_t strideSrc0 = predSrc0.get(compIdx).stride; - int32_t strideSrc1 = predSrc1.get(compIdx).stride; - - int32_t chromaScaleX = getComponentScaleX(compIdx, pu.chromaFormat); - int32_t chromaScaleY = getComponentScaleY(compIdx, pu.chromaFormat); - int8_t log2WidthY = floorLog2(width << chromaScaleX) - 1; - int8_t log2HeightY = floorLog2(height << chromaScaleY) - 1; - const char log2WeightBase = 3; - const ClpRng clpRng = pu.cu->slice->clpRngs().comp[compIdx]; - const int32_t shiftWeighted = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)) + log2WeightBase; - const int32_t offsetWeighted = (1 << (shiftWeighted - 1)) + (IF_INTERNAL_OFFS << log2WeightBase); - int16_t *weight = g_triangleWeights[splitDir][log2HeightY][log2WidthY]; - int16_t stepY = width << (chromaScaleX + chromaScaleY); - - const __m128i mmEight = _mm_set1_epi16(8); - const __m128i mmOffset = _mm_set1_epi32(offsetWeighted); - const __m128i mmShift = _mm_cvtsi32_si128(shiftWeighted); - const __m128i mmMin = _mm_set1_epi16(clpRng.min); - const __m128i mmMax = _mm_set1_epi16(clpRng.max); - - if (width == 2) - { - const __m128i mask = _mm_set_epi16( (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, 0x0504, 0x0100 ); - for (int y = 0; y < height; y++) - { - __m128i s0 = _mm_cvtsi32_si128(*(uint32_t *) src0); - __m128i s1 = _mm_cvtsi32_si128(*(uint32_t *) src1); - __m128i w0 = _mm_loadl_epi64((__m128i *) (weight)); - if (chromaScaleX == 1) - { - w0 = _mm_shuffle_epi8(w0, mask); - } - __m128i w1 = _mm_sub_epi16(mmEight, w0); - s0 = _mm_unpacklo_epi16(s0, s1); - w0 = _mm_unpacklo_epi16(w0, w1); - s0 = _mm_add_epi32(_mm_madd_epi16(s0, w0), mmOffset); - s0 = _mm_sra_epi32(s0, mmShift); - s0 = _mm_packs_epi32(s0, s0); - s0 = _mm_min_epi16(mmMax, _mm_max_epi16(s0, mmMin)); - - *(uint32_t *) dst = _mm_cvtsi128_si32(s0); - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - weight += stepY; - } - } - else if(width == 4) - { - const __m128i mask = _mm_set_epi16( (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, 0x0D0C, 0x0908, 0x0504, 0x0100 ); - for (int y = 0; y < height; y++) - { - __m128i s0 = _mm_loadl_epi64((__m128i *) (src0)); - __m128i s1 = _mm_loadl_epi64((__m128i *) (src1)); - __m128i w0 = _mm_loadu_si128((__m128i *) (weight)); - if (chromaScaleX == 1) - { - w0 = _mm_shuffle_epi8(w0, mask); - } - __m128i w1 = _mm_sub_epi16(mmEight, w0); - s0 = _mm_unpacklo_epi16(s0, s1); - w0 = _mm_unpacklo_epi16(w0, w1); - s0 = _mm_add_epi32(_mm_madd_epi16(s0, w0), mmOffset); - s0 = _mm_sra_epi32(s0, mmShift); - s0 = _mm_packs_epi32(s0, s0); - s0 = _mm_min_epi16(mmMax, _mm_max_epi16(s0, mmMin)); - _mm_storel_epi64((__m128i *) (dst), s0); - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - weight += stepY; - } - } - else - { - const __m128i mask1 = _mm_set_epi16( 0x0D0C, 0x0908, 0x0504, 0x0100, (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080 ); - const __m128i mask2 = _mm_set_epi16( (short) 0x8080, (short) 0x8080, (short) 0x8080, (short) 0x8080, 0x0D0C, 0x0908, 0x0504, 0x0100 ); - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x += 8) - { - __m128i s0 = _mm_loadu_si128((__m128i *) (src0 + x)); - __m128i s1 = _mm_loadu_si128((__m128i *) (src1 + x)); - - __m128i w0 = _mm_loadu_si128((__m128i *) (weight + (x << chromaScaleX))); - if (chromaScaleX == 1) - { - __m128i w01 = _mm_loadu_si128((__m128i *) (weight + (x << chromaScaleX) + 8)); - w0 = _mm_shuffle_epi8(w0, mask1); - w01 = _mm_shuffle_epi8(w01, mask2); - w0 = _mm_alignr_epi8(w01, w0, 8); - } - __m128i w1 = _mm_sub_epi16(mmEight, w0); - - __m128i s0tmp = _mm_unpacklo_epi16(s0, s1); - __m128i w0tmp = _mm_unpacklo_epi16(w0, w1); - s0tmp = _mm_add_epi32(_mm_madd_epi16(s0tmp, w0tmp), mmOffset); - s0tmp = _mm_sra_epi32(s0tmp, mmShift); - - s0 = _mm_unpackhi_epi16(s0, s1); - w0 = _mm_unpackhi_epi16(w0, w1); - s0 = _mm_add_epi32(_mm_madd_epi16(s0, w0), mmOffset); - s0 = _mm_sra_epi32(s0, mmShift); - - s0 = _mm_packs_epi32(s0tmp, s0); - s0 = _mm_min_epi16(mmMax, _mm_max_epi16(s0, mmMin)); - _mm_storeu_si128((__m128i *) (dst + x), s0); - } - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - weight += stepY; - } - } -} -#else template< X86_VEXT vext > void xWeightedGeoBlk_SSE(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) { @@ -1670,7 +1546,6 @@ void xWeightedGeoBlk_SSE(const PredictionUnit &pu, const uint32_t width, const u } } } -#endif template <X86_VEXT vext> void InterpolationFilter::_initInterpolationFilterX86() @@ -1711,11 +1586,7 @@ void InterpolationFilter::_initInterpolationFilterX86() m_filterCopy[1][0] = simdFilterCopy<vext, true, false>; m_filterCopy[1][1] = simdFilterCopy<vext, true, true>; -#if !JVET_Q0806 - m_weightedTriangleBlk = xWeightedTriangleBlk_SSE<vext>; -#else m_weightedGeoBlk = xWeightedGeoBlk_SSE<vext>; -#endif } template void InterpolationFilter::_initInterpolationFilterX86<SIMDX86>(); diff --git a/source/Lib/CommonLib/x86/RdCostX86.h b/source/Lib/CommonLib/x86/RdCostX86.h index b11df95044..fb15970b19 100644 --- a/source/Lib/CommonLib/x86/RdCostX86.h +++ b/source/Lib/CommonLib/x86/RdCostX86.h @@ -1973,7 +1973,6 @@ static uint32_t xCalcHAD8x16_AVX2( const Pel* piOrg, const Pel* piCur, const int return (sad); } -#if JVET_Q0806 template< X86_VEXT vext > Distortion RdCost::xGetSADwMask_SIMD( const DistParam &rcDtParam ) { @@ -2063,7 +2062,6 @@ Distortion RdCost::xGetSADwMask_SIMD( const DistParam &rcDtParam ) return sum >> DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth); } -#endif template<X86_VEXT vext> Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) @@ -2242,9 +2240,7 @@ void RdCost::_initRdCostX86() m_afpDistortFunc[DF_SAD_INTERMEDIATE_BITDEPTH] = RdCost::xGetSAD_IBD_SIMD<vext>; -#if JVET_Q0806 m_afpDistortFunc[DF_SAD_WITH_MASK] = xGetSADwMask_SIMD<vext>; -#endif } template void RdCost::_initRdCostX86<SIMDX86>(); diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 58d80eeef4..e43102c36c 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -2197,7 +2197,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__MERGE_FLAG ); -#if JVET_Q0806 const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64; const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && pu.cs->sps->getMaxNumGeoCand() > 1 @@ -2205,13 +2204,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth(); if (geoAvailable || ciipAvailable) -#else - const bool triangleAvailable = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && - pu.cs->sps->getMaxNumGeoCand() > 1; - const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE; - if (pu.cu->lwidth() * pu.cu->lheight() >= 64 - && (triangleAvailable || ciipAvailable)) -#endif { cu.firstPU->regularMergeFlag = m_BinDecoder.decodeBin(Ctx::RegularMergeFlag(cu.skip ? 0 : 1)); } @@ -2238,29 +2230,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) { pu.mmvdMergeFlag = false; pu.cu->mmvdSkip = false; -#if !JVET_Q0806 - if (triangleAvailable && ciipAvailable) - { - Ciip_flag(pu); - } - else if (ciipAvailable) - { - pu.ciipFlag = true; - } - else - { - pu.ciipFlag = false; - } - if (pu.ciipFlag) - { - pu.intraDir[0] = PLANAR_IDX; - pu.intraDir[1] = DM_CHROMA_IDX; - } - else - { - pu.cu->triangle = true; - } -#else if (geoAvailable && ciipAvailable) { Ciip_flag(pu); @@ -2282,7 +2251,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) { pu.cu->geoFlag = true; } -#endif } } if (pu.mmvdMergeFlag || pu.cu->mmvdSkip) @@ -2325,45 +2293,6 @@ void CABACReader::merge_idx( PredictionUnit& pu ) int numCandminus1 = int(pu.cs->sps->getMaxNumMergeCand()) - 1; pu.mergeIdx = 0; -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__TRIANGLE_INDEX ); - bool splitDir; - uint8_t candIdx0; - uint8_t candIdx1; - splitDir = m_BinDecoder.decodeBinEP(); - auto decodeOneIdx = [this](int numCandminus1) -> uint8_t - { - uint8_t decIdx = 0; - if( numCandminus1 > 0 ) - { - if( this->m_BinDecoder.decodeBin( Ctx::MergeIdx() ) ) - { - decIdx++; - for( ; decIdx < numCandminus1; decIdx++ ) - { - if( !this->m_BinDecoder.decodeBinEP() ) - break; - } - } - } - return decIdx; - }; - const int maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand(); - CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates"); - candIdx0 = decodeOneIdx(maxNumTriangleCand - 1); - candIdx1 = decodeOneIdx(maxNumTriangleCand - 2); - candIdx1 += candIdx1 >= candIdx0 ? 1 : 0; - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_split_dir=%d\n", splitDir ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx0=%d\n", candIdx0 ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx1=%d\n", candIdx1 ); - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - return; - } -#else if( pu.cu->geoFlag ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__GEO_INDEX ); @@ -2396,7 +2325,6 @@ void CABACReader::merge_idx( PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx1=%d\n", mergeCand1 ); return; } -#endif if (pu.cu->predMode == MODE_IBC) { diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index ffd9bb8cfb..1871d4ef06 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -134,7 +134,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) if (currCU.predMode != MODE_INTRA && currCU.predMode != MODE_PLT && currCU.Y().valid()) { xDeriveCUMV(currCU); -#if JVET_Q0806 && K0149_BLOCK_STATISTICS +#if K0149_BLOCK_STATISTICS if(currCU.geoFlag) { storeGeoMergeCtx(m_geoMrgCtx); @@ -644,35 +644,19 @@ void DecCu::xFillPCMBuffer(CodingUnit &cu) void DecCu::xReconInter(CodingUnit &cu) { -#if !JVET_Q0806 - if( cu.triangle ) - { - const bool splitDir = cu.firstPU->triangleSplitDir; - const uint8_t candIdx0 = cu.firstPU->triangleMergeIdx0; - const uint8_t candIdx1 = cu.firstPU->triangleMergeIdx1; - m_pcInterPred->motionCompensation4Triangle( cu, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); - PU::spanTriangleMotionInfo( *cu.firstPU, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); - } - else -#else if( cu.geoFlag ) { m_pcInterPred->motionCompensationGeo( cu, m_geoMrgCtx ); PU::spanGeoMotionInfo( *cu.firstPU, m_geoMrgCtx, cu.firstPU->geoSplitDir, cu.firstPU->geoMergeIdx0, cu.firstPU->geoMergeIdx1 ); } else -#endif { m_pcIntraPred->geneIntrainterPred(cu); // inter prediction CHECK(CU::isIBC(cu) && cu.firstPU->ciipFlag, "IBC and Ciip cannot be used together"); CHECK(CU::isIBC(cu) && cu.affine, "IBC and Affine cannot be used together"); -#if !JVET_Q0806 - CHECK(CU::isIBC(cu) && cu.triangle, "IBC and triangle cannot be used together"); -#else CHECK(CU::isIBC(cu) && cu.geoFlag, "IBC and geo cannot be used together"); -#endif CHECK(CU::isIBC(cu) && cu.firstPU->mmvdMergeFlag, "IBC and MMVD cannot be used together"); const bool luma = cu.Y().valid(); const bool chroma = isChromaEnabled(cu.chromaFormat) && cu.Cb().valid(); @@ -888,19 +872,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) else { { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - PU::getTriangleMergeCandidates( pu, m_triangleMrgCtx ); - } - else -#else if( pu.cu->geoFlag ) { PU::getGeoMergeCandidates( pu, m_geoMrgCtx ); } else -#endif { if( pu.cu->affine ) { @@ -1044,15 +1020,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) PU::spanMotionInfo( pu, mrgCtx ); } } -#if !JVET_Q0806 - if( !cu.triangle ) - { - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } - } -#else if( !cu.geoFlag ) { if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) @@ -1060,7 +1027,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) printf( "DECODER: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); } } -#endif if (CU::isIBC(cu)) { const int cuPelX = pu.Y().x; diff --git a/source/Lib/DecoderLib/DecCu.h b/source/Lib/DecoderLib/DecCu.h index c6932f3e91..8789afadb4 100644 --- a/source/Lib/DecoderLib/DecCu.h +++ b/source/Lib/DecoderLib/DecCu.h @@ -98,11 +98,7 @@ private: MotionInfo m_SubPuMiBuf[(MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1)]; -#if !JVET_Q0806 - MergeCtx m_triangleMrgCtx; -#else MergeCtx m_geoMrgCtx; -#endif }; //! \} diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 21573cb1f0..cd9b80c6b8 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1794,26 +1794,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_fpel_mmvd_enabled_flag" ); pcSPS->setFpelMmvdEnabledFlag ( uiCode != 0 ); } -#if !JVET_Q0806 - if (pcSPS->getMaxNumMergeCand() >= 2) - { - READ_FLAG(uiCode, "triangle_flag"); - pcSPS->setUseTriangle(uiCode != 0); - if (pcSPS->getUseTriangle() && pcSPS->getMaxNumMergeCand() >= 3) - { - READ_UVLC(uiCode, "max_num_merge_cand_minus_max_num_gpm_cand"); - CHECK(pcSPS->getMaxNumMergeCand() < uiCode, "Incorrrect max number of Triangle candidates!"); - pcSPS->setMaxNumGeoCand((uint32_t)(pcSPS->getMaxNumMergeCand() - uiCode)); - } - else if (pcSPS->getUseTriangle()) - pcSPS->setMaxNumGeoCand(2); - } - else - { - pcSPS->setUseTriangle(0); - pcSPS->setMaxNumGeoCand(0); - } -#else if (pcSPS->getMaxNumMergeCand() >= 2) { READ_FLAG(uiCode, "sps_gpm_enabled_flag"); @@ -1832,7 +1812,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setUseGeo(0); pcSPS->setMaxNumGeoCand(0); } -#endif READ_FLAG(uiCode, "sps_lmcs_enable_flag"); pcSPS->setUseLmcs(uiCode == 1); READ_FLAG( uiCode, "sps_lfnst_enabled_flag" ); pcSPS->setUseLFNST( uiCode != 0 ); @@ -4072,11 +4051,7 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "no_ibc_constraint_flag"); cinfo->setNoIbcConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_ciip_constraint_flag"); cinfo->setNoCiipConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_fpel_mmvd_constraint_flag"); cinfo->setNoFPelMmvdConstraintFlag(symbol > 0 ? true : false); -#if !JVET_Q0806 - READ_FLAG(symbol, "no_triangle_constraint_flag"); cinfo->setNoTriangleConstraintFlag(symbol > 0 ? true : false); -#else READ_FLAG(symbol, "no_gpm_constraint_flag"); cinfo->setNoGeoConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_ladf_constraint_flag"); cinfo->setNoLadfConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_transform_skip_constraint_flag"); cinfo->setNoTransformSkipConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_bdpcm_constraint_flag"); cinfo->setNoBDPCMConstraintFlag(symbol > 0 ? true : false); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index c39b64fec1..372202eff9 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1901,7 +1901,6 @@ void CABACWriter::merge_data(const PredictionUnit& pu) merge_idx(pu); return; } -#if JVET_Q0806 const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64; const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && pu.cs->sps->getMaxNumGeoCand() > 1 @@ -1909,13 +1908,6 @@ void CABACWriter::merge_data(const PredictionUnit& pu) && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth(); if (geoAvailable || ciipAvailable) -#else - const bool triangleAvailable = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && - pu.cs->sps->getMaxNumGeoCand() > 1; - const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE; - if (pu.cu->lwidth() * pu.cu->lheight() >= 64 - && (triangleAvailable || ciipAvailable)) -#endif { m_BinEncoder.encodeBin(pu.regularMergeFlag, Ctx::RegularMergeFlag(pu.cu->skip ? 0 : 1)); } @@ -1937,17 +1929,10 @@ void CABACWriter::merge_data(const PredictionUnit& pu) } else { -#if !JVET_Q0806 - if (triangleAvailable && ciipAvailable) - { - Ciip_flag(pu); - } -#else if (geoAvailable && ciipAvailable) { Ciip_flag(pu); } -#endif merge_idx(pu); } } @@ -2048,51 +2033,6 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) } else { -#if !JVET_Q0806 - if( pu.cu->triangle ) - { - bool splitDir = pu.triangleSplitDir; - uint8_t candIdx0 = pu.triangleMergeIdx0; - uint8_t candIdx1 = pu.triangleMergeIdx1; - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_split_dir=%d\n", splitDir ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx0=%d\n", candIdx0 ); - DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() triangle_idx1=%d\n", candIdx1 ); - candIdx1 -= candIdx1 < candIdx0 ? 0 : 1; - auto encodeOneIdx = [this](uint8_t mrgIdx, int numCandminus1) - { - if (numCandminus1 == 0) - { - CHECK(mrgIdx, "Incorrect index!"); - return; - } - if(mrgIdx == 0) - { - this->m_BinEncoder.encodeBin( 0, Ctx::MergeIdx() ); - return; - } - else - { - this->m_BinEncoder.encodeBin( 1, Ctx::MergeIdx() ); - for( unsigned idx = 1; idx < numCandminus1; idx++ ) - { - this->m_BinEncoder.encodeBinEP( mrgIdx == idx ? 0 : 1 ); - if( mrgIdx == idx ) - { - break; - } - } - } - }; - m_BinEncoder.encodeBinEP(splitDir); - const int maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand(); - CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates"); - CHECK(candIdx0 >= maxNumTriangleCand, "Incorrect candIdx0"); - CHECK(candIdx1 >= maxNumTriangleCand, "Incorrect candIdx1"); - encodeOneIdx(candIdx0, maxNumTriangleCand - 1); - encodeOneIdx(candIdx1, maxNumTriangleCand - 2); - return; - } -#else if( pu.cu->geoFlag ) { uint8_t splitDir = pu.geoSplitDir; @@ -2123,7 +2063,6 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) } return; } -#endif int numCandminus1; if (pu.cu->predMode == MODE_IBC) numCandminus1 = int(pu.cs->sps->getMaxNumIBCMergeCand()) - 1; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 5a5f83526d..b4136769d4 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -196,11 +196,7 @@ protected: bool m_noIbcConstraintFlag; bool m_bNoCiipConstraintFlag; bool m_noFPelMmvdConstraintFlag; -#if !JVET_Q0806 - bool m_bNoTriangleConstraintFlag; -#else bool m_noGeoConstraintFlag; -#endif bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; bool m_noBDPCMConstraintFlag; @@ -322,11 +318,7 @@ protected: #endif bool m_ciip; -#if !JVET_Q0806 - bool m_Triangle; -#else bool m_Geo; -#endif bool m_allowDisFracMMVD; bool m_AffineAmvr; bool m_HashME; @@ -635,11 +627,7 @@ protected: uint32_t m_log2ParallelMergeLevelMinus2; ///< Parallel merge estimation region uint32_t m_maxNumMergeCand; ///< Maximum number of merge candidates uint32_t m_maxNumAffineMergeCand; ///< Maximum number of affine merge candidates -#if !JVET_Q0806 uint32_t m_maxNumGeoCand; -#else - uint32_t m_maxNumGeoCand; -#endif uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates ScalingListMode m_useScalingListId; ///< Using quantization matrix i.e. 0=off, 1=default, 2=file. std::string m_scalingListFileName; ///< quantization matrix file name @@ -658,11 +646,7 @@ protected: int m_PPSMvdL1ZeroIdc; int m_PPSCollocatedFromL0Idc; uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; -#if !JVET_Q0806 - uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#else uint32_t m_PPSMaxNumMergeCandMinusMaxNumGeoCandPlus1; -#endif bool m_DepQuantEnabledFlag; bool m_SignDataHidingEnabledFlag; bool m_RCEnableRateControl; @@ -808,13 +792,8 @@ public: void setNoCiipConstraintFlag(bool bVal) { m_bNoCiipConstraintFlag = bVal; } bool getNoFPelMmvdConstraintFlag() const { return m_noFPelMmvdConstraintFlag; } void setNoFPelMmvdConstraintFlag(bool bVal) { m_noFPelMmvdConstraintFlag = bVal; } -#if !JVET_Q0806 - bool getNoTriangleConstraintFlag() const { return m_bNoTriangleConstraintFlag; } - void setNoTriangleConstraintFlag(bool bVal) { m_bNoTriangleConstraintFlag = bVal; } -#else bool getNoGeoConstraintFlag() const { return m_noGeoConstraintFlag; } void setNoGeoConstraintFlag(bool bVal) { m_noGeoConstraintFlag = bVal; } -#endif bool getNoLadfConstraintFlag() const { return m_bNoLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } @@ -1042,13 +1021,8 @@ public: void setUseCiip ( bool b ) { m_ciip = b; } bool getUseCiip () const { return m_ciip; } -#if !JVET_Q0806 - void setUseTriangle ( bool b ) { m_Triangle = b; } - bool getUseTriangle () const { return m_Triangle; } -#else void setUseGeo ( bool b ) { m_Geo = b; } bool getUseGeo () const { return m_Geo; } -#endif void setAllowDisFracMMVD ( bool b ) { m_allowDisFracMMVD = b; } bool getAllowDisFracMMVD () const { return m_allowDisFracMMVD; } void setUseHashME ( bool b ) { m_HashME = b; } @@ -1683,13 +1657,8 @@ public: uint32_t getMaxNumMergeCand () { return m_maxNumMergeCand; } void setMaxNumAffineMergeCand ( uint32_t u ) { m_maxNumAffineMergeCand = u; } uint32_t getMaxNumAffineMergeCand () { return m_maxNumAffineMergeCand; } -#if !JVET_Q0806 - void setMaxNumGeoCand(uint32_t u) { m_maxNumGeoCand = u; } - uint32_t getMaxNumGeoCand() { return m_maxNumGeoCand; } -#else void setMaxNumGeoCand ( uint32_t u ) { m_maxNumGeoCand = u; } uint32_t getMaxNumGeoCand () { return m_maxNumGeoCand; } -#endif void setMaxNumIBCMergeCand ( uint32_t u ) { m_maxNumIBCMergeCand = u; } uint32_t getMaxNumIBCMergeCand () { return m_maxNumIBCMergeCand; } void setUseScalingListId ( ScalingListMode u ) { m_useScalingListId = u; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 2a861fc35b..fafc855249 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -59,20 +59,6 @@ //! \{ // ==================================================================================================================== -#if !JVET_Q0806 -EncCu::EncCu() : m_triangleModeTest -{ - TriangleMotionInfo( 0, 1, 0 ), TriangleMotionInfo( 1, 0, 1 ), TriangleMotionInfo( 1, 0, 2 ), TriangleMotionInfo( 0, 0, 1 ), TriangleMotionInfo( 0, 2, 0 ), - TriangleMotionInfo( 1, 0, 3 ), TriangleMotionInfo( 1, 0, 4 ), TriangleMotionInfo( 1, 1, 0 ), TriangleMotionInfo( 0, 3, 0 ), TriangleMotionInfo( 0, 4, 0 ), - TriangleMotionInfo( 0, 0, 2 ), TriangleMotionInfo( 0, 1, 2 ), TriangleMotionInfo( 1, 1, 2 ), TriangleMotionInfo( 0, 0, 4 ), TriangleMotionInfo( 0, 0, 3 ), - TriangleMotionInfo( 0, 1, 3 ), TriangleMotionInfo( 0, 1, 4 ), TriangleMotionInfo( 1, 1, 4 ), TriangleMotionInfo( 1, 1, 3 ), TriangleMotionInfo( 1, 2, 1 ), - TriangleMotionInfo( 1, 2, 0 ), TriangleMotionInfo( 0, 2, 1 ), TriangleMotionInfo( 0, 4, 3 ), TriangleMotionInfo( 1, 3, 0 ), TriangleMotionInfo( 1, 3, 2 ), - TriangleMotionInfo( 1, 3, 4 ), TriangleMotionInfo( 1, 4, 0 ), TriangleMotionInfo( 1, 3, 1 ), TriangleMotionInfo( 1, 2, 3 ), TriangleMotionInfo( 1, 4, 1 ), - TriangleMotionInfo( 0, 4, 1 ), TriangleMotionInfo( 0, 2, 3 ), TriangleMotionInfo( 1, 4, 2 ), TriangleMotionInfo( 0, 3, 2 ), TriangleMotionInfo( 1, 4, 3 ), - TriangleMotionInfo( 0, 3, 1 ), TriangleMotionInfo( 0, 2, 4 ), TriangleMotionInfo( 1, 2, 4 ), TriangleMotionInfo( 0, 4, 2 ), TriangleMotionInfo( 0, 3, 4 ), -} -{} -#else EncCu::EncCu() : m_GeoModeTest { GeoMotionInfo(0, 1), GeoMotionInfo(1, 0),GeoMotionInfo(0, 2), GeoMotionInfo(1, 2), GeoMotionInfo(2, 0), @@ -83,7 +69,6 @@ EncCu::EncCu() : m_GeoModeTest GeoMotionInfo(5, 0), GeoMotionInfo(5, 1),GeoMotionInfo(5, 2), GeoMotionInfo(5, 3), GeoMotionInfo(5, 4) } {} -#endif void EncCu::create( EncCfg* encCfg ) { @@ -151,49 +136,10 @@ void EncCu::create( EncCfg* encCfg ) m_acRealMergeBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); m_acMergeTmpBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); } -#if !JVET_Q0806 - const unsigned maxNumTriangleCand = encCfg->getMaxNumGeoCand(); - for (unsigned i = 0; i < maxNumTriangleCand; i++) - { - for (unsigned j = 0; j < maxNumTriangleCand; j++) - { - if (i == j) - continue; - uint8_t idxBits0 = i + (i == maxNumTriangleCand - 1 ? 0 : 1); - uint8_t candIdx1Enc = j - (j > i ? 1 : 0); - uint8_t idxBits1 = candIdx1Enc + (candIdx1Enc == maxNumTriangleCand - 2 ? 0 : 1); - m_triangleIdxBins[1][i][j] = m_triangleIdxBins[0][i][j] = 1 + idxBits0 + idxBits1; - } - } - if (maxNumTriangleCand != 5) - { - // update the table - int index = 0; - for (unsigned i = 0; i < maxNumTriangleCand; i++) - { - for (unsigned j = 0; j < maxNumTriangleCand; j++) - { - if (i == j) - continue; - for (unsigned dir = 0; dir < 2; dir++, index++) - { - m_triangleModeTest[index].m_splitDir = dir; - m_triangleModeTest[index].m_candIdx0 = i; - m_triangleModeTest[index].m_candIdx1 = j; - } - } - } - } - for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) - { - m_acTriangleWeightedBuffer[ui].create( chromaFormat, Area( 0, 0, uiMaxWidth, uiMaxHeight ) ); - } -#else for( unsigned ui = 0; ui < GEO_MAX_TRY_WEIGHTED_SAD; ui++ ) { m_acGeoWeightedBuffer[ui].create( chromaFormat, Area( 0, 0, uiMaxWidth, uiMaxHeight ) ); } -#endif m_CtxBuffer.resize( maxDepth ); m_CurrCtx = 0; @@ -257,17 +203,10 @@ void EncCu::destroy() m_acRealMergeBuffer[ui].destroy(); m_acMergeTmpBuffer[ui].destroy(); } -#if !JVET_Q0806 - for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) - { - m_acTriangleWeightedBuffer[ui].destroy(); - } -#else for (unsigned ui = 0; ui < GEO_MAX_TRY_WEIGHTED_SAD; ui++) { m_acGeoWeightedBuffer[ui].destroy(); } -#endif } @@ -297,10 +236,8 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) m_dataId = tId; #endif m_pcLoopFilter = pcEncLib->getLoopFilter(); -#if JVET_Q0806 m_GeoCostList.init(GEO_NUM_PARTITION_MODE, m_pcEncCfg->getMaxNumGeoCand()); m_AFFBestSATDCost = MAX_DOUBLE; -#endif DecCu::init( m_pcTrQuant, m_pcIntraSearch, m_pcInterSearch ); @@ -828,17 +765,10 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par if (cu) cu->mmvdSkip = cu->skip == false ? false : cu->mmvdSkip; } -#if !JVET_Q0806 - else if( currTestMode.type == ETM_MERGE_TRIANGLE ) - { - xCheckRDCostMergeTriangle2Nx2N( tempCS, bestCS, partitioner, currTestMode ); - } -#else else if( currTestMode.type == ETM_MERGE_GEO ) { xCheckRDCostMergeGeo2Nx2N( tempCS, bestCS, partitioner, currTestMode ); } -#endif else if( currTestMode.type == ETM_INTRA ) { if (slice.getSPS()->getUseColorTrans() && !CS::isDualITree(*tempCS)) @@ -2452,11 +2382,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); cu.skip = false; cu.mmvdSkip = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif //cu.affine cu.predMode = MODE_INTER; //cu.LICFlag @@ -2715,11 +2641,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); cu.skip = false; cu.mmvdSkip = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif //cu.affine cu.predMode = MODE_INTER; //cu.LICFlag @@ -2884,230 +2806,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } -#if !JVET_Q0806 -void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) -{ - const Slice &slice = *tempCS->slice; - const SPS &sps = *tempCS->sps; - if (sps.getMaxNumGeoCand() < 2) - return; - - CHECK( slice.getSliceType() != B_SLICE, "Triangle mode is only applied to B-slices" ); - - tempCS->initStructData( encTestMode.qp ); - - bool trianglecandHasNoResidual[TRIANGLE_MAX_NUM_CANDS]; - for( int mergeCand = 0; mergeCand < TRIANGLE_MAX_NUM_CANDS; mergeCand++ ) - { - trianglecandHasNoResidual[mergeCand] = false; - } - - bool bestIsSkip = false; - uint8_t numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; - uint8_t triangleNumMrgSATDCand = TRIANGLE_MAX_NUM_SATD_CANDS; - PelUnitBuf triangleBuffer[TRIANGLE_MAX_NUM_UNI_CANDS]; - PelUnitBuf triangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; - static_vector<uint8_t, TRIANGLE_MAX_NUM_CANDS> triangleRdModeList; - static_vector<double, TRIANGLE_MAX_NUM_CANDS> tianglecandCostList; - uint8_t numTriangleCandComb = sps.getMaxNumGeoCand() * (sps.getMaxNumGeoCand() - 1) * 2; - - DistParam distParam; - const bool useHadamard = !tempCS->slice->getDisableSATDForRD(); - m_pcRdCost->setDistParam( distParam, tempCS->getOrgBuf().Y(), m_acMergeBuffer[0].Y(), sps.getBitDepth( CHANNEL_TYPE_LUMA ), COMPONENT_Y, useHadamard ); - - const UnitArea localUnitArea( tempCS->area.chromaFormat, Area( 0, 0, tempCS->area.Y().width, tempCS->area.Y().height) ); - - const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda( ); - - MergeCtx triangleMrgCtx; - { - CodingUnit cu( tempCS->area ); - cu.cs = tempCS; - cu.predMode = MODE_INTER; - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); - cu.triangle = true; - cu.mmvdSkip = false; - cu.BcwIdx = BCW_DEFAULT; - - PredictionUnit pu( tempCS->area ); - pu.cu = &cu; - pu.cs = tempCS; - pu.regularMergeFlag = false; - - PU::getTriangleMergeCandidates( pu, triangleMrgCtx ); - const uint8_t maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand(); - for (uint8_t mergeCand = 0; mergeCand < maxNumTriangleCand; mergeCand++) - { - triangleBuffer[mergeCand] = m_acMergeBuffer[mergeCand].getBuf(localUnitArea); - triangleMrgCtx.setMergeInfo( pu, mergeCand ); - PU::spanMotionInfo( pu, triangleMrgCtx ); - - if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( pu ) ) ) ) - { - // Do not use this mode - tempCS->initStructData( encTestMode.qp ); - return; - } - m_pcInterSearch->motionCompensation( pu, triangleBuffer[mergeCand] ); - } - } - - triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, numTriangleCandComb); - { - CodingUnit &cu = tempCS->addCU( tempCS->area, partitioner.chType ); - - partitioner.setCUData( cu ); - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); - cu.skip = false; - cu.predMode = MODE_INTER; - cu.chromaQpAdj = m_cuChromaQpOffsetIdxPlus1; - cu.qp = encTestMode.qp; - cu.triangle = true; - cu.mmvdSkip = false; - cu.BcwIdx = BCW_DEFAULT; - - PredictionUnit &pu = tempCS->addPU( cu, partitioner.chType ); - - if( abs(floorLog2(cu.lwidth()) - floorLog2(cu.lheight())) >= 2 ) - { - numTriangleCandidate = 30; - } - else - { - numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; - } - - numTriangleCandidate = min(numTriangleCandidate, numTriangleCandComb); - - for( uint8_t mergeCand = 0; mergeCand < numTriangleCandidate; mergeCand++ ) - { - bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; - uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; - uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; - - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - pu.mergeFlag = true; - pu.regularMergeFlag = false; - triangleWeightedBuffer[mergeCand] = m_acTriangleWeightedBuffer[mergeCand].getBuf( localUnitArea ); - triangleBuffer[candIdx0] = m_acMergeBuffer[candIdx0].getBuf( localUnitArea ); - triangleBuffer[candIdx1] = m_acMergeBuffer[candIdx1].getBuf( localUnitArea ); - - m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_LUMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); - distParam.cur = triangleWeightedBuffer[mergeCand].Y(); - - Distortion uiSad = distParam.distFunc( distParam ); - - uint32_t uiBitsCand = m_triangleIdxBins[splitDir][candIdx0][candIdx1]; - - double cost = (double)uiSad + (double)uiBitsCand * sqrtLambdaForFirstPass; - - updateCandList( mergeCand, cost, triangleRdModeList, tianglecandCostList - , triangleNumMrgSATDCand ); - } - - // limit number of candidates using SATD-costs - for( uint8_t i = 0; i < triangleNumMrgSATDCand; i++ ) - { - if( tianglecandCostList[i] > MRG_FAST_RATIO * tianglecandCostList[0] || tianglecandCostList[i] > getMergeBestSATDCost() ) - { - triangleNumMrgSATDCand = i; - break; - } - } - - // perform chroma weighting process - if (isChromaEnabled(pu.chromaFormat)) - { - for( uint8_t i = 0; i < triangleNumMrgSATDCand; i++ ) - { - uint8_t mergeCand = triangleRdModeList[i]; - bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; - uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; - uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; - - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - pu.mergeFlag = true; - pu.regularMergeFlag = false; - m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_CHROMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); - } - } - - tempCS->initStructData( encTestMode.qp ); - } - - triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, (uint8_t)triangleRdModeList.size()); - - m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; - { - uint8_t iteration; - uint8_t iterationBegin = 0; - iteration = 2; - for (uint8_t noResidualPass = iterationBegin; noResidualPass < iteration; ++noResidualPass) - { - for( uint8_t mrgHADIdx = 0; mrgHADIdx < triangleNumMrgSATDCand; mrgHADIdx++ ) - { - uint8_t mergeCand = triangleRdModeList[mrgHADIdx]; - - if ( ( (noResidualPass != 0) && trianglecandHasNoResidual[mergeCand] ) - || ( (noResidualPass == 0) && bestIsSkip ) ) - { - continue; - } - - bool splitDir = m_triangleModeTest[mergeCand].m_splitDir; - uint8_t candIdx0 = m_triangleModeTest[mergeCand].m_candIdx0; - uint8_t candIdx1 = m_triangleModeTest[mergeCand].m_candIdx1; - - CodingUnit &cu = tempCS->addCU(tempCS->area, partitioner.chType); - - partitioner.setCUData(cu); - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->pps->getTileIdx( tempCS->area.lumaPos() ); - cu.skip = false; - cu.predMode = MODE_INTER; - cu.chromaQpAdj = m_cuChromaQpOffsetIdxPlus1; - cu.qp = encTestMode.qp; - cu.triangle = true; - cu.mmvdSkip = false; - cu.BcwIdx = BCW_DEFAULT; - PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType); - - pu.triangleSplitDir = splitDir; - pu.triangleMergeIdx0 = candIdx0; - pu.triangleMergeIdx1 = candIdx1; - pu.mergeFlag = true; - pu.regularMergeFlag = false; - PU::spanTriangleMotionInfo(pu, triangleMrgCtx, splitDir, candIdx0, candIdx1 ); - - if( m_pcEncCfg->getMCTSEncConstraint() && ( !( MCTSHelper::checkMvBufferForMCTSConstraint( *cu.firstPU ) ) ) ) - { - // Do not use this mode - tempCS->initStructData( encTestMode.qp ); - return; - } - tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); - xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, ( noResidualPass == 0 ? &trianglecandHasNoResidual[mergeCand] : NULL ) ); - - if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip) - { - bestIsSkip = bestCS->getCU(partitioner.chType)->rootCbf == 0; - } - tempCS->initStructData(encTestMode.qp); - }// end loop mrgHADIdx - } - } - if ( m_bestModeUpdated && bestCS->cost != MAX_DOUBLE ) - { - xCalDebCost( *bestCS, partitioner ); - } -} -#else void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode) { const Slice &slice = *tempCS->slice; @@ -3386,7 +3084,6 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure xCalDebCost(*bestCS, pm); } } -#endif void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { @@ -3409,9 +3106,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct AffineMergeCtx affineMergeCtx; const SPS &sps = *tempCS->sps; -#if JVET_Q0806 setAFFBestSATDCost(MAX_DOUBLE); -#endif MergeCtx mrgCtx; if ( sps.getSBTMVPEnabledFlag() ) @@ -3552,9 +3247,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct } tempCS->initStructData( encTestMode.qp ); -#if JVET_Q0806 setAFFBestSATDCost(candCostList[0]); -#endif } else @@ -3708,11 +3401,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.mmvdSkip = false; pu.mmvdMergeFlag = false; pu.regularMergeFlag = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif PU::getIBCMergeCandidates(pu, mergeCtx); } @@ -3746,11 +3435,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.chromaQpAdj = m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; cu.mmvdSkip = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif DistParam distParam; const bool bUseHadamard = !cu.slice->getDisableSATDForRD(); PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType); //tempCS->addPU(cu); @@ -3867,11 +3552,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.mmvdSkip = false; pu.mmvdMergeFlag = false; pu.regularMergeFlag = false; -#if !JVET_Q0806 - cu.triangle = false; -#else cu.geoFlag = false; -#endif mergeCtx.setMergeInfo(pu, mergeCand); PU::spanMotionInfo(pu, mergeCtx); diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index c73ba36612..882a5ef7fa 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -67,17 +67,6 @@ class EncSlice; // ==================================================================================================================== /// CU encoder class -#if !JVET_Q0806 -struct TriangleMotionInfo -{ - uint8_t m_splitDir; - uint8_t m_candIdx0; - uint8_t m_candIdx1; - - TriangleMotionInfo ( uint8_t splitDir, uint8_t candIdx0, uint8_t candIdx1 ): m_splitDir(splitDir), m_candIdx0(candIdx0), m_candIdx1(candIdx1) { } - TriangleMotionInfo() { m_splitDir = m_candIdx0 = m_candIdx1 = 0; } -}; -#else struct GeoMergeCombo { int splitDir; @@ -156,7 +145,6 @@ public: } int numGeoTemplatesInitialized; }; -#endif class EncCu : DecCu @@ -203,13 +191,9 @@ private: PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelStorage m_acRealMergeBuffer[MRG_MAX_NUM_CANDS]; PelStorage m_acMergeTmpBuffer[MRG_MAX_NUM_CANDS]; -#if !JVET_Q0806 - PelStorage m_acTriangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; // to store weighted prediction pixles -#else PelStorage m_acGeoWeightedBuffer[GEO_MAX_TRY_WEIGHTED_SAD]; // to store weighted prediction pixles FastGeoCostList m_GeoCostList; double m_AFFBestSATDCost; -#endif double m_mergeBestSATDCost; MotionInfo m_SubPuMiBuf [( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 )]; @@ -220,12 +204,7 @@ private: #endif int m_bestBcwIdx[2]; double m_bestBcwCost[2]; -#if !JVET_Q0806 - TriangleMotionInfo m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS]; - uint8_t m_triangleIdxBins[2][TRIANGLE_MAX_NUM_UNI_CANDS][TRIANGLE_MAX_NUM_UNI_CANDS]; -#else GeoMotionInfo m_GeoModeTest[GEO_MAX_NUM_CANDS]; -#endif #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU void updateLambda ( Slice* slice, const int dQP, #if WCG_EXT && ER_CHROMA_QP_WCG_PPS @@ -255,10 +234,8 @@ public: void setMergeBestSATDCost(double cost) { m_mergeBestSATDCost = cost; } double getMergeBestSATDCost() { return m_mergeBestSATDCost; } -#if JVET_Q0806 void setAFFBestSATDCost(double cost) { m_AFFBestSATDCost = cost; } double getAFFBestSATDCost() { return m_AFFBestSATDCost; } -#endif IbcHashMap& getIbcHashMap() { return m_ibcHashMap; } EncCfg* getEncCfg() const { return m_pcEncCfg; } @@ -296,11 +273,7 @@ protected: void xCheckRDCostMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if !JVET_Q0806 - void xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#else void xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode); -#endif void xEncodeInterResidual( CodingStructure *&tempCS , CodingStructure *&bestCS diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 3bf68ceef6..b07e3385d9 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -1107,11 +1107,7 @@ void EncLib::xInitSPS( SPS& sps ) cinfo->setNoIbcConstraintFlag(m_noIbcConstraintFlag); cinfo->setNoCiipConstraintFlag(m_bNoCiipConstraintFlag); cinfo->setNoFPelMmvdConstraintFlag(m_noFPelMmvdConstraintFlag); -#if !JVET_Q0806 - cinfo->setNoTriangleConstraintFlag(m_bNoTriangleConstraintFlag); -#else cinfo->setNoGeoConstraintFlag(m_noGeoConstraintFlag); -#endif cinfo->setNoLadfConstraintFlag(m_bNoLadfConstraintFlag); cinfo->setNoTransformSkipConstraintFlag(m_noTransformSkipConstraintFlag); cinfo->setNoBDPCMConstraintFlag(m_noBDPCMConstraintFlag); @@ -1210,11 +1206,7 @@ void EncLib::xInitSPS( SPS& sps ) #endif sps.setUseCiip ( m_ciip ); -#if !JVET_Q0806 - sps.setUseTriangle ( m_Triangle ); -#else sps.setUseGeo ( m_Geo ); -#endif sps.setUseMMVD ( m_MMVD ); sps.setFpelMmvdEnabledFlag (( m_MMVD ) ? m_allowDisFracMMVD : false); sps.setBdofControlPresentFlag(m_BIO); diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index fa056726ff..332cd53324 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1364,17 +1364,10 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add inter modes if( m_pcEncCfg->getUseEarlySkipDetection() ) { -#if !JVET_Q0806 - if( cs.sps->getUseTriangle() && cs.slice->isInterB() ) - { - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp } ); - } -#else if( cs.sps->getUseGeo() && cs.slice->isInterB() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_GEO, ETO_STANDARD, qp } ); } -#endif m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp } ); if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { @@ -1385,17 +1378,10 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru else { m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp } ); -#if !JVET_Q0806 - if( cs.sps->getUseTriangle() && cs.slice->isInterB() ) - { - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp } ); - } -#else if( cs.sps->getUseGeo() && cs.slice->isInterB() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_GEO, ETO_STANDARD, qp } ); } -#endif m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp } ); if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { @@ -1433,11 +1419,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ComprCUCtx& cuECtx = m_ComprCUCtxList.back(); // Fast checks, partitioning depended -#if !JVET_Q0806 - if (cuECtx.isHashPerfectMatch && encTestmode.type != ETM_MERGE_SKIP && encTestmode.type != ETM_INTER_ME && encTestmode.type != ETM_AFFINE && encTestmode.type != ETM_MERGE_TRIANGLE) -#else if (cuECtx.isHashPerfectMatch && encTestmode.type != ETM_MERGE_SKIP && encTestmode.type != ETM_INTER_ME && encTestmode.type != ETM_AFFINE && encTestmode.type != ETM_MERGE_GEO) -#endif { return false; } @@ -1660,12 +1642,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#if !JVET_Q0806 - if( encTestmode.type == ETM_MERGE_TRIANGLE && ( partitioner.currArea().lumaSize().area() < TRIANGLE_MIN_SIZE || relatedCU.isIntra ) ) - { - return false; - } -#else if( encTestmode.type == ETM_MERGE_GEO && ( partitioner.currArea().lwidth() < GEO_MIN_CU_SIZE || partitioner.currArea().lheight() < GEO_MIN_CU_SIZE || partitioner.currArea().lwidth() > GEO_MAX_CU_SIZE || partitioner.currArea().lheight() > GEO_MAX_CU_SIZE || partitioner.currArea().lwidth() >= 8 * partitioner.currArea().lheight() @@ -1673,7 +1649,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#endif return true; } else if( isModeSplit( encTestmode ) ) diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index f2b75071da..0eb7a33298 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -59,11 +59,7 @@ enum EncTestModeType ETM_MERGE_SKIP, ETM_INTER_ME, ETM_AFFINE, -#if !JVET_Q0806 - ETM_MERGE_TRIANGLE, -#else ETM_MERGE_GEO, -#endif ETM_INTRA, ETM_PALETTE, ETM_SPLIT_QT, @@ -142,11 +138,7 @@ inline bool isModeInter( const EncTestMode& encTestmode ) // perhaps remove return ( encTestmode.type == ETM_INTER_ME || encTestmode.type == ETM_MERGE_SKIP || encTestmode.type == ETM_AFFINE -#if !JVET_Q0806 - || encTestmode.type == ETM_MERGE_TRIANGLE -#else || encTestmode.type == ETM_MERGE_GEO -#endif || encTestmode.type == ETM_HASH_INTER ); } diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index cbd5a2b7ad..9e8e33c277 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1128,17 +1128,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getFpelMmvdEnabledFlag() ? 1 : 0, "sps_fpel_mmvd_enabled_flag" ); } -#if !JVET_Q0806 - if (pcSPS->getMaxNumMergeCand() >= 2) - { - WRITE_FLAG(pcSPS->getUseTriangle() ? 1 : 0, "sps_triangle_enabled_flag"); - if (pcSPS->getUseTriangle() && pcSPS->getMaxNumMergeCand() >= 3) - { - CHECK(pcSPS->getMaxNumMergeCand() < pcSPS->getMaxNumGeoCand(), "Incorrrect max number of Triangle candidates!"); - WRITE_UVLC(pcSPS->getMaxNumMergeCand() - pcSPS->getMaxNumGeoCand(), "max_num_merge_cand_minus_max_num_gpm_cand"); - } - } -#else if (pcSPS->getMaxNumMergeCand() >= 2) { WRITE_FLAG(pcSPS->getUseGeo() ? 1 : 0, "sps_gpm_enabled_flag"); @@ -1148,7 +1137,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_UVLC(pcSPS->getMaxNumMergeCand() - pcSPS->getMaxNumGeoCand(), "max_num_merge_cand_minus_max_num_gpm_cand"); } } -#endif WRITE_FLAG(pcSPS->getUseLmcs() ? 1 : 0, "sps_lmcs_enable_flag"); WRITE_FLAG( pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag" ); @@ -2492,11 +2480,7 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoIbcConstraintFlag() ? 1 : 0, "no_ibc_constraint_flag"); WRITE_FLAG(cinfo->getNoCiipConstraintFlag() ? 1 : 0, "no_ciip_constraint_flag"); WRITE_FLAG(cinfo->getNoFPelMmvdConstraintFlag() ? 1 : 0, "no_fpel_mmvd_constraint_flag"); -#if !JVET_Q0806 - WRITE_FLAG(cinfo->getNoTriangleConstraintFlag() ? 1 : 0, "no_triangle_constraint_flag"); -#else WRITE_FLAG(cinfo->getNoGeoConstraintFlag() ? 1 : 0, "no_gpm_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); WRITE_FLAG(cinfo->getNoTransformSkipConstraintFlag() ? 1 : 0, "no_transform_skip_constraint_flag"); WRITE_FLAG(cinfo->getNoBDPCMConstraintFlag() ? 1 : 0, "no_bdpcm_constraint_flag"); -- GitLab