diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 490a284182a9d719cdd7cb6eadab7ff4886051d3..6f8adb88d749efe677066fa3867fa69f286d5187 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -153,11 +153,7 @@ uint32_t DecApp::decode() { read(nalu); -#if JVET_N0278_HLS if ((m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) || !isNaluTheTargetLayer(&nalu)) -#else - if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) -#endif { bNewPicture = false; } @@ -237,16 +233,8 @@ uint32_t DecApp::decode() m_cDecLib.setNoOutputPriorPicsFlag (false); } if ( bNewPicture && -#if !JVET_M0101_HLS - ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) -#else ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP) ) -#endif { xFlushOutput( pcListPic ); } @@ -256,16 +244,8 @@ uint32_t DecApp::decode() m_cDecLib.setFirstSliceInPicture (false); } // write reconstruction to file -- for additional bumping as defined in C.5.2.3 -#if JVET_N0067_NAL_Unit_Header if (!bNewPicture && ((nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL_15) || (nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu.m_nalUnitType <= NAL_UNIT_CODED_SLICE_GRA))) -#else -#if !JVET_M0101_HLS - if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31) -#else - if (!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL15) -#endif -#endif { xWriteOutput( pcListPic, nalu.m_temporalId ); } @@ -313,9 +293,7 @@ void DecApp::xCreateDecLib() ); m_cDecLib.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); -#if JVET_N0278_HLS m_cDecLib.setTargetDecLayer(m_iTargetLayer); -#endif if (!m_outputDecodedSEIMessagesFilename.empty()) { @@ -409,9 +387,6 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if ( !m_reconFileName.empty() ) { const Window &conf = pcPicTop->cs->sps->getConformanceWindow(); -#if !JVET_N0063_VUI - const Window defDisp = (m_respectDefDispWindow && pcPicTop->cs->sps->getVuiParametersPresentFlag()) ? pcPicTop->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window(); -#endif const bool isTff = pcPicTop->topField; bool display = true; @@ -430,17 +405,10 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), m_outputColourSpaceConvert, false, // TODO: m_packedYUVMode, -#if JVET_N0063_VUI conf.getWindowLeftOffset(), conf.getWindowRightOffset(), conf.getWindowTopOffset(), conf.getWindowBottomOffset(), -#else - conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), - conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), - conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), - conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, isTff ); } } @@ -484,24 +452,14 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if (!m_reconFileName.empty()) { const Window &conf = pcPic->cs->sps->getConformanceWindow(); -#if !JVET_N0063_VUI - const Window defDisp = (m_respectDefDispWindow && pcPic->cs->sps->getVuiParametersPresentFlag()) ? pcPic->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window(); -#endif m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, -#if JVET_N0063_VUI conf.getWindowLeftOffset(), conf.getWindowRightOffset(), conf.getWindowTopOffset(), conf.getWindowBottomOffset(), -#else - conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), - conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), - conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), - conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } @@ -556,25 +514,15 @@ void DecApp::xFlushOutput( PicList* pcListPic ) if ( !m_reconFileName.empty() ) { const Window &conf = pcPicTop->cs->sps->getConformanceWindow(); -#if !JVET_N0063_VUI - const Window defDisp = (m_respectDefDispWindow && pcPicTop->cs->sps->getVuiParametersPresentFlag()) ? pcPicTop->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window(); -#endif const bool isTff = pcPicTop->topField; m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), m_outputColourSpaceConvert, false, // TODO: m_packedYUVMode, -#if JVET_N0063_VUI conf.getWindowLeftOffset(), conf.getWindowRightOffset(), conf.getWindowTopOffset(), conf.getWindowBottomOffset(), -#else - conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), - conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), - conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), - conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, isTff ); } @@ -621,24 +569,14 @@ void DecApp::xFlushOutput( PicList* pcListPic ) if (!m_reconFileName.empty()) { const Window &conf = pcPic->cs->sps->getConformanceWindow(); -#if !JVET_N0063_VUI - const Window defDisp = (m_respectDefDispWindow && pcPic->cs->sps->getVuiParametersPresentFlag()) ? pcPic->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window(); -#endif m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, -#if JVET_N0063_VUI conf.getWindowLeftOffset(), conf.getWindowRightOffset(), conf.getWindowTopOffset(), conf.getWindowBottomOffset(), -#else - conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), - conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), - conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), - conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } @@ -688,7 +626,6 @@ bool DecApp::isNaluWithinTargetDecLayerIdSet( InputNALUnit* nalu ) return false; } -#if JVET_N0278_HLS /** \param nalu Input nalu to check whether its LayerId is the specified target layer */ bool DecApp::isNaluTheTargetLayer(InputNALUnit* nalu) @@ -698,6 +635,5 @@ bool DecApp::isNaluTheTargetLayer(InputNALUnit* nalu) return false; } -#endif //! \} diff --git a/source/App/DecoderApp/DecApp.h b/source/App/DecoderApp/DecApp.h index 5ef5e735b54893d6b4f43b8ad72fde95ad209b51..cf9caf947cd88ff2a0090468dc42a604bd5893a3 100644 --- a/source/App/DecoderApp/DecApp.h +++ b/source/App/DecoderApp/DecApp.h @@ -81,9 +81,7 @@ private: void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file void xFlushOutput ( PicList* pcListPic ); ///< flush all remaining decoded pictures to file bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet -#if JVET_N0278_HLS bool isNaluTheTargetLayer(InputNALUnit* nalu); ///< check whether given Nalu is within targetDecLayerIdSet -#endif }; //! \} diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index c32fe2c41156a2968bfbc912fefe724c3e594320..da4685e7ec42bc1d46e93eefea567529f225a4ef 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -87,9 +87,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) ("OutputBitDepthC,d", m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0, "bit depth of YUV output chroma component (default: use luma output bit-depth)") ("OutputColourSpaceConvert", outputColourSpaceConvert, string(""), "Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(false)) ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers") -#if JVET_N0278_HLS ("TargetLayer,p", m_iTargetLayer, -1, "Target bitstream Layer to be decoded.") -#endif ("SEIDecodedPictureHash,-dph",m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n" "\t1: check hash in SEI messages if available in the bitstream\n" "\t0: ignore SEI message") @@ -225,9 +223,7 @@ DecAppCfg::DecAppCfg() , m_iSkipFrame(0) // m_outputBitDepth array initialised below , m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED) -#if JVET_N0278_HLS , m_iTargetLayer(0) -#endif , m_iMaxTemporalLayer(-1) , m_decodedPictureHashSEIEnabled(0) , m_decodedNoDisplaySEIEnabled(false) diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h index 7a24479d6a8327317e8cc4b297e59d7895ef4d86..d4f01f770083c10356e02e91efb4ace512a21b2b 100644 --- a/source/App/DecoderApp/DecAppCfg.h +++ b/source/App/DecoderApp/DecAppCfg.h @@ -61,9 +61,7 @@ protected: int m_iSkipFrame; ///< counter for frames prior to the random access point to skip int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output InputColourSpaceConversion m_outputColourSpaceConvert; -#if JVET_N0278_HLS int m_iTargetLayer; ///< target stream layer to be decoded -#endif int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 2dc3b9ca579dc933f391cedeb045d50f5ad9e456..d3a9e4e6302e7e4dd3164407a1e701275cc807fc 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -85,7 +85,7 @@ void EncApp::xInitLibCfg() vps.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); } m_cEncLib.setVPS(&vps); -#elif JVET_N0278_HLS +#else VPS vps; vps.setMaxLayers ( 1 ); @@ -98,9 +98,7 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setProfile ( m_profile); m_cEncLib.setLevel ( m_levelTier, m_level); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setSubProfile ( m_subProfile ); -#endif m_cEncLib.setProgressiveSourceFlag ( m_progressiveSourceFlag); m_cEncLib.setInterlacedSourceFlag ( m_interlacedSourceFlag); m_cEncLib.setNonPackedConstraintFlag ( m_nonPackedConstraintFlag); @@ -131,9 +129,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setMaxChromaFormatConstraintIdc ( m_chromaFormatConstraint ); m_cEncLib.setFrameConstraintFlag ( m_bFrameConstraintFlag ); m_cEncLib.setNoQtbttDualTreeIntraConstraintFlag ( !m_dualTree ); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setNoPartitionConstraintsOverrideConstraintFlag ( !m_SplitConsOverrideEnabledFlag ); -#endif m_cEncLib.setNoSaoConstraintFlag ( !m_bUseSAO ); m_cEncLib.setNoAlfConstraintFlag ( !m_alf ); m_cEncLib.setNoPcmConstraintFlag ( !m_usePCM ); @@ -142,31 +138,18 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoSbtmvpConstraintFlag ( m_SubPuMvpMode ? false : true ); m_cEncLib.setNoAmvrConstraintFlag ( m_bNoAmvrConstraintFlag ); m_cEncLib.setNoBdofConstraintFlag ( !m_BIO ); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setNoDmvrConstraintFlag ( !m_DMVR ); -#endif m_cEncLib.setNoCclmConstraintFlag ( m_LMChroma ? false : true ); m_cEncLib.setNoMtsConstraintFlag ( (m_MTS || m_MTSImplicit) ? false : true ); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setNoSbtConstraintFlag ( !m_SBT ); -#endif m_cEncLib.setNoAffineMotionConstraintFlag ( !m_Affine ); m_cEncLib.setNoGbiConstraintFlag ( !m_GBi ); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setNoIbcConstraintFlag ( m_IBCMode ? false : true ); -#endif m_cEncLib.setNoMhIntraConstraintFlag ( !m_MHIntra ); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setNoFPelMmvdConstraintFlag ( !(m_MMVD && m_allowDisFracMMVD) ); -#endif m_cEncLib.setNoTriangleConstraintFlag ( !m_Triangle ); m_cEncLib.setNoLadfConstraintFlag ( !m_LadfEnabed ); -#if JVET_N0276_CONSTRAINT_FLAGS m_cEncLib.setNoTransformSkipConstraintFlag ( !m_useTransformSkip ); -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - m_cEncLib.setNoCurrPicRefConstraintFlag ( !m_IBCMode ); -#endif m_cEncLib.setNoQpDeltaConstraintFlag ( m_bNoQpDeltaConstraintFlag ); m_cEncLib.setNoDepQuantConstraintFlag ( !m_depQuantEnabledFlag); m_cEncLib.setNoSignDataHidingConstraintFlag ( !m_signDataHidingEnabledFlag ); @@ -175,19 +158,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setIntraPeriod ( m_iIntraPeriod ); m_cEncLib.setDecodingRefreshType ( m_iDecodingRefreshType ); m_cEncLib.setGOPSize ( m_iGOPSize ); -#if JCTVC_Y0038_PARAMS m_cEncLib.setReWriteParamSets ( m_rewriteParamSets ); -#endif -#if JVET_M0128 m_cEncLib.setRPLList0 ( m_RPLList0); m_cEncLib.setRPLList1 ( m_RPLList1); -#endif -#if !JVET_M0128 - m_cEncLib.setExtraRPSs ( m_extraRPSs ); -#endif -#if JVET_N0047_Merge_IDR_Non_IDR m_cEncLib.setIDRRefParamListPresent ( m_idrRefParamList ); -#endif m_cEncLib.setGopList ( m_GOPList ); for(int i = 0; i < MAX_TLAYER; i++) @@ -245,10 +219,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setChromaCrQpOffset ( m_crQpOffset ); m_cEncLib.setChromaCbQpOffsetDualTree ( m_cbQpOffsetDualTree ); m_cEncLib.setChromaCrQpOffsetDualTree ( m_crQpOffsetDualTree ); -#if JVET_N0054_JOINT_CHROMA m_cEncLib.setChromaCbCrQpOffset ( m_cbCrQpOffset ); m_cEncLib.setChromaCbCrQpOffsetDualTree ( m_cbCrQpOffsetDualTree ); -#endif #if ER_CHROMA_QP_WCG_PPS m_cEncLib.setWCGChromaQpControl ( m_wcgChromaQpControl ); #endif @@ -291,10 +263,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setMinQTSizes ( m_uiMinQT ); m_cEncLib.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma ); m_cEncLib.setDualITree ( m_dualTree ); -#if JVET_N0193_LFNST m_cEncLib.setLFNST ( m_LFNST ); m_cEncLib.setUseFastLFNST ( m_useFastLFNST ); -#endif m_cEncLib.setSubPuMvpMode ( m_SubPuMvpMode ); m_cEncLib.setAffine ( m_Affine ); m_cEncLib.setAffineType ( m_AffineType ); @@ -308,9 +278,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setImplicitMTS ( m_MTSImplicit ); m_cEncLib.setUseSBT ( m_SBT ); m_cEncLib.setUseCompositeRef ( m_compositeRefEnabled ); -#if JVET_N0235_SMVD_SPS m_cEncLib.setUseSMVD ( m_SMVD ); -#endif m_cEncLib.setUseGBi ( m_GBi ); m_cEncLib.setUseGBiFast ( m_GBiFast ); #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET @@ -333,15 +301,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseAffineAmvr ( m_AffineAmvr ); m_cEncLib.setUseAffineAmvrEncOpt ( m_AffineAmvrEncOpt ); m_cEncLib.setDMVR ( m_DMVR ); -#if JVET_N0127_MMVD_SPS_FLAG m_cEncLib.setMMVD ( m_MMVD ); -#endif -#if JVET_N0449_MMVD_SIMP m_cEncLib.setMmvdDisNum (m_MmvdDisNum); -#endif -#if JVET_N0413_RDPCM m_cEncLib.setRDPCM ( m_RdpcmMode ); -#endif m_cEncLib.setIBCMode ( m_IBCMode ); m_cEncLib.setIBCLocalSearchRangeX ( m_IBCLocalSearchRangeX ); m_cEncLib.setIBCLocalSearchRangeY ( m_IBCLocalSearchRangeY ); @@ -355,7 +317,6 @@ void EncApp::xInitLibCfg() // ADD_NEW_TOOL : (encoder app) add setting of tool enabling flags and associated parameters here -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND m_cEncLib.setLoopFilterAcrossVirtualBoundariesDisabledFlag ( m_loopFilterAcrossVirtualBoundariesDisabledFlag ); m_cEncLib.setNumVerVirtualBoundaries ( m_numVerVirtualBoundaries ); m_cEncLib.setNumHorVirtualBoundaries ( m_numHorVirtualBoundaries ); @@ -367,7 +328,6 @@ void EncApp::xInitLibCfg() { m_cEncLib.setVirtualBoundariesPosY ( m_virtualBoundariesPosY[ i ], i ); } -#endif m_cEncLib.setMaxCUWidth ( m_uiCTUSize ); m_cEncLib.setMaxCUHeight ( m_uiCTUSize ); @@ -388,14 +348,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseAMaxBT ( m_useAMaxBT ); m_cEncLib.setUseE0023FastEnc ( m_e0023FastEnc ); m_cEncLib.setUseContentBasedFastQtbt ( m_contentBasedFastQtbt ); -#if JVET_N0242_NON_LINEAR_ALF m_cEncLib.setUseNonLinearAlfLuma ( m_useNonLinearAlfLuma ); m_cEncLib.setUseNonLinearAlfChroma ( m_useNonLinearAlfChroma ); -#endif -#if JVET_N0217_MATRIX_INTRAPRED m_cEncLib.setUseMIP ( m_MIP ); m_cEncLib.setUseFastMIP ( m_useFastMIP ); -#endif m_cEncLib.setCrossComponentPredictionEnabledFlag ( m_crossComponentPredictionEnabledFlag ); m_cEncLib.setUseReconBasedCrossCPredictionEstimate ( m_reconBasedCrossCPredictionEstimate ); m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_LUMA , m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA] ); @@ -433,9 +389,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setPCMLog2MaxSize ( m_pcmLog2MaxSize); m_cEncLib.setMaxNumMergeCand ( m_maxNumMergeCand ); m_cEncLib.setMaxNumAffineMergeCand ( m_maxNumAffineMergeCand ); -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM m_cEncLib.setMaxNumTriangleCand ( m_maxNumTriangleCand ); -#endif //====== Weighted Prediction ======== m_cEncLib.setUseWP ( m_useWeightedPred ); @@ -555,22 +509,15 @@ void EncApp::xInitLibCfg() m_cEncLib.setColumnWidth ( m_tileColumnWidth ); m_cEncLib.setRowHeight ( m_tileRowHeight ); } -#if JVET_N0857_TILES_BRICKS m_cEncLib.setRectSliceFlag ( m_rectSliceFlag ); m_cEncLib.setNumSlicesInPicMinus1 ( m_numSlicesInPicMinus1 ); -#if JVET_N0857_RECT_SLICES m_cEncLib.setTopLeftBrickIdx ( m_topLeftBrickIdx ); m_cEncLib.setBottomRightBrickIdx ( m_bottomRightBrickIdx); -#else - m_cEncLib.setTopLeftTileIdx ( m_topLeftTileIdx ); - m_cEncLib.setBottomRightTileIdx ( m_bottomRightTileIdx ); -#endif m_cEncLib.setLoopFilterAcrossSlicesEnabledFlag ( m_loopFilterAcrossSlicesEnabledFlag ); m_cEncLib.setSignalledSliceIdFlag ( m_signalledSliceIdFlag ), m_cEncLib.setSignalledSliceIdLengthMinus1 ( m_signalledSliceIdLengthMinus1 ); m_cEncLib.setSliceId ( m_sliceId ); m_cEncLib.setBrickSplitMap (m_brickSplitMap); -#endif m_cEncLib.xCheckGSParameters(); int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1); @@ -581,14 +528,10 @@ void EncApp::xInitLibCfg() m_cEncLib.setLFCrossTileBoundaryFlag ( m_bLFCrossTileBoundaryFlag ); m_cEncLib.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); m_cEncLib.setTMVPModeId ( m_TMVPModeId ); -#if HEVC_USE_SCALING_LISTS m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); -#endif m_cEncLib.setDepQuantEnabledFlag ( m_depQuantEnabledFlag); -#if HEVC_USE_SIGN_HIDING m_cEncLib.setSignDataHidingEnabledFlag ( m_signDataHidingEnabledFlag); -#endif m_cEncLib.setUseRateCtrl ( m_RCEnableRateControl ); m_cEncLib.setTargetBitrate ( m_RCTargetBitrate ); m_cEncLib.setKeepHierBit ( m_RCKeepHierarchicalBit ); @@ -605,14 +548,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce ); m_cEncLib.setCostMode ( m_costMode ); m_cEncLib.setUseRecalculateQPAccordingToLambda ( m_recalculateQPAccordingToLambda ); -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - m_cEncLib.setUseStrongIntraSmoothing ( m_useStrongIntraSmoothing ); -#endif -#if JVET_N0349_DPS m_cEncLib.setDecodingParameterSetEnabled ( m_decodingParameterSetEnabled ); -#endif m_cEncLib.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); -#if JVET_N0063_VUI m_cEncLib.setVuiParametersPresentFlag ( m_vuiParametersPresentFlag ); m_cEncLib.setAspectRatioInfoPresentFlag ( m_aspectRatioInfoPresentFlag); m_cEncLib.setAspectRatioIdc ( m_aspectRatioIdc ); @@ -630,38 +567,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setOverscanAppropriateFlag ( m_overscanAppropriateFlag ); m_cEncLib.setVideoSignalTypePresentFlag ( m_videoSignalTypePresentFlag ); m_cEncLib.setVideoFullRangeFlag ( m_videoFullRangeFlag ); -#else - m_cEncLib.setVuiParametersPresentFlag ( m_vuiParametersPresentFlag ); - m_cEncLib.setAspectRatioInfoPresentFlag ( m_aspectRatioInfoPresentFlag); - m_cEncLib.setAspectRatioIdc ( m_aspectRatioIdc ); - m_cEncLib.setSarWidth ( m_sarWidth ); - m_cEncLib.setSarHeight ( m_sarHeight ); - m_cEncLib.setOverscanInfoPresentFlag ( m_overscanInfoPresentFlag ); - m_cEncLib.setOverscanAppropriateFlag ( m_overscanAppropriateFlag ); - m_cEncLib.setVideoSignalTypePresentFlag ( m_videoSignalTypePresentFlag ); - m_cEncLib.setVideoFormat ( m_videoFormat ); - m_cEncLib.setVideoFullRangeFlag ( m_videoFullRangeFlag ); - m_cEncLib.setColourDescriptionPresentFlag ( m_colourDescriptionPresentFlag ); - m_cEncLib.setColourPrimaries ( m_colourPrimaries ); - m_cEncLib.setTransferCharacteristics ( m_transferCharacteristics ); - m_cEncLib.setMatrixCoefficients ( m_matrixCoefficients ); - m_cEncLib.setChromaLocInfoPresentFlag ( m_chromaLocInfoPresentFlag ); - m_cEncLib.setChromaSampleLocTypeTopField ( m_chromaSampleLocTypeTopField ); - m_cEncLib.setChromaSampleLocTypeBottomField ( m_chromaSampleLocTypeBottomField ); - m_cEncLib.setNeutralChromaIndicationFlag ( m_neutralChromaIndicationFlag ); - m_cEncLib.setDefaultDisplayWindow ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); - m_cEncLib.setFrameFieldInfoPresentFlag ( m_frameFieldInfoPresentFlag ); - m_cEncLib.setPocProportionalToTimingFlag ( m_pocProportionalToTimingFlag ); - m_cEncLib.setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); - m_cEncLib.setBitstreamRestrictionFlag ( m_bitstreamRestrictionFlag ); - m_cEncLib.setTilesFixedStructureFlag ( m_tilesFixedStructureFlag ); - m_cEncLib.setMotionVectorsOverPicBoundariesFlag ( m_motionVectorsOverPicBoundariesFlag ); - m_cEncLib.setMinSpatialSegmentationIdc ( m_minSpatialSegmentationIdc ); - m_cEncLib.setMaxBytesPerPicDenom ( m_maxBytesPerPicDenom ); - m_cEncLib.setMaxBitsPerMinCuDenom ( m_maxBitsPerMinCuDenom ); - m_cEncLib.setLog2MaxMvLengthHorizontal ( m_log2MaxMvLengthHorizontal ); - m_cEncLib.setLog2MaxMvLengthVertical ( m_log2MaxMvLengthVertical ); -#endif m_cEncLib.setEfficientFieldIRAPEnabled ( m_bEfficientFieldIRAPEnabled ); m_cEncLib.setHarmonizeGopFirstFieldCoupleEnabled ( m_bHarmonizeGopFirstFieldCoupleEnabled ); m_cEncLib.setSummaryOutFilename ( m_summaryOutFilename ); @@ -950,24 +855,6 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector& a { switch ((*it_au)->m_nalUnitType) { -#if !JVET_M0101_HLS - case NAL_UNIT_CODED_SLICE_TRAIL_R: - case NAL_UNIT_CODED_SLICE_TRAIL_N: - case NAL_UNIT_CODED_SLICE_TSA_R: - case NAL_UNIT_CODED_SLICE_TSA_N: - case NAL_UNIT_CODED_SLICE_STSA_R: - case NAL_UNIT_CODED_SLICE_STSA_N: - case NAL_UNIT_CODED_SLICE_BLA_W_LP: - case NAL_UNIT_CODED_SLICE_BLA_W_RADL: - case NAL_UNIT_CODED_SLICE_BLA_N_LP: - case NAL_UNIT_CODED_SLICE_IDR_W_RADL: - case NAL_UNIT_CODED_SLICE_IDR_N_LP: - case NAL_UNIT_CODED_SLICE_CRA: - case NAL_UNIT_CODED_SLICE_RADL_N: - case NAL_UNIT_CODED_SLICE_RADL_R: - case NAL_UNIT_CODED_SLICE_RASL_N: - case NAL_UNIT_CODED_SLICE_RASL_R: -#else case NAL_UNIT_CODED_SLICE_TRAIL: case NAL_UNIT_CODED_SLICE_STSA: case NAL_UNIT_CODED_SLICE_IDR_W_RADL: @@ -975,13 +862,8 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector& a case NAL_UNIT_CODED_SLICE_CRA: case NAL_UNIT_CODED_SLICE_RADL: case NAL_UNIT_CODED_SLICE_RASL: -#endif -#if JVET_N0349_DPS case NAL_UNIT_DPS: -#endif -#if HEVC_VPS || JVET_N0278_HLS case NAL_UNIT_VPS: -#endif case NAL_UNIT_SPS: case NAL_UNIT_PPS: case NAL_UNIT_APS: diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index a22c1d4883d7948794bda8fa2b8819981451c8db..18e3d67f0fd00ad61c3162722a1aba0fc6f96e05 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -113,9 +113,7 @@ EncAppCfg::EncAppCfg() , m_maxChromaFormatConstraintIdc(CHROMA_420) , m_bFrameConstraintFlag(false) , m_bNoQtbttDualTreeIntraConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noPartitionConstraintsOverrideConstraintFlag(false) -#endif , m_bNoSaoConstraintFlag(false) , m_bNoAlfConstraintFlag(false) , m_bNoPcmConstraintFlag(false) @@ -124,31 +122,18 @@ EncAppCfg::EncAppCfg() , m_bNoSbtmvpConstraintFlag(false) , m_bNoAmvrConstraintFlag(false) , m_bNoBdofConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noDmvrConstraintFlag(false) -#endif , m_bNoCclmConstraintFlag(false) , m_bNoMtsConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noSbtConstraintFlag(false) -#endif , m_bNoAffineMotionConstraintFlag(false) , m_bNoGbiConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noIbcConstraintFlag(false) -#endif , m_bNoMhIntraConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noFPelMmvdConstraintFlag(false) -#endif , m_bNoTriangleConstraintFlag(false) , m_bNoLadfConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noTransformSkipConstraintFlag(false) -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS -, m_bNoCurrPicRefConstraintFlag(false) -#endif , m_bNoQpDeltaConstraintFlag(false) , m_bNoDepQuantConstraintFlag(false) , m_bNoSignDataHidingConstraintFlag(false) @@ -214,7 +199,6 @@ std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //in in>>entry.m_tcOffsetDiv2; in>>entry.m_betaOffsetDiv2; in>>entry.m_temporalId; -#if JVET_M0128 in >> entry.m_numRefPicsActive0; in >> entry.m_numRefPics0; for (int i = 0; i < entry.m_numRefPics0; i++) @@ -227,32 +211,9 @@ std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //in { in >> entry.m_deltaRefPics1[i]; } -#else - in >> entry.m_numRefPicsActive; - in>>entry.m_numRefPics; - for ( int i = 0; i < entry.m_numRefPics; i++ ) - { - in>>entry.m_referencePics[i]; - } - in>>entry.m_interRPSPrediction; - if (entry.m_interRPSPrediction==1) - { - in>>entry.m_deltaRPS; - in>>entry.m_numRefIdc; - for ( int i = 0; i < entry.m_numRefIdc; i++ ) - { - in>>entry.m_refIdc[i]; - } - } - else if (entry.m_interRPSPrediction==2) - { - in>>entry.m_deltaRPS; - } -#endif return in; } -#if JVET_N0857_TILES_BRICKS std::istringstream &operator>>(std::istringstream &in, BrickSplit &entry) //input { in>>entry.m_tileIdx; @@ -272,7 +233,6 @@ std::istringstream &operator>>(std::istringstream &in, BrickSplit &entry) // return in; } -#endif bool confirmPara(bool bflag, const char* message); @@ -421,7 +381,6 @@ strToCostMode[] = {"mixed_lossless_lossy", COST_MIXED_LOSSLESS_LOSSY_CODING} }; -#if HEVC_USE_SCALING_LISTS static const struct MapStrToScalingListMode { const char* str; @@ -436,7 +395,6 @@ strToScalingListMode[] = {"default", SCALING_LIST_DEFAULT}, {"file", SCALING_LIST_FILE_READ} }; -#endif template static std::string enumToString(P map[], uint32_t mapLen, const T val) @@ -496,12 +454,10 @@ static inline istream& operator >> (istream &in, CostMode &mode) return readStrToEnum(strToCostMode, sizeof(strToCostMode)/sizeof(*strToCostMode), in, mode); } -#if HEVC_USE_SCALING_LISTS static inline istream& operator >> (istream &in, ScalingListMode &mode) { return readStrToEnum(strToScalingListMode, sizeof(strToScalingListMode)/sizeof(*strToScalingListMode), in, mode); } -#endif template struct SMultiValueInput @@ -743,15 +699,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput cfg_codedPivotValue (std::numeric_limits::min(), std::numeric_limits::max(), 0, 1<<16); SMultiValueInput cfg_targetPivotValue (std::numeric_limits::min(), std::numeric_limits::max(), 0, 1<<16); -#if JVET_N0857_TILES_BRICKS -#if JVET_N0857_RECT_SLICES SMultiValueInput cfg_SliceIdx (0, std::numeric_limits::max(), 0, std::numeric_limits::max()); SMultiValueInput cfg_SignalledSliceId (0, std::numeric_limits::max(), 0, std::numeric_limits::max()); -#else - SMultiValueInput cfg_TileGroupIdx (0, std::numeric_limits::max(), 0, std::numeric_limits::max()); - SMultiValueInput cfg_SignalledTileGroupId (0, std::numeric_limits::max(), 0, std::numeric_limits::max()); -#endif -#endif SMultiValueInput cfg_adIntraLambdaModifier (0, std::numeric_limits::max(), 0, MAX_TLAYER); ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier. @@ -793,10 +742,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput cfg_LadfQpOffset ( -MAX_QP, MAX_QP, 2, MAX_LADF_INTERVALS, defaultLadfQpOffset, 3 ); SMultiValueInput cfg_LadfIntervalLowerBound ( 0, std::numeric_limits::max(), 1, MAX_LADF_INTERVALS - 1, defaultLadfIntervalLowerBound, 2 ); #endif -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND SMultiValueInput cfg_virtualBoundariesPosX (0, std::numeric_limits::max(), 0, 3); SMultiValueInput cfg_virtualBoundariesPosY (0, std::numeric_limits::max(), 0, 3); -#endif int warnUnknowParameter = 0; #if ENABLE_TRACING @@ -881,9 +828,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("Profile", extendedProfile, NONE, "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none") ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1, or none") ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level (main or high only)") -#if JVET_N0276_CONSTRAINT_FLAGS ("SubProfile", m_subProfile, 0u, "Sub-profile idc") -#endif ("EnableDecodingParameterSet", m_decodingParameterSetEnabled, false, "Enables writing of Decoding Parameter Set") ("MaxBitDepthConstraint", m_bitDepthConstraint, 0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters") ("MaxChromaFormatConstraint", tmpConstraintChromaFormat, 0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters") @@ -906,14 +851,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MaxBTDepthISliceL", m_uiMaxBTDepthI, 3u, "MaxBTDepthISliceL") ("MaxBTDepthISliceC", m_uiMaxBTDepthIChroma, 3u, "MaxBTDepthISliceC") ("DualITree", m_dualTree, false, "Use separate QTBT trees for intra slice luma and chroma channel types") -#if JVET_N0193_LFNST ( "LFNST", m_LFNST, false, "Enable LFNST (0:off, 1:on) [default: off]" ) ( "FastLFNST", m_useFastLFNST, false, "Fast methods for LFNST" ) -#endif ("SubPuMvp", m_SubPuMvpMode, 0, "Enable Sub-PU temporal motion vector prediction (0:off, 1:ATMVP, 2:STMVP, 3:ATMVP+STMVP) [default: off]") -#if JVET_N0127_MMVD_SPS_FLAG ("MMVD", m_MMVD, true, "Enable Merge mode with Motion Vector Difference (0:off, 1:on) [default: 1]") -#endif ("Affine", m_Affine, false, "Enable affine prediction (0:off, 1:on) [default: off]") ("AffineType", m_AffineType, true, "Enable affine type prediction (0:off, 1:on) [default: on]" ) ("BIO", m_BIO, false, "Enable bi-directional optical flow") @@ -939,9 +880,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if INCLUDE_ISP_CFG_FLAG ( "ISP", m_ISP, false, "Enable Intra Sub-Partitions\n" ) #endif -#if JVET_N0235_SMVD_SPS ("SMVD", m_SMVD, false, "Enable Symmetric MVD\n") -#endif ("CompositeLTReference", m_compositeRefEnabled, false, "Enable Composite Long Term Reference Frame") ("GBi", m_GBi, false, "Enable Generalized Bi-prediction(GBi)") ("GBiFast", m_GBiFast, false, "Fast methods for Generalized Bi-prediction(GBi)\n") @@ -959,12 +898,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("AffineAmvr", m_AffineAmvr, false, "Eanble AMVR for affine inter mode") ("AffineAmvrEncOpt", m_AffineAmvrEncOpt, false, "Enable encoder optimization of affine AMVR") ("DMVR", m_DMVR, false, "Decoder-side Motion Vector Refinement") -#if JVET_N0449_MMVD_SIMP ("MmvdDisNum", m_MmvdDisNum, 8, "Number of MMVD Distance Entries") -#endif -#if JVET_N0413_RDPCM ( "RDPCM", m_RdpcmMode, false, "RDPCM") -#endif ( "IBC", m_IBCMode, 0u, "IBCMode (0x1:enabled, 0x0:disabled) [default: disabled]") ( "IBCLocalSearchRangeX", m_IBCLocalSearchRangeX, 128u, "Search range of IBC local search in x direction") ( "IBCLocalSearchRangeY", m_IBCLocalSearchRangeY, 128u, "Search range of IBC local search in y direction") @@ -977,13 +912,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("WrapAroundOffset", m_wrapAroundOffset, 0u, "Offset in luma samples used for computing the horizontal wrap-around position") // ADD_NEW_TOOL : (encoder app) add parsing parameters here -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND ("LoopFilterAcrossVirtualBoundariesDisabledFlag", m_loopFilterAcrossVirtualBoundariesDisabledFlag, false, "Disable in-loop filtering operations across the virtual boundaries (0:off, 1:on) [default: off]") ("NumVerVirtualBoundaries", m_numVerVirtualBoundaries, 0u, "Number of vertical virtual boundaries (0-3, inclusive)") ("NumHorVirtualBoundaries", m_numHorVirtualBoundaries, 0u, "Number of horizontal virtual boundaries (0-3, inclusive)") ("VirtualBoundariesPosX", cfg_virtualBoundariesPosX, cfg_virtualBoundariesPosX, "Locations of the vertical virtual boundaries in units of luma samples") ("VirtualBoundariesPosY", cfg_virtualBoundariesPosY, cfg_virtualBoundariesPosY, "Locations of the horizontal virtual boundaries in units of luma samples") -#endif ("EncDbOpt", m_encDbOpt, false, "Encoder optimization with deblocking filter") ("LumaReshapeEnable", m_lumaReshapeEnable, false, "Enable Reshaping for Luma Channel") ("ReshapeSignalType", m_reshapeSignalType, 0u, "Input signal type: 0: SDR, 1:PQ, 2:HLG") @@ -994,14 +927,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("AMaxBT", m_useAMaxBT, false, "Adaptive maximal BT-size") ("E0023FastEnc", m_e0023FastEnc, true, "Fast encoding setting for QTBT (proposal E0023)") ("ContentBasedFastQtbt", m_contentBasedFastQtbt, false, "Signal based QTBT speed-up") -#if JVET_N0242_NON_LINEAR_ALF ("UseNonLinearAlfLuma", m_useNonLinearAlfLuma, true, "Non-linear adaptive loop filters for Luma Channel") ("UseNonLinearAlfChroma", m_useNonLinearAlfChroma, true, "Non-linear adaptive loop filters for Chroma Channels") -#endif -#if JVET_N0217_MATRIX_INTRAPRED ("MIP", m_MIP, true, "Enable MIP (matrix-based intra prediction)") ("FastMIP", m_useFastMIP, false, "Fast encoder search for MIP (matrix-based intra prediction)") -#endif // Unit definition parameters ("MaxCUWidth", m_uiMaxCUWidth, 64u) ("MaxCUHeight", m_uiMaxCUHeight, 64u) @@ -1018,14 +947,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)") ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") -#if JCTVC_Y0038_PARAMS ("ReWriteParamSets", m_rewriteParamSets, false, "Enable rewriting of Parameter sets before every (intra) random access point") //Alias with same name as in HM ("ReWriteParamSetsFlag", m_rewriteParamSets, false, "Alias for ReWriteParamSets") -#endif -#if JVET_N0047_Merge_IDR_Non_IDR ("IDRRefParamList", m_idrRefParamList, false, "Enable indication of reference picture list syntax elements in slice headers of IDR pictures") -#endif // motion search options ("DisableIntraInInter", m_bDisableIntraPUsInInterSlices, false, "Flag to disable intra PUs in inter slices") ("FastSearch", tmpMotionEstimationSearchMethod, int(MESEARCH_DIAMOND), "0:Full search 1:Diamond 2:Selective 3:Enhanced Diamond") @@ -1080,10 +1005,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") ("CbQpOffsetDualTree", m_cbQpOffsetDualTree, 0, "Chroma Cb QP Offset for dual tree") ("CrQpOffsetDualTree", m_crQpOffsetDualTree, 0, "Chroma Cr QP Offset for dual tree") -#if JVET_N0054_JOINT_CHROMA ("CbCrQpOffset,-cbcrqpofs", m_cbCrQpOffset, -1, "QP Offset for joint Cb-Cr mode") ("CbCrQpOffsetDualTree", m_cbCrQpOffsetDualTree, 0, "QP Offset for joint Cb-Cr mode in dual tree") -#endif #if ER_CHROMA_QP_WCG_PPS ("WCGPPSEnable", m_wcgChromaQpControl.enabled, false, "1: Enable the WCG PPS chroma modulation scheme. 0 (default) disabled") ("WCGPPSCbQpScale", m_wcgChromaQpControl.chromaCbQpScale, 1.0, "WCG PPS Chroma Cb QP Scale") @@ -1145,11 +1068,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if K0238_SAO_GREEDY_MERGE_ENCODING ("SAOGreedyEnc", m_saoGreedyMergeEnc, false, "SAO greedy merge encoding algorithm") #endif -#if JVET_N0857_TILES_BRICKS ("SliceMode", tmpSliceMode, int(NO_SLICES), "0: Disable all Recon slice limits, 1: (deprecated #CTU), 2: (deprecated #bytes), 3:specify tiles per slice, 4: one brick per slice") -#else - ("SliceMode", tmpSliceMode, int(NO_SLICES), "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") -#endif ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" "\t1: max number of CTUs per slice" "\t2: max number of bytes per slice" @@ -1173,10 +1092,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") //deprecated copies of renamed tile parameters ("UniformSpacingIdc", m_tileUniformSpacingFlag, false, "deprecated alias of TileUniformSpacing") -#if !JVET_N0857_TILES_BRICKS - ("ColumnWidthArray", cfg_ColumnWidth, cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray") - ("RowHeightArray", cfg_RowHeight, cfg_RowHeight, "deprecated alias of TileRowHeightArray") -#endif ("TileUniformSpacing", m_tileUniformSpacingFlag, false, "Indicates that tile columns and rows are distributed uniformly") ("NumTileColumnsMinus1", m_numTileColumnsMinus1, 0, "Number of tile columns in a picture minus 1") ("NumTileRowsMinus1", m_numTileRowsMinus1, 0, "Number of rows in a picture minus 1") @@ -1185,39 +1100,21 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") ("WaveFrontSynchro", m_entropyCodingSyncEnabledFlag, false, "0: entropy coding sync disabled; 1 entropy coding sync enabled") -#if JVET_N0857_TILES_BRICKS -#if JVET_N0857_RECT_SLICES ("RectSliceFlag", m_rectSliceFlag, true, "Rectangular slice flag") ("NumRectSlicesInPicMinus1", m_numSlicesInPicMinus1, 0, "Number slices in pic minus 1") -#else - ("RectTileGroupFlag", m_rectSliceFlag, true, "Rectangular tile group flag") - ("SlicesInPicMinus1", m_numSlicesInPicMinus1, 0, "Number tile groups in pic minus 1") -#endif ("LoopFilterAcrossTileGroupsEnabledFlag", m_loopFilterAcrossSlicesEnabledFlag, false, "Loop Filter Across Tile Groups Flag") ("SignalledIdFlag", m_signalledSliceIdFlag, false, "Signalled Slice ID Flag") ("SignalledSliceIdLengthMinus1", m_signalledSliceIdLengthMinus1, 0, "Signalled Tile Group Length minus 1") -#if JVET_N0857_RECT_SLICES ("RectSlicesBoundaryArray", cfg_SliceIdx, cfg_SliceIdx, "Rectangular slices boundaries in Pic") ("SignalledSliceId", cfg_SignalledSliceId, cfg_SliceIdx, "Signalled rectangular slice ID") -#else - ("TileGroupsInPic", cfg_TileGroupIdx, cfg_TileGroupIdx, "Tile Groups In Pic") - ("SignalledTileGroupId", cfg_SignalledTileGroupId, cfg_TileGroupIdx, "Signalled Tile Group ID") -#endif -#endif -#if HEVC_USE_SCALING_LISTS ("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile") ("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.") -#endif ("DepQuant", m_depQuantEnabledFlag, true ) -#if HEVC_USE_SIGN_HIDING ("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, false ) -#endif ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") ("MaxNumAffineMergeCand", m_maxNumAffineMergeCand, 5u, "Maximum number of affine merge candidates") -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM ("MaxNumTriangleCand", m_maxNumTriangleCand, 5u, "Maximum number of triangle candidates") -#endif /* Misc. */ ("SEIDecodedPictureHash,-dph", tmpDecodedPictureHashSEIMappedType, 0, "Control generation of decode picture hash SEI messages\n" "\t3: checksum\n" @@ -1247,12 +1144,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enabled_flag is enabled") ("CostMode", m_costMode, COST_STANDARD_LOSSY, "Use alternative cost functions: choose between 'lossy', 'sequence_level_lossless', 'lossless' (which forces QP to " MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP) ") and 'mixed_lossless_lossy' (which used QP'=" MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME) " for pre-estimates of transquant-bypass blocks).") ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") -#endif ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages"); opts.addOptions() -#if JVET_N0063_VUI ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") @@ -1270,41 +1163,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals"); -#else - ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") - ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") - ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") - ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") - ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") - ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") - ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") - ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") - ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") - ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") - ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") - ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") - ("TransferCharacteristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") - ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") - ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") - ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") - ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") - ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") - ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") - ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") - ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") - ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") - ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") - ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") - ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") - ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") - ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") - ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") - ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") - ("MaxBytesPerPicDenom", m_maxBytesPerPicDenom, 2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture") - ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") - ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") - ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units"); -#endif opts.addOptions() ("SEIColourRemappingInfoFileRoot,-cri", m_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters root file name (wo num ext)") ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, false, "Control generation of recovery point SEI messages") @@ -1458,20 +1316,17 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); } -#if JVET_N0857_TILES_BRICKS for(int i=1; i& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv, err); -#if JVET_M0128 for (int i = 0; m_GOPList[i].m_POC != -1 && i < MAX_GOP + 1; i++) { m_RPLList0[i].m_POC = m_RPLList1[i].m_POC = m_GOPList[i].m_POC; @@ -1489,20 +1344,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) for (int j = 0; j < m_GOPList[i].m_numRefPics1; j++) m_RPLList1[i].m_deltaRefPics[j] = m_GOPList[i].m_deltaRefPics1[j]; } -#endif if (m_compositeRefEnabled) { for (int i = 0; i < m_iGOPSize; i++) { m_GOPList[i].m_POC *= 2; -#if !JVET_M0128 - m_GOPList[i].m_deltaRPS *= 2; - for (int j = 0; j < m_GOPList[i].m_numRefPics; j++) - { - m_GOPList[i].m_referencePics[j] *= 2; - } -#else m_RPLList0[i].m_POC *= 2; m_RPLList1[i].m_POC *= 2; for (int j = 0; j < m_RPLList0[i].m_numRefPics; j++) @@ -1513,7 +1360,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { m_RPLList1[i].m_deltaRefPics[j] *= 2; } -#endif } } @@ -1814,24 +1660,16 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) EXIT( "Error: bad slice mode"); } m_sliceMode = SliceConstraint(tmpSliceMode); -#if JVET_N0857_TILES_BRICKS if (m_sliceMode==FIXED_NUMBER_OF_CTU || m_sliceMode==FIXED_NUMBER_OF_BYTES) { // note: slice mode 2 can be re-enabled using scan order tiles EXIT( "Error: slice mode 1 (fixed number of CTUs) and 2 (fixed number of bytes) are no longer supported"); } -#endif -#if JVET_N0857_TILES_BRICKS -#if JVET_N0857_RECT_SLICES m_topLeftBrickIdx.clear(); m_bottomRightBrickIdx.clear(); -#else - m_topLeftTileIdx.clear(); - m_bottomRightTileIdx.clear(); -#endif m_sliceId.clear(); bool singleTileInPicFlag = (m_numTileRowsMinus1 == 0 && m_numTileColumnsMinus1 == 0); @@ -1841,7 +1679,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) //if (!m_singleBrickPerSliceFlag && m_rectSliceFlag) if (m_sliceMode != 0 && m_sliceMode != 4 && m_rectSliceFlag) { -#if JVET_N0857_RECT_SLICES int numSlicesInPic = m_numSlicesInPicMinus1 + 1; if (cfg_SliceIdx.values.size() > numSlicesInPic * 2) @@ -1852,37 +1689,15 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { EXIT("Error: The number of slice indices (RectSlicesBoundaryInPic) is less than the NumSlicesInPicMinus1."); } -#else - int numTileGroupsInPic = m_numSlicesInPicMinus1 + 1; - - if (cfg_TileGroupIdx.values.size() > numTileGroupsInPic * 2) - { - EXIT("Error: The number of Tile group indexs are greater than the numTileGroupsInPicMinus1."); - } - else if (cfg_TileGroupIdx.values.size() < numTileGroupsInPic * 2) - { - EXIT("Error: The number of Tile group indexs are less than the numTileGroupsInPicMinus1."); - } -#endif else { -#if JVET_N0857_RECT_SLICES m_topLeftBrickIdx.resize(numSlicesInPic); m_bottomRightBrickIdx.resize(numSlicesInPic); for (uint32_t i = 0; i < numSlicesInPic; ++i) { m_topLeftBrickIdx[i] = cfg_SliceIdx.values[i * 2]; m_bottomRightBrickIdx[i] = cfg_SliceIdx.values[i * 2 + 1]; -#else - m_topLeftTileIdx.resize(numTileGroupsInPic); - m_bottomRightTileIdx.resize(numTileGroupsInPic); - for (uint32_t i = 0; i < numTileGroupsInPic; ++i) - { - m_topLeftTileIdx[i] = cfg_TileGroupIdx.values[i * 2]; - m_bottomRightTileIdx[i] = cfg_TileGroupIdx.values[i * 2 + 1]; -#endif } -#if JVET_N0857_RECT_SLICES //Validating the correctness of rectangular slice structure int **brickToSlice = (int **)malloc(sizeof(int *) * (m_numTileRowsMinus1 + 1)); for (int i = 0; i <= m_numTileRowsMinus1; i++) @@ -1952,12 +1767,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } free(brickToSlice); brickToSlice = 0; -#endif } } // (!m_singleBrickPerSliceFlag && m_rectSliceFlag) } // !singleTileInPicFlag -#if JVET_N0857_RECT_SLICES if (m_rectSliceFlag && m_signalledSliceIdFlag) { int numSlicesInPic = m_numSlicesInPicMinus1 + 1; @@ -1988,30 +1801,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_sliceId[i] = i; } } -#else - if (m_rectSliceFlag && m_signalledSliceIdFlag) - { - int numTileGroupsInPic = m_numSlicesInPicMinus1 + 1; - - if (cfg_SignalledTileGroupId.values.size() > numTileGroupsInPic) - { - EXIT("Error: The number of Tile group Ids are greater than the m_signalledTileGroupIdLengthMinus1."); - } - else if (cfg_SignalledTileGroupId.values.size() < numTileGroupsInPic) - { - EXIT("Error: The number of Tile group Ids are less than the m_signalledTileGroupIdLengthMinus1."); - } - else - { - m_sliceId.resize(numTileGroupsInPic); - for (uint32_t i = 0; i < cfg_SignalledTileGroupId.values.size(); ++i) - { - m_sliceId[i] = cfg_SignalledTileGroupId.values[i]; - } - } - } -#endif -#endif if (tmpDecodedPictureHashSEIMappedType<0 || tmpDecodedPictureHashSEIMappedType>=int(NUMBER_OF_HASHTYPES)) { @@ -2112,7 +1901,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } #endif -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if ( m_loopFilterAcrossVirtualBoundariesDisabledFlag ) { CHECK( m_numVerVirtualBoundaries > 3, "Number of vertical virtual boundaries must be comprised between 0 and 3 included" ); @@ -2148,7 +1936,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } } -#endif // reading external dQP description from file if ( !m_dQPFileName.empty() ) @@ -2379,20 +2166,14 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_MTS, "MTS only allowed with NEXT profile" ); xConfirmPara( m_MTSIntraMaxCand, "MTS only allowed with NEXT profile" ); xConfirmPara( m_MTSInterMaxCand, "MTS only allowed with NEXT profile" ); -#if JVET_N0235_SMVD_SPS xConfirmPara( m_SMVD, "SMVD is only allowed with NEXT profile" ); -#endif xConfirmPara( m_compositeRefEnabled, "Composite Reference Frame is only allowed with NEXT profile" ); xConfirmPara( m_GBi, "GBi is only allowed with NEXT profile" ); xConfirmPara( m_GBiFast, "GBiFast is only allowed with NEXT profile" ); xConfirmPara( m_Triangle, "Triangle is only allowed with NEXT profile" ); xConfirmPara(m_DMVR, "DMVR only allowed with NEXT profile"); -#if JVET_N0449_MMVD_SIMP xConfirmPara(m_MmvdDisNum, "Number of distance MMVD entry setting only allowed with NEXT profile"); -#endif -#if JVET_N0413_RDPCM xConfirmPara(m_RdpcmMode, "RDPCM only allowed with NEXT profile"); -#endif // ADD_NEW_TOOL : (parameter check) add a check for next tools here } else @@ -2400,20 +2181,14 @@ bool EncAppCfg::xCheckParameter() if( m_depQuantEnabledFlag ) { xConfirmPara( !m_useRDOQ || !m_useRDOQTS, "RDOQ and RDOQTS must be equal to 1 if dependent quantization is enabled" ); -#if HEVC_USE_SIGN_HIDING xConfirmPara( m_signDataHidingEnabledFlag, "SignHideFlag must be equal to 0 if dependent quantization is enabled" ); -#endif } } if( m_wrapAround ) { -#if JVET_N0070_WRAPAROUND xConfirmPara( m_wrapAroundOffset <= m_uiCTUSize + (m_uiMaxCUWidth >> m_uiLog2DiffMaxMinCodingBlockSize), "Wrap-around offset must be greater than CtbSizeY + MinCbSize" ); -#else - xConfirmPara( m_wrapAroundOffset == 0, "Wrap-around offset must be greater than 0" ); -#endif xConfirmPara( m_wrapAroundOffset > m_iSourceWidth, "Wrap-around offset must not be greater than the source picture width" ); int minCUSize = m_uiCTUSize >> m_uiLog2DiffMaxMinCodingBlockSize; xConfirmPara( m_wrapAroundOffset % minCUSize != 0, "Wrap-around offset must be an integer multiple of the specified minimum CU size" ); @@ -2530,9 +2305,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles."); xConfirmPara(m_cabacBypassAlignmentEnabledFlag, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles."); } -#if !JVET_N0671_CHROMA_FORMAT_422 - xConfirmPara(m_chromaFormatIDC == CHROMA_422, "4:2:2 chroma sampling format not supported with current compiler setting. Set compiler flag \"JVET_N0671_CHROMA_FORMAT_422\" equal to 1 for enabling 4:2:2.\n\n"); -#endif // !JVET_N0671_CHROMA_FORMAT_422 // check range of parameters @@ -2675,12 +2447,10 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_cbQpOffsetDualTree > 12, "Max. Chroma Cb QP Offset for dual tree is 12" ); xConfirmPara( m_crQpOffsetDualTree < -12, "Min. Chroma Cr QP Offset for dual tree is -12" ); xConfirmPara( m_crQpOffsetDualTree > 12, "Max. Chroma Cr QP Offset for dual tree is 12" ); -#if JVET_N0054_JOINT_CHROMA xConfirmPara( m_cbCrQpOffset < -12, "Min. Joint Cb-Cr QP Offset is -12" ); xConfirmPara( m_cbCrQpOffset > 12, "Max. Joint Cb-Cr QP Offset is 12" ); xConfirmPara( m_cbCrQpOffsetDualTree < -12, "Min. Joint Cb-Cr QP Offset for dual tree is -12" ); xConfirmPara( m_cbCrQpOffsetDualTree > 12, "Max. Joint Cb-Cr QP Offset for dual tree is 12" ); -#endif xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); if (m_iDecodingRefreshType == 2) @@ -2713,11 +2483,9 @@ bool EncAppCfg::xCheckParameter() #endif 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_N0400_SIGNAL_TRIANGLE_CAND_NUM xConfirmPara( m_maxNumTriangleCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS." ); xConfirmPara( m_maxNumTriangleCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand." ); xConfirmPara( 0 < m_maxNumTriangleCand && m_maxNumTriangleCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0." ); -#endif xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." ); xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." ); @@ -2765,17 +2533,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_confWinTop % SPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); xConfirmPara( m_confWinBottom % SPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); -#if !JVET_N0063_VUI - xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window"); - - if (m_defaultDisplayWindowFlag) - { - xConfirmPara( m_defDispWinLeftOffset % SPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling"); - xConfirmPara( m_defDispWinRightOffset % SPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling"); - xConfirmPara( m_defDispWinTopOffset % SPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling"); - xConfirmPara( m_defDispWinBottomOffset % SPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling"); - } -#endif // max CU width and height should be power of 2 uint32_t ui = m_uiMaxCUWidth; @@ -2806,15 +2563,11 @@ bool EncAppCfg::xCheckParameter() m_GOPList[0].m_betaOffsetDiv2 = 0; m_GOPList[0].m_tcOffsetDiv2 = 0; m_GOPList[0].m_POC = 1; -#if JVET_M0128 m_RPLList0[0] = RPLEntry(); m_RPLList1[0] = RPLEntry(); m_RPLList0[0].m_POC = m_RPLList1[0].m_POC = 1; m_RPLList0[0].m_numRefPicsActive = 4; m_GOPList[0].m_numRefPicsActive0 = 4; -#else - m_GOPList[0].m_numRefPicsActive = 4; -#endif } else { @@ -2871,7 +2624,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1] + m_crQpOffset ) > 12, "Intra/periodic Cr QP Offset, when combined with the PPS Cr offset, exceeds supported range (-12 to 12)" ); #endif -#if JVET_M0128 int extraRPLs = 0; //start looping through frames in coding order until we can verify that the GOP structure is correct. while (!verifiedGOP && !errorGOP) @@ -3114,203 +2866,6 @@ bool EncAppCfg::xCheckParameter() checkGOP++; } xConfirmPara(errorGOP, "Invalid GOP structure given"); -#else - m_extraRPSs=0; - //start looping through frames in coding order until we can verify that the GOP structure is correct. - while(!verifiedGOP&&!errorGOP) - { - int curGOP = (checkGOP-1)%m_iGOPSize; - int curPOC = ((checkGOP - 1) / m_iGOPSize)*m_iGOPSize * multipleFactor + m_GOPList[curGOP].m_POC; - if(m_GOPList[curGOP].m_POC<0) - { - msg( WARNING, "\nError: found fewer Reference Picture Sets than GOPSize\n"); - errorGOP=true; - } - else - { - //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. - bool beforeI = false; - for(int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) - { - int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; - if(absPOC < 0) - { - beforeI=true; - } - else - { - bool found=false; - for(int j=0; j 0) - m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; - int newRefs=0; - for(int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) - { - int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; - if(absPOC>=0) - { - m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; - m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; - newRefs++; - } - } - int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; - - for(int offset = -1; offset>-checkGOP; offset--) - { - //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. - int offGOP = (checkGOP-1+offset)%m_iGOPSize; - int offPOC = ((checkGOP - 1 + offset) / m_iGOPSize)*(m_iGOPSize * multipleFactor) + m_GOPList[offGOP].m_POC; - if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) - { - bool newRef=false; - for(int i=0; i0) - { - insertPoint = j; - break; - } - } - int prev = offPOC-curPOC; - int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; - for(int j=insertPoint; j=numPrefRefs) - { - break; - } - } - m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; - if (m_extraRPSs == 0) - { - m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; - m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; - } - else - { - int rIdx = m_iGOPSize + m_extraRPSs - 1; - int refPOC = m_GOPList[rIdx].m_POC; - int refPics = m_GOPList[rIdx].m_numRefPics; - int newIdc=0; - for(int i = 0; i<= refPics; i++) - { - int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 - int absPOCref = refPOC+deltaPOC; - int refIdc = 0; - for (int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) - { - if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) - { - if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) - { - refIdc = 1; - } - else - { - refIdc = 2; - } - } - } - m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; - newIdc++; - } - m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; - m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; - m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; - } - curGOP=m_iGOPSize+m_extraRPSs; - m_extraRPSs++; - } - numRefs=0; - for(int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) - { - int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; - if(absPOC >= 0) - { - refList[numRefs]=absPOC; - numRefs++; - } - } - refList[numRefs]=curPOC; - numRefs++; - } - checkGOP++; - } - xConfirmPara(errorGOP,"Invalid GOP structure given"); -#endif m_maxTempLayer = 1; @@ -3329,7 +2884,6 @@ bool EncAppCfg::xCheckParameter() } for(int i=0; i m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) - { - m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; - } -#endif int highestDecodingNumberWithLowerPOC = 0; for(int j=0; jmaxTileWidth ? m_tileColumnWidth[col]:maxTileWidth; - accColumnWidth += m_tileColumnWidth[col]; - } - maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; - } - if(m_numTileRowsMinus1<1) - { - maxTileHeight = m_iSourceHeight; - } - else - { - int accRowHeight = 0; - for(int row=0; row<(m_numTileRowsMinus1); row++) - { - maxTileHeight = m_tileRowHeight[row]>maxTileHeight ? m_tileRowHeight[row]:maxTileHeight; - accRowHeight += m_tileRowHeight[row]; - } - maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; - } - } - int maxSizeInSamplesY = maxTileWidth*maxTileHeight; - m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; - } - else if(m_entropyCodingSyncEnabledFlag) - { - m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; - } - else if(m_sliceMode == FIXED_NUMBER_OF_CTU) - { - m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; - } - else - { - m_minSpatialSegmentationIdc = 0; - } - } -#endif -#if JVET_N0857_TILES_BRICKS for (int i=0; i=0) @@ -3483,7 +2955,6 @@ bool EncAppCfg::xCheckParameter() // ToDo: check that brick dimensions don't exceed tile dimensions } } -#endif if ((m_MCTSEncConstraint) && (m_bLFCrossTileBoundaryFlag)) { @@ -3565,17 +3036,6 @@ bool EncAppCfg::xCheckParameter() { xConfirmPara( m_RCCpbSaturationEnabled != 0, "Target bits saturation cannot be processed without Rate control" ); } -#if !JVET_N0063_VUI - if (m_vuiParametersPresentFlag) - { - xConfirmPara(m_RCTargetBitrate == 0, "A target bit rate is required to be set for VUI/HRD parameters."); - if (m_RCCpbSize == 0) - { - msg( WARNING, "Warning: CPB size is set equal to zero. Adjusting value to be equal to TargetBitrate!\n"); - m_RCCpbSize = m_RCTargetBitrate; - } - } -#endif #endif xConfirmPara(!m_TransquantBypassEnabledFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0"); @@ -3769,9 +3229,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_N0400_SIGNAL_TRIANGLE_CAND_NUM msg( DETAILS, "Max Num Triangle Merge Candidates : %d\n", m_maxNumTriangleCand ); -#endif msg( DETAILS, "\n"); msg( VERBOSE, "TOOL CFG: "); @@ -3821,26 +3279,18 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "PME:%d ", m_log2ParallelMergeLevel); const int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; msg( VERBOSE, " WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams); -#if HEVC_USE_SCALING_LISTS msg( VERBOSE, " ScalingList:%d ", m_useScalingListId ); -#endif msg( VERBOSE, "TMVPMode:%d ", m_TMVPModeId ); msg( VERBOSE, " DQ:%d ", m_depQuantEnabledFlag); -#if HEVC_USE_SIGN_HIDING msg( VERBOSE, " SignBitHidingFlag:%d ", m_signDataHidingEnabledFlag); -#endif msg( VERBOSE, "RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); if( m_profile == Profile::NEXT ) { msg( VERBOSE, "\nNEXT TOOL CFG: " ); -#if JVET_N0193_LFNST msg( VERBOSE, "LFNST:%d ", m_LFNST ); -#endif -#if JVET_N0127_MMVD_SPS_FLAG msg( VERBOSE, "MMVD:%d ", m_MMVD); -#endif msg( VERBOSE, "Affine:%d ", m_Affine ); if ( m_Affine ) { @@ -3860,9 +3310,7 @@ void EncAppCfg::xPrintParameter() #if INCLUDE_ISP_CFG_FLAG msg( VERBOSE, "ISP:%d ", m_ISP ); #endif -#if JVET_N0235_SMVD_SPS msg( VERBOSE, "SMVD:%d ", m_SMVD ); -#endif msg( VERBOSE, "CompositeLTReference:%d ", m_compositeRefEnabled); msg( VERBOSE, "GBi:%d ", m_GBi ); msg( VERBOSE, "GBiFast:%d ", m_GBiFast ); @@ -3871,23 +3319,15 @@ void EncAppCfg::xPrintParameter() #endif msg(VERBOSE, "MHIntra:%d ", m_MHIntra); msg( VERBOSE, "Triangle:%d ", m_Triangle ); -#if JVET_N0127_MMVD_SPS_FLAG m_allowDisFracMMVD = m_MMVD ? m_allowDisFracMMVD : false; if ( m_MMVD ) msg(VERBOSE, "AllowDisFracMMVD:%d ", m_allowDisFracMMVD); -#else - msg( VERBOSE, "AllowDisFracMMVD:%d ", m_allowDisFracMMVD ); -#endif msg( VERBOSE, "AffineAmvr:%d ", m_AffineAmvr ); m_AffineAmvrEncOpt = m_AffineAmvr ? m_AffineAmvrEncOpt : false; msg( VERBOSE, "AffineAmvrEncOpt:%d ", m_AffineAmvrEncOpt ); msg(VERBOSE, "DMVR:%d ", m_DMVR); -#if JVET_N0449_MMVD_SIMP msg(VERBOSE, "MmvdDisNum:%d ", m_MmvdDisNum); -#endif -#if JVET_N0413_RDPCM msg(VERBOSE, "RDPCM:%d ", m_RdpcmMode ); -#endif } msg(VERBOSE, "IBC:%d ", m_IBCMode); msg( VERBOSE, "HashME:%d ", m_HashME ); @@ -3897,7 +3337,6 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "WrapAroundOffset:%d ", m_wrapAroundOffset ); } // ADD_NEW_TOOL (add some output indicating the usage of tools) -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND msg(VERBOSE, "LoopFilterAcrossVirtualBoundaries:%d ", m_loopFilterAcrossVirtualBoundariesDisabledFlag); if ( m_loopFilterAcrossVirtualBoundariesDisabledFlag ) { @@ -3913,16 +3352,13 @@ void EncAppCfg::xPrintParameter() } msg(VERBOSE, " ] "); } -#endif msg(VERBOSE, "Reshape:%d ", m_lumaReshapeEnable); if (m_lumaReshapeEnable) { msg(VERBOSE, "(Sigal:%s ", m_reshapeSignalType==0? "SDR" : "HDR-PQ"); msg(VERBOSE, ") "); } -#if JVET_N0217_MATRIX_INTRAPRED msg(VERBOSE, "MIP:%d ", m_MIP); -#endif msg(VERBOSE, "EncDbOpt:%d ", m_encDbOpt); msg( VERBOSE, "\nFAST TOOL CFG: " ); msg( VERBOSE, "LCTUFast:%d ", m_useFastLCTU ); @@ -3935,19 +3371,13 @@ void EncAppCfg::xPrintParameter() #else msg( VERBOSE, "ISPFast:%d ", m_useFastISP ); #endif -#if JVET_N0193_LFNST if( m_LFNST ) msg( VERBOSE, "FastLFNST:%d ", m_useFastLFNST ); -#endif msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT ); msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc ); msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt ); -#if JVET_N0242_NON_LINEAR_ALF msg( VERBOSE, "UseNonLinearALFLuma:%d ", m_useNonLinearAlfLuma ); msg( VERBOSE, "UseNonLinearALFChroma:%d ", m_useNonLinearAlfChroma ); -#endif -#if JVET_N0217_MATRIX_INTRAPRED if( m_MIP ) msg(VERBOSE, "FastMIP:%d ", m_useFastMIP); -#endif msg( VERBOSE, "NumSplitThreads:%d ", m_numSplitThreads ); if( m_numSplitThreads > 1 ) diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 1643fe0b876fd05d7acdb173470c25327f45488d..5c0b86f7e0da8b199e810dc7239cf216f0c266fa 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -122,9 +122,7 @@ protected: uint32_t m_maxChromaFormatConstraintIdc; bool m_bFrameConstraintFlag; bool m_bNoQtbttDualTreeIntraConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noPartitionConstraintsOverrideConstraintFlag; -#endif bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; bool m_bNoPcmConstraintFlag; @@ -133,31 +131,18 @@ protected: bool m_bNoSbtmvpConstraintFlag; bool m_bNoAmvrConstraintFlag; bool m_bNoBdofConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noDmvrConstraintFlag; -#endif bool m_bNoCclmConstraintFlag; bool m_bNoMtsConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noSbtConstraintFlag; -#endif bool m_bNoAffineMotionConstraintFlag; bool m_bNoGbiConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noIbcConstraintFlag; -#endif bool m_bNoMhIntraConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noFPelMmvdConstraintFlag; -#endif bool m_bNoTriangleConstraintFlag; bool m_bNoLadfConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noTransformSkipConstraintFlag; -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - bool m_bNoCurrPicRefConstraintFlag; -#endif bool m_bNoQpDeltaConstraintFlag; bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -166,9 +151,7 @@ protected: Profile::Name m_profile; Level::Tier m_levelTier; Level::Name m_level; -#if JVET_N0276_CONSTRAINT_FLAGS uint32_t m_subProfile; -#endif uint32_t m_bitDepthConstraint; ChromaFormat m_chromaFormatConstraint; bool m_intraConstraintFlag; @@ -183,23 +166,13 @@ protected: int m_iIntraPeriod; ///< period of I-slice (random access period) int m_iDecodingRefreshType; ///< random access type int m_iGOPSize; ///< GOP size of hierarchical structure -#if JCTVC_Y0038_PARAMS bool m_rewriteParamSets; ///< Flag to enable rewriting of parameter sets at random access points -#endif -#if JVET_M0128 RPLEntry m_RPLList0[MAX_GOP]; ///< the RPL entries from the config file RPLEntry m_RPLList1[MAX_GOP]; ///< the RPL entries from the config file -#else - int m_extraRPSs; ///< extra RPSs added to handle CRA -#endif -#if JVET_N0047_Merge_IDR_Non_IDR bool m_idrRefParamList; ///< indicates if reference picture list syntax elements are present in slice headers of IDR pictures -#endif GOPEntry m_GOPList[MAX_GOP]; ///< the coding structure entries from the config file -#if JVET_N0857_TILES_BRICKS BrickSplit m_brickSplits[MAX_TILES]; BrickSplitMap m_brickSplitMap; -#endif int m_numReorderPics[MAX_TLAYER]; ///< total number of reorder pictures int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of pictures in the decoded picture buffer bool m_crossComponentPredictionEnabledFlag; ///< flag enabling the use of cross-component prediction @@ -241,10 +214,8 @@ protected: int m_crQpOffset; ///< Chroma Cr QP Offset (0:default) int m_cbQpOffsetDualTree; ///< Chroma Cb QP Offset for dual tree (overwrite m_cbQpOffset for dual tree) int m_crQpOffsetDualTree; ///< Chroma Cr QP Offset for dual tree (overwrite m_crQpOffset for dual tree) -#if JVET_N0054_JOINT_CHROMA int m_cbCrQpOffset; ///< QP Offset for joint Cb-Cr mode int m_cbCrQpOffsetDualTree; ///< QP Offset for joint Cb-Cr mode (overwrite m_cbCrQpOffset for dual tree) -#endif #if ER_CHROMA_QP_WCG_PPS WCGChromaQPControl m_wcgChromaQpControl; ///< Wide-colour-gamut chroma QP control. #endif @@ -273,10 +244,8 @@ protected: unsigned m_uiMaxBTDepthI; unsigned m_uiMaxBTDepthIChroma; bool m_dualTree; -#if JVET_N0193_LFNST bool m_LFNST; bool m_useFastLFNST; -#endif int m_SubPuMvpMode; bool m_Affine; bool m_AffineType; @@ -289,9 +258,7 @@ protected: int m_MTSImplicit; bool m_SBT; ///< Sub-Block Transform for inter blocks -#if JVET_N0235_SMVD_SPS bool m_SMVD; -#endif bool m_compositeRefEnabled; bool m_GBi; bool m_GBiFast; @@ -309,15 +276,9 @@ protected: bool m_AffineAmvr; bool m_AffineAmvrEncOpt; bool m_DMVR; -#if JVET_N0127_MMVD_SPS_FLAG bool m_MMVD; -#endif -#if JVET_N0449_MMVD_SIMP int m_MmvdDisNum; -#endif -#if JVET_N0413_RDPCM bool m_RdpcmMode; -#endif unsigned m_IBCMode; unsigned m_IBCLocalSearchRangeX; unsigned m_IBCLocalSearchRangeY; @@ -330,13 +291,11 @@ protected: unsigned m_wrapAroundOffset; // ADD_NEW_TOOL : (encoder app) add tool enabling flags and associated parameters here -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool m_loopFilterAcrossVirtualBoundariesDisabledFlag; unsigned m_numVerVirtualBoundaries; unsigned m_numHorVirtualBoundaries; std::vector m_virtualBoundariesPosX; std::vector m_virtualBoundariesPosY; -#endif bool m_lumaReshapeEnable; uint32_t m_reshapeSignalType; uint32_t m_intraCMD; @@ -354,14 +313,10 @@ protected: bool m_useFastMrg; bool m_e0023FastEnc; bool m_contentBasedFastQtbt; -#if JVET_N0242_NON_LINEAR_ALF bool m_useNonLinearAlfLuma; bool m_useNonLinearAlfChroma; -#endif -#if JVET_N0217_MATRIX_INTRAPRED bool m_MIP; bool m_useFastMIP; -#endif int m_numSplitThreads; @@ -449,21 +404,14 @@ protected: std::vector m_tileRowHeight; bool m_entropyCodingSyncEnabledFlag; -#if JVET_N0857_TILES_BRICKS bool m_rectSliceFlag; int m_numSlicesInPicMinus1; -#if JVET_N0857_RECT_SLICES std::vector m_topLeftBrickIdx; std::vector m_bottomRightBrickIdx; -#else - std::vector m_topLeftTileIdx; - std::vector m_bottomRightTileIdx; -#endif bool m_loopFilterAcrossSlicesEnabledFlag; bool m_signalledSliceIdFlag; int m_signalledSliceIdLengthMinus1; std::vector m_sliceId; -#endif bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction bool m_bFastUDIUseMPMEnabled; @@ -551,15 +499,11 @@ 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_N0400_SIGNAL_TRIANGLE_CAND_NUM uint32_t m_maxNumTriangleCand; -#endif int m_TMVPModeId; bool m_depQuantEnabledFlag; -#if HEVC_USE_SIGN_HIDING bool m_signDataHidingEnabledFlag; -#endif bool m_RCEnableRateControl; ///< enable rate control or not int m_RCTargetBitrate; ///< target bitrate when rate control is enabled int m_RCKeepHierarchicalBit; ///< 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation @@ -572,25 +516,17 @@ protected: uint32_t m_RCCpbSize; ///< CPB size double m_RCInitialCpbFullness; ///< initial CPB fullness #endif -#if HEVC_USE_SCALING_LISTS ScalingListMode m_useScalingListId; ///< using quantization matrix std::string m_scalingListFileName; ///< quantization matrix file name -#endif bool m_TransquantBypassEnabledFlag; ///< transquant_bypass_enabled_flag setting in PPS. bool m_CUTransquantBypassFlagForce; ///< if transquant_bypass_enabled_flag, then, if true, all CU transquant bypass flags will be set to true. CostMode m_costMode; ///< Cost mode to use bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - bool m_useStrongIntraSmoothing; ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat -#endif int m_activeParameterSetsSEIEnabled; -#if JVET_N0349_DPS bool m_decodingParameterSetEnabled; ///< enable decoding parameter set -#endif -#if JVET_N0063_VUI bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present int m_aspectRatioIdc; ///< aspect_ratio_idc @@ -608,42 +544,6 @@ protected: bool m_overscanAppropriateFlag; ///< Indicates whether conformant decoded pictures are suitable for display using overscan bool m_videoSignalTypePresentFlag; ///< Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present bool m_videoFullRangeFlag; ///< Indicates the black level and range of luma and chroma signals -#else - bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters - bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present - int m_aspectRatioIdc; ///< aspect_ratio_idc - int m_sarWidth; ///< horizontal size of the sample aspect ratio - int m_sarHeight; ///< vertical size of the sample aspect ratio - bool m_overscanInfoPresentFlag; ///< Signals whether overscan_appropriate_flag is present - bool m_overscanAppropriateFlag; ///< Indicates whether conformant decoded pictures are suitable for display using overscan - bool m_videoSignalTypePresentFlag; ///< Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present - int m_videoFormat; ///< Indicates representation of pictures - bool m_videoFullRangeFlag; ///< Indicates the black level and range of luma and chroma signals - bool m_colourDescriptionPresentFlag; ///< Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present - int m_colourPrimaries; ///< Indicates chromaticity coordinates of the source primaries - int m_transferCharacteristics; ///< Indicates the opto-electronic transfer characteristics of the source - int m_matrixCoefficients; ///< Describes the matrix coefficients used in deriving luma and chroma from RGB primaries - bool m_chromaLocInfoPresentFlag; ///< Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present - int m_chromaSampleLocTypeTopField; ///< Specifies the location of chroma samples for top field - int m_chromaSampleLocTypeBottomField; ///< Specifies the location of chroma samples for bottom field - bool m_neutralChromaIndicationFlag; ///< Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1) - bool m_defaultDisplayWindowFlag; ///< Indicates the presence of the default window parameters - int m_defDispWinLeftOffset; ///< Specifies the left offset from the conformance window of the default window - int m_defDispWinRightOffset; ///< Specifies the right offset from the conformance window of the default window - int m_defDispWinTopOffset; ///< Specifies the top offset from the conformance window of the default window - int m_defDispWinBottomOffset; ///< Specifies the bottom offset from the conformance window of the default window - bool m_frameFieldInfoPresentFlag; ///< Indicates that pic_struct values are present in picture timing SEI messages - bool m_pocProportionalToTimingFlag; ///< Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS - int m_numTicksPocDiffOneMinus1; ///< Number of ticks minus 1 that for a POC difference of one - bool m_bitstreamRestrictionFlag; ///< Signals whether bitstream restriction parameters are present - bool m_tilesFixedStructureFlag; ///< Indicates that each active picture parameter set has the same values of the syntax elements related to tiles - bool m_motionVectorsOverPicBoundariesFlag; ///< Indicates that no samples outside the picture boundaries are used for inter prediction - int m_minSpatialSegmentationIdc; ///< Indicates the maximum size of the spatial segments in the pictures in the coded video sequence - int m_maxBytesPerPicDenom; ///< Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture - int m_maxBitsPerMinCuDenom; ///< Indicates an upper bound for the number of bits of coding_unit() data - int m_log2MaxMvLengthHorizontal; ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units - int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units -#endif int m_ImvMode; ///< imv mode int m_Imv4PelFast; ///< imv 4-Pel fast mode std::string m_colourRemapSEIFileRoot; diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp index da189dbece11b9a683628e4ae19881ec7573b67d..7e1a857b555f42f5ffde14f36ba701e86e25939e 100644 --- a/source/App/Parcat/parcat.cpp +++ b/source/App/Parcat/parcat.cpp @@ -59,9 +59,6 @@ bool ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parame SPS* sps = NULL; uint32_t firstSliceSegmentInPic; -#if !JVET_N0857_RECT_SLICES - READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); -#endif if( isRapPic ) { READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already @@ -74,21 +71,6 @@ bool ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parame //!KS: need to add error handling code here, if SPS is not available CHECK(sps==0, "Invalid SPS"); -#if !JVET_N0857_RECT_SLICES - int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); - uint32_t sliceSegmentAddress = 0; - int bitsSliceSegmentAddress = 0; - while(numCTUs>(1<getRectSliceFlag()) { @@ -128,7 +110,6 @@ bool ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parame { READ_UVLC(uiCode, "num_bricks_in_slice_minus1"); } -#endif //set uiCode to equal slice start address (or dependent slice start address) for (int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) { @@ -206,7 +187,6 @@ const bool verbose = false; const char * NALU_TYPE[] = { -#if JVET_N0067_NAL_Unit_Header "NAL_UNIT_PPS", "NAL_UNIT_ACCESS_UNIT_DELIMITER", "NAL_UNIT_PREFIX_SEI", @@ -239,104 +219,6 @@ const char * NALU_TYPE[] = "NAL_UNIT_UNSPECIFIED_29", "NAL_UNIT_UNSPECIFIED_30", "NAL_UNIT_UNSPECIFIED_31" -#else -#if !JVET_M0101_HLS - "TRAIL_N", - "TRAIL_R", - "TSA_N", - "TSA_R", - "STSA_N", - "STSA_R", - "RADL_N", - "RADL_R", - "RASL_N", - "RASL_R", - "RSV_VCL_N10", - "RSV_VCL_N12", - "RSV_VCL_N14", - "RSV_VCL_R11", - "RSV_VCL_R13", - "RSV_VCL_R15", - "BLA_W_LP", - "BLA_W_RADL", - "BLA_N_LP", - "IDR_W_RADL", - "IDR_N_LP", - "CRA_NUT", - "RSV_IRAP_VCL22", - "RSV_IRAP_VCL23", - "unk", - "unk", - "unk", - "unk", - "unk", - "unk", - "unk", - "unk", -#if HEVC_VPS - "VPS_NUT", -#elif JVET_N0278_HLS - "VPS_NUT", -#else - "unk", -#endif - "SPS_NUT", - "PPS_NUT", -#if JVET_M0132 - "APS_NUT", -#endif - "AUD_NUT", - "EOS_NUT", - "EOB_NUT", - "FD_NUT", - "PREFIX_SEI_NUT", - "SUFFIX_SEI_NUT", -#else - "NAL_UNIT_CODED_SLICE_TRAIL", - "NAL_UNIT_CODED_SLICE_STSA", - "NAL_UNIT_CODED_SLICE_RADL", - "NAL_UNIT_CODED_SLICE_RASL", - "NAL_UNIT_RESERVED_VCL_4", - "NAL_UNIT_RESERVED_VCL_5", - "NAL_UNIT_RESERVED_VCL_6", - "NAL_UNIT_RESERVED_VCL_7", - - "NAL_UNIT_CODED_SLICE_IDR_W_RADL", - "NAL_UNIT_CODED_SLICE_IDR_N_LP", - "NAL_UNIT_CODED_SLICE_CRA", - - "NAL_UNIT_RESERVED_IRAP_VCL11", - "NAL_UNIT_RESERVED_IRAP_VCL12", - "NAL_UNIT_RESERVED_IRAP_VCL13", - - "NAL_UNIT_RESERVED_VCL14", - -#if HEVC_VPS || JVET_N0278_HLS - "NAL_UNIT_VPS", -#else - "NAL_UNIT_RESERVED_VCL15", -#endif - - "NAL_UNIT_RESERVED_NVCL16", - - "NAL_UNIT_SPS", - "NAL_UNIT_PPS", - "NAL_UNIT_APS", - "NAL_UNIT_ACCESS_UNIT_DELIMITER", - "NAL_UNIT_EOS", - "NAL_UNIT_EOB", - "NAL_UNIT_PREFIX_SEI", - "NAL_UNIT_SUFFIX_SEI", - "NAL_UNIT_FILLER_DATA", - - "NAL_UNIT_RESERVED_NVCL26", - "NAL_UNIT_RESERVED_NVCL27", - "NAL_UNIT_UNSPECIFIED_28", - "NAL_UNIT_UNSPECIFIED_29", - "NAL_UNIT_UNSPECIFIED_30", - "NAL_UNIT_UNSPECIFIED_31" -#endif -#endif }; int calc_poc(int iPOClsb, int prevTid0POC, int getBitsForPOC, int nalu_type) @@ -358,15 +240,6 @@ int calc_poc(int iPOClsb, int prevTid0POC, int getBitsForPOC, int nalu_type) { iPOCmsb = iPrevPOCmsb; } -#if !JVET_M0101_HLS - if ( nalu_type == NAL_UNIT_CODED_SLICE_BLA_W_LP - || nalu_type == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || nalu_type == NAL_UNIT_CODED_SLICE_BLA_N_LP ) - { - // For BLA picture types, POCmsb is set to 0. - iPOCmsb = 0; - } -#endif return iPOCmsb + iPOClsb; } @@ -401,14 +274,10 @@ std::vector filter_segment(const std::vector & v, int idx, int p += nal_start; std::vector nalu(p, p + nal_end - nal_start); -#if JVET_N0067_NAL_Unit_Header int nalu_header = nalu[0]; bool zeroTidRequiredFlag = (nalu_header & ( 1 << 7 )) >> 7; int nalUnitTypeLsb = (((1 << 4) - 1) & nalu_header); int nalu_type = ((zeroTidRequiredFlag << 4) + nalUnitTypeLsb); -#else - int nalu_type = nalu[0] >> 1; -#endif int poc = -1; int poc_lsb = -1; int new_poc = -1; @@ -433,11 +302,7 @@ std::vector filter_segment(const std::vector & v, int idx, int { PPS* pps = new PPS(); HLSReader.setBitstream( &inp_nalu.getBitstream() ); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND HLSReader.parsePPS( pps, ¶meterSetManager ); -#else - HLSReader.parsePPS( pps ); -#endif parameterSetManager.storePPS( pps, inp_nalu.getBitstream().getFifo() ); } @@ -446,25 +311,12 @@ std::vector filter_segment(const std::vector & v, int idx, int poc = 0; new_poc = *poc_base + poc; } -#if JVET_N0067_NAL_Unit_Header if((nalu_type > 7 && nalu_type < 15) || nalu_type == NAL_UNIT_CODED_SLICE_CRA) -#else -#if !JVET_M0101_HLS - if(nalu_type < 32 && nalu_type != NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu_type != NAL_UNIT_CODED_SLICE_IDR_N_LP) -#else - if(nalu_type < 15 && nalu_type != NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu_type != NAL_UNIT_CODED_SLICE_IDR_N_LP) -#endif -#endif { parcatHLSReader.setBitstream( &inp_nalu.getBitstream() ); bool isRapPic = inp_nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || inp_nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP -#if !JVET_M0101_HLS - || inp_nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP - || inp_nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || inp_nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP -#endif || inp_nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA; // beginning of slice header parsing, taken from VLCReader @@ -506,25 +358,9 @@ std::vector filter_segment(const std::vector & v, int idx, int } #if HEVC_VPS -#if JVET_N0349_DPS if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP )) || ((idx>1 && !idr_found) && ( nalu_type == NAL_UNIT_DPS || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS)) #else - if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP )) || ((idx>1 && !idr_found) && ( nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS)) -#endif -#else -#if JVET_N0349_DPS -#if JVET_N0278_HLS if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_DPS || nalu_type == NAL_UNIT_VPS ||nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_APS)) -#else - if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_DPS ||nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_APS)) -#endif -#else -#if JVET_N0278_HLS - if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_APS)) -#else - if((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_APS)) -#endif -#endif #endif || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei)) { diff --git a/source/App/SEIRemovalApp/SEIRemovalApp.cpp b/source/App/SEIRemovalApp/SEIRemovalApp.cpp index a5bf76915a5356b22ffd95068d90c148cfb4f7b9..3fae3d53218b80ee6be0c8e23d1607e3b6d8136e 100644 --- a/source/App/SEIRemovalApp/SEIRemovalApp.cpp +++ b/source/App/SEIRemovalApp/SEIRemovalApp.cpp @@ -72,7 +72,6 @@ void read2(InputNALUnit& nalu) { InputBitstream& bs = nalu.getBitstream(); - #if JVET_N0067_NAL_Unit_Header bool zeroTidRequiredFlag = bs.read(1); // zero_tid_required_flag nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 CHECK(nalu.m_temporalId < 0, "Temporal ID is negative."); @@ -89,19 +88,6 @@ void read2(InputNALUnit& nalu) CHECK((nalu.m_nuhLayerId < 0) || (nalu.m_nuhLayerId > 126), "Layer ID out of range"); uint32_t nuh_reserved_zero_bit = bs.read(1); // nuh_reserved_zero_bit CHECK(nuh_reserved_zero_bit != 0, "Reserved zero bit is not '0'"); -#else - bool forbidden_zero_bit = bs.read(1); // forbidden_zero_bit - if(forbidden_zero_bit != 0) { THROW( "Forbidden zero-bit not '0'" );} -#if JVET_N0278_HLS - nalu.m_nalUnitType = (NalUnitType) bs.read(6); // nal_unit_type - nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 - nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id -#else - nalu.m_nalUnitType = (NalUnitType) bs.read(6); // nal_unit_type - nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id - nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 -#endif -#endif } uint32_t SEIRemovalApp::decode() diff --git a/source/App/StreamMergeApp/StreamMergeApp.cpp b/source/App/StreamMergeApp/StreamMergeApp.cpp index 557fa56b9c83dad01088c6598fe44ff2d0c9903e..546669f45f2251e40d032252bcd8b669563a8bf4 100644 --- a/source/App/StreamMergeApp/StreamMergeApp.cpp +++ b/source/App/StreamMergeApp/StreamMergeApp.cpp @@ -73,7 +73,6 @@ void read2(InputNALUnit& nalu) { InputBitstream& bs = nalu.getBitstream(); -#if JVET_N0067_NAL_Unit_Header bool zeroTidRequiredFlag = bs.read(1); // zero_tid_required_flag nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 CHECK(nalu.m_temporalId < 0, "Temporal ID is negative."); @@ -90,13 +89,6 @@ void read2(InputNALUnit& nalu) CHECK((nalu.m_nuhLayerId < 0) || (nalu.m_nuhLayerId > 126), "Layer ID out of range"); uint32_t nuh_reserved_zero_bit = bs.read(1); // nuh_reserved_zero_bit CHECK(nuh_reserved_zero_bit != 0, "Reserved zero bit is not '0'"); -#else - bool forbidden_zero_bit = bs.read(1); // forbidden_zero_bit - if (forbidden_zero_bit != 0) { THROW("Forbidden zero-bit not '0'"); } - nalu.m_nalUnitType = (NalUnitType)bs.read(6); // nal_unit_type - nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 - nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id -#endif } static void @@ -246,7 +238,6 @@ void StreamMergeApp::writeNewVPS(ostream& out, int nLayerId, int nTemporalId) OutputBitstream bsNALUHeader; static const uint8_t start_code_prefix[] = { 0,0,0,1 }; -#if JVET_N0067_NAL_Unit_Header bsNALUHeader.write(1, 1); // zero_tid_required_flag bsNALUHeader.write(nTemporalId + 1, 3); // nuh_temporal_id_plus1 uint32_t nalUnitTypeLsb = NAL_UNIT_VPS - (1 << 4); @@ -257,12 +248,6 @@ void StreamMergeApp::writeNewVPS(ostream& out, int nLayerId, int nTemporalId) bsNALUHeader.write(nLayerId, 7); // nuh_layer_id #endif bsNALUHeader.write(0, 1); // nuh_reserved_zero_bit -#else - bsNALUHeader.write(0, 1); // forbidden_zero_bit - bsNALUHeader.write(NAL_UNIT_VPS, 6); // nal_unit_type - bsNALUHeader.write(1, 3); // nuh_temporal_id_plus1 - bsNALUHeader.write(nLayerId, 6); // nuh_layer_id -#endif out.write(reinterpret_cast(start_code_prefix), 4); out.write(reinterpret_cast(bsNALUHeader.getByteStream()), bsNALUHeader.getByteStreamLength()); @@ -356,15 +341,11 @@ uint32_t StreamMergeApp::mergeStreams() //update the nul_layer_id uint8_t *p = (uint8_t*)nalu.getBitstream().getFifo().data(); -#if JVET_N0067_NAL_Unit_Header #if EMULATION_PREVENTION_FIX p[1] = ((layerId + 1) << 1) & 0xff; #else p[1] = (layerId << 1) & 0xff; #endif -#else - p[1] = (p[1] & 0xc0) | layerId; -#endif bitstreamFileOut.write((const char*)p, nalu.getBitstream().getFifo().size()); diff --git a/source/App/StreamMergeApp/StreamMergeAppCfg.cpp b/source/App/StreamMergeApp/StreamMergeAppCfg.cpp index 900dc4488dbc04ed858ba6bd186502d5af74f56d..feac8cb487557dad77349b662f5d5aa75a7db584 100644 --- a/source/App/StreamMergeApp/StreamMergeAppCfg.cpp +++ b/source/App/StreamMergeApp/StreamMergeAppCfg.cpp @@ -56,7 +56,6 @@ namespace po = df::program_options_lite; */ bool StreamMergeAppCfg::parseCfg(int argc, char* argv[]) { -#if 1 int i; m_numInputStreams = argc - 2; @@ -67,61 +66,6 @@ bool StreamMergeAppCfg::parseCfg(int argc, char* argv[]) } m_bitstreamFileNameOut = argv[i + 1]; -#else - bool do_help = false; - int warnUnknowParameter = 0; - po::Options opts; - opts.addOptions() - - ("help", do_help, false, "this help text") - ("BitstreamFileIn0,-a", m_bitstreamFileNameIn[0], string(""), "bitstream input file name") - ("BitstreamFileIn1,-b", m_bitstreamFileNameIn[1], string(""), "bitstream input file name") - ("BitstreamFileOut,o", m_bitstreamFileNameOut, string(""), "bitstream output file name") - ; - - po::setDefaults(opts); - po::ErrorReporter err; - const list& argv_unhandled = po::scanArgv(opts, argc, (const char**)argv, err); - - for (list::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) - { - std::cerr << "Unhandled argument ignored: " << *it << std::endl; - } - - if (argc == 1 || do_help) - { - po::doHelp(cout, opts); - return false; - } - - if (err.is_errored) - { - if (!warnUnknowParameter) - { - /* errors have already been reported to stderr */ - return false; - } - } - - m_numInputStreams = 0; - for (int i = 0; i < MAX_VPS_LAYERS; i++) - { - if (!m_bitstreamFileNameIn[i].empty()) - m_numInputStreams++; - } - - if (m_numInputStreams < 2) - { - std::cerr << "Need at least two input bitstreams, aborting" << std::endl; - return false; - } - - if (m_bitstreamFileNameOut.empty()) - { - std::cerr << "No output file specified, aborting" << std::endl; - return false; - } -#endif return true; } diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index b53b5b80f2074341f20e39e99c0a8aba48ad8114..9e6ffdb9de3bb589d9ac178e9412e966a35c4918 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -39,14 +39,10 @@ #include "CodingStructure.h" #include "Picture.h" -#if JVET_N0242_NON_LINEAR_ALF #include #include -#endif -#if JVET_N0242_NON_LINEAR_ALF constexpr int AdaptiveLoopFilter::AlfNumClippingValues[]; -#endif AdaptiveLoopFilter::AdaptiveLoopFilter() : m_classifier( nullptr ) @@ -72,7 +68,6 @@ AdaptiveLoopFilter::AdaptiveLoopFilter() #endif } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const int xPos, const int yPos, const int width, const int height, bool& clipTop, bool& clipBottom, bool& clipLeft, bool& clipRight, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps) { clipTop = false; clipBottom = false; clipLeft = false; clipRight = false; @@ -112,10 +107,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const int xPos, const int } return numHorVirBndry > 0 || numVerVirBndry > 0 || clipTop || clipBottom || clipLeft || clipRight; } -#endif -#if JVET_N0415_CTB_ALF -#if JVET_N0242_NON_LINEAR_ALF const int AdaptiveLoopFilter::m_fixedFilterSetCoeff[ALF_FIXED_FILTER_NUM][MAX_NUM_ALF_LUMA_COEFF] = { { 0, 0, 2, -3, 1, -4, 1, 7, -1, 1, -1, 5, 0 }, @@ -183,75 +175,6 @@ const int AdaptiveLoopFilter::m_fixedFilterSetCoeff[ALF_FIXED_FILTER_NUM][MAX_NU { 0, 1, 2, -8, 2, -6, 5, 15, 0, 2, -7, 9, 0 }, { 1, -1, 12, -15, -7, -2, 3, 6, 6, -1, 7, 30, 0 }, }; -#else -const int AdaptiveLoopFilter::m_fixedFilterSetCoeff[ALF_FIXED_FILTER_NUM][MAX_NUM_ALF_LUMA_COEFF] = -{ - { 0, 0, 2, -3, 1, -4, 1, 7, -1, 1, -1, 5, 112 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, -1, 2, 126 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 126 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 128 - (1 << (m_NUM_BITS - 1)) }, - { 2, 2, -7, -3, 0, -5, 13, 22, 12, -3, -3, 17, 34 - (1 << (m_NUM_BITS - 1)) }, - { -1, 0, 6, -8, 1, -5, 1, 23, 0, 2, -5, 10, 80 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, -1, -1, 0, -1, 2, 1, 0, 0, -1, 4, 122 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 3, -11, 1, 0, -1, 35, 5, 2, -9, 9, 60 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 8, -8, -2, -7, 4, 4, 2, 1, -1, 25, 76 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 1, -1, 0, -3, 1, 3, -1, 1, -1, 3, 122 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 3, -3, 0, -6, 5, -1, 2, 1, -4, 21, 92 - (1 << (m_NUM_BITS - 1)) }, - { -7, 1, 5, 4, -3, 5, 11, 13, 12, -8, 11, 12, 16 - (1 << (m_NUM_BITS - 1)) }, - { -5, -3, 6, -2, -3, 8, 14, 15, 2, -7, 11, 16, 24 - (1 << (m_NUM_BITS - 1)) }, - { 2, -1, -6, -5, -2, -2, 20, 14, -4, 0, -3, 25, 52 - (1 << (m_NUM_BITS - 1)) }, - { 3, 1, -8, -4, 0, -8, 22, 5, -3, 2, -10, 29, 70 - (1 << (m_NUM_BITS - 1)) }, - { 2, 1, -7, -1, 2, -11, 23, -5, 0, 2, -10, 29, 78 - (1 << (m_NUM_BITS - 1)) }, - { -6, -3, 8, 9, -4, 8, 9, 7, 14, -2, 8, 9, 14 - (1 << (m_NUM_BITS - 1)) }, - { 2, 1, -4, -7, 0, -8, 17, 22, 1, -1, -4, 23, 44 - (1 << (m_NUM_BITS - 1)) }, - { 3, 0, -5, -7, 0, -7, 15, 18, -5, 0, -5, 27, 60 - (1 << (m_NUM_BITS - 1)) }, - { 2, 0, 0, -7, 1, -10, 13, 13, -4, 2, -7, 24, 74 - (1 << (m_NUM_BITS - 1)) }, - { 3, 3, -13, 4, -2, -5, 9, 21, 25, -2, -3, 12, 24 - (1 << (m_NUM_BITS - 1)) }, - { -5, -2, 7, -3, -7, 9, 8, 9, 16, -2, 15, 12, 14 - (1 << (m_NUM_BITS - 1)) }, - { 0, -1, 0, -7, -5, 4, 11, 11, 8, -6, 12, 21, 32 - (1 << (m_NUM_BITS - 1)) }, - { 3, -2, -3, -8, -4, -1, 16, 15, -2, -3, 3, 26, 48 - (1 << (m_NUM_BITS - 1)) }, - { 2, 1, -5, -4, -1, -8, 16, 4, -2, 1, -7, 33, 68 - (1 << (m_NUM_BITS - 1)) }, - { 2, 1, -4, -2, 1, -10, 17, -2, 0, 2, -11, 33, 74 - (1 << (m_NUM_BITS - 1)) }, - { 1, -2, 7, -15, -16, 10, 8, 8, 20, 11, 14, 11, 14 - (1 << (m_NUM_BITS - 1)) }, - { 2, 2, 3, -13, -13, 4, 8, 12, 2, -3, 16, 24, 40 - (1 << (m_NUM_BITS - 1)) }, - { 1, 4, 0, -7, -8, -4, 9, 9, -2, -2, 8, 29, 54 - (1 << (m_NUM_BITS - 1)) }, - { 1, 1, 2, -4, -1, -6, 6, 3, -1, -1, -3, 30, 74 - (1 << (m_NUM_BITS - 1)) }, - { -7, 3, 2, 10, -2, 3, 7, 11, 19, -7, 8, 10, 14 - (1 << (m_NUM_BITS - 1)) }, - { 0, -2, -5, -3, -2, 4, 20, 15, -1, -3, -1, 22, 40 - (1 << (m_NUM_BITS - 1)) }, - { 3, -1, -8, -4, -1, -4, 22, 8, -4, 2, -8, 28, 62 - (1 << (m_NUM_BITS - 1)) }, - { 0, 3, -14, 3, 0, 1, 19, 17, 8, -3, -7, 20, 34 - (1 << (m_NUM_BITS - 1)) }, - { 0, 2, -1, -8, 3, -6, 5, 21, 1, 1, -9, 13, 84 - (1 << (m_NUM_BITS - 1)) }, - { -4, -2, 8, 20, -2, 2, 3, 5, 21, 4, 6, 1, 4 - (1 << (m_NUM_BITS - 1)) }, - { 2, -2, -3, -9, -4, 2, 14, 16, 3, -6, 8, 24, 38 - (1 << (m_NUM_BITS - 1)) }, - { 2, 1, 5, -16, -7, 2, 3, 11, 15, -3, 11, 22, 36 - (1 << (m_NUM_BITS - 1)) }, - { 1, 2, 3, -11, -2, -5, 4, 8, 9, -3, -2, 26, 68 - (1 << (m_NUM_BITS - 1)) }, - { 0, -1, 10, -9, -1, -8, 2, 3, 4, 0, 0, 29, 70 - (1 << (m_NUM_BITS - 1)) }, - { 1, 2, 0, -5, 1, -9, 9, 3, 0, 1, -7, 20, 96 - (1 << (m_NUM_BITS - 1)) }, - { -2, 8, -6, -4, 3, -9, -8, 45, 14, 2, -13, 7, 54 - (1 << (m_NUM_BITS - 1)) }, - { 1, -1, 16, -19, -8, -4, -3, 2, 19, 0, 4, 30, 54 - (1 << (m_NUM_BITS - 1)) }, - { 1, 1, -3, 0, 2, -11, 15, -5, 1, 2, -9, 24, 92 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, -2, 0, 1, -4, 4, 0, 0, 1, -4, 7, 120 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, 2, -5, 1, -6, 4, 10, -2, 1, -4, 10, 104 - (1 << (m_NUM_BITS - 1)) }, - { 3, 0, -3, -6, -2, -6, 14, 8, -1, -1, -3, 31, 60 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, 0, -2, 1, -6, 5, 1, 0, 1, -5, 13, 110 - (1 << (m_NUM_BITS - 1)) }, - { 3, 1, 9, -19, -21, 9, 7, 6, 13, 5, 15, 21, 30 - (1 << (m_NUM_BITS - 1)) }, - { 2, 4, 3, -12, -13, 1, 7, 8, 3, 0, 12, 26, 46 - (1 << (m_NUM_BITS - 1)) }, - { 3, 1, -8, -2, 0, -6, 18, 2, -2, 3, -10, 23, 84 - (1 << (m_NUM_BITS - 1)) }, - { 1, 1, -4, -1, 1, -5, 8, 1, -1, 2, -5, 10, 112 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, -1, 0, 0, -2, 2, 0, 0, 1, -2, 3, 124 - (1 << (m_NUM_BITS - 1)) }, - { 1, 1, -2, -7, 1, -7, 14, 18, 0, 0, -7, 21, 62 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, 0, -2, 0, -7, 8, 1, -2, 0, -3, 24, 88 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, 1, -2, 2, -10, 10, 0, -2, 1, -7, 23, 94 - (1 << (m_NUM_BITS - 1)) }, - { 0, 2, 2, -11, 2, -4, -3, 39, 7, 1, -10, 9, 60 - (1 << (m_NUM_BITS - 1)) }, - { 1, 0, 13, -16, -5, -6, -1, 8, 6, 0, 6, 29, 58 - (1 << (m_NUM_BITS - 1)) }, - { 1, 3, 1, -6, -4, -7, 9, 6, -3, -2, 3, 33, 60 - (1 << (m_NUM_BITS - 1)) }, - { 4, 0, -17, -1, -1, 5, 26, 8, -2, 3, -15, 30, 48 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, -2, 0, 2, -8, 12, -6, 1, 1, -6, 16, 106 - (1 << (m_NUM_BITS - 1)) }, - { 0, 0, 0, -1, 1, -4, 4, 0, 0, 0, -3, 11, 112 - (1 << (m_NUM_BITS - 1)) }, - { 0, 1, 2, -8, 2, -6, 5, 15, 0, 2, -7, 9, 98 - (1 << (m_NUM_BITS - 1)) }, - { 1, -1, 12, -15, -7, -2, 3, 6, 6, -1, 7, 30, 50 - (1 << (m_NUM_BITS - 1)) }, -}; -#endif const int AdaptiveLoopFilter::m_classToFilterMapping[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES] = { { 8, 2, 2, 2, 3, 4, 53, 9, 9, 52, 4, 4, 5, 9, 2, 8, 10, 9, 1, 3, 39, 39, 10, 9, 52 }, @@ -271,27 +194,14 @@ const int AdaptiveLoopFilter::m_classToFilterMapping[NUM_FIXED_FILTER_SETS][MAX_ { 33, 34, 51, 51, 52, 41, 41, 34, 62, 0, 41, 41, 56, 7, 5, 56, 38, 38, 40, 44, 37, 42, 57, 39, 10 }, { 16, 31, 32, 15, 60, 30, 4, 17, 19, 25, 22, 20, 4, 53, 19, 21, 22, 46, 25, 55, 26, 48, 63, 58, 55 }, }; -#endif -#if JVET_N0415_CTB_ALF void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) -#else -void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSliceParam ) -#endif { -#if JVET_N0415_CTB_ALF if (!cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Y) && !cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) && !cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Cr)) -#else - if( !alfSliceParam.enabledFlag[COMPONENT_Y] && !alfSliceParam.enabledFlag[COMPONENT_Cb] && !alfSliceParam.enabledFlag[COMPONENT_Cr] ) -#endif { return; } -#if !JVET_N0415_CTB_ALF - // set available filter shapes - alfSliceParam.filterShapes = m_filterShapes; -#endif // set clipping range m_clpRngs = cs.slice->getClpRngs(); @@ -301,16 +211,8 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic { m_ctuEnableFlag[compIdx] = cs.picture->getAlfCtuEnableFlag( compIdx ); } -#if JVET_N0415_CTB_ALF reconstructCoeffAPSs(cs, true, cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) || cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Cr), false); short* alfCtuFilterIndex = cs.slice->getPic()->getAlfCtbFilterIndex(); -#else - reconstructCoeff( alfSliceParam, CHANNEL_TYPE_LUMA ); -#if JVET_N0242_NON_LINEAR_ALF - if( alfSliceParam.enabledFlag[COMPONENT_Cb] || alfSliceParam.enabledFlag[COMPONENT_Cr] ) -#endif - reconstructCoeff( alfSliceParam, CHANNEL_TYPE_CHROMA ); -#endif PelUnitBuf recYuv = cs.getRecoBuf(); m_tempBuf.copyFrom( recYuv ); @@ -320,19 +222,16 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic const PreCalcValues& pcv = *cs.pcv; int ctuIdx = 0; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool clipTop = false, clipBottom = false, clipLeft = false, clipRight = false; int numHorVirBndry = 0, numVerVirBndry = 0; int horVirBndryPos[] = { 0, 0, 0 }; int verVirBndryPos[] = { 0, 0, 0 }; -#endif for( int yPos = 0; yPos < pcv.lumaHeight; yPos += pcv.maxCUHeight ) { for( int xPos = 0; xPos < pcv.lumaWidth; xPos += pcv.maxCUWidth ) { const int width = ( xPos + pcv.maxCUWidth > pcv.lumaWidth ) ? ( pcv.lumaWidth - xPos ) : pcv.maxCUWidth; const int height = ( yPos + pcv.maxCUHeight > pcv.lumaHeight ) ? ( pcv.lumaHeight - yPos ) : pcv.maxCUHeight; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool ctuEnableFlag = m_ctuEnableFlag[COMPONENT_Y][ctuIdx]; for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { @@ -370,66 +269,23 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic deriveClassification( m_classifier, buf.get(COMPONENT_Y), blkDst, blkSrc ); const Area blkPCM( xStart, yStart, w, h ); resetPCMBlkClassInfo( cs, m_classifier, buf.get(COMPONENT_Y), blkPCM ); -#if JVET_N0415_CTB_ALF short filterSetIndex = alfCtuFilterIndex[ctuIdx]; short *coeff; -#if JVET_N0242_NON_LINEAR_ALF short *clip; -#endif if (filterSetIndex >= NUM_FIXED_FILTER_SETS) { coeff = m_coeffApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS]; -#if JVET_N0242_NON_LINEAR_ALF clip = m_clippApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS]; -#endif } else { coeff = m_fixedFilterSetCoeffDec[filterSetIndex]; -#if JVET_N0242_NON_LINEAR_ALF clip = m_clipDefault; -#endif } -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs , m_alfVBLumaCTUHeight , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) ); -#else - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs); -#else - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, m_clpRngs.comp[COMPONENT_Y], cs); -#endif -#endif -#else -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, m_coeffFinal, m_clippFinal, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#else - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, m_coeffFinal, m_clippFinal, m_clpRngs.comp[COMPONENT_Y], cs); -#else - m_filter7x7Blk(m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs); -#endif -#endif -#endif } for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ ) @@ -442,47 +298,9 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic { const Area blkSrc( 0, 0, w >> chromaScaleX, h >> chromaScaleY ); const Area blkDst( xStart >> chromaScaleX, yStart >> chromaScaleY, w >> chromaScaleX, h >> chromaScaleY ); -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0415_CTB_ALF m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs , m_alfVBChmaCTUHeight , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos)); -#else - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, alfSliceParam.chromaCoeff, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#endif -#else -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#else - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#endif -#endif -#else - -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs); -#else - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, alfSliceParam.chromaCoeff, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs); -#endif -#else -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal, m_clpRngs.comp[compIdx], cs); -#else - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs); -#endif -#endif -#endif } } @@ -494,122 +312,30 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic } else { -#endif const UnitArea area( cs.area.chromaFormat, Area( xPos, yPos, width, height ) ); if( m_ctuEnableFlag[COMPONENT_Y][ctuIdx] ) { Area blk( xPos, yPos, width, height ); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk, blk ); -#else - deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk ); -#endif Area blkPCM(xPos, yPos, width, height); resetPCMBlkClassInfo(cs, m_classifier, tmpYuv.get(COMPONENT_Y), blkPCM); -#if JVET_N0415_CTB_ALF short filterSetIndex = alfCtuFilterIndex[ctuIdx]; short *coeff; -#if JVET_N0242_NON_LINEAR_ALF short *clip; -#endif if (filterSetIndex >= NUM_FIXED_FILTER_SETS) { coeff = m_coeffApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS]; -#if JVET_N0242_NON_LINEAR_ALF clip = m_clippApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS]; -#endif } else { coeff = m_fixedFilterSetCoeffDec[filterSetIndex]; -#if JVET_N0242_NON_LINEAR_ALF clip = m_clipDefault; -#endif } -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs , m_alfVBLumaCTUHeight , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) ); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, coeff, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, m_clpRngs.comp[COMPONENT_Y], cs); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, coeff, m_clpRngs.comp[COMPONENT_Y], cs); -#endif -#endif -#endif -#else -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, m_coeffFinal, m_clippFinal, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clippFinal, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight+4 : m_alfVBLumaPos) - ); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBLumaPos) - ); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs - , m_alfVBLumaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight+4 : m_alfVBLumaPos) - ); -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, m_coeffFinal, m_clippFinal, m_clpRngs.comp[COMPONENT_Y], cs); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clippFinal, m_clpRngs.comp[COMPONENT_Y], cs); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs); -#else - m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y], cs); -#endif -#endif -#endif -#endif } for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ ) @@ -621,108 +347,21 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic if( m_ctuEnableFlag[compIdx][ctuIdx] ) { Area blk( xPos >> chromaScaleX, yPos >> chromaScaleY, width >> chromaScaleX, height >> chromaScaleY ); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0415_CTB_ALF m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs , m_alfVBChmaCTUHeight , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos)); -#else - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, alfSliceParam.chromaCoeff, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#endif -#else -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#else - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs); -#else - m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, blk, compID, alfSliceParam.chromaCoeff, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs); -#endif -#else -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal, m_clpRngs.comp[compIdx], cs); -#else - m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs); -#endif -#endif -#endif -#else -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos)); -#else - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#endif -#else -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, compID, m_chromaCoeffFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#else - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) - ); -#endif -#endif -#else - -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs); -#else - m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs ); -#endif -#else -#if JVET_N0415_CTB_ALF - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, compID, m_chromaCoeffFinal, m_clpRngs.comp[compIdx], cs); -#else - m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, compID, alfSliceParam.chromaCoeff, m_clpRngs.comp[compIdx], cs ); -#endif -#endif -#endif -#endif } } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND } -#endif ctuIdx++; } } } -#if JVET_N0415_CTB_ALF void AdaptiveLoopFilter::reconstructCoeffAPSs(CodingStructure& cs, bool luma, bool chroma, bool isRdo) { //luma -#if JVET_N0805_APS_LMCS APS** aps = cs.slice->getAlfAPSs(); -#else - APS** aps = cs.slice->getAPSs(); -#endif AlfSliceParam alfSliceParamTmp; APS* curAPS; if (luma) @@ -735,9 +374,7 @@ void AdaptiveLoopFilter::reconstructCoeffAPSs(CodingStructure& cs, bool luma, bo alfSliceParamTmp = curAPS->getAlfAPSParam(); reconstructCoeff(alfSliceParamTmp, CHANNEL_TYPE_LUMA, isRdo, true); memcpy(m_coeffApsLuma[i], m_coeffFinal, sizeof(m_coeffFinal)); -#if JVET_N0242_NON_LINEAR_ALF memcpy(m_clippApsLuma[i], m_clippFinal, sizeof(m_clippFinal)); -#endif } } @@ -750,28 +387,17 @@ void AdaptiveLoopFilter::reconstructCoeffAPSs(CodingStructure& cs, bool luma, bo reconstructCoeff(alfSliceParamTmp, CHANNEL_TYPE_CHROMA, isRdo, true); } } -#endif -#if JVET_N0415_CTB_ALF void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, ChannelType channel, const bool isRdo, const bool isRedo ) -#else -void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, ChannelType channel, const bool isRedo ) -#endif { -#if JVET_N0415_CTB_ALF int factor = isRdo ? 0 : (1 << (m_NUM_BITS - 1)); -#else - int factor = ( 1 << ( m_NUM_BITS - 1 ) ); -#endif AlfFilterType filterType = isLuma( channel ) ? ALF_FILTER_7 : ALF_FILTER_5; int numClasses = isLuma( channel ) ? MAX_NUM_ALF_CLASSES : 1; int numCoeff = filterType == ALF_FILTER_5 ? 7 : 13; int numCoeffMinus1 = numCoeff - 1; int numFilters = isLuma( channel ) ? alfSliceParam.numLumaFilters : 1; short* coeff = isLuma( channel ) ? alfSliceParam.lumaCoeff : alfSliceParam.chromaCoeff; -#if JVET_N0242_NON_LINEAR_ALF short* clipp = isLuma( channel ) ? alfSliceParam.lumaClipp : alfSliceParam.chromaClipp; -#endif if( alfSliceParam.alfLumaCoeffDeltaPredictionFlag && isLuma( channel ) ) { @@ -786,45 +412,19 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, Channel for( int filterIdx = 0; filterIdx < numFilters; filterIdx++ ) { -#if JVET_N0242_NON_LINEAR_ALF coeff[filterIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor; -#else - int sum = 0; - for( int i = 0; i < numCoeffMinus1; i++ ) - { - sum += ( coeff[filterIdx* MAX_NUM_ALF_LUMA_COEFF + i] << 1 ); - } - coeff[filterIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor - sum; -#endif } if( isChroma( channel ) ) { -#if JVET_N0242_NON_LINEAR_ALF for( int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx ) { -#if JVET_N0415_CTB_ALF m_chromaCoeffFinal[coeffIdx] = alfSliceParam.chromaCoeff[coeffIdx]; int clipIdx = alfSliceParam.nonLinearFlag[channel] ? clipp[coeffIdx] : 0; m_chromaClippFinal[coeffIdx] = isRdo ? clipIdx : m_alfClippingValues[channel][clipIdx]; -#else - m_chromaClippFinal[coeffIdx] = alfSliceParam.nonLinearFlag[channel] ? m_alfClippingValues[channel][clipp[coeffIdx]] : m_alfClippingValues[channel][0]; -#endif } -#elif JVET_N0415_CTB_ALF - int sum = 0; - for (int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx) - { - m_chromaCoeffFinal[coeffIdx] = alfSliceParam.chromaCoeff[coeffIdx]; - sum += (m_chromaCoeffFinal[coeffIdx] << 1); - } -#endif -#if JVET_N0415_CTB_ALF && JVET_N0242_NON_LINEAR_ALF m_chromaCoeffFinal[numCoeffMinus1] = factor; m_chromaClippFinal[numCoeffMinus1] = isRdo ? 0 : m_alfClippingValues[channel][0]; -#elif JVET_N0415_CTB_ALF - m_chromaCoeffFinal[numCoeffMinus1] = factor - sum; -#endif return; } @@ -832,10 +432,6 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, Channel for( int classIdx = 0; classIdx < numClasses; classIdx++ ) { int filterIdx = alfSliceParam.filterCoeffDeltaIdx[classIdx]; -#if JVET_N0415_CTB_ALF -#if !JVET_N0242_NON_LINEAR_ALF - int sum = 0; -#endif int fixedFilterIdx = alfSliceParam.fixedFilterSetIndex; if (fixedFilterIdx > 0 && alfSliceParam.fixedFilterIdx[classIdx] > 0) { @@ -853,32 +449,14 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, Channel { m_coeffFinal[classIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] += m_fixedFilterSetCoeff[fixedFilterIdx][coeffIdx]; } -#if !JVET_N0242_NON_LINEAR_ALF - sum += (m_coeffFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + coeffIdx] << 1); -#endif } -#if JVET_N0242_NON_LINEAR_ALF m_coeffFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor; -#else - m_coeffFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor - sum; -#endif -#if JVET_N0242_NON_LINEAR_ALF m_clippFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = isRdo ? 0 : m_alfClippingValues[channel][0]; -#endif -#else - memcpy( m_coeffFinal + classIdx * MAX_NUM_ALF_LUMA_COEFF, coeff + filterIdx * MAX_NUM_ALF_LUMA_COEFF, sizeof( short ) * numCoeff ); -#endif -#if JVET_N0242_NON_LINEAR_ALF for( int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx ) { -#if JVET_N0415_CTB_ALF int clipIdx = alfSliceParam.nonLinearFlag[channel] ? (clipp + filterIdx * MAX_NUM_ALF_LUMA_COEFF)[coeffIdx] : 0; (m_clippFinal + classIdx * MAX_NUM_ALF_LUMA_COEFF)[coeffIdx] = isRdo ? clipIdx : m_alfClippingValues[channel][clipIdx]; -#else - (m_clippFinal + classIdx * MAX_NUM_ALF_LUMA_COEFF)[coeffIdx] = alfSliceParam.nonLinearFlag[channel] ? m_alfClippingValues[channel][(clipp + filterIdx * MAX_NUM_ALF_LUMA_COEFF)[coeffIdx]] : m_alfClippingValues[channel][0]; -#endif } -#endif } if(isRedo && alfSliceParam.alfLumaCoeffDeltaPredictionFlag ) @@ -908,15 +486,12 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const m_numCTUsInPic = m_numCTUsInHeight * m_numCTUsInWidth; m_filterShapes[CHANNEL_TYPE_LUMA].push_back( AlfFilterShape( 7 ) ); m_filterShapes[CHANNEL_TYPE_CHROMA].push_back( AlfFilterShape( 5 ) ); -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION m_alfVBLumaPos = m_maxCUHeight - ALF_VB_POS_ABOVE_CTUROW_LUMA; m_alfVBChmaPos = (m_maxCUHeight >> ((m_chromaFormat == CHROMA_420) ? 1 : 0)) - ALF_VB_POS_ABOVE_CTUROW_CHMA; m_alfVBLumaCTUHeight = m_maxCUHeight; m_alfVBChmaCTUHeight = (m_maxCUHeight >> ((m_chromaFormat == CHROMA_420) ? 1 : 0)); -#endif -#if JVET_N0242_NON_LINEAR_ALF static_assert( AlfNumClippingValues[CHANNEL_TYPE_LUMA] > 0, "AlfNumClippingValues[CHANNEL_TYPE_LUMA] must be at least one" ); for( int i = 0; i < AlfNumClippingValues[CHANNEL_TYPE_LUMA]; ++i ) { @@ -939,21 +514,16 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const + 8. * ( AlfNumClippingValues[CHANNEL_TYPE_CHROMA] - i - 1 ) / ( AlfNumClippingValues[CHANNEL_TYPE_CHROMA] - 1 ) ) ); } -#endif -#if JVET_N0415_CTB_ALF if (m_created) { return; } -#endif m_tempBuf.destroy(); m_tempBuf.create( format, Area( 0, 0, picWidth, picHeight ), maxCUWidth, MAX_ALF_FILTER_LENGTH >> 1, 0, false ); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND m_tempBuf2.destroy(); m_tempBuf2.create( format, Area( 0, 0, maxCUWidth + (MAX_ALF_PADDING_SIZE << 1), maxCUHeight + (MAX_ALF_PADDING_SIZE << 1) ), maxCUWidth, MAX_ALF_PADDING_SIZE, 0, false ); -#endif // Laplacian based activity for( int i = 0; i < NUM_DIRECTIONS; i++ ) @@ -979,47 +549,31 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const } } -#if JVET_N0415_CTB_ALF for (int filterSetIndex = 0; filterSetIndex < NUM_FIXED_FILTER_SETS; filterSetIndex++) { for (int classIdx = 0; classIdx < MAX_NUM_ALF_CLASSES; classIdx++) { int fixedFilterIdx = m_classToFilterMapping[filterSetIndex][classIdx]; -#if !JVET_N0242_NON_LINEAR_ALF - int sum = 0; -#endif for (int i = 0; i < MAX_NUM_ALF_LUMA_COEFF - 1; i++) { -#if !JVET_N0242_NON_LINEAR_ALF - sum += (m_fixedFilterSetCoeff[fixedFilterIdx][i]<<1); -#endif m_fixedFilterSetCoeffDec[filterSetIndex][classIdx * MAX_NUM_ALF_LUMA_COEFF + i] = m_fixedFilterSetCoeff[fixedFilterIdx][i]; } -#if JVET_N0242_NON_LINEAR_ALF m_fixedFilterSetCoeffDec[filterSetIndex][classIdx * MAX_NUM_ALF_LUMA_COEFF + MAX_NUM_ALF_LUMA_COEFF - 1] = (1 << (m_NUM_BITS - 1)); -#else - m_fixedFilterSetCoeffDec[filterSetIndex][classIdx * MAX_NUM_ALF_LUMA_COEFF + MAX_NUM_ALF_LUMA_COEFF - 1] = (1 << (m_NUM_BITS - 1)) - sum; -#endif } } -#if JVET_N0242_NON_LINEAR_ALF for (int i = 0; i < MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES; i++) { m_clipDefault[i] = m_alfClippingValues[CHANNEL_TYPE_LUMA][0]; } -#endif m_created = true; -#endif } void AdaptiveLoopFilter::destroy() { -#if JVET_N0415_CTB_ALF if (!m_created) { return; } -#endif for( int i = 0; i < NUM_DIRECTIONS; i++ ) { if( m_laplacian[i] ) @@ -1048,20 +602,12 @@ void AdaptiveLoopFilter::destroy() } m_tempBuf.destroy(); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND m_tempBuf2.destroy(); -#endif -#if JVET_N0415_CTB_ALF m_created = false; -#endif } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk ) -#else -void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk ) -#endif { int height = blk.pos().y + blk.height; int width = blk.pos().x + blk.width; @@ -1073,25 +619,10 @@ void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const for( int j = blk.pos().x; j < width; j += m_CLASSIFICATION_BLK_SIZE ) { int nWidth = std::min( j + m_CLASSIFICATION_BLK_SIZE, width ) - j; -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND m_deriveClassificationBlk(classifier, m_laplacian, srcLuma, Area( j - blk.pos().x + blkDst.pos().x, i - blk.pos().y + blkDst.pos().y, nWidth, nHeight ), Area(j, i, nWidth, nHeight), m_inputBitDepth[CHANNEL_TYPE_LUMA] + 4 , m_alfVBLumaCTUHeight , ((i - blk.pos().y + blkDst.pos().y + nHeight >= m_picHeight) ? m_picHeight : m_alfVBLumaPos) ); -#else - m_deriveClassificationBlk(classifier, m_laplacian, srcLuma, Area(j, i, nWidth, nHeight), m_inputBitDepth[CHANNEL_TYPE_LUMA] + 4 - , m_alfVBLumaCTUHeight - , ((i + nHeight >= m_picHeight) ? m_picHeight+4 : m_alfVBLumaPos) - ); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - m_deriveClassificationBlk(classifier, m_laplacian, srcLuma, Area(j - blk.pos().x + blkDst.pos().x, i - blk.pos().y + blkDst.pos().y, nWidth, nHeight), Area(j, i, nWidth, nHeight), m_inputBitDepth[CHANNEL_TYPE_LUMA] + 4); -#else - m_deriveClassificationBlk(classifier, m_laplacian, srcLuma, Area(j, i, nWidth, nHeight), m_inputBitDepth[CHANNEL_TYPE_LUMA] + 4); -#endif -#endif } } } @@ -1145,19 +676,7 @@ void AdaptiveLoopFilter::resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifi } } -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift, int vbCTUHeight, int vbPos) -#else -void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift, int vbCTUHeight, int vbPos) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift) -#else -void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift) -#endif -#endif { static const int th[16] = { 0, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4 }; const int stride = srcLuma.stride; @@ -1184,24 +703,14 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int const Pel *src1 = &src[yoffset]; const Pel *src2 = &src[yoffset + stride]; const Pel *src3 = &src[yoffset + stride * 2]; -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (((blkDst.pos().y - 2 + i) > 0) && ((blkDst.pos().y - 2 + i) % vbCTUHeight) == (vbPos - 2)) -#else - if (((posY - 2 + i) > 0) && ((posY - 2 + i) % vbCTUHeight) == (vbPos - 2)) -#endif { src3 = &src[yoffset + stride]; } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND else if (((blkDst.pos().y - 2 + i) > 0) && ((blkDst.pos().y - 2 + i) % vbCTUHeight) == vbPos) -#else - else if (((posY - 2 + i) > 0) && ((posY - 2 + i) % vbCTUHeight) == vbPos) -#endif { src0 = &src[yoffset]; } -#endif int* pYver = laplacian[VER][i]; int* pYhor = laplacian[HOR][i]; int* pYdig0 = laplacian[DIAG0][i]; @@ -1265,24 +774,15 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int for( int j = 0; j < blk.width; j += clsSizeX ) { -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION int sumV = 0; int sumH = 0; int sumD0 = 0; int sumD1 = 0; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (((i + blkDst.pos().y) % vbCTUHeight) == (vbPos - 4)) -#else - if (((i + posY) % vbCTUHeight) == (vbPos - 4)) -#endif { sumV = pYver[j] + pYver2[j] + pYver4[j]; sumH = pYhor[j] + pYhor2[j] + pYhor4[j]; sumD0 = pYdig0[j] + pYdig02[j] + pYdig04[j]; sumD1 = pYdig1[j] + pYdig12[j] + pYdig14[j]; } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND else if (((i + blkDst.pos().y) % vbCTUHeight) == vbPos) -#else - else if (((i + posY) % vbCTUHeight) == vbPos) -#endif { sumV = pYver2[j] + pYver4[j] + pYver6[j]; sumH = pYhor2[j] + pYhor4[j] + pYhor6[j]; @@ -1296,21 +796,10 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int sumD0 = pYdig0[j] + pYdig02[j] + pYdig04[j] + pYdig06[j]; sumD1 = pYdig1[j] + pYdig12[j] + pYdig14[j] + pYdig16[j]; } -#else - int sumV = pYver[j] + pYver2[j] + pYver4[j] + pYver6[j]; - int sumH = pYhor[j] + pYhor2[j] + pYhor4[j] + pYhor6[j]; - int sumD0 = pYdig0[j] + pYdig02[j] + pYdig04[j] + pYdig06[j]; - int sumD1 = pYdig1[j] + pYdig12[j] + pYdig14[j] + pYdig16[j]; -#endif int tempAct = sumV + sumH; -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION int activity = 0; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if ((((i + blkDst.pos().y) % vbCTUHeight) == (vbPos - 4)) || (((i + blkDst.pos().y) % vbCTUHeight) == vbPos)) -#else - if ((((i + posY) % vbCTUHeight) == (vbPos - 4)) || (((i + posY) % vbCTUHeight) == vbPos)) -#endif { activity = (Pel)Clip3(0, maxActivity, (tempAct * 96) >> shift); } @@ -1318,9 +807,6 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int { activity = (Pel)Clip3(0, maxActivity, (tempAct * 64) >> shift); } -#else - int activity = (Pel)Clip3(0, maxActivity, (tempAct * 64) >> shift); -#endif int classIdx = th[activity]; int hv1, hv0, d1, d0, hvd1, hvd0; @@ -1382,13 +868,8 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int static const int transposeTable[8] = { 0, 1, 0, 2, 2, 3, 1, 3 }; int transposeIdx = transposeTable[mainDirection * 2 + ( secondaryDirection >> 1 )]; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND int yOffset = i + blkDst.pos().y; int xOffset = j + blkDst.pos().x; -#else - int yOffset = i + posY; - int xOffset = j + posX; -#endif AlfClassifier *cl0 = classifier[yOffset] + xOffset; AlfClassifier *cl1 = classifier[yOffset + 1] + xOffset; @@ -1400,35 +881,7 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int } template -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#else -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#else -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs) -#else -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs) -#else -void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs) -#endif -#endif -#endif { const bool bChroma = isChroma( compId ); if( bChroma ) @@ -1452,19 +905,13 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf const int endWidth = blk.x + blk.width; const Pel* src = srcLuma.buf; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Pel* dst = dstLuma.buf + blkDst.y * dstStride; -#else - Pel* dst = dstLuma.buf + startHeight * dstStride; -#endif const Pel *pImgYPad0, *pImgYPad1, *pImgYPad2, *pImgYPad3, *pImgYPad4, *pImgYPad5, *pImgYPad6; const Pel *pImg0, *pImg1, *pImg2, *pImg3, *pImg4, *pImg5, *pImg6; short *coef = filterSet; -#if JVET_N0242_NON_LINEAR_ALF short *clip = fClipSet; -#endif const int shift = m_NUM_BITS - 1; @@ -1486,12 +933,8 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf int dstStride2 = dstStride * clsSizeY; int srcStride2 = srcStride * clsSizeY; -#if JVET_N0242_NON_LINEAR_ALF std::array filterCoeff; std::array filterClipp; -#else - std::vector filterCoeff( MAX_NUM_ALF_LUMA_COEFF ); -#endif pImgYPad0 = src + startHeight * srcStride + startWidth; pImgYPad1 = pImgYPad0 + srcStride; @@ -1501,22 +944,14 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf pImgYPad5 = pImgYPad3 + srcStride; pImgYPad6 = pImgYPad4 - srcStride; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Pel* pRec0 = dst + blkDst.x; -#else - Pel* pRec0 = dst + startWidth; -#endif Pel* pRec1 = pRec0 + dstStride; for( int i = 0; i < endHeight - startHeight; i += clsSizeY ) { if( !bChroma ) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND pClass = classifier[blkDst.y + i] + blkDst.x; -#else - pClass = classifier[startHeight + i] + startWidth; -#endif } for( int j = 0; j < endWidth - startWidth; j += clsSizeX ) @@ -1530,9 +965,7 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf continue; } coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; -#if JVET_N0242_NON_LINEAR_ALF clip = fClipSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; -#endif } else if( isPCMFilterDisabled ) { @@ -1545,11 +978,7 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf { for( blkX=0; blkX<4; blkX+=2 ) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Position pos(j + blkDst.x + blkX, i + blkDst.y + blkY); -#else - Position pos(j+startWidth+blkX, i+startHeight+blkY); -#endif CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); *flags++ = cu->ipcm ? 1 : 0; } @@ -1568,30 +997,22 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf if( transposeIdx == 1 ) { filterCoeff = { coef[9], coef[4], coef[10], coef[8], coef[1], coef[5], coef[11], coef[7], coef[3], coef[0], coef[2], coef[6], coef[12] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[9], clip[4], clip[10], clip[8], clip[1], clip[5], clip[11], clip[7], clip[3], clip[0], clip[2], clip[6], clip[12] }; -#endif } else if( transposeIdx == 2 ) { filterCoeff = { coef[0], coef[3], coef[2], coef[1], coef[8], coef[7], coef[6], coef[5], coef[4], coef[9], coef[10], coef[11], coef[12] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[0], clip[3], clip[2], clip[1], clip[8], clip[7], clip[6], clip[5], clip[4], clip[9], clip[10], clip[11], clip[12] }; -#endif } else if( transposeIdx == 3 ) { filterCoeff = { coef[9], coef[8], coef[10], coef[4], coef[3], coef[7], coef[11], coef[5], coef[1], coef[0], coef[2], coef[6], coef[12] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[9], clip[8], clip[10], clip[4], clip[3], clip[7], clip[11], clip[5], clip[1], clip[0], clip[2], clip[6], clip[12] }; -#endif } else { filterCoeff = { coef[0], coef[1], coef[2], coef[3], coef[4], coef[5], coef[6], coef[7], coef[8], coef[9], coef[10], coef[11], coef[12] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[0], clip[1], clip[2], clip[3], clip[4], clip[5], clip[6], clip[7], clip[8], clip[9], clip[10], clip[11], clip[12] }; -#endif } } else @@ -1599,30 +1020,22 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf if( transposeIdx == 1 ) { filterCoeff = { coef[4], coef[1], coef[5], coef[3], coef[0], coef[2], coef[6] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[4], clip[1], clip[5], clip[3], clip[0], clip[2], clip[6] }; -#endif } else if( transposeIdx == 2 ) { filterCoeff = { coef[0], coef[3], coef[2], coef[1], coef[4], coef[5], coef[6] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[0], clip[3], clip[2], clip[1], clip[4], clip[5], clip[6] }; -#endif } else if( transposeIdx == 3 ) { filterCoeff = { coef[4], coef[3], coef[5], coef[1], coef[0], coef[2], coef[6] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[4], clip[3], clip[5], clip[1], clip[0], clip[2], clip[6] }; -#endif } else { filterCoeff = { coef[0], coef[1], coef[2], coef[3], coef[4], coef[5], coef[6] }; -#if JVET_N0242_NON_LINEAR_ALF filterClipp = { clip[0], clip[1], clip[2], clip[3], clip[4], clip[5], clip[6] }; -#endif } } @@ -1638,8 +1051,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf pRec1 = pRec0 + j + ii * dstStride; -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if ((blkDst.y + i + ii) % vbCTUHeight < vbPos && ((blkDst.y + i + ii) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above { pImg1 = ((blkDst.y + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; @@ -1660,29 +1071,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf pImg3 = ((blkDst.y + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; pImg5 = ((blkDst.y + i + ii) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; } -#else - if ((startHeight + i + ii) % vbCTUHeight < vbPos && ((startHeight + i + ii) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((startHeight + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 3) ? pImg3 : pImg5; - - pImg2 = ((startHeight + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - pImg6 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 3) ? pImg4 : pImg6; - } - else if ((startHeight + i + ii) % vbCTUHeight >= vbPos && ((startHeight + i + ii) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((startHeight + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - pImg6 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 2) ? pImg4 : pImg6; - - pImg1 = ((startHeight + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; - } -#endif -#endif for( int jj = 0; jj < clsSizeX; jj++ ) { @@ -1704,121 +1092,39 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier** classifier, const PelUnitBuf } int sum = 0; -#if JVET_N0242_NON_LINEAR_ALF const Pel curr = pImg0[+0]; -#endif if( filtType == ALF_FILTER_7 ) { -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[0] * ( pImg5[0] + pImg6[0] ); -#else sum += filterCoeff[0] * ( clipALF(filterClipp[0], curr, pImg5[+0], pImg6[+0]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[1] * ( pImg3[+1] + pImg4[-1] ); -#else sum += filterCoeff[1] * ( clipALF(filterClipp[1], curr, pImg3[+1], pImg4[-1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[2] * ( pImg3[+0] + pImg4[+0] ); -#else sum += filterCoeff[2] * ( clipALF(filterClipp[2], curr, pImg3[+0], pImg4[+0]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[3] * ( pImg3[-1] + pImg4[+1] ); -#else sum += filterCoeff[3] * ( clipALF(filterClipp[3], curr, pImg3[-1], pImg4[+1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[4] * ( pImg1[+2] + pImg2[-2] ); -#else sum += filterCoeff[4] * ( clipALF(filterClipp[4], curr, pImg1[+2], pImg2[-2]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[5] * ( pImg1[+1] + pImg2[-1] ); -#else sum += filterCoeff[5] * ( clipALF(filterClipp[5], curr, pImg1[+1], pImg2[-1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[6] * ( pImg1[+0] + pImg2[+0] ); -#else sum += filterCoeff[6] * ( clipALF(filterClipp[6], curr, pImg1[+0], pImg2[+0]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[7] * ( pImg1[-1] + pImg2[+1] ); -#else sum += filterCoeff[7] * ( clipALF(filterClipp[7], curr, pImg1[-1], pImg2[+1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[8] * ( pImg1[-2] + pImg2[+2] ); -#else sum += filterCoeff[8] * ( clipALF(filterClipp[8], curr, pImg1[-2], pImg2[+2]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[9] * ( pImg0[+3] + pImg0[-3] ); -#else sum += filterCoeff[9] * ( clipALF(filterClipp[9], curr, pImg0[+3], pImg0[-3]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[10] * ( pImg0[+2] + pImg0[-2] ); -#else sum += filterCoeff[10] * ( clipALF(filterClipp[10], curr, pImg0[+2], pImg0[-2]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[11] * ( pImg0[+1] + pImg0[-1] ); -#else sum += filterCoeff[11] * ( clipALF(filterClipp[11], curr, pImg0[+1], pImg0[-1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[12] * ( pImg0[+0] ); -#endif } else { -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[0] * ( pImg3[+0] + pImg4[+0] ); -#else sum += filterCoeff[0] * ( clipALF(filterClipp[0], curr, pImg3[+0], pImg4[+0]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[1] * ( pImg1[+1] + pImg2[-1] ); -#else sum += filterCoeff[1] * ( clipALF(filterClipp[1], curr, pImg1[+1], pImg2[-1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[2] * ( pImg1[+0] + pImg2[+0] ); -#else sum += filterCoeff[2] * ( clipALF(filterClipp[2], curr, pImg1[+0], pImg2[+0]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[3] * ( pImg1[-1] + pImg2[+1] ); -#else sum += filterCoeff[3] * ( clipALF(filterClipp[3], curr, pImg1[-1], pImg2[+1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[4] * ( pImg0[+2] + pImg0[-2] ); -#else sum += filterCoeff[4] * ( clipALF(filterClipp[4], curr, pImg0[+2], pImg0[-2]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[5] * ( pImg0[+1] + pImg0[-1] ); -#else sum += filterCoeff[5] * ( clipALF(filterClipp[5], curr, pImg0[+1], pImg0[-1]) ); -#endif -#if !JVET_N0242_NON_LINEAR_ALF - sum += filterCoeff[6] * ( pImg0[+0] ); -#endif } sum = ( sum + offset ) >> shift; -#if JVET_N0242_NON_LINEAR_ALF sum += curr; -#endif pRec1[jj] = ClipPel( sum, clpRng ); pImg0++; diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.h b/source/Lib/CommonLib/AdaptiveLoopFilter.h index a391309cfec0c648ab2c36977b29758d6363385d..3ccb7ce9a6937fafac9e52ac2b5ef9baea841c55 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.h +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.h @@ -67,7 +67,6 @@ enum Direction class AdaptiveLoopFilter { public: -#if JVET_N0242_NON_LINEAR_ALF static inline int clipALF(const int clip, const short ref, const short val0, const short val1) { return Clip3(-clip, +clip, val0-ref) + Clip3(-clip, +clip, val1-ref); @@ -76,7 +75,6 @@ public: static constexpr int AlfNumClippingValues[MAX_NUM_CHANNEL_TYPE] = { 4, 4 }; static constexpr int MaxAlfNumClippingValues = 4; -#endif static constexpr int m_NUM_BITS = 8; static constexpr int m_CLASSIFICATION_BLK_SIZE = 32; //non-normative, local buffer size static constexpr int m_ALF_UNUSED_CLASSIDX = 255; @@ -84,118 +82,25 @@ public: AdaptiveLoopFilter(); virtual ~AdaptiveLoopFilter() {} -#if JVET_N0415_CTB_ALF void reconstructCoeffAPSs(CodingStructure& cs, bool luma, bool chroma, bool isRdo); void reconstructCoeff(AlfSliceParam& alfSliceParam, ChannelType channel, const bool isRdo, const bool isRedo = false); void ALFProcess(CodingStructure& cs); -#else - void reconstructCoeff(AlfSliceParam& alfSliceParam, ChannelType channel, const bool isRedo = false); - void ALFProcess( CodingStructure& cs, AlfSliceParam& alfSliceParam ); -#endif void create( const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE] ); void destroy(); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION static void deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift, int vbCTUHeight, int vbPos); -#else - static void deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift); -#endif void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk ); -#else -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION - static void deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift, int vbCTUHeight, int vbPos); -#else - static void deriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift); -#endif - void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk ); -#endif void resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk); template -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#else - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#else - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs); -#else - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs); -#else - static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs); -#endif -#endif -#endif inline static int getMaxGolombIdx( AlfFilterType filterType ) { return filterType == ALF_FILTER_5 ? 2 : 3; } -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void(*m_deriveClassificationBlk)(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift, int vbCTUHeight, int vbPos); -#else - void(*m_deriveClassificationBlk)(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift, int vbCTUHeight, int vbPos); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - void(*m_deriveClassificationBlk)(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift); -#else - void(*m_deriveClassificationBlk)(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift); -#endif -#endif -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#else - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#else - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos); -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs); -#else - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs); -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs); -#else - void(*m_filter5x5Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs); - void(*m_filter7x7Blk)(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs); -#endif -#endif -#endif #ifdef TARGET_SIMD_X86 void initAdaptiveLoopFilterX86(); @@ -204,37 +109,25 @@ public: #endif protected: -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool isCrossedByVirtualBoundaries( const int xPos, const int yPos, const int width, const int height, bool& clipTop, bool& clipBottom, bool& clipLeft, bool& clipRight, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps ); -#endif -#if JVET_N0415_CTB_ALF static const int m_classToFilterMapping[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES]; static const int m_fixedFilterSetCoeff[ALF_FIXED_FILTER_NUM][MAX_NUM_ALF_LUMA_COEFF]; short m_fixedFilterSetCoeffDec[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; short m_coeffApsLuma[6][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES]; -#if JVET_N0242_NON_LINEAR_ALF short m_clippApsLuma[6][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES]; short m_clipDefault[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; -#endif bool m_created = false; short m_chromaCoeffFinal[MAX_NUM_ALF_LUMA_COEFF]; -#endif -#if JVET_N0242_NON_LINEAR_ALF Pel m_alfClippingValues[MAX_NUM_CHANNEL_TYPE][MaxAlfNumClippingValues]; -#endif std::vector m_filterShapes[MAX_NUM_CHANNEL_TYPE]; AlfClassifier** m_classifier; short m_coeffFinal[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; -#if JVET_N0242_NON_LINEAR_ALF short m_clippFinal[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; short m_chromaClippFinal[MAX_NUM_ALF_LUMA_COEFF]; -#endif int** m_laplacian[NUM_DIRECTIONS]; uint8_t* m_ctuEnableFlag[MAX_NUM_COMPONENT]; PelStorage m_tempBuf; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND PelStorage m_tempBuf2; -#endif int m_inputBitDepth[MAX_NUM_CHANNEL_TYPE]; int m_picWidth; int m_picHeight; @@ -244,12 +137,10 @@ protected: int m_numCTUsInWidth; int m_numCTUsInHeight; int m_numCTUsInPic; -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION int m_alfVBLumaPos; int m_alfVBChmaPos; int m_alfVBLumaCTUHeight; int m_alfVBChmaCTUHeight; -#endif ChromaFormat m_chromaFormat; ClpRngs m_clpRngs; }; diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 95eafa85d81aa64cbc962dc418a469ccba2ecae8..663d34dd00339d5b7f8c8c109f8feb41c280ec22 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -91,11 +91,7 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr Pel* srcTmp = pSrc + srcStride + 1; Pel* gradXTmp = gradX + gradStride + 1; Pel* gradYTmp = gradY + gradStride + 1; -#if JVET_N0325_BDOF int shift1 = std::max(6, (bitDepth - 6)); -#else - int shift1 = std::max(2, (IF_INTERNAL_PREC - bitDepth)); -#endif for (int y = 0; y < (height - 2 * BIO_EXTEND_SIZE); y++) { @@ -132,13 +128,8 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr void calcBIOParCore(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, const int bitDepth) { -#if JVET_N0325_BDOF int shift4 = std::max(4, (bitDepth - 8)); int shift5 = std::max(1, (bitDepth - 11)); -#else - int shift4 = std::min(8, (bitDepth - 4)); - int shift5 = std::min(5, (bitDepth - 7)); -#endif for (int y = 0; y < heightG; y++) { for (int x = 0; x < widthG; x++) @@ -408,9 +399,7 @@ void AreaBuf::scaleSignal(const int scale, const bool dir, const ClpRng& cl { for (unsigned x = 0; x < width; x++) { -#if JVET_N0220_LMCS_SIMPLIFICATION src[x] = (Pel)Clip3((Pel)(-maxAbsclipBD - 1), (Pel)maxAbsclipBD, src[x]); -#endif sign = src[x] >= 0 ? 1 : -1; absval = sign * src[x]; int val = sign * ((absval * scale + (1 << (CSCALE_FP_PREC - 1))) >> CSCALE_FP_PREC); diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index 10a9788b474d9f3b98a117e675609c928654d4d5..d7a10b1fd894bcda72956dde498b1209fcd94e8f 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -111,10 +111,8 @@ struct AreaBuf : public Size void copyClip ( const AreaBuf &src, const ClpRng& clpRng); void subtract ( const AreaBuf &other ); -#if JVET_N0054_JOINT_CHROMA void copyAndNegate ( const AreaBuf &other ); void subtractAndHalve ( const AreaBuf &other ); -#endif void extendSingleBorderPel(); void extendBorderPel ( unsigned margin ); void addWeightedAvg ( const AreaBuf &other1, const AreaBuf &other2, const ClpRng& clpRng, const int8_t gbiIdx); @@ -359,7 +357,6 @@ void AreaBuf::subtract( const AreaBuf &other ) #undef SUBS_INC } -#if JVET_N0054_JOINT_CHROMA template void AreaBuf::copyAndNegate( const AreaBuf &other ) { @@ -401,7 +398,6 @@ void AreaBuf::subtractAndHalve( const AreaBuf &other ) #undef SUBS_OP #undef SUBS_INC } -#endif template void AreaBuf::copyClip( const AreaBuf &src, const ClpRng& clpRng ) diff --git a/source/Lib/CommonLib/ChromaFormat.h b/source/Lib/CommonLib/ChromaFormat.h index ca13e2ea52400682bf1c60434e458fc4739095a3..a6b827f93035ddd4bd91690114e3d00abff9703c 100644 --- a/source/Lib/CommonLib/ChromaFormat.h +++ b/source/Lib/CommonLib/ChromaFormat.h @@ -122,7 +122,6 @@ static inline int getScaledChromaQP(int unscaledChromaQP, const ChromaFormat chF } -#if HEVC_USE_SCALING_LISTS //====================================================================================================================== //Scaling lists ======================================================================================================= //====================================================================================================================== @@ -131,6 +130,5 @@ static inline int getScalingListType(const PredMode predMode, const ComponentID { return ((predMode != MODE_INTER) ? 0 : MAX_NUM_COMPONENT) + MAP_CHROMA(compID); } -#endif #endif diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h index 26d7617f9b2092d9a99d516fb8d9a343ed74ae9a..10499642f4e5cd663f8c0979056164f98987f86a 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -76,9 +76,7 @@ enum CodingStatisticsType STATS__CABAC_BITS__CHROMA_QP_ADJUSTMENT, STATS__CABAC_BITS__QT_CBF, STATS__CABAC_BITS__CROSS_COMPONENT_PREDICTION, -#if JVET_N0054_JOINT_CHROMA STATS__CABAC_BITS__JOINT_CB_CR, -#endif STATS__CABAC_BITS__MTS_FLAGS, STATS__CABAC_BITS__LAST_SIG_X_Y, STATS__CABAC_BITS__SIG_COEFF_GROUP_FLAG, @@ -91,9 +89,7 @@ enum CodingStatisticsType STATS__CABAC_BITS__SAO, STATS__CABAC_BITS__ALF, STATS__CABAC_TRM_BITS, -#if JVET_N0193_LFNST STATS__CABAC_BITS__LFNST, -#endif STATS__CABAC_FIXED_BITS, STATS__CABAC_PCM_ALIGN_BITS, STATS__CABAC_PCM_CODE_BITS, @@ -113,15 +109,11 @@ enum CodingStatisticsType STATS__CABAC_BITS__TRIANGLE_INDEX, STATS__CABAC_BITS__MULTI_REF_LINE, STATS__CABAC_BITS__SYMMVD_FLAG, -#if JVET_N0413_RDPCM STATS__CABAC_BITS__BDPCM_MODE, -#endif STATS__TOOL_TOTAL_FRAME,// This is a special case and is not included in the report. STATS__TOOL_AFF, STATS__TOOL_EMT, -#if JVET_N0193_LFNST STATS__TOOL_LFNST, -#endif STATS__TOOL_TOTAL, STATS__NUM_STATS }; @@ -169,9 +161,7 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__CHROMA_QP_ADJUSTMENT", "CABAC_BITS__QT_CBF", "CABAC_BITS__CROSS_COMPONENT_PREDICTION", -#if JVET_N0054_JOINT_CHROMA "CABAC_BITS__JOINT_CB_CR", -#endif "CABAC_BITS__MTS_FLAGS", "CABAC_BITS__LAST_SIG_X_Y", "CABAC_BITS__SIG_COEFF_GROUP_FLAG", @@ -182,9 +172,7 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__SIGN_BIT", "CABAC_BITS__ESCAPE_BITS", "CABAC_BITS__SAO", -#if JVET_N0193_LFNST "CABAC_BITS__LFNST", -#endif "CABAC_BITS__ALF", "CABAC_TRM_BITS", "CABAC_FIXED_BITS", @@ -206,15 +194,11 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__TRIANGLE_INDEX", "CABAC_BITS__MULTI_REF_LINE", "CABAC_BITS__SYMMVD_FLAG", -#if JVET_N0413_RDPCM "CABAC_BITS__BDPCM_MODE", -#endif "TOOL_FRAME", "TOOL_AFFINE", "TOOL_EMT", -#if JVET_N0193_LFNST "TOOL_LFNST", -#endif "TOOL_TOTAL" }; CHECK( STATS__NUM_STATS != sizeof( statNames ) / sizeof( char* ) || name >= STATS__NUM_STATS, "stats out of range" ); diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 96b21c75dbb59220a020430a37163aa660b4c49d..a807329c7475bf0fb2b7eec37c3cd8075ebcf159 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -286,11 +286,7 @@ TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType ef } else { -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES while( !tus[idx - 1 + extraIdx]->blocks[getFirstComponentOfChannel( effChType )].contains( pos ) ) -#else - while( pos != tus[idx - 1 + extraIdx]->blocks[getFirstComponentOfChannel( effChType )].pos() ) -#endif { extraIdx++; } @@ -774,23 +770,13 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe subStruct.sps = sps; #if HEVC_VPS subStruct.vps = vps; -#elif JVET_N0278_HLS +#else subStruct.vps = vps; #endif subStruct.pps = pps; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(subStruct.alfApss, alfApss, sizeof(alfApss)); -#else - memcpy(subStruct.apss, apss, sizeof(apss)); -#endif -#else - subStruct.aps = aps; -#endif -#if JVET_N0805_APS_LMCS subStruct.lmcsAps = lmcsAps; -#endif subStruct.slice = slice; subStruct.baseQP = baseQP; @@ -1359,16 +1345,12 @@ const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const C const CodingUnit* cu = getCU( pos, _chType ); // exists same slice and tile cu precedes curCu in encoding order // (thus, is either from parent CS in RD-search or its index is lower) -#if JVET_N0150_ONE_CTU_DELAY_WPP const bool wavefrontsEnabled = curCu.slice->getPPS()->getEntropyCodingSyncEnabledFlag(); int ctuSizeBit = g_aucLog2[curCu.cs->sps->getMaxCUWidth()]; int xNbY = pos.x << getChannelTypeScaleX( _chType, curCu.chromaFormat ); int xCurr = curCu.blocks[_chType].x << getChannelTypeScaleX( _chType, curCu.chromaFormat ); bool addCheck = (wavefrontsEnabled && (xNbY >> ctuSizeBit) >= (xCurr >> ctuSizeBit) + 1 ) ? false : true; if( cu && CU::isSameSliceAndTile( *cu, curCu ) && ( cu->cs != curCu.cs || cu->idx <= curCu.idx ) && addCheck) -#else - if( cu && CU::isSameSliceAndTile( *cu, curCu ) && ( cu->cs != curCu.cs || cu->idx <= curCu.idx ) ) -#endif { return cu; } @@ -1378,23 +1360,15 @@ const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const C } } -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const Position curPos, const unsigned curSliceIdx, const unsigned curTileIdx, const ChannelType _chType ) const -#else -const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const unsigned curSliceIdx, const unsigned curTileIdx, const ChannelType _chType ) const -#endif { const CodingUnit* cu = getCU( pos, _chType ); -#if JVET_N0150_ONE_CTU_DELAY_WPP const bool wavefrontsEnabled = this->slice->getPPS()->getEntropyCodingSyncEnabledFlag(); int ctuSizeBit = g_aucLog2[this->sps->getMaxCUWidth()]; int xNbY = pos.x << getChannelTypeScaleX( _chType, this->area.chromaFormat ); int xCurr = curPos.x << getChannelTypeScaleX( _chType, this->area.chromaFormat ); bool addCheck = (wavefrontsEnabled && (xNbY >> ctuSizeBit) >= (xCurr >> ctuSizeBit) + 1 ) ? false : true; return ( cu && cu->slice->getIndependentSliceIdx() == curSliceIdx && cu->tileIdx == curTileIdx && addCheck ) ? cu : nullptr; -#else - return ( cu && cu->slice->getIndependentSliceIdx() == curSliceIdx && cu->tileIdx == curTileIdx ) ? cu : nullptr; -#endif } const PredictionUnit* CodingStructure::getPURestricted( const Position &pos, const PredictionUnit& curPu, const ChannelType _chType ) const @@ -1402,16 +1376,12 @@ const PredictionUnit* CodingStructure::getPURestricted( const Position &pos, con const PredictionUnit* pu = getPU( pos, _chType ); // exists same slice and tile pu precedes curPu in encoding order // (thus, is either from parent CS in RD-search or its index is lower) -#if JVET_N0150_ONE_CTU_DELAY_WPP const bool wavefrontsEnabled = curPu.cu->slice->getPPS()->getEntropyCodingSyncEnabledFlag(); int ctuSizeBit = g_aucLog2[curPu.cs->sps->getMaxCUWidth()]; int xNbY = pos.x << getChannelTypeScaleX( _chType, curPu.chromaFormat ); int xCurr = curPu.blocks[_chType].x << getChannelTypeScaleX( _chType, curPu.chromaFormat ); bool addCheck = (wavefrontsEnabled && (xNbY >> ctuSizeBit) >= (xCurr >> ctuSizeBit) + 1 ) ? false : true; if( pu && CU::isSameSliceAndTile( *pu->cu, *curPu.cu ) && ( pu->cs != curPu.cs || pu->idx <= curPu.idx ) && addCheck ) -#else - if( pu && CU::isSameSliceAndTile( *pu->cu, *curPu.cu ) && ( pu->cs != curPu.cs || pu->idx <= curPu.idx ) ) -#endif { return pu; } @@ -1426,16 +1396,12 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons const TransformUnit* tu = getTU( pos, _chType ); // exists same slice and tile tu precedes curTu in encoding order // (thus, is either from parent CS in RD-search or its index is lower) -#if JVET_N0150_ONE_CTU_DELAY_WPP const bool wavefrontsEnabled = curTu.cu->slice->getPPS()->getEntropyCodingSyncEnabledFlag(); int ctuSizeBit = g_aucLog2[curTu.cs->sps->getMaxCUWidth()]; int xNbY = pos.x << getChannelTypeScaleX( _chType, curTu.chromaFormat ); int xCurr = curTu.blocks[_chType].x << getChannelTypeScaleX( _chType, curTu.chromaFormat ); bool addCheck = (wavefrontsEnabled && (xNbY >> ctuSizeBit) >= (xCurr >> ctuSizeBit) + 1 ) ? false : true; if( tu && CU::isSameSliceAndTile( *tu->cu, *curTu.cu ) && ( tu->cs != curTu.cs || tu->idx <= curTu.idx ) && addCheck ) -#else - if( tu && CU::isSameSliceAndTile( *tu->cu, *curTu.cu ) && ( tu->cs != curTu.cs || tu->idx <= curTu.idx ) ) -#endif { return tu; } diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index dc77086d7bfe974d9fc8172656285ae117110f2a..81356aed56324f6117ebcdb411aa77efa04248f8 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -95,21 +95,11 @@ public: bool isLossless; const SPS *sps; const PPS *pps; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS APS* alfApss[MAX_NUM_APS]; -#else - APS* apss[MAX_NUM_APS]; -#endif -#else - APS * aps; -#endif -#if JVET_N0805_APS_LMCS APS * lmcsAps; -#endif #if HEVC_VPS const VPS *vps; -#elif JVET_N0278_HLS +#else const VPS *vps; #endif const PreCalcValues* pcv; @@ -151,11 +141,7 @@ public: PredictionUnit *getPU(const ChannelType &_chType ) { return getPU(area.blocks[_chType].pos(), _chType); } TransformUnit *getTU(const ChannelType &_chType ) { return getTU(area.blocks[_chType].pos(), _chType); } -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit *getCURestricted(const Position &pos, const Position curPos, const unsigned curSliceIdx, const unsigned curTileIdx, const ChannelType _chType) const; -#else - const CodingUnit *getCURestricted(const Position &pos, const unsigned curSliceIdx, const unsigned curTileIdx, const ChannelType _chType) const; -#endif const CodingUnit *getCURestricted(const Position &pos, const CodingUnit& curCu, const ChannelType _chType) const; const PredictionUnit *getPURestricted(const Position &pos, const PredictionUnit& curPu, const ChannelType _chType) const; const TransformUnit *getTURestricted(const Position &pos, const TransformUnit& curTu, const ChannelType _chType) const; @@ -275,9 +261,7 @@ public: const CPelBuf getRecoBuf(const CompArea &blk) const; PelUnitBuf getRecoBuf(const UnitArea &unit); const CPelUnitBuf getRecoBuf(const UnitArea &unit) const; -#if JVET_N0415_CTB_ALF PelUnitBuf& getRecoBufRef() { return m_reco; } -#endif PelBuf getOrgResiBuf(const CompArea &blk); const CPelBuf getOrgResiBuf(const CompArea &blk) const; diff --git a/source/Lib/CommonLib/Common.h b/source/Lib/CommonLib/Common.h index 2d40a53647479f44c519959a0c7a4b1ce4922c56..a67e696ba8ce340d376c6d1958e4e1daf9a8d2cd 100644 --- a/source/Lib/CommonLib/Common.h +++ b/source/Lib/CommonLib/Common.h @@ -259,7 +259,6 @@ public: } }; -#if JVET_N0217_MATRIX_INTRAPRED struct AvailableInfo { int maxPosTop; @@ -268,7 +267,6 @@ struct AvailableInfo AvailableInfo() : maxPosTop(0), maxPosLeft(0) {} AvailableInfo(const int top, const int left) : maxPosTop(top), maxPosLeft(left) {} }; -#endif #endif diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index d836f63f80d3da1c4a638080f65c4edf65ba83fd..3f2a69f7b6060fe6ffdbec072edd30142c1f4a3e 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -143,10 +143,8 @@ static const int MAX_NUM_REF = 16; ///< max. static const int MAX_QP = 63; static const int NOT_VALID = -1; -#if JVET_N0857_TILES_BRICKS static const int MAX_TILES = 128; ///< max. number of tiles for which a brick configuration can be read static const int MAX_NUM_BRICKS_PER_TILE = 8; ///< max. number brick per tile, for which a configuration can be read -#endif static const int AMVP_MAX_NUM_CANDS = 2; ///< AMVP: advanced motion vector prediction - max number of final candidates static const int AMVP_MAX_NUM_CANDS_MEM = 3; ///< AMVP: advanced motion vector prediction - max number of candidates @@ -173,7 +171,7 @@ static const int MAX_NESTING_NUM_LAYER = 64; static const int MAX_VPS_NUM_HRD_PARAMETERS = 1; static const int MAX_VPS_OP_SETS_PLUS1 = 1024; static const int MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 = 1; -#elif JVET_N0278_HLS +#else static const int MAX_VPS_NUM_HRD_PARAMETERS = 1; static const int MAX_VPS_LAYERS = 256; #endif @@ -181,21 +179,15 @@ static const int MAX_VPS_LAYERS = 256; static const int MAXIMUM_INTRA_FILTERED_WIDTH = 16; static const int MAXIMUM_INTRA_FILTERED_HEIGHT = 16; -#if JVET_N0217_MATRIX_INTRAPRED static const int MIP_MAX_WIDTH = 64; static const int MIP_MAX_HEIGHT = 64; -#endif -#if JVET_N0415_CTB_ALF static const int ALF_FIXED_FILTER_NUM = 64; static const int ALF_CTB_MAX_NUM_APS = 6; static const int NUM_FIXED_FILTER_SETS = 16; static const int NUM_TOTAL_FILTER_SETS = NUM_FIXED_FILTER_SETS + ALF_CTB_MAX_NUM_APS; -#endif -#if JVET_N0178_IMPLICIT_BDOF_SPLIT static const int MAX_BDOF_APPLICATION_REGION = 16; -#endif static const int MAX_CPB_CNT = 32; ///< Upper bound of (cpb_cnt_minus1 + 1) static const int MAX_NUM_LAYER_IDS = 64; @@ -213,19 +205,13 @@ static const int MAX_NUM_DPS = 16; static const int MAX_NUM_SPS = 16; static const int MAX_NUM_PPS = 64; static const int MAX_NUM_APS = 32; //Currently APS ID has 5 bits -#if JVET_N0805_APS_LMCS static const int NUM_APS_TYPE_LEN = 3; //Currently APS Type has 3 bits static const int MAX_NUM_APS_TYPE = 8; //Currently APS Type has 3 bits so the max type is 8 -#endif static const int MLS_GRP_NUM = 1024; ///< Max number of coefficient groups, max(16, 256) static const int MLS_CG_SIZE = 4; ///< Coefficient group size of 4x4; = MLS_CG_LOG2_WIDTH + MLS_CG_LOG2_HEIGHT -#if !JVET_N0246_MODIFIED_QUANTSCALES -static const int ADJ_QUANT_SHIFT = 7; -static const int ADJ_DEQUANT_SHIFT = ( ADJ_QUANT_SHIFT + 1 ); -#endif static const int RVM_VCEGAM10_M = 4; @@ -237,9 +223,7 @@ static const int NUM_LUMA_MODE = 67; ///< Plan static const int NUM_LMC_MODE = 1 + 2; ///< LMC + MDLM_T + MDLM_L static const int NUM_INTRA_MODE = (NUM_LUMA_MODE + NUM_LMC_MODE); -#if JVET_N0193_LFNST static const int NUM_EXT_LUMA_MODE = 28; -#endif static const int NUM_DIR = (((NUM_LUMA_MODE - 3) >> 2) + 1); static const int PLANAR_IDX = 0; ///< index for intra PLANAR mode @@ -248,9 +232,7 @@ static const int HOR_IDX = (1 * (NUM_DIR - 1) + 2); ///< inde static const int DIA_IDX = (2 * (NUM_DIR - 1) + 2); ///< index for intra DIAGONAL mode static const int VER_IDX = (3 * (NUM_DIR - 1) + 2); ///< index for intra VERTICAL mode static const int VDIA_IDX = (4 * (NUM_DIR - 1) + 2); ///< index for intra VDIAGONAL mode -#if JVET_N0413_RDPCM static const int BDPCM_IDX = (5 * (NUM_DIR - 1) + 2); ///< index for intra VDIAGONAL mode -#endif static const int NOMODE_IDX = MAX_UCHAR; ///< indicating uninitialized elements static const int NUM_CHROMA_MODE = (5 + NUM_LMC_MODE); ///< total number of chroma modes @@ -265,26 +247,18 @@ static const uint32_t NUM_TRAFO_MODES_MTS = 6; ///< static const uint32_t MTS_INTRA_MAX_CU_SIZE = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128 static const uint32_t MTS_INTER_MAX_CU_SIZE = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128 static const int NUM_MOST_PROBABLE_MODES = 6; -#if JVET_N0217_MATRIX_INTRAPRED static const int NUM_MPM_MIP = 3; ///< number of most probable modes for MIP -#endif static const int LM_SYMBOL_NUM = (1 + NUM_LMC_MODE); -#if JVET_N0217_MATRIX_INTRAPRED static const int MAX_NUM_MIP_MODE = 35; ///< maximum number of MIP modes static const int FAST_UDI_MAX_RDMODE_NUM = (NUM_LUMA_MODE + MAX_NUM_MIP_MODE); ///< maximum number of RD comparison in fast-UDI estimation loop -#else -static const int FAST_UDI_MAX_RDMODE_NUM = NUM_LUMA_MODE; ///< maximum number of RD comparison in fast-UDI estimation loop -#endif -#if JVET_N0193_LFNST static const int MAX_LFNST_COEF_NUM = 16; static const int LFNST_SIG_NZ_LUMA = 1; static const int LFNST_SIG_NZ_CHROMA = 1; static const int NUM_LFNST_NUM_PER_SET = 3; -#endif static const int MDCS_ANGLE_LIMIT = 9; ///< 0 = Horizontal/vertical only, 1 = Horizontal/vertical +/- 1, 2 = Horizontal/vertical +/- 2 etc... @@ -339,11 +313,7 @@ static const int QUANT_SHIFT = 14; ///< Q(4) static const int IQUANT_SHIFT = 6; static const int SCALE_BITS = 15; ///< Precision for fractional bit estimates -#if JVET_N0847_SCALING_LISTS static const int SCALING_LIST_NUM = MAX_NUM_COMPONENT * (NUMBER_OF_PREDICTION_MODES - 1); ///< list number for quantization matrix -#else -static const int SCALING_LIST_NUM = MAX_NUM_COMPONENT * NUMBER_OF_PREDICTION_MODES; ///< list number for quantization matrix -#endif static const int SCALING_LIST_START_VALUE = 8; ///< start value for dpcm mode static const int MAX_MATRIX_COEF_NUM = 64; ///< max coefficient number for quantization matrix @@ -380,10 +350,8 @@ static const int GBI_SIZE_CONSTRAINT = 256; ///< disa static const int MAX_NUM_HMVP_CANDS = (MRG_MAX_NUM_CANDS-1); ///< maximum number of HMVP candidates to be stored and used in merge list static const int MAX_NUM_HMVP_AVMPCANDS = 4; ///< maximum number of HMVP candidates to be used in AMVP list -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION static const int ALF_VB_POS_ABOVE_CTUROW_LUMA = 4; static const int ALF_VB_POS_ABOVE_CTUROW_CHMA = 2; -#endif #if W0038_DB_OPT static const int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS = 8 ; @@ -399,9 +367,7 @@ static const int DMVR_SUBCU_WIDTH_LOG2 = 4; static const int DMVR_SUBCU_HEIGHT_LOG2 = 4; static const int MAX_NUM_SUBCU_DMVR = ((MAX_CU_SIZE * MAX_CU_SIZE) >> (DMVR_SUBCU_WIDTH_LOG2 + DMVR_SUBCU_HEIGHT_LOG2)); static const int DMVR_NUM_ITERATION = 2; -#if JVET_N0413_RDPCM static const int BDPCM_MAX_CU_SIZE = 32; ///< maximum CU size for RDPCM mode -#endif //QTBT high level parameters //for I slice luma CTB configuration para. @@ -419,10 +385,8 @@ static const int MAX_BT_DEPTH_C = 0; ///< static const int MAX_BT_SIZE_C = 64; ///< [1<(JVET_C0024_ZERO_OUT_TH, m_width) >> m_log2CGWidth) , m_heightInGroups(std::min(JVET_C0024_ZERO_OUT_TH, m_height) >> m_log2CGHeight) , m_log2BlockWidth (g_aucLog2[m_width]) , m_log2BlockHeight (g_aucLog2[m_height]) , m_maxNumCoeff (m_width * m_height) -#if HEVC_USE_SIGN_HIDING , m_signHiding (signHide) -#endif , m_extendedPrecision (tu.cs->sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag()) , m_maxLog2TrDynamicRange (tu.cs->sps->getMaxLog2TrDynamicRange(m_chType)) -#if HEVC_USE_MDCS - , m_scanType (CoeffScanType(TU::getCoefScanIdx( tu, m_compID))) -#else , m_scanType (SCAN_DIAG) -#endif -#if JVET_N0103_CGSIZE_HARMONIZATION , m_scan (g_scanOrder [SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )]) , m_scanCG (g_scanOrder [SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)]) -#else - , m_scan (g_scanOrder [m_chType][SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )]) - , m_scanCG (g_scanOrder [m_chType][SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)]) -#endif , m_CtxSetLastX (Ctx::LastX[m_chType]) , m_CtxSetLastY (Ctx::LastY[m_chType]) , m_maxLastPosX(g_uiGroupIdx[std::min(JVET_C0024_ZERO_OUT_TH, m_width) - 1]) @@ -106,36 +82,20 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp , m_sigFlagCtxSet { Ctx::SigFlag[m_chType], Ctx::SigFlag[m_chType+2], Ctx::SigFlag[m_chType+4] } , m_parFlagCtxSet ( Ctx::ParFlag[m_chType] ) , m_gtxFlagCtxSet { Ctx::GtxFlag[m_chType], Ctx::GtxFlag[m_chType+2] } -#if JVET_N0280_RESIDUAL_CODING_TS , m_sigGroupCtxIdTS (-1) , m_tsSigFlagCtxSet ( Ctx::TsSigFlag ) , m_tsParFlagCtxSet ( Ctx::TsParFlag ) , m_tsGtxFlagCtxSet ( Ctx::TsGtxFlag ) -#endif , m_sigCoeffGroupFlag () -#if JVET_N0413_RDPCM , m_bdpcm (bdpcm) -#endif { // LOGTODO unsigned log2sizeX = m_log2BlockWidth; unsigned log2sizeY = m_log2BlockHeight; -#if HEVC_USE_MDCS - if (m_scanType == SCAN_VER) - { - std::swap(log2sizeX, log2sizeY); - std::swap(const_cast(m_maxLastPosX), const_cast(m_maxLastPosY)); - } -#endif if (m_chType == CHANNEL_TYPE_CHROMA) { -#if HEVC_USE_MDCS - const_cast(m_lastShiftX) = Clip3( 0, 2, int( ( m_scanType == SCAN_VER ? m_height : m_width ) >> 3) ); - const_cast(m_lastShiftY) = Clip3( 0, 2, int( ( m_scanType == SCAN_VER ? m_width : m_height ) >> 3) ); -#else const_cast(m_lastShiftX) = Clip3( 0, 2, int( m_width >> 3) ); const_cast(m_lastShiftY) = Clip3( 0, 2, int( m_height >> 3) ); -#endif } else { @@ -164,11 +124,9 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag ) unsigned sigRight = unsigned( ( CGPosX + 1 ) < m_widthInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + 1 ] : false ); unsigned sigLower = unsigned( ( CGPosY + 1 ) < m_heightInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + m_widthInGroups ] : false ); m_sigGroupCtxId = Ctx::SigCoeffGroup[m_chType]( sigRight | sigLower ); -#if JVET_N0280_RESIDUAL_CODING_TS unsigned sigLeft = unsigned( CGPosX > 0 ? m_sigCoeffGroupFlag[m_subSetPos - 1 ] : false ); unsigned sigAbove = unsigned( CGPosY > 0 ? m_sigCoeffGroupFlag[m_subSetPos - m_widthInGroups] : false ); m_sigGroupCtxIdTS = Ctx::TsSigCoeffGroup( sigLeft + sigAbove ); -#endif } @@ -179,25 +137,13 @@ void DeriveCtx::CtxSplit( const CodingStructure& cs, Partitioner& partitioner, u { const Position pos = partitioner.currArea().blocks[partitioner.chType]; const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx(); -#if JVET_N0857_TILES_BRICKS const unsigned curTileIdx = cs.picture->brickMap->getBrickIdxRsMap( partitioner.currArea().lumaPos() ); -#else - const unsigned curTileIdx = cs.picture->tileMap->getTileIdxMap( partitioner.currArea().lumaPos() ); -#endif // get left depth -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit* cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), pos, curSliceIdx, curTileIdx, partitioner.chType ); -#else - const CodingUnit* cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), curSliceIdx, curTileIdx, partitioner.chType ); -#endif // get above depth -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit* cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), pos, curSliceIdx, curTileIdx, partitioner.chType ); -#else - const CodingUnit* cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), curSliceIdx, curTileIdx, partitioner.chType ); -#endif bool canSplit[6]; @@ -307,11 +253,7 @@ unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, unsigned DeriveCtx::CtxInterDir( const PredictionUnit& pu ) { -#if JVET_N0462_FIX_CTX_MODELING return ( 7 - ((g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1) >> 1) ); -#else - return Clip3( 0, 3, 7 - ( ( g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1 ) >> 1 ) ); // VG-ASYMM DONE -#endif } unsigned DeriveCtx::CtxAffineFlag( const CodingUnit& cu ) @@ -344,37 +286,6 @@ unsigned DeriveCtx::CtxSkipFlag( const CodingUnit& cu ) } -#if !JVET_N600_AMVR_TPM_CTX_REDUCTION -unsigned DeriveCtx::CtxIMVFlag( const CodingUnit& cu ) -{ - const CodingStructure *cs = cu.cs; - unsigned ctxId = 0; - - // Get BCBP of left PU - const CodingUnit *cuLeft = cs->getCURestricted( cu.lumaPos().offset( -1, 0 ), cu, CH_L ); - ctxId = ( cuLeft && cuLeft->imv ) ? 1 : 0; - - // Get BCBP of above PU - const CodingUnit *cuAbove = cs->getCURestricted( cu.lumaPos().offset( 0, -1 ), cu, CH_L ); - ctxId += ( cuAbove && cuAbove->imv ) ? 1 : 0; - - return ctxId; -} - -unsigned DeriveCtx::CtxTriangleFlag( const CodingUnit& cu ) -{ - const CodingStructure *cs = cu.cs; - unsigned ctxId = 0; - - const CodingUnit *cuLeft = cs->getCURestricted( cu.lumaPos().offset( -1, 0 ), cu, CH_L ); - ctxId = ( cuLeft && cuLeft->triangle ) ? 1 : 0; - - const CodingUnit *cuAbove = cs->getCURestricted( cu.lumaPos().offset( 0, -1 ), cu, CH_L ); - ctxId += ( cuAbove && cuAbove->triangle ) ? 1 : 0; - - return ctxId; -} -#endif unsigned DeriveCtx::CtxPredModeFlag( const CodingUnit& cu ) { @@ -402,9 +313,7 @@ unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu) void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) { CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" ); -#if JVET_N0324_REGULAR_MRG_FLAG pu.regularMergeFlag = !(pu.mhIntraFlag || pu.cu->triangle); -#endif pu.mergeFlag = true; pu.mmvdMergeFlag = false; pu.interDir = interDirNeighbours[candIdx]; @@ -486,7 +395,6 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) { const int scale = PU::getDistScaleFactor(currPoc, poc0, currPoc, poc1); tempMv[1] = tempMv[0]; -#if JVET_N0332_LTRP_MMVD_FIX const bool isL0RefLongTerm = slice.getRefPic(REF_PIC_LIST_0, refList0)->longTerm; const bool isL1RefLongTerm = slice.getRefPic(REF_PIC_LIST_1, refList1)->longTerm; if (isL0RefLongTerm || isL1RefLongTerm) @@ -501,13 +409,11 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) } } else -#endif tempMv[0] = tempMv[1].scaleMv(scale); } else { const int scale = PU::getDistScaleFactor(currPoc, poc1, currPoc, poc0); -#if JVET_N0332_LTRP_MMVD_FIX const bool isL0RefLongTerm = slice.getRefPic(REF_PIC_LIST_0, refList0)->longTerm; const bool isL1RefLongTerm = slice.getRefPic(REF_PIC_LIST_1, refList1)->longTerm; if (isL0RefLongTerm || isL1RefLongTerm) @@ -522,7 +428,6 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) } } else -#endif tempMv[1] = tempMv[0].scaleMv(scale); } @@ -584,9 +489,7 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.mmvdMergeFlag = true; pu.mmvdMergeIdx = candIdx; pu.mergeFlag = true; -#if JVET_N0324_REGULAR_MRG_FLAG pu.regularMergeFlag = false; -#endif pu.mergeIdx = candIdx; pu.mergeType = MRG_TYPE_DEFAULT_N; pu.mvd[REF_PIC_LIST_0] = Mv(); @@ -598,7 +501,6 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.cu->GBiIdx = (interDirNeighbours[fPosBaseIdx] == 3) ? GBiIdx[fPosBaseIdx] : GBI_DEFAULT; -#if JVET_N0334_MVCLIPPING for (int refList = 0; refList < 2; refList++) { if (pu.refIdx[refList] >= 0) @@ -606,13 +508,11 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.mv[refList].clipToStorageBitDepth(); } } -#endif PU::restrictBiPredMergeCandsOne(pu); } -#if JVET_N0217_MATRIX_INTRAPRED unsigned DeriveCtx::CtxMipFlag( const CodingUnit& cu ) { const CodingStructure *cs = cu.cs; @@ -628,4 +528,3 @@ unsigned DeriveCtx::CtxMipFlag( const CodingUnit& cu ) return ctxId; } -#endif diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index 1a6a67bbe758eb3e353233eab95d06107d205990..18e2654ac39f0ae733ca79805216f5f53043953a 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -51,26 +51,16 @@ struct CoeffCodingContext { public: -#if HEVC_USE_SIGN_HIDING -#if JVET_N0413_RDPCM CoeffCodingContext( const TransformUnit& tu, ComponentID component, bool signHide, bool bdpcm = false ); -#else - CoeffCodingContext( const TransformUnit& tu, ComponentID component, bool signHide); -#endif -#else - CoeffCodingContext( const TransformUnit& tu, ComponentID component ); -#endif public: void initSubblock ( int SubsetId, bool sigGroupFlag = false ); public: void resetSigGroup () { m_sigCoeffGroupFlag.reset( m_subSetPos ); } void setSigGroup () { m_sigCoeffGroupFlag.set( m_subSetPos ); } -#if JVET_N0280_RESIDUAL_CODING_TS bool noneSigGroup () { return m_sigCoeffGroupFlag.none(); } int lastSubSet () { return ( maxNumCoeff() - 1 ) >> log2CGSize(); } bool isLastSubSet () { return lastSubSet() == m_subSetId; } bool only1stSigGroup () { return m_sigCoeffGroupFlag.count()-m_sigCoeffGroupFlag[lastSubSet()]==0; } -#endif void setScanPosLast ( int posLast ) { m_scanPosLast = posLast; } public: ComponentID compID () const { return m_compID; } @@ -93,11 +83,9 @@ public: bool isNotFirst () const { return ( m_subSetId != 0 ); } bool isSigGroup(int scanPosCG) const { return m_sigCoeffGroupFlag[m_scanCG[scanPosCG].idx]; } bool isSigGroup () const { return m_sigCoeffGroupFlag[ m_subSetPos ]; } -#if HEVC_USE_SIGN_HIDING bool signHiding () const { return m_signHiding; } bool hideSign ( int posFirst, int posLast ) const { return ( m_signHiding && ( posLast - posFirst >= SBH_THRESHOLD ) ); } -#endif CoeffScanType scanType () const { return m_scanType; } unsigned blockPos(int scanPos) const { return m_scan[scanPos].idx; } unsigned posX(int scanPos) const { return m_scan[scanPos].x; } @@ -106,17 +94,11 @@ public: unsigned maxLastPosY () const { return m_maxLastPosY; } unsigned lastXCtxId ( unsigned posLastX ) const { return m_CtxSetLastX( m_lastOffsetX + ( posLastX >> m_lastShiftX ) ); } unsigned lastYCtxId ( unsigned posLastY ) const { return m_CtxSetLastY( m_lastOffsetY + ( posLastY >> m_lastShiftY ) ); } -#if JVET_N0280_RESIDUAL_CODING_TS bool isContextCoded () { return --m_remainingContextBins >= 0; } int numCtxBins () const { return m_remainingContextBins; } void setNumCtxBins ( int n ) { m_remainingContextBins = n; } unsigned sigGroupCtxId ( bool ts = false ) const { return ts ? m_sigGroupCtxIdTS : m_sigGroupCtxId; } -#else - unsigned sigGroupCtxId () const { return m_sigGroupCtxId; } -#endif -#if JVET_N0413_RDPCM bool bdpcm () const { return m_bdpcm; } -#endif unsigned sigCtxIdAbs( int scanPos, const TCoeff* coeff, const int state ) { const uint32_t posY = m_scan[scanPos].y; @@ -171,11 +153,7 @@ public: unsigned parityCtxIdAbs ( uint8_t offset ) const { return m_parFlagCtxSet ( offset ); } unsigned greater1CtxIdAbs ( uint8_t offset ) const { return m_gtxFlagCtxSet[1]( offset ); } unsigned greater2CtxIdAbs ( uint8_t offset ) const { return m_gtxFlagCtxSet[0]( offset ); } -#if JVET_N0188_UNIFY_RICEPARA unsigned templateAbsSum( int scanPos, const TCoeff* coeff, int baseLevel ) -#else - unsigned templateAbsSum( int scanPos, const TCoeff* coeff ) -#endif { const uint32_t posY = m_scan[scanPos].y; const uint32_t posX = m_scan[scanPos].x; @@ -201,14 +179,9 @@ public: sum += abs(pData[m_width << 1]); } } -#if JVET_N0188_UNIFY_RICEPARA return std::max(std::min(sum - 5 * baseLevel, 31), 0); -#else - return std::min(sum, 31); -#endif } -#if JVET_N0280_RESIDUAL_CODING_TS unsigned sigCtxIdAbsTS( int scanPos, const TCoeff* coeff ) { const uint32_t posY = m_scan[scanPos].y; @@ -257,7 +230,6 @@ public: return auiGoRicePars[ std::min(sum, 31) ]; } -#endif private: // constant @@ -273,9 +245,7 @@ private: const unsigned m_log2BlockWidth; const unsigned m_log2BlockHeight; const unsigned m_maxNumCoeff; -#if HEVC_USE_SIGN_HIDING const bool m_signHiding; -#endif const bool m_extendedPrecision; const int m_maxLog2TrDynamicRange; CoeffScanType m_scanType; @@ -304,17 +274,13 @@ private: CtxSet m_sigFlagCtxSet[3]; CtxSet m_parFlagCtxSet; CtxSet m_gtxFlagCtxSet[2]; -#if JVET_N0280_RESIDUAL_CODING_TS unsigned m_sigGroupCtxIdTS; CtxSet m_tsSigFlagCtxSet; CtxSet m_tsParFlagCtxSet; CtxSet m_tsGtxFlagCtxSet; int m_remainingContextBins; -#endif std::bitset m_sigCoeffGroupFlag; -#if JVET_N0413_RDPCM const bool m_bdpcm; -#endif }; @@ -380,18 +346,10 @@ void CtxSplit ( const CodingStructure& cs, Partitioner& partitioner, uns unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf = false, const int ispIdx = 0 ); unsigned CtxInterDir ( const PredictionUnit& pu ); unsigned CtxSkipFlag ( const CodingUnit& cu ); -#if !JVET_N600_AMVR_TPM_CTX_REDUCTION -unsigned CtxIMVFlag ( const CodingUnit& cu ); -#endif unsigned CtxAffineFlag( const CodingUnit& cu ); -#if !JVET_N600_AMVR_TPM_CTX_REDUCTION -unsigned CtxTriangleFlag( const CodingUnit& cu ); -#endif unsigned CtxPredModeFlag( const CodingUnit& cu ); unsigned CtxIBCFlag(const CodingUnit& cu); -#if JVET_N0217_MATRIX_INTRAPRED unsigned CtxMipFlag ( const CodingUnit& cu ); -#endif } #endif // __CONTEXTMODELLING__ diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 314fecd673398a61baa8576aeac714287de5130d..6f68221e92fcf9bf0a20cad26ddd546a8075383a 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -245,7 +245,6 @@ const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet { 5, }, }); -#if JVET_N0324_REGULAR_MRG_FLAG const CtxSet ContextSetCfg::RegularMergeFlag = ContextSetCfg::addCtxSet ({ { 142, 125, }, @@ -253,7 +252,6 @@ const CtxSet ContextSetCfg::RegularMergeFlag = ContextSetCfg::addCtxSet { CNU, CNU, }, { 4, 4, }, }); -#endif const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet ({ @@ -311,7 +309,6 @@ const CtxSet ContextSetCfg::IntraLumaMpmFlag = ContextSetCfg::addCtxSet { 6, }, }); -#if JVET_N0185_UNIFIED_MPM const CtxSet ContextSetCfg::IntraLumaPlanarFlag = ContextSetCfg::addCtxSet ({ { 125, 125, }, @@ -319,7 +316,6 @@ const CtxSet ContextSetCfg::IntraLumaPlanarFlag = ContextSetCfg::addCtxSet { 110, 154, }, { 4, 5, }, }); -#endif const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet ({ @@ -329,7 +325,6 @@ const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet { 5, 8, 8, }, }); -#if JVET_N0217_MATRIX_INTRAPRED const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet ({ { 181, 182, 183, 152, }, @@ -345,7 +340,6 @@ const CtxSet ContextSetCfg::MipMode = ContextSetCfg::addCtxSet { 182, }, { 9, }, }); -#endif const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet ({ @@ -397,18 +391,10 @@ const CtxSet ContextSetCfg::AffMergeIdx = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::GBiIdx = ContextSetCfg::addCtxSet ({ -#if JVET_N0286_SIMPLIFIED_GBI_IDX { 228, }, { 228, }, { CNU, }, { 4, }, -#else - // 4 ctx for 1st bin; 1 ctx for each of rest bins - { 228, CNU, CNU, CNU, 125, 155, 175, }, - { 242, CNU, CNU, CNU, 154, 170, 237, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { 4, DWS, DWS, DWS, 4, 0, 0, }, -#endif }); const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet @@ -419,7 +405,6 @@ const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet { 9, 5, }, }); -#if JVET_N0413_RDPCM const CtxSet ContextSetCfg::BDPCMMode = ContextSetCfg::addCtxSet ({ { 148, 154, }, @@ -427,7 +412,6 @@ const CtxSet ContextSetCfg::BDPCMMode = ContextSetCfg::addCtxSet { 40, 169, }, { 1, 4, }, }); -#endif const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet ({ @@ -439,7 +423,6 @@ const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::QtCbf[] = { -#if JVET_N0413_RDPCM ContextSetCfg::addCtxSet ({ { 142, 127, 124, 140, 111, }, @@ -447,15 +430,6 @@ const CtxSet ContextSetCfg::QtCbf[] = { CNU, 126, 124, 111, 138, }, { 1, 5, 8, 8, 1, }, }), -#else - ContextSetCfg::addCtxSet - ({ - { 141, 127, 139, 140, }, - { 142, 127, 139, 140, }, - { CNU, 111, 124, 111, }, - { 1, 5, 9, 8, }, - }), -#endif ContextSetCfg::addCtxSet ({ { 163, 135, }, @@ -662,22 +636,13 @@ const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet { DWS, }, }); -#if JVET_N0193_LFNST const CtxSet ContextSetCfg::LFNSTIdx = ContextSetCfg::addCtxSet ( { -#if JVET_N0105_LFNST_CTX_MODELLING { 184, CNU, }, { 155, CNU, }, { 169, 155, }, { 8, 8, }, -#else - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, }, -#endif } ); -#endif const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet ({ @@ -769,17 +734,10 @@ const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet ({ -#if JVET_N600_AMVR_TPM_CTX_REDUCTION { 212, 180, 183, 242, }, { 213, 166, 198, 244, }, { CNU, 182, CNU, CNU, }, { 1, 5, 1, 0, }, -#else - { 212, 199, 215, 180, 183, 242, }, - { 213, 229, 244, 166, 198, 244, }, - { CNU, CNU, CNU, 152, CNU, CNU, }, - { 1, 4, 4, 5, 1, 0, }, -#endif }); const CtxSet ContextSetCfg::ctbAlfFlag = ContextSetCfg::addCtxSet @@ -790,7 +748,6 @@ const CtxSet ContextSetCfg::ctbAlfFlag = ContextSetCfg::addCtxSet { 0, 0, 0, 0, 0, 0, 0, 0, 0, }, }); -#if JVET_N0415_CTB_ALF const CtxSet ContextSetCfg::AlfUseLatestFilt = ContextSetCfg::addCtxSet ({ { 169, }, @@ -806,7 +763,6 @@ const CtxSet ContextSetCfg::AlfUseTemporalFilt = ContextSetCfg::addCtxSet { CNU, }, { 0, }, }); -#endif const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet ({ @@ -816,32 +772,7 @@ const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet { 0, }, }); -#if !JVET_N0302_SIMPLFIED_CIIP -const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet -({ - { 156, CNU, CNU, CNU, }, - { 156, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, }, - { 9, DWS, DWS, DWS, }, -}); -#endif -#if !JVET_N0324_REGULAR_MRG_FLAG -const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet -({ -#if JVET_N600_AMVR_TPM_CTX_REDUCTION - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -#else - { 149, 123, 123, }, - { 151, 152, 138, }, - { CNU, CNU, CNU, }, - { 8, 12, 9, }, -#endif -}); -#endif const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet ({ @@ -851,7 +782,6 @@ const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet { 1, 5, 8, }, }); -#if JVET_N0054_JOINT_CHROMA const CtxSet ContextSetCfg::JointCbCrFlag = ContextSetCfg::addCtxSet ({ { 156, }, @@ -859,9 +789,7 @@ const CtxSet ContextSetCfg::JointCbCrFlag = ContextSetCfg::addCtxSet { 184, }, { 1, }, }); -#endif -#if JVET_N0280_RESIDUAL_CODING_TS const CtxSet ContextSetCfg::TsSigCoeffGroup = ContextSetCfg::addCtxSet ({ { 123, 139, 155, }, @@ -898,20 +826,12 @@ const CtxSet ContextSetCfg::TsResidualSign = { ContextSetCfg::addCtxSet ({ -#if JVET_N0413_RDPCM { 154, 154, }, { 139, 154, }, { 124, 139, }, { 1, 2, }, -#else - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -#endif }), }; -#endif // clang-format on const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size(); @@ -920,9 +840,7 @@ const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_Ini // combined sets const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::SaoTypeIdx }; -#if JVET_N0415_CTB_ALF const CtxSet ContextSetCfg::Alf = { ContextSetCfg::ctbAlfFlag, ContextSetCfg::AlfUseLatestFilt, ContextSetCfg::AlfUseTemporalFilt }; -#endif template CtxStore::CtxStore() diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index 842899bd484705a608bfc9aa8f2d382d6d5e83ca..db3d89db53fe4d7de8a989098a41bb03307e4655 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -201,21 +201,15 @@ public: static const CtxSet Split12Flag; static const CtxSet SkipFlag; static const CtxSet MergeFlag; -#if JVET_N0324_REGULAR_MRG_FLAG static const CtxSet RegularMergeFlag; -#endif static const CtxSet MergeIdx; static const CtxSet PredMode; static const CtxSet MultiRefLineIdx; static const CtxSet IntraLumaMpmFlag; -#if JVET_N0185_UNIFIED_MPM static const CtxSet IntraLumaPlanarFlag; -#endif static const CtxSet IntraChromaPredMode; -#if JVET_N0217_MATRIX_INTRAPRED static const CtxSet MipFlag; static const CtxSet MipMode; -#endif static const CtxSet DeltaQP; static const CtxSet InterDir; static const CtxSet RefPic; @@ -226,9 +220,7 @@ public: static const CtxSet AffineType; static const CtxSet AffMergeIdx; static const CtxSet Mvd; -#if JVET_N0413_RDPCM static const CtxSet BDPCMMode; -#endif static const CtxSet QtRootCbf; static const CtxSet QtCbf [3]; // [ channel ] static const CtxSet SigCoeffGroup [2]; // [ ChannelType ] @@ -237,21 +229,17 @@ public: static const CtxSet SigFlag [6]; // [ ChannelType + State ] static const CtxSet ParFlag [2]; // [ ChannelType ] static const CtxSet GtxFlag [4]; // [ ChannelType + x ] -#if JVET_N0280_RESIDUAL_CODING_TS static const CtxSet TsSigCoeffGroup; static const CtxSet TsSigFlag; static const CtxSet TsParFlag; static const CtxSet TsGtxFlag; static const CtxSet TsResidualSign; -#endif static const CtxSet MVPIdx; static const CtxSet SaoMergeFlag; static const CtxSet SaoTypeIdx; static const CtxSet MTSIndex; static const CtxSet TransquantBypassFlag; -#if JVET_N0193_LFNST static const CtxSet LFNSTIdx; -#endif static const CtxSet RdpcmFlag; static const CtxSet RdpcmDir; static const CtxSet SbtFlag; @@ -264,24 +252,14 @@ public: static const CtxSet ImvFlag; static const CtxSet GBiIdx; static const CtxSet ctbAlfFlag; -#if JVET_N0415_CTB_ALF static const CtxSet AlfUseLatestFilt; static const CtxSet AlfUseTemporalFilt; static const CtxSet Alf; -#endif static const CtxSet MHIntraFlag; -#if !JVET_N0302_SIMPLFIED_CIIP - static const CtxSet MHIntraPredMode; -#endif -#if !JVET_N0324_REGULAR_MRG_FLAG - static const CtxSet TriangleFlag; -#endif static const CtxSet SmvdFlag; static const CtxSet IBCFlag; static const CtxSet ISPMode; -#if JVET_N0054_JOINT_CHROMA static const CtxSet JointCbCrFlag; -#endif static const unsigned NumberOfContexts; // combined sets for less complex copying diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 5bd804176b33217b89d7cfa637e04daa58db3ed8..a682bad02c55a0b79a01b4818a08e1211a8b7786 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -128,13 +128,8 @@ namespace DQIntern Rom() : m_scansInitialized(false) {} ~Rom() { xUninitScanArrays(); } void init () { xInitScanArrays(); } -#if JVET_N0103_CGSIZE_HARMONIZATION const NbInfoSbb* getNbInfoSbb( int hd, int vd ) const { return m_scanId2NbInfoSbbArray[hd][vd]; } const NbInfoOut* getNbInfoOut( int hd, int vd ) const { return m_scanId2NbInfoOutArray[hd][vd]; } -#else - const NbInfoSbb* getNbInfoSbb( int hd, int vd, int ch ) const { return m_scanId2NbInfoSbbArray[hd][vd][ch]; } - const NbInfoOut* getNbInfoOut( int hd, int vd, int ch ) const { return m_scanId2NbInfoOutArray[hd][vd][ch]; } -#endif const TUParameters* getTUPars ( const CompArea& area, const ComponentID compID ) const { return m_tuParameters[g_aucLog2[area.width]][g_aucLog2[area.height]][toChannelType(compID)]; @@ -144,13 +139,8 @@ namespace DQIntern void xUninitScanArrays (); private: bool m_scansInitialized; -#if JVET_N0103_CGSIZE_HARMONIZATION NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ]; NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ]; -#else - NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; - NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; -#endif TUParameters* m_tuParameters [ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; }; @@ -167,10 +157,6 @@ namespace DQIntern uint32_t raster2id[ MAX_CU_SIZE * MAX_CU_SIZE ]; ::memset(raster2id, 0, sizeof(raster2id)); -#if !JVET_N0103_CGSIZE_HARMONIZATION - for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) - { -#endif for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) { for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) @@ -181,28 +167,17 @@ namespace DQIntern } const uint32_t blockWidth = (1 << hd); const uint32_t blockHeight = (1 << vd); -#if JVET_N0103_CGSIZE_HARMONIZATION const uint32_t log2CGWidth = g_log2SbbSize[hd][vd][0]; const uint32_t log2CGHeight = g_log2SbbSize[hd][vd][1]; -#else - const uint32_t log2CGWidth = g_log2SbbSize[ch][hd][vd][0]; - const uint32_t log2CGHeight = g_log2SbbSize[ch][hd][vd][1]; -#endif const uint32_t groupWidth = 1 << log2CGWidth; const uint32_t groupHeight = 1 << log2CGHeight; const uint32_t groupSize = groupWidth * groupHeight; const CoeffScanType scanType = SCAN_DIAG; const SizeType blkWidthIdx = gp_sizeIdxInfo->idxFrom( blockWidth ); const SizeType blkHeightIdx = gp_sizeIdxInfo->idxFrom( blockHeight ); -#if JVET_N0103_CGSIZE_HARMONIZATION const ScanElement * scanId2RP = g_scanOrder[SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx]; NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd]; NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd]; -#else - const ScanElement * scanId2RP = g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx]; - NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd][ch]; - NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd][ch]; -#endif // consider only non-zero-out region const uint32_t blkWidthNZOut = std::min( JVET_C0024_ZERO_OUT_TH, blockWidth ); const uint32_t blkHeightNZOut= std::min( JVET_C0024_ZERO_OUT_TH, blockHeight ); @@ -312,19 +287,12 @@ namespace DQIntern nbOut.maxDist -= scanId; } -#if JVET_N0103_CGSIZE_HARMONIZATION for( int chId = 0; chId < MAX_NUM_CHANNEL_TYPE; chId++ ) { m_tuParameters[hd][vd][chId] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(chId) ); } -#else - m_tuParameters[hd][vd][ch] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(ch) ); -#endif } } -#if !JVET_N0103_CGSIZE_HARMONIZATION - } -#endif m_scansInitialized = true; } @@ -334,7 +302,6 @@ namespace DQIntern { return; } -#if JVET_N0103_CGSIZE_HARMONIZATION for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) { for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) @@ -359,32 +326,6 @@ namespace DQIntern } } } -#else - for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) - { - for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) - { - for( int ch = 0; ch < 2; ch++ ) - { - NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd][ch]; - NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd][ch]; - TUParameters*& tuPars = m_tuParameters [hd][vd][ch]; - if( sId2NbSbb ) - { - delete [] sId2NbSbb; - } - if( sId2NbOut ) - { - delete [] sId2NbOut; - } - if( tuPars ) - { - delete tuPars; - } - } - } - } -#endif m_scansInitialized = false; } @@ -400,44 +341,25 @@ namespace DQIntern const uint32_t nonzeroWidth = std::min(JVET_C0024_ZERO_OUT_TH, m_width); const uint32_t nonzeroHeight = std::min(JVET_C0024_ZERO_OUT_TH, m_height); m_numCoeff = nonzeroWidth * nonzeroHeight; -#if JVET_N0103_CGSIZE_HARMONIZATION m_log2SbbWidth = g_log2SbbSize[ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0]; m_log2SbbHeight = g_log2SbbSize[ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1]; -#else - m_log2SbbWidth = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0]; - m_log2SbbHeight = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1]; -#endif m_log2SbbSize = m_log2SbbWidth + m_log2SbbHeight; m_sbbSize = ( 1 << m_log2SbbSize ); m_sbbMask = m_sbbSize - 1; m_widthInSbb = nonzeroWidth >> m_log2SbbWidth; m_heightInSbb = nonzeroHeight >> m_log2SbbHeight; m_numSbb = m_widthInSbb * m_heightInSbb; -#if HEVC_USE_MDCS -#error "MDCS is not supported" // use different function... - // m_scanType = CoeffScanType( TU::getCoefScanIdx( tu, m_compID ) ); -#else m_scanType = SCAN_DIAG; -#endif SizeType hsbb = gp_sizeIdxInfo->idxFrom( m_widthInSbb ); SizeType vsbb = gp_sizeIdxInfo->idxFrom( m_heightInSbb ); SizeType hsId = gp_sizeIdxInfo->idxFrom( m_width ); SizeType vsId = gp_sizeIdxInfo->idxFrom( m_height ); -#if JVET_N0103_CGSIZE_HARMONIZATION m_scanSbbId2SbbPos = g_scanOrder [ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ]; m_scanId2BlkPos = g_scanOrder [ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ]; int log2W = g_aucLog2[ m_width ]; int log2H = g_aucLog2[ m_height ]; m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H ); m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H ); -#else - m_scanSbbId2SbbPos = g_scanOrder [ chType ][ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ]; - m_scanId2BlkPos = g_scanOrder [ chType ][ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ]; - int log2W = g_aucLog2[ m_width ]; - int log2H = g_aucLog2[ m_height ]; - m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H, chType ); - m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H, chType ); -#endif m_scanInfo = new ScanInfo[ m_numCoeff ]; for( int scanIdx = 0; scanIdx < m_numCoeff; scanIdx++ ) { @@ -594,11 +516,7 @@ namespace DQIntern int32_t* lastBits = ( xy ? m_lastBitsY : m_lastBitsX ); const unsigned size = ( xy ? tuPars.m_height : tuPars.m_width ); const unsigned log2Size = g_aucNextLog2[ size ]; -#if HEVC_USE_MDCS - const bool useYCtx = ( m_scanType == SCAN_VER ? ( xy == 0 ) : ( xy != 0 ) ); -#else const bool useYCtx = ( xy != 0 ); -#endif const CtxSet& ctxSetLast = ( useYCtx ? Ctx::LastY : Ctx::LastX )[ chType ]; const unsigned lastShift = ( compID == COMPONENT_Y ? (log2Size+1)>>2 : Clip3(0,2,size>>3) ); const unsigned lastOffset = ( compID == COMPONENT_Y ? ( prefixCtx[log2Size] ) : 0 ); @@ -702,21 +620,13 @@ namespace DQIntern { public: Quantizer() {} -#if JVET_N0847_SCALING_LISTS void dequantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, CoeffBuf& recCoeff, bool enableScalingLists, int* piDequantCoef ) const; void initQuantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, const double lambda, int gValue ); inline void preQuantCoeff( const TCoeff absCoeff, PQData *pqData, int quanCoeff ) const; -#else - void dequantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, CoeffBuf& recCoeff) const; - void initQuantBlock( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, const double lambda ); - inline void preQuantCoeff(const TCoeff absCoeff, PQData *pqData) const; -#endif inline TCoeff getLastThreshold() const { return m_thresLast; } inline TCoeff getSSbbThreshold() const { return m_thresSSbb; } -#if JVET_N0847_SCALING_LISTS inline int64_t getQScale() const { return m_QScale; } -#endif private: // quantization int m_QShift; @@ -746,15 +656,8 @@ namespace DQIntern } return y; } -#if JVET_N0847_SCALING_LISTS void Quantizer::initQuantBlock(const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, const double lambda, int gValue = -1) -#else - void Quantizer::initQuantBlock( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, const double lambda ) -#endif { -#if HEVC_USE_SCALING_LISTS && !JVET_N0847_SCALING_LISTS - CHECK ( tu.cs->sps->getScalingListFlag(), "Scaling lists not supported" ); -#endif CHECKD( lambda <= 0.0, "Lambda must be greater than 0" ); const int qpDQ = cQP.Qp + 1; @@ -767,54 +670,21 @@ namespace DQIntern const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange( chType ); const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange ); const bool clipTransformShift = ( tu.mtsIdx==MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needsSqrt2ScaleAdjustment = TU::needsSqrt2Scale(tu, compID); const int transformShift = ( clipTransformShift ? std::max( 0, nomTransformShift ) : nomTransformShift ) + (needsSqrt2ScaleAdjustment?-1:0); -#else - const int transformShift = ( clipTransformShift ? std::max( 0, nomTransformShift ) : nomTransformShift ); -#endif // quant parameters m_QShift = QUANT_SHIFT - 1 + qpPer + transformShift; m_QAdd = -( ( 3 << m_QShift ) >> 1 ); -#if JVET_N0246_MODIFIED_QUANTSCALES Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift; m_QScale = g_quantScales[needsSqrt2ScaleAdjustment?1:0][ qpRem ]; -#else // JVET_N0246_MODIFIED_QUANTSCALES -#if HM_QTBT_AS_IN_JEM_QUANT - Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( tu, compID ) ? ADJ_DEQUANT_SHIFT : 0 ); - m_QScale = ( TU::needsSqrt2Scale( tu, compID ) ? ( g_quantScales[ qpRem ] * 181 ) >> 7 : g_quantScales[ qpRem ] ); -#else - Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift; - m_QScale = g_quantScales [ qpRem ]; -#endif -#endif // JVET_N0246_MODIFIED_QUANTSCALES const unsigned qIdxBD = std::min( maxLog2TrDynamicRange + 1, 8*sizeof(Intermediate_Int) + invShift - IQUANT_SHIFT - 1 ); m_maxQIdx = ( 1 << (qIdxBD-1) ) - 4; -#if JVET_N0847_SCALING_LISTS m_thresLast = TCoeff((int64_t(3) << m_QShift)); m_thresSSbb = TCoeff((int64_t(3) << m_QShift)); -#else - m_thresLast = TCoeff( ( int64_t(3) << m_QShift ) / ( 4 * m_QScale ) ); - m_thresSSbb = TCoeff( ( int64_t(3) << m_QShift ) / ( 4 * m_QScale ) ); -#endif // distortion calculation parameters -#if JVET_N0246_MODIFIED_QUANTSCALES -#if JVET_N0847_SCALING_LISTS const int64_t qScale = (gValue==-1) ? m_QScale : gValue; -#else - const int64_t qScale = m_QScale; -#endif const int nomDShift = SCALE_BITS - 2 * (nomTransformShift + DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)) + m_QShift + (needsSqrt2ScaleAdjustment ? 1 : 0); -#else // JVET_N0246_MODIFIED_QUANTSCALES - const int64_t qScale = g_quantScales[ qpRem ]; -#if HM_QTBT_AS_IN_JEM_QUANT - const int nomDShift = SCALE_BITS - 2 * (nomTransformShift + DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)) + m_QShift; -#else - const int nomDShift = SCALE_BITS - 2 * (nomTransformShift + DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)) - + m_QShift + (TU::needsQP3Offset(tu, compID) ? 1 : 0); -#endif -#endif // JVET_N0246_MODIFIED_QUANTSCALES const double qScale2 = double( qScale * qScale ); const double nomDistFactor = ( nomDShift < 0 ? 1.0/(double(int64_t(1)<<(-nomDShift))*qScale2*lambda) : double(int64_t(1)<sps->getScalingListFlag(), "Scaling lists not supported" ); -#endif //----- set basic parameters ----- const CompArea& area = tu.blocks[ compID ]; const int numCoeff = area.area(); const SizeType hsId = gp_sizeIdxInfo->idxFrom( area.width ); const SizeType vsId = gp_sizeIdxInfo->idxFrom( area.height ); -#if HEVC_USE_MDCS - const CoeffScanType scanType = CoeffScanType( TU::getCoefScanIdx( tu, compID ) ); -#else const CoeffScanType scanType = SCAN_DIAG; -#endif -#if JVET_N0103_CGSIZE_HARMONIZATION const ScanElement *scan = g_scanOrder[SCAN_GROUPED_4x4][scanType][hsId][vsId]; -#else - const ScanElement *scan = g_scanOrder[toChannelType(compID)][SCAN_GROUPED_4x4][scanType][hsId][vsId]; -#endif const TCoeff* qCoeff = tu.getCoeffs( compID ).buf; TCoeff* tCoeff = recCoeff.buf; @@ -881,36 +736,11 @@ namespace DQIntern const TCoeff maxTCoeff = ( 1 << maxLog2TrDynamicRange ) - 1; const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange ); const bool clipTransformShift = ( tu.mtsIdx==MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needsSqrt2ScaleAdjustment = TU::needsSqrt2Scale(tu, compID); const int transformShift = ( clipTransformShift ? std::max( 0, nomTransformShift ) : nomTransformShift ) + (needsSqrt2ScaleAdjustment?-1:0); -#if JVET_N0847_SCALING_LISTS Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); -#else - Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift; -#endif Intermediate_Int invQScale = g_invQuantScales[needsSqrt2ScaleAdjustment?1:0][ qpRem ]; -#else // JVET_N0246_MODIFIED_QUANTSCALES - const int transformShift = ( clipTransformShift ? std::max( 0, nomTransformShift ) : nomTransformShift ); -#if HM_QTBT_AS_IN_JEM_QUANT - Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( tu, compID ) ? ADJ_DEQUANT_SHIFT : 0 ); - Intermediate_Int invQScale = g_invQuantScales[ qpRem ] * ( TU::needsSqrt2Scale( tu, compID ) ? 181 : 1 ); -#else - Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift; - Intermediate_Int invQScale = g_invQuantScales[ qpRem ]; -#endif -#endif // JVET_N0246_MODIFIED_QUANTSCALES -#if JVET_N0847_SCALING_LISTS Intermediate_Int add = (shift < 0) ? 0 : ((1 << shift) >> 1); -#else - if( shift < 0 ) - { - invQScale <<= -shift; - shift = 0; - } - Intermediate_Int add = ( 1 << shift ) >> 1; - -#endif //----- dequant coefficients ----- for( int state = 0, scanIdx = lastScanIdx; scanIdx >= 0; scanIdx-- ) { @@ -918,7 +748,6 @@ namespace DQIntern const TCoeff& level = qCoeff[ rasterPos ]; if( level ) { -#if JVET_N0847_SCALING_LISTS if (enableScalingLists) invQScale = piDequantCoef[rasterPos];//scalingfactor*levelScale if (shift < 0) @@ -927,7 +756,6 @@ namespace DQIntern shift = 0; //add = (1 << shift) >> 1; } -#endif Intermediate_Int qIdx = ( level << 1 ) + ( level > 0 ? -(state>>1) : (state>>1) ); Intermediate_Int nomTCoeff = ( qIdx * invQScale + add ) >> shift; tCoeff[ rasterPos ] = (TCoeff)Clip3( minTCoeff, maxTCoeff, nomTCoeff ); @@ -936,17 +764,9 @@ namespace DQIntern } } -#if JVET_N0847_SCALING_LISTS inline void Quantizer::preQuantCoeff(const TCoeff absCoeff, PQData *pqData, int quanCoeff) const -#else - inline void Quantizer::preQuantCoeff(const TCoeff absCoeff, PQData *pqData) const -#endif { -#if JVET_N0847_SCALING_LISTS int64_t scaledOrg = int64_t( absCoeff ) * quanCoeff; -#else - int64_t scaledOrg = int64_t( absCoeff ) * m_QScale; -#endif TCoeff qIdx = std::max( 1, std::min( m_maxQIdx, TCoeff( ( scaledOrg + m_QAdd ) >> m_QShift ) ) ); int64_t scaledAdd = qIdx * m_DistStepAdd - scaledOrg * m_DistOrgFact; PQData& pq_a = pqData[ qIdx & 3 ]; @@ -1050,17 +870,12 @@ namespace DQIntern m_goRiceZero = 0; } -#if JVET_N0193_LFNST void checkRdCosts( const ScanPosType spt, const PQData& pqDataA, const PQData& pqDataB, Decision& decisionA, Decision& decisionB, bool zeroOut ) const -#else - void checkRdCosts( const ScanPosType spt, const PQData& pqDataA, const PQData& pqDataB, Decision& decisionA, Decision& decisionB) const -#endif { const int32_t* goRiceTab = g_goRiceBits[m_goRicePar]; int64_t rdCostA = m_rdCost + pqDataA.deltaDist; int64_t rdCostB = m_rdCost + pqDataB.deltaDist; int64_t rdCostZ = m_rdCost; -#if JVET_N0193_LFNST if( zeroOut ) { rdCostZ = m_rdCost; @@ -1096,7 +911,6 @@ namespace DQIntern } else { -#endif if( m_remRegBins >= 4 ) { if( pqDataA.absLevel < 4 ) @@ -1160,9 +974,7 @@ namespace DQIntern decisionB.absLevel = pqDataB.absLevel; decisionB.prevId = m_stateId; } -#if JVET_N0193_LFNST } -#endif } inline void checkRdCostStart(int32_t lastOffset, const PQData &pqData, Decision &decision) const @@ -1249,13 +1061,6 @@ namespace DQIntern m_goRicePar = prvState->m_goRicePar; if( m_remRegBins >= 4 ) { -#if !JVET_N0188_UNIFY_RICEPARA - TCoeff rem = (decision.absLevel - 4) >> 1; - if( m_goRicePar < 3 && rem > (3<m_absLevelsAndCtxInit, 48*sizeof(uint8_t) ); @@ -1272,9 +1077,6 @@ namespace DQIntern { m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - (decision.absLevel < 2 ? decision.absLevel : 3); } -#if !JVET_N0188_UNIFY_RICEPARA - m_goRicePar = ( ((decision.absLevel - 4) >> 1) > (3<<0)-1 ? 1 : 0 ); -#endif ::memset( m_absLevelsAndCtxInit, 0, 48*sizeof(uint8_t) ); } @@ -1322,7 +1124,6 @@ namespace DQIntern m_sigFracBits = m_sigFracBitsArray[scanInfo.sigCtxOffsetNext + (sumAbs1 < 5 ? sumAbs1 : 5)]; m_coeffFracBits = m_gtxFracBitsArray[scanInfo.gtxCtxOffsetNext + (sumGt1 < 4 ? sumGt1 : 4)]; -#if JVET_N0188_UNIFY_RICEPARA TCoeff sumAbs = m_absLevelsAndCtxInit[8 + scanInfo.nextInsidePos] >> 8; #define UPDATE(k) {TCoeff t=levels[scanInfo.nextNbInfoSbb.inPos[k]]; sumAbs+=t; } if (numIPos == 1) @@ -1358,7 +1159,6 @@ namespace DQIntern #undef UPDATE int sumAll = std::max(std::min(31, (int)sumAbs - 4 * 5), 0); m_goRicePar = g_auiGoRiceParsCoeff[sumAll]; -#endif } else { @@ -1523,22 +1323,12 @@ namespace DQIntern public: DepQuant(); -#if JVET_N0847_SCALING_LISTS void quant ( TransformUnit& tu, const CCoeffBuf& srcCoeff, const ComponentID compID, const QpParam& cQP, const double lambda, const Ctx& ctx, TCoeff& absSum, bool enableScalingLists, int* quantCoeff ); void dequant ( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP, bool enableScalingLists, int* quantCoeff ); -#else - void quant ( TransformUnit& tu, const CCoeffBuf& srcCoeff, const ComponentID compID, const QpParam& cQP, const double lambda, const Ctx& ctx, TCoeff& absSum ); - void dequant ( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP ) const; -#endif private: -#if JVET_N0847_SCALING_LISTS void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff); void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, int quantCoeff ); -#else - void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut ); - void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut ); -#endif private: CommonCtx m_commonCtx; @@ -1565,17 +1355,9 @@ namespace DQIntern #undef TINIT -#if JVET_N0847_SCALING_LISTS void DepQuant::dequant( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP, bool enableScalingLists, int* piDequantCoef ) -#else - void DepQuant::dequant( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP ) const -#endif { -#if JVET_N0847_SCALING_LISTS m_quant.dequantBlock( tu, compID, cQP, recCoeff, enableScalingLists, piDequantCoef ); -#else - m_quant.dequantBlock( tu, compID, cQP, recCoeff ); -#endif } @@ -1584,48 +1366,19 @@ namespace DQIntern #undef DINIT -#if JVET_N0847_SCALING_LISTS void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, int quanCoeff) -#else - void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut) -#endif { ::memcpy( decisions, startDec, 8*sizeof(Decision) ); -#if !JVET_N0193_LFNST - if( zeroOut ) - { - if( spt==SCAN_EOCSBB ) - { - m_skipStates[0].checkRdCostSkipSbbZeroOut( decisions[0] ); - m_skipStates[1].checkRdCostSkipSbbZeroOut( decisions[1] ); - m_skipStates[2].checkRdCostSkipSbbZeroOut( decisions[2] ); - m_skipStates[3].checkRdCostSkipSbbZeroOut( decisions[3] ); - } - return; - } -#endif PQData pqData[4]; -#if JVET_N0847_SCALING_LISTS m_quant.preQuantCoeff( absCoeff, pqData, quanCoeff ); -#else - m_quant.preQuantCoeff( absCoeff, pqData ); -#endif -#if JVET_N0193_LFNST m_prevStates[0].checkRdCosts( spt, pqData[0], pqData[2], decisions[0], decisions[2], zeroOut ); m_prevStates[1].checkRdCosts( spt, pqData[0], pqData[2], decisions[2], decisions[0], zeroOut ); m_prevStates[2].checkRdCosts( spt, pqData[3], pqData[1], decisions[1], decisions[3], zeroOut ); m_prevStates[3].checkRdCosts( spt, pqData[3], pqData[1], decisions[3], decisions[1], zeroOut ); -#else - m_prevStates[0].checkRdCosts( spt, pqData[0], pqData[2], decisions[0], decisions[2]); - m_prevStates[1].checkRdCosts( spt, pqData[0], pqData[2], decisions[2], decisions[0]); - m_prevStates[2].checkRdCosts( spt, pqData[3], pqData[1], decisions[1], decisions[3]); - m_prevStates[3].checkRdCosts( spt, pqData[3], pqData[1], decisions[3], decisions[1]); -#endif if( spt==SCAN_EOCSBB ) { -#if JVET_N0193_LFNST if( zeroOut ) { m_skipStates[0].checkRdCostSkipSbbZeroOut( decisions[0] ); @@ -1635,41 +1388,26 @@ namespace DQIntern } else { -#endif m_skipStates[0].checkRdCostSkipSbb( decisions[0] ); m_skipStates[1].checkRdCostSkipSbb( decisions[1] ); m_skipStates[2].checkRdCostSkipSbb( decisions[2] ); m_skipStates[3].checkRdCostSkipSbb( decisions[3] ); -#if JVET_N0193_LFNST } -#endif } -#if JVET_N0193_LFNST if( !zeroOut ) { -#endif m_startState.checkRdCostStart( lastOffset, pqData[0], decisions[0] ); m_startState.checkRdCostStart( lastOffset, pqData[2], decisions[2] ); -#if JVET_N0193_LFNST } -#endif } -#if JVET_N0847_SCALING_LISTS void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff ) -#else - void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut ) -#endif { Decision* decisions = m_trellis[ scanInfo.scanIdx ]; std::swap( m_prevStates, m_currStates ); -#if JVET_N0847_SCALING_LISTS xDecide( scanInfo.spt, absCoeff, lastOffset(scanInfo.scanIdx), decisions, zeroOut, quantCoeff ); -#else - xDecide( scanInfo.spt, absCoeff, lastOffset(scanInfo.scanIdx), decisions, zeroOut ); -#endif if( scanInfo.scanIdx ) { @@ -1682,11 +1420,7 @@ namespace DQIntern m_currStates[3].updateStateEOS( scanInfo, m_prevStates, m_skipStates, decisions[3] ); ::memcpy( decisions+4, decisions, 4*sizeof(Decision) ); } -#if !JVET_N0193_LFNST - else if( !zeroOut ) -#else else -#endif { switch( scanInfo.nextNbInfoSbb.num ) { @@ -1736,11 +1470,7 @@ namespace DQIntern } -#if JVET_N0847_SCALING_LISTS void DepQuant::quant( TransformUnit& tu, const CCoeffBuf& srcCoeff, const ComponentID compID, const QpParam& cQP, const double lambda, const Ctx& ctx, TCoeff& absSum, bool enableScalingLists, int* quantCoeff ) -#else - void DepQuant::quant( TransformUnit& tu, const CCoeffBuf& srcCoeff, const ComponentID compID, const QpParam& cQP, const double lambda, const Ctx& ctx, TCoeff& absSum ) -#endif { CHECKD( tu.cs->sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag(), "ext precision is not supported" ); @@ -1753,13 +1483,10 @@ namespace DQIntern ::memset( tu.getCoeffs( compID ).buf, 0x00, numCoeff*sizeof(TCoeff) ); absSum = 0; -#if JVET_N0193_LFNST const CompArea& area = tu.blocks[ compID ]; const uint32_t width = area.width; const uint32_t height = area.height; const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#endif -#if JVET_N0847_SCALING_LISTS //===== scaling matrix ==== //const int qpDQ = cQP.Qp + 1; //const int qpPer = qpDQ / 6; @@ -1776,22 +1503,16 @@ namespace DQIntern zeroOut = (effHeight < tuPars.m_height || effWidth < tuPars.m_width); } zeroOutforThres = zeroOut || (32 < tuPars.m_height || 32 < tuPars.m_width); -#endif //===== find first test position ===== int firstTestPos = numCoeff - 1; -#if JVET_N0193_LFNST if( lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) ) { firstTestPos = 7; } -#endif -#if JVET_N0847_SCALING_LISTS const TCoeff defaultQuantisationCoefficient = (TCoeff)m_quant.getQScale(); -#endif const TCoeff thres = m_quant.getLastThreshold(); for( ; firstTestPos >= 0; firstTestPos-- ) { -#if JVET_N0847_SCALING_LISTS if (zeroOutforThres && (tuPars.m_scanId2BlkPos[firstTestPos].x >= ((tuPars.m_width == 32 && zeroOut) ? 16 : 32) || tuPars.m_scanId2BlkPos[firstTestPos].y >= ((tuPars.m_height == 32 && zeroOut) ? 16 : 32))) continue; @@ -1799,9 +1520,6 @@ namespace DQIntern : TCoeff(thres / (4 * defaultQuantisationCoefficient)); if (abs(tCoeff[tuPars.m_scanId2BlkPos[firstTestPos].idx]) > thresTmp) -#else - if (abs(tCoeff[tuPars.m_scanId2BlkPos[firstTestPos].idx]) > thres) -#endif { break; } @@ -1820,25 +1538,13 @@ namespace DQIntern } m_startState.init(); -#if !JVET_N0847_SCALING_LISTS - int effWidth = tuPars.m_width, effHeight = tuPars.m_height; - bool zeroOut = false; - if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) - { - effHeight = ( tuPars.m_height == 32 ) ? 16 : tuPars.m_height; - effWidth = ( tuPars.m_width == 32 ) ? 16 : tuPars.m_width; - zeroOut = ( effHeight < tuPars.m_height || effWidth < tuPars.m_width ); - } -#endif //===== populate trellis ===== for( int scanIdx = firstTestPos; scanIdx >= 0; scanIdx-- ) { const ScanInfo& scanInfo = tuPars.m_scanInfo[ scanIdx ]; -#if JVET_N0193_LFNST bool lfnstZeroOut = lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 && ( ( ( ( width >= 8 && height >= 8 ) && scanIdx >= 16 ) || ( ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) && scanIdx >= 8 ) ) && scanIdx < 48 ); -#if JVET_N0847_SCALING_LISTS if (enableScalingLists) { m_quant.initQuantBlock(tu, compID, cQP, lambda, quantCoeff[scanInfo.rasterPos]); @@ -1846,12 +1552,6 @@ namespace DQIntern } else xDecideAndUpdate( abs( tCoeff[scanInfo.rasterPos]), scanInfo, (zeroOut && (scanInfo.posX >= effWidth || scanInfo.posY >= effHeight)) || lfnstZeroOut, defaultQuantisationCoefficient ); -#else - xDecideAndUpdate( abs( tCoeff[ scanInfo.rasterPos ] ), scanInfo, ( zeroOut && ( scanInfo.posX >= effWidth || scanInfo.posY >= effHeight ) ) || lfnstZeroOut ); -#endif -#else - xDecideAndUpdate( abs( tCoeff[ scanInfo.rasterPos ] ), scanInfo, zeroOut && ( scanInfo.posX >= effWidth || scanInfo.posY >= effHeight ) ); -#endif } //===== find best path ===== @@ -1902,13 +1602,8 @@ DepQuant::~DepQuant() void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx ) { -#if JVET_N0280_RESIDUAL_CODING_TS if( tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID)) ) -#else - if( tu.cs->slice->getDepQuantEnabledFlag() ) -#endif { -#if JVET_N0847_SCALING_LISTS //===== scaling matrix ==== const int qpDQ = cQP.Qp + 1; const int qpPer = qpDQ / 6; @@ -1922,9 +1617,6 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff const uint32_t log2TrHeight = g_aucLog2[height]; const bool enableScalingLists = getUseScalingList(width, height, tu.mtsIdx == MTS_SKIP); static_cast(p)->quant( tu, pSrc, compID, cQP, Quant::m_dLambda, ctx, uiAbsSum, enableScalingLists, Quant::getQuantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); -#else - static_cast(p)->quant( tu, pSrc, compID, cQP, Quant::m_dLambda, ctx, uiAbsSum ); -#endif } else { @@ -1934,13 +1626,8 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const ComponentID &compID, const QpParam &cQP ) { -#if JVET_N0280_RESIDUAL_CODING_TS if( tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID)) ) -#else - if( tu.cs->slice->getDepQuantEnabledFlag() ) -#endif { -#if JVET_N0847_SCALING_LISTS const int qpDQ = cQP.Qp + 1; const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; @@ -1954,9 +1641,6 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP)); static_cast(p)->dequant( tu, dstCoeff, compID, cQP, enableScalingLists, Quant::getDequantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); -#else - static_cast(p)->dequant( tu, dstCoeff, compID, cQP ); -#endif } else { diff --git a/source/Lib/CommonLib/Hash.cpp b/source/Lib/CommonLib/Hash.cpp index 86806b62c16fc7a2de53faea8ccfa38291656668..27b64987ea9c2f32bb8c6b69053228a19097eb73 100644 --- a/source/Lib/CommonLib/Hash.cpp +++ b/source/Lib/CommonLib/Hash.cpp @@ -109,12 +109,10 @@ TComHash::TComHash() { m_lookupTable = NULL; tableHasContent = false; -#if JVET_N0247_HASH_IMPROVE for (int i = 0; i < 5; i++) { hashPic[i] = NULL; } -#endif } TComHash::~TComHash() @@ -126,7 +124,6 @@ TComHash::~TComHash() m_lookupTable = NULL; } } -#if JVET_N0247_HASH_IMPROVE void TComHash::create(int picWidth, int picHeight) { if (m_lookupTable) @@ -144,15 +141,6 @@ void TComHash::create(int picWidth, int picHeight) { return; } -#else -void TComHash::create() -{ - if (m_lookupTable != NULL) - { - clearAll(); - return; - } -#endif int maxAddr = 1 << (m_CRCBits + m_blockSizeBits); m_lookupTable = new std::vector*[maxAddr]; memset(m_lookupTable, 0, sizeof(std::vector*) * maxAddr); @@ -161,7 +149,6 @@ void TComHash::create() void TComHash::clearAll() { -#if JVET_N0247_HASH_IMPROVE if (hashPic[0]) { for (int k = 0; k < 5; k++) @@ -170,7 +157,6 @@ void TComHash::clearAll() hashPic[k] = NULL; } } -#endif tableHasContent = false; if (m_lookupTable == NULL) { @@ -286,85 +272,6 @@ void TComHash::generateBlock2x2HashValue(const PelUnitBuf &curPicBuf, int picWid delete[] p; } -#if !JVET_N0247_HASH_IMPROVE -void TComHash::generateRectangleHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3]) -{ - //at present, only support 1:2(2:1) retangle hash value - CHECK(width != (height << 1) && (width << 1) != height, "Wrong") - bool isHorizontal = width == (height << 1) ? true : false; - - int xEnd = picWidth - width + 1; - int yEnd = picHeight - height + 1; - - int srcWidth = width >> 1; - int quadWidth = width >> 2; - int srcHeight = height >> 1; - int quadHeight = height >> 2; - - int length = 2 * sizeof(uint32_t); - uint32_t* p = new uint32_t[2]; - int pos = 0; - if (isHorizontal) - { - for (int yPos = 0; yPos < yEnd; yPos++) - { - for (int xPos = 0; xPos < xEnd; xPos++) - { - p[0] = srcPicBlockHash[0][pos]; - p[1] = srcPicBlockHash[0][pos + srcWidth]; - dstPicBlockHash[0][pos] = TComHash::getCRCValue1((unsigned char*)p, length); - - p[0] = srcPicBlockHash[1][pos]; - p[1] = srcPicBlockHash[1][pos + srcWidth]; - dstPicBlockHash[1][pos] = TComHash::getCRCValue2((unsigned char*)p, length); - - dstPicBlockSameInfo[0][pos] = srcPicBlockSameInfo[0][pos] && srcPicBlockSameInfo[0][pos + quadWidth] && srcPicBlockSameInfo[0][pos + srcWidth]; - dstPicBlockSameInfo[1][pos] = srcPicBlockSameInfo[1][pos] && srcPicBlockSameInfo[1][pos + srcWidth]; - pos++; - } - pos += width - 1; - } - } - else - { - for (int yPos = 0; yPos < yEnd; yPos++) - { - for (int xPos = 0; xPos < xEnd; xPos++) - { - p[0] = srcPicBlockHash[0][pos]; - p[1] = srcPicBlockHash[0][pos + srcHeight * picWidth]; - dstPicBlockHash[0][pos] = TComHash::getCRCValue1((unsigned char*)p, length); - - p[0] = srcPicBlockHash[1][pos]; - p[1] = srcPicBlockHash[1][pos + srcHeight * picWidth]; - dstPicBlockHash[1][pos] = TComHash::getCRCValue2((unsigned char*)p, length); - - dstPicBlockSameInfo[0][pos] = srcPicBlockSameInfo[0][pos] && srcPicBlockSameInfo[0][pos + srcHeight * picWidth]; - dstPicBlockSameInfo[1][pos] = srcPicBlockSameInfo[1][pos] && srcPicBlockSameInfo[1][pos + quadHeight * picWidth] && srcPicBlockSameInfo[1][pos + srcHeight * picWidth]; - - pos++; - } - pos += width - 1; - } - } - - int widthMinus1 = width - 1; - int heightMinus1 = height - 1; - pos = 0; - - for (int yPos = 0; yPos < yEnd; yPos++) - { - for (int xPos = 0; xPos < xEnd; xPos++) - { - dstPicBlockSameInfo[2][pos] = (!dstPicBlockSameInfo[0][pos] && !dstPicBlockSameInfo[1][pos]) || (((xPos & widthMinus1) == 0) && ((yPos & heightMinus1) == 0)); - pos++; - } - pos += width - 1; - } - - delete[] p; -} -#endif void TComHash::generateBlockHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3]) { @@ -409,21 +316,13 @@ void TComHash::generateBlockHashValue(int picWidth, int picHeight, int width, in if (width >= 4) { -#if !JVET_N0247_HASH_IMPROVE - int widthMinus1 = width - 1; - int heightMinus1 = height - 1; -#endif pos = 0; for (int yPos = 0; yPos < yEnd; yPos++) { for (int xPos = 0; xPos < xEnd; xPos++) { -#if JVET_N0247_HASH_IMPROVE dstPicBlockSameInfo[2][pos] = (!dstPicBlockSameInfo[0][pos] && !dstPicBlockSameInfo[1][pos]); -#else - dstPicBlockSameInfo[2][pos] = (!dstPicBlockSameInfo[0][pos] && !dstPicBlockSameInfo[1][pos]) || (((xPos & widthMinus1) == 0) && ((yPos & heightMinus1) == 0)); -#endif pos++; } pos += width - 1; @@ -447,18 +346,14 @@ void TComHash::addToHashMapByRowWithPrecalData(uint32_t* picHash[2], bool* picIs addValue <<= m_CRCBits; int crcMask = 1 << m_CRCBits; crcMask -= 1; -#if JVET_N0247_HASH_IMPROVE int blockIdx = g_aucLog2[width] - 2; -#endif for (int xPos = 0; xPos < xEnd; xPos++) { for (int yPos = 0; yPos < yEnd; yPos++) { int pos = yPos * picWidth + xPos; -#if JVET_N0247_HASH_IMPROVE hashPic[blockIdx][pos] = (uint16_t)(srcHash[1][pos] & crcMask); -#endif //valid data if (srcIsAdded[pos]) { @@ -606,7 +501,6 @@ bool TComHash::isBlock2x2ColSameValue(unsigned char* p, bool includeAllComponent return true; } -#if JVET_N0247_HASH_IMPROVE bool TComHash::isHorizontalPerfectLuma(const Pel* srcPel, int stride, int width, int height) { for (int i = 0; i < height; i++) @@ -637,7 +531,6 @@ bool TComHash::isVerticalPerfectLuma(const Pel* srcPel, int stride, int width, i } return true; } -#endif bool TComHash::getBlockHashValue(const PelUnitBuf &curPicBuf, int width, int height, int xStart, int yStart, const BitDepths bitDepths, uint32_t& hashValue1, uint32_t& hashValue2) { int addValue = m_blockSizeToIndex[width][height]; @@ -792,10 +685,6 @@ void TComHash::initBlockSizeToIndex() m_blockSizeToIndex[32][32] = 2; m_blockSizeToIndex[64][64] = 3; m_blockSizeToIndex[4][4] = 4; -#if !JVET_N0247_HASH_IMPROVE - m_blockSizeToIndex[4][8] = 5; - m_blockSizeToIndex[8][4] = 6; -#endif } uint32_t TComHash::getCRCValue1(unsigned char* p, int length) diff --git a/source/Lib/CommonLib/Hash.h b/source/Lib/CommonLib/Hash.h index b86322d90d05471bf50a209fc08fb41302433ed4..502c2575309e1233f66270ce9694da98290030d5 100644 --- a/source/Lib/CommonLib/Hash.h +++ b/source/Lib/CommonLib/Hash.h @@ -91,11 +91,7 @@ struct TComHash public: TComHash(); ~TComHash(); -#if JVET_N0247_HASH_IMPROVE void create(int picWidth, int picHeight); -#else - void create(); -#endif void clearAll(); void addToTable(uint32_t hashValue, const BlockHash& blockHash); int count(uint32_t hashValue); @@ -106,15 +102,10 @@ public: void generateBlock2x2HashValue(const PelUnitBuf &curPicBuf, int picWidth, int picHeight, const BitDepths bitDepths, uint32_t* picBlockHash[2], bool* picBlockSameInfo[3]); void generateBlockHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3]); -#if !JVET_N0247_HASH_IMPROVE - void generateRectangleHashValue(int picWidth, int picHeight, int width, int height, uint32_t* srcPicBlockHash[2], uint32_t* dstPicBlockHash[2], bool* srcPicBlockSameInfo[3], bool* dstPicBlockSameInfo[3]); -#endif void addToHashMapByRowWithPrecalData(uint32_t* srcHash[2], bool* srcIsSame, int picWidth, int picHeight, int width, int height); bool isInitial() { return tableHasContent; } void setInitial() { tableHasContent = true; } -#if JVET_N0247_HASH_IMPROVE uint16_t* getHashPic(int baseSize) const { return hashPic[g_aucLog2[baseSize] - 2]; } -#endif public: @@ -125,17 +116,13 @@ public: static bool isBlock2x2ColSameValue(unsigned char* p, bool includeAllComponent = true); static bool getBlockHashValue(const PelUnitBuf &curPicBuf, int width, int height, int xStart, int yStart, const BitDepths bitDepths, uint32_t& hashValue1, uint32_t& hashValue2); static void initBlockSizeToIndex(); -#if JVET_N0247_HASH_IMPROVE static bool isHorizontalPerfectLuma(const Pel* srcPel, int stride, int width, int height); static bool isVerticalPerfectLuma(const Pel* srcPel, int stride, int width, int height); -#endif private: std::vector** m_lookupTable; bool tableHasContent; -#if JVET_N0247_HASH_IMPROVE uint16_t* hashPic[5];//4x4 ~ 64x64 -#endif private: static const int m_CRCBits = 16; diff --git a/source/Lib/CommonLib/IbcHashMap.cpp b/source/Lib/CommonLib/IbcHashMap.cpp index 376f70a1b725b19a205f19fc4d32efb638faba3b..9111bdbaec8f788800f2d85fda9111077b9408bc 100644 --- a/source/Lib/CommonLib/IbcHashMap.cpp +++ b/source/Lib/CommonLib/IbcHashMap.cpp @@ -274,9 +274,7 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector& cand, // find the block with least candidates size_t minSize = MAX_UINT; unsigned int targetHashOneBlock = 0; -#if JVET_N0329_IBC_SEARCH_IMP Position targetBlockOffsetInCu(0, 0); -#endif for (SizeType y = 0; y < lumaArea.height && minSize > 1; y += MIN_PU_SIZE) { for (SizeType x = 0; x < lumaArea.width && minSize > 1; x += MIN_PU_SIZE) @@ -286,9 +284,7 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector& cand, { minSize = m_hash2Pos[hash].size(); targetHashOneBlock = hash; -#if JVET_N0329_IBC_SEARCH_IMP targetBlockOffsetInCu.repositionTo(Position(x, y)); -#endif } } } @@ -300,20 +296,12 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector& cand, // check whether whole block match for (std::vector::iterator refBlockPos = candOneBlock.begin(); refBlockPos != candOneBlock.end(); refBlockPos++) { -#if JVET_N0329_IBC_SEARCH_IMP Position topLeft = refBlockPos->offset(-targetBlockOffsetInCu.x, -targetBlockOffsetInCu.y); Position bottomRight = topLeft.offset(lumaArea.width - 1, lumaArea.height - 1); -#else - Position bottomRight = refBlockPos->offset(lumaArea.width - 1, lumaArea.height - 1); -#endif bool wholeBlockMatch = true; if (lumaArea.width > MIN_PU_SIZE || lumaArea.height > MIN_PU_SIZE) { -#if JVET_N0329_IBC_SEARCH_IMP if (!cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight || topLeft.x < 0 || topLeft.y < 0) -#else - if (!cs.isDecomp(bottomRight, cs.chType) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight) -#endif { continue; } @@ -322,33 +310,21 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector& cand, for (SizeType x = 0; x < lumaArea.width && wholeBlockMatch; x += MIN_PU_SIZE) { // whether the reference block and current block has the same hash -#if JVET_N0329_IBC_SEARCH_IMP wholeBlockMatch &= (m_pos2Hash[lumaArea.pos().y + y][lumaArea.pos().x + x] == m_pos2Hash[topLeft.y + y][topLeft.x + x]); -#else - wholeBlockMatch &= (m_pos2Hash[lumaArea.pos().y + y][lumaArea.pos().x + x] == m_pos2Hash[refBlockPos->y + y][refBlockPos->x + x]); -#endif } } } else { -#if JVET_N0329_IBC_SEARCH_IMP CHECK(topLeft != *refBlockPos, "4x4 target block should not have offset!"); if (abs(topLeft.x - lumaArea.x) > searchRange4SmallBlk || abs(topLeft.y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA)) -#else - if (abs(refBlockPos->x - lumaArea.x) > searchRange4SmallBlk || abs(refBlockPos->y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, cs.chType)) -#endif { continue; } } if (wholeBlockMatch) { -#if JVET_N0329_IBC_SEARCH_IMP cand.push_back(topLeft); -#else - cand.push_back(*refBlockPos); -#endif if (cand.size() > maxCand) { break; @@ -377,7 +353,6 @@ int IbcHashMap::getHashHitRatio(const Area& lumaArea) return 100 * hit / total; } -#if JVET_N0329_IBC_SEARCH_IMP int IbcHashMap::calHashBlkMatchPerc(const Area& lumaArea) { int maxX = std::min((int)(lumaArea.x + lumaArea.width), m_picWidth); @@ -456,5 +431,4 @@ int IbcHashMap::calHashBlkMatchPerc(const Area& lumaArea) return 100 * hit / total; } } -#endif //! \} diff --git a/source/Lib/CommonLib/IbcHashMap.h b/source/Lib/CommonLib/IbcHashMap.h index 46074a4b8c32a6a60c0378301e9ec6df9a9ffb7e..205af65ffaf31f9afa6df3d87240a51397272ac9 100644 --- a/source/Lib/CommonLib/IbcHashMap.h +++ b/source/Lib/CommonLib/IbcHashMap.h @@ -82,9 +82,7 @@ public: bool ibcHashMatch(const Area& lumaArea, std::vector& cand, const CodingStructure& cs, const int maxCand, const int searchRange4SmallBlk); int getHashHitRatio(const Area& lumaArea); -#if JVET_N0329_IBC_SEARCH_IMP int calHashBlkMatchPerc(const Area& lumaArea); -#endif #ifdef TARGET_SIMD_X86 void initIbcHashMapX86(); diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index e7e6cb5f18fc4dc94ee9623356486f630185e1fa..11593f5956d31b0436fcefbc72d93f6c5156f148 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -330,7 +330,6 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R pu.cu->affine = isAffine; } -#if JVET_N0178_IMPLICIT_BDOF_SPLIT void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/) { // compute the location of the current PU @@ -373,7 +372,6 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R } } } -#endif void InterPrediction::xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred) { // separated tree, chroma @@ -413,9 +411,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& int iRefIdx = pu.refIdx[eRefPicList]; Mv mv[3]; bool isIBC = false; -#if JVET_N0266_SMALL_BLOCKS CHECK( !CU::isIBC( *pu.cu ) && pu.lwidth() == 4 && pu.lheight() == 4, "invalid 4x4 inter blocks" ); -#endif if (CU::isIBC(*pu.cu)) { isIBC = true; @@ -471,17 +467,13 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) { const PPS &pps = *pu.cs->pps; const Slice &slice = *pu.cs->slice; -#if JVET_N0266_SMALL_BLOCKS CHECK( !pu.cu->affine && pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0 && ( pu.lwidth() + pu.lheight() == 12 ), "invalid 4x8/8x4 bi-predicted blocks" ); -#endif -#if JVET_N0146_DMVR_BDOF_CONDITION WPScalingParam *wp0; WPScalingParam *wp1; int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; int refIdx1 = pu.refIdx[REF_PIC_LIST_1]; pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0); pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); -#endif bool bioApplied = false; if (pu.cs->sps->getBDOFEnabledFlag()) @@ -492,20 +484,12 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) } else { -#if JVET_N0146_DMVR_BDOF_CONDITION const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag) && slice.getSliceType() == B_SLICE); -#else - const bool biocheck0 = !(pps.getWPBiPred() && slice.getSliceType() == B_SLICE); -#endif const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE); if (biocheck0 && biocheck1 && PU::isBiPredFromDifferentDir(pu) -#if JVET_N0266_SMALL_BLOCKS && pu.Y().height != 4 -#else - && !(pu.Y().height == 4 || (pu.Y().width == 4 && pu.Y().height == 8)) -#endif ) { bioApplied = true; @@ -572,7 +556,6 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) } } } -#if JVET_N0146_DMVR_BDOF_CONDITION CPelUnitBuf srcPred0 = ( pu.chromaFormat == CHROMA_400 ? CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvPred.Y())) : CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[0][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[0][2], pcYuvPred.Cr())) ); @@ -598,35 +581,6 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied ); } } -#else - if (dmvrApplied) - { - xProcessDMVR(pu, pcYuvPred, slice.clpRngs(), bioApplied); - } - - - CPelUnitBuf srcPred0 = ( pu.chromaFormat == CHROMA_400 ? - CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvPred.Y())) : - CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[0][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[0][2], pcYuvPred.Cr())) ); - CPelUnitBuf srcPred1 = ( pu.chromaFormat == CHROMA_400 ? - CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y())) : - CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[1][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvPred.Cr())) ); - if( pps.getWPBiPred() && slice.getSliceType() == B_SLICE ) - { - xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred ); - } - else if( pps.getUseWP() && slice.getSliceType() == P_SLICE ) - { - xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred ); - } - else - { - if (dmvrApplied == false) - { - xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied ); - } - } -#endif } void InterPrediction::xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng @@ -646,7 +600,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio int shiftHor = MV_FRACTIONAL_BITS_INTERNAL + ::getComponentScaleX(compID, chFmt); int shiftVer = MV_FRACTIONAL_BITS_INTERNAL + ::getComponentScaleY(compID, chFmt); -#if JVET_N0070_WRAPAROUND bool wrapRef = false; Mv mv(_mv); if( !isIBC && pu.cs->sps->getWrapAroundEnabledFlag() ) @@ -655,10 +608,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio } int xFrac = mv.hor & ((1 << shiftHor) - 1); int yFrac = mv.ver & ((1 << shiftVer) - 1); -#else - int xFrac = _mv.hor & ((1 << shiftHor) - 1); - int yFrac = _mv.ver & ((1 << shiftVer) - 1); -#endif if (isIBC) { xFrac = yFrac = 0; @@ -671,25 +620,13 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio CPelBuf refBuf; { -#if JVET_N0070_WRAPAROUND Position offset = pu.blocks[compID].pos().offset( mv.getHor() >> shiftHor, mv.getVer() >> shiftVer ); -#else - Position offset = pu.blocks[compID].pos().offset( _mv.getHor() >> shiftHor, _mv.getVer() >> shiftVer ); -#endif if (dmvrWidth) { -#if JVET_N0070_WRAPAROUND refBuf = refPic->getRecoBuf(CompArea(compID, chFmt, offset, Size(dmvrWidth, dmvrHeight)), wrapRef); -#else - refBuf = refPic->getRecoBuf(CompArea(compID, chFmt, offset, Size(dmvrWidth, dmvrHeight))); -#endif } else -#if JVET_N0070_WRAPAROUND refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, offset, pu.blocks[compID].size() ), wrapRef); -#else - refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, offset, pu.blocks[compID].size() ) ); -#endif } if (NULL != srcPadBuf) @@ -783,7 +720,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio } } -#if JVET_N0068_AFFINE_MEM_BW bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int d, int predType ) { int s4 = ( 4 << 11 ); @@ -823,23 +759,8 @@ bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int } return false; } -#endif void InterPrediction::xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng ) { -#if !JVET_N0196_SIX_TAP_FILTERS - if ( (pu.cu->affineType == AFFINEMODEL_6PARAM && _mv[0] == _mv[1] && _mv[0] == _mv[2]) - || (pu.cu->affineType == AFFINEMODEL_4PARAM && _mv[0] == _mv[1]) - ) - { - Mv mvTemp = _mv[0]; - clipMv( mvTemp, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); - xPredInterBlk( compID, pu, refPic, mvTemp, dstPic, bi, clpRng - , false - , false - ); - return; - } -#endif JVET_J0090_SET_REF_PICTURE( refPic, compID ); const ChromaFormat chFmt = pu.chromaFormat; @@ -858,11 +779,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio int blockHeight = AFFINE_MIN_BLOCK_SIZE; CHECK(blockWidth > (width >> iScaleX ), "Sub Block width > Block width"); -#if JVET_N0671_AFFINE CHECK(blockHeight > (height >> iScaleY), "Sub Block height > Block height"); -#else - CHECK(blockHeight > (height >> iScaleX), "Sub Block height > Block height"); -#endif //JVET_N0671_AFFINE const int MVBUFFER_SIZE = MAX_CU_SIZE / MIN_PU_SIZE; const int cxWidth = width >> iScaleX; @@ -899,12 +816,8 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio const int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; const int shift = iBit - 4 + MV_FRACTIONAL_BITS_INTERNAL; -#if JVET_N0070_WRAPAROUND bool wrapRef = false; -#endif -#if JVET_N0068_AFFINE_MEM_BW const bool subblkMVSpreadOverLimit = isSubblockVectorSpreadOverLimit( iDMvHorX, iDMvHorY, iDMvVerX, iDMvVerY, pu.interDir ); -#endif // get prediction block by block for ( int h = 0; h < cxHeight; h += blockHeight ) @@ -913,26 +826,18 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio { int iMvScaleTmpHor, iMvScaleTmpVer; -#if JVET_N0671_AFFINE if (compID == COMPONENT_Y || pu.chromaFormat == CHROMA_444) -#else - if(compID == COMPONENT_Y) -#endif //JVET_N0671_AFFINE { -#if JVET_N0068_AFFINE_MEM_BW if ( !subblkMVSpreadOverLimit ) { -#endif iMvScaleTmpHor = iMvScaleHor + iDMvHorX * (iHalfBW + w) + iDMvVerX * (iHalfBH + h); iMvScaleTmpVer = iMvScaleVer + iDMvHorY * (iHalfBW + w) + iDMvVerY * (iHalfBH + h); -#if JVET_N0068_AFFINE_MEM_BW } else { iMvScaleTmpHor = iMvScaleHor + iDMvHorX * ( cxWidth >> 1 ) + iDMvVerX * ( cxHeight >> 1 ); iMvScaleTmpVer = iMvScaleVer + iDMvHorY * ( cxWidth >> 1 ) + iDMvVerY * ( cxHeight >> 1 ); } -#endif roundAffineMv(iMvScaleTmpHor, iMvScaleTmpVer, shift); Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer); tmpMv.clipToStorageBitDepth(); @@ -944,19 +849,13 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio { m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer); -#if JVET_N0070_WRAPAROUND wrapRef = wrapClipMv( tmpMv, Position(pu.Y().x + w, pu.Y().y + h), Size(blockWidth, blockHeight), &sps); -#else - clipMv(tmpMv, Position(pu.Y().x + w, pu.Y().y + h), Size(blockWidth, blockHeight), sps); -#endif iMvScaleTmpHor = tmpMv.getHor(); iMvScaleTmpVer = tmpMv.getVer(); } else { -#if JVET_N0070_WRAPAROUND wrapRef = false; -#endif m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); iMvScaleTmpHor = std::min(iHorMax, std::max(iHorMin, iMvScaleTmpHor)); iMvScaleTmpVer = std::min(iVerMax, std::max(iVerMin, iMvScaleTmpVer)); @@ -965,25 +864,15 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio else { Mv curMv = m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE) * MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] + -#if JVET_N0671_AFFINE m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + iScaleY)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + iScaleX)]; -#else - m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)]; -#endif roundAffineMv(curMv.hor, curMv.ver, 1); if (sps.getWrapAroundEnabledFlag()) { -#if JVET_N0070_WRAPAROUND wrapRef = wrapClipMv( curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), &sps); -#else - clipMv(curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), sps); -#endif } else { -#if JVET_N0070_WRAPAROUND wrapRef = false; -#endif curMv.hor = std::min(iHorMax, std::max(iHorMin, curMv.hor)); curMv.ver = std::min(iVerMax, std::max(iVerMin, curMv.ver)); } @@ -1014,11 +903,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio yFrac = iMvScaleTmpVer & 31; } -#if JVET_N0070_WRAPAROUND const CPelBuf refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, pu.blocks[compID].offset(xInt + w, yInt + h), pu.blocks[compID] ), wrapRef ); -#else - const CPelBuf refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, pu.blocks[compID].offset(xInt + w, yInt + h), pu.blocks[compID] ) ); -#endif PelBuf &dstBuf = dstPic.bufs[compID]; if ( yFrac == 0 ) @@ -1105,11 +990,7 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf const int bitDepth = clipBitDepths.recon[toChannelType(COMPONENT_Y)]; const int shiftNum = IF_INTERNAL_PREC + 1 - bitDepth; const int offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS; -#if JVET_N0325_BDOF const int limit = (1<<(std::max(5, bitDepth - 7))); -#else - const int limit = (bitDepth>12)? 2 : ((int)1 << (4 + IF_INTERNAL_PREC - bitDepth - 5)); -#endif int* dotProductTemp1 = m_dotProduct1; int* dotProductTemp2 = m_dotProduct2; @@ -1264,7 +1145,6 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB pcYuvDst.bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]); } } -#if JVET_N0146_DMVR_BDOF_CONDITION if (pu.cs->pps->getWPBiPred()) { const int iRefIdx0 = pu.refIdx[0]; @@ -1283,9 +1163,6 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB { pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); } -#else - pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); -#endif } else if( iRefIdx0 >= 0 && iRefIdx1 < 0 ) { @@ -1353,18 +1230,13 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu else { -#if JVET_N0178_IMPLICIT_BDOF_SPLIT -#if JVET_N0266_SMALL_BLOCKS CHECK( !pu.cu->affine && pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0 && ( pu.lwidth() + pu.lheight() == 12 ), "invalid 4x8/8x4 bi-predicted blocks" ); -#endif -#if JVET_N0146_DMVR_BDOF_CONDITION WPScalingParam *wp0; WPScalingParam *wp1; int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; int refIdx1 = pu.refIdx[REF_PIC_LIST_1]; pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0); pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); -#endif bool bioApplied = false; const Slice &slice = *pu.cs->slice; if (pu.cs->sps->getBDOFEnabledFlag()) @@ -1376,20 +1248,12 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu } else { -#if JVET_N0146_DMVR_BDOF_CONDITION const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag) && slice.getSliceType() == B_SLICE); -#else - const bool biocheck0 = !(pps.getWPBiPred() && slice.getSliceType() == B_SLICE); -#endif const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE); if (biocheck0 && biocheck1 && PU::isBiPredFromDifferentDir(pu) -#if JVET_N0266_SMALL_BLOCKS && pu.Y().height != 4 -#else - && !(pu.Y().height == 4 || (pu.Y().width == 4 && pu.Y().height == 8)) -#endif ) { bioApplied = true; @@ -1416,7 +1280,6 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu xSubPuBio(pu, predBuf, eRefPicList); } else -#endif if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC) { xSubPuMC( pu, predBuf, eRefPicList ); @@ -1551,11 +1414,7 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint const int32_t ratioWH = (width > height) ? (width / height) : 1; const int32_t ratioHW = (width > height) ? 1 : (height / width); -#if JVET_N0671_INTRA_TPM_ALIGNWITH420 const bool longWeight = (compIdx == COMPONENT_Y); -#else - const bool longWeight = (compIdx == COMPONENT_Y) || ( predDst.chromaFormat == CHROMA_444 ); -#endif const int32_t weightedLength = longWeight ? 7 : 3; int32_t weightedStartPos = ( splitDir == 0 ) ? ( 0 - (weightedLength >> 1) * ratioWH ) : ( width - ((weightedLength + 1) >> 1) * ratioWH ); int32_t weightedEndPos = weightedStartPos + weightedLength * ratioWH - 1; @@ -1631,7 +1490,6 @@ void InterPrediction::xPrefetchPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPic height += (filtersize - 1); cMv += Mv(-(((filtersize >> 1) - 1) << mvshiftTemp), -(((filtersize >> 1) - 1) << mvshiftTemp)); -#if JVET_N0070_WRAPAROUND bool wrapRef = false; if( pu.cs->sps->getWrapAroundEnabledFlag() ) { @@ -1640,18 +1498,11 @@ void InterPrediction::xPrefetchPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPic else { clipMv(cMv, pu.lumaPos(), pu.lumaSize(),*pu.cs->sps); } -#else - clipMv(cMv, pu.lumaPos(), pu.lumaSize(),*pu.cs->sps); -#endif /* Pre-fetch similar to HEVC*/ { CPelBuf refBuf; Position Rec_offset = pu.blocks[compID].pos().offset(cMv.getHor() >> mvshiftTemp, cMv.getVer() >> mvshiftTemp); -#if JVET_N0070_WRAPAROUND refBuf = refPic->getRecoBuf(CompArea((ComponentID)compID, pu.chromaFormat, Rec_offset, pu.blocks[compID].size()), wrapRef); -#else - refBuf = refPic->getRecoBuf(CompArea((ComponentID)compID, pu.chromaFormat, Rec_offset, pu.blocks[compID].size())); -#endif PelBuf &dstBuf = pcPad.bufs[compID]; g_pelBufOP.copyBuffer((Pel *)refBuf.buf, refBuf.stride, ((Pel *)dstBuf.buf) + offset, dstBuf.stride, width, height); #if JVET_J0090_MEMORY_BANDWITH_MEASURE @@ -2055,19 +1906,13 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con subPu.mv[0] = mergeMv[REF_PIC_LIST_0] + pu.mvdL0SubPu[num]; subPu.mv[1] = mergeMv[REF_PIC_LIST_1] - pu.mvdL0SubPu[num]; -#if JVET_N0334_MVCLIPPING subPu.mv[0].clipToStorageBitDepth(); subPu.mv[1].clipToStorageBitDepth(); -#endif m_cYuvRefBuffSubCuDMVRL0 = m_cYuvRefBuffDMVRL0.subBuf(UnitAreaRelative(pu, subPu)); m_cYuvRefBuffSubCuDMVRL1 = m_cYuvRefBuffDMVRL1.subBuf(UnitAreaRelative(pu, subPu)); xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffSubCuDMVRL0, m_cYuvRefBuffSubCuDMVRL1, bioApplied, mergeMv); subPredBuf.bufs[COMPONENT_Y].buf = pcYuvDst.bufs[COMPONENT_Y].buf + xStart + yStart * dstStride[COMPONENT_Y]; -#if !JVET_N0671_DMVR - subPredBuf.bufs[COMPONENT_Cb].buf = pcYuvDst.bufs[COMPONENT_Cb].buf + (xStart >> 1) + ((yStart >> 1) * dstStride[COMPONENT_Cb]); - subPredBuf.bufs[COMPONENT_Cr].buf = pcYuvDst.bufs[COMPONENT_Cr].buf + (xStart >> 1) + ((yStart >> 1) * dstStride[COMPONENT_Cr]); -#else int scaleX = getComponentScaleX(COMPONENT_Cb, pu.chromaFormat); int scaleY = getComponentScaleY(COMPONENT_Cb, pu.chromaFormat); subPredBuf.bufs[COMPONENT_Cb].buf = pcYuvDst.bufs[COMPONENT_Cb].buf + (xStart >> scaleX) + ((yStart >> scaleY) * dstStride[COMPONENT_Cb]); @@ -2075,7 +1920,6 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con scaleX = getComponentScaleX(COMPONENT_Cr, pu.chromaFormat); scaleY = getComponentScaleY(COMPONENT_Cr, pu.chromaFormat); subPredBuf.bufs[COMPONENT_Cr].buf = pcYuvDst.bufs[COMPONENT_Cr].buf + (xStart >> scaleX) + ((yStart >> scaleY) * dstStride[COMPONENT_Cr]); -#endif // !JVET_N0671_DMVR xWeightedAverage(subPu, srcPred0, srcPred1, subPredBuf, subPu.cu->slice->getSPS()->getBitDepths(), subPu.cu->slice->clpRngs(), bioApplied); num++; diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 4b8a0a018d0e783e2ed65da5ae8dfaee62db1773..7aba3b9a97cf2fada55f8bfed31b2aaba6bd3f04 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -144,9 +144,7 @@ protected: static bool xCheckIdenticalMotion( const PredictionUnit& pu ); void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); -#if JVET_N0178_IMPLICIT_BDOF_SPLIT void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); -#endif void destroy(); @@ -190,9 +188,7 @@ public: #if ENABLE_SPLIT_PARALLELISM int getShareState() const { return m_shareState; } #endif -#if JVET_N0068_AFFINE_MEM_BW static bool isSubblockVectorSpreadOverLimit( int a, int b, int c, int d, int predType ); -#endif }; //! \} diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp index 0b82e157398a58b0256d6407a91af5fe16bacc69..373980494dcba3c70d7f6cc50f63b0eb95b938bf 100644 --- a/source/Lib/CommonLib/InterpolationFilter.cpp +++ b/source/Lib/CommonLib/InterpolationFilter.cpp @@ -54,7 +54,6 @@ CacheModel* InterpolationFilter::m_cacheModel; // ==================================================================================================================== // Tables // ==================================================================================================================== -#if JVET_N0196_SIX_TAP_FILTERS const TFilterCoeff InterpolationFilter::m_lumaFilter4x4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA] = { { 0, 0, 0, 64, 0, 0, 0, 0 }, @@ -74,7 +73,6 @@ const TFilterCoeff InterpolationFilter::m_lumaFilter4x4[LUMA_INTERPOLATION_FILTE { 0, 1, -3, 8, 62, -5, 1, 0 }, { 0, 1, -2, 4, 63, -3, 1, 0 } }; -#endif const TFilterCoeff InterpolationFilter::m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA] = { @@ -247,11 +245,7 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int { for (col = 0; col < width; col++) { -#if HM_JEM_CLIP_PEL dst[col] = src[col]; -#else - dst[col] = ClipPel( src[col], clpRng ); -#endif JVET_J0090_CACHE_ACCESS( &src[col], __FILE__, __LINE__ ); } @@ -595,18 +589,14 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i } else { -#if JVET_N0196_SIX_TAP_FILTERS if ((width == 4 && height == 4) || (width == 4 && height == (4 + NTAPS_LUMA - 1))) { filterHor(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter4x4[frac], biMCForDMVR); } else { -#endif filterHor(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac], biMCForDMVR); -#if JVET_N0196_SIX_TAP_FILTERS } -#endif } } else @@ -649,18 +639,14 @@ void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, i } else { -#if JVET_N0196_SIX_TAP_FILTERS if (width == 4 && height == 4) { filterVer(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter4x4[frac], biMCForDMVR); } else { -#endif filterVer(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac], biMCForDMVR); -#if JVET_N0196_SIX_TAP_FILTERS } -#endif } } else diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h index 8e9f96e87048f00f8309a607c2d683a6ba42607a..bb0d4120fb57d571e656f12cfcf1cf559c5e88d2 100644 --- a/source/Lib/CommonLib/InterpolationFilter.h +++ b/source/Lib/CommonLib/InterpolationFilter.h @@ -55,9 +55,7 @@ */ class InterpolationFilter { -#if JVET_N0196_SIX_TAP_FILTERS static const TFilterCoeff m_lumaFilter4x4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; -#endif static const TFilterCoeff m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps static const TFilterCoeff m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps static const TFilterCoeff m_bilinearFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 964c7a9115995a2e721d1c60d7ef778858d2cc7c..dc2e889026fc0fceb8ba83366d993a71ecf7652d 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -294,11 +294,7 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co const ChannelType channelType = toChannelType( compID ); const int iWidth = piPred.width; const int iHeight = piPred.height; -#if JVET_N0413_RDPCM const uint32_t uiDirMode = isLuma( compId ) && pu.cu->bdpcmMode ? BDPCM_IDX : PU::getFinalIntraMode( pu, channelType ); -#else - const uint32_t uiDirMode = PU::getFinalIntraMode( pu, channelType ); -#endif CHECK( g_aucLog2[iWidth] < 2 && pu.cs->pcv->noChroma2x2, "Size not allowed" ); CHECK( g_aucLog2[iWidth] > 7, "Size not allowed" ); @@ -317,9 +313,7 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co { case(PLANAR_IDX): xPredIntraPlanar(srcBuf, piPred); break; case(DC_IDX): xPredIntraDc(srcBuf, piPred, channelType, false); break; -#if JVET_N0413_RDPCM case(BDPCM_IDX): xPredIntraBDPCM(srcBuf, piPred, pu.cu->bdpcmMode, clpRng); break; -#endif default: xPredIntraAng(srcBuf, piPred, channelType, clpRng); break; } @@ -519,11 +513,7 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA // high level conditions and DC intra prediction if( sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag() -#if JVET_N0671_INTRA_TPM_ALIGNWITH420 || !isLuma( chType ) -#else - || ( !isLuma( chType ) && pu.chromaFormat != CHROMA_444 ) -#endif || useISP || m_ipaParam.multiRefIndex || DC_IDX == dirMode @@ -534,12 +524,10 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA m_ipaParam.interpolationFlag = (m_ipaParam.isModeVer ? puSize.width : puSize.height) > 8 ? true : false ; } } -#if JVET_N0413_RDPCM else if (isLuma( chType ) && pu.cu->bdpcmMode) // BDPCM { m_ipaParam.refFilterFlag = false; } -#endif else if (dirMode == PLANAR_IDX) // Planar intra prediction { m_ipaParam.refFilterFlag = puSize.width * puSize.height > 32 ? true : false; @@ -564,11 +552,7 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA if (filterFlag) { const bool isRefFilter = isIntegerSlope(absAng); -#if JVET_N0435_WAIP_HARMONIZATION m_ipaParam.refFilterFlag = isRefFilter && puSize.width * puSize.height > 32; -#else - m_ipaParam.refFilterFlag = isRefFilter; -#endif m_ipaParam.interpolationFlag = !isRefFilter; } } @@ -792,7 +776,6 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch } } -#if JVET_N0413_RDPCM void IntraPrediction::xPredIntraBDPCM(const CPelBuf &pSrc, PelBuf &pDst, const uint32_t dirMode, const ClpRng& clpRng ) { const int wdt = pDst.width; @@ -829,14 +812,12 @@ void IntraPrediction::xPredIntraBDPCM(const CPelBuf &pSrc, PelBuf &pDst, const u } } } -#endif bool IntraPrediction::useDPCMForFirstPassIntraEstimation(const PredictionUnit &pu, const uint32_t &uiDirMode) { return CU::isRDPCMEnabled(*pu.cu) && pu.cu->transQuantBypass && (uiDirMode == HOR_IDX || uiDirMode == VER_IDX); } -#if JVET_N0302_SIMPLFIED_CIIP void IntraPrediction::geneWeightedPred(const ComponentID compId, PelBuf &pred, const PredictionUnit &pu, Pel *srcBuf) { const int width = pred.width; @@ -877,90 +858,6 @@ void IntraPrediction::geneWeightedPred(const ComponentID compId, PelBuf &pred, c } } } -#else -void IntraPrediction::geneWeightedPred(const ComponentID compId, PelBuf &pred, const PredictionUnit &pu, Pel *srcBuf) -{ - const int width = pred.width; - const int height = pred.height; - const int srcStride = width; - const int dstStride = pred.stride; - - const uint32_t dirMode = PU::getFinalIntraMode(pu, toChannelType(compId)); - const ClpRng& clpRng(pu.cu->cs->slice->clpRng(compId)); - Pel* dstBuf = pred.buf; - int k, l; - - bool modeDC = (dirMode <= DC_IDX); - Pel wIntra1 = 6, wInter1 = 2, wIntra2 = 5, wInter2 = 3, wIntra3 = 3, wInter3 = 5, wIntra4 = 2, wInter4 = 6; - - if (modeDC || width < 4 || height < 4) - { - for (k = 0; k> 3), clpRng); - } - } - } - else - { - if (dirMode <= DIA_IDX) - { - int interval = (width >> 2); - - for (k = 0; k> 3), clpRng); - } - else if (l >= interval && l < (2 * interval)) - { - dstBuf[k*dstStride + l] = ClipPel((((dstBuf[k*dstStride + l] * wInter2) + (srcBuf[k*srcStride + l] * wIntra2)) >> 3), clpRng); - } - else if (l >= (interval * 2) && l < (3 * interval)) - { - dstBuf[k*dstStride + l] = ClipPel((((dstBuf[k*dstStride + l] * wInter3) + (srcBuf[k*srcStride + l] * wIntra3)) >> 3), clpRng); - } - else - { - dstBuf[k*dstStride + l] = ClipPel((((dstBuf[k*dstStride + l] * wInter4) + (srcBuf[k*srcStride + l] * wIntra4)) >> 3), clpRng); - } - } - } - } - else - { - int interval = (height >> 2); - for (k = 0; k> 3), clpRng); - } - else if (k >= interval && k < (2 * interval)) - { - dstBuf[k*dstStride + l] = ClipPel((((dstBuf[k*dstStride + l] * wInter2) + (srcBuf[k*srcStride + l] * wIntra2)) >> 3), clpRng); - } - else if (k >= (interval * 2) && k < (3 * interval)) - { - dstBuf[k*dstStride + l] = ClipPel((((dstBuf[k*dstStride + l] * wInter3) + (srcBuf[k*srcStride + l] * wIntra3)) >> 3), clpRng); - } - else - { - dstBuf[k*dstStride + l] = ClipPel((((dstBuf[k*dstStride + l] * wInter4) + (srcBuf[k*srcStride + l] * wIntra4)) >> 3), clpRng); - } - } - } - } - } -} -#endif void IntraPrediction::switchBuffer(const PredictionUnit &pu, ComponentID compID, PelBuf srcBuff, Pel *dst) { Pel *src = srcBuff.bufAt(0, 0); @@ -1293,43 +1190,6 @@ void IntraPrediction::xFilterReferenceSamples( const Pel* refBufUnfiltered, Pel* const int predStride = predSize + 1; -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - // Strong intra smoothing - ChannelType chType = toChannelType( area.compID ); - if( sps.getUseStrongIntraSmoothing() && isLuma( chType ) ) - { - const Pel bottomLeft = refBufUnfiltered[predStride * predHSize]; - const Pel topLeft = refBufUnfiltered[0]; - const Pel topRight = refBufUnfiltered[predSize]; - - const int threshold = 1 << (sps.getBitDepth( chType ) - 5); - const bool bilinearLeft = abs( (bottomLeft + topLeft) - (2 * refBufUnfiltered[predStride * tuHeight]) ) < threshold; //difference between the - const bool bilinearAbove = abs( (topLeft + topRight) - (2 * refBufUnfiltered[ tuWidth ]) ) < threshold; //ends and the middle - - if( tuWidth >= 32 && tuHeight >= 32 && bilinearLeft && bilinearAbove ) -#if !HEVC_USE_INTRA_SMOOTHING_T32 - if( tuWidth > 32 && tuHeight > 32 ) -#endif -#if !HEVC_USE_INTRA_SMOOTHING_T64 - if( tuWidth < 64 && tuHeight < 64 ) -#endif - { - Pel *piDestPtr = refBufFiltered + (predStride * predHSize); // bottom left - - // apply strong intra smoothing - for (int i = 0; i < predHSize; i++, piDestPtr -= predStride) //left column (bottom to top) - { - *piDestPtr = (((predHSize - i) * bottomLeft) + (i * topLeft) + predHSize / 2) / predHSize; - } - for( uint32_t i = 0; i <= predSize; i++, piDestPtr++ ) //full top row (left-to-right) - { - *piDestPtr = (((predSize - i) * topLeft) + (i * topRight) + predSize / 2) / predSize; - } - - return; - } - } -#endif // Regular reference sample filter const Pel *piSrcPtr = refBufUnfiltered + (predStride * predHSize); // bottom left @@ -1516,13 +1376,8 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom //assert 420 chroma subsampling CompArea lumaArea = CompArea( COMPONENT_Y, pu.chromaFormat, chromaArea.lumaPos(), recalcSize( pu.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, chromaArea.size() ) );//needed for correct pos/size (4x4 Tus) -#if JVET_N0671_CCLM CHECK(lumaArea.width == chromaArea.width && CHROMA_444 != pu.chromaFormat, ""); CHECK(lumaArea.height == chromaArea.height && CHROMA_444 != pu.chromaFormat && CHROMA_422 != pu.chromaFormat, ""); -#else - CHECK( lumaArea.width == chromaArea.width, "" ); - CHECK( lumaArea.height == chromaArea.height, "" ); -#endif //JVET_N0671_CCLM const SizeType uiCWidth = chromaArea.width; const SizeType uiCHeight = chromaArea.height; @@ -1530,15 +1385,11 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom const CPelBuf Src = pu.cs->picture->getRecoBuf( lumaArea ); Pel const* pRecSrc0 = Src.bufAt( 0, 0 ); int iRecStride = Src.stride; -#if JVET_N0671_CCLM int logSubWidthC = getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, pu.chromaFormat); int logSubHeightC = getChannelTypeScaleY(CHANNEL_TYPE_CHROMA, pu.chromaFormat); int iRecStride2 = iRecStride << logSubHeightC; const int mult = 1 << logSubWidthC ; -#else //!JVET_N0671_CCLM - int iRecStride2 = iRecStride << 1; -#endif //JVET_N0671_CCLM const CodingUnit& lumaCU = isChroma( pu.chType ) ? *pu.cs->picture->cs->getCU( lumaArea.pos(), CH_L ) : *pu.cu; const CodingUnit& cu = *pu.cu; @@ -1551,22 +1402,14 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom int iBaseUnitSize = ( 1 << MIN_CU_LOG2 ); const int iUnitWidth = iBaseUnitSize >> getComponentScaleX( area.compID, area.chromaFormat ); -#if JVET_N0671_CHROMA_FORMAT_422 const int iUnitHeight = iBaseUnitSize >> getComponentScaleY(area.compID, area.chromaFormat); -#else - const int iUnitHeight = iBaseUnitSize >> getComponentScaleX(area.compID, area.chromaFormat); -#endif // JVET_REXT_CLEANUP_CCLM_422 const int iTUWidthInUnits = uiTuWidth / iUnitWidth; const int iTUHeightInUnits = uiTuHeight / iUnitHeight; const int iAboveUnits = iTUWidthInUnits; const int iLeftUnits = iTUHeightInUnits; const int chromaUnitWidth = iBaseUnitSize >> getComponentScaleX(COMPONENT_Cb, area.chromaFormat); -#if JVET_N0671_CHROMA_FORMAT_422 const int chromaUnitHeight = iBaseUnitSize >> getComponentScaleY(COMPONENT_Cb, area.chromaFormat); -#else - const int chromaUnitHeight = iBaseUnitSize >> getComponentScaleX(COMPONENT_Cb, area.chromaFormat); -#endif // JVET_REXT_CLEANUP_CCLM_422 const int topTemplateSampNum = 2 * uiCWidth; // for MDLM, the number of template samples is 2W or 2H. const int leftTemplateSampNum = 2 * uiCHeight; assert(m_topRefLength >= topTemplateSampNum); @@ -1607,7 +1450,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom Pel const* piSrc = nullptr; bool isFirstRowOfCtu = ((pu.block(COMPONENT_Cb).y)&(((pu.cs->sps)->getMaxCUWidth() >> 1) - 1)) == 0; -#if JVET_N0671_CCLM const int strOffset = (CHROMA_444 == pu.chromaFormat) ? 0 : iRecStride; int c0_2tap = 1, c1_2tap = 1, offset_2tap = 1, shift_2tap = 1; //sum = 2 @@ -1617,14 +1459,12 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom switch (pu.chromaFormat) { -#if JVET_N0671_CHROMA_FORMAT_422 case CHROMA_422: //overwrite filter coefficient values for 422 c0_2tap = 1, c1_2tap = 0, offset_2tap = 0, shift_2tap = 0; //sum = 1 c0_3tap = 2, c1_3tap = 1, c2_3tap = 1, offset_3tap = 2, shift_3tap = 2; //sum = 4 c0_5tap = 0, c1_5tap = 1, c2_5tap = 0, c3_5tap = 0, c4_5tap = 0, offset_5tap = 0, shift_5tap = 0; //sum = 1 c0_6tap = 2, c1_6tap = 1, c2_6tap = 1, c3_6tap = 0, c4_6tap = 0, c5_6tap = 0, offset_6tap = 2, shift_6tap = 2; //sum = 4 break; -#endif //JVET_N0671_CHROMA_FORMAT_422 case CHROMA_444: //overwrite filter coefficient values for 422 c0_2tap = 1, c1_2tap = 0, offset_2tap = 0, shift_2tap = 0; //sum = 1 @@ -1636,7 +1476,6 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom default: break; } -#endif //JVET_N0671_CCLM if( bAboveAvaillable ) { @@ -1652,85 +1491,44 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { piSrc = pRecSrc0 - iRecStride; -#if JVET_N0671_CCLM if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC)) -#else //!JVET_N0671_CCLM - if (i == 0 && !bLeftAvaillable) -#endif //JVET_N0671_CCLM { -#if JVET_N0671_CCLM pDst[i] = piSrc[mult * i]; -#else //!JVET_N0671_CCLM - pDst[i] = piSrc[2 * i]; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst[i] = (piSrc[mult * i] * c0_3tap + piSrc[mult * i - 1] * c1_3tap + piSrc[mult * i + 1] * c2_3tap + offset_3tap) >> shift_3tap; -#else //!JVET_N0671_CCLM - pDst[i] = ( piSrc[2 * i] * 2 + piSrc[2 * i - 1] + piSrc[2 * i + 1] + 2 ) >> 2; -#endif //JVET_N0671_CCLM } } else if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { piSrc = pRecSrc0 - iRecStride2; -#if JVET_N0671_CCLM if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC)) -#else //!JVET_N0671_CCLM - if( i == 0 && !bLeftAvaillable ) -#endif //JVET_N0671_CCLM { -#if JVET_N0671_CCLM pDst[i] = (piSrc[mult * i] * c0_3tap + piSrc[mult * i - strOffset] * c1_3tap + piSrc[mult * i + strOffset] * c2_3tap + offset_3tap) >> shift_3tap; -#else //!JVET_N0671_CCLM - pDst[i] = ( piSrc[2 * i] * 2 + piSrc[2 * i - iRecStride] + piSrc[2 * i + iRecStride] + 2 ) >> 2; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst[i] = (piSrc[mult * i - strOffset] * c0_5tap + piSrc[mult * i] * c1_5tap + piSrc[mult * i - 1] * c2_5tap + piSrc[mult * i + 1] * c3_5tap + piSrc[mult * i + strOffset] * c4_5tap + offset_5tap) >> shift_5tap; -#else //!JVET_N0671_CCLM - pDst[i] = ( piSrc[2 * i - iRecStride] - + piSrc[2 * i ] * 4 + piSrc[2 * i - 1] + piSrc[2 * i + 1] - + piSrc[2 * i + iRecStride] - + 4 ) >> 3; -#endif //JVET_N0671_CCLM } } else { piSrc = pRecSrc0 - iRecStride2; -#if JVET_N0671_CCLM if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC)) -#else //!JVET_N0671_CCLM - if (i == 0 && !bLeftAvaillable) -#endif //JVET_N0671_CCLM { -#if JVET_N0671_CCLM pDst[i] = (piSrc[mult * i] * c0_2tap + piSrc[mult * i + strOffset] * c1_2tap + offset_2tap) >> shift_2tap; -#else //!JVET_N0671_CCLM - pDst[i] = ( piSrc[2 * i] + piSrc[2 * i + iRecStride] + 1 ) >> 1; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst[i] = ((piSrc[mult * i] * c0_6tap + piSrc[mult * i - 1] * c1_6tap + piSrc[mult * i + 1] * c2_6tap) + (piSrc[mult * i + strOffset] * c3_6tap + piSrc[mult * i - 1 + strOffset] * c4_6tap + piSrc[mult * i + 1 + strOffset] * c5_6tap) + offset_6tap) >> shift_6tap; -#else //!JVET_N0671_CCLM - pDst[i] = ( ( ( piSrc[2 * i ] * 2 ) + piSrc[2 * i - 1 ] + piSrc[2 * i + 1 ] ) - + ( ( piSrc[2 * i + iRecStride] * 2 ) + piSrc[2 * i - 1 + iRecStride] + piSrc[2 * i + 1 + iRecStride] ) - + 4 ) >> 3; -#endif //JVET_N0671_CCLM } } } @@ -1740,11 +1538,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { pDst = pDst0 - 1; -#if JVET_N0671_CCLM piSrc = pRecSrc0 - 2 - logSubWidthC; -#else //!JVET_N0671_CCLM - piSrc = pRecSrc0 - 3; -#endif //JVET_N0671_CCLM int addedLeftBelow = 0; if ((curChromaMode == MDLM_L_IDX) || (curChromaMode == MDLM_T_IDX)) @@ -1756,42 +1550,23 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { -#if JVET_N0671_CCLM if ((j == 0 && !bAboveAvaillable) || (j == uiCHeight + addedLeftBelow - 1 + logSubWidthC)) { pDst[0] = ( piSrc[1] * c0_3tap + piSrc[0] * c1_3tap + piSrc[2] * c2_3tap + offset_3tap) >> shift_3tap; -#else //!JVET_N0671_CCLM - if ( j == 0 && !bAboveAvaillable ) - { - pDst[0] = ( piSrc[1] * 2 + piSrc[0] + piSrc[2] + 2 ) >> 2; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst[0] = ( piSrc[1 - strOffset] * c0_5tap + piSrc[1 ] * c1_5tap + piSrc[0] * c2_5tap + piSrc[2] * c3_5tap + piSrc[1 + strOffset] * c4_5tap + offset_5tap ) >> shift_5tap; -#else //!JVET_N0671_CCLM - pDst[0] = ( piSrc[1 - iRecStride] - + piSrc[1 ] * 4 + piSrc[0] + piSrc[2] - + piSrc[1 + iRecStride] - + 4 ) >> 3; -#endif //JVET_N0671_CCLM } } else { -#if JVET_N0671_CCLM pDst[0] = ((piSrc[1] * c0_6tap + piSrc[0] * c1_6tap + piSrc[2] * c2_6tap) + (piSrc[1 + strOffset] * c3_6tap + piSrc[strOffset] * c4_6tap + piSrc[2 + strOffset] * c5_6tap) + offset_6tap) >> shift_6tap; -#else //!JVET_N0671_CCLM - pDst[0] = ( ( piSrc[1 ] * 2 + piSrc[0 ] + piSrc[2 ] ) - + ( piSrc[1 + iRecStride] * 2 + piSrc[iRecStride] + piSrc[2 + iRecStride] ) - + 4 ) >> 3; -#endif //JVET_N0671_CCLM } piSrc += iRecStride2; @@ -1810,74 +1585,37 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom { if ( j == 0 && !bAboveAvaillable ) { -#if JVET_N0671_CCLM pDst0[i] = pRecSrc0[mult * i]; -#else //!JVET_N0671_CCLM - pDst0[i] = pRecSrc0[2 * i]; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst0[i] = (pRecSrc0[mult * i] * c0_3tap + pRecSrc0[mult * i - strOffset] * c1_3tap + pRecSrc0[mult * i + strOffset] * c2_3tap + offset_3tap) >> shift_3tap; -#else //!JVET_N0671_CCLM - pDst0[i] = ( pRecSrc0[2 * i] * 2 + pRecSrc0[2 * i - iRecStride] + pRecSrc0[2 * i + iRecStride] + 2 ) >> 2; -#endif //JVET_N0671_CCLM } } -#if JVET_N0671_CCLM - else if ( j == 0 && !bAboveAvaillable ) -#else //JVET_N0671_CCLM else if ( j == 0 && !bAboveAvaillable ) -#endif //JVET_N0671_CCLM { -#if JVET_N0671_CCLM pDst0[i] = (pRecSrc0[mult * i] * c0_3tap + pRecSrc0[mult * i - 1] * c1_3tap + pRecSrc0[mult * i + 1] * c2_3tap + offset_3tap) >> shift_3tap; -#else //!JVET_N0671_CCLM - pDst0[i] = ( pRecSrc0[2 * i] * 2 + pRecSrc0[2 * i - 1] + pRecSrc0[2 * i + 1] + 2 ) >> 2; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst0[i] = (pRecSrc0[mult * i - strOffset] * c0_5tap + pRecSrc0[mult * i] * c1_5tap + pRecSrc0[mult * i - 1] * c2_5tap + pRecSrc0[mult * i + 1] * c3_5tap + pRecSrc0[mult * i + strOffset] * c4_5tap + offset_5tap) >> shift_5tap; -#else //!JVET_N0671_CCLM - pDst0[i] = ( pRecSrc0[2 * i - iRecStride] - + pRecSrc0[2 * i ] * 4 + pRecSrc0[2 * i - 1] + pRecSrc0[2 * i + 1] - + pRecSrc0[2 * i + iRecStride] - + 4 ) >> 3; -#endif //JVET_N0671_CCLM } } else { -#if JVET_N0671_CCLM if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth - 1 + logSubWidthC)) -#else //JVET_N0671_CCLM - if ( i == 0 && !bLeftAvaillable ) -#endif //JVET_N0671_CCLM { -#if JVET_N0671_CCLM pDst0[i] = (pRecSrc0[mult * i] * c0_2tap + pRecSrc0[mult * i + strOffset] * c1_2tap + offset_2tap) >> shift_2tap; -#else //!JVET_N0671_CCLM - pDst0[i] = ( pRecSrc0[2 * i] + pRecSrc0[2 * i + iRecStride] + 1 ) >> 1; -#endif //JVET_N0671_CCLM } else { -#if JVET_N0671_CCLM pDst0[i] = (pRecSrc0[mult * i] * c0_6tap + pRecSrc0[mult * i + 1] * c1_6tap + pRecSrc0[mult * i - 1] * c2_6tap + pRecSrc0[mult * i + strOffset] * c3_6tap + pRecSrc0[mult * i + 1 + strOffset] * c4_6tap + pRecSrc0[mult * i - 1 + strOffset] * c5_6tap + offset_6tap) >> shift_6tap; -#else //!JVET_N0671_CCLM - pDst0[i] = ( pRecSrc0[2 * i ] * 2 + pRecSrc0[2 * i + 1 ] + pRecSrc0[2 * i - 1 ] - + pRecSrc0[2 * i + iRecStride] * 2 + pRecSrc0[2 * i + 1 + iRecStride] + pRecSrc0[2 * i - 1 + iRecStride] - + 4 ) >> 3; -#endif //JVET_N0671_CCLM } } } @@ -1980,43 +1718,25 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component Pel *src = srcColor0 - srcStride; Pel *cur = curChroma0 - curStride; -#if !JVET_N0271_SIMPLFIED_CCLM - int minDim = 1; -#endif int actualTopTemplateSampNum = 0; int actualLeftTemplateSampNum = 0; if (curChromaMode == MDLM_T_IDX) { leftAvailable = 0; -#if JVET_N0271_SIMPLFIED_CCLM avaiAboveRightUnits = avaiAboveRightUnits > (cHeight/unitWidth) ? cHeight/unitWidth : avaiAboveRightUnits; -#endif actualTopTemplateSampNum = unitWidth*(avaiAboveUnits + avaiAboveRightUnits); -#if !JVET_N0271_SIMPLFIED_CCLM - minDim = actualTopTemplateSampNum; -#endif } else if (curChromaMode == MDLM_L_IDX) { aboveAvailable = 0; -#if JVET_N0271_SIMPLFIED_CCLM avaiLeftBelowUnits = avaiLeftBelowUnits > (cWidth/unitHeight) ? cWidth/unitHeight : avaiLeftBelowUnits; -#endif actualLeftTemplateSampNum = unitHeight*(avaiLeftUnits + avaiLeftBelowUnits); -#if !JVET_N0271_SIMPLFIED_CCLM - minDim = actualLeftTemplateSampNum; -#endif } else if (curChromaMode == LM_CHROMA_IDX) { actualTopTemplateSampNum = cWidth; actualLeftTemplateSampNum = cHeight; -#if !JVET_N0271_SIMPLFIED_CCLM - minDim = leftAvailable && aboveAvailable ? 1 << g_aucPrevLog2[std::min(actualLeftTemplateSampNum, actualTopTemplateSampNum)] - : 1 << g_aucPrevLog2[leftAvailable ? actualLeftTemplateSampNum : actualTopTemplateSampNum]; -#endif } -#if JVET_N0271_SIMPLFIED_CCLM int startPos[2]; //0:Above, 1: Left int pickStep[2]; @@ -2081,50 +1801,6 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component minLuma[1] = (selectChromaPix[tmpMinGrp[0]] + selectChromaPix[tmpMinGrp[1]] + 1) >> 1; maxLuma[0] = (selectLumaPix[tmpMaxGrp[0]] + selectLumaPix[tmpMaxGrp[1]] + 1 )>>1; maxLuma[1] = (selectChromaPix[tmpMaxGrp[0]] + selectChromaPix[tmpMaxGrp[1]] + 1) >> 1; -#else - int numSteps = minDim; - - if (aboveAvailable) - { - for (int j = 0; j < numSteps; j++) - { - int idx = (j * actualTopTemplateSampNum) / minDim; - - if (minLuma[0] > src[idx]) - { - minLuma[0] = src[idx]; - minLuma[1] = cur[idx]; - } - if (maxLuma[0] < src[idx]) - { - maxLuma[0] = src[idx]; - maxLuma[1] = cur[idx]; - } - } - } - - if (leftAvailable) - { - src = srcColor0 - 1; - cur = curChroma0 - 1; - - for (int i = 0; i < numSteps; i++) - { - int idx = (i * actualLeftTemplateSampNum) / minDim; - - if (minLuma[0] > src[srcStride * idx]) - { - minLuma[0] = src[srcStride * idx]; - minLuma[1] = cur[curStride * idx]; - } - if (maxLuma[0] < src[srcStride * idx]) - { - maxLuma[0] = src[srcStride * idx]; - maxLuma[1] = cur[curStride * idx]; - } - } - } -#endif if (leftAvailable || aboveAvailable) { @@ -2169,7 +1845,6 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component } } -#if JVET_N0217_MATRIX_INTRAPRED void IntraPrediction::initIntraMip( const PredictionUnit &pu ) { CHECK( pu.lwidth() > MIP_MAX_WIDTH || pu.lheight() > MIP_MAX_HEIGHT, "Error: block size not supported for MIP" ); @@ -2191,6 +1866,5 @@ void IntraPrediction::predIntraMip( const ComponentID compId, PelBuf &piPred, co const int bitDepth = pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); m_matrixIntraPred.predBlock( pu.Y(), pu.intraDir[CHANNEL_TYPE_LUMA], piPred, bitDepth ); } -#endif //! \} diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h index 668fdc8f8b609bc5642a84acc48f30ecf63cc25f..2d29ec29b1a692ccc97e3aa4fd494ae8fae52b3b 100644 --- a/source/Lib/CommonLib/IntraPrediction.h +++ b/source/Lib/CommonLib/IntraPrediction.h @@ -44,9 +44,7 @@ #include "Buffer.h" #include "Picture.h" -#if JVET_N0217_MATRIX_INTRAPRED #include "MatrixIntraPrediction.h" -#endif //! \ingroup CommonLib //! \{ @@ -105,9 +103,7 @@ private: Pel* m_piTemp; Pel* m_pMdlmTemp; // for MDLM mode -#if JVET_N0217_MATRIX_INTRAPRED MatrixIntraPrediction m_matrixIntraPred; -#endif protected: @@ -122,15 +118,9 @@ protected: void initPredIntraParams ( const PredictionUnit & pu, const CompArea compArea, const SPS& sps ); -#if JVET_N0435_WAIP_HARMONIZATION static bool isIntegerSlope(const int absAng) { return (0 == (absAng & 0x1F)); } -#else - static bool isIntegerSlope ( const int absAng ) { return (0 == (absAng & 0x1F)) && absAng <=32; } // integer-slope modes 2, DIA_IDX and VDIA_IDX. "absAng <=32" restricts wide-angle integer modes -#endif -#if JVET_N0413_RDPCM void xPredIntraBDPCM ( const CPelBuf &pSrc, PelBuf &pDst, const uint32_t dirMode, const ClpRng& clpRng ); -#endif Pel xGetPredValDc ( const CPelBuf &pSrc, const Size &dstSize ); void xFillReferenceSamples ( const CPelBuf &recoBuf, Pel* refBufUnfiltered, const CompArea &area, const CodingUnit &cu ); @@ -160,11 +150,9 @@ public: /// set parameters from CU data for accessing intra data void initIntraPatternChType (const CodingUnit &cu, const CompArea &area, const bool forceRefFilterFlag = false); // use forceRefFilterFlag to get both filtered and unfiltered buffers -#if JVET_N0217_MATRIX_INTRAPRED // Matrix-based intra prediction void initIntraMip (const PredictionUnit &pu); void predIntraMip (const ComponentID compId, PelBuf &piPred, const PredictionUnit &pu); -#endif static bool useDPCMForFirstPassIntraEstimation(const PredictionUnit &pu, const uint32_t &uiDirMode); diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 2e3ed1c99bbe9dda9c8b5de7e3f207d5f0c56443..88925c2020357adeb8ffae629a6514f730a6d8ee 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -148,10 +148,8 @@ void LoopFilter::loopFilterPic( CodingStructure& cs ) { const PreCalcValues& pcv = *cs.pcv; -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES m_shiftHor = ::getComponentScaleX( COMPONENT_Cb, cs.pcv->chrFormat ); m_shiftVer = ::getComponentScaleY( COMPONENT_Cb, cs.pcv->chrFormat ); -#endif DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "poc", cs.slice->getPOC() ) ) ); #if ENABLE_TRACING @@ -172,13 +170,11 @@ void LoopFilter::loopFilterPic( CodingStructure& cs { memset( m_aapucBS [EDGE_VER].data(), 0, m_aapucBS [EDGE_VER].byte_size() ); memset( m_aapbEdgeFilter[EDGE_VER].data(), false, m_aapbEdgeFilter[EDGE_VER].byte_size() ); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES memset( m_maxFilterLengthP, 0, sizeof(m_maxFilterLengthP) ); memset( m_maxFilterLengthQ, 0, sizeof(m_maxFilterLengthQ) ); memset( m_transformEdge, false, sizeof(m_transformEdge) ); m_ctuXLumaSamples = x << pcv.maxCUWidthLog2; m_ctuYLumaSamples = y << pcv.maxCUHeightLog2; -#endif const UnitArea ctuArea( pcv.chrFormat, Area( x << pcv.maxCUWidthLog2, y << pcv.maxCUHeightLog2, pcv.maxCUWidth, pcv.maxCUWidth ) ); @@ -192,11 +188,9 @@ void LoopFilter::loopFilterPic( CodingStructure& cs { memset( m_aapucBS [EDGE_VER].data(), 0, m_aapucBS [EDGE_VER].byte_size() ); memset( m_aapbEdgeFilter[EDGE_VER].data(), false, m_aapbEdgeFilter[EDGE_VER].byte_size() ); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES memset( m_maxFilterLengthP, 0, sizeof(m_maxFilterLengthP) ); memset( m_maxFilterLengthQ, 0, sizeof(m_maxFilterLengthQ) ); memset( m_transformEdge, false, sizeof(m_transformEdge) ); -#endif for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, CH_C ), CH_C ) ) { @@ -213,13 +207,11 @@ void LoopFilter::loopFilterPic( CodingStructure& cs { memset( m_aapucBS [EDGE_HOR].data(), 0, m_aapucBS [EDGE_HOR].byte_size() ); memset( m_aapbEdgeFilter[EDGE_HOR].data(), false, m_aapbEdgeFilter[EDGE_HOR].byte_size() ); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES memset( m_maxFilterLengthP, 0, sizeof(m_maxFilterLengthP) ); memset( m_maxFilterLengthQ, 0, sizeof(m_maxFilterLengthQ) ); memset( m_transformEdge, false, sizeof(m_transformEdge) ); m_ctuXLumaSamples = x << pcv.maxCUWidthLog2; m_ctuYLumaSamples = y << pcv.maxCUHeightLog2; -#endif const UnitArea ctuArea( pcv.chrFormat, Area( x << pcv.maxCUWidthLog2, y << pcv.maxCUHeightLog2, pcv.maxCUWidth, pcv.maxCUWidth ) ); @@ -233,11 +225,9 @@ void LoopFilter::loopFilterPic( CodingStructure& cs { memset( m_aapucBS [EDGE_HOR].data(), 0, m_aapucBS [EDGE_HOR].byte_size() ); memset( m_aapbEdgeFilter[EDGE_HOR].data(), false, m_aapbEdgeFilter[EDGE_HOR].byte_size() ); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES memset( m_maxFilterLengthP, 0, sizeof(m_maxFilterLengthP) ); memset( m_maxFilterLengthQ, 0, sizeof(m_maxFilterLengthQ) ); memset( m_transformEdge, false, sizeof(m_transformEdge) ); -#endif for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, CH_C ), CH_C ) ) { @@ -271,38 +261,19 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) const PreCalcValues& pcv = *cu.cs->pcv; const Area area = cu.Y().valid() ? cu.Y() : Area( recalcPosition( cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].pos() ), recalcSize( cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].size() ) ); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool horEdgeFilter = false, verEdgeFilter = false; int numHorVirBndry = 0, numVerVirBndry = 0; int horVirBndryPos[] = { 0, 0, 0 }; int verVirBndryPos[] = { 0, 0, 0 }; bool isCuCrossedByVirtualBoundaries = isCrossedByVirtualBoundaries( area.x, area.y, area.width, area.height, numHorVirBndry, numVerVirBndry, horVirBndryPos, verVirBndryPos, cu.cs->slice->getPPS() ); -#endif xSetLoopfilterParam( cu ); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES static_vector edgeIdx; edgeIdx.clear(); -#else - bool implicitTU = false; -#endif for( auto &currTU : CU::traverseTUs( cu ) ) { const Area& areaTu = cu.Y().valid() ? currTU.block( COMPONENT_Y ) : area; -#if !JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - const bool xOff = currTU.blocks[cu.chType].x != cu.blocks[cu.chType].x; - const bool yOff = currTU.blocks[cu.chType].y != cu.blocks[cu.chType].y; - if ((yOff != 0) && (edgeDir == EDGE_HOR)) - { - implicitTU = true; - } - if ((xOff != 0) && (edgeDir == EDGE_VER)) - { - implicitTU = true; - } -#endif -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND verEdgeFilter = m_stLFCUParam.internalEdge; horEdgeFilter = m_stLFCUParam.internalEdge; if( isCuCrossedByVirtualBoundaries ) @@ -311,14 +282,8 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } xSetEdgefilterMultiple( cu, EDGE_VER, areaTu, verEdgeFilter ); xSetEdgefilterMultiple( cu, EDGE_HOR, areaTu, horEdgeFilter ); -#else - xSetEdgefilterMultiple( cu, EDGE_VER, areaTu, m_stLFCUParam.internalEdge ); - xSetEdgefilterMultiple( cu, EDGE_HOR, areaTu, m_stLFCUParam.internalEdge ); -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES xSetMaxFilterLengthPQFromTransformSizes( edgeDir, cu, currTU ); edgeIdx.push_back( ( edgeDir == EDGE_HOR ) ? ( currTU.blocks[cu.chType].y - cu.blocks[cu.chType].y ) / 4 : ( currTU.blocks[cu.chType].x - cu.blocks[cu.chType].x ) / 4 ); -#endif } bool mvSubBlocks = false; @@ -329,7 +294,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) const bool xOff = currPU.blocks[cu.chType].x != cu.blocks[cu.chType].x; const bool yOff = currPU.blocks[cu.chType].y != cu.blocks[cu.chType].y; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND verEdgeFilter = (xOff ? m_stLFCUParam.internalEdge : m_stLFCUParam.leftEdge); horEdgeFilter = (yOff ? m_stLFCUParam.internalEdge : m_stLFCUParam.topEdge); if( isCuCrossedByVirtualBoundaries ) @@ -339,13 +303,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) xSetEdgefilterMultiple( cu, EDGE_VER, areaPu, verEdgeFilter, xOff ); xSetEdgefilterMultiple( cu, EDGE_HOR, areaPu, horEdgeFilter, yOff ); -#else - xSetEdgefilterMultiple( cu, EDGE_VER, areaPu, (xOff ? m_stLFCUParam.internalEdge : m_stLFCUParam.leftEdge), xOff ); - xSetEdgefilterMultiple( cu, EDGE_HOR, areaPu, (yOff ? m_stLFCUParam.internalEdge : m_stLFCUParam.topEdge), yOff ); -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES edgeIdx.push_back( ( edgeDir == EDGE_HOR ) ? ( currPU.blocks[cu.chType].y - cu.blocks[cu.chType].y ) / 4 : ( currPU.blocks[cu.chType].x - cu.blocks[cu.chType].x ) / 4 ); -#endif if ((currPU.mergeFlag && (currPU.mergeType == MRG_TYPE_SUBPU_ATMVP)) || cu.affine) { @@ -355,7 +313,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) for (uint32_t off = subBlockSize; off < areaPu.height; off += subBlockSize) { const Area mvBlockH(cu.Y().x, cu.Y().y + off, cu.Y().width, pcv.minCUHeight); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND horEdgeFilter = m_stLFCUParam.internalEdge; if( isCuCrossedByVirtualBoundaries ) { @@ -363,12 +320,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } xSetEdgefilterMultiple(cu, EDGE_HOR, mvBlockH, horEdgeFilter, 1); -#else - xSetEdgefilterMultiple(cu, EDGE_HOR, mvBlockH, m_stLFCUParam.internalEdge, 1); -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES edgeIdx.push_back( ( currPU.blocks[cu.chType].y + off - cu.blocks[cu.chType].y ) / 4 ); -#endif } } else @@ -376,7 +328,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) for (uint32_t off = subBlockSize; off < areaPu.width; off += subBlockSize) { const Area mvBlockV(cu.Y().x + off, cu.Y().y, pcv.minCUWidth, cu.Y().height); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND verEdgeFilter = m_stLFCUParam.internalEdge; if( isCuCrossedByVirtualBoundaries ) { @@ -384,80 +335,13 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } xSetEdgefilterMultiple(cu, EDGE_VER, mvBlockV, verEdgeFilter, 1); -#else - xSetEdgefilterMultiple(cu, EDGE_VER, mvBlockV, m_stLFCUParam.internalEdge, 1); -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES edgeIdx.push_back( ( currPU.blocks[cu.chType].x + off - cu.blocks[cu.chType].x ) / 4 ); -#endif - } - } - } - -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - xSetMaxFilterLengthPQForCodingSubBlocks( edgeDir, cu, currPU, mvSubBlocks, subBlockSize, areaPu ); -#endif - } -#if !JVET_N0302_SIMPLFIED_CIIP - if (cu.firstPU->mhIntraFlag) - { - const uint32_t dirMode = PU::getFinalIntraMode(*(cu.firstPU), cu.chType); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - edgeIdx.push_back( 0 ); -#endif - if (edgeDir == EDGE_VER && dirMode == HOR_IDX) - { - mvSubBlocks = true; - subBlockSize = std::max(8u, (area.width >> 2)); - for (uint32_t off = subBlockSize; off < area.width; off += subBlockSize) - { - const Area mvBlockV(cu.Y().x + off, cu.Y().y, pcv.minCUWidth, cu.Y().height); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - verEdgeFilter = m_stLFCUParam.internalEdge; - if( isCuCrossedByVirtualBoundaries ) - { - xDeriveEdgefilterParam( mvBlockV.x, mvBlockV.y, numVerVirBndry, 0, verVirBndryPos, horVirBndryPos, verEdgeFilter, horEdgeFilter ); } - - xSetEdgefilterMultiple(cu, EDGE_VER, mvBlockV, verEdgeFilter, 1); -#else - xSetEdgefilterMultiple(cu, EDGE_VER, mvBlockV, m_stLFCUParam.internalEdge, 1); -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - edgeIdx.push_back( off / 4 ); -#endif } } - else if (edgeDir == EDGE_HOR && dirMode == VER_IDX) - { - mvSubBlocks = true; - subBlockSize = std::max(8u, (area.height >> 2)); - for (uint32_t off = subBlockSize; off < area.height; off += subBlockSize) - { - const Area mvBlockH(cu.Y().x, cu.Y().y + off, cu.Y().width, pcv.minCUHeight); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - horEdgeFilter = m_stLFCUParam.internalEdge; - if( isCuCrossedByVirtualBoundaries ) - { - xDeriveEdgefilterParam( mvBlockH.x, mvBlockH.y, 0, numHorVirBndry, verVirBndryPos, horVirBndryPos, verEdgeFilter, horEdgeFilter ); - } - xSetEdgefilterMultiple(cu, EDGE_HOR, mvBlockH, horEdgeFilter, 1); -#else - xSetEdgefilterMultiple(cu, EDGE_HOR, mvBlockH, m_stLFCUParam.internalEdge, 1); -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - edgeIdx.push_back( off / 4 ); -#endif - } - } -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - const PredictionUnit& currPU = *cu.firstPU; - const Area& areaPu = cu.Y().valid() ? currPU.block( COMPONENT_Y ) : area; xSetMaxFilterLengthPQForCodingSubBlocks( edgeDir, cu, currPU, mvSubBlocks, subBlockSize, areaPu ); -#endif } -#endif const unsigned uiPelsInPart = pcv.minCUWidth; @@ -488,7 +372,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES std::sort( edgeIdx.begin(), edgeIdx.end() ); int prevEdgeIdx = -1; for ( const int& edge : edgeIdx ) @@ -511,115 +394,8 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } } } -#else - unsigned int orthogonalLength = 1; - unsigned int orthogonalIncrement = 1; -#if FIX_DB_MAX_TRANSFORM_SIZE -#if MAX_TB_SIZE_SIGNALLING - const int maxTsize = cu.slice->getSPS()->getMaxTbSize(); -#else - const int maxTsize = MAX_TB_SIZEY; -#endif -#endif -#if FIX_DB_MAX_TRANSFORM_SIZE - int maxFilterLengthQ = 7; - int maxFilterLengthP = 7; - if (implicitTU && maxTsize < 32) - { - maxFilterLengthQ = 3; - maxFilterLengthP = 3; - } -#else - int maxFilterLength = 7; -#endif - if (cu.blocks[COMPONENT_Y].valid()) - { - if (mvSubBlocks) - { -#if FIX_DB_MAX_TRANSFORM_SIZE - maxFilterLengthQ = std::min(maxFilterLengthQ, 5); -#else - maxFilterLength = 5; -#endif - orthogonalIncrement = subBlockSize / 4; - orthogonalLength = (edgeDir == EDGE_HOR) ? cu.blocks[COMPONENT_Y].height / 4 : cu.blocks[COMPONENT_Y].width / 4; - } -#if FIX_DB_MAX_TRANSFORM_SIZE - if ((cu.blocks[COMPONENT_Y].height > maxTsize) && (edgeDir == EDGE_HOR) && !mvSubBlocks) - { - orthogonalIncrement = maxTsize / 4; - orthogonalLength = cu.blocks[COMPONENT_Y].height / 4; - } - if ((cu.blocks[COMPONENT_Y].width > maxTsize) && (edgeDir == EDGE_VER) && !mvSubBlocks) - { - orthogonalIncrement = maxTsize / 4; - orthogonalLength = cu.blocks[COMPONENT_Y].width / 4; - - } -#else - if ((cu.blocks[COMPONENT_Y].height > 64) && (edgeDir == EDGE_HOR) && !mvSubBlocks) - { - orthogonalIncrement = 64 / 4; - orthogonalLength = cu.blocks[COMPONENT_Y].height / 4; - } - if ((cu.blocks[COMPONENT_Y].width > 64) && (edgeDir == EDGE_VER) && !mvSubBlocks) - { - orthogonalIncrement = 64 / 4; - orthogonalLength = cu.blocks[COMPONENT_Y].width / 4; - - } -#endif - } - - for (int edge = 0; edge < orthogonalLength; edge += orthogonalIncrement) - { - if (cu.blocks[COMPONENT_Y].valid()) - { - if (edge == 0) - { -#if FIX_DB_MAX_TRANSFORM_SIZE - xEdgeFilterLuma(cu, edgeDir, edge, maxFilterLengthP, maxFilterLengthQ); -#else - xEdgeFilterLuma(cu, edgeDir, edge, 7, maxFilterLength); -#endif - } - else - { -#if FIX_DB_MAX_TRANSFORM_SIZE - if (implicitTU && ((edge % (maxTsize / 4)) == 0)) -#else - if ( implicitTU && (edge == (64 / 4)) ) -#endif - { -#if FIX_DB_MAX_TRANSFORM_SIZE - xEdgeFilterLuma(cu, edgeDir, edge, maxFilterLengthQ, maxFilterLengthQ); -#else - xEdgeFilterLuma(cu, edgeDir, edge, maxFilterLength, maxFilterLength); -#endif - } -#if FIX_DB_MAX_TRANSFORM_SIZE - else if ((edge == 2 || edge == (orthogonalLength - 2)) || (implicitTU && (((edge - 2) % ((maxTsize) / 4) == 0) || ((edge + 2) % ((maxTsize) / 4) == 0)))) -#else - else if ( (edge == 2 || edge == (orthogonalLength - 2)) || (implicitTU && (edge == (56 / 4) || edge == (72 / 4))) ) -#endif - { - xEdgeFilterLuma(cu, edgeDir, edge, 2, 2); - } - else - { - xEdgeFilterLuma(cu, edgeDir, edge, 3, 3); - } - } - } - if (cu.blocks[COMPONENT_Cb].valid() && pcv.chrFormat != CHROMA_400) - { - xEdgeFilterChroma(cu, edgeDir, edge); - } - } -#endif } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND inline bool LoopFilter::isCrossedByVirtualBoundaries(const int xPos, const int yPos, const int width, const int height, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps) { numHorVirBndry = 0; numVerVirBndry = 0; @@ -663,9 +439,7 @@ inline void LoopFilter::xDeriveEdgefilterParam( const int xPos, const int yPos, } } } -#endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir edgeDir, const CodingUnit& cu, const TransformUnit& currTU ) { const TransformUnit& tuQ = currTU; @@ -810,7 +584,6 @@ void LoopFilter::xSetMaxFilterLengthPQForCodingSubBlocks( const DeblockEdgeDir e } } } -#endif void LoopFilter::xSetEdgefilterMultiple( const CodingUnit& cu, const DeblockEdgeDir edgeDir, @@ -850,9 +623,6 @@ void LoopFilter::xSetLoopfilterParam( const CodingUnit& cu ) m_stLFCUParam.internalEdge = true; m_stLFCUParam.leftEdge = ( 0 < pos.x ) && isAvailableLeft ( cu, *cu.cs->getCU( pos.offset( -1, 0 ), cu.chType ), !slice.getLFCrossSliceBoundaryFlag(), !pps.getLoopFilterAcrossBricksEnabledFlag() ); m_stLFCUParam.topEdge = ( 0 < pos.y ) && isAvailableAbove( cu, *cu.cs->getCU( pos.offset( 0, -1 ), cu.chType ), !slice.getLFCrossSliceBoundaryFlag(), !pps.getLoopFilterAcrossBricksEnabledFlag() ); -#if !JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES - m_stLFCUParam.internalEdge &= !cu.ispMode; -#endif } unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const Position& localPos ) const @@ -869,12 +639,10 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De const CodingUnit& cuQ = cu; const CodingUnit& cuP = *cu.cs->getCU( posP, cu.chType ); -#if JVET_N0413_RDPCM if( ( MODE_INTRA == cuP.predMode && cuP.bdpcmMode ) && ( MODE_INTRA == cuQ.predMode && cuQ.bdpcmMode ) ) { return 0; } -#endif //-- Set BS for Intra MB : BS = 4 or 3 if( ( MODE_INTRA == cuP.predMode ) || ( MODE_INTRA == cuQ.predMode ) ) @@ -1028,11 +796,7 @@ void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift, } #endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge ) -#else -void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge, const int initialMaxFilterLengthP, const int initialMaxFilterLengthQ) -#endif { const CompArea& lumaArea = cu.block(COMPONENT_Y); const PreCalcValues& pcv = *cu.cs->pcv; @@ -1090,7 +854,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge pos.x += xoffset; pos.y += yoffset; -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES // Deblock luma boundaries on 8x8 grid only if ( edgeDir == EDGE_HOR && ( pos.y % 8 ) != 0 ) { @@ -1100,7 +863,6 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge { continue; } -#endif uiBsAbsIdx = getRasterIdx( pos, pcv ); uiBs = BsGet(m_aapucBS[edgeDir][uiBsAbsIdx], COMPONENT_Y); @@ -1132,37 +894,15 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge bool sidePisLarge = false; bool sideQisLarge = false; -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES int maxFilterLengthP = m_maxFilterLengthP[COMPONENT_Y][pos.x-m_ctuXLumaSamples][pos.y-m_ctuYLumaSamples]; int maxFilterLengthQ = m_maxFilterLengthQ[COMPONENT_Y][pos.x-m_ctuXLumaSamples][pos.y-m_ctuYLumaSamples]; -#else - int maxFilterLengthP = initialMaxFilterLengthP; - int maxFilterLengthQ = initialMaxFilterLengthQ; -#endif if (maxFilterLengthP > 3) { -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES sidePisLarge = true; if ( maxFilterLengthP > 5 ) -#else - sidePisLarge = (edgeDir == EDGE_VER && cuP.block(COMPONENT_Y).width >= 32) - || (edgeDir == EDGE_HOR && cuP.block(COMPONENT_Y).height >= 32); - - if (sidePisLarge && maxFilterLengthP > 5) -#endif { // restrict filter length if sub-blocks are used (e.g affine or ATMVP) -#if JVET_N0302_SIMPLFIED_CIIP if (cuP.affine) -#else - bool ciipSubBlock = false; - if (cuP.firstPU->mhIntraFlag) - { - const uint32_t dirMode = PU::getFinalIntraMode(*(cuP.firstPU), cuP.chType); - ciipSubBlock = edgeDir == EDGE_HOR ? dirMode == VER_IDX : dirMode == HOR_IDX; - } - if (cuP.affine || ciipSubBlock) -#endif { maxFilterLengthP = std::min(maxFilterLengthP, 5); } @@ -1170,12 +910,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge } if (maxFilterLengthQ > 3) { -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES sideQisLarge = true; -#else - sideQisLarge = (edgeDir == EDGE_VER && cuQ.block(COMPONENT_Y).width >= 32) - || (edgeDir == EDGE_HOR && cuQ.block(COMPONENT_Y).height >= 32); -#endif } if (edgeDir == EDGE_HOR && pos.y % slice.getSPS()->getCTUSize() == 0) @@ -1422,7 +1157,6 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed bPartQNoFilter = bPartQNoFilter || cuQ.transQuantBypass; } -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES const int maxFilterLengthP = m_maxFilterLengthP[COMPONENT_Cb][(pos.x-m_ctuXLumaSamples)>>m_shiftHor][(pos.y-m_ctuYLumaSamples)>>m_shiftVer]; const int maxFilterLengthQ = m_maxFilterLengthQ[COMPONENT_Cb][(pos.x-m_ctuXLumaSamples)>>m_shiftHor][(pos.y-m_ctuYLumaSamples)>>m_shiftVer]; bool largeBoundary = false; @@ -1430,14 +1164,6 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed { largeBoundary = true; } -#else - const unsigned cuPWidth = cuP.block(COMPONENT_Cb).width; - const unsigned cuPHeight = cuP.block(COMPONENT_Cb).height; - const unsigned cuQWidth = cuQ.block(COMPONENT_Cb).width; - const unsigned cuQHeight = cuQ.block(COMPONENT_Cb).height; - - bool largeBoundary = ((edgeDir == EDGE_VER && cuPWidth >= 8 && cuQWidth >= 8) || (edgeDir == EDGE_HOR && cuPHeight >= 8 && cuQHeight >= 8)); -#endif if (edgeDir == EDGE_HOR && pos.y % cuP.slice->getSPS()->getCTUSize() == 0) { diff --git a/source/Lib/CommonLib/LoopFilter.h b/source/Lib/CommonLib/LoopFilter.h index b7e16d9ca5b371f36c2d4bea3c139572acc7bb55..3495d709ca16d8c7aedc388444eec6da2b89fd21 100644 --- a/source/Lib/CommonLib/LoopFilter.h +++ b/source/Lib/CommonLib/LoopFilter.h @@ -58,13 +58,11 @@ private: static_vector m_aapucBS [NUM_EDGE_DIR]; ///< Bs for [Ver/Hor][Y/U/V][Blk_Idx] static_vector m_aapbEdgeFilter[NUM_EDGE_DIR]; LFCUParam m_stLFCUParam; ///< status structure -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES int m_ctuXLumaSamples, m_ctuYLumaSamples; // location of left-edge and top-edge of CTU int m_shiftHor, m_shiftVer; // shift values to convert location from luma sample units to chroma sample units uint8_t m_maxFilterLengthP[MAX_NUM_COMPONENT][MAX_CU_SIZE][MAX_CU_SIZE]; // maxFilterLengthP for [component][luma/chroma sample distance from left edge of CTU][luma/chroma sample distance from top edge of CTU] uint8_t m_maxFilterLengthQ[MAX_NUM_COMPONENT][MAX_CU_SIZE][MAX_CU_SIZE]; // maxFilterLengthQ for [component][luma/chroma sample distance from left edge of CTU][luma/chroma sample distance from top edge of CTU] bool m_transformEdge[MAX_NUM_COMPONENT][MAX_CU_SIZE][MAX_CU_SIZE]; // transform edge flag for [component][luma/chroma sample distance from left edge of CTU][luma/chroma sample distance from top edge of CTU] -#endif PelStorage m_encPicYuvBuffer; bool m_enc; private: @@ -81,20 +79,14 @@ private: const Area& area, const bool bValue, const bool EdgeIdx = false ); -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES void xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge ); -#else - void xEdgeFilterLuma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge, const int initialMaxFilterLengthP, const int initialMaxFilterLengthQ ); -#endif void xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge); #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET void deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps ); #endif -#if JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES void xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir edgeDir, const CodingUnit& cu, const TransformUnit& currTU ); void xSetMaxFilterLengthPQForCodingSubBlocks( const DeblockEdgeDir edgeDir, const CodingUnit& cu, const PredictionUnit& currPU, const bool& mvSubBlocks, const int& subBlockSize, const Area& areaPu ); -#endif inline void xBilinearFilter ( Pel* srcP, Pel* srcQ, int offset, int refMiddle, int refP, int refQ, int numberPSide, int numberQSide, const int* dbCoeffsP, const int* dbCoeffsQ, int tc ) const; inline void xFilteringPandQ ( Pel* src, int offset, int numberPSide, int numberQSide, int tc ) const; @@ -104,10 +96,8 @@ private: inline unsigned BsSet(unsigned val, const ComponentID compIdx) const; inline unsigned BsGet(unsigned val, const ComponentID compIdx) const; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND inline bool isCrossedByVirtualBoundaries ( const int xPos, const int yPos, const int width, const int height, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps ); inline void xDeriveEdgefilterParam ( const int xPos, const int yPos, const int numVerVirBndry, const int numHorVirBndry, const int verVirBndryPos[], const int horVirBndryPos[], bool &verEdgeFilter, bool &horEdgeFilter ); -#endif inline int xCalcDP ( Pel* piSrc, const int iOffset ) const; inline int xCalcDQ ( Pel* piSrc, const int iOffset ) const; diff --git a/source/Lib/CommonLib/MCTS.cpp b/source/Lib/CommonLib/MCTS.cpp index 1c8aaca6627dac80b07a4cc074e7819c67608d12..a8eb0014984e52371dc9aeee51b95c193d8d4202 100644 --- a/source/Lib/CommonLib/MCTS.cpp +++ b/source/Lib/CommonLib/MCTS.cpp @@ -90,31 +90,17 @@ void MCTSHelper::clipMvToArea( Mv& rcMv, const Area& block, const Area& clipArea Area MCTSHelper::getTileArea( const CodingStructure* cs, const int ctuAddr ) { -#if JVET_N0857_TILES_BRICKS const BrickMap* tileMap = cs->picture->brickMap; const int tileIdx = tileMap->getBrickIdxRsMap( ctuAddr ); -#else - const TileMap* tileMap = cs->picture->tileMap; - const int tileIdx = tileMap->getTileIdxMap( ctuAddr ); -#endif -#if JVET_N0857_TILES_BRICKS const Brick& currentTile = tileMap->bricks[tileIdx]; -#else - const Tile& currentTile = tileMap->tiles[tileIdx]; -#endif const int frameWidthInCtus = cs->pcv->widthInCtus; const int firstCtuRsAddrOfTile = currentTile.getFirstCtuRsAddr(); const int tileXPosInCtus = firstCtuRsAddrOfTile % frameWidthInCtus; const int tileYPosInCtus = firstCtuRsAddrOfTile / frameWidthInCtus; -#if JVET_N0857_TILES_BRICKS const int tileWidthtInCtus = currentTile.getWidthInCtus(); const int tileHeightInCtus = currentTile.getHeightInCtus(); -#else - const int tileWidthtInCtus = currentTile.getTileWidthInCtus(); - const int tileHeightInCtus = currentTile.getTileHeightInCtus(); -#endif const int maxCUWidth = cs->pcv->maxCUWidth; const int maxCUHeight = cs->pcv->maxCUHeight; diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.cpp b/source/Lib/CommonLib/MatrixIntraPrediction.cpp index 13e9d57be907b7f4625bd1f1fbfd45ef9f1befa2..edfbe21f618e980aee317bccbef5ca7df175f46f 100644 --- a/source/Lib/CommonLib/MatrixIntraPrediction.cpp +++ b/source/Lib/CommonLib/MatrixIntraPrediction.cpp @@ -38,7 +38,6 @@ #include "MatrixIntraPrediction.h" #include "dtrace_next.h" -#if JVET_N0217_MATRIX_INTRAPRED #include "UnitTools.h" #include "MipData.h" @@ -544,4 +543,3 @@ void MatrixIntraPrediction::predBlock( const Size &puSize, const int intraMode, } } -#endif diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.h b/source/Lib/CommonLib/MatrixIntraPrediction.h index 6fc06880ed0a17fd1436a7d9c35eb515a458f06a..24229f878b32867d6d2d061ec73d0009967dec47 100644 --- a/source/Lib/CommonLib/MatrixIntraPrediction.h +++ b/source/Lib/CommonLib/MatrixIntraPrediction.h @@ -41,7 +41,6 @@ #include "Unit.h" -#if JVET_N0217_MATRIX_INTRAPRED static const int MIP_MAX_INPUT_SIZE = 8; static const int MIP_MAX_REDUCED_OUTPUT_SAMPLES = 64; @@ -106,6 +105,5 @@ public: void predBlock( const Size &puSize, const int modeIdx, PelBuf &dst, const int bitDepth ); }; -#endif // JVET_N0217_MATRIX_INTRAPRED #endif //__MATRIXINTRAPPREDICTION__ diff --git a/source/Lib/CommonLib/MotionInfo.h b/source/Lib/CommonLib/MotionInfo.h index 4f226261c2ea505f6b5c4fbb9e2c443b9eb8e04b..83bb07cffb317ddf0d457e52315ad3aed11b6389 100644 --- a/source/Lib/CommonLib/MotionInfo.h +++ b/source/Lib/CommonLib/MotionInfo.h @@ -221,16 +221,11 @@ struct LutMotionCand { static_vector lut; static_vector lutIbc; -#if !JVET_N0266_SMALL_BLOCKS - static_vector lutShare; -#endif static_vector lutShareIbc; }; -#if JVET_N0329_IBC_SEARCH_IMP struct PatentBvCand { Mv m_bvCands[IBC_NUM_CANDIDATES]; int currCnt; }; -#endif #endif // __MOTIONINFO__ diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp index 8c58ee2579fa7cb9ced56cc67dcad462424ba0fc..981ba6a02b6030d6b6c297066307d864270e434f 100644 --- a/source/Lib/CommonLib/Mv.cpp +++ b/source/Lib/CommonLib/Mv.cpp @@ -47,13 +47,8 @@ const MvPrecision Mv::m_amvrPrecIbc[3] = { MV_PRECISION_INT, MV_PRECISION_INT, M void roundAffineMv( int& mvx, int& mvy, int nShift ) { const int nOffset = 1 << (nShift - 1); -#if JVET_N0335_N0085_MV_ROUNDING mvx = (mvx + nOffset - (mvx >= 0)) >> nShift; mvy = (mvy + nOffset - (mvy >= 0)) >> nShift; -#else - mvx = mvx >= 0 ? (mvx + nOffset) >> nShift : -((-mvx + nOffset) >> nShift); - mvy = mvy >= 0 ? (mvy + nOffset) >> nShift : -((-mvy + nOffset) >> nShift); -#endif } void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& sps ) @@ -68,19 +63,6 @@ void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& if( sps.getWrapAroundEnabledFlag() ) { -#if !JVET_N0070_WRAPAROUND - int iHorMax = ( sps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + iOffset - ( int ) pos.x - 1 ) << iMvShift; - int iHorMin = ( -( int ) sps.getMaxCUWidth() - iOffset - ( int ) pos.x + 1 ) << iMvShift; - int mvX = rcMv.getHor(); - while( mvX > iHorMax ) { - mvX -= ( sps.getWrapAroundOffset() << iMvShift ); - } - while( mvX < iHorMin ) { - mvX += ( sps.getWrapAroundOffset() << iMvShift ); - } - rcMv.setHor( mvX ); - rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) ); -#endif return; } @@ -88,7 +70,6 @@ void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) ); } -#if JVET_N0070_WRAPAROUND bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS *sps ) { bool wrapRef = true; @@ -117,6 +98,5 @@ bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const S rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) ); return wrapRef; } -#endif //! \} diff --git a/source/Lib/CommonLib/Mv.h b/source/Lib/CommonLib/Mv.h index df4a468fc23ed18595b37dde03adf292149b2769..5d714d1c05c7731372260725669d043eac769930 100644 --- a/source/Lib/CommonLib/Mv.h +++ b/source/Lib/CommonLib/Mv.h @@ -65,10 +65,8 @@ private: static const MvPrecision m_amvrPrecAffine[3]; static const MvPrecision m_amvrPrecIbc[3]; -#if JVET_N0334_MVCLIPPING static const int mvClipPeriod = (1 << MV_BITS); static const int halMvClipPeriod = (1 << (MV_BITS - 1)); -#endif public: int hor; ///< horizontal component of motion vector @@ -129,22 +127,12 @@ public: //! shift right with rounding void divideByPowerOf2 (const int i) { -#if JVET_N0335_N0085_MV_ROUNDING if (i != 0) { const int offset = (1 << (i - 1)); hor = (hor + offset - (hor >= 0)) >> i; ver = (ver + offset - (ver >= 0)) >> i; } -#else -#if ME_ENABLE_ROUNDING_OF_MVS - const int offset = (i == 0) ? 0 : 1 << (i - 1); - hor += offset; - ver += offset; -#endif - hor >>= i; - ver >>= i; -#endif } const Mv& operator<<= (const int i) @@ -156,17 +144,12 @@ public: const Mv& operator>>= ( const int i ) { -#if JVET_N0335_N0085_MV_ROUNDING if (i != 0) { const int offset = (1 << (i - 1)); hor = (hor + offset - (hor >= 0)) >> i; ver = (ver + offset - (ver >= 0)) >> i; } -#else - hor >>= i; - ver >>= i; -#endif return *this; } @@ -192,13 +175,8 @@ public: const Mv scaleMv( int iScale ) const { -#if JVET_N0335_N0085_MV_ROUNDING const int mvx = Clip3(MV_MIN, MV_MAX, (iScale * getHor() + 128 - (iScale * getHor() >= 0)) >> 8); const int mvy = Clip3(MV_MIN, MV_MAX, (iScale * getVer() + 128 - (iScale * getVer() >= 0)) >> 8); -#else - const int mvx = Clip3(MV_MIN, MV_MAX, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8); - const int mvy = Clip3(MV_MIN, MV_MAX, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8); -#endif return Mv( mvx, mvy ); } @@ -213,13 +191,8 @@ public: { const int rightShift = -shift; const int nOffset = 1 << (rightShift - 1); -#if JVET_N0335_N0085_MV_ROUNDING hor = hor >= 0 ? (hor + nOffset - 1) >> rightShift : (hor + nOffset) >> rightShift; ver = ver >= 0 ? (ver + nOffset - 1) >> rightShift : (ver + nOffset) >> rightShift; -#else - hor = hor >= 0 ? (hor + nOffset) >> rightShift : -((-hor + nOffset) >> rightShift); - ver = ver >= 0 ? (ver + nOffset) >> rightShift : -((-ver + nOffset) >> rightShift); -#endif } } @@ -288,7 +261,6 @@ public: hor = Clip3( -(1 << 17), (1 << 17) - 1, hor ); ver = Clip3( -(1 << 17), (1 << 17) - 1, ver ); } -#if JVET_N0334_MVCLIPPING void mvCliptoStorageBitDepth() // periodic clipping { hor = (hor + mvClipPeriod) & (mvClipPeriod - 1); @@ -296,7 +268,6 @@ public: ver = (ver + mvClipPeriod) & (mvClipPeriod - 1); ver = (ver >= halMvClipPeriod) ? (ver - mvClipPeriod) : ver; } -#endif };// END CLASS DEFINITION MV namespace std @@ -314,11 +285,9 @@ void clipMv ( Mv& rcMv, const struct Position& pos, const struct Size& size, const class SPS& sps ); -#if JVET_N0070_WRAPAROUND bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS *sps ); -#endif void roundAffineMv( int& mvx, int& mvy, int nShift ); diff --git a/source/Lib/CommonLib/NAL.h b/source/Lib/CommonLib/NAL.h index e119e11d6d3d6eecaf07130a69e979fb342530c6..475b1d79a86660327c2bba4782f2e67fe937b647 100644 --- a/source/Lib/CommonLib/NAL.h +++ b/source/Lib/CommonLib/NAL.h @@ -74,7 +74,6 @@ struct NALUnit /** returns true if the NALunit is a slice NALunit */ bool isSlice() { -#if JVET_N0067_NAL_Unit_Header return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL @@ -83,34 +82,6 @@ struct NALUnit || m_nalUnitType == NAL_UNIT_CODED_SLICE_GRA || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL; -#else -#if JVET_M0101_HLS - return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL - || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA - || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA - || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL - || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL; -#else - return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R - || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N - || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_R - || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N - || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R - || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N - || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP - || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP - || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA - || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N - || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R - || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N - || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R; -#endif -#endif } bool isSei() { @@ -120,7 +91,6 @@ struct NALUnit bool isVcl() { -#if JVET_N0067_NAL_Unit_Header return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL @@ -130,9 +100,6 @@ struct NALUnit || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || m_nalUnitType == NAL_UNIT_CODED_SLICE_GRA; -#else - return ( (uint32_t)m_nalUnitType < 32 ); -#endif } }; diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 9f1d36a546f6d1e0f9bbec9619e34a8024eafcfc..eed0193bfe30e638fb1da3515ebfb46325ae3967 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -436,7 +436,6 @@ bool Scheduler::getNextCtu( Position& pos, int ctuLine, int offset) // picture methods // --------------------------------------------------------------------------- -#if JVET_N0857_TILES_BRICKS Brick::Brick() : m_widthInCtus (0) @@ -451,284 +450,7 @@ Brick::~Brick() { } -#else -Tile::Tile() -: m_tileWidthInCtus (0) -, m_tileHeightInCtus (0) -, m_rightEdgePosInCtus (0) -, m_bottomEdgePosInCtus (0) -, m_firstCtuRsAddr (0) -{ -} - -Tile::~Tile() -{ -} -#endif - -#if !JVET_N0857_TILES_BRICKS - -TileMap::TileMap() - : pcv(nullptr) - , tiles(0) - , numTiles(0) - , numTileColumns(0) - , numTileRows(0) - , tileIdxMap(nullptr) - , ctuTsToRsAddrMap(nullptr) - , ctuRsToTsAddrMap(nullptr) -{ -} - -void TileMap::create( const SPS& sps, const PPS& pps ) -{ - pcv = pps.pcv; - - numTileColumns = pps.getNumTileColumnsMinus1() + 1; - numTileRows = pps.getNumTileRowsMinus1() + 1; - numTiles = numTileColumns * numTileRows; - tiles.resize( numTiles ); - - const uint32_t numCtusInFrame = pcv->sizeInCtus; - tileIdxMap = new uint32_t[numCtusInFrame]; - ctuTsToRsAddrMap = new uint32_t[numCtusInFrame+1]; - ctuRsToTsAddrMap = new uint32_t[numCtusInFrame+1]; - - initTileMap( sps, pps ); - initCtuTsRsAddrMap(); -} - -void TileMap::destroy() -{ - tiles.clear(); - - if ( tileIdxMap ) - { - delete[] tileIdxMap; - tileIdxMap = nullptr; - } - - if ( ctuTsToRsAddrMap ) - { - delete[] ctuTsToRsAddrMap; - ctuTsToRsAddrMap = nullptr; - } - - if ( ctuRsToTsAddrMap ) - { - delete[] ctuRsToTsAddrMap; - ctuRsToTsAddrMap = nullptr; - } -} - -void TileMap::initTileMap( const SPS& sps, const PPS& pps ) -{ - const uint32_t frameWidthInCtus = pcv->widthInCtus; - const uint32_t frameHeightInCtus = pcv->heightInCtus; - - if( pps.getUniformTileSpacingFlag() ) - { - //set width and height for each (uniform) tile - for(int row=0; row < numTileRows; row++) - { - for(int col=0; col < numTileColumns; col++) - { - const int tileIdx = row * numTileColumns + col; - tiles[tileIdx].setTileWidthInCtus( (col+1)*frameWidthInCtus/numTileColumns - (col*frameWidthInCtus)/numTileColumns ); - tiles[tileIdx].setTileHeightInCtus( (row+1)*frameHeightInCtus/numTileRows - (row*frameHeightInCtus)/numTileRows ); - } - } - } - else - { - //set the width for each tile - for(int row=0; row < numTileRows; row++) - { - int cumulativeTileWidth = 0; - for(int col=0; col < numTileColumns - 1; col++) - { - tiles[row * numTileColumns + col].setTileWidthInCtus( pps.getTileColumnWidth(col) ); - cumulativeTileWidth += pps.getTileColumnWidth(col); - } - tiles[row * numTileColumns + numTileColumns - 1].setTileWidthInCtus( frameWidthInCtus-cumulativeTileWidth ); - } - - //set the height for each tile - for(int col=0; col < numTileColumns; col++) - { - int cumulativeTileHeight = 0; - for(int row=0; row < numTileRows - 1; row++) - { - tiles[row * numTileColumns + col].setTileHeightInCtus( pps.getTileRowHeight(row) ); - cumulativeTileHeight += pps.getTileRowHeight(row); - } - tiles[(numTileRows - 1) * numTileColumns + col].setTileHeightInCtus( frameHeightInCtus-cumulativeTileHeight ); - } - } - - // Tile size check - int minWidth = 1; - int minHeight = 1; -#if !JVET_M0101_HLS - const int profileIdc = sps.getPTL()->getGeneralPTL()->getProfileIdc(); -#else - const int profileIdc = sps.getProfileTierLevel()->getProfileIdc(); -#endif - if ( profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10) - { - if (pps.getTilesEnabledFlag()) - { - minHeight = 64 / sps.getMaxCUHeight(); - minWidth = 256 / sps.getMaxCUWidth(); - } - } - for(int row=0; row < numTileRows; row++) - { - for(int col=0; col < numTileColumns; col++) - { - const int tileIdx = row * numTileColumns + col; - if(tiles[tileIdx].getTileWidthInCtus() < minWidth) { THROW("Invalid tile size"); } - if(tiles[tileIdx].getTileHeightInCtus() < minHeight) { THROW("Invalid tile size"); } - } - } - - //initialize each tile of the current picture - for( int row=0; row < numTileRows; row++ ) - { - for( int col=0; col < numTileColumns; col++ ) - { - const int tileIdx = row * numTileColumns + col; - - //initialize the RightEdgePosInCU for each tile - int rightEdgePosInCTU = 0; - for( int i=0; i <= col; i++ ) - { - rightEdgePosInCTU += tiles[row * numTileColumns + i].getTileWidthInCtus(); - } - tiles[tileIdx].setRightEdgePosInCtus(rightEdgePosInCTU-1); - - //initialize the BottomEdgePosInCU for each tile - int bottomEdgePosInCTU = 0; - for( int i=0; i <= row; i++ ) - { - bottomEdgePosInCTU += tiles[i * numTileColumns + col].getTileHeightInCtus(); - } - tiles[tileIdx].setBottomEdgePosInCtus(bottomEdgePosInCTU-1); - - //initialize the FirstCUAddr for each tile - tiles[tileIdx].setFirstCtuRsAddr( (tiles[tileIdx].getBottomEdgePosInCtus() - tiles[tileIdx].getTileHeightInCtus() + 1) * frameWidthInCtus + - tiles[tileIdx].getRightEdgePosInCtus() - tiles[tileIdx].getTileWidthInCtus() + 1); - } - } - - int columnIdx = 0; - int rowIdx = 0; - - //initialize the TileIdxMap - const uint32_t numCtusInFrame = pcv->sizeInCtus; - for( int i=0; isizeInCtus; - for(int ctuTsAddr=0, ctuRsAddr=0; ctuTsAddrwidthInCtus; - uint32_t nextCtuRsAddr; - - //get the tile index for the current CTU - const uint32_t uiTileIdx = getTileIdxMap(currCtuRsAddr); - - //get the raster scan address for the next CTU - if( currCtuRsAddr % frameWidthInCtus == tiles[uiTileIdx].getRightEdgePosInCtus() && currCtuRsAddr / frameWidthInCtus == tiles[uiTileIdx].getBottomEdgePosInCtus() ) - //the current CTU is the last CTU of the tile - { - if(uiTileIdx+1 == numTiles) - { - nextCtuRsAddr = pcv->sizeInCtus; - } - else - { - nextCtuRsAddr = tiles[uiTileIdx+1].getFirstCtuRsAddr(); - } - } - else //the current CTU is not the last CTU of the tile - { - if( currCtuRsAddr % frameWidthInCtus == tiles[uiTileIdx].getRightEdgePosInCtus() ) //the current CTU is on the rightmost edge of the tile - { - nextCtuRsAddr = currCtuRsAddr + frameWidthInCtus - tiles[uiTileIdx].getTileWidthInCtus() + 1; - } - else - { - nextCtuRsAddr = currCtuRsAddr + 1; - } - } - - return nextCtuRsAddr; -} - -uint32_t TileMap::getSubstreamForCtuAddr(const uint32_t ctuAddr, const bool bAddressInRaster, Slice *pcSlice) const -{ - const bool bWPPEnabled = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag(); - uint32_t subStrm; - if( (bWPPEnabled && pcv->heightInCtus > 1) || (numTiles > 1) ) // wavefronts, and possibly tiles being used. - { - const uint32_t ctuRsAddr = bAddressInRaster ? ctuAddr : getCtuTsToRsAddrMap(ctuAddr); - const uint32_t tileIndex = getTileIdxMap(ctuRsAddr); - - if (bWPPEnabled) - { - const uint32_t firstCtuRsAddrOfTile = tiles[tileIndex].getFirstCtuRsAddr(); - const uint32_t tileYInCtus = firstCtuRsAddrOfTile / pcv->widthInCtus; - const uint32_t ctuLine = ctuRsAddr / pcv->widthInCtus; - const uint32_t startingSubstreamForTile = (tileYInCtus * numTileColumns) + (tiles[tileIndex].getTileHeightInCtus() * (tileIndex % numTileColumns)); - - subStrm = startingSubstreamForTile + (ctuLine - tileYInCtus); - } - else - { - subStrm = tileIndex; - } - } - else - { - subStrm = 0; - } - return subStrm; -} - -#else BrickMap::BrickMap() : pcv(nullptr) , numTiles(0) @@ -999,15 +721,10 @@ uint32_t BrickMap::getSubstreamForCtuAddr(const uint32_t ctuAddr, const bool add return subStrm; } -#endif Picture::Picture() { -#if JVET_N0857_TILES_BRICKS brickMap = nullptr; -#else - tileMap = nullptr; -#endif cs = nullptr; m_bIsBorderExtended = false; usedByCurr = false; @@ -1032,9 +749,7 @@ void Picture::create(const ChromaFormat &_chromaFormat, const Size &size, const margin = _margin; const Area a = Area( Position(), size ); M_BUFS( 0, PIC_RECONSTRUCTION ).create( _chromaFormat, a, _maxCUSize, _margin, MEMORY_ALIGN_DEF_SIZE ); -#if JVET_N0070_WRAPAROUND M_BUFS( 0, PIC_RECON_WRAP ).create( _chromaFormat, a, _maxCUSize, _margin, MEMORY_ALIGN_DEF_SIZE ); -#endif if( !_decoder ) { @@ -1081,21 +796,12 @@ void Picture::destroy() } SEIs.clear(); -#if JVET_N0857_TILES_BRICKS if ( brickMap ) { brickMap->destroy(); delete brickMap; brickMap = nullptr; } -#else - if ( tileMap ) - { - tileMap->destroy(); - delete tileMap; - tileMap = nullptr; - } -#endif if (m_spliceIdx) { delete[] m_spliceIdx; @@ -1168,7 +874,6 @@ const CPelBuf Picture::getResiBuf(const CompArea &blk) const { return getBu PelUnitBuf Picture::getResiBuf(const UnitArea &unit) { return getBuf(unit, PIC_RESIDUAL); } const CPelUnitBuf Picture::getResiBuf(const UnitArea &unit) const { return getBuf(unit, PIC_RESIDUAL); } -#if JVET_N0070_WRAPAROUND PelBuf Picture::getRecoBuf(const ComponentID compID, bool wrap) { return getBuf(compID, wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); } const CPelBuf Picture::getRecoBuf(const ComponentID compID, bool wrap) const { return getBuf(compID, wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); } PelBuf Picture::getRecoBuf(const CompArea &blk, bool wrap) { return getBuf(blk, wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); } @@ -1177,26 +882,8 @@ const CPelBuf Picture::getRecoBuf(const CompArea &blk, bool wrap) const const CPelUnitBuf Picture::getRecoBuf(const UnitArea &unit, bool wrap) const { return getBuf(unit, wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); } PelUnitBuf Picture::getRecoBuf(bool wrap) { return M_BUFS(scheduler.getSplitPicId(), wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); } const CPelUnitBuf Picture::getRecoBuf(bool wrap) const { return M_BUFS(scheduler.getSplitPicId(), wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); } -#else - PelBuf Picture::getRecoBuf(const ComponentID compID) { return getBuf(compID, PIC_RECONSTRUCTION); } -const CPelBuf Picture::getRecoBuf(const ComponentID compID) const { return getBuf(compID, PIC_RECONSTRUCTION); } - PelBuf Picture::getRecoBuf(const CompArea &blk) { return getBuf(blk, PIC_RECONSTRUCTION); } -const CPelBuf Picture::getRecoBuf(const CompArea &blk) const { return getBuf(blk, PIC_RECONSTRUCTION); } - PelUnitBuf Picture::getRecoBuf(const UnitArea &unit) { return getBuf(unit, PIC_RECONSTRUCTION); } -const CPelUnitBuf Picture::getRecoBuf(const UnitArea &unit) const { return getBuf(unit, PIC_RECONSTRUCTION); } - PelUnitBuf Picture::getRecoBuf() { return M_BUFS(scheduler.getSplitPicId(), PIC_RECONSTRUCTION); } -const CPelUnitBuf Picture::getRecoBuf() const { return M_BUFS(scheduler.getSplitPicId(), PIC_RECONSTRUCTION); } -#endif -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS void Picture::finalInit(const SPS& sps, const PPS& pps, APS** alfApss, APS& lmcsAps) -#else -void Picture::finalInit(const SPS& sps, const PPS& pps, APS** apss) -#endif -#else -void Picture::finalInit(const SPS& sps, const PPS& pps, APS& aps) -#endif { for( auto &sei : SEIs ) { @@ -1205,21 +892,12 @@ void Picture::finalInit(const SPS& sps, const PPS& pps, APS& aps) SEIs.clear(); clearSliceBuffer(); -#if JVET_N0857_TILES_BRICKS if( brickMap ) { brickMap->destroy(); delete brickMap; brickMap = nullptr; } -#else - if( tileMap ) - { - tileMap->destroy(); - delete tileMap; - tileMap = nullptr; - } -#endif const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); const int iWidth = sps.getPicWidthInLumaSamples(); @@ -1239,31 +917,16 @@ void Picture::finalInit(const SPS& sps, const PPS& pps, APS& aps) cs->picture = this; cs->slice = nullptr; // the slices for this picture have not been set at this point. update cs->slice after swapSliceObject() cs->pps = &pps; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(cs->alfApss, alfApss, sizeof(cs->alfApss)); -#else - memcpy(cs->apss, apss, sizeof(cs->apss)); -#endif -#else - cs->aps = &aps; -#endif -#if JVET_N0805_APS_LMCS cs->lmcsAps = &lmcsAps; -#endif #if HEVC_VPS cs->vps = nullptr; #endif cs->pcv = pps.pcv; -#if JVET_N0857_TILES_BRICKS brickMap = new BrickMap; brickMap->create( sps, pps ); -#else - tileMap = new TileMap; - tileMap->create( sps, pps ); -#endif if (m_spliceIdx == NULL) { m_ctuNums = cs->pcv->sizeInCtus; @@ -1276,19 +939,9 @@ void Picture::allocateNewSlice() { slices.push_back(new Slice); Slice& slice = *slices.back(); -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(slice.getAlfAPSs(), cs->alfApss, sizeof(cs->alfApss)); -#else - memcpy(slice.getAPSs(), cs->apss, sizeof(cs->apss)); -#endif -#else - slice.setAPS(cs->aps); -#endif -#if JVET_N0805_APS_LMCS slice.setLmcsAPS(cs->lmcsAps); -#endif slice.setPPS( cs->pps); slice.setSPS( cs->sps); @@ -1303,37 +956,17 @@ Slice *Picture::swapSliceObject(Slice * p, uint32_t i) { p->setSPS(cs->sps); p->setPPS(cs->pps); -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS p->setAlfAPSs(cs->alfApss); -#else - p->setAPSs(cs->apss); -#endif -#else - p->setAPS(cs->aps); -#endif -#if JVET_N0805_APS_LMCS p->setLmcsAPS(cs->lmcsAps); -#endif Slice * pTmp = slices[i]; slices[i] = p; pTmp->setSPS(0); pTmp->setPPS(0); -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memset(pTmp->getAlfAPSs(), 0, sizeof(*pTmp->getAlfAPSs())*MAX_NUM_APS); -#else - memset(pTmp->getAPSs(), 0, sizeof(*pTmp->getAPSs())*MAX_NUM_APS); -#endif -#else - pTmp->setAPS(0); -#endif -#if JVET_N0805_APS_LMCS pTmp->setLmcsAPS(0); -#endif return pTmp; } @@ -1397,23 +1030,6 @@ void Picture::extendPicBorder() Pel* pi = piTxt; // do left and right margins - #if !JVET_N0070_WRAPAROUND - if (cs->sps->getWrapAroundEnabledFlag()) - { - int xoffset = cs->sps->getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat ); - for (int y = 0; y < p.height; y++) - { - for (int x = 0; x < xmargin; x++ ) - { - pi[ -x - 1 ] = pi[ -x - 1 + xoffset ]; - pi[ p.width + x ] = pi[ p.width + x - xoffset ]; - } - pi += p.stride; - } - } - else - { -#endif for (int y = 0; y < p.height; y++) { for (int x = 0; x < xmargin; x++ ) @@ -1423,9 +1039,6 @@ void Picture::extendPicBorder() } pi += p.stride; } - #if !JVET_N0070_WRAPAROUND - } -#endif // pi is now the (0,height) (bottom left of image within bigger picture pi -= (p.stride + xmargin); @@ -1443,7 +1056,6 @@ void Picture::extendPicBorder() ::memcpy( pi - (y+1)*p.stride, pi, sizeof(Pel)*(p.width + (xmargin<<1)) ); } -#if JVET_N0070_WRAPAROUND // reference picture with horizontal wrapped boundary if (cs->sps->getWrapAroundEnabledFlag()) { @@ -1480,7 +1092,6 @@ void Picture::extendPicBorder() ::memcpy( pi - (y+1)*p.stride, pi, sizeof(Pel)*(p.width + (xmargin<<1)) ); } } -#endif } m_bIsBorderExtended = true; @@ -1618,21 +1229,10 @@ void Picture::addPictureToHashMapForInter() bIsBlockSame[i][j] = new bool[picWidth*picHeight]; } } -#if JVET_N0247_HASH_IMPROVE m_hashMap.create(picWidth, picHeight); -#else - m_hashMap.create(); -#endif m_hashMap.generateBlock2x2HashValue(getOrigBuf(), picWidth, picHeight, slices[0]->getSPS()->getBitDepths(), blockHashValues[0], bIsBlockSame[0]);//2x2 m_hashMap.generateBlockHashValue(picWidth, picHeight, 4, 4, blockHashValues[0], blockHashValues[1], bIsBlockSame[0], bIsBlockSame[1]);//4x4 m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[1], bIsBlockSame[1][2], picWidth, picHeight, 4, 4); -#if !JVET_N0247_HASH_IMPROVE - m_hashMap.generateRectangleHashValue(picWidth, picHeight, 8, 4, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//8x4 - m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 8, 4); - - m_hashMap.generateRectangleHashValue(picWidth, picHeight, 4, 8, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//4x8 - m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 4, 8); -#endif m_hashMap.generateBlockHashValue(picWidth, picHeight, 8, 8, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//8x8 m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 8, 8); diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index 750117d6ee1c4d849839c171058fc8097b2ebc53..4ccb3ee858d9db4bc723d886513df93cdd9fe37b 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -115,7 +115,6 @@ class AQpLayer; typedef std::list SEIMessages; -#if JVET_N0857_TILES_BRICKS class Brick { @@ -143,62 +142,7 @@ public: uint32_t getFirstCtuRsAddr () const { return m_firstCtuRsAddr; } }; -#else -class Tile -{ -private: - uint32_t m_tileWidthInCtus; - uint32_t m_tileHeightInCtus; - uint32_t m_rightEdgePosInCtus; - uint32_t m_bottomEdgePosInCtus; - uint32_t m_firstCtuRsAddr; - -public: - Tile(); - virtual ~Tile(); - - void setTileWidthInCtus ( uint32_t i ) { m_tileWidthInCtus = i; } - uint32_t getTileWidthInCtus () const { return m_tileWidthInCtus; } - void setTileHeightInCtus ( uint32_t i ) { m_tileHeightInCtus = i; } - uint32_t getTileHeightInCtus () const { return m_tileHeightInCtus; } - void setRightEdgePosInCtus ( uint32_t i ) { m_rightEdgePosInCtus = i; } - uint32_t getRightEdgePosInCtus () const { return m_rightEdgePosInCtus; } - void setBottomEdgePosInCtus ( uint32_t i ) { m_bottomEdgePosInCtus = i; } - uint32_t getBottomEdgePosInCtus () const { return m_bottomEdgePosInCtus; } - void setFirstCtuRsAddr ( uint32_t i ) { m_firstCtuRsAddr = i; } - uint32_t getFirstCtuRsAddr () const { return m_firstCtuRsAddr; } -}; -#endif -#if !JVET_N0857_TILES_BRICKS -struct TileMap -{ - TileMap(); - - void create( const SPS& sps, const PPS& pps ); - void destroy(); - - uint32_t getTileIdxMap( uint32_t ctuRsAddr ) const { return *(tileIdxMap + ctuRsAddr); } - uint32_t getTileIdxMap( const Position& pos ) const { return getTileIdxMap( ( pos.x / pcv->maxCUWidth ) + ( pos.y / pcv->maxCUHeight ) * pcv->widthInCtus ); }; - uint32_t getCtuTsToRsAddrMap( uint32_t ctuTsAddr ) const { return *(ctuTsToRsAddrMap + (ctuTsAddr>=pcv->sizeInCtus ? pcv->sizeInCtus : ctuTsAddr)); } - uint32_t getCtuRsToTsAddrMap( uint32_t ctuRsAddr ) const { return *(ctuRsToTsAddrMap + (ctuRsAddr>=pcv->sizeInCtus ? pcv->sizeInCtus : ctuRsAddr)); } - uint32_t getSubstreamForCtuAddr(const uint32_t ctuAddr, const bool bAddressInRaster, Slice *pcSlice) const; - - const PreCalcValues* pcv; - std::vector tiles; - uint32_t numTiles; - uint32_t numTileColumns; - uint32_t numTileRows; - uint32_t* tileIdxMap; - uint32_t* ctuTsToRsAddrMap; - uint32_t* ctuRsToTsAddrMap; - - void initTileMap( const SPS& sps, const PPS& pps ); - void initCtuTsRsAddrMap(); - uint32_t calculateNextCtuRSAddr( const uint32_t currCtuRsAddr ) const; -}; - -#else struct BrickMap { BrickMap(); @@ -231,7 +175,6 @@ struct BrickMap void initBrickMap( const SPS& sps, const PPS& pps ); void initCtuBsRsAddrMap(); }; -#endif #if ENABLE_SPLIT_PARALLELISM #define M_BUFS(JID,PID) m_bufs[JID][PID] @@ -273,7 +216,6 @@ struct Picture : public UnitArea PelUnitBuf getResiBuf(const UnitArea &unit); const CPelUnitBuf getResiBuf(const UnitArea &unit) const; -#if JVET_N0070_WRAPAROUND PelBuf getRecoBuf(const ComponentID compID, bool wrap=false); const CPelBuf getRecoBuf(const ComponentID compID, bool wrap=false) const; PelBuf getRecoBuf(const CompArea &blk, bool wrap=false); @@ -282,16 +224,6 @@ struct Picture : public UnitArea const CPelUnitBuf getRecoBuf(const UnitArea &unit, bool wrap=false) const; PelUnitBuf getRecoBuf(bool wrap=false); const CPelUnitBuf getRecoBuf(bool wrap=false) const; -#else - PelBuf getRecoBuf(const ComponentID compID); - const CPelBuf getRecoBuf(const ComponentID compID) const; - PelBuf getRecoBuf(const CompArea &blk); - const CPelBuf getRecoBuf(const CompArea &blk) const; - PelUnitBuf getRecoBuf(const UnitArea &unit); - const CPelUnitBuf getRecoBuf(const UnitArea &unit) const; - PelUnitBuf getRecoBuf(); - const CPelUnitBuf getRecoBuf() const; -#endif PelBuf getBuf(const ComponentID compID, const PictureType &type); const CPelBuf getBuf(const ComponentID compID, const PictureType &type) const; @@ -301,15 +233,7 @@ struct Picture : public UnitArea const CPelUnitBuf getBuf(const UnitArea &unit, const PictureType &type) const; void extendPicBorder(); -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS void finalInit(const SPS& sps, const PPS& pps, APS** alfApss, APS& lmcsAps); -#else - void finalInit(const SPS& sps, const PPS& pps, APS** apss); -#endif -#else - void finalInit(const SPS& sps, const PPS& pps, APS& aps); -#endif int getPOC() const { return poc; } void setBorderExtension( bool bFlag) { m_bIsBorderExtended = bFlag;} @@ -361,11 +285,7 @@ public: Slice *swapSliceObject(Slice * p, uint32_t i); void clearSliceBuffer(); -#if !JVET_N0857_TILES_BRICKS - TileMap* tileMap; -#else BrickMap* brickMap; -#endif MCTSInfo mctsInfo; std::vector aqlayer; @@ -412,7 +332,6 @@ public: std::fill( m_alfCtuEnableFlag[compIdx].begin(), m_alfCtuEnableFlag[compIdx].end(), 0 ); } } -#if JVET_N0415_CTB_ALF std::vector m_alfCtbFilterIndex; short* getAlfCtbFilterIndex() { return m_alfCtbFilterIndex.data(); } std::vector& getAlfCtbFilterIndexVec() { return m_alfCtbFilterIndex; } @@ -424,7 +343,6 @@ public: m_alfCtbFilterIndex[i] = 0; } } -#endif }; int calcAndPrintHashStatus(const CPelUnitBuf& pic, const class SEIDecodedPictureHash* pictureHashSEI, const BitDepths &bitDepths, const MsgLevel msgl); diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 8950a4adcef0ed413c28ef96846123b8fe070faa..faffc57c5d3bd1ccb2c3cecefec79ac0e36af6bf 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -103,21 +103,12 @@ QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int if (isChroma(compID)) { -#if JVET_N0054_JOINT_CHROMA chromaQpOffset += tu.cs->pps->getQpOffset ( tu.jointCbCr ? JOINT_CbCr : compID ); chromaQpOffset += tu.cs->slice->getSliceChromaQpDelta( tu.jointCbCr ? JOINT_CbCr : compID ); -#else - chromaQpOffset += tu.cs->pps->getQpOffset( compID ); - chromaQpOffset += tu.cs->slice->getSliceChromaQpDelta( compID ); -#endif chromaQpOffset += tu.cs->pps->getPpsRangeExtension().getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( compID ) - 1]; } -#if HM_QTBT_AS_IN_JEM_QUANT int dqp = 0; -#else - int dqp = ( TU::needsQP3Offset(tu, compID) ? -3 : 0 ); -#endif *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, toChannelType(compID), tu.cs->sps->getQpBDOffset(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp); } @@ -129,19 +120,14 @@ QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int Quant::Quant( const Quant* other ) { -#if HEVC_USE_SCALING_LISTS xInitScalingList( other ); -#endif } Quant::~Quant() { -#if HEVC_USE_SCALING_LISTS xDestroyScalingList(); -#endif } -#if JVET_N0413_RDPCM void invResDPCM( const TransformUnit &tu, const ComponentID &compID, CoeffBuf &dstBuf ) { const CompArea &rect = tu.blocks[compID]; @@ -220,9 +206,7 @@ void fwdResDPCM( TransformUnit &tu, const ComponentID &compID ) } } } -#endif -#if HEVC_USE_SIGN_HIDING // To minimize the distortion only. No rate is considered. void Quant::xSignBitHidingHDQ( TCoeff* pQCoef, const TCoeff* pCoef, TCoeff* deltaU, const CoeffCodingContext& cctx, const int maxLog2TrDynamicRange ) { @@ -357,7 +341,6 @@ void Quant::xSignBitHidingHDQ( TCoeff* pQCoef, const TCoeff* pCoef, TCoeff* delt return; } -#endif void Quant::dequant(const TransformUnit &tu, CoeffBuf &dstCoeff, @@ -368,22 +351,16 @@ void Quant::dequant(const TransformUnit &tu, const CompArea &area = tu.blocks[compID]; const uint32_t uiWidth = area.width; const uint32_t uiHeight = area.height; -#if !JVET_N0413_RDPCM - const TCoeff *const piQCoef = tu.getCoeffs(compID).buf; -#endif TCoeff *const piCoef = dstCoeff.buf; const uint32_t numSamplesInBlock = uiWidth * uiHeight; const int maxLog2TrDynamicRange = sps->getMaxLog2TrDynamicRange(toChannelType(compID)); const TCoeff transformMinimum = -(1 << maxLog2TrDynamicRange); const TCoeff transformMaximum = (1 << maxLog2TrDynamicRange) - 1; -#if HEVC_USE_SCALING_LISTS const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip); const int scalingListType = getScalingListType(tu.cu->predMode, compID); -#endif const int channelBitDepth = sps->getBitDepth(toChannelType(compID)); -#if JVET_N0413_RDPCM const TCoeff *coef; if( tu.cu->bdpcmMode && isLuma(compID) ) { @@ -395,50 +372,20 @@ void Quant::dequant(const TransformUnit &tu, coef = tu.getCoeffs(compID).buf; } const TCoeff *const piQCoef = coef; -#endif -#if HEVC_USE_SCALING_LISTS CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); -#endif CHECK(uiWidth > m_uiMaxTrSize, "Unsupported transformation size"); // Represents scaling through forward transform const bool bClipTransformShiftTo0 = tu.mtsIdx!=MTS_SKIP && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag(); const int originalTransformShift = getTransformShift(channelBitDepth, area.size(), maxLog2TrDynamicRange); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needSqrtAdjustment = TU::needsBlockSizeTrafoScale( tu, compID ); const int iTransformShift = (bClipTransformShiftTo0 ? std::max(0, originalTransformShift) : originalTransformShift) + (needSqrtAdjustment?-1:0); -#else - const int iTransformShift = bClipTransformShiftTo0 ? std::max(0, originalTransformShift) : originalTransformShift; -#endif const int QP_per = cQP.per; const int QP_rem = cQP.rem; -#if JVET_N0246_MODIFIED_QUANTSCALES -#if HEVC_USE_SCALING_LISTS const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); -#else - const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)); -#endif -#else -#if HM_QTBT_AS_IN_JEM_QUANT - const bool needsScalingCorrection = TU::needsBlockSizeTrafoScale( tu, compID ); - const int NEScale = TU::needsSqrt2Scale( tu, compID ) ? 181 : 1; -#if HEVC_USE_SCALING_LISTS - const int rightShift = (needsScalingCorrection ? 8 : 0 ) + (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); -#else - const int rightShift = (needsScalingCorrection ? 8 : 0 ) + (IQUANT_SHIFT - (iTransformShift + QP_per)); -#endif -#else -#if HEVC_USE_SCALING_LISTS - const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); -#else - const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)); -#endif -#endif -#endif // JVET_N0246_MODIFIED_QUANTSCALES -#if HEVC_USE_SCALING_LISTS if(enableScalingLists) { //from the dequantization equation: @@ -461,11 +408,7 @@ void Quant::dequant(const TransformUnit &tu, for( int n = 0; n < numSamplesInBlock; n++ ) { const TCoeff clipQCoef = TCoeff(Clip3(inputMinimum, inputMaximum, piQCoef[n])); -#if HM_QTBT_AS_IN_JEM_QUANT && !JVET_N0246_MODIFIED_QUANTSCALES - const Intermediate_Int iCoeffQ = ((Intermediate_Int(clipQCoef) * piDequantCoef[n] * NEScale) + iAdd ) >> rightShift; -#else const Intermediate_Int iCoeffQ = ((Intermediate_Int(clipQCoef) * piDequantCoef[n]) + iAdd ) >> rightShift; -#endif piCoef[n] = TCoeff(Clip3(transformMinimum,transformMaximum,iCoeffQ)); } @@ -477,11 +420,7 @@ void Quant::dequant(const TransformUnit &tu, for( int n = 0; n < numSamplesInBlock; n++ ) { const TCoeff clipQCoef = TCoeff(Clip3(inputMinimum, inputMaximum, piQCoef[n])); -#if HM_QTBT_AS_IN_JEM_QUANT && !JVET_N0246_MODIFIED_QUANTSCALES - const Intermediate_Int iCoeffQ = (Intermediate_Int(clipQCoef) * piDequantCoef[n] * NEScale) << leftShift; -#else const Intermediate_Int iCoeffQ = (Intermediate_Int(clipQCoef) * piDequantCoef[n]) << leftShift; -#endif piCoef[n] = TCoeff(Clip3(transformMinimum,transformMaximum,iCoeffQ)); } @@ -489,16 +428,7 @@ void Quant::dequant(const TransformUnit &tu, } else { -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES const int scale = g_invQuantScales[needSqrtAdjustment?1:0][QP_rem]; -#else -#if HM_QTBT_AS_IN_JEM_QUANT - const int scale = g_invQuantScales[QP_rem] * NEScale; -#else - const int scale = g_invQuantScales[QP_rem]; -#endif -#endif const int scaleBits = ( IQUANT_SHIFT + 1 ); //from the dequantisation equation: @@ -532,9 +462,7 @@ void Quant::dequant(const TransformUnit &tu, piCoef[n] = TCoeff(Clip3(transformMinimum,transformMaximum,iCoeffQ)); } } -#if HEVC_USE_SCALING_LISTS } -#endif } void Quant::init( uint32_t uiMaxTrSize, @@ -565,7 +493,6 @@ void Quant::copyState( const Quant& other ) } #endif -#if HEVC_USE_SCALING_LISTS /** set quantized matrix coefficient for encode * \param scalingList quantized matrix address * \param format chroma format @@ -577,18 +504,12 @@ void Quant::setScalingList(ScalingList *scalingList, const int maxLog2TrDynamicR const int minimumQp = 0; const int maximumQp = SCALING_LIST_REM_NUM; -#if JVET_N0847_SCALING_LISTS for(uint32_t size = SCALING_LIST_FIRST_CODED; size <= SCALING_LIST_LAST_CODED; size++) //2x2->64x64 -#else - for(uint32_t size = 0; size < SCALING_LIST_SIZE_NUM; size++) -#endif { for(uint32_t list = 0; list < SCALING_LIST_NUM; list++) { -#if JVET_N0847_SCALING_LISTS if (size == SCALING_LIST_2x2 && list % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0) //skip 2x2 luma continue; -#endif for(int qp = minimumQp; qp < maximumQp; qp++) { xSetScalingListEnc(scalingList,list,size,qp); @@ -596,7 +517,6 @@ void Quant::setScalingList(ScalingList *scalingList, const int maxLog2TrDynamicR } } } -#if JVET_N0847_SCALING_LISTS //based on square result and apply downsample technology for (uint32_t sizew = 0; sizew <= SCALING_LIST_LAST_CODED; sizew++) //7 { @@ -613,7 +533,6 @@ void Quant::setScalingList(ScalingList *scalingList, const int maxLog2TrDynamicR } } } -#endif } /** set quantized matrix coefficient for decode * \param scalingList quantized matrix address @@ -624,25 +543,18 @@ void Quant::setScalingListDec(const ScalingList &scalingList) const int minimumQp = 0; const int maximumQp = SCALING_LIST_REM_NUM; -#if JVET_N0847_SCALING_LISTS for (uint32_t size = SCALING_LIST_FIRST_CODED; size <= SCALING_LIST_LAST_CODED; size++) -#else - for(uint32_t size = 0; size < SCALING_LIST_SIZE_NUM; size++) -#endif { for(uint32_t list = 0; list < SCALING_LIST_NUM; list++) { -#if JVET_N0847_SCALING_LISTS if (size == SCALING_LIST_2x2 && list % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0) //skip 2x2 luma continue; -#endif for(int qp = minimumQp; qp < maximumQp; qp++) { xSetScalingListDec(scalingList,list,size,qp); } } } -#if JVET_N0847_SCALING_LISTS //based on square result and apply downsample technology //based on square result and apply downsample technology for (uint32_t sizew = 0; sizew <= SCALING_LIST_LAST_CODED; sizew++) //7 @@ -659,7 +571,6 @@ void Quant::setScalingListDec(const ScalingList &scalingList) } } } -#endif } @@ -679,12 +590,8 @@ void Quant::xSetScalingListEnc(ScalingList *scalingList, uint32_t listId, uint32 int *coeff = scalingList->getScalingListAddress(sizeId,listId); quantcoeff = getQuantCoeff(listId, qp, sizeId, sizeId); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool blockIsNotPowerOf4 = ((g_aucLog2[width] + g_aucLog2[height]) & 1) == 1; int quantScales = g_quantScales[blockIsNotPowerOf4?1:0][qp]; -#else - int quantScales = g_quantScales[qp]; -#endif processScalingListEnc(coeff, quantcoeff, @@ -711,12 +618,8 @@ void Quant::xSetScalingListDec(const ScalingList &scalingList, uint32_t listId, dequantcoeff = getDequantCoeff(listId, qp, sizeId, sizeId); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool blockIsNotPowerOf4 = ((g_aucLog2[width] + g_aucLog2[height]) & 1) == 1; int invQuantScale = g_invQuantScales[blockIsNotPowerOf4?1:0][qp]; -#else - int invQuantScale = g_invQuantScales[qp]; -#endif processScalingListDec(coeff, dequantcoeff, @@ -726,7 +629,6 @@ void Quant::xSetScalingListDec(const ScalingList &scalingList, uint32_t listId, scalingList.getScalingListDC(sizeId,listId)); } -#if JVET_N0847_SCALING_LISTS /** set quantized matrix coefficient for encode * \param scalingList quantized matrix address * \param listId List index @@ -781,7 +683,6 @@ void Quant::xSetRecScalingListDec(const ScalingList &scalingList, uint32_t listI (largeSideId >= 3 ? 8 : 4), scalingList.getScalingListDC(largeSideId, listId)); } -#endif /** set flat matrix value to quantized coefficient */ void Quant::setFlatScalingList(const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths) @@ -816,14 +717,9 @@ void Quant::xSetFlatScalingList(uint32_t list, uint32_t sizeX, uint32_t sizeY, i int *quantcoeff; int *dequantcoeff; -#if JVET_N0246_MODIFIED_QUANTSCALES const bool blockIsNotPowerOf4 = ((g_aucLog2[g_scalingListSizeX[sizeX]] + g_aucLog2[g_scalingListSizeX[sizeY]]) & 1) == 1; int quantScales = g_quantScales [blockIsNotPowerOf4?1:0][qp]; int invQuantScales = g_invQuantScales[blockIsNotPowerOf4?1:0][qp] << 4; -#else - int quantScales = g_quantScales [qp]; - int invQuantScales = g_invQuantScales[qp] << 4; -#endif quantcoeff = getQuantCoeff(list, qp, sizeX, sizeY); dequantcoeff = getDequantCoeff(list, qp, sizeX, sizeY); @@ -847,7 +743,6 @@ void Quant::xSetFlatScalingList(uint32_t list, uint32_t sizeX, uint32_t sizeY, i */ void Quant::processScalingListEnc( int *coeff, int *quantcoeff, int quantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc) { -#if JVET_N0847_SCALING_LISTS if (height != width) { for (uint32_t j = 0; jsps; const CompArea &rect = tu.blocks[compID]; -#if HEVC_USE_SCALING_LISTS const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; -#endif const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const CCoeffBuf &piCoef = pSrc; @@ -1028,19 +917,12 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); { -#if HEVC_USE_SIGN_HIDING CoeffCodingContext cctx(tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag()); -#else - CoeffCodingContext cctx(tu, compID); -#endif const TCoeff entropyCodingMinimum = -(1 << maxLog2TrDynamicRange); const TCoeff entropyCodingMaximum = (1 << maxLog2TrDynamicRange) - 1; -#if HEVC_USE_SIGN_HIDING TCoeff deltaU[MAX_TB_SIZEY * MAX_TB_SIZEY]; -#endif -#if HEVC_USE_SCALING_LISTS int scalingListType = getScalingListType(tu.cu->predMode, compID); CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth]; @@ -1048,8 +930,6 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth-1, uiLog2TrHeight-1); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip); -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES // for blocks that where width*height != 4^N, the effective scaling applied during transformation cannot be // compensated by a bit-shift (the quantised result will be sqrt(2) * larger than required). @@ -1057,77 +937,38 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem]; int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange) + ( needSqrtAdjustment?-1:0); -#else - const int defaultQuantisationCoefficient = g_quantScales[cQP.rem]; - - /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be - * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the - * uiLog2TrSize applied in iTransformShift, such that the result is 1/sqrt(2) the required result (i.e. smaller) - * Then a QP+3 (sqrt(2)) or QP-3 (1/sqrt(2)) method could be used to get the required result - */ - // Represents scaling through forward transform - int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); -#endif if (useTransformSkip && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag()) { iTransformShift = std::max(0, iTransformShift); } -#if !JVET_N0246_MODIFIED_QUANTSCALES - int iWHScale = 1; -#if HM_QTBT_AS_IN_JEM_QUANT - if( TU::needsBlockSizeTrafoScale( tu, compID ) ) - { - iTransformShift += ADJ_QUANT_SHIFT; - iWHScale = 181; - } -#endif -#endif const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset const int64_t iAdd = int64_t(tu.cs->slice->isIRAP() ? 171 : 85) << int64_t(iQBits - 9); -#if HEVC_USE_SIGN_HIDING const int qBits8 = iQBits - 8; -#endif for (int uiBlockPos = 0; uiBlockPos < piQCoef.area(); uiBlockPos++) { const TCoeff iLevel = piCoef.buf[uiBlockPos]; const TCoeff iSign = (iLevel < 0 ? -1: 1); -#if HEVC_USE_SCALING_LISTS const int64_t tmpLevel = (int64_t)abs(iLevel) * (enableScalingLists ? piQuantCoeff[uiBlockPos] : defaultQuantisationCoefficient); -#else - const int64_t tmpLevel = (int64_t)abs(iLevel) * defaultQuantisationCoefficient; -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES const TCoeff quantisedMagnitude = TCoeff((tmpLevel + iAdd ) >> iQBits); -#if HEVC_USE_SIGN_HIDING deltaU[uiBlockPos] = (TCoeff)((tmpLevel - ((int64_t)quantisedMagnitude<> qBits8); -#endif -#else - const TCoeff quantisedMagnitude = TCoeff((tmpLevel * iWHScale + iAdd ) >> iQBits); -#if HEVC_USE_SIGN_HIDING - deltaU[uiBlockPos] = (TCoeff)((tmpLevel * iWHScale - ((int64_t)quantisedMagnitude<> qBits8); -#endif -#endif uiAbsSum += quantisedMagnitude; const TCoeff quantisedCoefficient = quantisedMagnitude * iSign; piQCoef.buf[uiBlockPos] = Clip3( entropyCodingMinimum, entropyCodingMaximum, quantisedCoefficient ); } // for n -#if JVET_N0413_RDPCM if( tu.cu->bdpcmMode && isLuma(compID) ) { fwdResDPCM( tu, compID ); } -#endif -#if HEVC_USE_SIGN_HIDING if( cctx.signHiding() ) { if(uiAbsSum >= 2) //this prevents TUs with only one coefficient of value 1 from being tested @@ -1135,7 +976,6 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf xSignBitHidingHDQ(piQCoef.buf, piCoef.buf, deltaU, cctx, maxLog2TrDynamicRange); } } -#endif } //if RDOQ //return; } @@ -1144,10 +984,8 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff { const SPS &sps = *tu.cs->sps; const CompArea &rect = tu.blocks[compID]; -#if HEVC_USE_SCALING_LISTS const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; -#endif const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const CCoeffBuf piCoef = pSrc; @@ -1155,7 +993,6 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const bool useTransformSkip = tu.mtsIdx==MTS_SKIP; const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); -#if HEVC_USE_SCALING_LISTS int scalingListType = getScalingListType(tu.cu->predMode, compID); CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); @@ -1164,8 +1001,6 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth-1, uiLog2TrHeight-1); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0)); -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the @@ -1175,39 +1010,15 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem]; int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange) + (needSqrtAdjustment?-1:0); -#else - const int defaultQuantisationCoefficient = g_quantScales[cQP.rem]; - - /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be - * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the - * uiLog2TrSize applied in iTransformShift, such that the result is 1/sqrt(2) the required result (i.e. smaller) - * Then a QP+3 (sqrt(2)) or QP-3 (1/sqrt(2)) method could be used to get the required result - */ - - // Represents scaling through forward transform - int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); -#endif if (useTransformSkip && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag()) { iTransformShift = std::max(0, iTransformShift); } -#if !JVET_N0246_MODIFIED_QUANTSCALES - int iWHScale = 1; -#if HM_QTBT_AS_IN_JEM_QUANT - if( TU::needsBlockSizeTrafoScale( tu, compID ) ) - { - iTransformShift += ADJ_QUANT_SHIFT; - iWHScale = 181; - } -#endif -#endif const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; -#if JVET_N0246_MODIFIED_QUANTSCALES assert(iQBits>=0); -#endif // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset // iAdd is different from the iAdd used in normal quantization @@ -1216,16 +1027,8 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff for (int uiBlockPos = 0; uiBlockPos < rect.area(); uiBlockPos++) { const TCoeff iLevel = piCoef.buf[uiBlockPos]; -#if HEVC_USE_SCALING_LISTS const int64_t tmpLevel = (int64_t)abs(iLevel) * (enableScalingLists ? piQuantCoeff[uiBlockPos] : defaultQuantisationCoefficient); -#else - const int64_t tmpLevel = (int64_t)abs(iLevel) * defaultQuantisationCoefficient; -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES const TCoeff quantisedMagnitude = TCoeff((tmpLevel + iAdd ) >> iQBits); -#else - const TCoeff quantisedMagnitude = TCoeff((tmpLevel * iWHScale + iAdd ) >> iQBits); -#endif if (quantisedMagnitude != 0) { @@ -1240,30 +1043,20 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co { const SPS &sps = *tu.cs->sps; const CompArea &rect = tu.blocks[compID]; -#if HEVC_USE_SCALING_LISTS const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); -#if HEVC_USE_SCALING_LISTS const int scalingListType = getScalingListType(tu.cu->predMode, compID); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true); -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES const int defaultQuantisationCoefficient = g_quantScales[0][cQP.rem]; -#else - const int defaultQuantisationCoefficient = g_quantScales[cQP.rem]; -#endif -#if HEVC_USE_SCALING_LISTS CHECK( scalingListType >= SCALING_LIST_NUM, "Invalid scaling list" ); const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth]; const uint32_t uiLog2TrHeight = g_aucLog2[uiHeight]; const int *const piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth-1, uiLog2TrHeight-1); -#endif /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the @@ -1291,13 +1084,9 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co // quantization const TCoeff iSign = (transformedCoefficient < 0 ? -1: 1); -#if HEVC_USE_SCALING_LISTS const int quantisationCoefficient = enableScalingLists ? piQuantCoeff[uiPos] : defaultQuantisationCoefficient; const int64_t tmpLevel = (int64_t)abs(transformedCoefficient) * quantisationCoefficient; -#else - const int64_t tmpLevel = (int64_t)abs(transformedCoefficient) * defaultQuantisationCoefficient; -#endif const TCoeff quantisedCoefficient = (TCoeff((tmpLevel + iAdd ) >> iQBits)) * iSign; @@ -1310,25 +1099,19 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp { const SPS &sps = *tu.cs->sps; const CompArea &rect = tu.blocks[compID]; -#if HEVC_USE_SCALING_LISTS const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; -#endif const int QP_per = cQP.per; const int QP_rem = cQP.rem; const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); -#if HEVC_USE_SCALING_LISTS const int scalingListType = getScalingListType(tu.cu->predMode, compID); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true); CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); -#else - const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)); -#endif const TCoeff transformMinimum = -(1 << maxLog2TrDynamicRange); const TCoeff transformMaximum = (1 << maxLog2TrDynamicRange) - 1; @@ -1337,7 +1120,6 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp TCoeff dequantisedSample; -#if HEVC_USE_SCALING_LISTS if (enableScalingLists) { const uint32_t dequantCoefBits = 1 + IQUANT_SHIFT + SCALING_LIST_BITS; @@ -1369,12 +1151,7 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp } else { -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES const int scale = g_invQuantScales[0][QP_rem]; -#else - const int scale = g_invQuantScales[QP_rem]; -#endif const int scaleBits = (IQUANT_SHIFT + 1); const uint32_t targetInputBitDepth = std::min((maxLog2TrDynamicRange + 1), (((sizeof(Intermediate_Int) * 8) + rightShift) - scaleBits)); @@ -1397,9 +1174,7 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp dequantisedSample = TCoeff(Clip3(transformMinimum, transformMaximum, iCoeffQ)); } -#if HEVC_USE_SCALING_LISTS } -#endif // Inverse transform-skip diff --git a/source/Lib/CommonLib/Quant.h b/source/Lib/CommonLib/Quant.h index 134c5457890cd208dc123333638bd0827bb9a70b..b53de50b4884da9a9f8f4b2c5238beaf5eb56078 100644 --- a/source/Lib/CommonLib/Quant.h +++ b/source/Lib/CommonLib/Quant.h @@ -58,13 +58,11 @@ // ==================================================================================================================== // Class definition // ==================================================================================================================== -#if JVET_N0413_RDPCM struct TrQuantParams { int rightShift; int qScale; }; -#endif /// QP struct struct QpParam @@ -117,32 +115,19 @@ public: void setLambda ( const double dLambda ) { m_dLambda = dLambda; } double getLambda () const { return m_dLambda; } -#if HEVC_USE_SCALING_LISTS int* getQuantCoeff ( uint32_t list, int qp, uint32_t sizeX, uint32_t sizeY ) { return m_quantCoef [sizeX][sizeY][list][qp]; }; //!< get Quant Coefficent int* getDequantCoeff ( uint32_t list, int qp, uint32_t sizeX, uint32_t sizeY ) { return m_dequantCoef [sizeX][sizeY][list][qp]; }; //!< get DeQuant Coefficent void setUseScalingList ( bool bUseScalingList){ m_scalingListEnabledFlag = bUseScalingList; }; -#if JVET_N0847_SCALING_LISTS bool getUseScalingList ( const uint32_t width, const uint32_t height, const bool isTransformSkip) { return (m_scalingListEnabledFlag && !isTransformSkip); }; -#else - bool getUseScalingList ( const uint32_t width, const uint32_t height, const bool isTransformSkip) { return (m_scalingListEnabledFlag && (!isTransformSkip || ((width == 4) && (height == 4)))); }; -#endif void setScalingListDec ( const ScalingList &scalingList); -#if JVET_N0246_MODIFIED_QUANTSCALES void processScalingListEnc ( int *coeff, int *quantcoeff, int qpMod6, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); void processScalingListDec ( const int *coeff, int *dequantcoeff, int qpMod6, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); -#else - void processScalingListEnc ( int *coeff, int *quantcoeff, int quantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); - void processScalingListDec ( const int *coeff, int *dequantcoeff, int invQuantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); -#endif -#if JVET_N0847_SCALING_LISTS void processRecScalingListEnc ( int *coeff, int *quantcoeff, int quantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); void processRecScalingListDec ( const int *coeff, int *dequantcoeff, int invQuantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); -#endif virtual void setFlatScalingList( const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths); virtual void setScalingList ( ScalingList *scalingList, const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths); -#endif // quantization virtual void quant ( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx ); @@ -166,34 +151,26 @@ protected: #if T0196_SELECTIVE_RDOQ bool m_useSelectiveRDOQ; #endif -#if HEVC_USE_SCALING_LISTS private: void xInitScalingList ( const Quant* other ); void xDestroyScalingList(); void xSetFlatScalingList( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp ); void xSetScalingListEnc ( ScalingList *scalingList, uint32_t list, uint32_t size, int qp ); void xSetScalingListDec ( const ScalingList &scalingList, uint32_t list, uint32_t size, int qp ); -#if JVET_N0847_SCALING_LISTS void xSetRecScalingListEnc( ScalingList *scalingList, uint32_t list, uint32_t sizew, uint32_t sizeh, int qp ); void xSetRecScalingListDec( const ScalingList &scalingList, uint32_t list, uint32_t sizew, uint32_t sizeh, int qp ); -#endif -#endif -#if HEVC_USE_SIGN_HIDING private: void xSignBitHidingHDQ (TCoeff* pQCoef, const TCoeff* pCoef, TCoeff* deltaU, const CoeffCodingContext& cctx, const int maxLog2TrDynamicRange); -#endif private: #if RDOQ_CHROMA_LAMBDA double m_lambdas[MAX_NUM_COMPONENT]; #endif -#if HEVC_USE_SCALING_LISTS bool m_scalingListEnabledFlag; bool m_isScalingListOwner; int *m_quantCoef [SCALING_LIST_SIZE_NUM][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][SCALING_LIST_REM_NUM]; ///< array of quantization matrix coefficient 4x4 int *m_dequantCoef [SCALING_LIST_SIZE_NUM][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][SCALING_LIST_REM_NUM]; ///< array of dequantization matrix coefficient 4x4 -#endif };// END CLASS DEFINITION Quant diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 3f79f95817527d1161eb3e3b584e9201e4b401a8..82039dd613dd2b4b49afd3eba8f60220f43919ea 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -82,16 +82,12 @@ QuantRDOQ::QuantRDOQ( const Quant* other ) : Quant( other ) const QuantRDOQ *rdoq = dynamic_cast( other ); CHECK( other && !rdoq, "The RDOQ cast must be successfull!" ); -#if HEVC_USE_SCALING_LISTS xInitScalingList( rdoq ); -#endif } QuantRDOQ::~QuantRDOQ() { -#if HEVC_USE_SCALING_LISTS xDestroyScalingList(); -#endif } @@ -347,7 +343,6 @@ inline double QuantRDOQ::xGetIEPRate ( -#if HEVC_USE_SCALING_LISTS /** set quantized matrix coefficient for encode * \param scalingList quantized matrix address * \param format chroma format @@ -377,7 +372,6 @@ void QuantRDOQ::setScalingList(ScalingList *scalingList, const int maxLog2TrDyna -#if JVET_N0847_SCALING_LISTS double QuantRDOQ::xGetErrScaleCoeff(const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth) { const int iTransformShift = getTransformShift(channelBitDepth, Size(width, height), maxLog2TrDynamicRange); @@ -388,45 +382,9 @@ double QuantRDOQ::xGetErrScaleCoeff(const bool needsSqrt2, SizeType width, SizeT double finalErrScale = dErrScale / QStep / QStep / (1 << (DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth) << 1)); return finalErrScale; } -#endif -#if HM_QTBT_AS_IN_JEM_QUANT -#endif -#else - -#if JVET_N0246_MODIFIED_QUANTSCALES -double QuantRDOQ::xGetErrScaleCoeff( const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth ) -{ - const int iTransformShift = getTransformShift(channelBitDepth, Size(width, height), maxLog2TrDynamicRange); - double dErrScale = (double)( 1 << SCALE_BITS ); // Compensate for scaling of bitcount in Lagrange cost function - double dTransShift = (double)iTransformShift + ( needsSqrt2 ? -0.5 : 0.0 ); - dErrScale = dErrScale*pow( 2.0, ( -2.0*dTransShift ) ); // Compensate for scaling through forward transform - const int QStep = g_quantScales[needsSqrt2?1:0][qp]; - double finalErrScale = dErrScale / QStep / QStep / (1 << (DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth) << 1)); - return finalErrScale; -} -#else -double QuantRDOQ::xGetErrScaleCoeff( const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth ) -{ - const int iTransformShift = getTransformShift(channelBitDepth, Size(width, height), maxLog2TrDynamicRange); -#if HM_QTBT_AS_IN_JEM_QUANT - double dErrScale = (double)( 1 << SCALE_BITS ); // Compensate for scaling of bitcount in Lagrange cost function - double dTransShift = (double)iTransformShift + ( needsSqrt2 ? -0.5 : 0.0 ); - dErrScale = dErrScale*pow( 2.0, ( -2.0*dTransShift ) ); // Compensate for scaling through forward transform - int QStep = ( needsSqrt2 ? ( ( g_quantScales[qp] * 181 ) >> 7 ) : g_quantScales[qp] ); - double finalErrScale = dErrScale / QStep / QStep / (1 << (DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth) << 1)); -#else - int errShift = SCALE_BITS - ((iTransformShift + DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)) << 1); - double dErrScale = exp2( double( errShift ) ); - double finalErrScale = dErrScale / double( g_quantScales[qp] * g_quantScales[qp] ); -#endif - return finalErrScale; -} -#endif -#endif -#if HEVC_USE_SCALING_LISTS /** set error scale coefficients * \param list list ID * \param size @@ -446,20 +404,11 @@ void QuantRDOQ::xSetErrScaleCoeff( uint32_t list, uint32_t sizeX, uint32_t sizeY int *piQuantcoeff; double *pdErrScale; piQuantcoeff = getQuantCoeff( list, qp, sizeX, sizeY ); -#if JVET_N0847_SCALING_LISTS pdErrScale = xGetErrScaleCoeffSL( list, sizeX, sizeY, qp); -#else - pdErrScale = xGetErrScaleCoeff( list, sizeX, sizeY, qp ); -#endif -#if HM_QTBT_AS_IN_JEM_QUANT double dErrScale = (double)( 1 << SCALE_BITS ); // Compensate for scaling of bitcount in Lagrange cost function -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needsSqrt2 = ((g_aucLog2[width] + g_aucLog2[height]) & 1) == 1; -#else // !JVET_N0246_MODIFIED_QUANTSCALES - bool needsSqrt2 = TU::needsBlockSizeTrafoScale( Size( g_scalingListSizeX[sizeX], g_scalingListSizeX[sizeY] ) );// ( ( (sizeX+sizeY) & 1 ) !=0 ); -#endif // JVET_N0246_MODIFIED_QUANTSCALES double dTransShift = (double)iTransformShift + ( needsSqrt2 ? -0.5 : 0.0 ); dErrScale = dErrScale*pow( 2.0, ( -2.0*dTransShift ) ); // Compensate for scaling through forward transform @@ -469,23 +418,10 @@ void QuantRDOQ::xSetErrScaleCoeff( uint32_t list, uint32_t sizeX, uint32_t sizeY / (1 << (DISTORTION_PRECISION_ADJUSTMENT(bitDepths.recon[channelType]) << 1)); } -#if JVET_N0246_MODIFIED_QUANTSCALES int QStep = g_quantScales[needsSqrt2][qp]; -#else - int QStep = ( needsSqrt2 ? ( ( g_quantScales[qp] * 181 ) >> 7 ) : g_quantScales[qp] ); -#endif xGetErrScaleCoeffNoScalingList(list, sizeX, sizeY, qp) = dErrScale / QStep / QStep / (1 << (DISTORTION_PRECISION_ADJUSTMENT(bitDepths.recon[channelType]) << 1)); -#else - int errShift = SCALE_BITS - ((iTransformShift + DISTORTION_PRECISION_ADJUSTMENT(bitDepths.recon[channelType])) << 1); - double dErrScale = exp2( double( errShift ) ); - for( i = 0; i < uiMaxNumCoeff; i++ ) - { - pdErrScale[i] = dErrScale / double( piQuantcoeff[i] * piQuantcoeff[i] ); - } - xGetErrScaleCoeffNoScalingList( list, sizeX, sizeY, qp ) = dErrScale / double( g_quantScales[qp] * g_quantScales[qp] ); -#endif } /** set flat matrix value to quantized coefficient @@ -564,7 +500,6 @@ void QuantRDOQ::xDestroyScalingList() } // Quant::destroyScalingList(); } -#endif void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx) @@ -592,10 +527,8 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff if (!m_useSelectiveRDOQ || xNeedRDOQ(tu, compID, piCoef, cQP)) { #endif -#if JVET_N0280_RESIDUAL_CODING_TS if( isLuma( compID ) && useTransformSkip ) { -#if JVET_N0413_RDPCM if( tu.cu->bdpcmMode && isLuma(compID) ) { forwardRDPCM( tu, compID, pSrc, uiAbsSum, cQP, ctx ); @@ -604,17 +537,11 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff { xRateDistOptQuantTS( tu, compID, pSrc, uiAbsSum, cQP, ctx ); } -#else - xRateDistOptQuantTS( tu, compID, pSrc, uiAbsSum, cQP, ctx ); -#endif } else { xRateDistOptQuant( tu, compID, pSrc, uiAbsSum, cQP, ctx ); } -#else - xRateDistOptQuant( tu, compID, pSrc, uiAbsSum, cQP, ctx ); -#endif #if T0196_SELECTIVE_RDOQ } else @@ -663,18 +590,14 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, double d64BlockUncodedCost = 0; const uint32_t uiLog2BlockWidth = g_aucLog2[uiWidth]; -#if HEVC_USE_SCALING_LISTS const uint32_t uiLog2BlockHeight = g_aucLog2[uiHeight]; -#endif const uint32_t uiMaxNumCoeff = rect.area(); CHECK(compID >= MAX_NUM_TBLOCKS, "Invalid component ID"); -#if HEVC_USE_SCALING_LISTS int scalingListType = getScalingListType(tu.cu->predMode, compID); CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); -#endif const TCoeff *plSrcCoeff = pSrc.buf; TCoeff *piDstCoeff = tu.getCoeffs(compID).buf; @@ -682,82 +605,34 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, double *pdCostCoeff = m_pdCostCoeff; double *pdCostSig = m_pdCostSig; double *pdCostCoeff0 = m_pdCostCoeff0; -#if HEVC_USE_SIGN_HIDING int *rateIncUp = m_rateIncUp; int *rateIncDown = m_rateIncDown; int *sigRateDelta = m_sigRateDelta; TCoeff *deltaU = m_deltaU; -#endif memset(piDstCoeff, 0, sizeof(*piDstCoeff) * uiMaxNumCoeff); memset( m_pdCostCoeff, 0, sizeof( double ) * uiMaxNumCoeff ); memset( m_pdCostSig, 0, sizeof( double ) * uiMaxNumCoeff ); -#if HEVC_USE_SIGN_HIDING memset( m_rateIncUp, 0, sizeof( int ) * uiMaxNumCoeff ); memset( m_rateIncDown, 0, sizeof( int ) * uiMaxNumCoeff ); memset( m_sigRateDelta, 0, sizeof( int ) * uiMaxNumCoeff ); memset( m_deltaU, 0, sizeof( TCoeff ) * uiMaxNumCoeff ); -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); -#if HEVC_USE_SCALING_LISTS -#if JVET_N0847_SCALING_LISTS const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, (uiLog2BlockWidth - 1), (uiLog2BlockHeight - 1), cQP.rem); -#else - const double *const pdErrScale = xGetErrScaleCoeff(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem); -#endif const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1)); const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip); const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem]; const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem); const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift + (needSqrtAdjustment?-1:0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits -#else - const int quantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem]; - const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale( tu, compID ), uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth ); - const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift + (needSqrtAdjustment?-1:0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits -#endif // HEVC_USE_SCALING_LISTS -#else // JVET_N0246_MODIFIED_QUANTSCALES - const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits - -#if HEVC_USE_SCALING_LISTS - const double *const pdErrScale = xGetErrScaleCoeff(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem); - const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1)); - - const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, tu.transformSkip[compID]); -#if HM_QTBT_AS_IN_JEM_QUANT - const int defaultQuantisationCoefficient = ( TU::needsSqrt2Scale( rect, tu.transformSkip[compID] ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] ); - const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem); -#else - const double blkErrScale = ( TU::needsQP3Offset( tu, compID ) ? 2.0 : 1.0 ); - const int defaultQuantisationCoefficient = g_quantScales[cQP.rem]; - const double defaultErrorScale = blkErrScale * xGetErrScaleCoeffNoScalingList( scalingListType, ( uiLog2BlockWidth - 1 ), ( uiLog2BlockHeight - 1 ), cQP.rem ); -#endif -#else //HEVC_USE_SCALING_LISTS -#if HM_QTBT_AS_IN_JEM_QUANT - const int quantisationCoefficient = ( TU::needsSqrt2Scale( tu, compID ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] ); - const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale( tu, compID ), uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth ); -#else - const double blkErrScale = ( TU::needsQP3Offset( tu, compID ) ? 2.0 : 1.0 ); - const int quantisationCoefficient = g_quantScales[cQP.rem]; - const double errorScale = blkErrScale * xGetErrScaleCoeff( uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth ); -#endif -#endif//HEVC_USE_SCALING_LISTS -#endif // JVET_N0246_MODIFIED_QUANTSCALES -#if HEVC_USE_SIGN_HIDING const TCoeff entropyCodingMinimum = -(1 << maxLog2TrDynamicRange); -#endif const TCoeff entropyCodingMaximum = (1 << maxLog2TrDynamicRange) - 1; -#if HEVC_USE_SIGN_HIDING CoeffCodingContext cctx(tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag()); -#else - CoeffCodingContext cctx(tu, compID); -#endif const int iCGSizeM1 = (1 << cctx.log2CGSize()) - 1; int iCGLastScanPos = -1; @@ -779,26 +654,21 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, DTRACE( g_trace_ctx, D_RDOQ, "%d: %3d, %3d, %dx%d, comp=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_RDOQ ), rect.x, rect.y, rect.width, rect.height, compID ); #endif -#if JVET_N0193_LFNST const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#endif for (int subSetId = iCGNum - 1; subSetId >= 0; subSetId--) { cctx.initSubblock( subSetId ); -#if JVET_N0193_LFNST uint32_t maxNonZeroPosInCG = iCGSizeM1; if( lfnstIdx > 0 && ( ( uiWidth == 4 && uiHeight == 4 ) || ( uiWidth == 8 && uiHeight == 8 && cctx.cgPosX() == 0 && cctx.cgPosY() == 0 ) ) ) { maxNonZeroPosInCG = 7; } -#endif memset( &rdStats, 0, sizeof (coeffGroupRDStats)); -#if JVET_N0193_LFNST for( int iScanPosinCG = iCGSizeM1; iScanPosinCG > maxNonZeroPosInCG; iScanPosinCG-- ) { iScanPos = cctx.minSubPos() + iScanPosinCG; @@ -806,23 +676,14 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, piDstCoeff[ blkPos ] = 0; } for( int iScanPosinCG = maxNonZeroPosInCG; iScanPosinCG >= 0; iScanPosinCG-- ) -#else - for (int iScanPosinCG = iCGSizeM1; iScanPosinCG >= 0; iScanPosinCG--) -#endif { iScanPos = cctx.minSubPos() + iScanPosinCG; //===== quantization ===== uint32_t uiBlkPos = cctx.blockPos(iScanPos); // set coeff -#if HEVC_USE_SCALING_LISTS const int quantisationCoefficient = (enableScalingLists) ? piQCoef [uiBlkPos] : defaultQuantisationCoefficient; -#if HM_QTBT_AS_IN_JEM_QUANT const double errorScale = (enableScalingLists) ? pdErrScale[uiBlkPos] : defaultErrorScale; -#else - const double errorScale = (enableScalingLists) ? pdErrScale[uiBlkPos] * blkErrScale : defaultErrorScale; -#endif -#endif const int64_t tmpLevel = int64_t(abs(plSrcCoeff[ uiBlkPos ])) * quantisationCoefficient; const Intermediate_Int lLevelDouble = (Intermediate_Int)std::min(tmpLevel, std::numeric_limits::max() - (Intermediate_Int(1) << (iQBits - 1))); @@ -864,11 +725,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, uint32_t goRiceZero = 0; if( remRegBins < 4 ) { -#if JVET_N0188_UNIFY_RICEPARA unsigned sumAbs = cctx.templateAbsSum( iScanPos, piDstCoeff, 0 ); -#else - unsigned sumAbs = cctx.templateAbsSum( iScanPos, piDstCoeff ); -#endif goRiceParam = g_auiGoRiceParsCoeff [ sumAbs ]; goRiceZero = g_auiGoRicePosCoeff0[0][ sumAbs ]; } @@ -889,16 +746,13 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const BinFracBits fracBitsSig = fracBits.getFracBitsArray( ctxIdSig ); uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, &fracBitsSig, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, iQBits, errorScale, 0, extendedPrecision, maxLog2TrDynamicRange ); -#if HEVC_USE_SIGN_HIDING sigRateDelta[ uiBlkPos ] = ( remRegBins < 4 ? 0 : fracBitsSig.intBits[1] - fracBitsSig.intBits[0] ); -#endif } DTRACE( g_trace_ctx, D_RDOQ, " Lev=%d \n", uiLevel ); DTRACE_COND( ( uiMaxAbsLevel != 0 ), g_trace_ctx, D_RDOQ, " CostC0=%d\n", (int64_t)( pdCostCoeff0[iScanPos] ) ); DTRACE_COND( ( uiMaxAbsLevel != 0 ), g_trace_ctx, D_RDOQ, " CostC =%d\n", (int64_t)( pdCostCoeff[iScanPos] ) ); -#if HEVC_USE_SIGN_HIDING deltaU[ uiBlkPos ] = TCoeff((lLevelDouble - (Intermediate_Int(uiLevel) << iQBits)) >> (iQBits-8)); if( uiLevel > 0 ) @@ -919,7 +773,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, rateIncUp [ uiBlkPos ] = fracBitsGt1.intBits[ 0 ]; } } -#endif piDstCoeff[ uiBlkPos ] = uiLevel; d64BaseCost += pdCostCoeff [ iScanPos ]; @@ -931,16 +784,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, } else if( remRegBins >= 4 ) { -#if JVET_N0188_UNIFY_RICEPARA int sumAll = cctx.templateAbsSum(iScanPos, piDstCoeff, 4); goRiceParam = g_auiGoRiceParsCoeff[sumAll]; -#else - const uint32_t baseLevel = 4; - if( goRiceParam < 3 && ((uiLevel-baseLevel)>>1) > (3<= 0; iScanPosinCG-- ) -#else - for (int iScanPosinCG = iCGSizeM1; iScanPosinCG >= 0; iScanPosinCG--) -#endif { iScanPos = cctx.minSubPos() + iScanPosinCG; uint32_t uiBlkPos = cctx.blockPos( iScanPos ); @@ -1098,13 +939,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, int lastBitsX[LAST_SIGNIFICANT_GROUPS] = { 0 }; int lastBitsY[LAST_SIGNIFICANT_GROUPS] = { 0 }; { -#if HEVC_USE_MDCS - int dim1 = ( cctx.scanType() == SCAN_VER ? uiHeight : uiWidth ); - int dim2 = ( cctx.scanType() == SCAN_VER ? uiWidth : uiHeight ); -#else int dim1 = std::min(JVET_C0024_ZERO_OUT_TH, uiWidth); int dim2 = std::min(JVET_C0024_ZERO_OUT_TH, uiHeight); -#endif int bitsX = 0; int bitsY = 0; int ctxId; @@ -1133,16 +969,12 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, d64BaseCost -= pdCostCoeffGroupSig [ iCGScanPos ]; if (cctx.isSigGroup( iCGScanPos ) ) { -#if JVET_N0193_LFNST uint32_t maxNonZeroPosInCG = iCGSizeM1; if( lfnstIdx > 0 && ( ( uiWidth == 4 && uiHeight == 4 ) || ( uiWidth == 8 && uiHeight == 8 && cctx.cgPosX() == 0 && cctx.cgPosY() == 0 ) ) ) { maxNonZeroPosInCG = 7; } for( int iScanPosinCG = maxNonZeroPosInCG; iScanPosinCG >= 0; iScanPosinCG-- ) -#else - for (int iScanPosinCG = iCGSizeM1; iScanPosinCG >= 0; iScanPosinCG--) -#endif { iScanPos = iCGScanPos * (iCGSizeM1 + 1) + iScanPosinCG; @@ -1156,11 +988,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, { uint32_t uiPosY = uiBlkPos >> uiLog2BlockWidth; uint32_t uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockWidth ); -#if HEVC_USE_MDCS - double d64CostLast = ( cctx.scanType() == SCAN_VER ? xGetRateLast( lastBitsX, lastBitsY, uiPosY, uiPosX ) : xGetRateLast( lastBitsX, lastBitsY, uiPosX, uiPosY ) ); -#else double d64CostLast = xGetRateLast( lastBitsX, lastBitsY, uiPosX, uiPosY ); -#endif double totalCost = d64BaseCost + d64CostLast - pdCostSig[ iScanPos ]; @@ -1208,20 +1036,11 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, piDstCoeff[ cctx.blockPos( scanPos ) ] = 0; } -#if HEVC_USE_SIGN_HIDING if( cctx.signHiding() && uiAbsSum>=2) { -#if JVET_N0246_MODIFIED_QUANTSCALES const double inverseQuantScale = double(g_invQuantScales[0][cQP.rem]); -#else - const double inverseQuantScale = double(g_invQuantScales[cQP.rem]); -#endif int64_t rdFactor = (int64_t)(inverseQuantScale * inverseQuantScale * (1 << (2 * cQP.per)) / m_dLambda / 16 / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth))) -#if HM_QTBT_AS_IN_JEM_QUANT -#else - * blkErrScale -#endif + 0.5); int lastCG = -1; @@ -1347,10 +1166,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, } } } -#endif } -#if JVET_N0280_RESIDUAL_CODING_TS void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &coeffs, TCoeff &absSum, const QpParam &qp, const Ctx &ctx ) { const FracBitsAccess& fracBits = ctx.getFracBitsAcess(); @@ -1373,17 +1190,12 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI } double blockUncodedCost = 0; -#if HEVC_USE_SCALING_LISTS && !JVET_N0847_SCALING_LISTS - const uint32_t log2BlockHeight = g_aucLog2[height]; -#endif const uint32_t maxNumCoeff = rect.area(); CHECK( compID >= MAX_NUM_TBLOCKS, "Invalid component ID" ); -#if HEVC_USE_SCALING_LISTS int scalingListType = getScalingListType( tu.cu->predMode, compID ); CHECK( scalingListType >= SCALING_LIST_NUM, "Invalid scaling list" ); -#endif const TCoeff *srcCoeff = coeffs.buf; TCoeff *dstCoeff = tu.getCoeffs( compID ).buf; @@ -1395,32 +1207,14 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI memset( m_pdCostCoeff, 0, sizeof( double ) * maxNumCoeff ); memset( m_pdCostSig, 0, sizeof( double ) * maxNumCoeff ); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needsSqrt2Scale = TU::needsSqrt2Scale( tu, compID ); // should always be false - transform-skipped blocks don't require sqrt(2) compensation. const int qBits = QUANT_SHIFT + qp.per + transformShift + (needsSqrt2Scale?-1:0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits const int quantisationCoefficient = g_quantScales[needsSqrt2Scale?1:0][qp.rem]; const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale( tu, compID ), width, height, qp.rem, maxLog2TrDynamicRange, channelBitDepth ); -#else - - const int qBits = QUANT_SHIFT + qp.per + transformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits - -#if HM_QTBT_AS_IN_JEM_QUANT - const int quantisationCoefficient = ( TU::needsSqrt2Scale( tu, compID ) ? ( g_quantScales[qp.rem] * 181 ) >> 7 : g_quantScales[qp.rem] ); - const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale( tu, compID ), width, height, qp.rem, maxLog2TrDynamicRange, channelBitDepth ); -#else - const double blkErrScale = ( TU::needsQP3Offset( tu, compID ) ? 2.0 : 1.0 ); - const int quantisationCoefficient = g_quantScales[qp.rem]; - const double errorScale = blkErrScale * xGetErrScaleCoeff( width, height, qp.rem, maxLog2TrDynamicRange, channelBitDepth ); -#endif -#endif const TCoeff entropyCodingMaximum = ( 1 << maxLog2TrDynamicRange ) - 1; -#if HEVC_USE_SIGN_HIDING CoeffCodingContext cctx( tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag() ); -#else - CoeffCodingContext cctx( tu, compID ); -#endif const int sbSizeM1 = ( 1 << cctx.log2CGSize() ) - 1; double baseCost = 0; uint32_t goRiceParam = 0; @@ -1551,7 +1345,6 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI } } -#if JVET_N0413_RDPCM void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &coeffs, TCoeff &absSum, const QpParam &qp, const Ctx &ctx ) { const FracBitsAccess& fracBits = ctx.getFracBitsAcess(); @@ -1575,17 +1368,12 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons } double blockUncodedCost = 0; -#if HEVC_USE_SCALING_LISTS && !JVET_N0847_SCALING_LISTS - const uint32_t log2BlockHeight = g_aucLog2[height]; -#endif const uint32_t maxNumCoeff = rect.area(); CHECK(compID >= MAX_NUM_TBLOCKS, "Invalid component ID"); -#if HEVC_USE_SCALING_LISTS int scalingListType = getScalingListType(tu.cu->predMode, compID); CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); -#endif const TCoeff *srcCoeff = coeffs.buf; TCoeff *dstCoeff = tu.getCoeffs(compID).buf; @@ -1598,7 +1386,6 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons memset(m_pdCostSig, 0, sizeof(double) * maxNumCoeff); memset(m_fullCoeff, 0, sizeof(TCoeff) * maxNumCoeff); -#if JVET_N0246_MODIFIED_QUANTSCALES const bool needsSqrt2Scale = TU::needsSqrt2Scale(tu, compID); // should always be false - transform-skipped blocks don't require sqrt(2) compensation. const int qBits = QUANT_SHIFT + qp.per + transformShift + (needsSqrt2Scale ? -1 : 0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits const int quantisationCoefficient = g_quantScales[needsSqrt2Scale ? 1 : 0][qp.rem]; @@ -1607,27 +1394,10 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons TrQuantParams trQuantParams; trQuantParams.rightShift = (IQUANT_SHIFT - (transformShift + qp.per)); trQuantParams.qScale = g_invQuantScales[needsSqrt2Scale ? 1 : 0][qp.rem]; -#else - - const int qBits = QUANT_SHIFT + qp.per + transformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits - -#if HM_QTBT_AS_IN_JEM_QUANT - const int quantisationCoefficient = (TU::needsSqrt2Scale(tu, compID) ? (g_quantScales[qp.rem] * 181) >> 7 : g_quantScales[qp.rem]); - const double errorScale = xGetErrScaleCoeff(TU::needsSqrt2Scale(tu, compID), width, height, qp.rem, maxLog2TrDynamicRange, channelBitDepth); -#else - const double blkErrScale = (TU::needsQP3Offset(tu, compID) ? 2.0 : 1.0); - const int quantisationCoefficient = g_quantScales[qp.rem]; - const double errorScale = blkErrScale * xGetErrScaleCoeff(width, height, qp.rem, maxLog2TrDynamicRange, channelBitDepth); -#endif -#endif const TCoeff entropyCodingMaximum = (1 << maxLog2TrDynamicRange) - 1; -#if HEVC_USE_SIGN_HIDING CoeffCodingContext cctx(tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag()); -#else - CoeffCodingContext cctx(tu, compID); -#endif const int sbSizeM1 = (1 << cctx.log2CGSize()) - 1; double baseCost = 0; uint32_t goRiceParam = 0; @@ -1790,7 +1560,6 @@ void QuantRDOQ::xDequantSample(TCoeff& pRes, TCoeff& coeff, const TrQuantParams& pRes = TCoeff((Intermediate_Int(coeff) * trQuantParams.qScale) << -trQuantParams.rightShift); } } -#endif inline uint32_t QuantRDOQ::xGetCodedLevelTS( double& codedCost, double& codedCost0, double& codedCostSig, @@ -1932,6 +1701,5 @@ inline int QuantRDOQ::xGetICRateTS( const uint32_t absLevel, } return rate; } -#endif //! \} diff --git a/source/Lib/CommonLib/QuantRDOQ.h b/source/Lib/CommonLib/QuantRDOQ.h index ecc45551cdfcc942a328274b0e83a23d421bee09..213089850c27c0e38ad1b8be15321ae002f8a64e 100644 --- a/source/Lib/CommonLib/QuantRDOQ.h +++ b/source/Lib/CommonLib/QuantRDOQ.h @@ -61,34 +61,20 @@ public: ~QuantRDOQ(); public: -#if HEVC_USE_SCALING_LISTS void setFlatScalingList ( const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths ); void setScalingList ( ScalingList *scalingList, const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths); -#endif // quantization void quant ( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx ); -#if JVET_N0413_RDPCM void forwardRDPCM ( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx &ctx ); -#endif private: -#if HEVC_USE_SCALING_LISTS -#if JVET_N0847_SCALING_LISTS double* xGetErrScaleCoeffSL ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp ) { return m_errScale[sizeX][sizeY][list][qp]; }; //!< get Error Scale Coefficent double xGetErrScaleCoeff ( const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth); -#else - double* xGetErrScaleCoeff ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp ) { return m_errScale [sizeX][sizeY][list][qp]; }; //!< get Error Scale Coefficent -#endif double& xGetErrScaleCoeffNoScalingList ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp ) { return m_errScaleNoScalingList[sizeX][sizeY][list][qp]; }; //!< get Error Scale Coefficent void xInitScalingList ( const QuantRDOQ* other ); void xDestroyScalingList (); void xSetErrScaleCoeff ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp, const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths ); -#else - double xGetErrScaleCoeff ( const bool needsSqrt2, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth); -#endif -#if JVET_N0413_RDPCM void xDequantSample ( TCoeff& pRes, TCoeff& coeff, const TrQuantParams& trQuantParams ); -#endif // RDOQ functions void xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx &ctx); @@ -130,7 +116,6 @@ private: inline double xGetICost ( double dRate ) const; inline double xGetIEPRate ( ) const; -#if JVET_N0280_RESIDUAL_CODING_TS void xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &coeffs, TCoeff &absSum, const QpParam &qp, const Ctx &ctx ); inline uint32_t xGetCodedLevelTS( double& codedCost, @@ -160,28 +145,21 @@ private: const uint16_t ricePar, const bool useLimitedPrefixLength, const int maxLog2TrDynamicRange ) const; -#endif private: -#if HEVC_USE_SCALING_LISTS bool m_isErrScaleListOwner; double *m_errScale [SCALING_LIST_SIZE_NUM][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][SCALING_LIST_REM_NUM]; ///< array of quantization matrix coefficient 4x4 double m_errScaleNoScalingList[SCALING_LIST_SIZE_NUM][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][SCALING_LIST_REM_NUM]; ///< array of quantization matrix coefficient 4x4 -#endif // temporary buffers for RDOQ double m_pdCostCoeff [MAX_TB_SIZEY * MAX_TB_SIZEY]; double m_pdCostSig [MAX_TB_SIZEY * MAX_TB_SIZEY]; double m_pdCostCoeff0 [MAX_TB_SIZEY * MAX_TB_SIZEY]; double m_pdCostCoeffGroupSig[(MAX_TB_SIZEY * MAX_TB_SIZEY) >> MLS_CG_SIZE]; // even if CG size is 2 (if one of the sides is 2) instead of 4, there should be enough space -#if HEVC_USE_SIGN_HIDING int m_rateIncUp [MAX_TB_SIZEY * MAX_TB_SIZEY]; int m_rateIncDown [MAX_TB_SIZEY * MAX_TB_SIZEY]; int m_sigRateDelta [MAX_TB_SIZEY * MAX_TB_SIZEY]; TCoeff m_deltaU [MAX_TB_SIZEY * MAX_TB_SIZEY]; -#if JVET_N0413_RDPCM TCoeff m_fullCoeff [MAX_TB_SIZEY * MAX_TB_SIZEY]; -#endif -#endif };// END CLASS DEFINITION QuantRDOQ //! \} diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index 179eca8e0ea283042dcd65c35bb295df7f6bb784..5118b933fa71970ce7ead1723e9ed520fb630c71 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -380,10 +380,8 @@ Distortion RdCost::getDistPart( const CPelBuf &org, const CPelBuf &cur, int bitD #if WCG_EXT if( orgLuma ) { -#if JVET_N0671_RDCOST_FIX cDtParam.cShiftX = getComponentScaleX(compID, m_cf); cDtParam.cShiftY = getComponentScaleY(compID, m_cf); -#endif if( isChroma(compID) ) { cDtParam.orgLuma = *orgLuma; @@ -3028,12 +3026,8 @@ Distortion RdCost::xGetSSE_WTD( const DistParam &rcDtParam ) const int iStrideOrg = rcDtParam.org.stride; const Pel* piOrgLuma = rcDtParam.orgLuma.buf; const int iStrideOrgLuma = rcDtParam.orgLuma.stride; -#if JVET_N0671_RDCOST_FIX const size_t cShift = rcDtParam.cShiftX; const size_t cShiftY = rcDtParam.cShiftY; -#else - const size_t cShift = (rcDtParam.compID==COMPONENT_Y) ? 0 : 1; // assume 420, could use getComponentScaleX, getComponentScaleY -#endif Distortion uiSum = 0; uint32_t uiShift = DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth) << 1; @@ -3046,11 +3040,7 @@ Distortion RdCost::xGetSSE_WTD( const DistParam &rcDtParam ) piOrg += iStrideOrg; piCur += iStrideCur; -#if JVET_N0671_RDCOST_FIX piOrgLuma += iStrideOrgLuma<> uiShift); piOrg += iStrideOrg; piCur += iStrideCur; -#if JVET_N0671_RDCOST_FIX piOrgLuma += iStrideOrgLuma<> uiShift); piOrg += iStrideOrg; piCur += iStrideCur; -#if JVET_N0671_RDCOST_FIX piOrgLuma += iStrideOrgLuma<> uiShift); piOrg += iStrideOrg; piCur += iStrideCur; -#if JVET_N0671_RDCOST_FIX piOrgLuma += iStrideOrgLuma<> uiShift); piOrg += iStrideOrg; piCur += iStrideCur; -#if JVET_N0671_RDCOST_FIX piOrgLuma += iStrideOrgLuma<::max() ), subShift( 0 ) -#if JVET_N0671_RDCOST_FIX , cShiftX(-1), cShiftY(-1) -#endif { } }; @@ -117,9 +113,7 @@ private: static uint32_t m_signalType; static double m_chromaWeight; static int m_lumaBD; -#if JVET_N0671_RDCOST_FIX ChromaFormat m_cf; -#endif // JVET_N0671_RDCOST_FIX #endif double m_DistScale; double m_dLambdaMotionSAD[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/]; @@ -136,9 +130,7 @@ public: virtual ~RdCost(); #if WCG_EXT -#if JVET_N0671_RDCOST_FIX void setChromaFormat ( const ChromaFormat & _cf) { m_cf = _cf; } -#endif double calcRdCost ( uint64_t fracBits, Distortion distortion, bool useUnadjustedLambda = true ); #else double calcRdCost ( uint64_t fracBits, Distortion distortion ); @@ -190,11 +182,7 @@ public: inline Distortion getBvCostMultiplePreds(int x, int y, bool useIMV) { -#if JVET_N0329_IBC_SEARCH_IMP return Distortion(m_dCost * getBitsMultiplePreds(x, y, useIMV)); -#else - return Distortion((m_dCost * getBitsMultiplePreds(x, y, useIMV)) / 65536.0); -#endif } unsigned int getBitsMultiplePreds(int x, int y, bool useIMV) diff --git a/source/Lib/CommonLib/Reshape.cpp b/source/Lib/CommonLib/Reshape.cpp index 9d5cd9f2f435d9abbd811d7b8505bc71629e5a25..e870641baf91168f419232777425ad5f4fcc8d43 100644 --- a/source/Lib/CommonLib/Reshape.cpp +++ b/source/Lib/CommonLib/Reshape.cpp @@ -110,19 +110,10 @@ void Reshape::reverseLUT(std::vector& inputLUT, std::vector& outputLUT for (i = m_reshapePivot[m_sliceReshapeInfo.reshaperModelMaxBinIdx + 1]; i < m_reshapeLUTSize; i++) outputLUT[i] = outputLUT[m_reshapePivot[m_sliceReshapeInfo.reshaperModelMaxBinIdx + 1]]; -#if JVET_N0220_LMCS_SIMPLIFICATION for (i = 0; i < lutSize; i++) { outputLUT[i] = Clip3((Pel)0, (Pel)((1< 0) && (m_sliceReshapeInfo.reshaperModelMaxBinIdx < (PIC_CODE_CW_BINS - 1))); - for (i = 0; i < lutSize; i++) - { - if (clipRange) outputLUT[i] = Clip3((Pel)(16<<(m_lumaBD-8)), (Pel)(235<<(m_lumaBD-8)), outputLUT[i]); - else outputLUT[i] = Clip3((Pel)0, (Pel)((1< 10 ? (m_binCW[i] >> (m_lumaBD - 10)) : m_lumaBD < 10 ? (m_binCW[i] << (10 -m_lumaBD)): m_binCW[i]; - if ((i < m_sliceReshapeInfo.reshaperModelMinBinIdx) || (i > m_sliceReshapeInfo.reshaperModelMaxBinIdx)) - m_chromaAdjHelpLUT[i] = 1 << CSCALE_FP_PREC; - else - m_chromaAdjHelpLUT[i] = CW_bin_SC_LUT[Clip3((uint16_t)1, (uint16_t)64, (uint16_t)(binCW >> 1)) - 1]; - } -#endif } diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 2c72157719a2487c64552402157fd4236ae626b3..43f3a68a92067d488b89f07c672e375f30de7469 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -63,7 +63,6 @@ const char* nalUnitTypeToString(NalUnitType type) { switch (type) { -#if JVET_N0067_NAL_Unit_Header case NAL_UNIT_PPS: return "PPS"; case NAL_UNIT_ACCESS_UNIT_DELIMITER: return "AUD"; case NAL_UNIT_PREFIX_SEI: return "Prefix SEI"; @@ -83,60 +82,6 @@ const char* nalUnitTypeToString(NalUnitType type) case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; case NAL_UNIT_CODED_SLICE_GRA: return "GRA"; default: return "UNK"; -#else -#if JVET_M0101_HLS - case NAL_UNIT_CODED_SLICE_TRAIL: return "TRAIL"; - case NAL_UNIT_CODED_SLICE_STSA: return "STSA"; - case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL"; - case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; - case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; - case NAL_UNIT_CODED_SLICE_RADL: return "RADL"; - case NAL_UNIT_CODED_SLICE_RASL: return "RASL"; -#if HEVC_VPS || JVET_N0278_HLS - case NAL_UNIT_VPS: return "VPS"; -#endif - case NAL_UNIT_SPS: return "SPS"; - case NAL_UNIT_PPS: return "PPS"; - case NAL_UNIT_APS: return "APS"; - case NAL_UNIT_ACCESS_UNIT_DELIMITER: return "AUD"; - case NAL_UNIT_EOS: return "EOS"; - case NAL_UNIT_EOB: return "EOB"; - case NAL_UNIT_FILLER_DATA: return "FILLER"; - case NAL_UNIT_PREFIX_SEI: return "Prefix SEI"; - case NAL_UNIT_SUFFIX_SEI: return "Suffix SEI"; - default: return "UNK"; -#else - case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R"; - case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N"; - case NAL_UNIT_CODED_SLICE_TSA_R: return "TSA_R"; - case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N"; - case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R"; - case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N"; - case NAL_UNIT_CODED_SLICE_BLA_W_LP: return "BLA_W_LP"; - case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL"; - case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP"; - case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL"; - case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; - case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; - case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; - case NAL_UNIT_CODED_SLICE_RADL_N: return "RADL_N"; - case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; - case NAL_UNIT_CODED_SLICE_RASL_N: return "RASL_N"; -#if HEVC_VPS || JVET_N0278_HLS - case NAL_UNIT_VPS: return "VPS"; -#endif - case NAL_UNIT_SPS: return "SPS"; - case NAL_UNIT_PPS: return "PPS"; - case NAL_UNIT_APS: return "APS"; - case NAL_UNIT_ACCESS_UNIT_DELIMITER: return "AUD"; - case NAL_UNIT_EOS: return "EOS"; - case NAL_UNIT_EOB: return "EOB"; - case NAL_UNIT_FILLER_DATA: return "FILLER"; - case NAL_UNIT_PREFIX_SEI: return "Prefix SEI"; - case NAL_UNIT_SUFFIX_SEI: return "Suffix SEI"; - default: return "UNK"; -#endif -#endif } } @@ -185,37 +130,6 @@ public: } break; -#if HEVC_USE_MDCS - //------------------------------------------------ - case SCAN_HOR: - - if (m_column == m_blockWidth - 1) - { - m_line++; - m_column = 0; - } - else - { - m_column++; - } - break; - - //------------------------------------------------ - - case SCAN_VER: - - if (m_line == m_blockHeight - 1) - { - m_column++; - m_line = 0; - } - else - { - m_line++; - } - break; - -#endif //------------------------------------------------ default: @@ -291,7 +205,6 @@ uint32_t deriveWeightIdxBits(uint8_t gbiIdx) // Note: align this with TEncSbac:: return numBits; } -#if JVET_N0103_CGSIZE_HARMONIZATION uint32_t g_log2SbbSize[MAX_CU_DEPTH + 1][MAX_CU_DEPTH + 1][2] = //===== luma/chroma ===== { @@ -304,33 +217,6 @@ uint32_t g_log2SbbSize[MAX_CU_DEPTH + 1][MAX_CU_DEPTH + 1][2] = { { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } }, { { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } } }; -#else -uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] = -{ - //===== luma ===== - { - { {0,0}, {0,1}, {0,2}, {0,3}, {0,4}, {0,4}, {0,4}, {0,4} }, - { {1,0}, {1,1}, {1,2}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3} }, - { {2,0}, {2,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {3,0}, {3,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {4,0}, {3,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {4,0}, {3,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {4,0}, {3,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {4,0}, {3,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} } - }, - //===== chroma ===== - { - { {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }, - { {0,0}, {1,1}, {1,1}, {1,1}, {1,1}, {1,1}, {1,1}, {1,1} }, - { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }, - { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} } - }, -}; -#endif // initialize ROM variables void initROM() { @@ -362,10 +248,6 @@ void initROM() SizeIndexInfoLog2 sizeInfo; sizeInfo.init(MAX_CU_SIZE); -#if !JVET_N0103_CGSIZE_HARMONIZATION - for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) - { -#endif // initialize scan orders for (uint32_t blockHeightIdx = 0; blockHeightIdx < sizeInfo.numAllHeights(); blockHeightIdx++) { @@ -389,11 +271,7 @@ void initROM() scan = new ScanElement[totalValues]; } -#if JVET_N0103_CGSIZE_HARMONIZATION g_scanOrder[SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan; -#else - g_scanOrder[ch][SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan; -#endif if (scan == nullptr) { @@ -417,11 +295,7 @@ void initROM() //-------------------------------------------------------------------------------------------------- //grouped scan orders -#if JVET_N0103_CGSIZE_HARMONIZATION const uint32_t* log2Sbb = g_log2SbbSize[g_aucLog2[blockWidth]][g_aucLog2[blockHeight]]; -#else - const uint32_t* log2Sbb = g_log2SbbSize[ch][ g_aucLog2[blockWidth] ][ g_aucLog2[blockHeight] ]; -#endif const uint32_t log2CGWidth = log2Sbb[0]; const uint32_t log2CGHeight = log2Sbb[1]; @@ -439,11 +313,7 @@ void initROM() ScanElement *scan = new ScanElement[totalValues]; -#if JVET_N0103_CGSIZE_HARMONIZATION g_scanOrder[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan; -#else - g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan; -#endif if ( blockWidth > JVET_C0024_ZERO_OUT_TH || blockHeight > JVET_C0024_ZERO_OUT_TH ) { @@ -485,11 +355,7 @@ void initROM() //-------------------------------------------------------------------------------------------------- } } -#if !JVET_N0103_CGSIZE_HARMONIZATION - } -#endif -#if JVET_N0193_LFNST // initialize CoefTopLeftDiagScan8x8 for LFNST for( uint32_t blockWidthIdx = 0; blockWidthIdx < sizeInfo.numAllWidths(); blockWidthIdx++ ) { @@ -513,7 +379,6 @@ void initROM() g_coefTopLeftDiagScan8x8[ blockWidthIdx ][ i ].y = g_auiXYDiagScan8x8[ i ][ 1 ]; } } -#endif for( int idxH = MAX_CU_DEPTH - MIN_CU_LOG2; idxH >= 0; --idxH ) { @@ -543,7 +408,6 @@ void destroyROM() unsigned numWidths = gp_sizeIdxInfo->numAllWidths(); unsigned numHeights = gp_sizeIdxInfo->numAllHeights(); -#if JVET_N0103_CGSIZE_HARMONIZATION for (uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++) { for (uint32_t scanOrderIndex = 0; scanOrderIndex < SCAN_NUMBER_OF_TYPES; scanOrderIndex++) @@ -558,25 +422,6 @@ void destroyROM() } } } -#else - for( uint32_t ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) - { - for( uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++ ) - { - for( uint32_t scanOrderIndex = 0; scanOrderIndex < SCAN_NUMBER_OF_TYPES; scanOrderIndex++ ) - { - for( uint32_t blockWidthIdx = 0; blockWidthIdx <= numWidths; blockWidthIdx++ ) - { - for( uint32_t blockHeightIdx = 0; blockHeightIdx <= numHeights; blockHeightIdx++ ) - { - delete[] g_scanOrder[ch][groupTypeIndex][scanOrderIndex][blockWidthIdx][blockHeightIdx]; - g_scanOrder[ch][groupTypeIndex][scanOrderIndex][blockWidthIdx][blockHeightIdx] = nullptr; - } - } - } - } - } -#endif delete gp_sizeIdxInfo; gp_sizeIdxInfo = nullptr; @@ -586,7 +431,6 @@ void destroyROM() // Data structure related table & variable // ==================================================================================================================== -#if JVET_N0246_MODIFIED_QUANTSCALES const int g_quantScales[2][SCALING_LIST_REM_NUM] = // can be represented as a 9 element table { { 26214,23302,20560,18396,16384,14564 }, @@ -598,17 +442,6 @@ const int g_invQuantScales[2][SCALING_LIST_REM_NUM] = // can be represented as a { 40,45,51,57,64,72 }, { 57,64,72,80,90,102 } // Note: last 3 values of second row == double of the first 3 values of the first row }; -#else -const int g_quantScales[SCALING_LIST_REM_NUM] = -{ - 26214,23302,20560,18396,16384,14564 -}; - -const int g_invQuantScales[SCALING_LIST_REM_NUM] = -{ - 40,45,51,57,64,72 -}; -#endif //-------------------------------------------------------------------------------------------------- //structures @@ -665,7 +498,6 @@ const uint8_t g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE] = //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, DM { 0, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 6, 8, 10, 12, 13, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 44, 45, 46, 46, 46, 47, 48, 48, 48, 49, 50, 51, 52, 52, 52, 53, 54, 54, 54, 55, 56, 56, 56, 57, 58, 59, 60, DM_CHROMA_IDX }; -#if JVET_N0217_MATRIX_INTRAPRED extern const uint8_t g_intraMode65to33AngMapping[NUM_INTRA_MODE] = // H D V //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, DM @@ -690,7 +522,6 @@ const int g_sortedMipMpms[3][NUM_MPM_MIP] = { 0, 7, 16 }, { 1, 4, 6 }, }; -#endif @@ -710,14 +541,8 @@ UnitScale g_miScaling( MIN_CU_LOG2, MIN_CU_LOG2 ); // ==================================================================================================================== // scanning order table -#if JVET_N0103_CGSIZE_HARMONIZATION ScanElement *g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#else -ScanElement *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#endif -#if JVET_N0193_LFNST ScanElement g_coefTopLeftDiagScan8x8[ MAX_CU_SIZE / 2 + 1 ][ 64 ]; -#endif const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,24,32,48,64,96 }; const uint32_t g_uiGroupIdx[MAX_TB_SIZEY] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 }; @@ -732,10 +557,8 @@ const uint32_t g_auiGoRicePosCoeff0[3][32] = {1, 1, 2, 2, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16} }; -#if HEVC_USE_SCALING_LISTS const char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = { -#if JVET_N0847_SCALING_LISTS { "INTRA1X1_LUMA", "INTRA1X1_CHROMAU", @@ -744,7 +567,6 @@ const char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = "INTER1X1_CHROMAU", "INTER1X1_CHROMAV" }, -#endif { "INTRA2X2_LUMA", "INTRA2X2_CHROMAU", @@ -777,7 +599,6 @@ const char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = "INTER16X16_CHROMAU", "INTER16X16_CHROMAV" }, -#if JVET_N0847_SCALING_LISTS { "INTRA32X32_LUMA", "INTRA32X32_CHROMAU", @@ -796,24 +617,12 @@ const char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = }, { }, -#else - { - "INTRA32X32_LUMA", - "INTRA32X32_CHROMAU_FROM16x16_CHROMAU", - "INTRA32X32_CHROMAV_FROM16x16_CHROMAV", - "INTER32X32_LUMA", - "INTER32X32_CHROMAU_FROM16x16_CHROMAU", - "INTER32X32_CHROMAV_FROM16x16_CHROMAV" - }, -#endif }; const char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = { -#if JVET_N0847_SCALING_LISTS { //1x1 }, -#endif { }, { @@ -828,7 +637,6 @@ const char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = "INTER16X16_CHROMAU_DC", "INTER16X16_CHROMAV_DC" }, -#if JVET_N0847_SCALING_LISTS { "INTRA32X32_LUMA_DC", "INTRA32X32_CHROMAU_DC", @@ -847,16 +655,6 @@ const char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = }, { }, -#else - { - "INTRA32X32_LUMA_DC", - "INTRA32X32_CHROMAU_DC_FROM16x16_CHROMAU", - "INTRA32X32_CHROMAV_DC_FROM16x16_CHROMAV", - "INTER32X32_LUMA_DC", - "INTER32X32_CHROMAU_DC_FROM16x16_CHROMAU", - "INTER32X32_CHROMAV_DC_FROM16x16_CHROMAV" - }, -#endif }; const int g_quantTSDefault4x4[4 * 4] = @@ -869,7 +667,6 @@ const int g_quantTSDefault4x4[4 * 4] = const int g_quantIntraDefault8x8[8 * 8] = { -#if JVET_N0847_SCALING_LISTS 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16, @@ -878,21 +675,10 @@ const int g_quantIntraDefault8x8[8 * 8] = 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16 -#else - 16,16,16,16,17,18,21,24, - 16,16,16,16,17,19,22,25, - 16,16,17,18,20,22,25,29, - 16,16,18,21,24,27,31,36, - 17,17,20,24,30,35,41,47, - 18,19,22,27,35,44,54,65, - 21,22,25,31,41,54,70,88, - 24,25,29,36,47,65,88,115 -#endif }; const int g_quantInterDefault8x8[8 * 8] = { -#if JVET_N0847_SCALING_LISTS 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16, @@ -901,26 +687,10 @@ const int g_quantInterDefault8x8[8 * 8] = 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16 -#else - 16,16,16,16,17,18,20,24, - 16,16,16,17,18,20,24,25, - 16,16,17,18,20,24,25,28, - 16,17,18,20,24,25,28,33, - 17,18,20,24,25,28,33,41, - 18,20,24,25,28,33,41,54, - 20,24,25,28,33,41,54,71, - 24,25,28,33,41,54,71,91 -#endif }; -#if JVET_N0847_SCALING_LISTS const uint32_t g_scalingListSize [SCALING_LIST_SIZE_NUM] = { 1, 4, 16, 64, 256, 1024, 4096, 16384 }; const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -#else -const uint32_t g_scalingListSize [SCALING_LIST_SIZE_NUM] = { 4, 16, 64, 256, 1024, 4096, 16384 }; -const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM] = { 2, 4, 8, 16, 32, 64, 128 }; -#endif -#endif uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index b35701dc19582441ad684c761500943f9d5efd34..01cbe66d8bf7faf50a3b1e73a6b040cdcfd2275a 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -67,36 +67,21 @@ struct ScanElement uint16_t y; }; -#if JVET_N0103_CGSIZE_HARMONIZATION extern uint32_t g_log2SbbSize[MAX_CU_DEPTH + 1][MAX_CU_DEPTH + 1][2]; extern ScanElement *g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#else -extern uint32_t g_log2SbbSize [2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2]; -extern ScanElement - *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; -#endif -#if JVET_N0193_LFNST extern ScanElement g_coefTopLeftDiagScan8x8[ MAX_CU_SIZE / 2 + 1 ][ 64 ]; -#endif -#if JVET_N0246_MODIFIED_QUANTSCALES extern const int g_quantScales [2/*0=4^n blocks, 1=2*4^n blocks*/][SCALING_LIST_REM_NUM]; // Q(QP%6) extern const int g_invQuantScales[2/*0=4^n blocks, 1=2*4^n blocks*/][SCALING_LIST_REM_NUM]; // IQ(QP%6) -#else -extern const int g_quantScales [SCALING_LIST_REM_NUM]; // Q(QP%6) -extern const int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6) -#endif static const int g_numTransformMatrixSizes = 6; static const int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 6, 6 }; -#if JVET_N0217_MATRIX_INTRAPRED extern const uint8_t g_intraMode65to33AngMapping[NUM_INTRA_MODE]; extern const uint8_t g_mapMipToAngular65[3][MAX_NUM_MIP_MODE]; extern const uint8_t g_mapAngular33ToMip[3][35]; extern const int g_sortedMipMpms [3][NUM_MPM_MIP]; -#endif // ==================================================================================================================== // Luma QP to Chroma QP mapping @@ -148,12 +133,10 @@ extern const TMatrixCoeff g_trCoreDST7P8 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 8][ extern const TMatrixCoeff g_trCoreDST7P16 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 16][ 16]; extern const TMatrixCoeff g_trCoreDST7P32 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 32][ 32]; -#if JVET_N0193_LFNST extern const int8_t g_lfnst8x8[ 4 ][ 2 ][ 16 ][ 48 ]; extern const int8_t g_lfnst4x4[ 4 ][ 2 ][ 16 ][ 16 ]; extern const uint8_t g_lfnstLut[ NUM_INTRA_MODE + NUM_EXT_LUMA_MODE - 1 ]; -#endif // ==================================================================================================================== // Misc. @@ -193,7 +176,6 @@ extern CDTrace* g_trace_ctx; const char* nalUnitTypeToString(NalUnitType type); -#if HEVC_USE_SCALING_LISTS extern const char *MatrixType [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; extern const char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; @@ -203,7 +185,6 @@ extern const int g_quantInterDefault8x8[8*8]; extern const uint32_t g_scalingListSize [SCALING_LIST_SIZE_NUM]; extern const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM]; -#endif extern MsgLevel g_verbosity; diff --git a/source/Lib/CommonLib/RomLFNST.cpp b/source/Lib/CommonLib/RomLFNST.cpp index 74a42528e1abb7b1e7b2c10f9d1bb9ca3fc8eaf3..43d9ebe100cabb00b42058da269b255bc7fe324d 100644 --- a/source/Lib/CommonLib/RomLFNST.cpp +++ b/source/Lib/CommonLib/RomLFNST.cpp @@ -37,7 +37,6 @@ #include "Rom.h" -#if JVET_N0193_LFNST #include #include @@ -364,5 +363,4 @@ const int8_t g_lfnst4x4[ 4 ][ 2 ][ 16 ][ 16 ] = { } }; -#endif //-------------------------------------------------------------------------------------------------- diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index 481bfdd2c92c1aed22319bd56a3afad3de11eae6..4c97ae136e7f3f3d8186f6e01d314c4b6eb5d465 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -292,9 +292,7 @@ void SampleAdaptiveOffset::xReconstructBlkSAOParams(CodingStructure& cs, SAOBlkP void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& clpRng, int typeIdx, int* offset , const Pel* srcBlk, Pel* resBlk, int srcStride, int resStride, int width, int height , bool isLeftAvail, bool isRightAvail, bool isAboveAvail, bool isBelowAvail, bool isAboveLeftAvail, bool isAboveRightAvail, bool isBelowLeftAvail, bool isBelowRightAvail -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND , bool isCtuCrossedByVirtualBoundaries, int horVirBndryPos[], int verVirBndryPos[], int numHorVirBndry, int numVerVirBndry -#endif ) { int x,y, startX, startY, endX, endY, edgeType; @@ -317,13 +315,11 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& for (x=startX; x< endX; x++) { signRight = (int8_t)sgn(srcLine[x] - srcLine[x+1]); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, y, numVerVirBndry, 0, verVirBndryPos, horVirBndryPos)) { signLeft = -signRight; continue; } -#endif edgeType = signRight + signLeft; signLeft = -signRight; @@ -362,13 +358,11 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& for (x=0; x< width; x++) { signDown = (int8_t)sgn(srcLine[x] - srcLineBelow[x]); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, y, 0, numHorVirBndry, verVirBndryPos, horVirBndryPos)) { signUpLine[x] = -signDown; continue; } -#endif edgeType = signDown + signUpLine[x]; signUpLine[x]= -signDown; @@ -404,12 +398,10 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& firstLineEndX = isAboveAvail? endX: 1; for(x= firstLineStartX; x< firstLineEndX; x++) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, 0, numVerVirBndry, numHorVirBndry, verVirBndryPos, horVirBndryPos)) { continue; } -#endif edgeType = sgn(srcLine[x] - srcLineAbove[x- 1]) - signUpLine[x+1]; resLine[x] = ClipPel( srcLine[x] + offset[edgeType], clpRng); @@ -426,13 +418,11 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& for (x=startX; x( srcLine[x] + offset[edgeType], clpRng); @@ -454,12 +444,10 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& lastLineEndX = isBelowRightAvail ? width : (width -1); for(x= lastLineStartX; x< lastLineEndX; x++) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, height - 1, numVerVirBndry, numHorVirBndry, verVirBndryPos, horVirBndryPos)) { continue; } -#endif edgeType = sgn(srcLine[x] - srcLineBelow[x+ 1]) + signUpLine[x]; resLine[x] = ClipPel( srcLine[x] + offset[edgeType], clpRng); @@ -488,12 +476,10 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& firstLineEndX = isAboveRightAvail ? width : (width-1); for(x= firstLineStartX; x< firstLineEndX; x++) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, 0, numVerVirBndry, numHorVirBndry, verVirBndryPos, horVirBndryPos)) { continue; } -#endif edgeType = sgn(srcLine[x] - srcLineAbove[x+1]) -signUpLine[x-1]; resLine[x] = ClipPel(srcLine[x] + offset[edgeType], clpRng); } @@ -508,13 +494,11 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& for(x= startX; x< endX; x++) { signDown = (int8_t)sgn(srcLine[x] - srcLineBelow[x-1]); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, y, numVerVirBndry, numHorVirBndry, verVirBndryPos, horVirBndryPos)) { signUpLine[x - 1] = -signDown; continue; } -#endif edgeType = signDown + signUpLine[x]; resLine[x] = ClipPel(srcLine[x] + offset[edgeType], clpRng); signUpLine[x-1] = -signDown; @@ -530,12 +514,10 @@ void SampleAdaptiveOffset::offsetBlock(const int channelBitDepth, const ClpRng& lastLineEndX = isBelowAvail ? endX : 1; for(x= lastLineStartX; x< lastLineEndX; x++) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (isCtuCrossedByVirtualBoundaries && isProcessDisabled(x, height - 1, numVerVirBndry, numHorVirBndry, verVirBndryPos, horVirBndryPos)) { continue; } -#endif edgeType = sgn(srcLine[x] - srcLineBelow[x-1]) + signUpLine[x]; resLine[x] = ClipPel(srcLine[x] + offset[edgeType], clpRng); @@ -591,14 +573,12 @@ void SampleAdaptiveOffset::offsetCTU( const UnitArea& area, const CPelUnitBuf& s m_signLineBuf2.resize(lineBufferSize); } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND int numHorVirBndry = 0, numVerVirBndry = 0; int horVirBndryPos[] = { -1,-1,-1 }; int verVirBndryPos[] = { -1,-1,-1 }; int horVirBndryPosComp[] = { -1,-1,-1 }; int verVirBndryPosComp[] = { -1,-1,-1 }; bool isCtuCrossedByVirtualBoundaries = isCrossedByVirtualBoundaries(area.Y().x, area.Y().y, area.Y().width, area.Y().height, numHorVirBndry, numVerVirBndry, horVirBndryPos, verVirBndryPos, cs.slice->getPPS()); -#endif for(int compIdx = 0; compIdx < numberOfComponents; compIdx++) { const ComponentID compID = ComponentID(compIdx); @@ -611,7 +591,6 @@ void SampleAdaptiveOffset::offsetCTU( const UnitArea& area, const CPelUnitBuf& s const Pel* srcBlk = src.get(compID).bufAt(compArea); int resStride = res.get(compID).stride; Pel* resBlk = res.get(compID).bufAt(compArea); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND for (int i = 0; i < numHorVirBndry; i++) { horVirBndryPosComp[i] = (horVirBndryPos[i] >> ::getComponentScaleY(compID, area.chromaFormat)) - compArea.y; @@ -620,7 +599,6 @@ void SampleAdaptiveOffset::offsetCTU( const UnitArea& area, const CPelUnitBuf& s { verVirBndryPosComp[i] = (verVirBndryPos[i] >> ::getComponentScaleX(compID, area.chromaFormat)) - compArea.x; } -#endif offsetBlock( cs.sps->getBitDepth(toChannelType(compID)), cs.slice->clpRng(compID), @@ -630,9 +608,7 @@ void SampleAdaptiveOffset::offsetCTU( const UnitArea& area, const CPelUnitBuf& s , isAboveAvail, isBelowAvail , isAboveLeftAvail, isAboveRightAvail , isBelowLeftAvail, isBelowRightAvail -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND , isCtuCrossedByVirtualBoundaries, horVirBndryPosComp, verVirBndryPosComp, numHorVirBndry, numVerVirBndry -#endif ); } } //compIdx @@ -753,11 +729,7 @@ void SampleAdaptiveOffset::xPCMSampleRestoration(CodingUnit& cu, const Component PelBuf dstBuf = cu.cs->getRecoBuf( currTU.block(compID) ); dstBuf.copyFrom( pcmBuf ); -#if JVET_N0805_APS_LMCS if (cu.slice->getLmcsEnabledFlag() && isLuma(compID)) -#else - if (cu.slice->getReshapeInfo().getUseSliceReshaper() && isLuma(compID)) -#endif { dstBuf.rspSignal(m_pcReshape->getInvLUT()); } @@ -779,11 +751,7 @@ void SampleAdaptiveOffset::xPCMSampleRestoration(CodingUnit& cu, const Component dstBuf.at(x,y) = (pcmBuf.at(x,y) << uiPcmLeftShiftBit); } } -#if JVET_N0805_APS_LMCS if (cu.slice->getLmcsEnabledFlag()&& isLuma(compID)) -#else - if (cu.slice->getReshapeInfo().getUseSliceReshaper() && isLuma(compID)) -#endif { dstBuf.rspSignal(m_pcReshape->getInvLUT()); } @@ -864,7 +832,6 @@ void SampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructure& } } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool SampleAdaptiveOffset::isCrossedByVirtualBoundaries(const int xPos, const int yPos, const int width, const int height, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps) { numHorVirBndry = 0; numVerVirBndry = 0; @@ -887,5 +854,4 @@ bool SampleAdaptiveOffset::isCrossedByVirtualBoundaries(const int xPos, const in } return numHorVirBndry > 0 || numVerVirBndry > 0 ; } -#endif //! \} diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.h b/source/Lib/CommonLib/SampleAdaptiveOffset.h index a00e527f4fcbc8197243f65aad6d22c84447b8d5..c314eb6f6849984e2a582335d0812a18ef8bcdaf 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.h +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.h @@ -85,9 +85,7 @@ protected: void offsetBlock(const int channelBitDepth, const ClpRng& clpRng, int typeIdx, int* offset, const Pel* srcBlk, Pel* resBlk, int srcStride, int resStride, int width, int height , bool isLeftAvail, bool isRightAvail, bool isAboveAvail, bool isBelowAvail, bool isAboveLeftAvail, bool isAboveRightAvail, bool isBelowLeftAvail, bool isBelowRightAvail -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND , bool isCtuCrossedByVirtualBoundaries, int horVirBndryPos[], int verVirBndryPos[], int numHorVirBndry, int numVerVirBndry -#endif ); void invertQuantOffsets(ComponentID compIdx, int typeIdc, int typeAuxInfo, int* dstOffsets, int* srcOffsets); void reconstructBlkSAOParam(SAOBlkParam& recParam, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES]); @@ -97,7 +95,6 @@ protected: void xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea); void xPCMSampleRestoration(CodingUnit& cu, const ComponentID compID); void xReconstructBlkSAOParams(CodingStructure& cs, SAOBlkParam* saoBlkParams); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool isCrossedByVirtualBoundaries(const int xPos, const int yPos, const int width, const int height, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps); inline bool isProcessDisabled(int xPos, int yPos, int numVerVirBndry, int numHorVirBndry, int verVirBndryPos[], int horVirBndryPos[]) { @@ -120,7 +117,6 @@ protected: } return bDisabledFlag; } -#endif Reshape* m_pcReshape; protected: uint32_t m_offsetStepLog2[MAX_NUM_COMPONENT]; //offset step diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index ef03c18ec61f9899e747897c21229b7da4deab3f..ede292b45cfb96190248df40ce8c26f1deac60ce 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -53,15 +53,8 @@ Slice::Slice() , m_iLastIDR ( 0 ) , m_iAssociatedIRAP ( 0 ) , m_iAssociatedIRAPType ( NAL_UNIT_INVALID ) -#if JVET_M0128 , m_rpl0Idx ( -1 ) , m_rpl1Idx ( -1 ) -#else -, m_pRPS ( 0 ) -, m_localRPS ( ) -, m_rpsIdx ( 0 ) -, m_RefPicListModification ( ) -#endif , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) , m_eSliceType ( I_SLICE ) , m_iSliceQp ( 0 ) @@ -72,9 +65,7 @@ Slice::Slice() , m_deblockingFilterTcOffsetDiv2 ( 0 ) , m_pendingRasInit ( false ) , m_depQuantEnabledFlag ( false ) -#if HEVC_USE_SIGN_HIDING , m_signDataHidingEnabledFlag ( false ) -#endif , m_bCheckLDC ( false ) , m_biDirPred ( false ) , m_iSliceQpDelta ( 0 ) @@ -82,9 +73,7 @@ Slice::Slice() #if HEVC_VPS , m_pcVPS ( NULL ) #endif -#if JVET_N0349_DPS , m_dps ( nullptr ) -#endif , m_pcSPS ( NULL ) , m_pcPPS ( NULL ) , m_pcPic ( NULL ) @@ -95,9 +84,7 @@ Slice::Slice() , m_colRefIdx ( 0 ) , m_maxNumMergeCand ( 0 ) , m_maxNumAffineMergeCand ( 0 ) -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM , m_maxNumTriangleCand ( 0 ) -#endif , m_disFracMMVD ( false ) , m_uiTLayer ( 0 ) , m_bTLayerSwitchingFlag ( false ) @@ -114,9 +101,6 @@ Slice::Slice() , m_substreamSizes ( ) , m_cabacInitFlag ( false ) , m_bLMvdL1Zero ( false ) -#if !JVET_M0101_HLS -, m_temporalLayerNonReferenceFlag ( false ) -#endif , m_LFCrossSliceBoundaryFlag ( false ) , m_enableTMVPFlag ( true ) , m_encCABACTableIdx (I_SLICE) @@ -131,16 +115,10 @@ Slice::Slice() , m_uiMaxBTSizeIChroma ( 0 ) , m_uiMaxTTSizeIChroma ( 0 ) , m_uiMaxBTSize ( 0 ) -#if !JVET_N0415_CTB_ALF -, m_apsId ( -1 ) -, m_aps (NULL) -#endif -#if JVET_N0805_APS_LMCS , m_lmcsApsId ( -1 ) , m_lmcsAps (nullptr) , m_tileGroupLmcsEnabledFlag (false) , m_tileGroupLmcsChromaResidualScaleFlag (false) -#endif { for(uint32_t i=0; ilongTerm; } } -#else -void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool bCopyL0toL1ErrorCase ) -{ - if ( m_eSliceType == I_SLICE) - { - ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); - ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); - - if (!checkNumPocTotalCurr) - { - return; - } - } - - Picture* pcRefPic= NULL; - static const uint32_t MAX_NUM_NEGATIVE_PICTURES=16; - Picture* RefPicSetStCurr0[MAX_NUM_NEGATIVE_PICTURES]; - Picture* RefPicSetStCurr1[MAX_NUM_NEGATIVE_PICTURES]; - Picture* RefPicSetLtCurr[MAX_NUM_NEGATIVE_PICTURES]; - uint32_t NumPicStCurr0 = 0; - uint32_t NumPicStCurr1 = 0; - uint32_t NumPicLtCurr = 0; - int i; - - for(i=0; i < m_pRPS->getNumberOfNegativePictures(); i++) - { - if(m_pRPS->getUsed(i)) - { - pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i)); - pcRefPic->longTerm = false; - pcRefPic->extendPicBorder(); - RefPicSetStCurr0[NumPicStCurr0] = pcRefPic; - NumPicStCurr0++; - } - } - - for(; i < m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures(); i++) - { - if(m_pRPS->getUsed(i)) - { - pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i)); - pcRefPic->longTerm = false; - pcRefPic->extendPicBorder(); - RefPicSetStCurr1[NumPicStCurr1] = pcRefPic; - NumPicStCurr1++; - } - } - - for(i = m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures()+m_pRPS->getNumberOfLongtermPictures()-1; i > m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures()-1 ; i--) - { - if(m_pRPS->getUsed(i)) - { - pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); - pcRefPic->longTerm = true; - pcRefPic->extendPicBorder(); - RefPicSetLtCurr[NumPicLtCurr] = pcRefPic; - NumPicLtCurr++; - } - if(pcRefPic==NULL) - { - pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); - } - } - // ref_pic_list_init - Picture* rpsCurrList0[MAX_NUM_REF+1]; - Picture* rpsCurrList1[MAX_NUM_REF+1]; - int numPicTotalCurr = NumPicStCurr0 + NumPicStCurr1 + NumPicLtCurr; - - if (checkNumPocTotalCurr) - { - // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: - // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. - // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. - if (getRapPicFlag()) - { - CHECK(numPicTotalCurr != 0, "Invalid state"); - } - - if (m_eSliceType == I_SLICE) - { - return; - } - - CHECK(numPicTotalCurr == 0, "Invalid state"); - // general tier and level limit: - CHECK(numPicTotalCurr > 8, "Invalid state"); - } - - int cIdx = 0; - for ( i=0; i= numPicTotalCurr, "Invalid state"); - m_apcRefPicList[REF_PIC_LIST_0][rIdx] = rpsCurrList0[ cIdx ]; - m_bIsUsedAsLongTerm[REF_PIC_LIST_0][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); - } - if ( m_eSliceType != B_SLICE ) - { - m_aiNumRefIdx[REF_PIC_LIST_1] = 0; - ::memset( m_apcRefPicList[REF_PIC_LIST_1], 0, sizeof(m_apcRefPicList[REF_PIC_LIST_1])); - } - else - { - for (int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_1]; rIdx ++) - { - cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPicTotalCurr; - CHECK(cIdx < 0 || cIdx >= numPicTotalCurr, "Invalid state"); - m_apcRefPicList[REF_PIC_LIST_1][rIdx] = rpsCurrList1[ cIdx ]; - m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); - } - } - // For generalized B - // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) - if( bCopyL0toL1ErrorCase && isInterB() && getNumRefIdx(REF_PIC_LIST_1) == 0) - { - int iNumRefIdx = getNumRefIdx(REF_PIC_LIST_0); - setNumRefIdx( REF_PIC_LIST_1, iNumRefIdx ); - - for (int iRefIdx = 0; iRefIdx < iNumRefIdx; iRefIdx++) - { - m_apcRefPicList[REF_PIC_LIST_1][iRefIdx] = m_apcRefPicList[REF_PIC_LIST_0] [iRefIdx]; - } - } -} - - -int Slice::getNumRpsCurrTempList() const -{ - int numRpsCurrTempList = 0; - - if (m_eSliceType == I_SLICE) - { - return 0; - } - for(uint32_t i=0; i < m_pRPS->getNumberOfNegativePictures()+ m_pRPS->getNumberOfPositivePictures() + m_pRPS->getNumberOfLongtermPictures(); i++) - { - if(m_pRPS->getUsed(i)) - { - numRpsCurrTempList++; - } - } - return numRpsCurrTempList; -} -#endif void Slice::initEqualRef() { @@ -668,7 +444,6 @@ void Slice::checkColRefIdx(uint32_t curSliceSegmentIdx, const Picture* pic) } } -#if JVET_M0128 void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic) { if (pocCRA < MAX_UINT && getPOC() > pocCRA) @@ -708,61 +483,7 @@ void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureLi pocCRA = getPOC(); associatedIRAPType = getNalUnitType(); } -#if !JVET_M0101_HLS - else if (getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP) // BLA picture found - { - pocCRA = getPOC(); - associatedIRAPType = getNalUnitType(); - } -#endif } -#else -void Slice::checkCRA(const ReferencePictureSet *pReferencePictureSet, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic) -{ - for(int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) - { - if(pocCRA < MAX_UINT && getPOC() > pocCRA) - { - CHECK(getPOC()+pReferencePictureSet->getDeltaPOC(i) < pocCRA, "Invalid state"); - } - } - for(int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) - { - if(pocCRA < MAX_UINT && getPOC() > pocCRA) - { - if (!pReferencePictureSet->getCheckLTMSBPresent(i)) - { - CHECK(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() < pocCRA, "Invalid state"); - } - else - { - CHECK(pReferencePictureSet->getPOC(i) < pocCRA, "Invalid state"); - } - } - } - if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found - { - pocCRA = getPOC(); - associatedIRAPType = getNalUnitType(); - } - else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found - { - pocCRA = getPOC(); - associatedIRAPType = getNalUnitType(); - } -#if !JVET_M0101_HLS - else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found - { - pocCRA = getPOC(); - associatedIRAPType = getNalUnitType(); - } -#endif -} -#endif /** Function for marking the reference pictures when an IDR/CRA/CRANT/BLA/BLANT is encountered. * \param pocCRA POC of the CRA/CRANT/BLA/BLANT picture @@ -787,16 +508,8 @@ void Slice::decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& Picture* rpcPic; int pocCurr = getPOC(); -#if !JVET_M0101_HLS - if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP - || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture -#else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP) // IDR picture -#endif { // mark all pictures as not used for reference PicList::iterator iterPic = rcListPic.begin(); @@ -810,14 +523,6 @@ void Slice::decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& } iterPic++; } -#if !JVET_M0101_HLS - if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) - { - pocCRA = pocCurr; - } -#endif if (bEfficientFieldIRAPEnabled) { bRefreshPending = true; @@ -907,9 +612,7 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) { m_iSliceChromaQpDelta[component] = pSrc->m_iSliceChromaQpDelta[component]; } -#if JVET_N0054_JOINT_CHROMA m_iSliceChromaQpDelta[JOINT_CbCr] = pSrc->m_iSliceChromaQpDelta[JOINT_CbCr]; -#endif for (i = 0; i < NUM_REF_PIC_LIST_01; i++) { @@ -924,12 +627,8 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) if( cpyAlmostAll ) m_iDepth = pSrc->m_iDepth; // access channel -#if JVET_M0128 if (cpyAlmostAll) m_pRPL0 = pSrc->m_pRPL0; if (cpyAlmostAll) m_pRPL1 = pSrc->m_pRPL1; -#else - if( cpyAlmostAll ) m_pRPS = pSrc->m_pRPS; -#endif m_iLastIDR = pSrc->m_iLastIDR; if( cpyAlmostAll ) m_pcPic = pSrc->m_pcPic; @@ -976,33 +675,19 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) } m_cabacInitFlag = pSrc->m_cabacInitFlag; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(m_alfApss, pSrc->m_alfApss, sizeof(m_alfApss)); // this might be quite unsafe -#else - memcpy(m_apss, pSrc->m_apss, sizeof(m_apss)); // this might be quite unsafe -#endif memcpy( m_tileGroupAlfEnabledFlag, pSrc->m_tileGroupAlfEnabledFlag, sizeof(m_tileGroupAlfEnabledFlag)); m_tileGroupNumAps = pSrc->m_tileGroupNumAps; m_tileGroupLumaApsId = pSrc->m_tileGroupLumaApsId; m_tileGroupChromaApsId = pSrc->m_tileGroupChromaApsId; -#else - m_apsId = pSrc->m_apsId; - m_aps = pSrc->m_aps; - m_tileGroupAlfEnabledFlag = pSrc->m_tileGroupAlfEnabledFlag; -#endif -#if JVET_N0329_IBC_SEARCH_IMP m_disableSATDForRd = pSrc->m_disableSATDForRd; -#endif m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; m_enableTMVPFlag = pSrc->m_enableTMVPFlag; m_maxNumMergeCand = pSrc->m_maxNumMergeCand; m_maxNumAffineMergeCand = pSrc->m_maxNumAffineMergeCand; -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM m_maxNumTriangleCand = pSrc->m_maxNumTriangleCand; -#endif m_disFracMMVD = pSrc->m_disFracMMVD; if( cpyAlmostAll ) m_encCABACTableIdx = pSrc->m_encCABACTableIdx; m_splitConsOverrideFlag = pSrc->m_splitConsOverrideFlag; @@ -1018,14 +703,10 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_depQuantEnabledFlag = pSrc->m_depQuantEnabledFlag; m_signDataHidingEnabledFlag = pSrc->m_signDataHidingEnabledFlag; -#if JVET_N0805_APS_LMCS m_tileGroupLmcsEnabledFlag = pSrc->m_tileGroupLmcsEnabledFlag; m_tileGroupLmcsChromaResidualScaleFlag = pSrc->m_tileGroupLmcsChromaResidualScaleFlag; m_lmcsAps = pSrc->m_lmcsAps; m_lmcsApsId = pSrc->m_lmcsApsId; -#else - m_sliceReshapeInfo = pSrc->m_sliceReshapeInfo; -#endif } @@ -1077,64 +758,25 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const if(this->getAssociatedIRAPPOC() > this->getPOC()) { // Do not check IRAP pictures since they may get a POC lower than their associated IRAP -#if JVET_N0067_NAL_Unit_Header if (nalUnitType < NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalUnitType > NAL_UNIT_CODED_SLICE_CRA) -#else -#if !JVET_M0101_HLS - if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP || - nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23) -#else - if (nalUnitType < NAL_UNIT_CODED_SLICE_IDR_W_RADL || - nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL13) -#endif -#endif { -#if !JVET_M0101_HLS - CHECK( nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N && - nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R && - nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N && - nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R, "Invalid NAL unit type"); -#else CHECK(nalUnitType != NAL_UNIT_CODED_SLICE_RASL && nalUnitType != NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type"); -#endif } } // When a picture is a trailing picture, it shall not be a RADL or RASL picture. if(this->getAssociatedIRAPPOC() < this->getPOC()) { -#if !JVET_M0101_HLS - CHECK( nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R, "Invalid NAL unit type" ); -#else CHECK(nalUnitType == NAL_UNIT_CODED_SLICE_RASL || nalUnitType == NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type"); -#endif } -#if !JVET_M0101_HLS - // No RASL pictures shall be present in the bitstream that are associated - // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP. - if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) - { - CHECK (this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || - this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP, "Invalid NAL unit type"); - } -#endif // No RASL pictures shall be present in the bitstream that are associated with // an IDR picture. -#if !JVET_M0101_HLS - if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) -#else if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL) -#endif { CHECK( this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL, "Invalid NAL unit type"); @@ -1143,19 +785,9 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const // No RADL pictures shall be present in the bitstream that are associated with // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated // with an IDR picture having nal_unit_type equal to IDR_N_LP. -#if !JVET_M0101_HLS - if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) -#else if (nalUnitType == NAL_UNIT_CODED_SLICE_RADL) -#endif { -#if !JVET_M0101_HLS - CHECK (this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || - this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP, "Invalid NAL unit type"); -#else CHECK (this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP, "Invalid NAL unit type"); -#endif } // loop through all pictures in the reference picture buffer @@ -1178,18 +810,9 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const // (Note that any picture following in output order would be present in the DPB) if(pcSlice->getPicOutputFlag() == 1 && !this->getNoOutputPriorPicsFlag()) { -#if !JVET_M0101_HLS - if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || - nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP || - nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL || - nalUnitType == NAL_UNIT_CODED_SLICE_CRA || - nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || - nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) -#else if (nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) -#endif { CHECK(pcPic->poc >= this->getPOC(), "Invalid POC"); } @@ -1198,564 +821,71 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture // in decoding order shall precede any RADL picture associated with the IRAP // picture in output order. - if(pcSlice->getPicOutputFlag() == 1) - { -#if !JVET_M0101_HLS - if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)) -#else - if (nalUnitType == NAL_UNIT_CODED_SLICE_RADL) -#endif - { - // rpcPic precedes the IRAP in decoding order - if(this->getAssociatedIRAPPOC() > pcSlice->getAssociatedIRAPPOC()) - { - // rpcPic must not be the IRAP picture - if(this->getAssociatedIRAPPOC() != pcPic->poc) - { - CHECK( pcPic->poc >= this->getPOC(), "Invalid POC"); - } - } - } - } - - // When a picture is a leading picture, it shall precede, in decoding order, - // all trailing pictures that are associated with the same IRAP picture. -#if !JVET_M0101_HLS - if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) -#else - if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL ) -#endif - { - if(pcSlice->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) - { - // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB - // rpcPic would violate the constraint if it was a trailing picture - CHECK( pcPic->poc > this->getAssociatedIRAPPOC(), "Invalid POC"); - } - } - - // Any RASL picture associated with a CRA or BLA picture shall precede any - // RADL picture associated with the CRA or BLA picture in output order -#if !JVET_M0101_HLS - if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) -#else - if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL) -#endif - { -#if !JVET_M0101_HLS - if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || - this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || - this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || - this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && -#else - if ((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && -#endif - this->getAssociatedIRAPPOC() == pcSlice->getAssociatedIRAPPOC()) - { -#if !JVET_M0101_HLS - if(pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R) -#else - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL) -#endif - { - CHECK( pcPic->poc <= this->getPOC(), "Invalid POC"); - } - } - } - - // Any RASL picture associated with a CRA picture shall follow, in output - // order, any IRAP picture that precedes the CRA picture in decoding order. -#if !JVET_M0101_HLS - if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || - nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) -#else - if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL) -#endif - { - if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) - { - if(pcSlice->getPOC() < this->getAssociatedIRAPPOC() && - ( -#if !JVET_M0101_HLS - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || -#endif - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || - pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) - { - CHECK(this->getPOC() <= pcSlice->getPOC(), "Invalid POC"); - } - } - } - } -} - - - -#if !JVET_M0128 -/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. -*/ -void Slice::applyReferencePictureSet( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet) const -{ - int i, isReference; - - checkLeadingPictureRestrictions(rcListPic); - - // loop through all pictures in the reference picture buffer - PicList::iterator iterPic = rcListPic.begin(); - while ( iterPic != rcListPic.end()) - { - Picture* pcPic = *(iterPic++); - - if( ! pcPic->referenced) - { -#if JVET_N0247_HASH_IMPROVE - pcPic->getHashMap()->clearAll(); -#endif - continue; - } - - isReference = 0; - // loop through all pictures in the Reference Picture Set - // to see if the picture should be kept as reference picture - for(i=0;igetNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) - { - if( ! pcPic->longTerm && pcPic->poc == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) - { - isReference = 1; - pcPic->usedByCurr = pReferencePictureSet->getUsed(i); - pcPic->longTerm = false; - } - } - for(;igetNumberOfPictures();i++) - { - if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) - { - if( pcPic->longTerm && pcPic->poc == pReferencePictureSet->getPOC(i)) - { - isReference = 1; - pcPic->usedByCurr = pReferencePictureSet->getUsed(i); - } - } - else - { - int pocCycle = 1 << pcPic->cs->sps->getBitsForPOC(); - int curPoc = pcPic->poc & (pocCycle-1); - int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); - if( pcPic->longTerm && curPoc == refPoc) - { - isReference = 1; - pcPic->usedByCurr = pReferencePictureSet->getUsed(i); - } - } - } - // mark the picture as "unused for reference" if it is not in - // the Reference Picture Set - if( pcPic->poc != this->getPOC() && isReference == 0) - { - pcPic->referenced = false; - pcPic->usedByCurr = false; - pcPic->longTerm = false; - pcPic->getHashMap()->clearAll(); - } - - // sanity checks - if( pcPic->referenced) - { - //check that pictures of higher temporal layers are not used - CHECK( pcPic->usedByCurr && !(pcPic->layer<=this->getTLayer()), "Invalid state"); - //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture -#if !JVET_M0101_HLS - if( this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) - { - CHECK( !(pcPic->layergetTLayer()), "Invalid state"); - } -#endif -#if !JVET_M0101_HLS - //check that pictures marked as temporal layer non-reference pictures are not used for reference - if( pcPic->poc != this->getPOC() && (pcPic->layer == this->getTLayer())) - { - CHECK( pcPic->usedByCurr && pcPic->slices[0]->getTemporalLayerNonReferenceFlag(), "Invalid state"); - } -#endif - } - } -} - -/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. -*/ -int Slice::checkThatAllRefPicsAreAvailable( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool printErrors, int pocRandomAccess, bool bUseRecoveryPoint) const -{ - int atLeastOneUnabledByRecoveryPoint = 0; - int atLeastOneFlushedByPreviousIDR = 0; - Picture* rpcPic; - int i, isAvailable; - int atLeastOneLost = 0; - int atLeastOneRemoved = 0; - int iPocLost = 0; - - // loop through all long-term pictures in the Reference Picture Set - // to see if the picture should be kept as reference picture - for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();igetNumberOfPictures();i++) - { - isAvailable = 0; - // loop through all pictures in the reference picture buffer - PicList::iterator iterPic = rcListPic.begin(); - while ( iterPic != rcListPic.end()) - { - rpcPic = *(iterPic++); - if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) - { - if(rpcPic->longTerm && (rpcPic->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->referenced) - { - if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) - { - isAvailable = 0; - } - else - { - isAvailable = 1; - } - } - } - else - { - int pocCycle = 1<cs->sps->getBitsForPOC(); - int curPoc = rpcPic->getPOC() & (pocCycle-1); - int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); - if(rpcPic->longTerm && curPoc == refPoc && rpcPic->referenced) - { - if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) - { - isAvailable = 0; - } - else - { - isAvailable = 1; - } - } - } - } - // if there was no such long-term check the short terms - if(!isAvailable) - { - iterPic = rcListPic.begin(); - while ( iterPic != rcListPic.end()) - { - rpcPic = *(iterPic++); - - int pocCycle = 1 << rpcPic->cs->sps->getBitsForPOC(); - int curPoc = rpcPic->getPOC(); - int refPoc = pReferencePictureSet->getPOC(i); - if (!pReferencePictureSet->getCheckLTMSBPresent(i)) - { - curPoc = curPoc & (pocCycle - 1); - refPoc = refPoc & (pocCycle - 1); - } - - if (rpcPic->referenced && curPoc == refPoc) - { - if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) - { - isAvailable = 0; - } - else - { - isAvailable = 1; - rpcPic->longTerm = true; - break; - } - } - } - } - // report that a picture is lost if it is in the Reference Picture Set - // but not available as reference picture - if(isAvailable == 0) - { - if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) - { - if(!pReferencePictureSet->getUsed(i) ) - { - if(printErrors) - { - msg( ERROR, "\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); - } - atLeastOneRemoved = 1; - } - else - { - if(printErrors) - { - msg( ERROR, "\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); - } - atLeastOneLost = 1; - iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); - } - } - else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) - { - atLeastOneUnabledByRecoveryPoint = 1; - } - else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) - { - atLeastOneFlushedByPreviousIDR = 1; - } - } - } - // loop through all short-term pictures in the Reference Picture Set - // to see if the picture should be kept as reference picture - for(i=0;igetNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) - { - isAvailable = 0; - // loop through all pictures in the reference picture buffer - PicList::iterator iterPic = rcListPic.begin(); - while ( iterPic != rcListPic.end()) - { - rpcPic = *(iterPic++); - - if( ! rpcPic->longTerm && rpcPic->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->referenced) - { - if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) - { - isAvailable = 0; - } - else - { - isAvailable = 1; - } - } - } - // report that a picture is lost if it is in the Reference Picture Set - // but not available as reference picture - if(isAvailable == 0) - { - if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) - { - if(!pReferencePictureSet->getUsed(i) ) - { - if(printErrors) - { - msg( ERROR, "\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); - } - atLeastOneRemoved = 1; - } - else - { - if(printErrors) - { - msg( ERROR, "\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); - } - atLeastOneLost = 1; - iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); - } - } - else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) - { - atLeastOneUnabledByRecoveryPoint = 1; - } - else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) - { - atLeastOneFlushedByPreviousIDR = 1; - } - } - } - - if(atLeastOneUnabledByRecoveryPoint || atLeastOneFlushedByPreviousIDR) - { - return -1; - } - if(atLeastOneLost) - { - return iPocLost+1; - } - if(atLeastOneRemoved) - { - return -2; - } - else - { - return 0; - } -} - -/** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set -*/ -void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled - , bool isEncodeLtRef, bool isCompositeRefEnable -) -{ - Picture* rpcPic; - int i, j; - int k = 0; - int nrOfNegativePictures = 0; - int nrOfPositivePictures = 0; - ReferencePictureSet* pLocalRPS = this->getLocalRPS(); - (*pLocalRPS)=ReferencePictureSet(); - - bool irapIsInRPS = false; // Used when bEfficientFieldIRAPEnabled==true - - // loop through all pictures in the Reference Picture Set - for(i=0;igetNumberOfPictures();i++) - { - j = 0; - // loop through all pictures in the reference picture buffer - PicList::iterator iterPic = rcListPic.begin(); - while ( iterPic != rcListPic.end()) + if(pcSlice->getPicOutputFlag() == 1) { - j++; - rpcPic = *(iterPic++); - - if(rpcPic->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->referenced) + if (nalUnitType == NAL_UNIT_CODED_SLICE_RADL) { - // This picture exists as a reference picture - // and should be added to the explicit Reference Picture Set - pLocalRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); - pLocalRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); - if (bEfficientFieldIRAPEnabled) - { - pLocalRPS->setUsed(k, pLocalRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); - } - - if(pLocalRPS->getDeltaPOC(k) < 0) - { - nrOfNegativePictures++; - } - else + // rpcPic precedes the IRAP in decoding order + if(this->getAssociatedIRAPPOC() > pcSlice->getAssociatedIRAPPOC()) { - if (bEfficientFieldIRAPEnabled && rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC() + (isCompositeRefEnable ? 2 : 1)) + // rpcPic must not be the IRAP picture + if(this->getAssociatedIRAPPOC() != pcPic->poc) { - irapIsInRPS = true; + CHECK( pcPic->poc >= this->getPOC(), "Invalid POC"); } - nrOfPositivePictures++; } - k++; } } - } - bool useNewRPS = false; - // if current picture is complimentary field associated to IRAP, add the IRAP to its RPS. - if(bEfficientFieldIRAPEnabled && m_pcPic->fieldPic && !irapIsInRPS) - { - PicList::iterator iterPic = rcListPic.begin(); - while ( iterPic != rcListPic.end()) - { - rpcPic = *(iterPic++); - if (rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC() + (isCompositeRefEnable ? 2 : 1)) + // When a picture is a leading picture, it shall precede, in decoding order, + // all trailing pictures that are associated with the same IRAP picture. + if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL || + nalUnitType == NAL_UNIT_CODED_SLICE_RADL ) { - pLocalRPS->setDeltaPOC(k, 1); - pLocalRPS->setUsed(k, true); - nrOfPositivePictures++; - k ++; - useNewRPS = true; + if(pcSlice->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) + { + // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB + // rpcPic would violate the constraint if it was a trailing picture + CHECK( pcPic->poc > this->getAssociatedIRAPPOC(), "Invalid POC"); + } } - } - } - if (isCompositeRefEnable && isEncodeLtRef) - { - useNewRPS = true; - nrOfNegativePictures = 0; - nrOfPositivePictures = 0; - for (i = 0; igetNumberOfPictures(); i++) - { - j = 0; - k = 0; - // loop through all pictures in the reference picture buffer - PicList::iterator iterPic = rcListPic.begin(); - while (iterPic != rcListPic.end()) + // Any RASL picture associated with a CRA or BLA picture shall precede any + // RADL picture associated with the CRA or BLA picture in output order + if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL) + { + if ((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && + this->getAssociatedIRAPPOC() == pcSlice->getAssociatedIRAPPOC()) { - j++; - rpcPic = *(iterPic++); - - if (rpcPic->getPOC() == this->getPOC() + 1 + pReferencePictureSet->getDeltaPOC(i) && rpcPic->referenced) + if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL) { - // This picture exists as a reference picture - // and should be added to the explicit Reference Picture Set - pLocalRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i) + 1); - pLocalRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); - if (bEfficientFieldIRAPEnabled) - { - pLocalRPS->setUsed(k, pLocalRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) + 1 < pocRandomAccess)); - } - - if (pLocalRPS->getDeltaPOC(k) < 0) - { - nrOfNegativePictures++; - } - else - { - if (bEfficientFieldIRAPEnabled && rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC() + 2) - { - irapIsInRPS = true; - } - nrOfPositivePictures++; - } - k++; + CHECK( pcPic->poc <= this->getPOC(), "Invalid POC"); } } } - } - pLocalRPS->setNumberOfNegativePictures(nrOfNegativePictures); - pLocalRPS->setNumberOfPositivePictures(nrOfPositivePictures); - pLocalRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); - // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the - // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. - // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. - if (!pReferencePictureSet->getInterRPSPrediction() || useNewRPS ) - { - pLocalRPS->setInterRPSPrediction(false); - pLocalRPS->setNumRefIdc(0); - } - else - { - int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; - int deltaRPS = pReferencePictureSet->getDeltaRPS(); - const ReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); - int iRefPics = pcRefRPS->getNumberOfPictures(); - int iNewIdc=0; - for(i=0; i<= iRefPics; i++) + + // Any RASL picture associated with a CRA picture shall follow, in output + // order, any IRAP picture that precedes the CRA picture in decoding order. + if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL) { - int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 - int iRefIdc = 0; - for (j=0; j < pLocalRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS + if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) { - if ( (deltaPOC + deltaRPS) == pLocalRPS->getDeltaPOC(j)) + if(pcSlice->getPOC() < this->getAssociatedIRAPPOC() && + ( + pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || + pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || + pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) { - if (pLocalRPS->getUsed(j)) - { - iRefIdc = 1; - } - else - { - iRefIdc = 2; - } + CHECK(this->getPOC() <= pcSlice->getPOC(), "Invalid POC"); } } - pLocalRPS->setRefIdc(i, iRefIdc); - iNewIdc++; } - pLocalRPS->setInterRPSPrediction(true); - pLocalRPS->setNumRefIdc(iNewIdc); - pLocalRPS->setDeltaRPS(deltaRPS); - pLocalRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); } - - this->setRPS(pLocalRPS); - this->setRPSidx(-1); } -#endif -#if JVET_M0128 + + + //Function for applying picture marking based on the Reference Picture List void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1) const { @@ -2076,7 +1206,6 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c this->setRPL1idx(-1); this->setRPL1(pLocalRPL1); } -#endif //! get AC and DC values for weighted pred void Slice::getWpAcDcParam(const WPACDCParam *&wp) const @@ -2181,11 +1310,7 @@ unsigned Slice::getMinPictureDistance() const { for (int refIdx = 0; refIdx < getNumRefIdx(REF_PIC_LIST_1); refIdx++) { -#if JVET_M0128 //[HD] Please check if this is correct. Seems like a software bug to me. minPicDist = std::min(minPicDist, std::abs(currPOC - getRefPic(REF_PIC_LIST_1, refIdx)->getPOC())); -#else - minPicDist = std::min( minPicDist, std::abs(currPOC - getRefPic(REF_PIC_LIST_0, refIdx)->getPOC())); -#endif } } } @@ -2219,7 +1344,7 @@ VPS::VPS() VPS::~VPS() { } -#elif JVET_N0278_HLS +#else // ------------------------------------------------------------------------------------------------ // Video parameter set (VPS) // ------------------------------------------------------------------------------------------------ @@ -2261,60 +1386,10 @@ SPSRExt::SPSRExt() SPS::SPS() : m_SPSId ( 0) -#if JVET_N0349_DPS , m_decodingParameterSetId ( 0 ) -#endif -#if !JVET_M0101_HLS -, m_bIntraOnlyConstraintFlag (false) -, m_maxBitDepthConstraintIdc ( 0) -, m_maxChromaFormatConstraintIdc(CHROMA_420) -, m_bFrameConstraintFlag (false) -, m_bNoQtbttDualTreeIntraConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS -, m_noPartitionConstraintsOverrideConstraintFlag(false) -#endif -, m_bNoSaoConstraintFlag (false) -, m_bNoAlfConstraintFlag (false) -, m_bNoPcmConstraintFlag (false) -, m_bNoRefWraparoundConstraintFlag(false) -, m_bNoTemporalMvpConstraintFlag(false) -, m_bNoSbtmvpConstraintFlag (false) -, m_bNoAmvrConstraintFlag (false) -, m_bNoBdofConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS -, m_noDmvrConstraintFlag (false) -#endif -, m_bNoCclmConstraintFlag (false) -, m_bNoMtsConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS -, m_noSbtConstraintFlag (false) -#endif -, m_bNoAffineMotionConstraintFlag(false) -, m_bNoGbiConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS -, m_noIbcConstraintFlag (false) -#endif -, m_bNoMhIntraConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS -, m_noFPelMmvdConstraintFlag (false) -#endif -, m_bNoTriangleConstraintFlag (false) -, m_bNoLadfConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS -, m_noTransformSkipConstraintFlag(false) -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS -, m_bNoCurrPicRefConstraintFlag(false) -#endif -, m_bNoQpDeltaConstraintFlag (false) -, m_bNoDepQuantConstraintFlag (false) -, m_bNoSignDataHidingConstraintFlag(false) -#endif , m_affineAmvrEnabledFlag ( false ) , m_DMVR ( false ) -#if JVET_N0127_MMVD_SPS_FLAG , m_MMVD ( false ) -#endif , m_SBT ( false ) , m_MaxSbtSize ( 32 ) #if INCLUDE_ISP_CFG_FLAG @@ -2338,13 +1413,11 @@ SPS::SPS() , m_uiMaxCUWidth ( 32) , m_uiMaxCUHeight ( 32) , m_uiMaxCodingDepth ( 3) -#if JVET_M0128 , m_numRPL0 ( 0 ) , m_numRPL1 ( 0 ) , m_rpl1CopyFromRpl0Flag ( false ) , m_rpl1IdxPresentFlag ( false ) , m_allRplEntriesHasSameSignFlag ( true ) -#endif , m_bLongTermRefsPresent (false) // Tool list , m_pcmEnabledFlag (false) @@ -2361,12 +1434,7 @@ SPS::SPS() #endif , m_saoEnabledFlag (false) , m_bTemporalIdNestingFlag (false) -#if HEVC_USE_SCALING_LISTS , m_scalingListEnabledFlag (false) -#endif -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 -, m_useStrongIntraSmoothing (false) -#endif , m_vuiParametersPresentFlag (false) , m_vuiParameters () , m_wrapAroundEnabledFlag (false) @@ -2378,9 +1446,7 @@ SPS::SPS() , m_cclmCollocatedChromaFlag ( false ) , m_IntraMTS ( false ) , m_InterMTS ( false ) -#if JVET_N0193_LFNST , m_LFNST ( false ) -#endif , m_Affine ( false ) , m_AffineType ( false ) , m_MHIntra ( false ) @@ -2391,9 +1457,7 @@ SPS::SPS() , m_LadfQpOffset { 0 } , m_LadfIntervalLowerBound { 0 } #endif -#if JVET_N0217_MATRIX_INTRAPRED , m_MIP ( false ) -#endif { for(int ch=0; ch= 0; k--) - { - int temp = getDeltaPOC(k); - if (deltaPOC < temp) - { - setDeltaPOC(k+1, temp); - setUsed(k+1, getUsed(k)); - setDeltaPOC(k, deltaPOC); - setUsed(k, used); - } - } - } - // flip the negative values to largest first - int numNegPics = getNumberOfNegativePictures(); - for(int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) - { - int deltaPOC = getDeltaPOC(j); - bool used = getUsed(j); - setDeltaPOC(j, getDeltaPOC(k)); - setUsed(j, getUsed(k)); - setDeltaPOC(k, deltaPOC); - setUsed(k, used); - } -} - -/** Prints the deltaPOC and RefIdc (if available) values in the RPS. - * A "*" is added to the deltaPOC value if it is Used bu current. - * \returns void - */ -void ReferencePictureSet::printDeltaPOC() const -{ - DTRACE( g_trace_ctx, D_RPSINFO, "DeltaPOC = { " ); - for(int j=0; j < getNumberOfPictures(); j++) - { - DTRACE( g_trace_ctx, D_RPSINFO, "%d%s ", getDeltaPOC( j ), ( getUsed( j ) == 1 ) ? "*" : "" ); - } - if (getInterRPSPrediction()) - { - DTRACE( g_trace_ctx, D_RPSINFO, "}, RefIdc = { " ); - for(int j=0; j < getNumRefIdc(); j++) - { - DTRACE( g_trace_ctx, D_RPSINFO, "%d ", getRefIdc( j ) ); - } - } - DTRACE( g_trace_ctx, D_RPSINFO, "}\n" ); -} - -RefPicListModification::RefPicListModification() -: m_refPicListModificationFlagL0 (false) -, m_refPicListModificationFlagL1 (false) -{ - ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); - ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); -} - -RefPicListModification::~RefPicListModification() -{ -} -#endif -#if JVET_M0128 ReferencePictureList::ReferencePictureList() : m_numberOfShorttermPictures(0) , m_numberOfLongtermPictures(0) @@ -2787,9 +1666,7 @@ void ReferencePictureList::printRefPicInfo() const //DTRACE(g_trace_ctx, D_RPSINFO, "}\n"); printf("}\n"); } -#endif -#if HEVC_USE_SCALING_LISTS ScalingList::ScalingList() { for(uint32_t sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) @@ -2818,42 +1695,26 @@ void ScalingList::setDefaultScalingList() */ bool ScalingList::checkDefaultScalingList() { -#if JVET_N0847_SCALING_LISTS bool isAllDefault = true; for ( uint32_t sizeId = SCALING_LIST_2x2; sizeId <= SCALING_LIST_64x64; sizeId++) -#else - uint32_t defaultCounter=0; - - for( uint32_t sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++ ) -#endif { for(uint32_t listId=0;listId= 0; predListIdx--) -#else - int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries. - - for(int predListIdx = (int)listId ; predListIdx >= 0; predListIdx-=predListStep) -#endif { -#if JVET_N0847_SCALING_LISTS if ((sizeId == SCALING_LIST_64x64 && (listId % 3) != 0) || (sizeId == SCALING_LIST_2x2 && (listId % 3) == 0)) continue; -#endif if( !::memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ? getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(int)*std::min(MAX_MATRIX_COEF_NUM,(int)g_scalingListSize[sizeId])) // check value of matrix && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value @@ -2910,21 +1763,11 @@ static void outputScalingListHelp(std::ostream &os) " \n"; os << "The permitted matrix names are:\n"; -#if JVET_N0847_SCALING_LISTS for (uint32_t sizeIdc = SCALING_LIST_2x2; sizeIdc <= SCALING_LIST_64x64; sizeIdc++) { for (uint32_t listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) -#else - for(uint32_t sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) - { - for(uint32_t listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) -#endif { -#if JVET_N0847_SCALING_LISTS if (!(((sizeIdc == SCALING_LIST_64x64) && (listIdc % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) != 0)) || ((sizeIdc == SCALING_LIST_2x2) && (listIdc % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0)))) -#else - if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0)) -#endif { os << " " << MatrixType[sizeIdc][listIdc] << '\n'; } @@ -2934,24 +1777,12 @@ static void outputScalingListHelp(std::ostream &os) void ScalingList::outputScalingLists(std::ostream &os) const { -#if JVET_N0847_SCALING_LISTS for (uint32_t sizeIdc = SCALING_LIST_2x2; sizeIdc <= SCALING_LIST_64x64; sizeIdc++) -#else - for(uint32_t sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) -#endif { -#if JVET_N0847_SCALING_LISTS const uint32_t size = (sizeIdc == 1) ? 2 : ((sizeIdc == 2) ? 4 : 8); -#else - const uint32_t size = std::min(8,4<<(sizeIdc)); -#endif for(uint32_t listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) { -#if JVET_N0847_SCALING_LISTS if (!(((sizeIdc == SCALING_LIST_64x64) && (listIdc % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) != 0)) || ((sizeIdc == SCALING_LIST_2x2) && (listIdc % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0)))) -#else - if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0)) -#endif { const int *src = getScalingListAddress(sizeIdc, listIdc); os << (MatrixType[sizeIdc][listIdc]) << " =\n "; @@ -2993,11 +1824,7 @@ bool ScalingList::xParseScalingList(const std::string &fileName) return true; } -#if JVET_N0847_SCALING_LISTS for (uint32_t sizeIdc = SCALING_LIST_2x2; sizeIdc <= SCALING_LIST_64x64; sizeIdc++)//2x2-128x128 -#else - for(uint32_t sizeIdc = SCALING_LIST_FIRST_CODED; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) -#endif { const uint32_t size = std::min(MAX_MATRIX_COEF_NUM,(int)g_scalingListSize[sizeIdc]); @@ -3005,22 +1832,10 @@ bool ScalingList::xParseScalingList(const std::string &fileName) { int * const src = getScalingListAddress(sizeIdc, listIdc); -#if JVET_N0847_SCALING_LISTS if (((sizeIdc == SCALING_LIST_64x64) && (listIdc % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) != 0)) || ((sizeIdc == SCALING_LIST_2x2) && (listIdc % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0))) { continue; } -#else - if ((sizeIdc==SCALING_LIST_32x32) && (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0)) // derive chroma32x32 from chroma16x16 - { - const int *srcNextSmallerSize = getScalingListAddress(sizeIdc-1, listIdc); - for(uint32_t i=0; i SCALING_LIST_8x8) ? getScalingListDC(sizeIdc-1, listIdc) : src[0]); - } -#endif else { { @@ -3117,9 +1932,7 @@ const int* ScalingList::getScalingListDefaultAddress(uint32_t sizeId, uint32_t l const int *src = 0; switch(sizeId) { -#if JVET_N0847_SCALING_LISTS case SCALING_LIST_1x1: -#endif case SCALING_LIST_2x2: case SCALING_LIST_4x4: src = g_quantTSDefault4x4; @@ -3129,11 +1942,7 @@ const int* ScalingList::getScalingListDefaultAddress(uint32_t sizeId, uint32_t l case SCALING_LIST_32x32: case SCALING_LIST_64x64: case SCALING_LIST_128x128: -#if JVET_N0847_SCALING_LISTS src = (listId < (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1))) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; -#else - src = (listId < (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) ) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; -#endif break; default: THROW( "Invalid scaling list" ); @@ -3169,7 +1978,6 @@ void ScalingList::checkDcOfMatrix() } } } -#endif ParameterSetManager::ParameterSetManager() #if HEVC_VPS @@ -3179,20 +1987,12 @@ ParameterSetManager::ParameterSetManager() : m_spsMap(MAX_NUM_SPS) #endif , m_ppsMap(MAX_NUM_PPS) -#if JVET_N0805_APS_LMCS , m_apsMap(MAX_NUM_APS * MAX_NUM_APS_TYPE) -#else -, m_apsMap(MAX_NUM_APS) -#endif -#if JVET_N0349_DPS , m_dpsMap(MAX_NUM_DPS) -#endif #if HEVC_VPS , m_activeVPSId(-1) #endif -#if JVET_N0349_DPS , m_activeDPSId(-1) -#endif , m_activeSPSId(-1) { } @@ -3250,7 +2050,6 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) SPS *sps = m_spsMap.getPS(spsId); if (sps) { -#if JVET_N0349_DPS int dpsId = sps->getDecodingParameterSetId(); if ((m_activeDPSId!=-1) && (dpsId != m_activeDPSId )) { @@ -3278,7 +2077,6 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) m_dpsMap.setActive(dpsId); } } -#endif #if HEVC_VPS int vpsId = sps->getVPSId(); @@ -3289,9 +2087,7 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) else { #endif -#if JVET_N0415_CTB_ALF m_spsMap.clear(); -#endif m_spsMap.setActive(spsId); #if HEVC_VPS VPS *vps =m_vpsMap.getPS(vpsId); @@ -3309,9 +2105,7 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) } #else m_activeSPSId = spsId; -#if JVET_N0415_CTB_ALF m_ppsMap.clear(); -#endif m_ppsMap.setActive(ppsId); return true; #endif @@ -3332,13 +2126,10 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) #if HEVC_VPS m_activeVPSId=-1; #endif -#if JVET_N0349_DPS m_activeDPSId=-1; -#endif return false; } -#if JVET_N0805_APS_LMCS bool ParameterSetManager::activateAPS(int apsId, int apsType) { APS *aps = m_apsMap.getPS((apsId << NUM_APS_TYPE_LEN) + apsType); @@ -3353,22 +2144,6 @@ bool ParameterSetManager::activateAPS(int apsId, int apsType) } return false; } -#else -bool ParameterSetManager::activateAPS(int apsId) -{ - APS *aps = m_apsMap.getPS(apsId); - if (aps) - { - m_apsMap.setActive(apsId); - return true; - } - else - { - msg(WARNING, "Warning: tried to activate non-existing APS."); - } - return false; -} -#endif template <> void ParameterSetMap::setID(APS* parameterSet, const int psId) @@ -3387,41 +2162,15 @@ void ParameterSetMap::setID(SPS* parameterSet, const int psId) parameterSet->setSPSId(psId); } -#if !JVET_M0101_HLS -ProfileTierLevel::ProfileTierLevel() - : m_profileSpace (0) - , m_tierFlag (Level::MAIN) - , m_profileIdc (Profile::NONE) -#if JVET_N0276_CONSTRAINT_FLAGS - , m_subProfileIdc (0) -#endif - , m_levelIdc (Level::NONE) - , m_progressiveSourceFlag (false) - , m_interlacedSourceFlag (false) - , m_nonPackedConstraintFlag(false) - , m_frameOnlyConstraintFlag(false) -{ - ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); -} - -PTL::PTL() -{ - ::memset(m_subLayerProfilePresentFlag, 0, sizeof(m_subLayerProfilePresentFlag)); - ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); -} -#else ProfileTierLevel::ProfileTierLevel() : m_tierFlag (Level::MAIN) , m_profileIdc (Profile::NONE) -#if JVET_N0276_CONSTRAINT_FLAGS , m_subProfileIdc (0) -#endif , m_levelIdc (Level::NONE) { ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); ::memset(m_subLayerLevelIdc, Level::NONE, sizeof(m_subLayerLevelIdc )); } -#endif void calculateParameterSetChangedFlag(bool &bChanged, const std::vector *pOldData, const std::vector *pNewData) { @@ -3500,19 +2249,15 @@ uint32_t PreCalcValues::getMinQtSize( const Slice &slice, const ChannelType chTy } #if ENABLE_TRACING -#if HEVC_VPS || JVET_N0278_HLS void xTraceVPSHeader() { DTRACE( g_trace_ctx, D_HEADER, "=========== Video Parameter Set ===========\n" ); } -#endif -#if JVET_N0349_DPS void xTraceDPSHeader() { DTRACE( g_trace_ctx, D_HEADER, "=========== Decoding Parameter Set ===========\n" ); } -#endif void xTraceSPSHeader() { diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 1bad462344fe878bc133006cff06fd31ad345de3..542ef3ed98508289f5dbf3ba737bbeff7239c31a 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -69,94 +69,7 @@ typedef std::list PicList; // Class definition // ==================================================================================================================== -#if !JVET_M0128 -/// Reference Picture Set class -class ReferencePictureSet -{ -private: - int m_numberOfPictures; - int m_numberOfNegativePictures; - int m_numberOfPositivePictures; - int m_numberOfLongtermPictures; - int m_deltaPOC[MAX_NUM_REF_PICS]; - int m_POC[MAX_NUM_REF_PICS]; - bool m_used[MAX_NUM_REF_PICS]; - bool m_interRPSPrediction; - int m_deltaRIdxMinus1; - int m_deltaRPS; - int m_numRefIdc; - int m_refIdc[MAX_NUM_REF_PICS+1]; - bool m_bCheckLTMSB[MAX_NUM_REF_PICS]; - int m_pocLSBLT[MAX_NUM_REF_PICS]; - int m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS]; - bool m_deltaPocMSBPresentFlag[MAX_NUM_REF_PICS]; - -public: - ReferencePictureSet(); - virtual ~ReferencePictureSet(); - int getPocLSBLT(int i) const { return m_pocLSBLT[i]; } - void setPocLSBLT(int i, int x) { m_pocLSBLT[i] = x; } - int getDeltaPocMSBCycleLT(int i) const { return m_deltaPOCMSBCycleLT[i]; } - void setDeltaPocMSBCycleLT(int i, int x) { m_deltaPOCMSBCycleLT[i] = x; } - bool getDeltaPocMSBPresentFlag(int i) const { return m_deltaPocMSBPresentFlag[i]; } - void setDeltaPocMSBPresentFlag(int i, bool x) { m_deltaPocMSBPresentFlag[i] = x; } - void setUsed(int bufferNum, bool used); - void setDeltaPOC(int bufferNum, int deltaPOC); - void setPOC(int bufferNum, int deltaPOC); - void setNumberOfPictures(int numberOfPictures); - void setCheckLTMSBPresent(int bufferNum, bool b ); - bool getCheckLTMSBPresent(int bufferNum) const; - - int getUsed(int bufferNum) const; - int getDeltaPOC(int bufferNum) const; - int getPOC(int bufferNum) const; - int getNumberOfPictures() const; - - void setNumberOfNegativePictures(int number) { m_numberOfNegativePictures = number; } - int getNumberOfNegativePictures() const { return m_numberOfNegativePictures; } - void setNumberOfPositivePictures(int number) { m_numberOfPositivePictures = number; } - int getNumberOfPositivePictures() const { return m_numberOfPositivePictures; } - void setNumberOfLongtermPictures(int number) { m_numberOfLongtermPictures = number; } - int getNumberOfLongtermPictures() const { return m_numberOfLongtermPictures; } - - void setInterRPSPrediction(bool flag) { m_interRPSPrediction = flag; } - bool getInterRPSPrediction() const { return m_interRPSPrediction; } - void setDeltaRIdxMinus1(int x) { m_deltaRIdxMinus1 = x; } - int getDeltaRIdxMinus1() const { return m_deltaRIdxMinus1; } - void setDeltaRPS(int x) { m_deltaRPS = x; } - int getDeltaRPS() const { return m_deltaRPS; } - void setNumRefIdc(int x) { m_numRefIdc = x; } - int getNumRefIdc() const { return m_numRefIdc; } - - void setRefIdc(int bufferNum, int refIdc); - int getRefIdc(int bufferNum) const ; - - void sortDeltaPOC(); - void printDeltaPOC() const; -}; - -/// Reference Picture Set set class -class RPSList -{ -private: - std::vector m_referencePictureSets; - -public: - RPSList() { } - virtual ~RPSList() { } - - void create (int numberOfEntries) { m_referencePictureSets.resize(numberOfEntries); } - void destroy () { } - - ReferencePictureSet* getReferencePictureSet(int referencePictureSetNum) { return &m_referencePictureSets[referencePictureSetNum]; } - const ReferencePictureSet* getReferencePictureSet(int referencePictureSetNum) const { return &m_referencePictureSets[referencePictureSetNum]; } - - int getNumberOfReferencePictureSets() const { return int(m_referencePictureSets.size()); } -}; -#endif - -#if JVET_M0128 class ReferencePictureList { private: @@ -216,9 +129,7 @@ public: int getNumberOfReferencePictureLists() const { return int(m_referencePictureLists.size()); } }; -#endif -#if HEVC_USE_SCALING_LISTS /// SCALING_LIST class class ScalingList { @@ -254,9 +165,7 @@ private: uint32_t m_refMatrixId [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID std::vector m_scalingListCoef [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix }; -#endif -#if JVET_M0101_HLS class ConstraintInfo { bool m_progressiveSourceFlag; @@ -270,9 +179,7 @@ class ConstraintInfo bool m_lowerBitRateConstraintFlag; bool m_noQtbttDualTreeIntraConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noPartitionConstraintsOverrideConstraintFlag; -#endif bool m_noSaoConstraintFlag; bool m_noAlfConstraintFlag; bool m_noPcmConstraintFlag; @@ -281,31 +188,18 @@ class ConstraintInfo bool m_noSbtmvpConstraintFlag; bool m_noAmvrConstraintFlag; bool m_noBdofConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noDmvrConstraintFlag; -#endif bool m_noCclmConstraintFlag; bool m_noMtsConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noSbtConstraintFlag; -#endif bool m_noAffineMotionConstraintFlag; bool m_noGbiConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noIbcConstraintFlag; -#endif bool m_noMhIntraConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noFPelMmvdConstraintFlag; -#endif bool m_noTriangleConstraintFlag; bool m_noLadfConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS bool m_noTransformSkipConstraintFlag; -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - bool m_noCurrPicRefConstraintFlag; -#endif bool m_noQpDeltaConstraintFlag; bool m_noDepQuantConstraintFlag; bool m_noSignDataHidingConstraintFlag; @@ -320,9 +214,7 @@ public: , m_maxBitDepthConstraintIdc ( 0) , m_maxChromaFormatConstraintIdc(CHROMA_420) , m_noQtbttDualTreeIntraConstraintFlag(false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noPartitionConstraintsOverrideConstraintFlag(false) -#endif , m_noSaoConstraintFlag (false) , m_noAlfConstraintFlag (false) , m_noPcmConstraintFlag (false) @@ -331,31 +223,18 @@ public: , m_noSbtmvpConstraintFlag (false) , m_noAmvrConstraintFlag (false) , m_noBdofConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noDmvrConstraintFlag (false) -#endif , m_noCclmConstraintFlag (false) , m_noMtsConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noSbtConstraintFlag (false) -#endif , m_noAffineMotionConstraintFlag(false) , m_noGbiConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noIbcConstraintFlag (false) -#endif , m_noMhIntraConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noFPelMmvdConstraintFlag (false) -#endif , m_noTriangleConstraintFlag (false) , m_noLadfConstraintFlag (false) -#if JVET_N0276_CONSTRAINT_FLAGS , m_noTransformSkipConstraintFlag(false) -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - , m_noCurrPicRefConstraintFlag(false) -#endif , m_noQpDeltaConstraintFlag (false) , m_noDepQuantConstraintFlag (false) , m_noSignDataHidingConstraintFlag(false) @@ -390,10 +269,8 @@ public: bool getNoQtbttDualTreeIntraConstraintFlag() const { return m_noQtbttDualTreeIntraConstraintFlag; } void setNoQtbttDualTreeIntraConstraintFlag(bool bVal) { m_noQtbttDualTreeIntraConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS bool getNoPartitionConstraintsOverrideConstraintFlag() const { return m_noPartitionConstraintsOverrideConstraintFlag; } void setNoPartitionConstraintsOverrideConstraintFlag(bool bVal) { m_noPartitionConstraintsOverrideConstraintFlag = bVal; } -#endif bool getNoSaoConstraintFlag() const { return m_noSaoConstraintFlag; } void setNoSaoConstraintFlag(bool bVal) { m_noSaoConstraintFlag = bVal; } bool getNoAlfConstraintFlag() const { return m_noAlfConstraintFlag; } @@ -410,44 +287,30 @@ public: void setNoAmvrConstraintFlag(bool bVal) { m_noAmvrConstraintFlag = bVal; } bool getNoBdofConstraintFlag() const { return m_noBdofConstraintFlag; } void setNoBdofConstraintFlag(bool bVal) { m_noBdofConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS bool getNoDmvrConstraintFlag() const { return m_noDmvrConstraintFlag; } void setNoDmvrConstraintFlag(bool bVal) { m_noDmvrConstraintFlag = bVal; } -#endif bool getNoCclmConstraintFlag() const { return m_noCclmConstraintFlag; } void setNoCclmConstraintFlag(bool bVal) { m_noCclmConstraintFlag = bVal; } bool getNoMtsConstraintFlag() const { return m_noMtsConstraintFlag; } void setNoMtsConstraintFlag(bool bVal) { m_noMtsConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS bool getNoSbtConstraintFlag() const { return m_noSbtConstraintFlag; } void setNoSbtConstraintFlag(bool bVal) { m_noSbtConstraintFlag = bVal; } -#endif bool getNoAffineMotionConstraintFlag() const { return m_noAffineMotionConstraintFlag; } void setNoAffineMotionConstraintFlag(bool bVal) { m_noAffineMotionConstraintFlag = bVal; } bool getNoGbiConstraintFlag() const { return m_noGbiConstraintFlag; } void setNoGbiConstraintFlag(bool bVal) { m_noGbiConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS bool getNoIbcConstraintFlag() const { return m_noIbcConstraintFlag; } void setNoIbcConstraintFlag(bool bVal) { m_noIbcConstraintFlag = bVal; } -#endif bool getNoMhIntraConstraintFlag() const { return m_noMhIntraConstraintFlag; } void setNoMhIntraConstraintFlag(bool bVal) { m_noMhIntraConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS bool getNoFPelMmvdConstraintFlag() const { return m_noFPelMmvdConstraintFlag; } void setNoFPelMmvdConstraintFlag(bool bVal) { m_noFPelMmvdConstraintFlag = bVal; } -#endif bool getNoTriangleConstraintFlag() const { return m_noTriangleConstraintFlag; } void setNoTriangleConstraintFlag(bool bVal) { m_noTriangleConstraintFlag = bVal; } bool getNoLadfConstraintFlag() const { return m_noLadfConstraintFlag; } void setNoLadfConstraintFlag(bool bVal) { m_noLadfConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } void setNoTransformSkipConstraintFlag(bool bVal) { m_noTransformSkipConstraintFlag = bVal; } -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - bool getNoCurrPicRefConstraintFlag() const { return m_noCurrPicRefConstraintFlag; } - void setNoCurrPicRefConstraintFlag(bool bVal) { m_noCurrPicRefConstraintFlag = bVal; } -#endif bool getNoQpDeltaConstraintFlag() const { return m_noQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_noQpDeltaConstraintFlag = bVal; } bool getNoDepQuantConstraintFlag() const { return m_noDepQuantConstraintFlag; } @@ -455,45 +318,20 @@ public: bool getNoSignDataHidingConstraintFlag() const { return m_noSignDataHidingConstraintFlag; } void setNoSignDataHidingConstraintFlag(bool bVal) { m_noSignDataHidingConstraintFlag = bVal; } }; -#endif class ProfileTierLevel { -#if !JVET_M0101_HLS - int m_profileSpace; -#endif Level::Tier m_tierFlag; Profile::Name m_profileIdc; -#if !JVET_M0101_HLS - bool m_profileCompatibilityFlag[32]; -#endif -#if JVET_N0276_CONSTRAINT_FLAGS uint32_t m_subProfileIdc; -#endif Level::Name m_levelIdc; -#if !JVET_M0101_HLS - bool m_progressiveSourceFlag; - bool m_interlacedSourceFlag; - bool m_nonPackedConstraintFlag; - bool m_frameOnlyConstraintFlag; - uint32_t m_bitDepthConstraintValue; - ChromaFormat m_chromaFormatConstraintValue; - bool m_intraConstraintFlag; - bool m_onePictureOnlyConstraintFlag; - bool m_lowerBitRateConstraintFlag; -#else ConstraintInfo m_constraintInfo; bool m_subLayerLevelPresentFlag[MAX_TLAYER - 1]; Level::Name m_subLayerLevelIdc[MAX_TLAYER - 1]; -#endif public: ProfileTierLevel(); -#if !JVET_M0101_HLS - int getProfileSpace() const { return m_profileSpace; } - void setProfileSpace(int x) { m_profileSpace = x; } -#endif Level::Tier getTierFlag() const { return m_tierFlag; } void setTierFlag(Level::Tier x) { m_tierFlag = x; } @@ -501,49 +339,14 @@ public: Profile::Name getProfileIdc() const { return m_profileIdc; } void setProfileIdc(Profile::Name x) { m_profileIdc = x; } -#if JVET_N0276_CONSTRAINT_FLAGS uint32_t getSubProfileIdc() const { return m_subProfileIdc; } void setSubProfileIdc(uint32_t x) { m_subProfileIdc = x; } -#endif -#if !JVET_M0101_HLS - bool getProfileCompatibilityFlag(int i) const { return m_profileCompatibilityFlag[i]; } - void setProfileCompatibilityFlag(int i, bool x) { m_profileCompatibilityFlag[i] = x; } -#endif Level::Name getLevelIdc() const { return m_levelIdc; } void setLevelIdc(Level::Name x) { m_levelIdc = x; } -#if !JVET_M0101_HLS - bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; } - void setProgressiveSourceFlag(bool b) { m_progressiveSourceFlag = b; } - - bool getInterlacedSourceFlag() const { return m_interlacedSourceFlag; } - void setInterlacedSourceFlag(bool b) { m_interlacedSourceFlag = b; } - - bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; } - void setNonPackedConstraintFlag(bool b) { m_nonPackedConstraintFlag = b; } - - bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } - void setFrameOnlyConstraintFlag(bool b) { m_frameOnlyConstraintFlag = b; } - uint32_t getBitDepthConstraint() const { return m_bitDepthConstraintValue; } - void setBitDepthConstraint(uint32_t bitDepth) { m_bitDepthConstraintValue=bitDepth; } - - ChromaFormat getChromaFormatConstraint() const { return m_chromaFormatConstraintValue; } - void setChromaFormatConstraint(ChromaFormat fmt) { m_chromaFormatConstraintValue=fmt; } - - bool getIntraConstraintFlag() const { return m_intraConstraintFlag; } - void setIntraConstraintFlag(bool b) { m_intraConstraintFlag = b; } - - bool getOnePictureOnlyConstraintFlag() const { return m_onePictureOnlyConstraintFlag;} - void setOnePictureOnlyConstraintFlag(bool b) { m_onePictureOnlyConstraintFlag = b; } - - bool getLowerBitRateConstraintFlag() const { return m_lowerBitRateConstraintFlag; } - void setLowerBitRateConstraintFlag(bool b) { m_lowerBitRateConstraintFlag = b; } -#endif - -#if JVET_M0101_HLS ConstraintInfo* getConstraintInfo() { return &m_constraintInfo; } const ConstraintInfo* getConstraintInfo() const { return &m_constraintInfo; } @@ -552,33 +355,10 @@ public: Level::Name getSubLayerLevelIdc(int i) const { return m_subLayerLevelIdc[i]; } void setSubLayerLevelIdc(int i, Level::Name x) { m_subLayerLevelIdc[i] = x; } -#endif }; -#if !JVET_M0101_HLS -class PTL -{ - ProfileTierLevel m_generalPTL; - ProfileTierLevel m_subLayerPTL [MAX_TLAYER-1]; // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 (= 6) - bool m_subLayerProfilePresentFlag [MAX_TLAYER-1]; - bool m_subLayerLevelPresentFlag [MAX_TLAYER-1]; - -public: - PTL(); - bool getSubLayerProfilePresentFlag(int i) const { return m_subLayerProfilePresentFlag[i]; } - void setSubLayerProfilePresentFlag(int i, bool x) { m_subLayerProfilePresentFlag[i] = x; } - - bool getSubLayerLevelPresentFlag(int i) const { return m_subLayerLevelPresentFlag[i]; } - void setSubLayerLevelPresentFlag(int i, bool x) { m_subLayerLevelPresentFlag[i] = x; } - - ProfileTierLevel* getGeneralPTL() { return &m_generalPTL; } - const ProfileTierLevel* getGeneralPTL() const { return &m_generalPTL; } - ProfileTierLevel* getSubLayerPTL(int i) { return &m_subLayerPTL[i]; } - const ProfileTierLevel* getSubLayerPTL(int i) const { return &m_subLayerPTL[i]; } -}; -#endif class SliceReshapeInfo { @@ -622,7 +402,6 @@ struct ChromaQpAdj } u; }; -#if JVET_N0349_DPS class DPS { @@ -648,7 +427,6 @@ public: const ProfileTierLevel& getProfileTierLevel() const { return m_profileTierLevel; } }; -#endif #if HEVC_VPS @@ -731,7 +509,7 @@ public: TimingInfo* getTimingInfo() { return &m_timingInfo; } const TimingInfo* getTimingInfo() const { return &m_timingInfo; } }; -#elif JVET_N0278_HLS +#else class VPS { private: @@ -801,7 +579,6 @@ public: class VUI { private: -#if JVET_N0063_VUI bool m_aspectRatioInfoPresentFlag; int m_aspectRatioIdc; int m_sarWidth; @@ -819,43 +596,8 @@ private: bool m_overscanAppropriateFlag; bool m_videoSignalTypePresentFlag; bool m_videoFullRangeFlag; -#else - bool m_aspectRatioInfoPresentFlag; - int m_aspectRatioIdc; - int m_sarWidth; - int m_sarHeight; - bool m_overscanInfoPresentFlag; - bool m_overscanAppropriateFlag; - bool m_videoSignalTypePresentFlag; - int m_videoFormat; - bool m_videoFullRangeFlag; - bool m_colourDescriptionPresentFlag; - int m_colourPrimaries; - int m_transferCharacteristics; - int m_matrixCoefficients; - bool m_chromaLocInfoPresentFlag; - int m_chromaSampleLocTypeTopField; - int m_chromaSampleLocTypeBottomField; - bool m_neutralChromaIndicationFlag; - bool m_fieldSeqFlag; - Window m_defaultDisplayWindow; - bool m_frameFieldInfoPresentFlag; - bool m_hrdParametersPresentFlag; - bool m_bitstreamRestrictionFlag; - bool m_tilesFixedStructureFlag; - bool m_motionVectorsOverPicBoundariesFlag; - bool m_restrictedRefPicListsFlag; - int m_minSpatialSegmentationIdc; - int m_maxBytesPerPicDenom; - int m_maxBitsPerMinCuDenom; - int m_log2MaxMvLengthHorizontal; - int m_log2MaxMvLengthVertical; - HRDParameters m_hrdParameters; - TimingInfo m_timingInfo; -#endif public: -#if JVET_N0063_VUI VUI() : m_aspectRatioInfoPresentFlag (false) //TODO: This initialiser list contains magic numbers , m_aspectRatioIdc (0) @@ -875,43 +617,9 @@ public: , m_videoSignalTypePresentFlag (false) , m_videoFullRangeFlag (false) {} -#else - VUI() - : m_aspectRatioInfoPresentFlag (false) //TODO: This initialiser list contains magic numbers - , m_aspectRatioIdc (0) - , m_sarWidth (0) - , m_sarHeight (0) - , m_overscanInfoPresentFlag (false) - , m_overscanAppropriateFlag (false) - , m_videoSignalTypePresentFlag (false) - , m_videoFormat (5) - , m_videoFullRangeFlag (false) - , m_colourDescriptionPresentFlag (false) - , m_colourPrimaries (2) - , m_transferCharacteristics (2) - , m_matrixCoefficients (2) - , m_chromaLocInfoPresentFlag (false) - , m_chromaSampleLocTypeTopField (0) - , m_chromaSampleLocTypeBottomField (0) - , m_neutralChromaIndicationFlag (false) - , m_fieldSeqFlag (false) - , m_frameFieldInfoPresentFlag (false) - , m_hrdParametersPresentFlag (false) - , m_bitstreamRestrictionFlag (false) - , m_tilesFixedStructureFlag (false) - , m_motionVectorsOverPicBoundariesFlag(true) - , m_restrictedRefPicListsFlag (1) - , m_minSpatialSegmentationIdc (0) - , m_maxBytesPerPicDenom (2) - , m_maxBitsPerMinCuDenom (1) - , m_log2MaxMvLengthHorizontal (15) - , m_log2MaxMvLengthVertical (15) - {} -#endif virtual ~VUI() {} -#if JVET_N0063_VUI bool getAspectRatioInfoPresentFlag() const { return m_aspectRatioInfoPresentFlag; } void setAspectRatioInfoPresentFlag(bool i) { m_aspectRatioInfoPresentFlag = i; } @@ -963,104 +671,6 @@ public: bool getVideoFullRangeFlag() const { return m_videoFullRangeFlag; } void setVideoFullRangeFlag(bool i) { m_videoFullRangeFlag = i; } -#else - bool getAspectRatioInfoPresentFlag() const { return m_aspectRatioInfoPresentFlag; } - void setAspectRatioInfoPresentFlag(bool i) { m_aspectRatioInfoPresentFlag = i; } - - int getAspectRatioIdc() const { return m_aspectRatioIdc; } - void setAspectRatioIdc(int i) { m_aspectRatioIdc = i; } - - int getSarWidth() const { return m_sarWidth; } - void setSarWidth(int i) { m_sarWidth = i; } - - int getSarHeight() const { return m_sarHeight; } - void setSarHeight(int i) { m_sarHeight = i; } - - bool getOverscanInfoPresentFlag() const { return m_overscanInfoPresentFlag; } - void setOverscanInfoPresentFlag(bool i) { m_overscanInfoPresentFlag = i; } - - bool getOverscanAppropriateFlag() const { return m_overscanAppropriateFlag; } - void setOverscanAppropriateFlag(bool i) { m_overscanAppropriateFlag = i; } - - bool getVideoSignalTypePresentFlag() const { return m_videoSignalTypePresentFlag; } - void setVideoSignalTypePresentFlag(bool i) { m_videoSignalTypePresentFlag = i; } - - int getVideoFormat() const { return m_videoFormat; } - void setVideoFormat(int i) { m_videoFormat = i; } - - bool getVideoFullRangeFlag() const { return m_videoFullRangeFlag; } - void setVideoFullRangeFlag(bool i) { m_videoFullRangeFlag = i; } - - bool getColourDescriptionPresentFlag() const { return m_colourDescriptionPresentFlag; } - void setColourDescriptionPresentFlag(bool i) { m_colourDescriptionPresentFlag = i; } - - int getColourPrimaries() const { return m_colourPrimaries; } - void setColourPrimaries(int i) { m_colourPrimaries = i; } - - int getTransferCharacteristics() const { return m_transferCharacteristics; } - void setTransferCharacteristics(int i) { m_transferCharacteristics = i; } - - int getMatrixCoefficients() const { return m_matrixCoefficients; } - void setMatrixCoefficients(int i) { m_matrixCoefficients = i; } - - bool getChromaLocInfoPresentFlag() const { return m_chromaLocInfoPresentFlag; } - void setChromaLocInfoPresentFlag(bool i) { m_chromaLocInfoPresentFlag = i; } - - int getChromaSampleLocTypeTopField() const { return m_chromaSampleLocTypeTopField; } - void setChromaSampleLocTypeTopField(int i) { m_chromaSampleLocTypeTopField = i; } - - int getChromaSampleLocTypeBottomField() const { return m_chromaSampleLocTypeBottomField; } - void setChromaSampleLocTypeBottomField(int i) { m_chromaSampleLocTypeBottomField = i; } - - bool getNeutralChromaIndicationFlag() const { return m_neutralChromaIndicationFlag; } - void setNeutralChromaIndicationFlag(bool i) { m_neutralChromaIndicationFlag = i; } - - bool getFieldSeqFlag() const { return m_fieldSeqFlag; } - void setFieldSeqFlag(bool i) { m_fieldSeqFlag = i; } - - bool getFrameFieldInfoPresentFlag() const { return m_frameFieldInfoPresentFlag; } - void setFrameFieldInfoPresentFlag(bool i) { m_frameFieldInfoPresentFlag = i; } - - Window& getDefaultDisplayWindow() { return m_defaultDisplayWindow; } - const Window& getDefaultDisplayWindow() const { return m_defaultDisplayWindow; } - void setDefaultDisplayWindow(Window& defaultDisplayWindow ) { m_defaultDisplayWindow = defaultDisplayWindow; } - - bool getHrdParametersPresentFlag() const { return m_hrdParametersPresentFlag; } - void setHrdParametersPresentFlag(bool i) { m_hrdParametersPresentFlag = i; } - - bool getBitstreamRestrictionFlag() const { return m_bitstreamRestrictionFlag; } - void setBitstreamRestrictionFlag(bool i) { m_bitstreamRestrictionFlag = i; } - - bool getTilesFixedStructureFlag() const { return m_tilesFixedStructureFlag; } - void setTilesFixedStructureFlag(bool i) { m_tilesFixedStructureFlag = i; } - - bool getMotionVectorsOverPicBoundariesFlag() const { return m_motionVectorsOverPicBoundariesFlag; } - void setMotionVectorsOverPicBoundariesFlag(bool i) { m_motionVectorsOverPicBoundariesFlag = i; } - - bool getRestrictedRefPicListsFlag() const { return m_restrictedRefPicListsFlag; } - void setRestrictedRefPicListsFlag(bool b) { m_restrictedRefPicListsFlag = b; } - - int getMinSpatialSegmentationIdc() const { return m_minSpatialSegmentationIdc; } - void setMinSpatialSegmentationIdc(int i) { m_minSpatialSegmentationIdc = i; } - - int getMaxBytesPerPicDenom() const { return m_maxBytesPerPicDenom; } - void setMaxBytesPerPicDenom(int i) { m_maxBytesPerPicDenom = i; } - - int getMaxBitsPerMinCuDenom() const { return m_maxBitsPerMinCuDenom; } - void setMaxBitsPerMinCuDenom(int i) { m_maxBitsPerMinCuDenom = i; } - - int getLog2MaxMvLengthHorizontal() const { return m_log2MaxMvLengthHorizontal; } - void setLog2MaxMvLengthHorizontal(int i) { m_log2MaxMvLengthHorizontal = i; } - - int getLog2MaxMvLengthVertical() const { return m_log2MaxMvLengthVertical; } - void setLog2MaxMvLengthVertical(int i) { m_log2MaxMvLengthVertical = i; } - - HRDParameters* getHrdParameters() { return &m_hrdParameters; } - const HRDParameters* getHrdParameters() const { return &m_hrdParameters; } - - TimingInfo* getTimingInfo() { return &m_timingInfo; } - const TimingInfo* getTimingInfo() const { return &m_timingInfo; } -#endif }; /// SPS RExt class @@ -1124,61 +734,11 @@ class SPS { private: int m_SPSId; -#if JVET_N0349_DPS int m_decodingParameterSetId; -#endif -#if !JVET_M0101_HLS - bool m_bIntraOnlyConstraintFlag; - uint32_t m_maxBitDepthConstraintIdc; - uint32_t m_maxChromaFormatConstraintIdc; - bool m_bFrameConstraintFlag; - bool m_bNoQtbttDualTreeIntraConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS - bool m_noPartitionConstraintsOverrideConstraintFlag; -#endif - bool m_bNoSaoConstraintFlag; - bool m_bNoAlfConstraintFlag; - bool m_bNoPcmConstraintFlag; - bool m_bNoRefWraparoundConstraintFlag; - bool m_bNoTemporalMvpConstraintFlag; - bool m_bNoSbtmvpConstraintFlag; - bool m_bNoAmvrConstraintFlag; - bool m_bNoBdofConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS - bool m_noDmvrConstraintFlag; -#endif - bool m_bNoCclmConstraintFlag; - bool m_bNoMtsConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS - bool m_noSbtConstraintFlag; -#endif - bool m_bNoAffineMotionConstraintFlag; - bool m_bNoGbiConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS - bool m_noIbcConstraintFlag; -#endif - bool m_bNoMhIntraConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS - bool m_noFPelMmvdConstraintFlag; -#endif - bool m_bNoTriangleConstraintFlag; - bool m_bNoLadfConstraintFlag; -#if JVET_N0276_CONSTRAINT_FLAGS - bool m_noTransformSkipConstraintFlag; -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - bool m_bNoCurrPicRefConstraintFlag; -#endif - bool m_bNoQpDeltaConstraintFlag; - bool m_bNoDepQuantConstraintFlag; - bool m_bNoSignDataHidingConstraintFlag; -#endif bool m_affineAmvrEnabledFlag; bool m_DMVR; -#if JVET_N0127_MMVD_SPS_FLAG bool m_MMVD; -#endif bool m_SBT; uint8_t m_MaxSbtSize; #if INCLUDE_ISP_CFG_FLAG @@ -1203,9 +763,7 @@ private: unsigned m_maxBTDepth[3]; unsigned m_maxBTSize[3]; unsigned m_maxTTSize[3]; -#if JVET_N0047_Merge_IDR_Non_IDR bool m_idrRefParamList; -#endif unsigned m_dualITree; uint32_t m_uiMaxCUWidth; uint32_t m_uiMaxCUHeight; @@ -1213,7 +771,6 @@ private: Window m_conformanceWindow; -#if JVET_M0128 RPLList m_RPLList0; RPLList m_RPLList1; uint32_t m_numRPL0; @@ -1221,9 +778,6 @@ private: bool m_rpl1CopyFromRpl0Flag; bool m_rpl1IdxPresentFlag; bool m_allRplEntriesHasSameSignFlag; -#else - RPSList m_RPSList; -#endif bool m_bLongTermRefsPresent; bool m_SPSTemporalMVPEnabledFlag; int m_numReorderPics[MAX_TLAYER]; @@ -1254,23 +808,16 @@ private: bool m_bTemporalIdNestingFlag; // temporal_id_nesting_flag -#if HEVC_USE_SCALING_LISTS bool m_scalingListEnabledFlag; bool m_scalingListPresentFlag; ScalingList m_scalingList; -#endif uint32_t m_uiMaxDecPicBuffering[MAX_TLAYER]; uint32_t m_uiMaxLatencyIncreasePlus1[MAX_TLAYER]; -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - bool m_useStrongIntraSmoothing; -#endif -#if JVET_N0063_VUI TimingInfo m_timingInfo; bool m_hrdParametersPresentFlag; HRDParameters m_hrdParameters; -#endif bool m_vuiParametersPresentFlag; VUI m_vuiParameters; @@ -1279,11 +826,7 @@ private: static const int m_winUnitX[NUM_CHROMA_FORMAT]; static const int m_winUnitY[NUM_CHROMA_FORMAT]; -#if !JVET_M0101_HLS - PTL m_pcPTL; -#else ProfileTierLevel m_profileTierLevel; -#endif bool m_alfEnabledFlag; @@ -1298,12 +841,8 @@ private: bool m_MTS; bool m_IntraMTS; // 18 bool m_InterMTS; // 19 -#if JVET_N0193_LFNST bool m_LFNST; -#endif -#if JVET_N0235_SMVD_SPS bool m_SMVD; -#endif bool m_Affine; bool m_AffineType; bool m_GBi; // @@ -1315,9 +854,7 @@ private: int m_LadfQpOffset[MAX_LADF_INTERVALS]; int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS]; #endif -#if JVET_N0217_MATRIX_INTRAPRED bool m_MIP; -#endif public: @@ -1327,89 +864,11 @@ public: #if HEVC_VPS int getVPSId() const { return m_VPSId; } void setVPSId(int i) { m_VPSId = i; } -#endif -#if !JVET_M0101_HLS - bool getIntraOnlyConstraintFlag() const { return m_bIntraOnlyConstraintFlag; } - void setIntraOnlyConstraintFlag(bool bVal) { m_bIntraOnlyConstraintFlag = bVal; } - uint32_t getMaxBitDepthConstraintIdc() const { return m_maxBitDepthConstraintIdc; } - void setMaxBitDepthConstraintIdc(uint32_t u) { m_maxBitDepthConstraintIdc = u; } - uint32_t getMaxChromaFormatConstraintIdc() const { return m_maxChromaFormatConstraintIdc; } - void setMaxChromaFormatConstraintIdc(uint32_t u) { m_maxChromaFormatConstraintIdc = u; } - bool getFrameConstraintFlag() const { return m_bFrameConstraintFlag; } - void setFrameConstraintFlag(bool bVal) { m_bFrameConstraintFlag = bVal; } - bool getNoQtbttDualTreeIntraConstraintFlag() const { return m_bNoQtbttDualTreeIntraConstraintFlag; } - void setNoQtbttDualTreeIntraConstraintFlag(bool bVal) { m_bNoQtbttDualTreeIntraConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS - bool getNoPartitionConstraintsOverrideConstraintFlag() const { return m_noPartitionConstraintsOverrideConstraintFlag; } - void setNoPartitionConstraintsOverrideConstraintFlag(bool bVal) { m_noPartitionConstraintsOverrideConstraintFlag = bVal; } -#endif - bool getNoSaoConstraintFlag() const { return m_bNoSaoConstraintFlag; } - void setNoSaoConstraintFlag(bool bVal) { m_bNoSaoConstraintFlag = bVal; } - bool getNoAlfConstraintFlag() const { return m_bNoAlfConstraintFlag; } - void setNoAlfConstraintFlag(bool bVal) { m_bNoAlfConstraintFlag = bVal; } - bool getNoPcmConstraintFlag() const { return m_bNoPcmConstraintFlag; } - void setNoPcmConstraintFlag(bool bVal) { m_bNoPcmConstraintFlag = bVal; } - bool getNoRefWraparoundConstraintFlag() const { return m_bNoRefWraparoundConstraintFlag; } - void setNoRefWraparoundConstraintFlag(bool bVal) { m_bNoRefWraparoundConstraintFlag= bVal; } - bool getNoTemporalMvpConstraintFlag() const { return m_bNoTemporalMvpConstraintFlag; } - void setNoTemporalMvpConstraintFlag(bool bVal) { m_bNoTemporalMvpConstraintFlag = bVal; } - bool getNoSbtmvpConstraintFlag() const { return m_bNoSbtmvpConstraintFlag; } - void setNoSbtmvpConstraintFlag(bool bVal) { m_bNoSbtmvpConstraintFlag = bVal; } - bool getNoAmvrConstraintFlag() const { return m_bNoAmvrConstraintFlag; } - void setNoAmvrConstraintFlag(bool bVal) { m_bNoAmvrConstraintFlag = bVal; } - bool getNoBdofConstraintFlag() const { return m_bNoBdofConstraintFlag; } - void setNoBdofConstraintFlag(bool bVal) { m_bNoBdofConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS - bool getNoDmvrConstraintFlag() const { return m_noDmvrConstraintFlag; } - void setNoDmvrConstraintFlag(bool bVal) { m_noDmvrConstraintFlag = bVal; } -#endif - bool getNoCclmConstraintFlag() const { return m_bNoCclmConstraintFlag; } - void setNoCclmConstraintFlag(bool bVal) { m_bNoCclmConstraintFlag = bVal; } - bool getNoMtsConstraintFlag() const { return m_bNoMtsConstraintFlag; } - void setNoMtsConstraintFlag(bool bVal) { m_bNoMtsConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS - bool getNoSbtConstraintFlag() const { return m_noSbtConstraintFlag; } - void setNoSbtConstraintFlag(bool bVal) { m_noSbtConstraintFlag = bVal; } -#endif - bool getNoAffineMotionConstraintFlag() const { return m_bNoAffineMotionConstraintFlag; } - void setNoAffineMotionConstraintFlag(bool bVal) { m_bNoAffineMotionConstraintFlag = bVal; } - bool getNoGbiConstraintFlag() const { return m_bNoGbiConstraintFlag; } - void setNoGbiConstraintFlag(bool bVal) { m_bNoGbiConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS - bool getNoIbcConstraintFlag() const { return m_noIbcConstraintFlag; } - void setNoIbcConstraintFlag(bool bVal) { m_noIbcConstraintFlag = bVal; } -#endif - bool getNoMhIntraConstraintFlag() const { return m_bNoMhIntraConstraintFlag; } - void setNoMhIntraConstraintFlag(bool bVal) { m_bNoMhIntraConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS - bool getNoFPelMmvdConstraintFlag() const { return m_noFPelMmvdConstraintFlag; } - void setNoFPelMmvdConstraintFlag(bool bVal) { m_noFPelMmvdConstraintFlag = bVal; } -#endif - bool getNoTriangleConstraintFlag() const { return m_bNoTriangleConstraintFlag; } - void setNoTriangleConstraintFlag(bool bVal) { m_bNoTriangleConstraintFlag = bVal; } - bool getNoLadfConstraintFlag() const { return m_bNoLadfConstraintFlag; } - void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } -#if JVET_N0276_CONSTRAINT_FLAGS - bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } - void setNoTransformSkipConstraintFlag(bool bVal) { m_noTransformSkipConstraintFlag = bVal; } -#endif -#if !JVET_N0276_CONSTRAINT_FLAGS - bool getNoCurrPicRefConstraintFlag() const { return m_bNoCurrPicRefConstraintFlag; } - void setNoCurrPicRefConstraintFlag(bool bVal) { m_bNoCurrPicRefConstraintFlag = bVal; } -#endif - bool getNoQpDeltaConstraintFlag() const { return m_bNoQpDeltaConstraintFlag; } - void setNoQpDeltaConstraintFlag(bool bVal) { m_bNoQpDeltaConstraintFlag = bVal; } - bool getNoDepQuantConstraintFlag() const { return m_bNoDepQuantConstraintFlag; } - void setNoDepQuantConstraintFlag(bool bVal) { m_bNoDepQuantConstraintFlag = bVal; } - bool getNoSignDataHidingConstraintFlag() const { return m_bNoSignDataHidingConstraintFlag; } - void setNoSignDataHidingConstraintFlag(bool bVal) { m_bNoSignDataHidingConstraintFlag = bVal; } #endif int getSPSId() const { return m_SPSId; } void setSPSId(int i) { m_SPSId = i; } -#if JVET_N0349_DPS void setDecodingParameterSetId(int val) { m_decodingParameterSetId = val; } int getDecodingParameterSetId() const { return m_decodingParameterSetId; } -#endif ChromaFormat getChromaFormatIdc () const { return m_chromaFormatIdc; } void setChromaFormatIdc (ChromaFormat i) { m_chromaFormatIdc = i; } @@ -1468,10 +927,8 @@ public: unsigned getMaxTTSize() const { return m_maxTTSize[1]; } unsigned getMaxTTSizeI() const { return m_maxTTSize[0]; } unsigned getMaxTTSizeIChroma() const { return m_maxTTSize[2]; } -#if JVET_N0047_Merge_IDR_Non_IDR void setIDRRefParamListPresent(bool b) { m_idrRefParamList = b; } bool getIDRRefParamListPresent() const { return m_idrRefParamList; } -#endif void setUseDualITree(bool b) { m_dualITree = b; } bool getUseDualITree() const { return m_dualITree; } @@ -1491,7 +948,6 @@ public: uint32_t getBitsForPOC() const { return m_uiBitsForPOC; } void setNumReorderPics(int i, uint32_t tlayer) { m_numReorderPics[tlayer] = i; } int getNumReorderPics(uint32_t tlayer) const { return m_numReorderPics[tlayer]; } -#if JVET_M0128 void createRPLList0(int numRPL); void createRPLList1(int numRPL); const RPLList* getRPLList0() const { return &m_RPLList0; } @@ -1505,11 +961,6 @@ public: bool getRPL1IdxPresentFlag() const { return m_rpl1IdxPresentFlag; } void setAllActiveRplEntriesHasSameSignFlag(bool isAllSame) { m_allRplEntriesHasSameSignFlag = isAllSame; } bool getAllActiveRplEntriesHasSameSignFlag() const { return m_allRplEntriesHasSameSignFlag; } -#else - void createRPSList( int numRPS ); - const RPSList* getRPSList() const { return &m_RPSList; } - RPSList* getRPSList() { return &m_RPSList; } -#endif bool getLongTermRefsPresent() const { return m_bLongTermRefsPresent; } void setLongTermRefsPresent(bool b) { m_bLongTermRefsPresent=b; } bool getSPSTemporalMVPEnabledFlag() const { return m_SPSTemporalMVPEnabledFlag; } @@ -1545,10 +996,8 @@ public: void setFpelMmvdEnabledFlag( bool b ) { m_fpelMmvdEnabledFlag = b; } bool getUseDMVR()const { return m_DMVR; } void setUseDMVR(bool b) { m_DMVR = b; } -#if JVET_N0127_MMVD_SPS_FLAG bool getUseMMVD()const { return m_MMVD; } void setUseMMVD(bool b) { m_MMVD = b; } -#endif uint32_t getMaxTLayers() const { return m_uiMaxTLayers; } void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; } @@ -1559,45 +1008,31 @@ public: void setPCMFilterDisableFlag( bool bValue ) { m_bPCMFilterDisableFlag = bValue; } bool getPCMFilterDisableFlag() const { return m_bPCMFilterDisableFlag; } -#if HEVC_USE_SCALING_LISTS bool getScalingListFlag() const { return m_scalingListEnabledFlag; } void setScalingListFlag( bool b ) { m_scalingListEnabledFlag = b; } bool getScalingListPresentFlag() const { return m_scalingListPresentFlag; } void setScalingListPresentFlag( bool b ) { m_scalingListPresentFlag = b; } ScalingList& getScalingList() { return m_scalingList; } const ScalingList& getScalingList() const { return m_scalingList; } -#endif uint32_t getMaxDecPicBuffering(uint32_t tlayer) const { return m_uiMaxDecPicBuffering[tlayer]; } void setMaxDecPicBuffering( uint32_t ui, uint32_t tlayer ) { CHECK(tlayer >= MAX_TLAYER, "Invalid T-layer"); m_uiMaxDecPicBuffering[tlayer] = ui; } uint32_t getMaxLatencyIncreasePlus1(uint32_t tlayer) const { return m_uiMaxLatencyIncreasePlus1[tlayer]; } void setMaxLatencyIncreasePlus1( uint32_t ui , uint32_t tlayer) { m_uiMaxLatencyIncreasePlus1[tlayer] = ui; } -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - void setUseStrongIntraSmoothing(bool bVal) { m_useStrongIntraSmoothing = bVal; } - bool getUseStrongIntraSmoothing() const { return m_useStrongIntraSmoothing; } - -#endif void setAffineAmvrEnabledFlag( bool val ) { m_affineAmvrEnabledFlag = val; } bool getAffineAmvrEnabledFlag() const { return m_affineAmvrEnabledFlag; } -#if JVET_N0063_VUI TimingInfo* getTimingInfo() { return &m_timingInfo; } const TimingInfo* getTimingInfo() const { return &m_timingInfo; } bool getHrdParametersPresentFlag() const { return m_hrdParametersPresentFlag; } void setHrdParametersPresentFlag(bool b) { m_hrdParametersPresentFlag = b; } HRDParameters* getHrdParameters() { return &m_hrdParameters; } const HRDParameters* getHrdParameters() const { return &m_hrdParameters; } -#endif bool getVuiParametersPresentFlag() const { return m_vuiParametersPresentFlag; } void setVuiParametersPresentFlag(bool b) { m_vuiParametersPresentFlag = b; } VUI* getVuiParameters() { return &m_vuiParameters; } const VUI* getVuiParameters() const { return &m_vuiParameters; } -#if !JVET_M0101_HLS - const PTL* getPTL() const { return &m_pcPTL; } - PTL* getPTL() { return &m_pcPTL; } -#else const ProfileTierLevel* getProfileTierLevel() const { return &m_profileTierLevel; } ProfileTierLevel* getProfileTierLevel() { return &m_profileTierLevel; } -#endif const SPSRExt& getSpsRangeExtension() const { return m_spsRangeExtension; } SPSRExt& getSpsRangeExtension() { return m_spsRangeExtension; } @@ -1636,14 +1071,10 @@ public: bool getUseIntraMTS () const { return m_IntraMTS; } void setUseInterMTS ( bool b ) { m_InterMTS = b; } bool getUseInterMTS () const { return m_InterMTS; } -#if JVET_N0193_LFNST void setUseLFNST ( bool b ) { m_LFNST = b; } bool getUseLFNST () const { return m_LFNST; } -#endif -#if JVET_N0235_SMVD_SPS void setUseSMVD(bool b) { m_SMVD = b; } bool getUseSMVD() const { return m_SMVD; } -#endif void setUseGBi ( bool b ) { m_GBi = b; } bool getUseGBi () const { return m_GBi; } #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET @@ -1661,37 +1092,12 @@ public: bool getUseMHIntra () const { return m_MHIntra; } void setUseTriangle ( bool b ) { m_Triangle = b; } bool getUseTriangle () const { return m_Triangle; } -#if JVET_N0217_MATRIX_INTRAPRED void setUseMIP ( bool b ) { m_MIP = b; } bool getUseMIP () const { return m_MIP; } -#endif }; /// Reference Picture Lists class -#if !JVET_M0128 -class RefPicListModification -{ -private: - bool m_refPicListModificationFlagL0; - bool m_refPicListModificationFlagL1; - uint32_t m_RefPicSetIdxL0[REF_PIC_LIST_NUM_IDX]; - uint32_t m_RefPicSetIdxL1[REF_PIC_LIST_NUM_IDX]; - -public: - RefPicListModification(); - virtual ~RefPicListModification(); - - bool getRefPicListModificationFlagL0() const { return m_refPicListModificationFlagL0; } - void setRefPicListModificationFlagL0(bool flag) { m_refPicListModificationFlagL0 = flag; } - bool getRefPicListModificationFlagL1() const { return m_refPicListModificationFlagL1; } - void setRefPicListModificationFlagL1(bool flag) { m_refPicListModificationFlagL1 = flag; } - uint32_t getRefPicSetIdxL0(uint32_t idx) const { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); return m_RefPicSetIdxL0[idx]; } - void setRefPicSetIdxL0(uint32_t idx, uint32_t refPicSetIdx) { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); m_RefPicSetIdxL0[idx] = refPicSetIdx; } - uint32_t getRefPicSetIdxL1(uint32_t idx) const { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); return m_RefPicSetIdxL1[idx]; } - void setRefPicSetIdxL1(uint32_t idx, uint32_t refPicSetIdx) { CHECK(idx>=REF_PIC_LIST_NUM_IDX, "Invalid ref-pic-list index"); m_RefPicSetIdxL1[idx] = refPicSetIdx; } -}; -#endif /// PPS RExt class @@ -1771,25 +1177,18 @@ private: int m_chromaCbQpOffset; int m_chromaCrQpOffset; -#if JVET_N0054_JOINT_CHROMA int m_chromaCbCrQpOffset; -#endif uint32_t m_numRefIdxL0DefaultActive; uint32_t m_numRefIdxL1DefaultActive; -#if JVET_M0128 bool m_rpl1IdxPresentFlag; -#endif bool m_bUseWeightPred; //!< Use of Weighting Prediction (P_SLICE) bool m_useWeightedBiPred; //!< Use of Weighting Bi-Prediction (B_SLICE) bool m_OutputFlagPresentFlag; //!< Indicates the presence of output_flag in slice header bool m_TransquantBypassEnabledFlag; //!< Indicates presence of cu_transquant_bypass_flag in CUs. bool m_useTransformSkip; -#if !JVET_N0857_TILES_BRICKS - bool m_tilesEnabledFlag; //!< Indicates the presence of tiles -#endif bool m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts bool m_loopFilterAcrossBricksEnabledFlag; @@ -1799,7 +1198,6 @@ private: std::vector m_tileColumnWidth; std::vector m_tileRowHeight; -#if JVET_N0857_TILES_BRICKS bool m_singleTileInPicFlag; int m_tileColsWidthMinus1; int m_tileRowsHeightMinus1; @@ -1812,20 +1210,14 @@ private: bool m_singleBrickPerSliceFlag; bool m_rectSliceFlag; int m_numSlicesInPicMinus1; -#if JVET_N0857_RECT_SLICES std::vector m_topLeftBrickIdx; std::vector m_bottomRightBrickIdx; int m_numTilesInPic; int m_numBricksInPic; -#else - std::vector m_topLeftTileIdx; - std::vector m_bottomRightTileIdx; -#endif bool m_signalledSliceIdFlag; int m_signalledSliceIdLengthMinus1; std::vector m_sliceId; -#endif bool m_cabacInitPresentFlag; @@ -1836,21 +1228,17 @@ private: bool m_ppsDeblockingFilterDisabledFlag; int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter -#if HEVC_USE_SCALING_LISTS bool m_scalingListPresentFlag; ScalingList m_scalingList; //!< ScalingList class -#endif bool m_listsModificationPresentFlag; uint32_t m_log2ParallelMergeLevelMinus2; int m_numExtraSliceHeaderBits; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND bool m_loopFilterAcrossVirtualBoundariesDisabledFlag; unsigned m_numVerVirtualBoundaries; unsigned m_numHorVirtualBoundaries; unsigned m_virtualBoundariesPosX[3]; unsigned m_virtualBoundariesPosY[3]; -#endif PPSRExt m_ppsRangeExtension; @@ -1888,12 +1276,10 @@ public: { m_chromaCrQpOffset = i; } -#if JVET_N0054_JOINT_CHROMA else if (compID==JOINT_CbCr) { m_chromaCbCrQpOffset = i; } -#endif else { THROW( "Invalid chroma QP offset" ); @@ -1901,11 +1287,7 @@ public: } int getQpOffset(ComponentID compID) const { -#if JVET_N0054_JOINT_CHROMA return (compID==COMPONENT_Y) ? 0 : (compID==COMPONENT_Cb ? m_chromaCbQpOffset : compID==COMPONENT_Cr ? m_chromaCrQpOffset : m_chromaCbCrQpOffset ); -#else - return (compID==COMPONENT_Y) ? 0 : (compID==COMPONENT_Cb ? m_chromaCbQpOffset : m_chromaCrQpOffset ); -#endif } void setNumRefIdxL0DefaultActive(uint32_t ui) { m_numRefIdxL0DefaultActive=ui; } @@ -1913,10 +1295,8 @@ public: void setNumRefIdxL1DefaultActive(uint32_t ui) { m_numRefIdxL1DefaultActive=ui; } uint32_t getNumRefIdxL1DefaultActive() const { return m_numRefIdxL1DefaultActive; } -#if JVET_M0128 void setRpl1IdxPresentFlag(bool isPresent) { m_rpl1IdxPresentFlag = isPresent; } uint32_t getRpl1IdxPresentFlag() const { return m_rpl1IdxPresentFlag; } -#endif bool getUseWP() const { return m_bUseWeightPred; } bool getWPBiPred() const { return m_useWeightedBiPred; } @@ -1933,10 +1313,6 @@ public: void setLoopFilterAcrossBricksEnabledFlag(bool b) { m_loopFilterAcrossBricksEnabledFlag = b; } bool getLoopFilterAcrossBricksEnabledFlag() const { return m_loopFilterAcrossBricksEnabledFlag; } -#if !JVET_N0857_TILES_BRICKS - void setTilesEnabledFlag(bool val) { m_tilesEnabledFlag = val; } - bool getTilesEnabledFlag() const { return m_tilesEnabledFlag; } -#endif bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; } void setEntropyCodingSyncEnabledFlag(bool val) { m_entropyCodingSyncEnabledFlag = val; } @@ -1951,7 +1327,6 @@ public: void setTileRowHeight(const std::vector& rowHeight) { m_tileRowHeight = rowHeight; } uint32_t getTileRowHeight(uint32_t rowIdx) const { return m_tileRowHeight[rowIdx]; } -#if JVET_N0857_TILES_BRICKS bool getSingleTileInPicFlag() const { return m_singleTileInPicFlag; } void setSingleTileInPicFlag(bool val) { m_singleTileInPicFlag = val; } int getTileColsWidthMinus1() const { return m_tileColsWidthMinus1; } @@ -1976,7 +1351,6 @@ public: void setRectSliceFlag(bool val) { m_rectSliceFlag = val; } int getNumSlicesInPicMinus1() const { return m_numSlicesInPicMinus1; } void setNumSlicesInPicMinus1(int val) { m_numSlicesInPicMinus1 = val; } -#if JVET_N0857_RECT_SLICES int getTopLeftBrickIdx(uint32_t columnIdx) const { return m_topLeftBrickIdx[columnIdx]; } void setTopLeftBrickIdx(const std::vector& val) { m_topLeftBrickIdx = val; } int getBottomRightBrickIdx(uint32_t columnIdx) const { return m_bottomRightBrickIdx[columnIdx]; } @@ -1985,19 +1359,12 @@ public: void setNumTilesInPic(int val) { m_numTilesInPic = val; } int getNumBricksInPic() const { return m_numBricksInPic; } void setNumBricksInPic(int val) { m_numBricksInPic = val; } -#else - int getTopLeftTileIdx(uint32_t columnIdx) const { return m_topLeftTileIdx[columnIdx]; } - void setTopLeftTileIdx(const std::vector& val) { m_topLeftTileIdx = val; } - int getBottomeRightTileIdx(uint32_t columnIdx) const { return m_bottomRightTileIdx[columnIdx]; } - void setBottomRightTileIdx(const std::vector& val) { m_bottomRightTileIdx = val; } -#endif bool getSignalledSliceIdFlag() const { return m_signalledSliceIdFlag; } void setSignalledSliceIdFlag(bool val) { m_signalledSliceIdFlag = val; } int getSignalledSliceIdLengthMinus1() const { return m_signalledSliceIdLengthMinus1; } void setSignalledSliceIdLengthMinus1(int val) { m_signalledSliceIdLengthMinus1 = val; } int getSliceId(uint32_t columnIdx) const { return m_sliceId[columnIdx]; } void setSliceId(const std::vector& val) { m_sliceId = val; } -#endif void setCabacInitPresentFlag( bool flag ) { m_cabacInitPresentFlag = flag; } bool getCabacInitPresentFlag() const { return m_cabacInitPresentFlag; } @@ -2011,12 +1378,10 @@ public: int getDeblockingFilterBetaOffsetDiv2() const { return m_deblockingFilterBetaOffsetDiv2; } //!< get beta offset for deblocking filter void setDeblockingFilterTcOffsetDiv2(int val) { m_deblockingFilterTcOffsetDiv2 = val; } //!< set tc offset for deblocking filter int getDeblockingFilterTcOffsetDiv2() const { return m_deblockingFilterTcOffsetDiv2; } //!< get tc offset for deblocking filter -#if HEVC_USE_SCALING_LISTS bool getScalingListPresentFlag() const { return m_scalingListPresentFlag; } void setScalingListPresentFlag( bool b ) { m_scalingListPresentFlag = b; } ScalingList& getScalingList() { return m_scalingList; } const ScalingList& getScalingList() const { return m_scalingList; } -#endif bool getListsModificationPresentFlag() const { return m_listsModificationPresentFlag; } void setListsModificationPresentFlag( bool b ) { m_listsModificationPresentFlag = b; } uint32_t getLog2ParallelMergeLevelMinus2() const { return m_log2ParallelMergeLevelMinus2; } @@ -2028,7 +1393,6 @@ public: bool getSliceHeaderExtensionPresentFlag() const { return m_sliceHeaderExtensionPresentFlag; } void setSliceHeaderExtensionPresentFlag(bool val) { m_sliceHeaderExtensionPresentFlag = val; } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void setLoopFilterAcrossVirtualBoundariesDisabledFlag(bool b) { m_loopFilterAcrossVirtualBoundariesDisabledFlag = b; } bool getLoopFilterAcrossVirtualBoundariesDisabledFlag() const { return m_loopFilterAcrossVirtualBoundariesDisabledFlag; } void setNumVerVirtualBoundaries(unsigned u) { m_numVerVirtualBoundaries = u; } @@ -2039,7 +1403,6 @@ public: unsigned getVirtualBoundariesPosX(unsigned idx) const { return m_virtualBoundariesPosX[idx]; } void setVirtualBoundariesPosY(unsigned u, unsigned idx) { m_virtualBoundariesPosY[idx] = u; } unsigned getVirtualBoundariesPosY(unsigned idx) const { return m_virtualBoundariesPosY[idx]; } -#endif const PPSRExt& getPpsRangeExtension() const { return m_ppsRangeExtension; } PPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; } @@ -2049,13 +1412,9 @@ class APS { private: int m_APSId; // adaptation_parameter_set_id -#if JVET_N0805_APS_LMCS int m_APSType; // aps_params_type -#endif AlfSliceParam m_alfAPSParam; -#if JVET_N0805_APS_LMCS SliceReshapeInfo m_reshapeAPSInfo; -#endif public: APS(); @@ -2064,24 +1423,16 @@ public: int getAPSId() const { return m_APSId; } void setAPSId(int i) { m_APSId = i; } -#if JVET_N0805_APS_LMCS int getAPSType() const { return m_APSType; } void setAPSType(int type) { m_APSType = type; } -#endif void setAlfAPSParam(AlfSliceParam& alfAPSParam) { m_alfAPSParam = alfAPSParam; } -#if JVET_N0415_CTB_ALF void setTemporalId(int i) { m_alfAPSParam.tLayer = i; } int getTemporalId() { return m_alfAPSParam.tLayer; } AlfSliceParam& getAlfAPSParam() { return m_alfAPSParam; } -#else - const AlfSliceParam& getAlfAPSParam() const { return m_alfAPSParam; } -#endif -#if JVET_N0805_APS_LMCS void setReshaperAPSInfo(SliceReshapeInfo& reshapeAPSInfo) { m_reshapeAPSInfo = reshapeAPSInfo; } SliceReshapeInfo& getReshaperAPSInfo() { return m_reshapeAPSInfo; } -#endif }; struct WPScalingParam { @@ -2119,19 +1470,12 @@ private: int m_iLastIDR; int m_iAssociatedIRAP; NalUnitType m_iAssociatedIRAPType; -#if JVET_M0128 const ReferencePictureList* m_pRPL0; //< pointer to RPL for L0, either in the SPS or the local RPS in the same slice header const ReferencePictureList* m_pRPL1; //< pointer to RPL for L1, either in the SPS or the local RPS in the same slice header ReferencePictureList m_localRPL0; //< RPL for L0 when present in slice header ReferencePictureList m_localRPL1; //< RPL for L1 when present in slice header int m_rpl0Idx; //< index of used RPL in the SPS or -1 for local RPL in the slice header int m_rpl1Idx; //< index of used RPL in the SPS or -1 for local RPL in the slice header -#else - const ReferencePictureSet* m_pRPS; //< pointer to RPS, either in the SPS or the local RPS in the same slice header - ReferencePictureSet m_localRPS; //< RPS when present in slice header - int m_rpsIdx; //< index of used RPS in the SPS or -1 for local RPS in the slice header - RefPicListModification m_RefPicListModification; -#endif NalUnitType m_eNalUnitType; ///< Nal unit type for the slice SliceType m_eSliceType; int m_iSliceQp; @@ -2146,9 +1490,7 @@ private: bool m_pendingRasInit; bool m_depQuantEnabledFlag; -#if HEVC_USE_SIGN_HIDING bool m_signDataHidingEnabledFlag; -#endif bool m_bCheckLDC; bool m_biDirPred; @@ -2156,11 +1498,7 @@ private: // Data int m_iSliceQpDelta; -#if JVET_N0054_JOINT_CHROMA int m_iSliceChromaQpDelta[MAX_NUM_COMPONENT+1]; -#else - int m_iSliceChromaQpDelta[MAX_NUM_COMPONENT]; -#endif Picture* m_apcRefPicList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; int m_aiRefPOCList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; bool m_bIsUsedAsLongTerm[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; @@ -2171,9 +1509,7 @@ private: #if HEVC_VPS const VPS* m_pcVPS; #endif -#if JVET_N0349_DPS const DPS* m_dps; -#endif const SPS* m_pcSPS; const PPS* m_pcPPS; Picture* m_pcPic; @@ -2186,9 +1522,7 @@ private: uint32_t m_colRefIdx; uint32_t m_maxNumMergeCand; uint32_t m_maxNumAffineMergeCand; -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM uint32_t m_maxNumTriangleCand; -#endif bool m_disFracMMVD; double m_lambdas[MAX_NUM_COMPONENT]; @@ -2205,12 +1539,10 @@ private: uint32_t m_sliceBits; bool m_bFinalized; -#if JVET_N0857_RECT_SLICES uint32_t m_sliceCurStartBrickIdx; uint32_t m_sliceCurEndBrickIdx; uint32_t m_sliceNumBricks; uint32_t m_sliceIdx; -#endif bool m_bTestWeightPred; bool m_bTestWeightBiPred; @@ -2222,9 +1554,6 @@ private: bool m_cabacInitFlag; bool m_bLMvdL1Zero; -#if !JVET_M0101_HLS - bool m_temporalLayerNonReferenceFlag; -#endif bool m_LFCrossSliceBoundaryFlag; bool m_enableTMVPFlag; @@ -2245,32 +1574,16 @@ private: uint32_t m_uiMaxTTSizeIChroma; uint32_t m_uiMaxBTSize; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS APS* m_alfApss[MAX_NUM_APS]; -#else - APS* m_apss[MAX_NUM_APS]; -#endif bool m_tileGroupAlfEnabledFlag[MAX_NUM_COMPONENT]; int m_tileGroupNumAps; std::vector m_tileGroupLumaApsId; int m_tileGroupChromaApsId; -#else - int m_apsId; - APS* m_aps; - bool m_tileGroupAlfEnabledFlag; -#endif -#if JVET_N0329_IBC_SEARCH_IMP bool m_disableSATDForRd; -#endif -#if JVET_N0805_APS_LMCS int m_lmcsApsId; APS* m_lmcsAps; bool m_tileGroupLmcsEnabledFlag; bool m_tileGroupLmcsChromaResidualScaleFlag; -#else - SliceReshapeInfo m_sliceReshapeInfo; -#endif public: Slice(); virtual ~Slice(); @@ -2280,10 +1593,8 @@ public: void setVPS( VPS* pcVPS ) { m_pcVPS = pcVPS; } const VPS* getVPS() const { return m_pcVPS; } #endif -#if JVET_N0349_DPS void setDPS( DPS* dps ) { m_dps = dps; } const DPS* getDPS() const { return m_dps; } -#endif void setSPS( const SPS* pcSPS ) { m_pcSPS = pcSPS; } const SPS* getSPS() const { return m_pcSPS; } @@ -2293,21 +1604,8 @@ public: void setPPSId( int PPSId ) { m_iPPSId = PPSId; } int getPPSId() const { return m_iPPSId; } -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS void setAlfAPSs(APS** apss) { memcpy(m_alfApss, apss, sizeof(m_alfApss)); } APS** getAlfAPSs() { return m_alfApss; } -#else - void setAPSs(APS** apss) { memcpy(m_apss, apss, sizeof(m_apss)); } - APS** getAPSs() { return m_apss; } -#endif -#else - void setAPS(APS* aps) { m_aps = aps; m_apsId = (aps) ? aps->getAPSId() : -1; } - APS* getAPS() { return m_aps; } - void setAPSId(int apsId) { m_apsId = apsId; } - int getAPSId() const { return m_apsId; } -#endif -#if JVET_N0805_APS_LMCS void setLmcsAPS(APS* lmcsAps) { m_lmcsAps = lmcsAps; m_lmcsApsId = (lmcsAps) ? lmcsAps->getAPSId() : -1; } APS* getLmcsAPS() { return m_lmcsAps; } void setLmcsAPSId(int lmcsApsId) { m_lmcsApsId = lmcsApsId; } @@ -2318,12 +1616,10 @@ public: void setLmcsChromaResidualScaleFlag(bool b) { m_tileGroupLmcsChromaResidualScaleFlag = b; } bool getLmcsChromaResidualScaleFlag() { return m_tileGroupLmcsChromaResidualScaleFlag; } const bool getLmcsChromaResidualScaleFlag() const { return m_tileGroupLmcsChromaResidualScaleFlag; } -#endif void setPicOutputFlag( bool b ) { m_PicOutputFlag = b; } bool getPicOutputFlag() const { return m_PicOutputFlag; } void setSaoEnabledFlag(ChannelType chType, bool s) {m_saoEnabledFlag[chType] =s; } bool getSaoEnabledFlag(ChannelType chType) const { return m_saoEnabledFlag[chType]; } -#if JVET_M0128 void setRPL0(const ReferencePictureList *pcRPL) { m_pRPL0 = pcRPL; } void setRPL1(const ReferencePictureList *pcRPL) { m_pRPL1 = pcRPL; } const ReferencePictureList* getRPL0() { return m_pRPL0; } @@ -2334,15 +1630,6 @@ public: void setRPL1idx(int rplIdx) { m_rpl1Idx = rplIdx; } int getRPL0idx() const { return m_rpl0Idx; } int getRPL1idx() const { return m_rpl1Idx; } -#else - void setRPS( const ReferencePictureSet *pcRPS ) { m_pRPS = pcRPS; } - const ReferencePictureSet* getRPS() { return m_pRPS; } - ReferencePictureSet* getLocalRPS() { return &m_localRPS; } - - void setRPSidx( int rpsIdx ) { m_rpsIdx = rpsIdx; } - int getRPSidx() const { return m_rpsIdx; } - RefPicListModification* getRefPicListModification() { return &m_RefPicListModification; } -#endif void setLastIDR(int iIDRPOC) { m_iLastIDR = iIDRPOC; } int getLastIDR() const { return m_iLastIDR; } void setAssociatedIRAPPOC(int iAssociatedIRAPPOC) { m_iAssociatedIRAP = iAssociatedIRAPPOC; } @@ -2376,35 +1663,15 @@ public: void setIsUsedAsLongTerm(int i, int j, bool value) { m_bIsUsedAsLongTerm[i][j] = value; } bool getCheckLDC() const { return m_bCheckLDC; } bool getMvdL1ZeroFlag() const { return m_bLMvdL1Zero; } -#if !JVET_M0128 - int getNumRpsCurrTempList() const; -#endif int getList1IdxToList0Idx( int list1Idx ) const { return m_list1IdxToList0Idx[list1Idx]; } -#if !JVET_M0101_HLS - bool isReferenceNalu() const { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); } -#endif void setPOC( int i ) { m_iPOC = i; } void setNalUnitType( NalUnitType e ) { m_eNalUnitType = e; } NalUnitType getNalUnitType() const { return m_eNalUnitType; } bool getRapPicFlag() const; bool getIdrPicFlag() const { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } -#if JVET_N0067_NAL_Unit_Header bool isIRAP() const { return (getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA); } bool isIDRorBLA() const { return (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP); } -#else -#if !JVET_M0101_HLS - bool isIRAP() const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } - bool isIDRorBLA() const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 20); } -#else - bool isIRAP() const { return (getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL13); } - bool isIDRorBLA() const { return (getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP); } -#endif -#endif -#if !JVET_M0128 - void checkCRA(const ReferencePictureSet *pReferencePictureSet, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic); -#else void checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic); -#endif void decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& rcListPic, const bool bEfficientFieldIRAPEnabled); void setSliceType( SliceType e ) { m_eSliceType = e; } void setSliceQp( int i ) { m_iSliceQp = i; } @@ -2420,11 +1687,7 @@ public: void setPic( Picture* p ) { m_pcPic = p; } void setDepth( int iDepth ) { m_iDepth = iDepth; } -#if JVET_M0128 void constructRefPicList(PicList& rcListPic); -#else - void setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr = false, bool bCopyL0toL1ErrorCase = false ); -#endif void setRefPOCList(); void setColFromL0Flag( bool colFromL0 ) { m_colFromL0Flag = colFromL0; } @@ -2465,10 +1728,8 @@ public: void setDepQuantEnabledFlag( bool b ) { m_depQuantEnabledFlag = b; } bool getDepQuantEnabledFlag() const { return m_depQuantEnabledFlag; } -#if HEVC_USE_SIGN_HIDING void setSignDataHidingEnabledFlag( bool b ) { m_signDataHidingEnabledFlag = b; } bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; } -#endif void initEqualRef(); bool isEqualRef( RefPicList e, int iRefIdx1, int iRefIdx2 ) @@ -2497,30 +1758,17 @@ public: void setTLayer( uint32_t uiTLayer ) { m_uiTLayer = uiTLayer; } void checkLeadingPictureRestrictions( PicList& rcListPic ) const; -#if JVET_M0128 void applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1 ) const; -#else - void applyReferencePictureSet( PicList& rcListPic, const ReferencePictureSet *RPSList) const; -#endif bool isTemporalLayerSwitchingPoint( PicList& rcListPic ) const; bool isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic ) const; -#if JVET_M0128 int checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList *pRPL, int rplIdx, bool printErrors) const; void createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1); -#else - int checkThatAllRefPicsAreAvailable( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool printErrors, int pocRandomAccess = 0, bool bUseRecoveryPoint = false) const; - void createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled - , bool isEncodeLtRef, bool isCompositeRefEnable - ); -#endif void setMaxNumMergeCand(uint32_t val ) { m_maxNumMergeCand = val; } uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; } void setMaxNumAffineMergeCand( uint32_t val ) { m_maxNumAffineMergeCand = val; } uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; } - #if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM void setMaxNumTriangleCand(uint32_t val) { m_maxNumTriangleCand = val;} uint32_t getMaxNumTriangleCand() const { return m_maxNumTriangleCand;} -#endif void setDisFracMMVD( bool val ) { m_disFracMMVD = val; } bool getDisFracMMVD() const { return m_disFracMMVD; } void setNoOutputPriorPicsFlag( bool val ) { m_noOutputPriorPicsFlag = val; } @@ -2547,7 +1795,6 @@ public: uint32_t getSliceBits() const { return m_sliceBits; } void setFinalized( bool uiVal ) { m_bFinalized = uiVal; } bool getFinalized() const { return m_bFinalized; } -#if JVET_N0857_RECT_SLICES void setSliceCurStartBrickIdx(uint32_t brickIdx) { m_sliceCurStartBrickIdx = brickIdx; } uint32_t getSliceCurStartBrickIdx() const { return m_sliceCurStartBrickIdx; } void setSliceCurEndBrickIdx(uint32_t brickIdx) { m_sliceCurEndBrickIdx = brickIdx; } @@ -2556,7 +1803,6 @@ public: uint32_t getSliceNumBricks() const { return m_sliceNumBricks; } void setSliceIndex(uint32_t idx) { m_sliceIdx = idx; } uint32_t setSliceIndex() const { return m_sliceIdx; } -#endif bool testWeightPred( ) const { return m_bTestWeightPred; } void setTestWeightPred( bool bValue ) { m_bTestWeightPred = bValue; } bool testWeightBiPred( ) const { return m_bTestWeightBiPred; } @@ -2583,10 +1829,6 @@ public: void setCabacInitFlag( bool val ) { m_cabacInitFlag = val; } //!< set CABAC initial flag bool getCabacInitFlag() const { return m_cabacInitFlag; } //!< get CABAC initial flag -#if !JVET_M0101_HLS - bool getTemporalLayerNonReferenceFlag() const { return m_temporalLayerNonReferenceFlag; } - void setTemporalLayerNonReferenceFlag(bool x) { m_temporalLayerNonReferenceFlag = x; } -#endif void setLFCrossSliceBoundaryFlag( bool val ) { m_LFCrossSliceBoundaryFlag = val; } bool getLFCrossSliceBoundaryFlag() const { return m_LFCrossSliceBoundaryFlag; } @@ -2610,7 +1852,6 @@ public: void resetProcessingTime() { m_dProcessingTime = m_iProcessingStartTime = 0; } double getProcessingTime() const { return m_dProcessingTime; } -#if JVET_N0415_CTB_ALF void resetTileGroupAlfEnabledFlag() { memset(m_tileGroupAlfEnabledFlag, 0, sizeof(m_tileGroupAlfEnabledFlag)); } bool getTileGroupAlfEnabledFlag(ComponentID compId) const { return m_tileGroupAlfEnabledFlag[compId]; } void setTileGroupAlfEnabledFlag(ComponentID compId, bool b) { m_tileGroupAlfEnabledFlag[compId] = b; } @@ -2619,11 +1860,7 @@ public: int getTileGroupApsIdChroma() const { return m_tileGroupChromaApsId; } void setTileGroupApsIdChroma(int i) { m_tileGroupChromaApsId = i; } std::vector getTileGroupApsIdLuma() const { return m_tileGroupLumaApsId; } -#if JVET_N0805_APS_LMCS void setAlfAPSs(std::vector ApsIDs) -#else - void setAPSs(std::vector ApsIDs) -#endif { m_tileGroupLumaApsId.resize(m_tileGroupNumAps); for (int i = 0; i < m_tileGroupNumAps; i++) @@ -2631,18 +1868,8 @@ public: m_tileGroupLumaApsId[i] = ApsIDs[i]; } } -#else - bool getTileGroupAlfEnabledFlag() const { return m_tileGroupAlfEnabledFlag; } - void setTileGroupAlfEnabledFlag(bool b) { m_tileGroupAlfEnabledFlag = b; } -#endif -#if JVET_N0329_IBC_SEARCH_IMP void setDisableSATDForRD(bool b) { m_disableSATDForRd = b; } bool getDisableSATDForRD() { return m_disableSATDForRd; } -#endif -#if !JVET_N0805_APS_LMCS - const SliceReshapeInfo& getReshapeInfo() const { return m_sliceReshapeInfo; } - SliceReshapeInfo& getReshapeInfo() { return m_sliceReshapeInfo; } -#endif protected: Picture* xGetRefPic (PicList& rcListPic, int poc); Picture* xGetLongTermRefPic(PicList& rcListPic, int poc, bool pocHasMsb); @@ -2663,14 +1890,9 @@ public: ParameterSetMap(int maxId) :m_maxId (maxId) -#if !JVET_N0415_CTB_ALF - ,m_activePsId(-1) -#endif ,m_lastActiveParameterSet(NULL) { -#if JVET_N0415_CTB_ALF m_activePsId.clear(); -#endif } ~ParameterSetMap() @@ -2696,12 +1918,10 @@ public: return m_paramsetMap[psId].parameterSet; } -#if JVET_N0415_CTB_ALF void clearMap() { m_paramsetMap.clear(); } -#endif void storePS(int psId, T *ps, const std::vector *pNaluData) { @@ -2720,11 +1940,7 @@ public: return; } -#if JVET_N0415_CTB_ALF if (find(m_activePsId.begin(), m_activePsId.end(), psId) != m_activePsId.end()) -#else - if( m_activePsId == psId ) -#endif { std::swap( m_paramsetMap[psId].parameterSet, m_lastActiveParameterSet ); } @@ -2792,21 +2008,13 @@ public: return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second.parameterSet; } -#if JVET_N0415_CTB_ALF void setActive(int psId) { m_activePsId.push_back(psId); } void clear() { m_activePsId.clear(); } -#else - void setActive(int psId ) { m_activePsId = psId;} -#endif private: std::map > m_paramsetMap; int m_maxId; -#if JVET_N0415_CTB_ALF std::vector m_activePsId; -#else - int m_activePsId; -#endif T* m_lastActiveParameterSet; static void setID(T* parameterSet, const int psId); }; @@ -2827,14 +2035,12 @@ public: VPS* getFirstVPS() { return m_vpsMap.getFirstPS(); }; #endif -#if JVET_N0349_DPS void storeDPS(DPS *dps, const std::vector &naluData) { m_dpsMap.storePS( dps->getDecodingParameterSetId(), dps, &naluData); }; //! get pointer to existing video parameter set DPS* getDPS(int dpsId) { return m_dpsMap.getPS(dpsId); }; bool getDPSChangedFlag(int dpsId) const { return m_dpsMap.getChangedFlag(dpsId); } void clearDPSChangedFlag(int dpsId) { m_dpsMap.clearChangedFlag(dpsId); } DPS* getFirstDPS() { return m_dpsMap.getFirstPS(); }; -#endif //! store sequence parameter set and take ownership of it void storeSPS(SPS *sps, const std::vector &naluData) { m_spsMap.storePS( sps->getSPSId(), sps, &naluData); }; //! get pointer to existing sequence parameter set @@ -2862,32 +2068,19 @@ public: #endif //! \returns true, if activation is successful bool activatePPS(int ppsId, bool isIRAP); -#if JVET_N0415_CTB_ALF APS** getAPSs() { return &m_apss[0]; } ParameterSetMap* getApsMap() { return &m_apsMap; } -#endif -#if JVET_N0805_APS_LMCS void storeAPS(APS *aps, const std::vector &naluData) { m_apsMap.storePS((aps->getAPSId() << NUM_APS_TYPE_LEN) + aps->getAPSType(), aps, &naluData); }; APS* getAPS(int apsId, int apsType) { return m_apsMap.getPS((apsId << NUM_APS_TYPE_LEN) + apsType); }; bool getAPSChangedFlag(int apsId, int apsType) const { return m_apsMap.getChangedFlag((apsId << NUM_APS_TYPE_LEN) + apsType); } void clearAPSChangedFlag(int apsId, int apsType) { m_apsMap.clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + apsType); } APS* getFirstAPS() { return m_apsMap.getFirstPS(); }; bool activateAPS(int apsId, int apsType); -#else - void storeAPS(APS *aps, const std::vector &naluData) { m_apsMap.storePS(aps->getAPSId(), aps, &naluData); }; - APS* getAPS(int apsId) { return m_apsMap.getPS(apsId); }; - bool getAPSChangedFlag(int apsId) const { return m_apsMap.getChangedFlag(apsId); } - void clearAPSChangedFlag(int apsId) { m_apsMap.clearChangedFlag(apsId); } - APS* getFirstAPS() { return m_apsMap.getFirstPS(); }; - bool activateAPS(int apsId); -#endif #if HEVC_VPS const VPS* getActiveVPS()const { return m_vpsMap.getPS(m_activeVPSId); }; #endif const SPS* getActiveSPS()const { return m_spsMap.getPS(m_activeSPSId); }; -#if JVET_N0349_DPS const DPS* getActiveDPS()const { return m_dpsMap.getPS(m_activeDPSId); }; -#endif protected: #if HEVC_VPS @@ -2896,20 +2089,14 @@ protected: ParameterSetMap m_spsMap; ParameterSetMap m_ppsMap; ParameterSetMap m_apsMap; -#if JVET_N0349_DPS ParameterSetMap m_dpsMap; -#endif -#if JVET_N0415_CTB_ALF APS* m_apss[MAX_NUM_APS]; -#endif #if HEVC_VPS int m_activeVPSId; // -1 for nothing active #endif -#if JVET_N0349_DPS int m_activeDPSId; // -1 for nothing active -#endif int m_activeSPSId; // -1 for nothing active }; @@ -2995,12 +2182,8 @@ public: }; #if ENABLE_TRACING -#if HEVC_VPS || JVET_N0278_HLS void xTraceVPSHeader(); -#endif -#if JVET_N0349_DPS void xTraceDPSHeader(); -#endif void xTraceSPSHeader(); void xTracePPSHeader(); void xTraceAPSHeader(); diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index c98194cb08f1dcf2a906d20c5a6781809a364531..ef42ebeac30264657a1f851905b4f1a7a9a271b8 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -157,16 +157,9 @@ void TrQuant::init( const Quant* otherQuant, delete m_quant; m_quant = nullptr; -#if !JVET_N0847_SCALING_LISTS - if( bUseRDOQ || !bEnc ) -#endif { m_quant = new DepQuant( otherQuant, bEnc ); } -#if !JVET_N0847_SCALING_LISTS - else - m_quant = new Quant( otherQuant ); -#endif if( m_quant ) { @@ -174,7 +167,6 @@ void TrQuant::init( const Quant* otherQuant, } } -#if JVET_N0193_LFNST void TrQuant::fwdLfnstNxN( int* src, int* dst, const uint32_t mode, const uint32_t index, const uint32_t size, int zeroOutSize ) { const int8_t* trMat = ( size > 4 ) ? g_lfnst8x8[ mode ][ index ][ 0 ] : g_lfnst4x4[ mode ][ index ][ 0 ]; @@ -263,11 +255,7 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID ) if( lfnstIdx && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 ) { const bool whge3 = width >= 8 && height >= 8; -#if JVET_N0103_CGSIZE_HARMONIZATION const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; -#else - const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ toChannelType( compID ) ][ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; -#endif uint32_t intraMode = PU::getFinalIntraMode( *tu.cs->getPU( area.pos(), toChannelType( compID ) ), toChannelType( compID ) ); if( PU::isLMCMode( tu.cs->getPU( area.pos(), toChannelType( compID ) )->intraDir[ toChannelType( compID ) ] ) ) @@ -367,11 +355,7 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons if( lfnstIdx && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 ) { const bool whge3 = width >= 8 && height >= 8; -#if JVET_N0103_CGSIZE_HARMONIZATION const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; -#else - const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ toChannelType( compID ) ][ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; -#endif uint32_t intraMode = PU::getFinalIntraMode( *tu.cs->getPU( area.pos(), toChannelType( compID ) ), toChannelType( compID ) ); if( PU::isLMCMode( tu.cs->getPU( area.pos(), toChannelType( compID ) )->intraDir[ toChannelType( compID ) ] ) ) @@ -460,7 +444,6 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons } } } -#endif void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, PelBuf &pResi, const QpParam &cQP ) @@ -495,12 +478,10 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel DTRACE_COEFF_BUF( D_TCOEFF, tempCoeff, tu, tu.cu->predMode, compID ); -#if JVET_N0193_LFNST if( tu.cs->sps->getUseLFNST() ) { xInvLfnst( tu, compID ); } -#endif if( isLuma(compID) && tu.mtsIdx == MTS_SKIP ) { @@ -579,26 +560,16 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf & // Logical transform // ------------------------------------------------------------------------------------------------ -#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer) -#else -void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer ) -#endif { -#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP const bool isExplicitMTS = (CU::isIntra(*tu.cu) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS() && CU::isInter(*tu.cu)) && isLuma(compID); const bool isImplicitMTS = CU::isIntra(*tu.cu) && tu.cs->sps->getUseImplicitMTS() && isLuma(compID); const bool isISP = CU::isIntra(*tu.cu) && tu.cu->ispMode && isLuma(compID); const bool isSBT = CU::isInter(*tu.cu) && tu.cu->sbtInfo && isLuma(compID); -#else - bool mtsActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS() && CU::isInter( *tu.cu ); - bool mtsImplicit = CU::isIntra( *tu.cu ) && tu.cs->sps->getUseImplicitMTS() && compID == COMPONENT_Y; -#endif trTypeHor = DCT2; trTypeVer = DCT2; -#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP if (isImplicitMTS || isISP) { int width = tu.blocks[compID].width; @@ -612,21 +583,9 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy trTypeVer = DST7; return; } -#endif -#if !JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP - if (tu.cu->ispMode && isLuma(compID)) - { - TU::getTransformTypeISP(tu, compID, trTypeHor, trTypeVer); - return; - } -#endif -#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP if (isSBT) -#else - if( tu.cu->sbtInfo && compID == COMPONENT_Y ) -#endif { uint8_t sbtIdx = tu.cu->getSbtIdx(); uint8_t sbtPos = tu.cu->getSbtPos(); @@ -660,7 +619,6 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy return; } -#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP if (isExplicitMTS) { if (tu.mtsIdx > MTS_SKIP) @@ -672,36 +630,6 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy trTypeVer = indVer ? DCT8 : DST7; } } -#else - if ( mtsActivated ) - { - if( compID == COMPONENT_Y ) - { - if ( tu.mtsIdx > MTS_SKIP ) - { - int indHor = ( tu.mtsIdx - MTS_DST7_DST7 ) & 1; - int indVer = ( tu.mtsIdx - MTS_DST7_DST7 ) >> 1; - - trTypeHor = indHor ? DCT8 : DST7; - trTypeVer = indVer ? DCT8 : DST7; - } - } - } - else if ( mtsImplicit ) - { - int width = tu.blocks[compID].width; - int height = tu.blocks[compID].height; - bool widthDstOk = width >= 4 && width <= 16; - bool heightDstOk = height >= 4 && height <= 16; - - if ( width < height && widthDstOk ) - trTypeHor = DST7; - else if ( height < width && heightDstOk ) - trTypeVer = DST7; - else if ( width == height && widthDstOk ) - trTypeHor = trTypeVer = DST7; - } -#endif } @@ -959,9 +887,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr, double* diagRatio, double* horVerRatio ) { CodingStructure &cs = *tu.cs; -#if JVET_N0193_LFNST const SPS &sps = *cs.sps; -#endif const CompArea &rect = tu.blocks[compID]; const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; @@ -979,12 +905,10 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const RDPCMMode rdpcmMode = RDPCM_OFF; rdpcmNxN(tu, compID, cQP, uiAbsSum, rdpcmMode); -#if JVET_N0413_RDPCM if( tu.cu->bdpcmMode && isLuma(compID) ) { tu.mtsIdx = MTS_SKIP; } -#endif if (rdpcmMode == RDPCM_OFF) { @@ -1048,12 +972,10 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const xGetCoeffEnergy( tu, compID, tempCoeff, diagRatio, horVerRatio ); } -#if JVET_N0193_LFNST if( sps.getUseLFNST() ) { xFwdLfnst( tu, compID, loadTr ); } -#endif DTRACE_COEFF_BUF( D_TCOEFF, tempCoeff, tu, tu.cu->predMode, compID ); diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h index f416f3bfda6582fa22ad7a74b25b288bcbe01eea..b6334ecafe84b7602c73299db9e0e6f3609607cd 100644 --- a/source/Lib/CommonLib/TrQuant.h +++ b/source/Lib/CommonLib/TrQuant.h @@ -47,9 +47,7 @@ #include "UnitPartitioner.h" #include "Quant.h" -#if JVET_N0847_SCALING_LISTS #include "DepQuant.h" -#endif //! \ingroup CommonLib //! \{ @@ -80,26 +78,18 @@ public: const bool bEnc = false, const bool useTransformSkipFast = false ); -#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP void getTrTypes(const TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer); -#else - void getTrTypes( TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer ); -#endif -#if JVET_N0193_LFNST void fwdLfnstNxN( int* src, int* dst, const uint32_t mode, const uint32_t index, const uint32_t size, int zeroOutSize ); void invLfnstNxN( int* src, int* dst, const uint32_t mode, const uint32_t index, const uint32_t size, int zeroOutSize ); uint32_t getLFNSTIntraMode( int wideAngPredMode ); bool getTransposeFlag ( uint32_t intraMode ); -#endif protected: -#if JVET_N0193_LFNST void xFwdLfnst( const TransformUnit &tu, const ComponentID compID, const bool loadTr = false ); void xInvLfnst( const TransformUnit &tu, const ComponentID compID ); -#endif public: @@ -122,11 +112,7 @@ public: void setLambda ( const double dLambda ) { m_quant->setLambda( dLambda ); } double getLambda () const { return m_quant->getLambda(); } -#if JVET_N0847_SCALING_LISTS //maybe no need DepQuant* getQuant() { return m_quant; } -#else - Quant* getQuant() { return m_quant; } -#endif #if ENABLE_SPLIT_PARALLELISM @@ -142,16 +128,10 @@ protected: bool m_scalingListEnabledFlag; private: -#if JVET_N0847_SCALING_LISTS DepQuant *m_quant; //!< Quantizer -#else - Quant *m_quant; //!< Quantizer -#endif TCoeff** m_mtsCoeffs; -#if JVET_N0193_LFNST TCoeff m_tempInMatrix [ 48 ]; TCoeff m_tempOutMatrix[ 48 ]; -#endif // forward Transform diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 1d707927933ccacbcfe62a2ca4d3908c6faf1822..6de4c6214ed980424688321aa1b5c9e6d56a5bd7 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,169 +50,81 @@ #include #include -#define JVET_N0047_Merge_IDR_Non_IDR 1 // merging IDR and non-IDR pictures -#define JVET_N0276_CONSTRAINT_FLAGS 1 // JVET-N0276: On interoperability point signalling -#define JVET_N0278_HLS 1 // JVET-N0278: HLS for MPEG requirements on immersive media delivery and access -#define JVET_N0805_APS_LMCS 1 // JVET-N0805: Reference to APS from slice header for LMCS -#define JVET_N0070_WRAPAROUND 1 // reference wraparound simplifications -#define JVET_N0063_VUI 1 // JVET-N0063: Video Usability Information -#define JVET_N0847_SCALING_LISTS 1 //1: default mode, 2: user defined mode -#if JVET_N0847_SCALING_LISTS -#define HEVC_USE_SCALING_LISTS 1 -#endif -#define JVET_N0415_CTB_ALF 1 // JVET-N0415: CTB-based ALF switch -#define JVET_N0105_LFNST_CTX_MODELLING 1 // LFNST index signalled without intra mode dependency and with on ctx-coded bin -#define JVET_N0193_LFNST 1 //Low Frequency Non-Separable Transform (LFNST), previously, Reduced Secondary Transform (RST) -#define JVET_N0217_MATRIX_INTRAPRED 1 // matrix-based intra prediction (MIP) -#define JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM 1 // JVET-N0400, JVET-N0447, JVET-N0500, JVET-N0851, align triangle merge candidate number and regular merge candidate number -#define JVET_N0413_RDPCM 1 // Residual DPCM JVET-N0413/N0214 -#define JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP 1 // JVET-N0866: unified transform derivation for ISP and implicit MTS (combining JVET-N0172, JVET-N0375, JVET-N0419 and JVET-N0420) -#define JVET_N0340_TRI_MERGE_CAND 1 -#define JVET_N0302_SIMPLFIED_CIIP 1 -#define JVET_N0327_MERGE_BIT_CALC_FIX 1 -#define JVET_N0324_REGULAR_MRG_FLAG 1 -#define JVET_N0251_ITEM4_IBC_LOCAL_SEARCH_RANGE 1 -#define JVET_N0435_WAIP_HARMONIZATION 1 -#define JVET_N0168_AMVR_ME_MODIFICATION 1 // Correct the cost and bits calculation in encoder side -#define JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND 1 // loop filter disabled across virtual boundaries -#define JVET_N0067_NAL_Unit_Header 1 // NAL Unit Header -#define JVET_N0349_DPS 1 // Decoding Parameter Set -#define JVET_N0068_AFFINE_MEM_BW 1 // memory bandwidth reduction for affine mode -#define JVET_N0308_MAX_CU_SIZE_FOR_ISP 1 -#define JVET_N0857_TILES_BRICKS 1 // VTM-5 basic Slices/Tiles/Bricks design, rectangular slices not supported yet -#define JVET_N0857_RECT_SLICES 1 // Support for rectangular slices and raster-scan slices (i.e., multiple tiles/brick in a slice) -#if JVET_N0857_TILES_BRICKS -#define JVET_N0124_PROPOSAL1 1 // JVET-N0124 Proposal 1 -#define JVET_N0124_PROPOSAL2 1 // JVET-N0124 Proposal 2 -#endif -#define JVET_N0280_RESIDUAL_CODING_TS 1 -#define JVET_N0103_CGSIZE_HARMONIZATION 1 // Chroma CG sizes aligned to luma CG sizes -#define JVET_N0146_DMVR_BDOF_CONDITION 1 // JVET-N146/N0162/N0442/N0153/N0262/N0440/N0086 applicable condition of DMVR and BDOF -#define JVET_N0470_SMVD_FIX 1 // remove mvd_l1_zero_flag condition, align to spec text. -#define JVET_N0235_SMVD_SPS 1 -#define JVET_N0671 1 -#if JVET_N0671 -#define JVET_N0671_CHROMA_FORMAT_422 1 -#define JVET_N0671_RGB 1 -#define JVET_N0671_CCLM 1 -#define JVET_N0671_AFFINE 1 -#define JVET_N0671_DMVR 1 -#define JVET_N0671_RDCOST_FIX 1 -#define JVET_N0671_INTRA_TPM_ALIGNWITH420 1 -#endif //JVET_N0671 -#define JVET_N0843_BVP_SIMPLIFICATION 1 -#define JVET_N0448_N0380 1 // When MaxNumMergeCand is 1, MMVD_BASE_MV_NUM is inferred to be 1. -#define JVET_N0266_SMALL_BLOCKS 1 // remove 4x4 uni-pred, 4x8/8x4 bi-pred from regular inter modes -#define JVET_N0054_JOINT_CHROMA 1 // Joint chroma residual coding mode -#define JVET_N0317_ADD_ZERO_BV 1 -#define JVET_N0318_N0467_IBC_SIZE 1 // IBC flag dependent on CU size and disabling 128x128 IBC mode -#define JVET_N0462_FIX_CTX_MODELING 1 // Fix context modeling of inter_pred_idc -#define JVET_N0175_N0251_N0384_IBC_SMALL_CTU 1 // IBC search range arrangement for small CTU sizes -#define JVET_N0127_MMVD_SPS_FLAG 1 -#define JVET_N0286_SIMPLIFIED_GBI_IDX 1 // Simplified coding of the GBi index -#define JVET_N600_AMVR_TPM_CTX_REDUCTION 1 -#define JVET_N0188_UNIFY_RICEPARA 1 -#define JVET_N0334_MVCLIPPING 1 // prevention of MV stroage overflow and alignment with spec of MV/CPMV modular for AMVP mode -#define JVET_N0481_BCW_CONSTRUCTED_AFFINE 1 -#define JVET_N0483_DISABLE_SBT_FOR_TPM 1 -#define JVET_N0180_ALF_LINE_BUFFER_REDUCTION 1 // Line buffer reduction for ALF using symmetric padding -#define JVET_N0242_NON_LINEAR_ALF 1 // enable CE5-3.2, Non-linear ALF based on clipping function -#define JVET_N0329_IBC_SEARCH_IMP 1 // IBC encoder-side improvement -#define JVET_N0325_BDOF 1 // unified right-shifts for BDOF derivation -#define JVET_N0247_HASH_IMPROVE 1 // Improve hash motion estimation -#define JVET_N0449_MMVD_SIMP 1 // Configurable number of mmvd distance entries used -#define JVET_N0363_INTRA_COST_MOD 1 // Modified cost criterion for intra encoder search -#define JVET_N0137_DUALTREE_CHROMA_SIZE 1 -#define JVET_N0335_N0085_MV_ROUNDING 1 // MV rounding unification -#define JVET_N0332_LTRP_MMVD_FIX 1 // MMVD scaling considering LTRPs from N0332 -#define JVET_N0477_LMCS_CLEANUP 1 -#define JVET_N0220_LMCS_SIMPLIFICATION 1 -#define JVET_N0185_UNIFIED_MPM 1 -#define JVET_N0271_SIMPLFIED_CCLM 1 // Simplified CCLM parameter derivation in JVET-N0271 -#define JVET_N0178_IMPLICIT_BDOF_SPLIT 1 -#define JVET_N0383_N0251_IBC_COL_VPDU_REMOVE 1 -#define JVET_N0407_DMVR_CU_SIZE_RESTRICTION 1 // Disable 4xN/8x8 CUs for DMVR -#define JVET_N0196_SIX_TAP_FILTERS 1 // 6-tap filters for affine motion compensation -#define JVET_N0213_TMVP_REMOVAL 1 // Remove TMVP candidates from merge and amvp mode with samples <= 32 -#define JVET_N0492_NO_HIERARCH_CBF 1 // Allow CBFs writing for leaf TU only -#define JVET_N0473_DEBLOCK_INTERNAL_TRANSFORM_BOUNDARIES 1 // JVET-N0473, JVET-N0098: Deblocking of ISP/SBT TU boundaries -#define JVET_N0150_ONE_CTU_DELAY_WPP 1 // one CTU delay WPP -#define JCTVC_Y0038_PARAMS 1 #define FIX_DB_MAX_TRANSFORM_SIZE 1 @@ -220,7 +132,6 @@ #define JVET_M0497_MATRIX_MULT 0 // 0: Fast method; 1: Matrix multiplication -#define JVET_M0128 1 // Implementation of RPL as in JVET-M0128 #define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on #define FIX_PCM 1 // Fix PCM bugs in VTM3 @@ -243,17 +154,10 @@ typedef std::pair TrCost; #endif // clang-format on -#ifndef JVET_B0051_NON_MPM_MODE -#define JVET_B0051_NON_MPM_MODE ( 1 && JEM_TOOLS ) -#endif -#ifndef QTBT_AS_IN_JEM -#define QTBT_AS_IN_JEM 1 -#endif #ifndef HEVC_TOOLS #define HEVC_TOOLS 0 #endif -#define JVET_N0246_MODIFIED_QUANTSCALES 1 #ifndef JVET_J0090_MEMORY_BANDWITH_MEASURE #define JVET_J0090_MEMORY_BANDWITH_MEASURE 0 @@ -305,35 +209,17 @@ typedef std::pair TrCost; #define WCG_WPSNR WCG_EXT #if HEVC_TOOLS -#define HEVC_USE_INTRA_SMOOTHING_T32 1 -#define HEVC_USE_INTRA_SMOOTHING_T64 1 -#define HEVC_USE_MDCS 1 -#define HEVC_USE_SIGN_HIDING 1 -#define HEVC_USE_SCALING_LISTS 1 #define HEVC_VPS 1 #else -#define HEVC_USE_SIGN_HIDING 1 #endif -#define JVET_M0101_HLS 1 // joint HLS syntax #define KEEP_PRED_AND_RESI_SIGNALS 0 -#if QTBT_AS_IN_JEM // macros which will cause changes in the decoder behavior ara marked with *** - keep them on to retain compatibility with JEM-toolcheck -#define HM_QTBT_AS_IN_JEM 1 // *** -#if HM_QTBT_AS_IN_JEM -#define HM_QTBT_AS_IN_JEM_QUANT 1 // *** -#define HM_QTBT_REPRODUCE_FAST_LCTU_BUG 1 -#endif -#define HM_CODED_CU_INFO 1 // like in JEM, when related CU is skipped, it stays like this even if a non skip mode wins... -#define HM_4TAPIF_AS_IN_JEM 1 // *** - PM: condition not well suited for 4-tap interpolation filters -#define HM_JEM_CLIP_PEL 1 // *** -#define HM_JEM_MERGE_CANDS 0 // *** -#endif//JEM_COMP // ==================================================================================================================== // Debugging @@ -471,13 +357,11 @@ typedef uint64_t Distortion; ///< distortion measurement // ==================================================================================================================== // Enumeration // ==================================================================================================================== -#if JVET_N0805_APS_LMCS enum ApsTypeValues { ALF_APS = 0, LMCS_APS = 1, }; -#endif enum QuantFlags { @@ -597,9 +481,7 @@ enum ComponentID COMPONENT_Cb = 1, COMPONENT_Cr = 2, MAX_NUM_COMPONENT = 3, -#if JVET_N0054_JOINT_CHROMA JOINT_CbCr = MAX_NUM_COMPONENT, -#endif MAX_NUM_TBLOCKS = MAX_NUM_COMPONENT }; @@ -768,10 +650,6 @@ enum MESearchMethod enum CoeffScanType { SCAN_DIAG = 0, ///< up-right diagonal scan -#if HEVC_USE_MDCS - SCAN_HOR = 1, ///< horizontal first scan - SCAN_VER = 2, ///< vertical first scan -#endif SCAN_NUMBER_OF_TYPES }; @@ -782,7 +660,6 @@ enum CoeffScanGroupType SCAN_NUMBER_OF_GROUP_TYPES = 2 }; -#if HEVC_USE_SCALING_LISTS enum ScalingListMode { SCALING_LIST_OFF, @@ -792,12 +669,8 @@ enum ScalingListMode enum ScalingListSize { -#if JVET_N0847_SCALING_LISTS SCALING_LIST_1x1 = 0, SCALING_LIST_2x2, -#else - SCALING_LIST_2x2 = 0, -#endif SCALING_LIST_4x4, SCALING_LIST_8x8, SCALING_LIST_16x16, @@ -805,16 +678,10 @@ enum ScalingListSize SCALING_LIST_64x64, SCALING_LIST_128x128, SCALING_LIST_SIZE_NUM, -#if JVET_N0847_SCALING_LISTS //for user define matrix SCALING_LIST_FIRST_CODED = SCALING_LIST_2x2, SCALING_LIST_LAST_CODED = SCALING_LIST_64x64 -#else - SCALING_LIST_FIRST_CODED = SCALING_LIST_4x4, // smallest scaling coded as High Level Parameter - SCALING_LIST_LAST_CODED = SCALING_LIST_32x32 -#endif }; -#endif // Slice / Slice segment encoding modes enum SliceConstraint @@ -823,12 +690,8 @@ enum SliceConstraint FIXED_NUMBER_OF_CTU = 1, ///< Limit maximum number of largest coding tree units in a slice / slice segments FIXED_NUMBER_OF_BYTES = 2, ///< Limit maximum number of bytes in a slice / slice segment FIXED_NUMBER_OF_TILES = 3, ///< slices / slice segments span an integer number of tiles -#if !JVET_N0857_TILES_BRICKS - NUMBER_OF_SLICE_CONSTRAINT_MODES = 4 -#else SINGLE_BRICK_PER_SLICE = 4, ///< each brick is coded as separate NAL unit (slice) NUMBER_OF_SLICE_CONSTRAINT_MODES = 5 -#endif }; // For use with decoded picture hash SEI messages, generated by encoder. @@ -975,7 +838,6 @@ enum PPSExtensionFlagIndex // effort can be done without use of macros to alter the names used to indicate the different NAL unit types. enum NalUnitType { - #if JVET_N0067_NAL_Unit_Header NAL_UNIT_PPS = 0, // 0 NAL_UNIT_ACCESS_UNIT_DELIMITER, // 1 NAL_UNIT_PREFIX_SEI, // 2 @@ -1009,137 +871,6 @@ enum NalUnitType NAL_UNIT_UNSPECIFIED_30, // 31 NAL_UNIT_UNSPECIFIED_31, // 32 NAL_UNIT_INVALID -#else -#if JVET_M0101_HLS - NAL_UNIT_CODED_SLICE_TRAIL = 0, // 0 - NAL_UNIT_CODED_SLICE_STSA, // 1 - - //KJS: keep RADL/RASL since there is no real decision on these types yet - NAL_UNIT_CODED_SLICE_RADL, // 2 should be NAL_UNIT_RESERVED_VCL_2, - NAL_UNIT_CODED_SLICE_RASL, // 3 should be NAL_UNIT_RESERVED_VCL_3, - - NAL_UNIT_RESERVED_VCL_4, - NAL_UNIT_RESERVED_VCL_5, - NAL_UNIT_RESERVED_VCL_6, - NAL_UNIT_RESERVED_VCL_7, - - NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 8 - NAL_UNIT_CODED_SLICE_IDR_N_LP, // 9 - NAL_UNIT_CODED_SLICE_CRA, // 10 - - NAL_UNIT_RESERVED_IRAP_VCL11, - NAL_UNIT_RESERVED_IRAP_VCL12, - NAL_UNIT_RESERVED_IRAP_VCL13, - - NAL_UNIT_RESERVED_VCL14, - -#if HEVC_VPS - NAL_UNIT_VPS, // probably not coming back -#else - NAL_UNIT_RESERVED_VCL15, -#endif - - NAL_UNIT_RESERVED_NVCL16, // probably DPS - - NAL_UNIT_SPS, // 17 - NAL_UNIT_PPS, // 18 - NAL_UNIT_APS, // 19 NAL unit type number needs to be reaaranged. - NAL_UNIT_ACCESS_UNIT_DELIMITER, // 20 - NAL_UNIT_EOS, // 21 - NAL_UNIT_EOB, // 22 - NAL_UNIT_PREFIX_SEI, // 23 - NAL_UNIT_SUFFIX_SEI, // 24 - NAL_UNIT_FILLER_DATA, // 25 keep: may be added with HRD - - NAL_UNIT_RESERVED_NVCL26, - NAL_UNIT_RESERVED_NVCL27, - NAL_UNIT_UNSPECIFIED_28, - NAL_UNIT_UNSPECIFIED_29, - NAL_UNIT_UNSPECIFIED_30, - NAL_UNIT_UNSPECIFIED_31, - NAL_UNIT_INVALID, -#else - NAL_UNIT_CODED_SLICE_TRAIL_N = 0, // 0 - NAL_UNIT_CODED_SLICE_TRAIL_R, // 1 - - NAL_UNIT_CODED_SLICE_TSA_N, // 2 - NAL_UNIT_CODED_SLICE_TSA_R, // 3 - - NAL_UNIT_CODED_SLICE_STSA_N, // 4 - NAL_UNIT_CODED_SLICE_STSA_R, // 5 - - NAL_UNIT_CODED_SLICE_RADL_N, // 6 - NAL_UNIT_CODED_SLICE_RADL_R, // 7 - - NAL_UNIT_CODED_SLICE_RASL_N, // 8 - NAL_UNIT_CODED_SLICE_RASL_R, // 9 - - NAL_UNIT_RESERVED_VCL_N10, - NAL_UNIT_RESERVED_VCL_R11, - NAL_UNIT_RESERVED_VCL_N12, - NAL_UNIT_RESERVED_VCL_R13, - NAL_UNIT_RESERVED_VCL_N14, - NAL_UNIT_RESERVED_VCL_R15, - - NAL_UNIT_CODED_SLICE_BLA_W_LP, // 16 - NAL_UNIT_CODED_SLICE_BLA_W_RADL, // 17 - NAL_UNIT_CODED_SLICE_BLA_N_LP, // 18 - NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 19 - NAL_UNIT_CODED_SLICE_IDR_N_LP, // 20 - NAL_UNIT_CODED_SLICE_CRA, // 21 - NAL_UNIT_RESERVED_IRAP_VCL22, - NAL_UNIT_RESERVED_IRAP_VCL23, - - NAL_UNIT_RESERVED_VCL24, - NAL_UNIT_RESERVED_VCL25, - NAL_UNIT_RESERVED_VCL26, - NAL_UNIT_RESERVED_VCL27, - NAL_UNIT_RESERVED_VCL28, - NAL_UNIT_RESERVED_VCL29, - NAL_UNIT_RESERVED_VCL30, - NAL_UNIT_RESERVED_VCL31, - -#if HEVC_VPS || JVET_N0278_HLS - NAL_UNIT_VPS, // 32 -#else - NAL_UNIT_RESERVED_32, -#endif - NAL_UNIT_SPS, // 33 - NAL_UNIT_PPS, // 34 - NAL_UNIT_APS, //NAL unit type number needs to be reaaranged. - NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35 - NAL_UNIT_EOS, // 36 - NAL_UNIT_EOB, // 37 - NAL_UNIT_FILLER_DATA, // 38 - NAL_UNIT_PREFIX_SEI, // 39 - NAL_UNIT_SUFFIX_SEI, // 40 - - NAL_UNIT_RESERVED_NVCL41, - NAL_UNIT_RESERVED_NVCL42, - NAL_UNIT_RESERVED_NVCL43, - NAL_UNIT_RESERVED_NVCL44, - NAL_UNIT_RESERVED_NVCL45, - NAL_UNIT_RESERVED_NVCL46, - NAL_UNIT_RESERVED_NVCL47, - NAL_UNIT_UNSPECIFIED_48, - NAL_UNIT_UNSPECIFIED_49, - NAL_UNIT_UNSPECIFIED_50, - NAL_UNIT_UNSPECIFIED_51, - NAL_UNIT_UNSPECIFIED_52, - NAL_UNIT_UNSPECIFIED_53, - NAL_UNIT_UNSPECIFIED_54, - NAL_UNIT_UNSPECIFIED_55, - NAL_UNIT_UNSPECIFIED_56, - NAL_UNIT_UNSPECIFIED_57, - NAL_UNIT_UNSPECIFIED_58, - NAL_UNIT_UNSPECIFIED_59, - NAL_UNIT_UNSPECIFIED_60, - NAL_UNIT_UNSPECIFIED_61, - NAL_UNIT_UNSPECIFIED_62, - NAL_UNIT_UNSPECIFIED_63, - NAL_UNIT_INVALID, -#endif -#endif }; #if SHARP_LUMA_DELTA_QP @@ -1659,9 +1390,7 @@ struct XUCache #define MAX_NUM_ALF_CHROMA_COEFF 7 #define MAX_ALF_FILTER_LENGTH 7 #define MAX_NUM_ALF_COEFF (MAX_ALF_FILTER_LENGTH * MAX_ALF_FILTER_LENGTH / 2 + 1) -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND #define MAX_ALF_PADDING_SIZE 4 -#endif enum AlfFilterType { @@ -1748,30 +1477,22 @@ struct AlfFilterShape struct AlfSliceParam { bool enabledFlag[MAX_NUM_COMPONENT]; // alf_slice_enable_flag, alf_chroma_idc -#if JVET_N0242_NON_LINEAR_ALF bool nonLinearFlag[MAX_NUM_CHANNEL_TYPE]; // alf_nonlinear_enable_flag[Luma/Chroma] -#endif short lumaCoeff[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; // alf_coeff_luma_delta[i][j] -#if JVET_N0242_NON_LINEAR_ALF short lumaClipp[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; // alf_clipp_luma_[i][j] -#endif short chromaCoeff[MAX_NUM_ALF_CHROMA_COEFF]; // alf_coeff_chroma[i] -#if JVET_N0242_NON_LINEAR_ALF short chromaClipp[MAX_NUM_ALF_CHROMA_COEFF]; // alf_clipp_chroma[i] -#endif short filterCoeffDeltaIdx[MAX_NUM_ALF_CLASSES]; // filter_coeff_delta[i] bool alfLumaCoeffFlag[MAX_NUM_ALF_CLASSES]; // alf_luma_coeff_flag[i] int numLumaFilters; // number_of_filters_minus1 + 1 bool alfLumaCoeffDeltaFlag; // alf_luma_coeff_delta_flag bool alfLumaCoeffDeltaPredictionFlag; // alf_luma_coeff_delta_prediction_flag std::vector* filterShapes; -#if JVET_N0415_CTB_ALF int tLayer; bool newFilterFlag[MAX_NUM_CHANNEL_TYPE]; int fixedFilterPattern; int fixedFilterIdx[MAX_NUM_ALF_CLASSES]; int fixedFilterSetIndex; -#endif AlfSliceParam() { @@ -1781,58 +1502,42 @@ struct AlfSliceParam void reset() { std::memset( enabledFlag, false, sizeof( enabledFlag ) ); -#if JVET_N0242_NON_LINEAR_ALF std::memset( nonLinearFlag, false, sizeof( nonLinearFlag ) ); -#endif std::memset( lumaCoeff, 0, sizeof( lumaCoeff ) ); -#if JVET_N0242_NON_LINEAR_ALF std::memset( lumaClipp, 0, sizeof( lumaClipp ) ); -#endif std::memset( chromaCoeff, 0, sizeof( chromaCoeff ) ); -#if JVET_N0242_NON_LINEAR_ALF std::memset( chromaClipp, 0, sizeof( chromaClipp ) ); -#endif std::memset( filterCoeffDeltaIdx, 0, sizeof( filterCoeffDeltaIdx ) ); std::memset( alfLumaCoeffFlag, true, sizeof( alfLumaCoeffFlag ) ); numLumaFilters = 1; alfLumaCoeffDeltaFlag = false; alfLumaCoeffDeltaPredictionFlag = false; -#if JVET_N0415_CTB_ALF tLayer = 0; memset(newFilterFlag, 0, sizeof(newFilterFlag)); fixedFilterPattern = 0; std::memset(fixedFilterIdx, 0, sizeof(fixedFilterIdx)); fixedFilterSetIndex = 0;; -#endif } const AlfSliceParam& operator = ( const AlfSliceParam& src ) { std::memcpy( enabledFlag, src.enabledFlag, sizeof( enabledFlag ) ); -#if JVET_N0242_NON_LINEAR_ALF std::memcpy( nonLinearFlag, src.nonLinearFlag, sizeof( nonLinearFlag ) ); -#endif std::memcpy( lumaCoeff, src.lumaCoeff, sizeof( lumaCoeff ) ); -#if JVET_N0242_NON_LINEAR_ALF std::memcpy( lumaClipp, src.lumaClipp, sizeof( lumaClipp ) ); -#endif std::memcpy( chromaCoeff, src.chromaCoeff, sizeof( chromaCoeff ) ); -#if JVET_N0242_NON_LINEAR_ALF std::memcpy( chromaClipp, src.chromaClipp, sizeof( chromaClipp ) ); -#endif std::memcpy( filterCoeffDeltaIdx, src.filterCoeffDeltaIdx, sizeof( filterCoeffDeltaIdx ) ); std::memcpy( alfLumaCoeffFlag, src.alfLumaCoeffFlag, sizeof( alfLumaCoeffFlag ) ); numLumaFilters = src.numLumaFilters; alfLumaCoeffDeltaFlag = src.alfLumaCoeffDeltaFlag; alfLumaCoeffDeltaPredictionFlag = src.alfLumaCoeffDeltaPredictionFlag; filterShapes = src.filterShapes; -#if JVET_N0415_CTB_ALF tLayer = src.tLayer; std::memcpy(newFilterFlag, src.newFilterFlag, sizeof(newFilterFlag)); fixedFilterPattern = src.fixedFilterPattern; std::memcpy(fixedFilterIdx, src.fixedFilterIdx, sizeof(fixedFilterIdx)); fixedFilterSetIndex = src.fixedFilterSetIndex; -#endif return *this; } }; diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index e34fe4249b70f5d91ee6382e6249b88cff06dcd7..b6f6ce9443fb7c000ef76925be6b19bbb1b99391 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -267,18 +267,14 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) affineType = other.affineType; triangle = other.triangle; transQuantBypass = other.transQuantBypass; -#if JVET_N0413_RDPCM bdpcmMode = other.bdpcmMode; -#endif ipcm = other.ipcm; qp = other.qp; chromaQpAdj = other.chromaQpAdj; rootCbf = other.rootCbf; sbtInfo = other.sbtInfo; -#if JVET_N0193_LFNST mtsFlag = other.mtsFlag; lfnstIdx = other.lfnstIdx; -#endif tileIdx = other.tileIdx; imv = other.imv; imvNumCand = other.imvNumCand; @@ -290,9 +286,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) shareParentSize = other.shareParentSize; smvdMode = other.smvdMode; ispMode = other.ispMode; -#if JVET_N0217_MATRIX_INTRAPRED mipFlag = other.mipFlag; -#endif return *this; } @@ -311,18 +305,14 @@ void CodingUnit::initData() affineType = 0; triangle = false; transQuantBypass = false; -#if JVET_N0413_RDPCM bdpcmMode = 0; -#endif ipcm = false; qp = 0; chromaQpAdj = 0; rootCbf = true; sbtInfo = 0; -#if JVET_N0193_LFNST mtsFlag = 0; lfnstIdx = 0; -#endif tileIdx = 0; imv = 0; imvNumCand = 0; @@ -334,9 +324,7 @@ void CodingUnit::initData() shareParentSize.height = -1; smvdMode = 0; ispMode = 0; -#if JVET_N0217_MATRIX_INTRAPRED mipFlag = false; -#endif } const uint8_t CodingUnit::checkAllowedSbt() const @@ -355,12 +343,10 @@ const uint8_t CodingUnit::checkAllowedSbt() const { return 0; } -#if JVET_N0483_DISABLE_SBT_FOR_TPM if( triangle ) { return 0; } -#endif uint8_t sbtAllowed = 0; int cuWidth = lwidth(); @@ -424,9 +410,7 @@ void PredictionUnit::initData() // inter data mergeFlag = false; -#if JVET_N0324_REGULAR_MRG_FLAG regularMergeFlag = false; -#endif mergeIdx = MAX_UCHAR; triangleSplitDir = MAX_UCHAR; triangleMergeIdx0 = MAX_UCHAR; @@ -479,9 +463,7 @@ PredictionUnit& PredictionUnit::operator=(const IntraPredictionData& predData) PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) { mergeFlag = predData.mergeFlag; -#if JVET_N0324_REGULAR_MRG_FLAG regularMergeFlag = predData.regularMergeFlag; -#endif mergeIdx = predData.mergeIdx; triangleSplitDir = predData.triangleSplitDir ; triangleMergeIdx0 = predData.triangleMergeIdx0 ; @@ -528,9 +510,7 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) multiRefIdx = other.multiRefIdx; mergeFlag = other.mergeFlag; -#if JVET_N0324_REGULAR_MRG_FLAG regularMergeFlag = other.regularMergeFlag; -#endif mergeIdx = other.mergeIdx; triangleSplitDir = other.triangleSplitDir ; triangleMergeIdx0 = other.triangleMergeIdx0 ; @@ -640,9 +620,7 @@ void TransformUnit::initData() depth = 0; mtsIdx = MTS_DCT2_DCT2; noResidual = false; -#if JVET_N0054_JOINT_CHROMA jointCbCr = 0; -#endif m_chromaResScaleInv = 0; } @@ -678,9 +656,7 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other) depth = other.depth; mtsIdx = other.mtsIdx; noResidual = other.noResidual; -#if JVET_N0054_JOINT_CHROMA jointCbCr = other.jointCbCr; -#endif return *this; } @@ -702,9 +678,7 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen depth = other.depth; mtsIdx = isLuma( i ) ? other.mtsIdx : mtsIdx; noResidual = other.noResidual; -#if JVET_N0054_JOINT_CHROMA jointCbCr = isChroma( i ) ? other.jointCbCr : jointCbCr; -#endif } CoeffBuf TransformUnit::getCoeffs(const ComponentID id) { return CoeffBuf(m_coeffs[id], blocks[id]); } diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 0a2a6fc35bf55a42766e71b3c8a0ab553506c1ab..5c2f9eb56775973b179559910cc1a3ac9e569175 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -267,12 +267,8 @@ struct UnitAreaRelative : public UnitArea }; class SPS; -#if HEVC_VPS || JVET_N0278_HLS class VPS; -#endif -#if JVET_N0349_DPS class DPS; -#endif class PPS; class Slice; @@ -308,23 +304,17 @@ struct CodingUnit : public UnitArea int affineType; bool triangle; bool transQuantBypass; -#if JVET_N0413_RDPCM int bdpcmMode; -#endif bool ipcm; uint8_t imv; bool rootCbf; uint8_t sbtInfo; uint32_t tileIdx; -#if JVET_N0193_LFNST uint8_t mtsFlag; uint32_t lfnstIdx; -#endif uint8_t GBiIdx; int refIdxBi[2]; -#if JVET_N0217_MATRIX_INTRAPRED bool mipFlag; -#endif // needed for fast imv mode decisions int8_t imvNumCand; @@ -375,9 +365,7 @@ struct IntraPredictionData struct InterPredictionData { bool mergeFlag; -#if JVET_N0324_REGULAR_MRG_FLAG bool regularMergeFlag; -#endif uint8_t mergeIdx; uint8_t triangleSplitDir; uint8_t triangleMergeIdx0; @@ -455,9 +443,7 @@ struct TransformUnit : public UnitArea uint8_t depth; uint8_t mtsIdx; bool noResidual; -#if JVET_N0054_JOINT_CHROMA uint8_t jointCbCr; -#endif uint8_t cbf [ MAX_NUM_TBLOCKS ]; RDPCMMode rdpcm [ MAX_NUM_TBLOCKS ]; int8_t compAlpha [ MAX_NUM_TBLOCKS ]; diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index 416157d1aab55da5313bb043da9ca65a74fc8b41..3309c07d9b8ee8e166174432d89262ff08488271 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -144,23 +144,12 @@ void AdaptiveDepthPartitioner::setMaxMinDepth( unsigned& minDepth, unsigned& max unsigned stdMaxDepth = ( g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize( cs.slice->getSliceType(), chType )]); const Position pos = currArea().blocks[chType].pos(); const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx(); -#if JVET_N0857_TILES_BRICKS const unsigned curTileIdx = cs.picture->brickMap->getBrickIdxRsMap( currArea().lumaPos() ); -#else - const unsigned curTileIdx = cs.picture->tileMap->getTileIdxMap( currArea().lumaPos() ); -#endif -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit* cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), pos, curSliceIdx, curTileIdx, chType ); const CodingUnit* cuBelowLeft = cs.getCURestricted( pos.offset( -1, currArea().blocks[chType].height), pos, curSliceIdx, curTileIdx, chType ); const CodingUnit* cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), pos, curSliceIdx, curTileIdx, chType ); const CodingUnit* cuAboveRight = cs.getCURestricted( pos.offset( currArea().blocks[chType].width, -1 ), pos, curSliceIdx, curTileIdx, chType ); -#else - const CodingUnit* cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), curSliceIdx, curTileIdx, chType ); - const CodingUnit* cuBelowLeft = cs.getCURestricted( pos.offset( -1, currArea().blocks[chType].height), curSliceIdx, curTileIdx, chType ); - const CodingUnit* cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), curSliceIdx, curTileIdx, chType ); - const CodingUnit* cuAboveRight = cs.getCURestricted( pos.offset( currArea().blocks[chType].width, -1 ), curSliceIdx, curTileIdx, chType ); -#endif minDepth = stdMaxDepth; maxDepth = stdMinDepth; @@ -355,9 +344,7 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca // the minimal and maximal sizes are given in luma samples const CompArea& area = currArea().Y(); -#if JVET_N0137_DUALTREE_CHROMA_SIZE const CompArea& areaC = currArea().Cb(); -#endif PartLevel& level = m_partStack.back(); const PartSplit lastSplit = level.split; @@ -366,9 +353,7 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca // don't allow QT-splitting below a BT split if( lastSplit != CTU_LEVEL && lastSplit != CU_QUAD_SPLIT ) canQt = false; if( area.width <= minQtSize ) canQt = false; -#if JVET_N0137_DUALTREE_CHROMA_SIZE if( chType == CHANNEL_TYPE_CHROMA && areaC.width <= MIN_DUALTREE_CHROMA_WIDTH ) canQt = false; -#endif if( implicitSplit != CU_DONT_SPLIT ) { canNo = canTh = canTv = false; @@ -411,26 +396,18 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca // specific check for BT splits if( area.height <= minBtSize ) canBh = false; if( area.width > MAX_TB_SIZEY && area.height <= MAX_TB_SIZEY ) canBh = false; -#if JVET_N0137_DUALTREE_CHROMA_SIZE if( chType == CHANNEL_TYPE_CHROMA && areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE ) canBh = false; -#endif if( area.width <= minBtSize ) canBv = false; if( area.width <= MAX_TB_SIZEY && area.height > MAX_TB_SIZEY ) canBv = false; -#if JVET_N0137_DUALTREE_CHROMA_SIZE if( chType == CHANNEL_TYPE_CHROMA && areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE ) canBv = false; -#endif if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize ) canTh = false; if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTh = false; -#if JVET_N0137_DUALTREE_CHROMA_SIZE if( chType == CHANNEL_TYPE_CHROMA && areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE*2 ) canTh = false; -#endif if( area.width <= 2 * minTtSize || area.width > maxTtSize || area.height > maxTtSize ) canTv = false; if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTv = false; -#if JVET_N0137_DUALTREE_CHROMA_SIZE if( chType == CHANNEL_TYPE_CHROMA && areaC.width * areaC.height <= MIN_DUALTREE_CHROMA_SIZE*2 ) canTv = false; -#endif } bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs ) diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index d1453efe864587998d33dea8481b4f271af79ec1..996a5d1623c8e04eaace6ee83c21378e79fe6a75 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -87,10 +87,8 @@ void CS::setRefinedMotionField(CodingStructure &cs) subPu.mv[1] = pu.mv[1]; subPu.mv[REF_PIC_LIST_0] += pu.mvdL0SubPu[num]; subPu.mv[REF_PIC_LIST_1] -= pu.mvdL0SubPu[num]; -#if JVET_N0334_MVCLIPPING subPu.mv[REF_PIC_LIST_0].clipToStorageBitDepth(); subPu.mv[REF_PIC_LIST_1].clipToStorageBitDepth(); -#endif pu.mvdL0SubPu[num].setZero(); num++; PU::spanMotionInfo(subPu); @@ -252,26 +250,17 @@ bool CU::hasNonTsCodedBlock( const CodingUnit& cu ) return hasAnyNonTSCoded; } -#if JVET_N0193_LFNST uint32_t CU::getNumNonZeroCoeffNonTs( const CodingUnit& cu, const bool lumaFlag, const bool chromaFlag ) -#else -uint32_t CU::getNumNonZeroCoeffNonTs( const CodingUnit& cu ) -#endif { uint32_t count = 0; for( auto &currTU : traverseTUs( cu ) ) { -#if JVET_N0193_LFNST count += TU::getNumNonZeroCoeffsNonTS( currTU, lumaFlag, chromaFlag ); -#else - count += TU::getNumNonZeroCoeffsNonTS( currTU ); -#endif } return count; } -#if JVET_N0193_LFNST uint32_t CU::getNumNonZeroCoeffNonTsCorner8x8( const CodingUnit& cu, const bool lumaFlag, const bool chromaFlag ) { uint32_t count = 0; @@ -282,7 +271,6 @@ uint32_t CU::getNumNonZeroCoeffNonTsCorner8x8( const CodingUnit& cu, const bool return count; } -#endif bool CU::divideTuInRows( const CodingUnit &cu ) { @@ -411,14 +399,9 @@ ISPType CU::canUseISPSplit( const int width, const int height, const int maxTrSi const uint32_t minTuSizeForISP = MIN_TB_SIZEY; bool notEnoughSamplesToSplit = ( g_aucLog2[width] + g_aucLog2[height] <= ( g_aucLog2[minTuSizeForISP] << 1 ) ); -#if JVET_N0308_MAX_CU_SIZE_FOR_ISP bool cuSizeLargerThanMaxTrSize = width > maxTrSize || height > maxTrSize; widthCannotBeUsed = cuSizeLargerThanMaxTrSize || notEnoughSamplesToSplit; heightCannotBeUsed = cuSizeLargerThanMaxTrSize || notEnoughSamplesToSplit; -#else - widthCannotBeUsed = width > maxTrSize || notEnoughSamplesToSplit; - heightCannotBeUsed = height > maxTrSize || notEnoughSamplesToSplit; -#endif if( !widthCannotBeUsed && !heightCannotBeUsed ) { @@ -488,15 +471,8 @@ cTUTraverser CU::traverseTUs( const CodingUnit& cu ) int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType &channelType /*= CHANNEL_TYPE_LUMA*/ ) { const int numMPMs = NUM_MOST_PROBABLE_MODES; -#if !JVET_N0185_UNIFIED_MPM - const int extendRefLine = (channelType == CHANNEL_TYPE_LUMA) ? pu.multiRefIdx : 0; - const ISPType ispType = isLuma( channelType ) ? ISPType( pu.cu->ispMode ) : NOT_INTRA_SUBPARTITIONS; - const bool isHorSplit = ispType == HOR_INTRA_SUBPARTITIONS; -#endif { -#if JVET_N0217_MATRIX_INTRAPRED CHECK(channelType != CHANNEL_TYPE_LUMA, "Not harmonized yet"); -#endif int numCand = -1; int leftIntraDir = PLANAR_IDX, aboveIntraDir = PLANAR_IDX; @@ -508,22 +484,14 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType const PredictionUnit *puLeft = pu.cs->getPURestricted(posLB.offset(-1, 0), pu, channelType); if (puLeft && CU::isIntra(*puLeft->cu)) { -#if JVET_N0217_MATRIX_INTRAPRED leftIntraDir = PU::getIntraDirLuma( *puLeft ); -#else - leftIntraDir = puLeft->intraDir[channelType]; -#endif } // Get intra direction of above PU const PredictionUnit *puAbove = pu.cs->getPURestricted(posRT.offset(0, -1), pu, channelType); if (puAbove && CU::isIntra(*puAbove->cu) && CU::isSameCtu(*pu.cu, *puAbove->cu)) { -#if JVET_N0217_MATRIX_INTRAPRED aboveIntraDir = PU::getIntraDirLuma( *puAbove ); -#else - aboveIntraDir = puAbove->intraDir[channelType]; -#endif } CHECK(2 >= numMPMs, "Invalid number of most probable modes"); @@ -531,192 +499,9 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType const int offset = (int)NUM_LUMA_MODE - 6; const int mod = offset + 3; -#if !JVET_N0185_UNIFIED_MPM - if (extendRefLine) - { - int modeIdx = 0; - int angularMode[2] = { 0, 0 }; - - if (leftIntraDir > DC_IDX) - { - angularMode[modeIdx++] = leftIntraDir; - } - if (aboveIntraDir > DC_IDX && aboveIntraDir != leftIntraDir) - { - angularMode[modeIdx++] = aboveIntraDir; - } - if (modeIdx == 0) - { - mpm[0] = VER_IDX; - mpm[1] = HOR_IDX; - mpm[2] = 2; - mpm[3] = DIA_IDX; - mpm[4] = VDIA_IDX; - mpm[5] = 26; - } - else if (modeIdx == 1) - { - mpm[0] = angularMode[0]; - mpm[1] = ((angularMode[0] + offset) % mod) + 2; - mpm[2] = ((angularMode[0] - 1) % mod) + 2; - mpm[3] = ((angularMode[0] + offset - 1) % mod) + 2; - mpm[4] = (angularMode[0] % mod) + 2; - mpm[5] = ((angularMode[0] + offset - 2) % mod) + 2; - } - else - { - mpm[0] = angularMode[0]; - mpm[1] = angularMode[1]; - int maxCandModeIdx = mpm[0] > mpm[1] ? 0 : 1; - int minCandModeIdx = 1 - maxCandModeIdx; - if (mpm[maxCandModeIdx] - mpm[minCandModeIdx] == 1) - { - mpm[2] = ((angularMode[minCandModeIdx] + offset) % mod) + 2; - mpm[3] = ((angularMode[maxCandModeIdx] - 1) % mod) + 2; - mpm[4] = ((angularMode[minCandModeIdx] + offset - 1) % mod) + 2; - mpm[5] = ( angularMode[maxCandModeIdx] % mod) + 2; - } - else if (mpm[maxCandModeIdx] - mpm[minCandModeIdx] >= 62) - { - mpm[2] = ((angularMode[minCandModeIdx] - 1) % mod) + 2; - mpm[3] = ((angularMode[maxCandModeIdx] + offset) % mod) + 2; - mpm[4] = ((angularMode[minCandModeIdx]) % mod) + 2; - mpm[5] = ((angularMode[maxCandModeIdx] + offset - 1) % mod) + 2; - } - else if (mpm[maxCandModeIdx] - mpm[minCandModeIdx] == 2) - { - mpm[2] = ((angularMode[minCandModeIdx] - 1) % mod) + 2; - mpm[3] = ((angularMode[minCandModeIdx] + offset) % mod) + 2; - mpm[4] = ((angularMode[maxCandModeIdx] - 1) % mod) + 2; - mpm[5] = ((angularMode[minCandModeIdx] + offset - 1) % mod) + 2; - } - else - { - mpm[2] = ((angularMode[minCandModeIdx] + offset) % mod) + 2; - mpm[3] = ((angularMode[minCandModeIdx] - 1) % mod) + 2; - mpm[4] = ((angularMode[maxCandModeIdx] + offset) % mod) + 2; - mpm[5] = ((angularMode[maxCandModeIdx] - 1) % mod) + 2; - } - } - } - else if( ispType != NOT_INTRA_SUBPARTITIONS ) - { - //default case - mpm[0] = PLANAR_IDX; - if( isHorSplit ) - { - mpm[1] = HOR_IDX; - mpm[2] = 25; - mpm[3] = 10; - mpm[4] = 65; - mpm[5] = VER_IDX; - } - else - { - mpm[1] = VER_IDX; - mpm[2] = 43; - mpm[3] = 60; - mpm[4] = 3; - mpm[5] = HOR_IDX; - } - int canonicalMode = mpm[1]; - if( leftIntraDir == aboveIntraDir ) //L=A - { - numCand = 1; - if( leftIntraDir > DC_IDX ) - { - mpm[0] = leftIntraDir; - mpm[1] = ( ( leftIntraDir + offset ) % mod ) + 2; - mpm[2] = ( ( leftIntraDir - 1 ) % mod ) + 2; - if( ( isHorSplit && leftIntraDir < DIA_IDX ) || ( !isHorSplit && leftIntraDir >= DIA_IDX ) ) - { - mpm[3] = ( ( leftIntraDir + offset - 1 ) % mod ) + 2; - mpm[4] = ( leftIntraDir % mod ) + 2; - mpm[5] = ( ( leftIntraDir + offset - 2 ) % mod ) + 2;; - } - else - { - if( isHorSplit ) - { - mpm[3] = HOR_IDX; - mpm[4] = 5; - } - else - { - mpm[3] = VER_IDX; - mpm[4] = VDIA_IDX - 3; - } - mpm[5] = PLANAR_IDX; - } - } - } - else //L!=A - { - numCand = 2; - if( ( leftIntraDir > DC_IDX ) && ( aboveIntraDir > DC_IDX ) ) - { - int distLeftToCanonicalMode = abs( leftIntraDir - canonicalMode ); - int distAboveToCanonicalMode = abs( aboveIntraDir - canonicalMode ); - mpm[0] = aboveIntraDir; - mpm[1] = leftIntraDir; - if( distLeftToCanonicalMode <= distAboveToCanonicalMode ) - { - mpm[0] = leftIntraDir; - mpm[1] = aboveIntraDir; - } - int maxCandModeIdx = mpm[0] > mpm[1] ? 0 : 1; - int minCandModeIdx = 1 - maxCandModeIdx; - if( mpm[maxCandModeIdx] - mpm[minCandModeIdx] == 1 ) - { - mpm[2] = ( ( mpm[minCandModeIdx] + offset ) % mod ) + 2; - mpm[3] = ( ( mpm[maxCandModeIdx] - 1 ) % mod ) + 2; - mpm[4] = ( ( mpm[minCandModeIdx] + offset - 1 ) % mod ) + 2; - mpm[5] = ( mpm[maxCandModeIdx] % mod ) + 2; - } - else if( mpm[maxCandModeIdx] - mpm[minCandModeIdx] >= 62 ) - { - mpm[2] = ( ( mpm[minCandModeIdx] - 1 ) % mod ) + 2; - mpm[3] = ( ( mpm[maxCandModeIdx] + offset ) % mod ) + 2; - mpm[4] = ( ( mpm[minCandModeIdx] ) % mod ) + 2; - mpm[5] = ( ( mpm[maxCandModeIdx] + offset - 1 ) % mod ) + 2; - } - else if( mpm[maxCandModeIdx] - mpm[minCandModeIdx] == 2 ) - { - mpm[2] = ( ( mpm[minCandModeIdx] - 1 ) % mod ) + 2; - mpm[3] = ( ( mpm[minCandModeIdx] + offset ) % mod ) + 2; - mpm[4] = ( ( mpm[maxCandModeIdx] - 1 ) % mod ) + 2; - mpm[5] = ( ( mpm[minCandModeIdx] + offset - 1 ) % mod ) + 2; - } - else - { - mpm[2] = ( ( mpm[minCandModeIdx] + offset ) % mod ) + 2; - mpm[3] = ( ( mpm[minCandModeIdx] - 1 ) % mod ) + 2; - mpm[4] = ( ( mpm[maxCandModeIdx] + offset ) % mod ) + 2; - mpm[5] = ( ( mpm[maxCandModeIdx] - 1 ) % mod ) + 2; - } - } - else if( leftIntraDir + aboveIntraDir > 2 ) - { - //mpm[0] = PLANAR_IDX; - int angMode = leftIntraDir > DC_IDX ? leftIntraDir : aboveIntraDir; - mpm[1] = angMode; - mpm[2] = ( ( angMode + offset ) % mod ) + 2; - mpm[3] = ( ( angMode - 1 ) % mod ) + 2; - mpm[4] = ( ( angMode + offset - 1 ) % mod ) + 2; - mpm[5] = ( ( angMode ) % mod ) + 2; - } - } - } - else -#endif { -#if JVET_N0185_UNIFIED_MPM mpm[0] = PLANAR_IDX; mpm[1] = DC_IDX; -#else - mpm[0] = leftIntraDir; - mpm[1] = (mpm[0] == PLANAR_IDX) ? DC_IDX : PLANAR_IDX; -#endif mpm[2] = VER_IDX; mpm[3] = HOR_IDX; mpm[4] = VER_IDX - 4; @@ -727,53 +512,28 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType numCand = 1; if (leftIntraDir > DC_IDX) { -#if JVET_N0185_UNIFIED_MPM mpm[0] = PLANAR_IDX; mpm[1] = leftIntraDir; mpm[2] = ((leftIntraDir + offset) % mod) + 2; mpm[3] = ((leftIntraDir - 1) % mod) + 2; mpm[4] = DC_IDX; mpm[5] = ((leftIntraDir + offset - 1) % mod) + 2; -#else - mpm[0] = leftIntraDir; - mpm[1] = PLANAR_IDX; - mpm[2] = DC_IDX; - mpm[3] = ((leftIntraDir + offset) % mod) + 2; - mpm[4] = ((leftIntraDir - 1) % mod) + 2; - mpm[5] = ((leftIntraDir + offset - 1) % mod) + 2; -#endif } } else //L!=A { numCand = 2; -#if !JVET_N0185_UNIFIED_MPM - mpm[0] = leftIntraDir; - mpm[1] = aboveIntraDir; -#endif -#if JVET_N0185_UNIFIED_MPM int maxCandModeIdx = mpm[0] > mpm[1] ? 0 : 1; -#else - bool maxCandModeIdx = mpm[0] > mpm[1] ? 0 : 1; -#endif if ((leftIntraDir > DC_IDX) && (aboveIntraDir > DC_IDX)) { -#if JVET_N0185_UNIFIED_MPM mpm[0] = PLANAR_IDX; mpm[1] = leftIntraDir; mpm[2] = aboveIntraDir; maxCandModeIdx = mpm[1] > mpm[2] ? 1 : 2; int minCandModeIdx = mpm[1] > mpm[2] ? 2 : 1; -#else - mpm[2] = PLANAR_IDX; -#endif mpm[3] = DC_IDX; -#if JVET_N0185_UNIFIED_MPM if ((mpm[maxCandModeIdx] - mpm[minCandModeIdx] < 63) && (mpm[maxCandModeIdx] - mpm[minCandModeIdx] > 1)) -#else - if ((mpm[maxCandModeIdx] - mpm[!maxCandModeIdx] < 63) && (mpm[maxCandModeIdx] - mpm[!maxCandModeIdx] > 1)) -#endif { mpm[4] = ((mpm[maxCandModeIdx] + offset) % mod) + 2; mpm[5] = ((mpm[maxCandModeIdx] - 1) % mod) + 2; @@ -786,14 +546,10 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType } else if (leftIntraDir + aboveIntraDir >= 2) { -#if JVET_N0185_UNIFIED_MPM mpm[0] = PLANAR_IDX; mpm[1] = (leftIntraDir < aboveIntraDir) ? aboveIntraDir : leftIntraDir; maxCandModeIdx = 1; mpm[2] = DC_IDX; -#else - mpm[2] = (mpm[!maxCandModeIdx] == PLANAR_IDX) ? DC_IDX : PLANAR_IDX; -#endif mpm[3] = ((mpm[maxCandModeIdx] + offset) % mod) + 2; mpm[4] = ((mpm[maxCandModeIdx] - 1) % mod) + 2; mpm[5] = ((mpm[maxCandModeIdx] + offset - 1) % mod) + 2; @@ -809,7 +565,6 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType } } -#if JVET_N0217_MATRIX_INTRAPRED bool PU::isMIP(const PredictionUnit &pu, const ChannelType &chType) { return (chType == CHANNEL_TYPE_LUMA && pu.cu->mipFlag); @@ -997,7 +752,6 @@ AvailableInfo PU::getAvailableInfoLuma(const PredictionUnit &pu) CHECKD(availInfo.maxPosTop > puArea.width || availInfo.maxPosLeft > puArea.height, "Error"); return availInfo; } -#endif void PU::getIntraChromaCandModes( const PredictionUnit &pu, unsigned modeList[NUM_CHROMA_MODE] ) { @@ -1014,11 +768,7 @@ void PU::getIntraChromaCandModes( const PredictionUnit &pu, unsigned modeList[NU Position topLeftPos = pu.blocks[pu.chType].lumaPos(); Position refPos = topLeftPos.offset( pu.blocks[pu.chType].lumaSize().width >> 1, pu.blocks[pu.chType].lumaSize().height >> 1 ); const PredictionUnit *lumaPU = CS::isDualITree( *pu.cs ) ? pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : &pu; -#if JVET_N0217_MATRIX_INTRAPRED const uint32_t lumaMode = PU::getIntraDirLuma( *lumaPU ); -#else - const uint32_t lumaMode = lumaPU->intraDir[CHANNEL_TYPE_LUMA]; -#endif for( int i = 0; i < 4; i++ ) { if( lumaMode == modeList[i] ) @@ -1062,135 +812,6 @@ bool PU::isChromaIntraModeCrossCheckMode( const PredictionUnit &pu ) return pu.intraDir[CHANNEL_TYPE_CHROMA] == DM_CHROMA_IDX; } -#if !JVET_N0302_SIMPLFIED_CIIP -int PU::getMHIntraMPMs(const PredictionUnit &pu, unsigned* mpm, const ChannelType &channelType /*= CHANNEL_TYPE_LUMA*/, const bool isChromaMDMS /*= false*/, const unsigned startIdx /*= 0*/) -{ - const int numMPMs = 3; // Multi-hypothesis intra uses only 3 MPM - { - int numCand = -1; - uint32_t leftIntraDir = DC_IDX, aboveIntraDir = DC_IDX; - - const CompArea& area = pu.block(getFirstComponentOfChannel(channelType)); - const Position& pos = area.pos(); - - // Get intra direction of left PU - const PredictionUnit *puLeft = pu.cs->getPURestricted(pos.offset(-1, 0), pu, channelType); - - if (puLeft && (CU::isIntra(*puLeft->cu) || puLeft->mhIntraFlag)) - { - leftIntraDir = puLeft->intraDir[channelType]; - - if (isChroma(channelType) && leftIntraDir == DM_CHROMA_IDX) - { - leftIntraDir = puLeft->intraDir[0]; - } - } - - // Get intra direction of above PU - const PredictionUnit* puAbove = pu.cs->getPURestricted(pos.offset(0, -1), pu, channelType); - - if (puAbove && (CU::isIntra(*puAbove->cu) || puAbove->mhIntraFlag) && CU::isSameCtu(*pu.cu, *puAbove->cu)) - { - aboveIntraDir = puAbove->intraDir[channelType]; - - if (isChroma(channelType) && aboveIntraDir == DM_CHROMA_IDX) - { - aboveIntraDir = puAbove->intraDir[0]; - } - } - - CHECK(2 >= numMPMs, "Invalid number of most probable modes"); - - uint32_t leftIntraDir2 = leftIntraDir; - uint32_t aboveIntraDir2 = aboveIntraDir; - - leftIntraDir2 = (leftIntraDir2 > DC_IDX) ? ((leftIntraDir2 <= DIA_IDX) ? HOR_IDX : VER_IDX) : leftIntraDir2; - aboveIntraDir2 = (aboveIntraDir2 > DC_IDX) ? ((aboveIntraDir2 <= DIA_IDX) ? HOR_IDX : VER_IDX) : aboveIntraDir2; - - if (leftIntraDir2 == aboveIntraDir2) - { - numCand = 1; - - if (leftIntraDir2 > DC_IDX) // angular modes - { - mpm[0] = leftIntraDir2; - mpm[1] = PLANAR_IDX; - mpm[2] = DC_IDX; - } - else //non-angular - { - mpm[0] = PLANAR_IDX; - mpm[1] = DC_IDX; - mpm[2] = VER_IDX; - } - } - else - { - numCand = 2; - - mpm[0] = leftIntraDir2; - mpm[1] = aboveIntraDir2; - - if (leftIntraDir2 && aboveIntraDir2) //both modes are non-planar - { - mpm[2] = PLANAR_IDX; - } - else - { - mpm[2] = (leftIntraDir2 + aboveIntraDir2) < 2 ? VER_IDX : DC_IDX; - } - } - int narrowCase = getNarrowShape(pu.lwidth(), pu.lheight()); - if (narrowCase > 0) - { - bool isMPM[NUM_LUMA_MODE]; - for (int idx = 0; idx < NUM_LUMA_MODE; idx++) - { - isMPM[idx] = false; - } - for (int idx = 0; idx < numMPMs; idx++) - { - isMPM[mpm[idx]] = true; - } - if (narrowCase == 1 && isMPM[HOR_IDX]) - { - for (int idx = 0; idx < numMPMs; idx++) - { - if (mpm[idx] == HOR_IDX) - { - if (!isMPM[PLANAR_IDX]) - mpm[idx] = PLANAR_IDX; - else if (!isMPM[DC_IDX]) - mpm[idx] = DC_IDX; - else if (!isMPM[VER_IDX]) - mpm[idx] = VER_IDX; - break; - } - } - } - if (narrowCase == 2 && isMPM[VER_IDX]) - { - for (int idx = 0; idx < numMPMs; idx++) - { - if (mpm[idx] == VER_IDX) - { - if (!isMPM[PLANAR_IDX]) - mpm[idx] = PLANAR_IDX; - else if (!isMPM[DC_IDX]) - mpm[idx] = DC_IDX; - else if (!isMPM[HOR_IDX]) - mpm[idx] = HOR_IDX; - break; - } - } - } - } - CHECK(numCand == 0, "No candidates found"); - CHECK(mpm[0] == mpm[1] || mpm[0] == mpm[2] || mpm[2] == mpm[1], "redundant MPM"); - return numCand; - } -} -#endif int PU::getNarrowShape(const int width, const int height) { int longSide = (width > height) ? width : height; @@ -1218,24 +839,15 @@ uint32_t PU::getFinalIntraMode( const PredictionUnit &pu, const ChannelType &chT Position refPos = topLeftPos.offset( pu.blocks[pu.chType].lumaSize().width >> 1, pu.blocks[pu.chType].lumaSize().height >> 1 ); const PredictionUnit &lumaPU = CS::isDualITree( *pu.cs ) ? *pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : *pu.cs->getPU( topLeftPos, CHANNEL_TYPE_LUMA ); -#if JVET_N0217_MATRIX_INTRAPRED uiIntraMode = PU::getIntraDirLuma( lumaPU ); -#else - uiIntraMode = lumaPU.intraDir[0]; -#endif } -#if JVET_N0671_CHROMA_FORMAT_422 if( pu.chromaFormat == CHROMA_422 && !isLuma( chType ) && uiIntraMode < NUM_LUMA_MODE ) // map directional, planar and dc -#else - if( pu.chromaFormat == CHROMA_422 && !isLuma( chType ) ) -#endif //JVET_N0671_CHROMA_FORMAT_422 { uiIntraMode = g_chroma422IntraAngleMappingTable[uiIntraMode]; } return uiIntraMode; } -#if JVET_N0193_LFNST int PU::getWideAngIntraMode( const TransformUnit &tu, const uint32_t dirMode, const ComponentID compID ) { if( dirMode < 2 ) @@ -1263,7 +875,6 @@ int PU::getWideAngIntraMode( const TransformUnit &tu, const uint32_t dirMode, co return predMode; } -#endif bool PU::xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const MergeCtx mergeCandList, bool hasPruned[MRG_MAX_NUM_CANDS]) { @@ -1328,11 +939,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa { hasPruned[subPuMvpPos] = true; } -#if JVET_N0266_SMALL_BLOCKS auto &lut = ibcFlag ? ( isShared ? cs.motionLut.lutShareIbc : cs.motionLut.lutIbc ) : cs.motionLut.lut; -#else - auto &lut = ibcFlag ? ( isShared ? cs.motionLut.lutShareIbc : cs.motionLut.lutIbc ) : ( isShared ? cs.motionLut.lutShare : cs.motionLut.lut ); -#endif int num_avai_candInLUT = (int) lut.size(); for (int mrgIdx = 1; mrgIdx <= num_avai_candInLUT; mrgIdx++) @@ -1344,11 +951,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]); } -#if JVET_N0843_BVP_SIMPLIFICATION if (mrgIdx > 2 || (mrgIdx > 1 && ibcFlag) || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) -#else - if (mrgIdx > 2 || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) -#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; @@ -1389,9 +992,6 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int cnt = 0; -#if JVET_N0843_BVP_SIMPLIFICATION==0 - const Position posLT = pu.shareParentPos; -#endif const Position posRT = pu.shareParentPos.offset(pu.shareParentSize.width - 1, 0); const Position posLB = pu.shareParentPos.offset(0, pu.shareParentSize.height - 1); @@ -1452,108 +1052,8 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int spatialCandPos = cnt; -#if JVET_N0843_BVP_SIMPLIFICATION==0 - // above right - const PredictionUnit *puAboveRight = cs.getPURestricted(posRT.offset(1, -1), pu, pu.chType); - bool isAvailableB0 = puAboveRight && isDiffMER(pu, *puAboveRight) && CU::isIBC(*puAboveRight->cu); - if (isAvailableB0) - { - miAboveRight = puAboveRight->getMotionInfo(posRT.offset(1, -1)); - -#if HM_JEM_MERGE_CANDS - if ((!isAvailableB1 || (miAbove != miAboveRight)) && (!isAvailableA1 || (miLeft != miAboveRight))) -#else - if (!isAvailableB1 || (miAbove != miAboveRight)) -#endif - { - // get Inter Dir - mrgCtx.interDirNeighbours[cnt] = miAboveRight.interDir; - // get Mv from Above-right - mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miAboveRight.mv[0], miAboveRight.refIdx[0]); - - if (mrgCandIdx == cnt && canFastExit) - { - return; - } - - cnt++; - } - } - // early termination - if (cnt == maxNumMergeCand) - { - return; - } - - //left bottom - const PredictionUnit *puLeftBottom = cs.getPURestricted(posLB.offset(-1, 1), pu, pu.chType); - bool isAvailableA0 = puLeftBottom && isDiffMER(pu, *puLeftBottom) && CU::isIBC(*puLeftBottom->cu); - if (isAvailableA0) - { - miBelowLeft = puLeftBottom->getMotionInfo(posLB.offset(-1, 1)); -#if HM_JEM_MERGE_CANDS - if ((!isAvailableA1 || (miBelowLeft != miLeft)) && (!isAvailableB1 || (miBelowLeft != miAbove)) && (!isAvailableB0 || (miBelowLeft != miAboveRight))) -#else - if (!isAvailableA1 || (miBelowLeft != miLeft)) -#endif - { - // get Inter Dir - mrgCtx.interDirNeighbours[cnt] = miBelowLeft.interDir; - mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miBelowLeft.mv[0], miBelowLeft.refIdx[0]); - if (mrgCandIdx == cnt && canFastExit) - { - return; - } - - cnt++; - } - } - // early termination - if (cnt == maxNumMergeCand) - { - return; - } - - // above left - if (cnt < 4) - { - const PredictionUnit *puAboveLeft = cs.getPURestricted(posLT.offset(-1, -1), pu, pu.chType); - bool isAvailableB2 = puAboveLeft && isDiffMER(pu, *puAboveLeft) && CU::isIBC(*puAboveLeft->cu); - if (isAvailableB2) - { - miAboveLeft = puAboveLeft->getMotionInfo(posLT.offset(-1, -1)); - -#if HM_JEM_MERGE_CANDS - if ((!isAvailableA1 || (miLeft != miAboveLeft)) && (!isAvailableB1 || (miAbove != miAboveLeft)) && (!isAvailableA0 || (miBelowLeft != miAboveLeft)) && (!isAvailableB0 || (miAboveRight != miAboveLeft))) -#else - if ((!isAvailableA1 || (miLeft != miAboveLeft)) && (!isAvailableB1 || (miAbove != miAboveLeft))) -#endif - { - // get Inter Dir - mrgCtx.interDirNeighbours[cnt] = miAboveLeft.interDir; - mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miAboveLeft.mv[0], miAboveLeft.refIdx[0]); - if (mrgCandIdx == cnt && canFastExit) - { - return; - } - - cnt++; - } - } - } - // early termination - if (cnt == maxNumMergeCand) - { - return; - } -#endif - -#if JVET_N0843_BVP_SIMPLIFICATION int maxNumMergeCandMin1 = maxNumMergeCand; -#else - int maxNumMergeCandMin1 = maxNumMergeCand - 1; -#endif if (cnt != maxNumMergeCandMin1) { bool isAvailableSubPu = false; @@ -1582,35 +1082,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const } } -#if JVET_L0090_PAIR_AVG && JVET_N0843_BVP_SIMPLIFICATION==0 - // pairwise-average candidates - if (cnt>1 && cnt getMotionInfo( posRT.offset( 1, -1 ) ); -#if HM_JEM_MERGE_CANDS - if( ( !isAvailableB1 || ( miAbove != miAboveRight ) ) && ( !isAvailableA1 || ( miLeft != miAboveRight ) ) ) -#else if( !isAvailableB1 || ( miAbove != miAboveRight ) ) -#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; @@ -1802,11 +1263,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { miBelowLeft = puLeftBottom->getMotionInfo( posLB.offset( -1, 1 ) ); -#if HM_JEM_MERGE_CANDS - if( ( !isAvailableA1 || ( miBelowLeft != miLeft ) ) && ( !isAvailableB1 || ( miBelowLeft != miAbove ) ) && ( !isAvailableB0 || ( miBelowLeft != miAboveRight ) ) ) -#else if( !isAvailableA1 || ( miBelowLeft != miLeft ) ) -#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; @@ -1849,11 +1306,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { miAboveLeft = puAboveLeft->getMotionInfo( posLT.offset( -1, -1 ) ); -#if HM_JEM_MERGE_CANDS - if( ( !isAvailableA1 || ( miLeft != miAboveLeft ) ) && ( !isAvailableB1 || ( miAbove != miAboveLeft ) ) && ( !isAvailableA0 || ( miBelowLeft != miAboveLeft ) ) && ( !isAvailableB0 || ( miAboveRight != miAboveLeft ) ) ) -#else if( ( !isAvailableA1 || ( miLeft != miAboveLeft ) ) && ( !isAvailableB1 || ( miAbove != miAboveLeft ) ) ) -#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; @@ -1885,31 +1338,16 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, return; } -#if JVET_N0213_TMVP_REMOVAL if (slice.getEnableTMVPFlag() && (pu.lumaSize().width + pu.lumaSize().height > 12)) -#else - if (slice.getEnableTMVPFlag()) -#endif { //>> MTK colocated-RightBottom // offset the pos to be sure to "point" to the same position the uiAbsPartIdx would've pointed to -#if JVET_N0266_SMALL_BLOCKS Position posRB = pu.Y().bottomRight().offset( -3, -3 ); -#else - Position posRB = pu.shareParentPos.offset(pu.shareParentSize.width-3, pu.shareParentSize.height - 3); -#endif const PreCalcValues& pcv = *cs.pcv; Position posC0; -#if JVET_N0266_SMALL_BLOCKS Position posC1 = pu.Y().center(); -#else - Position posC1 = pu.shareParentPos.offset((pu.shareParentSize.width/2), (pu.shareParentSize.height/2)); -#endif bool C0Avail = false; -#if !JVET_N0266_SMALL_BLOCKS - bool C1Avail = (posC1.x < pcv.lumaWidth) && (posC1.y < pcv.lumaHeight); -#endif if (((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight)) { int posYInCtu = posRB.y & pcv.maxCUHeightMask; @@ -1925,11 +1363,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int dir = 0; unsigned uiArrayAddr = cnt; bool bExistMV = ( C0Avail && getColocatedMVP(pu, REF_PIC_LIST_0, posC0, cColMv, iRefIdx ) ) -#if JVET_N0266_SMALL_BLOCKS || getColocatedMVP( pu, REF_PIC_LIST_0, posC1, cColMv, iRefIdx ); -#else - || ( C1Avail && getColocatedMVP(pu, REF_PIC_LIST_0, posC1, cColMv, iRefIdx )); -#endif if (bExistMV) { dir |= 1; @@ -1939,11 +1373,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if (slice.isInterB()) { bExistMV = ( C0Avail && getColocatedMVP(pu, REF_PIC_LIST_1, posC0, cColMv, iRefIdx ) ) -#if JVET_N0266_SMALL_BLOCKS || getColocatedMVP( pu, REF_PIC_LIST_1, posC1, cColMv, iRefIdx ); -#else - || (C1Avail && getColocatedMVP(pu, REF_PIC_LIST_1, posC1, cColMv, iRefIdx ) ); -#endif if (bExistMV) { dir |= 2; @@ -1954,18 +1384,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if( dir != 0 ) { bool addTMvp = true; -#if HM_JEM_MERGE_CANDS - int iSpanCand = cnt; - for( int i = 0; i < iSpanCand; i++ ) - { - if( mrgCtx.interDirNeighbours[ i ] == dir && - mrgCtx.mvFieldNeighbours [ i << 1 ] == mrgCtx.mvFieldNeighbours[ uiArrayAddr << 1 ] && - mrgCtx.mvFieldNeighbours [( i << 1 ) + 1] == mrgCtx.mvFieldNeighbours[( uiArrayAddr << 1 ) + 1] ) - { - addTMvp = false; - } - } -#endif if( addTMvp ) { mrgCtx.interDirNeighbours[uiArrayAddr] = dir; @@ -1995,11 +1413,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, bool isAvailableSubPu = false; unsigned subPuMvpPos = 0; #if JVET_L0090_PAIR_AVG -#if JVET_N0266_SMALL_BLOCKS bool isShared = false; -#else - bool isShared = ((pu.Y().lumaSize().width != pu.shareParentSize.width) || (pu.Y().lumaSize().height != pu.shareParentSize.height)); -#endif bool bFound = addMergeHMVPCand(cs, mrgCtx, canFastExit , mrgCandIdx , maxNumMergeCandMin1, cnt @@ -2173,14 +1587,12 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, } bool PU::checkDMVRCondition(const PredictionUnit& pu) { -#if JVET_N0146_DMVR_BDOF_CONDITION WPScalingParam *wp0; WPScalingParam *wp1; int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; int refIdx1 = pu.refIdx[REF_PIC_LIST_1]; pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0); pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); -#endif if (pu.cs->sps->getUseDMVR()) { return pu.mergeFlag @@ -2190,16 +1602,10 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) && !pu.cu->mmvdSkip && PU::isBiPredFromDifferentDirEqDistPoc(pu) && (pu.lheight() >= 8) -#if JVET_N0407_DMVR_CU_SIZE_RESTRICTION && (pu.lwidth() >= 8) && ((pu.lheight() * pu.lwidth()) >= 128) -#else - && ((pu.lheight() * pu.lwidth()) >= 64) -#endif -#if JVET_N0146_DMVR_BDOF_CONDITION && (pu.cu->GBiIdx == GBI_DEFAULT) && ((!wp0[COMPONENT_Y].bPresentFlag) && (!wp1[COMPONENT_Y].bPresentFlag)) -#endif ; } else @@ -2251,21 +1657,13 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i } // in the same CTU line -#if JVET_N0175_N0251_N0384_IBC_SMALL_CTU int numLeftCTUs = (1 << ((7 - ctuSizeLog2) << 1)) - ((ctuSizeLog2 < 7) ? 1 : 0); if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2) - numLeftCTUs)) -#else - if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2) - 1)) -#endif { // in the same CTU, or left CTU // if part of ref block is in the left CTU, some area can be referred from the not-yet updated local CTU buffer -#if JVET_N0175_N0251_N0384_IBC_SMALL_CTU if (((refLeftX >> ctuSizeLog2) == ((xPos >> ctuSizeLog2) - 1)) && (ctuSizeLog2 == 7)) -#else - if ((refLeftX >> ctuSizeLog2) == ((xPos >> ctuSizeLog2) - 1)) -#endif { // ref block's collocated block in current CTU const Position refPosCol = pu.Y().topLeft().offset(xBv + ctuSize, yBv); @@ -2274,10 +1672,8 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i const Position refPosCol64x64 = {offset64x, offset64y}; if (pu.cs->isDecomp(refPosCol64x64, toChannelType(COMPONENT_Y))) return false; -#if JVET_N0383_N0251_IBC_COL_VPDU_REMOVE if (refPosCol64x64 == pu.Y().topLeft()) return false; -#endif } } else @@ -2390,19 +1786,6 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, break; } } -#if !JVET_N0448_N0380 - if (currBaseNum < MMVD_BASE_MV_NUM) - { - for (k = currBaseNum; k < MMVD_BASE_MV_NUM; k++) - { - mrgCtx.mmvdBaseMv[k][0] = MvField(Mv(0, 0), 0); - const Slice &slice = *pu.cs->slice; - mrgCtx.mmvdBaseMv[k][1] = MvField(Mv(0, 0), (slice.isInterB() ? 0 : -1)); - mrgCtx.GBiIdx[k] = GBI_DEFAULT; - mrgCtx.interDirNeighbours[k] = (mrgCtx.mmvdBaseMv[k][0].refIdx >= 0) + (mrgCtx.mmvdBaseMv[k][1].refIdx >= 0) * 2; - } - } -#endif } bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList, const Position &_pos, Mv& rcMv, const int &refIdx ) { @@ -2527,7 +1910,6 @@ bool PU::isDiffMER(const PredictionUnit &pu1, const PredictionUnit &pu2) return false; } -#if JVET_N0329_IBC_SEARCH_IMP bool PU::isAddNeighborMv(const Mv& currMv, Mv* neighborMvs, int numNeighborMv) { bool existed = false; @@ -2548,15 +1930,9 @@ bool PU::isAddNeighborMv(const Mv& currMv, Mv* neighborMvs, int numNeighborMv) return false; } } -#endif -#if JVET_N0329_IBC_SEARCH_IMP void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* mvPred, int& nbPred) -#else -void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) -#endif { -#if JVET_N0329_IBC_SEARCH_IMP const PreCalcValues &pcv = *pu.cs->pcv; const int cuWidth = pu.blocks[COMPONENT_Y].width; const int cuHeight = pu.blocks[COMPONENT_Y].height; @@ -2640,76 +2016,6 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) } } while (nbPred > curNbPred && nbPred < IBC_NUM_CANDIDATES); } -#else - //-- Get Spatial MV - Position posLT = pu.Y().topLeft(); - Position posRT = pu.Y().topRight(); - Position posLB = pu.Y().bottomLeft(); - - unsigned int left = 0, above = 0; - - //left - const PredictionUnit *neibLeftPU = NULL; - neibLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 0), pu, CHANNEL_TYPE_LUMA); - left = (neibLeftPU) ? CU::isIBC(*neibLeftPU->cu) : 0; - - if (left) - { - MvPred[nbPred++] = neibLeftPU->bv; - if (getDerivedBV(pu, MvPred[nbPred - 1], MvPred[nbPred])) - nbPred++; - } - - //above - const PredictionUnit *neibAbovePU = NULL; - neibAbovePU = pu.cs->getPURestricted(posRT.offset(0, -1), pu, CHANNEL_TYPE_LUMA); - above = (neibAbovePU) ? CU::isIBC(*neibAbovePU->cu) : 0; - - if (above) - { - MvPred[nbPred++] = neibAbovePU->bv; - if (getDerivedBV(pu, MvPred[nbPred - 1], MvPred[nbPred])) - nbPred++; - } - - // Below Left predictor search - const PredictionUnit *neibBelowLeftPU = NULL; - neibBelowLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 1), pu, CHANNEL_TYPE_LUMA); - unsigned int belowLeft = (neibBelowLeftPU) ? CU::isIBC(*neibBelowLeftPU->cu) : 0; - - if (belowLeft) - { - MvPred[nbPred++] = neibBelowLeftPU->bv; - if (getDerivedBV(pu, MvPred[nbPred - 1], MvPred[nbPred])) - nbPred++; - } - - - // Above Right predictor search - const PredictionUnit *neibAboveRightPU = NULL; - neibAboveRightPU = pu.cs->getPURestricted(posRT.offset(1, -1), pu, CHANNEL_TYPE_LUMA); - unsigned int aboveRight = (neibAboveRightPU) ? CU::isIBC(*neibAboveRightPU->cu) : 0; - - if (aboveRight) - { - MvPred[nbPred++] = neibAboveRightPU->bv; - if (getDerivedBV(pu, MvPred[nbPred - 1], MvPred[nbPred])) - nbPred++; - } - - - // Above Left predictor search - const PredictionUnit *neibAboveLeftPU = NULL; - neibAboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, CHANNEL_TYPE_LUMA); - unsigned int aboveLeft = (neibAboveLeftPU) ? CU::isIBC(*neibAboveLeftPU->cu) : 0; - - if (aboveLeft) - { - MvPred[nbPred++] = neibAboveLeftPU->bv; - if (getDerivedBV(pu, MvPred[nbPred - 1], MvPred[nbPred])) - nbPred++; - } -#endif } bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) @@ -2744,85 +2050,12 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) */ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo) { -#if JVET_N0843_BVP_SIMPLIFICATION==0 - CodingStructure &cs = *pu.cs; -#endif AMVPInfo *pInfo = &amvpInfo; pInfo->numCand = 0; -#if JVET_N0843_BVP_SIMPLIFICATION==0 - //-- Get Spatial MV - Position posLT = pu.Y().topLeft(); - Position posRT = pu.Y().topRight(); - Position posLB = pu.Y().bottomLeft(); - - bool isScaledFlagLX = false; /// variable name from specification; true when the PUs below left or left are available (availableA0 || availableA1). - - const PredictionUnit* tmpPU = cs.getPURestricted(posLB.offset(-1, 1), pu, pu.chType); // getPUBelowLeft(idx, partIdxLB); - isScaledFlagLX = tmpPU != NULL && CU::isIBC(*tmpPU->cu); - if (!isScaledFlagLX) - { - tmpPU = cs.getPURestricted(posLB.offset(-1, 0), pu, pu.chType); - isScaledFlagLX = tmpPU != NULL && CU::isIBC(*tmpPU->cu); - } - // Left predictor search - if (isScaledFlagLX) - { - bool isAdded = addIBCMVPCand(pu, posLB, MD_BELOW_LEFT, *pInfo); - - if (!isAdded) - { - isAdded = addIBCMVPCand(pu, posLB, MD_LEFT, *pInfo); - } - } - - // Above predictor search - bool isAdded = addIBCMVPCand(pu, posRT, MD_ABOVE_RIGHT, *pInfo); - - if (!isAdded) - { - isAdded = addIBCMVPCand(pu, posRT, MD_ABOVE, *pInfo); - - if (!isAdded) - { - addIBCMVPCand(pu, posLT, MD_ABOVE_LEFT, *pInfo); - } - } - - for( int i = 0; i < pInfo->numCand; i++ ) - { - pInfo->mvCand[i].roundTransPrecInternal2Amvr(pu.cu->imv); - } - - if (pInfo->numCand == 2) - { - if (pInfo->mvCand[0] == pInfo->mvCand[1]) - { - pInfo->numCand = 1; - } - } - - if (pInfo->numCand < AMVP_MAX_NUM_CANDS) - { - addAMVPHMVPCand(pu, REF_PIC_LIST_0, REF_PIC_LIST_1, cs.slice->getPOC(), *pInfo, pu.cu->imv); - } - - if (pInfo->numCand > AMVP_MAX_NUM_CANDS) - { - pInfo->numCand = AMVP_MAX_NUM_CANDS; - } - - while (pInfo->numCand < AMVP_MAX_NUM_CANDS) - { - pInfo->mvCand[pInfo->numCand] = Mv(0, 0); - pInfo->numCand++; - } -#endif - -#if JVET_N0843_BVP_SIMPLIFICATION MergeCtx mergeCtx; PU::getIBCMergeCandidates(pu, mergeCtx, AMVP_MAX_NUM_CANDS - 1); int candIdx = 0; @@ -2832,13 +2065,10 @@ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo) pInfo->numCand++; candIdx++; } -#endif for (Mv &mv : pInfo->mvCand) { -#if JVET_N0843_BVP_SIMPLIFICATION mv.roundIbcPrecInternal2Amvr(pu.cu->imv); -#endif } } @@ -2945,11 +2175,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in } } -#if JVET_N0213_TMVP_REMOVAL - if (cs.slice->getEnableTMVPFlag() && pInfo->numCand < AMVP_MAX_NUM_CANDS && (pu.lumaSize().width + pu.lumaSize().height > 12)) -#else - if( cs.slice->getEnableTMVPFlag() && pInfo->numCand < AMVP_MAX_NUM_CANDS ) -#endif + if (cs.slice->getEnableTMVPFlag() && pInfo->numCand < AMVP_MAX_NUM_CANDS && (pu.lumaSize().width + pu.lumaSize().height > 12)) { // Get Temporal Motion Predictor const int refIdx_Col = refIdx; @@ -2961,9 +2187,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in Position posC0; bool C0Avail = false; Position posC1 = pu.Y().center(); -#if !JVET_N0266_SMALL_BLOCKS - bool C1Avail = ( posC1.x < pcv.lumaWidth ) && ( posC1.y < pcv.lumaHeight ) ; -#endif Mv cColMv; if( ( ( posRB.x + pcv.minCUWidth ) < pcv.lumaWidth ) && ( ( posRB.y + pcv.minCUHeight ) < pcv.lumaHeight ) ) @@ -2975,11 +2198,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in C0Avail = true; } } -#if JVET_N0266_SMALL_BLOCKS if ( ( C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdx_Col ) ) || getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdx_Col ) ) -#else - if ((C0Avail && getColocatedMVP(pu, eRefPicList, posC0, cColMv, refIdx_Col)) || (C1Avail && getColocatedMVP(pu, eRefPicList, posC1, cColMv, refIdx_Col))) -#endif { cColMv.roundTransPrecInternal2Amvr(pu.cu->imv); pInfo->mvCand[pInfo->numCand++] = cColMv; @@ -3285,9 +2504,6 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co Position posC0; bool C0Avail = false; Position posC1 = pu.Y().center(); -#if !JVET_N0266_SMALL_BLOCKS - bool C1Avail = ( posC1.x < pcv.lumaWidth ) && ( posC1.y < pcv.lumaHeight ) ; -#endif Mv cColMv; if ( ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight) ) { @@ -3298,11 +2514,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co C0Avail = true; } } -#if JVET_N0266_SMALL_BLOCKS if ( ( C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdxCol ) ) || getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdxCol ) ) -#else - if ( (C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdxCol )) || (C1Avail && getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdxCol ) ) ) -#endif { cColMv.roundAffinePrecInternal2Amvr(pu.cu->imv); affiAMVPInfo.mvCandLT[affiAMVPInfo.numCand] = cColMv; @@ -3553,20 +2765,14 @@ bool PU::isBipredRestriction(const PredictionUnit &pu) { return true; } -#if JVET_N0266_SMALL_BLOCKS /* disable bi-prediction for 4x8/8x4 */ if ( pu.cu->lumaSize().width + pu.cu->lumaSize().height == 12 ) { return true; } -#endif return false; } -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE void PU::getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], int8_t neighGbi[4], bool isAvailable[4], int verIdx[4], int modelIdx, int verNum, AffineMergeCtx& affMrgType) -#else -void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], bool isAvailable[4], int verIdx[4], int modelIdx, int verNum, AffineMergeCtx& affMrgType ) -#endif { int cuW = pu.Y().width; int cuH = pu.Y().height; @@ -3578,9 +2784,7 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], Mv cMv[2][4]; int refIdx[2] = { -1, -1 }; int dir = 0; -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE int8_t gbiIdx = GBI_DEFAULT; -#endif EAffineModel curType = (verNum == 2) ? AFFINEMODEL_4PARAM : AFFINEMODEL_6PARAM; if ( verNum == 2 ) @@ -3603,7 +2807,6 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], } } } -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE if (dir == 3) { if (neighGbi[idx0] == neighGbi[idx1]) @@ -3612,7 +2815,6 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], } } -#endif } else if ( verNum == 3 ) { @@ -3634,7 +2836,6 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], } } } -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE int gbiClass[5] = { -1,0,0,0,1 }; if (dir == 3) { @@ -3658,7 +2859,6 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], } -#endif } if ( dir == 0 ) @@ -3685,25 +2885,19 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], case 1: // 1 : LT, RT, RB cMv[l][2].hor = cMv[l][3].hor + cMv[l][0].hor - cMv[l][1].hor; cMv[l][2].ver = cMv[l][3].ver + cMv[l][0].ver - cMv[l][1].ver; -#if JVET_N0334_MVCLIPPING cMv[l][2].clipToStorageBitDepth(); -#endif break; case 2: // 2 : LT, LB, RB cMv[l][1].hor = cMv[l][3].hor + cMv[l][0].hor - cMv[l][2].hor; cMv[l][1].ver = cMv[l][3].ver + cMv[l][0].ver - cMv[l][2].ver; -#if JVET_N0334_MVCLIPPING cMv[l][1].clipToStorageBitDepth(); -#endif break; case 3: // 3 : RT, LB, RB cMv[l][0].hor = cMv[l][1].hor + cMv[l][2].hor - cMv[l][3].hor; cMv[l][0].ver = cMv[l][1].ver + cMv[l][2].ver - cMv[l][3].ver; -#if JVET_N0334_MVCLIPPING cMv[l][0].clipToStorageBitDepth(); -#endif break; case 4: // 4 : LT, RT @@ -3714,9 +2908,7 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], vy = (cMv[l][0].ver << shift) - ((cMv[l][2].hor - cMv[l][0].hor) << shiftHtoW); roundAffineMv( vx, vy, shift ); cMv[l][1].set( vx, vy ); -#if JVET_N0334_MVCLIPPING cMv[l][1].clipToStorageBitDepth(); -#endif break; default: @@ -3744,9 +2936,7 @@ void PU::getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], } affMrgType.interDirNeighbours[affMrgType.numValidMergeCand] = dir; affMrgType.affineType[affMrgType.numValidMergeCand] = curType; -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE affMrgType.GBiIdx[affMrgType.numValidMergeCand] = gbiIdx; -#endif affMrgType.numValidMergeCand++; @@ -3953,9 +3143,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { MotionInfo mi[4]; bool isAvailable[4] = { false }; -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE int8_t neighGbi[4] = { GBI_DEFAULT, GBI_DEFAULT, GBI_DEFAULT, GBI_DEFAULT }; -#endif // control point: LT B2->B3->A2 const Position posLT[3] = { pu.Y().topLeft().offset( -1, -1 ), pu.Y().topLeft().offset( 0, -1 ), pu.Y().topLeft().offset( -1, 0 ) }; for ( int i = 0; i < 3; i++ ) @@ -3968,9 +3156,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { isAvailable[0] = true; mi[0] = puNeigh->getMotionInfo( pos ); -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE neighGbi[0] = puNeigh->cu->GBiIdx; -#endif break; } } @@ -3988,9 +3174,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { isAvailable[1] = true; mi[1] = puNeigh->getMotionInfo( pos ); -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE neighGbi[1] = puNeigh->cu->GBiIdx; -#endif break; } } @@ -4008,9 +3192,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { isAvailable[2] = true; mi[2] = puNeigh->getMotionInfo( pos ); -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE neighGbi[2] = puNeigh->cu->GBiIdx; -#endif break; } } @@ -4077,11 +3259,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx for ( int idx = startIdx; idx < modelNum; idx++ ) { int modelIdx = order[idx]; -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE getAffineControlPointCand(pu, mi, neighGbi, isAvailable, model[modelIdx], modelIdx, verNum[modelIdx], affMrgCtx); -#else - getAffineControlPointCand( pu, mi, isAvailable, model[modelIdx], modelIdx, verNum[modelIdx], affMrgCtx ); -#endif if ( affMrgCtx.numValidMergeCand != 0 && affMrgCtx.numValidMergeCand - 1 == mrgCandIdx ) { return; @@ -4141,15 +3319,10 @@ void PU::setAllAffineMvField( PredictionUnit &pu, MvField *mvField, RefPicList e pu.refIdx[eRefList] = mvField[0].refIdx; } -#if JVET_N0334_MVCLIPPING void PU::setAllAffineMv(PredictionUnit& pu, Mv affLT, Mv affRT, Mv affLB, RefPicList eRefList, bool clipCPMVs) -#else -void PU::setAllAffineMv( PredictionUnit& pu, Mv affLT, Mv affRT, Mv affLB, RefPicList eRefList) -#endif { int width = pu.Y().width; int shift = MAX_CU_DEPTH; -#if JVET_N0334_MVCLIPPING if (clipCPMVs) { affLT.mvCliptoStorageBitDepth(); @@ -4159,7 +3332,6 @@ void PU::setAllAffineMv( PredictionUnit& pu, Mv affLT, Mv affRT, Mv affLB, RefPi affLB.mvCliptoStorageBitDepth(); } } -#endif int deltaMvHorX, deltaMvHorY, deltaMvVerX, deltaMvVerY; deltaMvHorX = (affRT - affLT).getHor() << (shift - g_aucLog2[width]); deltaMvHorY = (affRT - affLT).getVer() << (shift - g_aucLog2[width]); @@ -4185,28 +3357,22 @@ void PU::setAllAffineMv( PredictionUnit& pu, Mv affLT, Mv affRT, Mv affLB, RefPi MotionBuf mb = pu.getMotionBuf(); int mvScaleTmpHor, mvScaleTmpVer; -#if JVET_N0068_AFFINE_MEM_BW const bool subblkMVSpreadOverLimit = InterPrediction::isSubblockVectorSpreadOverLimit( deltaMvHorX, deltaMvHorY, deltaMvVerX, deltaMvVerY, pu.interDir ); -#endif for ( int h = 0; h < pu.Y().height; h += blockHeight ) { for ( int w = 0; w < pu.Y().width; w += blockWidth ) { -#if JVET_N0068_AFFINE_MEM_BW if ( !subblkMVSpreadOverLimit ) { -#endif mvScaleTmpHor = mvScaleHor + deltaMvHorX * (halfBW + w) + deltaMvVerX * (halfBH + h); mvScaleTmpVer = mvScaleVer + deltaMvHorY * (halfBW + w) + deltaMvVerY * (halfBH + h); -#if JVET_N0068_AFFINE_MEM_BW } else { mvScaleTmpHor = mvScaleHor + deltaMvHorX * ( pu.Y().width >> 1 ) + deltaMvVerX * ( pu.Y().height >> 1 ); mvScaleTmpVer = mvScaleVer + deltaMvHorY * ( pu.Y().width >> 1 ) + deltaMvVerY * ( pu.Y().height >> 1 ); } -#endif roundAffineMv( mvScaleTmpHor, mvScaleTmpVer, shift ); Mv curMv(mvScaleTmpHor, mvScaleTmpVer); curMv.clipToStorageBitDepth(); @@ -4579,9 +3745,7 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP pu.mvpNum[0] = amvpInfo.numCand; pu.mvpIdx[0] = mvp_idx; pu.mv [0] = amvpInfo.mvCand[mvp_idx] + pu.mvd[0]; -#if JVET_N0334_MVCLIPPING pu.mv[0].mvCliptoStorageBitDepth(); -#endif } if (pu.interDir != 1 /* PRED_L0 */) @@ -4596,9 +3760,7 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP pu.mvpNum[1] = amvpInfo.numCand; pu.mvpIdx[1] = mvp_idx; pu.mv [1] = amvpInfo.mvCand[mvp_idx] + pu.mvd[1]; -#if JVET_N0334_MVCLIPPING pu.mv[1].mvCliptoStorageBitDepth(); -#endif } } else @@ -4679,7 +3841,6 @@ void PU::restrictBiPredMergeCandsOne(PredictionUnit &pu) void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangleMrgCtx ) { -#if JVET_N0340_TRI_MERGE_CAND MergeCtx tmpMergeCtx; const Slice &slice = *pu.cs->slice; @@ -4734,353 +3895,6 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl } } } -#else - - const CodingStructure &cs = *pu.cs; - const Slice &slice = *pu.cs->slice; - const int32_t maxNumMergeCand = TRIANGLE_MAX_NUM_UNI_CANDS; - triangleMrgCtx.numValidMergeCand = 0; - - for( int32_t i = 0; i < maxNumMergeCand; i++ ) - { - 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(); - } - - MotionInfo candidate[TRIANGLE_MAX_NUM_CANDS_MEM]; - int32_t candCount = 0; - - const Position posLT = pu.Y().topLeft(); - const Position posRT = pu.Y().topRight(); - const Position posLB = pu.Y().bottomLeft(); - - MotionInfo miAbove, miLeft, miAboveLeft, miAboveRight, miBelowLeft; - - //left - const PredictionUnit* puLeft = cs.getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType ); - const bool isAvailableA1 = puLeft && isDiffMER( pu, *puLeft ) && pu.cu != puLeft->cu && CU::isInter( *puLeft->cu ) - ; - if( isAvailableA1 ) - { - miLeft = puLeft->getMotionInfo( posLB.offset(-1, 0) ); - candidate[candCount].isInter = true; - candidate[candCount].interDir = miLeft.interDir; - candidate[candCount].mv[0] = miLeft.mv[0]; - candidate[candCount].mv[1] = miLeft.mv[1]; - candidate[candCount].refIdx[0] = miLeft.refIdx[0]; - candidate[candCount].refIdx[1] = miLeft.refIdx[1]; - candCount++; - } - - // above - const PredictionUnit *puAbove = cs.getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType ); - bool isAvailableB1 = puAbove && isDiffMER( pu, *puAbove ) && pu.cu != puAbove->cu && CU::isInter( *puAbove->cu ) - ; - if( isAvailableB1 ) - { - miAbove = puAbove->getMotionInfo( posRT.offset( 0, -1 ) ); - - if( !isAvailableA1 || ( miAbove != miLeft ) ) - { - candidate[candCount].isInter = true; - candidate[candCount].interDir = miAbove.interDir; - candidate[candCount].mv[0] = miAbove.mv[0]; - candidate[candCount].mv[1] = miAbove.mv[1]; - candidate[candCount].refIdx[0] = miAbove.refIdx[0]; - candidate[candCount].refIdx[1] = miAbove.refIdx[1]; - candCount++; - } - } - - // above right - const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); - bool isAvailableB0 = puAboveRight && isDiffMER( pu, *puAboveRight ) && CU::isInter( *puAboveRight->cu ) - ; - - if( isAvailableB0 ) - { - miAboveRight = puAboveRight->getMotionInfo( posRT.offset( 1, -1 ) ); - - if( ( !isAvailableB1 || ( miAbove != miAboveRight ) ) && ( !isAvailableA1 || ( miLeft != miAboveRight ) ) ) - { - candidate[candCount].isInter = true; - candidate[candCount].interDir = miAboveRight.interDir; - candidate[candCount].mv[0] = miAboveRight.mv[0]; - candidate[candCount].mv[1] = miAboveRight.mv[1]; - candidate[candCount].refIdx[0] = miAboveRight.refIdx[0]; - candidate[candCount].refIdx[1] = miAboveRight.refIdx[1]; - candCount++; - } - } - - //left bottom - const PredictionUnit *puLeftBottom = cs.getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType ); - bool isAvailableA0 = puLeftBottom && isDiffMER( pu, *puLeftBottom ) && CU::isInter( *puLeftBottom->cu ) - ; - if( isAvailableA0 ) - { - miBelowLeft = puLeftBottom->getMotionInfo( posLB.offset( -1, 1 ) ); - - if( ( !isAvailableA1 || ( miBelowLeft != miLeft ) ) && ( !isAvailableB1 || ( miBelowLeft != miAbove ) ) && ( !isAvailableB0 || ( miBelowLeft != miAboveRight ) ) ) - { - candidate[candCount].isInter = true; - candidate[candCount].interDir = miBelowLeft.interDir; - candidate[candCount].mv[0] = miBelowLeft.mv[0]; - candidate[candCount].mv[1] = miBelowLeft.mv[1]; - candidate[candCount].refIdx[0] = miBelowLeft.refIdx[0]; - candidate[candCount].refIdx[1] = miBelowLeft.refIdx[1]; - candCount++; - } - } - - // above left - const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); - bool isAvailableB2 = puAboveLeft && isDiffMER( pu, *puAboveLeft ) && CU::isInter( *puAboveLeft->cu ) - ; - - if( isAvailableB2 ) - { - miAboveLeft = puAboveLeft->getMotionInfo( posLT.offset( -1, -1 ) ); - - if( ( !isAvailableA1 || ( miLeft != miAboveLeft ) ) && ( !isAvailableB1 || ( miAbove != miAboveLeft ) ) && ( !isAvailableA0 || ( miBelowLeft != miAboveLeft ) ) && ( !isAvailableB0 || ( miAboveRight != miAboveLeft ) ) ) - { - candidate[candCount].isInter = true; - candidate[candCount].interDir = miAboveLeft.interDir; - candidate[candCount].mv[0] = miAboveLeft.mv[0]; - candidate[candCount].mv[1] = miAboveLeft.mv[1]; - candidate[candCount].refIdx[0] = miAboveLeft.refIdx[0]; - candidate[candCount].refIdx[1] = miAboveLeft.refIdx[1]; - candCount++; - } - } - - if( slice.getEnableTMVPFlag() ) - { - Position posRB = pu.Y().bottomRight().offset(-3, -3); - - const PreCalcValues& pcv = *cs.pcv; - - Position posC0; - Position posC1 = pu.Y().center(); - bool isAvailableC0 = false; -#if !JVET_N0266_SMALL_BLOCKS - bool isAvailableC1 = (posC1.x < pcv.lumaWidth) && (posC1.y < pcv.lumaHeight); -#endif - if (((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight)) - { - Position posInCtu( posRB.x & pcv.maxCUWidthMask, posRB.y & pcv.maxCUHeightMask ); - - if( ( posInCtu.x + 4 < pcv.maxCUWidth ) && // is not at the last column of CTU - ( posInCtu.y + 4 < pcv.maxCUHeight ) ) // is not at the last row of CTU - { - posC0 = posRB.offset( 4, 4 ); - isAvailableC0 = true; - } - else if( posInCtu.x + 4 < pcv.maxCUWidth ) // is not at the last column of CTU But is last row of CTU - { - posC0 = posRB.offset( 4, 4 ); - // in the reference the CTU address is not set - thus probably resulting in no using this C0 possibility - } - else if( posInCtu.y + 4 < pcv.maxCUHeight ) // is not at the last row of CTU But is last column of CTU - { - posC0 = posRB.offset( 4, 4 ); - isAvailableC0 = true; - } - else //is the right bottom corner of CTU - { - posC0 = posRB.offset( 4, 4 ); - // same as for last column but not last row - } - } - - // C0 - Mv cColMv; - int32_t refIdx = 0; - bool existMV = ( isAvailableC0 && getColocatedMVP( pu, REF_PIC_LIST_0, posC0, cColMv, refIdx ) ); - MotionInfo temporalMv; - temporalMv.interDir = 0; - if( existMV ) - { - temporalMv.isInter = true; - temporalMv.interDir |= 1; - temporalMv.mv[0] = cColMv; - temporalMv.refIdx[0] = refIdx; - } - existMV = ( isAvailableC0 && getColocatedMVP( pu, REF_PIC_LIST_1, posC0, cColMv, refIdx ) ); - if( existMV ) - { - temporalMv.interDir |= 2; - temporalMv.mv[1] = cColMv; - temporalMv.refIdx[1] = refIdx; - } - - if( temporalMv.interDir != 0 ) - { - candidate[candCount].isInter = true; - candidate[candCount].interDir = temporalMv.interDir; - candidate[candCount].mv[0] = temporalMv.mv[0]; - candidate[candCount].mv[1] = temporalMv.mv[1]; - candidate[candCount].refIdx[0] = temporalMv.refIdx[0]; - candidate[candCount].refIdx[1] = temporalMv.refIdx[1]; - candCount++; - } - - // C1 - temporalMv.interDir = 0; -#if JVET_N0266_SMALL_BLOCKS - existMV = getColocatedMVP( pu, REF_PIC_LIST_0, posC1, cColMv, refIdx ); -#else - existMV = isAvailableC1 && getColocatedMVP(pu, REF_PIC_LIST_0, posC1, cColMv, refIdx ); -#endif - if( existMV ) - { - temporalMv.isInter = true; - temporalMv.interDir |= 1; - temporalMv.mv[0] = cColMv; - temporalMv.refIdx[0] = refIdx; - } -#if JVET_N0266_SMALL_BLOCKS - existMV = getColocatedMVP( pu, REF_PIC_LIST_1, posC1, cColMv, refIdx ); -#else - existMV = isAvailableC1 && getColocatedMVP(pu, REF_PIC_LIST_1, posC1, cColMv, refIdx ); -#endif - if( existMV ) - { - temporalMv.interDir |= 2; - temporalMv.mv[1] = cColMv; - temporalMv.refIdx[1] = refIdx; - } - - if( temporalMv.interDir != 0 ) - { - candidate[candCount].isInter = true; - candidate[candCount].interDir = temporalMv.interDir; - candidate[candCount].mv[0] = temporalMv.mv[0]; - candidate[candCount].mv[1] = temporalMv.mv[1]; - candidate[candCount].refIdx[0] = temporalMv.refIdx[0]; - candidate[candCount].refIdx[1] = temporalMv.refIdx[1]; - candCount++; - } - } - // put uni-prediction candidate to the triangle candidate list - for( int32_t i = 0; i < candCount; i++ ) - { - if( candidate[i].interDir != 3 ) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = candidate[i].interDir; - triangleMrgCtx.mrgTypeNeighbours [triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].mv = candidate[i].mv[0]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].mv = candidate[i].mv[1]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].refIdx = candidate[i].refIdx[0]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].refIdx = candidate[i].refIdx[1]; - triangleMrgCtx.numValidMergeCand += isUniqueTriangleCandidates(pu, triangleMrgCtx); - if( triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS ) - { - return; - } - } - } - - // put L0 mv of bi-prediction candidate to the triangle candidate list - for( int32_t i = 0; i < candCount; i++ ) - { - if( candidate[i].interDir == 3 ) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1; - triangleMrgCtx.mrgTypeNeighbours [triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].mv = candidate[i].mv[0]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].refIdx = candidate[i].refIdx[0]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].refIdx = -1; - triangleMrgCtx.numValidMergeCand += isUniqueTriangleCandidates(pu, triangleMrgCtx); - if( triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS ) - { - return; - } - } - } - - // put L1 mv of bi-prediction candidate to the triangle candidate list - for( int32_t i = 0; i < candCount; i++ ) - { - if( candidate[i].interDir == 3 ) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 2; - triangleMrgCtx.mrgTypeNeighbours [triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].mv = candidate[i].mv[1]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].refIdx = -1; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].refIdx = candidate[i].refIdx[1]; - triangleMrgCtx.numValidMergeCand += isUniqueTriangleCandidates(pu, triangleMrgCtx); - if( triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS ) - { - return; - } - } - } - - // put average of L0 and L1 mvs of bi-prediction candidate to the triangle candidate list - for( int32_t i = 0; i < candCount; i++ ) - { - if( candidate[i].interDir == 3 ) - { - int32_t curPicPoc = slice.getPOC(); - int32_t refPicPocL0 = slice.getRefPOC(REF_PIC_LIST_0, candidate[i].refIdx[0]); - int32_t refPicPocL1 = slice.getRefPOC(REF_PIC_LIST_1, candidate[i].refIdx[1]); - Mv aveMv = candidate[i].mv[1]; - int32_t distscale = xGetDistScaleFactor( curPicPoc, refPicPocL0, curPicPoc, refPicPocL1 ); - if( distscale != 4096 ) - { - aveMv = aveMv.scaleMv( distscale ); // scaling to L0 - } - aveMv = aveMv + candidate[i].mv[0]; - roundAffineMv(aveMv.hor, aveMv.ver, 1); - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1; - triangleMrgCtx.mrgTypeNeighbours [triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].mv = aveMv; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].mv = Mv(0, 0); - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) ].refIdx = candidate[i].refIdx[0]; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1].refIdx = -1; - triangleMrgCtx.numValidMergeCand += isUniqueTriangleCandidates(pu, triangleMrgCtx); - if( triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS ) - { - return; - } - } - } - - // fill with Mv(0, 0) - int32_t numRefIdx = std::min( slice.getNumRefIdx(REF_PIC_LIST_0), slice.getNumRefIdx(REF_PIC_LIST_1) ); - int32_t cnt = 0; - while( triangleMrgCtx.numValidMergeCand < TRIANGLE_MAX_NUM_UNI_CANDS ) - { - if( cnt < numRefIdx ) - { - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1; - triangleMrgCtx.mvFieldNeighbours[triangleMrgCtx.numValidMergeCand << 1].setMvField(Mv(0, 0), cnt); - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + 1].refIdx = NOT_VALID; - triangleMrgCtx.mvFieldNeighbours[(triangleMrgCtx.numValidMergeCand << 1) + 1].mv = Mv(); - triangleMrgCtx.numValidMergeCand++; - - if( triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS ) - { - return; - } - - triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 2; - triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1 ].setMvField(Mv(0, 0), cnt); - triangleMrgCtx.mvFieldNeighbours[triangleMrgCtx.numValidMergeCand << 1].refIdx = NOT_VALID; - triangleMrgCtx.mvFieldNeighbours[triangleMrgCtx.numValidMergeCand << 1].mv = Mv(); - triangleMrgCtx.numValidMergeCand++; - - cnt = (cnt + 1) % numRefIdx; - } - } -#endif } bool PU::isUniqueTriangleCandidates( const PredictionUnit &pu, MergeCtx& triangleMrgCtx ) @@ -5360,35 +4174,11 @@ int CU::getMaxNeighboriMVCandNum( const CodingStructure& cs, const Position& pos int maxImvNumCand = 0; // Get BCBP of left PU -#if JVET_N0857_TILES_BRICKS -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit *cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), pos, cs.slice->getIndependentSliceIdx(), cs.picture->brickMap->getBrickIdxRsMap( pos ), CH_L ); -#else - const CodingUnit *cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), cs.slice->getIndependentSliceIdx(), cs.picture->brickMap->getBrickIdxRsMap( pos ), CH_L ); -#endif -#else -#if JVET_N0150_ONE_CTU_DELAY_WPP - const CodingUnit *cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), pos, cs.slice->getIndependentSliceIdx(), cs.picture->tileMap->getTileIdxMap( pos ), CH_L ); -#else - const CodingUnit *cuLeft = cs.getCURestricted( pos.offset( -1, 0 ), cs.slice->getIndependentSliceIdx(), cs.picture->tileMap->getTileIdxMap( pos ), CH_L ); -#endif -#endif maxImvNumCand = ( cuLeft ) ? cuLeft->imvNumCand : numDefault; // Get BCBP of above PU -#if JVET_N0857_TILES_BRICKS -#if JVET_N0150_ONE_CTU_DELAY_WPP const CodingUnit *cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), pos, cs.slice->getIndependentSliceIdx(), cs.picture->brickMap->getBrickIdxRsMap( pos ), CH_L ); -#else - const CodingUnit *cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), cs.slice->getIndependentSliceIdx(), cs.picture->brickMap->getBrickIdxRsMap( pos ), CH_L ); -#endif -#else -#if JVET_N0150_ONE_CTU_DELAY_WPP - const CodingUnit *cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), pos, cs.slice->getIndependentSliceIdx(), cs.picture->tileMap->getTileIdxMap( pos ), CH_L ); -#else - const CodingUnit *cuAbove = cs.getCURestricted( pos.offset( 0, -1 ), cs.slice->getIndependentSliceIdx(), cs.picture->tileMap->getTileIdxMap( pos ), CH_L ); -#endif -#endif maxImvNumCand = std::max( maxImvNumCand, ( cuAbove ) ? cuAbove->imvNumCand : numDefault ); return maxImvNumCand; @@ -5629,7 +4419,6 @@ uint8_t CU::deriveGbiIdx( uint8_t gbiLO, uint8_t gbiL1 ) } } -#if JVET_N0413_RDPCM bool CU::bdpcmAllowed( const CodingUnit& cu, const ComponentID compID ) { bool bdpcmAllowed = compID == COMPONENT_Y; @@ -5638,7 +4427,6 @@ bool CU::bdpcmAllowed( const CodingUnit& cu, const ComponentID compID ) return bdpcmAllowed; } -#endif // TU tools bool TU::isNonTransformedResidualRotated(const TransformUnit &tu, const ComponentID &compID) @@ -5672,9 +4460,7 @@ bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) tsAllowed &= tu.cs->pps->getUseTransformSkip(); tsAllowed &= !tu.cu->transQuantBypass; tsAllowed &= ( !tu.cu->ispMode || !isLuma(compID) ); -#if JVET_N0413_RDPCM tsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= BDPCM_MAX_CU_SIZE && tu.lheight() <= BDPCM_MAX_CU_SIZE ); -#endif SizeType transformSkipMaxSize = 1 << maxSize; tsAllowed &= tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize; tsAllowed &= !tu.cu->sbtInfo; @@ -5691,9 +4477,7 @@ bool TU::isMTSAllowed(const TransformUnit &tu, const ComponentID compID) mtsAllowed &= ( tu.lwidth() <= maxSize && tu.lheight() <= maxSize ); mtsAllowed &= !tu.cu->ispMode; mtsAllowed &= !tu.cu->sbtInfo; -#if JVET_N0413_RDPCM mtsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= BDPCM_MAX_CU_SIZE && tu.lheight() <= BDPCM_MAX_CU_SIZE ); -#endif return mtsAllowed; } @@ -5715,61 +4499,6 @@ uint32_t TU::getGolombRiceStatisticsIndex(const TransformUnit &tu, const Compone return selectedIndex; } -#if HEVC_USE_MDCS -uint32_t TU::getCoefScanIdx(const TransformUnit &tu, const ComponentID &compID) -{ - //------------------------------------------------ - - //this mechanism is available for intra only - - if( !CU::isIntra( *tu.cu ) ) - { - return SCAN_DIAG; - } - - //------------------------------------------------ - - //check that MDCS can be used for this TU - - - const CompArea &area = tu.blocks[compID]; - const SPS &sps = *tu.cs->sps; - const ChromaFormat format = sps.getChromaFormatIdc(); - - - const uint32_t maximumWidth = MDCS_MAXIMUM_WIDTH >> getComponentScaleX(compID, format); - const uint32_t maximumHeight = MDCS_MAXIMUM_HEIGHT >> getComponentScaleY(compID, format); - - if ((area.width > maximumWidth) || (area.height > maximumHeight)) - { - return SCAN_DIAG; - } - - //------------------------------------------------ - - //otherwise, select the appropriate mode - - const PredictionUnit &pu = *tu.cs->getPU( area.pos(), toChannelType( compID ) ); - - uint32_t uiDirMode = PU::getFinalIntraMode(pu, toChannelType(compID)); - - //------------------ - - if (abs((int) uiDirMode - VER_IDX) <= MDCS_ANGLE_LIMIT) - { - return SCAN_HOR; - } - else if (abs((int) uiDirMode - HOR_IDX) <= MDCS_ANGLE_LIMIT) - { - return SCAN_VER; - } - else - { - return SCAN_DIAG; - } -} - -#endif bool TU::hasCrossCompPredInfo( const TransformUnit &tu, const ComponentID &compID ) { return (isChroma(compID) && tu.cs->pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf(tu, COMPONENT_Y) && @@ -5781,11 +4510,7 @@ uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma uint32_t count = 0; for( uint32_t i = 0; i < ::getNumberValidTBlocks( *tu.cs->pcv ); i++ ) { -#if JVET_N0193_LFNST if( tu.blocks[ i ].valid() && tu.mtsIdx != MTS_SKIP && TU::getCbf( tu, ComponentID( i ) ) ) -#else - if( tu.blocks[i].valid() && ( isLuma(ComponentID(i)) ? tu.mtsIdx !=MTS_SKIP : true ) && TU::getCbf( tu, ComponentID( i ) ) ) -#endif { if( isLuma ( tu.blocks[i].compID ) && !bLuma ) continue; if( isChroma( tu.blocks[i].compID ) && !bChroma ) continue; @@ -5801,7 +4526,6 @@ uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma return count; } -#if JVET_N0193_LFNST uint32_t TU::getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit& tu, const bool lumaFlag, const bool chromaFlag ) { const uint32_t lumaWidth = tu.blocks[ 0 ].width, chromaWidth = tu.blocks[ 1 ].width; @@ -5843,7 +4567,6 @@ uint32_t TU::getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit& tu, const b } return count; } -#endif bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID ) { @@ -5852,22 +4575,11 @@ bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID ) return (!isTransformSkip) && (((g_aucLog2[size.width] + g_aucLog2[size.height]) & 1) == 1); } -#if HM_QTBT_AS_IN_JEM_QUANT bool TU::needsBlockSizeTrafoScale( const TransformUnit &tu, const ComponentID &compID ) { return needsSqrt2Scale( tu, compID ) || isNonLog2BlockSize( tu.blocks[compID] ); } -#else -bool TU::needsQP3Offset(const TransformUnit &tu, const ComponentID &compID) -{ - if( !tu.transformSkip[compID] ) - { - return ( ( ( g_aucLog2[tu.blocks[compID].width] + g_aucLog2[tu.blocks[compID].height] ) & 1 ) == 1 ); - } - return false; -} -#endif TransformUnit* TU::getPrevTU( const TransformUnit &tu, const ComponentID compID ) @@ -5888,40 +4600,6 @@ bool TU::getPrevTuCbfAtDepth( const TransformUnit ¤tTu, const ComponentID return ( prevTU != nullptr ) ? TU::getCbfAtDepth( *prevTU, compID, trDepth ) : false; } -#if !JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP -void TU::getTransformTypeISP( const TransformUnit &tu, const ComponentID compID, int &typeH, int &typeV ) -{ - typeH = DCT2, typeV = DCT2; - const int uiChFinalMode = PU::getFinalIntraMode( *tu.cu->firstPU, toChannelType( compID ) ); - bool intraModeIsEven = uiChFinalMode % 2 == 0; - - if( uiChFinalMode == DC_IDX || uiChFinalMode == 33 || uiChFinalMode == 35 ) - { - typeH = DCT2; - typeV = typeH; - } - else if( uiChFinalMode == PLANAR_IDX || ( uiChFinalMode >= 31 && uiChFinalMode <= 37 ) ) - { - typeH = DST7; - typeV = typeH; - } - else if( ( intraModeIsEven && uiChFinalMode >= 2 && uiChFinalMode <= 30 ) || ( !intraModeIsEven && uiChFinalMode >= 39 && uiChFinalMode <= 65 ) ) - { - typeH = DST7; - typeV = DCT2; - } - else if( ( !intraModeIsEven && uiChFinalMode >= 3 && uiChFinalMode <= 29 ) || ( intraModeIsEven && uiChFinalMode >= 38 && uiChFinalMode <= 66 ) ) - { - typeH = DCT2; - typeV = DST7; - } - //Size restriction for non-DCT-II transforms - Area tuArea = tu.blocks[compID]; - typeH = tuArea.width <= 2 || tuArea.width >= 32 ? DCT2 : typeH; - typeV = tuArea.height <= 2 || tuArea.height >= 32 ? DCT2 : typeV; -} - -#endif // other tools @@ -5930,7 +4608,6 @@ uint32_t getCtuAddr( const Position& pos, const PreCalcValues& pcv ) return ( pos.x >> pcv.maxCUWidthLog2 ) + ( pos.y >> pcv.maxCUHeightLog2 ) * pcv.widthInCtus; } -#if JVET_N0217_MATRIX_INTRAPRED int getNumModesMip(const Size& block) { if (block.width > (4 * block.height) || block.height > (4 * block.width)) @@ -5962,7 +4639,6 @@ bool mipModesAvailable(const Size& block) { return (getNumModesMip(block)); } -#endif diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index e82e7268f3550e0c1b07209d11dede6bba3a1e6a..edfbb8f1ea65e9f35c9589dceecb46c875c6682e 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -78,20 +78,14 @@ namespace CU PartSplit getSplitAtDepth (const CodingUnit& cu, const unsigned depth); bool hasNonTsCodedBlock (const CodingUnit& cu); -#if JVET_N0193_LFNST uint32_t getNumNonZeroCoeffNonTs ( const CodingUnit& cu, const bool lumaFlag = true, const bool chromaFlag = true ); uint32_t getNumNonZeroCoeffNonTsCorner8x8( const CodingUnit& cu, const bool lumaFlag = true, const bool chromaFlag = true ); -#else - uint32_t getNumNonZeroCoeffNonTs (const CodingUnit& cu); -#endif bool isGBiIdxCoded (const CodingUnit& cu); uint8_t getValidGbiIdx (const CodingUnit& cu); void setGbiIdx (CodingUnit& cu, uint8_t uh); uint8_t deriveGbiIdx (uint8_t gbiLO, uint8_t gbiL1); -#if JVET_N0413_RDPCM bool bdpcmAllowed (const CodingUnit& cu, const ComponentID compID); -#endif bool divideTuInRows ( const CodingUnit &cu ); @@ -130,18 +124,14 @@ namespace PU { int getLMSymbolList(const PredictionUnit &pu, int *pModeList); int getIntraMPMs(const PredictionUnit &pu, unsigned *mpm, const ChannelType &channelType = CHANNEL_TYPE_LUMA); -#if JVET_N0217_MATRIX_INTRAPRED bool isMIP (const PredictionUnit &pu, const ChannelType &chType = CHANNEL_TYPE_LUMA); int getMipMPMs (const PredictionUnit &pu, unsigned *mpm); int getMipSizeId (const PredictionUnit &pu); uint32_t getIntraDirLuma (const PredictionUnit &pu); AvailableInfo getAvailableInfoLuma (const PredictionUnit &pu); -#endif void getIntraChromaCandModes (const PredictionUnit &pu, unsigned modeList[NUM_CHROMA_MODE]); uint32_t getFinalIntraMode (const PredictionUnit &pu, const ChannelType &chType); -#if JVET_N0193_LFNST int getWideAngIntraMode ( const TransformUnit &tu, const uint32_t dirMode, const ComponentID compID ); -#endif void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, int mmvdList, const int& mrgCandIdx = -1 ); @@ -172,17 +162,11 @@ namespace PU bool isBipredRestriction (const PredictionUnit &pu); void spanMotionInfo ( PredictionUnit &pu, const MergeCtx &mrgCtx = MergeCtx() ); void applyImv ( PredictionUnit &pu, MergeCtx &mrgCtx, InterPrediction *interPred = NULL ); -#if JVET_N0481_BCW_CONSTRUCTED_AFFINE void getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], int8_t neighGbi[4], bool isAvailable[4], int verIdx[4], int modelIdx, int verNum, AffineMergeCtx& affMrgCtx); -#else - void getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], bool isAvailable[4], int verIdx[4], int modelIdx, int verNum, AffineMergeCtx& affMrgCtx ); -#endif void getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx, const int mrgCandIdx = -1 ); void setAllAffineMvField ( PredictionUnit &pu, MvField *mvField, RefPicList eRefList ); void setAllAffineMv ( PredictionUnit &pu, Mv affLT, Mv affRT, Mv affLB, RefPicList eRefList -#if JVET_N0334_MVCLIPPING , bool clipCPMVs = false -#endif ); bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count , int mmvdList @@ -196,20 +180,13 @@ namespace PU bool isLMCMode ( unsigned mode); bool isLMCModeEnabled (const PredictionUnit &pu, unsigned mode); bool isChromaIntraModeCrossCheckMode(const PredictionUnit &pu); -#if !JVET_N0302_SIMPLFIED_CIIP - int getMHIntraMPMs (const PredictionUnit &pu, unsigned *mpm, const ChannelType &channelType = CHANNEL_TYPE_LUMA, const bool isChromaMDMS = false, const unsigned startIdx = 0); -#endif int getNarrowShape (const int width, const int height); void getTriangleMergeCandidates (const PredictionUnit &pu, MergeCtx &triangleMrgCtx); bool isUniqueTriangleCandidates (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); -#if JVET_N0329_IBC_SEARCH_IMP bool isAddNeighborMv (const Mv& currMv, Mv* neighborMvs, int numNeighborMv); void getIbcMVPsEncOnly(PredictionUnit &pu, Mv* mvPred, int& nbPred); -#else - void getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred); -#endif bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); bool isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xStartInCU, int yStartInCU, int xBv, int yBv, int ctuSize); bool checkDMVRCondition(const PredictionUnit& pu); @@ -219,9 +196,7 @@ namespace PU namespace TU { uint32_t getNumNonZeroCoeffsNonTS (const TransformUnit &tu, const bool bLuma = true, const bool bChroma = true); -#if JVET_N0193_LFNST uint32_t getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit &tu, const bool bLuma = true, const bool bChroma = true ); -#endif bool isNonTransformedResidualRotated(const TransformUnit &tu, const ComponentID &compID); bool getCbf (const TransformUnit &tu, const ComponentID &compID); bool getCbfAtDepth (const TransformUnit &tu, const ComponentID &compID, const unsigned &depth); @@ -229,38 +204,23 @@ namespace TU bool isTSAllowed (const TransformUnit &tu, const ComponentID compID); bool isMTSAllowed (const TransformUnit &tu, const ComponentID compID); uint32_t getGolombRiceStatisticsIndex (const TransformUnit &tu, const ComponentID &compID); -#if HEVC_USE_MDCS - uint32_t getCoefScanIdx (const TransformUnit &tu, const ComponentID &compID); -#endif bool hasCrossCompPredInfo (const TransformUnit &tu, const ComponentID &compID); bool needsSqrt2Scale ( const TransformUnit &tu, const ComponentID &compID ); -#if HM_QTBT_AS_IN_JEM_QUANT bool needsBlockSizeTrafoScale ( const TransformUnit &tu, const ComponentID &compID ); -#else - bool needsQP3Offset (const TransformUnit &tu, const ComponentID &compID); -#endif TransformUnit* getPrevTU ( const TransformUnit &tu, const ComponentID compID ); bool getPrevTuCbfAtDepth( const TransformUnit &tu, const ComponentID compID, const int trDepth ); -#if !JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP - void getTransformTypeISP( const TransformUnit &tu, const ComponentID compID, int &typeH, int &typeV ); -#endif } uint32_t getCtuAddr (const Position& pos, const PreCalcValues &pcv); -#if JVET_N0217_MATRIX_INTRAPRED int getNumModesMip (const Size& block); int getNumEpBinsMip (const Size& block); bool mipModesAvailable(const Size& block); -#endif template uint32_t updateCandList(T uiMode, double uiCost, static_vector& candModeList, static_vector& candCostList -#if !JVET_N0217_MATRIX_INTRAPRED - , static_vector& extendRefList, int extendRef -#endif , size_t uiFastCandNum = N, int* iserttPos = nullptr) { CHECK( std::min( uiFastCandNum, candModeList.size() ) != std::min( uiFastCandNum, candCostList.size() ), "Sizes do not match!" ); @@ -281,21 +241,9 @@ uint32_t updateCandList(T uiMode, double uiCost, static_vector& candModeLi { candModeList[currSize - i] = candModeList[currSize - 1 - i]; candCostList[currSize - i] = candCostList[currSize - 1 - i]; -#if !JVET_N0217_MATRIX_INTRAPRED - if (extendRef != -1) - { - extendRefList[currSize - i] = extendRefList[currSize - 1 - i]; - } -#endif } candModeList[currSize - shift] = uiMode; candCostList[currSize - shift] = uiCost; -#if !JVET_N0217_MATRIX_INTRAPRED - if (extendRef != -1) - { - extendRefList[currSize - shift] = extendRef; - } -#endif if (iserttPos != nullptr) { *iserttPos = int(currSize - shift); @@ -306,12 +254,6 @@ uint32_t updateCandList(T uiMode, double uiCost, static_vector& candModeLi { candModeList.insert( candModeList.end() - shift, uiMode ); candCostList.insert( candCostList.end() - shift, uiCost ); -#if !JVET_N0217_MATRIX_INTRAPRED - if (extendRef != -1) - { - extendRefList.insert(extendRefList.end() - shift, extendRef); - } -#endif if (iserttPos != nullptr) { *iserttPos = int(candModeList.size() - shift - 1); diff --git a/source/Lib/CommonLib/WeightPrediction.cpp b/source/Lib/CommonLib/WeightPrediction.cpp index 6a645952d4a6ce6aa898327960ab83f63e6b31a4..007fb08fc5a487d02b8c18df6826acc73719dfe3 100644 --- a/source/Lib/CommonLib/WeightPrediction.cpp +++ b/source/Lib/CommonLib/WeightPrediction.cpp @@ -215,7 +215,6 @@ void WeightPrediction::addWeightBi(const CPelUnitBuf &pcYuvSrc0, } // compID loop } -#if JVET_N0146_DMVR_BDOF_CONDITION void WeightPrediction::addWeightBiComponent(const CPelUnitBuf &pcYuvSrc0, const CPelUnitBuf &pcYuvSrc1, const ClpRngs &clpRngs, @@ -271,7 +270,6 @@ void WeightPrediction::addWeightBiComponent(const CPelUnitBuf &pcYuvSrc dst += dstStride; } // y loop } -#endif void WeightPrediction::addWeightUni(const CPelUnitBuf &pcYuvSrc0, const ClpRngs &clpRngs, @@ -409,9 +407,7 @@ void WeightPrediction::xWeightedPredictionBi(const PredictionUnit &pu, CHECK( !pu.cs->pps->getWPBiPred(), "Weighted Bi-prediction disabled" ); -#if JVET_N0146_DMVR_BDOF_CONDITION if (iRefIdx0 < 0 && iRefIdx1 < 0) return; -#endif getWpScaling(pu.cu->slice, iRefIdx0, iRefIdx1, pwp0, pwp1, maxNumComp); diff --git a/source/Lib/CommonLib/WeightPrediction.h b/source/Lib/CommonLib/WeightPrediction.h index 86671665fbb0281d99f56961040e69e2b334b8aa..a038dd2571dbbe69de1b33f475b6ed05e5bfb31c 100644 --- a/source/Lib/CommonLib/WeightPrediction.h +++ b/source/Lib/CommonLib/WeightPrediction.h @@ -71,7 +71,6 @@ public: const bool bRoundLuma = true, const ComponentID maxNumComp = MAX_NUM_COMPONENT ); -#if JVET_N0146_DMVR_BDOF_CONDITION void addWeightBiComponent( const CPelUnitBuf &pcYuvSrc0, const CPelUnitBuf &pcYuvSrc1, const ClpRngs &clpRngs, @@ -80,7 +79,6 @@ public: PelUnitBuf &rpcYuvDst, const bool bRoundLuma = true, const ComponentID Comp = COMPONENT_Y); -#endif void addWeightUni( const CPelUnitBuf &pcYuvSrc0, const ClpRngs &clpRngs, diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 6ae216abff14b77b5e425b6aea4820e05c4d3100..d5a82c9d4fe793ebaad6800c65021de8a20e1668 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -437,13 +437,9 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::SkipFlag), cu.skip); } -#if JVET_N0413_RDPCM DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::BDPCM), cu.bdpcmMode); -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::TileIdx), cu.tileIdx); -#if JVET_N0193_LFNST DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::LFNSTIdx), cu.lfnstIdx); -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::MMVDSkipFlag), cu.mmvdSkip); } else if( chType == CHANNEL_TYPE_CHROMA ) @@ -474,9 +470,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MergeFlag), pu.mergeFlag); } -#if JVET_N0324_REGULAR_MRG_FLAG DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::RegularMergeFlag), pu.regularMergeFlag); -#endif if( pu.mergeFlag ) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MergeIdx), pu.mergeIdx); @@ -491,9 +485,6 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::Luma_IntraMode), pu.intraDir[COMPONENT_Y]); } -#if !JVET_N0324_REGULAR_MRG_FLAG - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::TriangleFlag), pu.cu->triangle); -#endif } DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::AffineType), pu.cu->affineType); @@ -682,9 +673,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) if(chType == CHANNEL_TYPE_LUMA) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IPCM), cu.ipcm); -#if JVET_N0217_MATRIX_INTRAPRED DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::MIPFlag), cu.mipFlag); -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::ISPMode), cu.ispMode); } else if(chType == CHANNEL_TYPE_CHROMA) @@ -710,9 +699,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) { const uint32_t uiChFinalMode = PU::getFinalIntraMode( pu, ChannelType( chType ) ); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::Chroma_IntraMode), uiChFinalMode); -#if JVET_N0671_CHROMA_FORMAT_422 assert(0); -#endif //JVET_N0671_CHROMA_FORMAT_422 } } } @@ -731,12 +718,10 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Y), tu.cbf[COMPONENT_Y]); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::MTSIdx), tu.mtsIdx); } -#if JVET_N0054_JOINT_CHROMA if ( tu.Cb().valid() ) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::JointCbCr), tu.jointCbCr); } -#endif if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==MTS_SKIP || cu.transQuantBypass ) ) { @@ -904,13 +889,6 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) } } } -#if !JVET_N0324_REGULAR_MRG_FLAG - if (cu.cs->slice->getSPS()->getUseTriangle() && cu.cs->slice->isInterB() && cu.lwidth() * cu.lheight() >= TRIANGLE_MIN_SIZE && !cu.affine) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TriangleFlag), cu.triangle); - - } -#endif } else { diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index 71f9bf8b71ffe4d2b8bff8bfc25a241de9538923..865b1753a574b89f104420f68b78046c42b81144 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -65,16 +65,10 @@ enum class BlockStatistic { SplitSeries, TransQuantBypassFlag, MTSIdx, -#if JVET_N0413_RDPCM BDPCM, -#endif TileIdx, -#if JVET_N0193_LFNST LFNSTIdx, -#endif -#if JVET_N0054_JOINT_CHROMA JointCbCr, -#endif CompAlphaCb, CompAlphaCr, RDPCM_Y, @@ -86,9 +80,7 @@ enum class BlockStatistic { Luma_IntraMode, Chroma_IntraMode, MultiRefIdx, -#if JVET_N0217_MATRIX_INTRAPRED MIPFlag, -#endif ISPMode, // inter @@ -102,9 +94,7 @@ enum class BlockStatistic { IMVMode, InterDir, MergeFlag, -#if JVET_N0324_REGULAR_MRG_FLAG RegularMergeFlag, -#endif MergeIdx, MergeType, MVPIdxL0, @@ -126,9 +116,6 @@ enum class BlockStatistic { MMVDMergeIdx, MHIntraFlag, SMVDFlag, -#if !JVET_N0324_REGULAR_MRG_FLAG - TriangleFlag, -#endif TrianglePartitioning, TriangleMVL0, //<< currently only uni-prediction enabled TriangleMVL1, //<< currently only uni-prediction enabled @@ -167,9 +154,7 @@ static const std::map{"PredMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_PREDICTION_MODES) + "]"}}, { BlockStatistic::MergeFlag, std::tuple{"MergeFlag", BlockStatisticType::Flag, ""}}, -#if JVET_N0324_REGULAR_MRG_FLAG { BlockStatistic::RegularMergeFlag, std::tuple{"RegularMergeFlag", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::MVL0, std::tuple{"MVL0", BlockStatisticType::Vector, "Scale: 4"}}, { BlockStatistic::MVL1, std::tuple{"MVL1", BlockStatisticType::Vector, "Scale: 4"}}, { BlockStatistic::IPCM, std::tuple{"IPCM", BlockStatisticType::Flag, ""}}, @@ -177,25 +162,17 @@ static const std::map{"Chroma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::SkipFlag, std::tuple{"SkipFlag", BlockStatisticType::Flag, ""}}, { BlockStatistic::MTSIdx, std::tuple{"TransformSkipFlag_Y", BlockStatisticType::Integer, ""}}, -#if JVET_N0413_RDPCM { BlockStatistic::BDPCM, std::tuple{"BDPCM", BlockStatisticType::Flag, ""}}, // called bdpcmMode, but used like a flag in the software? related to intra, but signalled always? -#endif { BlockStatistic::TileIdx, std::tuple{"TileIdx", BlockStatisticType::Integer, ""}}, -#if JVET_N0193_LFNST { BlockStatistic::LFNSTIdx, std::tuple{"LFNSTIdx", BlockStatisticType::Integer, "[0, 3]"}}, -#endif -#if JVET_N0054_JOINT_CHROMA { BlockStatistic::JointCbCr, std::tuple{"JointCbCr", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::CompAlphaCb, std::tuple{"CompAlphaCb", BlockStatisticType::Integer, ""}}, { BlockStatistic::CompAlphaCr, std::tuple{"CompAlphaCr", BlockStatisticType::Integer, ""}}, { BlockStatistic::RDPCM_Y, std::tuple{"RDPCM_Y", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}}, { BlockStatistic::RDPCM_Cb, std::tuple{"RDPCM_Cb", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}}, { BlockStatistic::RDPCM_Cr, std::tuple{"RDPCM_Cr", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}}, -#if JVET_N0217_MATRIX_INTRAPRED { BlockStatistic::MIPFlag, std::tuple{"MIPFlag", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::ISPMode, std::tuple{"ISPMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_SUBPARTITIONS_MODES) + "]"}}, { BlockStatistic::Depth, std::tuple{"Depth", BlockStatisticType::Integer, "[0, 7]"}}, { BlockStatistic::QT_Depth, std::tuple{"QT_Depth", BlockStatisticType::Integer, "[0, 7]"}}, @@ -233,9 +210,6 @@ static const std::map{"MMVDMergeIdx", BlockStatisticType::Integer, "[0, 1]"}}, { BlockStatistic::MHIntraFlag, std::tuple{"MHIntraFlag", BlockStatisticType::Flag, ""}}, { BlockStatistic::SMVDFlag, std::tuple{"SMVDFlag", BlockStatisticType::Flag, ""}}, -#if !JVET_N0324_REGULAR_MRG_FLAG - { BlockStatistic::TriangleFlag, std::tuple{"TriangleFlag", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::TrianglePartitioning, std::tuple{"TrianglePartitioning", BlockStatisticType::Line, ""}}, { BlockStatistic::TriangleMVL0, std::tuple{"TriangleMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"}}, { BlockStatistic::TriangleMVL1, std::tuple{"TriangleMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"}}, diff --git a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h index 71f42c7d9ccc2a2d267638a803500973027a51b0..dc75192ee5876eebffaf85a7b108b1bfa76672dd 100644 --- a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h +++ b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h @@ -48,19 +48,7 @@ #endif template -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift, int vbCTUHeight, int vbPos) -#else -static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift, int vbCTUHeight, int vbPos) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift) -#else -static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blk, const int shift) -#endif -#endif { const int img_stride = srcLuma.stride; const Pel* srcExt = srcLuma.buf; @@ -88,25 +76,15 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac const Pel *p_imgY_pad_up = &srcExt[yoffset + img_stride]; const Pel *p_imgY_pad_up2 = &srcExt[yoffset + img_stride * 2]; -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION // pixel padding for gradient calculation -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (((blkDst.pos().y - 2 + i) > 0) && ((blkDst.pos().y - 2 + i) % vbCTUHeight) == (vbPos - 2)) -#else - if (((posY - 2 + i) > 0) && ((posY - 2 + i) % vbCTUHeight) == (vbPos - 2)) -#endif { p_imgY_pad_up2 = &srcExt[yoffset + img_stride]; } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND else if (((blkDst.pos().y - 2 + i) > 0) && ((blkDst.pos().y - 2 + i) % vbCTUHeight) == vbPos) -#else - else if (((posY - 2 + i) > 0) && ((posY - 2 + i) % vbCTUHeight) == vbPos) -#endif { p_imgY_pad_down = &srcExt[yoffset]; } -#endif __m128i mmStore = _mm_setzero_si128(); @@ -217,24 +195,15 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac { for( int j = 0; j < blk.width; j += 8 ) { -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION __m128i xmm0, xmm1, xmm2, xmm3; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if ((((i << 1) + blkDst.pos().y) % vbCTUHeight) == (vbPos - 4)) -#else - if ((((i << 1) + posY) % vbCTUHeight) == (vbPos - 4)) -#endif { xmm0 = _mm_loadu_si128((__m128i*)(&(_temp[i + 0][j]))); xmm1 = _mm_loadu_si128((__m128i*)(&(_temp[i + 1][j]))); xmm2 = _mm_loadu_si128((__m128i*)(&(_temp[i + 2][j]))); xmm3 = mm_0; } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND else if ((((i << 1) + blkDst.pos().y) % vbCTUHeight) == vbPos) -#else - else if ((((i << 1) + posY) % vbCTUHeight) == vbPos) -#endif { xmm0 = mm_0; xmm1 = _mm_loadu_si128((__m128i*)(&(_temp[i + 1][j]))); @@ -249,12 +218,6 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac xmm3 = _mm_loadu_si128((__m128i*)(&(_temp[i + 3][j]))); } -#else - __m128i xmm0 = _mm_loadu_si128((__m128i*)(&(_temp[i + 0][j]))); - __m128i xmm1 = _mm_loadu_si128((__m128i*)(&(_temp[i + 1][j]))); - __m128i xmm2 = _mm_loadu_si128((__m128i*)(&(_temp[i + 2][j]))); - __m128i xmm3 = _mm_loadu_si128((__m128i*)(&(_temp[i + 3][j]))); -#endif __m128i xmm4 = _mm_add_epi16( xmm0, xmm1 ); __m128i xmm6 = _mm_add_epi16( xmm2, xmm3 ); @@ -270,12 +233,7 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac __m128i xmm12 = _mm_blend_epi16( xmm4, _mm_shuffle_epi32( xmm0, 0x40 ), 0xF0 ); __m128i xmm10 = _mm_shuffle_epi32( xmm12, 0xB1 ); xmm12 = _mm_add_epi32( xmm10, xmm12 ); -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if (((((i << 1) + blkDst.pos().y) % vbCTUHeight) == (vbPos - 4)) || ((((i << 1) + blkDst.pos().y) % vbCTUHeight) == vbPos)) -#else - if (((((i << 1) + posY) % vbCTUHeight) == (vbPos - 4)) || ((((i << 1) + posY) % vbCTUHeight) == vbPos)) -#endif { xmm12 = _mm_srai_epi32(_mm_add_epi32(_mm_slli_epi32(xmm12, 5), _mm_slli_epi32(xmm12, 6)), shift); } @@ -283,9 +241,6 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac { xmm12 = _mm_srai_epi32(xmm12, shift - 6); } -#else - xmm12 = _mm_srai_epi32(xmm12, shift - 6); -#endif xmm12 = _mm_min_epi32( xmm12, xmm13 ); xmm12 = _mm_and_si128( xmm12, mm_15 ); @@ -378,13 +333,8 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac int classIdx0 = c0; int classIdx1 = c1; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND const int yOffset = (i << 1) + blkDst.pos().y; const int xOffset = j + blkDst.pos().x; -#else - const int yOffset = ( i << 1 ) + posY; - const int xOffset = j + posX; -#endif AlfClassifier *cl0 = classifier[yOffset] + xOffset; AlfClassifier *cl1 = classifier[yOffset + 1] + xOffset; @@ -403,42 +353,8 @@ static void simdDeriveClassificationBlk(AlfClassifier** classifier, int** laplac } template -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#else -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#else -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs) -#else -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs) -#else -static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs) -#endif -#endif -#endif { -#if !JVET_N0242_NON_LINEAR_ALF - static const unsigned char mask05[16] = { 8, 9, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - static const unsigned char mask03[16] = { 4, 5, 2, 3, 0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - static const unsigned char mask_c[16] = { 0, 1, 8, 9, 4, 5, 14, 15, 2, 3, 10, 11, 12, 13, 6, 7 }; - -#endif const bool bChroma = isChroma( compId ); const SPS* sps = cs.slice->getSPS(); @@ -452,16 +368,6 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs const int srcStride = srcLuma.stride; const int dstStride = dstLuma.stride; -#if !JVET_N0242_NON_LINEAR_ALF - const Pel* srcExt = srcLuma.buf; - Pel* dst = dstLuma.buf; - - const Pel *pImgYPad0, *pImgYPad1, *pImgYPad2, *pImgYPad3, *pImgYPad4, *pImgYPad5; - - short *coef = filterSet; - const Pel *pImg0, *pImg1, *pImg2, *pImg3, *pImg4, *pImg5; - -#endif const int numBitsMinus1 = AdaptiveLoopFilter::m_NUM_BITS - 1; const int offset = ( 1 << ( AdaptiveLoopFilter::m_NUM_BITS - 2 ) ); @@ -470,13 +376,8 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs const int startWidth = blk.x; const int endWidth = blk.x + blk.width; -#if JVET_N0242_NON_LINEAR_ALF const Pel* src = srcLuma.buf; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Pel* dst = dstLuma.buf + blkDst.y * dstStride; -#else - Pel* dst = dstLuma.buf + startHeight * dstStride; -#endif const Pel *pImgYPad0, *pImgYPad1, *pImgYPad2, *pImgYPad3, *pImgYPad4; const Pel *pImg0, *pImg1, *pImg2, *pImg3, *pImg4; @@ -485,119 +386,48 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs short *clip[2] = { fClipSet, fClipSet }; int transposeIdx[2] = {0, 0}; -#else - Pel* imgYRecPost = dst; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - imgYRecPost += blkDst.y * dstStride; -#else - imgYRecPost += startHeight * dstStride; -#endif - - int transposeIdx = 0; - -#endif const int clsSizeY = 4; const int clsSizeX = 4; -#if JVET_N0242_NON_LINEAR_ALF bool pcmFlags2x2[8] = {0,0,0,0,0,0,0,0}; Pel pcmRec2x2[32]; -#else - bool pcmFlags2x2[4] = {0,0,0,0}; - Pel pcmRec2x2[16]; -#endif CHECK( startHeight % clsSizeY, "Wrong startHeight in filtering" ); CHECK( startWidth % clsSizeX, "Wrong startWidth in filtering" ); CHECK( ( endHeight - startHeight ) % clsSizeY, "Wrong endHeight in filtering" ); CHECK( ( endWidth - startWidth ) % clsSizeX, "Wrong endWidth in filtering" ); -#if !JVET_N0242_NON_LINEAR_ALF - const Pel* imgYRec = srcExt; - - Pel *pRec; -#endif AlfClassifier *pClass = nullptr; -#if JVET_N0242_NON_LINEAR_ALF int dstStride2 = dstStride * clsSizeY; -#endif int srcStride2 = srcStride * clsSizeY; const __m128i mmOffset = _mm_set1_epi32( offset ); -#if JVET_N0242_NON_LINEAR_ALF const __m128i mmMin = _mm_set1_epi16( clpRng.min ); const __m128i mmMax = _mm_set1_epi16( clpRng.max ); -#else - const __m128i mmMin = _mm_set1_epi32( clpRng.min ); - const __m128i mmMax = _mm_set1_epi32( clpRng.max ); -#endif -#if JVET_N0242_NON_LINEAR_ALF const unsigned char *filterCoeffIdx[2]; Pel filterCoeff[MAX_NUM_ALF_LUMA_COEFF][2]; Pel filterClipp[MAX_NUM_ALF_LUMA_COEFF][2]; pImgYPad0 = src + startHeight * srcStride + startWidth; -#else - const __m128i xmm10 = _mm_loadu_si128( ( __m128i* )mask03 ); - const __m128i mm_mask05 = _mm_loadu_si128( ( __m128i* )mask05 ); - - pImgYPad0 = imgYRec + startHeight * srcStride + startWidth; -#endif pImgYPad1 = pImgYPad0 + srcStride; pImgYPad2 = pImgYPad0 - srcStride; pImgYPad3 = pImgYPad1 + srcStride; pImgYPad4 = pImgYPad2 - srcStride; -#if !JVET_N0242_NON_LINEAR_ALF - pImgYPad5 = pImgYPad3 + srcStride; -#endif -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Pel* pRec0 = dst + blkDst.x; -#else - Pel* pRec0 = dst + startWidth; -#endif Pel* pRec1; -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - pRec = imgYRecPost + blkDst.x; -#else - pRec = imgYRecPost + startWidth; -#endif -#endif -#if JVET_N0242_NON_LINEAR_ALF for( int i = 0; i < endHeight - startHeight; i += clsSizeY ) -#else - for( int i = 0; i < endHeight - startHeight; i += 4 ) -#endif { -#if !JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - pRec = imgYRecPost + blkDst.x + i * dstStride; -#else - pRec = imgYRecPost + startWidth + i * dstStride; -#endif - -#endif if( !bChroma ) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND pClass = classifier[blkDst.y + i] + blkDst.x; -#else - pClass = classifier[startHeight + i] + startWidth; -#endif } -#if JVET_N0242_NON_LINEAR_ALF for( int j = 0; j < endWidth - startWidth; j += 8 ) -#else - for( int j = 0; j < endWidth - startWidth; j += 4 ) -#endif { -#if JVET_N0242_NON_LINEAR_ALF for( int k = 0; k < 2; ++k ) { if( !bChroma ) @@ -649,87 +479,8 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs filterClipp[i][k] = clip[k][filterCoeffIdx[k][i]]; } } -#else - if( !bChroma ) - { - AlfClassifier& cl = pClass[j]; - transposeIdx = cl.transposeIdx; - if( isPCMFilterDisabled && cl.classIdx == AdaptiveLoopFilter::m_ALF_UNUSED_CLASSIDX && transposeIdx == AdaptiveLoopFilter::m_ALF_UNUSED_TRANSPOSIDX ) - { - pRec += 4; - continue; - } - coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; - } - else if ( isPCMFilterDisabled ) - { - int blkX, blkY; - bool *flags = pcmFlags2x2; - Pel *pcmRec = pcmRec2x2; - - // check which chroma 2x2 blocks use PCM - // chroma PCM may not be aligned with 4x4 ALF processing grid - for( blkY=0; blkY<4; blkY+=2 ) - { - for( blkX=0; blkX<4; blkX+=2 ) - { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - Position pos(j + blkDst.x + blkX, i + blkDst.y + blkY); -#else - Position pos(j+startWidth+blkX, i+startHeight+blkY); -#endif - CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); - *flags++ = cu->ipcm ? 1 : 0; - - // save original samples from 2x2 PCM blocks - if( cu->ipcm ) - { - *pcmRec++ = pRec[(blkY+0)*dstStride + (blkX+0)]; - *pcmRec++ = pRec[(blkY+0)*dstStride + (blkX+1)]; - *pcmRec++ = pRec[(blkY+1)*dstStride + (blkX+0)]; - *pcmRec++ = pRec[(blkY+1)*dstStride + (blkX+1)]; - } - } - } - - // skip entire 4x4 if all chroma 2x2 blocks use PCM - if( pcmFlags2x2[0] && pcmFlags2x2[1] && pcmFlags2x2[2] && pcmFlags2x2[3] ) - { - pRec += 4; - continue; - } - } - - __m128i c0, t0 = _mm_setzero_si128(); - - c0 = _mm_loadu_si128( ( __m128i* )( coef + 0 ) ); - c0 = _mm_alignr_epi8( c0, c0, 2 ); - c0 = _mm_blend_epi16( c0, t0, 0x40 ); - - if( transposeIdx & 1 ) - { - c0 = _mm_shuffle_epi8( c0, _mm_loadu_si128( ( __m128i* )mask_c ) ); - } - - if( transposeIdx == 0 || transposeIdx == 1 ) - { - c0 = _mm_shuffle_epi8( c0, xmm10 ); - } - -#endif -#if !JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg0 = pImgYPad0 + j; - pImg1 = pImgYPad1 + j; - pImg2 = pImgYPad2 + j; - pImg3 = pImgYPad3 + j; - pImg4 = pImgYPad4 + j; -#endif -#if !JVET_N0180_ALF_LINE_BUFFER_REDUCTION && !JVET_N0242_NON_LINEAR_ALF - pImg5 = pImgYPad5 + j; -#endif -#if JVET_N0242_NON_LINEAR_ALF pRec1 = pRec0 + j; if ( bChroma && isPCMFilterDisabled ) @@ -744,11 +495,7 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs { for( blkX=0; blkX<8; blkX+=2 ) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Position pos(j + blkDst.x + blkX, i + blkDst.y + blkY); -#else - Position pos(j+startWidth+blkX, i+startHeight+blkY); -#endif CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); if(cu != NULL) { @@ -775,15 +522,11 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs for( int ii = 0; ii < clsSizeY; ii++ ) { -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION pImg0 = pImgYPad0 + j + ii * srcStride; pImg1 = pImgYPad1 + j + ii * srcStride; pImg2 = pImgYPad2 + j + ii * srcStride; pImg3 = pImgYPad3 + j + ii * srcStride; pImg4 = pImgYPad4 + j + ii * srcStride; -#endif -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if ((blkDst.y + i + ii) % vbCTUHeight < vbPos && ((blkDst.y + i + ii) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above { pImg1 = ((blkDst.y + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; @@ -800,25 +543,6 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs pImg1 = ((blkDst.y + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg1; pImg3 = ((blkDst.y + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; } -#else - if ((startHeight + i + ii) % vbCTUHeight < vbPos && ((startHeight + i + ii) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((startHeight + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - - pImg2 = ((startHeight + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - } - else if ((startHeight + i + ii) % vbCTUHeight >= vbPos && ((startHeight + i + ii) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((startHeight + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - - pImg1 = ((startHeight + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - } -#endif -#endif __m128i clipp, clipm; __m128i coeffa, coeffb; __m128i xmmCur = _mm_lddqu_si128( ( __m128i* ) ( pImg0 + 0 ) ); @@ -990,149 +714,7 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs xmmS0 = _mm_blend_epi16( xmmS0, xmmCur, 0xFC ); _mm_storeu_si128( ( __m128i* )( pRec1 ), xmmS0 ); } -#else - for( int k = 0; k < 4; k++ ) - { -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg0 = pImgYPad0 + j + k * srcStride; //j: width, 4x4 block - pImg1 = pImgYPad1 + j + k * srcStride; - pImg2 = pImgYPad2 + j + k * srcStride; - pImg3 = pImgYPad3 + j + k * srcStride; - pImg4 = pImgYPad4 + j + k * srcStride; -#endif -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - if ((blkDst.y + i + k) % vbCTUHeight < vbPos && ((blkDst.y + i + k) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((blkDst.y + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - pImg5 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 3) ? pImg3 : pImg5; - - pImg2 = ((blkDst.y + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - } - else if ((blkDst.y + i + k) % vbCTUHeight >= vbPos && ((blkDst.y + i + k) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((blkDst.y + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - - pImg1 = ((blkDst.y + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - pImg5 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; - } -#else - if ((startHeight + i + k) % vbCTUHeight < vbPos && ((startHeight + i + k) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((startHeight + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 3) ? pImg3 : pImg5; - - pImg2 = ((startHeight + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - } - else if ((startHeight + i + k) % vbCTUHeight >= vbPos && ((startHeight + i + k) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((startHeight + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - - pImg1 = ((startHeight + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; - } -#endif -#endif - __m128i xmm4 = _mm_lddqu_si128( ( __m128i* ) ( pImg4 ) ); - __m128i xmm2 = _mm_lddqu_si128( ( __m128i* ) ( pImg2 - 1 ) ); - __m128i xmm0 = _mm_lddqu_si128( ( __m128i* ) ( pImg0 - 2 ) ); - __m128i xmm1 = _mm_lddqu_si128( ( __m128i* ) ( pImg1 - 1 - 1 ) ); - __m128i xmm3 = _mm_lddqu_si128( ( __m128i* ) ( pImg3 - 0 - 2 ) ); - - __m128i xmm7 = _mm_setzero_si128(); - - __m128i xmm6 = _mm_shuffle_epi8( xmm0, mm_mask05 ); - __m128i xmm8 = _mm_shuffle_epi8( _mm_srli_si128( xmm0, 2 ), mm_mask05 ); - __m128i xmm9 = _mm_shuffle_epi8( _mm_srli_si128( xmm0, 4 ), mm_mask05 ); - __m128i xmm11 = _mm_shuffle_epi8( _mm_srli_si128( xmm0, 6 ), mm_mask05 ); - - xmm6 = _mm_blend_epi16( xmm7, xmm6, 0x03 ); - xmm8 = _mm_blend_epi16( xmm7, xmm8, 0x03 ); - xmm9 = _mm_blend_epi16( xmm7, xmm9, 0x03 ); - xmm11 = _mm_blend_epi16( xmm7, xmm11, 0x03 ); - xmm6 = _mm_add_epi16( xmm6, xmm0 ); - xmm8 = _mm_add_epi16( xmm8, _mm_srli_si128( xmm0, 2 ) ); - xmm9 = _mm_add_epi16( xmm9, _mm_srli_si128( xmm0, 4 ) ); - xmm11 = _mm_add_epi16( xmm11, _mm_srli_si128( xmm0, 6 ) ); - - xmm6 = _mm_slli_si128( xmm6, 6 ); - xmm8 = _mm_slli_si128( xmm8, 6 ); - xmm9 = _mm_slli_si128( xmm9, 6 ); - xmm11 = _mm_slli_si128( xmm11, 6 ); - - xmm4 = _mm_add_epi16( xmm4, _mm_srli_si128( xmm3, 4 ) ); - xmm6 = _mm_blend_epi16( xmm6, _mm_slli_si128( xmm4, 14 ), 0x80 ); - xmm8 = _mm_blend_epi16( xmm8, _mm_slli_si128( xmm4, 12 ), 0x80 ); - xmm9 = _mm_blend_epi16( xmm9, _mm_slli_si128( xmm4, 10 ), 0x80 ); - xmm11 = _mm_blend_epi16( xmm11, _mm_slli_si128( xmm4, 8 ), 0x80 ); - - __m128i xmm12 = _mm_shuffle_epi8( xmm2, xmm10 ); - __m128i xmm13 = _mm_shuffle_epi8( _mm_srli_si128( xmm2, 2 ), xmm10 ); - __m128i xmm14 = _mm_shuffle_epi8( _mm_srli_si128( xmm2, 4 ), xmm10 ); - __m128i xmm15 = _mm_shuffle_epi8( _mm_srli_si128( xmm2, 6 ), xmm10 ); - - xmm12 = _mm_add_epi16( xmm12, _mm_srli_si128( xmm1, 2 ) ); - xmm13 = _mm_add_epi16( xmm13, _mm_srli_si128( xmm1, 4 ) ); - xmm14 = _mm_add_epi16( xmm14, _mm_srli_si128( xmm1, 6 ) ); - xmm15 = _mm_add_epi16( xmm15, _mm_srli_si128( xmm1, 8 ) ); - - xmm6 = _mm_blend_epi16( xmm6, xmm12, 0x07 ); - xmm8 = _mm_blend_epi16( xmm8, xmm13, 0x07 ); - xmm9 = _mm_blend_epi16( xmm9, xmm14, 0x07 ); - xmm11 = _mm_blend_epi16( xmm11, xmm15, 0x07 ); - - xmm6 = _mm_madd_epi16( xmm6, c0 ); - xmm8 = _mm_madd_epi16( xmm8, c0 ); - xmm9 = _mm_madd_epi16( xmm9, c0 ); - xmm11 = _mm_madd_epi16( xmm11, c0 ); - - xmm12 = _mm_shuffle_epi32( xmm6, 0x1B ); - xmm13 = _mm_shuffle_epi32( xmm8, 0x1B ); - xmm14 = _mm_shuffle_epi32( xmm9, 0x1B ); - xmm15 = _mm_shuffle_epi32( xmm11, 0x1B ); - - xmm6 = _mm_add_epi32( xmm6, xmm12 ); - xmm8 = _mm_add_epi32( xmm8, xmm13 ); - xmm9 = _mm_add_epi32( xmm9, xmm14 ); - xmm11 = _mm_add_epi32( xmm11, xmm15 ); - - xmm6 = _mm_blend_epi16( xmm6, xmm8, 0xF0 ); - xmm9 = _mm_blend_epi16( xmm9, xmm11, 0xF0 ); - - xmm12 = _mm_hadd_epi32( xmm6, xmm9 ); - - xmm12 = _mm_add_epi32( xmm12, mmOffset ); - xmm12 = _mm_srai_epi32( xmm12, numBitsMinus1 ); - - xmm12 = _mm_min_epi32( mmMax, _mm_max_epi32( xmm12, mmMin ) ); - - xmm12 = _mm_packus_epi32( xmm12, xmm12 ); - - _mm_storel_epi64( ( __m128i* )( pRec ), xmm12 ); - - pRec += dstStride; -#endif -#if !JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg0 += srcStride; - pImg1 += srcStride; - pImg2 += srcStride; - pImg3 += srcStride; - pImg4 += srcStride; -#endif -#if !JVET_N0242_NON_LINEAR_ALF && !JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg5 += srcStride; -#endif - -#if JVET_N0242_NON_LINEAR_ALF pRec1 += dstStride; } pRec1 -= dstStride2; @@ -1157,101 +739,23 @@ static void simdFilter5x5Blk(AlfClassifier** classifier, const PelUnitBuf &recDs } } -#else - } //<-- end of k-loop - - pRec -= ( 4 * dstStride ); - - // restore 2x2 PCM chroma blocks - if( bChroma && isPCMFilterDisabled ) - { - int blkX, blkY; - bool *flags = pcmFlags2x2; - Pel *pcmRec = pcmRec2x2; - for( blkY=0; blkY<4; blkY+=2 ) - { - for( blkX=0; blkX<4; blkX+=2 ) - { - if( *flags++ ) - { - pRec[(blkY+0)*dstStride + (blkX+0)] = *pcmRec++; - pRec[(blkY+0)*dstStride + (blkX+1)] = *pcmRec++; - pRec[(blkY+1)*dstStride + (blkX+0)] = *pcmRec++; - pRec[(blkY+1)*dstStride + (blkX+1)] = *pcmRec++; - } - } - } - } - - pRec += 4; -#endif } -#if JVET_N0242_NON_LINEAR_ALF pRec0 += dstStride2; -#else - pRec += 4 * dstStride; -#endif pImgYPad0 += srcStride2; pImgYPad1 += srcStride2; pImgYPad2 += srcStride2; pImgYPad3 += srcStride2; pImgYPad4 += srcStride2; -#if !JVET_N0242_NON_LINEAR_ALF - pImgYPad5 += srcStride2; -#endif } } template -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND static void simdFilter7x7Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#else -static void simdFilter7x7Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdFilter7x7Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#else -static void simdFilter7x7Blk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos) -#endif -#endif -#else -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs ) -#else -static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs ) -#endif -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND -static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ) -#else -static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blk, const ComponentID compId, short* filterSet, const ClpRng& clpRng, CodingStructure& cs ) -#endif -#endif -#endif { -#if !JVET_N0242_NON_LINEAR_ALF - static const unsigned char mask0[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 7, 4, 5, 2, 3 }; - static const unsigned char mask00[16] = { 2, 3, 0, 1, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, 1 }; - static const unsigned char mask02[16] = { 0, 0, 0, 0, 2, 3, 10, 11, 0, 0, 10, 11, 2, 3, 0, 0 }; - static const unsigned char mask20[16] = { 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 6, 7, 0, 0, 0, 0 }; - static const unsigned char mask22[16] = { 14, 15, 0, 0, 6, 7, 4, 5, 12, 13, 0, 0, 8, 9, 0, 1 }; - static const unsigned char mask35[16] = { 4, 5, 2, 3, 0, 1, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7 }; - -#endif const bool bChroma = isChroma( compId ); -#if !JVET_N0242_NON_LINEAR_ALF - if( bChroma ) - { - CHECK( 0, "Chroma doesn't support 7x7" ); - } -#endif const SPS* sps = cs.slice->getSPS(); bool isDualTree = CS::isDualITree(cs); bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); @@ -1262,17 +766,6 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD const int srcStride = srcLuma.stride; const int dstStride = dstLuma.stride; -#if !JVET_N0242_NON_LINEAR_ALF - const Pel* srcExt = srcLuma.buf; - Pel* dst = dstLuma.buf; - - const Pel *pImgYPad0, *pImgYPad1, *pImgYPad2, *pImgYPad3, *pImgYPad4, *pImgYPad5, *pImgYPad6; - - short *coef = filterSet; - const Pel *pImg0, *pImg1, *pImg2, *pImg3, *pImg4; - const Pel *pImg5, *pImg6; - -#endif const int numBitsMinus1 = AdaptiveLoopFilter::m_NUM_BITS - 1; const int offset = ( 1 << ( AdaptiveLoopFilter::m_NUM_BITS - 2 ) ); @@ -1281,13 +774,8 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD const int startWidth = blk.x; const int endWidth = blk.x + blk.width; -#if JVET_N0242_NON_LINEAR_ALF const Pel* src = srcLuma.buf; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Pel* dst = dstLuma.buf + blkDst.y * dstStride; -#else - Pel* dst = dstLuma.buf + startHeight * dstStride; -#endif const Pel *pImgYPad0, *pImgYPad1, *pImgYPad2, *pImgYPad3, *pImgYPad4, *pImgYPad5, *pImgYPad6; const Pel *pImg0, *pImg1, *pImg2, *pImg3, *pImg4, *pImg5, *pImg6; @@ -1296,63 +784,31 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD short *clip[2] = { fClipSet, fClipSet }; int transposeIdx[2] = {0, 0}; -#else - Pel* imgYRecPost = dst; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - imgYRecPost += blkDst.y * dstStride; -#else - imgYRecPost += startHeight * dstStride; -#endif - - int transposeIdx = 0; - -#endif const int clsSizeY = 4; const int clsSizeX = 4; -#if JVET_N0242_NON_LINEAR_ALF bool pcmFlags2x2[8] = {0,0,0,0,0,0,0,0}; Pel pcmRec2x2[32]; -#else - bool pcmFlags2x2[4] = {0,0,0,0}; - Pel pcmRec2x2[16]; -#endif CHECK( startHeight % clsSizeY, "Wrong startHeight in filtering" ); CHECK( startWidth % clsSizeX, "Wrong startWidth in filtering" ); CHECK( ( endHeight - startHeight ) % clsSizeY, "Wrong endHeight in filtering" ); CHECK( ( endWidth - startWidth ) % clsSizeX, "Wrong endWidth in filtering" ); -#if !JVET_N0242_NON_LINEAR_ALF - const Pel* imgYRec = srcExt; - - Pel *pRec; -#endif AlfClassifier *pClass = nullptr; int dstStride2 = dstStride * clsSizeY; int srcStride2 = srcStride * clsSizeY; const __m128i mmOffset = _mm_set1_epi32( offset ); -#if JVET_N0242_NON_LINEAR_ALF const __m128i mmMin = _mm_set1_epi16( clpRng.min ); const __m128i mmMax = _mm_set1_epi16( clpRng.max ); -#else - const __m128i mmMin = _mm_set1_epi32( clpRng.min ); - const __m128i mmMax = _mm_set1_epi32( clpRng.max ); -#endif -#if JVET_N0242_NON_LINEAR_ALF const unsigned char *filterCoeffIdx[2]; Pel filterCoeff[MAX_NUM_ALF_LUMA_COEFF][2]; Pel filterClipp[MAX_NUM_ALF_LUMA_COEFF][2]; pImgYPad0 = src + startHeight * srcStride + startWidth; -#else - const __m128i xmm10 = _mm_loadu_si128( ( __m128i* )mask35 ); - - pImgYPad0 = imgYRec + startHeight * srcStride + startWidth; -#endif pImgYPad1 = pImgYPad0 + srcStride; pImgYPad2 = pImgYPad0 - srcStride; pImgYPad3 = pImgYPad1 + srcStride; @@ -1360,51 +816,18 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD pImgYPad5 = pImgYPad3 + srcStride; pImgYPad6 = pImgYPad4 - srcStride; -#if JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Pel* pRec0 = dst + blkDst.x; -#else - Pel* pRec0 = dst + startWidth; -#endif Pel* pRec1; -#else -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - pRec = imgYRecPost + blkDst.x; -#else - pRec = imgYRecPost + startWidth; -#endif -#endif -#if JVET_N0242_NON_LINEAR_ALF for( int i = 0; i < endHeight - startHeight; i += clsSizeY ) -#else - for( int i = 0; i < endHeight - startHeight; i += 4 ) -#endif { -#if !JVET_N0242_NON_LINEAR_ALF -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - pRec = imgYRecPost + blkDst.x + i * dstStride; -#else - pRec = imgYRecPost + startWidth + i * dstStride; -#endif - -#endif if( !bChroma ) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND pClass = classifier[blkDst.y + i] + blkDst.x; -#else - pClass = classifier[startHeight + i] + startWidth; -#endif } -#if JVET_N0242_NON_LINEAR_ALF for( int j = 0; j < endWidth - startWidth; j += 8 ) -#else - for( int j = 0; j < endWidth - startWidth; j += 4 ) -#endif { -#if JVET_N0242_NON_LINEAR_ALF for (int k = 0; k < 2; ++k) { if( !bChroma ) @@ -1456,103 +879,7 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD filterClipp[i][k] = clip[k][filterCoeffIdx[k][i]]; } } -#else - if( !bChroma ) - { - AlfClassifier& cl = pClass[j]; - transposeIdx = cl.transposeIdx; - if ( isPCMFilterDisabled && cl.classIdx == AdaptiveLoopFilter::m_ALF_UNUSED_CLASSIDX && transposeIdx == AdaptiveLoopFilter::m_ALF_UNUSED_TRANSPOSIDX ) - { - pRec += 4; - continue; - } - coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; - } - else if ( isPCMFilterDisabled ) - { - int blkX, blkY; - bool *flags = pcmFlags2x2; - Pel *pcmRec = pcmRec2x2; - - // check which chroma 2x2 blocks use PCM - // chroma PCM may not be aligned with 4x4 ALF processing grid - for( blkY=0; blkY<4; blkY+=2 ) - { - for( blkX=0; blkX<4; blkX+=2 ) - { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - Position pos(j + blkDst.x + blkX, i + blkDst.y + blkY); -#else - Position pos(j+startWidth+blkX, i+startHeight+blkY); -#endif - CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); - *flags++ = cu->ipcm ? 1 : 0; - - // save original samples from 2x2 PCM blocks - if( cu->ipcm ) - { - *pcmRec++ = pRec[(blkY+0)*dstStride + (blkX+0)]; - *pcmRec++ = pRec[(blkY+0)*dstStride + (blkX+1)]; - *pcmRec++ = pRec[(blkY+1)*dstStride + (blkX+0)]; - *pcmRec++ = pRec[(blkY+1)*dstStride + (blkX+1)]; - } - } - } - - // skip entire 4x4 if all chroma 2x2 blocks use PCM - if( pcmFlags2x2[0] && pcmFlags2x2[1] && pcmFlags2x2[2] && pcmFlags2x2[3] ) - { - pRec += 4; - continue; - } - } - - __m128i c0, c2, t1, t2; - t1 = _mm_loadu_si128( ( __m128i* )( coef + 0 ) ); - t2 = _mm_loadu_si128( ( __m128i* )( coef + 1 ) ); - c2 = _mm_loadu_si128( ( __m128i* )( coef + 4 - 3 ) ); - c0 = _mm_loadu_si128( ( __m128i* )( coef + 9 - 1 ) ); - - c0 = _mm_blend_epi16( c0, t1, 0x01 ); - c2 = _mm_blend_epi16( c2, t2, 0x07 ); - - if( transposeIdx & 1 ) - { - t1 = _mm_loadu_si128( ( __m128i* )mask00 ); - t2 = _mm_loadu_si128( ( __m128i* )mask02 ); - __m128i t3 = _mm_loadu_si128( ( __m128i* )mask20 ); - __m128i t4 = _mm_loadu_si128( ( __m128i* )mask22 ); - - t1 = _mm_shuffle_epi8( c0, t1 ); - t2 = _mm_shuffle_epi8( c2, t2 ); - t3 = _mm_shuffle_epi8( c0, t3 ); - t4 = _mm_shuffle_epi8( c2, t4 ); - - c0 = _mm_blend_epi16( t1, t2, 0x6C ); - c2 = _mm_blend_epi16( t4, t3, 0x22 ); - } - else - { - c0 = _mm_shuffle_epi8( c0, _mm_loadu_si128( ( __m128i* )mask0 ) ); - } - - if( transposeIdx == 0 || transposeIdx == 3 ) - { - c2 = _mm_shuffle_epi8( c2, xmm10 ); - } - #endif -#if !JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg0 = pImgYPad0 + j; - pImg1 = pImgYPad1 + j; - pImg2 = pImgYPad2 + j; - pImg3 = pImgYPad3 + j; - pImg4 = pImgYPad4 + j; - pImg5 = pImgYPad5 + j; - pImg6 = pImgYPad6 + j; -#endif - -#if JVET_N0242_NON_LINEAR_ALF pRec1 = pRec0 + j; if ( bChroma && isPCMFilterDisabled ) @@ -1567,11 +894,7 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD { for( blkX=0; blkX<8; blkX+=2 ) { -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND Position pos(j + blkDst.x + blkX, i + blkDst.y + blkY); -#else - Position pos(j+startWidth+blkX, i+startHeight+blkY); -#endif CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); if( cu != NULL) { @@ -1598,7 +921,6 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD for( int ii = 0; ii < clsSizeY; ii++ ) { -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION pImg0 = pImgYPad0 + j + ii * srcStride; pImg1 = pImgYPad1 + j + ii * srcStride; pImg2 = pImgYPad2 + j + ii * srcStride; @@ -1606,7 +928,6 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD pImg4 = pImgYPad4 + j + ii * srcStride; pImg5 = pImgYPad5 + j + ii * srcStride; pImg6 = pImgYPad6 + j + ii * srcStride; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND if ((blkDst.y + i + ii) % vbCTUHeight < vbPos && ((blkDst.y + i + ii) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above { pImg1 = ((blkDst.y + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; @@ -1627,29 +948,6 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD pImg3 = ((blkDst.y + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; pImg5 = ((blkDst.y + i + ii) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; } -#else - if ((startHeight + i + ii) % vbCTUHeight < vbPos && ((startHeight + i + ii) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((startHeight + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 3) ? pImg3 : pImg5; - - pImg2 = ((startHeight + i + ii) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - pImg6 = ((startHeight + i + ii) % vbCTUHeight >= vbPos - 3) ? pImg4 : pImg6; - } - else if ((startHeight + i + ii) % vbCTUHeight >= vbPos && ((startHeight + i + ii) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((startHeight + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - pImg6 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 2) ? pImg4 : pImg6; - - pImg1 = ((startHeight + i + ii) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + ii) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; - } -#endif -#endif __m128i clipp, clipm; __m128i coeffa, coeffb; __m128i xmmCur = _mm_lddqu_si128( ( __m128i* ) ( pImg0 + 0 ) ); @@ -1965,150 +1263,7 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD xmmS0 = _mm_blend_epi16( xmmS0, xmmCur, 0xFC ); _mm_storeu_si128( ( __m128i* )( pRec1 ), xmmS0 ); } -#else - for( int k = 0; k < 4; k++ ) - { -#if JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg0 = pImgYPad0 + j + k * srcStride; //j: width, 4x4 block - pImg1 = pImgYPad1 + j + k * srcStride; - pImg2 = pImgYPad2 + j + k * srcStride; - pImg3 = pImgYPad3 + j + k * srcStride; - pImg4 = pImgYPad4 + j + k * srcStride; - pImg5 = pImgYPad5 + j + k * srcStride; - pImg6 = pImgYPad6 + j + k * srcStride; -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND - if ((blkDst.y + i + k) % vbCTUHeight < vbPos && ((blkDst.y + i + k) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((blkDst.y + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - pImg5 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 3) ? pImg3 : pImg5; - - pImg2 = ((blkDst.y + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - pImg6 = ((blkDst.y + i + k) % vbCTUHeight >= vbPos - 3) ? pImg4 : pImg6; - } - else if ((blkDst.y + i + k) % vbCTUHeight >= vbPos && ((blkDst.y + i + k) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((blkDst.y + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - pImg6 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 2) ? pImg4 : pImg6; - - pImg1 = ((blkDst.y + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - pImg5 = ((blkDst.y + i + k) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; - } -#else - if ((startHeight + i + k) % vbCTUHeight < vbPos && ((startHeight + i + k) % vbCTUHeight >= vbPos - (bChroma ? 2 : 4))) //above - { - pImg1 = ((startHeight + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 2) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 3) ? pImg3 : pImg5; - - pImg2 = ((startHeight + i + k) % vbCTUHeight == vbPos - 1) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 2) ? pImg2 : pImg4; - pImg6 = ((startHeight + i + k) % vbCTUHeight >= vbPos - 3) ? pImg4 : pImg6; - } - else if ((startHeight + i + k) % vbCTUHeight >= vbPos && ((startHeight + i + k) % vbCTUHeight <= vbPos + (bChroma ? 1 : 3))) //bottom - { - pImg2 = ((startHeight + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg2; - pImg4 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 1) ? pImg2 : pImg4; - pImg6 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 2) ? pImg4 : pImg6; - pImg1 = ((startHeight + i + k) % vbCTUHeight == vbPos) ? pImg0 : pImg1; - pImg3 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 1) ? pImg1 : pImg3; - pImg5 = ((startHeight + i + k) % vbCTUHeight <= vbPos + 2) ? pImg3 : pImg5; - } -#endif -#endif - __m128i xmm6 = _mm_lddqu_si128( ( __m128i* ) pImg6 ); - __m128i xmm4 = _mm_lddqu_si128( ( __m128i* ) ( pImg4 - 1 ) ); - __m128i xmm2 = _mm_lddqu_si128( ( __m128i* ) ( pImg2 - 2 ) ); - __m128i xmm0 = _mm_lddqu_si128( ( __m128i* ) ( pImg0 - 3 ) ); - __m128i xmm11 = _mm_lddqu_si128( ( __m128i* ) ( pImg0 + 5 ) ); - __m128i xmm1 = _mm_lddqu_si128( ( __m128i* ) ( pImg1 - 2 - 1 ) ); - __m128i xmm8 = _mm_lddqu_si128( ( __m128i* ) ( pImg1 + 5 ) ); - __m128i xmm3 = _mm_lddqu_si128( ( __m128i* ) ( pImg3 - 2 ) ); - __m128i xmm5 = _mm_lddqu_si128( ( __m128i* ) ( pImg5 - 1 ) ); - - xmm6 = _mm_add_epi16( xmm6, _mm_srli_si128( xmm5, 2 ) ); - - __m128i xmm12 = _mm_blend_epi16( _mm_slli_si128( xmm0, 2 ), xmm6, 0x01 ); - __m128i xmm13 = _mm_blend_epi16( xmm0, _mm_srli_si128( xmm6, 2 ), 0x01 ); - - __m128i xmm14 = _mm_blend_epi16( _mm_slli_si128( xmm2, 6 ), xmm4, 0x07 ); - __m128i xmm16 = _mm_blend_epi16( _mm_slli_si128( xmm1, 4 ), _mm_srli_si128( xmm3, 2 ), 0x07 ); - xmm14 = _mm_shuffle_epi8( xmm14, xmm10 ); - xmm14 = _mm_add_epi16( xmm14, xmm16 ); - __m128i xmm15 = _mm_blend_epi16( _mm_slli_si128( xmm2, 4 ), _mm_srli_si128( xmm4, 2 ), 0x07 ); - __m128i xmm17 = _mm_blend_epi16( _mm_slli_si128( xmm1, 2 ), _mm_srli_si128( xmm3, 4 ), 0x07 ); - xmm15 = _mm_shuffle_epi8( xmm15, xmm10 ); - xmm15 = _mm_add_epi16( xmm15, xmm17 ); - - xmm12 = _mm_madd_epi16( xmm12, c0 ); - xmm13 = _mm_madd_epi16( xmm13, c0 ); - xmm14 = _mm_madd_epi16( xmm14, c2 ); - xmm15 = _mm_madd_epi16( xmm15, c2 ); - - xmm12 = _mm_add_epi32( xmm12, xmm14 ); - xmm13 = _mm_add_epi32( xmm13, xmm15 ); - xmm14 = _mm_shuffle_epi32( xmm12, 0x1B ); - xmm15 = _mm_shuffle_epi32( xmm13, 0x1B ); - xmm12 = _mm_add_epi32( xmm12, xmm14 ); - xmm13 = _mm_add_epi32( xmm13, xmm15 ); - - __m128i xmm7 = _mm_blend_epi16( xmm12, xmm13, 0xF0 ); - - xmm12 = _mm_blend_epi16( _mm_alignr_epi8( xmm11, xmm0, 2 ), _mm_srli_si128( xmm6, 4 ), 0x01 ); - xmm13 = _mm_blend_epi16( _mm_alignr_epi8( xmm11, xmm0, 4 ), _mm_srli_si128( xmm6, 6 ), 0x01 ); - - xmm14 = _mm_blend_epi16( _mm_slli_si128( xmm2, 2 ), _mm_srli_si128( xmm4, 4 ), 0x07 ); - xmm16 = _mm_blend_epi16( xmm1, _mm_srli_si128( xmm3, 6 ), 0x07 ); - xmm14 = _mm_shuffle_epi8( xmm14, xmm10 ); - xmm14 = _mm_add_epi16( xmm14, xmm16 ); - xmm15 = _mm_blend_epi16( xmm2, _mm_srli_si128( xmm4, 6 ), 0x07 ); - xmm8 = _mm_alignr_epi8( xmm8, xmm1, 2 ); - xmm17 = _mm_blend_epi16( xmm8, _mm_srli_si128( xmm3, 8 ), 0x07 ); - xmm15 = _mm_shuffle_epi8( xmm15, xmm10 ); - xmm15 = _mm_add_epi16( xmm15, xmm17 ); - - xmm12 = _mm_madd_epi16( xmm12, c0 ); - xmm13 = _mm_madd_epi16( xmm13, c0 ); - xmm14 = _mm_madd_epi16( xmm14, c2 ); - xmm15 = _mm_madd_epi16( xmm15, c2 ); - - xmm12 = _mm_add_epi32( xmm12, xmm14 ); - xmm13 = _mm_add_epi32( xmm13, xmm15 ); - xmm14 = _mm_shuffle_epi32( xmm12, 0x1B ); - xmm15 = _mm_shuffle_epi32( xmm13, 0x1B ); - xmm12 = _mm_add_epi32( xmm12, xmm14 ); - xmm13 = _mm_add_epi32( xmm13, xmm15 ); - - __m128i xmm9 = _mm_blend_epi16( xmm12, xmm13, 0xF0 ); - - xmm12 = _mm_hadd_epi32( xmm7, xmm9 ); - - xmm12 = _mm_add_epi32( xmm12, mmOffset ); - xmm12 = _mm_srai_epi32( xmm12, numBitsMinus1 ); - - xmm12 = _mm_min_epi32( mmMax, _mm_max_epi32( xmm12, mmMin ) ); - - xmm12 = _mm_packus_epi32( xmm12, xmm12 ); - - _mm_storel_epi64( ( __m128i* )( pRec ), xmm12 ); - - pRec += dstStride; -#endif - -#if !JVET_N0180_ALF_LINE_BUFFER_REDUCTION - pImg0 += srcStride; - pImg1 += srcStride; - pImg2 += srcStride; - pImg3 += srcStride; - pImg4 += srcStride; - pImg5 += srcStride; - pImg6 += srcStride; -#endif -#if JVET_N0242_NON_LINEAR_ALF pRec1 += dstStride; } @@ -2134,41 +1289,9 @@ static void simdFilter7x7Blk( AlfClassifier** classifier, const PelUnitBuf &recD } } -#else - } - - pRec -= ( 4 * dstStride ); - - // restore 2x2 PCM chroma blocks - if( bChroma && isPCMFilterDisabled ) - { - int blkX, blkY; - bool *flags = pcmFlags2x2; - Pel *pcmRec = pcmRec2x2; - for( blkY=0; blkY<4; blkY+=2 ) - { - for( blkX=0; blkX<4; blkX+=2 ) - { - if( *flags++ ) - { - pRec[(blkY+0)*dstStride + (blkX+0)] = *pcmRec++; - pRec[(blkY+0)*dstStride + (blkX+1)] = *pcmRec++; - pRec[(blkY+1)*dstStride + (blkX+0)] = *pcmRec++; - pRec[(blkY+1)*dstStride + (blkX+1)] = *pcmRec++; - } - } - } - } - - pRec += 4; -#endif } -#if JVET_N0242_NON_LINEAR_ALF pRec0 += dstStride2; -#else - pRec += dstStride2; -#endif pImgYPad0 += srcStride2; pImgYPad1 += srcStride2; diff --git a/source/Lib/CommonLib/x86/BufferX86.h b/source/Lib/CommonLib/x86/BufferX86.h index 41e97b1086ece7c73e5e42eb609a339546e86ef6..ae39695890e2df4acf95c4e5e35f739a9c9971e7 100644 --- a/source/Lib/CommonLib/x86/BufferX86.h +++ b/source/Lib/CommonLib/x86/BufferX86.h @@ -288,11 +288,7 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri int widthInside = width - 2 * BIO_EXTEND_SIZE; int heightInside = height - 2 * BIO_EXTEND_SIZE; -#if JVET_N0325_BDOF int shift1 = std::max(6, bitDepth - 6); -#else - int shift1 = std::max(2, (14 - bitDepth)); -#endif assert((widthInside & 3) == 0); @@ -344,13 +340,8 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri template< X86_VEXT vext > void calcBIOPar_SSE(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, const int bitDepth) { -#if JVET_N0325_BDOF int shift4 = std::max(4, (bitDepth - 8)); int shift5 = std::max(1, (bitDepth - 11)); -#else - int shift4 = std::min(8, (bitDepth - 4)); - int shift5 = std::min(5, (bitDepth - 7)); -#endif for (int y = 0; y < heightG; y++) { int x = 0; diff --git a/source/Lib/CommonLib/x86/InterpolationFilterX86.h b/source/Lib/CommonLib/x86/InterpolationFilterX86.h index 59c455d30fc0a5d7a74e7a3c80226ec10056965d..33bd60b4ed573d73a038242e1bf99bede8386a8a 100644 --- a/source/Lib/CommonLib/x86/InterpolationFilterX86.h +++ b/source/Lib/CommonLib/x86/InterpolationFilterX86.h @@ -195,21 +195,6 @@ static void fullPelCopyAVX2( const ClpRng& clpRng, const void*_src, int srcStrid template static void simdFilterCopy( const ClpRng& clpRng, const Pel* src, int srcStride, int16_t* dst, int dstStride, int width, int height, bool biMCForDMVR) { -#if !HM_JEM_CLIP_PEL - if( vext >= AVX2 && ( width % 16 ) == 0 ) - { - fullPelCopyAVX2( clpRng, src, srcStride, dst, dstStride, width, height ); - } - else if( ( width % 16 ) == 0 ) - { - fullPelCopySSE( clpRng, src, srcStride, dst, dstStride, width, height ); - } - else if( ( width % 8 ) == 0 ) - { - fullPelCopySSE( clpRng, src, srcStride, dst, dstStride, width, height ); - } - else -#endif { //Scalar InterpolationFilter::filterCopy( clpRng, src, srcStride, dst, dstStride, width, height, biMCForDMVR); } diff --git a/source/Lib/CommonLib/x86/RdCostX86.h b/source/Lib/CommonLib/x86/RdCostX86.h index 25e402e2fa79cffc9e8c9d4906ca254ea75e923c..740a24ece651d24811b258ac20fc88ccad4b69e2 100644 --- a/source/Lib/CommonLib/x86/RdCostX86.h +++ b/source/Lib/CommonLib/x86/RdCostX86.h @@ -2109,12 +2109,6 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) THROW( "Unsupported size" ); } -#if 0 - Distortion hadSimd = uiSum >> DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth); - Distortion hadScalar = RdCost::xGetHADs( rcDtParam ); - - CHECK( hadSimd != hadScalar, "SIMD implementation of HAD norm is equal to the scalar implementation!" ); -#endif return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth); } diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 6969c038de3fd42fd380f41e6a667af01e1b1fe9..f206c628c6db8f4c98985401da5d60abbfd72ffd 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -142,44 +142,24 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i sao( cs, ctuRsAddr ); -#if JVET_N0415_CTB_ALF if (cs.sps->getALFEnabledFlag() && (cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Y))) { -#else - if (cs.sps->getALFEnabledFlag() && (cs.slice->getTileGroupAlfEnabledFlag())) - { - CHECK(cs.aps == nullptr, "APS not initialized"); - const AlfSliceParam& alfSliceParam = cs.aps->getAlfAPSParam(); -#endif const PreCalcValues& pcv = *cs.pcv; int frame_width_in_ctus = pcv.widthInCtus; int ry = ctuRsAddr / frame_width_in_ctus; int rx = ctuRsAddr - ry * frame_width_in_ctus; const Position pos( rx * cs.pcv->maxCUWidth, ry * cs.pcv->maxCUHeight ); const uint32_t curSliceIdx = cs.slice->getIndependentSliceIdx(); -#if JVET_N0857_TILES_BRICKS const uint32_t curTileIdx = cs.picture->brickMap->getBrickIdxRsMap( pos ); -#else - const uint32_t curTileIdx = cs.picture->tileMap->getTileIdxMap( pos ); -#endif -#if JVET_N0150_ONE_CTU_DELAY_WPP bool leftAvail = cs.getCURestricted( pos.offset( -(int)pcv.maxCUWidth, 0 ), pos, curSliceIdx, curTileIdx, CH_L ) ? true : false; bool aboveAvail = cs.getCURestricted( pos.offset( 0, -(int)pcv.maxCUHeight ), pos, curSliceIdx, curTileIdx, CH_L ) ? true : false; -#else - bool leftAvail = cs.getCURestricted( pos.offset( -(int)pcv.maxCUWidth, 0 ), curSliceIdx, curTileIdx, CH_L ) ? true : false; - bool aboveAvail = cs.getCURestricted( pos.offset( 0, -(int)pcv.maxCUHeight ), curSliceIdx, curTileIdx, CH_L ) ? true : false; -#endif int leftCTUAddr = leftAvail ? ctuRsAddr - 1 : -1; int aboveCTUAddr = aboveAvail ? ctuRsAddr - frame_width_in_ctus : -1; for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { -#if JVET_N0415_CTB_ALF if (cs.slice->getTileGroupAlfEnabledFlag((ComponentID)compIdx)) -#else - if( alfSliceParam.enabledFlag[compIdx] ) -#endif { uint8_t* ctbAlfFlag = cs.slice->getPic()->getAlfCtuEnableFlag( compIdx ); int ctx = 0; @@ -189,12 +169,10 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__ALF); ctbAlfFlag[ctuRsAddr] = m_BinDecoder.decodeBin( Ctx::ctbAlfFlag( compIdx * 3 + ctx ) ); -#if JVET_N0415_CTB_ALF if (isLuma((ComponentID)compIdx) && ctbAlfFlag[ctuRsAddr]) { readAlfCtuFilterIndex(cs, ctuRsAddr); } -#endif } } } @@ -231,7 +209,6 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i return isLast; } -#if JVET_N0415_CTB_ALF void CABACReader::readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr) { short* alfCtbFilterSetIndex = cs.slice->getPic()->getAlfCtbFilterIndex(); @@ -272,7 +249,6 @@ void CABACReader::readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr) } alfCtbFilterSetIndex[ctuRsAddr] = filtIndex; } -#endif //================================================================================ // clause 7.3.8.3 //-------------------------------------------------------------------------------- @@ -310,26 +286,14 @@ void CABACReader::sao( CodingStructure& cs, unsigned ctuRsAddr ) RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SAO ); -#if JVET_N0857_TILES_BRICKS const unsigned curTileIdx = cs.picture->brickMap->getBrickIdxRsMap( pos ); -#else - const unsigned curTileIdx = cs.picture->tileMap->getTileIdxMap( pos ); -#endif -#if JVET_N0150_ONE_CTU_DELAY_WPP if( cs.getCURestricted( pos.offset(-(int)cs.pcv->maxCUWidth, 0), pos, curSliceIdx, curTileIdx, CH_L ) ) -#else - if( cs.getCURestricted( pos.offset(-(int)cs.pcv->maxCUWidth, 0), curSliceIdx, curTileIdx, CH_L ) ) -#endif { // sao_merge_left_flag sao_merge_type += int( m_BinDecoder.decodeBin( Ctx::SaoMergeFlag() ) ); } -#if JVET_N0150_ONE_CTU_DELAY_WPP if( sao_merge_type < 0 && cs.getCURestricted( pos.offset(0, -(int)cs.pcv->maxCUHeight), pos, curSliceIdx, curTileIdx, CH_L ) ) -#else - if( sao_merge_type < 0 && cs.getCURestricted( pos.offset(0, -(int)cs.pcv->maxCUHeight), curSliceIdx, curTileIdx, CH_L ) ) -#endif { // sao_merge_above_flag sao_merge_type += int( m_BinDecoder.decodeBin( Ctx::SaoMergeFlag() ) ) << 1; @@ -604,11 +568,7 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU partitioner.setCUData( cu ); cu.slice = cs.slice; -#if JVET_N0857_TILES_BRICKS cu.tileIdx = cs.picture->brickMap->getBrickIdxRsMap( currArea.lumaPos() ); -#else - cu.tileIdx = cs.picture->tileMap->getTileIdxMap( currArea.lumaPos() ); -#endif // Predict QP on start of quantization group if( cuCtx.qgStart ) @@ -737,9 +697,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& { cu_transquant_bypass_flag( cu ); } -#if JVET_N0324_REGULAR_MRG_FLAG PredictionUnit& pu = cs.addPU(cu, partitioner.chType); -#endif // skip flag if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && cu.Y().valid()) { @@ -750,9 +708,6 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& if( cu.skip ) { cs.addTU ( cu, partitioner.chType ); -#if !JVET_N0324_REGULAR_MRG_FLAG - PredictionUnit& pu = cs.addPU( cu, partitioner.chType ); -#endif pu.shareParentPos = cu.shareParentPos; pu.shareParentSize = cu.shareParentSize; MergeCtx mrgCtx; @@ -762,14 +717,9 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& // prediction mode and partitioning data pred_mode ( cu ); -#if JVET_N0413_RDPCM bdpcm_mode( cu, ComponentID( partitioner.chType ) ); -#endif // --> create PUs -#if !JVET_N0324_REGULAR_MRG_FLAG - CU::addPUs( cu ); -#endif // pcm samples if( CU::isIntra(cu) ) { @@ -782,11 +732,6 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& } } -#if !JVET_N0217_MATRIX_INTRAPRED - extend_ref_line( cu ); - - isp_mode( cu ); -#endif // prediction data ( intra prediction modes / reference indexes + motion vectors ) cu_pred_data( cu ); @@ -817,10 +762,8 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) cu.rootCbf = false; cu.predMode = MODE_INTRA; cu.mmvdSkip = false; -#if JVET_N0318_N0467_IBC_SIZE if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode { -#endif unsigned ctxId = DeriveCtx::CtxSkipFlag(cu); unsigned skip = m_BinDecoder.decodeBin(Ctx::SkipFlag(ctxId)); DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0 ); @@ -831,17 +774,13 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) cu.predMode = MODE_IBC; cu.mmvdSkip = false; } -#if JVET_N0318_N0467_IBC_SIZE } -#endif return; } -#if JVET_N0266_SMALL_BLOCKS if ( !cu.cs->slice->getSPS()->getIBCFlag() && cu.lwidth() == 4 && cu.lheight() == 4 ) { return; } -#endif unsigned ctxId = DeriveCtx::CtxSkipFlag(cu); unsigned skip = m_BinDecoder.decodeBin( Ctx::SkipFlag(ctxId) ); @@ -849,11 +788,8 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) if (skip && cu.cs->slice->getSPS()->getIBCFlag()) { -#if JVET_N0318_N0467_IBC_SIZE if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode { -#endif -#if JVET_N0266_SMALL_BLOCKS if ( cu.lwidth() == 4 && cu.lheight() == 4 ) { cu.skip = true; @@ -862,7 +798,6 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) cu.mmvdSkip = false; return; } -#endif unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx))) { @@ -870,27 +805,22 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) cu.rootCbf = false; cu.predMode = MODE_IBC; cu.mmvdSkip = false; -#if JVET_N0324_REGULAR_MRG_FLAG cu.firstPU->regularMergeFlag = false; -#endif } else { cu.predMode = MODE_INTER; } DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode); -#if JVET_N0318_N0467_IBC_SIZE } else { cu.predMode = MODE_INTER; } -#endif } if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getIBCFlag()) || (skip && !cu.cs->slice->getSPS()->getIBCFlag())) { -#if JVET_N0324_REGULAR_MRG_FLAG if (!cu.cs->slice->getSPS()->getUseMMVD() && (cu.firstPU->lwidth() * cu.firstPU->lheight() == 32)) { cu.firstPU->regularMergeFlag = true; @@ -911,15 +841,9 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) } else { -#if JVET_N0127_MMVD_SPS_FLAG if (cu.cs->slice->getSPS()->getUseMMVD()) { -#endif -#if JVET_N0266_SMALL_BLOCKS bool isCUWithOnlyRegularAndMMVD=((cu.firstPU->lwidth() == 8 && cu.firstPU->lheight() == 4) || (cu.firstPU->lwidth() == 4 && cu.firstPU->lheight() == 8)); -#else - bool isCUWithOnlyRegularAndMMVD=((cu.firstPU->lwidth() == 4 && cu.firstPU->lheight() == 4) || (cu.firstPU->lwidth() == 8 && cu.firstPU->lheight() == 4) || (cu.firstPU->lwidth() == 4 && cu.firstPU->lheight() == 8)); -#endif if (isCUWithOnlyRegularAndMMVD) { cu.mmvdSkip = !(cu.firstPU->regularMergeFlag); @@ -930,30 +854,12 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) cu.mmvdSkip = mmvdSkip; DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, mmvdSkip ? 1 : 0); } -#if JVET_N0127_MMVD_SPS_FLAG } else { cu.mmvdSkip = false; } -#endif - } -#else -#if JVET_N0127_MMVD_SPS_FLAG - if (cu.cs->slice->getSPS()->getUseMMVD()) - { -#endif - unsigned mmvdSkip = m_BinDecoder.decodeBin(Ctx::MmvdFlag(0)); - cu.mmvdSkip = mmvdSkip; - DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, mmvdSkip ? 1 : 0); -#if JVET_N0127_MMVD_SPS_FLAG - } - else - { - cu.mmvdSkip = false; } -#endif -#endif cu.skip = true; cu.rootCbf = false; cu.predMode = MODE_INTER; @@ -983,29 +889,16 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) const SPS *sps = cu.cs->sps; unsigned value = 0; -#if !JVET_N600_AMVR_TPM_CTX_REDUCTION - unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); -#endif if (CU::isIBC(cu)) value = 1; else -#if JVET_N600_AMVR_TPM_CTX_REDUCTION value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 0 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 0 ); -#else - value = m_BinDecoder.decodeBin( Ctx::ImvFlag( ctxId ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, ctxId ); -#endif if( sps->getAMVREnabledFlag() && value ) { -#if JVET_N600_AMVR_TPM_CTX_REDUCTION value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 1 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 1 ); -#else - value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 3 ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 3 ); -#endif value++; } @@ -1030,23 +923,13 @@ void CABACReader::affine_amvr_mode( CodingUnit& cu, MergeCtx& mrgCtx ) } unsigned value = 0; -#if JVET_N600_AMVR_TPM_CTX_REDUCTION value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 2 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", value, 2 ); -#else - value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 4 ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", value, 4 ); -#endif if( value ) { -#if JVET_N600_AMVR_TPM_CTX_REDUCTION value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 3 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", value, 3 ); -#else - value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 5 ) ); - DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", value, 5 ); -#endif value++; } @@ -1060,25 +943,17 @@ void CABACReader::pred_mode( CodingUnit& cu ) if (cu.cs->slice->getSPS()->getIBCFlag()) { -#if JVET_N0266_SMALL_BLOCKS if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) ) -#else - if (cu.cs->slice->isIntra()) -#endif { cu.predMode = MODE_INTRA; -#if JVET_N0318_N0467_IBC_SIZE if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode { -#endif unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx))) { cu.predMode = MODE_IBC; } -#if JVET_N0318_N0467_IBC_SIZE } -#endif } else { @@ -1089,28 +964,20 @@ void CABACReader::pred_mode( CodingUnit& cu ) else { cu.predMode = MODE_INTER; -#if JVET_N0318_N0467_IBC_SIZE if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode { -#endif unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx))) { cu.predMode = MODE_IBC; } -#if JVET_N0318_N0467_IBC_SIZE } -#endif } } } else { -#if JVET_N0266_SMALL_BLOCKS if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) || m_BinDecoder.decodeBin( Ctx::PredMode( DeriveCtx::CtxPredModeFlag( cu ) ) ) ) -#else - if (cu.cs->slice->isIntra() || m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)))) -#endif { cu.predMode = MODE_INTRA; } @@ -1120,7 +987,6 @@ void CABACReader::pred_mode( CodingUnit& cu ) } } } -#if JVET_N0413_RDPCM void CABACReader::bdpcm_mode( CodingUnit& cu, const ComponentID compID ) { cu.bdpcmMode = 0; @@ -1138,7 +1004,6 @@ void CABACReader::bdpcm_mode( CodingUnit& cu, const ComponentID compID ) DTRACE( g_trace_ctx, D_SYNTAX, "bdpcm_mode() x=%d, y=%d, w=%d, h=%d, bdpcm=%d\n", cu.lumaPos().x, cu.lumaPos().y, cu.lwidth(), cu.lheight(), cu.bdpcmMode ); } -#endif void CABACReader::pcm_flag( CodingUnit& cu, Partitioner &partitioner ) { const SPS& sps = *cu.cs->sps; @@ -1202,26 +1067,16 @@ void CABACReader::cu_gbi_flag(CodingUnit& cu) uint32_t prefixNumBits = numGBi - 2; uint32_t step = 1; -#if !JVET_N0286_SIMPLIFIED_GBI_IDX - unsigned ctxIdGBi = 4; -#endif idx = 1; for(int ui = 0; ui < prefixNumBits; ++ui) { -#if JVET_N0286_SIMPLIFIED_GBI_IDX symbol = m_BinDecoder.decodeBinEP(); -#else - symbol = m_BinDecoder.decodeBin(Ctx::GBiIdx(ctxIdGBi)); -#endif if (symbol == 1) { break; } -#if !JVET_N0286_SIMPLIFIED_GBI_IDX - ctxIdGBi += step; -#endif idx += step; } } @@ -1269,11 +1124,7 @@ void CABACReader::extend_ref_line(CodingUnit& cu) #if !ENABLE_JVET_L0283_MRL return; #endif -#if JVET_N0413_RDPCM if ( !cu.Y().valid() || cu.predMode != MODE_INTRA || !isLuma(cu.chType) || cu.ipcm || cu.bdpcmMode ) -#else - if (!cu.Y().valid() || cu.predMode != MODE_INTRA || !isLuma(cu.chType) || cu.ipcm) -#endif { cu.firstPU->multiRefIdx = 0; return; @@ -1314,7 +1165,6 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) return; } -#if JVET_N0413_RDPCM if( cu.bdpcmMode ) { PredictionUnit *pu = cu.firstPU; @@ -1323,9 +1173,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) cu.firstPU->intraDir[0] = mpm_pred[0]; return; } -#endif -#if JVET_N0217_MATRIX_INTRAPRED mip_flag(cu); if (cu.mipFlag) { @@ -1334,7 +1182,6 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) } extend_ref_line( cu ); isp_mode( cu ); -#endif RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__INTRA_DIR_ANG, cu.lumaSize(), CHANNEL_TYPE_LUMA ); @@ -1365,15 +1212,11 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) { uint32_t ipred_idx = 0; { -#if JVET_N0185_UNIFIED_MPM unsigned ctx = (pu->cu->ispMode == NOT_INTRA_SUBPARTITIONS ? 1 : 0); if (pu->multiRefIdx == 0) ipred_idx = m_BinDecoder.decodeBin(Ctx::IntraLumaPlanarFlag(ctx)); else ipred_idx = 1; -#else - ipred_idx = m_BinDecoder.decodeBinEP(); -#endif if( ipred_idx ) { ipred_idx += m_BinDecoder.decodeBinEP(); @@ -1517,9 +1360,7 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); } -#if JVET_N0193_LFNST residual_lfnst_mode( cu ); -#endif } void CABACReader::rqt_root_cbf( CodingUnit& cu ) @@ -1636,42 +1477,30 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) } else { -#if JVET_N0324_REGULAR_MRG_FLAG if (pu.regularMergeFlag) { merge_idx(pu); } else { -#endif subblock_merge_flag( *pu.cu ); MHIntra_flag(pu); if (pu.mhIntraFlag) { -#if JVET_N0302_SIMPLFIED_CIIP pu.intraDir[0] = PLANAR_IDX; -#else - MHIntra_luma_pred_modes(*pu.cu); -#endif pu.intraDir[1] = DM_CHROMA_IDX; } -#if JVET_N0324_REGULAR_MRG_FLAG else { pu.cu->triangle = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && !pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip; } -#else - triangle_mode( *pu.cu ); -#endif if (pu.mmvdMergeFlag) { mmvd_merge_idx(pu); } else merge_data ( pu ); -#if JVET_N0324_REGULAR_MRG_FLAG } -#endif } } else if (CU::isIBC(*pu.cu)) @@ -1825,12 +1654,9 @@ void CABACReader::merge_flag( PredictionUnit& pu ) if (pu.mergeFlag && CU::isIBC(*pu.cu)) { pu.mmvdMergeFlag = false; -#if JVET_N0324_REGULAR_MRG_FLAG pu.regularMergeFlag = false; -#endif return; } -#if JVET_N0324_REGULAR_MRG_FLAG if (pu.mergeFlag) { if (!pu.cs->sps->getUseMMVD() && (pu.lwidth() * pu.lheight() == 32)) @@ -1851,15 +1677,9 @@ void CABACReader::merge_flag( PredictionUnit& pu ) } else { -#if JVET_N0127_MMVD_SPS_FLAG if (pu.cs->sps->getUseMMVD()) { -#endif -#if JVET_N0266_SMALL_BLOCKS bool isCUWithOnlyRegularAndMMVD=((pu.lwidth() == 8 && pu.lheight() == 4) || (pu.lwidth() == 4 && pu.lheight() == 8)); -#else - bool isCUWithOnlyRegularAndMMVD=((pu.lwidth() == 4 && pu.lheight() == 4) || (pu.lwidth() == 8 && pu.lheight() == 4) || (pu.lwidth() == 4 && pu.lheight() == 8)); -#endif if (isCUWithOnlyRegularAndMMVD) { pu.mmvdMergeFlag = !(pu.regularMergeFlag); @@ -1869,32 +1689,13 @@ void CABACReader::merge_flag( PredictionUnit& pu ) pu.mmvdMergeFlag = (m_BinDecoder.decodeBin(Ctx::MmvdFlag(0))); DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_merge_flag() mmvd_merge=%d pos=(%d,%d) size=%dx%d\n", pu.mmvdMergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height); } -#if JVET_N0127_MMVD_SPS_FLAG } else { pu.mmvdMergeFlag = false; } -#endif } } -#else -#if JVET_N0127_MMVD_SPS_FLAG - if (pu.mergeFlag && pu.cs->sps->getUseMMVD()) -#else - if (pu.mergeFlag) -#endif - { - pu.mmvdMergeFlag = (m_BinDecoder.decodeBin(Ctx::MmvdFlag(0))); - DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_merge_flag() mmvd_merge=%d pos=(%d,%d) size=%dx%d\n", pu.mmvdMergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height); - } -#if JVET_N0127_MMVD_SPS_FLAG - else - { - pu.mmvdMergeFlag = false; - } -#endif -#endif } @@ -1964,15 +1765,10 @@ void CABACReader::merge_idx( PredictionUnit& pu ) } return decIdx; }; -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM const int maxNumTriangleCand = pu.cs->slice->getMaxNumTriangleCand(); CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates"); candIdx0 = decodeOneIdx(maxNumTriangleCand - 1); candIdx1 = decodeOneIdx(maxNumTriangleCand - 2); -#else - candIdx0 = decodeOneIdx(TRIANGLE_MAX_NUM_UNI_CANDS - 1); - candIdx1 = decodeOneIdx(TRIANGLE_MAX_NUM_UNI_CANDS - 2); -#endif 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 ); @@ -2013,12 +1809,8 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu) mvpIdx = (var + dir0)*(MMVD_MAX_REFINE_NUM*MMVD_BASE_MV_NUM); -#if JVET_N0448_N0380 int numCand = int(pu.cs->slice->getMaxNumMergeCand()); int numCandminus1_base = (numCand > 1) ? MMVD_BASE_MV_NUM - 1 : 0; -#else - int numCandminus1_base = MMVD_BASE_MV_NUM - 1; -#endif var0 = 0; if (numCandminus1_base > 0) { @@ -2191,141 +1983,8 @@ void CABACReader::MHIntra_flag(PredictionUnit& pu) DTRACE(g_trace_ctx, D_SYNTAX, "MHIntra_flag() MHIntra=%d pos=(%d,%d) size=%dx%d\n", pu.mhIntraFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height); } -#if !JVET_N0302_SIMPLFIED_CIIP -void CABACReader::MHIntra_luma_pred_modes(CodingUnit &cu) -{ - if (!cu.Y().valid()) - { - return; - } - - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__INTRA_DIR_ANG, cu.lumaSize(), CHANNEL_TYPE_LUMA); - - const int numMPMs = 3; // Multi-hypothesis intra uses only 3 MPM - - // prev_intra_luma_pred_flag - int numBlocks = CU::getNumPUs(cu); - int mpmFlag[4]; - PredictionUnit *pu = cu.firstPU; - for (int k = 0; k < numBlocks; k++) - { - if (PU::getNarrowShape(pu->lwidth(), pu->lheight()) == 0) - { - mpmFlag[k] = m_BinDecoder.decodeBin(Ctx::MHIntraPredMode()); - } - else - { - mpmFlag[k] = 1; - } - } - - unsigned mpm_pred[numMPMs]; - for (int k = 0; k < numBlocks; k++) - { - PU::getMHIntraMPMs(*pu, mpm_pred); - - if (mpmFlag[k]) - { - unsigned pred_idx = 0; - - pred_idx = m_BinDecoder.decodeBinEP(); - if (pred_idx) - { - pred_idx += m_BinDecoder.decodeBinEP(); - } - pu->intraDir[0] = mpm_pred[pred_idx]; - } - else - { - unsigned pred_mode = 0; - - bool isMPMCand[4]; - for (unsigned i = 0; i < 4; i++) - { - isMPMCand[i] = false; - } - for (unsigned i = 0; i < 3; i++) - { - if (mpm_pred[i] == PLANAR_IDX) - { - isMPMCand[0] = true; - } - else if (mpm_pred[i] == DC_IDX) - { - isMPMCand[1] = true; - } - else if (mpm_pred[i] == HOR_IDX) - { - isMPMCand[2] = true; - } - else if (mpm_pred[i] == VER_IDX) - { - isMPMCand[3] = true; - } - } - if (!isMPMCand[0]) - { - pred_mode = PLANAR_IDX; - } - if (!isMPMCand[1]) - { - pred_mode = DC_IDX; - } - if (!isMPMCand[2]) - { - pred_mode = HOR_IDX; - } - if (!isMPMCand[3]) - { - pred_mode = VER_IDX; - } - pu->intraDir[0] = pred_mode; - } - DTRACE(g_trace_ctx, D_SYNTAX, "intra_luma_pred_modes() idx=%d pos=(%d,%d) mode=%d\n", k, pu->lumaPos().x, pu->lumaPos().y, pu->intraDir[0]); - pu = pu->next; - } -} -#endif - -#if !JVET_N0324_REGULAR_MRG_FLAG -void CABACReader::triangle_mode( CodingUnit& cu ) -{ - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__TRIANGLE_FLAG ); - - if( !cu.cs->slice->getSPS()->getUseTriangle() || !cu.cs->slice->isInterB() || cu.lwidth() * cu.lheight() < TRIANGLE_MIN_SIZE || cu.affine ) - { - return; - } - - if ( cu.firstPU->mmvdMergeFlag || cu.mmvdSkip ) - { - return; - } - - if ( cu.firstPU->mhIntraFlag ) - { - return; - } - -#if JVET_N0400_SIGNAL_TRIANGLE_CAND_NUM - if (cu.cs->slice->getMaxNumTriangleCand() < 2) - { - return; - } -#endif - -#if JVET_N600_AMVR_TPM_CTX_REDUCTION - cu.triangle = m_BinDecoder.decodeBin( Ctx::TriangleFlag(0) ); -#else - unsigned flag_idx = DeriveCtx::CtxTriangleFlag( cu ); - cu.triangle = m_BinDecoder.decodeBin( Ctx::TriangleFlag(flag_idx) ); -#endif - DTRACE( g_trace_ctx, D_SYNTAX, "triangle_mode() triangle_mode=%d pos=(%d,%d) size: %dx%d\n", cu.triangle, cu.Y().x, cu.Y().y, cu.lumaSize().width, cu.lumaSize().height ); -} -#endif - //================================================================================ // clause 7.3.8.7 //-------------------------------------------------------------------------------- @@ -2383,9 +2042,7 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, split = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); -#if JVET_N0492_NO_HIERARCH_CBF bool max_tu_split = split; -#endif if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { @@ -2402,20 +2059,12 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) { const int cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; -#if JVET_N0492_NO_HIERARCH_CBF if (!max_tu_split) -#endif { -#if !JVET_N0492_NO_HIERARCH_CBF - if (chromaCbfs.Cb) -#endif { if (!(cu.sbtInfo && trDepth == 1)) chromaCbfs.Cb &= cbf_comp(cs, area.blocks[COMPONENT_Cb], cbfDepth); } -#if !JVET_N0492_NO_HIERARCH_CBF - if (chromaCbfs.Cr) -#endif { if (!(cu.sbtInfo && trDepth == 1)) chromaCbfs.Cr &= cbf_comp(cs, area.blocks[COMPONENT_Cr], cbfDepth, chromaCbfs.Cb); @@ -2568,7 +2217,6 @@ bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__QT_CBF, area.size(), area.compID); -#if JVET_N0413_RDPCM unsigned cbf = 0; if( area.compID == COMPONENT_Y && cs.getCU( area.pos(), ChannelType( area.compID ) )->bdpcmMode ) { @@ -2578,9 +2226,6 @@ bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned { cbf = m_BinDecoder.decodeBin( ctxSet( ctxId ) ); } -#else - const unsigned cbf = m_BinDecoder.decodeBin( ctxSet( ctxId ) ); -#endif DTRACE( g_trace_ctx, D_SYNTAX, "cbf_comp() etype=%d pos=(%d,%d) ctx=%d cbf=%d\n", area.compID, area.x, area.y, ctxId, cbf ); return cbf; @@ -2750,20 +2395,17 @@ void CABACReader::cu_chroma_qp_offset( CodingUnit& cu ) // void residual_coding_subblock( coeffCtx ) //================================================================================ -#if JVET_N0054_JOINT_CHROMA void CABACReader::joint_cb_cr( TransformUnit& tu ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__JOINT_CB_CR, tu.blocks[COMPONENT_Cr].lumaSize(), CHANNEL_TYPE_CHROMA ); tu.jointCbCr = m_BinDecoder.decodeBin( Ctx::JointCbCrFlag( 0 ) ); } -#endif void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) { const CodingUnit& cu = *tu.cu; DTRACE( g_trace_ctx, D_SYNTAX, "residual_coding() etype=%d pos=(%d,%d) size=%dx%d predMode=%d\n", tu.blocks[compID].compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.blocks[compID].width, tu.blocks[compID].height, cu.predMode ); -#if JVET_N0054_JOINT_CHROMA // Joint Cb-Cr residual mode is signalled if both Cb and Cr cbfs are true if ( compID == COMPONENT_Cr && TU::getCbf( tu, COMPONENT_Cb ) ) { @@ -2773,25 +2415,17 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) if ( tu.jointCbCr ) return; } -#endif // parse transform skip and explicit rdpcm mode mts_coding ( tu, compID ); explicit_rdpcm_mode( tu, compID ); -#if JVET_N0280_RESIDUAL_CODING_TS -#if JVET_N0413_RDPCM if( isLuma( compID ) && ( tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode ) ) -#else - if( isLuma( compID ) && tu.mtsIdx == MTS_SKIP ) -#endif { residual_codingTS( tu, compID ); return; } -#endif -#if HEVC_USE_SIGN_HIDING // determine sign hiding bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF ); if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==MTS_SKIP ) @@ -2803,14 +2437,9 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) signHiding = false; } } -#endif // init coeff coding context -#if HEVC_USE_SIGN_HIDING CoeffCodingContext cctx ( tu, compID, signHiding ); -#else - CoeffCodingContext cctx ( tu, compID ); -#endif TCoeff* coeff = tu.getCoeffs( compID ).buf; // parse last coeff position @@ -2842,9 +2471,7 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) const bool tsAllowed = TU::isTSAllowed ( tu, compID ); const bool mtsAllowed = TU::isMTSAllowed( tu, compID ); -#if JVET_N0413_RDPCM if( tu.cu->bdpcmMode ) tu.mtsIdx = MTS_SKIP; -#endif if( !mtsAllowed && !tsAllowed ) return; RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__MTS_FLAGS, tu.blocks[compID], compID ); @@ -2889,17 +2516,9 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) void CABACReader::isp_mode( CodingUnit& cu ) { #if INCLUDE_ISP_CFG_FLAG -#if JVET_N0413_RDPCM if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || !cu.cs->sps->getUseISP() || cu.bdpcmMode ) #else - if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || !cu.cs->sps->getUseISP() ) -#endif -#else -#if JVET_N0413_RDPCM if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || cu.bdpcmMode ) -#else - if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm ) -#endif #endif { cu.ispMode = NOT_INTRA_SUBPARTITIONS; @@ -2961,14 +2580,9 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) } } -#if JVET_N0193_LFNST void CABACReader::residual_lfnst_mode( CodingUnit& cu ) { -#if JVET_N0217_MATRIX_INTRAPRED if( cu.ispMode != NOT_INTRA_SUBPARTITIONS || cu.mipFlag == true || -#else - if( cu.ispMode != NOT_INTRA_SUBPARTITIONS || -#endif ( CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) ) { return; @@ -2997,42 +2611,19 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu ) return; } -#if !JVET_N0105_LFNST_CTX_MODELLING - uint32_t ctxOff = 0; - - int intraMode = cu.firstPU->intraDir[ cu.chType ]; - if( intraMode == DM_CHROMA_IDX && !isLuma( cu.chType ) ) - { - intraMode = PLANAR_IDX; - } - if( cu.chromaFormat == CHROMA_422 && !isLuma( cu.chType ) ) - { - intraMode = g_chroma422IntraAngleMappingTable[ intraMode ]; - } - ctxOff = PU::isLMCMode( intraMode ) || intraMode <= DC_IDX; -#endif unsigned cctx = 0; if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++; -#if JVET_N0105_LFNST_CTX_MODELLING uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( cctx ) ); -#else - uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( ctxOff + 4 * cctx ) ); -#endif if( idxLFNST ) { -#if JVET_N0105_LFNST_CTX_MODELLING idxLFNST += m_BinDecoder.decodeBinEP(); -#else - idxLFNST += m_BinDecoder.decodeBin( Ctx::LFNSTIdx( 2 + ctxOff + 4 * cctx ) ); -#endif } cu.lfnstIdx = idxLFNST; DTRACE( g_trace_ctx, D_SYNTAX, "residual_lfnst_mode() etype=%d pos=(%d,%d) mode=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), ( int ) cu.lfnstIdx ); } -#endif int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, ComponentID compID ) { @@ -3084,13 +2675,6 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co } int blkPos; -#if HEVC_USE_MDCS - if( cctx.scanType() == SCAN_VER ) - { - blkPos = PosLastY + ( PosLastX * cctx.width() ); - } - else -#endif { blkPos = PosLastX + ( PosLastY * cctx.width() ); } @@ -3146,10 +2730,8 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co //===== decode absolute values ===== const int inferSigPos = nextSigPos != cctx.scanPosLast() ? ( cctx.isNotFirst() ? minSubPos : -1 ) : nextSigPos; -#if HEVC_USE_SIGN_HIDING int firstNZPos = nextSigPos; int lastNZPos = -1; -#endif int numNonZero = 0; bool is2x2subblock = ( cctx.log2CGSize() == 2 ); int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); @@ -3178,10 +2760,8 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co uint8_t& ctxOff = ctxOffset[ nextSigPos - minSubPos ]; ctxOff = cctx.ctxOffsetAbs(); sigBlkPos[ numNonZero++ ] = blkPos; -#if HEVC_USE_SIGN_HIDING firstNZPos = nextSigPos; lastNZPos = std::max( lastNZPos, nextSigPos ); -#endif RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 ); unsigned gt1Flag = m_BinDecoder.decodeBin( cctx.greater1CtxIdAbs(ctxOff) ); @@ -3214,10 +2794,8 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co unsigned ricePar = 0; for( int scanPos = firstSigPos; scanPos > firstPosMode2; scanPos-- ) { -#if JVET_N0188_UNIFY_RICEPARA int sumAll = cctx.templateAbsSum(scanPos, coeff, 4); ricePar = g_auiGoRiceParsCoeff[sumAll]; -#endif TCoeff& tcoeff = coeff[ cctx.blockPos( scanPos ) ]; if( tcoeff >= 4 ) { @@ -3225,23 +2803,13 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co int rem = m_BinDecoder.decodeRemAbsEP( ricePar, cctx.extPrec(), cctx.maxLog2TrDRange() ); DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, ricePar ); tcoeff += (rem<<1); -#if !JVET_N0188_UNIFY_RICEPARA - if( ricePar < 3 && rem > (3<= minSubPos; scanPos-- ) { -#if JVET_N0188_UNIFY_RICEPARA int sumAll = cctx.templateAbsSum(scanPos, coeff, 0); -#else - int sumAll = cctx.templateAbsSum(scanPos, coeff); -#endif int rice = g_auiGoRiceParsCoeff [sumAll]; int pos0 = g_auiGoRicePosCoeff0[std::max(0, state - 1)][sumAll]; int rem = m_BinDecoder.decodeRemAbsEP( rice, cctx.extPrec(), cctx.maxLog2TrDRange() ); @@ -3253,36 +2821,25 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co { int blkPos = cctx.blockPos( scanPos ); sigBlkPos[ numNonZero++ ] = blkPos; -#if HEVC_USE_SIGN_HIDING lastNZPos = std::max( lastNZPos, scanPos ); -#endif coeff[blkPos] = tcoeff; } } //===== decode sign's ===== RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__SIGN_BIT, Size( cctx.width(), cctx.height() ), cctx.compID() ); -#if HEVC_USE_SIGN_HIDING const unsigned numSigns = ( cctx.hideSign( firstNZPos, lastNZPos ) ? numNonZero - 1 : numNonZero ); unsigned signPattern = m_BinDecoder.decodeBinsEP( numSigns ) << ( 32 - numSigns ); -#else - unsigned signPattern = m_BinDecoder.decodeBinsEP( numNonZero ) << ( 32 - numNonZero ); -#endif //===== set final coefficents ===== int sumAbs = 0; -#if HEVC_USE_SIGN_HIDING for( unsigned k = 0; k < numSigns; k++ ) -#else - for( unsigned k = 0; k < numNonZero; k++ ) -#endif { int AbsCoeff = coeff[ sigBlkPos[ k ] ]; sumAbs += AbsCoeff; coeff[ sigBlkPos[k] ] = ( signPattern & ( 1u << 31 ) ? -AbsCoeff : AbsCoeff ); signPattern <<= 1; } -#if HEVC_USE_SIGN_HIDING if( numNonZero > numSigns ) { int k = numSigns; @@ -3290,20 +2847,14 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co sumAbs += AbsCoeff; coeff[ sigBlkPos[k] ] = ( sumAbs & 1 ? -AbsCoeff : AbsCoeff ); } -#endif } -#if JVET_N0280_RESIDUAL_CODING_TS void CABACReader::residual_codingTS( TransformUnit& tu, ComponentID compID ) { DTRACE( g_trace_ctx, D_SYNTAX, "residual_codingTS() etype=%d pos=(%d,%d) size=%dx%d\n", tu.blocks[compID].compID, tu.blocks[compID].x, tu.blocks[compID].y, tu.blocks[compID].width, tu.blocks[compID].height ); // init coeff coding context -#if JVET_N0413_RDPCM CoeffCodingContext cctx ( tu, compID, false, tu.cu->bdpcmMode ); -#else - CoeffCodingContext cctx ( tu, compID, false ); -#endif TCoeff* coeff = tu.getCoeffs( compID ).buf; cctx.setNumCtxBins( 2 * tu.lwidth()*tu.lheight() ); @@ -3390,11 +2941,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* int sign; if( cctx.isContextCoded() ) { -#if JVET_N0413_RDPCM sign = m_BinDecoder.decodeBin( Ctx::TsResidualSign( cctx.bdpcm() ? 1 : 0 ) ); -#else - sign = m_BinDecoder.decodeBin( Ctx::TsResidualSign( toChannelType( cctx.compID() ) ) ); -#endif } else { @@ -3489,7 +3036,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* signPattern >>= 1; } } -#endif //================================================================================ @@ -3575,7 +3121,6 @@ unsigned CABACReader::exp_golomb_eqprob( unsigned count ) return symbol; } -#if JVET_N0217_MATRIX_INTRAPRED unsigned CABACReader::code_unary_fixed( unsigned ctxId, unsigned unary_max, unsigned fixed ) { unsigned idx; @@ -3668,4 +3213,3 @@ void CABACReader::mip_pred_mode( PredictionUnit &pu ) DTRACE( g_trace_ctx, D_SYNTAX, "mip_pred_mode() pos=(%d,%d) mode=%d\n", pu.lumaPos().x, pu.lumaPos().y, pu.intraDir[CHANNEL_TYPE_LUMA] ); } -#endif diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index eb03163ac4131e88ad45a5bb32ee7426abe9f594..72868ea7f0e409871ac6e5bee45dcb4a2187bf0b 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -68,9 +68,7 @@ public: // sao (clause 7.3.8.3) void sao ( CodingStructure& cs, unsigned ctuRsAddr ); -#if JVET_N0415_CTB_ALF void readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr); -#endif // coding (quad)tree (clause 7.3.8.4) bool coding_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, Partitioner* pPartitionerChroma = nullptr, CUCtx* pCuCtxChroma = nullptr); @@ -81,9 +79,7 @@ public: void cu_transquant_bypass_flag ( CodingUnit& cu ); void cu_skip_flag ( CodingUnit& cu ); void pred_mode ( CodingUnit& cu ); -#if JVET_N0413_RDPCM void bdpcm_mode ( CodingUnit& cu, const ComponentID compID ); -#endif void pcm_flag ( CodingUnit& cu, Partitioner& pm ); void cu_pred_data ( CodingUnit& cu ); void cu_gbi_flag ( CodingUnit& cu ); @@ -96,11 +92,9 @@ public: void rqt_root_cbf ( CodingUnit& cu ); void sbt_mode ( CodingUnit& cu ); bool end_of_ctu ( CodingUnit& cu, CUCtx& cuCtx ); -#if JVET_N0217_MATRIX_INTRAPRED void mip_flag ( CodingUnit& cu ); void mip_pred_modes ( CodingUnit& cu ); void mip_pred_mode ( PredictionUnit& pu ); -#endif // prediction unit (clause 7.3.8.6) void prediction_unit ( PredictionUnit& pu, MergeCtx& mrgCtx ); @@ -117,9 +111,6 @@ public: void mvp_flag ( PredictionUnit& pu, RefPicList eRefList ); void MHIntra_flag ( PredictionUnit& pu ); void MHIntra_luma_pred_modes ( CodingUnit& cu ); -#if !JVET_N0324_REGULAR_MRG_FLAG - void triangle_mode ( CodingUnit& cu ); -#endif void smvd_mode ( PredictionUnit& pu ); // pcm samples (clause 7.3.8.7) @@ -140,20 +131,14 @@ public: // residual coding (clause 7.3.8.11) void residual_coding ( TransformUnit& tu, ComponentID compID ); void mts_coding ( TransformUnit& tu, ComponentID compID ); -#if JVET_N0193_LFNST void residual_lfnst_mode ( CodingUnit& cu ); -#endif void isp_mode ( CodingUnit& cu ); void explicit_rdpcm_mode ( TransformUnit& tu, ComponentID compID ); int last_sig_coeff ( CoeffCodingContext& cctx, TransformUnit& tu, ComponentID compID ); void residual_coding_subblock ( CoeffCodingContext& cctx, TCoeff* coeff, const int stateTransTable, int& state ); -#if JVET_N0280_RESIDUAL_CODING_TS void residual_codingTS ( TransformUnit& tu, ComponentID compID ); void residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* coeff ); -#endif -#if JVET_N0054_JOINT_CHROMA void joint_cb_cr ( TransformUnit& tu ); -#endif // cross component prediction (clause 7.3.8.12) void cross_comp_pred ( TransformUnit& tu, ComponentID compID ); @@ -163,9 +148,7 @@ private: unsigned unary_max_eqprob ( unsigned maxSymbol ); unsigned exp_golomb_eqprob ( unsigned count ); unsigned get_num_bits_read () { return m_BinDecoder.getNumBitsRead(); } -#if JVET_N0217_MATRIX_INTRAPRED unsigned code_unary_fixed ( unsigned ctxId, unsigned unary_max, unsigned fixed ); -#endif void xReadTruncBinCode(uint32_t& symbol, uint32_t maxSymbol); public: diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index f745f6603a83b19495d027b8ed8010d69cea1e07..9dfb9f0ed9f0d55697a33e2f4db68c7619c4414e 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -122,9 +122,6 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) if ((currCU.shareParentPos.x >= 0) && (!(currCU.shareParentPos.x == prevTmpPos.x && currCU.shareParentPos.y == prevTmpPos.y))) { m_shareStateDec = GEN_ON_SHARED_BOUND; -#if !JVET_N0266_SMALL_BLOCKS - cs.motionLut.lutShare = cs.motionLut.lut; -#endif cs.motionLut.lutShareIbc = cs.motionLut.lutIbc; } @@ -198,7 +195,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } else { -#if JVET_N0217_MATRIX_INTRAPRED if( PU::isMIP( pu, chType ) ) { m_pcIntraPred->initIntraMip( pu ); @@ -206,27 +202,12 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } else { -#endif m_pcIntraPred->predIntraAng( compID, piPred, pu ); -#if JVET_N0217_MATRIX_INTRAPRED } -#endif } const Slice &slice = *cs.slice; -#if JVET_N0805_APS_LMCS bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#else - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#endif -#if JVET_N0477_LMCS_CLEANUP -#if JVET_N0805_APS_LMCS if (flag && slice.getLmcsChromaResidualScaleFlag() && (compID != COMPONENT_Y) && (tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr])) -#else - if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID != COMPONENT_Y) && (tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr])) -#endif -#else - if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID != COMPONENT_Y)) -#endif { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); const CompArea &areaY = CompArea(COMPONENT_Y, tu.chromaFormat, area); @@ -241,12 +222,10 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) const QpParam cQP( tu, compID ); -#if JVET_N0054_JOINT_CHROMA // Joint chroma residual mode: Cr uses negative of the signalled Cb residual if ( tu.jointCbCr && compID == COMPONENT_Cr ) piResi.copyAndNegate( cs.getResiBuf( tu.blocks[COMPONENT_Cb] ) ); else -#endif if( TU::getCbf( tu, compID ) ) { m_pcTrQuant->invTransformNxN( tu, compID, piResi, cQP ); @@ -258,15 +237,9 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) //===== reconstruction ===== flag = flag && (tu.blocks[compID].width*tu.blocks[compID].height > 4); -#if JVET_N0805_APS_LMCS if (flag && TU::getCbf(tu, compID) && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag()) -#else - if (flag && TU::getCbf(tu, compID) && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj()) -#endif { -#if JVET_N0054_JOINT_CHROMA if ( !(tu.jointCbCr && compID == COMPONENT_Cr) ) // // Joint chroma residual mode: chroma scaling took place already when doing Cb -#endif piResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); } if( isChroma(compID) && tu.compAlpha[compID] != 0 ) @@ -289,11 +262,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred; #endif -#if JVET_N0805_APS_LMCS if (slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#endif { #if REUSE_CU_RESULTS { @@ -310,11 +279,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) #if !KEEP_PRED_AND_RESI_SIGNALS pReco.copyFrom( piPred ); #endif -#if JVET_N0805_APS_LMCS if (slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#else - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) -#endif { #if REUSE_CU_RESULTS { @@ -496,11 +461,7 @@ void DecCu::xReconInter(CodingUnit &cu) if (cu.firstPU->mhIntraFlag) { -#if JVET_N0805_APS_LMCS if (cu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) -#endif { cu.cs->getPredBuf(*cu.firstPU).Y().rspSignal(m_pcReshape->getFwdLUT()); } @@ -525,11 +486,7 @@ void DecCu::xReconInter(CodingUnit &cu) CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred; #endif -#if JVET_N0805_APS_LMCS if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) -#endif { #if REUSE_CU_RESULTS if (cs.pcv->isEncoder) @@ -547,11 +504,7 @@ void DecCu::xReconInter(CodingUnit &cu) cs.getResiBuf( cu ).reconstruct( cs.getPredBuf( cu ), cs.getResiBuf( cu ), cs.slice->clpRngs() ); cs.getRecoBuf( cu ).copyFrom ( cs.getResiBuf( cu ) ); #endif -#if JVET_N0805_APS_LMCS if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) -#else - if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()) -#endif { #if REUSE_CU_RESULTS if (cs.pcv->isEncoder) @@ -564,11 +517,7 @@ void DecCu::xReconInter(CodingUnit &cu) else { cs.getRecoBuf(cu).copyClip(cs.getPredBuf(cu), cs.slice->clpRngs()); -#if JVET_N0805_APS_LMCS if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && !cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#else - if (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && !cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) -#endif { cs.getRecoBuf(cu).get(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT()); } @@ -593,12 +542,10 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) const QpParam cQP(currTU, compID); -#if JVET_N0054_JOINT_CHROMA // Joint chroma residual mode: Cr uses negative of the signalled Cb residual if ( currTU.jointCbCr && compID == COMPONENT_Cr ) resiBuf.copyAndNegate( cs.getResiBuf( currTU.blocks[COMPONENT_Cb] ) ); else -#endif if( TU::getCbf( currTU, compID ) ) { m_pcTrQuant->invTransformNxN( currTU, compID, resiBuf, cQP ); @@ -610,15 +557,9 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) //===== reconstruction ===== const Slice &slice = *cs.slice; -#if JVET_N0805_APS_LMCS if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && isChroma(compID) && TU::getCbf(currTU, compID) && slice.getLmcsChromaResidualScaleFlag() && currTU.blocks[compID].width*currTU.blocks[compID].height > 4) -#else - if ( slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && isChroma(compID) && TU::getCbf(currTU, compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj() && currTU.blocks[compID].width*currTU.blocks[compID].height > 4 ) -#endif { -#if JVET_N0054_JOINT_CHROMA if ( !(currTU.jointCbCr && compID == COMPONENT_Cr) ) // Joint chroma residual mode: chroma scaling took place already when doing Cb -#endif resiBuf.scaleSignal(currTU.getChromaAdj(), 0, currTU.cu->cs->slice->clpRng(compID)); } if( isChroma( compID ) && currTU.compAlpha[compID] != 0 ) @@ -644,15 +585,7 @@ void DecCu::xDecodeInterTexture(CodingUnit &cu) { CodingStructure &cs = *cu.cs; const Slice &slice = *cs.slice; -#if JVET_N0477_LMCS_CLEANUP -#if JVET_N0805_APS_LMCS if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && slice.getLmcsChromaResidualScaleFlag() && (compID == COMPONENT_Y) && (currTU.cbf[COMPONENT_Cb] || currTU.cbf[COMPONENT_Cr])) -#else - if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID == COMPONENT_Y) && (currTU.cbf[COMPONENT_Cb] || currTU.cbf[COMPONENT_Cr])) -#endif -#else - if (slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID == COMPONENT_Y)) -#endif { const CompArea &areaY = currTU.blocks[COMPONENT_Y]; PelBuf predY = cs.getPredBuf(areaY); @@ -711,10 +644,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) { if( pu.cu->triangle ) { -#if JVET_N0340_TRI_MERGE_CAND && !JVET_N0266_SMALL_BLOCKS - pu.shareParentPos = cu.shareParentPos; - pu.shareParentSize = cu.shareParentSize; -#endif PU::getTriangleMergeCandidates( pu, m_triangleMrgCtx ); } else @@ -772,10 +701,8 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } else { -#if JVET_N0843_BVP_SIMPLIFICATION pu.shareParentPos = cu.shareParentPos; pu.shareParentSize = cu.shareParentSize; -#endif #if REUSE_CU_RESULTS if ( cu.imv && !pu.cu->affine && !cu.cs->pcv->isEncoder ) #else @@ -822,11 +749,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) mvLB = affineAMVPInfo.mvCandLB[mvp_idx] + pu.mvdAffi[eRefList][2]; mvLB += pu.mvdAffi[eRefList][0]; } -#if JVET_N0334_MVCLIPPING PU::setAllAffineMv(pu, mvLT, mvRT, mvLB, eRefList, true); -#else - PU::setAllAffineMv( pu, mvLT, mvRT, mvLB, eRefList ); -#endif } } } @@ -843,9 +766,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) mvd.changeIbcPrecAmvr2Internal(pu.cu->imv); } pu.mv[REF_PIC_LIST_0] = amvpInfo.mvCand[pu.mvpIdx[REF_PIC_LIST_0]] + mvd; -#if JVET_N0334_MVCLIPPING pu.mv[REF_PIC_LIST_0].mvCliptoStorageBitDepth(); -#endif } else { @@ -862,9 +783,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) pu.mvd[eRefList].changeTransPrecAmvr2Internal(pu.cu->imv); } pu.mv[eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + pu.mvd[eRefList]; -#if JVET_N0334_MVCLIPPING pu.mv[eRefList].mvCliptoStorageBitDepth(); -#endif } } } diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 2c56028fe8ce21ce7a08c3b4bef1787f4164cc0d..0775a62a02464bae989e228259edc58d90a70a5b 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -201,9 +201,7 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri if( pic->cs->sps->getALFEnabledFlag() ) { -#if JVET_N0415_CTB_ALF std::copy(pic->getAlfCtbFilterIndexVec().begin(), pic->getAlfCtbFilterIndexVec().end(), pcEncPic->getAlfCtbFilterIndexVec().begin()); -#endif for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { std::copy( pic->getAlfCtuEnableFlag()[compIdx].begin(), pic->getAlfCtuEnableFlag()[compIdx].end(), pcEncPic->getAlfCtuEnableFlag()[compIdx].begin() ); @@ -211,24 +209,13 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri for( int i = 0; i < pic->slices.size(); i++ ) { -#if JVET_N0415_CTB_ALF pcEncPic->slices[i]->setTileGroupNumAps(pic->slices[i]->getTileGroupNumAps()); -#if JVET_N0805_APS_LMCS pcEncPic->slices[i]->setAlfAPSs(pic->slices[i]->getTileGroupApsIdLuma()); pcEncPic->slices[i]->setAlfAPSs(pic->slices[i]->getAlfAPSs()); -#else - pcEncPic->slices[i]->setAPSs(pic->slices[i]->getTileGroupApsIdLuma()); - pcEncPic->slices[i]->setAPSs(pic->slices[i]->getAPSs()); -#endif pcEncPic->slices[i]->setTileGroupApsIdChroma(pic->slices[i]->getTileGroupApsIdChroma()); pcEncPic->slices[i]->setTileGroupAlfEnabledFlag(COMPONENT_Y, pic->slices[i]->getTileGroupAlfEnabledFlag(COMPONENT_Y)); pcEncPic->slices[i]->setTileGroupAlfEnabledFlag(COMPONENT_Cb, pic->slices[i]->getTileGroupAlfEnabledFlag(COMPONENT_Cb)); pcEncPic->slices[i]->setTileGroupAlfEnabledFlag(COMPONENT_Cr, pic->slices[i]->getTileGroupAlfEnabledFlag(COMPONENT_Cr)); -#else - pcEncPic->slices[i]->setAPSId(pic->slices[i]->getAPSId()); - pcEncPic->slices[i]->setAPS( pic->slices[i]->getAPS()); - pcEncPic->slices[i]->setTileGroupAlfEnabledFlag( pic->slices[i]->getTileGroupAlfEnabledFlag()); -#endif } } @@ -579,21 +566,12 @@ void DecLib::executeLoopFilters() if( cs.sps->getALFEnabledFlag() ) { -#if JVET_N0415_CTB_ALF if (cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) -#else - if (cs.slice->getTileGroupAlfEnabledFlag()) -#endif { // ALF decodes the differentially coded coefficients and stores them in the parameters structure. // Code could be restructured to do directly after parsing. So far we just pass a fresh non-const // copy in case the APS gets used more than once. -#if JVET_N0415_CTB_ALF m_cALF.ALFProcess(cs); -#else - AlfSliceParam alfParamCopy = cs.aps->getAlfAPSParam(); - m_cALF.ALFProcess(cs, alfParamCopy); -#endif } } @@ -754,16 +732,8 @@ void DecLib::xActivateParameterSets() { if (m_bFirstSliceInPicture) { -#if JVET_N0415_CTB_ALF APS** apss = m_parameterSetManager.getAPSs(); memset(apss, 0, sizeof(*apss) * MAX_NUM_APS); -#else - APS *aps = m_parameterSetManager.getAPS(m_apcSlicePilot->getAPSId()); // this is a temporary APS object. Do not store this value - if (m_apcSlicePilot->getAPSId() != -1) - { - CHECK(aps == 0, "No APS present"); - } -#endif const PPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value CHECK(pps == 0, "No PPS present"); @@ -781,31 +751,18 @@ void DecLib::xActivateParameterSets() { THROW("Parameter set activation failed!"); } -#if JVET_N0415_CTB_ALF m_parameterSetManager.getApsMap()->clear(); //luma APSs for (int i = 0; i < m_apcSlicePilot->getTileGroupApsIdLuma().size(); i++) { int apsId = m_apcSlicePilot->getTileGroupApsIdLuma()[i]; -#if JVET_N0805_APS_LMCS APS* aps = m_parameterSetManager.getAPS(apsId, ALF_APS); -#else - APS* aps = m_parameterSetManager.getAPS(apsId); -#endif if (aps) { -#if JVET_N0805_APS_LMCS m_parameterSetManager.clearAPSChangedFlag(apsId, ALF_APS); -#else - m_parameterSetManager.clearAPSChangedFlag(apsId); -#endif apss[apsId] = aps; -#if JVET_N0805_APS_LMCS if (false == m_parameterSetManager.activateAPS(apsId, ALF_APS)) -#else - if (false == m_parameterSetManager.activateAPS(apsId)) -#endif { THROW("APS activation failed!"); } @@ -814,40 +771,17 @@ void DecLib::xActivateParameterSets() //chroma APS int apsId = m_apcSlicePilot->getTileGroupApsIdChroma(); -#if JVET_N0805_APS_LMCS APS* aps = m_parameterSetManager.getAPS(apsId, ALF_APS); -#else - APS* aps = m_parameterSetManager.getAPS(apsId); -#endif if (aps) { -#if JVET_N0805_APS_LMCS m_parameterSetManager.clearAPSChangedFlag(apsId, ALF_APS); -#else - m_parameterSetManager.clearAPSChangedFlag(apsId); -#endif apss[apsId] = aps; -#if JVET_N0805_APS_LMCS if (false == m_parameterSetManager.activateAPS(apsId, ALF_APS)) -#else - if (false == m_parameterSetManager.activateAPS(apsId)) -#endif - { - THROW("APS activation failed!"); - } - } -#else - if (aps) - { - m_parameterSetManager.clearAPSChangedFlag(aps->getAPSId()); - if (false == m_parameterSetManager.activateAPS(m_apcSlicePilot->getAPSId())) { THROW("APS activation failed!"); } } -#endif -#if JVET_N0805_APS_LMCS APS* lmcsAPS = NULL; if (m_apcSlicePilot->getLmcsAPSId() != -1) { @@ -863,7 +797,6 @@ void DecLib::xActivateParameterSets() THROW("LMCS APS activation failed!"); } } -#endif xParsePrefixSEImessages(); @@ -877,23 +810,9 @@ void DecLib::xActivateParameterSets() // Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use. m_pcPic = xGetNewPicBuffer (*sps, *pps, m_apcSlicePilot->getTLayer()); -#if JVET_M0128 m_apcSlicePilot->applyReferencePictureListBasedMarking(m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1()); -#else - m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); -#endif -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS m_pcPic->finalInit(*sps, *pps, apss, *lmcsAPS); -#else - m_pcPic->finalInit(*sps, *pps, apss); -#endif -#else - m_pcPic->finalInit(*sps, *pps, *aps); -#endif -#if JVET_N0857_RECT_SLICES m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId())->setNumBricksInPic((int)m_pcPic->brickMap->bricks.size()); -#endif m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth ); m_pcPic->cs->createCoeffs(); @@ -906,9 +825,6 @@ void DecLib::xActivateParameterSets() Slice *pSlice = m_pcPic->slices[m_uiSliceSegmentIdx]; // Update the PPS and SPS pointers with the ones of the picture. -#if !JVET_N0415_CTB_ALF - aps= pSlice->getAPS(); -#endif pps=pSlice->getPPS(); sps=pSlice->getSPS(); @@ -916,18 +832,8 @@ void DecLib::xActivateParameterSets() m_pcPic->cs->slice = pSlice; m_pcPic->cs->sps = sps; m_pcPic->cs->pps = pps; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(m_pcPic->cs->alfApss, apss, sizeof(m_pcPic->cs->alfApss)); -#else - memcpy(m_pcPic->cs->apss, apss, sizeof(m_pcPic->cs->apss)); -#endif -#else - m_pcPic->cs->aps = aps; -#endif -#if JVET_N0805_APS_LMCS m_pcPic->cs->lmcsAps = lmcsAPS; -#endif #if HEVC_VPS m_pcPic->cs->vps = pSlice->getVPS(); @@ -1000,35 +906,15 @@ void DecLib::xActivateParameterSets() const SPS *sps = pSlice->getSPS(); const PPS *pps = pSlice->getPPS(); -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS APS** apss = pSlice->getAlfAPSs(); -#else - APS** apss = pSlice->getAPSs(); -#endif -#else - APS *aps = pSlice->getAPS(); -#endif -#if JVET_N0805_APS_LMCS APS *lmcsAPS = pSlice->getLmcsAPS(); -#endif // fix Parameter Sets, now that we have the real slice m_pcPic->cs->slice = pSlice; m_pcPic->cs->sps = sps; m_pcPic->cs->pps = pps; -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(m_pcPic->cs->alfApss, apss, sizeof(m_pcPic->cs->alfApss)); -#else - memcpy(m_pcPic->cs->apss, apss, sizeof(m_pcPic->cs->apss)); -#endif -#else - m_pcPic->cs->aps = aps; -#endif -#if JVET_N0805_APS_LMCS m_pcPic->cs->lmcsAps = lmcsAPS; -#endif #if HEVC_VPS m_pcPic->cs->vps = pSlice->getVPS(); @@ -1044,33 +930,19 @@ void DecLib::xActivateParameterSets() { EXIT("Error - a new PPS has been decoded while processing a picture"); } -#if JVET_N0415_CTB_ALF for (int i = 0; i < MAX_NUM_APS; i++) { -#if JVET_N0805_APS_LMCS APS* aps = m_parameterSetManager.getAPS(i, ALF_APS); if (aps && m_parameterSetManager.getAPSChangedFlag(i, ALF_APS)) -#else - APS* aps = m_parameterSetManager.getAPS(i); - if (aps && m_parameterSetManager.getAPSChangedFlag(i)) -#endif { EXIT("Error - a new APS has been decoded while processing a picture"); } } -#else - if (aps && m_parameterSetManager.getAPSChangedFlag(aps->getAPSId())) - { - EXIT("Error - a new APS has been decoded while processing a picture"); - } -#endif -#if JVET_N0805_APS_LMCS if (lmcsAPS && m_parameterSetManager.getAPSChangedFlag(lmcsAPS->getAPSId(), LMCS_APS) ) { EXIT("Error - a new LMCS APS has been decoded while processing a picture"); } -#endif xParsePrefixSEImessages(); @@ -1126,14 +998,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); -#if !JVET_M0101_HLS - bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || - m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || - m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || - m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || - m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); - m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); -#endif m_apcSlicePilot->setTLayer(nalu.m_temporalId); m_HLSReader.setBitstream( &nalu.getBitstream() ); @@ -1168,14 +1032,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl //For inference of NoOutputOfPriorPicsFlag if (m_apcSlicePilot->getRapPicFlag()) { -#if !JVET_M0101_HLS - if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsCvsStartFlag())) -#else if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsCvsStartFlag())) -#endif { m_apcSlicePilot->setNoRaslOutputFlag(true); } @@ -1208,11 +1066,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } //For inference of PicOutputFlag -#if !JVET_M0101_HLS - if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R) -#else if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL) -#endif { if ( m_craNoRaslOutputFlag ) { @@ -1229,13 +1083,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl int iMaxPOClsb = 1 << sps->getBitsForPOC(); m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) ); xUpdatePreviousTid0POC(m_apcSlicePilot); -#if !JVET_N0415_CTB_ALF - if (m_apcSlicePilot->getAPSId() != -1) - { - APS *aps = m_parameterSetManager.getAPS(m_apcSlicePilot->getAPSId()); - CHECK(aps == 0, "No APS present"); - } -#endif } // Skip pictures due to random access @@ -1247,14 +1094,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl return false; } // Skip TFD pictures associated with BLA/BLANT pictures -#if !JVET_M0101_HLS - if (isSkipPictureForBLA(iPOCLastDisplay)) - { - m_prevSliceSkipped = true; - m_skippedPOC = m_apcSlicePilot->getPOC(); - return false; - } -#endif // clear previous slice skipped flag m_prevSliceSkipped = false; @@ -1284,17 +1123,10 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl //detect lost reference picture and insert copy of earlier frame. { int lostPoc; -#if JVET_M0128 while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL0(), 0, true)) > 0) xCreateLostPicture(lostPoc - 1); while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL1(), 1, true)) > 0) xCreateLostPicture(lostPoc - 1); -#else - while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0) - { - xCreateLostPicture(lostPoc-1); - } -#endif } m_prevPOC = m_apcSlicePilot->getPOC(); @@ -1320,20 +1152,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses. // Now, having set up the maps, convert them to the correct form. -#if JVET_N0857_TILES_BRICKS const BrickMap& tileMap = *(m_pcPic->brickMap); -#else - const TileMap& tileMap = *(m_pcPic->tileMap); -#endif -#if !JVET_N0857_RECT_SLICES -#if JVET_N0857_TILES_BRICKS - pcSlice->setSliceCurStartCtuTsAddr( tileMap.getCtuRsToBsAddrMap(pcSlice->getSliceCurStartCtuTsAddr()) ); - pcSlice->setSliceCurEndCtuTsAddr( tileMap.getCtuRsToBsAddrMap(pcSlice->getSliceCurEndCtuTsAddr()) ); -#else - pcSlice->setSliceCurStartCtuTsAddr( tileMap.getCtuRsToTsAddrMap(pcSlice->getSliceCurStartCtuTsAddr()) ); - pcSlice->setSliceCurEndCtuTsAddr( tileMap.getCtuRsToTsAddrMap(pcSlice->getSliceCurEndCtuTsAddr()) ); -#endif -#else const uint32_t numberOfCtusInFrame = m_pcPic->cs->pcv->sizeInCtus; uint32_t startCtuIdx = 0; @@ -1358,16 +1177,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->setSliceCurStartCtuTsAddr(startCtuIdx); pcSlice->setSliceCurEndCtuTsAddr(endCtuIdx); -#endif -#if JVET_M0128 pcSlice->checkCRA(pcSlice->getRPL0(), pcSlice->getRPL1(), m_pocCRA, m_associatedIRAPType, m_cListPic); pcSlice->constructRefPicList(m_cListPic); -#else - pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); - // Set reference list - pcSlice->setRefPicList( m_cListPic, true, true ); -#endif if (!pcSlice->isIntra()) { @@ -1396,15 +1208,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->setCheckLDC(bLowDelay); } -#if JVET_N0235_SMVD_SPS if (pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false -#if !JVET_N0470_SMVD_FIX - && pcSlice->getMvdL1ZeroFlag() == false -#endif ) -#else - if ( pcSlice->getCheckLDC() == false && pcSlice->getMvdL1ZeroFlag() == false ) -#endif { int currPOC = pcSlice->getPOC(); @@ -1484,7 +1289,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->setRefPOCList(); -#if HEVC_USE_SCALING_LISTS Quant *quant = m_cTrQuant.getQuant(); if(pcSlice->getSPS()->getScalingListFlag()) @@ -1509,12 +1313,10 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { quant->setUseScalingList(false); } -#endif if (pcSlice->getSPS()->getUseReshaper()) { -#if JVET_N0805_APS_LMCS if (pcSlice->getLmcsEnabledFlag()) { APS* lmcsAPS = pcSlice->getLmcsAPS(); @@ -1535,15 +1337,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl tInfo.setSliceReshapeChromaAdj(false); tInfo.setSliceReshapeModelPresentFlag(false); } -#endif -#if !JVET_N0805_APS_LMCS - m_cReshaper.copySliceReshaperInfo(m_cReshaper.getSliceReshaperInfo(), pcSlice->getReshapeInfo()); -#endif -#if JVET_N0805_APS_LMCS if (pcSlice->getLmcsEnabledFlag()) -#else - if (pcSlice->getReshapeInfo().getSliceReshapeModelPresentFlag()) -#endif { m_cReshaper.constructReshaper(); } @@ -1585,19 +1379,13 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl return false; } -#if HEVC_VPS || JVET_N0278_HLS void DecLib::xDecodeVPS( InputNALUnit& nalu ) { VPS* vps = new VPS(); m_HLSReader.setBitstream( &nalu.getBitstream() ); m_HLSReader.parseVPS( vps ); -#if !JVET_N0278_HLS - m_parameterSetManager.storeVPS( vps, nalu.getBitstream().getFifo() ); -#endif } -#endif -#if JVET_N0349_DPS void DecLib::xDecodeDPS( InputNALUnit& nalu ) { DPS* dps = new DPS(); @@ -1605,7 +1393,6 @@ void DecLib::xDecodeDPS( InputNALUnit& nalu ) m_HLSReader.parseDPS( dps ); m_parameterSetManager.storeDPS( dps, nalu.getBitstream().getFifo() ); } -#endif void DecLib::xDecodeSPS( InputNALUnit& nalu ) { @@ -1621,11 +1408,7 @@ void DecLib::xDecodePPS( InputNALUnit& nalu ) { PPS* pps = new PPS(); m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND m_HLSReader.parsePPS( pps, &m_parameterSetManager ); -#else - m_HLSReader.parsePPS( pps ); -#endif m_parameterSetManager.storePPS( pps, nalu.getBitstream().getFifo() ); } @@ -1634,20 +1417,14 @@ void DecLib::xDecodeAPS(InputNALUnit& nalu) APS* aps = new APS(); m_HLSReader.setBitstream(&nalu.getBitstream()); m_HLSReader.parseAPS(aps); -#if JVET_N0415_CTB_ALF aps->setTemporalId(nalu.m_temporalId); -#endif m_parameterSetManager.storeAPS(aps, nalu.getBitstream().getFifo()); } bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) { bool ret; // ignore all NAL units of layers > 0 -#if JVET_N0278_HLS if (getTargetDecLayer() >= 0 && nalu.m_nuhLayerId != getTargetDecLayer()) //TBC: ignore bitstreams whose nuh_layer_id is not the target layer id -#else - if (nalu.m_nuhLayerId > 0) -#endif { msg( WARNING, "Warning: found NAL unit with nuh_layer_id equal to %d. Ignoring.\n", nalu.m_nuhLayerId); return false; @@ -1655,17 +1432,13 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) switch (nalu.m_nalUnitType) { -#if HEVC_VPS || JVET_N0278_HLS case NAL_UNIT_VPS: xDecodeVPS( nalu ); return false; -#endif -#if JVET_N0349_DPS case NAL_UNIT_DPS: xDecodeDPS( nalu ); return false; -#endif case NAL_UNIT_SPS: xDecodeSPS( nalu ); @@ -1694,24 +1467,6 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) } return false; -#if !JVET_M0101_HLS - case NAL_UNIT_CODED_SLICE_TRAIL_R: - case NAL_UNIT_CODED_SLICE_TRAIL_N: - case NAL_UNIT_CODED_SLICE_TSA_R: - case NAL_UNIT_CODED_SLICE_TSA_N: - case NAL_UNIT_CODED_SLICE_STSA_R: - case NAL_UNIT_CODED_SLICE_STSA_N: - case NAL_UNIT_CODED_SLICE_BLA_W_LP: - case NAL_UNIT_CODED_SLICE_BLA_W_RADL: - case NAL_UNIT_CODED_SLICE_BLA_N_LP: - case NAL_UNIT_CODED_SLICE_IDR_W_RADL: - case NAL_UNIT_CODED_SLICE_IDR_N_LP: - case NAL_UNIT_CODED_SLICE_CRA: - case NAL_UNIT_CODED_SLICE_RADL_N: - case NAL_UNIT_CODED_SLICE_RADL_R: - case NAL_UNIT_CODED_SLICE_RASL_N: - case NAL_UNIT_CODED_SLICE_RASL_R: -#else case NAL_UNIT_CODED_SLICE_TRAIL: case NAL_UNIT_CODED_SLICE_STSA: case NAL_UNIT_CODED_SLICE_IDR_W_RADL: @@ -1719,7 +1474,6 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) case NAL_UNIT_CODED_SLICE_CRA: case NAL_UNIT_CODED_SLICE_RADL: case NAL_UNIT_CODED_SLICE_RASL: -#endif ret = xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); #if JVET_J0090_MEMORY_BANDWITH_MEASURE if ( ret ) @@ -1752,110 +1506,25 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) case NAL_UNIT_EOB: return false; -#if !JVET_N0067_NAL_Unit_Header - case NAL_UNIT_FILLER_DATA: - { - FDReader fdReader; - uint32_t size; - fdReader.parseFillerData(&(nalu.getBitstream()),size); - msg( NOTICE, "Note: found NAL_UNIT_FILLER_DATA with %u bytes payload.\n", size); - return false; - } -#endif -#if JVET_N0067_NAL_Unit_Header case NAL_UNIT_RESERVED_VCL_12: case NAL_UNIT_RESERVED_VCL_13: case NAL_UNIT_RESERVED_VCL_14: case NAL_UNIT_RESERVED_VCL_15: -#else -#if !JVET_M0101_HLS - case NAL_UNIT_RESERVED_VCL_N10: - case NAL_UNIT_RESERVED_VCL_R11: - case NAL_UNIT_RESERVED_VCL_N12: - case NAL_UNIT_RESERVED_VCL_R13: - case NAL_UNIT_RESERVED_VCL_N14: - case NAL_UNIT_RESERVED_VCL_R15: - - case NAL_UNIT_RESERVED_IRAP_VCL22: - case NAL_UNIT_RESERVED_IRAP_VCL23: - - case NAL_UNIT_RESERVED_VCL24: - case NAL_UNIT_RESERVED_VCL25: - case NAL_UNIT_RESERVED_VCL26: - case NAL_UNIT_RESERVED_VCL27: - case NAL_UNIT_RESERVED_VCL28: - case NAL_UNIT_RESERVED_VCL29: - case NAL_UNIT_RESERVED_VCL30: - case NAL_UNIT_RESERVED_VCL31: -#if !HEVC_VPS && !JVET_N0278_HLS - case NAL_UNIT_RESERVED_32: -#endif -#else - case NAL_UNIT_RESERVED_VCL_4: - case NAL_UNIT_RESERVED_VCL_5: - case NAL_UNIT_RESERVED_VCL_6: - case NAL_UNIT_RESERVED_VCL_7: - - case NAL_UNIT_RESERVED_IRAP_VCL11: - case NAL_UNIT_RESERVED_IRAP_VCL12: - case NAL_UNIT_RESERVED_IRAP_VCL13: - - case NAL_UNIT_RESERVED_VCL14: -#if !HEVC_VPS - case NAL_UNIT_RESERVED_VCL15: -#endif -#endif -#endif msg( NOTICE, "Note: found reserved VCL NAL unit.\n"); xParsePrefixSEIsForUnknownVCLNal(); return false; -#if JVET_N0067_NAL_Unit_Header case NAL_UNIT_RESERVED_NVCL_5: case NAL_UNIT_RESERVED_NVCL_6: case NAL_UNIT_RESERVED_NVCL_7: case NAL_UNIT_RESERVED_NVCL_21: case NAL_UNIT_RESERVED_NVCL_22: case NAL_UNIT_RESERVED_NVCL_23: -#else -#if !JVET_M0101_HLS - case NAL_UNIT_RESERVED_NVCL41: - case NAL_UNIT_RESERVED_NVCL42: - case NAL_UNIT_RESERVED_NVCL43: - case NAL_UNIT_RESERVED_NVCL44: - case NAL_UNIT_RESERVED_NVCL45: - case NAL_UNIT_RESERVED_NVCL46: - case NAL_UNIT_RESERVED_NVCL47: -#else - case NAL_UNIT_RESERVED_NVCL16: - case NAL_UNIT_RESERVED_NVCL26: - case NAL_UNIT_RESERVED_NVCL27: -#endif -#endif msg( NOTICE, "Note: found reserved NAL unit.\n"); return false; -#if !JVET_M0101_HLS - case NAL_UNIT_UNSPECIFIED_48: - case NAL_UNIT_UNSPECIFIED_49: - case NAL_UNIT_UNSPECIFIED_50: - case NAL_UNIT_UNSPECIFIED_51: - case NAL_UNIT_UNSPECIFIED_52: - case NAL_UNIT_UNSPECIFIED_53: - case NAL_UNIT_UNSPECIFIED_54: - case NAL_UNIT_UNSPECIFIED_55: - case NAL_UNIT_UNSPECIFIED_56: - case NAL_UNIT_UNSPECIFIED_57: - case NAL_UNIT_UNSPECIFIED_58: - case NAL_UNIT_UNSPECIFIED_59: - case NAL_UNIT_UNSPECIFIED_60: - case NAL_UNIT_UNSPECIFIED_61: - case NAL_UNIT_UNSPECIFIED_62: - case NAL_UNIT_UNSPECIFIED_63: -#else case NAL_UNIT_UNSPECIFIED_28: case NAL_UNIT_UNSPECIFIED_29: case NAL_UNIT_UNSPECIFIED_30: case NAL_UNIT_UNSPECIFIED_31: -#endif msg( NOTICE, "Note: found unspecified NAL unit.\n"); return false; default: @@ -1866,21 +1535,6 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) return false; } -#if !JVET_M0101_HLS -/** Function for checking if picture should be skipped because of association with a previous BLA picture - * This function skips all TFD pictures that follow a BLA picture in decoding order and precede it in output order. - */ -bool DecLib::isSkipPictureForBLA( int& iPOCLastDisplay ) -{ - if( ( m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) && - m_apcSlicePilot->getPOC() < m_pocCRA && ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N ) ) - { - iPOCLastDisplay++; - return true; - } - return false; -} -#endif /** Function for checking if picture should be skipped because of random access. This function checks the skipping of pictures in the case of -s option random access. * All pictures prior to the random access point indicated by the counter iSkipFrame are skipped. @@ -1900,14 +1554,7 @@ bool DecLib::isRandomAccessSkipPicture( int& iSkipFrame, int& iPOCLastDisplay ) } else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. { -#if !JVET_M0101_HLS - if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA - || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP - || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) -#else if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) -#endif { // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. m_pocRandomAccess = m_apcSlicePilot->getPOC(); @@ -1927,11 +1574,7 @@ bool DecLib::isRandomAccessSkipPicture( int& iSkipFrame, int& iPOCLastDisplay ) } } // skip the reordered pictures, if necessary -#if !JVET_M0101_HLS - else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) -#else else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL)) -#endif { iPOCLastDisplay++; return true; diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 8d5c2185bc619d50394b33ff8c22d28a2ddb462a..f29cda58f34006fcccd877f33868b35e47f0595c 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -82,9 +82,7 @@ private: SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices, excluding prefix SEIs... -#if JVET_N0278_HLS int m_iTargetLayer; ///< target stream layer to be decoded -#endif // functional classes IntraPrediction m_cIntraPred; @@ -103,9 +101,6 @@ private: RdCost m_cRdCost; ///< RD cost computation class #if JVET_J0090_MEMORY_BANDWITH_MEASURE CacheModel m_cacheModel; -#endif -#if !JVET_M0101_HLS - bool isSkipPictureForBLA(int& iPOCLastDisplay); #endif bool isRandomAccessSkipPicture(int& iSkipFrame, int& iPOCLastDisplay); Picture* m_pcPic; @@ -152,10 +147,8 @@ public: void finishPictureLight(int& poc, PicList*& rpcListPic ); void checkNoOutputPriorPics (PicList* rpcListPic); -#if JVET_N0278_HLS void setTargetDecLayer (int val) { m_iTargetLayer = val; } int getTargetDecLayer() { return m_iTargetLayer; } -#endif bool getNoOutputPriorPicsFlag () const { return m_isNoOutputPriorPics; } void setNoOutputPriorPicsFlag (bool val) { m_isNoOutputPriorPics = val; } @@ -177,20 +170,12 @@ protected: void xActivateParameterSets(); bool xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDisplay); -#if HEVC_VPS || JVET_N0278_HLS void xDecodeVPS( InputNALUnit& nalu ); -#endif -#if JVET_N0349_DPS void xDecodeDPS( InputNALUnit& nalu ); -#endif void xDecodeSPS( InputNALUnit& nalu ); void xDecodePPS( InputNALUnit& nalu ); void xDecodeAPS(InputNALUnit& nalu); -#if !JVET_M0101_HLS - void xUpdatePreviousTid0POC( Slice *pSlice ) { if ((pSlice->getTLayer()==0) && (pSlice->isReferenceNalu() && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) { m_prevTid0POC=pSlice->getPOC(); } } -#else void xUpdatePreviousTid0POC(Slice *pSlice) { if ((pSlice->getTLayer() == 0) && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL) && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL)) { m_prevTid0POC = pSlice->getPOC(); } } -#endif void xParsePrefixSEImessages(); void xParsePrefixSEIsForUnknownVCLNal(); diff --git a/source/Lib/DecoderLib/DecSlice.cpp b/source/Lib/DecoderLib/DecSlice.cpp index 1c16aff44e955fd327d5e5650b86ad2e8c36d3a8..9f83a120275ae585374f57312946f1532630a178 100644 --- a/source/Lib/DecoderLib/DecSlice.cpp +++ b/source/Lib/DecoderLib/DecSlice.cpp @@ -77,11 +77,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb const SPS* sps = slice->getSPS(); Picture* pic = slice->getPic(); -#if JVET_N0857_TILES_BRICKS const BrickMap& tileMap = *pic->brickMap; -#else - const TileMap& tileMap = *pic->tileMap; -#endif CABACReader& cabacReader = *m_CABACDecoder->getCABACReader( 0 ); // setup coding structure @@ -89,19 +85,9 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb cs.slice = slice; cs.sps = sps; cs.pps = slice->getPPS(); -#if JVET_N0415_CTB_ALF -#if JVET_N0805_APS_LMCS memcpy(cs.alfApss, slice->getAlfAPSs(), sizeof(cs.alfApss)); -#else - memcpy(cs.apss, slice->getAPSs(), sizeof(cs.apss)); -#endif -#else - cs.aps = slice->getAPS(); -#endif -#if JVET_N0805_APS_LMCS cs.lmcsAps = slice->getLmcsAPS(); -#endif #if HEVC_VPS cs.vps = slice->getVPS(); @@ -114,9 +100,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb if (slice->getSliceCurStartCtuTsAddr() == 0) { cs.picture->resizeAlfCtuEnableFlag( cs.pcv->sizeInCtus ); -#if JVET_N0415_CTB_ALF cs.picture->resizeAlfCtbFilterIndex(cs.pcv->sizeInCtus); -#endif } const unsigned numSubstreams = slice->getNumberOfSubstreamSizes() + 1; @@ -130,9 +114,6 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb } const int startCtuTsAddr = slice->getSliceCurStartCtuTsAddr(); -#if !JVET_N0857_TILES_BRICKS - const int startCtuRsAddr = tileMap.getCtuTsToRsAddrMap(startCtuTsAddr); -#endif const unsigned numCtusInFrame = cs.pcv->sizeInCtus; const unsigned widthInCtus = cs.pcv->widthInCtus; @@ -147,44 +128,27 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb DTRACE( g_trace_ctx, D_HEADER, "=========== POC: %d ===========\n", slice->getPOC() ); -#if !JVET_N0857_RECT_SLICES - // The first CTU of the slice is the first coded substream, but the global substream number, as calculated by getSubstreamForCtuAddr may be higher. - // This calculates the common offset for all substreams in this slice. - const unsigned subStreamOffset = tileMap.getSubstreamForCtuAddr(startCtuRsAddr, true, slice); -#endif // for every CTU in the slice segment... bool isLastCtuOfSliceSegment = false; -#if JVET_N0857_RECT_SLICES uint32_t startSliceRsRow = tileMap.getCtuBsToRsAddrMap(startCtuTsAddr) / widthInCtus; uint32_t startSliceRsCol = tileMap.getCtuBsToRsAddrMap(startCtuTsAddr) % widthInCtus; uint32_t endSliceRsRow = tileMap.getCtuBsToRsAddrMap(slice->getSliceCurEndCtuTsAddr() - 1) / widthInCtus; uint32_t endSliceRsCol = tileMap.getCtuBsToRsAddrMap(slice->getSliceCurEndCtuTsAddr() - 1) % widthInCtus; unsigned subStrmId = 0; -#endif for( unsigned ctuTsAddr = startCtuTsAddr; !isLastCtuOfSliceSegment && ctuTsAddr < numCtusInFrame; ctuTsAddr++ ) { -#if JVET_N0857_TILES_BRICKS const unsigned ctuRsAddr = tileMap.getCtuBsToRsAddrMap(ctuTsAddr); const Brick& currentTile = tileMap.bricks[ tileMap.getBrickIdxRsMap(ctuRsAddr) ]; -#else - const unsigned ctuRsAddr = tileMap.getCtuTsToRsAddrMap(ctuTsAddr); - const Tile& currentTile = tileMap.tiles[ tileMap.getTileIdxMap(ctuRsAddr) ]; -#endif -#if JVET_N0857_RECT_SLICES if (slice->getPPS()->getRectSliceFlag() && ((ctuRsAddr / widthInCtus) < startSliceRsRow || (ctuRsAddr / widthInCtus) > endSliceRsRow || (ctuRsAddr % widthInCtus) < startSliceRsCol || (ctuRsAddr % widthInCtus) > endSliceRsCol)) continue; -#endif const unsigned firstCtuRsAddrOfTile = currentTile.getFirstCtuRsAddr(); const unsigned tileXPosInCtus = firstCtuRsAddrOfTile % widthInCtus; const unsigned tileYPosInCtus = firstCtuRsAddrOfTile / widthInCtus; const unsigned ctuXPosInCtus = ctuRsAddr % widthInCtus; const unsigned ctuYPosInCtus = ctuRsAddr / widthInCtus; -#if !JVET_N0857_RECT_SLICES - const unsigned subStrmId = tileMap.getSubstreamForCtuAddr( ctuRsAddr, true, slice ) - subStreamOffset; -#endif const unsigned maxCUSize = sps->getMaxCUWidth(); Position pos( ctuXPosInCtus*maxCUSize, ctuYPosInCtus*maxCUSize) ; UnitArea ctuArea(cs.area.chromaFormat, Area( pos.x, pos.y, maxCUSize, maxCUSize ) ); @@ -209,19 +173,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb { cabacReader.initCtxModels( *slice ); } -#if JVET_N0857_TILES_BRICKS -#if JVET_N0150_ONE_CTU_DELAY_WPP if( cs.getCURestricted( pos.offset(0, -1), pos, slice->getIndependentSliceIdx(), tileMap.getBrickIdxRsMap( pos ), CH_L ) ) -#else - if( cs.getCURestricted( pos.offset(maxCUSize, -1), slice->getIndependentSliceIdx(), tileMap.getBrickIdxRsMap( pos ), CH_L ) ) -#endif -#else -#if JVET_N0150_ONE_CTU_DELAY_WPP - if( cs.getCURestricted( pos.offset(0, -1), pos, slice->getIndependentSliceIdx(), tileMap.getTileIdxMap( pos ), CH_L ) ) -#else - if( cs.getCURestricted( pos.offset(maxCUSize, -1), slice->getIndependentSliceIdx(), tileMap.getTileIdxMap( pos ), CH_L ) ) -#endif -#endif { // Top-right is available, so use it. cabacReader.getCtx() = m_entropyCodingSyncContextState; @@ -239,9 +191,6 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb { cs.motionLut.lut.resize(0); cs.motionLut.lutIbc.resize(0); -#if !JVET_N0266_SMALL_BLOCKS - cs.motionLut.lutShare.resize(0); -#endif cs.motionLut.lutShareIbc.resize(0); } @@ -259,11 +208,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb m_pcCuDecoder->decompressCtu( cs, ctuArea ); -#if JVET_N0150_ONE_CTU_DELAY_WPP if( ctuXPosInCtus == tileXPosInCtus && wavefrontsEnabled ) -#else - if( ctuXPosInCtus == tileXPosInCtus+1 && wavefrontsEnabled ) -#endif { m_entropyCodingSyncContextState = cabacReader.getCtx(); } @@ -276,13 +221,8 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb #endif slice->setSliceCurEndCtuTsAddr( ctuTsAddr+1 ); } -#if JVET_N0857_TILES_BRICKS else if( ( ctuXPosInCtus + 1 == tileXPosInCtus + currentTile.getWidthInCtus () ) && ( ctuYPosInCtus + 1 == tileYPosInCtus + currentTile.getHeightInCtus() || wavefrontsEnabled ) ) -#else - else if( ( ctuXPosInCtus + 1 == tileXPosInCtus + currentTile.getTileWidthInCtus () ) && - ( ctuYPosInCtus + 1 == tileYPosInCtus + currentTile.getTileHeightInCtus() || wavefrontsEnabled ) ) -#endif { // The sub-stream/stream should be terminated after this CTU. // (end of slice-segment, end of tile, end of wavefront-CTU-row) @@ -291,9 +231,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb #if DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES cabacReader.remaining_bytes( true ); #endif -#if JVET_N0857_RECT_SLICES subStrmId++; -#endif } } CHECK( !isLastCtuOfSliceSegment, "Last CTU of slice segment not signalled as such" ); diff --git a/source/Lib/DecoderLib/NALread.cpp b/source/Lib/DecoderLib/NALread.cpp index c52db649989a597f065142b35c28199caf76d7f9..d0ed99d4f9731beb9c9520a6f0916c7b3ab1a71b 100644 --- a/source/Lib/DecoderLib/NALread.cpp +++ b/source/Lib/DecoderLib/NALread.cpp @@ -110,7 +110,6 @@ static void convertPayloadToRBSP(vector& nalUnitBuf, InputBitstream *bi static void xTraceNalUnitHeader(InputNALUnit& nalu) { DTRACE( g_trace_ctx, D_NALUNITHEADER, "*********** NAL UNIT (%s) ***********\n", nalUnitTypeToString(nalu.m_nalUnitType) ); - #if JVET_N0067_NAL_Unit_Header bool zeroTidRequiredFlag = 0; if((nalu.m_nalUnitType >= 16) && (nalu.m_nalUnitType <= 31)) { zeroTidRequiredFlag = 1; @@ -124,12 +123,6 @@ static void xTraceNalUnitHeader(InputNALUnit& nalu) DTRACE( g_trace_ctx, D_NALUNITHEADER, "%-50s u(%d) : %u\n", "nuh_layer_id", 7, nalu.m_nuhLayerId ); #endif DTRACE( g_trace_ctx, D_NALUNITHEADER, "%-50s u(%d) : %u\n", "nuh_reserved_zero_bit", 1, 0 ); - #else - DTRACE( g_trace_ctx, D_NALUNITHEADER, "%-50s u(%d) : %u\n", "forbidden_zero_bit", 1, 0 ); - DTRACE( g_trace_ctx, D_NALUNITHEADER, "%-50s u(%d) : %u\n", "nal_unit_type", 6, nalu.m_nalUnitType ); - DTRACE( g_trace_ctx, D_NALUNITHEADER, "%-50s u(%d) : %u\n", "nuh_layer_id", 6, nalu.m_nuhLayerId ); - DTRACE( g_trace_ctx, D_NALUNITHEADER, "%-50s u(%d) : %u\n", "nuh_temporal_id_plus1", 3, nalu.m_temporalId + 1 ); - #endif } #endif @@ -137,7 +130,6 @@ void readNalUnitHeader(InputNALUnit& nalu) { InputBitstream& bs = nalu.getBitstream(); -#if JVET_N0067_NAL_Unit_Header bool zeroTidRequiredFlag = bs.read(1); // zero_tid_required_flag nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 //When zero_tid_required_flag is equal to 1, the value of nuh_temporal_id_plus1 shall be equal to 1. @@ -154,20 +146,9 @@ void readNalUnitHeader(InputNALUnit& nalu) #endif uint32_t nuh_reserved_zero_bit = bs.read(1); // nuh_reserved_zero_bit CHECK(nuh_reserved_zero_bit != 0, "Reserved zero bit is not '0'"); -#else - bool forbidden_zero_bit = bs.read(1); // forbidden_zero_bit - if(forbidden_zero_bit != 0) { THROW( "Forbidden zero-bit not '0'" );} - nalu.m_nalUnitType = (NalUnitType) bs.read(6); // nal_unit_type - nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id - nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 -#endif #if RExt__DECODER_DEBUG_BIT_STATISTICS -#if JVET_N0067_NAL_Unit_Header CodingStatistics::IncrementStatisticEP(STATS__NAL_UNIT_HEADER_BITS, 1+3+4+7+1, 0); -#else - CodingStatistics::IncrementStatisticEP(STATS__NAL_UNIT_HEADER_BITS, 1+6+6+3, 0); -#endif #endif #if ENABLE_TRACING @@ -179,82 +160,15 @@ void readNalUnitHeader(InputNALUnit& nalu) { if ( nalu.m_temporalId ) { -#if JVET_N0067_NAL_Unit_Header CHECK( (uint32_t)nalu.m_nalUnitType >= 16 && (uint32_t)nalu.m_nalUnitType <= 31 , "Invalid NAL type" ); -#else -#if HEVC_VPS -#if !JVET_M0101_HLS - CHECK( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA - || nalu.m_nalUnitType == NAL_UNIT_VPS - || nalu.m_nalUnitType == NAL_UNIT_SPS - || nalu.m_nalUnitType == NAL_UNIT_EOS - || nalu.m_nalUnitType == NAL_UNIT_EOB - , "Invalid NAL type" ); -#else - CHECK( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA - || nalu.m_nalUnitType == NAL_UNIT_VPS - || nalu.m_nalUnitType == NAL_UNIT_SPS - || nalu.m_nalUnitType == NAL_UNIT_EOS - || nalu.m_nalUnitType == NAL_UNIT_EOB - , "Invalid NAL type" ); -#endif -#else -#if !JVET_M0101_HLS - CHECK(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA -#if JVET_N0278_HLS - || nalu.m_nalUnitType == NAL_UNIT_VPS -#endif - || nalu.m_nalUnitType == NAL_UNIT_SPS - || nalu.m_nalUnitType == NAL_UNIT_EOS - || nalu.m_nalUnitType == NAL_UNIT_EOB - , "Invalid NAL type"); -#else - CHECK(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA -#if JVET_N0278_HLS - || nalu.m_nalUnitType == NAL_UNIT_VPS -#endif - || nalu.m_nalUnitType == NAL_UNIT_SPS - || nalu.m_nalUnitType == NAL_UNIT_EOS - || nalu.m_nalUnitType == NAL_UNIT_EOB - , "Invalid NAL type"); -#endif -#endif -#endif } else { -#if JVET_N0067_NAL_Unit_Header - CHECK(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA - , "Invalid NAL type"); -#else -#if !JVET_M0101_HLS - CHECK( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_R - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N - , "Invalid NAL type" ); -#else CHECK(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA , "Invalid NAL type"); -#endif -#endif } } } diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 0f4864f1b864ed60593a64f387ea6a63e9c525d3..a7f7698df6d03671e19e2772c2b1e5d9140762b6 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -474,7 +474,6 @@ void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t pay sei_read_uvlc( pDecodedMessageOutputStream, val, "decoding_unit_idx"); sei.m_decodingUnitIdx = val; -#if JVET_N0063_VUI if(sps->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) { sei_read_code( pDecodedMessageOutputStream, ( sps->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment"); @@ -490,24 +489,6 @@ void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t pay sei_read_code( pDecodedMessageOutputStream, sps->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); sei.m_picSptDpbOutputDuDelay = val; } -#else - const VUI *vui = sps->getVuiParameters(); - if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) - { - sei_read_code( pDecodedMessageOutputStream, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment"); - sei.m_duSptCpbRemovalDelay = val; - } - else - { - sei.m_duSptCpbRemovalDelay = 0; - } - sei_read_flag( pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0); - if(sei.m_dpbOutputDuDelayPresentFlag) - { - sei_read_code( pDecodedMessageOutputStream, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); - sei.m_picSptDpbOutputDuDelay = val; - } -#endif } void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream) @@ -515,12 +496,7 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo int i, nalOrVcl; uint32_t code; -#if JVET_N0063_VUI const HRDParameters *pHRD = sps->getHrdParameters(); -#else - const VUI *pVUI = sps->getVuiParameters(); - const HRDParameters *pHRD = pVUI->getHrdParameters(); -#endif output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); @@ -569,17 +545,9 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi int i; uint32_t code; -#if JVET_N0063_VUI const HRDParameters *hrd = sps->getHrdParameters(); -#else - const VUI *vui = sps->getVuiParameters(); - const HRDParameters *hrd = vui->getHrdParameters(); -#endif output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); -#if !JVET_N0063_VUI - if( vui->getFrameFieldInfoPresentFlag() ) -#endif { sei_read_code( pDecodedMessageOutputStream, 4, code, "pic_struct" ); sei.m_picStruct = code; sei_read_code( pDecodedMessageOutputStream, 2, code, "source_scan_type" ); sei.m_sourceScanType = code; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 610d1aadb467dd8ef72125175666bdc4a5d72c55..b6f1b5b82bcd63a84597b158616009e8b55ad294 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -269,7 +269,6 @@ HLSyntaxReader::~HLSyntaxReader() // Public member functions // ==================================================================================================================== -#if JVET_M0128 void HLSyntaxReader::copyRefPicList(SPS* sps, ReferencePictureList* source_rpl, ReferencePictureList* dest_rp) { dest_rp->setNumberOfShorttermPictures(source_rpl->getNumberOfShorttermPictures()); @@ -339,112 +338,8 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl) rpl->setNumberOfShorttermPictures(numStrp); rpl->setNumberOfLongtermPictures(numLtrp); } -#else -void HLSyntaxReader::parseShortTermRefPicSet( SPS* sps, ReferencePictureSet* rps, int idx ) -{ - uint32_t code; - uint32_t interRPSPred; - if (idx > 0) - { - READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred); - } - else - { - interRPSPred = false; - rps->setInterRPSPrediction(false); - } - - if (interRPSPred) - { - uint32_t bit; - if(idx == sps->getRPSList()->getNumberOfReferencePictureSets()) - { - READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 - } - else - { - code = 0; - } - rps->setDeltaRIdxMinus1(code); // th we need that for proper transcoding - CHECK(code > idx-1, "Code exceeds boundary"); // delta_idx_minus1 shall not be larger than idx-1, otherwise we will predict from a negative row position that does not exist. When idx equals 0 there is no legal value and interRPSPred must be zero. See J0185-r2 - int rIdx = idx - 1 - code; - CHECK(rIdx > idx-1 || rIdx < 0, "Invalid index"); // Made assert tighter; if rIdx = idx then prediction is done from itself. rIdx must belong to range 0, idx-1, inclusive, see J0185-r2 - ReferencePictureSet* rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx); - int k = 0, k0 = 0, k1 = 0; - READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign - READ_UVLC(code, "abs_delta_rps_minus1"); // absolute delta RPS minus 1 - int deltaRPS = (1 - 2 * bit) * (code + 1); // delta_RPS - - rps->setDeltaRPS( deltaRPS ); // th we need that for proper transcoding - - for(int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) - { - READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 - int refIdc = bit; - if (refIdc == 0) - { - READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. - refIdc = bit<<1; //second bit is "1" if refIdc is 2, "0" if refIdc = 0. - } - if (refIdc == 1 || refIdc == 2) - { - int deltaPOC = deltaRPS + ((j < rpsRef->getNumberOfPictures())? rpsRef->getDeltaPOC(j) : 0); - rps->setDeltaPOC(k, deltaPOC); - rps->setUsed(k, (refIdc == 1)); - - if (deltaPOC < 0) - { - k0++; - } - else - { - k1++; - } - k++; - } - rps->setRefIdc(j,refIdc); - } - rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); - rps->setNumberOfPictures(k); - rps->setNumberOfNegativePictures(k0); - rps->setNumberOfPositivePictures(k1); - rps->sortDeltaPOC(); - } - else - { - READ_UVLC(code, "num_negative_pics"); rps->setNumberOfNegativePictures(code); - READ_UVLC(code, "num_positive_pics"); rps->setNumberOfPositivePictures(code); - int prev = 0; - int poc; - for(int j=0 ; j < rps->getNumberOfNegativePictures(); j++) - { - READ_UVLC(code, "delta_poc_s0_minus1"); - poc = prev-code-1; - prev = poc; - rps->setDeltaPOC(j,poc); - READ_FLAG(code, "used_by_curr_pic_s0_flag"); rps->setUsed(j,code); - } - prev = 0; - for(int j=rps->getNumberOfNegativePictures(); j < rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); j++) - { - READ_UVLC(code, "delta_poc_s1_minus1"); - poc = prev+code+1; - prev = poc; - rps->setDeltaPOC(j,poc); - READ_FLAG(code, "used_by_curr_pic_s1_flag"); rps->setUsed(j,code); - } - rps->setNumberOfPictures(rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures()); - } - rps->printDeltaPOC(); -} -#endif - -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetManager ) -#else -void HLSyntaxReader::parsePPS( PPS* pcPPS ) -#endif { #if ENABLE_TRACING xTracePPSHeader (); @@ -477,10 +372,8 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) CHECK(uiCode > 14, "Invalid code read"); pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); -#if JVET_M0128 READ_FLAG(uiCode, "rpl1_idx_present_flag"); pcPPS->setRpl1IdxPresentFlag(uiCode); -#endif READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); @@ -507,12 +400,10 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) CHECK( pcPPS->getQpOffset(COMPONENT_Cr) < -12, "Invalid Cr QP offset" ); CHECK( pcPPS->getQpOffset(COMPONENT_Cr) > 12, "Invalid Cr QP offset" ); -#if JVET_N0054_JOINT_CHROMA READ_SVLC( iCode, "pps_cb_cr_qp_offset"); pcPPS->setQpOffset(JOINT_CbCr, iCode); CHECK( pcPPS->getQpOffset(JOINT_CbCr) < -12, "Invalid CbCr QP offset" ); CHECK( pcPPS->getQpOffset(JOINT_CbCr) > 12, "Invalid CbCr QP offset" ); -#endif CHECK(MAX_NUM_COMPONENT>3, "Invalid maximal number of components"); @@ -527,7 +418,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_FLAG( uiCode, "transquant_bypass_enabled_flag"); pcPPS->setTransquantBypassEnabledFlag(uiCode ? true : false); -#if JVET_N0857_TILES_BRICKS READ_FLAG( uiCode, "single_tile_in_pic_flag" ); pcPPS->setSingleTileInPicFlag(uiCode == 1); if(!pcPPS->getSingleTileInPicFlag()) @@ -574,9 +464,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_FLAG( uiCode, "brick_splitting_present_flag" ); pcPPS->setBrickSplittingPresentFlag(uiCode == 1); int numTilesInPic = pcPPS->getUniformTileSpacingFlag() ? 0 : (pcPPS->getNumTileColumnsMinus1() + 1) * (pcPPS->getNumTileRowsMinus1() + 1); -#if JVET_N0857_RECT_SLICES pcPPS->setNumTilesInPic(numTilesInPic); -#endif if (pcPPS->getBrickSplittingPresentFlag()) { @@ -636,9 +524,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) const uint32_t numSlicesInPic = pcPPS->getNumSlicesInPicMinus1() + 1; const uint32_t numTilesInPic = (tileColumnsMinus1 + 1) * (tileRowsMinus1 + 1); int codeLength = (int)ceil(log2(numTilesInPic)); -#if JVET_N0124_PROPOSAL2 int codeLength2 = codeLength; -#endif if (numSlicesInPic > 0) { std::vector topLeft(numSlicesInPic); @@ -650,31 +536,15 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) { READ_CODE( codeLength, uiCode, "top_left_brick_idx" ); topLeft[i] = uiCode; -#if JVET_N0124_PROPOSAL2 -#if JVET_N0857_RECT_SLICES codeLength2 = (int)ceil(log2((numTilesInPic - topLeft[i] < 2) ? 2 : numTilesInPic - topLeft[i])); //Bugfix -#else - codeLength2 = (int)ceil(log2(numTilesInPic - topLeft[i])); -#endif -#endif } -#if JVET_N0124_PROPOSAL2 READ_CODE( codeLength2, uiCode, "bottom_right_brick_idx_delta"); -#else - READ_CODE(codeLength, uiCode, "bottom_right_brick_idx_delta"); -#endif bottomRight[i] = topLeft[i] + uiCode; } -#if JVET_N0857_RECT_SLICES pcPPS->setTopLeftBrickIdx(topLeft); pcPPS->setBottomRightBrickIdx(bottomRight); -#else - pcPPS->setTopLeftTileIdx(topLeft); - pcPPS->setBottomRightTileIdx(bottomRight); -#endif } } -#if JVET_N0857_RECT_SLICES if (pcPPS->getRectSliceFlag() && pcPPS->getSingleBrickPerSliceFlag()) { std::vector topLeft(numTilesInPic); //TODO: this should be numBricksInPic. Fix it when the bricks codes have been updated @@ -687,7 +557,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setTopLeftBrickIdx(topLeft); pcPPS->setBottomRightBrickIdx(bottomRight); } -#endif READ_FLAG( uiCode, "loop_filter_across_bricks_enabled_flag "); pcPPS->setLoopFilterAcrossBricksEnabledFlag(uiCode ? true : false); if (pcPPS->getLoopFilterAcrossBricksEnabledFlag()) @@ -697,18 +566,14 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) } else { -#if JVET_N0124_PROPOSAL1 pcPPS->setSingleBrickPerSliceFlag(true); -#endif pcPPS->setRectSliceFlag(true); -#if JVET_N0857_RECT_SLICES std::vector topLeft(1); topLeft[0] = 0; std::vector bottomRight(1); bottomRight[0] = 0; pcPPS->setTopLeftBrickIdx(topLeft); pcPPS->setBottomRightBrickIdx(bottomRight); -#endif } if (pcPPS->getRectSliceFlag()) @@ -717,7 +582,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) if (pcPPS->getSignalledSliceIdFlag()) { READ_UVLC( uiCode, "signalled_slice_id_length_minus1" ); pcPPS->setSignalledSliceIdLengthMinus1(uiCode); -#if JVET_N0857_RECT_SLICES const uint32_t numSlices = pcPPS->getNumSlicesInPicMinus1() + 1; int codeLength = pcPPS->getSignalledSliceIdLengthMinus1() + 1; if (numSlices > 0) @@ -730,22 +594,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) } pcPPS->setSliceId(sliceID); } -#else - const uint32_t numTileGroups = pcPPS->getNumSlicesInPicMinus1() + 1; - int codeLength = pcPPS->getSignalledSliceIdLengthMinus1() + 1; - if (numTileGroups > 0) - { - std::vector tileGroupID(numTileGroups); - for (uint32_t i = 0; i < numTileGroups; i++) - { - READ_CODE( codeLength, uiCode, "slice_id" ); - tileGroupID[i] = uiCode; - } - pcPPS->setSliceId(tileGroupID); - } -#endif } -#if JVET_N0857_RECT_SLICES else { std::vector sliceID(pcPPS->getNumSlicesInPicMinus1() + 1); @@ -755,52 +604,8 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) } pcPPS->setSliceId(sliceID); } -#endif } -#endif - -#if !JVET_N0857_TILES_BRICKS - READ_FLAG(uiCode, "tiles_enabled_flag"); pcPPS->setTilesEnabledFlag(uiCode == 1); - if (pcPPS->getTilesEnabledFlag()) - { - READ_UVLC(uiCode, "num_tile_columns_minus1"); pcPPS->setNumTileColumnsMinus1(uiCode); - READ_UVLC(uiCode, "num_tile_rows_minus1"); pcPPS->setNumTileRowsMinus1(uiCode); - READ_FLAG(uiCode, "uniform_spacing_flag"); pcPPS->setUniformTileSpacingFlag(uiCode == 1); - - const uint32_t tileColumnsMinus1 = pcPPS->getNumTileColumnsMinus1(); - const uint32_t tileRowsMinus1 = pcPPS->getNumTileRowsMinus1(); - - if (!pcPPS->getUniformTileSpacingFlag()) - { - if (tileColumnsMinus1 > 0) - { - std::vector columnWidth(tileColumnsMinus1); - for (uint32_t i = 0; i < tileColumnsMinus1; i++) - { - READ_UVLC(uiCode, "column_width_minus1"); - columnWidth[i] = uiCode + 1; - } - pcPPS->setTileColumnWidth(columnWidth); - } - - if (tileRowsMinus1 > 0) - { - std::vector rowHeight(tileRowsMinus1); - for (uint32_t i = 0; i < tileRowsMinus1; i++) - { - READ_UVLC(uiCode, "row_height_minus1"); - rowHeight[i] = uiCode + 1; - } - pcPPS->setTileRowHeight(rowHeight); - } - } - CHECK((tileColumnsMinus1 + tileRowsMinus1) == 0, "Invalid tile configuration"); - READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossBricksEnabledFlag( uiCode ? true : false ); - } - - READ_FLAG( uiCode, "pps_loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false ); -#endif READ_FLAG(uiCode, "entropy_coding_sync_enabled_flag"); pcPPS->setEntropyCodingSyncEnabledFlag(uiCode == 1); READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false ); @@ -815,7 +620,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) } } -#if JVET_N0438_LOOP_FILTER_DISABLED_ACROSS_VIR_BOUND READ_FLAG( uiCode, "pps_loop_filter_across_virtual_boundaries_disabled_flag" ); pcPPS->setLoopFilterAcrossVirtualBoundariesDisabledFlag( uiCode != 0 ); if( pcPPS->getLoopFilterAcrossVirtualBoundariesDisabledFlag() ) { @@ -834,20 +638,13 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_CODE( numBits, uiCode, "pps_virtual_boundaries_pos_y" ); pcPPS->setVirtualBoundariesPosY( uiCode << 3, i ); } } -#endif -#if HEVC_USE_SCALING_LISTS READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); if(pcPPS->getScalingListPresentFlag ()) { parseScalingList( &(pcPPS->getScalingList()) ); } -#endif -#if !JVET_M0128 - READ_FLAG( uiCode, "lists_modification_present_flag"); - pcPPS->setListsModificationPresentFlag(uiCode); -#endif READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); @@ -959,7 +756,6 @@ void HLSyntaxReader::parseAPS( APS* aps ) READ_CODE(5, code, "adaptation_parameter_set_id"); aps->setAPSId(code); - #if JVET_N0805_APS_LMCS READ_CODE(3, code, "aps_params_type"); aps->setAPSType(code); if (code == ALF_APS) @@ -979,136 +775,24 @@ void HLSyntaxReader::parseAPS( APS* aps ) } } xReadRbspTrailingBits(); -#else - AlfSliceParam param = aps->getAlfAPSParam(); -#if JVET_N0415_CTB_ALF - param.enabledFlag[COMPONENT_Y] = param.enabledFlag[COMPONENT_Cb] = param.enabledFlag[COMPONENT_Cr] = true; - READ_FLAG(code, "alf_luma_new_filter"); - param.newFilterFlag[CHANNEL_TYPE_LUMA] = code; - READ_FLAG(code, "alf_chroma_new_filter"); - param.newFilterFlag[CHANNEL_TYPE_CHROMA] = code; -#else - param.enabledFlag[COMPONENT_Y] = true; - - int alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc - param.enabledFlag[COMPONENT_Cb] = alfChromaIdc >> 1; - param.enabledFlag[COMPONENT_Cr] = alfChromaIdc & 1; -#endif - -#if JVET_N0242_NON_LINEAR_ALF && !JVET_N0415_CTB_ALF - READ_FLAG( code, "alf_luma_clip" ); - param.nonLinearFlag[CHANNEL_TYPE_LUMA] = code ? true : false; - - if( alfChromaIdc ) - { - READ_FLAG( code, "alf_chroma_clip" ); - param.nonLinearFlag[CHANNEL_TYPE_CHROMA] = code ? true : false; - } -#endif - -#if JVET_N0415_CTB_ALF - if (param.newFilterFlag[CHANNEL_TYPE_LUMA]) - { -#if JVET_N0242_NON_LINEAR_ALF - READ_FLAG(code, "alf_luma_clip"); - param.nonLinearFlag[CHANNEL_TYPE_LUMA] = code ? true : false; -#endif -#endif - xReadTruncBinCode(code, MAX_NUM_ALF_CLASSES); //number_of_filters_minus1 - param.numLumaFilters = code + 1; - if (param.numLumaFilters > 1) - { - for (int i = 0; i < MAX_NUM_ALF_CLASSES; i++) - { - xReadTruncBinCode(code, param.numLumaFilters); - param.filterCoeffDeltaIdx[i] = code; - } - } - else - { - memset(param.filterCoeffDeltaIdx, 0, sizeof(param.filterCoeffDeltaIdx)); - } - -#if JVET_N0415_CTB_ALF - READ_FLAG(code, "fixed_filter_set_flag"); - param.fixedFilterSetIndex = code; - if (param.fixedFilterSetIndex > 0) - { - xReadTruncBinCode(code, NUM_FIXED_FILTER_SETS); - param.fixedFilterSetIndex = code + 1; - READ_FLAG(code, "fixed_filter_flag_pattern"); - param.fixedFilterPattern = code; - for (int classIdx = 0; classIdx < MAX_NUM_ALF_CLASSES; classIdx++) - { - code = 1; - if (param.fixedFilterPattern > 0) - { - READ_FLAG(code, "fixed_filter_flag"); - } - param.fixedFilterIdx[classIdx] = code; - } - } -#endif - alfFilter(param, false); -#if JVET_N0415_CTB_ALF - } - if (param.newFilterFlag[CHANNEL_TYPE_CHROMA]) - { -#if JVET_N0242_NON_LINEAR_ALF - READ_FLAG(code, "alf_luma_clip"); - param.nonLinearFlag[CHANNEL_TYPE_CHROMA] = code ? true : false; -#endif -#else - if (alfChromaIdc) - { -#endif - alfFilter(param, true); - } - aps->setAlfAPSParam(param); - - xReadRbspTrailingBits(); -#endif } -#if JVET_N0805_APS_LMCS void HLSyntaxReader::parseAlfAps( APS* aps ) { uint32_t code; AlfSliceParam param = aps->getAlfAPSParam(); -#if JVET_N0415_CTB_ALF param.enabledFlag[COMPONENT_Y] = param.enabledFlag[COMPONENT_Cb] = param.enabledFlag[COMPONENT_Cr] = true; READ_FLAG(code, "alf_luma_new_filter"); param.newFilterFlag[CHANNEL_TYPE_LUMA] = code; READ_FLAG(code, "alf_chroma_new_filter"); param.newFilterFlag[CHANNEL_TYPE_CHROMA] = code; -#else - param.enabledFlag[COMPONENT_Y] = true; - - int alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc - param.enabledFlag[COMPONENT_Cb] = alfChromaIdc >> 1; - param.enabledFlag[COMPONENT_Cr] = alfChromaIdc & 1; -#endif - -#if JVET_N0242_NON_LINEAR_ALF && !JVET_N0415_CTB_ALF - READ_FLAG(code, "alf_luma_clip"); - param.nonLinearFlag[CHANNEL_TYPE_LUMA] = code ? true : false; - if (alfChromaIdc) - { - READ_FLAG(code, "alf_chroma_clip"); - param.nonLinearFlag[CHANNEL_TYPE_CHROMA] = code ? true : false; - } -#endif -#if JVET_N0415_CTB_ALF if (param.newFilterFlag[CHANNEL_TYPE_LUMA]) { -#if JVET_N0242_NON_LINEAR_ALF READ_FLAG(code, "alf_luma_clip"); param.nonLinearFlag[CHANNEL_TYPE_LUMA] = code ? true : false; -#endif -#endif xReadTruncBinCode(code, MAX_NUM_ALF_CLASSES); //number_of_filters_minus1 param.numLumaFilters = code + 1; if (param.numLumaFilters > 1) @@ -1124,7 +808,6 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) memset(param.filterCoeffDeltaIdx, 0, sizeof(param.filterCoeffDeltaIdx)); } -#if JVET_N0415_CTB_ALF READ_FLAG(code, "fixed_filter_set_flag"); param.fixedFilterSetIndex = code; if (param.fixedFilterSetIndex > 0) @@ -1143,20 +826,12 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) param.fixedFilterIdx[classIdx] = code; } } -#endif alfFilter(param, false); -#if JVET_N0415_CTB_ALF } if (param.newFilterFlag[CHANNEL_TYPE_CHROMA]) { -#if JVET_N0242_NON_LINEAR_ALF READ_FLAG(code, "alf_luma_clip"); param.nonLinearFlag[CHANNEL_TYPE_CHROMA] = code ? true : false; -#endif -#else - if (alfChromaIdc) - { -#endif alfFilter(param, true); } aps->setAlfAPSParam(param); @@ -1185,7 +860,6 @@ void HLSyntaxReader::parseLmcsAps( APS* aps ) } aps->setReshaperAPSInfo(info); } -#endif void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) @@ -1194,7 +868,6 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n"); #endif -#if JVET_N0063_VUI uint32_t symbol; @@ -1245,98 +918,6 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) READ_FLAG( symbol, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(symbol); } -#else - - uint32_t uiCode; - - READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode); - if (pcVUI->getAspectRatioInfoPresentFlag()) - { - READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode); - if (pcVUI->getAspectRatioIdc() == 255) - { - READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); - READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); - } - } - - READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode); - if (pcVUI->getOverscanInfoPresentFlag()) - { - READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode); - } - - READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); - if (pcVUI->getVideoSignalTypePresentFlag()) - { - READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode); - READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode); - READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode); - if (pcVUI->getColourDescriptionPresentFlag()) - { - READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); - READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); - READ_CODE(8, uiCode, "matrix_coeffs"); pcVUI->setMatrixCoefficients(uiCode); - } - } - - READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode); - if (pcVUI->getChromaLocInfoPresentFlag()) - { - READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode); - READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode); - } - - READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode); - - READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); - - READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); - - READ_FLAG( uiCode, "default_display_window_flag"); - if (uiCode != 0) - { - Window &defDisp = pcVUI->getDefaultDisplayWindow(); - READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * SPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); - READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * SPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); - READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * SPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); - READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * SPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); - } - - TimingInfo *timingInfo = pcVUI->getTimingInfo(); - READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); - if(timingInfo->getTimingInfoPresentFlag()) - { - READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); - READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode); - READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); - if(timingInfo->getPocProportionalToTimingFlag()) - { - READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); - } - - READ_FLAG( uiCode, "vui_hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); - if( pcVUI->getHrdParametersPresentFlag() ) - { - parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); - } - } - - READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); - if (pcVUI->getBitstreamRestrictionFlag()) - { - READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); - READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); - READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); - READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); - CHECK(uiCode >= 4096, "Invalid code signalled"); - READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); - READ_UVLC( uiCode, "max_bits_per_min_cu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); - READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); - READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); - } - -#endif } void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, bool commonInfPresentFlag, uint32_t maxNumSubLayersMinus1) @@ -1417,44 +998,6 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, bool commonInfPresen } } -#if !JVET_N0805_APS_LMCS -void HLSyntaxReader::parseReshaper(SliceReshapeInfo& info, const SPS* pcSPS, const bool isIntra) -{ - unsigned symbol = 0; - READ_FLAG(symbol, "tile_group_reshaper_model_present_flag"); info.setSliceReshapeModelPresentFlag(symbol == 1); - if (info.getSliceReshapeModelPresentFlag()) - { - memset(info.reshaperModelBinCWDelta, 0, PIC_CODE_CW_BINS * sizeof(int)); - READ_UVLC(symbol, "reshaper_model_min_bin_idx"); info.reshaperModelMinBinIdx = symbol; - READ_UVLC(symbol, "reshaper_model_delta_max_bin_idx"); info.reshaperModelMaxBinIdx = PIC_CODE_CW_BINS - 1 - symbol; - READ_UVLC(symbol, "reshaper_model_bin_delta_abs_cw_prec_minus1"); info.maxNbitsNeededDeltaCW = symbol + 1; - assert(info.maxNbitsNeededDeltaCW > 0); - for (uint32_t i = info.reshaperModelMinBinIdx; i <= info.reshaperModelMaxBinIdx; i++) - { - READ_CODE(info.maxNbitsNeededDeltaCW, symbol, "reshaper_model_bin_delta_abs_CW"); - int absCW = symbol; - if (absCW > 0) - { - READ_CODE(1, symbol, "reshaper_model_bin_delta_sign_CW_flag"); - } - int signCW = symbol; - info.reshaperModelBinCWDelta[i] = (1 - 2 * signCW) * absCW; - } - } - READ_FLAG(symbol, "tile_group_reshaper_enable_flag"); info.setUseSliceReshaper(symbol == 1); - if (info.getUseSliceReshaper()) - { - if (!(pcSPS->getUseDualITree() && isIntra)) - { - READ_FLAG(symbol, "slice_reshaper_ChromaAdj"); info.setSliceReshapeChromaAdj(symbol); - } - else - { - info.setSliceReshapeChromaAdj(0); - } - } -} -#endif void HLSyntaxReader::parseSPS(SPS* pcSPS) { @@ -1463,52 +1006,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if ENABLE_TRACING xTraceSPSHeader (); #endif -#if JVET_N0349_DPS READ_CODE( 4, uiCode, "sps_decoding_parameter_set_id"); pcSPS->setDecodingParameterSetId( uiCode ); -#endif #if HEVC_VPS READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); #endif -#if !JVET_M0101_HLS - READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); - CHECK(uiCode > 15, "Invalid SPS id signalled"); - - READ_FLAG(uiCode, "intra_only_constraint_flag"); pcSPS->setIntraOnlyConstraintFlag(uiCode > 0 ? true : false); - READ_CODE(4, uiCode, "max_bitdepth_constraint_idc"); pcSPS->setMaxBitDepthConstraintIdc(uiCode); - READ_CODE(2, uiCode, "max_chroma_format_constraint_idc"); pcSPS->setMaxChromaFormatConstraintIdc(uiCode); - READ_FLAG(uiCode, "frame_only_constraint_flag"); pcSPS->setFrameConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_qtbtt_dual_tree_intra_constraint_flag"); pcSPS->setNoQtbttDualTreeIntraConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_sao_constraint_flag"); pcSPS->setNoSaoConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_alf_constraint_flag"); pcSPS->setNoAlfConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_pcm_constraint_flag"); pcSPS->setNoPcmConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_ref_wraparound_constraint_flag"); pcSPS->setNoRefWraparoundConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_temporal_mvp_constraint_flag"); pcSPS->setNoTemporalMvpConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_sbtmvp_constraint_flag"); pcSPS->setNoSbtmvpConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_amvr_constraint_flag"); pcSPS->setNoAmvrConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_bdof_constraint_flag"); pcSPS->setNoBdofConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_cclm_constraint_flag"); pcSPS->setNoCclmConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_mts_constraint_flag"); pcSPS->setNoMtsConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_affine_motion_constraint_flag"); pcSPS->setNoAffineMotionConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_gbi_constraint_flag"); pcSPS->setNoGbiConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_mh_intra_constraint_flag"); pcSPS->setNoMhIntraConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_triangle_constraint_flag"); pcSPS->setNoTriangleConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_ladf_constraint_flag"); pcSPS->setNoLadfConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_curr_pic_ref_constraint_flag"); pcSPS->setNoCurrPicRefConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_qp_delta_constraint_flag"); pcSPS->setNoQpDeltaConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_dep_quant_constraint_flag"); pcSPS->setNoDepQuantConstraintFlag(uiCode > 0 ? true : false); - READ_FLAG(uiCode, "no_sign_data_hiding_constraint_flag"); pcSPS->setNoSignDataHidingConstraintFlag(uiCode > 0 ? true : false); - - // KJS: Marakech decision: sub-layers added back - READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); - CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled"); - READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); - if ( pcSPS->getMaxTLayers() == 1 ) - { - // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 - CHECK( uiCode != 1, "Invalid maximum number of T-layers" ); - } - parsePTL(pcSPS->getPTL(), true, pcSPS->getMaxTLayers() - 1); -#else READ_CODE(3, uiCode, "sps_max_sub_layers_minus1"); pcSPS->setMaxTLayers (uiCode + 1); CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled"); READ_CODE(5, uiCode, "sps_reserved_zero_5bits"); @@ -1517,18 +1018,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); READ_UVLC(uiCode, "sps_seq_parameter_set_id"); pcSPS->setSPSId(uiCode); -#endif READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); CHECK(uiCode > 3, "Invalid chroma format signalled"); -#if !JVET_N0671_CHROMA_FORMAT_422 - if (pcSPS->getChromaFormatIdc() == CHROMA_422) - { - EXIT("Error: 4:2:2 chroma sampling format not supported with current compiler setting." - "\n Set compiler flag \"JVET_N0671_CHROMA_FORMAT_422\" equal to 1 for enabling 4:2:2.\n"); - } -#endif //!JVET_N0671_CHROMA_FORMAT_422 if( pcSPS->getChromaFormatIdc() == CHROMA_444 ) @@ -1563,9 +1056,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); CHECK(uiCode > 12, "Invalid code"); -#if JVET_N0047_Merge_IDR_Non_IDR READ_FLAG( uiCode, "sps_idr_rpl_present_flag" ); pcSPS->setIDRRefParamListPresent( (bool) uiCode); -#endif // KJS: Marakech decision: sub-layers added back uint32_t subLayerOrderingInfoPresentFlag; READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); @@ -1591,7 +1082,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } } -#if JVET_M0128 READ_FLAG(uiCode, "long_term_ref_pics_flag"); pcSPS->setLongTermRefsPresent(uiCode); READ_FLAG(uiCode, "rpl1_copy_from_rpl0_flag"); pcSPS->setRPL1CopyFromRPL0Flag(uiCode); @@ -1630,7 +1120,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) for (uint32_t ii = 0; ii < numberOfRPL; ii++) copyRefPicList(pcSPS, rplListSource->getReferencePictureList(ii), rplListDest->getReferencePictureList(ii)); } -#endif unsigned minQT[3] = { 0, 0, 0 }; unsigned maxBTD[3] = { 0, 0, 0 }; @@ -1682,12 +1171,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setMaxBTSize(maxBTSize[1], maxBTSize[0], maxBTSize[2]); pcSPS->setMaxTTSize(maxTTSize[1], maxTTSize[0], maxTTSize[2]); -#if !JVET_M0101_HLS - if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) - { - CHECK(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() < 5, "Invalid code"); - } -#endif #if MAX_TB_SIZE_SIGNALLING // KJS: Not in syntax @@ -1706,23 +1189,19 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); } -#if JVET_N0070_WRAPAROUND if( pcSPS->getCTUSize() + 2*(1 << pcSPS->getLog2MinCodingBlockSize()) <= pcSPS->getPicWidthInLumaSamples() ) { -#endif READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag"); pcSPS->setWrapAroundEnabledFlag( uiCode ? true : false ); if (pcSPS->getWrapAroundEnabledFlag()) { READ_UVLC(uiCode, "sps_ref_wraparound_offset_minus1"); pcSPS->setWrapAroundOffset( (uiCode+1)*(1 << pcSPS->getLog2MinCodingBlockSize())); } -#if JVET_N0070_WRAPAROUND } else { pcSPS->setWrapAroundEnabledFlag(0); } -#endif READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode); @@ -1743,9 +1222,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); READ_FLAG(uiCode, "sps_dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0); -#if JVET_N0127_MMVD_SPS_FLAG READ_FLAG(uiCode, "sps_mmvd_enable_flag"); pcSPS->setUseMMVD(uiCode != 0); -#endif // KJS: sps_cclm_enabled_flag READ_FLAG( uiCode, "lm_chroma_enabled_flag" ); pcSPS->setUseLMChroma ( uiCode != 0 ); if ( pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420 ) @@ -1759,12 +1236,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "mts_intra_enabled_flag" ); pcSPS->setUseIntraMTS ( uiCode != 0 ); READ_FLAG( uiCode, "mts_inter_enabled_flag" ); pcSPS->setUseInterMTS ( uiCode != 0 ); } -#if JVET_N0193_LFNST READ_FLAG( uiCode, "lfnst_enabled_flag" ); pcSPS->setUseLFNST ( uiCode != 0 ); -#endif -#if JVET_N0235_SMVD_SPS READ_FLAG(uiCode, "smvd_flag"); pcSPS->setUseSMVD ( uiCode != 0 ); -#endif // KJS: sps_affine_enabled_flag READ_FLAG( uiCode, "affine_flag" ); pcSPS->setUseAffine ( uiCode != 0 ); if ( pcSPS->getUseAffine() ) @@ -1776,20 +1249,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) // KJS: sps_ciip_enabled_flag READ_FLAG( uiCode, "mhintra_flag" ); pcSPS->setUseMHIntra ( uiCode != 0 ); -#if JVET_N0127_MMVD_SPS_FLAG if ( pcSPS->getUseMMVD() ) { READ_FLAG( uiCode, "sps_fpel_mmvd_enabled_flag" ); pcSPS->setFpelMmvdEnabledFlag ( uiCode != 0 ); } -#else - READ_FLAG( uiCode, "sps_fpel_mmvd_enabled_flag" ); pcSPS->setFpelMmvdEnabledFlag ( uiCode != 0 ); -#endif READ_FLAG( uiCode, "triangle_flag" ); pcSPS->setUseTriangle ( uiCode != 0 ); -#if JVET_N0217_MATRIX_INTRAPRED READ_FLAG( uiCode, "sps_mip_flag"); pcSPS->setUseMIP ( uiCode != 0 ); -#endif // KJS: not in draft yet READ_FLAG(uiCode, "sbt_enable_flag"); pcSPS->setUseSBT(uiCode != 0); if( pcSPS->getUseSBT() ) @@ -1819,41 +1286,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #endif // KJS: reference picture sets to be replaced -#if !JVET_M0128 - READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); - CHECK(uiCode > 64, "Invalid code"); - pcSPS->createRPSList(uiCode); - - RPSList* rpsList = pcSPS->getRPSList(); - ReferencePictureSet* rps; - - for(uint32_t i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) - { - rps = rpsList->getReferencePictureSet(i); - parseShortTermRefPicSet(pcSPS,rps,i); - } - READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); - if (pcSPS->getLongTermRefsPresent()) - { - READ_UVLC( uiCode, "num_long_term_ref_pics_sps" ); - pcSPS->setNumLongTermRefPicSPS(uiCode); - for (uint32_t k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) - { - READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" ); - pcSPS->setLtRefPicPocLsbSps(k, uiCode); - READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]"); - pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); - } - } -#endif // KJS: not found in draft -> does not exist -#if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 - READ_FLAG( uiCode, "strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); -#endif // KJS: remove scaling lists? -#if HEVC_USE_SCALING_LISTS READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); if(pcSPS->getScalingListFlag()) { @@ -1863,9 +1299,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) parseScalingList( &(pcSPS->getScalingList()) ); } } -#endif -#if JVET_N0063_VUI TimingInfo *timingInfo = pcSPS->getTimingInfo(); READ_FLAG( uiCode, "timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); if(timingInfo->getTimingInfoPresentFlag()) @@ -1879,7 +1313,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) parseHrdParameters( pcSPS->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); } } -#endif READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); @@ -1950,7 +1383,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) xReadRbspTrailingBits(); } -#if JVET_N0349_DPS void HLSyntaxReader::parseDPS(DPS* dps) { #if ENABLE_TRACING @@ -1979,7 +1411,6 @@ void HLSyntaxReader::parseDPS(DPS* dps) } xReadRbspTrailingBits(); } -#endif #if HEVC_VPS void HLSyntaxReader::parseVPS(VPS* pcVPS) @@ -2076,7 +1507,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) xReadRbspTrailingBits(); } -#elif JVET_N0278_HLS +#else void HLSyntaxReader::parseVPS(VPS* pcVPS) { #if ENABLE_TRACING @@ -2116,10 +1547,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para PPS* pps = NULL; SPS* sps = NULL; -#if !JVET_N0857_RECT_SLICES - uint32_t firstSliceSegmentInPic; - READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); -#endif if( pcSlice->getRapPicFlag()) { READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already @@ -2137,24 +1564,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para const uint32_t numValidComp=getNumberValidComponents(chFmt); const bool bChroma=(chFmt!=CHROMA_400); -#if !JVET_N0857_RECT_SLICES - int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); - uint32_t sliceSegmentAddress = 0; - int bitsSliceSegmentAddress = 0; - while(numCTUs>(1<setSliceCurStartCtuTsAddr(sliceSegmentAddress); // this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. - pcSlice->setSliceCurEndCtuTsAddr(numCTUs); -#endif -#if JVET_N0857_RECT_SLICES int bitsSliceAddress = 1; if (!pps->getRectSliceFlag()) { @@ -2203,7 +1612,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setSliceCurEndBrickIdx(pcSlice->getSliceCurStartBrickIdx() + uiCode); } pcSlice->setSliceCurStartCtuTsAddr(pcSlice->getSliceCurStartBrickIdx()); -#endif for (int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) { @@ -2224,19 +1632,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para // read colour_plane_id // (separate_colour_plane_flag == 1) is not supported in this version of the standard. -#if JVET_N0047_Merge_IDR_Non_IDR if( pcSlice->getIdrPicFlag() && !(sps->getIDRRefParamListPresent())) -#else - if( pcSlice->getIdrPicFlag() ) -#endif { READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); pcSlice->setPOC(uiCode); -#if !JVET_M0128 - ReferencePictureSet* rps = pcSlice->getLocalRPS(); - (*rps)=ReferencePictureSet(); - pcSlice->setRPS(rps); -#endif } else { @@ -2259,18 +1658,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { iPOCmsb = iPrevPOCmsb; } -#if !JVET_M0101_HLS - if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) - { - // For BLA picture types, POCmsb is set to 0. - iPOCmsb = 0; - } -#endif pcSlice->setPOC (iPOCmsb+iPOClsb); -#if JVET_M0128 //Read L0 related syntax elements if (sps->getNumRPL0() > 0) { @@ -2390,132 +1779,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } } } -#else - ReferencePictureSet* rps; - rps = pcSlice->getLocalRPS(); - (*rps)=ReferencePictureSet(); - - pcSlice->setRPS(rps); - READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); - if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header - { - parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); - } - else // use reference to short-term reference picture set in PPS - { - int numBits = 0; - while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) - { - numBits++; - } - if (numBits > 0) - { - READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); - } - else - { - uiCode = 0; - - } - *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); - } - if(sps->getLongTermRefsPresent()) - { - int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); - uint32_t numOfLtrp = 0; - uint32_t numLtrpInSPS = 0; - if (sps->getNumLongTermRefPicSPS() > 0) - { - READ_UVLC( uiCode, "num_long_term_sps"); - numLtrpInSPS = uiCode; - numOfLtrp += numLtrpInSPS; - rps->setNumberOfLongtermPictures(numOfLtrp); - } - int bitsForLtrpInSPS = 0; - while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) - { - bitsForLtrpInSPS++; - } - READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); - numOfLtrp += uiCode; - rps->setNumberOfLongtermPictures(numOfLtrp); - int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); - int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; - for(int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) - { - int pocLsbLt; - if (k < numLtrpInSPS) - { - uiCode = 0; - if (bitsForLtrpInSPS > 0) - { - READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); - } - bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode); - - pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode); - rps->setUsed(j,usedByCurrFromSPS); - } - else - { - READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; - READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); - } - READ_FLAG(uiCode,"delta_poc_msb_present_flag"); - bool mSBPresentFlag = uiCode ? true : false; - if(mSBPresentFlag) - { - READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); - bool deltaFlag = false; - // First LTRP || First LTRP from SH - if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) - { - deltaFlag = true; - } - if(deltaFlag) - { - deltaPocMSBCycleLT = uiCode; - } - else - { - deltaPocMSBCycleLT = uiCode + prevDeltaMSB; - } - - int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB - - iPOClsb + pocLsbLt; - rps->setPOC (j, pocLTCurr); - rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); - rps->setCheckLTMSBPresent(j,true); - } - else - { - rps->setPOC (j, pocLsbLt); - rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLsbLt); - rps->setCheckLTMSBPresent(j,false); - - // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present - if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) - { - deltaPocMSBCycleLT = 0; - } - } - prevDeltaMSB = deltaPocMSBCycleLT; - } - offset += rps->getNumberOfLongtermPictures(); - rps->setNumberOfPictures(offset); - } -#if !JVET_M0101_HLS - if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP - || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL - || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) - { - // In the case of BLA picture types, rps data is read from slice header but ignored - rps = pcSlice->getLocalRPS(); - (*rps)=ReferencePictureSet(); - pcSlice->setRPS(rps); - } -#endif -#endif if (sps->getSPSTemporalMVPEnabledFlag()) { @@ -2542,7 +1805,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para if( sps->getALFEnabledFlag() ) { READ_FLAG(uiCode, "tile_group_alf_enabled_flag"); -#if JVET_N0415_CTB_ALF pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Y, uiCode); int alfChromaIdc = 0; if (uiCode) @@ -2565,11 +1827,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } -#if JVET_N0805_APS_LMCS pcSlice->setAlfAPSs(apsId); -#else - pcSlice->setAPSs(apsId); -#endif alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc if (alfChromaIdc) { @@ -2590,21 +1848,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cb, alfChromaIdc & 1); pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cr, alfChromaIdc >> 1); -#else - if (uiCode) - { - READ_CODE(5, uiCode, "tile_group_aps_id"); - pcSlice->setAPSId(uiCode); - pcSlice->setAPS(parameterSetManager->getAPS(uiCode)); - pcSlice->setTileGroupAlfEnabledFlag(true); - } - else - { - pcSlice->setTileGroupAlfEnabledFlag(false); - pcSlice->setAPSId(-1); - pcSlice->setAPS(nullptr); - } -#endif } if (pcSlice->getIdrPicFlag()) @@ -2641,94 +1884,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } } // } -#if !JVET_M0128 - RefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); - if(!pcSlice->isIntra()) - { - if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 ) - { - refPicListModification->setRefPicListModificationFlagL0( 0 ); - } - else - { -