diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index f5873527fbb2b3d1d405a2b0973e0b1852ef4302..629b23511b892ff9d5601b501b3d368b55daa73b 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -153,14 +153,12 @@ uint32_t DecApp::decode() { read(nalu); -#if JVET_O0610_DETECT_AUD if(m_cDecLib.getFirstSliceInPicture() && (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP)) { xFlushOutput(pcListPic); } -#endif if ((m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) || !isNaluTheTargetLayer(&nalu)) { @@ -171,13 +169,11 @@ uint32_t DecApp::decode() bNewPicture = m_cDecLib.decode(nalu, m_iSkipFrame, m_iPOCLastDisplay); if (bNewPicture) { -#if JVET_O0610_DETECT_AUD // check if new picture was detected at an access unit delimiter NALU if(nalu.m_nalUnitType != NAL_UNIT_ACCESS_UNIT_DELIMITER) { msg( ERROR, "Error: New picture detected without access unit delimiter. VVC requires the presence of access unit delimiters.\n"); } -#endif bitstreamFile.clear(); /* location points to the current nalunit payload[1] due to the * need for the annexB parser to read three extra bytes. @@ -246,36 +242,14 @@ uint32_t DecApp::decode() { xWriteOutput( pcListPic, nalu.m_temporalId ); } -#if! JVET_O0610_DETECT_AUD -#if JVET_N0865_NONSYNTAX - if ((bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR) && m_cDecLib.getNoOutputPriorPicsFlag()) -#else - if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cDecLib.getNoOutputPriorPicsFlag() ) -#endif - { - m_cDecLib.checkNoOutputPriorPics( pcListPic ); - m_cDecLib.setNoOutputPriorPicsFlag (false); - } - if ( bNewPicture && - ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL - || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP) ) - { - xFlushOutput( pcListPic ); - } -#endif if (nalu.m_nalUnitType == NAL_UNIT_EOS) { xWriteOutput( pcListPic, nalu.m_temporalId ); m_cDecLib.setFirstSliceInPicture (false); } // write reconstruction to file -- for additional bumping as defined in C.5.2.3 -#if JVET_N0865_GRA2GDR 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_GDR))) -#else - 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))) -#endif { xWriteOutput( pcListPic, nalu.m_temporalId ); } @@ -416,11 +390,7 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; if ( !m_reconFileName.empty() ) { -#if JVET_O1164_PS const Window &conf = pcPicTop->cs->pps->getConformanceWindow(); -#else - const Window &conf = pcPicTop->cs->sps->getConformanceWindow(); -#endif const bool isTff = pcPicTop->topField; bool display = true; @@ -441,17 +411,10 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), m_outputColourSpaceConvert, false, // TODO: m_packedYUVMode, -#if JVET_O1164_PS conf.getWindowLeftOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ), conf.getWindowRightOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ), conf.getWindowTopOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ), conf.getWindowBottomOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ), -#else - conf.getWindowLeftOffset(), - conf.getWindowRightOffset(), - conf.getWindowTopOffset(), - conf.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, isTff ); } } @@ -494,36 +457,21 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if (!m_reconFileName.empty()) { -#if JVET_O1164_PS const Window &conf = pcPic->getConformanceWindow(); const SPS* sps = pcPic->cs->sps; ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); -#else - const Window &conf = pcPic->cs->sps->getConformanceWindow(); -#endif -#if JVET_O1164_RPR if( m_upscaledOutput ) { m_cVideoIOYuvReconFile.writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } else m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), -#else - m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(), -#endif m_outputColourSpaceConvert, m_packedYUVMode, -#if JVET_O1164_PS conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), -#else - conf.getWindowLeftOffset(), - conf.getWindowRightOffset(), - conf.getWindowTopOffset(), - conf.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } @@ -578,27 +526,16 @@ void DecApp::xFlushOutput( PicList* pcListPic ) // write to file if ( !m_reconFileName.empty() ) { -#if JVET_O1164_PS const Window &conf = pcPicTop->cs->pps->getConformanceWindow(); -#else - const Window &conf = pcPicTop->cs->sps->getConformanceWindow(); -#endif const bool isTff = pcPicTop->topField; m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), m_outputColourSpaceConvert, false, // TODO: m_packedYUVMode, -#if JVET_O1164_PS conf.getWindowLeftOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ), conf.getWindowRightOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ), conf.getWindowTopOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ), conf.getWindowBottomOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ), -#else - conf.getWindowLeftOffset(), - conf.getWindowRightOffset(), - conf.getWindowTopOffset(), - conf.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, isTff ); } @@ -644,36 +581,21 @@ void DecApp::xFlushOutput( PicList* pcListPic ) if (!m_reconFileName.empty()) { -#if JVET_O1164_PS const Window &conf = pcPic->getConformanceWindow(); const SPS* sps = pcPic->cs->sps; ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); -#else - const Window &conf = pcPic->cs->sps->getConformanceWindow(); -#endif -#if JVET_O1164_RPR if( m_upscaledOutput ) { m_cVideoIOYuvReconFile.writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } else m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), -#else - m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(), -#endif m_outputColourSpaceConvert, m_packedYUVMode, -#if JVET_O1164_PS conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), -#else - conf.getWindowLeftOffset(), - conf.getWindowRightOffset(), - conf.getWindowTopOffset(), - conf.getWindowBottomOffset(), -#endif NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index c20f4e84e4abcc1f4bda8e6bd2827459a2567e07..42584a5fa8e63453d3faa2af06d5f409b6e893fd 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -114,9 +114,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) "\t3: enable bit and tool statistic\n") #endif ("MCTSCheck", m_mctsCheck, false, "If enabled, the decoder checks for violations of mc_exact_sample_value_match_flag in Temporal MCTS ") -#if JVET_O1164_RPR ( "UpscaledOutput", m_upscaledOutput, 0, "Upscaled output for RPR" ) -#endif ; po::setDefaults(opts); diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h index d2088ff8a67c5dfb0694538a565a4deb877756b0..774d15dac52c133a4aff18b9dd49d67530bcd47f 100644 --- a/source/App/DecoderApp/DecAppCfg.h +++ b/source/App/DecoderApp/DecAppCfg.h @@ -76,9 +76,7 @@ protected: int m_statMode; ///< Config statistic mode (0 - bit stat, 1 - tool stat, 3 - both) bool m_mctsCheck; -#if JVET_O1164_RPR int m_upscaledOutput; ////< Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR. -#endif public: DecAppCfg(); diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index d2cc65f5e3eb484b75e32eeafd13281dc39a3155..81bad4b47cf04b57323733fe999f592d4e7d6d6c 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -84,15 +84,11 @@ void EncApp::xInitLibCfg() m_cEncLib.setVPS(&vps); m_cEncLib.setProfile ( m_profile); m_cEncLib.setLevel ( m_levelTier, m_level); -#if JVET_O0044_MULTI_SUB_PROFILE m_cEncLib.setNumSubProfile ( m_numSubProfile ); for (int i = 0; i < m_numSubProfile; i++) { m_cEncLib.setSubProfile(i, m_subProfile[i]); } -#else - m_cEncLib.setSubProfile ( m_subProfile ); -#endif m_cEncLib.setProgressiveSourceFlag ( m_progressiveSourceFlag); m_cEncLib.setInterlacedSourceFlag ( m_interlacedSourceFlag); m_cEncLib.setNonPackedConstraintFlag ( m_nonPackedConstraintFlag); @@ -114,15 +110,11 @@ void EncApp::xInitLibCfg() m_cEncLib.setTemporalSubsampleRatio ( m_temporalSubsampleRatio ); m_cEncLib.setSourceWidth ( m_iSourceWidth ); m_cEncLib.setSourceHeight ( m_iSourceHeight ); -#if JVET_O1164_RPR m_cEncLib.setConformanceWindow ( m_confWinLeft / SPS::getWinUnitX( m_InputChromaFormatIDC ), m_confWinRight / SPS::getWinUnitX( m_InputChromaFormatIDC ), m_confWinTop / SPS::getWinUnitY( m_InputChromaFormatIDC ), m_confWinBottom / SPS::getWinUnitY( m_InputChromaFormatIDC ) ); m_cEncLib.setScalingRatio ( m_scalingRatioHor, m_scalingRatioVer ); m_cEncLib.setRPREnabled ( m_rprEnabled ); m_cEncLib.setSwitchPocPeriod ( m_switchPocPeriod ); m_cEncLib.setUpscaledOutput ( m_upscaledOutput ); -#else - m_cEncLib.setConformanceWindow ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); -#endif m_cEncLib.setFramesToBeEncoded ( m_framesToBeEncoded ); //====== SPS constraint flags ======= @@ -134,9 +126,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoPartitionConstraintsOverrideConstraintFlag ( !m_SplitConsOverrideEnabledFlag ); m_cEncLib.setNoSaoConstraintFlag ( !m_bUseSAO ); m_cEncLib.setNoAlfConstraintFlag ( !m_alf ); -#if !JVET_O0525_REMOVE_PCM - m_cEncLib.setNoPcmConstraintFlag ( !m_usePCM ); -#endif m_cEncLib.setNoRefWraparoundConstraintFlag ( m_bNoRefWraparoundConstraintFlag ); m_cEncLib.setNoTemporalMvpConstraintFlag ( m_TMVPModeId ? false : true ); m_cEncLib.setNoSbtmvpConstraintFlag ( m_SubPuMvpMode ? false : true ); @@ -154,12 +143,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoTriangleConstraintFlag ( !m_Triangle ); m_cEncLib.setNoLadfConstraintFlag ( !m_LadfEnabed ); m_cEncLib.setNoTransformSkipConstraintFlag ( !m_useTransformSkip ); -#if JVET_O1136_TS_BDPCM_SIGNALLING m_cEncLib.setNoBDPCMConstraintFlag ( !m_useBDPCM ); -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG m_cEncLib.setNoJointCbCrConstraintFlag (!m_JointCbCrMode); -#endif m_cEncLib.setNoQpDeltaConstraintFlag ( m_bNoQpDeltaConstraintFlag ); m_cEncLib.setNoDepQuantConstraintFlag ( !m_depQuantEnabledFlag); m_cEncLib.setNoSignDataHidingConstraintFlag ( !m_signDataHidingEnabledFlag ); @@ -168,9 +153,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setIntraPeriod ( m_iIntraPeriod ); m_cEncLib.setDecodingRefreshType ( m_iDecodingRefreshType ); m_cEncLib.setGOPSize ( m_iGOPSize ); -#if JVET_N0494_DRAP m_cEncLib.setDrapPeriod ( m_drapPeriod ); -#endif m_cEncLib.setReWriteParamSets ( m_rewriteParamSets ); m_cEncLib.setRPLList0 ( m_RPLList0); m_cEncLib.setRPLList1 ( m_RPLList1); @@ -195,10 +178,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setIntraQPOffset ( m_intraQPOffset ); m_cEncLib.setLambdaFromQPEnable ( m_lambdaFromQPEnable ); #endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE m_cEncLib.setChromaQpMappingTableParams (m_chromaQpMappingTableParams); -#endif m_cEncLib.setPad ( m_aiPad ); m_cEncLib.setAccessUnitDelimiter ( m_AccessUnitDelimiter ); @@ -285,9 +266,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setSubPuMvpMode ( m_SubPuMvpMode ); m_cEncLib.setAffine ( m_Affine ); m_cEncLib.setAffineType ( m_AffineType ); -#if JVET_O0070_PROF m_cEncLib.setPROF ( m_PROF ); -#endif m_cEncLib.setBIO (m_BIO); m_cEncLib.setUseLMChroma ( m_LMChroma ); m_cEncLib.setCclmCollocatedChromaFlag ( m_cclmCollocatedChromaFlag ); @@ -323,15 +302,8 @@ void EncApp::xInitLibCfg() m_cEncLib.setDMVR ( m_DMVR ); m_cEncLib.setMMVD ( m_MMVD ); m_cEncLib.setMmvdDisNum (m_MmvdDisNum); -#if !JVET_O1136_TS_BDPCM_SIGNALLING - m_cEncLib.setRDPCM ( m_RdpcmMode ); -#endif -#if JVET_O0119_BASE_PALETTE_444 m_cEncLib.setPLTMode ( m_PLTMode ); -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG m_cEncLib.setJointCbCr ( m_JointCbCrMode ); -#endif m_cEncLib.setIBCMode ( m_IBCMode ); m_cEncLib.setIBCLocalSearchRangeX ( m_IBCLocalSearchRangeX ); m_cEncLib.setIBCLocalSearchRangeY ( m_IBCLocalSearchRangeY ); @@ -361,9 +333,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setMaxCUHeight ( m_uiCTUSize ); m_cEncLib.setMaxCodingDepth ( m_uiMaxCodingDepth ); m_cEncLib.setLog2DiffMaxMinCodingBlockSize ( m_uiLog2DiffMaxMinCodingBlockSize ); -#if MAX_TB_SIZE_SIGNALLING m_cEncLib.setLog2MaxTbSize ( m_log2MaxTbSize ); -#endif m_cEncLib.setUseEncDbOpt(m_encDbOpt); m_cEncLib.setUseFastLCTU ( m_useFastLCTU ); m_cEncLib.setFastInterSearchMode ( m_fastInterSearchMode ); @@ -378,23 +348,17 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseContentBasedFastQtbt ( m_contentBasedFastQtbt ); m_cEncLib.setUseNonLinearAlfLuma ( m_useNonLinearAlfLuma ); m_cEncLib.setUseNonLinearAlfChroma ( m_useNonLinearAlfChroma ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_cEncLib.setMaxNumAlfAlternativesChroma ( m_maxNumAlfAlternativesChroma ); -#endif m_cEncLib.setUseMIP ( m_MIP ); m_cEncLib.setUseFastMIP ( m_useFastMIP ); -#if JVET_O0050_LOCAL_DUAL_TREE m_cEncLib.setFastLocalDualTreeMode ( m_fastLocalDualTreeMode ); -#endif m_cEncLib.setCrossComponentPredictionEnabledFlag ( m_crossComponentPredictionEnabledFlag ); m_cEncLib.setUseReconBasedCrossCPredictionEstimate ( m_reconBasedCrossCPredictionEstimate ); m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_LUMA , m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA] ); m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); m_cEncLib.setUseTransformSkip ( m_useTransformSkip ); m_cEncLib.setUseTransformSkipFast ( m_useTransformSkipFast ); -#if JVET_O1136_TS_BDPCM_SIGNALLING m_cEncLib.setUseBDPCM ( m_useBDPCM ); -#endif m_cEncLib.setTransformSkipRotationEnabledFlag ( m_transformSkipRotationEnabledFlag ); m_cEncLib.setTransformSkipContextEnabledFlag ( m_transformSkipContextEnabledFlag ); m_cEncLib.setPersistentRiceAdaptationEnabledFlag ( m_persistentRiceAdaptationEnabledFlag ); @@ -408,10 +372,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setFastUDIUseMPMEnabled ( m_bFastUDIUseMPMEnabled ); m_cEncLib.setFastMEForGenBLowDelayEnabled ( m_bFastMEForGenBLowDelayEnabled ); m_cEncLib.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures ); -#if !JVET_O0525_REMOVE_PCM - m_cEncLib.setPCMLog2MinSize ( m_uiPCMLog2MinSize); - m_cEncLib.setUsePCM ( m_usePCM ); -#endif m_cEncLib.setUseISP ( m_ISP ); m_cEncLib.setUseFastISP ( m_useFastISP ); @@ -420,20 +380,12 @@ void EncApp::xInitLibCfg() { m_cEncLib.setBitDepth((ChannelType)channelType, m_internalBitDepth[channelType]); m_cEncLib.setInputBitDepth((ChannelType)channelType, m_inputBitDepth[channelType]); -#if !JVET_O0525_REMOVE_PCM - m_cEncLib.setPCMBitDepth((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]); -#endif } -#if !JVET_O0525_REMOVE_PCM - m_cEncLib.setPCMLog2MaxSize ( m_pcmLog2MaxSize); -#endif m_cEncLib.setMaxNumMergeCand ( m_maxNumMergeCand ); m_cEncLib.setMaxNumAffineMergeCand ( m_maxNumAffineMergeCand ); m_cEncLib.setMaxNumTriangleCand ( m_maxNumTriangleCand ); -#if JVET_O0455_IBC_MAX_MERGE_NUM m_cEncLib.setMaxNumIBCMergeCand ( m_maxNumIBCMergeCand ); -#endif //====== Weighted Prediction ======== m_cEncLib.setUseWP ( m_useWeightedPred ); @@ -459,10 +411,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setMaxNumOffsetsPerPic ( m_maxNumOffsetsPerPic); m_cEncLib.setSaoCtuBoundary ( m_saoCtuBoundary); -#if !JVET_O0525_REMOVE_PCM - m_cEncLib.setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); - m_cEncLib.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); -#endif m_cEncLib.setSaoGreedyMergeEnc ( m_saoGreedyMergeEnc); m_cEncLib.setIntraSmoothingDisabledFlag (!m_enableIntraReferenceSmoothing ); @@ -470,23 +418,13 @@ void EncApp::xInitLibCfg() #if HEVC_SEI m_cEncLib.setRecoveryPointSEIEnabled ( m_recoveryPointSEIEnabled ); #endif -#if JVET_N0494_DRAP m_cEncLib.setDependentRAPIndicationSEIEnabled ( m_drapPeriod > 0 ); -#endif m_cEncLib.setBufferingPeriodSEIEnabled ( m_bufferingPeriodSEIEnabled ); m_cEncLib.setPictureTimingSEIEnabled ( m_pictureTimingSEIEnabled ); -#if JVET_O0041_FRAME_FIELD_SEI m_cEncLib.setFrameFieldInfoSEIEnabled ( m_frameFieldInfoSEIEnabled ); -#endif -#if JVET_N0867_TEMP_SCAL_HRD m_cEncLib.setBpDeltasGOPStructure ( m_bpDeltasGOPStructure ); -#endif -#if JVET_O0189_DU m_cEncLib.setDecodingUnitInfoSEIEnabled ( m_decodingUnitInfoSEIEnabled ); -#endif -#if FIX_HRD_O0189 m_cEncLib.setHrdParametersPresentFlag ( m_hrdParametersPresentFlag ); -#endif #if HEVC_SEI m_cEncLib.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); m_cEncLib.setTMISEIToneMapId ( m_toneMapId ); @@ -567,13 +505,11 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (m_tileUniformSpacingFlag) { m_cEncLib.setUniformTileColsWidthMinus1 ( m_uniformTileColsWidthMinus1 ); m_cEncLib.setUniformTileRowHeightMinus1 ( m_uniformTileRowHeightMinus1 ); } -#endif m_cEncLib.setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); m_cEncLib.setNumRowsMinus1 ( m_numTileRowsMinus1 ); if(!m_tileUniformSpacingFlag) @@ -600,7 +536,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setLFCrossTileBoundaryFlag ( m_bLFCrossTileBoundaryFlag ); m_cEncLib.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); m_cEncLib.setTMVPModeId ( m_TMVPModeId ); -#if JVET_O0238_PPS_OR_SLICE m_cEncLib.setConstantSliceHeaderParamsEnabledFlag ( m_constantSliceHeaderParamsEnabledFlag ); m_cEncLib.setPPSDepQuantEnabledIdc ( m_PPSDepQuantEnabledIdc ); m_cEncLib.setPPSRefPicListSPSIdc0 ( m_PPSRefPicListSPSIdc0 ); @@ -611,7 +546,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setPPSSixMinusMaxNumMergeCandPlus1 ( m_PPSSixMinusMaxNumMergeCandPlus1 ); m_cEncLib.setPPSFiveMinusMaxNumSubblockMergeCandPlus1 ( m_PPSFiveMinusMaxNumSubblockMergeCandPlus1 ); m_cEncLib.setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ( m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ); -#endif m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); m_cEncLib.setDepQuantEnabledFlag ( m_depQuantEnabledFlag); @@ -938,7 +872,6 @@ void EncApp::xWriteOutput( int iNumEncoded, std::list<PelUnitBuf*>& recBufList const PelUnitBuf* pcPicYuvRec = *(iterPicYuvRec++); if (!m_reconFileName.empty()) { -#if JVET_O1164_RPR if( m_cEncLib.isRPREnabled() && m_cEncLib.getUpscaledOutput() ) { const SPS& sps = *m_cEncLib.getSPS( 0 ); @@ -951,12 +884,6 @@ void EncApp::xWriteOutput( int iNumEncoded, std::list<PelUnitBuf*>& recBufList m_cVideoIOYuvReconFile.write( pcPicYuvRec->get( COMPONENT_Y ).width, pcPicYuvRec->get( COMPONENT_Y ).height, *pcPicYuvRec, ipCSC, m_packedYUVMode, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } -#else - m_cVideoIOYuvReconFile.write( *pcPicYuvRec, - ipCSC, - m_packedYUVMode, - m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); -#endif } } } @@ -988,9 +915,7 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector<uint32_t>& a case NAL_UNIT_CODED_SLICE_IDR_W_RADL: case NAL_UNIT_CODED_SLICE_IDR_N_LP: case NAL_UNIT_CODED_SLICE_CRA: -#if JVET_N0865_NONSYNTAX case NAL_UNIT_CODED_SLICE_GDR: -#endif case NAL_UNIT_CODED_SLICE_RADL: case NAL_UNIT_CODED_SLICE_RASL: case NAL_UNIT_DPS: diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 37675e22a065b9073138174345277042fbb81bd2..386380bb28dcdb8e11d2fe3b109660915ffa4850 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -116,9 +116,6 @@ EncAppCfg::EncAppCfg() , m_noPartitionConstraintsOverrideConstraintFlag(false) , m_bNoSaoConstraintFlag(false) , m_bNoAlfConstraintFlag(false) -#if !JVET_O0525_REMOVE_PCM -, m_bNoPcmConstraintFlag(false) -#endif , m_bNoRefWraparoundConstraintFlag(false) , m_bNoTemporalMvpConstraintFlag(false) , m_bNoSbtmvpConstraintFlag(false) @@ -136,12 +133,8 @@ EncAppCfg::EncAppCfg() , m_bNoTriangleConstraintFlag(false) , m_bNoLadfConstraintFlag(false) , m_noTransformSkipConstraintFlag(false) -#if JVET_O1136_TS_BDPCM_SIGNALLING , m_noBDPCMConstraintFlag(false) -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG , m_noJointCbCrConstraintFlag(false) -#endif , m_bNoQpDeltaConstraintFlag(false) , m_bNoDepQuantConstraintFlag(false) , m_bNoSignDataHidingConstraintFlag(false) @@ -510,7 +503,6 @@ uint32_t SMultiValueInput<uint32_t>::readValue(const char *&pStr, bool &bSuccess return val; } -#if JVET_O0044_MULTI_SUB_PROFILE template<> uint8_t SMultiValueInput<uint8_t>::readValue(const char *&pStr, bool &bSuccess) { @@ -520,7 +512,6 @@ uint8_t SMultiValueInput<uint8_t>::readValue(const char *&pStr, bool &bSuccess) bSuccess = !(*eptr != 0 && !isspace(*eptr) && *eptr != ',') && !(val<minValIncl || val>maxValIncl); return val; } -#endif template<> int SMultiValueInput<int>::readValue(const char *&pStr, bool &bSuccess) @@ -736,7 +727,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<int> cfg_lumaLeveltoDQPMappingLuma (0, std::numeric_limits<int>::max(), 0, LUMA_LEVEL_TO_DQP_LUT_MAXSIZE, defaultLumaLevelTodQp_LumaChangePoints, sizeof(defaultLumaLevelTodQp_LumaChangePoints)/sizeof(int)); uint32_t lumaLevelToDeltaQPMode; #endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE const int qpInVals[] = { 25, 33, 43 }; // qpInVal values used to derive the chroma QP mapping table used in VTM-5.0 const int qpOutVals[] = { 25, 32, 37 }; // qpOutVal values used to derive the chroma QP mapping table used in VTM-5.0 SMultiValueInput<int> cfg_qpInValCb (MIN_QP_VALUE_FOR_16_BIT, MAX_QP, 0, MAX_NUM_QP_VALUES, qpInVals, sizeof(qpInVals)/sizeof(int)); @@ -746,7 +736,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<int> cfg_qpOutValCr (MIN_QP_VALUE_FOR_16_BIT, MAX_QP, 0, MAX_NUM_QP_VALUES, zeroVector, 1); SMultiValueInput<int> cfg_qpInValCbCr (MIN_QP_VALUE_FOR_16_BIT, MAX_QP, 0, MAX_NUM_QP_VALUES, zeroVector, 1); SMultiValueInput<int> cfg_qpOutValCbCr (MIN_QP_VALUE_FOR_16_BIT, MAX_QP, 0, MAX_NUM_QP_VALUES, zeroVector, 1); -#endif const uint32_t defaultInputKneeCodes[3] = { 600, 800, 900 }; const uint32_t defaultOutputKneeCodes[3] = { 100, 250, 450 }; SMultiValueInput<uint32_t> cfg_kneeSEIInputKneePointValue (1, 999, 0, 999, defaultInputKneeCodes, sizeof(defaultInputKneeCodes )/sizeof(uint32_t)); @@ -780,9 +769,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<unsigned> cfg_virtualBoundariesPosX (0, std::numeric_limits<uint32_t>::max(), 0, 3); SMultiValueInput<unsigned> cfg_virtualBoundariesPosY (0, std::numeric_limits<uint32_t>::max(), 0, 3); -#if JVET_O0044_MULTI_SUB_PROFILE SMultiValueInput<uint8_t> cfg_SubProfile(0, std::numeric_limits<uint8_t>::max(), 0, std::numeric_limits<uint8_t>::max()); -#endif int warnUnknowParameter = 0; @@ -845,11 +832,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ConfWinRight", m_confWinRight, 0, "Right offset for window conformance mode 3") ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") -#if JVET_O0610_CFG ("AccessUnitDelimiter", m_AccessUnitDelimiter, true, "Enable Access Unit Delimiter NALUs") -#else - ("AccessUnitDelimiter", m_AccessUnitDelimiter, false, "Enable Access Unit Delimiter NALUs") -#endif ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") ("TemporalSubsampleRatio,-ts", m_temporalSubsampleRatio, 1u, "Temporal sub-sample ratio when reading input YUV") @@ -889,11 +872,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_O0044_MULTI_SUB_PROFILE ("SubProfile", cfg_SubProfile, cfg_SubProfile, "Sub-profile idc") -#else - ("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") @@ -922,9 +901,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MMVD", m_MMVD, true, "Enable Merge mode with Motion Vector Difference (0:off, 1:on) [default: 1]") ("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]" ) -#if JVET_O0070_PROF ("PROF", m_PROF, false, "Enable Prediction refinement with optical flow for affine mode (0:off, 1:on) [default: off]") -#endif ("BIO", m_BIO, false, "Enable bi-directional optical flow") ("IMV", m_ImvMode, 1, "Adaptive MV precision Mode (IMV)\n" "\t0: disabled\n" @@ -965,15 +942,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("AffineAmvrEncOpt", m_AffineAmvrEncOpt, false, "Enable encoder optimization of affine AMVR") ("DMVR", m_DMVR, false, "Decoder-side Motion Vector Refinement") ("MmvdDisNum", m_MmvdDisNum, 8, "Number of MMVD Distance Entries") -#if !JVET_O1136_TS_BDPCM_SIGNALLING - ( "RDPCM", m_RdpcmMode, false, "RDPCM") -#endif -#if JVET_O0119_BASE_PALETTE_444 ("PLT", m_PLTMode, 0u, "PLTMode (0x1:enabled, 0x0:disabled) [default: disabled]") -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG ("JointCbCr", m_JointCbCrMode, false, "Enable joint coding of chroma residuals (JointCbCr, 0:off, 1:on)") -#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") @@ -992,7 +962,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("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") ("EncDbOpt", m_encDbOpt, false, "Encoder optimization with deblocking filter") -#if JVET_O0432_LMCS_ENCODER ("LMCSEnable", m_lumaReshapeEnable, false, "Enable LMCS (luma mapping with chroma scaling") ("LMCSSignalType", m_reshapeSignalType, 0u, "Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG") ("LMCSUpdateCtrl", m_updateCtrl, 0, "LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP") @@ -1000,10 +969,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "1: rsp both (CW66 for QP<=22), 2: rsp TID0 (for all QP)," "3: rsp inter(CW66 for QP<=22), 4: rsp inter(for all QP).") ("LMCSInitialCW", m_initialCW, 0u, "LMCS initial total codeword (0~1023) when LMCSAdpOption > 0") -#else - ("LumaReshapeEnable", m_lumaReshapeEnable, false, "Enable Reshaping for Luma Channel") - ("ReshapeSignalType", m_reshapeSignalType, 0u, "Input signal type: 0: SDR, 1:PQ, 2:HLG") -#endif ("IntraCMD", m_intraCMD, 0u, "IntraChroma MD: 0: none, 1:fixed to default wPSNR weight") ("LCTUFast", m_useFastLCTU, false, "Fast methods for large CTU") ("FastMrg", m_useFastMrg, false, "Fast methods for inter merge") @@ -1013,15 +978,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ContentBasedFastQtbt", m_contentBasedFastQtbt, false, "Signal based QTBT speed-up") ("UseNonLinearAlfLuma", m_useNonLinearAlfLuma, true, "Non-linear adaptive loop filters for Luma Channel") ("UseNonLinearAlfChroma", m_useNonLinearAlfChroma, true, "Non-linear adaptive loop filters for Chroma Channels") -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB ("MaxNumAlfAlternativesChroma", m_maxNumAlfAlternativesChroma, (unsigned)MAX_NUM_ALF_ALTERNATIVES_CHROMA, std::string("Maximum number of alternative Chroma filters (1-") + std::to_string(MAX_NUM_ALF_ALTERNATIVES_CHROMA) + std::string (", inclusive)") ) -#endif ("MIP", m_MIP, true, "Enable MIP (matrix-based intra prediction)") ("FastMIP", m_useFastMIP, false, "Fast encoder search for MIP (matrix-based intra prediction)") -#if JVET_O0050_LOCAL_DUAL_TREE ("FastLocalDualTreeMode", m_fastLocalDualTreeMode, 0, "Fast intra pass coding for local dual-tree in intra coding region, 0: off, 1: use threshold, 2: one intra mode only") -#endif // Unit definition parameters ("MaxCUWidth", m_uiMaxCUWidth, 64u) ("MaxCUHeight", m_uiMaxCUHeight, 64u) @@ -1030,17 +991,13 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") -#if MAX_TB_SIZE_SIGNALLING ("Log2MaxTbSize", m_log2MaxTbSize, 6, "Maximum transform block size in logarithm base 2 (Default: 6)") -#endif // Coding structure paramters ("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 JVET_N0494_DRAP ("DRAPPeriod", m_drapPeriod, 0, "DRAP period in frames (0: disable Dependent RAP indication SEI messages)") -#endif ("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") @@ -1094,7 +1051,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("LumaLevelToDeltaQPMappingLuma", cfg_lumaLeveltoDQPMappingLuma, cfg_lumaLeveltoDQPMappingLuma, "Luma to Delta QP Mapping - luma thresholds") ("LumaLevelToDeltaQPMappingDQP", cfg_lumaLeveltoDQPMappingQP, cfg_lumaLeveltoDQPMappingQP, "Luma to Delta QP Mapping - DQP values") #endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE ("UseIdentityTableForNon420Chroma", m_useIdentityTableForNon420Chroma, true, "True: Indicates that 422/444 chroma uses identity chroma QP mapping tables; False: explicit Qp table may be specified in config") ("SameCQPTablesForAllChroma", m_chromaQpMappingTableParams.m_sameCQPTableForAllChromaFlag, true, "0: Different tables for Cb, Cr and joint Cb-Cr components, 1 (default): Same tables for all three chroma components") ("QpInValCb", cfg_qpInValCb, cfg_qpInValCb, "Input coordinates for the QP table for Cb component") @@ -1103,7 +1059,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("QpOutValCr", cfg_qpOutValCr, cfg_qpOutValCr, "Output coordinates for the QP table for Cr component") ("QpInValCbCr", cfg_qpInValCbCr, cfg_qpInValCbCr, "Input coordinates for the QP table for joint Cb-Cr component") ("QpOutValCbCr", cfg_qpOutValCbCr, cfg_qpOutValCbCr, "Output coordinates for the QP table for joint Cb-Cr component") -#endif ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") ("CbQpOffsetDualTree", m_cbQpOffsetDualTree, 0, "Chroma Cb QP Offset for dual tree") @@ -1155,9 +1110,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") ("TransformSkipFast", m_useTransformSkipFast, false, "Fast encoder search for transform skipping, winner takes it all mode.") ("TransformSkipLog2MaxSize", m_log2MaxTransformSkipBlockSize, 5U, "Specify transform-skip maximum size. Minimum 2, Maximum 5. (not valid in V1 profiles)") -#if JVET_O1136_TS_BDPCM_SIGNALLING ("BDPCM", m_useBDPCM, false, "BDPCM") -#endif ("ISPFast", m_useFastISP, false, "Fast encoder search for ISP") ("ImplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT], false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)") ("ExplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT], false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)") @@ -1183,14 +1136,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("FastUDIUseMPMEnabled", m_bFastUDIUseMPMEnabled, true, "If enabled, adapt intra direction search, accounting for MPM") ("FastMEForGenBLowDelayEnabled", m_bFastMEForGenBLowDelayEnabled, true, "If enabled use a fast ME for generalised B Low Delay slices") ("UseBLambdaForNonKeyLowDelayPictures", m_bUseBLambdaForNonKeyLowDelayPictures, true, "Enables use of B-Lambda for non-key low-delay pictures") -#if !JVET_O0525_REMOVE_PCM - ("PCMEnabledFlag", m_usePCM, false) - ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) - ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) - - ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) - ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) -#endif ("IntraReferenceSmoothing", m_enableIntraReferenceSmoothing, true, "0: Disable use of intra reference smoothing (not valid in V1 profiles). 1: Enable use of intra reference smoothing (same as V1)") ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") @@ -1201,10 +1146,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("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") -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA ("UniformTileColsWidthMinus1", m_uniformTileColsWidthMinus1, -1, "Tile width to use for uniform tiles minus 1") ("UniformTileRowHeightMinus1", m_uniformTileRowHeightMinus1, -1, "Tile height to use for uniform tiles minus 1") -#endif ("TileColumnWidthArray", cfg_ColumnWidth, cfg_ColumnWidth, "Array containing tile column width values in units of CTU") ("TileRowHeightArray", cfg_RowHeight, cfg_RowHeight, "Array containing tile row height values in units of CTU") ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") @@ -1225,9 +1168,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") ("MaxNumAffineMergeCand", m_maxNumAffineMergeCand, 5u, "Maximum number of affine merge candidates") ("MaxNumTriangleCand", m_maxNumTriangleCand, 5u, "Maximum number of triangle candidates") -#if JVET_O0455_IBC_MAX_MERGE_NUM ("MaxNumIBCMergeCand", m_maxNumIBCMergeCand, 6u, "Maximum number of IBC merge candidates") -#endif /* Misc. */ ("SEIDecodedPictureHash,-dph", tmpDecodedPictureHashSEIMappedType, 0, "Control generation of decode picture hash SEI messages\n" "\t3: checksum\n" @@ -1235,10 +1176,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "\t1: use MD5\n" "\t0: disable") ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") -#if JVET_O0238_PPS_OR_SLICE ("PPSorSliceMode", m_PPSorSliceMode, 0, "Enable signalling certain parameters either in PPS or per slice\n" "\tmode 0: Always per slice (default), 1: RA settings, 2: LDB settings, 3: LDP settings") -#endif ("FEN", tmpFastInterSearchMode, int(FASTINTERSEARCH_DISABLED), "fast encoder setting") ("ECU", m_bUseEarlyCU, false, "Early CU setting") ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") @@ -1265,9 +1204,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages"); opts.addOptions() #endif -#if FIX_HRD_O0189 ("HrdParametersPresent,-hrd", m_hrdParametersPresentFlag, false, "Enable generation of hrd_parameters()") -#endif ("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") @@ -1292,12 +1229,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #endif ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, false, "Control generation of buffering period SEI messages") ("SEIPictureTiming", m_pictureTimingSEIEnabled, false, "Control generation of picture timing SEI messages") -#if JVET_O0189_DU ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, false, "Control generation of decoding unit information SEI message.") -#endif -#if JVET_O0041_FRAME_FIELD_SEI ("SEIFrameFieldInfo", m_frameFieldInfoSEIEnabled, false, "Control generation of frame field information SEI messages") -#endif #if HEVC_SEI ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") @@ -1434,13 +1367,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("EnsureWppBitEqual", m_ensureWppBitEqual, false, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off") #endif ( "ALF", m_alf, true, "Adpative Loop Filter\n" ) -#if JVET_O1164_RPR ( "ScalingRatioHor", m_scalingRatioHor, 1.0, "Scaling ratio in hor direction" ) ( "ScalingRatioVer", m_scalingRatioVer, 1.0, "Scaling ratio in ver direction" ) ( "FractionNumFrames", m_fractionOfFrames, 1.0, "Encode a fraction of the specified in FramesToBeEncoded frames" ) ( "SwitchPocPeriod", m_switchPocPeriod, 0, "Switch POC period for RPR" ) ( "UpscaledOutput", m_upscaledOutput, 0, "Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR" ) -#endif ; #if EXTENSION_360_VIDEO @@ -1466,7 +1397,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) po::ErrorReporter err; const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv, err); -#if JVET_O1164_RPR m_rprEnabled = m_scalingRatioHor != 1.0 || m_scalingRatioVer != 1.0; if( m_fractionOfFrames != 1.0 ) { @@ -1477,8 +1407,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { m_switchPocPeriod = m_iFrameRate / 2 / m_iGOPSize * m_iGOPSize; } -#endif -#if JVET_N0867_TEMP_SCAL_HRD m_bpDeltasGOPStructure = false; if(m_iGOPSize == 16) { @@ -1520,7 +1448,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { m_bpDeltasGOPStructure = false; } -#endif 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; @@ -1533,10 +1460,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_RPLList1[i].m_numRefPicsActive = m_GOPList[i].m_numRefPicsActive1; m_RPLList0[i].m_numRefPics = m_GOPList[i].m_numRefPics0; m_RPLList1[i].m_numRefPics = m_GOPList[i].m_numRefPics1; -#if JVET_N0100_PROPOSAL1 m_RPLList0[i].m_ltrp_in_slice_header_flag = m_GOPList[i].m_ltrp_in_slice_header_flag; m_RPLList1[i].m_ltrp_in_slice_header_flag = m_GOPList[i].m_ltrp_in_slice_header_flag; -#endif for (int j = 0; j < m_GOPList[i].m_numRefPics0; j++) m_RPLList0[i].m_deltaRefPics[j] = m_GOPList[i].m_deltaRefPics0[j]; for (int j = 0; j < m_GOPList[i].m_numRefPics1; j++) @@ -1664,16 +1589,13 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { m_tileRowHeight.clear(); } - #if JVET_O0044_MULTI_SUB_PROFILE m_numSubProfile = (uint8_t) cfg_SubProfile.values.size(); m_subProfile.resize(m_numSubProfile); for (uint8_t i = 0; i < m_numSubProfile; ++i) { m_subProfile[i] = cfg_SubProfile.values[i]; } -#endif -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (m_tileUniformSpacingFlag) { int uniformTileHeight = ((m_uniformTileRowHeightMinus1 + 1) * m_uiCTUSize); @@ -1681,7 +1603,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_numTileRowsMinus1 = ((m_iSourceHeight + uniformTileHeight - 1) / uniformTileHeight) - 1; m_numTileColumnsMinus1 = ((m_iSourceWidth + uniformTileWidth - 1) / uniformTileWidth) - 1; } -#endif /* rules for input, output and internal bitdepths as per help text */ if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] == 0) { @@ -1898,12 +1819,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (!singleTileInPicFlag) { //if (!m_singleBrickPerSliceFlag && m_rectSliceFlag) -#if SUPPORT_FOR_RECT_SLICES_WITH_VARYING_NUMBER_OF_TILES if ( (m_sliceMode != 0 && m_sliceMode != 4 && m_rectSliceFlag) || (m_numSlicesInPicMinus1 != 0 && m_rectSliceFlag) ) -#else - if (m_sliceMode != 0 && m_sliceMode != 4 && m_rectSliceFlag) -#endif { int numSlicesInPic = m_numSlicesInPicMinus1 + 1; @@ -2113,7 +2030,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } #endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE CHECK(cfg_qpInValCb.values.size() != cfg_qpOutValCb.values.size(), "Chroma QP table for Cb is incomplete."); CHECK(cfg_qpInValCr.values.size() != cfg_qpOutValCr.values.size(), "Chroma QP table for Cr is incomplete."); @@ -2162,7 +2078,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_chromaQpMappingTableParams.m_deltaQpOutVal[2][i] = (i == 0) ? cfg_qpOutValCbCr.values[i] + qpBdOffsetC : cfg_qpOutValCbCr.values[i] - cfg_qpOutValCbCr.values[i - 1]; } } -#endif #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET if ( m_LadfEnabed ) @@ -2178,12 +2093,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } #endif -#if JVET_O0610_CFG if (m_AccessUnitDelimiter == false) { printf ("Warning: Access unit delimiters are disabled. VVC requires the presence of access unit delimiters\n"); } -#endif #if JVET_O0756_CONFIG_HDRMETRICS && !JVET_O0756_CALCULATE_HDRMETRICS if ( m_calculateHdrMetrics == true) @@ -2229,13 +2142,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if ( m_alf ) { CHECK( m_maxNumAlfAlternativesChroma < 1 || m_maxNumAlfAlternativesChroma > MAX_NUM_ALF_ALTERNATIVES_CHROMA, std::string("The maximum number of ALF Chroma filter alternatives must be in the range (1-") + std::to_string(MAX_NUM_ALF_ALTERNATIVES_CHROMA) + std::string (", inclusive)") ); } -#endif // reading external dQP description from file if ( !m_dQPFileName.empty() ) { @@ -2342,17 +2253,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_reshapeCW.binCW.resize(3); m_reshapeCW.rspFps = m_iFrameRate; -#if !JVET_O0432_LMCS_ENCODER - m_reshapeCW.rspIntraPeriod = m_iIntraPeriod; -#endif m_reshapeCW.rspPicSize = m_iSourceWidth*m_iSourceHeight; m_reshapeCW.rspFpsToIp = std::max(16, 16 * (int)(round((double)m_iFrameRate /16.0))); m_reshapeCW.rspBaseQP = m_iQP; -#if JVET_O0432_LMCS_ENCODER m_reshapeCW.updateCtrl = m_updateCtrl; m_reshapeCW.adpOption = m_adpOption; m_reshapeCW.initialCW = m_initialCW; -#endif #if ENABLE_TRACING g_trace_ctx = tracing_init(sTracingFile, sTracingRule); if( bTracingChannelsList && g_trace_ctx ) @@ -2380,11 +2286,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if WCG_EXT && ER_CHROMA_QP_WCG_PPS && (!m_wcgChromaQpControl.enabled) #endif -#if MAX_TB_SIZE_SIGNALLING && ((1 << (m_log2MaxTbSize + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320)) -#else - && ((1 << (MAX_TB_LOG2_SIZEY + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320)) -#endif { m_cuQpDeltaSubdiv = 2; } @@ -2400,9 +2302,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) msg( WARNING, "*************************************************************************\n" ); m_uiCTUSize = m_uiMaxCUWidth; -#if MAX_TB_SIZE_SIGNALLING if( ( 1u << m_log2MaxTbSize ) > m_uiCTUSize ) m_log2MaxTbSize--; -#endif } #endif #endif // ENABLE_QPA @@ -2471,9 +2371,7 @@ bool EncAppCfg::xCheckParameter() #endif xConfirmPara( m_LMChroma, "LMChroma only allowed with NEXT profile" ); xConfirmPara( m_ImvMode, "IMV is only allowed with NEXT profile" ); -#if JVET_O0119_BASE_PALETTE_444 xConfirmPara( m_PLTMode, "PLT Mode only allowed with NEXT profile"); -#endif xConfirmPara(m_IBCMode, "IBC Mode only allowed with NEXT profile"); xConfirmPara( m_HashME, "Hash motion estimation only allowed with NEXT profile" ); xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" ); @@ -2487,12 +2385,7 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_Triangle, "Triangle is only allowed with NEXT profile" ); xConfirmPara(m_DMVR, "DMVR only allowed with NEXT profile"); xConfirmPara(m_MmvdDisNum, "Number of distance MMVD entry setting only allowed with NEXT profile"); -#if !JVET_O1136_TS_BDPCM_SIGNALLING - xConfirmPara(m_RdpcmMode, "RDPCM only allowed with NEXT profile"); -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG xConfirmPara(m_JointCbCrMode, "JointCbCr only allowed with NEXT profile"); -#endif // ADD_NEW_TOOL : (parameter check) add a check for next tools here } else @@ -2664,9 +2557,7 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); -#if JVET_N0494_DRAP xConfirmPara( m_drapPeriod < 0, "DRAP period must be greater or equal to 0" ); -#endif xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3, "Decoding Refresh Type must be comprised between 0 and 3 included" ); #if HEVC_SEI if(m_iDecodingRefreshType == 3) @@ -2677,23 +2568,13 @@ bool EncAppCfg::xCheckParameter() if (m_isField) { -#if JVET_O0041_FRAME_FIELD_SEI if (!m_frameFieldInfoSEIEnabled) { msg( WARNING, "*************************************************************************************\n"); msg( WARNING, "** WARNING: Frame field information SEI should be enabled for field coding! **\n"); msg( WARNING, "*************************************************************************************\n"); } -#else - if (!m_pictureTimingSEIEnabled) - { - msg( WARNING, "****************************************************************************\n"); - msg( WARNING, "** WARNING: Picture Timing SEI should be enabled for field coding! **\n"); - msg( WARNING, "****************************************************************************\n"); - } -#endif } -#if JVET_N0353_INDEP_BUFF_TIME_SEI if ( m_pictureTimingSEIEnabled && (!m_bufferingPeriodSEIEnabled)) { msg( WARNING, "****************************************************************************\n"); @@ -2701,7 +2582,6 @@ bool EncAppCfg::xCheckParameter() msg( WARNING, "****************************************************************************\n"); m_pictureTimingSEIEnabled = false; } -#endif if(m_crossComponentPredictionEnabledFlag && (m_chromaFormatIDC != CHROMA_444)) { @@ -2773,11 +2653,7 @@ bool EncAppCfg::xCheckParameter() { m_intraCMD = 1; } -#if JVET_O0432_LMCS_ENCODER else if (m_lumaReshapeEnable && (m_reshapeSignalType == RESHAPE_SIGNAL_SDR || m_reshapeSignalType == RESHAPE_SIGNAL_HLG)) -#else - else if (m_lumaReshapeEnable && m_reshapeSignalType == RESHAPE_SIGNAL_SDR) -#endif { m_intraCMD = 0; } @@ -2785,7 +2661,6 @@ bool EncAppCfg::xCheckParameter() { m_lumaReshapeEnable = false; } -#if JVET_O0432_LMCS_ENCODER if (m_lumaReshapeEnable) { xConfirmPara(m_updateCtrl < 0, "Min. LMCS Update Control is 0"); @@ -2796,7 +2671,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_initialCW > 1023, "Max. Initial Total Codeword is 1023"); if (m_updateCtrl > 0 && m_adpOption > 2) { m_adpOption -= 2; } } -#endif xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); @@ -2806,7 +2680,6 @@ 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_O0376_SPS_JOINTCBCR_FLAG if (m_JointCbCrMode && (m_chromaFormatIDC == CHROMA_400)) { msg( WARNING, "****************************************************************************\n"); @@ -2821,12 +2694,6 @@ bool EncAppCfg::xCheckParameter() 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"); } -#else - 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) { @@ -2837,77 +2704,38 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_uiMinQT[0] < 1<<MIN_CU_LOG2, "Minimum QT size should be larger than or equal to 4"); xConfirmPara( m_uiMinQT[1] < 1<<MIN_CU_LOG2, "Minimum QT size should be larger than or equal to 4"); -#if JVET_O0526_MIN_CTU_SIZE xConfirmPara( m_uiCTUSize < 32, "CTUSize must be greater than or equal to 32"); xConfirmPara( m_uiCTUSize > 128, "CTUSize must be less than or equal to 128"); xConfirmPara( m_uiCTUSize != 32 && m_uiCTUSize != 64 && m_uiCTUSize != 128, "CTUSize must be a power of 2 (32, 64, or 128)"); -#else - xConfirmPara( m_uiCTUSize < 16, "Maximum partition width size should be larger than or equal to 16"); - xConfirmPara( m_uiCTUSize < 16, "Maximum partition height size should be larger than or equal to 16"); -#endif -#if !JVET_O0640_PICTURE_SIZE_CONSTRAINT - xConfirmPara( (m_iSourceWidth % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame width must be a multiple of the minimum unit size"); - xConfirmPara( (m_iSourceHeight % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame height must be a multiple of the minimum unit size"); - xConfirmPara( (m_iSourceWidth % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame width must be a multiple of the minimum unit size"); - xConfirmPara( (m_iSourceHeight % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame height must be a multiple of the minimum unit size"); - xConfirmPara( (m_iSourceWidth % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame width must be a multiple of the minimum unit size"); - xConfirmPara( (m_iSourceHeight % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame height must be a multiple of the minimum unit size"); -#endif xConfirmPara( m_uiMaxCUDepth < 1, "MaxPartitionDepth must be greater than zero"); xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); -#if JVET_O0640_PICTURE_SIZE_CONSTRAINT xConfirmPara( (m_iSourceWidth % (std::max(8, int(m_uiMaxCUWidth >> (m_uiMaxCUDepth - 1))))) != 0, "Resulting coded frame width must be a multiple of Max(8, the minimum CU size)"); xConfirmPara( (m_iSourceHeight % (std::max(8, int(m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1))))) != 0, "Resulting coded frame height must be a multiple of Max(8, the minimum CU size)"); -#else - xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); - xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); -#endif -#if MAX_TB_SIZE_SIGNALLING xConfirmPara( m_log2MaxTbSize > 6, "Log2MaxTbSize must be 6 or smaller." ); -#endif -#if JVET_O0545_MAX_TB_SIGNALLING xConfirmPara( m_log2MaxTbSize < 5, "Log2MaxTbSize must be 5 or greater." ); -#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." ); 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." ); -#if JVET_O0455_IBC_MAX_MERGE_NUM xConfirmPara( m_maxNumIBCMergeCand < 1, "MaxNumIBCMergeCand must be 1 or greater." ); xConfirmPara( m_maxNumIBCMergeCand > IBC_MRG_MAX_NUM_CANDS, "MaxNumIBCMergeCand must be no more than IBC_MRG_MAX_NUM_CANDS." ); -#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." ); if ( m_Affine == 0 ) { m_maxNumAffineMergeCand = m_SubPuMvpMode; -#if JVET_O0070_PROF if (m_PROF) msg(WARNING, "PROF is forcefully disabled when Affine is off \n"); m_PROF = false; -#endif } xConfirmPara( m_MTS < 0 || m_MTS > 3, "MTS must be greater than 0 smaller than 4" ); xConfirmPara( m_MTSIntraMaxCand < 0 || m_MTSIntraMaxCand > 5, "m_MTSIntraMaxCand must be greater than 0 and smaller than 6" ); xConfirmPara( m_MTSInterMaxCand < 0 || m_MTSInterMaxCand > 5, "m_MTSInterMaxCand must be greater than 0 and smaller than 6" ); xConfirmPara( m_MTS != 0 && m_MTSImplicit != 0, "Both explicit and implicit MTS cannot be enabled at the same time" ); -#if !JVET_O0525_REMOVE_PCM - if( m_usePCM) - { - for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) - { - xConfirmPara(((m_MSBExtendedBitDepth[channelType] > m_internalBitDepth[channelType]) && m_bPCMInputBitDepthFlag), "PCM bit depth cannot be greater than internal bit depth (PCMInputBitDepthFlag cannot be used when InputBitDepth or MSBExtendedBitDepth > InternalBitDepth)"); - } - xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); - xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); - xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); - xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); - } -#endif if (m_useBDPCM) { @@ -3027,9 +2855,7 @@ 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_O0050_LOCAL_DUAL_TREE xConfirmPara( m_fastLocalDualTreeMode < 0 || m_fastLocalDualTreeMode > 2, "FastLocalDualTreeMode must be in range [0..2]" ); -#endif int extraRPLs = 0; //start looping through frames in coding order until we can verify that the GOP structure is correct. @@ -3385,7 +3211,6 @@ bool EncAppCfg::xCheckParameter() m_BIO = false; } - #if JVET_O0238_PPS_OR_SLICE // If m_PPSorSliceFlag is equal to 1, for each PPS parameter below, // 0: value is signaled in slice header // >0: value is derived from PPS parameter as value - 1 @@ -3442,11 +3267,8 @@ bool EncAppCfg::xCheckParameter() default: THROW("Invalid value for PPSorSliceMode"); } -#endif -#if JVET_N0494_DRAP xConfirmPara(m_drapPeriod > 0 && m_PPSRefPicListSPSIdc0 > 0, "PPSRefPicListSPSIdc0 shall be 0 when DRAP is used. This can be fixed by setting PPSorSliceMode=0."); xConfirmPara(m_drapPeriod > 0 && m_PPSRefPicListSPSIdc1 > 0, "PPSRefPicListSPSIdc1 shall be 0 when DRAP is used. This can be fixed by setting PPSorSliceMode=0."); -#endif #if HEVC_SEI if (m_toneMappingInfoSEIEnabled) @@ -3626,18 +3448,11 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "Profile : %s\n", profileToString(m_profile) ); } msg( DETAILS, "CU size / depth / total-depth : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxCodingDepth ); -#if MAX_TB_SIZE_SIGNALLING msg( DETAILS, "Max TB size : %d \n", 1 << m_log2MaxTbSize ); -#endif -#if !JVET_O0525_REMOVE_PCM - msg( DETAILS, "Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); -#endif msg( DETAILS, "Motion search range : %d\n", m_iSearchRange ); msg( DETAILS, "Intra period : %d\n", m_iIntraPeriod ); msg( DETAILS, "Decoding refresh type : %d\n", m_iDecodingRefreshType ); -#if JVET_N0494_DRAP msg( DETAILS, "DRAP period : %d\n", m_drapPeriod ); -#endif #if QP_SWITCHING_FOR_PARALLEL if (m_qpIncrementAtSourceFrame.bPresent) { @@ -3659,10 +3474,6 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "Input bit depth : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] ); msg( DETAILS, "MSB-extended bit depth : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] ); msg( DETAILS, "Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] ); -#if !JVET_O0525_REMOVE_PCM - msg( DETAILS, "PCM sample bit depth : (Y:%d, C:%d)\n", m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA], - m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] ); -#endif msg( DETAILS, "Intra reference smoothing : %s\n", (m_enableIntraReferenceSmoothing ? "Enabled" : "Disabled") ); msg( DETAILS, "cu_chroma_qp_offset_subdiv : %d\n", m_cuChromaQpOffsetSubdiv); msg( DETAILS, "extended_precision_processing_flag : %s\n", (m_extendedPrecisionProcessingFlag ? "Enabled" : "Disabled") ); @@ -3713,9 +3524,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 ); msg( DETAILS, "Max Num Triangle Merge Candidates : %d\n", m_maxNumTriangleCand ); -#if JVET_O0455_IBC_MAX_MERGE_NUM msg( DETAILS, "Max Num IBC Merge Candidates : %d\n", m_maxNumIBCMergeCand ); -#endif msg( DETAILS, "\n"); msg( VERBOSE, "TOOL CFG: "); @@ -3739,9 +3548,7 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "TransformSkip:%d ", m_useTransformSkip ); msg( VERBOSE, "TransformSkipFast:%d ", m_useTransformSkipFast ); msg( VERBOSE, "TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize); -#if JVET_O1136_TS_BDPCM_SIGNALLING msg( VERBOSE, "BDPCM:%d ", m_useBDPCM ); -#endif msg( VERBOSE, "Slice: M=%d ", int(m_sliceMode)); if (m_sliceMode!=NO_SLICES) { @@ -3752,9 +3559,6 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "CIP:%d ", m_bUseConstrainedIntraPred); msg( VERBOSE, "SAO:%d ", (m_bUseSAO)?(1):(0)); msg( VERBOSE, "ALF:%d ", m_alf ? 1 : 0 ); -#if !JVET_O0525_REMOVE_PCM - msg( VERBOSE, "PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); -#endif if (m_TransquantBypassEnabledFlag && m_CUTransquantBypassFlagForce) { @@ -3786,9 +3590,7 @@ void EncAppCfg::xPrintParameter() { msg( VERBOSE, "AffineType:%d ", m_AffineType ); } -#if JVET_O0070_PROF msg(VERBOSE, "PROF:%d ", m_PROF); -#endif msg(VERBOSE, "SubPuMvp:%d+%d ", m_SubPuMvpMode & 1, (m_SubPuMvpMode & 2) == 2); msg( VERBOSE, "DualITree:%d ", m_dualTree ); msg( VERBOSE, "IMV:%d ", m_ImvMode ); @@ -3818,17 +3620,10 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "AffineAmvrEncOpt:%d ", m_AffineAmvrEncOpt ); msg(VERBOSE, "DMVR:%d ", m_DMVR); msg(VERBOSE, "MmvdDisNum:%d ", m_MmvdDisNum); -#if !JVET_O1136_TS_BDPCM_SIGNALLING - msg(VERBOSE, "RDPCM:%d ", m_RdpcmMode ); -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG msg(VERBOSE, "JointCbCr:%d ", m_JointCbCrMode); -#endif } -#if JVET_O0119_BASE_PALETTE_444 m_PLTMode = ( m_chromaFormatIDC == CHROMA_444) ? m_PLTMode : 0u; msg(VERBOSE, "PLT:%d ", m_PLTMode); -#endif msg(VERBOSE, "IBC:%d ", m_IBCMode); msg( VERBOSE, "HashME:%d ", m_HashME ); msg( VERBOSE, "WrapAround:%d ", m_wrapAround); @@ -3855,13 +3650,9 @@ void EncAppCfg::xPrintParameter() msg(VERBOSE, "Reshape:%d ", m_lumaReshapeEnable); if (m_lumaReshapeEnable) { -#if JVET_O0432_LMCS_ENCODER msg(VERBOSE, "(Signal:%s ", m_reshapeSignalType == 0 ? "SDR" : (m_reshapeSignalType == 2 ? "HDR-HLG" : "HDR-PQ")); msg(VERBOSE, "Opt:%d", m_adpOption); if (m_adpOption > 0) { msg(VERBOSE, " CW:%d", m_initialCW); } -#else - msg(VERBOSE, "(Sigal:%s ", m_reshapeSignalType==0? "SDR" : "HDR-PQ"); -#endif msg(VERBOSE, ") "); } msg(VERBOSE, "MIP:%d ", m_MIP); @@ -3879,13 +3670,9 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt ); msg( VERBOSE, "UseNonLinearAlfLuma:%d ", m_useNonLinearAlfLuma ); msg( VERBOSE, "UseNonLinearAlfChroma:%d ", m_useNonLinearAlfChroma ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB msg( VERBOSE, "MaxNumAlfAlternativesChroma:%d ", m_maxNumAlfAlternativesChroma ); -#endif if( m_MIP ) msg(VERBOSE, "FastMIP:%d ", m_useFastMIP); -#if JVET_O0050_LOCAL_DUAL_TREE msg( VERBOSE, "FastLocalDualTree:%d ", m_fastLocalDualTreeMode ); -#endif msg( VERBOSE, "NumSplitThreads:%d ", m_numSplitThreads ); if( m_numSplitThreads > 1 ) @@ -3895,7 +3682,6 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "NumWppThreads:%d+%d ", m_numWppThreads, m_numWppExtraLines ); msg( VERBOSE, "EnsureWppBitEqual:%d ", m_ensureWppBitEqual ); -#if JVET_O1164_RPR if( m_rprEnabled ) { msg( VERBOSE, "RPR:(%1.2lfx, %1.2lfx)|%d", m_scalingRatioHor, m_scalingRatioVer, m_switchPocPeriod ); @@ -3904,7 +3690,6 @@ void EncAppCfg::xPrintParameter() { msg( VERBOSE, "RPR:%d", 0 ); } -#endif #if EXTENSION_360_VIDEO m_ext360.outputConfigurationSummary(); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 36b98506fb62673e6fd26fa04824505221249414..c993b9ddab39ac0b284a62e5ec921f57f735165c 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -130,9 +130,6 @@ protected: bool m_noPartitionConstraintsOverrideConstraintFlag; bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; -#if !JVET_O0525_REMOVE_PCM - bool m_bNoPcmConstraintFlag; -#endif bool m_bNoRefWraparoundConstraintFlag; bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; @@ -150,12 +147,8 @@ protected: bool m_bNoTriangleConstraintFlag; bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; -#if JVET_O1136_TS_BDPCM_SIGNALLING bool m_noBDPCMConstraintFlag; -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool m_noJointCbCrConstraintFlag; -#endif bool m_bNoQpDeltaConstraintFlag; bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -164,12 +157,8 @@ protected: Profile::Name m_profile; Level::Tier m_levelTier; Level::Name m_level; -#if JVET_O0044_MULTI_SUB_PROFILE std::vector<uint32_t> m_subProfile; uint8_t m_numSubProfile; -#else - uint32_t m_subProfile; -#endif uint32_t m_bitDepthConstraint; ChromaFormat m_chromaFormatConstraint; bool m_intraConstraintFlag; @@ -184,9 +173,7 @@ 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 JVET_N0494_DRAP int m_drapPeriod; ///< period of dependent RAP pictures -#endif bool m_rewriteParamSets; ///< Flag to enable rewriting of parameter sets at random access points RPLEntry m_RPLList0[MAX_GOP]; ///< the RPL entries from the config file RPLEntry m_RPLList1[MAX_GOP]; ///< the RPL entries from the config file @@ -201,9 +188,7 @@ protected: uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; ///< number of bits for the upward bit shift operation on the decoded SAO offsets bool m_useTransformSkip; ///< flag for enabling intra transform skipping bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping -#if JVET_O1136_TS_BDPCM_SIGNALLING bool m_useBDPCM; -#endif uint32_t m_log2MaxTransformSkipBlockSize; ///< transform-skip maximum size (minimum of 2) bool m_transformSkipRotationEnabledFlag; ///< control flag for transform-skip/transquant-bypass residual rotation bool m_transformSkipContextEnabledFlag; ///< control flag for transform-skip/transquant-bypass single significance map context @@ -220,10 +205,8 @@ protected: double m_fQP; ///< QP value of key-picture (floating point) #endif int m_iQP; ///< QP value of key-picture (integer) -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE bool m_useIdentityTableForNon420Chroma; ChromaQpMappingTableParams m_chromaQpMappingTableParams; -#endif #if X0038_LAMBDA_FROM_QP_CAPABILITY int m_intraQPOffset; ///< QP offset for intra slice (integer) bool m_lambdaFromQPEnable; ///< enable flag for QP:lambda fix @@ -277,9 +260,7 @@ protected: int m_SubPuMvpMode; bool m_Affine; bool m_AffineType; -#if JVET_O0070_PROF bool m_PROF; -#endif bool m_BIO; int m_LMChroma; bool m_cclmCollocatedChromaFlag; @@ -309,15 +290,8 @@ protected: bool m_DMVR; bool m_MMVD; int m_MmvdDisNum; -#if !JVET_O1136_TS_BDPCM_SIGNALLING - bool m_RdpcmMode; -#endif -#if JVET_O0119_BASE_PALETTE_444 unsigned m_PLTMode; -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool m_JointCbCrMode; -#endif unsigned m_IBCMode; unsigned m_IBCLocalSearchRangeX; unsigned m_IBCLocalSearchRangeY; @@ -339,11 +313,9 @@ protected: uint32_t m_reshapeSignalType; uint32_t m_intraCMD; ReshapeCW m_reshapeCW; -#if JVET_O0432_LMCS_ENCODER int m_updateCtrl; int m_adpOption; uint32_t m_initialCW; -#endif bool m_encDbOpt; unsigned m_uiMaxCUWidth; ///< max. CU width in pixel unsigned m_uiMaxCUHeight; ///< max. CU height in pixel @@ -359,14 +331,10 @@ protected: bool m_contentBasedFastQtbt; bool m_useNonLinearAlfLuma; bool m_useNonLinearAlfChroma; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB unsigned m_maxNumAlfAlternativesChroma; -#endif bool m_MIP; bool m_useFastMIP; -#if JVET_O0050_LOCAL_DUAL_TREE int m_fastLocalDualTreeMode; -#endif int m_numSplitThreads; @@ -375,9 +343,7 @@ protected: int m_numWppExtraLines; bool m_ensureWppBitEqual; -#if MAX_TB_SIZE_SIGNALLING int m_log2MaxTbSize; -#endif // coding tools (bit-depth) int m_inputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input file int m_outputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of output file @@ -389,10 +355,6 @@ protected: //coding tools (chroma format) ChromaFormat m_chromaFormatIDC; -#if !JVET_O0525_REMOVE_PCM - // coding tools (PCM bit-depth) - bool m_bPCMInputBitDepthFlag; ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth. -#endif // coding tool (SAO) bool m_bUseSAO; @@ -411,13 +373,6 @@ protected: int m_deblockingFilterMetric; ///< blockiness metric in encoder #else bool m_DeblockingFilterMetric; ///< blockiness metric in encoder -#endif -#if !JVET_O0525_REMOVE_PCM - // coding tools (PCM) - bool m_usePCM; ///< flag for using IPCM - uint32_t m_pcmLog2MaxSize; ///< log2 of maximum PCM block size - uint32_t m_uiPCMLog2MinSize; ///< log2 of minimum PCM block size - bool m_bPCMFilterDisableFlag; ///< PCM filter disable flag #endif bool m_enableIntraReferenceSmoothing; ///< flag for enabling(default)/disabling intra reference smoothing/filtering @@ -452,10 +407,8 @@ protected: bool m_tileUniformSpacingFlag; int m_numTileColumnsMinus1; int m_numTileRowsMinus1; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int m_uniformTileColsWidthMinus1; int m_uniformTileRowHeightMinus1; -#endif std::vector<int> m_tileColumnWidth; std::vector<int> m_tileRowHeight; bool m_entropyCodingSyncEnabledFlag; @@ -480,15 +433,9 @@ protected: #endif bool m_bufferingPeriodSEIEnabled; bool m_pictureTimingSEIEnabled; -#if JVET_N0867_TEMP_SCAL_HRD bool m_bpDeltasGOPStructure; -#endif -#if JVET_O0189_DU bool m_decodingUnitInfoSEIEnabled; -#endif -#if JVET_O0041_FRAME_FIELD_SEI bool m_frameFieldInfoSEIEnabled; -#endif #if HEVC_SEI bool m_toneMappingInfoSEIEnabled; bool m_chromaResamplingFilterSEIenabled; @@ -570,12 +517,9 @@ protected: uint32_t m_maxNumMergeCand; ///< Max number of merge candidates uint32_t m_maxNumAffineMergeCand; ///< Max number of affine merge candidates uint32_t m_maxNumTriangleCand; -#if JVET_O0455_IBC_MAX_MERGE_NUM uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates -#endif int m_TMVPModeId; -#if JVET_O0238_PPS_OR_SLICE int m_PPSorSliceMode; bool m_constantSliceHeaderParamsEnabledFlag; int m_PPSDepQuantEnabledIdc; @@ -587,7 +531,6 @@ protected: uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; uint32_t m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#endif bool m_depQuantEnabledFlag; bool m_signDataHidingEnabledFlag; bool m_RCEnableRateControl; ///< enable rate control or not @@ -614,9 +557,7 @@ protected: #endif bool m_decodingParameterSetEnabled; ///< enable decoding parameter set -#if FIX_HRD_O0189 bool m_hrdParametersPresentFlag; ///< enable generation of HRD parameters -#endif bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present int m_aspectRatioIdc; ///< aspect_ratio_idc @@ -657,14 +598,12 @@ protected: bool m_alf; ///< Adaptive Loop Filter -#if JVET_O1164_RPR double m_scalingRatioHor; double m_scalingRatioVer; bool m_rprEnabled; double m_fractionOfFrames; ///< encode a fraction of the frames as specified in FramesToBeEncoded int m_switchPocPeriod; int m_upscaledOutput; ////< Output upscaled (2), decoded cropped but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR. -#endif #if EXTENSION_360_VIDEO TExt360AppEncCfg m_ext360; diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp index 3913e5da5eb98ca3b1172e7196488baa0c7eeb2c..1020c559ce8fbd0f955d4f3acc85d93644dac729 100644 --- a/source/App/Parcat/parcat.cpp +++ b/source/App/Parcat/parcat.cpp @@ -59,12 +59,6 @@ bool ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parame SPS* sps = NULL; uint32_t firstSliceSegmentInPic; -#if !JVET_N0865_SYNTAX - if (isRapPic) - { - READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); // ignored -- updated already - } -#endif READ_UVLC(uiCode, "slice_pic_parameter_set_id"); pps = parameterSetManager->getPPS(uiCode); //!KS: need to add error handling code here, if PPS is not available @@ -113,9 +107,7 @@ bool ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parame READ_UVLC(uiCode, "num_bricks_in_slice_minus1"); } -#if JVET_O0181 READ_FLAG(uiCode, "non_reference_picture_flag"); -#endif //set uiCode to equal slice start address (or dependent slice start address) for (int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) @@ -124,12 +116,6 @@ bool ParcatHLSyntaxReader::parseSliceHeaderUpToPoc ( ParameterSetManager *parame } READ_UVLC ( uiCode, "slice_type" ); -#if !JVET_N0865_SYNTAX - if( pps->getOutputFlagPresentFlag() ) - { - READ_FLAG( uiCode, "pic_output_flag" ); - } -#endif return firstSliceSegmentInPic; @@ -196,7 +182,6 @@ const bool verbose = false; const char * NALU_TYPE[] = { -#if JVET_O0179 "NAL_UNIT_CODED_SLICE_TRAIL", "NAL_UNIT_CODED_SLICE_STSA", "NAL_UNIT_CODED_SLICE_RASL", @@ -208,11 +193,7 @@ const char * NALU_TYPE[] = "NAL_UNIT_CODED_SLICE_IDR_W_RADL", "NAL_UNIT_CODED_SLICE_IDR_N_LP", "NAL_UNIT_CODED_SLICE_CRA", -#if JVET_N0865_GRA2GDR "NAL_UNIT_CODED_SLICE_GDR", -#else - "NAL_UNIT_CODED_SLICE_GRA", -#endif "NAL_UNIT_RESERVED_IRAP_VCL12", "NAL_UNIT_RESERVED_IRAP_VCL13", "NAL_UNIT_RESERVED_VCL14", @@ -233,44 +214,6 @@ const char * NALU_TYPE[] = "NAL_UNIT_UNSPECIFIED_29", "NAL_UNIT_UNSPECIFIED_30", "NAL_UNIT_UNSPECIFIED_31" -#else - "NAL_UNIT_PPS", - "NAL_UNIT_ACCESS_UNIT_DELIMITER", - "NAL_UNIT_PREFIX_SEI", - "NAL_UNIT_SUFFIX_SEI", - "NAL_UNIT_APS", - "NAL_UNIT_RESERVED_NVCL_5", - "NAL_UNIT_RESERVED_NVCL_6", - "NAL_UNIT_RESERVED_NVCL_7", - "NAL_UNIT_CODED_SLICE_TRAIL", - "NAL_UNIT_CODED_SLICE_STSA", - "NAL_UNIT_CODED_SLICE_RADL", - "NAL_UNIT_CODED_SLICE_RASL", - "NAL_UNIT_RESERVED_VCL_12", - "NAL_UNIT_RESERVED_VCL_13", - "NAL_UNIT_RESERVED_VCL_14", - "NAL_UNIT_RESERVED_VCL_15", - "NAL_UNIT_DPS", - "NAL_UNIT_SPS", - "NAL_UNIT_EOS", - "NAL_UNIT_EOB", - "NAL_UNIT_VPS", - "NAL_UNIT_RESERVED_NVCL_21", - "NAL_UNIT_RESERVED_NVCL_22", - "NAL_UNIT_RESERVED_NVCL_23", - "NAL_UNIT_CODED_SLICE_IDR_W_RADL", - "NAL_UNIT_CODED_SLICE_IDR_N_LP", - "NAL_UNIT_CODED_SLICE_CRA", -#if JVET_N0865_GRA2GDR - "NAL_UNIT_CODED_SLICE_GDR", -#else - "NAL_UNIT_CODED_SLICE_GRA", -#endif - "NAL_UNIT_UNSPECIFIED_28", - "NAL_UNIT_UNSPECIFIED_29", - "NAL_UNIT_UNSPECIFIED_30", - "NAL_UNIT_UNSPECIFIED_31" -#endif }; int calc_poc(int iPOClsb, int prevTid0POC, int getBitsForPOC, int nalu_type) @@ -326,14 +269,7 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int p += nal_start; std::vector<uint8_t> nalu(p, p + nal_end - nal_start); -#if JVET_O0179 int nalu_type = nalu[1] >> 3; -#else - 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); -#endif #if ENABLE_TRACING printf ("NALU Type: %d (%s)\n", nalu_type, NALU_TYPE[nalu_type]); #endif @@ -370,11 +306,7 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int poc = 0; new_poc = *poc_base + poc; } -#if JVET_O0179 if((nalu_type < 7) || (nalu_type > 9 && nalu_type < 15) ) -#else - if((nalu_type > 7 && nalu_type < 15) || nalu_type == NAL_UNIT_CODED_SLICE_CRA) -#endif { parcatHLSReader.setBitstream( &inp_nalu.getBitstream() ); bool isRapPic = diff --git a/source/App/SEIRemovalApp/SEIRemovalApp.cpp b/source/App/SEIRemovalApp/SEIRemovalApp.cpp index b34207d97d2087221b81adde02fc48e216da92bb..b1d55fb4a06b33a055b7188aec1a4ae463c7fb76 100644 --- a/source/App/SEIRemovalApp/SEIRemovalApp.cpp +++ b/source/App/SEIRemovalApp/SEIRemovalApp.cpp @@ -72,28 +72,11 @@ void read2(InputNALUnit& nalu) { InputBitstream& bs = nalu.getBitstream(); -#if JVET_O0179 nalu.m_forbiddenZeroBit = bs.read(1); // forbidden zero bit nalu.m_nuhReservedZeroBit = bs.read(1); // nuh_reserved_zero_bit nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id nalu.m_nalUnitType = (NalUnitType) bs.read(5); // nal_unit_type nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 -#else - 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."); - //When zero_tid_required_flag is equal to 1, the value of nuh_temporal_id_plus1 shall be equal to 1. - CHECK((zeroTidRequiredFlag == 1) && (nalu.m_temporalId != 0), "Temporal ID is not '0' when zero tid is required."); - uint32_t nalUnitTypeLsb = bs.read(4); // nal_unit_type_lsb - nalu.m_nalUnitType = (NalUnitType) ((zeroTidRequiredFlag << 4) + nalUnitTypeLsb); - nalu.m_nuhLayerId = bs.read(7); // nuh_layer_id - CHECK(nalu.m_nuhLayerId == 0, "nuh_layer_id_plus1 must be greater than zero"); - nalu.m_nuhLayerId--; - CHECK(nalu.m_nuhLayerId > 125, "Layer ID out of range"); - 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'"); -#endif } uint32_t SEIRemovalApp::decode() diff --git a/source/App/StreamMergeApp/StreamMergeApp.cpp b/source/App/StreamMergeApp/StreamMergeApp.cpp index b8063cee734ca2a0fcd4b92d6c2d773eaa07a92d..4df1bad911969fda2a25d623bdeba36e4b3bf43a 100644 --- a/source/App/StreamMergeApp/StreamMergeApp.cpp +++ b/source/App/StreamMergeApp/StreamMergeApp.cpp @@ -76,28 +76,11 @@ void read2(InputNALUnit& nalu) { InputBitstream& bs = nalu.getBitstream(); -#if JVET_O0179 nalu.m_forbiddenZeroBit = bs.read(1); // forbidden zero bit nalu.m_nuhReservedZeroBit = bs.read(1); // nuh_reserved_zero_bit nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id nalu.m_nalUnitType = (NalUnitType) bs.read(5); // nal_unit_type nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 -#else - 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."); - //When zero_tid_required_flag is equal to 1, the value of nuh_temporal_id_plus1 shall be equal to 1. - CHECK((zeroTidRequiredFlag == 1) && (nalu.m_temporalId != 0), "Temporal ID is not '0' when zero tid is required."); - uint32_t nalUnitTypeLsb = bs.read(4); // nal_unit_type_lsb - nalu.m_nalUnitType = (NalUnitType)((zeroTidRequiredFlag << 4) + nalUnitTypeLsb); - nalu.m_nuhLayerId = bs.read(7); // nuh_layer_id - CHECK(nalu.m_nuhLayerId == 0, "nuh_layer_id_plus1 must be greater than zero"); - nalu.m_nuhLayerId--; - CHECK(nalu.m_nuhLayerId > 125, "Layer ID out of range"); - 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'"); -#endif } static void @@ -247,7 +230,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_O0179 int forbiddenZero = 0; bsNALUHeader.write(forbiddenZero, 1); // forbidden_zero_bit int nuhReservedZeroBit = 0; @@ -255,14 +237,6 @@ void StreamMergeApp::writeNewVPS(ostream& out, int nLayerId, int nTemporalId) bsNALUHeader.write(nLayerId, 6); // nuh_layer_id bsNALUHeader.write(NAL_UNIT_VPS, 5); // nal_unit_type bsNALUHeader.write(nTemporalId + 1, 3); // nuh_temporal_id_plus1 -#else - 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); - bsNALUHeader.write(nalUnitTypeLsb, 4); // nal_unit_type_lsb - bsNALUHeader.write(nLayerId + 1, 7); // nuh_layer_id - bsNALUHeader.write(0, 1); // nuh_reserved_zero_bit -#endif out.write(reinterpret_cast<const char*>(start_code_prefix), 4); out.write(reinterpret_cast<const char*>(bsNALUHeader.getByteStream()), bsNALUHeader.getByteStreamLength()); diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index 67ae25e15bbcebea38c05a2241c8594e27314f06..912fb32ab20c827e246a41ed70473c35906ada27 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -59,9 +59,7 @@ AdaptiveLoopFilter::AdaptiveLoopFilter() for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { m_ctuEnableFlag[compIdx] = nullptr; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_ctuAlternative[compIdx] = nullptr; -#endif } m_deriveClassificationBlk = deriveClassificationBlk; @@ -353,9 +351,7 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { m_ctuEnableFlag[compIdx] = cs.picture->getAlfCtuEnableFlag( compIdx ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_ctuAlternative[compIdx] = cs.picture->getAlfCtuAlternativeData( compIdx ); -#endif } reconstructCoeffAPSs(cs, true, cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) || cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Cr), false); short* alfCtuFilterIndex = cs.slice->getPic()->getAlfCtbFilterIndex(); @@ -434,10 +430,6 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) deriveClassification( m_classifier, buf.get(COMPONENT_Y), blkDst, blkSrc, alfBryList ); #else deriveClassification( m_classifier, buf.get(COMPONENT_Y), blkDst, blkSrc ); -#endif -#if !JVET_O0525_REMOVE_PCM - const Area blkPCM( xStart, yStart, w, h ); - resetPCMBlkClassInfo( cs, m_classifier, buf.get(COMPONENT_Y), blkPCM ); #endif short filterSetIndex = alfCtuFilterIndex[ctuIdx]; short *coeff; @@ -472,12 +464,8 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) { const Area blkSrc( 0, 0, w >> chromaScaleX, h >> chromaScaleY ); const Area blkDst( xStart >> chromaScaleX, yStart >> chromaScaleY, w >> chromaScaleX, h >> chromaScaleY ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB uint8_t alt_num = m_ctuAlternative[compIdx][ctuIdx]; m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs -#else - m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs -#endif , m_alfVBChmaCTUHeight #if JVET_O0625_ALF_PADDING , ( ( yPos + pcv.maxCUHeight >= pcv.lumaHeight ) ? pcv.lumaHeight : m_alfVBChmaPos ), alfBryList ); @@ -503,10 +491,6 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk, blk, alfBryList ); #else deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk, blk ); -#endif -#if !JVET_O0525_REMOVE_PCM - Area blkPCM(xPos, yPos, width, height); - resetPCMBlkClassInfo(cs, m_classifier, tmpYuv.get(COMPONENT_Y), blkPCM); #endif short filterSetIndex = alfCtuFilterIndex[ctuIdx]; short *coeff; @@ -540,12 +524,8 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs) if( m_ctuEnableFlag[compIdx][ctuIdx] ) { Area blk( xPos >> chromaScaleX, yPos >> chromaScaleY, width >> chromaScaleX, height >> chromaScaleY ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB uint8_t alt_num = m_ctuAlternative[compIdx][ctuIdx]; m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs -#else - m_filter5x5Blk(m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs -#endif , m_alfVBChmaCTUHeight #if JVET_O0625_ALF_PADDING , ( ( yPos + pcv.maxCUHeight >= pcv.lumaHeight ) ? pcv.lumaHeight : m_alfVBChmaPos ), alfBryList ); @@ -585,12 +565,8 @@ void AdaptiveLoopFilter::reconstructCoeffAPSs(CodingStructure& cs, bool luma, bo { int apsIdxChroma = cs.slice->getTileGroupApsIdChroma(); curAPS = aps[apsIdxChroma]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfParamChroma = &curAPS->getAlfAPSParam(); alfParamTmp = *m_alfParamChroma; -#else - alfParamTmp = curAPS->getAlfAPSParam(); -#endif reconstructCoeff(alfParamTmp, CHANNEL_TYPE_CHROMA, isRdo, true); } } @@ -602,12 +578,6 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfParam& alfParam, ChannelType chann int numClasses = isLuma( channel ) ? MAX_NUM_ALF_CLASSES : 1; int numCoeff = filterType == ALF_FILTER_5 ? 7 : 13; int numCoeffMinus1 = numCoeff - 1; -#if !JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - int numFilters = isLuma( channel ) ? alfParam.numLumaFilters : 1; - short* coeff = isLuma( channel ) ? alfParam.lumaCoeff : alfParam.chromaCoeff; - short* clipp = isLuma( channel ) ? alfParam.lumaClipp : alfParam.chromaClipp; -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const int numAlts = isLuma( channel ) ? 1 : alfParam.numAlternativesChroma; for( int altIdx = 0; altIdx < numAlts; ++ altIdx ) @@ -616,19 +586,6 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfParam& alfParam, ChannelType chann short* coeff = isLuma( channel ) ? alfParam.lumaCoeff : alfParam.chromaCoeff[altIdx]; short* clipp = isLuma( channel ) ? alfParam.lumaClipp : alfParam.chromaClipp[altIdx]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if( alfParam.alfLumaCoeffDeltaPredictionFlag && isLuma( channel ) ) - { - for( int i = 1; i < numFilters; i++ ) - { - for( int j = 0; j < numCoeffMinus1; j++ ) - { - coeff[i * MAX_NUM_ALF_LUMA_COEFF + j] += coeff[( i - 1 ) * MAX_NUM_ALF_LUMA_COEFF + j]; - } - } - } - -#endif for( int filterIdx = 0; filterIdx < numFilters; filterIdx++ ) { coeff[filterIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor; @@ -649,27 +606,9 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfParam& alfParam, ChannelType chann for( int classIdx = 0; classIdx < numClasses; classIdx++ ) { int filterIdx = alfParam.filterCoeffDeltaIdx[classIdx]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - int fixedFilterIdx = alfParam.fixedFilterSetIndex; - if (fixedFilterIdx > 0 && alfParam.fixedFilterIdx[classIdx] > 0) - { - fixedFilterIdx = m_classToFilterMapping[fixedFilterIdx - 1][classIdx]; - } - else - { - fixedFilterIdx = -1; - } -#endif for (int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx) { m_coeffFinal[classIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] = coeff[filterIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - //fixed filter - if (fixedFilterIdx >= 0) - { - m_coeffFinal[classIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] += m_fixedFilterSetCoeff[fixedFilterIdx][coeffIdx]; - } -#endif } m_coeffFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor; m_clippFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = isRdo ? 0 : m_alfClippingValues[channel][0]; @@ -683,113 +622,11 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfParam& alfParam, ChannelType chann m_alfClippingValues[channel][0]; } } -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - - if( isChroma( channel ) ) - return; - - if( isRedo && alfParam.alfLumaCoeffDeltaPredictionFlag ) - { - int numFilters = alfParam.numLumaFilters; - short* coeff = alfParam.lumaCoeff; - - for( int i = numFilters - 1; i > 0; i-- ) - { - for( int j = 0; j < numCoeffMinus1; j++ ) - { - coeff[i * MAX_NUM_ALF_LUMA_COEFF + j] = coeff[i * MAX_NUM_ALF_LUMA_COEFF + j] - coeff[( i - 1 ) * MAX_NUM_ALF_LUMA_COEFF + j]; - } - } - } -#endif -#else - -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if( alfParam.alfLumaCoeffDeltaPredictionFlag && isLuma( channel ) ) - { - for( int i = 1; i < numFilters; i++ ) - { - for( int j = 0; j < numCoeffMinus1; j++ ) - { - coeff[i * MAX_NUM_ALF_LUMA_COEFF + j] += coeff[( i - 1 ) * MAX_NUM_ALF_LUMA_COEFF + j]; - } - } - } -#endif - - for( int filterIdx = 0; filterIdx < numFilters; filterIdx++ ) - { - coeff[filterIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor; - } - - if( isChroma( channel ) ) - { - for( int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx ) - { - m_chromaCoeffFinal[coeffIdx] = alfParam.chromaCoeff[coeffIdx]; - int clipIdx = alfParam.nonLinearFlag[channel] ? clipp[coeffIdx] : 0; - m_chromaClippFinal[coeffIdx] = isRdo ? clipIdx : m_alfClippingValues[channel][clipIdx]; - } - m_chromaCoeffFinal[numCoeffMinus1] = factor; - m_chromaClippFinal[numCoeffMinus1] = isRdo ? 0 : m_alfClippingValues[channel][0]; - - return; - } - - for( int classIdx = 0; classIdx < numClasses; classIdx++ ) - { - int filterIdx = alfParam.filterCoeffDeltaIdx[classIdx]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - int fixedFilterIdx = alfParam.fixedFilterSetIndex; - if (fixedFilterIdx > 0 && alfParam.fixedFilterIdx[classIdx] > 0) - { - fixedFilterIdx = m_classToFilterMapping[fixedFilterIdx - 1][classIdx]; - } - else - { - fixedFilterIdx = -1; - } -#endif - for (int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx) - { - m_coeffFinal[classIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] = coeff[filterIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - //fixed filter - if (fixedFilterIdx >= 0) - { - m_coeffFinal[classIdx * MAX_NUM_ALF_LUMA_COEFF + coeffIdx] += m_fixedFilterSetCoeff[fixedFilterIdx][coeffIdx]; - } -#endif - } - m_coeffFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = factor; - m_clippFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + numCoeffMinus1] = isRdo ? 0 : m_alfClippingValues[channel][0]; - for( int coeffIdx = 0; coeffIdx < numCoeffMinus1; ++coeffIdx ) - { - int clipIdx = alfParam.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]; - } - } - -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if(isRedo && alfParam.alfLumaCoeffDeltaPredictionFlag ) - { - for( int i = numFilters - 1; i > 0; i-- ) - { - for( int j = 0; j < numCoeffMinus1; j++ ) - { - coeff[i * MAX_NUM_ALF_LUMA_COEFF + j] = coeff[i * MAX_NUM_ALF_LUMA_COEFF + j] - coeff[( i - 1 ) * MAX_NUM_ALF_LUMA_COEFF + j]; - } - } - } -#endif -#endif } void AdaptiveLoopFilter::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] ) { -#if JVET_O1164_PS destroy(); -#endif std::memcpy( m_inputBitDepth, inputBitDepth, sizeof( m_inputBitDepth ) ); m_picWidth = picWidth; m_picHeight = picHeight; @@ -889,10 +726,8 @@ void AdaptiveLoopFilter::destroy() m_tempBuf.destroy(); m_tempBuf2.destroy(); -#if JVET_O1164_PS m_filterShapes[CHANNEL_TYPE_LUMA].clear(); m_filterShapes[CHANNEL_TYPE_CHROMA].clear(); -#endif m_created = false; } @@ -925,57 +760,6 @@ void AdaptiveLoopFilter::deriveClassification( AlfClassifier** classifier, const } } } -#if !JVET_O0525_REMOVE_PCM -void AdaptiveLoopFilter::resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk) -{ - if ( !cs.sps->getPCMFilterDisableFlag() ) - { - return; - } - - int height = blk.pos().y + blk.height; - int width = blk.pos().x + blk.width; - const int clsSizeY = 4; - const int clsSizeX = 4; - int classIdx = m_ALF_UNUSED_CLASSIDX; - int transposeIdx = m_ALF_UNUSED_TRANSPOSIDX; - - for( int i = blk.pos().y; i < height; i += m_CLASSIFICATION_BLK_SIZE ) - { - int nHeight = std::min(i + m_CLASSIFICATION_BLK_SIZE, height) - i; - - for( int j = blk.pos().x; j < width; j += m_CLASSIFICATION_BLK_SIZE ) - { - int nWidth = std::min(j + m_CLASSIFICATION_BLK_SIZE, width) - j; - int posX = j; - int posY = i; - - for( int subi = 0; subi < nHeight; subi += clsSizeY ) - { - for( int subj = 0; subj < nWidth; subj += clsSizeX ) - { - int yOffset = subi + posY; - int xOffset = subj + posX; - Position pos(xOffset, yOffset); - - const CodingUnit* cu = cs.getCU(pos, CH_L); - if ( cu->ipcm ) - { - AlfClassifier *cl0 = classifier[yOffset] + xOffset; - AlfClassifier *cl1 = classifier[yOffset + 1] + xOffset; - AlfClassifier *cl2 = classifier[yOffset + 2] + xOffset; - AlfClassifier *cl3 = classifier[yOffset + 3] + xOffset; - cl0[0] = cl0[1] = cl0[2] = cl0[3] = - cl1[0] = cl1[1] = cl1[2] = cl1[3] = - cl2[0] = cl2[1] = cl2[2] = cl2[3] = - cl3[0] = cl3[1] = cl3[2] = cl3[3] = AlfClassifier(classIdx, transposeIdx); - } - } - } - } - } -} -#endif #if JVET_O0625_ALF_PADDING void AdaptiveLoopFilter::deriveClassificationBlk( AlfClassifier **classifier, int **laplacian[NUM_DIRECTIONS], @@ -1306,12 +1090,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf { CHECK( filtType != 0, "Chroma needs to have filtType == 0" ); } -#if !JVET_O0525_REMOVE_PCM - const SPS* sps = cs.slice->getSPS(); - bool isDualTree =CS::isDualITree(cs); - bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); - ChromaFormat nChromaFormat = sps->getChromaFormatIdc(); -#endif const CPelBuf srcLuma = recSrc.get( compId ); PelBuf dstLuma = recDst.get( compId ); @@ -1341,9 +1119,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf const int clsSizeY = 4; const int clsSizeX = 4; -#if !JVET_O0525_REMOVE_PCM - bool pcmFlags2x2[4] = {0,0,0,0}; -#endif CHECK( startHeight % clsSizeY, "Wrong startHeight in filtering" ); CHECK( startWidth % clsSizeX, "Wrong startWidth in filtering" ); @@ -1392,48 +1167,9 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf { AlfClassifier& cl = pClass[j]; transposeIdx = cl.transposeIdx; -#if !JVET_O0525_REMOVE_PCM - if( isPCMFilterDisabled && cl.classIdx== m_ALF_UNUSED_CLASSIDX && transposeIdx== m_ALF_UNUSED_TRANSPOSIDX ) - { - continue; - } -#endif coef = filterSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; clip = fClipSet + cl.classIdx * MAX_NUM_ALF_LUMA_COEFF; } -#if !JVET_O0525_REMOVE_PCM - else if( isPCMFilterDisabled ) - { - int blkX, blkY; - bool *flags = pcmFlags2x2; - - // 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 ) - { - Position pos(j + blkDst.x + blkX, i + blkDst.y + blkY); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB && !JVET_O0050_LOCAL_DUAL_TREE - const CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); -#else - CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); -#endif -#if JVET_O0050_LOCAL_DUAL_TREE - cu = cu->isSepTree() ? cs.getCU( pos, CH_C ) : cu; -#endif - *flags++ = cu->ipcm ? 1 : 0; - } - } - - // skip entire 4x4 if all chroma 2x2 blocks use PCM - if( pcmFlags2x2[0] && pcmFlags2x2[1] && pcmFlags2x2[2] && pcmFlags2x2[3] ) - { - continue; - } - } - -#endif if( filtType == ALF_FILTER_7 ) { @@ -1546,23 +1282,6 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf for( int jj = 0; jj < clsSizeX; jj++ ) { -#if !JVET_O0525_REMOVE_PCM - // skip 2x2 PCM chroma blocks - if( bChroma && isPCMFilterDisabled ) - { - if( pcmFlags2x2[2*(ii>>1) + (jj>>1)] ) - { - pImg0++; - pImg1++; - pImg2++; - pImg3++; - pImg4++; - pImg5++; - pImg6++; - continue; - } - } -#endif int sum = 0; const Pel curr = pImg0[+0]; diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.h b/source/Lib/CommonLib/AdaptiveLoopFilter.h index 50c45d839c56b1ebe9356dedaa18dba4bf706170..42ab5bf3d7f6c73e5adee6cf6dacd68edf53c026 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.h +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.h @@ -97,9 +97,6 @@ public: const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, const int shift, const int vbCTUHeight, int vbPos); void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk ); -#endif -#if !JVET_O0525_REMOVE_PCM - void resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk); #endif template<AlfFilterType filtType> #if JVET_O0625_ALF_PADDING @@ -113,12 +110,6 @@ public: const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight, int vbPos); #endif -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - inline static int getMaxGolombIdx( AlfFilterType filterType ) - { - return filterType == ALF_FILTER_5 ? 2 : 3; - } -#endif #if JVET_O0625_ALF_PADDING void getAlfBoundary( const CodingStructure& cs, int posX, int posY, int &topBry, int &botBry, int &leftBry, int &rightBry ); void (*m_deriveClassificationBlk)( AlfClassifier **classifier, int **laplacian[NUM_DIRECTIONS], const CPelBuf &srcLuma, @@ -162,38 +153,23 @@ protected: 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]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB || JVET_O_MAX_NUM_ALF_APS_8 short m_coeffApsLuma[ALF_CTB_MAX_NUM_APS][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES]; short m_clippApsLuma[ALF_CTB_MAX_NUM_APS][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES]; -#else - short m_coeffApsLuma[6][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES]; - short m_clippApsLuma[6][MAX_NUM_ALF_LUMA_COEFF * MAX_NUM_ALF_CLASSES]; -#endif short m_clipDefault[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; bool m_created = false; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB short m_chromaCoeffFinal[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF]; AlfParam* m_alfParamChroma; -#else - short m_chromaCoeffFinal[MAX_NUM_ALF_LUMA_COEFF]; -#endif Pel m_alfClippingValues[MAX_NUM_CHANNEL_TYPE][MaxAlfNumClippingValues]; std::vector<AlfFilterShape> m_filterShapes[MAX_NUM_CHANNEL_TYPE]; AlfClassifier** m_classifier; short m_coeffFinal[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; short m_clippFinal[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB short m_chromaClippFinal[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF]; -#else - short m_chromaClippFinal[MAX_NUM_ALF_LUMA_COEFF]; -#endif int** m_laplacian[NUM_DIRECTIONS]; int * m_laplacianPtr[NUM_DIRECTIONS][m_CLASSIFICATION_BLK_SIZE + 5]; int m_laplacianData[NUM_DIRECTIONS][m_CLASSIFICATION_BLK_SIZE + 5][m_CLASSIFICATION_BLK_SIZE + 5]; uint8_t* m_ctuEnableFlag[MAX_NUM_COMPONENT]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB uint8_t* m_ctuAlternative[MAX_NUM_COMPONENT]; -#endif PelStorage m_tempBuf; PelStorage m_tempBuf2; int m_inputBitDepth[MAX_NUM_CHANNEL_TYPE]; diff --git a/source/Lib/CommonLib/AlfParameters.h b/source/Lib/CommonLib/AlfParameters.h index e6e80fd04a75bf2f963a1c0b046a9bdb5b0761b7..67b532a9ff508c600fdbfd87697cd4015e45ff53 100644 --- a/source/Lib/CommonLib/AlfParameters.h +++ b/source/Lib/CommonLib/AlfParameters.h @@ -73,13 +73,6 @@ struct AlfFilterShape 2, 2, 2, 2, 2, 1, 1 }; -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - golombIdx = { - 0, - 0, 1, 0, - 0, 1, 2, 2 - }; -#endif filterType = ALF_FILTER_5; } @@ -101,14 +94,6 @@ struct AlfFilterShape 2, 2, 2, 2, 2, 2, 2, 2, 1, 1 }; -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - golombIdx = { - 0, - 0, 1, 0, - 0, 1, 2, 1, 0, - 0, 1, 2, 3, 3 - }; -#endif filterType = ALF_FILTER_7; } @@ -125,46 +110,23 @@ struct AlfFilterShape int filterSize; std::vector<int> pattern; std::vector<int> weights; -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - std::vector<int> golombIdx; -#endif }; struct AlfParam { bool enabledFlag[MAX_NUM_COMPONENT]; // alf_slice_enable_flag, alf_chroma_idc -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB bool nonLinearFlag[MAX_NUM_CHANNEL_TYPE][MAX_NUM_ALF_ALTERNATIVES_CHROMA]; // alf_[luma/chroma]_clip_flag -#else - 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] short lumaClipp[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; // alf_clipp_luma_[i][j] -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB int numAlternativesChroma; // alf_chroma_num_alts_minus_one + 1 short chromaCoeff[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF]; // alf_coeff_chroma[i] short chromaClipp[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF]; // alf_clipp_chroma[i] -#else - short chromaCoeff[MAX_NUM_ALF_CHROMA_COEFF]; // alf_coeff_chroma[i] - 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 -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - bool alfLumaCoeffDeltaPredictionFlag; // alf_luma_coeff_delta_prediction_flag -#endif std::vector<AlfFilterShape>* filterShapes; -#if !JVET_O0245_VPS_DPS_APS - int tLayer; -#endif bool newFilterFlag[MAX_NUM_CHANNEL_TYPE]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - int fixedFilterPattern; - int fixedFilterIdx[MAX_NUM_ALF_CLASSES]; - int fixedFilterSetIndex; -#endif AlfParam() { @@ -177,27 +139,14 @@ struct AlfParam std::memset( nonLinearFlag, false, sizeof( nonLinearFlag ) ); std::memset( lumaCoeff, 0, sizeof( lumaCoeff ) ); std::memset( lumaClipp, 0, sizeof( lumaClipp ) ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB numAlternativesChroma = 1; -#endif std::memset( chromaCoeff, 0, sizeof( chromaCoeff ) ); std::memset( chromaClipp, 0, sizeof( chromaClipp ) ); std::memset( filterCoeffDeltaIdx, 0, sizeof( filterCoeffDeltaIdx ) ); std::memset( alfLumaCoeffFlag, true, sizeof( alfLumaCoeffFlag ) ); numLumaFilters = 1; alfLumaCoeffDeltaFlag = false; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - alfLumaCoeffDeltaPredictionFlag = false; -#endif -#if !JVET_O0245_VPS_DPS_APS - tLayer = 0; -#endif memset(newFilterFlag, 0, sizeof(newFilterFlag)); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - fixedFilterPattern = 0; - std::memset(fixedFilterIdx, 0, sizeof(fixedFilterIdx)); - fixedFilterSetIndex = 0; -#endif } const AlfParam& operator = ( const AlfParam& src ) @@ -206,32 +155,18 @@ struct AlfParam std::memcpy( nonLinearFlag, src.nonLinearFlag, sizeof( nonLinearFlag ) ); std::memcpy( lumaCoeff, src.lumaCoeff, sizeof( lumaCoeff ) ); std::memcpy( lumaClipp, src.lumaClipp, sizeof( lumaClipp ) ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB numAlternativesChroma = src.numAlternativesChroma; -#endif std::memcpy( chromaCoeff, src.chromaCoeff, sizeof( chromaCoeff ) ); std::memcpy( chromaClipp, src.chromaClipp, sizeof( chromaClipp ) ); std::memcpy( filterCoeffDeltaIdx, src.filterCoeffDeltaIdx, sizeof( filterCoeffDeltaIdx ) ); std::memcpy( alfLumaCoeffFlag, src.alfLumaCoeffFlag, sizeof( alfLumaCoeffFlag ) ); numLumaFilters = src.numLumaFilters; alfLumaCoeffDeltaFlag = src.alfLumaCoeffDeltaFlag; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - alfLumaCoeffDeltaPredictionFlag = src.alfLumaCoeffDeltaPredictionFlag; -#endif filterShapes = src.filterShapes; -#if !JVET_O0245_VPS_DPS_APS - tLayer = src.tLayer; -#endif std::memcpy(newFilterFlag, src.newFilterFlag, sizeof(newFilterFlag)); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - fixedFilterPattern = src.fixedFilterPattern; - std::memcpy(fixedFilterIdx, src.fixedFilterIdx, sizeof(fixedFilterIdx)); - fixedFilterSetIndex = src.fixedFilterSetIndex; -#endif return *this; } -#if JVET_O0245_VPS_DPS_APS bool operator==( const AlfParam& other ) { if( memcmp( enabledFlag, other.enabledFlag, sizeof( enabledFlag ) ) ) @@ -290,7 +225,6 @@ struct AlfParam { return !( *this == other ); } -#endif }; //! \} diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 49f17e6a4f8cd4fc73dd232e378cf8fd9f059f18..759cd09f836c35805eb45d59ef2342f13f19e770 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -42,7 +42,6 @@ #include "Buffer.h" #include "InterpolationFilter.h" -#if JVET_O0070_PROF void applyPROFCore(Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, int shiftNum, Pel offset, const ClpRng& clpRng) { int idx = 0; @@ -117,7 +116,6 @@ void applyBiPROFCore (Pel* dst, int dstStride, const Pel* src0, const Pel* src1, src1 += srcStride; } } -#endif template< typename T > void addAvgCore( const T* src1, int src1Stride, const T* src2, int src2Stride, T* dest, int dstStride, int width, int height, int rshift, int offset, const ClpRng& clpRng ) @@ -163,9 +161,7 @@ void addBIOAvgCore(const Pel* src0, int src0Stride, const Pel* src1, int src1Str } } -#if JVET_O0070_PROF template<bool PAD = true> -#endif void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth) { Pel* srcTmp = pSrc + srcStride + 1; @@ -177,23 +173,16 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr { for (int x = 0; x < (width - 2 * BIO_EXTEND_SIZE); x++) { -#if JVET_O0570_GRAD_SIMP gradYTmp[x] = ( srcTmp[x + srcStride] >> shift1 ) - ( srcTmp[x - srcStride] >> shift1 ); gradXTmp[x] = ( srcTmp[x + 1] >> shift1 ) - ( srcTmp[x - 1] >> shift1 ); -#else - gradYTmp[x] = (srcTmp[x + srcStride] - srcTmp[x - srcStride]) >> shift1; - gradXTmp[x] = (srcTmp[x + 1] - srcTmp[x - 1]) >> shift1; -#endif } gradXTmp += gradStride; gradYTmp += gradStride; srcTmp += srcStride; } -#if JVET_O0070_PROF if (PAD) { -#endif gradXTmp = gradX + gradStride + 1; gradYTmp = gradY + gradStride + 1; for (int y = 0; y < (height - 2 * BIO_EXTEND_SIZE); y++) @@ -213,12 +202,9 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr ::memcpy(gradXTmp + (height - 2 * BIO_EXTEND_SIZE)*gradStride, gradXTmp + (height - 2 * BIO_EXTEND_SIZE - 1)*gradStride, sizeof(Pel)*(width)); ::memcpy(gradYTmp - gradStride, gradYTmp, sizeof(Pel)*(width)); ::memcpy(gradYTmp + (height - 2 * BIO_EXTEND_SIZE)*gradStride, gradYTmp + (height - 2 * BIO_EXTEND_SIZE - 1)*gradStride, sizeof(Pel)*(width)); -#if JVET_O0070_PROF } -#endif } -#if JVET_O0304_SIMPLIFIED_BDOF void calcBIOSumsCore(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel* gradX1, Pel* gradY0, Pel* gradY1, int xu, int yu, const int src0Stride, const int src1Stride, const int widthG, const int bitDepth, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGY_GX) { int shift4 = std::max<int>(4, (bitDepth - 8)); @@ -246,7 +232,6 @@ void calcBIOSumsCore(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel* gradY1 += widthG; } } -#endif 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) { @@ -390,12 +375,7 @@ PelBufferOps::PelBufferOps() addBIOAvg4 = addBIOAvgCore; bioGradFilter = gradFilterCore; -#if !JVET_O0304_SIMPLIFIED_BDOF - calcBIOPar = calcBIOParCore; - calcBlkGradient = calcBlkGradientCore; -#else calcBIOSums = calcBIOSumsCore; -#endif copyBuffer = copyBufferCore; padding = paddingCore; @@ -406,13 +386,11 @@ PelBufferOps::PelBufferOps() removeHighFreq4 = removeHighFreq; #endif -#if JVET_O0070_PROF profGradFilter = gradFilterCore <false>; applyPROF = applyPROFCore; applyBiPROF[1] = applyBiPROFCore; applyBiPROF[0] = applyBiPROFCore <false>; roundIntVector = nullptr; -#endif } PelBufferOps g_pelBufOP = PelBufferOps(); diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index e76cdd7a55ad73002fdf1f9e197290312a13548e..e714d2869888ebeb6cf2a80c2cb0288acdac23a8 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -70,9 +70,7 @@ struct PelBufferOps void(*addBIOAvg4) (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng); void(*bioGradFilter) (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth); void(*calcBIOPar) (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, const int bitDepth); -#if JVET_O0304_SIMPLIFIED_BDOF void(*calcBIOSums) (const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel* gradX1, Pel* gradY0, Pel* gradY1, int xu, int yu, const int src0Stride, const int src1Stride, const int widthG, const int bitDepth, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGY_GX); -#endif void(*calcBlkGradient)(int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void(*copyBuffer)(Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height); void(*padding)(Pel *dst, int stride, int width, int height, int padSize); @@ -82,12 +80,10 @@ struct PelBufferOps void ( *removeHighFreq8) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height); void ( *removeHighFreq4) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height); #endif -#if JVET_O0070_PROF void (*profGradFilter) (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth); void (*applyPROF) (Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, int shiftNum, Pel offset, const ClpRng& clpRng); void (*applyBiPROF[2]) (Pel* dst, int dstStride, const Pel* src0, const Pel* src1, int srcStride, int width, int height, const Pel* gradX0, const Pel* gradY0, const Pel* gradX1, const Pel* gradY1, int gradStride, const int* dMvX0, const int* dMvY0, const int* dMvX1, const int* dMvY1, int dMvStride, const int8_t gbiWeightL0, const ClpRng& clpRng); void (*roundIntVector) (int* v, int size, unsigned int nShift, const int dmvLimit); -#endif }; extern PelBufferOps g_pelBufOP; @@ -120,10 +116,6 @@ struct AreaBuf : public Size void copyClip ( const AreaBuf<const T> &src, const ClpRng& clpRng); void subtract ( const AreaBuf<const T> &other ); -#if !JVET_O0105_ICT - void copyAndNegate ( const AreaBuf<const T> &other ); - void subtractAndHalve ( const AreaBuf<const T> &other ); -#endif void extendSingleBorderPel(); void extendBorderPel ( unsigned margin ); void addWeightedAvg ( const AreaBuf<const T> &other1, const AreaBuf<const T> &other2, const ClpRng& clpRng, const int8_t gbiIdx); @@ -173,13 +165,11 @@ typedef AreaBuf<const TCoeff> CCoeffBuf; typedef AreaBuf< MotionInfo> MotionBuf; typedef AreaBuf<const MotionInfo> CMotionBuf; -#if JVET_O0119_BASE_PALETTE_444 typedef AreaBuf< TCoeff> PLTescapeBuf; typedef AreaBuf<const TCoeff> CPLTescapeBuf; typedef AreaBuf< bool> PLTtypeBuf; typedef AreaBuf<const bool> CPLTtypeBuf; -#endif #define SIZE_AWARE_PER_EL_OP( OP, INC ) \ if( ( width & 7 ) == 0 ) \ @@ -375,49 +365,6 @@ void AreaBuf<T>::subtract( const AreaBuf<const T> &other ) #undef SUBS_INC } -#if !JVET_O0105_ICT -template<typename T> -void AreaBuf<T>::copyAndNegate( const AreaBuf<const T> &other ) -{ - CHECK( width != other.width, "Incompatible size" ); - CHECK( height != other.height, "Incompatible size" ); - - T* dest = buf; - const T* subs = other.buf; - -#define SUBS_INC \ - dest += stride; \ - subs += other.stride; \ - -#define SUBS_OP( ADDR ) dest[ADDR] = -subs[ADDR] - - SIZE_AWARE_PER_EL_OP( SUBS_OP, SUBS_INC ); - -#undef SUBS_OP -#undef SUBS_INC -} - -template<typename T> -void AreaBuf<T>::subtractAndHalve( const AreaBuf<const T> &other ) -{ - CHECK( width != other.width, "Incompatible size" ); - CHECK( height != other.height, "Incompatible size" ); - - T* dest = buf; - const T* subs = other.buf; - -#define SUBS_INC \ - dest += stride; \ - subs += other.stride; \ - -#define SUBS_OP( ADDR ) dest[ADDR] = ( dest[ADDR] - subs[ADDR] ) / 2 - - SIZE_AWARE_PER_EL_OP( SUBS_OP, SUBS_INC ); - -#undef SUBS_OP -#undef SUBS_INC -} -#endif template<typename T> void AreaBuf<T>::copyClip( const AreaBuf<const T> &src, const ClpRng& clpRng ) @@ -944,7 +891,6 @@ private: Pel *m_origin[MAX_NUM_COMPONENT]; }; -#if JVET_O0105_ICT struct CompStorage : public PelBuf { CompStorage () { m_memory = nullptr; } @@ -965,6 +911,5 @@ struct CompStorage : public PelBuf private: Pel* m_memory; }; -#endif #endif diff --git a/source/Lib/CommonLib/ChromaFormat.h b/source/Lib/CommonLib/ChromaFormat.h index d6930043d5874c106e77635830897ce52d41bb5c..82b817d39e45c7550111b204eea88af2763dbf69 100644 --- a/source/Lib/CommonLib/ChromaFormat.h +++ b/source/Lib/CommonLib/ChromaFormat.h @@ -115,12 +115,6 @@ static inline int getTransformShift(const int channelBitDepth, const Size size, //------------------------------------------------ -#if !JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE -static inline int getScaledChromaQP(int unscaledChromaQP, const ChromaFormat chFmt) -{ - return g_aucChromaScale[chFmt][Clip3(0, (chromaQPMappingTableSize - 1), unscaledChromaQP)]; -} -#endif //====================================================================================================================== //Scaling lists ======================================================================================================= @@ -128,11 +122,7 @@ static inline int getScaledChromaQP(int unscaledChromaQP, const ChromaFormat chF static inline int getScalingListType(const PredMode predMode, const ComponentID compID) { -#if JVET_O0267_IBC_SCALING_LIST return ((predMode == MODE_INTRA) ? 0 : MAX_NUM_COMPONENT) + MAP_CHROMA(compID); -#else - 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 d9dae2f63e5d19565ce2a28c26c365cc1133d77f..0b73663aa1bb0b9ff98f48d63fc800387fac0509 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -58,9 +58,7 @@ enum CodingStatisticsType STATS__CABAC_BITS__MERGE_INDEX, STATS__CABAC_BITS__MVP_IDX, STATS__CABAC_BITS__SPLIT_FLAG, -#if JVET_O0050_LOCAL_DUAL_TREE STATS__CABAC_BITS__MODE_CONSTRAINT_FLAG, -#endif STATS__CABAC_BITS__PART_SIZE, STATS__CABAC_BITS__PRED_MODE, STATS__CABAC_BITS__INTRA_DIR_ANG, @@ -102,10 +100,6 @@ enum CodingStatisticsType STATS__CABAC_BITS__ALF, STATS__CABAC_TRM_BITS, STATS__CABAC_FIXED_BITS, -#if !JVET_O0525_REMOVE_PCM - STATS__CABAC_PCM_ALIGN_BITS, - STATS__CABAC_PCM_CODE_BITS, -#endif STATS__BYTE_ALIGNMENT_BITS, STATS__TRAILING_BITS, STATS__EXPLICIT_RDPCM_BITS, @@ -156,9 +150,7 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__MERGE_INDEX", "CABAC_BITS__MVP_IDX", "CABAC_BITS__SPLIT_FLAG", -#if JVET_O0050_LOCAL_DUAL_TREE "CABAC_BITS__MODE_CONSTRAINT_FLAG", -#endif "CABAC_BITS__PART_SIZE", "CABAC_BITS__PRED_MODE", "CABAC_BITS__INTRA_DIR_ANG", @@ -200,10 +192,6 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_BITS__ALF", "CABAC_TRM_BITS", "CABAC_FIXED_BITS", -#if !JVET_O0525_REMOVE_PCM - "CABAC_PCM_ALIGN_BITS", - "CABAC_PCM_CODE_BITS", -#endif "BYTE_ALIGNMENT_BITS", "TRAILING_BITS", "EXPLICIT_RDPCM_BITS", diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 2df5fd5627f5da1b1e4d9891815ce039e1f06ecb..4d33034d59a138cb37ab21246622f3acbf6b44bd 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -67,21 +67,15 @@ CodingStructure::CodingStructure(CUCache& cuCache, PUCache& puCache, TUCache& tu , m_cuCache ( cuCache ) , m_puCache ( puCache ) , m_tuCache ( tuCache ) -#if JVET_O0070_PROF , bestParent ( nullptr ) -#endif -#if JVET_O1170_CHECK_BV_AT_DECODER , resetIBCBuffer (false) -#endif { for( uint32_t i = 0; i < MAX_NUM_COMPONENT; i++ ) { m_coeffs[ i ] = nullptr; m_pcmbuf[ i ] = nullptr; -#if JVET_O0119_BASE_PALETTE_444 m_runType[i] = nullptr; m_runLength[i] = nullptr; -#endif m_offsets[ i ] = 0; } @@ -96,10 +90,8 @@ CodingStructure::CodingStructure(CUCache& cuCache, PUCache& puCache, TUCache& tu m_motionBuf = nullptr; features.resize( NUM_ENC_FEATURES ); -#if JVET_O0050_LOCAL_DUAL_TREE treeType = TREE_D; modeType = MODE_TYPE_ALL; -#endif } void CodingStructure::destroy() @@ -196,7 +188,6 @@ void CodingStructure::setDecomp(const UnitArea &_area, const bool _isCoded /*= t } } -#if JVET_O0050_LOCAL_DUAL_TREE const int CodingStructure::signalModeCons( const PartSplit split, Partitioner &partitioner, const ModeType modeTypeParent ) const { if( CS::isDualITree( *this ) || modeTypeParent != MODE_TYPE_ALL || partitioner.currArea().chromaFormat == CHROMA_444 ) @@ -272,9 +263,7 @@ void CodingStructure::clearCuPuTuIdxMap( const UnitArea &_area, uint32_t numCu, m_offsets[i] = pOffset[i]; } } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE CodingUnit* CodingStructure::getLumaCU( const Position &pos ) { const ChannelType effChType = CHANNEL_TYPE_LUMA; @@ -286,26 +275,19 @@ CodingUnit* CodingStructure::getLumaCU( const Position &pos ) if( idx != 0 ) return cus[idx - 1]; else return nullptr; } -#endif CodingUnit* CodingStructure::getCU( const Position &pos, const ChannelType effChType ) { const CompArea &_blk = area.blocks[effChType]; -#if JVET_O0050_LOCAL_DUAL_TREE if( !_blk.contains( pos ) || (treeType == TREE_C && effChType == CHANNEL_TYPE_LUMA) ) -#else - if( !_blk.contains( pos ) ) -#endif { -#if JVET_O0050_LOCAL_DUAL_TREE //keep this check, which is helpful to identify bugs if( treeType == TREE_C && effChType == CHANNEL_TYPE_LUMA ) { CHECK( parent == nullptr, "parent shall be valid; consider using function getLumaCU()" ); CHECK( parent->treeType != TREE_D, "wrong parent treeType " ); } -#endif if( parent ) return parent->getCU( pos, effChType ); else return nullptr; } @@ -322,19 +304,13 @@ const CodingUnit* CodingStructure::getCU( const Position &pos, const ChannelType { const CompArea &_blk = area.blocks[effChType]; -#if JVET_O0050_LOCAL_DUAL_TREE if( !_blk.contains( pos ) || (treeType == TREE_C && effChType == CHANNEL_TYPE_LUMA) ) -#else - if( !_blk.contains( pos ) ) -#endif { -#if JVET_O0050_LOCAL_DUAL_TREE if( treeType == TREE_C && effChType == CHANNEL_TYPE_LUMA ) { CHECK( parent == nullptr, "parent shall be valid; consider using function getLumaCU()" ); CHECK( parent->treeType != TREE_D, "wrong parent treeType" ); } -#endif if( parent ) return parent->getCU( pos, effChType ); else return nullptr; } @@ -415,10 +391,8 @@ TransformUnit* CodingStructure::getTU( const Position &pos, const ChannelType ef while( !tus[idx - 1 + extraIdx]->blocks[getFirstComponentOfChannel( effChType )].contains( pos ) ) { extraIdx++; -#if JVET_O0050_LOCAL_DUAL_TREE CHECK( tus[idx - 1 + extraIdx]->cu->treeType == TREE_C, "tu searched by position points to a chroma tree CU" ); CHECK( extraIdx > 3, "extraIdx > 3" ); -#endif } } } @@ -460,10 +434,8 @@ const TransformUnit * CodingStructure::getTU( const Position &pos, const Channel while ( !tus[idx - 1 + extraIdx]->blocks[getFirstComponentOfChannel( effChType )].contains(pos) ) { extraIdx++; -#if JVET_O0050_LOCAL_DUAL_TREE CHECK( tus[idx - 1 + extraIdx]->cu->treeType == TREE_C, "tu searched by position points to a chroma tree CU" ); CHECK( extraIdx > 3, "extraIdx > 3" ); -#endif } } } @@ -489,10 +461,8 @@ CodingUnit& CodingStructure::addCU( const UnitArea &unit, const ChannelType chTy cu->firstTU = nullptr; cu->lastTU = nullptr; cu->chType = chType; -#if JVET_O0050_LOCAL_DUAL_TREE cu->treeType = treeType; cu->modeType = modeType; -#endif CodingUnit *prevCU = m_numCUs > 0 ? cus.back() : nullptr; @@ -639,10 +609,8 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c TCoeff *coeffs[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; Pel *pcmbuf[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; -#if JVET_O0119_BASE_PALETTE_444 bool *runType[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; Pel *runLength[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; -#endif uint32_t numCh = ::getNumberValidComponents( area.chromaFormat ); @@ -679,20 +647,14 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c coeffs[i] = m_coeffs[i] + m_offsets[i]; pcmbuf[i] = m_pcmbuf[i] + m_offsets[i]; -#if JVET_O0119_BASE_PALETTE_444 runType[i] = m_runType[i] + m_offsets[i]; runLength[i] = m_runLength[i] + m_offsets[i]; -#endif unsigned areaSize = tu->blocks[i].area(); m_offsets[i] += areaSize; } -#if JVET_O0119_BASE_PALETTE_444 tu->init( coeffs, pcmbuf, runLength, runType); -#else - tu->init( coeffs, pcmbuf ); -#endif return *tu; } @@ -701,7 +663,6 @@ CUTraverser CodingStructure::traverseCUs( const UnitArea& unit, const ChannelTyp { CodingUnit* firstCU = getCU( isLuma( effChType ) ? unit.lumaPos() : unit.chromaPos(), effChType ); CodingUnit* lastCU = firstCU; -#if JVET_O0050_LOCAL_DUAL_TREE if( !CS::isDualITree( *this ) ) //for a more generalized separate tree { bool bContinue = true; @@ -735,11 +696,8 @@ CUTraverser CodingStructure::traverseCUs( const UnitArea& unit, const ChannelTyp } else { -#endif do { } while( lastCU && ( lastCU = lastCU->next ) && unit.contains( *lastCU ) ); -#if JVET_O0050_LOCAL_DUAL_TREE } -#endif return CUTraverser( firstCU, lastCU ); } @@ -892,7 +850,6 @@ void CodingStructure::addMiToLut(static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> & lut.push_back(mi); } -#if JVET_O0119_BASE_PALETTE_444 void CodingStructure::resetPrevPLT(PLTBuf& prevPLT) { for (int comp = 0; comp < MAX_NUM_COMPONENT; comp++) @@ -948,7 +905,6 @@ void CodingStructure::reorderPrevPLT(PLTBuf& prevPLT, uint32_t curPLTSize[MAX_NU memcpy(prevPLT.curPLT[i], stuffedPLT[i], prevPLT.curPLTSize[comID] * sizeof(Pel)); } } -#endif void CodingStructure::rebindPicBufs() { @@ -977,10 +933,8 @@ void CodingStructure::createCoeffs() m_coeffs[i] = _area > 0 ? ( TCoeff* ) xMalloc( TCoeff, _area ) : nullptr; m_pcmbuf[i] = _area > 0 ? ( Pel* ) xMalloc( Pel, _area ) : nullptr; -#if JVET_O0119_BASE_PALETTE_444 m_runType[i] = _area > 0 ? ( bool* ) xMalloc( bool, _area ) : nullptr; m_runLength[i] = _area > 0 ? ( Pel* ) xMalloc( Pel, _area ) : nullptr; -#endif } } @@ -990,10 +944,8 @@ void CodingStructure::destroyCoeffs() { if( m_coeffs[i] ) { xFree( m_coeffs[i] ); m_coeffs[i] = nullptr; } if( m_pcmbuf[i] ) { xFree( m_pcmbuf[i] ); m_pcmbuf[i] = nullptr; } -#if JVET_O0119_BASE_PALETTE_444 if (m_runType[i]) { xFree(m_runType[i]); m_runType[i] = nullptr; } if (m_runLength[i]) { xFree(m_runLength[i]); m_runLength[i] = nullptr; } -#endif } } @@ -1026,9 +978,7 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe memcpy(subStruct.alfApss, alfApss, sizeof(alfApss)); subStruct.lmcsAps = lmcsAps; -#if JVET_O0299_APS_SCALINGLIST subStruct.scalinglistAps = scalinglistAps; -#endif subStruct.slice = slice; subStruct.baseQP = baseQP; @@ -1040,14 +990,10 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe subStruct.motionLut = motionLut; -#if JVET_O0119_BASE_PALETTE_444 subStruct.prevPLT = prevPLT; -#endif -#if JVET_O0050_LOCAL_DUAL_TREE subStruct.treeType = treeType; subStruct.modeType = modeType; -#endif subStruct.initStructData( currQP[_chType], isLossless ); @@ -1110,9 +1056,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C motionLut = subStruct.motionLut; } -#if JVET_O0119_BASE_PALETTE_444 prevPLT = subStruct.prevPLT; -#endif #if ENABLE_WPP_PARALLELISM @@ -1141,11 +1085,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C { // add an analogue CU into own CU store const UnitArea &cuPatch = *pcu; -#if JVET_O0050_LOCAL_DUAL_TREE CodingUnit &cu = addCU( cuPatch, pcu->chType ); -#else - CodingUnit &cu = addCU( cuPatch, chType ); -#endif // copy the CU info from subPatch cu = *pcu; @@ -1163,11 +1103,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C { // add an analogue PU into own PU store const UnitArea &puPatch = *ppu; -#if JVET_O0050_LOCAL_DUAL_TREE PredictionUnit &pu = addPU( puPatch, ppu->chType ); -#else - PredictionUnit &pu = addPU( puPatch, chType ); -#endif // copy the PU info from subPatch pu = *ppu; @@ -1178,11 +1114,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C { // add an analogue TU into own TU store const UnitArea &tuPatch = *ptu; -#if JVET_O0050_LOCAL_DUAL_TREE TransformUnit &tu = addTU( tuPatch, ptu->chType ); -#else - TransformUnit &tu = addTU( tuPatch, chType ); -#endif // copy the TU info from subPatch tu = *ptu; @@ -1214,11 +1146,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C { // add an analogue CU into own CU store const UnitArea &cuPatch = *pcu; -#if JVET_O0050_LOCAL_DUAL_TREE CodingUnit &cu = addCU( cuPatch, pcu->chType ); -#else - CodingUnit &cu = addCU( cuPatch, chType ); -#endif // copy the CU info from subPatch cu = *pcu; @@ -1236,11 +1164,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C { // add an analogue PU into own PU store const UnitArea &puPatch = *ppu; -#if JVET_O0050_LOCAL_DUAL_TREE PredictionUnit &pu = addPU( puPatch, ppu->chType ); -#else - PredictionUnit &pu = addPU( puPatch, chType ); -#endif // copy the PU info from subPatch pu = *ppu; @@ -1251,11 +1175,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C { // add an analogue TU into own TU store const UnitArea &tuPatch = *ptu; -#if JVET_O0050_LOCAL_DUAL_TREE TransformUnit &tu = addTU( tuPatch, ptu->chType ); -#else - TransformUnit &tu = addTU( tuPatch, chType ); -#endif // copy the TU info from subPatch tu = *ptu; @@ -1314,9 +1234,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel motionLut = other.motionLut; } -#if JVET_O0119_BASE_PALETTE_444 prevPLT = other.prevPLT; -#endif if( copyTUs ) { @@ -1697,40 +1615,3 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons } } -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE -IbcLumaCoverage CodingStructure::getIbcLumaCoverage(const CompArea& chromaArea) const -{ - const unsigned int unitAreaSubBlock = MIN_PU_SIZE * MIN_PU_SIZE; - CompArea lumaArea = CompArea(COMPONENT_Y, chromaArea.chromaFormat, chromaArea.lumaPos(), recalcSize(chromaArea.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, chromaArea.size())); - lumaArea = clipArea(lumaArea, picture->block(COMPONENT_Y)); - const unsigned int fullArea = lumaArea.area(); - unsigned int ibcArea = 0; - for (SizeType y = 0; y < lumaArea.height; y += MIN_PU_SIZE) - { - for (SizeType x = 0; x < lumaArea.width; x += MIN_PU_SIZE) - { - Position pos = lumaArea.offset(x, y); -#if JVET_O0050_LOCAL_DUAL_TREE - if (picture->cs->getMotionInfo(pos).isInter && picture->cs->getMotionInfo(pos).isIBCmot) -#else - if (picture->cs->getMotionInfo(pos).isInter) // need to change if inter slice allows dualtree -#endif - { - ibcArea += unitAreaSubBlock; - } - } - } - - IbcLumaCoverage coverage = IBC_LUMA_COVERAGE_FULL; - if (ibcArea == 0) - { - coverage = IBC_LUMA_COVERAGE_NONE; - } - else if (ibcArea < fullArea) - { - coverage = IBC_LUMA_COVERAGE_PARTIAL; - } - - return coverage; -} -#endif diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index d3c5c248f2dec86ff408a37a40628f2ba71131dd..ae9642fd1b425f8a2f39f706257aba4eb5b52af2 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -58,21 +58,10 @@ enum PictureType PIC_RESIDUAL, PIC_ORG_RESI, PIC_RECON_WRAP, -#if RPR_CTC_PRINT PIC_ORIGINAL_INPUT, PIC_TRUE_ORIGINAL_INPUT, -#endif NUM_PIC_TYPES }; -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE -enum IbcLumaCoverage -{ - IBC_LUMA_COVERAGE_FULL = 0, - IBC_LUMA_COVERAGE_PARTIAL, - IBC_LUMA_COVERAGE_NONE, - NUM_IBC_LUMA_COVERAGE, -}; -#endif extern XUCache g_globalUnitCache; // --------------------------------------------------------------------------- @@ -101,15 +90,9 @@ public: bool isLossless; const SPS *sps; const PPS *pps; -#if JVET_O_MAX_NUM_ALF_APS_8 APS* alfApss[ALF_CTB_MAX_NUM_APS]; -#else - APS* alfApss[MAX_NUM_APS]; -#endif APS * lmcsAps; -#if JVET_O0299_APS_SCALINGLIST APS * scalinglistAps; -#endif const VPS *vps; const PreCalcValues* pcv; @@ -139,9 +122,7 @@ public: const TransformUnit *getTU(const Position &pos, const ChannelType _chType, const int subTuIdx = -1) const; CodingUnit *getCU(const Position &pos, const ChannelType _chType); -#if JVET_O0050_LOCAL_DUAL_TREE CodingUnit *getLumaCU( const Position &pos ); -#endif PredictionUnit *getPU(const Position &pos, const ChannelType _chType); TransformUnit *getTU(const Position &pos, const ChannelType _chType, const int subTuIdx = -1); @@ -169,9 +150,6 @@ public: cCUTraverser traverseCUs(const UnitArea& _unit, const ChannelType _chType) const; cPUTraverser traversePUs(const UnitArea& _unit, const ChannelType _chType) const; cTUTraverser traverseTUs(const UnitArea& _unit, const ChannelType _chType) const; -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE - IbcLumaCoverage getIbcLumaCoverage(const CompArea& chromaArea) const; -#endif // --------------------------------------------------------------------------- // encoding search utilities // --------------------------------------------------------------------------- @@ -185,10 +163,8 @@ public: uint64_t fracBits; Distortion dist; Distortion interHad; -#if JVET_O0050_LOCAL_DUAL_TREE TreeType treeType; //because partitioner can not go deep to tu and cu coding (e.g., addCU()), need another variable for indicating treeType ModeType modeType; -#endif void initStructData (const int &QP = MAX_INT, const bool &_isLosses = false, const bool &skipMotBuf = false); void initSubStructure( CodingStructure& cs, const ChannelType chType, const UnitArea &subArea, const bool &isTuEnc); @@ -200,7 +176,6 @@ public: void clearTUs(); void clearPUs(); void clearCUs(); -#if JVET_O0050_LOCAL_DUAL_TREE const int signalModeCons( const PartSplit split, Partitioner &partitioner, const ModeType modeTypeParent ) const; void clearCuPuTuIdxMap ( const UnitArea &_area, uint32_t numCu, uint32_t numPu, uint32_t numTu, uint32_t* pOffset ); void getNumCuPuTuOffset ( uint32_t* pArray ) @@ -208,7 +183,6 @@ public: pArray[0] = m_numCUs; pArray[1] = m_numPUs; pArray[2] = m_numTUs; pArray[3] = m_offsets[0]; pArray[4] = m_offsets[1]; pArray[5] = m_offsets[2]; } -#endif private: @@ -224,11 +198,9 @@ public: void addMiToLut(static_vector<MotionInfo, MAX_NUM_HMVP_CANDS>& lut, const MotionInfo &mi); -#if JVET_O0119_BASE_PALETTE_444 PLTBuf prevPLT; void resetPrevPLT(PLTBuf& prevPLT); void reorderPrevPLT(PLTBuf& prevPLT, uint32_t curPLTSize[MAX_NUM_COMPONENT], Pel curPLT[MAX_NUM_COMPONENT][MAXPLTSIZE], bool reuseflag[MAX_NUM_COMPONENT][MAXPLTPREDSIZE], uint32_t compBegin, uint32_t numComp, bool jointPLT); -#endif private: // needed for TU encoding @@ -256,21 +228,15 @@ private: TCoeff *m_coeffs [ MAX_NUM_COMPONENT ]; Pel *m_pcmbuf [ MAX_NUM_COMPONENT ]; -#if JVET_O0119_BASE_PALETTE_444 bool *m_runType [MAX_NUM_COMPONENT]; Pel *m_runLength[MAX_NUM_COMPONENT]; -#endif int m_offsets[ MAX_NUM_COMPONENT ]; MotionInfo *m_motionBuf; public: -#if JVET_O0070_PROF CodingStructure *bestParent; -#endif -#if JVET_O1170_CHECK_BV_AT_DECODER bool resetIBCBuffer; -#endif MotionBuf getMotionBuf( const Area& _area ); MotionBuf getMotionBuf( const UnitArea& _area ) { return getMotionBuf( _area.Y() ); } diff --git a/source/Lib/CommonLib/Common.h b/source/Lib/CommonLib/Common.h index e551bbe3b34b9ebaf19c9ec567ef04e8c1db25b1..81c92278b2bd60a59c558424bcdbedf0f1defb5b 100644 --- a/source/Lib/CommonLib/Common.h +++ b/source/Lib/CommonLib/Common.h @@ -259,16 +259,6 @@ public: } }; -#if !JVET_O0925_MIP_SIMPLIFICATIONS -struct AvailableInfo -{ - int maxPosTop; - int maxPosLeft; - - 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 2577ae611d689b91df8816f9e15a51186803fbac..f491e1bebbde8e385f7444236f43364ed204d580 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -153,9 +153,7 @@ static const int AMVP_MAX_NUM_CANDS_MEM = 3; ///< AMVP static const int AMVP_DECIMATION_FACTOR = 2; static const int MRG_MAX_NUM_CANDS = 6; ///< MERGE static const int AFFINE_MRG_MAX_NUM_CANDS = 5; ///< AFFINE MERGE -#if JVET_O0455_IBC_MAX_MERGE_NUM static const int IBC_MRG_MAX_NUM_CANDS = 6; ///< IBC MERGE -#endif static const int MAX_TLAYER = 7; ///< Explicit temporal layer QP offset - max number of temporal layer @@ -178,17 +176,10 @@ 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_O0925_MIP_SIMPLIFICATIONS static const int MIP_MAX_WIDTH = MAX_TB_SIZEY; static const int MIP_MAX_HEIGHT = MAX_TB_SIZEY; -#else -static const int MIP_MAX_WIDTH = 64; -static const int MIP_MAX_HEIGHT = 64; -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB static const int MAX_NUM_ALF_ALTERNATIVES_CHROMA = 8; -#endif static const int MAX_NUM_ALF_CLASSES = 25; static const int MAX_NUM_ALF_LUMA_COEFF = 13; static const int MAX_NUM_ALF_CHROMA_COEFF = 7; @@ -197,11 +188,7 @@ static const int MAX_NUM_ALF_COEFF = MAX_ALF_FILTE static const int MAX_ALF_PADDING_SIZE = 4; static const int ALF_FIXED_FILTER_NUM = 64; -#if JVET_O_MAX_NUM_ALF_APS_8 static const int ALF_CTB_MAX_NUM_APS = 8; -#else -static const int ALF_CTB_MAX_NUM_APS = 6; -#endif static const int NUM_FIXED_FILTER_SETS = 16; static const int NUM_TOTAL_FILTER_SETS = NUM_FIXED_FILTER_SETS + ALF_CTB_MAX_NUM_APS; @@ -236,11 +223,13 @@ static const int RVM_VCEGAM10_M = 4; static const int MAX_REF_LINE_IDX = 3; //highest refLine offset in the list static const int MRL_NUM_REF_LINES = 3; //number of candidates in the array +#if JVET_P0418_ALIGN_MLRP_CCLM +static const int MULTI_REF_LINE_IDX[4] = { 0, 1, 2, 0 }; +#else static const int MULTI_REF_LINE_IDX[4] = { 0, 1, 3, 0 }; +#endif -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN static const int PRED_REG_MIN_WIDTH = 4; // Minimum prediction region width for ISP subblocks -#endif static const int NUM_LUMA_MODE = 67; ///< Planar + DC + 65 directional mode (4*16 + 1) static const int NUM_LMC_MODE = 1 + 2; ///< LMC + MDLM_T + MDLM_L @@ -268,9 +257,6 @@ 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_O0925_MIP_SIMPLIFICATIONS -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); static const int MAX_NUM_MIP_MODE = 35; ///< maximum number of MIP modes @@ -278,13 +264,8 @@ static const int FAST_UDI_MAX_RDMODE_NUM = (NUM_LUMA_MODE + MAX_NUM_MIP_MODE); / static const int MAX_LFNST_COEF_NUM = 16; -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS static const int LFNST_LAST_SIG_LUMA = 1; static const int LFNST_LAST_SIG_CHROMA = 1; -#else -static const int LFNST_SIG_NZ_LUMA = 1; -static const int LFNST_SIG_NZ_CHROMA = 1; -#endif static const int NUM_LFNST_NUM_PER_SET = 3; @@ -305,11 +286,9 @@ static const int NUM_LONG_TERM_REF_PIC_SPS = 0; static const int MAX_QP_OFFSET_LIST_SIZE = 6; ///< Maximum size of QP offset list is 6 entries -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE static const int MAX_NUM_CQP_MAPPING_TABLES = 3; ///< Maximum number of chroma QP mapping tables (Cb, Cr and joint Cb-Cr) static const int MIN_QP_VALUE_FOR_16_BIT = -48; ////< Minimum value for QP (-6*(bitdepth - 8) ) for bit depth 16 ; actual minimum QP value is bit depth dependent static const int MAX_NUM_QP_VALUES = MAX_QP + 1 - MIN_QP_VALUE_FOR_16_BIT; ////< Maximum number of QP values possible - bit depth dependent -#endif // Cost mode support static const int LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP = 0; ///< QP to use for lossless coding. @@ -326,12 +305,8 @@ static const int MAX_CU_SIZE = 1<<MAX_CU_DEPTH; static const int MIN_CU_LOG2 = 2; static const int MIN_PU_SIZE = 4; static const int MAX_NUM_PARTS_IN_CTU = ( ( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 ) ); -#if JVET_O0545_MAX_TB_SIGNALLING static const int MAX_NUM_TUS = 16; ///< Maximum number of TUs within one CU. When max TB size is 32x32, up to 16 TUs within one CU (128x128) is supported static const int MAX_LOG2_DIFF_CU_TR_SIZE = 3; -#else -static const int MAX_LOG2_DIFF_CU_TR_SIZE = 2; -#endif static const int MAX_CU_TILING_PARTITIONS = 1 << ( MAX_LOG2_DIFF_CU_TR_SIZE << 1 ); static const int JVET_C0024_ZERO_OUT_TH = 32; @@ -366,23 +341,14 @@ static const int MMVD_ADD_NUM = (MMVD_MAX_RE static const int MMVD_MRG_MAX_RD_NUM = MRG_MAX_NUM_CANDS; static const int MMVD_MRG_MAX_RD_BUF_NUM = (MMVD_MRG_MAX_RD_NUM + 1);///< increase buffer size by 1 -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT static const int MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA = 28; static const int MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA = 28; -#else -static const int MAX_NUM_REG_BINS_4x4SUBBLOCK = 32; ///< max number of context-coded bins (incl. gt2 bins) per 4x4 subblock -static const int MAX_NUM_GT2_BINS_4x4SUBBLOCK = 4; ///< max number of gt2 bins per 4x4 subblock -static const int MAX_NUM_REG_BINS_2x2SUBBLOCK = 8; ///< max number of context-coded bins (incl. gt2 bins) per 2x2 subblock (chroma) -static const int MAX_NUM_GT2_BINS_2x2SUBBLOCK = 2; ///< max number of gt2 bins per 2x2 subblock (chroma) -#endif static const int BIO_EXTEND_SIZE = 1; static const int BIO_TEMP_BUFFER_SIZE = (MAX_CU_SIZE + 2 * BIO_EXTEND_SIZE) * (MAX_CU_SIZE + 2 * BIO_EXTEND_SIZE); -#if JVET_O0070_PROF static const int PROF_BORDER_EXT_W = 1; static const int PROF_BORDER_EXT_H = 1; -#endif static const int GBI_NUM = 5; ///< the number of weight options static const int GBI_DEFAULT = ((uint8_t)(GBI_NUM >> 1)); ///< Default weighting index representing for w=0.5 static const int GBI_SIZE_CONSTRAINT = 256; ///< disabling GBi if cu size is smaller than 256 @@ -406,9 +372,6 @@ 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_O1136_TS_BDPCM_SIGNALLING -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. @@ -469,12 +432,10 @@ static const int SBT_MAX_SIZE = 64; ///< maxi static const int SBT_NUM_SL = 10; ///< maximum number of historical PU decision saved for a CU static const int SBT_NUM_RDO = 2; ///< maximum number of SBT mode tried for a PU -#if JVET_O0050_LOCAL_DUAL_TREE static const int NUM_INTER_CU_INFO_SAVE = 8; ///< maximum number of inter cu information saved for fast algorithm static const int LDT_MODE_TYPE_INHERIT = 0; ///< No need to signal mode_constraint_flag, and the modeType of the region is inherited from its parent node static const int LDT_MODE_TYPE_INFER = 1; ///< No need to signal mode_constraint_flag, and the modeType of the region is inferred as MODE_TYPE_INTRA static const int LDT_MODE_TYPE_SIGNAL = 2; ///< Need to signal mode_constraint_flag, and the modeType of the region is determined by the flag -#endif static const int IBC_MAX_CAND_SIZE = 16; // max block size for ibc search static const int IBC_NUM_CANDIDATES = 64; ///< Maximum number of candidates to store/test @@ -492,23 +453,16 @@ static constexpr int MV_BITS = 18; static constexpr int MV_MAX = (1 << (MV_BITS - 1)) - 1; static constexpr int MV_MIN = -(1 << (MV_BITS - 1)); -#if JVET_O0567_MVDRange_Constraint static const int MVD_MAX = (1 << 17) - 1; static const int MVD_MIN = -(1 << 17); -#endif static const int PIC_ANALYZE_CW_BINS = 32; static const int PIC_CODE_CW_BINS = 16; -#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING static const int LMCS_SEG_SIZE = (PIC_CODE_CW_BINS << 1); -#endif static const int FP_PREC = 11; static const int CSCALE_FP_PREC = 11; -#if JVET_O1109_UNFIY_CRS static const int NEIG_NUM_LOG = 6; static const int NEIG_NUM = 1 << NEIG_NUM_LOG; -#endif -#if JVET_O0119_BASE_PALETTE_444 static const int MAXPLTPREDSIZE = 63; static const int MAXPLTSIZE = 31; static const int PLT_ENCBITDEPTH = 8; @@ -516,16 +470,13 @@ static const int PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE = 4; static const int PLT_RUN_MSB_IDX_CTX_T1 = 1; static const int PLT_RUN_MSB_IDX_CTX_T2 = 3; static const int PLT_FAST_RATIO = 100; -#endif #if RExt__DECODER_DEBUG_TOOL_MAX_FRAME_STATS static const int EPBIN_WEIGHT_FACTOR = 4; #endif -#if JVET_O1164_RPR static const int ENC_PPS_ID_RPR = 3; static const int SCALE_RATIO_BITS = 14; static const int MAX_SCALING_RATIO = 8; // max scaling ratio allowed in the software, it is used to allocated an internla buffer in the rescaling static const std::pair<int, int> SCALE_1X = std::pair<int, int>( 1 << SCALE_RATIO_BITS, 1 << SCALE_RATIO_BITS ); // scale ratio 1x -#endif // ==================================================================================================================== // Macro functions diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index 901806cb4aeedf84202472eb2c0d42dc2c1b0c47..217bf1b732cb5b6f70043c81bbca77ab566859f4 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -86,10 +86,8 @@ CoeffCodingContext::CoeffCodingContext( const TransformUnit& tu, ComponentID com , m_tsSigFlagCtxSet ( Ctx::TsSigFlag ) , m_tsParFlagCtxSet ( Ctx::TsParFlag ) , m_tsGtxFlagCtxSet ( Ctx::TsGtxFlag ) -#if JVET_O0122_TS_SIGN_LEVEL , m_tsLrg1FlagCtxSet (Ctx::TsLrg1Flag) , m_tsSignFlagCtxSet (Ctx::TsResidualSign) -#endif , m_sigCoeffGroupFlag () , m_bdpcm (bdpcm) { @@ -134,7 +132,6 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag ) } -#if JVET_O0050_LOCAL_DUAL_TREE unsigned DeriveCtx::CtxModeConsFlag( const CodingStructure& cs, Partitioner& partitioner ) { assert( partitioner.chType == CHANNEL_TYPE_LUMA ); @@ -148,7 +145,6 @@ unsigned DeriveCtx::CtxModeConsFlag( const CodingStructure& cs, Partitioner& par unsigned ctxId = ((cuAbove && cuAbove->predMode == MODE_INTRA) || (cuLeft && cuLeft->predMode == MODE_INTRA)) ? 1 : 0; return ctxId; } -#endif void DeriveCtx::CtxSplit( const CodingStructure& cs, Partitioner& partitioner, unsigned& ctxSpl, unsigned& ctxQt, unsigned& ctxHv, unsigned& ctxHorBt, unsigned& ctxVerBt, bool* _canSplit /*= nullptr */ ) @@ -249,11 +245,7 @@ void DeriveCtx::CtxSplit( const CodingStructure& cs, Partitioner& partitioner, u ctxVerBt = ( partitioner.currMtDepth <= 1 ? 3 : 2 ); } -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const bool prevCbf, const int ispIdx ) -#else -unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, const bool prevCbf, const int ispIdx ) -#endif { if( ispIdx && isLuma( compID ) ) { @@ -263,18 +255,7 @@ unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, { return ( prevCbf ? 1 : 0 ); } -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX return 0; -#else - if( isChroma( compID ) ) - { - return ( trDepth == 0 ? 0 : 1 ); - } - else - { - return ( trDepth == 0 ? 1 : 0 ); - } -#endif } unsigned DeriveCtx::CtxInterDir( const PredictionUnit& pu ) @@ -343,9 +324,7 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) pu.mergeFlag = true; pu.mmvdMergeFlag = false; pu.interDir = interDirNeighbours[candIdx]; -#if JVET_O0057_ALTHPELIF pu.cu->imv = (!pu.cu->triangle && useAltHpelIf[candIdx]) ? IMV_HPEL : 0; -#endif pu.mergeIdx = candIdx; pu.mergeType = mrgTypeNeighbours[candIdx]; pu.mv [REF_PIC_LIST_0] = mvFieldNeighbours[(candIdx << 1) + 0].mv; @@ -362,9 +341,7 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) { pu.bv = pu.mv[REF_PIC_LIST_0]; pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution -#if JVET_O0057_ALTHPELIF pu.cu->imv = pu.cu->imv == IMV_HPEL ? 0 : pu.cu->imv; -#endif } pu.cu->GBiIdx = ( interDirNeighbours[candIdx] == 3 ) ? GBiIdx[candIdx] : GBI_DEFAULT; @@ -521,11 +498,7 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.mmvdMergeFlag = true; pu.mmvdMergeIdx = candIdx; pu.mergeFlag = true; -#if JVET_O0249_MERGE_SYNTAX pu.regularMergeFlag = true; -#else - pu.regularMergeFlag = false; -#endif pu.mergeIdx = candIdx; pu.mergeType = MRG_TYPE_DEFAULT_N; pu.mvd[REF_PIC_LIST_0] = Mv(); @@ -534,9 +507,7 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.mvpIdx[REF_PIC_LIST_1] = NOT_VALID; pu.mvpNum[REF_PIC_LIST_0] = NOT_VALID; pu.mvpNum[REF_PIC_LIST_1] = NOT_VALID; -#if JVET_O0057_ALTHPELIF pu.cu->imv = mmvdUseAltHpelIf[fPosBaseIdx] ? IMV_HPEL : 0; -#endif pu.cu->GBiIdx = (interDirNeighbours[fPosBaseIdx] == 3) ? GBiIdx[fPosBaseIdx] : GBI_DEFAULT; diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index 17ba388db3b02780e1729fcfff28de12011acbf8..f746b9d8346c6f2d4e789ea0d7a300e4dd04ef57 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -131,19 +131,11 @@ public: #undef UPDATE -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION int ctxOfs = std::min((sumAbs+1)>>1, 3) + ( diag < 2 ? 4 : 0 ); -#else - int ctxOfs = std::min( sumAbs, 5 ) + ( diag < 2 ? 6 : 0 ); -#endif if( m_chType == CHANNEL_TYPE_LUMA ) { -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION ctxOfs += diag < 5 ? 4 : 0; -#else - ctxOfs += diag < 5 ? 6 : 0; -#endif } m_tmplCpDiag = diag; @@ -217,7 +209,6 @@ public: unsigned parityCtxIdAbsTS () const { return m_tsParFlagCtxSet( 0 ); } unsigned greaterXCtxIdAbsTS ( uint8_t offset ) const { return m_tsGtxFlagCtxSet( offset ); } -#if JVET_O0122_TS_SIGN_LEVEL unsigned lrg1CtxIdAbsTS(int scanPos, const TCoeff* coeff, int bdpcm) { const uint32_t posY = m_scan[scanPos].y; @@ -246,9 +237,7 @@ public: #undef UPDATE return m_tsLrg1FlagCtxSet(numPos); } -#endif -#if JVET_O0122_TS_SIGN_LEVEL unsigned signCtxIdAbsTS(int scanPos, const TCoeff* coeff, int bdpcm) { const uint32_t posY = m_scan[scanPos].y; @@ -285,9 +274,7 @@ public: } return m_tsSignFlagCtxSet(signCtx); } -#endif -#if JVET_O0122_TS_SIGN_LEVEL void neighTS(int &rightPixel, int &belowPixel, int scanPos, const TCoeff* coeff) { const uint32_t posY = m_scan[scanPos].y; @@ -346,10 +333,12 @@ public: } return(absCoeffMod); } -#endif unsigned templateAbsSumTS( int scanPos, const TCoeff* coeff ) { +#if JVET_P0562_TS_RESIDUAL_CODING_SIMP + return 1; +#else const uint32_t posY = m_scan[scanPos].y; const uint32_t posX = m_scan[scanPos].x; const TCoeff* posC = coeff + posX + posY * m_width; @@ -372,11 +361,10 @@ public: }; return auiGoRicePars[ std::min(sum, 31) ]; +#endif } -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int regBinLimit; -#endif private: // constant @@ -425,10 +413,8 @@ private: CtxSet m_tsSigFlagCtxSet; CtxSet m_tsParFlagCtxSet; CtxSet m_tsGtxFlagCtxSet; -#if JVET_O0122_TS_SIGN_LEVEL CtxSet m_tsLrg1FlagCtxSet; CtxSet m_tsSignFlagCtxSet; -#endif int m_remainingContextBins; std::bitset<MLS_GRP_NUM> m_sigCoeffGroupFlag; const bool m_bdpcm; @@ -439,63 +425,28 @@ class CUCtx { public: CUCtx() : isDQPCoded(false), isChromaQpAdjCoded(false), -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS qgStart(false) { -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS violatesLfnstConstrained[CHANNEL_TYPE_LUMA ] = false; violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; -#endif lfnstLastScanPos = false; } -#else - qgStart(false), -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS - numNonZeroCoeffNonTs(0) - { - violatesLfnstConstrained[CHANNEL_TYPE_LUMA ] = false; - violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; - } -#else - numNonZeroCoeffNonTs(0) {} -#endif -#endif CUCtx(int _qp) : isDQPCoded(false), isChromaQpAdjCoded(false), qgStart(false), -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS qp(_qp) { -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS violatesLfnstConstrained[CHANNEL_TYPE_LUMA ] = false; violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; -#endif lfnstLastScanPos = false; } -#else -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS - numNonZeroCoeffNonTs(0), qp(_qp) - { - violatesLfnstConstrained[CHANNEL_TYPE_LUMA ] = false; - violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; - } -#else - numNonZeroCoeffNonTs(0), qp(_qp) {} -#endif -#endif ~CUCtx() {} public: bool isDQPCoded; bool isChromaQpAdjCoded; bool qgStart; -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS bool lfnstLastScanPos; -#else - uint32_t numNonZeroCoeffNonTs; -#endif int8_t qp; // used as a previous(last) QP and for QP prediction -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS bool violatesLfnstConstrained[MAX_NUM_CHANNEL_TYPE]; -#endif }; class MergeCtx @@ -515,10 +466,8 @@ public: MotionBuf subPuMvpExtMiBuf; MvField mmvdBaseMv[MMVD_BASE_MV_NUM][2]; void setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx); -#if JVET_O0057_ALTHPELIF bool mmvdUseAltHpelIf [ MMVD_BASE_MV_NUM ]; bool useAltHpelIf [ MRG_MAX_NUM_CANDS ]; -#endif void setMergeInfo( PredictionUnit& pu, int candIdx ); }; @@ -543,14 +492,8 @@ public: namespace DeriveCtx { void CtxSplit ( const CodingStructure& cs, Partitioner& partitioner, unsigned& ctxSpl, unsigned& ctxQt, unsigned& ctxHv, unsigned& ctxHorBt, unsigned& ctxVerBt, bool* canSplit = nullptr ); -#if JVET_O0050_LOCAL_DUAL_TREE unsigned CtxModeConsFlag( const CodingStructure& cs, Partitioner& partitioner ); -#endif -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX unsigned CtxQtCbf ( const ComponentID compID, const bool prevCbf = false, const int ispIdx = 0 ); -#else -unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth, const bool prevCbf = false, const int ispIdx = 0 ); -#endif unsigned CtxInterDir ( const PredictionUnit& pu ); unsigned CtxSkipFlag ( const CodingUnit& cu ); unsigned CtxAffineFlag( const CodingUnit& cu ); diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 7e0eb4b62aecbbdcce75d4847692e30c17f89bc4..a70b6c8ffb3516d489517b9e297886994ec58511 100755 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -120,32 +120,13 @@ const BinFracBits ProbModelTables::m_binFracBits[256] = { { { 0x28beb, 0x0057e } }, { { 0x2a658, 0x004c0 } }, { { 0x2c531, 0x00403 } }, { { 0x2ea40, 0x00346 } }, { { 0x318a9, 0x0028b } }, { { 0x356cb, 0x001d0 } }, { { 0x3b520, 0x00116 } }, { { 0x48000, 0x0005c } }, }; -#if !JVET_O0065_CABAC_INIT -const uint16_t ProbModelTables::m_inistateToCount[128] = { - 614, 647, 681, 718, 756, 797, 839, 884, 932, 982, 1034, 1089, 1148, 1209, 1274, 1342, - 1414, 1490, 1569, 1653, 1742, 1835, 1933, 2037, 2146, 2261, 2382, 2509, 2643, 2785, 2934, 3091, - 3256, 3430, 3614, 3807, 4011, 4225, 4452, 4690, 4941, 5205, 5483, 5777, 6086, 6412, 6755, 7116, - 7497, 7898, 8320, 8766, 9235, 9729, 10249, 10798, 11375, 11984, 12625, 13300, 14012, 14762, 15551, 16384, - 16384, 17216, 18005, 18755, 19467, 20142, 20783, 21392, 21969, 22518, 23038, 23532, 24001, 24447, 24869, 25270, - 25651, 26012, 26355, 26681, 26990, 27284, 27562, 27826, 28077, 28315, 28542, 28756, 28960, 29153, 29337, 29511, - 29676, 29833, 29982, 30124, 30258, 30385, 30506, 30621, 30730, 30834, 30932, 31025, 31114, 31198, 31277, 31353, - 31425, 31493, 31558, 31619, 31678, 31733, 31785, 31835, 31883, 31928, 31970, 32011, 32049, 32086, 32120, 32153 -}; -#endif void BinProbModel_Std::init( int qp, int initId ) { -#if JVET_O0065_CABAC_INIT int slope = (initId >> 3) - 4; int offset = ((initId & 7) * 18) + 1; int inistate = ((slope * (qp - 16)) >> 1) + offset; int state_clip = inistate < 1 ? 1 : inistate > 127 ? 127 : inistate; const int p1 = (state_clip << 8); -#else - int slope = ( ( initId >> 4 ) * 5 ) - 45; - int offset = ( ( initId & 15 ) << 3 ) - 16; - int inistate = ( ( slope * qp ) >> 4 ) + offset; - const int p1 = m_inistateToCount[inistate < 0 ? 0 : inistate > 127 ? 127 : inistate]; -#endif m_state[0] = p1 & MASK_0; m_state[1] = p1 & MASK_1; } @@ -200,15 +181,10 @@ CtxSet ContextSetCfg::addCtxSet( std::initializer_list<std::initializer_list<uin } -#if JVET_O0065_CABAC_INIT #define CNU 35 -#else -#define CNU 154 // dummy initialization value for unused context models 'Context model Not Used' -#endif std::vector<std::vector<uint8_t>> ContextSetCfg::sm_InitTables(NUMBER_OF_SLICE_TYPES + 1); // clang-format off -#if JVET_O0065_CABAC_INIT const CtxSet ContextSetCfg::SplitFlag = ContextSetCfg::addCtxSet ({ { 18, 27, 15, 11, 28, 30, 19, 22, 23, }, @@ -241,7 +217,6 @@ const CtxSet ContextSetCfg::Split12Flag = ContextSetCfg::addCtxSet { 12, 12, 12, 13, }, }); -#if JVET_O0050_LOCAL_DUAL_TREE const CtxSet ContextSetCfg::ModeConsFlag = ContextSetCfg::addCtxSet ({ { 40, 28, }, @@ -249,7 +224,6 @@ const CtxSet ContextSetCfg::ModeConsFlag = ContextSetCfg::addCtxSet { CNU, CNU, }, { 1, 0, }, }); -#endif const CtxSet ContextSetCfg::SkipFlag = ContextSetCfg::addCtxSet ({ @@ -363,15 +337,6 @@ const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet { 9, 10, 10, 5, }, }); -#if !JVET_O0925_MIP_SIMPLIFICATIONS -const CtxSet ContextSetCfg::MipMode = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); -#endif const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet ({ @@ -381,6 +346,15 @@ const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet { DWS, DWS, }, }); +#if JVET_P0042_FIX_INTER_DIR_CTX +const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet +({ + { 6, 13, 5, 4, 25, 48, }, + { 7, 6, 5, 4, 33, 34, }, + { CNU, CNU, CNU, CNU, CNU, CNU, }, + { 0, 0, 1, 4, 0, 0, }, +}); +#else const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet ({ { 6, 13, 5, 4, 25, }, @@ -388,6 +362,7 @@ const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet { CNU, CNU, CNU, CNU, CNU, }, { 0, 0, 1, 4, 0, }, }); +#endif const CtxSet ContextSetCfg::RefPic = ContextSetCfg::addCtxSet ({ @@ -684,7 +659,6 @@ const CtxSet ContextSetCfg::LFNSTIdx = ContextSetCfg::addCtxSet { 8, 8, }, }); -#if JVET_O0119_BASE_PALETTE_444 const CtxSet ContextSetCfg::PLTFlag = ContextSetCfg::addCtxSet ({ { CNU, }, @@ -724,7 +698,6 @@ const CtxSet ContextSetCfg::CopyRunModel = ContextSetCfg::addCtxSet { CNU, CNU, CNU, }, { DWS, DWS, DWS, }, }); -#endif const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet ({ @@ -925,878 +898,16 @@ const CtxSet ContextSetCfg::TsResidualSign = ContextSetCfg::addCtxSet { 20, 2, 46, CNU, CNU, CNU, }, { 1, 4, 4, DWS, DWS, DWS, }, }); -#else -const CtxSet ContextSetCfg::SplitFlag = ContextSetCfg::addCtxSet -({ - { 136, 153, 141, 122, 125, 156, 138, 126, 143, }, - { 122, 139, 186, 124, 125, 141, 139, 141, 158, }, - { 138, 154, 172, 124, 140, 142, 154, 142, 175, }, - { 12, 12, 8, 8, 13, 12, 5, 10, 12, }, -}); - -const CtxSet ContextSetCfg::SplitQtFlag = ContextSetCfg::addCtxSet -({ - { 123, 140, 142, 136, 138, 140, }, - { 139, 126, 142, 136, 138, 125, }, - { 124, 125, 127, 136, 153, 126, }, - { 0, 8, 8, 12, 12, 12, }, -}); - -const CtxSet ContextSetCfg::SplitHvFlag = ContextSetCfg::addCtxSet -({ - { 154, 168, 155, 139, 155, }, - { 169, 168, 170, 153, 170, }, - { 154, 168, 155, 153, 155, }, - { 10, 9, 9, 8, 8, }, -}); - -const CtxSet ContextSetCfg::Split12Flag = ContextSetCfg::addCtxSet -({ - { 154, 155, 154, 140, }, - { 169, 141, 154, 155, }, - { 169, 170, 169, 170, }, - { 12, 12, 12, 12, }, -}); - -#if JVET_O0050_LOCAL_DUAL_TREE -const CtxSet ContextSetCfg::ModeConsFlag = ContextSetCfg::addCtxSet -({ - { 192, 168, }, - { 179, 139, }, - { CNU, CNU, }, - { 5, 2, }, -}); -#endif - -const CtxSet ContextSetCfg::SkipFlag = ContextSetCfg::addCtxSet -({ - { 197, 214, 216, }, - { 211, 198, 185, }, - { 0, 152, 154, }, - { 5, 8, 8, }, -}); - -const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet -({ - { 111, }, - { 111, }, - { 138, }, - { 5, }, -}); - -const CtxSet ContextSetCfg::RegularMergeFlag = ContextSetCfg::addCtxSet -({ -#if JVET_O0249_MERGE_SYNTAX - { 159, 126 }, - { 143, 111 }, - { 154, 154 }, - { 6, 5 } -#else - { 142, 125, }, - { 141, 110, }, - { CNU, CNU, }, - { 4, 4, }, -#endif -}); - -const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet -({ - { 137, }, - { 154, }, - { 138, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet -({ -#if JVET_O0249_MERGE_SYNTAX - { 108, }, - { 108, }, - { 154, }, - { 5, }, -#else - { 109, }, - { 124, }, - { CNU, }, - { 5, }, -#endif -}); - -const CtxSet ContextSetCfg::MmvdMergeIdx = ContextSetCfg::addCtxSet -({ - { 154, }, - { 154, }, - { CNU, }, - { 10, }, -}); - -const CtxSet ContextSetCfg::MmvdStepMvpIdx = ContextSetCfg::addCtxSet -({ - { 213, }, - { 244, }, - { CNU, }, - { 1, }, -}); - -const CtxSet ContextSetCfg::PredMode = ContextSetCfg::addCtxSet -({ - { 192, 168, }, - { 179, 139, }, - { CNU, CNU, }, - { 5, 2, }, -}); - -const CtxSet ContextSetCfg::MultiRefLineIdx = ContextSetCfg::addCtxSet -({ - { 90, 212, }, - { 118, 212, }, - { 134, 169, }, - { 8, 8, }, -}); - -const CtxSet ContextSetCfg::IntraLumaMpmFlag = ContextSetCfg::addCtxSet -({ - { 154, }, - { 154, }, - { 170, }, - { 6, }, -}); - -const CtxSet ContextSetCfg::IntraLumaPlanarFlag = ContextSetCfg::addCtxSet -({ - { 125, 125, }, - { 139, 139, }, - { 110, 154, }, - { 4, 5, }, -}); -#if JVET_O1153_INTRA_CHROMAMODE_CODING -const CtxSet ContextSetCfg::CclmModeFlag = ContextSetCfg::addCtxSet -({ - { 153,}, - { 168,}, - { 169,}, - { 4,}, - }); -const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet -({ - { 149,}, - { 166,}, - { 138,}, - { 5,}, - }); -#else -const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet -({ - { 137, 139, 140, }, - { 138, 139, 169, }, - { 154, 154, 154, }, - { 5, 8, 8, }, -}); -#endif - -const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet -({ - { 181, 182, 183, 152, }, - { 181, 197, 183, 152, }, - { 165, 196, 168, 40, }, - { 9, 10, 10, 1, }, -}); - -#if !JVET_O0925_MIP_SIMPLIFICATIONS -const CtxSet ContextSetCfg::MipMode = ContextSetCfg::addCtxSet -({ - { 196, }, - { 196, }, - { 182, }, - { 9, }, -}); -#endif - -const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet -({ - { CNU, CNU, }, - { CNU, CNU, }, - { CNU, CNU, }, - { DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet -({ - { 111, 125, 95, 94, 164, }, - { 126, 111, 110, 109, 136, }, - { CNU, CNU, CNU, CNU, CNU, }, - { 0, 0, 1, 4, 0, }, -}); - -const CtxSet ContextSetCfg::RefPic = ContextSetCfg::addCtxSet -({ - { 125, 139, }, - { 138, 168, }, - { CNU, CNU, }, - { 4, 5, }, -}); - -#if JVET_O0500_SEP_CTX_AFFINE_SUBBLOCK_MRG -const CtxSet ContextSetCfg::SubblockMergeFlag = ContextSetCfg::addCtxSet -({ - { 183, 185, 187, }, - { 168, 169, 171, }, - { CNU, CNU, CNU, }, - { 4, 4, 4, }, - }); -#endif - -const CtxSet ContextSetCfg::AffineFlag = ContextSetCfg::addCtxSet -({ -#if JVET_O0249_MERGE_SYNTAX - { 180, 169, 186 }, - { 195, 168, 155 }, - { 154, 154, 154 }, - { 5, 4, 4 } -#else - { 183, 185, 187, }, - { 168, 169, 171, }, - { CNU, CNU, CNU, }, - { 4, 4, 4, }, -#endif -}); - -const CtxSet ContextSetCfg::AffineType = ContextSetCfg::addCtxSet -({ - { 153, }, - { 153, }, - { CNU, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::AffMergeIdx = ContextSetCfg::addCtxSet -({ - { 110, }, - { 110, }, - { CNU, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::GBiIdx = ContextSetCfg::addCtxSet -({ - { 228, }, - { 228, }, - { CNU, }, - { 4, }, -}); - -const CtxSet ContextSetCfg::Mvd = ContextSetCfg::addCtxSet -({ - { 169, 183, }, - { 155, 154, }, - { 126, 156, }, - { 9, 5, }, -}); - -const CtxSet ContextSetCfg::BDPCMMode = ContextSetCfg::addCtxSet -({ - { 148, 154, }, - { 0, 140, }, - { 40, 169, }, - { 1, 4, }, -}); +// clang-format on -const CtxSet ContextSetCfg::QtRootCbf = ContextSetCfg::addCtxSet -({ - { 94, }, - { 95, }, - { 110, }, - { 4, }, -}); +const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size(); -const CtxSet ContextSetCfg::QtCbf[] = -{ - ContextSetCfg::addCtxSet - ({ -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX - { 127, 111, 124, 140 }, - { 127, 79, 139, 126 }, - { 126, 138, 124, 111 }, - { 5, 1, 8, 8 }, -#else - { 142, 127, 124, 140, 111, }, - { 143, 127, 139, 126, 79, }, - { CNU, 126, 124, 111, 138, }, - { 1, 5, 8, 8, 1, }, -#endif - }), - ContextSetCfg::addCtxSet - ({ -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX - { 163, }, - { 150, }, - { 124, }, - { 5, }, -#else - { 163, 135, }, - { 150, 121, }, - { 124, CNU, }, - { 5, 0, }, -#endif - }), - ContextSetCfg::addCtxSet - ({ - { 161, 155, }, - { 163, 155, }, - { 151, 141, }, - { 2, 2, }, - }) -}; -const CtxSet ContextSetCfg::SigCoeffGroup[] = -{ - ContextSetCfg::addCtxSet - ({ - { 105, 170, }, - { 106, 156, }, - { 107, 158, }, - { 8, 5, }, - }), - ContextSetCfg::addCtxSet - ({ - { 105, 155, }, - { 105, 155, }, - { 90, 126, }, - { 5, 8, }, - }), -}; +// combined sets +const CtxSet ContextSetCfg::Palette = { ContextSetCfg::RotationFlag, ContextSetCfg::RunTypeFlag, ContextSetCfg::IdxRunModel, ContextSetCfg::CopyRunModel }; +const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::SaoTypeIdx }; -const CtxSet ContextSetCfg::SigFlag[] = -{ -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION - ContextSetCfg::addCtxSet - ({ - { 88, 166, 182, 169, 101, 167, 168, 155, 194, 213, 183, 156, }, - { 132, 152, 168, 140, 177, 182, 154, 155, 151, 213, 169, 156, }, - { 89, 138, 139, 140, 150, 139, 140, 141, 138, 185, 141, 157, }, - { 12, 9, 9, 10, 9, 9, 9, 9, 8, 8, 8, 10, }, - }), - ContextSetCfg::addCtxSet - ({ - { 27, 167, 168, 140, 180, 199, 214, 186, }, - { 133, 138, 139, 140, 181, 214, 200, 157, }, - { 134, 153, 154, 155, 167, 186, 186, 143, }, - { 9, 9, 9, 13, 5, 5, 8, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 152, 156, 186, 202, 182, 249, 247, 207, 182, 223, 223, 223, }, - { 123, 142, 172, 218, 138, 250, 248, 223, 125, 223, 223, 223, }, - { 93, 142, 143, 175, 153, 223, 223, 238, 154, 223, 223, 223, }, - { 9, 12, 8, 8, 8, 8, 8, 5, 8, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 182, 171, 143, 190, 183, 223, 223, 223, }, - { 168, 156, 216, 249, 169, 223, 223, 223, }, - { 138, 173, 157, 223, 170, 223, 223, 223, }, - { 8, 12, 8, 8, 4, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 123, 175, 223, 223, 212, 223, 223, 223, 0, 223, 223, 223, }, - { 123, 223, 205, 223, 138, 223, 223, 223, 196, 223, 223, 223, }, - { 107, 206, 223, 223, 93, 223, 223, 238, 55, 223, 223, 223, }, - { 8, 8, 8, 8, 8, 0, 4, 4, 0, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 167, 187, 249, 207, 181, 223, 223, 223, }, - { 167, 157, 191, 223, 152, 223, 223, 223, }, - { 152, 236, 223, 223, 123, 223, 223, 223, }, - { 8, 8, 8, 8, 4, 0, 0, 0, }, - }), -#else - ContextSetCfg::addCtxSet - ({ - { 88, 166, 152, 182, 168, 154, 116, 167, 182, 168, 183, 155, 208, 213, 183, 183, 169, 185, }, - { 132, 152, 167, 168, 183, 140, 177, 182, 168, 154, 169, 155, 151, 213, 183, 169, 184, 156, }, - { 89, 138, 153, 139, 154, 140, 135, 139, 139, 140, 140, 141, 123, 185, 140, 170, 141, 157, }, - { 12, 9, 9, 9, 9, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 27, 167, 153, 168, 139, 140, 180, 199, 183, 199, 199, 186, }, - { 133, 138, 153, 139, 154, 140, 181, 229, 169, 229, 170, 157, }, - { 104, 153, 168, 154, 154, 155, 167, 186, 170, 201, 171, 143, }, - { 9, 9, 12, 9, 12, 13, 5, 5, 8, 8, 8, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 152, 156, 201, 186, 186, 187, 182, 249, 188, 232, 188, 191, 182, 223, 223, 223, 223, 223, }, - { 123, 142, 157, 172, 172, 218, 138, 250, 248, 248, 234, 223, 125, 223, 223, 223, 223, 223, }, - { 93, 142, 157, 143, 188, 175, 153, 223, 251, 223, 223, 238, 154, 223, 223, 223, 223, 223, }, - { 9, 12, 9, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 0, 0, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 182, 171, 157, 143, 172, 189, 183, 223, 223, 223, 223, 223, }, - { 168, 156, 173, 216, 172, 234, 169, 223, 223, 223, 223, 223, }, - { 138, 173, 142, 172, 189, 223, 170, 223, 223, 223, 223, 223, }, - { 8, 9, 12, 8, 8, 8, 4, 0, 0, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 123, 159, 223, 223, 247, 237, 212, 223, 223, 237, 237, 223, 176, 223, 223, 223, 223, 223, }, - { 123, 191, 223, 190, 218, 223, 138, 223, 223, 223, 223, 223, 196, 223, 223, 223, 223, 223, }, - { 107, 175, 223, 223, 252, 223, 78, 223, 223, 238, 223, 238, 25, 223, 223, 223, 223, 223, }, - { 8, 8, 4, 8, 8, 8, 8, 0, 0, 4, 8, 4, 4, 0, 0, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 167, 201, 223, 248, 219, 207, 181, 223, 223, 223, 223, 223, }, - { 167, 171, 223, 190, 248, 223, 152, 223, 223, 223, 223, 223, }, - { 137, 250, 223, 237, 234, 223, 123, 223, 223, 223, 223, 223, }, - { 8, 8, 1, 8, 8, 8, 4, 0, 0, 0, 0, 0, }, - }) -#endif -}; - -const CtxSet ContextSetCfg::ParFlag[] = -{ - ContextSetCfg::addCtxSet - ({ - { 121, 119, 121, 137, 152, 153, 119, 151, 152, 138, 168, 135, 152, 153, 168, 139, 151, 153, 139, 168, 154, }, - { 121, 104, 121, 137, 138, 153, 104, 122, 123, 153, 124, 106, 138, 153, 168, 139, 137, 153, 168, 139, 139, }, - { 121, 135, 137, 152, 138, 153, 91, 137, 138, 153, 139, 151, 138, 153, 139, 139, 138, 168, 139, 154, 139, }, - { 8, 9, 12, 13, 13, 13, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 10, 13, 13, 13, 13, }, - }), - ContextSetCfg::addCtxSet - ({ - { 151, 120, 152, 138, 138, 138, 151, 168, 154, 153, 154, }, - { 150, 120, 137, 123, 138, 153, 136, 153, 168, 139, 154, }, - { 151, 135, 152, 153, 138, 153, 137, 168, 154, 139, 154, }, - { 9, 13, 12, 12, 13, 13, 10, 13, 13, 13, 13, }, - }) -}; - -const CtxSet ContextSetCfg::GtxFlag[] = -{ - ContextSetCfg::addCtxSet - ({ - { 104, 0, 102, 89, 150, 122, 0, 58, 134, 136, 138, 0, 148, 136, 152, 124, 133, 136, 138, 153, 140, }, - { 73, 0, 26, 104, 120, 137, 0, 57, 105, 136, 138, 116, 90, 107, 152, 153, 104, 107, 123, 153, 125, }, - { 119, 41, 148, 135, 136, 123, 43, 60, 106, 122, 109, 73, 106, 108, 109, 124, 136, 138, 139, 154, 111, }, - { 4, 5, 9, 9, 9, 6, 5, 9, 10, 9, 9, 9, 9, 9, 8, 9, 9, 8, 9, 8, 9, }, - }), - ContextSetCfg::addCtxSet - ({ - { 149, 56, 134, 136, 92, 123, 104, 122, 124, 140, 126, }, - { 103, 0, 90, 91, 92, 93, 103, 136, 138, 154, 140, }, - { 165, 87, 120, 122, 122, 123, 120, 137, 168, 154, 155, }, - { 2, 5, 8, 8, 8, 6, 6, 9, 8, 8, 8, }, - }), - ContextSetCfg::addCtxSet - ({ - { 0, 176, 151, 138, 139, 140, 162, 167, 139, 154, 155, 164, 153, 154, 169, 170, 181, 183, 184, 156, 157, }, - { 0, 133, 137, 138, 139, 125, 134, 138, 139, 154, 155, 136, 153, 154, 140, 170, 138, 154, 155, 170, 157, }, - { 134, 120, 123, 153, 139, 140, 121, 109, 139, 125, 111, 138, 154, 140, 155, 141, 154, 140, 185, 156, 143, }, - { 8, 5, 9, 13, 13, 10, 9, 10, 13, 13, 13, 9, 10, 10, 10, 10, 8, 9, 8, 9, 13, }, - }), - ContextSetCfg::addCtxSet - ({ - { 161, 178, 153, 154, 140, 140, 211, 170, 186, 157, 188, }, - { 0, 135, 153, 139, 125, 140, 182, 170, 156, 142, 159, }, - { 164, 151, 153, 154, 125, 140, 154, 170, 186, 172, 159, }, - { 6, 9, 10, 12, 12, 10, 5, 9, 9, 9, 12, }, - }) -}; - -const CtxSet ContextSetCfg::LastX[] = -{ - ContextSetCfg::addCtxSet - ({ - { 111, 111, 95, 111, 111, 124, 111, 126, 111, 124, 126, 126, 111, 111, 154, 154, 111, 110, 110, 124, }, - { 125, 110, 109, 125, 125, 123, 111, 111, 95, 123, 140, 111, 110, 95, 169, 125, 140, 139, 139, 138, }, - { 125, 110, 109, 140, 111, 109, 111, 111, 140, 123, 111, 126, 111, 140, 79, 155, 142, 141, 140, 198, }, - { 8, 5, 4, 5, 4, 4, 5, 4, 1, 0, 5, 1, 0, 0, 0, 1, 1, 0, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 137, 95, 63, }, - { 138, 123, 92, }, - { 109, 108, 77, }, - { 2, 1, 1, }, - }) -}; - -const CtxSet ContextSetCfg::LastY[] = -{ - ContextSetCfg::addCtxSet - ({ - { 125, 110, 139, 125, 111, 124, 111, 111, 95, 110, 140, 126, 110, 124, 155, 139, 111, 110, 124, 181, }, - { 95, 95, 109, 110, 110, 123, 125, 111, 124, 123, 140, 111, 110, 124, 154, 125, 126, 110, 124, 153, }, - { 110, 95, 94, 125, 125, 108, 111, 111, 95, 108, 111, 141, 111, 95, 78, 140, 186, 156, 125, 138, }, - { 8, 5, 8, 5, 5, 4, 5, 5, 4, 0, 5, 5, 1, 0, 0, 1, 4, 1, 0, 0, }, - }), - ContextSetCfg::addCtxSet - ({ - { 108, 124, 138, }, - { 108, 123, 92, }, - { 109, 94, 92, }, - { 3, 2, 2, }, - }) -}; - -const CtxSet ContextSetCfg::MVPIdx = ContextSetCfg::addCtxSet -({ - { 153, }, - { 168, }, - { 153, }, - { 10, }, -}); - -const CtxSet ContextSetCfg::SmvdFlag = ContextSetCfg::addCtxSet -({ - { 154, }, - { 139, }, - { CNU, }, - { 5, }, -}); - -const CtxSet ContextSetCfg::SaoMergeFlag = ContextSetCfg::addCtxSet -({ - { 31, }, - { 244, }, - { 214, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::SaoTypeIdx = ContextSetCfg::addCtxSet -({ - { 46, }, - { 95, }, - { 95, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::LFNSTIdx = ContextSetCfg::addCtxSet -( { - { 184, CNU, }, - { 155, CNU, }, - { 169, 155, }, - { 8, 8, }, -} ); - -#if JVET_O0119_BASE_PALETTE_444 -const CtxSet ContextSetCfg::PLTFlag = ContextSetCfg::addCtxSet -({ - { 146 }, - { 146 }, - { 147 }, - { 1 } -}); - -const CtxSet ContextSetCfg::RotationFlag = ContextSetCfg::addCtxSet -({ - { 153 }, - { 138 }, - { 168 }, - { 5 } -}); - -const CtxSet ContextSetCfg::RunTypeFlag = ContextSetCfg::addCtxSet -({ - { 167 }, - { 167 }, - { 167 }, - { 8 } -}); - -const CtxSet ContextSetCfg::IdxRunModel = ContextSetCfg::addCtxSet -({ - { 157, 169, 138, 170, 155 }, - { 186, 169, 166, 186, 185 }, - { 155, 168, 167, 155, 154 }, - { 5, 6, 5, 9, 10 } -}); - -const CtxSet ContextSetCfg::CopyRunModel = ContextSetCfg::addCtxSet -({ - { 187, 172, 156 }, - { 187, 187, 185 }, - { 201, 171, 155 }, - { 0, 5, 5 } -}); -#endif - -const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet -({ - { CNU, CNU, }, - { CNU, CNU, }, - { CNU, CNU, }, - { DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet -({ - { CNU, CNU, }, - { CNU, CNU, }, - { CNU, CNU, }, - { DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::MTSIndex = ContextSetCfg::addCtxSet -({ - { CNU, 141, 141, 140, 140, CNU, 218, 137, 153, 0, CNU, }, - { CNU, 141, 141, 126, 155, CNU, 250, 166, 153, 0, CNU, }, - { CNU, CNU, 139, 139, 154, CNU, 220, 0, 182, 161, CNU, }, - { DWS, 8, 8, 9, 8, DWS, 1, 0, 9, 0, DWS, }, -}); - -const CtxSet ContextSetCfg::ISPMode = ContextSetCfg::addCtxSet -({ - { 165, 154, }, - { 150, 169, }, - { 151, 169, }, - { 9, 1, }, -}); - -const CtxSet ContextSetCfg::SbtFlag = ContextSetCfg::addCtxSet -({ - { 197, 183, }, - { 211, 183, }, - { CNU, CNU, }, - { 4, 5, }, -}); - -const CtxSet ContextSetCfg::SbtQuadFlag = ContextSetCfg::addCtxSet -({ - { 168, }, - { 168, }, - { CNU, }, - { 9, }, -}); - -const CtxSet ContextSetCfg::SbtHorFlag = ContextSetCfg::addCtxSet -({ - { 139, 169, 139, }, - { 139, 154, 124, }, - { CNU, CNU, CNU, }, - { 8, 4, 4, }, -}); - -const CtxSet ContextSetCfg::SbtPosFlag = ContextSetCfg::addCtxSet -({ - { 154, }, - { 154, }, - { CNU, }, - { 13, }, -}); - -const CtxSet ContextSetCfg::CrossCompPred = ContextSetCfg::addCtxSet -({ - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, }, - { DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, }, -}); - -const CtxSet ContextSetCfg::ChromaQpAdjFlag = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet -({ - { CNU, }, - { CNU, }, - { CNU, }, - { DWS, }, -}); - -#if JVET_O0057_ALTHPELIF -const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet -({ - { 212, 180, 183, 242, 242, }, - { 213, 166, 198, 244, 244, }, - { CNU, 182, CNU, CNU, CNU, }, - { 1, 5, 1, 0, 0, }, -}); -#else -const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet -({ - { 212, 180, 183, 242, }, - { 213, 166, 198, 244, }, - { CNU, 182, CNU, CNU, }, - { 1, 5, 1, 0, }, -}); -#endif - -const CtxSet ContextSetCfg::ctbAlfFlag = ContextSetCfg::addCtxSet -({ - { 167, 200, 174, 211, 247, 249, 151, 247, 249, }, - { 110, 142, 203, 168, 246, 248, 168, 246, 248, }, - { 223, 223, 223, 202, 204, 250, 202, 204, 221, }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, }, -}); - -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB -const CtxSet ContextSetCfg::ctbAlfAlternative = ContextSetCfg::addCtxSet -({ // Cb, Cr - { 100, 100, }, // B / P (cabac_init_flag) - { 153, 153, }, // P / B (cabac_init_flag) - { 200, 200, }, // I - { 0, 0, }, // shiftIdx -}); - -#endif -const CtxSet ContextSetCfg::AlfUseLatestFilt = ContextSetCfg::addCtxSet -({ - { 169, }, - { 183, }, - { 159, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::AlfUseTemporalFilt = ContextSetCfg::addCtxSet -({ - { 201, }, - { 200, }, - { CNU, }, - { 0, }, -}); - -const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet -({ -#if JVET_O0249_MERGE_SYNTAX - { 184, }, - { 184, }, - { 154, }, - { 1, }, -#else - { 184, }, - { 185, }, - { CNU, }, - { 0, }, -#endif -}); - - - -const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet -({ - { 0, 154, 156, }, - { 0, 153, 155, }, - { 133, 153, 154, }, - { 1, 5, 8, }, -}); - -const CtxSet ContextSetCfg::JointCbCrFlag = ContextSetCfg::addCtxSet -({ -#if JVET_O0105_ICT - { 156, 156, 156, }, - { 156, 156, 156, }, - { 184, 184, 184, }, - { 1, 1, 1, }, -#else - { 156, }, - { 156, }, - { 184, }, - { 1, }, -#endif -}); - -const CtxSet ContextSetCfg::TsSigCoeffGroup = ContextSetCfg::addCtxSet -({ - { 123, 139, 155, }, - { 123, 124, 140, }, - { 123, 139, 156, }, - { 5, 5, 5, }, -}); - -const CtxSet ContextSetCfg::TsSigFlag = ContextSetCfg::addCtxSet -({ - { 150, 168, 140, }, - { 136, 124, 140, }, - { 135, 139, 126, }, - { 13, 13, 9, }, -}); - -const CtxSet ContextSetCfg::TsParFlag = ContextSetCfg::addCtxSet -({ - { 123, }, - { 123, }, - { 138, }, - { 5, }, -}); - -const CtxSet ContextSetCfg::TsGtxFlag = ContextSetCfg::addCtxSet -({ - { 124, 63, 79, 79, 95, }, - { 138, 47, 63, 63, 63, }, - { 124, 63, 63, 63, 63, }, - { 4, 1, 1, 1, 1, }, -}); - -#if JVET_O0122_TS_SIGN_LEVEL -const CtxSet ContextSetCfg::TsLrg1Flag = ContextSetCfg::addCtxSet -({ - { 139, 108, 124, 111 }, - { 122, 138, 139, 110 }, - { 123, 139, 110, 125 }, - { 4, 2, 1, 5 } - }); -#endif - -#if JVET_O0122_TS_SIGN_LEVEL - -const CtxSet ContextSetCfg::TsResidualSign = -{ - ContextSetCfg::addCtxSet - ({ - { 139, 92, 201, 139, 122, 171 }, - { 124, 77, 171, 169, 121, 187 }, - { 124, 61, 187, 154, 121, 187 }, - { 1, 4, 1, 5, 5, 5 } - }), -}; - -#else -const CtxSet ContextSetCfg::TsResidualSign = -{ - ContextSetCfg::addCtxSet - ({ - { 154, 154, }, - { 139, 154, }, - { 124, 139, }, - { 1, 2, }, - }), -}; -#endif -#endif -// clang-format on - -const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size(); - - -// combined sets -#if JVET_O0119_BASE_PALETTE_444 -const CtxSet ContextSetCfg::Palette = { ContextSetCfg::RotationFlag, ContextSetCfg::RunTypeFlag, ContextSetCfg::IdxRunModel, ContextSetCfg::CopyRunModel }; -#endif -const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::SaoTypeIdx }; - -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const CtxSet ContextSetCfg::Alf = { ContextSetCfg::ctbAlfFlag, ContextSetCfg::ctbAlfAlternative, ContextSetCfg::AlfUseLatestFilt, ContextSetCfg::AlfUseTemporalFilt }; -#else -const CtxSet ContextSetCfg::Alf = { ContextSetCfg::ctbAlfFlag, ContextSetCfg::AlfUseLatestFilt, ContextSetCfg::AlfUseTemporalFilt }; -#endif template <class BinProbModel> CtxStore<BinProbModel>::CtxStore() diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index e29d29ba3f3064c2103e21d8b9b657bfeb8a1117..cfbf82e1e8aecdba28827f101290a8783cae3325 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -67,9 +67,6 @@ class ProbModelTables { protected: static const BinFracBits m_binFracBits[256]; -#if !JVET_O0065_CABAC_INIT - static const uint16_t m_inistateToCount[128]; -#endif static const uint8_t m_RenormTable_32 [ 32]; // Std MP MPI }; @@ -201,9 +198,7 @@ public: static const CtxSet SplitQtFlag; static const CtxSet SplitHvFlag; static const CtxSet Split12Flag; -#if JVET_O0050_LOCAL_DUAL_TREE static const CtxSet ModeConsFlag; -#endif static const CtxSet SkipFlag; static const CtxSet MergeFlag; static const CtxSet RegularMergeFlag; @@ -212,23 +207,16 @@ public: static const CtxSet MultiRefLineIdx; static const CtxSet IntraLumaMpmFlag; static const CtxSet IntraLumaPlanarFlag; -#if JVET_O1153_INTRA_CHROMAMODE_CODING static const CtxSet CclmModeFlag; -#endif static const CtxSet IntraChromaPredMode; static const CtxSet MipFlag; -#if !JVET_O0925_MIP_SIMPLIFICATIONS - static const CtxSet MipMode; -#endif static const CtxSet DeltaQP; static const CtxSet InterDir; static const CtxSet RefPic; static const CtxSet MmvdFlag; static const CtxSet MmvdMergeIdx; static const CtxSet MmvdStepMvpIdx; -#if JVET_O0500_SEP_CTX_AFFINE_SUBBLOCK_MRG static const CtxSet SubblockMergeFlag; -#endif static const CtxSet AffineFlag; static const CtxSet AffineType; static const CtxSet AffMergeIdx; @@ -246,9 +234,7 @@ public: static const CtxSet TsSigFlag; static const CtxSet TsParFlag; static const CtxSet TsGtxFlag; -#if JVET_O0122_TS_SIGN_LEVEL static const CtxSet TsLrg1Flag; -#endif static const CtxSet TsResidualSign; static const CtxSet MVPIdx; static const CtxSet SaoMergeFlag; @@ -256,13 +242,11 @@ public: static const CtxSet MTSIndex; static const CtxSet TransquantBypassFlag; static const CtxSet LFNSTIdx; -#if JVET_O0119_BASE_PALETTE_444 static const CtxSet PLTFlag; static const CtxSet RotationFlag; static const CtxSet RunTypeFlag; static const CtxSet IdxRunModel; static const CtxSet CopyRunModel; -#endif static const CtxSet RdpcmFlag; static const CtxSet RdpcmDir; static const CtxSet SbtFlag; @@ -275,14 +259,9 @@ public: static const CtxSet ImvFlag; static const CtxSet GBiIdx; static const CtxSet ctbAlfFlag; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB static const CtxSet ctbAlfAlternative; -#endif static const CtxSet AlfUseLatestFilt; static const CtxSet AlfUseTemporalFilt; -#if !JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - static const CtxSet Alf; -#endif static const CtxSet MHIntraFlag; static const CtxSet SmvdFlag; static const CtxSet IBCFlag; @@ -294,12 +273,8 @@ public: // NOTE: The contained CtxSet's should directly follow each other in the initalization list; // otherwise, you will copy more elements than you want !!! static const CtxSet Sao; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB static const CtxSet Alf; -#endif -#if JVET_O0119_BASE_PALETTE_444 static const CtxSet Palette; -#endif public: static const std::vector<uint8_t>& getInitTable( unsigned initId ); diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 1aacb46fe1eba60a98192a18915589ce8f5bd89f..7da6763a4a11c29fa2fa7305ecdc26c9a1c4ca70 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -89,12 +89,10 @@ namespace DQIntern int nextSbbBelow; int posX; int posY; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT ChannelType chType; int sbtInfo; int tuWidth; int tuHeight; -#endif }; class Rom; @@ -376,11 +374,9 @@ namespace DQIntern void TUParameters::xSetScanInfo( ScanInfo& scanInfo, int scanIdx ) { -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT scanInfo.chType = m_chType; scanInfo.tuWidth = m_width; scanInfo.tuHeight = m_height; -#endif scanInfo.sbbSize = m_sbbSize; scanInfo.numSbb = m_numSbb; scanInfo.scanIdx = scanIdx; @@ -401,20 +397,12 @@ namespace DQIntern const int diag = m_scanId2BlkPos[nextScanIdx].x + m_scanId2BlkPos[nextScanIdx].y; if( m_chType == CHANNEL_TYPE_LUMA ) { -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION scanInfo.sigCtxOffsetNext = ( diag < 2 ? 8 : diag < 5 ? 4 : 0 ); -#else - scanInfo.sigCtxOffsetNext = ( diag < 2 ? 12 : diag < 5 ? 6 : 0 ); -#endif scanInfo.gtxCtxOffsetNext = ( diag < 1 ? 16 : diag < 3 ? 11 : diag < 10 ? 6 : 1 ); } else { -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION scanInfo.sigCtxOffsetNext = ( diag < 2 ? 4 : 0 ); -#else - scanInfo.sigCtxOffsetNext = ( diag < 2 ? 6 : 0 ); -#endif scanInfo.gtxCtxOffsetNext = ( diag < 1 ? 6 : 1 ); } scanInfo.nextInsidePos = nextScanIdx & m_sbbMask; @@ -460,11 +448,7 @@ namespace DQIntern static const unsigned sm_numCtxSetsSig = 3; static const unsigned sm_numCtxSetsGtx = 2; static const unsigned sm_maxNumSigSbbCtx = 2; -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION static const unsigned sm_maxNumSigCtx = 12; -#else - static const unsigned sm_maxNumSigCtx = 18; -#endif static const unsigned sm_maxNumGtxCtx = 21; private: @@ -522,19 +506,11 @@ namespace DQIntern { prevLumaCbf = TU::getPrevTuCbfAtDepth(tu, compID, tu.depth); } -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX bits = fracBitsAccess.getFracBitsArray(Ctx::QtCbf[compID](DeriveCtx::CtxQtCbf(compID, prevLumaCbf, true))); -#else - bits = fracBitsAccess.getFracBitsArray(Ctx::QtCbf[compID](DeriveCtx::CtxQtCbf(compID, tu.depth, prevLumaCbf, true))); -#endif } else { -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX bits = fracBitsAccess.getFracBitsArray(Ctx::QtCbf[compID](DeriveCtx::CtxQtCbf(compID, tu.cbf[COMPONENT_Cb]))); -#else - bits = fracBitsAccess.getFracBitsArray(Ctx::QtCbf[compID](DeriveCtx::CtxQtCbf(compID, tu.depth, tu.cbf[COMPONENT_Cb]))); -#endif } cbfDeltaBits = lastCbfIsInferred ? 0 : int32_t(bits.intBits[1]) - int32_t(bits.intBits[0]); } @@ -582,11 +558,7 @@ namespace DQIntern { BinFracBits* bits = m_sigFracBits [ ctxSetId ]; const CtxSet& ctxSet = Ctx::SigFlag [ chType + 2*ctxSetId ]; -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION const unsigned numCtx = ( chType == CHANNEL_TYPE_LUMA ? 12 : 8 ); -#else - const unsigned numCtx = ( chType == CHANNEL_TYPE_LUMA ? 18 : 12 ); -#endif for( unsigned ctxId = 0; ctxId < numCtx; ctxId++ ) { bits[ ctxId ] = fracBitsAccess.getFracBitsArray( ctxSet( ctxId ) ); @@ -695,11 +667,7 @@ namespace DQIntern { CHECKD( lambda <= 0.0, "Lambda must be greater than 0" ); -#if JVET_O0919_TS_MIN_QP const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#else - const int qpDQ = cQP.Qp + 1; -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const SPS& sps = *tu.cs->sps; @@ -718,11 +686,7 @@ namespace DQIntern m_QScale = g_quantScales[needsSqrt2ScaleAdjustment?1:0][ qpRem ]; const unsigned qIdxBD = std::min<unsigned>( maxLog2TrDynamicRange + 1, 8*sizeof(Intermediate_Int) + invShift - IQUANT_SHIFT - 1 ); m_maxQIdx = ( 1 << (qIdxBD-1) ) - 4; -#if JVET_O0256_ADJUST_THD_DEPQUANT m_thresLast = TCoeff((int64_t(4) << m_QShift)); -#else - m_thresLast = TCoeff((int64_t(3) << m_QShift)); -#endif m_thresSSbb = TCoeff((int64_t(3) << m_QShift)); // distortion calculation parameters const int64_t qScale = (gValue==-1) ? m_QScale : gValue; @@ -768,11 +732,7 @@ namespace DQIntern } //----- set dequant parameters ----- -#if JVET_O0919_TS_MIN_QP const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#else - const int qpDQ = cQP.Qp + 1; -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const SPS& sps = *tu.cs->sps; @@ -914,53 +874,12 @@ namespace DQIntern m_goRicePar = 0; m_goRiceZero = 0; } -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS void checkRdCosts( const ScanPosType spt, const PQData& pqDataA, const PQData& pqDataB, Decision& decisionA, Decision& decisionB ) const -#else - void checkRdCosts( const ScanPosType spt, const PQData& pqDataA, const PQData& pqDataB, Decision& decisionA, Decision& decisionB, bool zeroOut ) 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_O0094_LFNST_ZERO_PRIM_COEFFS - if( zeroOut ) - { - rdCostZ = m_rdCost; - if( m_remRegBins >= 4 ) - { - if( spt == SCAN_ISCSBB ) - { - rdCostZ += m_sigFracBits.intBits[ 0 ]; - } - else if( spt == SCAN_SOCSBB ) - { - rdCostZ += m_sbbFracBits.intBits[ 1 ] + m_sigFracBits.intBits[ 0 ]; - } - else if( m_numSigSbb ) - { - rdCostZ += m_sigFracBits.intBits[ 0 ]; - } - else - { - rdCostZ = decisionA.rdCost; - } - } - else - { - rdCostZ += goRiceTab[ m_goRiceZero ]; - } - if( rdCostZ < decisionA.rdCost ) - { - decisionA.rdCost = rdCostZ; - decisionA.absLevel = 0; - decisionA.prevId = m_stateId; - } - } - else - { -#endif if( m_remRegBins >= 4 ) { if( pqDataA.absLevel < 4 ) @@ -1025,9 +944,6 @@ namespace DQIntern decisionB.prevId = m_stateId; } } -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - } -#endif inline void checkRdCostStart(int32_t lastOffset, const PQData &pqData, Decision &decision) const { @@ -1072,11 +988,7 @@ namespace DQIntern int64_t m_rdCost; uint16_t m_absLevelsAndCtxInit[24]; // 16x8bit for abs levels + 16x16bit for ctx init id int8_t m_numSigSbb; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int m_remRegBins; -#else - int8_t m_remRegBins; -#endif int8_t m_refSbbCtxId; BinFracBits m_sbbFracBits; BinFracBits m_sigFracBits; @@ -1088,11 +1000,9 @@ namespace DQIntern const CoeffFracBits*const m_gtxFracBitsArray; const uint32_t*const m_goRiceZeroArray; CommonCtx& m_commonCtx; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT public: unsigned effWidth; unsigned effHeight; -#endif }; @@ -1130,19 +1040,8 @@ namespace DQIntern { m_numSigSbb = 1; m_refSbbCtxId = -1; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int ctxBinSampleRatio = (scanInfo.chType == CHANNEL_TYPE_LUMA) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA; m_remRegBins = (effWidth * effHeight *ctxBinSampleRatio) / 16 - (decision.absLevel < 2 ? decision.absLevel : 3); -#else - if ( scanInfo.sbbSize == 4 ) - { - m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK - (decision.absLevel < 2 ? decision.absLevel : 3); - } - else - { - m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - (decision.absLevel < 2 ? decision.absLevel : 3); - } -#endif ::memset( m_absLevelsAndCtxInit, 0, 48*sizeof(uint8_t) ); } @@ -1187,11 +1086,7 @@ namespace DQIntern } #undef UPDATE TCoeff sumGt1 = sumAbs1 - sumNum; -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION m_sigFracBits = m_sigFracBitsArray[scanInfo.sigCtxOffsetNext + std::min( (sumAbs1+1)>>1, 3 )]; -#else - m_sigFracBits = m_sigFracBitsArray[scanInfo.sigCtxOffsetNext + (sumAbs1 < 5 ? sumAbs1 : 5)]; -#endif m_coeffFracBits = m_gtxFracBitsArray[scanInfo.gtxCtxOffsetNext + (sumGt1 < 4 ? sumGt1 : 4)]; TCoeff sumAbs = m_absLevelsAndCtxInit[8 + scanInfo.nextInsidePos] >> 8; @@ -1305,11 +1200,7 @@ namespace DQIntern TCoeff sumNum = tinit & 7; TCoeff sumAbs1 = ( tinit >> 3 ) & 31; TCoeff sumGt1 = sumAbs1 - sumNum; -#if JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION m_sigFracBits = m_sigFracBitsArray[ scanInfo.sigCtxOffsetNext + std::min( (sumAbs1+1)>>1, 3 ) ]; -#else - m_sigFracBits = m_sigFracBitsArray[ scanInfo.sigCtxOffsetNext + ( sumAbs1 < 5 ? sumAbs1 : 5 ) ]; -#endif m_coeffFracBits = m_gtxFracBitsArray[ scanInfo.gtxCtxOffsetNext + ( sumGt1 < 4 ? sumGt1 : 4 ) ]; } } @@ -1334,7 +1225,6 @@ namespace DQIntern const int sigNSbb = ( ( scanInfo.nextSbbRight ? sbbFlags[ scanInfo.nextSbbRight ] : false ) || ( scanInfo.nextSbbBelow ? sbbFlags[ scanInfo.nextSbbBelow ] : false ) ? 1 : 0 ); currState.m_numSigSbb = 0; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT if (prevState) { currState.m_remRegBins = prevState->m_remRegBins; @@ -1344,16 +1234,6 @@ namespace DQIntern int ctxBinSampleRatio = (scanInfo.chType == CHANNEL_TYPE_LUMA) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA; currState.m_remRegBins = (currState.effWidth * currState.effHeight *ctxBinSampleRatio) / 16; } -#else - if (scanInfo.sbbSize == 4) - { - currState.m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK; - } - else - { - currState.m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK; - } -#endif currState.m_goRicePar = 0; currState.m_refSbbCtxId = currState.m_stateId; currState.m_sbbFracBits = m_sbbFlagBits[ sigNSbb ]; @@ -1456,7 +1336,6 @@ namespace DQIntern { ::memcpy( decisions, startDec, 8*sizeof(Decision) ); -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS if( zeroOut ) { if( spt==SCAN_EOCSBB ) @@ -1468,52 +1347,23 @@ namespace DQIntern } return; } -#endif PQData pqData[4]; m_quant.preQuantCoeff( absCoeff, pqData, quanCoeff ); -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS 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]); -#else - 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 ); -#endif if( spt==SCAN_EOCSBB ) { -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - if( zeroOut ) - { - m_skipStates[0].checkRdCostSkipSbbZeroOut( decisions[0] ); - m_skipStates[1].checkRdCostSkipSbbZeroOut( decisions[1] ); - m_skipStates[2].checkRdCostSkipSbbZeroOut( decisions[2] ); - m_skipStates[3].checkRdCostSkipSbbZeroOut( decisions[3] ); - } - 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_O0094_LFNST_ZERO_PRIM_COEFFS - } -#endif } -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - if( !zeroOut ) - { -#endif m_startState.checkRdCostStart( lastOffset, pqData[0], decisions[0] ); m_startState.checkRdCostStart( lastOffset, pqData[2], decisions[2] ); -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - } -#endif } void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff ) @@ -1535,11 +1385,7 @@ namespace DQIntern m_currStates[3].updateStateEOS( scanInfo, m_prevStates, m_skipStates, decisions[3] ); ::memcpy( decisions+4, decisions, 4*sizeof(Decision) ); } -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS else if( !zeroOut ) -#else - else -#endif { switch( scanInfo.nextNbInfoSbb.num ) { @@ -1615,11 +1461,7 @@ namespace DQIntern bool zeroOut = false; bool zeroOutforThres = false; int effWidth = tuPars.m_width, effHeight = tuPars.m_height; -#if JVET_O0538_SPS_CONTROL_ISP_SBT if( ( tu.mtsIdx > MTS_SKIP || ( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if ((tu.mtsIdx > MTS_SKIP || (tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32)) && !tu.cu->transQuantBypass && compID == COMPONENT_Y) -#endif { effHeight = (tuPars.m_height == 32) ? 16 : tuPars.m_height; effWidth = (tuPars.m_width == 32) ? 16 : tuPars.m_width; @@ -1628,17 +1470,10 @@ namespace DQIntern zeroOutforThres = zeroOut || (32 < tuPars.m_height || 32 < tuPars.m_width); //===== find first test position ===== int firstTestPos = numCoeff - 1; -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS if( lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 ) { firstTestPos = ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) ? 7 : 15 ; } -#else - if( lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) ) - { - firstTestPos = 7; - } -#endif const TCoeff defaultQuantisationCoefficient = (TCoeff)m_quant.getQScale(); const TCoeff thres = m_quant.getLastThreshold(); for( ; firstTestPos >= 0; firstTestPos-- ) @@ -1669,7 +1504,6 @@ namespace DQIntern m_startState.init(); -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int effectWidth = std::min(32, effWidth); int effectHeight = std::min(32, effHeight); for (int k = 0; k < 12; k++) @@ -1679,23 +1513,11 @@ namespace DQIntern } m_startState.effWidth = effectWidth; m_startState.effHeight = effectHeight; -#endif //===== populate trellis ===== for( int scanIdx = firstTestPos; scanIdx >= 0; scanIdx-- ) { const ScanInfo& scanInfo = tuPars.m_scanInfo[ scanIdx ]; -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - 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 (enableScalingLists) - { - m_quant.initQuantBlock(tu, compID, cQP, lambda, quantCoeff[scanInfo.rasterPos]); - xDecideAndUpdate( abs( tCoeff[scanInfo.rasterPos]), scanInfo, (zeroOut && (scanInfo.posX >= effWidth || scanInfo.posY >= effHeight)) || lfnstZeroOut, quantCoeff[scanInfo.rasterPos] ); - } - else - xDecideAndUpdate( abs( tCoeff[scanInfo.rasterPos]), scanInfo, (zeroOut && (scanInfo.posX >= effWidth || scanInfo.posY >= effHeight)) || lfnstZeroOut, defaultQuantisationCoefficient ); -#else if (enableScalingLists) { m_quant.initQuantBlock(tu, compID, cQP, lambda, quantCoeff[scanInfo.rasterPos]); @@ -1703,7 +1525,6 @@ namespace DQIntern } else xDecideAndUpdate( abs( tCoeff[scanInfo.rasterPos]), scanInfo, (zeroOut && (scanInfo.posX >= effWidth || scanInfo.posY >= effHeight)), defaultQuantisationCoefficient ); -#endif } //===== find best path ===== @@ -1757,11 +1578,7 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff if( tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID)) ) { //===== scaling matrix ==== -#if JVET_O0919_TS_MIN_QP const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#else - const int qpDQ = cQP.Qp + 1; -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const CompArea &rect = tu.blocks[compID]; @@ -1784,11 +1601,7 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo { if( tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID)) ) { -#if JVET_O0919_TS_MIN_QP const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#else - const int qpDQ = cQP.Qp + 1; -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const CompArea &rect = tu.blocks[compID]; diff --git a/source/Lib/CommonLib/HRD.h b/source/Lib/CommonLib/HRD.h index 5b436d040eae626d0775974b85501ccbc82c32b4..52cc7cbf25078c7b98a817447558503796d630cf 100644 --- a/source/Lib/CommonLib/HRD.h +++ b/source/Lib/CommonLib/HRD.h @@ -36,9 +36,7 @@ #define __HRD__ #include "Common.h" -#if JVET_N0353_INDEP_BUFF_TIME_SEI #include "SEI.h" -#endif class TimingInfo { @@ -92,68 +90,24 @@ class HRDParameters private: bool m_nalHrdParametersPresentFlag; bool m_vclHrdParametersPresentFlag; -#if !JVET_O0189_DU - bool m_subPicCpbParamsPresentFlag; -#endif uint32_t m_tickDivisorMinus2; -#if JVET_O0189_DU bool m_decodingUnitCpbParamsInPicTimingSeiFlag; -#else - uint32_t m_duCpbRemovalDelayLengthMinus1; -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - bool m_subPicCpbParamsInPicTimingSEIFlag; -#else bool m_decodingUnitHrdParamsPresentFlag; -#endif -#if !JVET_O0189_DU - uint32_t m_dpbOutputDelayDuLengthMinus1; -#endif uint32_t m_bitRateScale; uint32_t m_cpbSizeScale; -#if JVET_O0189_DU uint32_t m_cpbSizeDuScale; -#else - uint32_t m_ducpbSizeScale; -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - uint32_t m_initialCpbRemovalDelayLengthMinus1; - uint32_t m_cpbRemovalDelayLengthMinus1; - uint32_t m_dpbOutputDelayLengthMinus1; -#endif HrdSubLayerInfo m_HRD[MAX_TLAYER]; public: HRDParameters() :m_nalHrdParametersPresentFlag (false) ,m_vclHrdParametersPresentFlag (false) -#if !JVET_O0189_DU - ,m_subPicCpbParamsPresentFlag (false) -#endif ,m_tickDivisorMinus2 (0) -#if JVET_O0189_DU ,m_decodingUnitCpbParamsInPicTimingSeiFlag (false) -#else - ,m_duCpbRemovalDelayLengthMinus1 (0) -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - ,m_subPicCpbParamsInPicTimingSEIFlag (false) -#else ,m_decodingUnitHrdParamsPresentFlag (false) -#endif -#if !JVET_O0189_DU - ,m_dpbOutputDelayDuLengthMinus1 (0) -#endif ,m_bitRateScale (0) ,m_cpbSizeScale (0) -#if JVET_O0189_DU ,m_cpbSizeDuScale (0) -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - ,m_initialCpbRemovalDelayLengthMinus1(23) - ,m_cpbRemovalDelayLengthMinus1 (23) - ,m_dpbOutputDelayLengthMinus1 (23) -#endif {} virtual ~HRDParameters() {} @@ -164,59 +118,25 @@ public: void setVclHrdParametersPresentFlag( bool flag ) { m_vclHrdParametersPresentFlag = flag; } bool getVclHrdParametersPresentFlag( ) const { return m_vclHrdParametersPresentFlag; } -#if !JVET_O0189_DU - void setSubPicCpbParamsPresentFlag( bool flag ) { m_subPicCpbParamsPresentFlag = flag; } - bool getSubPicCpbParamsPresentFlag( ) const { return m_subPicCpbParamsPresentFlag; } -#endif void setTickDivisorMinus2( uint32_t value ) { m_tickDivisorMinus2 = value; } uint32_t getTickDivisorMinus2( ) const { return m_tickDivisorMinus2; } -#if !JVET_O0189_DU - void setDuCpbRemovalDelayLengthMinus1( uint32_t value ) { m_duCpbRemovalDelayLengthMinus1 = value; } - uint32_t getDuCpbRemovalDelayLengthMinus1( ) const { return m_duCpbRemovalDelayLengthMinus1; } -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void setSubPicCpbParamsInPicTimingSEIFlag( bool flag) { m_subPicCpbParamsInPicTimingSEIFlag = flag; } - bool getSubPicCpbParamsInPicTimingSEIFlag( ) const { return m_subPicCpbParamsInPicTimingSEIFlag; } -#else void setDecodingUnitHrdParamsPresentFlag( bool flag) { m_decodingUnitHrdParamsPresentFlag = flag; } bool getDecodingUnitHrdParamsPresentFlag( ) const { return m_decodingUnitHrdParamsPresentFlag; } -#endif -#if !JVET_O0189_DU - void setDpbOutputDelayDuLengthMinus1(uint32_t value ) { m_dpbOutputDelayDuLengthMinus1 = value; } - uint32_t getDpbOutputDelayDuLengthMinus1( ) const { return m_dpbOutputDelayDuLengthMinus1; } -#endif -#if JVET_O0189_DU void setDecodingUnitCpbParamsInPicTimingSeiFlag( uint32_t value ) { m_decodingUnitCpbParamsInPicTimingSeiFlag = value; } uint32_t getDecodingUnitCpbParamsInPicTimingSeiFlag( ) const { return m_decodingUnitCpbParamsInPicTimingSeiFlag; } -#endif void setBitRateScale( uint32_t value ) { m_bitRateScale = value; } uint32_t getBitRateScale( ) const { return m_bitRateScale; } void setCpbSizeScale( uint32_t value ) { m_cpbSizeScale = value; } uint32_t getCpbSizeScale( ) const { return m_cpbSizeScale; } -#if JVET_O0189_DU void setCpbSizeDuScale( uint32_t value ) { m_cpbSizeDuScale = value; } uint32_t getCpbSizeDuScale( ) const { return m_cpbSizeDuScale; } -#else - void setDuCpbSizeScale( uint32_t value ) { m_ducpbSizeScale = value; } - uint32_t getDuCpbSizeScale( ) const { return m_ducpbSizeScale; } -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void setInitialCpbRemovalDelayLengthMinus1( uint32_t value ) { m_initialCpbRemovalDelayLengthMinus1 = value; } - uint32_t getInitialCpbRemovalDelayLengthMinus1( ) const { return m_initialCpbRemovalDelayLengthMinus1; } - - void setCpbRemovalDelayLengthMinus1( uint32_t value ) { m_cpbRemovalDelayLengthMinus1 = value; } - uint32_t getCpbRemovalDelayLengthMinus1( ) const { return m_cpbRemovalDelayLengthMinus1; } - - void setDpbOutputDelayLengthMinus1( uint32_t value ) { m_dpbOutputDelayLengthMinus1 = value; } - uint32_t getDpbOutputDelayLengthMinus1( ) const { return m_dpbOutputDelayLengthMinus1; } -#endif void setFixedPicRateFlag( int layer, bool flag ) { m_HRD[layer].fixedPicRateFlag = flag; } bool getFixedPicRateFlag( int layer ) const { return m_HRD[layer].fixedPicRateFlag; } @@ -252,9 +172,7 @@ class HRD { public: HRD() -#if JVET_N0353_INDEP_BUFF_TIME_SEI :m_bufferingPeriodInitialized (false) -#endif {}; virtual ~HRD() @@ -268,18 +186,14 @@ public: TimingInfo getTimingInfo() const { return m_timingInfo; } const TimingInfo& getTimingInfo() { return m_timingInfo; } -#if JVET_N0353_INDEP_BUFF_TIME_SEI void setBufferingPeriodSEI(const SEIBufferingPeriod* bp) { bp->copyTo(m_bufferingPeriodSEI); m_bufferingPeriodInitialized = true; } const SEIBufferingPeriod* getBufferingPeriodSEI() const { return m_bufferingPeriodInitialized ? &m_bufferingPeriodSEI : nullptr; } -#endif protected: HRDParameters m_hrdParams; TimingInfo m_timingInfo; -#if JVET_N0353_INDEP_BUFF_TIME_SEI bool m_bufferingPeriodInitialized; SEIBufferingPeriod m_bufferingPeriodSEI; -#endif }; #endif //__HRD__ \ No newline at end of file diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 94acb9ae7483b11e45001ebdb30263989255f1a5..0ae617a0f858e20da315f8c8e9ebbe818545f28c 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -57,11 +57,9 @@ InterPrediction::InterPrediction() , m_maxCompIDToPred ( MAX_NUM_COMPONENT ) , m_pcRdCost ( nullptr ) , m_storedMv ( nullptr ) -#if JVET_O0070_PROF , m_skipPROF (false) , m_encOnly (false) , m_isBi (false) -#endif , m_gradX0(nullptr) , m_gradY0(nullptr) , m_gradX1(nullptr) @@ -151,16 +149,10 @@ void InterPrediction::destroy() xFree(m_cRefSamplesDMVRL1[ch]); m_cRefSamplesDMVRL1[ch] = nullptr; } -#if JVET_O1170_IBC_VIRTUAL_BUFFER m_IBCBuffer.destroy(); -#endif } -#if JVET_O1170_IBC_VIRTUAL_BUFFER void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC, const int ctuSize ) -#else -void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC ) -#endif { m_pcRdCost = pcRdCost; @@ -226,13 +218,11 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC ) const int MVBUFFER_SIZE = MAX_CU_SIZE / MIN_PU_SIZE; m_storedMv = new Mv[MVBUFFER_SIZE*MVBUFFER_SIZE]; } -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (m_IBCBuffer.bufs.empty()) { m_IBCBufferWidth = 128 * 128 / ctuSize; m_IBCBuffer.create(UnitArea(chromaFormatIDC, Area(0, 0, m_IBCBufferWidth, ctuSize))); } -#endif } // ==================================================================================================================== @@ -307,10 +297,8 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R int fstStep = (!verMC ? puHeight : puWidth); int secStep = (!verMC ? puWidth : puHeight); -#if JVET_O1164_RPR pu.refIdx[0] = 0; pu.refIdx[1] = pu.cs->slice->getSliceType() == B_SLICE ? 0 : -1; bool scaled = !PU::isRefPicSameSize( pu ); -#endif m_subPuMC = true; @@ -328,11 +316,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R while (later < secEnd) { const MotionInfo &laterMi = !verMC ? pu.getMotionInfo(Position{ later, fstDim }) : pu.getMotionInfo(Position{ fstDim, later }); -#if JVET_O1164_RPR if (!scaled && laterMi == curMi) -#else - if (laterMi == curMi) -#endif { length += secStep; } @@ -358,11 +342,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R pu.cu->affine = isAffine; } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/, PelUnitBuf* yuvDstTmp /*= NULL*/) -#else -void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/) -#endif { // compute the location of the current PU Position puPos = pu.lumaPos(); @@ -376,9 +356,7 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R subPu.mmvdMergeFlag = pu.mmvdMergeFlag; subPu.mmvdEncOptMode = pu.mmvdEncOptMode; subPu.mergeFlag = pu.mergeFlag; -#if JVET_O0108_DIS_DMVR_BDOF_CIIP subPu.mhIntraFlag = pu.mhIntraFlag; -#endif subPu.mvRefine = pu.mvRefine; subPu.refIdx[0] = pu.refIdx[0]; subPu.refIdx[1] = pu.refIdx[1]; @@ -403,47 +381,16 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R subPu = curMi; PelUnitBuf subPredBuf = predBuf.subBuf(UnitAreaRelative(pu, subPu)); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) { PelUnitBuf subPredBufTmp = yuvDstTmp->subBuf(UnitAreaRelative(pu, subPu)); motionCompensation(subPu, subPredBuf, eRefPicList, true, true, &subPredBufTmp); } else -#endif motionCompensation(subPu, subPredBuf, eRefPicList); } } } -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE -void InterPrediction::xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred) -{ - // separated tree, chroma - const CompArea lumaArea = CompArea(COMPONENT_Y, pu.chromaFormat, pu.Cb().lumaPos(), recalcSize(pu.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, pu.Cb().size())); - PredictionUnit subPu; - subPu.cs = pu.cs; - subPu.cu = pu.cu; - - Picture * refPic = pu.cu->slice->getPic(); - for (int y = lumaArea.y; y < lumaArea.y + lumaArea.height; y += MIN_PU_SIZE) - { - for (int x = lumaArea.x; x < lumaArea.x + lumaArea.width; x += MIN_PU_SIZE) - { - const MotionInfo &curMi = pu.cs->picture->cs->getMotionInfo(Position{ x, y }); - - subPu.UnitArea::operator=(UnitArea(pu.chromaFormat, Area(x, y, MIN_PU_SIZE, MIN_PU_SIZE))); - PelUnitBuf subPredBuf = pcYuvPred.subBuf(UnitAreaRelative(pu, subPu)); - - xPredInterBlk(COMPONENT_Cb, subPu, refPic, curMi.mv[0], subPredBuf, false, pu.cu->slice->clpRng(COMPONENT_Cb) - , false - , true); - xPredInterBlk(COMPONENT_Cr, subPu, refPic, curMi.mv[0], subPredBuf, false, pu.cu->slice->clpRng(COMPONENT_Cr) - , false - , true); - } - } -} -#endif void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi , const bool& bioApplied @@ -475,14 +422,10 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& if( !pu.cu->affine ) { -#if JVET_O1164_PS if( pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx ) == SCALE_1X ) { clipMv( mv[0], pu.cu->lumaPos(), pu.cu->lumaSize(), sps, *pu.cs->pps ); } -#else - clipMv( mv[0], pu.cu->lumaPos(), pu.cu->lumaSize(), sps ); -#endif } for( uint32_t comp = COMPONENT_Y; comp < pcYuvPred.bufs.size() && comp <= m_maxCompIDToPred; comp++ ) @@ -495,14 +438,8 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& if ( pu.cu->affine ) { CHECK( bioApplied, "BIO is not allowed with affine" ); -#if JVET_O0070_PROF m_iRefListIdx = eRefPicList; -#endif -#if JVET_O1164_RPR xPredAffineBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->unscaledPic, mv, pcYuvPred, bi, pu.cu->slice->clpRng( compID ), pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx )); -#else - xPredAffineBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx ), mv, pcYuvPred, bi, pu.cu->slice->clpRng( compID ) ); -#endif } else { @@ -515,24 +452,13 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& } else { -#if JVET_O1164_RPR xPredInterBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->unscaledPic, mv[0], pcYuvPred, bi, pu.cu->slice->clpRng( compID ), bioApplied, isIBC, pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx ) ); -#else - xPredInterBlk(compID, pu, pu.cu->slice->getRefPic(eRefPicList, iRefIdx), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng(compID) - , bioApplied - , isIBC - ); -#endif } } } } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp /*= NULL*/) -#else -void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) -#endif { const PPS &pps = *pu.cs->pps; const Slice &slice = *pu.cs->slice; @@ -545,11 +471,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); bool bioApplied = false; -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if (pu.cs->sps->getBDOFEnabledFlag() && (!pu.cs->slice->getDisBdofDmvrFlag())) -#else - if (pu.cs->sps->getBDOFEnabledFlag()) -#endif { if (pu.cu->affine || m_subPuMC) { @@ -562,23 +484,17 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) if (biocheck0 && biocheck1 && PU::isBiPredFromDifferentDir(pu) -#if JVET_O0634_BDOF_SIZE_CONSTRAINT && (pu.Y().height >= 8) && (pu.Y().width >= 8) && ((pu.Y().height * pu.Y().width) >= 128) -#else - && pu.Y().height != 4 -#endif ) { bioApplied = true; } } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (bioApplied && pu.mhIntraFlag) bioApplied = false; -#endif if (bioApplied && pu.cu->smvdMode) { @@ -596,11 +512,9 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) bool dmvrApplied = false; dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); -#if JVET_O1164_RPR bool samePicSize = PU::isRefPicSameSize( pu ); dmvrApplied = dmvrApplied && samePicSize; bioApplied = bioApplied && samePicSize; -#endif for (uint32_t refList = 0; refList < NUM_REF_PIC_LIST_01; refList++) { @@ -623,15 +537,11 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) if (pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0) { if (dmvrApplied) -#if JVET_O0108_DIS_DMVR_BDOF_CIIP { if (yuvPredTmp) xPredInterUni(pu, eRefPicList, pcMbBuf, true, false, true, true); continue; } -#else - continue; // mc will happen in processDMVR -#endif xPredInterUni ( pu, eRefPicList, pcMbBuf, true , bioApplied , true, true @@ -664,38 +574,28 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) if( !pu.cu->triangle && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->GBiIdx==GBI_DEFAULT) { xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred ); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvPredTmp) yuvPredTmp->copyFrom(pcYuvPred); -#endif } else if( !pu.cu->triangle && pps.getUseWP() && slice.getSliceType() == P_SLICE ) { xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred ); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvPredTmp) yuvPredTmp->copyFrom(pcYuvPred); -#endif } else { if (dmvrApplied) { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvPredTmp) { yuvPredTmp->addAvg(srcPred0, srcPred1, slice.clpRngs(), false); } -#endif xProcessDMVR(pu, pcYuvPred, slice.clpRngs(), bioApplied); } else { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied, yuvPredTmp); -#else - xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied ); -#endif } } } @@ -703,9 +603,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) void InterPrediction::xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng , const bool& bioApplied , bool isIBC -#if JVET_O1164_RPR , const std::pair<int, int> scalingRatio -#endif , SizeType dmvrWidth , SizeType dmvrHeight , bool bilinearMC @@ -724,17 +622,10 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio Mv mv(_mv); if( !isIBC && pu.cs->sps->getWrapAroundEnabledFlag() ) { -#if JVET_O1164_PS wrapRef = wrapClipMv( mv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps ); -#else - wrapRef = wrapClipMv( mv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps ); -#endif } -#if JVET_O1164_RPR -#if JVET_O0057_ALTHPELIF bool useAltHpelIf = pu.cu->imv == IMV_HPEL; -#endif if( !isIBC && xPredInterBlkRPR( scalingRatio, *pu.cs->pps, CompArea( compID, chFmt, pu.blocks[compID], Size( dstPic.bufs[compID].width, dstPic.bufs[compID].height ) ), refPic, mv, dstPic.bufs[compID].buf, dstPic.bufs[compID].stride, bi, wrapRef, clpRng, 0, useAltHpelIf ) ) { @@ -743,7 +634,6 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio } else { -#endif int xFrac = mv.hor & ((1 << shiftHor) - 1); int yFrac = mv.ver & ((1 << shiftVer) - 1); if (isIBC) @@ -793,25 +683,14 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio dstBuf.buf = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + 2 * dstBuf.stride + 2; } -#if JVET_O0057_ALTHPELIF && !JVET_O1164_RPR - bool useAltHpelIf = pu.cu->imv == IMV_HPEL; -#endif if( yFrac == 0 ) { -#if JVET_O0057_ALTHPELIF m_if.filterHor(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, xFrac, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf); -#else - m_if.filterHor(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, xFrac, rndRes, chFmt, clpRng, bilinearMC, bilinearMC); -#endif } else if( xFrac == 0 ) { -#if JVET_O0057_ALTHPELIF m_if.filterVer(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, true, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf); -#else - m_if.filterVer(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, true, rndRes, chFmt, clpRng, bilinearMC, bilinearMC); -#endif } else { @@ -824,29 +703,17 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio { vFilterSize = NTAPS_BILINEAR; } -#if JVET_O0057_ALTHPELIF m_if.filterHor(compID, (Pel*)refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf); -#else - m_if.filterHor(compID, (Pel*)refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, chFmt, clpRng, bilinearMC, bilinearMC); -#endif JVET_J0090_SET_CACHE_ENABLE( false ); -#if JVET_O0057_ALTHPELIF m_if.filterVer(compID, (Pel*)tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf); -#else - m_if.filterVer(compID, (Pel*)tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng, bilinearMC, bilinearMC); -#endif } JVET_J0090_SET_CACHE_ENABLE( srcPadStride == 0 ); // Enabled only in non-DMVR process, In DMVR process, srcPadStride is always non-zero if (bioApplied && compID == COMPONENT_Y) { const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)); -#if JVET_O0594_BDOF_REF_SAMPLE_PADDING int xOffset = (xFrac < 8) ? 1 : 0; int yOffset = (yFrac < 8) ? 1 : 0; const Pel* refPel = refBuf.buf - yOffset * refBuf.stride - xOffset; -#else - const Pel* refPel = refBuf.buf - refBuf.stride - 1; -#endif Pel* dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + dstBuf.stride + 1; for (int w = 0; w < (width - 2 * BIO_EXTEND_SIZE); w++) { @@ -854,11 +721,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio dstPel[w] = val - (Pel)IF_INTERNAL_OFFS; } -#if JVET_O0594_BDOF_REF_SAMPLE_PADDING refPel = refBuf.buf + (1 - yOffset)*refBuf.stride - xOffset; -#else - refPel = refBuf.buf - 1; -#endif dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + 2 * dstBuf.stride + 1; for (int h = 0; h < (height - 2 * BIO_EXTEND_SIZE - 2); h++) { @@ -872,11 +735,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio dstPel += dstBuf.stride; } -#if JVET_O0594_BDOF_REF_SAMPLE_PADDING refPel = refBuf.buf + (height - 2 * BIO_EXTEND_SIZE - 2 + 1 - yOffset)*refBuf.stride - xOffset; -#else - refPel = refBuf.buf + (height - 2 * BIO_EXTEND_SIZE - 2)*refBuf.stride - 1; -#endif dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + (height - 2 * BIO_EXTEND_SIZE)*dstBuf.stride + 1; for (int w = 0; w < (width - 2 * BIO_EXTEND_SIZE); w++) { @@ -890,9 +749,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio dstBuf.buf = backupDstBufPtr; dstBuf.stride = backupDstBufStride; } -#if JVET_O1164_RPR } -#endif } bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int d, int predType ) @@ -935,11 +792,7 @@ bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int return false; } -#if JVET_O1164_RPR void InterPrediction::xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const std::pair<int, int> scalingRatio ) -#else -void InterPrediction::xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng ) -#endif { JVET_J0090_SET_REF_PICTURE( refPic, compID ); @@ -987,37 +840,23 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio const SPS &sps = *pu.cs->sps; const int iMvShift = 4; const int iOffset = 8; -#if JVET_O1164_PS const int iHorMax = ( pu.cs->pps->getPicWidthInLumaSamples() + iOffset - pu.Y().x - 1 ) << iMvShift; -#else - const int iHorMax = ( sps.getPicWidthInLumaSamples() + iOffset - pu.Y().x - 1 ) << iMvShift; -#endif const int iHorMin = ( -(int)pu.cs->pcv->maxCUWidth - iOffset - (int)pu.Y().x + 1 ) << iMvShift; -#if JVET_O1164_PS const int iVerMax = ( pu.cs->pps->getPicHeightInLumaSamples() + iOffset - pu.Y().y - 1 ) << iMvShift; -#else - const int iVerMax = ( sps.getPicHeightInLumaSamples() + iOffset - pu.Y().y - 1 ) << iMvShift; -#endif const int iVerMin = ( -(int)pu.cs->pcv->maxCUHeight - iOffset - (int)pu.Y().y + 1 ) << iMvShift; -#if !JVET_O0070_PROF - PelBuf tmpBuf = PelBuf(m_filteredBlockTmp[0][compID], pu.blocks[compID]); -#endif const int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; const int shift = iBit - 4 + MV_FRACTIONAL_BITS_INTERNAL; bool wrapRef = false; const bool subblkMVSpreadOverLimit = isSubblockVectorSpreadOverLimit( iDMvHorX, iDMvHorY, iDMvVerX, iDMvVerY, pu.interDir ); -#if JVET_O0070_PROF bool enablePROF = (sps.getUsePROF()) && (!m_skipPROF) && (compID == COMPONENT_Y); enablePROF &= !((pu.cu->affineType == AFFINEMODEL_6PARAM && _mv[0] == _mv[1] && _mv[0] == _mv[2]) || (pu.cu->affineType == AFFINEMODEL_4PARAM && _mv[0] == _mv[1])); enablePROF &= !subblkMVSpreadOverLimit; const int profThres = 1 << (iBit + (m_isBi ? 1 : 0)); enablePROF &= !m_encOnly || pu.cu->slice->getCheckLDC() || iDMvHorX > profThres || iDMvHorY > profThres || iDMvVerX > profThres || iDMvVerY > profThres || iDMvHorX < -profThres || iDMvHorY < -profThres || iDMvVerX < -profThres || iDMvVerY < -profThres; -#if JVET_O1164_RPR enablePROF &= pu.cs->pps->getPicWidthInLumaSamples() == refPic->getPicWidthInLumaSamples() && pu.cs->pps->getPicHeightInLumaSamples() == refPic->getPicHeightInLumaSamples(); -#endif if (compID == COMPONENT_Y) { @@ -1095,7 +934,6 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio g_pelBufOP.roundIntVector(dMvScaleVer, sz, shift, dmvLimit); } } -#endif // get prediction block by block for ( int h = 0; h < cxHeight; h += blockHeight ) { @@ -1126,11 +964,7 @@ 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_O1164_PS wrapRef = wrapClipMv( tmpMv, Position( pu.Y().x + w, pu.Y().y + h ), Size( blockWidth, blockHeight ), &sps, pu.cs->pps ); -#else - wrapRef = wrapClipMv( tmpMv, Position(pu.Y().x + w, pu.Y().y + h), Size(blockWidth, blockHeight), &sps); -#endif iMvScaleTmpHor = tmpMv.getHor(); iMvScaleTmpVer = tmpMv.getVer(); } @@ -1138,15 +972,11 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio { wrapRef = false; m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); -#if JVET_O1164_RPR if( scalingRatio == SCALE_1X ) { -#endif iMvScaleTmpHor = std::min<int>(iHorMax, std::max<int>(iHorMin, iMvScaleTmpHor)); iMvScaleTmpVer = std::min<int>(iVerMax, std::max<int>(iVerMin, iMvScaleTmpVer)); -#if JVET_O1164_RPR } -#endif } } else @@ -1156,37 +986,27 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio roundAffineMv(curMv.hor, curMv.ver, 1); if (sps.getWrapAroundEnabledFlag()) { -#if JVET_O1164_PS wrapRef = wrapClipMv( curMv, Position( pu.Y().x + ( w << iScaleX ), pu.Y().y + ( h << iScaleY ) ), Size( blockWidth << iScaleX, blockHeight << iScaleY ), &sps, pu.cs->pps ); -#else - wrapRef = wrapClipMv( curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), &sps); -#endif } else { wrapRef = false; -#if JVET_O1164_RPR if( scalingRatio == SCALE_1X ) { -#endif curMv.hor = std::min<int>(iHorMax, std::max<int>(iHorMin, curMv.hor)); curMv.ver = std::min<int>(iVerMax, std::max<int>(iVerMin, curMv.ver)); -#if JVET_O1164_RPR } -#endif } iMvScaleTmpHor = curMv.hor; iMvScaleTmpVer = curMv.ver; } -#if JVET_O1164_RPR if( xPredInterBlkRPR( scalingRatio, *pu.cs->pps, CompArea( compID, chFmt, pu.blocks[compID].offset( w, h ), Size( blockWidth, blockHeight ) ), refPic, Mv( iMvScaleTmpHor, iMvScaleTmpVer ), dstBuf.buf + w + h * dstBuf.stride, dstBuf.stride, bi, wrapRef, clpRng, 2 ) ) { CHECK( enablePROF, "PROF should be disabled with RPR" ); } else { -#endif // get the MV in high precision int xFrac, yFrac, xInt, yInt; @@ -1212,11 +1032,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio } const CPelBuf refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, pu.blocks[compID].offset(xInt + w, yInt + h), pu.blocks[compID] ), wrapRef ); -#if !JVET_O0070_PROF - PelBuf &dstBuf = dstPic.bufs[compID]; -#endif -#if JVET_O0070_PROF Pel* ref = (Pel*) refBuf.buf; Pel* dst = dstBuf.buf + w + h * dstBuf.stride; @@ -1231,40 +1047,22 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio dst = dstExtBuf.bufAt(PROF_BORDER_EXT_W, PROF_BORDER_EXT_H); dstStride = dstExtBuf.stride; } -#endif if ( yFrac == 0 ) { -#if JVET_O0070_PROF m_if.filterHor( compID, (Pel*) ref, refStride, dst, dstStride, bw, bh, xFrac, isLast, chFmt, clpRng); -#else - m_if.filterHor( compID, (Pel*) refBuf.buf, refBuf.stride, dstBuf.buf + w + h * dstBuf.stride, dstBuf.stride, blockWidth, blockHeight, xFrac, !bi, chFmt, clpRng ); -#endif } else if ( xFrac == 0 ) { -#if JVET_O0070_PROF m_if.filterVer( compID, (Pel*) ref, refStride, dst, dstStride, bw, bh, yFrac, true, isLast, chFmt, clpRng); -#else - m_if.filterVer( compID, (Pel*) refBuf.buf, refBuf.stride, dstBuf.buf + w + h * dstBuf.stride, dstBuf.stride, blockWidth, blockHeight, yFrac, true, !bi, chFmt, clpRng ); -#endif } else { -#if JVET_O0070_PROF m_if.filterHor( compID, (Pel*)ref - ((vFilterSize>>1) -1)*refStride, refStride, tmpBuf.buf, tmpBuf.stride, bw, bh+vFilterSize-1, xFrac, false, chFmt, clpRng); -#else - m_if.filterHor( compID, (Pel*) refBuf.buf - ((vFilterSize>>1) -1)*refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, blockWidth, blockHeight+vFilterSize-1, xFrac, false, chFmt, clpRng); -#endif JVET_J0090_SET_CACHE_ENABLE( false ); -#if JVET_O0070_PROF m_if.filterVer( compID, tmpBuf.buf + ((vFilterSize>>1) -1)*tmpBuf.stride, tmpBuf.stride, dst, dstStride, bw, bh, yFrac, false, isLast, chFmt, clpRng); -#else - m_if.filterVer( compID, tmpBuf.buf + ((vFilterSize>>1) -1)*tmpBuf.stride, tmpBuf.stride, dstBuf.buf + w + h * dstBuf.stride, dstBuf.stride, blockWidth, blockHeight, yFrac, false, !bi, chFmt, clpRng); -#endif JVET_J0090_SET_CACHE_ENABLE( true ); } -#if JVET_O0070_PROF if (enablePROF) { const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)); @@ -1313,10 +1111,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio destBuf.copyFrom(srcExtBuf); } } -#endif -#if JVET_O1164_RPR } -#endif } } } @@ -1370,15 +1165,6 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf const int shiftNum = IF_INTERNAL_PREC + 1 - bitDepth; const int offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS; const int limit = (1<<(std::max<int>(5, bitDepth - 7))); -#if !JVET_O0304_SIMPLIFIED_BDOF - int* dotProductTemp1 = m_dotProduct1; - int* dotProductTemp2 = m_dotProduct2; - int* dotProductTemp3 = m_dotProduct3; - int* dotProductTemp5 = m_dotProduct5; - int* dotProductTemp6 = m_dotProduct6; - - xCalcBIOPar(srcY0Temp, srcY1Temp, gradX0, gradX1, gradY0, gradY1, dotProductTemp1, dotProductTemp2, dotProductTemp3, dotProductTemp5, dotProductTemp6, src0Stride, src1Stride, widthG, widthG, heightG, bitDepth); -#endif int xUnit = (width >> 2); int yUnit = (height >> 2); @@ -1391,44 +1177,6 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf { for (int xu = 0; xu < xUnit; xu++) { -#if !JVET_O0055_INT_DMVR_DIS_BDOF - if (m_bioPredSubBlkDist[yu*xUnit + xu] < m_bioSubBlkDistThres) - { - srcY0Temp = srcY0 + (stridePredMC + 1) + ((yu*src0Stride + xu) << 2); - srcY1Temp = srcY1 + (stridePredMC + 1) + ((yu*src1Stride + xu) << 2); - dstY0 = dstY + ((yu*dstStride + xu) << 2); - PelBuf dstPelBuf(dstY0, dstStride, Size(4, 4)); - dstPelBuf.addAvg(CPelBuf(srcY0Temp, src0Stride, Size(4, 4)), CPelBuf(srcY1Temp, src1Stride, Size(4, 4)), clpRng); - continue; - } -#endif -#if !JVET_O0304_SIMPLIFIED_BDOF - int sGxdI = 0, sGydI = 0, sGxGy = 0, sGx2 = 0, sGy2 = 0; - int tmpx = 0, tmpy = 0; - - dotProductTemp1 = m_dotProduct1 + offsetPos + ((yu*widthG + xu) << 2); - dotProductTemp2 = m_dotProduct2 + offsetPos + ((yu*widthG + xu) << 2); - dotProductTemp3 = m_dotProduct3 + offsetPos + ((yu*widthG + xu) << 2); - dotProductTemp5 = m_dotProduct5 + offsetPos + ((yu*widthG + xu) << 2); - dotProductTemp6 = m_dotProduct6 + offsetPos + ((yu*widthG + xu) << 2); - - xCalcBlkGradient(xu << 2, yu << 2, dotProductTemp1, dotProductTemp2, dotProductTemp3, dotProductTemp5, dotProductTemp6, sGx2, sGy2, sGxGy, sGxdI, sGydI, widthG, heightG, (1 << 2)); - - if (sGx2 > 0) - { - tmpx = rightShiftMSB(sGxdI << 3, sGx2); - tmpx = Clip3(-limit, limit, tmpx); - } - if (sGy2 > 0) - { - int mainsGxGy = sGxGy >> 12; - int secsGxGy = sGxGy & ((1 << 12) - 1); - int tmpData = tmpx * mainsGxGy; - tmpData = ((tmpData << 12) + tmpx*secsGxGy) >> 1; - tmpy = rightShiftMSB(((sGydI << 3) - tmpData), sGy2); - tmpy = Clip3(-limit, limit, tmpy); - } -#else int tmpx = 0, tmpy = 0; int sumAbsGX = 0, sumAbsGY = 0, sumDIX = 0, sumDIY = 0; int sumSignGY_GX = 0; @@ -1450,7 +1198,6 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf tmpData = ((tmpData << 12) + tmpx*secsGxGy) >> 1; tmpy = (sumAbsGY == 0 ? 0 : rightShiftMSB(((sumDIY << 3) - tmpData), sumAbsGY)); tmpy = Clip3(-limit, limit, tmpy); -#endif srcY0Temp = srcY0 + (stridePredMC + 1) + ((yu*src0Stride + xu) << 2); srcY1Temp = srcY1 + (stridePredMC + 1) + ((yu*src0Stride + xu) << 2); gradX0 = m_gradX0 + offsetPos + ((yu*widthG + xu) << 2); @@ -1465,41 +1212,6 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf } -#if !JVET_O0055_INT_DMVR_DIS_BDOF -bool InterPrediction::xCalcBiPredSubBlkDist(const PredictionUnit &pu, const Pel* pYuvSrc0, const int src0Stride, const Pel* pYuvSrc1, const int src1Stride, const BitDepths &clipBitDepths) -{ - const int width = pu.lwidth(); - const int height = pu.lheight(); - const int clipbd = clipBitDepths.recon[toChannelType(COMPONENT_Y)]; - const uint32_t distortionShift = DISTORTION_PRECISION_ADJUSTMENT(clipbd); - const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)); - const int xUnit = (width >> 2); - const int yUnit = (height >> 2); - - m_bioDistThres = (shift <= 5) ? (((32 << (clipbd - 8))*width*height) >> (5 - shift)) : (((32 << (clipbd - 8))*width*height) << (shift - 5)); - m_bioSubBlkDistThres = (shift <= 5) ? (((64 << (clipbd - 8)) << 4) >> (5 - shift)) : (((64 << (clipbd - 8)) << 4) << (shift - 5)); - - m_bioDistThres >>= distortionShift; - m_bioSubBlkDistThres >>= distortionShift; - - DistParam cDistParam; - Distortion dist = 0; - for (int yu = 0, blkIdx = 0; yu < yUnit; yu++) - { - for (int xu = 0; xu < xUnit; xu++, blkIdx++) - { - const Pel* pPred0 = pYuvSrc0 + ((yu*src0Stride + xu) << 2); - const Pel* pPred1 = pYuvSrc1 + ((yu*src1Stride + xu) << 2); - - m_pcRdCost->setDistParam(cDistParam, pPred0, pPred1, src0Stride, src1Stride, clipbd, COMPONENT_Y, (1 << 2), (1 << 2), 0, 1, false, true); - m_bioPredSubBlkDist[blkIdx] = cDistParam.distFunc(cDistParam); - dist += m_bioPredSubBlkDist[blkIdx]; - } - } - - return (dist >= m_bioDistThres); -} -#endif void InterPrediction::xAddBIOAvg4(const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng) { @@ -1521,44 +1233,26 @@ void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int g_pelBufOP.calcBlkGradient(sx, sy, arraysGx2, arraysGxGy, arraysGxdI, arraysGy2, arraysGydI, sGx2, sGy2, sGxGy, sGxdI, sGydI, width, height, unitSize); } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp /*= NULL*/) -#else -void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied ) -#endif { const int iRefIdx0 = pu.refIdx[0]; const int iRefIdx1 = pu.refIdx[1]; if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) { -#if JVET_O0070_PROF if (pu.cu->affine && (m_applyPROF[0] || m_applyPROF[1])) { xApplyBiPROF(pu, pcYuvSrc0.bufs[COMPONENT_Y], pcYuvSrc1.bufs[COMPONENT_Y], pcYuvDst.bufs[COMPONENT_Y], clpRngs.comp[COMPONENT_Y]); pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx, true); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP CHECK(yuvDstTmp, "yuvDstTmp is disallowed with PROF"); -#endif return; } -#endif -#if JVET_O0681_DIS_BPWA_CIIP if( pu.cu->GBiIdx != GBI_DEFAULT && (yuvDstTmp || !pu.mhIntraFlag) ) -#else - if( pu.cu->GBiIdx != GBI_DEFAULT ) -#endif { CHECK(bioApplied, "GBi is disallowed with BIO"); pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) -#if JVET_O0681_DIS_BPWA_CIIP yuvDstTmp->addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, false); -#else - yuvDstTmp->copyFrom(pcYuvDst); -#endif -#endif return; } if (bioApplied) @@ -1568,26 +1262,18 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB const Pel* pSrcY0 = m_filteredBlockTmp[2][COMPONENT_Y] + 2 * src0Stride + 2; const Pel* pSrcY1 = m_filteredBlockTmp[3][COMPONENT_Y] + 2 * src1Stride + 2; -#if JVET_O0055_INT_DMVR_DIS_BDOF bool bioEnabled = true; -#else - bool bioEnabled = xCalcBiPredSubBlkDist(pu, pSrcY0, src0Stride, pSrcY1, src1Stride, clipBitDepths); -#endif if (bioEnabled) { applyBiOptFlow(pu, pcYuvSrc0, pcYuvSrc1, iRefIdx0, iRefIdx1, pcYuvDst, clipBitDepths); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) yuvDstTmp->bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]); -#endif } else { pcYuvDst.bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) yuvDstTmp->bufs[0].copyFrom(pcYuvDst.bufs[0]); -#endif } } if (pu.cs->pps->getWPBiPred()) @@ -1608,7 +1294,6 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB { pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) { if (bioApplied) @@ -1619,7 +1304,6 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB else yuvDstTmp->copyFrom(pcYuvDst); } -#endif } else if( iRefIdx0 >= 0 && iRefIdx1 < 0 ) { @@ -1629,10 +1313,8 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB } else pcYuvDst.copyClip( pcYuvSrc0, clpRngs ); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) yuvDstTmp->copyFrom(pcYuvDst); -#endif } else if( iRefIdx0 < 0 && iRefIdx1 >= 0 ) { @@ -1642,14 +1324,11 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB } else pcYuvDst.copyClip( pcYuvSrc1, clpRngs ); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (yuvDstTmp) yuvDstTmp->copyFrom(pcYuvDst); -#endif } } -#if JVET_O0070_PROF void InterPrediction::xApplyBiPROF(const PredictionUnit &pu, const CPelBuf& pcYuvSrc0, const CPelBuf& pcYuvSrc1, PelBuf& pcYuvDst, const ClpRng& clpRng) { int blockWidth = AFFINE_MIN_BLOCK_SIZE; @@ -1765,20 +1444,14 @@ void InterPrediction::xApplyBiPROF(const PredictionUnit &pu, const CPelBuf& pcYu else g_pelBufOP.applyBiPROF[0](dstY, pcYuvDst.stride, srcY1, srcY0, pcYuvSrc0.stride, width, height, gX1, gY1, gX0, gY0, gradXExt0.stride, dMvX1, dMvY1, dMvX0, dMvY0, blockWidth, getGbiWeight(pu.cu->GBiIdx, REF_PIC_LIST_1), clpRng); } -#endif void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList , const bool luma, const bool chroma -#if JVET_O0108_DIS_DMVR_BDOF_CIIP , PelUnitBuf* predBufWOBIO /*= NULL*/ -#endif ) { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP CHECK(predBufWOBIO && pu.mhIntraFlag, "the case should not happen!"); -#endif -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!pu.cs->pcv->isEncoder) { if (CU::isIBC(*pu.cu)) @@ -1793,26 +1466,13 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu return; } } -#endif // dual tree handling for IBC as the only ref if ((!luma || !chroma) && eRefPicList == REF_PIC_LIST_0) { -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE - if (!luma && chroma) - { - xChromaMC(pu, predBuf); - return; - } - else // (luma && !chroma) - { -#endif xPredInterUni(pu, eRefPicList, predBuf, false , false , luma, chroma); return; -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE - } -#endif } // else, go with regular MC below CodingStructure &cs = *pu.cs; @@ -1821,9 +1481,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu if( eRefPicList != REF_PIC_LIST_X ) { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP CHECK(predBufWOBIO != NULL, "the case should not happen!"); -#endif if( ( ( sliceType == P_SLICE && pps.getUseWP() ) || ( sliceType == B_SLICE && pps.getWPBiPred() ) ) ) { xPredInterUni ( pu, eRefPicList, predBuf, true @@ -1852,11 +1510,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); bool bioApplied = false; const Slice &slice = *pu.cs->slice; -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if (pu.cs->sps->getBDOFEnabledFlag() && (!pu.cs->slice->getDisBdofDmvrFlag())) -#else - if (pu.cs->sps->getBDOFEnabledFlag()) -#endif { if (pu.cu->affine || m_subPuMC) @@ -1870,25 +1524,19 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu if (biocheck0 && biocheck1 && PU::isBiPredFromDifferentDir(pu) -#if JVET_O0634_BDOF_SIZE_CONSTRAINT && (pu.Y().height >= 8) && (pu.Y().width >= 8) && ((pu.Y().height * pu.Y().width) >= 128) -#else - && pu.Y().height != 4 -#endif ) { bioApplied = true; } } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (bioApplied && pu.mhIntraFlag) { bioApplied = false; } -#endif if (bioApplied && pu.cu->smvdMode) { @@ -1903,25 +1551,17 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu bioApplied = false; } } -#if JVET_O1164_RPR bioApplied = PU::isRefPicSameSize( pu ) ? bioApplied : false; -#endif bool dmvrApplied = false; dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); if ((pu.lumaSize().width > MAX_BDOF_APPLICATION_REGION || pu.lumaSize().height > MAX_BDOF_APPLICATION_REGION) && pu.mergeType != MRG_TYPE_SUBPU_ATMVP && (bioApplied && !dmvrApplied)) { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP xSubPuBio(pu, predBuf, eRefPicList, predBufWOBIO); -#else - xSubPuBio(pu, predBuf, eRefPicList); -#endif } else if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC) { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP CHECK(predBufWOBIO != NULL, "the case should not happen!"); -#endif xSubPuMC( pu, predBuf, eRefPicList ); } else if( xCheckIdenticalMotion( pu ) ) @@ -1930,18 +1570,12 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu , false , true, true ); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP if (predBufWOBIO) predBufWOBIO->copyFrom(predBuf); -#endif } else { -#if JVET_O0108_DIS_DMVR_BDOF_CIIP xPredInterBi(pu, predBuf, predBufWOBIO); -#else - xPredInterBi( pu, predBuf ); -#endif } } return; @@ -2014,123 +1648,27 @@ void InterPrediction::weightedTriangleBlk( PredictionUnit &pu, const bool splitD { if( channel == CHANNEL_TYPE_LUMA ) { -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING m_if.weightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); -#else - xWeightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); -#endif } else if( channel == CHANNEL_TYPE_CHROMA ) { -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); -#else - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); -#endif } else { -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING m_if.weightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); m_if.weightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); -#else - xWeightedTriangleBlk( pu, pu.lumaSize().width, pu.lumaSize().height, COMPONENT_Y, splitDir, predDst, predSrc0, predSrc1 ); - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cb, splitDir, predDst, predSrc0, predSrc1 ); - xWeightedTriangleBlk( pu, pu.chromaSize().width, pu.chromaSize().height, COMPONENT_Cr, splitDir, predDst, predSrc0, predSrc1 ); -#endif } } -#if !JVET_O0280_SIMD_TRIANGLE_WEIGHTING -void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) -{ - Pel* dst = predDst .get(compIdx).buf; - Pel* src0 = predSrc0.get(compIdx).buf; - Pel* src1 = predSrc1.get(compIdx).buf; - int32_t strideDst = predDst .get(compIdx).stride - width; - int32_t strideSrc0 = predSrc0.get(compIdx).stride - width; - int32_t strideSrc1 = predSrc1.get(compIdx).stride - width; - - const char log2WeightBase = 3; - const ClpRng clipRng = pu.cu->slice->clpRngs().comp[compIdx]; - const int32_t clipbd = clipRng.bd; - const int32_t shiftDefault = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)); - const int32_t offsetDefault = (1<<(shiftDefault-1)) + IF_INTERNAL_OFFS; - const int32_t shiftWeighted = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)) + log2WeightBase; - const int32_t offsetWeighted = (1 << (shiftWeighted - 1)) + (IF_INTERNAL_OFFS << log2WeightBase); - - const int32_t ratioWH = (width > height) ? (width / height) : 1; - const int32_t ratioHW = (width > height) ? 1 : (height / width); - - const bool longWeight = (compIdx == COMPONENT_Y); - 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; - int32_t weightedPosoffset =( splitDir == 0 ) ? ratioWH : -ratioWH; - - Pel tmpPelWeighted; - int32_t weightIdx; - int32_t x, y, tmpX, tmpY, tmpWeightedStart, tmpWeightedEnd; - - for( y = 0; y < height; y+= ratioHW ) - { - for( tmpY = ratioHW; tmpY > 0; tmpY-- ) - { - for( x = 0; x < weightedStartPos; x++ ) - { - *dst++ = ClipPel( rightShift( (splitDir == 0 ? *src1 : *src0) + offsetDefault, shiftDefault), clipRng ); - src0++; - src1++; - } - tmpWeightedStart = std::max((int32_t)0, weightedStartPos); - tmpWeightedEnd = std::min(weightedEndPos, (int32_t)(width - 1)); - weightIdx = 1; - if( weightedStartPos < 0 ) - { - weightIdx += abs(weightedStartPos) / ratioWH; - } - for( x = tmpWeightedStart; x <= tmpWeightedEnd; x+= ratioWH ) - { - for( tmpX = ratioWH; tmpX > 0; tmpX-- ) - { - tmpPelWeighted = Clip3( 1, 7, longWeight ? weightIdx : (weightIdx * 2)); - tmpPelWeighted = splitDir ? ( 8 - tmpPelWeighted ) : tmpPelWeighted; - *dst++ = ClipPel( rightShift( (tmpPelWeighted*(*src0++) + ((8 - tmpPelWeighted) * (*src1++)) + offsetWeighted), shiftWeighted ), clipRng ); - } - weightIdx ++; - } - - for( x = weightedEndPos + 1; x < width; x++ ) - { - *dst++ = ClipPel( rightShift( (splitDir == 0 ? *src0 : *src1) + offsetDefault, shiftDefault ), clipRng ); - src0++; - src1++; - } - - dst += strideDst; - src0 += strideSrc0; - src1 += strideSrc1; - } - weightedStartPos += weightedPosoffset; - weightedEndPos += weightedPosoffset; - } -} -#endif - -#if JVET_O0297_DMVR_PADDING // For Dec speedup void InterPrediction::xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId, bool forLuma) { int offset, width, height; Mv cMv; -#if JVET_O1164_RPR const Picture* refPic = pu.cu->slice->getRefPic( refId, pu.refIdx[refId] )->unscaledPic; -#else - const Picture* refPic = pu.cu->slice->getRefPic(refId, pu.refIdx[refId]); -#endif int mvShift = (MV_FRACTIONAL_BITS_INTERNAL); int start = 0; @@ -2153,7 +1691,6 @@ void InterPrediction::xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicLis cMv += Mv(-(((filtersize >> 1) - 1) << mvshiftTemp), -(((filtersize >> 1) - 1) << mvshiftTemp)); bool wrapRef = false; -#if JVET_O1164_PS if( pu.cs->sps->getWrapAroundEnabledFlag() ) { wrapRef = wrapClipMv( cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps ); @@ -2162,16 +1699,6 @@ void InterPrediction::xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicLis { clipMv( cMv, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps ); } -#else - if( pu.cs->sps->getWrapAroundEnabledFlag() ) - { - wrapRef = wrapClipMv( cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps); - } - else - { - clipMv(cMv, pu.lumaPos(), pu.lumaSize(),*pu.cs->sps); - } -#endif /* Pre-fetch similar to HEVC*/ { CPelBuf refBuf; @@ -2202,70 +1729,6 @@ void InterPrediction::xPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList ref } } } -#else -void InterPrediction::xPrefetchPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId) -{ - int offset, width, height; - int padsize; - Mv cMv; - const Picture* refPic = pu.cu->slice->getRefPic(refId, pu.refIdx[refId]); - int mvShift = (MV_FRACTIONAL_BITS_INTERNAL); - for (int compID = 0; compID < MAX_NUM_COMPONENT; compID++) - { - cMv = Mv(pu.mv[refId].getHor(), pu.mv[refId].getVer()); - pcPad.bufs[compID].stride = (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA); - int filtersize = (compID == (COMPONENT_Y)) ? NTAPS_LUMA : NTAPS_CHROMA; - width = pcPad.bufs[compID].width; - height = pcPad.bufs[compID].height; - offset = (DMVR_NUM_ITERATION) * (pcPad.bufs[compID].stride + 1); - padsize = (DMVR_NUM_ITERATION) >> getComponentScaleX((ComponentID)compID, pu.chromaFormat); - int mvshiftTemp = mvShift + getComponentScaleX((ComponentID)compID, pu.chromaFormat); - width += (filtersize - 1); - height += (filtersize - 1); - cMv += Mv(-(((filtersize >> 1) - 1) << mvshiftTemp), - -(((filtersize >> 1) - 1) << mvshiftTemp)); - bool wrapRef = false; - if( pu.cs->sps->getWrapAroundEnabledFlag() ) - { -#if JVET_O1164_PS - wrapRef = wrapClipMv( cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps ); -#else - wrapRef = wrapClipMv( cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps); -#endif - } - else - { -#if JVET_O1164_PS - clipMv( cMv, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#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); - refBuf = refPic->getRecoBuf(CompArea((ComponentID)compID, pu.chromaFormat, Rec_offset, pu.blocks[compID].size()), wrapRef); - 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 - JVET_J0090_SET_REF_PICTURE( refPic, (ComponentID)compID ); - for ( int row = 0 ; row < height ; row++ ) - { - for ( int col = 0 ; col < width ; col++ ) - { - JVET_J0090_CACHE_ACCESS( ((Pel *)refBuf.buf) + row * refBuf.stride + col, __FILE__, __LINE__ ); - } - } -#endif - } - /*padding on all side of size DMVR_PAD_LENGTH*/ - { - g_pelBufOP.padding(pcPad.bufs[compID].buf + offset, pcPad.bufs[compID].stride, width, height, padsize); - } - } -} -#endif inline int32_t div_for_maxq7(int64_t N, int64_t D) { int32_t sign, q; @@ -2382,9 +1845,7 @@ void InterPrediction::xBIPMVRefine(int bd, Pel *pRefL0, Pel *pRefL1, uint64_t& m void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvSrc0, PelUnitBuf &pcYuvSrc1, PelUnitBuf &pcPad0, PelUnitBuf &pcPad1, const bool bioApplied , const Mv mergeMV[NUM_REF_PIC_LIST_01] -#if JVET_O0297_DMVR_PADDING // For Dec speedup , bool blockMoved -#endif ) { int offset, deltaIntMvX, deltaIntMvY; @@ -2399,17 +1860,9 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu RefPicList refId = (RefPicList)k; Mv cMv = pu.mv[refId]; m_iRefListIdx = refId; -#if JVET_O1164_RPR const Picture* refPic = pu.cu->slice->getRefPic( refId, pu.refIdx[refId] )->unscaledPic; -#else - const Picture* refPic = pu.cu->slice->getRefPic(refId, pu.refIdx[refId]); -#endif Mv cMvClipped = cMv; -#if JVET_O1164_PS clipMv( cMvClipped, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(cMvClipped, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps); -#endif Mv startMv = mergeMV[refId]; @@ -2422,7 +1875,6 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu } for (int compID = 0; compID < MAX_NUM_COMPONENT; compID++) { -#if JVET_O0297_DMVR_PADDING // For Dec speedup Pel *srcBufPelPtr = NULL; int pcPadstride = 0; if (blockMoved || (compID == 0)) @@ -2452,39 +1904,8 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu srcBufPelPtr = (srcBuf.buf + offset); } -#if JVET_O1164_RPR xPredInterBlk( (ComponentID)compID, pu, refPic, cMvClipped, pcYUVTemp, true, pu.cs->slice->getClpRngs().comp[compID], bioApplied, false, pu.cu->slice->getScalingRatio( refId, pu.refIdx[refId] ), 0, 0, 0, srcBufPelPtr, pcPadstride ); -#else - xPredInterBlk((ComponentID)compID, pu, refPic, cMvClipped, pcYUVTemp, true, pu.cs->slice->getClpRngs().comp[compID], - bioApplied, false, 0, 0, 0, srcBufPelPtr, pcPadstride); -#endif -#else - int mvshiftTemp = mvShift + getComponentScaleX((ComponentID)compID, pu.chromaFormat); - int leftPixelExtra; - if (compID == COMPONENT_Y) - { - leftPixelExtra = (NTAPS_LUMA >> 1) - 1; - } - else - { - leftPixelExtra = (NTAPS_CHROMA >> 1) - 1; - } - - deltaIntMvX = (cMv.getHor() >> mvshiftTemp) - - (startMv.getHor() >> mvshiftTemp); - deltaIntMvY = (cMv.getVer() >> mvshiftTemp) - - (startMv.getVer() >> mvshiftTemp); - - CHECK((abs(deltaIntMvX) > DMVR_NUM_ITERATION) || (abs(deltaIntMvY) > DMVR_NUM_ITERATION), "not expected DMVR movement"); - - offset = (DMVR_NUM_ITERATION + leftPixelExtra) * (pcPadTemp.bufs[compID].stride + 1); - offset += (deltaIntMvY)* pcPadTemp.bufs[compID].stride; - offset += (deltaIntMvX); - PelBuf &srcBuf = pcPadTemp.bufs[compID]; - xPredInterBlk((ComponentID)compID, pu, refPic, cMvClipped, pcYUVTemp, true, pu.cs->slice->getClpRngs().comp[compID], - bioApplied, false, 0, 0, 0, (srcBuf.buf + offset), pcPadTemp.bufs[compID].stride); -#endif } pcYUVTemp = pcYuvSrc1; pcPadTemp = pcPad1; @@ -2530,13 +1951,8 @@ void InterPrediction::xinitMC(PredictionUnit& pu, const ClpRngs &clpRngs) Mv mergeMVL1(pu.mv[REF_PIC_LIST_1]); /*Clip the starting MVs*/ -#if JVET_O1164_PS clipMv( mergeMVL0, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps ); clipMv( mergeMVL1, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(mergeMVL0, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps); - clipMv(mergeMVL1, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps); -#endif /*L0 MC for refinement*/ { @@ -2547,21 +1963,11 @@ void InterPrediction::xinitMC(PredictionUnit& pu, const ClpRngs &clpRngs) offset += (-(int)DMVR_NUM_ITERATION); PelBuf srcBuf = m_cYuvRefBuffDMVRL0.bufs[COMPONENT_Y]; PelUnitBuf yuvPredTempL0 = PelUnitBuf(pu.chromaFormat, PelBuf(m_cYuvPredTempDMVRL0, -#if JVET_O0297_DMVR_PADDING // For Dec speedup m_biLinearBufStride -#else - (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)) -#endif , pu.lwidth() + (2 * DMVR_NUM_ITERATION), pu.lheight() + (2 * DMVR_NUM_ITERATION))); -#if JVET_O1164_RPR xPredInterBlk( COMPONENT_Y, pu, pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->unscaledPic, mergeMVL0, yuvPredTempL0, true, clpRngs.comp[COMPONENT_Y], false, false, pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ), pu.lwidth() + ( 2 * DMVR_NUM_ITERATION ), pu.lheight() + ( 2 * DMVR_NUM_ITERATION ), true, ( (Pel *)srcBuf.buf ) + offset, srcBuf.stride ); -#else - xPredInterBlk(COMPONENT_Y, pu, pu.cu->slice->getRefPic(REF_PIC_LIST_0, refIdx0), mergeMVL0, yuvPredTempL0, true, clpRngs.comp[COMPONENT_Y], - false, false, pu.lwidth() + (2 * DMVR_NUM_ITERATION), pu.lheight() + (2 * DMVR_NUM_ITERATION), true, ((Pel *)srcBuf.buf) + offset, srcBuf.stride - ); -#endif } /*L1 MC for refinement*/ @@ -2573,21 +1979,11 @@ void InterPrediction::xinitMC(PredictionUnit& pu, const ClpRngs &clpRngs) offset += (-(int)DMVR_NUM_ITERATION); PelBuf srcBuf = m_cYuvRefBuffDMVRL1.bufs[COMPONENT_Y]; PelUnitBuf yuvPredTempL1 = PelUnitBuf(pu.chromaFormat, PelBuf(m_cYuvPredTempDMVRL1, -#if JVET_O0297_DMVR_PADDING // For Dec speedup m_biLinearBufStride -#else - (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)) -#endif , pu.lwidth() + (2 * DMVR_NUM_ITERATION), pu.lheight() + (2 * DMVR_NUM_ITERATION))); -#if JVET_O1164_RPR xPredInterBlk( COMPONENT_Y, pu, pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->unscaledPic, mergeMVL1, yuvPredTempL1, true, clpRngs.comp[COMPONENT_Y], false, false, pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ), pu.lwidth() + ( 2 * DMVR_NUM_ITERATION ), pu.lheight() + ( 2 * DMVR_NUM_ITERATION ), true, ( (Pel *)srcBuf.buf ) + offset, srcBuf.stride ); -#else - xPredInterBlk(COMPONENT_Y, pu, pu.cu->slice->getRefPic(REF_PIC_LIST_1, refIdx1), mergeMVL1, yuvPredTempL1, true, clpRngs.comp[COMPONENT_Y], - false, false, pu.lwidth() + (2 * DMVR_NUM_ITERATION), pu.lheight() + (2 * DMVR_NUM_ITERATION), true, ((Pel *)srcBuf.buf) + offset, srcBuf.stride - ); -#endif } } @@ -2604,42 +2000,15 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con int dy = std::min<int>(pu.lumaSize().height, DMVR_SUBCU_HEIGHT); int dx = std::min<int>(pu.lumaSize().width, DMVR_SUBCU_WIDTH); -#if !JVET_O0297_DMVR_PADDING - /*L0 Padding*/ - m_cYuvRefBuffDMVRL0 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL0[0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL0[0], pcYuvDst.Y()), - PelBuf(m_cRefSamplesDMVRL0[1], pcYuvDst.Cb()), PelBuf(m_cRefSamplesDMVRL0[2], pcYuvDst.Cr()))); - - xPrefetchPad(pu, m_cYuvRefBuffDMVRL0, REF_PIC_LIST_0); - - /*L1 Padding*/ - m_cYuvRefBuffDMVRL1 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL1[0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL1[0], pcYuvDst.Y()), PelBuf(m_cRefSamplesDMVRL1[1], pcYuvDst.Cb()), - PelBuf(m_cRefSamplesDMVRL1[2], pcYuvDst.Cr()))); - - xPrefetchPad(pu, m_cYuvRefBuffDMVRL1, REF_PIC_LIST_1); - - JVET_J0090_SET_CACHE_ENABLE( false ); - xinitMC(pu, clpRngs); - - // point mc buffer to cetre point to avoid multiplication to reach each iteration to the begining - Pel *biLinearPredL0 = m_cYuvPredTempDMVRL0 + (DMVR_NUM_ITERATION * m_biLinearBufStride) + DMVR_NUM_ITERATION; - Pel *biLinearPredL1 = m_cYuvPredTempDMVRL1 + (DMVR_NUM_ITERATION * m_biLinearBufStride) + DMVR_NUM_ITERATION; -#endif Position puPos = pu.lumaPos(); int bd = pu.cs->slice->getClpRngs().comp[COMPONENT_Y].bd; -#if JVET_O0055_INT_DMVR_DIS_BDOF int bioEnabledThres = 2 * dy * dx; bool bioAppliedType[MAX_NUM_SUBCU_DMVR]; -#endif { int num = 0; -#if JVET_O0297_DMVR_PADDING // For Dec speedup int scaleX = getComponentScaleX(COMPONENT_Cb, pu.chromaFormat); int scaleY = getComponentScaleY(COMPONENT_Cb, pu.chromaFormat); m_biLinearBufStride = (dx + (2 * DMVR_NUM_ITERATION)); @@ -2670,49 +2039,19 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con srcPred0 = srcPred0.subBuf(UnitAreaRelative(pu, subPu)); srcPred1 = srcPred1.subBuf(UnitAreaRelative(pu, subPu)); -#endif int yStart = 0; for (int y = puPos.y; y < (puPos.y + pu.lumaSize().height); y = y + dy, yStart = yStart + dy) { for (int x = puPos.x, xStart = 0; x < (puPos.x + pu.lumaSize().width); x = x + dx, xStart = xStart + dx) { -#if JVET_O0297_DMVR_PADDING PredictionUnit subPu = pu; subPu.UnitArea::operator=(UnitArea(pu.chromaFormat, Area(x, y, dx, dy))); -#if! JVET_O0297_DMVR_PADDING // For Dec speedup - /*L0 Padding*/ -#if! JVET_O0297_DMVR_PADDING // For Dec speedup - m_cYuvRefBuffDMVRL0 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL0[0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL0[0], pcYuvDst.Y()), - PelBuf(m_cRefSamplesDMVRL0[1], pcYuvDst.Cb()), PelBuf(m_cRefSamplesDMVRL0[2], pcYuvDst.Cr()))); - m_cYuvRefBuffDMVRL0 = m_cYuvRefBuffDMVRL0.subBuf(UnitAreaRelative(pu, subPu)); -#endif - xPrefetchPad(subPu, m_cYuvRefBuffDMVRL0, REF_PIC_LIST_0); - - /*L1 Padding*/ -#if! JVET_O0297_DMVR_PADDING // For Dec speedup - m_cYuvRefBuffDMVRL1 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL1[0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_cRefSamplesDMVRL1[0], pcYuvDst.Y()), PelBuf(m_cRefSamplesDMVRL1[1], pcYuvDst.Cb()), - PelBuf(m_cRefSamplesDMVRL1[2], pcYuvDst.Cr()))); - m_cYuvRefBuffDMVRL1 = m_cYuvRefBuffDMVRL1.subBuf(UnitAreaRelative(pu, subPu)); -#endif - xPrefetchPad(subPu, m_cYuvRefBuffDMVRL1, REF_PIC_LIST_1); -#else xPrefetch(subPu, m_cYuvRefBuffDMVRL0, REF_PIC_LIST_0, 1); xPrefetch(subPu, m_cYuvRefBuffDMVRL1, REF_PIC_LIST_1, 1); -#endif xinitMC(subPu, clpRngs); -#if! JVET_O0297_DMVR_PADDING // For Dec speedup - // point mc buffer to cetre point to avoid multiplication to reach each iteration to the begining - Pel *biLinearPredL0 = m_cYuvPredTempDMVRL0 + (DMVR_NUM_ITERATION * m_biLinearBufStride) + DMVR_NUM_ITERATION; - Pel *biLinearPredL1 = m_cYuvPredTempDMVRL1 + (DMVR_NUM_ITERATION * m_biLinearBufStride) + DMVR_NUM_ITERATION; -#endif -#endif uint64_t minCost = MAX_UINT64; bool notZeroCost = true; int16_t totalDeltaMV[2] = { 0,0 }; @@ -2723,27 +2062,16 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con m_SADsArray[i] = MAX_UINT64; } pSADsArray = &m_SADsArray[(((2 * DMVR_NUM_ITERATION) + 1) * ((2 * DMVR_NUM_ITERATION) + 1)) >> 1]; -#if !JVET_O0297_DMVR_PADDING - Pel *addrL0Centre = biLinearPredL0 + yStart * m_biLinearBufStride + xStart; - Pel *addrL1Centre = biLinearPredL1 + yStart * m_biLinearBufStride + xStart; -#endif for (int i = 0; i < iterationCount; i++) { deltaMV[0] = 0; deltaMV[1] = 0; -#if JVET_O0297_DMVR_PADDING Pel *addrL0 = biLinearPredL0 + totalDeltaMV[0] + (totalDeltaMV[1] * m_biLinearBufStride); Pel *addrL1 = biLinearPredL1 - totalDeltaMV[0] - (totalDeltaMV[1] * m_biLinearBufStride); -#else - Pel *addrL0 = addrL0Centre + totalDeltaMV[0] + (totalDeltaMV[1] * m_biLinearBufStride); - Pel *addrL1 = addrL1Centre - totalDeltaMV[0] - (totalDeltaMV[1] * m_biLinearBufStride); -#endif if (i == 0) { minCost = xDMVRCost(clpRngs.comp[COMPONENT_Y].bd, addrL0, m_biLinearBufStride, addrL1, m_biLinearBufStride, dx, dy); -#if JVET_O0590_REDUCE_DMVR_ORIG_MV_COST minCost -= (minCost >>2); -#endif if (minCost < (dx * dy)) { notZeroCost = false; @@ -2768,29 +2096,14 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con pSADsArray += ((deltaMV[1] * (((2 * DMVR_NUM_ITERATION) + 1))) + deltaMV[0]); } -#if JVET_O0055_INT_DMVR_DIS_BDOF bioAppliedType[num] = (minCost < bioEnabledThres) ? false : bioApplied; -#endif totalDeltaMV[0] = (totalDeltaMV[0] << mvShift); totalDeltaMV[1] = (totalDeltaMV[1] << mvShift); xDMVRSubPixelErrorSurface(notZeroCost, totalDeltaMV, deltaMV, pSADsArray); pu.mvdL0SubPu[num] = Mv(totalDeltaMV[0], totalDeltaMV[1]); -#if JVET_O0297_DMVR_PADDING -#if! JVET_O0297_DMVR_PADDING // For Dec speedup - PelUnitBuf srcPred0 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvDst.Y()), PelBuf(m_acYuvPred[0][1], pcYuvDst.Cb()), PelBuf(m_acYuvPred[0][2], pcYuvDst.Cr()))); - PelUnitBuf srcPred1 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvDst.Y()), PelBuf(m_acYuvPred[1][1], pcYuvDst.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvDst.Cr()))); - - srcPred0 = srcPred0.subBuf(UnitAreaRelative(pu, subPu)); - srcPred1 = srcPred1.subBuf(UnitAreaRelative(pu, subPu)); -#endif PelUnitBuf subPredBuf = pcYuvDst.subBuf(UnitAreaRelative(pu, subPu)); -#if JVET_O0297_DMVR_PADDING // For Dec speedup bool blockMoved = false; if (pu.mvdL0SubPu[num] != Mv(0, 0)) { @@ -2800,7 +2113,6 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con xPad(subPu, m_cYuvRefBuffDMVRL0, REF_PIC_LIST_0); xPad(subPu, m_cYuvRefBuffDMVRL1, REF_PIC_LIST_1); } -#endif int dstStride[MAX_NUM_COMPONENT] = { pcYuvDst.bufs[COMPONENT_Y].stride, pcYuvDst.bufs[COMPONENT_Cb].stride, pcYuvDst.bufs[COMPONENT_Cr].stride }; subPu.mv[0] = mergeMv[REF_PIC_LIST_0] + pu.mvdL0SubPu[num]; @@ -2809,99 +2121,21 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con subPu.mv[0].clipToStorageBitDepth(); subPu.mv[1].clipToStorageBitDepth(); -#if JVET_O0055_INT_DMVR_DIS_BDOF xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffDMVRL0, m_cYuvRefBuffDMVRL1, bioAppliedType[num], mergeMv -#else - xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffDMVRL0, m_cYuvRefBuffDMVRL1, bioApplied, mergeMv -#endif -#if JVET_O0297_DMVR_PADDING // For Dec speedup , blockMoved -#endif ); subPredBuf.bufs[COMPONENT_Y].buf = pcYuvDst.bufs[COMPONENT_Y].buf + xStart + yStart * dstStride[COMPONENT_Y]; -#if !JVET_O0297_DMVR_PADDING // For Dec speedup - int scaleX = getComponentScaleX(COMPONENT_Cb, pu.chromaFormat); - int scaleY = getComponentScaleY(COMPONENT_Cb, pu.chromaFormat); -#endif subPredBuf.bufs[COMPONENT_Cb].buf = pcYuvDst.bufs[COMPONENT_Cb].buf + (xStart >> scaleX) + ((yStart >> scaleY) * dstStride[COMPONENT_Cb]); -#if !JVET_O0297_DMVR_PADDING // For Dec speedup - scaleX = getComponentScaleX(COMPONENT_Cr, pu.chromaFormat); - scaleY = getComponentScaleY(COMPONENT_Cr, pu.chromaFormat); -#endif subPredBuf.bufs[COMPONENT_Cr].buf = pcYuvDst.bufs[COMPONENT_Cr].buf + (xStart >> scaleX) + ((yStart >> scaleY) * dstStride[COMPONENT_Cr]); -#if JVET_O0055_INT_DMVR_DIS_BDOF xWeightedAverage(subPu, srcPred0, srcPred1, subPredBuf, subPu.cu->slice->getSPS()->getBitDepths(), subPu.cu->slice->clpRngs(), bioAppliedType[num]); -#else - xWeightedAverage(subPu, srcPred0, srcPred1, subPredBuf, subPu.cu->slice->getSPS()->getBitDepths(), subPu.cu->slice->clpRngs(), bioApplied); -#endif -#endif num++; } } } -#if !JVET_O0297_DMVR_PADDING - { - PredictionUnit subPu = pu; - subPu.UnitArea::operator=(UnitArea(pu.chromaFormat, Area(puPos.x, puPos.y, dx, dy))); - PelUnitBuf m_cYuvRefBuffSubCuDMVRL0; - PelUnitBuf m_cYuvRefBuffSubCuDMVRL1; - PelUnitBuf srcPred0 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[0][0], pcYuvDst.Y()), PelBuf(m_acYuvPred[0][1], pcYuvDst.Cb()), PelBuf(m_acYuvPred[0][2], pcYuvDst.Cr()))); - PelUnitBuf srcPred1 = (pu.chromaFormat == CHROMA_400 ? - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvDst.Y())) : - PelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvDst.Y()), PelBuf(m_acYuvPred[1][1], pcYuvDst.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvDst.Cr()))); - - srcPred0 = srcPred0.subBuf(UnitAreaRelative(pu, subPu)); - srcPred1 = srcPred1.subBuf(UnitAreaRelative(pu, subPu)); - PelUnitBuf subPredBuf = pcYuvDst.subBuf(UnitAreaRelative(pu, subPu)); - - int x = 0, y = 0; - int xStart = 0, yStart = 0; - int num = 0; - - int dstStride[MAX_NUM_COMPONENT] = { pcYuvDst.bufs[COMPONENT_Y].stride, pcYuvDst.bufs[COMPONENT_Cb].stride, pcYuvDst.bufs[COMPONENT_Cr].stride }; - for (y = puPos.y; y < (puPos.y + pu.lumaSize().height); y = y + dy, yStart = yStart + dy) - { - for (x = puPos.x, xStart = 0; x < (puPos.x + pu.lumaSize().width); x = x + dx, xStart = xStart + dx) - { - subPu.UnitArea::operator=(UnitArea(pu.chromaFormat, Area(x, y, dx, dy))); - - subPu.mv[0] = mergeMv[REF_PIC_LIST_0] + pu.mvdL0SubPu[num]; - subPu.mv[1] = mergeMv[REF_PIC_LIST_1] - pu.mvdL0SubPu[num]; - subPu.mv[0].clipToStorageBitDepth(); - subPu.mv[1].clipToStorageBitDepth(); - m_cYuvRefBuffSubCuDMVRL0 = m_cYuvRefBuffDMVRL0.subBuf(UnitAreaRelative(pu, subPu)); - m_cYuvRefBuffSubCuDMVRL1 = m_cYuvRefBuffDMVRL1.subBuf(UnitAreaRelative(pu, subPu)); -#if JVET_O0055_INT_DMVR_DIS_BDOF - xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffSubCuDMVRL0, m_cYuvRefBuffSubCuDMVRL1, bioAppliedType[num], mergeMv); -#else - xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffSubCuDMVRL0, m_cYuvRefBuffSubCuDMVRL1, bioApplied, mergeMv); -#endif - - subPredBuf.bufs[COMPONENT_Y].buf = pcYuvDst.bufs[COMPONENT_Y].buf + xStart + yStart * dstStride[COMPONENT_Y]; - 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]); - - 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]); - -#if JVET_O0055_INT_DMVR_DIS_BDOF - xWeightedAverage(subPu, srcPred0, srcPred1, subPredBuf, subPu.cu->slice->getSPS()->getBitDepths(), subPu.cu->slice->clpRngs(), bioAppliedType[num]); -#else - xWeightedAverage(subPu, srcPred0, srcPred1, subPredBuf, subPu.cu->slice->getSPS()->getBitDepths(), subPu.cu->slice->clpRngs(), bioApplied); -#endif - num++; - } - } - } -#endif JVET_J0090_SET_CACHE_ENABLE(true); } #if JVET_J0090_MEMORY_BANDWITH_MEASURE @@ -2913,7 +2147,6 @@ void InterPrediction::cacheAssign( CacheModel *cache ) } #endif -#if JVET_O1170_IBC_VIRTUAL_BUFFER void InterPrediction::xFillIBCBuffer(CodingUnit &cu) { for (auto &currPU : CU::traverseTUs(cu)) @@ -2980,7 +2213,6 @@ void InterPrediction::xIntraBlockCopy(PredictionUnit &pu, PelUnitBuf &predBuf, c } } -#if JVET_O1170_CHECK_BV_AT_DECODER void InterPrediction::resetIBCBuffer(const ChromaFormat chromaFormatIDC, const int ctuSize) { const UnitArea area = UnitArea(chromaFormatIDC, Area(0, 0, m_IBCBufferWidth, ctuSize)); @@ -3014,10 +2246,7 @@ bool InterPrediction::isLumaBvValid(const int ctuSize, const int xCb, const int } return true; } -#endif -#endif -#if JVET_O1164_RPR bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, const PPS& pps, const CompArea &blk, const Picture* refPic, const Mv& mv, Pel* dst, const int dstStride, const bool bi, const bool wrapRef, const ClpRng& clpRng, const int filterIndex, const bool useAltHpelIf ) { const ChromaFormat chFmt = blk.chromaFormat; @@ -3053,7 +2282,6 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, y0Int = ( ( blk.pos().y << ( 4 + ::getComponentScaleY( compID, chFmt ) ) ) + mv.getVer() )* (int64_t)scalingRatio.second; y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + ::getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + ::getComponentScaleY( compID, chFmt ) ) ); -#if RPR_BUFFER const int extSize = isLuma( compID ) ? 1 : 2; int vFilterSize = isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA; @@ -3110,60 +2338,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, Position offset = Position( xInt, yInt ); refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, offset, Size( 1, 1 ) ), wrapRef ); -#else - for( row = 0; row < height; row++ ) - { - for( col = 0; col < width; col++ ) - { - // pixel position in the current picture - int posX = (int32_t)x0Int + col * stepX; - int posY = (int32_t)y0Int + row * stepY; - - // integer reference position in the reference frame - int xInt = ( posX + offX ) >> posShift; - int yInt = ( posY + offY ) >> posShift; - - xInt = std::min( std::max( 0, xInt ), ( refPicWidth >> ::getComponentScaleX( compID, chFmt ) ) ); - yInt = std::min( std::max( 0, yInt ), ( refPicHeight >> ::getComponentScaleY( compID, chFmt ) ) ); - - // fractional position in the reference frame - int xFrac = ( ( posX + offX ) >> ( posShift - shiftHor ) ) & ( ( 1 << shiftHor ) - 1 ); - int yFrac = ( ( posY + offY ) >> ( posShift - shiftVer ) ) & ( ( 1 << shiftVer ) - 1 ); - - Position offset = Position( xInt, yInt ); - - refBuf = refPic->getRecoBuf( CompArea( compID, chFmt, offset, Size( 1, 1 ) ), wrapRef ); - - Pel* tempDstBuf = dst + col + row * dstStride; - - //--------------------------------copied from the "refPicWidth == curPicWidth" branch-------------------------------------------- - if( yFrac == 0 ) - { - m_if.filterHor( compID, (Pel*)refBuf.buf, refBuf.stride, /*dstBuf.buf*/tempDstBuf, dstStride, /*backupWidth*/1, /*backupHeight*/1, xFrac, rndRes, chFmt, clpRng, filterIndex, false, useAltHpelIf ); - } - else if( xFrac == 0 ) - { - m_if.filterVer( compID, (Pel*)refBuf.buf, refBuf.stride, /*dstBuf.buf*/tempDstBuf, dstStride, /*backupWidth*/1, /*backupHeight*/1, yFrac, true, rndRes, chFmt, clpRng, filterIndex, false, useAltHpelIf ); - } - else - { - PelBuf tmpBuf = PelBuf( m_filteredBlockTmp[0][compID], blk ); - tmpBuf.stride = dstStride; - - int vFilterSize = isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA; - - m_if.filterHor( compID, (Pel*)refBuf.buf - ( ( vFilterSize >> 1 ) - 1 ) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, /*backupWidth*/1, /*backupHeight*/1 + vFilterSize - 1, xFrac, false, chFmt, clpRng, filterIndex, false, useAltHpelIf ); - - JVET_J0090_SET_CACHE_ENABLE( false ); - m_if.filterVer( compID, (Pel*)tmpBuf.buf + ( ( vFilterSize >> 1 ) - 1 ) * tmpBuf.stride, tmpBuf.stride, /*dstBuf.buf*/tempDstBuf, dstStride, /*backupWidth*/1, /*backupHeight*/1, yFrac, false, rndRes, chFmt, clpRng, filterIndex, false, useAltHpelIf ); - JVET_J0090_SET_CACHE_ENABLE( true ); - } - //-------------------------------------------------------------------------------- - } - } -#endif } return scaled; } -#endif diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 65cfe502b625a3746672a91b9a4c4c2d604f1a01..350f30d1336826374f1b247c046a3dfcdbeb3bef 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -65,19 +65,7 @@ class InterPrediction : public WeightPrediction private: int m_shareState; -#if !JVET_O0055_INT_DMVR_DIS_BDOF - Distortion m_bioDistThres; - Distortion m_bioSubBlkDistThres; - Distortion m_bioPredSubBlkDist[MAX_NUM_PARTS_IN_CTU]; -#endif -#if !JVET_O0304_SIMPLIFIED_BDOF - int m_dotProduct1[BIO_TEMP_BUFFER_SIZE]; - int m_dotProduct2[BIO_TEMP_BUFFER_SIZE]; - int m_dotProduct3[BIO_TEMP_BUFFER_SIZE]; - int m_dotProduct5[BIO_TEMP_BUFFER_SIZE]; - int m_dotProduct6[BIO_TEMP_BUFFER_SIZE]; -#endif protected: InterpolationFilter m_if; @@ -112,14 +100,12 @@ protected: Mv(-2, 2), Mv(-1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2) }; uint64_t m_SADsArray[((2 * DMVR_NUM_ITERATION) + 1) * ((2 * DMVR_NUM_ITERATION) + 1)]; -#if JVET_O0070_PROF Pel m_gradBuf[2][2][(MAX_CU_SIZE + 2) * (MAX_CU_SIZE + 2)]; int m_dMvBuf[2][16 * 2]; bool m_applyPROF[2]; bool m_skipPROF; bool m_encOnly; bool m_isBi; -#endif Pel* m_gradX0; Pel* m_gradY0; @@ -127,31 +113,20 @@ protected: Pel* m_gradY1; bool m_subPuMC; -#if JVET_O1170_IBC_VIRTUAL_BUFFER int m_IBCBufferWidth; PelStorage m_IBCBuffer; void xIntraBlockCopy (PredictionUnit &pu, PelUnitBuf &predBuf, const ComponentID compID); -#endif int rightShiftMSB(int numer, int denom); void applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf &yuvSrc0, const CPelUnitBuf &yuvSrc1, const int &refIdx0, const int &refIdx1, PelUnitBuf &yuvDst, const BitDepths &clipBitDepths); -#if !JVET_O0055_INT_DMVR_DIS_BDOF - bool xCalcBiPredSubBlkDist(const PredictionUnit &pu, const Pel* yuvSrc0, const int src0Stride, const Pel* yuvSrc1, const int src1Stride, const BitDepths &clipBitDepths); -#endif void xPredInterUni ( const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi , const bool& bioApplied , const bool luma, const bool chroma ); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp = NULL ); -#else - void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred ); -#endif void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng , const bool& bioApplied , bool isIBC -#if JVET_O1164_RPR , const std::pair<int, int> scalingRatio = SCALE_1X -#endif , SizeType dmvrWidth = 0 , SizeType dmvrHeight = 0 , bool bilinearMC = false @@ -163,37 +138,20 @@ protected: void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth); void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth); void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp = NULL ); -#else - void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied ); -#endif -#if JVET_O0070_PROF void xApplyBiPROF (const PredictionUnit& pu, const CPelBuf& pcYuvSrc0, const CPelBuf& pcYuvSrc1, PelBuf& pcYuvDst, const ClpRng& clpRng); -#endif -#if JVET_O1164_RPR void xPredAffineBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const std::pair<int, int> scalingRatio = SCALE_1X ); -#else - void xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng ); -#endif void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); static bool xCheckIdenticalMotion( const PredictionUnit& pu ); void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X, PelUnitBuf* yuvDstTmp = NULL); -#else - void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); -#endif void destroy(); MotionInfo m_SubPuMiBuf[(MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1)]; -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE - void xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred); -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE CacheModel *m_cacheModel; #endif @@ -201,18 +159,12 @@ public: InterPrediction(); virtual ~InterPrediction(); -#if JVET_O1170_IBC_VIRTUAL_BUFFER void init (RdCost* pcRdCost, ChromaFormat chromaFormatIDC, const int ctuSize); -#else - void init (RdCost* pcRdCost, ChromaFormat chromaFormatIDC); -#endif // inter void motionCompensation (PredictionUnit &pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X , const bool luma = true, const bool chroma = true -#if JVET_O0108_DIS_DMVR_BDOF_CIIP , PelUnitBuf* predBufWOBIO = NULL -#endif ); void motionCompensation (PredictionUnit &pu, const RefPicList &eRefPicList = REF_PIC_LIST_X , const bool luma = true, const bool chroma = true @@ -223,17 +175,11 @@ public: void motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ); void weightedTriangleBlk ( PredictionUnit &pu, const bool splitDir, int32_t channel, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); -#if JVET_O0297_DMVR_PADDING // For Dec speedup void xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId, bool forLuma); void xPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId); -#else - void xPrefetchPad(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicList refId); -#endif void xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvSrc0, PelUnitBuf &pcYuvSrc1, PelUnitBuf &pcPad0, PelUnitBuf &pcPad1, const bool bioApplied , const Mv startMV[NUM_REF_PIC_LIST_01] -#if JVET_O0297_DMVR_PADDING // For Dec speedup , bool blockMoved -#endif ); void xBIPMVRefine(int bd, Pel *pRefL0, Pel *pRefL1, uint64_t& minCost, int16_t *deltaMV, uint64_t *pSADsArray, int width, int height); uint64_t xDMVRCost(int bitDepth, Pel* pRef, uint32_t refStride, const Pel* pOrg, uint32_t orgStride, int width, int height); @@ -248,18 +194,12 @@ public: int getShareState() const { return m_shareState; } #endif static bool isSubblockVectorSpreadOverLimit( int a, int b, int c, int d, int predType ); -#if JVET_O1170_IBC_VIRTUAL_BUFFER void xFillIBCBuffer(CodingUnit &cu); -#if JVET_O1170_CHECK_BV_AT_DECODER void resetIBCBuffer(const ChromaFormat chromaFormatIDC, const int ctuSize); void resetVPDUforIBC(const ChromaFormat chromaFormatIDC, const int ctuSize, const int vSize, const int xPos, const int yPos); bool isLumaBvValid(const int ctuSize, const int xCb, const int yCb, const int width, const int height, const int xBv, const int yBv); -#endif -#endif -#if JVET_O1164_RPR bool xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, const PPS& pps, const CompArea &blk, const Picture* refPic, const Mv& mv, Pel* dst, const int dstStride, const bool bi, const bool wrapRef, const ClpRng& clpRng, const int filterIndex, const bool useAltHpelIf = false ); -#endif }; //! \} diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp index 004e432f09bed5fb31d12369b64e330bb36efbe2..1b0a09738af87c7ae5ee3df93342434857f1d6fe 100644 --- a/source/Lib/CommonLib/InterpolationFilter.cpp +++ b/source/Lib/CommonLib/InterpolationFilter.cpp @@ -94,9 +94,7 @@ const TFilterCoeff InterpolationFilter::m_lumaFilter[LUMA_INTERPOLATION_FILTER_S { 0, 1, -2, 4, 63, -3, 1, 0 } }; -#if JVET_O0057_ALTHPELIF const TFilterCoeff InterpolationFilter::m_lumaAltHpelIFilter[NTAPS_LUMA] = { 0, 3, 9, 20, 20, 9, 3, 0 }; -#endif const TFilterCoeff InterpolationFilter::m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA] = { { 0, 64, 0, 0 }, @@ -213,9 +211,7 @@ InterpolationFilter::InterpolationFilter() m_filterCopy[1][0] = filterCopy<true, false>; m_filterCopy[1][1] = filterCopy<true, true>; -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING m_weightedTriangleBlk = xWeightedTriangleBlk; -#endif } @@ -580,11 +576,7 @@ void InterpolationFilter::filterVer(const ClpRng& clpRng, Pel const *src, int sr * \param fmt Chroma format * \param bitDepth Bit depth */ -#if JVET_O0057_ALTHPELIF void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR, bool useAltHpelIf) -#else -void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR) -#endif { if( frac == 0 ) { @@ -597,21 +589,17 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i { filterHor<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR); } -#if JVET_O1164_RPR else if( nFilterIdx == 2 ) { filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter4x4[frac], biMCForDMVR ); } -#endif else { -#if JVET_O0057_ALTHPELIF if (frac == 8 && useAltHpelIf) { filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaAltHpelIFilter, biMCForDMVR); } else -#endif { if ((width == 4 && height == 4) || (width == 4 && height == (4 + NTAPS_LUMA - 1))) { @@ -649,11 +637,7 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i * \param fmt Chroma format * \param bitDepth Bit depth */ -#if JVET_O0057_ALTHPELIF void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR, bool useAltHpelIf) -#else -void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR) -#endif { if( frac == 0 ) { @@ -666,21 +650,17 @@ void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, i { filterVer<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR); } -#if JVET_O1164_RPR else if( nFilterIdx == 2 ) { filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter4x4[frac], biMCForDMVR ); } -#endif else { -#if JVET_O0057_ALTHPELIF if (frac == 8 && useAltHpelIf) { filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaAltHpelIFilter, biMCForDMVR); } else -#endif { if (width == 4 && height == 4) { @@ -701,7 +681,6 @@ void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, i } } -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING void InterpolationFilter::xWeightedTriangleBlk( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ) { Pel* dst = predDst .get(compIdx).buf; @@ -781,7 +760,6 @@ void InterpolationFilter::weightedTriangleBlk(const PredictionUnit &pu, const ui { m_weightedTriangleBlk(pu, width, height, compIdx, splitDir, predDst, predSrc0, predSrc1); } -#endif /** * \brief turn on SIMD fuc diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h index 03079addd0bef814e514db95269550e5a630f59c..14f49ec4d994f536459216ec3aa0c974fa35941f 100644 --- a/source/Lib/CommonLib/InterpolationFilter.h +++ b/source/Lib/CommonLib/InterpolationFilter.h @@ -56,17 +56,11 @@ class InterpolationFilter { static const TFilterCoeff m_lumaFilter4x4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; -#if JVET_O1164_RPR public: -#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 -#if JVET_O1164_RPR private: -#endif -#if JVET_O0057_ALTHPELIF static const TFilterCoeff m_lumaAltHpelIFilter[NTAPS_LUMA]; ///< Luma filter taps -#endif static const TFilterCoeff m_bilinearFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps static const TFilterCoeff m_bilinearFilterPrec4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps public: @@ -81,10 +75,8 @@ public: template<int N> void filterVer(const ClpRng& clpRng, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff, bool biMCForDMVR); -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING static void xWeightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); void weightedTriangleBlk(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif protected: #if JVET_J0090_MEMORY_BANDWITH_MEASURE static CacheModel* m_cacheModel; @@ -95,9 +87,7 @@ public: void( *m_filterHor[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); void( *m_filterVer[3][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, TFilterCoeff const *coeff, bool biMCForDMVR); void( *m_filterCopy[2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, bool biMCForDMVR); -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING void( *m_weightedTriangleBlk )(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1); -#endif void initInterpolationFilter( bool enable ); #ifdef TARGET_SIMD_X86 @@ -105,13 +95,8 @@ public: template <X86_VEXT vext> void _initInterpolationFilterX86(); #endif -#if JVET_O0057_ALTHPELIF void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false, bool useAltHpelIf = false); void filterVer(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false, bool useAltHpelIf = false); -#else - void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false); - void filterVer(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false); -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE void cacheAssign( CacheModel *cache ) { m_cacheModel = cache; } #endif diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index afe12bf8ca2ba58369aa1d27b104925aec722e10..56ba627b164ad57d15ab32d1b0c7160b88f3f863 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -57,15 +57,9 @@ const uint8_t IntraPrediction::m_aucIntraFilter[MAX_INTRA_FILTER_DEPTHS] = { -#if JVET_O0277_INTRA_SMALL_BLOCK_DCTIF 24, // 1xn 24, // 2xn 24, // 4xn -#else - 20, // 1xn - 20, // 2xn - 20, // 4xn -#endif 14, // 8xn 2, // 16xn 0, // 32xn @@ -116,15 +110,6 @@ IntraPrediction::IntraPrediction() : m_currChromaFormat( NUM_CHROMA_FORMAT ) { -#if !FLATTEN_BUFFERS - for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++) - { - for (uint32_t buf = 0; buf < NUM_PRED_BUF; buf++) - { - m_piYuvExt[ch][buf] = nullptr; - } - } -#endif for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++) { for (uint32_t buf = 0; buf < 4; buf++) @@ -136,10 +121,8 @@ IntraPrediction::IntraPrediction() m_piTemp = nullptr; m_pMdlmTemp = nullptr; -#if JVET_O0119_BASE_PALETTE_444 m_runTypeRD = nullptr; m_runLengthRD = nullptr; -#endif } IntraPrediction::~IntraPrediction() @@ -149,16 +132,6 @@ IntraPrediction::~IntraPrediction() void IntraPrediction::destroy() { -#if !FLATTEN_BUFFERS - for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++) - { - for (uint32_t buf = 0; buf < NUM_PRED_BUF; buf++) - { - delete[] m_piYuvExt[ch][buf]; - m_piYuvExt[ch][buf] = nullptr; - } - } -#endif for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++) { for (uint32_t buf = 0; buf < 4; buf++) @@ -172,21 +145,12 @@ void IntraPrediction::destroy() m_piTemp = nullptr; delete[] m_pMdlmTemp; m_pMdlmTemp = nullptr; -#if JVET_O0119_BASE_PALETTE_444 if (m_runTypeRD) { xFree( m_runTypeRD ); m_runTypeRD = NULL; } if (m_runLengthRD) { xFree( m_runLengthRD); m_runLengthRD = NULL; } -#endif } void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepthY) { -#if !FLATTEN_BUFFERS - // if it has been initialised before, but the chroma format has changed, release the memory and start again. - if (m_piYuvExt[COMPONENT_Y][PRED_BUF_UNFILTERED] != nullptr && m_currChromaFormat != chromaFormatIDC) - { - destroy(); - } -#endif if (m_yuvExt2[COMPONENT_Y][0] != nullptr && m_currChromaFormat != chromaFormatIDC) { @@ -195,24 +159,6 @@ void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepth m_currChromaFormat = chromaFormatIDC; -#if !FLATTEN_BUFFERS - if (m_piYuvExt[COMPONENT_Y][PRED_BUF_UNFILTERED] == nullptr) // check if first is null (in which case, nothing initialised yet) - { -#if JVET_O0364_PADDING - m_iYuvExtSize = (MAX_CU_SIZE * 2 + 1 + MAX_REF_LINE_IDX) * (MAX_CU_SIZE * 2 + 1 + MAX_REF_LINE_IDX); -#else - m_iYuvExtSize = (MAX_CU_SIZE * 2 + 1 + MAX_REF_LINE_IDX * 33) * (MAX_CU_SIZE * 2 + 1 + MAX_REF_LINE_IDX * 33); -#endif - - for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++) - { - for (uint32_t buf = 0; buf < NUM_PRED_BUF; buf++) - { - m_piYuvExt[ch][buf] = new Pel[m_iYuvExtSize]; - } - } - } -#endif if (m_yuvExt2[COMPONENT_Y][0] == nullptr) // check if first is null (in which case, nothing initialised yet) { @@ -235,7 +181,6 @@ void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepth { m_pMdlmTemp = new Pel[(2 * MAX_CU_SIZE + 1)*(2 * MAX_CU_SIZE + 1)];//MDLM will use top-above and left-below samples. } -#if JVET_O0119_BASE_PALETTE_444 if (m_runTypeRD == nullptr) { m_runTypeRD = (bool *) xMalloc(bool, MAX_CU_SIZE * MAX_CU_SIZE); @@ -244,7 +189,6 @@ void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepth { m_runLengthRD = (Pel *) xMalloc(Pel, MAX_CU_SIZE * MAX_CU_SIZE); } -#endif } // ==================================================================================================================== @@ -269,26 +213,14 @@ Pel IntraPrediction::xGetPredValDc( const CPelBuf &pSrc, const Size &dstSize ) { for( idx = 0; idx < width; idx++ ) { -#if JVET_O0426_MRL_REF_SAMPLES_DC_MODE sum += pSrc.at(m_ipaParam.multiRefIndex + 1 + idx, 0); -#else - sum += pSrc.at( 1 + idx, 0 ); -#endif } } if ( width <= height ) { for( idx = 0; idx < height; idx++ ) { -#if JVET_O0426_MRL_REF_SAMPLES_DC_MODE -#if FLATTEN_BUFFERS sum += pSrc.at(m_ipaParam.multiRefIndex + 1 + idx, 1); -#else - sum += pSrc.at(0, m_ipaParam.multiRefIndex + 1 + idx); -#endif -#else - sum += pSrc.at( 0, 1 + idx ); -#endif } } @@ -336,28 +268,10 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co CHECK( floorLog2(iWidth) < 2 && pu.cs->pcv->noChroma2x2, "Size not allowed" ); CHECK( floorLog2(iWidth) > 7, "Size not allowed" ); -#if FLATTEN_BUFFERS const int srcStride = m_refBufferStride[compID]; const int srcHStride = 2; -#else - const int multiRefIdx = m_ipaParam.multiRefIndex; -#if JVET_O0364_PADDING - const int srcStride = m_topRefLength + 1 + multiRefIdx; - const int srcHStride = m_leftRefLength + 1 + multiRefIdx; -#else - const int whRatio = m_ipaParam.whRatio; - const int hwRatio = m_ipaParam.hwRatio; - - const int srcStride = m_topRefLength + 1 + (whRatio + 1) * multiRefIdx; - const int srcHStride = m_leftRefLength + 1 + (hwRatio + 1) * multiRefIdx; -#endif -#endif -#if JVET_O0502_ISP_CLEANUP && !FLATTEN_BUFFERS - const CPelBuf& srcBuf = pu.cu->ispMode && isLuma(compID) ? getISPBuffer() : CPelBuf(getPredictorPtr(compID), srcStride, srcHStride); -#else const CPelBuf & srcBuf = CPelBuf(getPredictorPtr(compID), srcStride, srcHStride); -#endif const ClpRng& clpRng(pu.cu->cs->slice->clpRng(compID)); switch (uiDirMode) @@ -374,20 +288,12 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co const int scale = ((floorLog2(iWidth) - 2 + floorLog2(iHeight) - 2 + 2) >> 2); CHECK(scale < 0 || scale > 31, "PDPC: scale < 0 || scale > 31"); -#if JVET_O0364_PDPC_DC if (uiDirMode == PLANAR_IDX || uiDirMode == DC_IDX) -#else - if (uiDirMode == PLANAR_IDX) -#endif { for (int y = 0; y < iHeight; y++) { const int wT = 32 >> std::min(31, ((y << 1) >> scale)); -#if FLATTEN_BUFFERS const Pel left = srcBuf.at(y + 1, 1); -#else - const Pel left = srcBuf.at(0, y + 1); -#endif for (int x = 0; x < iWidth; x++) { const int wL = 32 >> std::min(31, ((x << 1) >> scale)); @@ -397,24 +303,6 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co } } } -#if !JVET_O0364_PDPC_DC - else if (uiDirMode == DC_IDX) - { - const Pel topLeft = srcBuf.at(0, 0); - for (int y = 0; y < iHeight; y++) - { - int wT = 32 >> std::min(31, ((y << 1) >> scale)); - const Pel left = srcBuf.at(0, y + 1); - for (int x = 0; x < iWidth; x++) - { - const Pel top = srcBuf.at(x + 1, 0); - int wL = 32 >> std::min(31, ((x << 1) >> scale)); - int wTL = (wL >> 4) + (wT >> 4); - dstBuf.at(x, y) = ClipPel((wL * left + wT * top - wTL * topLeft + (64 - wL - wT + wTL) * dstBuf.at(x, y) + 32) >> 6, clpRng); - } - } - } -#endif } } @@ -448,8 +336,14 @@ void IntraPrediction::xPredIntraPlanar( const CPelBuf &pSrc, PelBuf &pDst ) { const uint32_t width = pDst.width; const uint32_t height = pDst.height; + +#if JVET_P0329_PLANAR_SIMPLIFICATION + const uint32_t log2W = floorLog2( width ); + const uint32_t log2H = floorLog2( height ); +#else const uint32_t log2W = floorLog2(width < 2 ? 2 : width); const uint32_t log2H = floorLog2(height < 2 ? 2 : height); +#endif int leftColumn[MAX_CU_SIZE + 1], topRow[MAX_CU_SIZE + 1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE]; const uint32_t offset = 1 << (log2W + log2H); @@ -462,11 +356,7 @@ void IntraPrediction::xPredIntraPlanar( const CPelBuf &pSrc, PelBuf &pDst ) for( int k = 0; k < height + 1; k++ ) { -#if FLATTEN_BUFFERS leftColumn[k] = pSrc.at(k + 1, 1); -#else - leftColumn[k] = pSrc.at( 0, k + 1 ); -#endif } // Prepare intermediate variables used in interpolation @@ -522,19 +412,11 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA const int dirMode = PU::getFinalIntraMode(pu, chType); const int predMode = getWideAngle( blockSize.width, blockSize.height, dirMode ); -#if !JVET_O0364_PADDING - m_ipaParam.whRatio = std::max( unsigned( 1 ), blockSize.width / blockSize.height ) ; - m_ipaParam.hwRatio = std::max( unsigned( 1 ), blockSize.height / blockSize.width ) ; -#endif m_ipaParam.isModeVer = predMode >= DIA_IDX; m_ipaParam.multiRefIndex = isLuma (chType) ? pu.multiRefIdx : 0 ; m_ipaParam.refFilterFlag = false; m_ipaParam.interpolationFlag = false; -#if JVET_O0502_ISP_CLEANUP m_ipaParam.applyPDPC = ((puSize.width >= MIN_TB_SIZEY && puSize.height >= MIN_TB_SIZEY) || !isLuma(compId)) && m_ipaParam.multiRefIndex == 0; -#else - m_ipaParam.applyPDPC = !useISP && m_ipaParam.multiRefIndex == 0; -#endif const int intraPredAngleMode = (m_ipaParam.isModeVer) ? predMode - VER_IDX : -(predMode - HOR_IDX); @@ -543,14 +425,10 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA if (dirMode > DC_IDX && dirMode < NUM_LUMA_MODE) // intraPredAngle for directional modes { static const int angTable[32] = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 23, 26, 29, 32, 35, 39, 45, 51, 57, 64, 73, 86, 102, 128, 171, 256, 341, 512, 1024 }; -#if JVET_O0364_PADDING static const int invAngTable[32] = { 0, 16384, 8192, 5461, 4096, 2731, 2048, 1638, 1365, 1170, 1024, 910, 819, 712, 630, 565, 512, 468, 420, 364, 321, 287, 256, 224, 191, 161, 128, 96, 64, 48, 32, 16 }; // (512 * 32) / Angle -#else - static const int invAngTable[32] = { 0, 8192, 4096, 2731, 2048, 1365, 1024, 819, 683, 585, 512, 455, 410, 356, 315, 282, 256, 234, 210, 182, 161, 144, 128, 112, 95, 80, 64, 48, 32, 24, 16, 8 }; // (256 * 32) / Angle -#endif const int absAngMode = abs(intraPredAngleMode); const int signAng = intraPredAngleMode < 0 ? -1 : 1; @@ -558,7 +436,6 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA m_ipaParam.invAngle = invAngTable[absAngMode]; m_ipaParam.intraPredAngle = signAng * absAng; -#if JVET_O0364_PDPC_ANGULAR if (intraPredAngleMode < 0) { m_ipaParam.applyPDPC = false; @@ -568,35 +445,20 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA const int sideSize = m_ipaParam.isModeVer ? puSize.height : puSize.width; const int maxScale = 2; -#if JVET_O0364_PADDING m_ipaParam.angularScale = std::min(maxScale, floorLog2(sideSize) - (floorLog2(3 * m_ipaParam.invAngle - 2) - 8)); -#else - m_ipaParam.angularScale = std::min(maxScale, floorLog2(sideSize) - (floorLog2(3 * m_ipaParam.invAngle - 2) - 7)); -#endif m_ipaParam.applyPDPC &= m_ipaParam.angularScale >= 0; } -#else - m_ipaParam.applyPDPC &= m_ipaParam.intraPredAngle == 0 || m_ipaParam.intraPredAngle >= 12; // intra prediction modes: HOR, VER, x, where x>=VDIA-8 or x<=2+8 -#endif } // high level conditions and DC intra prediction if( sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag() || !isLuma( chType ) || useISP -#if JVET_O0925_MIP_SIMPLIFICATIONS || PU::isMIP( pu, chType ) -#endif || m_ipaParam.multiRefIndex || DC_IDX == dirMode ) { -#if !JVET_O0502_ISP_CLEANUP - if (useISP) - { - m_ipaParam.interpolationFlag = (m_ipaParam.isModeVer ? puSize.width : puSize.height) > 8 ? true : false ; - } -#endif } else if (isLuma( chType ) && pu.cu->bdpcmMode) // BDPCM { @@ -609,19 +471,8 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA else if (!useISP)// HOR, VER and angular modes (MDIS) { bool filterFlag = false; -#if !JVET_O0277_INTRA_SMALL_BLOCK_DCTIF - if (predMode != dirMode ) // wide-anlge mode { - filterFlag = true; - } - else -#endif - { -#if JVET_O0277_INTRA_SMALL_BLOCK_DCTIF const int diff = std::min<int>( abs( predMode - HOR_IDX ), abs( predMode - VER_IDX ) ); -#else - const int diff = std::min<int>( abs( dirMode - HOR_IDX ), abs( dirMode - VER_IDX ) ); -#endif const int log2Size = ((floorLog2(puSize.width) + floorLog2(puSize.height)) >> 1); CHECK( log2Size >= MAX_INTRA_FILTER_DEPTHS, "Size not supported" ); filterFlag = (diff > m_aucIntraFilter[log2Size]); @@ -631,12 +482,8 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA if (filterFlag) { const bool isRefFilter = isIntegerSlope(absAng); -#if JVET_O0277_INTRA_SMALL_BLOCK_DCTIF CHECK( puSize.width * puSize.height <= 32, "DCT-IF interpolation filter is always used for 4x4, 4x8, and 8x4 luma CB" ); m_ipaParam.refFilterFlag = isRefFilter; -#else - m_ipaParam.refFilterFlag = isRefFilter && puSize.width * puSize.height > 32; -#endif m_ipaParam.interpolationFlag = !isRefFilter; } } @@ -661,10 +508,6 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch int height=int(pDst.height); const bool bIsModeVer = m_ipaParam.isModeVer; -#if !JVET_O0364_PADDING - const int whRatio = m_ipaParam.whRatio; - const int hwRatio = m_ipaParam.hwRatio; -#endif const int multiRefIdx = m_ipaParam.multiRefIndex; const int intraPredAngle = m_ipaParam.intraPredAngle; const int invAngle = m_ipaParam.invAngle; @@ -678,18 +521,13 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch // Initialize the Main and Left reference array. if (intraPredAngle < 0) { -#if JVET_O0364_PADDING for (int x = 0; x <= width + 1 + multiRefIdx; x++) { refAbove[x + height] = pSrc.at(x, 0); } for (int y = 0; y <= height + 1 + multiRefIdx; y++) { -#if FLATTEN_BUFFERS refLeft[y + width] = pSrc.at(y, 1); -#else - refLeft[y + width] = pSrc.at(0, y); -#endif } refMain = bIsModeVer ? refAbove + height : refLeft + width; refSide = bIsModeVer ? refLeft + width : refAbove + height; @@ -700,48 +538,16 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch { refMain[k] = refSide[std::min((-k * invAngle + 256) >> 9, sizeSide)]; } -#else - const int width = pDst.width + 1; - const int height = pDst.height + 1; - const int lastIdx = (bIsModeVer ? width : height) + multiRefIdx; - const int firstIdx = (((bIsModeVer ? height : width) - 1) * intraPredAngle) >> 5; - - for (int x = 0; x < width + 1 + multiRefIdx; x++) - { - refAbove[x + height - 1] = pSrc.at( x, 0 ); - } - for (int y = 0; y < height + 1 + multiRefIdx; y++) - { - refLeft[y + width - 1] = pSrc.at( 0, y ); - } - refMain = (bIsModeVer ? refAbove + height : refLeft + width ) - 1; - refSide = (bIsModeVer ? refLeft + width : refAbove + height) - 1; - - // Extend the Main reference to the left. - int invAngleSum = 128; // rounding for (shift by 8) - for( int k = -1; k > firstIdx; k-- ) - { - invAngleSum += invAngle; - refMain[k] = refSide[invAngleSum>>8]; - } - refMain[lastIdx] = refMain[lastIdx-1]; - refMain[firstIdx] = refMain[firstIdx+1]; -#endif } else { -#if JVET_O0364_PADDING for (int x = 0; x <= m_topRefLength + multiRefIdx; x++) { refAbove[x] = pSrc.at(x, 0); } for (int y = 0; y <= m_leftRefLength + multiRefIdx; y++) { -#if FLATTEN_BUFFERS refLeft[y] = pSrc.at(y, 1); -#else - refLeft[y] = pSrc.at(0, y); -#endif } refMain = bIsModeVer ? refAbove : refLeft; @@ -757,24 +563,6 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch { refMain[refLength + multiRefIdx + z] = val; } -#else - for (int x = 0; x < m_topRefLength + 1 + (whRatio + 1) * multiRefIdx; x++) - { - refAbove[x+1] = pSrc.at(x, 0); - } - for (int y = 0; y < m_leftRefLength + 1 + (hwRatio + 1) * multiRefIdx; y++) - { - refLeft[y+1] = pSrc.at(0, y); - } - refMain = bIsModeVer ? refAbove : refLeft ; - refSide = bIsModeVer ? refLeft : refAbove; - - refMain++; - refSide++; - refMain[-1] = refMain[0]; - auto lastIdx = 1 + ((bIsModeVer) ? m_topRefLength + (whRatio + 1) * multiRefIdx : m_leftRefLength + (hwRatio + 1) * multiRefIdx); - refMain[lastIdx] = refMain[lastIdx-1]; -#endif } // swap width/height if we are doing a horizontal mode: @@ -840,11 +628,7 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch p[0] = refMain[deltaInt + x]; p[1] = refMain[deltaInt + x + 1]; p[2] = refMain[deltaInt + x + 2]; -#if JVET_O0364_PADDING p[3] = refMain[deltaInt + x + 3]; -#else - p[3] = f[3] != 0 ? refMain[deltaInt + x + 3] : 0; -#endif Pel val = (f[0] * p[0] + f[1] * p[1] + f[2] * p[2] + f[3] * p[3] + 32) >> 6; @@ -873,83 +657,20 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch pDsty[x] = refMain[x + deltaInt + 1]; } } -#if JVET_O0364_PDPC_ANGULAR if (m_ipaParam.applyPDPC) { const int scale = m_ipaParam.angularScale; -#if JVET_O0364_PADDING int invAngleSum = 256; -#else - int invAngleSum = 128; -#endif for (int x = 0; x < std::min(3 << scale, width); x++) { invAngleSum += invAngle; int wL = 32 >> (2 * x >> scale); -#if JVET_O0364_PADDING Pel left = refSide[y + (invAngleSum >> 9) + 1]; -#else - Pel left = refSide[y + (invAngleSum >> 8) + 1]; -#endif pDsty[x] = pDsty[x] + ((wL * (left - pDsty[x]) + 32) >> 6); } } -#else - const int scale = ((floorLog2(width) - 2 + floorLog2(height) - 2 + 2) >> 2); - CHECK(scale < 0 || scale > 31, "PDPC: scale < 0 || scale > 31"); - if (m_ipaParam.applyPDPC) - { - if (m_ipaParam.intraPredAngle == 32) // intra prediction modes: 2 and VDIA - { - int wT = 16 >> std::min(31, ((y << 1) >> scale)); - - for (int x = 0; x < width; x++) - { - int wL = 16 >> std::min(31, ((x << 1) >> scale)); - if (wT + wL == 0) break; - - int c = x + y + 1; - if (c >= 2 * height) { wL = 0; } - if (c >= 2 * width) { wT = 0; } - const Pel left = (wL != 0) ? refSide[c + 1] : 0; - const Pel top = (wT != 0) ? refMain[c + 1] : 0; - - pDsty[x] = ClipPel((wL * left + wT * top + (64 - wL - wT) * pDsty[x] + 32) >> 6, clpRng); - } - } - else - { -#if JVET_O0364_PADDING - int invAngleSum0 = 4; -#else - int invAngleSum0 = 2; -#endif - for (int x = 0; x < width; x++) - { - invAngleSum0 += invAngle; -#if JVET_O0364_PADDING - int deltaPos0 = invAngleSum0 >> 3; -#else - int deltaPos0 = invAngleSum0 >> 2; -#endif - int deltaFrac0 = deltaPos0 & 63; - int deltaInt0 = deltaPos0 >> 6; - - int deltay = y + deltaInt0 + 1; - if (deltay >(bIsModeVer ? m_leftRefLength : m_topRefLength) - 1) break; - - int wL = 32 >> std::min(31, ((x << 1) >> scale)); - if (wL == 0) break; - Pel *p = refSide + deltay; - - Pel left = p[deltaFrac0 >> 5]; - pDsty[x] = ClipPel((wL * left + (64 - wL) * pDsty[x] + 32) >> 6, clpRng); - } - } - } -#endif } } @@ -983,11 +704,7 @@ void IntraPrediction::xPredIntraBDPCM(const CPelBuf &pSrc, PelBuf &pDst, const u Pel val; for( int y = 0; y < hgt; y++ ) { -#if FLATTEN_BUFFERS val = pSrc.buf[(y + 1) + strideS]; -#else - val = pSrc.buf[(y + 1) * strideS]; -#endif for( int x = 0; x < wdt; x++ ) { pred[x] = val; @@ -1107,19 +824,10 @@ void IntraPrediction::initIntraPatternChType(const CodingUnit &cu, const CompAre initPredIntraParams(*cu.firstPU, area, *cs.sps); } -#if FLATTEN_BUFFERS Pel *refBufUnfiltered = m_refBuffer[area.compID][PRED_BUF_UNFILTERED]; Pel *refBufFiltered = m_refBuffer[area.compID][PRED_BUF_FILTERED]; -#else - Pel *refBufUnfiltered = m_piYuvExt[area.compID][PRED_BUF_UNFILTERED]; - Pel *refBufFiltered = m_piYuvExt[area.compID][PRED_BUF_FILTERED]; -#endif -#if JVET_O0502_ISP_CLEANUP setReferenceArrayLengths( area ); -#else - setReferenceArrayLengths( cu.ispMode && isLuma( area.compID ) ? cu.blocks[area.compID] : area ); -#endif // ----- Step 1: unfiltered reference samples ----- xFillReferenceSamples( cs.picture->getRecoBuf( area ), refBufUnfiltered, area, cu ); @@ -1130,7 +838,6 @@ void IntraPrediction::initIntraPatternChType(const CodingUnit &cu, const CompAre } } -#if JVET_O0502_ISP_CLEANUP void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const CompArea& area, PelBuf& recBuf, const bool forceRefFilterFlag) { const CodingStructure& cs = *cu.cs; @@ -1144,17 +851,9 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp bool isLeftAvail = cs.isDecomp(posLT.offset(-1, 0), CHANNEL_TYPE_LUMA); bool isAboveAvail = cs.isDecomp(posLT.offset(0, -1), CHANNEL_TYPE_LUMA); // ----- Step 1: unfiltered reference samples ----- -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN if (cu.blocks[area.compID].x == area.x && cu.blocks[area.compID].y == area.y) -#else - if (CU::isISPFirst(cu, area, area.compID)) -#endif { -#if FLATTEN_BUFFERS Pel *refBufUnfiltered = m_refBuffer[area.compID][PRED_BUF_UNFILTERED]; -#else - Pel* refBufUnfiltered = m_piYuvExt[area.compID][PRED_BUF_UNFILTERED]; -#endif // With the first subpartition all the CU reference samples are fetched at once in a single call to xFillReferenceSamples if (cu.ispMode == HOR_INTRA_SUBPARTITIONS) { @@ -1167,13 +866,6 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp m_topRefLength = cu.Y().width << 1; } -#if !FLATTEN_BUFFERS - const int srcStride = m_topRefLength + 1; - const int srcHStride = m_leftRefLength + 1; - - m_pelBufISP[0] = m_pelBufISPBase[0] = PelBuf(m_piYuvExt[area.compID][PRED_BUF_UNFILTERED], srcStride, srcHStride); - m_pelBufISP[1] = m_pelBufISPBase[1] = PelBuf(m_piYuvExt[area.compID][PRED_BUF_FILTERED], srcStride, srcHStride); -#endif xFillReferenceSamples(cs.picture->getRecoBuf(cu.Y()), refBufUnfiltered, cu.Y(), cu); @@ -1183,15 +875,6 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp } else { -#if !FLATTEN_BUFFERS - //Now we only need to fetch the newly available reconstructed samples from the previously coded TU - Position tuPos = area; - tuPos.relativeTo(cu.Y()); - m_pelBufISP[0] = m_pelBufISPBase[0].subBuf(tuPos, area.size()); - m_pelBufISP[1] = m_pelBufISPBase[1].subBuf(tuPos, area.size()); - - PelBuf& dstBuf = m_pelBufISP[0]; -#endif m_topRefLength = cu.blocks[area.compID].width + area.width; m_leftRefLength = cu.blocks[area.compID].height + area.height; @@ -1201,7 +884,6 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp if (cu.ispMode == HOR_INTRA_SUBPARTITIONS) { Pel* src = recBuf.bufAt(0, -1); -#if FLATTEN_BUFFERS Pel *ref = m_refBuffer[area.compID][PRED_BUF_UNFILTERED] + m_refBufferStride[area.compID]; if (isLeftAvail) { @@ -1219,9 +901,6 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp } Pel *dst = m_refBuffer[area.compID][PRED_BUF_UNFILTERED] + 1; dst[-1] = ref[0]; -#else - Pel* dst = dstBuf.bufAt(1, 0); -#endif for (int i = 0; i < area.width; i++) { dst[i] = src[i]; @@ -1232,23 +911,10 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp { dst[i] = sample; } -#if !FLATTEN_BUFFERS - if (!isLeftAvail) //if left is not avaible, then it is necessary to fetch these samples for each subpartition - { - Pel* dst = dstBuf.bufAt(0, 0); - Pel sample = src[0]; - for (int i = 0; i < predSizeVer + 1; i++) - { - *dst = sample; - dst += dstBuf.stride; - } - } -#endif } else { Pel* src = recBuf.bufAt(-1, 0); -#if FLATTEN_BUFFERS Pel *ref = m_refBuffer[area.compID][PRED_BUF_UNFILTERED]; if (isAboveAvail) { @@ -1266,58 +932,29 @@ void IntraPrediction::initIntraPatternChTypeISP(const CodingUnit& cu, const Comp } Pel *dst = m_refBuffer[area.compID][PRED_BUF_UNFILTERED] + m_refBufferStride[area.compID] + 1; dst[-1] = ref[0]; -#else - Pel* dst = dstBuf.bufAt(0, 1); -#endif for (int i = 0; i < area.height; i++) { *dst = *src; src += recBuf.stride; -#if FLATTEN_BUFFERS dst++; -#else - dst += dstBuf.stride; -#endif } Pel sample = src[-recBuf.stride]; for (int i = 0; i < predSizeVer - area.height; i++) { *dst = sample; -#if FLATTEN_BUFFERS dst++; -#else - dst += dstBuf.stride; -#endif } -#if !FLATTEN_BUFFERS - if (!isAboveAvail) //if above is not avaible, then it is necessary to fetch these samples for each subpartition - { - Pel* dst = dstBuf.bufAt(0, 0); - Pel sample = recBuf.at(-1, 0); - for (int i = 0; i < predSizeHor + 1; i++) - { - dst[i] = sample; - } - } -#endif } } // ----- Step 2: filtered reference samples ----- if (m_ipaParam.refFilterFlag || forceRefFilterFlag) { -#if FLATTEN_BUFFERS Pel *refBufUnfiltered = m_refBuffer[area.compID][PRED_BUF_UNFILTERED]; Pel *refBufFiltered = m_refBuffer[area.compID][PRED_BUF_FILTERED]; xFilterReferenceSamples(refBufUnfiltered, refBufFiltered, area, *cs.sps, cu.firstPU->multiRefIdx); -#else - Pel* refBufUnfiltered = m_pelBufISP[0].buf; - Pel* refBufFiltered = m_pelBufISP[1].buf; - xFilterReferenceSamples(refBufUnfiltered, refBufFiltered, area, *cs.sps, cu.firstPU->multiRefIdx, m_pelBufISP[0].stride); -#endif } } -#endif void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBufUnfiltered, const CompArea &area, const CodingUnit &cu ) @@ -1333,18 +970,8 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf const int tuHeight = area.height; const int predSize = m_topRefLength; const int predHSize = m_leftRefLength; -#if JVET_O0364_PADDING const int predStride = predSize + 1 + multiRefIdx; -#if FLATTEN_BUFFERS m_refBufferStride[area.compID] = predStride; -#endif -#else - const int cuWidth = cu.blocks[area.compID].width; - const int cuHeight = cu.blocks[area.compID].height; - const int whRatio = cu.ispMode && isLuma(area.compID) ? std::max(1, cuWidth / cuHeight) : std::max(1, tuWidth / tuHeight); - const int hwRatio = cu.ispMode && isLuma(area.compID) ? std::max(1, cuHeight / cuWidth) : std::max(1, tuHeight / tuWidth); - const int predStride = predSize + 1 + (whRatio + 1) * multiRefIdx; -#endif const bool noShift = pcv.noChroma2x2 && area.width == 4; // don't shift on the lowest level (chroma not-split) const int unitWidth = tuWidth <= 2 && cu.ispMode && isLuma(area.compID) ? tuWidth : pcv.minCUWidth >> (noShift ? 0 : getComponentScaleX(area.compID, sps.getChromaFormatIdc())); @@ -1378,9 +1005,6 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf numIntraNeighbor += isBelowLeftAvailable ( cu, chType, posLB, numLeftBelowUnits, unitHeight, (neighborFlags + totalLeftUnits - 1 - numLeftUnits) ); // ----- Step 2: fill reference samples (depending on neighborhood) ----- -#if !FLATTEN_BUFFERS - CHECK((predHSize + 1) * predStride > m_iYuvExtSize, "Reference sample area not supported"); -#endif const Pel* srcBuf = recoBuf.buf; const int srcStride = recoBuf.stride; @@ -1393,29 +1017,20 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf { // Fill border with DC value for (int j = 0; j <= predSize + multiRefIdx; j++) { ptrDst[j] = valueDC; } -#if FLATTEN_BUFFERS for (int i = 0; i <= predHSize + multiRefIdx; i++) { ptrDst[i + predStride] = valueDC; } -#else - for (int i = 1; i <= predHSize + multiRefIdx; i++) { ptrDst[i*predStride] = valueDC; } -#endif } else if( numIntraNeighbor == totalUnits ) { // Fill top-left border and top and top right with rec. samples ptrSrc = srcBuf - (1 + multiRefIdx) * srcStride - (1 + multiRefIdx); for (int j = 0; j <= predSize + multiRefIdx; j++) { ptrDst[j] = ptrSrc[j]; } -#if FLATTEN_BUFFERS for (int i = 0; i <= predHSize + multiRefIdx; i++) { ptrDst[i + predStride] = ptrSrc[i * srcStride]; } -#else - ptrSrc = srcBuf - multiRefIdx * srcStride - (1 + multiRefIdx); - for (int i = 1; i <= predHSize + multiRefIdx; i++) { ptrDst[i*predStride] = *(ptrSrc); ptrSrc += srcStride; } -#endif } else // reference samples are partially available { @@ -1425,46 +1040,28 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf if (neighborFlags[totalLeftUnits]) { ptrDst[0] = ptrSrc[0]; -#if FLATTEN_BUFFERS ptrDst[predStride] = ptrSrc[0]; -#endif for (int i = 1; i <= multiRefIdx; i++) { ptrDst[i] = ptrSrc[i]; -#if FLATTEN_BUFFERS ptrDst[i + predStride] = ptrSrc[i * srcStride]; -#else - ptrDst[i*predStride] = ptrSrc[i*srcStride]; -#endif } } // Fill left & below-left samples if available (downwards) ptrSrc += (1 + multiRefIdx) * srcStride; -#if FLATTEN_BUFFERS ptrDst += (1 + multiRefIdx) + predStride; -#else - ptrDst += (1 + multiRefIdx) * predStride; -#endif for (int unitIdx = totalLeftUnits - 1; unitIdx > 0; unitIdx--) { if (neighborFlags[unitIdx]) { for (int i = 0; i < unitHeight; i++) { -#if FLATTEN_BUFFERS ptrDst[i] = ptrSrc[i * srcStride]; -#else - ptrDst[i*predStride] = ptrSrc[i*srcStride]; -#endif } } ptrSrc += unitHeight * srcStride; -#if FLATTEN_BUFFERS ptrDst += unitHeight; -#else - ptrDst += unitHeight * predStride; -#endif } // Fill last below-left sample(s) if (neighborFlags[0]) @@ -1472,11 +1069,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf int lastSample = (predHSize % unitHeight == 0) ? unitHeight : predHSize % unitHeight; for (int i = 0; i < lastSample; i++) { -#if FLATTEN_BUFFERS ptrDst[i] = ptrSrc[i * srcStride]; -#else - ptrDst[i*predStride] = ptrSrc[i*srcStride]; -#endif } } @@ -1517,11 +1110,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf } // first available sample -#if FLATTEN_BUFFERS int firstAvailRow = -1; -#else - int firstAvailRow = 0; -#endif int firstAvailCol = 0; if (firstAvailUnit < totalLeftUnits) { @@ -1535,11 +1124,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf { firstAvailCol = (firstAvailUnit - totalLeftUnits - 1) * unitWidth + 1 + multiRefIdx; } -#if FLATTEN_BUFFERS const Pel firstAvailSample = ptrDst[firstAvailRow < 0 ? firstAvailCol : firstAvailRow + predStride]; -#else - const Pel firstAvailSample = ptrDst[firstAvailCol + firstAvailRow * predStride]; -#endif // last sample below-left (n.a.) int lastRow = predHSize + multiRefIdx; @@ -1547,11 +1132,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf // fill left column for (int i = lastRow; i > firstAvailRow; i--) { -#if FLATTEN_BUFFERS ptrDst[i + predStride] = firstAvailSample; -#else - ptrDst[i*predStride] = firstAvailSample; -#endif } // fill top row if (firstAvailCol > 0) @@ -1571,11 +1152,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf if (!neighborFlags[currUnit]) // samples not available { // last available sample -#if FLATTEN_BUFFERS int lastAvailRow = -1; -#else - int lastAvailRow = 0; -#endif int lastAvailCol = 0; if (lastAvailUnit < totalLeftUnits) { @@ -1589,37 +1166,21 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf { lastAvailCol = (lastAvailUnit - totalLeftUnits) * unitWidth + multiRefIdx; } -#if FLATTEN_BUFFERS const Pel lastAvailSample = ptrDst[lastAvailRow < 0 ? lastAvailCol : lastAvailRow + predStride]; -#else - const Pel lastAvailSample = ptrDst[lastAvailCol + lastAvailRow * predStride]; -#endif // fill current unit with last available sample if (currUnit < totalLeftUnits) { for (int i = lastAvailRow - 1; i >= lastAvailRow - unitHeight; i--) { -#if FLATTEN_BUFFERS ptrDst[i + predStride] = lastAvailSample; -#else - ptrDst[i*predStride] = lastAvailSample; -#endif } } else if (currUnit == totalLeftUnits) { -#if FLATTEN_BUFFERS for (int i = 0; i < multiRefIdx + 1; i++) -#else - for (int i = 1; i < multiRefIdx + 1; i++) -#endif { -#if FLATTEN_BUFFERS ptrDst[i + predStride] = lastAvailSample; -#else - ptrDst[i*predStride] = lastAvailSample; -#endif } for (int j = 0; j < multiRefIdx + 1; j++) { @@ -1639,38 +1200,18 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf currUnit++; } } -#if !JVET_O0364_PADDING - // padding of extended samples above right with the last sample - int lastSample = multiRefIdx + predSize; - for (int j = 1; j <= whRatio * multiRefIdx; j++) { ptrDst[lastSample + j] = ptrDst[lastSample]; } - // padding of extended samples below left with the last sample - lastSample = multiRefIdx + predHSize; - for (int i = 1; i <= hwRatio * multiRefIdx; i++) { ptrDst[(lastSample + i)*predStride] = ptrDst[lastSample*predStride]; } -#endif } void IntraPrediction::xFilterReferenceSamples(const Pel *refBufUnfiltered, Pel *refBufFiltered, const CompArea &area, const SPS &sps, int multiRefIdx -#if JVET_O0502_ISP_CLEANUP && !FLATTEN_BUFFERS - , - int stride -#endif ) { if (area.compID != COMPONENT_Y) { multiRefIdx = 0; } -#if JVET_O0364_PADDING const int predSize = m_topRefLength + multiRefIdx; const int predHSize = m_leftRefLength + multiRefIdx; -#else - int whRatio = std::max(1, int(area.width / area.height)); - int hwRatio = std::max(1, int(area.height / area.width)); - const int predSize = m_topRefLength + (whRatio + 1) * multiRefIdx; - const int predHSize = m_leftRefLength + (hwRatio + 1) * multiRefIdx; -#endif -#if FLATTEN_BUFFERS const size_t predStride = m_refBufferStride[area.compID]; const Pel topLeft = @@ -1695,38 +1236,6 @@ void IntraPrediction::xFilterReferenceSamples(const Pel *refBufUnfiltered, Pel * refBufFiltered[i] = (refBufUnfiltered[i - 1] + 2 * refBufUnfiltered[i] + refBufUnfiltered[i + 1] + 2) >> 2; } refBufFiltered[predHSize] = refBufUnfiltered[predHSize]; -#else -#if JVET_O0502_ISP_CLEANUP - const int predStride = stride == 0 ? predSize + 1 : stride; -#else - const int predStride = predSize + 1; -#endif - - // Regular reference sample filter - const Pel *piSrcPtr = refBufUnfiltered + (predStride * predHSize); // bottom left - Pel *piDestPtr = refBufFiltered + (predStride * predHSize); // bottom left - - // bottom left (not filtered) - *piDestPtr = *piSrcPtr; - piDestPtr -= predStride; - piSrcPtr -= predStride; - //left column (bottom to top) - for( int i = 1; i < predHSize; i++, piDestPtr -= predStride, piSrcPtr -= predStride) - { - *piDestPtr = (piSrcPtr[predStride] + 2 * piSrcPtr[0] + piSrcPtr[-predStride] + 2) >> 2; - } - //top-left - *piDestPtr = (piSrcPtr[predStride] + 2 * piSrcPtr[0] + piSrcPtr[1] + 2) >> 2; - piDestPtr++; - piSrcPtr++; - //top row (left-to-right) - for( uint32_t i=1; i < predSize; i++, piDestPtr++, piSrcPtr++ ) - { - *piDestPtr = (piSrcPtr[1] + 2 * piSrcPtr[0] + piSrcPtr[-1] + 2) >> 2; - } - // top right (not filtered) - *piDestPtr=*piSrcPtr; -#endif } bool isAboveLeftAvailable(const CodingUnit &cu, const ChannelType &chType, const Position &posLT) @@ -2202,11 +1711,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component avaiAboveRightUnits = isAboveRightAvailable(cu, CHANNEL_TYPE_CHROMA, chromaArea.topRightComp(chromaArea.compID), aboveRightUnits, unitWidth, (neighborFlags + leftUnits + leftBelowUnits + aboveUnits + 1)); } Pel *srcColor0, *curChroma0; -#if FLATTEN_BUFFERS int srcStride; -#else - int srcStride, curStride; -#endif PelBuf temp; if ((curChromaMode == MDLM_L_IDX) || (curChromaMode == MDLM_T_IDX)) @@ -2222,11 +1727,6 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component srcColor0 = temp.bufAt(0, 0); curChroma0 = getPredictorPtr(compID); -#if !FLATTEN_BUFFERS - curStride = m_topRefLength + 1; - - curChroma0 += curStride + 1; -#endif unsigned internalBitDepth = sps.getBitDepth(CHANNEL_TYPE_CHROMA); @@ -2234,9 +1734,6 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component int maxLuma[2] = { -MAX_INT, 0 }; Pel *src = srcColor0 - srcStride; -#if !FLATTEN_BUFFERS - Pel *cur = curChroma0 - curStride; -#endif int actualTopTemplateSampNum = 0; int actualLeftTemplateSampNum = 0; if (curChromaMode == MDLM_T_IDX) @@ -2278,11 +1775,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component { cntT = std::min(actualTopTemplateSampNum, (1 + aboveIs4) << 1); src = srcColor0 - srcStride; -#if FLATTEN_BUFFERS const Pel *cur = curChroma0 + 1; -#else - cur = curChroma0 - curStride; -#endif for (int pos = startPos[0]; cnt < cntT; pos += pickStep[0], cnt++) { selectLumaPix[cnt] = src[pos]; @@ -2294,19 +1787,11 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component { cntL = std::min(actualLeftTemplateSampNum, ( 1 + leftIs4 ) << 1 ); src = srcColor0 - 1; -#if FLATTEN_BUFFERS const Pel *cur = curChroma0 + m_refBufferStride[compID] + 1; -#else - cur = curChroma0 - 1; -#endif for (int pos = startPos[1], cnt = 0; cnt < cntL; pos += pickStep[1], cnt++) { selectLumaPix[cnt + cntT] = src[pos * srcStride]; -#if FLATTEN_BUFFERS selectChromaPix[cnt + cntT] = cur[pos]; -#else - selectChromaPix[cnt+ cntT] = cur[pos * curStride]; -#endif } } cnt = cntL + cntT; @@ -2378,42 +1863,21 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component void IntraPrediction::initIntraMip( const PredictionUnit &pu ) { -#if JVET_O0545_MAX_TB_SIGNALLING CHECK( pu.lwidth() > pu.cs->sps->getMaxTbSize() || pu.lheight() > pu.cs->sps->getMaxTbSize(), "Error: block size not supported for MIP" ); -#else - CHECK( pu.lwidth() > MIP_MAX_WIDTH || pu.lheight() > MIP_MAX_HEIGHT, "Error: block size not supported for MIP" ); -#endif -#if JVET_O0925_MIP_SIMPLIFICATIONS // prepare input (boundary) data for prediction CHECK(m_ipaParam.refFilterFlag, "ERROR: unfiltered refs expected for MIP"); Pel *ptrSrc = getPredictorPtr(COMPONENT_Y); -#if FLATTEN_BUFFERS const int srcStride = m_refBufferStride[COMPONENT_Y]; const int srcHStride = 2; -#else - const int srcStride = m_topRefLength + 1; - const int srcHStride = m_leftRefLength + 1; -#endif m_matrixIntraPred.prepareInputForPred(CPelBuf(ptrSrc, srcStride, srcHStride), pu.Y(), pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA)); -#else - // derive above and left availability - AvailableInfo availInfo = PU::getAvailableInfoLuma(pu); - - // prepare input (boundary) data for prediction - m_matrixIntraPred.prepareInputForPred(pu.cs->picture->getRecoBuf(COMPONENT_Y), pu.Y(), pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), availInfo); -#endif } void IntraPrediction::predIntraMip( const ComponentID compId, PelBuf &piPred, const PredictionUnit &pu ) { CHECK( compId != COMPONENT_Y, "Error: chroma not supported" ); -#if JVET_O0545_MAX_TB_SIGNALLING CHECK( pu.lwidth() > pu.cs->sps->getMaxTbSize() || pu.lheight() > pu.cs->sps->getMaxTbSize(), "Error: block size not supported for MIP" ); -#else - CHECK( pu.lwidth() > MIP_MAX_WIDTH || pu.lheight() > MIP_MAX_HEIGHT, "Error: block size not supported for MIP" ); -#endif CHECK( pu.lwidth() != (1 << floorLog2(pu.lwidth())) || pu.lheight() != (1 << floorLog2(pu.lheight())), "Error: expecting blocks of size 2^M x 2^N" ); // generate mode-specific prediction @@ -2425,16 +1889,11 @@ void IntraPrediction::predIntraMip( const ComponentID compId, PelBuf &piPred, co { for (int x = 0; x < pu.lwidth(); x++) { -#if JVET_O0925_MIP_SIMPLIFICATIONS piPred.at(x, y) = Pel(predMip[y * pu.lwidth() + x]); -#else - piPred.at(x, y) = Pel(ClipBD<int>(predMip[y * pu.lwidth() + x], bitDepth)); -#endif } } } -#if JVET_O0119_BASE_PALETTE_444 bool IntraPrediction::calCopyRun(CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin) { CodingUnit &cu = *cs.getCU(partitioner.chType); @@ -2578,6 +2037,5 @@ void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, } } } -#endif //! \} diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h index 3fec78faf069305ad5c9f834a86434d905f71276..d3c9449ff5304dc1bad10770d999d1123bfbb3be 100644 --- a/source/Lib/CommonLib/IntraPrediction.h +++ b/source/Lib/CommonLib/IntraPrediction.h @@ -65,22 +65,11 @@ static const uint32_t MAX_INTRA_FILTER_DEPTHS=8; class IntraPrediction { -#if FLATTEN_BUFFERS protected: Pel m_refBuffer[MAX_NUM_COMPONENT][NUM_PRED_BUF][(MAX_CU_SIZE * 2 + 1 + MAX_REF_LINE_IDX) * 2]; uint32_t m_refBufferStride[MAX_NUM_COMPONENT]; private: -#else -private: - - Pel* m_piYuvExt[MAX_NUM_COMPONENT][NUM_PRED_BUF]; -#if JVET_O0502_ISP_CLEANUP - PelBuf m_pelBufISPBase[2]; - PelBuf m_pelBufISP[2]; -#endif - int m_iYuvExtSize; -#endif Pel* m_yuvExt2[MAX_NUM_COMPONENT][4]; int m_yuvExtSize2; @@ -93,16 +82,10 @@ private: bool applyPDPC; bool isModeVer; int multiRefIndex; -#if !JVET_O0364_PADDING - int whRatio; - int hwRatio; -#endif int intraPredAngle; int invAngle; bool interpolationFlag; -#if JVET_O0364_PDPC_ANGULAR int angularScale; -#endif // clang-format off IntraPredParam() @@ -110,16 +93,10 @@ private: , applyPDPC(false) , isModeVer(false) , multiRefIndex(-1) -#if !JVET_O0364_PADDING - , whRatio(0) - , hwRatio(0) -#endif , intraPredAngle(std::numeric_limits<int>::max()) , invAngle(std::numeric_limits<int>::max()) , interpolationFlag(false) -#if JVET_O0364_PDPC_ANGULAR , angularScale(-1) -#endif // clang-format on { } @@ -138,7 +115,6 @@ protected: int m_topRefLength; int m_leftRefLength; -#if JVET_O0119_BASE_PALETTE_444 ScanElement* m_scanOrder; bool m_bestScanRotationMode; Ctx m_storeCtxRun; @@ -147,7 +123,6 @@ protected: Ctx m_orgCtxRD; bool *m_runTypeRD; Pel *m_runLengthRD; -#endif // prediction void xPredIntraPlanar ( const CPelBuf &pSrc, PelBuf &pDst ); void xPredIntraDc ( const CPelBuf &pSrc, PelBuf &pDst, const ChannelType channelType, const bool enableBoundaryFilter = true ); @@ -163,10 +138,6 @@ protected: void xFillReferenceSamples ( const CPelBuf &recoBuf, Pel* refBufUnfiltered, const CompArea &area, const CodingUnit &cu ); void xFilterReferenceSamples(const Pel *refBufUnfiltered, Pel *refBufFiltered, const CompArea &area, const SPS &sps, int multiRefIdx -#if JVET_O0502_ISP_CLEANUP && !FLATTEN_BUFFERS - , - int predStride = 0 -#endif ); static int getWideAngle ( int width, int height, int predMode ); @@ -183,26 +154,17 @@ public: // Angular Intra void predIntraAng ( const ComponentID compId, PelBuf &piPred, const PredictionUnit &pu); -#if FLATTEN_BUFFERS Pel *getPredictorPtr(const ComponentID compId) { return m_refBuffer[compId][m_ipaParam.refFilterFlag ? PRED_BUF_FILTERED : PRED_BUF_UNFILTERED]; } -#else - Pel* getPredictorPtr ( const ComponentID compId ) { return m_piYuvExt[compId][m_ipaParam.refFilterFlag ? PRED_BUF_FILTERED : PRED_BUF_UNFILTERED]; } -#endif // Cross-component Chroma void predIntraChromaLM(const ComponentID compID, PelBuf &piPred, const PredictionUnit &pu, const CompArea& chromaArea, int intraDir); void xGetLumaRecPixels(const PredictionUnit &pu, CompArea chromaArea); /// 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_O0502_ISP_CLEANUP void initIntraPatternChTypeISP (const CodingUnit& cu, const CompArea& area, PelBuf& piReco, const bool forceRefFilterFlag = false); // use forceRefFilterFlag to get both filtered and unfiltered buffers -#if !FLATTEN_BUFFERS - const PelBuf& getISPBuffer () { return m_pelBufISP[m_ipaParam.refFilterFlag ? PRED_BUF_FILTERED : PRED_BUF_UNFILTERED]; } -#endif -#endif // Matrix-based intra prediction void initIntraMip (const PredictionUnit &pu); @@ -214,11 +176,9 @@ public: Pel* getPredictorPtr2 (const ComponentID compID, uint32_t idx) { return m_yuvExt2[compID][idx]; } void switchBuffer (const PredictionUnit &pu, ComponentID compID, PelBuf srcBuff, Pel *dst); void geneIntrainterPred (const CodingUnit &cu); -#if JVET_O0119_BASE_PALETTE_444 void reorderPLT (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); bool calCopyRun (CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin); bool calIndexRun (CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin); -#endif }; //! \} diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 13424b7d8e41683a7534e9cda36303504f6d8cad..a4defc3f26b2d944a90514203dd115e34af2165b 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -63,18 +63,10 @@ // Tables // ==================================================================================================================== -#if JVET_O0159_10BITTCTABLE_DEBLOCKING const uint16_t LoopFilter::sm_tcTable[MAX_QP + 1 + DEFAULT_INTRA_TC_OFFSET] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,5,5,5,7,7,8,9,10,10,11,13,14,15,17,19,21,24,25,29,33,36,41,45,51,57,64,71,80,89,100,112,125,141,157,177,198,222,250,280,314,352,395 }; -#else -const uint8_t LoopFilter::sm_tcTable[MAX_QP + 1 + DEFAULT_INTRA_TC_OFFSET] = -{ - 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,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,25 - , 28, 31, 35, 39, 44, 50, 56, 63, 70, 79, 88, 99 -}; -#endif const uint8_t LoopFilter::sm_betaTable[MAX_QP + 1] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64 @@ -390,18 +382,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } } -#if !JVET_O0060_4x4_deblocking - if (edgeDir == EDGE_HOR) - { - if (!((cu.block(COMPONENT_Y).y % 8) == 0)) - return; - } - else - { - if (!((cu.block(COMPONENT_Y).x % 8) == 0)) - return; - } -#endif std::sort( edgeIdx.begin(), edgeIdx.end() ); int prevEdgeIdx = -1; @@ -499,7 +479,6 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e if ( comp == COMPONENT_Y ) { -#if JVET_O0060_4x4_deblocking bool smallBlock = (sizePSide <= 4) || (sizeQSide <= 4); if (smallBlock) { @@ -511,10 +490,6 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff] = (sizeQSide >= 32) ? 7 : 3; m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff] = (sizePSide >= 32) ? 7 : 3; } -#else - m_maxFilterLengthQ[cIdx][ctuXOff+x][ctuYOff] = ( sizeQSide >= 32 ) ? 7 : 3; - m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff] = ( sizePSide >= 32 ) ? 7 : 3; -#endif } else { @@ -549,7 +524,6 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e if ( comp == COMPONENT_Y ) { -#if JVET_O0060_4x4_deblocking bool smallBlock = (sizePSide <= 4) || (sizeQSide <= 4); if (smallBlock) { @@ -561,10 +535,6 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e m_maxFilterLengthQ[cIdx][ctuXOff][ctuYOff + y] = (sizeQSide >= 32) ? 7 : 3; m_maxFilterLengthP[cIdx][ctuXOff][ctuYOff + y] = (sizePSide >= 32) ? 7 : 3; } -#else - m_maxFilterLengthQ[cIdx][ctuXOff][ctuYOff+y] = ( sizeQSide >= 32 ) ? 7 : 3; - m_maxFilterLengthP[cIdx][ctuXOff][ctuYOff+y] = ( sizePSide >= 32 ) ? 7 : 3; -#endif } else { @@ -601,13 +571,11 @@ void LoopFilter::xSetMaxFilterLengthPQForCodingSubBlocks( const DeblockEdgeDir e m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y] = std::min<int>(m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y], 5); } } -#if JVET_O0060_4x4_deblocking else if (y > 0 && (m_transformEdge[cIdx][ctuXOff + x][ctuYOff + y - 4] || ((y + 4) >= areaPu.height) || m_transformEdge[cIdx][ctuXOff + x][ctuYOff + y + 4])) // adjacent to transform edge +/- 4 { m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff + y] = 1; m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff + y] = 1; } -#endif else if (y > 0 && ( m_transformEdge[cIdx][ctuXOff+x][ctuYOff+y-8] || (( y + 8 ) >= areaPu.height) || m_transformEdge[cIdx][ctuXOff+x][ctuYOff+y+8] )) // adjacent to transform edge on 8x8 grid { m_maxFilterLengthQ[cIdx][ctuXOff+x][ctuYOff+y] = 2; @@ -635,13 +603,11 @@ void LoopFilter::xSetMaxFilterLengthPQForCodingSubBlocks( const DeblockEdgeDir e m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y] = std::min<int>(m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y], 5); } } -#if JVET_O0060_4x4_deblocking else if (x > 0 && (m_transformEdge[cIdx][ctuXOff + x - 4][ctuYOff + y] || ((x + 4) >= areaPu.width) || m_transformEdge[cIdx][ctuXOff + x + 4][ctuYOff + y])) // adjacent to transform edge +/- 4 { m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff + y] = 1; m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff + y] = 1; } -#endif else if ( x > 0 && ( m_transformEdge[cIdx][ctuXOff+x-8][ctuYOff+y] || ( (x + 8) >= areaPu.width ) || m_transformEdge[cIdx][ctuXOff+x+8][ctuYOff+y] ) ) // adjacent to transform edge on 8x8 grid { m_maxFilterLengthQ[cIdx][ctuXOff+x][ctuYOff+y] = 2; @@ -724,11 +690,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De } const TransformUnit& tuQ = *cuQ.cs->getTU(posQ, cuQ.chType); -#if JVET_O0050_LOCAL_DUAL_TREE const TransformUnit& tuP = *cuP.cs->getTU(posP, cuQ.chType); //based on chType of the current cu, because cuQ.chType and cuP.chType are not the same when local dual-tree is applied -#else - const TransformUnit& tuP = *cuP.cs->getTU(posP, cuP.chType); -#endif const PreCalcValues& pcv = *cu.cs->pcv; const unsigned rasterIdx = getRasterIdx( Position{ localPos.x, localPos.y }, pcv ); if (m_aapucBS[edgeDir][rasterIdx] && (cuP.firstPU->mhIntraFlag || cuQ.firstPU->mhIntraFlag)) @@ -744,20 +706,12 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De tmpBs += BsSet(1, COMPONENT_Y); } // U -#if JVET_O0105_ICT if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cb) || TU::getCbf(tuP, COMPONENT_Cb) || tuQ.jointCbCr || tuP.jointCbCr)) -#else - if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cb) || TU::getCbf(tuP, COMPONENT_Cb))) -#endif { tmpBs += BsSet(1, COMPONENT_Cb); } // V -#if JVET_O0105_ICT if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cr) || TU::getCbf(tuP, COMPONENT_Cr) || tuQ.jointCbCr || tuP.jointCbCr)) -#else - if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cr) || TU::getCbf(tuP, COMPONENT_Cr))) -#endif { tmpBs += BsSet(1, COMPONENT_Cr); } @@ -795,11 +749,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De if( 0 <= miQ.refIdx[0] ) { mvQ0 = miQ.mv[0]; } if( 0 <= miQ.refIdx[1] ) { mvQ1 = miQ.mv[1]; } -#if JVET_O0061_MV_THR_DEBLOCKING int nThreshold = (1 << MV_FRACTIONAL_BITS_INTERNAL) >> 1; -#else - int nThreshold = 1 << MV_FRACTIONAL_BITS_INTERNAL; -#endif unsigned uiBs = 0; //th can be optimized @@ -851,11 +801,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De Mv mvP0 = miP.mv[0]; Mv mvQ0 = miQ.mv[0]; -#if JVET_O0061_MV_THR_DEBLOCKING int nThreshold = (1 << MV_FRACTIONAL_BITS_INTERNAL) >> 1; -#else - int nThreshold = 1 << MV_FRACTIONAL_BITS_INTERNAL; -#endif return ( ( abs( mvQ0.getHor() - mvP0.getHor() ) >= nThreshold ) || ( abs( mvQ0.getVer() - mvP0.getVer() ) >= nThreshold ) ) ? (tmpBs + 1) : tmpBs; } @@ -902,9 +848,7 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg const SPS &sps = *(cu.cs->sps); const Slice &slice = *(cu.slice); const bool ppsTransquantBypassEnabledFlag = pps.getTransquantBypassEnabledFlag(); -#if JVET_O0119_BASE_PALETTE_444 const bool spsPaletteEnabledFlag = sps.getPLTMode(); -#endif const int bitDepthLuma = sps.getBitDepth(CHANNEL_TYPE_LUMA); const ClpRng& clpRng( cu.cs->slice->clpRng(COMPONENT_Y) ); @@ -914,9 +858,6 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg unsigned uiBsAbsIdx = 0, uiBs = 0; int iOffset, iSrcStep; -#if !JVET_O0525_REMOVE_PCM - bool bPCMFilter = (sps.getPCMEnabledFlag() && sps.getPCMFilterDisableFlag()) ? true : false; -#endif bool bPartPNoFilter = false; bool bPartQNoFilter = false; int betaOffsetDiv2 = slice.getDeblockingFilterBetaOffsetDiv2(); @@ -952,7 +893,6 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg pos.x += xoffset; pos.y += yoffset; -#if JVET_O0060_4x4_deblocking // Deblock luma boundaries on 4x4 grid only if (edgeDir == EDGE_HOR && (pos.y % 4) != 0) { @@ -962,17 +902,6 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg { continue; } -#else - // Deblock luma boundaries on 8x8 grid only - if ( edgeDir == EDGE_HOR && ( pos.y % 8 ) != 0 ) - { - continue; - } - if ( edgeDir == EDGE_VER && ( pos.x % 8 ) != 0 ) - { - continue; - } -#endif uiBsAbsIdx = getRasterIdx( pos, pcv ); uiBs = BsGet(m_aapucBS[edgeDir][uiBsAbsIdx], COMPONENT_Y); @@ -1029,11 +958,7 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg const int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, int(iQP + DEFAULT_INTRA_TC_OFFSET*(uiBs - 1) + (tcOffsetDiv2 << 1))); const int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1)); -#if JVET_O0159_10BITTCTABLE_DEBLOCKING const int iTc = bitDepthLuma < 10 ? ((sm_tcTable[iIndexTC] + 2) >> (10 - bitDepthLuma)) : ((sm_tcTable[iIndexTC]) << (bitDepthLuma - 10)); -#else - const int iTc = sm_tcTable [iIndexTC] * iBitdepthScale; -#endif const int iBeta = sm_betaTable[iIndexB ] * iBitdepthScale; const int iSideThreshold = ( iBeta + ( iBeta >> 1 ) ) >> 3; const int iThrCut = iTc * 10; @@ -1073,28 +998,18 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg int dL = d0L + d3L; bPartPNoFilter = bPartQNoFilter = false; -#if !JVET_O0525_REMOVE_PCM - if (bPCMFilter) - { - // Check if each of PUs is I_PCM with LF disabling - bPartPNoFilter = cuP.ipcm; - bPartQNoFilter = cuQ.ipcm; - } -#endif if (ppsTransquantBypassEnabledFlag) { // check if each of PUs is lossless coded bPartPNoFilter = bPartPNoFilter || cuP.transQuantBypass; bPartQNoFilter = bPartQNoFilter || cuQ.transQuantBypass; } -#if JVET_O0119_BASE_PALETTE_444 if (spsPaletteEnabledFlag) { // check if each of PUs is palette coded bPartPNoFilter = bPartPNoFilter || CU::isPLT(cuP); bPartQNoFilter = bPartQNoFilter || CU::isPLT(cuQ); } -#endif if (dL < iBeta) { @@ -1128,32 +1043,21 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg const int d = d0 + d3; bPartPNoFilter = bPartQNoFilter = false; -#if !JVET_O0525_REMOVE_PCM - if( bPCMFilter ) - { - // Check if each of PUs is I_PCM with LF disabling - bPartPNoFilter = cuP.ipcm; - bPartQNoFilter = cuQ.ipcm; - } -#endif if( ppsTransquantBypassEnabledFlag ) { // check if each of PUs is lossless coded bPartPNoFilter = bPartPNoFilter || cuP.transQuantBypass; bPartQNoFilter = bPartQNoFilter || cuQ.transQuantBypass; } -#if JVET_O0119_BASE_PALETTE_444 if( spsPaletteEnabledFlag) { // check if each of PUs is palette coded bPartPNoFilter = bPartPNoFilter || CU::isPLT(cuP); bPartQNoFilter = bPartQNoFilter || CU::isPLT(cuQ); } -#endif if( d < iBeta ) { -#if JVET_O0060_4x4_deblocking bool bFilterP = false; bool bFilterQ = false; if (maxFilterLengthP > 1 && maxFilterLengthQ > 1) @@ -1161,10 +1065,6 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg bFilterP = (dp < iSideThreshold); bFilterQ = (dq < iSideThreshold); } -#else - const bool bFilterP = (dp < iSideThreshold); - const bool bFilterQ = (dq < iSideThreshold); -#endif bool sw = false; if (maxFilterLengthP > 2 && maxFilterLengthQ > 2) { @@ -1205,9 +1105,6 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed int iOffset, iSrcStep; unsigned uiLoopLength; -#if !JVET_O0525_REMOVE_PCM - bool bPCMFilter = (sps.getPCMEnabledFlag() && sps.getPCMFilterDisableFlag()) ? true : false; -#endif bool bPartPNoFilter = false; bool bPartQNoFilter = false; const int tcOffsetDiv2 = slice.getDeblockingFilterTcOffsetDiv2(); @@ -1290,28 +1187,18 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed } bPartPNoFilter = bPartQNoFilter = false; -#if !JVET_O0525_REMOVE_PCM - if (bPCMFilter) - { - // Check if each of PUs is I_PCM with LF disabling - bPartPNoFilter = cuP.ipcm; - bPartQNoFilter = cuQ.ipcm; - } -#endif if( pps.getTransquantBypassEnabledFlag() ) { // check if each of PUs is lossless coded bPartPNoFilter = bPartPNoFilter || cuP.transQuantBypass; bPartQNoFilter = bPartQNoFilter || cuQ.transQuantBypass; } -#if JVET_O0119_BASE_PALETTE_444 if ( sps.getPLTMode()) { // check if each of PUs is palette coded bPartPNoFilter = bPartPNoFilter || CU::isPLT(cuP); bPartQNoFilter = bPartQNoFilter || CU::isPLT(cuQ); } -#endif 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]; @@ -1334,34 +1221,11 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed const int chromaQPOffset = pps.getQpOffset( ComponentID( chromaIdx + 1 ) ); Pel* piTmpSrcChroma = (chromaIdx == 0) ? piTmpSrcCb : piTmpSrcCr; -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE int iQP = sps.getMappedChromaQpValue(ComponentID(chromaIdx + 1), ((cuP.qp + cuQ.qp + 1) >> 1)); iQP = Clip3(0, MAX_QP, iQP + chromaQPOffset); -#else - int iQP = ( ( cuP.qp + cuQ.qp + 1 ) >> 1 ) + chromaQPOffset; - if (iQP >= chromaQPMappingTableSize) - { - if( sps.getChromaFormatIdc() == CHROMA_420 ) - { - iQP -= 6; - } - else if( iQP > MAX_QP ) - { - iQP = MAX_QP; - } - } - else if( iQP >= 0 ) - { - iQP = getScaledChromaQP(iQP, sps.getChromaFormatIdc()); - } -#endif const int iIndexTC = Clip3<int>(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (bS[chromaIdx] - 1) + (tcOffsetDiv2 << 1)); -#if JVET_O0159_10BITTCTABLE_DEBLOCKING const int iTc = sps.getBitDepth(CHANNEL_TYPE_CHROMA) < 10 ? ((sm_tcTable[iIndexTC] + 2) >> (10 - sps.getBitDepth(CHANNEL_TYPE_CHROMA))) : ((sm_tcTable[iIndexTC]) << (sps.getBitDepth(CHANNEL_TYPE_CHROMA) - 10)); -#else - const int iTc = sm_tcTable[iIndexTC] * iBitdepthScale; -#endif bool useLongFilter = false; if (largeBoundary) { @@ -1370,33 +1234,19 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed const int dp0 = xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset); const int dq0 = xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset); -#if JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION const int subSamplingShift = ( edgeDir == EDGE_VER ) ? m_shiftVer : m_shiftHor; const int dp3 = ( subSamplingShift == 1 ) ? xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset) : xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 3), iOffset); const int dq3 = ( subSamplingShift == 1 ) ? xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset) : xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 3), iOffset); -#else - const int dp1 = xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset); - const int dq1 = xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset); -#endif const int d0 = dp0 + dq0; -#if JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION const int d3 = dp3 + dq3; const int d = d0 + d3; -#else - const int d1 = dp1 + dq1; - const int d = d0 + d1; -#endif if (d < beta) { useLongFilter = true; const bool sw = xUseStrongFiltering(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset, 2 * d0, beta, iTc) -#if JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION && xUseStrongFiltering(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + ( ( subSamplingShift == 1 ) ? 1 : 3 ) ), iOffset, 2 * d3, beta, iTc); -#else - && xUseStrongFiltering(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset, 2 * d1, beta, iTc); -#endif for (unsigned step = 0; step < uiLoopLength; step++) { diff --git a/source/Lib/CommonLib/LoopFilter.h b/source/Lib/CommonLib/LoopFilter.h index ea7a70fc64a056eb6a3936bdcc2abccebbc13348..0b2e05f6a67d1a2a7363038171846e081dd84abb 100644 --- a/source/Lib/CommonLib/LoopFilter.h +++ b/source/Lib/CommonLib/LoopFilter.h @@ -101,11 +101,7 @@ private: inline int xCalcDP ( Pel* piSrc, const int iOffset ) const; inline int xCalcDQ ( Pel* piSrc, const int iOffset ) const; -#if JVET_O0159_10BITTCTABLE_DEBLOCKING static const uint16_t sm_tcTable[MAX_QP + 3]; -#else - static const uint8_t sm_tcTable[MAX_QP + 3]; -#endif static const uint8_t sm_betaTable[MAX_QP + 1]; public: diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.cpp b/source/Lib/CommonLib/MatrixIntraPrediction.cpp index 133502e0bfd785d508035d68ffafe6daccb5c5c3..42c2202affafdae51957e0c48d47d3a91d78b64f 100644 --- a/source/Lib/CommonLib/MatrixIntraPrediction.cpp +++ b/source/Lib/CommonLib/MatrixIntraPrediction.cpp @@ -45,29 +45,20 @@ MatrixIntraPrediction::MatrixIntraPrediction(): m_reducedBoundary (MIP_MAX_INPUT_SIZE), m_reducedBoundaryTransposed(MIP_MAX_INPUT_SIZE), -#if JVET_O0925_MIP_SIMPLIFICATIONS m_inputOffset ( 0 ), m_inputOffsetTransp( 0 ), m_refSamplesTop (MIP_MAX_WIDTH), m_refSamplesLeft(MIP_MAX_HEIGHT), -#else - m_boundaryForUpsamplingTop (MIP_MAX_WIDTH), - m_boundaryForUpsamplingLeft(MIP_MAX_HEIGHT), -#endif m_blockSize( 0, 0 ), m_numModes( 0 ), m_reducedBoundarySize( 0, 0 ), m_reducedPredictionSize( 0, 0 ), -#if !JVET_O0925_MIP_SIMPLIFICATIONS - m_boundarySizeForUpsampling( 0, 0 ), -#endif m_upsmpFactorHor( 0 ), m_upsmpFactorVer( 0 ) { } -#if JVET_O0925_MIP_SIMPLIFICATIONS void MatrixIntraPrediction::prepareInputForPred(const CPelBuf &pSrc, const Area& block, const int bitDepth) { // Step 1: Save block size and calculate dependent values @@ -83,11 +74,7 @@ void MatrixIntraPrediction::prepareInputForPred(const CPelBuf &pSrc, const Area& m_refSamplesLeft.resize(block.height); for (int y = 0; y < block.height; y++) { -#if FLATTEN_BUFFERS m_refSamplesLeft[y] = pSrc.at(y + 1, 1); -#else - m_refSamplesLeft[y] = pSrc.at(0, y + 1); -#endif } // Step 3: Compute the reduced boundary via Haar-downsampling (input for the prediction) @@ -126,110 +113,15 @@ void MatrixIntraPrediction::prepareInputForPred(const CPelBuf &pSrc, const Area& m_reducedBoundaryTransposed[i] -= m_inputOffsetTransp; } } -#else -void MatrixIntraPrediction::prepareInputForPred(const CPelBuf& src, const Area& block, const int bitDepth, const AvailableInfo &availInfo) -{ - // Step 1: Save block size and calculate dependent values - initPredBlockParams(block); - - // Step 2: Get the input data (left and top reference samples) - const int defaultPad = int(1 << (bitDepth - 1)); - - // TOP (save top boundary since we might need it for upsampling) - m_boundaryForUpsamplingTop.resize( block.width ); - const int availPosTop = availInfo.maxPosTop; - CHECKD(availPosTop > block.width, "Error: availPosTop out of range"); - - if (availPosTop > 0) - { - // top available - const Position posT0(block.x, block.y - 1); - for (int x = 0; x < availPosTop; x++) - { - m_boundaryForUpsamplingTop[ x ] = src.at( posT0.offset( x, 0 ) ); - } - // top unavailable - const int padVal = m_boundaryForUpsamplingTop[ availPosTop - 1 ]; - for( int x = availPosTop; x < m_boundaryForUpsamplingTop.size(); x++ ) - { - m_boundaryForUpsamplingTop[ x ] = padVal; - } - } - else - { - std::fill( m_boundaryForUpsamplingTop.begin(), m_boundaryForUpsamplingTop.end(), defaultPad ); - } - - // LEFT (save left boundary since we might need it for upsampling) - m_boundaryForUpsamplingLeft.resize( block.height ); - const int availPosLeft = availInfo.maxPosLeft; - CHECKD(availPosLeft > block.height, "Error: availPosLeft out of range"); - - if (availPosLeft > 0) - { - // left available - const Position posL0(block.x - 1, block.y); - for (int y = 0; y < availPosLeft; y++) - { - m_boundaryForUpsamplingLeft[ y ] = src.at( posL0.offset( 0, y ) ); - } - // left unavailable - const int padVal = m_boundaryForUpsamplingLeft[ availPosLeft - 1 ]; - for( int y = availPosLeft; y < m_boundaryForUpsamplingLeft.size(); y++ ) - { - m_boundaryForUpsamplingLeft[ y ] = padVal; - } - } - else - { - std::fill( m_boundaryForUpsamplingLeft.begin(), m_boundaryForUpsamplingLeft.end(), defaultPad ); - } - - // Step 3: Compute the reduced boundary via Haar-downsampling (input for the prediction and intermediate boundary for upsampling) - m_reducedBoundary .resize( m_reducedBoundarySize.width + m_reducedBoundarySize.height ); - m_reducedBoundaryTransposed.resize( m_reducedBoundarySize.width + m_reducedBoundarySize.height ); - - const bool needVerticalUpsampling = ( m_upsmpFactorVer > 1 ); - int* const topReduced = m_reducedBoundary.data(); - boundaryDownsampling1D( topReduced, m_boundaryForUpsamplingTop.data(), block.width, m_reducedBoundarySize.width, needVerticalUpsampling, m_boundarySizeForUpsampling.width ); - m_boundaryForUpsamplingTop.resize( needVerticalUpsampling ? m_boundarySizeForUpsampling.width : 0 ); - - const bool needHorizontalUpsampling = ( m_upsmpFactorHor > 1 ); - int* const leftReduced = m_reducedBoundary.data() + m_reducedBoundarySize.width; - boundaryDownsampling1D( leftReduced, m_boundaryForUpsamplingLeft.data(), block.height, m_reducedBoundarySize.height, needHorizontalUpsampling, m_boundarySizeForUpsampling.height ); - m_boundaryForUpsamplingLeft.resize( needHorizontalUpsampling ? m_boundarySizeForUpsampling.height : 0 ); - - int* const leftReducedTransposed = m_reducedBoundaryTransposed.data(); - int* const topReducedTransposed = m_reducedBoundaryTransposed.data() + m_reducedBoundarySize.height; - for( int x = 0; x < m_reducedBoundarySize.width; x++ ) - { - topReducedTransposed[ x ] = topReduced[ x ]; - } - for( int y = 0; y < m_reducedBoundarySize.height; y++ ) - { - leftReducedTransposed[ y ] = leftReduced[ y ]; - } -} -#endif void MatrixIntraPrediction::predBlock(int* const result, const int modeIdx, const int bitDepth) { const bool transpose = isTransposed( modeIdx ); const bool needUpsampling = ( m_upsmpFactorHor > 1 ) || ( m_upsmpFactorVer > 1 ); -#if JVET_O0925_MIP_SIMPLIFICATIONS const uint8_t* matrix; int shiftMatrix = 0, offsetMatrix = 0; getMatrixData(matrix, shiftMatrix, offsetMatrix, modeIdx); -#else - const short* matrix; - const short* bias; - getMatrixBias( matrix, bias, modeIdx ); - - int shiftMatrix = 0; - int shiftBias = 0; - getShifts(shiftMatrix, shiftBias, modeIdx, bitDepth ); -#endif bool leaveHorOut = ( m_blockSize.width == 4 && m_blockSize.height >= 16 ); bool leaveVerOut = ( m_blockSize.height == 4 && m_blockSize.width >= 16 ); @@ -240,15 +132,8 @@ void MatrixIntraPrediction::predBlock(int* const result, const int modeIdx, cons static_vector<int, MIP_MAX_REDUCED_OUTPUT_SAMPLES> bufReducedPred( m_reducedPredictionSize.area() ); int* const reducedPred = needUpsampling ? bufReducedPred.data() : result; const int* const reducedBoundary = transpose ? m_reducedBoundaryTransposed.data() : m_reducedBoundary.data(); -#if JVET_O0925_MIP_SIMPLIFICATIONS computeReducedPred( reducedPred, reducedBoundary, matrix, leaveHorOut, leaveVerOut, shiftMatrix, offsetMatrix, transpose, needUpsampling, bitDepth ); -#else - xComputeMatrixTimesRedBndryPlusBias( reducedPred, reducedBoundary, matrix, bias, - leaveHorOut, leaveVerOut, - shiftMatrix, shiftBias, - transpose, needUpsampling ); -#endif // Reduced prediction is transposed if ( transpose && needUpsampling ). if( needUpsampling ) @@ -299,17 +184,6 @@ void MatrixIntraPrediction::initPredBlockParams(const Size& block) m_reducedPredictionSize = Size(std::min<SizeType>(m_blockSize.width, 8), std::min<SizeType>(m_blockSize.height, 8)); } -#if !JVET_O0925_MIP_SIMPLIFICATIONS - // init boundary size for upsampling - if (m_blockSize.height > m_blockSize.width) - { - m_boundarySizeForUpsampling = Size(m_blockSize.width, m_reducedPredictionSize.height); - } - else - { - m_boundarySizeForUpsampling = Size(m_reducedPredictionSize.width, m_blockSize.height); - } -#endif // init upsampling factors m_upsmpFactorHor = m_blockSize.width / m_reducedPredictionSize.width; @@ -323,18 +197,11 @@ void MatrixIntraPrediction::initPredBlockParams(const Size& block) void MatrixIntraPrediction::doDownsampling(int* dst, const int* src, const SizeType srcLen, const SizeType dstLen) { -#if !JVET_O0925_MIP_SIMPLIFICATIONS - // TODO: Check if src and dst can ever be negative. If not assign unsigned type and simplify rounding. -#endif const SizeType downsmpFactor = srcLen / dstLen; CHECKD( srcLen != dstLen * downsmpFactor, "Need integer downsampling factor." ); CHECKD( ( downsmpFactor & ( downsmpFactor - 1 ) ) != 0, "Need power of two downsampling factor." ); const int log2DownsmpFactor = floorLog2( downsmpFactor ); -#if JVET_O0925_MIP_SIMPLIFICATIONS const int roundingOffset = ( 1 << ( log2DownsmpFactor - 1 ) ); -#else - const int roundingOffsetPositive = ( 1 << ( log2DownsmpFactor - 1 ) ); -#endif for( SizeType srcIdx = 0, dstIdx = 0; dstIdx < dstLen; ++dstIdx ) { @@ -343,15 +210,11 @@ void MatrixIntraPrediction::doDownsampling(int* dst, const int* src, const SizeT { sum += src[ srcIdx ]; } -#if !JVET_O0925_MIP_SIMPLIFICATIONS - const int roundingOffset = roundingOffsetPositive - ( sum < 0 ? 1 : 0 ); -#endif dst[ dstIdx ] = ( sum + roundingOffset ) >> log2DownsmpFactor; } } -#if JVET_O0925_MIP_SIMPLIFICATIONS void MatrixIntraPrediction::boundaryDownsampling1D(int* reducedDst, const int* const fullSrc, const SizeType srcLen, const SizeType dstLen) { if (dstLen < srcLen) @@ -368,70 +231,27 @@ void MatrixIntraPrediction::boundaryDownsampling1D(int* reducedDst, const int* c } } } -#else -void MatrixIntraPrediction::boundaryDownsampling1D(int* reducedDst, int* fullSrcAndIntermediateDst, - const SizeType srcLen, const SizeType dstLen, - const bool saveIntermediate, const SizeType intermediateLen ) -{ - SizeType currLen = srcLen; - - // Create intermediate boundary if needed. - if( saveIntermediate && intermediateLen < srcLen ) - { - CHECKD( intermediateLen < dstLen, "Intermediate length must not be less than target length." ); - doDownsampling( fullSrcAndIntermediateDst, fullSrcAndIntermediateDst, currLen, intermediateLen ); - currLen = intermediateLen; - } - - if( dstLen < currLen ) - { - // Create reduced boundary by downsampling. - doDownsampling( reducedDst, fullSrcAndIntermediateDst, currLen, dstLen ); - } - else - { - // Copy reduced boundary if no downsampling is needed. - for( SizeType i = 0; i < dstLen; ++i ) - { - reducedDst[ i ] = fullSrcAndIntermediateDst[ i ]; - } - } -} -#endif void MatrixIntraPrediction::predictionUpsampling1D(int* const dst, const int* const src, const int* const bndry, const SizeType srcSizeUpsmpDim, const SizeType srcSizeOrthDim, const SizeType srcStep, const SizeType srcStride, const SizeType dstStep, const SizeType dstStride, -#if JVET_O0925_MIP_SIMPLIFICATIONS const SizeType bndryStep, -#endif const unsigned int upsmpFactor ) { -#if !JVET_O0925_MIP_SIMPLIFICATIONS - // TODO: Check if src and dst can ever be negative. If not assign unsigned type and simplify rounding. -#endif const int log2UpsmpFactor = floorLog2( upsmpFactor ); CHECKD( upsmpFactor <= 1, "Upsampling factor must be at least 2." ); -#if JVET_O0925_MIP_SIMPLIFICATIONS const int roundingOffset = 1 << (log2UpsmpFactor - 1); -#endif SizeType idxOrthDim = 0; const int* srcLine = src; int* dstLine = dst; -#if JVET_O0925_MIP_SIMPLIFICATIONS const int* bndryLine = bndry + bndryStep - 1; -#endif while( idxOrthDim < srcSizeOrthDim ) { SizeType idxUpsmpDim = 0; -#if JVET_O0925_MIP_SIMPLIFICATIONS const int* before = bndryLine; -#else - const int* before = bndry + idxOrthDim; -#endif const int* behind = srcLine; int* currDst = dstLine; while( idxUpsmpDim < srcSizeUpsmpDim ) @@ -443,13 +263,7 @@ void MatrixIntraPrediction::predictionUpsampling1D(int* const dst, const int* co { scaledBefore -= *before; scaledBehind += *behind; -#if JVET_O0925_MIP_SIMPLIFICATIONS *currDst = (scaledBefore + scaledBehind + roundingOffset) >> log2UpsmpFactor; -#else - *currDst = scaledBefore + scaledBehind; - *currDst = ( *currDst + ( 1 << ( log2UpsmpFactor - 1 ) ) - - ( *currDst < 0 ? 1 : 0 ) ) >> log2UpsmpFactor; -#endif pos++; currDst += dstStep; @@ -463,9 +277,7 @@ void MatrixIntraPrediction::predictionUpsampling1D(int* const dst, const int* co idxOrthDim++; srcLine += srcStride; dstLine += dstStride; -#if JVET_O0925_MIP_SIMPLIFICATIONS bndryLine += bndryStep; -#endif } } @@ -486,17 +298,10 @@ void MatrixIntraPrediction::predictionUpsampling(int* const dst, const int* cons int* const horDst = dst + ( m_upsmpFactorVer - 1 ) * m_blockSize.width; const SizeType horDstStride = m_upsmpFactorVer * m_blockSize.width; -#if JVET_O0925_MIP_SIMPLIFICATIONS predictionUpsampling1D( horDst, src, m_refSamplesLeft.data(), m_reducedPredictionSize.width, m_reducedPredictionSize.height, horSrcStep, horSrcStride, 1, horDstStride, m_upsmpFactorVer, m_upsmpFactorHor ); -#else - predictionUpsampling1D( horDst, src, m_boundaryForUpsamplingLeft.data(), - m_reducedPredictionSize.width, m_reducedPredictionSize.height, - horSrcStep, horSrcStride, 1, horDstStride, - m_upsmpFactorHor ); -#endif verSrc = horDst; verSrcStep = horDstStride; @@ -508,17 +313,10 @@ void MatrixIntraPrediction::predictionUpsampling(int* const dst, const int* cons verSrcStep = transpose ? 1 : m_blockSize.width; verSrcStride = transpose ? m_reducedPredictionSize.height : 1; } -#if JVET_O0925_MIP_SIMPLIFICATIONS predictionUpsampling1D( dst, verSrc, m_refSamplesTop.data(), m_reducedPredictionSize.height, m_blockSize.width, verSrcStep, verSrcStride, m_blockSize.width, 1, 1, m_upsmpFactorVer ); -#else - predictionUpsampling1D( dst, verSrc, m_boundaryForUpsamplingTop.data(), - m_reducedPredictionSize.height, m_blockSize.width, - verSrcStep, verSrcStride, m_blockSize.width, 1, - m_upsmpFactorVer ); -#endif } else { @@ -534,17 +332,10 @@ void MatrixIntraPrediction::predictionUpsampling(int* const dst, const int* cons const SizeType verDstStep = m_blockSize.width; const SizeType verDstStride = m_upsmpFactorHor; -#if JVET_O0925_MIP_SIMPLIFICATIONS predictionUpsampling1D( verDst, src, m_refSamplesTop.data(), m_reducedPredictionSize.height, m_reducedPredictionSize.width, verSrcStep, verSrcStride, verDstStep, verDstStride, m_upsmpFactorHor, m_upsmpFactorVer ); -#else - predictionUpsampling1D( verDst, src, m_boundaryForUpsamplingTop.data(), - m_reducedPredictionSize.height, m_reducedPredictionSize.width, - verSrcStep, verSrcStride, verDstStep, verDstStride, - m_upsmpFactorVer ); -#endif horSrc = verDst; horSrcStep = verDstStride; @@ -556,21 +347,13 @@ void MatrixIntraPrediction::predictionUpsampling(int* const dst, const int* cons horSrcStep = transpose ? m_blockSize.height : 1; horSrcStride = transpose ? 1 : m_reducedPredictionSize.width; } -#if JVET_O0925_MIP_SIMPLIFICATIONS predictionUpsampling1D( dst, horSrc, m_refSamplesLeft.data(), m_reducedPredictionSize.width, m_blockSize.height, horSrcStep, horSrcStride, 1, m_blockSize.width, 1, m_upsmpFactorHor ); -#else - predictionUpsampling1D( dst, horSrc, m_boundaryForUpsamplingLeft.data(), - m_reducedPredictionSize.width, m_blockSize.height, - horSrcStep, horSrcStride, 1, m_blockSize.width, - m_upsmpFactorHor ); -#endif } } -#if JVET_O0925_MIP_SIMPLIFICATIONS void MatrixIntraPrediction::getMatrixData(const uint8_t*& matrix, int &shiftMatrix, int &offsetMatrix, const int modeIdx) const { const int idx = getWeightIdx( modeIdx ); @@ -593,62 +376,11 @@ void MatrixIntraPrediction::getMatrixData(const uint8_t*& matrix, int &shiftMatr offsetMatrix = mipOffsetMatrix16x16[idx]; } } -#else -void MatrixIntraPrediction::getMatrixBias(const short*& matrix, const short*& bias, const int modeIdx) const -{ - const int idx = getWeightIdx( modeIdx ); - - if( m_blockSize.width == 4 && m_blockSize.height == 4 ) - { - matrix = &mipMatrix4x4[idx][0][0]; - bias = &mipBias4x4 [idx][0]; - } - else if( m_blockSize.width <= 8 && m_blockSize.height <= 8 ) - { - matrix = &mipMatrix8x8[idx][0][0]; - bias = &mipBias8x8 [idx][0]; - } - else - { - matrix = &mipMatrix16x16[idx][0][0]; - bias = &mipBias16x16 [idx][0]; - } -} - -void MatrixIntraPrediction::getShifts(int &shiftMatrix, int &shiftBias, const int modeIdx, const int bitDepth) const -{ - const int idx = getWeightIdx( modeIdx ); - - if( m_blockSize.width == 4 && m_blockSize.height == 4 ) - { - shiftMatrix = mipShiftMatrix4x4[idx]; - shiftBias = mipShiftBias4x4 [idx] + (bitDepth - 10); - } - else if( m_blockSize.width <= 8 && m_blockSize.height <= 8 ) - { - shiftMatrix = mipShiftMatrix8x8[idx]; - shiftBias = mipShiftBias8x8 [idx] + (bitDepth - 10); - } - else - { - shiftMatrix = mipShiftMatrix16x16[idx]; - shiftBias = mipShiftBias16x16 [idx] + (bitDepth - 10); - } -} -#endif -#if JVET_O0925_MIP_SIMPLIFICATIONS void MatrixIntraPrediction::computeReducedPred(int*const result, const int* const input, const uint8_t*matrix, const bool leaveHorOut, const bool leaveVerOut, const int shiftMatrix, const int offsetMatrix, const bool transpose, const bool needUpsampling, const int bitDepth ) -#else -void MatrixIntraPrediction::xComputeMatrixTimesRedBndryPlusBias(int*const result, const int* const input, - const short*matrix, const short*bias, - const bool leaveHorOut, const bool leaveVerOut, - const int shiftMatrix, const int shiftBias, - const bool transpose, const bool needUpsampling ) -#endif { const int inputSize = m_reducedBoundarySize.width + m_reducedBoundarySize.height; @@ -656,78 +388,43 @@ void MatrixIntraPrediction::xComputeMatrixTimesRedBndryPlusBias(int*const result static_vector<int, MIP_MAX_REDUCED_OUTPUT_SAMPLES> resBufTransposed( m_reducedPredictionSize.area() ); int*const resPtr = (transpose && !needUpsampling) ? resBufTransposed.data() : result; -#if JVET_O0925_MIP_SIMPLIFICATIONS int sum = 0; for (int i = 0; i < inputSize; i++) { sum += input[i]; } const int offset = (1 << (shiftMatrix - 1)) - offsetMatrix * sum; -#else - const int offset = 1 << (shiftMatrix - 1); -#endif CHECK(inputSize != 4 * (inputSize >> 2), "Error, input size not divisible by four"); -#if JVET_O0925_MIP_SIMPLIFICATIONS const uint8_t *weight = matrix; const int inputOffset = transpose ? m_inputOffsetTransp : m_inputOffset; -#else - const short *weight = matrix; -#endif const int intermediateWidth = transpose ? m_reducedPredictionSize.height : m_reducedPredictionSize.width; const int intermediateHeight = transpose ? m_reducedPredictionSize.width : m_reducedPredictionSize.height; const int xStep = leaveHorOut ? 2 : 1; const int yStep = leaveVerOut ? intermediateWidth : 0; -#if JVET_O0925_MIP_SIMPLIFICATIONS const int redSize = (m_blockSize.width <= 8 && m_blockSize.height <= 8) ? 0 : 1; if ( redSize ) weight += xStep-1; -#endif int posRes = 0; -#if !JVET_O0925_MIP_SIMPLIFICATIONS - int posBias = 0; -#endif for (int y = 0; y < intermediateHeight; y++) { for (int x = 0; x < intermediateWidth; x++) { -#if JVET_O0925_MIP_SIMPLIFICATIONS if(redSize) weight -= xStep; int tmp0 = redSize ? 0 : (input[0] * weight[0]); int tmp1 = input[1] * weight[1]; int tmp2 = input[2] * weight[2]; int tmp3 = input[3] * weight[3]; for (int i = 4; i < inputSize; i += 4) -#else - int tmp0 = 0; - int tmp1 = 0; - int tmp2 = 0; - int tmp3 = 0; - for (int i = 0; i < inputSize - 1; i += 4) -#endif { tmp0 += input[i] * weight[i]; tmp1 += input[i + 1] * weight[i + 1]; tmp2 += input[i + 2] * weight[i + 2]; tmp3 += input[i + 3] * weight[i + 3]; } -#if JVET_O0925_MIP_SIMPLIFICATIONS resPtr[posRes++] = ClipBD<int>( ((tmp0 + tmp1 + tmp2 + tmp3 + offset) >> shiftMatrix) + inputOffset, bitDepth ); -#else - resPtr[posRes++] = ((tmp0 + tmp1 + tmp2 + tmp3) + (bias[posBias] << shiftBias) + offset) >> shiftMatrix; -#endif weight += xStep * inputSize; -#if !JVET_O0925_MIP_SIMPLIFICATIONS - posBias += xStep; -#endif } -#if JVET_O0925_MIP_SIMPLIFICATIONS weight += yStep * (inputSize - redSize); -#else - weight += yStep * inputSize; -#endif -#if !JVET_O0925_MIP_SIMPLIFICATIONS - posBias += yStep; -#endif } // Re-transpose if no upsampling will be done. diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.h b/source/Lib/CommonLib/MatrixIntraPrediction.h index 75957811755406eeceb4c1310f724ff54bb32a29..fcc1bbd33d9133bc8d5bc71d62ac3a53821fe3a7 100644 --- a/source/Lib/CommonLib/MatrixIntraPrediction.h +++ b/source/Lib/CommonLib/MatrixIntraPrediction.h @@ -50,43 +50,27 @@ class MatrixIntraPrediction public: MatrixIntraPrediction(); -#if JVET_O0925_MIP_SIMPLIFICATIONS void prepareInputForPred(const CPelBuf &pSrc, const Area& block, const int bitDepth); -#else - void prepareInputForPred(const CPelBuf &src, const Area& block, const int bitDepth, const AvailableInfo &availInfo); -#endif void predBlock(int* const result, const int modeIdx, const int bitDepth); private: static_vector<int, MIP_MAX_INPUT_SIZE> m_reducedBoundary; // downsampled boundary of a block static_vector<int, MIP_MAX_INPUT_SIZE> m_reducedBoundaryTransposed; // downsampled, transposed boundary of a block -#if JVET_O0925_MIP_SIMPLIFICATIONS int m_inputOffset; int m_inputOffsetTransp; static_vector<int, MIP_MAX_WIDTH> m_refSamplesTop; // top reference samples for upsampling static_vector<int, MIP_MAX_HEIGHT> m_refSamplesLeft; // left reference samples for upsampling -#else - static_vector<int, MIP_MAX_WIDTH> m_boundaryForUpsamplingTop; // top boundary samples for upsampling - static_vector<int, MIP_MAX_HEIGHT> m_boundaryForUpsamplingLeft; // left boundary samples for upsampling -#endif Size m_blockSize; int m_numModes; Size m_reducedBoundarySize; Size m_reducedPredictionSize; -#if !JVET_O0925_MIP_SIMPLIFICATIONS - Size m_boundarySizeForUpsampling; -#endif unsigned int m_upsmpFactorHor; unsigned int m_upsmpFactorVer; void initPredBlockParams(const Size& block); -#if JVET_O0925_MIP_SIMPLIFICATIONS static void boundaryDownsampling1D(int* reducedDst, const int* const fullSrc, const SizeType srcLen, const SizeType dstLen); -#else - static void boundaryDownsampling1D( int* reducedDst, int* fullSrcAndIntermediateDst, const SizeType srcLen, const SizeType dstLen, const bool saveIntermediate, const SizeType intermediateLen ); -#endif static void doDownsampling( int* dst, const int* src, const SizeType srcLen, const SizeType dstLen ); void predictionUpsampling( int* const dst, const int* const src, const bool transpose ) const; @@ -94,33 +78,18 @@ public: const SizeType srcSizeUpsmpDim, const SizeType srcSizeOrthDim, const SizeType srcStep, const SizeType srcStride, const SizeType dstStep, const SizeType dstStride, -#if JVET_O0925_MIP_SIMPLIFICATIONS const SizeType bndryStep, -#endif const unsigned int upsmpFactor ); -#if JVET_O0925_MIP_SIMPLIFICATIONS void getMatrixData(const uint8_t*& matrix, int &shiftMatrix, int &offsetMatrix, const int modeIdx) const; -#else - void getMatrixBias( const short*& matrix, const short*& bias, const int modeIdx ) const; - void getShifts( int &shiftMatrix, int &shiftBias, const int modeIdx, const int bitDepth ) const; -#endif bool isTransposed( const int modeIdx ) const; int getWeightIdx( const int modeIdx ) const; -#if JVET_O0925_MIP_SIMPLIFICATIONS void computeReducedPred( int*const result, const int* const input, const uint8_t*matrix, const bool leaveHorOut, const bool leaveVerOut, const int shiftMatrix, const int offsetMatrix, const bool transpose, const bool needUpsampling, const int bitDepth ); -#else - void xComputeMatrixTimesRedBndryPlusBias( int*const result, const int* const input, - const short*matrix, const short*bias, - const bool leaveHorOut, const bool leaveVerOut, - const int shiftMatrix, const int shiftBias, - const bool transpose, const bool needUpsampling ); -#endif }; #endif //__MATRIXINTRAPPREDICTION__ diff --git a/source/Lib/CommonLib/MipData.h b/source/Lib/CommonLib/MipData.h index 55a09dbc2acb654d41406140aff998691cba4b58..c179b31a66eb66a0bd0c0ca1875830dc07852648 100644 --- a/source/Lib/CommonLib/MipData.h +++ b/source/Lib/CommonLib/MipData.h @@ -35,7 +35,6 @@ \brief weight and bias data for matrix-based intra prediction (MIP) */ -#if JVET_O0925_MIP_SIMPLIFICATIONS ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipMatrix4x4[18][16][4]) = { { @@ -965,983 +964,3 @@ ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipOffsetMatrix16x16[6]) = ALIGN_DATA(MEMORY_ALIGN_DEF_SIZE, const uint8_t mipShiftMatrix16x16[6]) = { 7, 5, 6, 6, 6, 6 }; -#else -#include "CommonDef.h" - -ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, const short mipMatrix4x4[18][16][4] )= -{ - { - { 132, -13, 142, -13 }, - { 169, 66, 4, 19 }, - { -32, 273, -9, 29 }, - { -66, 250, 8, 9 }, - { -3, 20, 180, 63 }, - { 2, 123, 10, 124 }, - { -57, 193, -40, 89 }, - { -17, 105, -34, 67 }, - { -12, 28, -28, 273 }, - { -39, 87, -59, 193 }, - { -28, 85, -30, 82 }, - { -12, 71, -24, 71 }, - { 2, 10, -58, 243 }, - { -33, 67, -13, 98 }, - { -24, 74, -10, 66 }, - { -19, 73, -17, 66 } - }, - { - { 32, -10, 224, 6 }, - { 137, -37, 145, 6 }, - { 93, 123, 36, 0 }, - { -9, 273, -10, -5 }, - { -9, 3, 265, -8 }, - { -17, -7, 283, -16 }, - { -5, -10, 267, -16 }, - { -119, 184, 167, -5 }, - { 6, -4, 86, 165 }, - { 4, -10, 45, 194 }, - { 8, -35, 13, 221 }, - { -35, -15, -4, 241 }, - { -1, -15, -125, 369 }, - { -1, -22, -125, 361 }, - { -1, -25, -124, 352 }, - { 14, -41, -117, 337 } - }, - { - { 164, 12, 115, -44 }, - { 244, -5, 34, -33 }, - { 213, 41, 19, -24 }, - { -86, 336, 3, -27 }, - { -56, 2, 262, 39 }, - { -5, 14, 190, 24 }, - { 90, 7, 78, 17 }, - { -51, 215, -21, 13 }, - { -6, -4, 0, 262 }, - { -22, 0, 11, 257 }, - { -16, -8, 15, 243 }, - { -40, 47, -20, 214 }, - { -2, 3, 6, 248 }, - { -4, 4, 7, 247 }, - { -5, 2, 11, 249 }, - { -1, -12, 18, 247 } - }, - { - { 44, -8, 248, -29 }, - { 232, -20, 46, -4 }, - { 97, 187, -35, 4 }, - { -34, 279, 2, 6 }, - { -12, 7, 200, 62 }, - { 40, -22, 174, 62 }, - { 97, 107, -8, 56 }, - { -6, 271, -47, 22 }, - { 2, 4, 24, 227 }, - { 3, -9, 38, 223 }, - { -20, 36, 67, 170 }, - { -68, 209, 27, -6 }, - { -3, 0, 5, 251 }, - { 6, 0, 1, 249 }, - { -11, -7, 44, 212 }, - { -179, 87, 176, -35 } - }, - { - { 89, -18, 246, -68 }, - { 43, 62, 167, -25 }, - { -52, 192, 40, 51 }, - { -18, 179, -69, 125 }, - { -48, 3, 156, 140 }, - { -38, 3, 66, 210 }, - { -26, 1, 13, 247 }, - { -13, 1, -6, 253 }, - { 2, 0, -18, 267 }, - { 0, 1, -12, 260 }, - { -5, 4, 1, 250 }, - { -9, 5, 8, 246 }, - { -6, 1, 8, 248 }, - { -7, 2, 8, 247 }, - { -10, 5, 5, 249 }, - { -10, 5, 4, 248 } - }, - { - { 69, 2, 189, -2 }, - { 196, -17, 74, 1 }, - { 276, -23, -1, 0 }, - { 167, 92, -4, 1 }, - { -11, 0, 280, -15 }, - { 2, 4, 262, -14 }, - { 96, -5, 168, -5 }, - { 227, -30, 56, -1 }, - { 1, -1, 147, 111 }, - { -1, -5, 238, 22 }, - { -14, 0, 284, -17 }, - { 21, 2, 246, -17 }, - { 4, -2, -35, 288 }, - { 5, -5, 21, 234 }, - { 6, -7, 116, 140 }, - { -1, -5, 206, 51 } - }, - { - { 149, -11, 134, -12 }, - { 113, 82, 79, -17 }, - { -5, 237, 41, -19 }, - { -20, 266, 8, -1 }, - { -74, 9, 296, 22 }, - { -100, 63, 228, 60 }, - { -129, 159, 91, 132 }, - { -71, 177, -46, 172 }, - { -15, -5, 35, 242 }, - { -20, 21, -42, 284 }, - { -31, 47, -62, 242 }, - { -35, 59, -44, 169 }, - { 23, 22, -102, 288 }, - { 3, 46, -57, 180 }, - { -7, 55, -19, 106 }, - { -13, 60, -10, 101 } - }, - { - { 183, 12, 81, -17 }, - { 274, -11, -12, 0 }, - { 223, 29, 2, 5 }, - { -22, 274, -2, 0 }, - { 0, 1, 255, -1 }, - { 149, 6, 115, -19 }, - { 280, -25, 12, -19 }, - { 161, 91, 11, -17 }, - { -15, -2, 48, 224 }, - { -11, -3, 84, 179 }, - { 116, -9, 8, 129 }, - { 257, -29, -72, 74 }, - { 4, 1, -17, 267 }, - { -3, 1, -16, 271 }, - { -8, -2, -14, 272 }, - { 93, -30, -93, 258 } - }, - { - { 205, -44, 129, -41 }, - { 280, -48, 41, -32 }, - { 71, 188, 10, -27 }, - { -16, 266, 19, -24 }, - { -53, 8, 253, 40 }, - { 50, -35, 184, 29 }, - { 69, 41, 64, 19 }, - { -46, 232, -35, 17 }, - { -11, 1, 0, 260 }, - { -21, -1, 8, 257 }, - { -11, -17, 8, 245 }, - { -119, 135, -50, 224 }, - { -3, 2, 6, 250 }, - { -5, 5, 7, 249 }, - { 0, -2, 10, 251 }, - { -36, 26, 15, 248 } - }, - { - { -41, 96, 265, -58 }, - { -99, 156, 141, 57 }, - { -61, 95, 49, 170 }, - { -15, 28, 13, 230 }, - { -49, 19, 71, 212 }, - { -4, -16, 7, 268 }, - { 6, -21, 12, 263 }, - { -2, -6, 20, 251 }, - { 7, -2, -5, 259 }, - { -1, 4, 14, 246 }, - { -6, 9, 15, 245 }, - { -5, 7, 15, 247 }, - { -4, 3, 16, 247 }, - { -4, 3, 14, 251 }, - { -3, 3, 13, 251 }, - { -2, 3, 15, 249 } - }, - { - { 145, -30, 241, -108 }, - { 234, -111, 222, -105 }, - { 305, -175, 207, -101 }, - { 315, -178, 192, -95 }, - { -39, -71, 254, 109 }, - { -15, -99, 257, 106 }, - { 36, -151, 258, 101 }, - { 112, -222, 250, 99 }, - { 14, -11, -15, 269 }, - { 12, -9, -12, 268 }, - { 2, -1, -5, 266 }, - { 1, -6, 8, 261 }, - { -5, -1, 25, 242 }, - { 1, -7, 28, 242 }, - { 6, -12, 28, 242 }, - { 11, -16, 29, 243 } - }, - { - { 38, -15, 237, 4 }, - { 95, 22, 148, -3 }, - { 39, 212, 21, -20 }, - { -2, 267, 2, -15 }, - { -10, 2, 258, 2 }, - { -26, 1, 252, 26 }, - { -70, 112, 132, 81 }, - { -45, 242, -78, 115 }, - { -1, -8, 52, 213 }, - { -2, -4, -26, 273 }, - { -30, 16, -46, 253 }, - { -50, 84, -75, 169 }, - { 3, 15, -116, 321 }, - { 3, 24, -75, 204 }, - { 15, 27, -35, 101 }, - { 13, 30, -16, 78 } - }, - { - { 21, 0, 232, 5 }, - { 3, 31, 220, 3 }, - { -22, 75, 203, -1 }, - { -35, 109, 182, -3 }, - { -27, 20, 263, -1 }, - { -34, 26, 261, 2 }, - { -36, 27, 262, 4 }, - { -39, 33, 259, 6 }, - { -14, 16, 235, 26 }, - { -20, 24, 246, 11 }, - { -29, 33, 246, 6 }, - { -37, 41, 240, -10 }, - { 12, -17, -200, 435 }, - { 8, -19, -170, 376 }, - { -6, -15, -120, 280 }, - { -19, -8, -74, 200 } - }, - { - { 24, -11, 235, 11 }, - { 84, -32, 196, 12 }, - { 35, 74, 142, 8 }, - { -93, 255, 92, 2 }, - { -7, 6, 263, -7 }, - { -16, 6, 271, -7 }, - { -2, -14, 275, -3 }, - { -47, 40, 262, 2 }, - { 8, 14, 158, 112 }, - { 11, 10, 184, 77 }, - { 7, 10, 205, 49 }, - { 18, -8, 223, 29 }, - { -5, -34, -115, 340 }, - { -1, -46, -101, 313 }, - { 0, -52, -85, 289 }, - { -5, -49, -62, 260 } - }, - { - { 79, 11, 177, -16 }, - { -33, 202, 102, -9 }, - { -65, 266, -22, 92 }, - { 47, 148, -156, 202 }, - { -115, 120, 200, 68 }, - { -34, 139, -45, 199 }, - { 83, 29, -186, 273 }, - { 103, -19, -204, 264 }, - { 15, 24, -85, 295 }, - { 61, -38, -154, 281 }, - { 46, -48, -143, 238 }, - { 39, -33, -143, 228 }, - { 32, -43, -110, 275 }, - { 19, -50, -108, 230 }, - { 17, -43, -118, 228 }, - { 22, -37, -128, 228 } - }, - { - { 21, 1, 231, 6 }, - { 4, 30, 219, 4 }, - { -19, 72, 203, 0 }, - { -25, 100, 182, -2 }, - { -23, 17, 263, -2 }, - { -30, 24, 260, 1 }, - { -31, 23, 260, 3 }, - { -32, 27, 258, 5 }, - { -10, 14, 231, 32 }, - { -17, 23, 246, 12 }, - { -26, 31, 248, 4 }, - { -32, 38, 242, -10 }, - { 4, -12, -193, 420 }, - { -3, -12, -162, 360 }, - { -14, -10, -113, 267 }, - { -24, -4, -65, 180 } - }, - { - { 10, -9, 304, -55 }, - { 12, -15, 305, -56 }, - { -14, 14, 293, -45 }, - { -182, 186, 260, -19 }, - { -17, 9, 175, 89 }, - { -14, 7, 126, 134 }, - { 3, -11, 82, 176 }, - { 11, -20, 50, 205 }, - { 3, -2, -11, 264 }, - { 3, -2, -15, 267 }, - { -4, 4, -12, 264 }, - { 3, -2, -4, 256 }, - { -3, -1, 6, 250 }, - { -3, -2, 9, 247 }, - { -4, -1, 8, 247 }, - { -7, 2, 8, 246 } - }, - { - { -23, -3, 283, -2 }, - { -18, -11, 287, -2 }, - { -2, -26, 287, -3 }, - { -1, -21, 282, -4 }, - { 18, 2, 234, 3 }, - { 16, 5, 233, 3 }, - { 13, 7, 231, 5 }, - { 17, 0, 229, 10 }, - { 2, -1, 9, 246 }, - { 2, -1, 6, 249 }, - { 1, 1, 3, 251 }, - { -1, 3, 3, 251 }, - { 0, 0, -11, 267 }, - { 0, 1, -11, 266 }, - { 1, 1, -10, 264 }, - { 1, 1, -9, 263 } - } -}; -ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, const short mipBias4x4[18][16] )= -{ - { 3, 10, -3, -4, 8, -2, -6, 1, -3, -5, -2, -3, -1, 2, -3, 1 }, - { 4, 5, 3, 4, 4, 11, 19, 25, 3, 24, 51, 70, 28, 44, 55, 63 }, - { 2, 6, 0, 29, 0, 1, 4, 33, 4, 7, 6, 15, -1, 0, 0, 5 }, - { 1, 1, 1, 3, -1, 2, 3, 13, 0, 1, 3, 87, 3, -1, 16, 191 }, - { 6, 8, 24, 37, 4, 14, 19, 20, 5, 7, 6, 6, 4, 6, 6, 8 }, - { 0, 2, 3, -1, 2, 2, 2, 4, -1, 1, 3, 3, 0, -1, 0, 2 }, - { -3, -2, -3, -6, 1, -5, -11, 30, -13, 19, 114, 207, 67, 183, 255, 253 }, - { -2, 4, -1, 3, 1, 4, 7, 7, 1, 4, 11, 21, 1, 2, 6, 23 }, - { 12, 20, 16, 12, 11, 42, 89, 115, 4, 13, 35, 81, 4, 2, -3, 2 }, - { -6, 0, 3, 0, 3, 1, -4, -7, -3, -6, -7, -9, -7, -8, -9, -10 }, - { 8, 15, 20, 21, 2, 7, 12, 16, -1, -3, -6, -8, -5, -7, -8, -9 }, - { -6, -4, 6, 6, 4, 7, 13, 21, 8, 11, 15, 23, -9, -3, -2, -4 }, - { -2, -2, 2, 4, 2, 2, -1, -5, -10, -5, 3, 37, 47, 104, 190, 249 }, - { -3, -4, -3, 0, 0, 2, 0, -1, -34, -24, -15, -5, 66, 87, 99, 106 }, - { 7, -6, -18, 17, -20, -6, 63, 122, 6, 113, 172, 172, 108, 173, 178, 175 }, - { -1, -1, -1, -1, 1, 1, 1, 0, -5, -5, -3, 4, 11, 24, 43, 61 }, - { 6, 9, 8, 11, 0, 3, 6, 10, 2, 4, 5, 4, 4, 6, 7, 7 }, - { 1, 1, 1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 } -}; -const int mipShiftBias4x4[18] = -{ - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 -}; -const int mipShiftMatrix4x4[18] = -{ - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 -}; -ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, const short mipMatrix8x8[10][16][8] )= -{ - { - { 42, -26, 8, -1, 270, -41, 7, -3 }, - { 192, -31, -4, 1, 131, -41, 12, -4 }, - { 128, 146, -21, -3, 10, -5, 2, -2 }, - { 14, 136, 111, 1, -9, 7, -3, -1 }, - { -11, 2, -2, 1, 35, 267, -42, 5 }, - { -34, 0, 2, 1, 197, 126, -42, 6 }, - { 52, -41, 8, 1, 257, -15, -3, -1 }, - { 132, 15, -18, 5, 156, -40, 11, -4 }, - { 3, -1, 0, 1, -16, 32, 272, -36 }, - { 9, -2, -1, 1, -47, 199, 129, -32 }, - { -13, 6, -3, 2, 12, 268, -11, -4 }, - { -15, -6, 3, 3, 137, 167, -35, 3 }, - { -3, 0, -2, 1, 4, -15, 24, 246 }, - { -5, 0, -3, 2, 15, -56, 202, 101 }, - { 1, -1, -3, 2, -8, 6, 267, -9 }, - { 5, 0, -3, 4, -29, 145, 152, -18 } - }, - { - { 5, 192, -40, 5, -50, 83, 71, -8 }, - { -8, 9, 238, -14, 9, -36, 18, 40 }, - { 3, -4, 7, 250, 0, 1, -19, 19 }, - { 2, 3, -34, 289, 3, -3, -1, -1 }, - { -23, 55, 97, -21, 13, -65, 125, 74 }, - { 4, -26, 87, 166, -1, 7, -41, 60 }, - { 2, 6, -48, 299, 1, -4, -3, 4 }, - { 2, 4, -33, 288, 3, -4, 0, 0 }, - { -10, -19, 84, 73, 5, 9, -64, 177 }, - { -2, -8, -29, 279, 2, 3, -6, 16 }, - { 2, 2, -37, 293, 2, -4, 2, -2 }, - { 2, 5, -31, 285, 4, -4, 1, -1 }, - { -8, -32, 7, 202, 6, 19, -18, 78 }, - { -4, -3, -41, 288, 4, 3, -2, 11 }, - { 2, 2, -34, 288, 4, -3, 4, -4 }, - { 2, 6, -27, 277, 6, -3, 1, 0 } - }, - { - { 140, 38, -4, 1, 8, 73, -2, 3 }, - { -62, 273, 15, -4, -17, 38, 6, 5 }, - { -5, -45, 294, 3, -25, 23, 6, 6 }, - { 1, 10, -86, 325, -14, 7, 2, -1 }, - { 101, 18, 2, 0, -101, 178, 60, -2 }, - { -66, 275, -8, 0, -99, 96, 49, 8 }, - { -18, -24, 287, -11, -60, 31, 32, 14 }, - { -3, 3, -77, 310, -23, -1, 11, 7 }, - { 74, 7, 5, 0, -70, 9, 179, 53 }, - { -76, 268, -19, 1, -111, 31, 104, 58 }, - { -33, -1, 272, -22, -85, 24, 31, 58 }, - { -7, -5, -68, 290, -36, 4, -16, 38 }, - { 57, 3, 7, -1, -51, 5, -27, 262 }, - { -79, 244, -22, 2, -96, 8, -15, 212 }, - { -51, 26, 241, -25, -88, 6, -23, 146 }, - { -15, -13, -51, 264, -42, -5, -38, 82 } - }, - { - { 218, -56, 9, -3, 411, -76, 12, -4 }, - { 448, 94, -45, 6, 23, -15, 2, -3 }, - { -1, 476, 77, -34, -5, -2, 1, -3 }, - { 1, -16, 466, 61, 5, -4, 1, -3 }, - { -38, 2, -3, 0, 260, 358, -77, 8 }, - { 122, -39, 1, -1, 463, -25, -11, -2 }, - { 405, 54, -41, 5, 121, -33, 2, -6 }, - { 107, 402, 16, -12, 3, -4, 1, -6 }, - { 5, -1, -1, 0, -62, 267, 375, -73 }, - { -25, 3, -4, -1, 108, 466, -28, -11 }, - { 58, -25, -3, -1, 418, 96, -35, -3 }, - { 301, 18, -15, 5, 229, -21, -4, -7 }, - { -1, -3, -2, -2, 24, -95, 291, 297 }, - { 3, 1, -5, -2, -30, 103, 464, -29 }, - { -16, 0, -6, 0, 41, 429, 70, -13 }, - { 27, -5, -2, 1, 303, 193, -13, -1 } - }, - { - { -48, 38, 6, 23, 120, 145, -34, 6 }, - { -27, 25, 32, 56, -15, 217, -34, 1 }, - { -3, 8, 3, 133, -111, 223, 11, -11 }, - { 10, 6, -26, 183, -148, 163, 67, -6 }, - { 7, 4, 1, 25, -69, 155, 160, -30 }, - { -3, 9, -2, 58, -70, 42, 239, -23 }, - { -7, 16, -23, 102, -75, -38, 239, 32 }, - { -7, 18, -22, 120, -85, -62, 168, 113 }, - { -2, 4, -1, 19, -18, -39, 160, 129 }, - { -8, 8, -9, 51, -43, -18, 37, 226 }, - { -11, 12, -20, 81, -65, -3, -45, 287 }, - { -12, 12, -17, 93, -80, 2, -72, 302 }, - { -5, 1, -6, 21, -18, 7, -84, 326 }, - { -14, 5, -13, 45, -33, -6, -79, 322 }, - { -20, 6, -13, 64, -46, -17, -67, 311 }, - { -20, 6, -14, 78, -56, -23, -57, 297 } - }, - { - { -11, -15, 6, 0, 286, -10, 0, -1 }, - { 86, -29, -9, 2, 242, -44, 13, -5 }, - { 104, 64, -28, -8, 157, -42, 14, -6 }, - { 92, 71, 72, -38, 77, -26, 11, -6 }, - { 2, 1, 0, -1, -23, 291, -12, -3 }, - { -24, 4, 1, -1, 58, 259, -49, 5 }, - { -32, -9, 3, 0, 155, 178, -46, 5 }, - { -20, 0, -10, 3, 212, 93, -28, 1 }, - { -4, -1, 0, 0, 4, -23, 291, -13 }, - { 2, -2, 1, -2, -21, 58, 254, -38 }, - { 5, -1, 1, -2, -43, 157, 168, -34 }, - { 2, 0, 4, -4, -35, 222, 82, -19 }, - { 3, -3, 1, -1, -3, 0, -26, 283 }, - { 0, -2, 0, -1, 6, -29, 62, 217 }, - { -2, -1, 1, -2, 14, -59, 171, 130 }, - { -3, 1, 1, -2, 14, -56, 238, 58 } - }, - { - { -84, 52, -6, 0, 255, 63, -38, 12 }, - { -207, 168, 29, -8, 218, 82, -42, 13 }, - { -179, -9, 206, -3, 162, 107, -46, 12 }, - { -143, 13, -61, 252, 98, 124, -42, 10 }, - { 10, 1, 3, -2, -78, 245, 116, -42 }, - { 2, 5, 3, -1, -69, 207, 151, -47 }, - { -10, 2, 18, -6, -63, 171, 188, -51 }, - { -19, -2, -14, 40, -56, 133, 209, -47 }, - { -4, 1, 0, 0, 21, -73, 226, 83 }, - { -3, 3, -2, -1, 18, -65, 189, 114 }, - { -3, 2, -2, -1, 17, -60, 152, 146 }, - { -4, 1, 0, 1, 13, -50, 120, 170 }, - { 2, -1, 0, -1, -10, 26, -74, 311 }, - { -1, 3, -1, -1, -12, 24, -68, 306 }, - { 1, 0, 2, 0, -14, 25, -66, 303 }, - { 0, -1, 1, 4, -14, 24, -58, 294 } - }, - { - { -73, -7, -2, 8, 320, 17, -11, 3 }, - { -40, -37, -1, 12, 319, 10, -9, 2 }, - { -48, -7, -27, 17, 321, 5, -7, 1 }, - { -54, -10, -1, 8, 314, 4, -6, 1 }, - { 22, -1, -1, 4, -91, 308, 32, -16 }, - { 13, 3, -2, 7, -82, 306, 25, -14 }, - { 15, -7, 2, 10, -79, 308, 21, -14 }, - { 13, -7, -6, 17, -71, 303, 19, -13 }, - { -10, -1, -1, 3, 29, -90, 299, 28 }, - { -11, -2, -2, 6, 26, -82, 297, 23 }, - { -10, -6, -2, 10, 26, -81, 299, 20 }, - { -10, -7, -5, 14, 24, -75, 294, 19 }, - { 2, 1, -1, 3, -12, 27, -86, 321 }, - { -2, 1, -1, 7, -10, 25, -78, 314 }, - { -3, -3, -1, 12, -10, 25, -77, 313 }, - { -4, -4, -5, 18, -9, 23, -71, 307 } - }, - { - { -91, 23, 13, 8, 209, 261, 72, 24 }, - { -26, -22, 14, 13, 88, 306, 114, 35 }, - { -16, 18, -16, 5, 31, 327, 135, 39 }, - { -11, 11, 30, -19, 3, 325, 142, 41 }, - { 12, -4, 1, 1, -14, 273, 227, 26 }, - { 3, 10, -3, -5, 6, 231, 249, 34 }, - { 1, 8, 5, -9, 10, 214, 262, 37 }, - { -1, 11, 4, -7, 15, 208, 259, 40 }, - { 5, 0, 4, -4, 6, 92, 340, 78 }, - { 4, 6, 1, -5, 6, 113, 329, 75 }, - { 2, 13, 2, -8, 6, 123, 319, 75 }, - { 1, 13, 6, -10, 9, 136, 303, 74 }, - { 6, 1, 4, -5, 8, 38, 217, 252 }, - { 4, 10, 1, -7, 9, 58, 313, 141 }, - { 3, 12, 4, -8, 11, 70, 327, 114 }, - { 2, 14, 4, -7, 14, 82, 314, 110 } - }, - { - { 103, 77, -13, 1, 11, 78, -2, 2 }, - { -26, 221, 40, -5, -23, 34, 9, 5 }, - { -2, -29, 268, 12, -22, 14, 9, 8 }, - { -6, 12, -76, 321, -11, 1, 3, 2 }, - { 41, 64, -7, 0, -79, 176, 64, -3 }, - { -33, 204, 29, -3, -84, 81, 45, 17 }, - { -9, -10, 256, 1, -49, 18, 17, 28 }, - { -9, 10, -68, 304, -15, -7, -3, 18 }, - { 13, 54, -5, 0, -46, 2, 162, 75 }, - { -50, 172, 27, -3, -87, 27, 75, 94 }, - { -23, 4, 235, -3, -74, 21, 4, 82 }, - { -15, 7, -60, 281, -30, 4, -27, 44 }, - { 5, 46, -2, 0, -35, 2, -18, 257 }, - { -53, 132, 27, -2, -64, 3, -6, 215 }, - { -39, 12, 198, -1, -71, 5, -13, 141 }, - { -22, 2, -47, 251, -40, -2, -21, 64 } - } -}; -ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, const short mipBias8x8[10][16] )= -{ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 1, 0, -1, 0, 1, 0, -1, 1, 1, -1, -2, 2, 1, -1, -2 }, - { 0, 2, 0, 18, 0, 2, 8, 42, -1, 1, 20, 76, 1, 5, 34, 99 }, - { 1, 2, 3, 1, 1, 3, 3, 3, 2, 4, 4, 4, 3, 5, 5, 5 }, - { 0, 0, 1, 4, 2, 4, 7, 11, 2, 9, 17, 22, 12, 23, 31, 37 }, - { 1, 1, 2, 3, 1, 2, 2, 3, 1, 3, 3, 3, 2, 2, 3, 4 }, - { 1, 2, 3, 4, 3, 4, 6, 8, 1, 3, 4, 4, 3, 5, 5, 6 }, - { 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1 }, - { -7, -10, -11, -11, -10, -14, -17, -18, -11, -15, -19, -21, -10, -17, -21, -22 }, - { -1, -1, -3, -1, 0, -1, -5, 2, -1, -1, -5, 6, 0, -2, -4, 10 } -}; -const int mipShiftBias8x8[10] = -{ - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 -}; -const int mipShiftMatrix8x8[10] = -{ - 8, 8, 8, 9, 8, 8, 8, 8, 9, 8 -}; -ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, const short mipMatrix16x16[6][64][8] )= -{ - { - { -44, 32, 26, 9, 248, -21, 9, -3 }, - { -51, 11, 43, 34, 214, 2, 6, -3 }, - { -27, -28, 50, 66, 159, 36, 2, -2 }, - { -11, -35, 33, 100, 101, 73, -3, -1 }, - { -8, -6, -8, 131, 50, 105, -8, 0 }, - { -5, 15, -26, 145, 3, 132, -10, 2 }, - { 0, 17, -4, 130, -35, 155, -11, 2 }, - { 7, 15, 12, 118, -60, 167, -8, 4 }, - { -15, -19, -3, 22, 112, 171, -13, 0 }, - { -7, -17, -14, 35, 73, 200, -13, 1 }, - { -6, -8, -24, 42, 41, 221, -13, 2 }, - { -5, -3, -24, 43, 18, 234, -10, 2 }, - { -2, -4, -17, 41, 0, 239, -4, 2 }, - { -1, -3, -13, 41, -16, 240, 4, 2 }, - { -1, 1, -14, 46, -27, 232, 15, 2 }, - { -2, 4, -15, 52, -35, 216, 29, 4 }, - { 2, 0, -13, 14, -5, 252, 2, 5 }, - { 2, 0, -14, 17, -12, 248, 10, 4 }, - { 2, -1, -14, 18, -13, 232, 30, 2 }, - { 1, -2, -13, 18, -14, 212, 53, -1 }, - { 0, -1, -13, 17, -13, 189, 79, -5 }, - { -2, 0, -12, 18, -13, 163, 107, -7 }, - { -2, 0, -11, 18, -13, 135, 132, -6 }, - { -2, 0, -11, 20, -13, 111, 147, 1 }, - { 2, 1, -6, 8, -16, 151, 120, -5 }, - { 1, 1, -6, 8, -12, 118, 153, -8 }, - { 0, 1, -7, 9, -8, 87, 180, -7 }, - { 0, 0, -8, 9, -6, 64, 199, -5 }, - { -1, 0, -8, 9, -4, 43, 212, 1 }, - { -2, 0, -9, 10, -3, 27, 218, 11 }, - { -2, 0, -9, 12, -3, 18, 211, 25 }, - { -2, 0, -9, 14, -4, 15, 196, 42 }, - { 0, 1, -3, 4, -3, 11, 236, 9 }, - { 0, 1, -4, 4, -1, -1, 234, 21 }, - { 0, 0, -5, 6, -2, -3, 214, 43 }, - { -1, 0, -6, 8, -3, -4, 193, 65 }, - { 0, 0, -6, 9, -4, -3, 171, 87 }, - { -1, 0, -7, 10, -5, -2, 146, 110 }, - { -1, 0, -8, 13, -5, 1, 122, 131 }, - { -1, 0, -9, 14, -7, 5, 102, 148 }, - { 0, 1, -2, 3, -1, -12, 142, 125 }, - { -1, 1, -3, 4, -2, -9, 111, 153 }, - { -1, 1, -4, 7, -4, -5, 84, 176 }, - { -1, 0, -4, 8, -5, -3, 63, 195 }, - { -1, 0, -6, 10, -6, -2, 45, 212 }, - { -2, 0, -7, 13, -7, 0, 30, 225 }, - { -2, 0, -8, 15, -8, 1, 20, 233 }, - { -2, 0, -8, 16, -10, 3, 17, 235 }, - { -1, 0, -2, 3, -1, -2, 4, 253 }, - { -1, 0, -3, 5, -2, -2, -6, 263 }, - { -2, 0, -4, 8, -3, -3, -10, 268 }, - { -2, 0, -5, 10, -4, -4, -14, 272 }, - { -3, 0, -7, 13, -5, -5, -17, 276 }, - { -3, 0, -9, 16, -6, -6, -18, 278 }, - { -3, 0, -9, 17, -8, -6, -18, 278 }, - { -3, 0, -9, 18, -9, -5, -16, 275 }, - { -1, -1, -3, 5, 0, -6, -35, 294 }, - { -1, -1, -3, 6, -2, -6, -33, 293 }, - { -2, -1, -5, 10, -3, -8, -32, 293 }, - { -1, -2, -6, 12, -4, -9, -32, 294 }, - { -2, -1, -7, 14, -5, -10, -31, 294 }, - { -3, 0, -9, 17, -6, -11, -30, 292 }, - { -3, 1, -10, 18, -8, -11, -28, 291 }, - { -3, 1, -10, 19, -8, -11, -25, 286 } - }, - { - { 78, 15, 0, 0, 158, 7, 0, -2 }, - { 117, 35, 2, -1, 96, 9, 0, -2 }, - { 115, 72, 9, -1, 55, 7, 1, -2 }, - { 75, 116, 26, -1, 36, 4, 3, -2 }, - { 41, 117, 71, 0, 24, 2, 3, -2 }, - { 28, 62, 138, 12, 14, 1, 3, -1 }, - { 22, 14, 140, 69, 8, 1, 3, -2 }, - { 16, 10, 34, 188, 7, 2, 1, -1 }, - { 18, 5, 1, 0, 171, 64, -1, -2 }, - { 51, 11, 2, 0, 158, 37, 1, -3 }, - { 81, 28, 1, 0, 123, 24, 1, -3 }, - { 96, 51, 5, 1, 89, 15, 3, -3 }, - { 89, 78, 19, 0, 63, 8, 3, -3 }, - { 69, 94, 44, 2, 43, 4, 3, -3 }, - { 51, 78, 86, 10, 29, 3, 3, -3 }, - { 38, 49, 98, 47, 21, 3, 3, -3 }, - { 5, 1, 1, 0, 83, 162, 5, -2 }, - { 16, 2, 1, 1, 123, 112, 4, -3 }, - { 37, 8, 1, 1, 135, 74, 3, -3 }, - { 60, 19, 1, 1, 127, 49, 3, -4 }, - { 77, 38, 4, 0, 107, 32, 2, -3 }, - { 80, 61, 11, 1, 84, 21, 2, -4 }, - { 72, 76, 30, 2, 63, 14, 2, -4 }, - { 59, 72, 55, 11, 48, 12, 3, -4 }, - { 3, -1, 0, 1, 19, 178, 61, -4 }, - { 5, -1, 0, 1, 55, 166, 33, -4 }, - { 13, 1, -1, 1, 90, 134, 20, -4 }, - { 28, 6, -1, 1, 109, 105, 11, -4 }, - { 45, 15, 0, 1, 114, 78, 7, -4 }, - { 59, 31, 2, 1, 107, 57, 4, -5 }, - { 64, 49, 9, 1, 92, 43, 3, -5 }, - { 62, 59, 23, 5, 74, 34, 3, -5 }, - { 1, -2, 1, 0, 7, 87, 167, -6 }, - { 1, -2, 0, 1, 22, 129, 112, -6 }, - { 3, -2, 0, 1, 45, 145, 70, -5 }, - { 10, 0, -1, 1, 68, 140, 44, -6 }, - { 21, 4, 0, 1, 87, 123, 27, -6 }, - { 33, 13, 0, 1, 96, 103, 16, -7 }, - { 44, 27, 2, 2, 94, 83, 11, -6 }, - { 48, 38, 10, 4, 85, 67, 10, -6 }, - { 0, -1, 1, 0, 5, 11, 205, 36 }, - { -2, -1, 0, 0, 9, 55, 183, 11 }, - { -3, -1, 0, 0, 19, 98, 142, 1 }, - { 0, -2, 0, 0, 35, 125, 103, -4 }, - { 6, -2, 0, 1, 51, 134, 72, -6 }, - { 15, 2, 0, 2, 66, 129, 49, -7 }, - { 25, 11, 0, 3, 75, 116, 34, -7 }, - { 32, 21, 4, 4, 76, 98, 27, -6 }, - { 0, -1, 0, 0, 1, 4, 91, 161 }, - { -2, -1, -1, 0, 3, 18, 146, 91 }, - { -4, -2, -1, 1, 8, 46, 164, 44 }, - { -6, -3, 0, 1, 17, 77, 151, 17 }, - { -3, -4, 1, 1, 29, 102, 125, 4 }, - { 3, -3, 0, 3, 41, 116, 98, -2 }, - { 10, 2, 0, 4, 52, 119, 74, -4 }, - { 16, 10, 3, 5, 59, 109, 57, -2 }, - { 0, -2, -1, 0, 1, 14, -26, 269 }, - { -2, -2, -1, 0, 1, 17, 33, 208 }, - { -4, -2, -1, 1, 3, 27, 93, 139 }, - { -5, -3, 0, 1, 9, 44, 129, 82 }, - { -5, -4, 1, 2, 16, 65, 135, 47 }, - { -2, -4, 1, 3, 25, 83, 125, 26 }, - { 2, -2, 1, 4, 35, 94, 106, 15 }, - { 7, 3, 2, 6, 42, 96, 87, 12 } - }, - { - { 71, 17, 6, 4, 135, 11, 8, 4 }, - { 45, 82, 4, 9, 69, 33, 10, 4 }, - { -13, 144, 15, 16, 35, 41, 13, 5 }, - { -29, 103, 86, 16, 16, 44, 16, 5 }, - { -18, 22, 149, 34, 1, 42, 19, 7 }, - { -11, -6, 103, 111, -8, 37, 25, 8 }, - { -9, -3, 22, 190, -13, 26, 33, 10 }, - { -4, -1, -8, 215, -17, 13, 40, 20 }, - { -9, 20, 10, 6, 106, 117, -3, 9 }, - { -11, 41, 16, 17, 55, 120, 9, 11 }, - { -22, 58, 25, 29, 13, 119, 20, 14 }, - { -24, 43, 49, 43, -11, 108, 34, 16 }, - { -18, 12, 66, 66, -25, 88, 49, 18 }, - { -12, -4, 45, 110, -32, 64, 64, 23 }, - { -8, -6, 11, 150, -34, 38, 74, 32 }, - { -4, -6, -3, 164, -34, 17, 74, 49 }, - { -9, 8, 9, 10, 11, 203, 8, 16 }, - { -12, 13, 13, 23, -6, 173, 33, 20 }, - { -13, 14, 16, 38, -20, 137, 62, 24 }, - { -13, 9, 20, 54, -30, 100, 88, 29 }, - { -10, 2, 20, 71, -36, 67, 105, 38 }, - { -8, -3, 11, 93, -39, 39, 112, 51 }, - { -6, -5, 2, 109, -38, 17, 104, 73 }, - { -3, -6, 0, 115, -36, 2, 85, 99 }, - { -3, -1, 6, 14, -16, 134, 112, 11 }, - { -5, -2, 6, 26, -18, 94, 131, 23 }, - { -7, 0, 4, 38, -21, 60, 142, 39 }, - { -7, 0, 3, 51, -25, 36, 140, 59 }, - { -5, -2, 3, 60, -28, 19, 126, 84 }, - { -4, -2, -1, 70, -30, 6, 106, 112 }, - { -3, -3, -2, 77, -31, -5, 85, 137 }, - { -2, -4, -2, 82, -31, -10, 66, 156 }, - { -1, -3, 1, 15, -8, 25, 198, 29 }, - { -1, -4, -1, 25, -12, 14, 174, 61 }, - { -3, -2, -5, 35, -15, 7, 142, 96 }, - { -3, -1, -6, 42, -19, 1, 113, 128 }, - { -1, -2, -4, 46, -22, -4, 86, 157 }, - { -1, -1, -4, 51, -23, -9, 65, 178 }, - { 0, -1, -4, 55, -25, -13, 48, 195 }, - { 0, -2, -3, 59, -26, -14, 35, 205 }, - { 1, -4, -3, 13, -6, -5, 141, 119 }, - { 1, -3, -7, 22, -10, -6, 105, 153 }, - { -1, 0, -11, 29, -12, -8, 75, 182 }, - { -1, 0, -9, 33, -14, -11, 53, 204 }, - { 0, -1, -6, 34, -17, -13, 35, 221 }, - { 0, -1, -5, 36, -19, -15, 22, 234 }, - { 1, -1, -4, 39, -20, -18, 13, 243 }, - { 2, -1, -2, 42, -22, -18, 7, 246 }, - { 2, -2, -6, 11, -4, -6, 39, 222 }, - { 1, -1, -11, 18, -7, -9, 24, 239 }, - { 0, 2, -13, 23, -8, -12, 13, 250 }, - { -1, 2, -10, 24, -11, -14, 4, 260 }, - { 0, 0, -6, 24, -12, -17, -3, 267 }, - { 0, -1, -3, 25, -14, -19, -10, 273 }, - { 1, -1, -2, 27, -15, -21, -13, 275 }, - { 2, -1, -2, 31, -18, -22, -13, 272 }, - { 2, -1, -8, 9, -3, -7, -12, 274 }, - { 2, 0, -11, 14, -4, -11, -15, 279 }, - { 0, 3, -11, 16, -6, -15, -18, 283 }, - { -2, 4, -9, 17, -7, -16, -21, 286 }, - { -1, 1, -5, 17, -8, -18, -23, 288 }, - { -1, 0, -3, 18, -10, -20, -24, 289 }, - { 0, 0, -2, 21, -12, -21, -25, 288 }, - { 1, -1, -2, 26, -14, -21, -24, 284 } - }, - { - { -21, 97, -12, -3, 185, 15, -5, 0 }, - { -40, 153, 13, -5, 68, 87, -21, 2 }, - { -17, 83, 97, -4, 4, 110, -14, -3 }, - { 3, -3, 157, 22, -15, 83, 19, -10 }, - { 4, -14, 102, 98, -14, 41, 50, -9 }, - { 3, -3, 21, 172, -10, 10, 61, 3 }, - { 2, 1, -1, 188, -7, -11, 58, 27 }, - { 4, 3, 1, 173, -7, -23, 46, 58 }, - { -31, 47, 24, -4, 56, 198, -40, 6 }, - { -3, 9, 71, 5, -6, 187, -5, -2 }, - { 6, -16, 79, 40, -19, 117, 57, -7 }, - { 6, -13, 40, 91, -15, 47, 97, 4 }, - { 5, -7, 9, 124, -11, 5, 101, 31 }, - { 4, -1, -7, 135, -10, -16, 87, 63 }, - { 4, 5, -11, 132, -9, -25, 64, 97 }, - { 6, 6, -5, 121, -10, -27, 39, 125 }, - { 8, -10, 34, 6, -24, 217, 27, -2 }, - { 9, -21, 35, 35, -18, 111, 109, -5 }, - { 6, -13, 10, 70, -11, 34, 142, 18 }, - { 5, -4, -8, 89, -8, -3, 126, 59 }, - { 3, 1, -12, 93, -7, -17, 96, 99 }, - { 3, 4, -11, 91, -8, -22, 65, 134 }, - { 4, 5, -7, 85, -9, -25, 40, 161 }, - { 4, 6, -2, 81, -10, -23, 23, 175 }, - { 8, -14, 11, 21, -12, 71, 181, -10 }, - { 4, -10, -4, 47, -4, 12, 180, 31 }, - { 3, -3, -14, 62, -2, -8, 133, 87 }, - { 3, 0, -16, 65, -4, -14, 86, 135 }, - { 3, 3, -13, 63, -5, -17, 52, 170 }, - { 2, 4, -8, 60, -7, -19, 29, 193 }, - { 2, 5, -4, 56, -8, -19, 16, 204 }, - { 2, 4, 0, 56, -8, -18, 11, 206 }, - { 3, -5, -9, 26, -1, -4, 198, 47 }, - { 2, -2, -16, 40, -1, -10, 127, 116 }, - { 1, 1, -18, 45, -2, -11, 70, 169 }, - { 2, 2, -15, 45, -4, -12, 37, 199 }, - { 2, 2, -10, 43, -6, -12, 18, 216 }, - { 3, 3, -6, 41, -9, -13, 8, 226 }, - { 2, 4, -3, 40, -10, -13, 3, 229 }, - { 2, 4, -1, 41, -10, -13, 2, 226 }, - { 1, 0, -13, 21, -1, -5, 96, 158 }, - { 2, 1, -16, 29, -3, -5, 44, 204 }, - { 1, 2, -16, 31, -3, -6, 19, 226 }, - { 1, 2, -12, 30, -5, -7, 7, 236 }, - { 1, 2, -7, 29, -7, -8, 2, 241 }, - { 1, 2, -4, 28, -9, -9, -2, 243 }, - { 1, 3, -2, 28, -10, -10, -3, 243 }, - { 2, 3, 0, 29, -11, -9, -3, 239 }, - { 0, 2, -13, 15, -2, -2, 22, 233 }, - { 0, 3, -14, 19, -3, -2, 4, 247 }, - { 1, 3, -12, 20, -5, -3, -1, 251 }, - { 1, 1, -8, 19, -6, -5, -3, 252 }, - { 1, 1, -4, 19, -8, -6, -3, 251 }, - { 2, 1, -2, 18, -10, -6, -4, 251 }, - { 1, 2, 0, 19, -11, -7, -5, 249 }, - { 1, 2, 0, 21, -11, -8, -2, 243 }, - { 0, 3, -11, 8, -1, -1, -1, 255 }, - { 0, 3, -11, 11, -4, -1, -3, 256 }, - { 0, 3, -9, 12, -5, -2, 0, 253 }, - { 0, 2, -5, 12, -6, -4, -1, 252 }, - { 0, 1, -3, 13, -7, -5, -1, 251 }, - { 0, 2, -1, 14, -9, -5, -2, 249 }, - { 0, 2, 0, 15, -9, -5, -3, 247 }, - { 1, 1, 1, 17, -9, -6, -3, 242 } - }, - { - { -34, 16, 3, 2, 306, -45, 8, 1 }, - { -35, 15, 4, 4, 303, -44, 8, 0 }, - { -35, 13, 6, 4, 303, -43, 8, 0 }, - { -38, 13, 9, 4, 301, -42, 7, 0 }, - { -43, 20, 6, 7, 299, -41, 7, 0 }, - { -48, 20, 11, 9, 295, -39, 7, 0 }, - { -53, 13, 30, 6, 290, -36, 6, 0 }, - { -59, 8, 27, 26, 278, -32, 6, 1 }, - { -38, 1, -1, 0, 213, 104, -25, 3 }, - { -40, 2, -1, 0, 216, 99, -23, 3 }, - { -44, 7, -2, 1, 215, 101, -24, 3 }, - { -45, 6, -1, 1, 214, 102, -24, 3 }, - { -43, 1, 4, 0, 212, 103, -24, 3 }, - { -43, 0, 3, 2, 210, 105, -24, 2 }, - { -43, 2, -1, 6, 208, 106, -24, 2 }, - { -44, 3, 0, 6, 203, 107, -23, 3 }, - { -1, -2, -1, -1, 8, 285, -36, 3 }, - { -1, -2, 0, 0, 8, 285, -37, 4 }, - { -2, -1, 0, 0, 7, 286, -37, 3 }, - { -2, -2, 1, 0, 7, 286, -36, 3 }, - { -2, -3, 1, 0, 7, 285, -35, 3 }, - { -3, -3, 1, 1, 7, 284, -34, 3 }, - { -3, -4, 1, 2, 8, 281, -32, 2 }, - { -5, -3, 1, 3, 10, 275, -28, 2 }, - { 10, -3, 0, -1, -42, 203, 111, -22 }, - { 9, -2, 1, 0, -42, 204, 108, -21 }, - { 8, -1, 0, 0, -41, 200, 111, -22 }, - { 8, -1, 0, 0, -40, 199, 113, -22 }, - { 7, -3, 2, 0, -39, 196, 115, -22 }, - { 7, -3, 2, 1, -39, 194, 116, -22 }, - { 7, -3, 1, 1, -37, 191, 118, -22 }, - { 6, -3, 2, 2, -35, 186, 119, -21 }, - { 2, -1, 0, 0, -4, 8, 277, -27 }, - { 1, 0, 0, 0, -4, 7, 279, -28 }, - { 0, 1, 0, 0, -4, 6, 279, -27 }, - { 0, 1, 1, 0, -3, 6, 278, -26 }, - { -1, 0, 1, 1, -4, 6, 278, -25 }, - { -1, 0, 1, 1, -4, 6, 276, -24 }, - { -1, -1, 1, 2, -4, 7, 274, -22 }, - { -1, -1, 2, 3, -4, 9, 267, -18 }, - { 0, -1, 0, 0, 6, -39, 207, 81 }, - { -1, 0, 0, 0, 7, -38, 207, 81 }, - { -2, 1, 0, 0, 6, -37, 205, 83 }, - { -2, 1, 1, 0, 6, -37, 203, 84 }, - { -2, 0, 2, 0, 6, -36, 201, 86 }, - { -2, 0, 2, 1, 6, -36, 199, 87 }, - { -3, 0, 1, 2, 6, -35, 197, 89 }, - { -3, 0, 2, 2, 5, -33, 192, 91 }, - { 0, 0, 0, 0, 1, -4, 15, 244 }, - { 0, 0, 0, 0, 1, -3, 14, 245 }, - { -1, 1, 0, -1, 1, -4, 13, 246 }, - { -2, 1, 1, -1, 1, -4, 13, 246 }, - { -2, 0, 2, -1, 1, -4, 12, 247 }, - { -2, 0, 2, 0, 1, -4, 12, 246 }, - { -2, 0, 2, 1, 1, -5, 13, 246 }, - { -3, 0, 2, 2, 1, -4, 15, 243 }, - { 1, 0, -1, 0, -2, 10, -67, 314 }, - { -1, 1, 0, 0, -2, 9, -62, 310 }, - { -1, 2, 0, 0, -2, 9, -63, 311 }, - { -2, 2, 1, 0, -2, 9, -63, 311 }, - { -2, 1, 2, 0, -2, 9, -63, 310 }, - { -2, 0, 2, 1, -2, 9, -62, 309 }, - { -2, 0, 2, 2, -2, 9, -61, 308 }, - { -3, 0, 2, 3, -2, 9, -59, 305 } - }, - { - { 58, 21, 7, 1, 168, 0, 1, 0 }, - { 16, 99, 5, 3, 126, 6, 1, 0 }, - { -58, 186, 15, 4, 98, 9, 1, 0 }, - { -87, 163, 91, -2, 79, 11, 0, 0 }, - { -72, 59, 186, 7, 63, 12, 0, 1 }, - { -57, 9, 160, 81, 49, 12, 0, 1 }, - { -50, 11, 45, 196, 39, 13, 0, 1 }, - { -47, 15, -21, 260, 32, 14, 0, 2 }, - { -35, 35, 6, 2, 165, 92, -10, 0 }, - { -80, 89, 13, 5, 159, 76, -5, -2 }, - { -135, 150, 26, 8, 143, 70, -3, -2 }, - { -161, 141, 81, 8, 127, 63, -3, -2 }, - { -154, 74, 148, 21, 112, 57, -2, -2 }, - { -138, 32, 132, 83, 97, 52, -1, -1 }, - { -123, 24, 49, 177, 80, 50, 0, -1 }, - { -109, 22, -4, 233, 64, 48, 1, 1 }, - { -32, 28, 7, 3, 33, 228, -12, 1 }, - { -78, 65, 16, 7, 46, 211, -11, -1 }, - { -127, 103, 32, 12, 54, 192, -8, -2 }, - { -159, 100, 70, 18, 60, 175, -6, -2 }, - { -169, 64, 110, 35, 64, 158, -5, -2 }, - { -170, 38, 99, 86, 67, 141, -2, -2 }, - { -165, 29, 46, 157, 66, 124, 2, -2 }, - { -154, 24, 7, 205, 60, 108, 6, -1 }, - { -25, 20, 9, 4, -23, 202, 79, -9 }, - { -62, 44, 16, 9, -20, 215, 60, -7 }, - { -100, 66, 30, 16, -16, 216, 50, -7 }, - { -128, 64, 57, 24, -12, 215, 42, -6 }, - { -145, 44, 81, 43, -7, 210, 36, -7 }, - { -155, 30, 72, 84, -2, 202, 30, -5 }, - { -159, 24, 37, 138, 2, 190, 28, -4 }, - { -157, 20, 10, 177, 6, 172, 28, -2 }, - { -25, 15, 8, 4, -5, 47, 225, -13 }, - { -53, 31, 14, 11, -8, 70, 207, -15 }, - { -82, 43, 25, 19, -12, 91, 186, -14 }, - { -104, 41, 44, 28, -16, 110, 166, -13 }, - { -119, 27, 58, 46, -19, 126, 148, -12 }, - { -130, 20, 50, 79, -22, 139, 130, -10 }, - { -139, 17, 26, 121, -24, 148, 113, -7 }, - { -143, 15, 8, 153, -23, 150, 98, -2 }, - { -21, 10, 7, 4, 4, -28, 225, 55 }, - { -43, 21, 11, 11, 2, -20, 234, 40 }, - { -65, 28, 19, 20, -1, -9, 234, 30 }, - { -81, 22, 32, 30, -5, 3, 232, 22 }, - { -93, 14, 41, 46, -10, 16, 227, 15 }, - { -105, 10, 33, 74, -14, 30, 216, 11 }, - { -115, 9, 16, 106, -18, 44, 202, 11 }, - { -122, 8, 4, 132, -21, 56, 183, 14 }, - { -14, 8, 5, 3, -3, -8, 60, 205 }, - { -32, 14, 7, 12, -4, -9, 82, 185 }, - { -48, 16, 13, 21, -5, -10, 102, 165 }, - { -60, 10, 23, 31, -6, -8, 120, 147 }, - { -71, 4, 26, 47, -9, -7, 137, 129 }, - { -82, 2, 18, 70, -12, -4, 150, 112 }, - { -93, 3, 6, 95, -13, -1, 158, 99 }, - { -100, 3, -2, 117, -16, 6, 157, 91 }, - { -12, 5, 3, 5, -6, 15, -69, 314 }, - { -26, 9, 4, 14, -6, 14, -55, 302 }, - { -37, 9, 8, 22, -7, 12, -42, 290 }, - { -46, 3, 13, 33, -9, 12, -27, 277 }, - { -55, -2, 14, 47, -11, 10, -11, 262 }, - { -65, -2, 7, 66, -12, 10, 6, 245 }, - { -75, -1, -2, 87, -13, 9, 23, 227 }, - { -83, -2, -7, 105, -15, 11, 34, 211 } - } -}; -ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, const short mipBias16x16[6][64] )= -{ - { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 3, 3, 1, 1, 2, 2, 2, 3, 3, 3, 1, 2, 2, 2, 3, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 3, 1, 2, 2, 3, 3, 3, 4, 4, 2, 3, 3, 3, 4, 4, 5, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { -1, -1, 0, 0, 0, -1, 0, 1, 0, -1, 0, 0, 0, 0, 1, 2, 0, 0, 1, 1, 1, 2, 3, 4, 0, 1, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 8, 9, 1, 3, 5, 7, 8, 10, 11, 12, 2, 5, 7, 10, 12, 13, 15, 15, 5, 8, 10, 12, 15, 16, 17, 18 }, - { -1, -1, 0, 0, -1, -1, -1, -1, 0, 0, -1, -1, -1, -2, -2, -2, 0, 0, -1, -1, -2, -2, -3, -3, 0, -1, -1, -2, -2, -3, -3, -3, 0, -1, -2, -2, -3, -3, -3, -3, -1, -1, -2, -2, -3, -3, -3, -4, -1, -2, -2, -3, -3, -4, -4, -3, -1, -2, -2, -3, -3, -3, -3, -3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 } -}; -const int mipShiftBias16x16[6] = -{ - 9, 9, 9, 9, 9, 9 -}; -const int mipShiftMatrix16x16[6] = -{ - 8, 8, 8, 8, 8, 8 -}; -#endif \ No newline at end of file diff --git a/source/Lib/CommonLib/MotionInfo.h b/source/Lib/CommonLib/MotionInfo.h index f7abf293528c09a9401a46ec35d34a84410dc294..3e7ad1f975c5ca0ab2bfd37312f2e24e44bcc9bc 100644 --- a/source/Lib/CommonLib/MotionInfo.h +++ b/source/Lib/CommonLib/MotionInfo.h @@ -103,25 +103,15 @@ struct MotionInfo bool isInter; bool isIBCmot; char interDir; -#if JVET_O0057_ALTHPELIF bool useAltHpelIf; -#endif uint16_t sliceIdx; Mv mv [ NUM_REF_PIC_LIST_01 ]; int16_t refIdx [ NUM_REF_PIC_LIST_01 ]; uint8_t GBiIdx; Mv bv; -#if JVET_O0057_ALTHPELIF MotionInfo() : isInter(false), isIBCmot(false), interDir(0), useAltHpelIf(false), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { } -#else - MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { } -#endif // ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything else -#if JVET_O0057_ALTHPELIF MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), useAltHpelIf(false), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); } -#else - MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); } -#endif bool operator==( const MotionInfo& mi ) const { @@ -232,9 +222,6 @@ struct LutMotionCand { static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lut; static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutIbc; -#if !JVET_O0078_SINGLE_HMVPLUT - static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutShareIbc; -#endif }; struct PatentBvCand { diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp index f29b1ba3550d6d484308ed8397f3d45d9f2cea17..d4557e53d02373d5ba0ea96d7a0923d7f601a3e3 100644 --- a/source/Lib/CommonLib/Mv.cpp +++ b/source/Lib/CommonLib/Mv.cpp @@ -40,11 +40,7 @@ #include "Common.h" #include "Slice.h" -#if JVET_O0057_ALTHPELIF const MvPrecision Mv::m_amvrPrecision[4] = { MV_PRECISION_QUARTER, MV_PRECISION_INT, MV_PRECISION_4PEL, MV_PRECISION_HALF }; // for cu.imv=0, 1, 2 and 3 -#else -const MvPrecision Mv::m_amvrPrecision[3] = { MV_PRECISION_QUARTER, MV_PRECISION_INT, MV_PRECISION_4PEL }; // for cu.imv=0, 1 and 2 -#endif const MvPrecision Mv::m_amvrPrecAffine[3] = { MV_PRECISION_QUARTER, MV_PRECISION_SIXTEENTH, MV_PRECISION_INT }; // for cu.imv=0, 1 and 2 const MvPrecision Mv::m_amvrPrecIbc[3] = { MV_PRECISION_INT, MV_PRECISION_INT, MV_PRECISION_4PEL }; // for cu.imv=0, 1 and 2 @@ -55,62 +51,34 @@ void roundAffineMv( int& mvx, int& mvy, int nShift ) mvy = (mvy + nOffset - (mvy >= 0)) >> nShift; } -#if JVET_O1164_PS void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& sps, const PPS& pps ) -#else -void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& sps ) -#endif { if (sps.getWrapAroundEnabledFlag()) { -#if JVET_O1164_PS wrapClipMv(rcMv, pos, size, &sps, &pps); -#else - wrapClipMv(rcMv, pos, size, &sps); -#endif return; } int iMvShift = MV_FRACTIONAL_BITS_INTERNAL; int iOffset = 8; -#if JVET_O1164_PS int iHorMax = ( pps.getPicWidthInLumaSamples() + iOffset - (int)pos.x - 1 ) << iMvShift; -#else - int iHorMax = ( sps.getPicWidthInLumaSamples() + iOffset - ( int ) pos.x - 1 ) << iMvShift; -#endif int iHorMin = ( -( int ) sps.getMaxCUWidth() - iOffset - ( int ) pos.x + 1 ) << iMvShift; -#if JVET_O1164_PS int iVerMax = ( pps.getPicHeightInLumaSamples() + iOffset - (int)pos.y - 1 ) << iMvShift; -#else - int iVerMax = ( sps.getPicHeightInLumaSamples() + iOffset - ( int ) pos.y - 1 ) << iMvShift; -#endif int iVerMin = ( -( int ) sps.getMaxCUHeight() - iOffset - ( int ) pos.y + 1 ) << iMvShift; rcMv.setHor( std::min( iHorMax, std::max( iHorMin, rcMv.getHor() ) ) ); rcMv.setVer( std::min( iVerMax, std::max( iVerMin, rcMv.getVer() ) ) ); } -#if JVET_O1164_PS bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS *sps, const PPS *pps ) -#else -bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS *sps ) -#endif { bool wrapRef = true; int iMvShift = MV_FRACTIONAL_BITS_INTERNAL; int iOffset = 8; -#if JVET_O1164_PS int iHorMax = ( pps->getPicWidthInLumaSamples() + sps->getMaxCUWidth() - size.width + iOffset - (int)pos.x - 1 ) << iMvShift; -#else - int iHorMax = ( sps->getPicWidthInLumaSamples() + sps->getMaxCUWidth() - size.width + iOffset - ( int ) pos.x - 1 ) << iMvShift; -#endif int iHorMin = ( -( int ) sps->getMaxCUWidth() - iOffset - ( int ) pos.x + 1 ) << iMvShift; -#if JVET_O1164_PS int iVerMax = ( pps->getPicHeightInLumaSamples() + iOffset - (int)pos.y - 1 ) << iMvShift; -#else - int iVerMax = ( sps->getPicHeightInLumaSamples() + iOffset - ( int ) pos.y - 1 ) << iMvShift; -#endif int iVerMin = ( -( int ) sps->getMaxCUHeight() - iOffset - ( int ) pos.y + 1 ) << iMvShift; int mvX = rcMv.getHor(); diff --git a/source/Lib/CommonLib/Mv.h b/source/Lib/CommonLib/Mv.h index 250244e753e3e91a7dae03e4505958011a7fbb87..496ce93090ff83ac6fd2e6457b95eb6cb2e922b9 100644 --- a/source/Lib/CommonLib/Mv.h +++ b/source/Lib/CommonLib/Mv.h @@ -61,11 +61,7 @@ enum MvPrecision class Mv { private: -#if JVET_O0057_ALTHPELIF static const MvPrecision m_amvrPrecision[4]; -#else - static const MvPrecision m_amvrPrecision[3]; -#endif static const MvPrecision m_amvrPrecAffine[3]; static const MvPrecision m_amvrPrecIbc[3]; @@ -288,17 +284,13 @@ namespace std void clipMv ( Mv& rcMv, const struct Position& pos, const struct Size& size, const class SPS& sps -#if JVET_O1164_PS , const class PPS& pps -#endif ); bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS *sps -#if JVET_O1164_PS , const PPS* pps -#endif ); void roundAffineMv( int& mvx, int& mvy, int nShift ); diff --git a/source/Lib/CommonLib/NAL.h b/source/Lib/CommonLib/NAL.h index a49968a68564aaea6dfbc54cda3ce3128d47dbfc..aaeb903809fe8e523262f82ed29ddb6e0a45eaee 100644 --- a/source/Lib/CommonLib/NAL.h +++ b/source/Lib/CommonLib/NAL.h @@ -50,28 +50,22 @@ struct NALUnit NalUnitType m_nalUnitType; ///< nal_unit_type uint32_t m_temporalId; ///< temporal_id uint32_t m_nuhLayerId; ///< nuh_layer_id -#if JVET_O0179 uint32_t m_forbiddenZeroBit; uint32_t m_nuhReservedZeroBit; -#endif NALUnit(const NALUnit &src) :m_nalUnitType (src.m_nalUnitType) ,m_temporalId (src.m_temporalId) ,m_nuhLayerId (src.m_nuhLayerId) -#if JVET_O0179 , m_forbiddenZeroBit(src.m_forbiddenZeroBit) , m_nuhReservedZeroBit(src.m_nuhReservedZeroBit) -#endif { } /** construct an NALunit structure with given header values. */ NALUnit( NalUnitType nalUnitType, int temporalId = 0, -#if JVET_O0179 uint32_t nuhReservedZeroBit = 0, uint32_t forbiddenZeroBit = 0, -#endif int nuhLayerId = 0) :m_nalUnitType (nalUnitType) ,m_temporalId (temporalId) @@ -97,11 +91,7 @@ struct NALUnit || 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 -#if JVET_N0865_GRA2GDR || m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR -#else - || m_nalUnitType == NAL_UNIT_CODED_SLICE_GRA -#endif || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL; } @@ -120,11 +110,7 @@ struct NALUnit || 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 -#if JVET_N0865_GRA2GDR || m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR; -#else - || m_nalUnitType == NAL_UNIT_CODED_SLICE_GRA; -#endif } }; @@ -163,9 +149,7 @@ struct NALUnitEBSP : public NALUnit class AccessUnit : public std::list<NALUnitEBSP*> // NOTE: Should not inherit from STL. { public: -#if JVET_O0245_VPS_DPS_APS int temporalId; -#endif ~AccessUnit() { for (AccessUnit::iterator it = this->begin(); it != this->end(); it++) diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 2089e9f188beee410e6421de2142b1a3c0019c43..d84ae961bfa08179c14862cd6557b0e4f63400a0 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -519,7 +519,6 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) const uint32_t frameWidthInCtus = pcv->widthInCtus; const uint32_t frameHeightInCtus = pcv->heightInCtus; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA std::vector<uint32_t> tileRowHeight; std::vector<uint32_t> tileColWidth; if (pps.getUniformTileSpacingFlag()) @@ -529,13 +528,8 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) int tileWidthInLumaSamples = tileWidthInCTUs * sps.getCTUSize(); int tileHeightInLumaSamples = tileHeightInCTUs * sps.getCTUSize(); -#if JVET_O1164_RPR numTileColumns = (pps.getPicWidthInLumaSamples() + tileWidthInLumaSamples - 1) / tileWidthInLumaSamples; numTileRows = (pps.getPicHeightInLumaSamples() + tileHeightInLumaSamples - 1) / tileHeightInLumaSamples; -#else - numTileColumns = (sps.getPicWidthInLumaSamples() + tileWidthInLumaSamples - 1) / tileWidthInLumaSamples; - numTileRows = (sps.getPicHeightInLumaSamples() + tileHeightInLumaSamples - 1) / tileHeightInLumaSamples; -#endif numTiles = numTileColumns * numTileRows; int remainingHeightInCtbsY = frameHeightInCtus; @@ -553,29 +547,11 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) remainingWidthInCtbsY -= tileWidthInCTUs; } tileColWidth.push_back(remainingWidthInCtbsY); -#else - std::vector<uint32_t> tileRowHeight (numTileRows); - std::vector<uint32_t> tileColWidth (numTileColumns); - - if( pps.getUniformTileSpacingFlag() ) - { - //set width and height for each (uniform) tile - for(int row=0; row < numTileRows; row++) - { - tileRowHeight[row] = (row+1)*frameHeightInCtus/numTileRows - (row*frameHeightInCtus)/numTileRows; - } - for(int col=0; col < numTileColumns; col++) - { - tileColWidth[col] = (col+1)*frameWidthInCtus/numTileColumns - (col*frameWidthInCtus)/numTileColumns; - } -#endif } else { -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA tileColWidth.resize(numTileColumns); tileRowHeight.resize(numTileRows); -#endif tileColWidth[ numTileColumns - 1 ] = frameWidthInCtus; for( int i = 0; i < numTileColumns - 1; i++ ) { @@ -612,13 +588,8 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) int brickIdx = 0; for(int tileIdx=0; tileIdx< numTiles; tileIdx++) { -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int tileX = tileIdx % numTileColumns; int tileY = tileIdx / numTileColumns; -#else - int tileX = tileIdx % ( pps.getNumTileColumnsMinus1() + 1 ); - int tileY = tileIdx / ( pps.getNumTileColumnsMinus1() + 1 ); -#endif if ( !pps.getBrickSplittingPresentFlag() || !pps.getBrickSplitFlag(tileIdx)) { bricks.resize(bricks.size()+1); @@ -633,7 +604,6 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) { std::vector<uint32_t> rowHeight2; std::vector<uint32_t> rowBd2; -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 int numBrickRowsMinus2 = 0; if (pps.getUniformBrickSpacingFlag(tileIdx)) { @@ -677,51 +647,6 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) bricks[brickIdx].setFirstCtuRsAddr(bricks[brickIdx].getColBd() + bricks[brickIdx].getRowBd() * frameWidthInCtus); brickIdx++; } -#else - int numBrickRowsMinus1 = 0; - if (pps.getUniformBrickSpacingFlag(tileIdx)) - { - int brickHeight= pps.getBrickHeightMinus1(tileIdx) + 1; - int remainingHeightInCtbsY = tileRowHeight[ tileY ]; - int brickInTile = 0; - while( remainingHeightInCtbsY > brickHeight ) - { - rowHeight2.resize(brickInTile+1); - rowHeight2[ brickInTile++ ] = brickHeight; - remainingHeightInCtbsY -= brickHeight; - } - rowHeight2.resize(brickInTile+1); - rowHeight2[ brickInTile ] = remainingHeightInCtbsY; - numBrickRowsMinus1 = brickInTile; - } - else - { - numBrickRowsMinus1 = pps.getNumBrickRowsMinus1(tileIdx); - rowHeight2.resize(numBrickRowsMinus1 + 1); - rowHeight2[ numBrickRowsMinus1 ] = tileRowHeight[ tileY ]; - for(int j = 0; j < numBrickRowsMinus1; j++ ) - { - rowHeight2[ j ] = pps.getBrickRowHeightMinus1 ( tileIdx, j )+ 1; - rowHeight2[ numBrickRowsMinus1 ] -= rowHeight2[ j ]; - } - } - rowBd2.resize(numBrickRowsMinus1 + 1); - rowBd2[ 0 ] = 0; - for( int j = 0; j < numBrickRowsMinus1; j++ ) - { - rowBd2[ j + 1 ] = rowBd2[ j ] + rowHeight2[ j ]; - } - for( int j = 0; j < numBrickRowsMinus1 + 1; j++ ) - { - bricks.resize(bricks.size()+1); - bricks[ brickIdx ].setColBd (tileColBd[ tileX ]); - bricks[ brickIdx ].setRowBd (tileRowBd[ tileY ] + rowBd2[ j ]); - bricks[ brickIdx ].setWidthInCtus (tileColWidth[ tileX ]); - bricks[ brickIdx ].setHeightInCtus(rowHeight2[ j ]); - bricks[ brickIdx ].setFirstCtuRsAddr(bricks[ brickIdx ].getColBd() + bricks[ brickIdx ].getRowBd() * frameWidthInCtus); - brickIdx++; - } - #endif } } @@ -740,7 +665,6 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) } } } -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (pps.getRectSliceFlag()) { int numSlicesInPic = (pps.getNumSlicesInPicMinus1() + 1); @@ -781,7 +705,6 @@ void BrickMap::initBrickMap( const SPS& sps, const PPS& pps ) } } } -#endif } @@ -871,9 +794,7 @@ Picture::Picture() layer = std::numeric_limits<uint32_t>::max(); fieldPic = false; topField = false; -#if JVET_N0494_DRAP precedingDRAP = false; -#endif for( int i = 0; i < MAX_NUM_CHANNEL_TYPE; i++ ) { m_prevQP[i] = -1; @@ -885,19 +806,10 @@ Picture::Picture() void Picture::create(const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned _margin, const bool _decoder) { UnitArea::operator=( UnitArea( _chromaFormat, Area( Position{ 0, 0 }, size ) ) ); -#if JVET_O1164_RPR - margin = RPR_MAX_SCALE_FACTOR*_margin; -#else - margin = _margin; -#endif + margin = MAX_SCALING_RATIO*_margin; const Area a = Area( Position(), size ); -#if JVET_O1164_RPR - M_BUFS( 0, PIC_RECONSTRUCTION ).create( _chromaFormat, a, _maxCUSize, RPR_MAX_SCALE_FACTOR*_margin, MEMORY_ALIGN_DEF_SIZE ); - M_BUFS( 0, PIC_RECON_WRAP ).create( _chromaFormat, a, _maxCUSize, RPR_MAX_SCALE_FACTOR*_margin, MEMORY_ALIGN_DEF_SIZE ); -#else - M_BUFS( 0, PIC_RECONSTRUCTION ).create( _chromaFormat, a, _maxCUSize, _margin, MEMORY_ALIGN_DEF_SIZE ); - M_BUFS( 0, PIC_RECON_WRAP ).create( _chromaFormat, a, _maxCUSize, _margin, MEMORY_ALIGN_DEF_SIZE ); -#endif + M_BUFS( 0, PIC_RECONSTRUCTION ).create( _chromaFormat, a, _maxCUSize, MAX_SCALING_RATIO*_margin, MEMORY_ALIGN_DEF_SIZE ); + M_BUFS( 0, PIC_RECON_WRAP ).create( _chromaFormat, a, _maxCUSize, MAX_SCALING_RATIO*_margin, MEMORY_ALIGN_DEF_SIZE ); if( !_decoder ) { @@ -1031,11 +943,7 @@ const CPelUnitBuf Picture::getRecoBuf(const UnitArea &unit, bool wrap) const 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); } -#if JVET_O0299_APS_SCALINGLIST void Picture::finalInit( const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcsAps, APS* scalingListAps ) -#else -void Picture::finalInit(const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcsAps) -#endif { for( auto &sei : SEIs ) { @@ -1052,13 +960,8 @@ void Picture::finalInit(const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcs } const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); -#if JVET_O1164_PS const int iWidth = pps.getPicWidthInLumaSamples(); const int iHeight = pps.getPicHeightInLumaSamples(); -#else - const int iWidth = sps.getPicWidthInLumaSamples(); - const int iHeight = sps.getPicHeightInLumaSamples(); -#endif if( cs ) { @@ -1076,9 +979,7 @@ void Picture::finalInit(const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcs cs->pps = &pps; memcpy(cs->alfApss, alfApss, sizeof(cs->alfApss)); cs->lmcsAps = lmcsAps; -#if JVET_O0299_APS_SCALINGLIST cs->scalinglistAps = scalingListAps; -#endif cs->pcv = pps.pcv; @@ -1099,9 +1000,7 @@ void Picture::allocateNewSlice() memcpy(slice.getAlfAPSs(), cs->alfApss, sizeof(cs->alfApss)); slice.setLmcsAPS(cs->lmcsAps); -#if JVET_O0299_APS_SCALINGLIST slice.setscalingListAPS( cs->scalinglistAps ); -#endif slice.setPPS( cs->pps); slice.setSPS( cs->sps); @@ -1120,25 +1019,17 @@ Slice *Picture::swapSliceObject(Slice * p, uint32_t i) if(cs->lmcsAps != nullptr) p->setLmcsAPS(cs->lmcsAps); -#if JVET_O0299_APS_SCALINGLIST if(cs->scalinglistAps != nullptr) p->setscalingListAPS( cs->scalinglistAps ); -#endif Slice * pTmp = slices[i]; slices[i] = p; pTmp->setSPS(0); pTmp->setPPS(0); -#if JVET_O_MAX_NUM_ALF_APS_8 memset(pTmp->getAlfAPSs(), 0, sizeof(*pTmp->getAlfAPSs())*ALF_CTB_MAX_NUM_APS); -#else - memset(pTmp->getAlfAPSs(), 0, sizeof(*pTmp->getAlfAPSs())*MAX_NUM_APS); -#endif pTmp->setLmcsAPS(0); -#if JVET_O0299_APS_SCALINGLIST pTmp->setscalingListAPS( 0 ); -#endif return pTmp; } @@ -1185,7 +1076,6 @@ void Picture::finishCtuPart( const UnitArea& ctuArea ) #endif -#if JVET_O1164_RPR const TFilterCoeff DownsamplingFilterSRC[8][16][12] = { { // D = 1 @@ -1441,7 +1331,6 @@ void Picture::sampleRateConv( const Pel* orgSrc, SizeType orgWidth, SizeType org delete[] buf; } -#if RPR_CONF_WINDOW void Picture::rescalePicture( const CPelUnitBuf& beforeScaling, const Window& confBefore, const PelUnitBuf& afterScaling, const Window& confAfter, const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling ) { for( int comp = 0; comp < ::getNumberValidComponents( chromaFormatIDC ); comp++ ) @@ -1457,20 +1346,6 @@ void Picture::rescalePicture( const CPelUnitBuf& beforeScaling, const Window& co Picture::sampleRateConv( beforeScale.buf, widthBefore, heightBefore, beforeScale.stride, afterScale.buf, widthAfter, heightAfter, afterScale.width, afterScale.height, afterScale.stride, bitDepths.recon[comp], downsampling || useLumaFilter ? true : isLuma(compID), downsampling ); } } -#else -void Picture::rescalePicture(const CPelUnitBuf& beforeScaling, const PelUnitBuf& afterScaling, const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling) -{ - for (int comp = 0; comp < ::getNumberValidComponents(chromaFormatIDC); comp++) - { - ComponentID compID = ComponentID(comp); - const CPelBuf& beforeScale = beforeScaling.get(compID); - const PelBuf& afterScale = afterScaling.get(compID); - - Picture::sampleRateConv(beforeScale.buf, beforeScale.width, beforeScale.height, beforeScale.stride, afterScale.buf, afterScale.width, afterScale.height, afterScale.width, afterScale.height, afterScale.stride, bitDepths.recon[comp], downsampling || useLumaFilter ? true : isLuma(compID), downsampling); - } -} -#endif -#endif void Picture::extendPicBorder() { @@ -1558,20 +1433,12 @@ void Picture::extendPicBorder() PelBuf Picture::getBuf( const ComponentID compID, const PictureType &type ) { -#if JVET_O1164_RPR return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL || type == PIC_ORIGINAL_INPUT || type == PIC_TRUE_ORIGINAL_INPUT ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#else - return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#endif } const CPelBuf Picture::getBuf( const ComponentID compID, const PictureType &type ) const { -#if JVET_O1164_RPR return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL || type == PIC_ORIGINAL_INPUT || type == PIC_TRUE_ORIGINAL_INPUT ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#else - return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID ); -#endif } PelBuf Picture::getBuf( const CompArea &blk, const PictureType &type ) @@ -1582,11 +1449,7 @@ PelBuf Picture::getBuf( const CompArea &blk, const PictureType &type ) } #if ENABLE_SPLIT_PARALLELISM -#if JVET_O1164_RPR const int jId = ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL || type == PIC_ORIGINAL_INPUT || type == PIC_TRUE_ORIGINAL_INPUT ) ? 0 : scheduler.getSplitPicId(); -#else - const int jId = ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL ) ? 0 : scheduler.getSplitPicId(); -#endif #endif #if !KEEP_PRED_AND_RESI_SIGNALS if( type == PIC_RESIDUAL || type == PIC_PREDICTION ) @@ -1682,13 +1545,8 @@ bool Picture::getSpliceFull() void Picture::addPictureToHashMapForInter() { -#if JVET_O1164_PS int picWidth = slices[0]->getPPS()->getPicWidthInLumaSamples(); int picHeight = slices[0]->getPPS()->getPicHeightInLumaSamples(); -#else - int picWidth = slices[0]->getSPS()->getPicWidthInLumaSamples(); - int picHeight = slices[0]->getSPS()->getPicHeightInLumaSamples(); -#endif uint32_t* blockHashValues[2][2]; bool* bIsBlockSame[2][3]; diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index f7a4c3d54560a92d863fc60542bf449757f38e1a..e352118b9c7860092a3234e37a47457840544ff5 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -50,9 +50,7 @@ #include "MCTS.h" #include <deque> -#if JVET_O1164_RPR #include "CommonLib/InterpolationFilter.h" -#endif #if ENABLE_WPP_PARALLELISM || ENABLE_SPLIT_PARALLELISM #if ENABLE_WPP_PARALLELISM @@ -165,12 +163,10 @@ struct BrickMap uint32_t getSubstreamForCtuAddr(const uint32_t ctuAddr, const bool addressInRaster, Slice *slice) const; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int getTopLeftBrickIdx(uint32_t val) const { return m_topLeftBrickIdx[val]; } void setTopLeftBrickIdx(const std::vector<int>& val) { m_topLeftBrickIdx = val; } int getBottomRightBrickIdx(uint32_t val) const { return m_bottomRightBrickIdx[val]; } void setBottomRightBrickIdx(const std::vector<int>& val) { m_bottomRightBrickIdx = val; } -#endif const PreCalcValues* pcv; std::vector<Brick> bricks; @@ -183,10 +179,8 @@ struct BrickMap uint32_t* ctuBsToRsAddrMap; uint32_t* ctuRsToBsAddrMap; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA std::vector<int> m_topLeftBrickIdx; std::vector<int> m_bottomRightBrickIdx; -#endif void initBrickMap( const SPS& sps, const PPS& pps ); void initCtuBsRsAddrMap(); @@ -249,11 +243,7 @@ struct Picture : public UnitArea const CPelUnitBuf getBuf(const UnitArea &unit, const PictureType &type) const; void extendPicBorder(); -#if JVET_O0299_APS_SCALINGLIST void finalInit( const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcsAps, APS* scalingListAps ); -#else - void finalInit(const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcsAps); -#endif int getPOC() const { return poc; } void setBorderExtension( bool bFlag) { m_bIsBorderExtended = bFlag;} @@ -263,15 +253,9 @@ struct Picture : public UnitArea void setSpliceIdx(uint32_t idx, int poc) { m_spliceIdx[idx] = poc; } void createSpliceIdx(int nums); bool getSpliceFull(); -#if JVET_O1164_RPR static void sampleRateConv( const Pel* orgSrc, SizeType orgWidth, SizeType orgHeight, SizeType orgStride, Pel* scaledSrc, SizeType scaledWidth, SizeType scaledHeight, SizeType paddedWidth, SizeType paddedHeight, SizeType scaledStride, const int bitDepth, const bool useLumaFilter, const bool downsampling = false ); -#if RPR_CONF_WINDOW static void rescalePicture(const CPelUnitBuf& beforeScaling, const Window& confBefore, const PelUnitBuf& afterScaling, const Window& confAfter, const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling = false); -#else - static void rescalePicture(const CPelUnitBuf& beforeScaling, const PelUnitBuf& afterScaling, const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling = false); -#endif -#endif public: bool m_bIsBorderExtended; @@ -283,9 +267,7 @@ public: bool topField; bool fieldPic; int m_prevQP[MAX_NUM_CHANNEL_TYPE]; -#if JVET_N0494_DRAP bool precedingDRAP; // preceding a DRAP picture in decoding order -#endif int poc; uint32_t layer; @@ -303,9 +285,7 @@ public: #else PelStorage m_bufs[NUM_PIC_TYPES]; #endif -#if JVET_O1164_RPR const Picture* unscaledPic; -#endif TComHash m_hashMap; TComHash* getHashMap() { return &m_hashMap; } @@ -316,7 +296,6 @@ public: std::deque<Slice*> slices; SEIMessages SEIs; -#if JVET_O1164_RPR uint32_t m_picWidthInLumaSamples; uint32_t m_picHeightInLumaSamples; Window m_conformanceWindow; @@ -329,7 +308,6 @@ public: Window& getConformanceWindow() { return m_conformanceWindow; } const Window& getConformanceWindow() const { return m_conformanceWindow; } void setConformanceWindow( Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } -#endif void allocateNewSlice(); Slice *swapSliceObject(Slice * p, uint32_t i); @@ -393,7 +371,6 @@ public: m_alfCtbFilterIndex[i] = 0; } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB std::vector<uint8_t> m_alfCtuAlternative[MAX_NUM_COMPONENT]; std::vector<uint8_t>& getAlfCtuAlternative( int compIdx ) { return m_alfCtuAlternative[compIdx]; } uint8_t* getAlfCtuAlternativeData( int compIdx ) { return m_alfCtuAlternative[compIdx].data(); } @@ -405,7 +382,6 @@ public: std::fill( m_alfCtuAlternative[compIdx].begin(), m_alfCtuAlternative[compIdx].end(), 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 9c3e68f5a7cc00778bc3679b4e27d4e0fc5d9ce4..076c18a863d124eb4141893f6f10e3d95beb68b8 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -63,65 +63,35 @@ // ==================================================================================================================== QpParam::QpParam(const int qpy, -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE const ComponentID compID, -#else - const ChannelType chType, -#endif const int qpBdOffset, -#if JVET_O0919_TS_MIN_QP const int minQpPrimeTsMinus4, -#endif const int chromaQPOffset, const ChromaFormat chFmt, const int dqp -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE , const SPS *sps -#endif ) { int baseQp; -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE if (isLuma(compID)) -#else - if(isLuma(chType)) -#endif { baseQp = qpy + qpBdOffset; } else { -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE int qpi = Clip3(-qpBdOffset, MAX_QP, qpy); baseQp = sps->getMappedChromaQpValue(compID, qpi); baseQp = Clip3(-qpBdOffset, MAX_QP, baseQp + chromaQPOffset) + qpBdOffset; -#else - baseQp = Clip3( -qpBdOffset, (chromaQPMappingTableSize - 1), qpy + chromaQPOffset ); - - if(baseQp < 0) - { - baseQp = baseQp + qpBdOffset; - } - else - { - baseQp = getScaledChromaQP(baseQp, chFmt) + qpBdOffset; - } -#endif } baseQp = Clip3( 0, MAX_QP+qpBdOffset, baseQp + dqp ); -#if JVET_O0919_TS_MIN_QP Qps[0] =baseQp; pers[0]=baseQp/6; rems[0]=baseQp%6; int baseQpTS = baseQp; -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE if (isLuma(compID)) -#else - if( isLuma( chType ) ) -#endif { baseQpTS = std::max(baseQpTS , 4 + minQpPrimeTsMinus4); } @@ -129,11 +99,6 @@ QpParam::QpParam(const int qpy, Qps[1] = baseQpTS; pers[1] = baseQpTS / 6; rems[1] = baseQpTS % 6; -#else - Qp =baseQp; - per=baseQp/6; - rem=baseQp%6; -#endif } QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int QP /*= -MAX_INT*/) @@ -143,52 +108,18 @@ QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int if (isChroma(compID)) { -#if JVET_O0105_ICT const bool useJQP = ( abs(TU::getICTMode(tu)) == 2 ); chromaQpOffset += tu.cs->pps->getQpOffset ( useJQP ? JOINT_CbCr : compID ); chromaQpOffset += tu.cs->slice->getSliceChromaQpDelta( useJQP ? JOINT_CbCr : compID ); -#else - chromaQpOffset += tu.cs->pps->getQpOffset ( tu.jointCbCr ? JOINT_CbCr : compID ); - chromaQpOffset += tu.cs->slice->getSliceChromaQpDelta( tu.jointCbCr ? JOINT_CbCr : compID ); -#endif -#if JVET_O1168_CU_CHROMA_QP_OFFSET -#if JVET_O0105_ICT chromaQpOffset += tu.cs->pps->getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( useJQP ? JOINT_CbCr : compID ) - 1]; -#else - chromaQpOffset += tu.cs->pps->getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( tu.jointCbCr ? JOINT_CbCr : compID ) - 1]; -#endif -#else - chromaQpOffset += tu.cs->pps->getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( compID ) - 1]; -#endif } int dqp = 0; -#if JVET_O0919_TS_MIN_QP -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE -#if JVET_O0105_ICT const bool useJQP = isChroma(compID) && (abs(TU::getICTMode(tu)) == 2); -#else - const bool useJQP = isChroma(compID) && tu.jointCbCr; -#endif *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, useJQP ? JOINT_CbCr : compID, tu.cs->sps->getQpBDOffset(toChannelType(compID)), tu.cs->sps->getMinQpPrimeTsMinus4(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp, tu.cs->sps); -#else - *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, toChannelType(compID), tu.cs->sps->getQpBDOffset(toChannelType(compID)), tu.cs->sps->getMinQpPrimeTsMinus4(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp); -#endif -#else -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE -#if JVET_O0105_ICT - const bool useJQP = isChroma(compID) && (abs(TU::getICTMode(tu)) == 2); -#else - const bool useJQP = isChroma(compID) && tu.jointCbCr; -#endif - *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, useJQP ? JOINT_CbCr : compID, tu.cs->sps->getQpBDOffset(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp, tu.cs->sps); -#else - *this = QpParam(QP <= -MAX_INT ? tu.cu->qp : QP, toChannelType(compID), tu.cs->sps->getQpBDOffset(toChannelType(compID)), chromaQpOffset, tu.chromaFormat, dqp); -#endif -#endif } @@ -459,13 +390,8 @@ void Quant::dequant(const TransformUnit &tu, const bool needSqrtAdjustment = TU::needsBlockSizeTrafoScale( tu, compID ); const int iTransformShift = (bClipTransformShiftTo0 ? std::max<int>(0, originalTransformShift) : originalTransformShift) + (needSqrtAdjustment?-1:0); -#if JVET_O0919_TS_MIN_QP const int QP_per = cQP.per(isTransformSkip); const int QP_rem = cQP.rem(isTransformSkip); -#else - const int QP_per = cQP.per; - const int QP_rem = cQP.rem; -#endif const int rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); @@ -1016,11 +942,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const uint32_t uiLog2TrWidth = floorLog2(uiWidth); const uint32_t uiLog2TrHeight = floorLog2(uiHeight); -#if JVET_O0919_TS_MIN_QP int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight); -#else - int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth, uiLog2TrHeight); -#endif const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip); @@ -1028,11 +950,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf // compensated by a bit-shift (the quantised result will be sqrt(2) * larger than required). // The quantScale table and shift is used to compensate for this. const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); -#if JVET_O0919_TS_MIN_QP const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem(useTransformSkip)]; -#else - const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem]; -#endif int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange) + ( needSqrtAdjustment?-1:0); if (useTransformSkip && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag()) @@ -1041,24 +959,16 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf } -#if JVET_O0919_TS_MIN_QP const int iQBits = QUANT_SHIFT + cQP.per(useTransformSkip) + iTransformShift; -#else - const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; -#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 const int64_t iAdd = int64_t(tu.cs->slice->isIRAP() ? 171 : 85) << int64_t(iQBits - 9); const int qBits8 = iQBits - 8; -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS const uint32_t lfnstIdx = tu.cu->lfnstIdx; const int maxNumberOfCoeffs = lfnstIdx > 0 ? ((( uiWidth == 4 && uiHeight == 4 ) || ( uiWidth == 8 && uiHeight == 8) ) ? 8 : 16) : piQCoef.area(); memset( piQCoef.buf, 0, sizeof(TCoeff) * piQCoef.area() ); for (int uiBlockPos = 0; uiBlockPos < maxNumberOfCoeffs; uiBlockPos++ ) -#else - for (int uiBlockPos = 0; uiBlockPos < piQCoef.area(); uiBlockPos++) -#endif { const TCoeff iLevel = piCoef.buf[uiBlockPos]; const TCoeff iSign = (iLevel < 0 ? -1: 1); @@ -1106,11 +1016,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const uint32_t uiLog2TrWidth = floorLog2(uiWidth); const uint32_t uiLog2TrHeight = floorLog2(uiHeight); -#if JVET_O0919_TS_MIN_QP int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight); -#else - int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth, uiLog2TrHeight); -#endif const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0)); @@ -1120,11 +1026,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff * Then a QP+3 (sqrt(2)) or QP-3 (1/sqrt(2)) method could be used to get the required result */ const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); -#if JVET_O0919_TS_MIN_QP const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem(useTransformSkip)]; -#else - const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem]; -#endif int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange) + (needSqrtAdjustment?-1:0); if (useTransformSkip && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag()) @@ -1133,11 +1035,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff } -#if JVET_O0919_TS_MIN_QP const int iQBits = QUANT_SHIFT + cQP.per(useTransformSkip) + iTransformShift; -#else - const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; -#endif assert(iQBits>=0); // 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 @@ -1170,22 +1068,14 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); const int scalingListType = getScalingListType(tu.cu->predMode, compID); const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true); -#if JVET_O0919_TS_MIN_QP const bool useTransformSkip = tu.mtsIdx == MTS_SKIP && isLuma(compID); const int defaultQuantisationCoefficient = g_quantScales[0][cQP.rem(useTransformSkip)]; -#else - const int defaultQuantisationCoefficient = g_quantScales[0][cQP.rem]; -#endif CHECK( scalingListType >= SCALING_LIST_NUM, "Invalid scaling list" ); const uint32_t uiLog2TrWidth = floorLog2(uiWidth); const uint32_t uiLog2TrHeight = floorLog2(uiHeight); -#if JVET_O0919_TS_MIN_QP const int *const piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight); -#else - const int *const piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth, uiLog2TrHeight); -#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 @@ -1193,11 +1083,7 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co * Then a QP+3 (sqrt(2)) or QP-3 (1/sqrt(2)) method could be used to get the required result */ -#if JVET_O0919_TS_MIN_QP const int iQBits = QUANT_SHIFT + cQP.per(useTransformSkip) + iTransformShift; -#else - const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; -#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 const int iAdd = int64_t(bUseHalfRoundingPoint ? 256 : (tu.cs->slice->isIRAP() ? 171 : 85)) << int64_t(iQBits - 9); TCoeff transformedCoefficient; @@ -1234,13 +1120,8 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp const CompArea &rect = tu.blocks[compID]; const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; -#if JVET_O0919_TS_MIN_QP const int QP_per = cQP.per(tu.mtsIdx==MTS_SKIP && isLuma(compID)); const int QP_rem = cQP.rem(tu.mtsIdx==MTS_SKIP && isLuma(compID)); -#else - const int QP_per = cQP.per; - const int QP_rem = cQP.rem; -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); diff --git a/source/Lib/CommonLib/Quant.h b/source/Lib/CommonLib/Quant.h index aff8bc2381ab2eaa96601a104f6780d5d929a466..4ce303767b71f747e38ee576b7f229f5a287145f 100644 --- a/source/Lib/CommonLib/Quant.h +++ b/source/Lib/CommonLib/Quant.h @@ -65,51 +65,31 @@ struct TrQuantParams }; /// QP struct -#if JVET_O0919_TS_MIN_QP class QpParam -#else -struct QpParam -#endif { -#if JVET_O0919_TS_MIN_QP int Qps[2]; int pers[2]; int rems[2]; -#else - int Qp; - int per; - int rem; -#endif private: QpParam(const int qpy, -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE const ComponentID compID, -#else - const ChannelType chType, -#endif const int qpBdOffset, -#if JVET_O0919_TS_MIN_QP const int minQpPrimeTsMinus4, -#endif const int chromaQPOffset, const ChromaFormat chFmt, const int dqp -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE , const SPS *sps -#endif ); public: QpParam(const TransformUnit& tu, const ComponentID &compID, const int QP = -MAX_INT); -#if JVET_O0919_TS_MIN_QP int Qp ( const bool ts ) const { return Qps [ts?1:0]; } int per( const bool ts ) const { return pers[ts?1:0]; } int rem( const bool ts ) const { return rems[ts?1:0]; } -#endif }; // END STRUCT DEFINITION QpParam diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 3cc4462700c57d81734e15b1f1834bd7ba00c51b..378758f5071ab66441af77478536d107f53fa2b2 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -108,9 +108,6 @@ inline uint32_t QuantRDOQ::xGetCodedLevel( double& rd64CodedCost, const BinFracBits& fracBitsPar, const BinFracBits& fracBitsGt1, const BinFracBits& fracBitsGt2, -#if !JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT - const int remGt2Bins, -#endif const int remRegBins, unsigned goRiceZero, uint16_t ui16AbsGoRice, @@ -148,11 +145,7 @@ inline uint32_t QuantRDOQ::xGetCodedLevel( double& rd64CodedCost, { double dErr = double( lLevelDouble - ( Intermediate_Int(uiAbsLevel) << iQBits ) ); -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT double dCurrCost = dErr * dErr * errorScale + xGetICost( xGetICRate( uiAbsLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, ui16AbsGoRice, true, maxLog2TrDynamicRange ) ); -#else - double dCurrCost = dErr * dErr * errorScale + xGetICost( xGetICRate( uiAbsLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, ui16AbsGoRice, true, maxLog2TrDynamicRange ) ); -#endif dCurrCost += dCurrCostSig; if( dCurrCost < rd64CodedCost ) @@ -181,9 +174,6 @@ inline int QuantRDOQ::xGetICRate( const uint32_t uiAbsLevel, const BinFracBits& fracBitsPar, const BinFracBits& fracBitsGt1, const BinFracBits& fracBitsGt2, -#if !JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT - const int remGt2Bins, -#endif const int remRegBins, unsigned goRiceZero, const uint16_t ui16AbsGoRice, @@ -636,25 +626,13 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); -#if JVET_O0919_TS_MIN_QP const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem(isTransformSkip)); const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem(isTransformSkip), uiLog2BlockWidth, uiLog2BlockHeight); -#else - const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem); - const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem, uiLog2BlockWidth, uiLog2BlockHeight); - const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip); -#if JVET_O0919_TS_MIN_QP const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem(isTransformSkip)]; const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem(isTransformSkip)); const int iQBits = QUANT_SHIFT + cQP.per(isTransformSkip) + iTransformShift + (needSqrtAdjustment?-1:0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits -#else - const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem]; - const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, 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 -#endif const TCoeff entropyCodingMinimum = -(1 << maxLog2TrDynamicRange); @@ -667,21 +645,12 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, double d64BaseCost = 0; int iLastScanPos = -1; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int ctxBinSampleRatio = (compID == COMPONENT_Y) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA; int remRegBins = (uiWidth * uiHeight * ctxBinSampleRatio) >> 4; -#else - bool is2x2subblock = ( iCGSizeM1 == 3 ); - int remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK ); - int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); -#endif uint32_t goRiceParam = 0; double *pdCostCoeffGroupSig = m_pdCostCoeffGroupSig; memset( pdCostCoeffGroupSig, 0, ( uiMaxNumCoeff >> cctx.log2CGSize() ) * sizeof( double ) ); -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - const int iCGNum = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth) * std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight) >> cctx.log2CGSize(); -#endif int iScanPos; coeffGroupRDStats rdStats; @@ -691,9 +660,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS const int iCGNum = lfnstIdx > 0 ? 1 : std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth) * std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight) >> cctx.log2CGSize(); -#endif for (int subSetId = iCGNum - 1; subSetId >= 0; subSetId--) { @@ -774,26 +741,16 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, if( iScanPos == iLastScanPos ) { -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, nullptr, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, iQBits, errorScale, 1, extendedPrecision, maxLog2TrDynamicRange ); -#else - uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], - lLevelDouble, uiMaxAbsLevel, nullptr, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, iQBits, errorScale, 1, extendedPrecision, maxLog2TrDynamicRange ); -#endif } else { DTRACE_COND( ( uiMaxAbsLevel != 0 ), g_trace_ctx, D_RDOQ_MORE, " uiCtxSig=%d", ctxIdSig ); const BinFracBits fracBitsSig = fracBits.getFracBitsArray( ctxIdSig ); -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, &fracBitsSig, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, iQBits, errorScale, 0, extendedPrecision, maxLog2TrDynamicRange ); -#else - uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], - lLevelDouble, uiMaxAbsLevel, &fracBitsSig, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, iQBits, errorScale, 0, extendedPrecision, maxLog2TrDynamicRange ); -#endif sigRateDelta[ uiBlkPos ] = ( remRegBins < 4 ? 0 : fracBitsSig.intBits[1] - fracBitsSig.intBits[0] ); } @@ -805,27 +762,16 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, if( uiLevel > 0 ) { -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int rateNow = xGetICRate( uiLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ); rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; -#else - int rateNow = xGetICRate( uiLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ); - rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; - rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; -#endif } else // uiLevel == 0 { if( remRegBins < 4 ) { -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int rateNow = xGetICRate( uiLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ); rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsPar, fracBitsGt1, fracBitsGt2, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; -#else - int rateNow = xGetICRate( uiLevel, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ); - rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, fracBitsPar, fracBitsGt1, fracBitsGt2, remGt2Bins, remRegBins, goRiceZero, goRiceParam, extendedPrecision, maxLog2TrDynamicRange ) - rateNow; -#endif } else { @@ -837,10 +783,6 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, if( ( (iScanPos & iCGSizeM1) == 0 ) && ( iScanPos > 0 ) ) { -#if !JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT - remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK ); - remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ) - remGt2Bins; -#endif goRiceParam = 0; } else if( remRegBins >= 4 ) @@ -984,11 +926,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, previousCbf = TU::getPrevTuCbfAtDepth(tu, compID, tu.depth); } } -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[compID]( DeriveCtx::CtxQtCbf( rect.compID, previousCbf, useIntraSubPartitions ) ) ); -#else - BinFracBits fracBitsQtCbf = fracBits.getFracBitsArray( Ctx::QtCbf[compID]( DeriveCtx::CtxQtCbf( rect.compID, tu.depth, previousCbf, useIntraSubPartitions ) ) ); -#endif if( !lastCbfIsInferred ) { @@ -1103,17 +1041,10 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, if( cctx.signHiding() && uiAbsSum>=2) { -#if JVET_O0919_TS_MIN_QP const double inverseQuantScale = double(g_invQuantScales[0][cQP.rem(isTransformSkip)]); int64_t rdFactor = (int64_t)(inverseQuantScale * inverseQuantScale * (1 << (2 * cQP.per(isTransformSkip))) / m_dLambda / 16 / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth))) + 0.5); -#else - const double inverseQuantScale = double(g_invQuantScales[0][cQP.rem]); - int64_t rdFactor = (int64_t)(inverseQuantScale * inverseQuantScale * (1 << (2 * cQP.per)) / m_dLambda / 16 - / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth))) - + 0.5); -#endif int lastCG = -1; int absSum = 0 ; @@ -1279,28 +1210,18 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI memset( m_pdCostCoeff, 0, sizeof( double ) * maxNumCoeff ); memset( m_pdCostSig, 0, sizeof( double ) * maxNumCoeff ); -#if JVET_O0122_TS_SIGN_LEVEL m_bdpcm = 0; -#endif const bool needsSqrt2Scale = TU::needsSqrt2Scale( tu, compID ); // should always be false - transform-skipped blocks don't require sqrt(2) compensation. -#if JVET_O0919_TS_MIN_QP const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); const int qBits = QUANT_SHIFT + qp.per(isTransformSkip) + 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(isTransformSkip)]; const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale( tu, compID ), width, height, qp.rem(isTransformSkip), maxLog2TrDynamicRange, channelBitDepth ); -#else - 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 ); -#endif const TCoeff entropyCodingMaximum = ( 1 << maxLog2TrDynamicRange ) - 1; -#if JVET_O0122_TS_SIGN_LEVEL uint32_t coeffLevels[3]; double coeffLevelError[4]; -#endif CoeffCodingContext cctx( tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag() ); const int sbSizeM1 = ( 1 << cctx.log2CGSize() ) - 1; @@ -1335,7 +1256,6 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI const int64_t tmpLevel = int64_t( abs( srcCoeff[blkPos] ) ) * quantisationCoefficient; const Intermediate_Int levelDouble = (Intermediate_Int)std::min<int64_t>( tmpLevel, std::numeric_limits<Intermediate_Int>::max() - ( Intermediate_Int( 1 ) << ( qBits - 1 ) ) ); -#if JVET_O0122_TS_SIGN_LEVEL uint32_t roundAbsLevel = std::min<uint32_t>(uint32_t(entropyCodingMaximum), uint32_t((levelDouble + (Intermediate_Int(1) << (qBits - 1))) >> qBits)); uint32_t minAbsLevel = (roundAbsLevel > 1 ? roundAbsLevel - 1 : 1); @@ -1362,14 +1282,6 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI costCoeff0[scanPos] = coeffLevelError[0]; blockUncodedCost += costCoeff0[ scanPos ]; dstCoeff[blkPos] = coeffLevels[0]; -#else - uint32_t maxAbsLevel = std::min<uint32_t>( uint32_t( entropyCodingMaximum ), uint32_t( ( levelDouble + ( Intermediate_Int( 1 ) << ( qBits - 1 ) ) ) >> qBits ) ); - - const double err = double( levelDouble ); - costCoeff0[ scanPos ] = err * err * errorScale; - blockUncodedCost += costCoeff0[ scanPos ]; - dstCoeff[ blkPos ] = maxAbsLevel; -#endif //===== coefficient level estimation ===== unsigned ctxIdSig = cctx.sigCtxIdAbsTS( scanPos, dstCoeff ); @@ -1377,50 +1289,31 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI const BinFracBits fracBitsPar = fracBits.getFracBitsArray( cctx.parityCtxIdAbsTS() ); goRiceParam = cctx.templateAbsSumTS( scanPos, dstCoeff ); -#if JVET_O0122_TS_SIGN_LEVEL unsigned ctxIdSign = cctx.signCtxIdAbsTS(scanPos, dstCoeff, 0); const BinFracBits fracBitsSign = fracBits.getFracBitsArray(ctxIdSign); -#else - const BinFracBits fracBitsSign = fracBits.getFracBitsArray( Ctx::TsResidualSign( toChannelType(compID) ) ); -#endif const uint8_t sign = srcCoeff[ blkPos ] < 0 ? 1 : 0; -#if JVET_O0122_TS_SIGN_LEVEL DTRACE_COND( ( coeffLevels[0] != 0 ), g_trace_ctx, D_RDOQ_MORE, " uiCtxSig=%d", ctxIdSig ); -#else - DTRACE_COND( ( maxAbsLevel != 0 ), g_trace_ctx, D_RDOQ_MORE, " uiCtxSig=%d", ctxIdSig ); -#endif -#if JVET_O0122_TS_SIGN_LEVEL unsigned gt1CtxId = cctx.lrg1CtxIdAbsTS(scanPos, dstCoeff, 0); const BinFracBits fracBitsGr1 = fracBits.getFracBitsArray(gt1CtxId); -#endif const BinFracBits fracBitsSig = fracBits.getFracBitsArray( ctxIdSig ); bool lastCoeff = false; // if (scanPosInSB == lastPosCoded && noCoeffCoded == 0) { lastCoeff = true; } -#if JVET_O0122_TS_SIGN_LEVEL cLevel = xGetCodedLevelTSPred( costCoeff[ scanPos ], costCoeff0[ scanPos ], costSig[ scanPos ], levelDouble, qBits, errorScale, coeffLevels, coeffLevelError, &fracBitsSig, fracBitsPar, cctx, fracBits, fracBitsSign, fracBitsGr1, sign, rightPixel, belowPixel, goRiceParam, lastCoeff, extendedPrecision, maxLog2TrDynamicRange); -#else - cLevel = xGetCodedLevelTS( costCoeff[ scanPos ], costCoeff0[ scanPos ], costSig[ scanPos ], - levelDouble, maxAbsLevel, &fracBitsSig, fracBitsPar, cctx, fracBits, fracBitsSign, sign, goRiceParam, qBits, errorScale, lastCoeff, extendedPrecision, maxLog2TrDynamicRange ); -#endif if (cLevel > 0) { noCoeffCoded++; } -#if JVET_O0122_TS_SIGN_LEVEL TCoeff level = cLevel; dstCoeff[blkPos] = (level != 0 && srcCoeff[blkPos] < 0) ? -level : level; -#else - dstCoeff[ blkPos ] = cLevel; -#endif baseCost += costCoeff[ scanPos ]; rdStats.d64SigCost += costSig[ scanPos ]; @@ -1484,12 +1377,7 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI { int blkPos = cctx.blockPos( scanPos ); TCoeff level = dstCoeff[ blkPos ]; -#if !JVET_O0122_TS_SIGN_LEVEL - absSum += level; - dstCoeff[ blkPos ] = ( level != 0 && srcCoeff[ blkPos ] < 0 ) ? -level : level; -#else absSum += abs(level); -#endif } } @@ -1534,37 +1422,22 @@ 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_O0122_TS_SIGN_LEVEL m_bdpcm = dirMode; -#endif const bool needsSqrt2Scale = TU::needsSqrt2Scale(tu, compID); // should always be false - transform-skipped blocks don't require sqrt(2) compensation. -#if JVET_O0919_TS_MIN_QP const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); const int qBits = QUANT_SHIFT + qp.per(isTransformSkip) + 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(isTransformSkip)]; const double errorScale = xGetErrScaleCoeff(TU::needsSqrt2Scale(tu, compID), width, height, qp.rem(isTransformSkip), maxLog2TrDynamicRange, channelBitDepth); -#else - 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); -#endif TrQuantParams trQuantParams; -#if JVET_O0919_TS_MIN_QP trQuantParams.rightShift = (IQUANT_SHIFT - (transformShift + qp.per(isTransformSkip))); trQuantParams.qScale = g_invQuantScales[needsSqrt2Scale ? 1 : 0][qp.rem(isTransformSkip)]; -#else - trQuantParams.rightShift = (IQUANT_SHIFT - (transformShift + qp.per)); - trQuantParams.qScale = g_invQuantScales[needsSqrt2Scale ? 1 : 0][qp.rem]; -#endif const TCoeff entropyCodingMaximum = (1 << maxLog2TrDynamicRange) - 1; -#if JVET_O0122_TS_SIGN_LEVEL uint32_t coeffLevels[3]; double coeffLevelError[4]; -#endif CoeffCodingContext cctx(tu, compID, tu.cs->slice->getSignDataHidingEnabledFlag()); const int sbSizeM1 = (1 << cctx.log2CGSize()) - 1; @@ -1604,7 +1477,6 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons // set coeff const int64_t tmpLevel = int64_t(abs(srcCoeff[blkPos] - predCoeff)) * quantisationCoefficient; const Intermediate_Int levelDouble = (Intermediate_Int)std::min<int64_t>(tmpLevel, std::numeric_limits<Intermediate_Int>::max() - (Intermediate_Int(1) << (qBits - 1))); -#if JVET_O0122_TS_SIGN_LEVEL uint32_t roundAbsLevel = std::min<uint32_t>(uint32_t(entropyCodingMaximum), uint32_t((levelDouble + (Intermediate_Int(1) << (qBits - 1))) >> qBits)); uint32_t minAbsLevel = (roundAbsLevel > 1 ? roundAbsLevel - 1 : 1); @@ -1620,14 +1492,6 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons costCoeff0[scanPos] = coeffLevelError[0]; blockUncodedCost += costCoeff0[scanPos]; dstCoeff[blkPos] = coeffLevels[0]; -#else - uint32_t maxAbsLevel = std::min<uint32_t>(uint32_t(entropyCodingMaximum), uint32_t((levelDouble + (Intermediate_Int(1) << (qBits - 1))) >> qBits)); - - const double err = double(levelDouble); - costCoeff0[scanPos] = err * err * errorScale; - blockUncodedCost += costCoeff0[scanPos]; - dstCoeff[blkPos] = maxAbsLevel; -#endif //===== coefficient level estimation ===== unsigned ctxIdSig = cctx.sigCtxIdAbsTS(scanPos, dstCoeff); @@ -1635,23 +1499,13 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons const BinFracBits fracBitsPar = fracBits.getFracBitsArray(cctx.parityCtxIdAbsTS()); goRiceParam = cctx.templateAbsSumTS(scanPos, dstCoeff); -#if JVET_O0122_TS_SIGN_LEVEL unsigned ctxIdSign = cctx.signCtxIdAbsTS(scanPos, dstCoeff, dirMode); const BinFracBits fracBitsSign = fracBits.getFracBitsArray(ctxIdSign); -#else - const BinFracBits fracBitsSign = fracBits.getFracBitsArray(Ctx::TsResidualSign(1)); -#endif const uint8_t sign = srcCoeff[blkPos] - predCoeff < 0 ? 1 : 0; -#if JVET_O0122_TS_SIGN_LEVEL unsigned gt1CtxId = cctx.lrg1CtxIdAbsTS(scanPos, dstCoeff, dirMode); const BinFracBits fracBitsGr1 = fracBits.getFracBitsArray(gt1CtxId); -#endif -#if JVET_O0122_TS_SIGN_LEVEL DTRACE_COND((dstCoeff[blkPos] != 0), g_trace_ctx, D_RDOQ_MORE, " uiCtxSig=%d", ctxIdSig); -#else - DTRACE_COND((maxAbsLevel != 0), g_trace_ctx, D_RDOQ_MORE, " uiCtxSig=%d", ctxIdSig); -#endif const BinFracBits fracBitsSig = fracBits.getFracBitsArray(ctxIdSig); bool lastCoeff = false; // @@ -1659,15 +1513,10 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons { lastCoeff = true; } -#if JVET_O0122_TS_SIGN_LEVEL int rightPixel, belowPixel; cctx.neighTS(rightPixel, belowPixel, scanPos, dstCoeff); cLevel = xGetCodedLevelTSPred(costCoeff[scanPos], costCoeff0[scanPos], costSig[scanPos], levelDouble, qBits, errorScale, coeffLevels, coeffLevelError, &fracBitsSig, fracBitsPar, cctx, fracBits, fracBitsSign, fracBitsGr1, sign, rightPixel, belowPixel, goRiceParam, lastCoeff, extendedPrecision, maxLog2TrDynamicRange); -#else - cLevel = xGetCodedLevelTS(costCoeff[scanPos], costCoeff0[scanPos], costSig[scanPos], - levelDouble, maxAbsLevel, &fracBitsSig, fracBitsPar, cctx, fracBits, fracBitsSign, sign, goRiceParam, qBits, errorScale, lastCoeff, extendedPrecision, maxLog2TrDynamicRange); -#endif if (cLevel > 0) { @@ -1769,7 +1618,6 @@ void QuantRDOQ::xDequantSample(TCoeff& pRes, TCoeff& coeff, const TrQuantParams& } } -#if JVET_O0122_TS_SIGN_LEVEL inline uint32_t QuantRDOQ::xGetCodedLevelTSPred(double& rd64CodedCost, double& rd64CodedCost0, double& rd64CodedCostSig, @@ -1834,75 +1682,13 @@ inline uint32_t QuantRDOQ::xGetCodedLevelTSPred(double& rd64CodedCost return bestAbsLevel; } -#else -inline uint32_t QuantRDOQ::xGetCodedLevelTS( double& codedCost, - double& codedCost0, - double& codedCostSig, - Intermediate_Int levelDouble, - uint32_t maxAbsLevel, - const BinFracBits* fracBitsSig, - const BinFracBits& fracBitsPar, - const CoeffCodingContext& cctx, - const FracBitsAccess& fracBitsAccess, - const BinFracBits& fracBitsSign, - const uint8_t sign, - uint16_t ricePar, - int qBits, - double errorScale, - bool isLast, - bool useLimitedPrefixLength, - const int maxLog2TrDynamicRange - ) const -{ - double currCostSig = 0; - uint32_t bestAbsLevel = 0; - - if( !isLast && maxAbsLevel < 3 ) - { - codedCostSig = xGetRateSigCoef( *fracBitsSig, 0 ); - codedCost = codedCost0 + codedCostSig; - if( maxAbsLevel == 0 ) - { - return bestAbsLevel; - } - } - else - { - codedCost = MAX_DOUBLE; - } - - if( !isLast ) - { - currCostSig = xGetRateSigCoef( *fracBitsSig, 1 ); - } - - uint32_t minAbsLevel = ( maxAbsLevel > 1 ? maxAbsLevel - 1 : 1 ); - for( int absLevel = maxAbsLevel; absLevel >= minAbsLevel ; absLevel-- ) - { - double err = double( levelDouble - ( Intermediate_Int( absLevel ) << qBits ) ); - double currCost = err * err * errorScale + xGetICost( xGetICRateTS( absLevel, fracBitsPar, cctx, fracBitsAccess, fracBitsSign, sign, ricePar, useLimitedPrefixLength, maxLog2TrDynamicRange ) ); - currCost += currCostSig; - - if( currCost < codedCost ) - { - bestAbsLevel = absLevel; - codedCost = currCost; - codedCostSig = currCostSig; - } - } - - return bestAbsLevel; -} -#endif inline int QuantRDOQ::xGetICRateTS( const uint32_t absLevel, const BinFracBits& fracBitsPar, const CoeffCodingContext& cctx, const FracBitsAccess& fracBitsAccess, const BinFracBits& fracBitsSign, -#if JVET_O0122_TS_SIGN_LEVEL const BinFracBits& fracBitsGt1, -#endif const uint8_t sign, const uint16_t ricePar, const bool useLimitedPrefixLength, @@ -1910,10 +1696,6 @@ inline int QuantRDOQ::xGetICRateTS( const uint32_t absLevel, { int rate = fracBitsSign.intBits[sign]; -#if !JVET_O0122_TS_SIGN_LEVEL - const uint16_t ctxGt1 = cctx.greaterXCtxIdAbsTS( 0 ); - const BinFracBits &fracBitsGt1 = fracBitsAccess.getFracBitsArray( ctxGt1 ); -#endif if( absLevel > 1 ) { diff --git a/source/Lib/CommonLib/QuantRDOQ.h b/source/Lib/CommonLib/QuantRDOQ.h index 0010d40c107d20f61be9efa5d4abe6f1a44e55e8..7387b1b4898fb5e17c25aa449f023080651a47b1 100644 --- a/source/Lib/CommonLib/QuantRDOQ.h +++ b/source/Lib/CommonLib/QuantRDOQ.h @@ -87,9 +87,6 @@ private: const BinFracBits& fracBitsPar, const BinFracBits& fracBitsGt1, const BinFracBits& fracBitsGt2, -#if !JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT - const int remGt2Bins, -#endif const int remRegBins, unsigned goRiceZero, uint16_t ui16AbsGoRice, @@ -102,9 +99,6 @@ private: const BinFracBits& fracBitsPar, const BinFracBits& fracBitsGt1, const BinFracBits& fracBitsGt2, -#if !JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT - const int remGt2Bins, -#endif const int remRegBins, unsigned goRiceZero, const uint16_t ui16AbsGoRice, @@ -122,7 +116,6 @@ private: void xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &coeffs, TCoeff &absSum, const QpParam &qp, const Ctx &ctx ); -#if JVET_O0122_TS_SIGN_LEVEL inline uint32_t xGetCodedLevelTSPred(double& rd64CodedCost, double& rd64CodedCost0, double& rd64CodedCostSig, @@ -145,34 +138,13 @@ private: bool useLimitedPrefixLength, const int maxLog2TrDynamicRange ) const; -#else - inline uint32_t xGetCodedLevelTS( double& codedCost, - double& codedCost0, - double& codedCostSig, - Intermediate_Int levelDouble, - uint32_t maxAbsLevel, - const BinFracBits* fracBitsSig, - const BinFracBits& fracBitsPar, - const CoeffCodingContext& cctx, - const FracBitsAccess& fracBitsAccess, - const BinFracBits& fracBitsSign, - const uint8_t sign, - uint16_t ricePar, - int qBits, - double errorScale, - bool isLast, - bool useLimitedPrefixLength, - const int maxLog2TrDynamicRange ) const; -#endif inline int xGetICRateTS ( const uint32_t absLevel, const BinFracBits& fracBitsPar, const CoeffCodingContext& cctx, const FracBitsAccess& fracBitsAccess, const BinFracBits& fracBitsSign, -#if JVET_O0122_TS_SIGN_LEVEL const BinFracBits& fracBitsGt1, -#endif const uint8_t sign, const uint16_t ricePar, const bool useLimitedPrefixLength, @@ -192,10 +164,8 @@ private: int m_sigRateDelta [MAX_TB_SIZEY * MAX_TB_SIZEY]; TCoeff m_deltaU [MAX_TB_SIZEY * MAX_TB_SIZEY]; TCoeff m_fullCoeff [MAX_TB_SIZEY * MAX_TB_SIZEY]; -#if JVET_O0122_TS_SIGN_LEVEL int m_bdpcm; int m_testedLevels; -#endif };// END CLASS DEFINITION QuantRDOQ //! \} diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index 8a786feb02bc5b3f4d75647a9268b9188bb3ac53..9e00d6dc656f945da19d91709fda552543095b4f 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -2938,11 +2938,7 @@ void RdCost::restoreReshapeLumaLevelToWeightTable() void RdCost::updateReshapeLumaLevelToWeightTable(SliceReshapeInfo &sliceReshape, Pel *wtTable, double cwt) { -#if JVET_O0432_LMCS_ENCODER if (m_signalType == RESHAPE_SIGNAL_SDR || m_signalType == RESHAPE_SIGNAL_HLG) -#else - if (m_signalType == RESHAPE_SIGNAL_SDR) -#endif { if (sliceReshape.getSliceReshapeModelPresentFlag()) { @@ -2995,11 +2991,7 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con } // use luma to get weight double weight = 1.0; -#if JVET_O0432_LMCS_ENCODER if (m_signalType == RESHAPE_SIGNAL_SDR || m_signalType == RESHAPE_SIGNAL_HLG) -#else - if (m_signalType == RESHAPE_SIGNAL_SDR) -#endif { if (compIdx == COMPONENT_Y) { diff --git a/source/Lib/CommonLib/Reshape.cpp b/source/Lib/CommonLib/Reshape.cpp index 107b8b23889c8c8ba5df2ff0dd83fbba4df1a9b3..40a5ed72316c760025a4dfd9159d668c520ccf8d 100644 --- a/source/Lib/CommonLib/Reshape.cpp +++ b/source/Lib/CommonLib/Reshape.cpp @@ -38,9 +38,7 @@ #include <stdio.h> #include <string.h> #include <math.h> -#if JVET_O1109_UNFIY_CRS #include <UnitTools.h> -#endif //! \ingroup CommonLib //! \{ @@ -52,9 +50,7 @@ Reshape::Reshape() : m_CTUFlag (false) , m_recReshaped (false) , m_reshape (true) -#if JVET_O1109_UNFIY_CRS , m_chromaScale (1 << CSCALE_FP_PREC) -#endif , m_vpduX (-1) , m_vpduY (-1) { @@ -75,14 +71,12 @@ void Reshape::createDec(int bitDepth) m_invLUT.resize(m_reshapeLUTSize, 0); if (m_binCW.empty()) m_binCW.resize(PIC_CODE_CW_BINS, 0); -#if JVET_O0428_LMCS_CLEANUP if (m_inputPivot.empty()) m_inputPivot.resize(PIC_CODE_CW_BINS + 1, 0); if (m_fwdScaleCoef.empty()) m_fwdScaleCoef.resize(PIC_CODE_CW_BINS, 1 << FP_PREC); if (m_invScaleCoef.empty()) m_invScaleCoef.resize(PIC_CODE_CW_BINS, 1 << FP_PREC); -#endif if (m_reshapePivot.empty()) m_reshapePivot.resize(PIC_CODE_CW_BINS + 1, 0); if (m_chromaAdjHelpLUT.empty()) @@ -93,46 +87,6 @@ void Reshape::destroy() { } -#if !JVET_O0428_LMCS_CLEANUP -/** --Perform inverse of a one dimension LUT -\param InputLUT describing the input LUT -\retval OutputLUT describing the inversed LUT of InputLUT -\param lut_size size of LUT in number of samples -*/ -void Reshape::reverseLUT(std::vector<Pel>& inputLUT, std::vector<Pel>& outputLUT, uint16_t lutSize) -{ - int i, j; - outputLUT[m_reshapePivot[m_sliceReshapeInfo.reshaperModelMinBinIdx]] = m_sliceReshapeInfo.reshaperModelMinBinIdx*m_initCW; - for (i = m_sliceReshapeInfo.reshaperModelMinBinIdx; i <= m_sliceReshapeInfo.reshaperModelMaxBinIdx; i++) - { - int16_t X1 = m_reshapePivot[i]; - int16_t X2 = m_reshapePivot[i + 1]; - outputLUT[X2] = (i + 1)*m_initCW; - int16_t Y1 = outputLUT[X1]; - int16_t Y2 = outputLUT[X2]; - - if (X2 !=X1) - { - int32_t scale = (int32_t)(Y2 - Y1) * (1 << FP_PREC) / (int32_t)(X2 - X1); - for (j = X1 + 1; j < X2; j++) - { - outputLUT[j] = (Pel)((scale*(int32_t)(j - X1) + (1 << (FP_PREC - 1))) >> FP_PREC) + Y1; - } - } - } - - for (i = 0; i < m_reshapePivot[m_sliceReshapeInfo.reshaperModelMinBinIdx]; i++) - outputLUT[i] = outputLUT[m_reshapePivot[m_sliceReshapeInfo.reshaperModelMinBinIdx]]; - for (i = m_reshapePivot[m_sliceReshapeInfo.reshaperModelMaxBinIdx + 1]; i < m_reshapeLUTSize; i++) - outputLUT[i] = outputLUT[m_reshapePivot[m_sliceReshapeInfo.reshaperModelMaxBinIdx + 1]]; - - for (i = 0; i < lutSize; i++) - { - outputLUT[i] = Clip3((Pel)0, (Pel)((1<<m_lumaBD)-1), outputLUT[i]); - } -} -#endif /** compute chroma residuce scale for TU @@ -146,7 +100,6 @@ int Reshape::calculateChromaAdj(Pel avgLuma) return(iAdj); } -#if JVET_O1109_UNFIY_CRS /** compute chroma residuce scale for TU * \param average luma pred of TU * \return chroma residue scale @@ -244,7 +197,6 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY return(chromaScale); } } -#endif /** find inx of PWL for inverse mapping * \param average luma pred of TU * \return idx of PWL for inverse mapping @@ -252,26 +204,11 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY int Reshape::getPWLIdxInv(int lumaVal) { int idxS = 0; -#if JVET_O0428_LMCS_CLEANUP for (idxS = m_sliceReshapeInfo.reshaperModelMinBinIdx; (idxS <= m_sliceReshapeInfo.reshaperModelMaxBinIdx); idxS++) { if (lumaVal < m_reshapePivot[idxS + 1]) break; } return std::min(idxS, PIC_CODE_CW_BINS-1); -#else - if (lumaVal < m_reshapePivot[m_sliceReshapeInfo.reshaperModelMinBinIdx + 1]) - return m_sliceReshapeInfo.reshaperModelMinBinIdx; - else if (lumaVal >= m_reshapePivot[m_sliceReshapeInfo.reshaperModelMaxBinIdx]) - return m_sliceReshapeInfo.reshaperModelMaxBinIdx; - else - { - for (idxS = m_sliceReshapeInfo.reshaperModelMinBinIdx; (idxS < m_sliceReshapeInfo.reshaperModelMaxBinIdx); idxS++) - { - if (lumaVal < m_reshapePivot[idxS + 1]) break; - } - return idxS; - } -#endif } /** @@ -312,7 +249,6 @@ void Reshape::constructReshaper() for (int i = m_sliceReshapeInfo.reshaperModelMinBinIdx; i <= m_sliceReshapeInfo.reshaperModelMaxBinIdx; i++) m_binCW[i] = (uint16_t)(m_sliceReshapeInfo.reshaperModelBinCWDelta[i] + (int)m_initCW); -#if JVET_O0428_LMCS_CLEANUP for (int i = 0; i < pwlFwdLUTsize; i++) { m_reshapePivot[i + 1] = m_reshapePivot[i] + m_binCW[i]; @@ -339,45 +275,8 @@ void Reshape::constructReshaper() int invSample = m_inputPivot[idxYInv] + ((m_invScaleCoef[idxYInv] * (lumaSample - m_reshapePivot[idxYInv]) + (1 << (FP_PREC - 1))) >> FP_PREC); m_invLUT[lumaSample] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)(invSample)); } -#else - for (int i = 0; i < pwlFwdLUTsize; i++) - { - m_reshapePivot[i + 1] = m_reshapePivot[i] + m_binCW[i]; - int16_t Y1 = m_reshapePivot[i]; - int16_t Y2 = m_reshapePivot[i + 1]; - - m_fwdLUT[i*pwlFwdBinLen] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)Y1); - - int log2PwlFwdBinLen = floorLog2(pwlFwdBinLen); - - int32_t scale = ((int32_t)(Y2 - Y1) * (1 << FP_PREC) + (1 << (log2PwlFwdBinLen - 1))) >> (log2PwlFwdBinLen); - for (int j = 1; j < pwlFwdBinLen; j++) - { - int tempVal = Y1 + (((int32_t)scale * (int32_t)j + (1 << (FP_PREC - 1))) >> FP_PREC); - m_fwdLUT[i*pwlFwdBinLen + j] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)tempVal); - } - } - reverseLUT(m_fwdLUT, m_invLUT, m_reshapeLUTSize); - updateChromaScaleLUT(); -#endif } -#if !JVET_O0428_LMCS_CLEANUP -/** generate chroma residue scaling LUT -* \param void -* \return void -*/ -void Reshape::updateChromaScaleLUT() -{ - for (int i = 0; i < PIC_CODE_CW_BINS; i++) - { - if (m_binCW[i] == 0) - m_chromaAdjHelpLUT[i] = 1 << CSCALE_FP_PREC; - else - m_chromaAdjHelpLUT[i] = m_initCW * (1 << CSCALE_FP_PREC) / m_binCW[i]; - } -} -#endif // diff --git a/source/Lib/CommonLib/Reshape.h b/source/Lib/CommonLib/Reshape.h index 853e6f7b88520b46cbf8fcac86bac319c49f13b5..28fe781d5ef26b4d810c2ed016dcd3e89f8d790d 100644 --- a/source/Lib/CommonLib/Reshape.h +++ b/source/Lib/CommonLib/Reshape.h @@ -64,18 +64,14 @@ protected: uint16_t m_initCW; bool m_reshape; std::vector<Pel> m_reshapePivot; -#if JVET_O0428_LMCS_CLEANUP std::vector<Pel> m_inputPivot; std::vector<int32_t> m_fwdScaleCoef; std::vector<int32_t> m_invScaleCoef; -#endif int m_lumaBD; int m_reshapeLUTSize; -#if JVET_O1109_UNFIY_CRS int m_chromaScale; int m_vpduX; int m_vpduY; -#endif public: Reshape(); #if ENABLE_SPLIT_PARALLELISM @@ -87,9 +83,6 @@ public: void createDec(int bitDepth); void destroy(); -#if !JVET_O0428_LMCS_CLEANUP - void reverseLUT(std::vector<Pel>& inputLUT, std::vector<Pel>& outputLUT, uint16_t lutSize); -#endif std::vector<Pel>& getFwdLUT() { return m_fwdLUT; } std::vector<Pel>& getInvLUT() { return m_invLUT; } std::vector<int>& getChromaAdjHelpLUT() { return m_chromaAdjHelpLUT; } @@ -105,18 +98,13 @@ public: void copySliceReshaperInfo(SliceReshapeInfo& tInfo, SliceReshapeInfo& sInfo); void constructReshaper(); -#if !JVET_O0428_LMCS_CLEANUP - void updateChromaScaleLUT(); -#endif bool getReshapeFlag() { return m_reshape; } void setReshapeFlag(bool b) { m_reshape = b; } -#if JVET_O1109_UNFIY_CRS int calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY); void setVPDULoc(int x, int y) { m_vpduX = x, m_vpduY = y; } bool isVPDUprocessed(int x, int y) { return ((x == m_vpduX) && (y == m_vpduY)); } void setChromaScale (int chromaScale) { m_chromaScale = chromaScale; } int getChromaScale() { return m_chromaScale; } -#endif };// END CLASS DEFINITION Reshape //! \} diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 780c87e3c8312ffe9143afb566c1015642ace86f..2822b75b3a7159c83f7514770c59d1ad8d9663f1 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -79,11 +79,7 @@ const char* nalUnitTypeToString(NalUnitType type) 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"; -#if JVET_N0865_GRA2GDR case NAL_UNIT_CODED_SLICE_GDR: return "GDR"; -#else - case NAL_UNIT_CODED_SLICE_GRA: return "GRA"; -#endif default: return "UNK"; } } @@ -133,7 +129,6 @@ public: } break; -#if JVET_O0119_BASE_PALETTE_444 case SCAN_TRAV_HOR: if (m_line % 2 == 0) { @@ -175,7 +170,6 @@ public: else m_line--; } break; -#endif //------------------------------------------------ default: @@ -427,7 +421,6 @@ void initROM() } } -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING for (int idxH = 0; idxH < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxH) { for (int idxW = 0; idxW < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxW) @@ -454,11 +447,8 @@ void initROM() } } } -#endif -#if JVET_O0592_ENC_ME_IMP ::memset(g_isReusedUniMVsFilled, 0, sizeof(g_isReusedUniMVsFilled)); -#endif } void destroyROM() @@ -484,7 +474,6 @@ void destroyROM() delete gp_sizeIdxInfo; gp_sizeIdxInfo = nullptr; -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING for (int idxH = 0; idxH < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxH) { for (int idxW = 0; idxW < MAX_CU_DEPTH - MIN_CU_LOG2 + 2; ++idxW) @@ -499,7 +488,6 @@ void destroyROM() g_triangleWeights[1][1][idxH][idxW] = nullptr; } } -#endif } // ==================================================================================================================== @@ -523,16 +511,6 @@ const int g_invQuantScales[2][SCALING_LIST_REM_NUM] = // can be represented as a //-------------------------------------------------------------------------------------------------- //coefficients //-------------------------------------------------------------------------------------------------- -#if !JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE -const uint8_t g_aucChromaScale[NUM_CHROMA_FORMAT][chromaQPMappingTableSize] = -{ - //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,67,68,69 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 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,29,30,31,32,33,33,34,34,35,35,36,36,37,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 }, - { 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,63,63,63,63,63,63 }, - { 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,63,63,63,63,63,63 } -}; -#endif // ==================================================================================================================== // Intra prediction // ==================================================================================================================== @@ -569,41 +547,14 @@ const uint8_t g_aucIntraModeNumFast_NotUseMPM[MAX_CU_DEPTH] = }; const uint8_t g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE] = -#if JVET_O0655_422_CHROMA_DM_MAPPING_FIX +#if JVET_P0111_CHROMA_422_FIX +// * 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 +{ 0, 1, 61, 62, 63, 64, 65, 66, 2, 3, 5, 6, 8, 10, 12, 13, 14, 16, 18, 20, 22, 23, 24, 26, 28, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 41, 42, 43, 43, 44, 44, 45, 45, 46, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 54, 55, 55, 56, 56, 57, 57, 58, 59, 59, 60, DM_CHROMA_IDX }; +#else // 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 { 0, 1, 61, 62, 63, 64, 65, 66, 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 }; -#else -// 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 -{ 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 }; -#endif - -#if !JVET_O0925_MIP_SIMPLIFICATIONS -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 -{ 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, DM_CHROMA_IDX }; - -const uint8_t g_mapMipToAngular65[3][MAX_NUM_MIP_MODE] = -{ - { 0, 18, 18, 0, 18, 0, 12, 0, 18, 2, 18, 12, 18, 18, 1, 18, 18, 0, 0, 50, 0, 50, 0, 56, 0, 50, 66, 50, 56, 50, 50, 1, 50, 50, 50 }, - { 0, 1, 0, 1, 0, 22, 18, 18, 1, 0, 1, 0, 1, 0, 44, 0, 50, 1, 0 }, - { 1, 1, 1, 1, 18, 0, 1, 0, 1, 50, 0 }, -}; -const uint8_t g_mapAngular33ToMip[3][35] = -{ - { 17, 17, 17, 9, 9, 9, 9, 17, 17, 17, 17, 17, 17, 17, 5, 5, 5, 5, 34, 22, 22, 22, 22, 34, 34, 34, 34, 34, 34, 34, 26, 26, 26, 26, 26 }, - { 0, 0, 10, 10, 10, 10, 10, 4, 6, 7, 7, 7, 5, 5, 0, 0, 3, 3, 12, 12, 12, 12, 14, 14, 14, 16, 16, 16, 15, 13, 1, 1, 1, 1, 1 }, - { 5, 1, 3, 3, 3, 3, 0, 0, 0, 4, 4, 4, 5, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8 }, -}; - -const int g_sortedMipMpms[3][NUM_MPM_MIP] = -{ - { 17, 34, 5 }, - { 0, 7, 16 }, - { 1, 4, 6 }, -}; #endif @@ -613,9 +564,7 @@ const int g_sortedMipMpms[3][NUM_MPM_MIP] = // ==================================================================================================================== SizeIndexInfo* gp_sizeIdxInfo = NULL; -#if JVET_O0105_ICT const int g_ictModes[2][4] = { { 0, 3, 1, 2 }, { 0, -3, -1, -2 } }; -#endif UnitScale g_miScaling( MIN_CU_LOG2, MIN_CU_LOG2 ); @@ -778,17 +727,11 @@ const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM] = { 1, 2, 4, 8, 16, uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; -#endif -#if JVET_O0592_ENC_ME_IMP Mv g_reusedUniMVs[32][32][8][8][2][33]; bool g_isReusedUniMVsFilled[32][32][8][8]; -#endif -#if JVET_O0119_BASE_PALETTE_444 const uint8_t g_paletteQuant[52] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 24, 23, 25, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 45 }; uint8_t g_paletteRunTopLut [5] = { 0, 1, 1, 2, 2 }; uint8_t g_paletteRunLeftLut[5] = { 0, 3, 3, 4, 4 }; -#endif //! \} diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index 7dc2170d4dab6bffa1c8366f8ff0e47d3d816e0a..6ba79c0c7270d6f762081a90b2449b063da02900 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -79,20 +79,6 @@ extern const int g_invQuantScales[2/*0=4^n blocks, 1=2*4^n blocks*/][SCALING_LIS static const int g_numTransformMatrixSizes = 6; static const int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 6, 6 }; -#if !JVET_O0925_MIP_SIMPLIFICATIONS -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 -#if !JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE -// ==================================================================================================================== -// Luma QP to Chroma QP mapping -// ==================================================================================================================== -static const int chromaQPMappingTableSize = (MAX_QP + 7); - -extern const uint8_t g_aucChromaScale[NUM_CHROMA_FORMAT][chromaQPMappingTableSize]; -#endif // ==================================================================================================================== // Scanning order & context mapping table @@ -146,9 +132,7 @@ extern const uint8_t g_lfnstLut[ NUM_INTRA_MODE + NUM_EXT_LUMA_MODE - 1 ]; // ==================================================================================================================== extern SizeIndexInfo* gp_sizeIdxInfo; -#if JVET_O0105_ICT extern const int g_ictModes[2][4]; -#endif inline bool is34( const SizeType& size ) { @@ -219,24 +203,18 @@ constexpr uint8_t g_tbMax[257] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, //! \} extern uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING // 7-tap/3-tap, direction, 2/4/8/16/32/64/128 extern int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; -#endif extern bool g_mctsDecCheckEnabled; -#if JVET_O0592_ENC_ME_IMP class Mv; extern Mv g_reusedUniMVs[32][32][8][8][2][33]; extern bool g_isReusedUniMVsFilled[32][32][8][8]; -#endif -#if JVET_O0119_BASE_PALETTE_444 extern const uint8_t g_paletteQuant[52]; extern uint8_t g_paletteRunTopLut[5]; extern uint8_t g_paletteRunLeftLut[5]; -#endif #endif //__TCOMROM__ diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index fed29096ec615778c448877a771a6689f4393841..4438e50a11c34b9358d635144b945f688b8a8647 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -98,70 +98,31 @@ void deleteSEIs (SEIMessages &seiList) void SEIBufferingPeriod::copyTo (SEIBufferingPeriod& target) const { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - target.m_bpSeqParameterSetId = m_bpSeqParameterSetId; - target.m_rapCpbParamsPresentFlag = m_rapCpbParamsPresentFlag; -#else target.m_bpNalCpbParamsPresentFlag = m_bpNalCpbParamsPresentFlag; target.m_bpVclCpbParamsPresentFlag = m_bpVclCpbParamsPresentFlag; target.m_initialCpbRemovalDelayLength = m_initialCpbRemovalDelayLength; target.m_cpbRemovalDelayLength = m_cpbRemovalDelayLength; target.m_dpbOutputDelayLength = m_dpbOutputDelayLength; -#if !JVET_N0867_TEMP_SCAL_HRD - target.m_bpCpbCnt = m_bpCpbCnt; -#endif -#endif -#if !FIX_SEI_O0189 - target.m_cpbDelayOffset = m_cpbDelayOffset; - target.m_dpbDelayOffset = m_dpbDelayOffset; -#endif -#if JVET_O0189_DU target.m_duCpbRemovalDelayIncrementLength = m_duCpbRemovalDelayIncrementLength; target.m_dpbOutputDelayDuLength = m_dpbOutputDelayDuLength; -#endif target.m_concatenationFlag = m_concatenationFlag; target.m_auCpbRemovalDelayDelta = m_auCpbRemovalDelayDelta; -#if JVET_N0867_TEMP_SCAL_HRD target.m_cpbRemovalDelayDeltasPresentFlag = m_cpbRemovalDelayDeltasPresentFlag; target.m_numCpbRemovalDelayDeltas = m_numCpbRemovalDelayDeltas; target.m_bpMaxSubLayers = m_bpMaxSubLayers; -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - ::memcpy(target.m_initialCpbRemovalDelay, m_initialCpbRemovalDelay, sizeof(m_initialCpbRemovalDelay)); - ::memcpy(target.m_initialCpbRemovalDelayOffset, m_initialCpbRemovalDelayOffset, sizeof(m_initialCpbRemovalDelayOffset)); - ::memcpy(target.m_initialAltCpbRemovalDelay, m_initialAltCpbRemovalDelay, sizeof(m_initialAltCpbRemovalDelay)); - ::memcpy(target.m_initialAltCpbRemovalDelayOffset, m_initialAltCpbRemovalDelayOffset, sizeof(m_initialAltCpbRemovalDelayOffset)); -#else -#if !JVET_N0867_TEMP_SCAL_HRD - target.m_initialCpbRemovalDelay[0] = m_initialCpbRemovalDelay [0]; - target.m_initialCpbRemovalDelay[1] = m_initialCpbRemovalDelay [1]; - target.m_initialCpbRemovalOffset[0] = m_initialCpbRemovalOffset [0]; - target.m_initialCpbRemovalOffset[1] = m_initialCpbRemovalOffset [1]; -#else ::memcpy(target.m_initialCpbRemovalDelay, m_initialCpbRemovalDelay, sizeof(m_initialCpbRemovalDelay)); ::memcpy(target.m_initialCpbRemovalOffset, m_initialCpbRemovalOffset, sizeof(m_initialCpbRemovalOffset)); ::memcpy(target.m_cpbRemovalDelayDelta, m_cpbRemovalDelayDelta, sizeof(m_cpbRemovalDelayDelta)); ::memcpy(target.m_bpCpbCnt, m_bpCpbCnt, sizeof(m_bpCpbCnt)); -#endif -#endif } void SEIPictureTiming::copyTo (SEIPictureTiming& target) const { -#if !JVET_O0041_FRAME_FIELD_SEI - target.m_picStruct = m_picStruct; - target.m_sourceScanType = m_sourceScanType; - target.m_duplicateFlag = m_duplicateFlag; -#endif -#if !JVET_N0867_TEMP_SCAL_HRD - target.m_auCpbRemovalDelay = m_auCpbRemovalDelay; -#else ::memcpy(target.m_auCpbRemovalDelay, m_auCpbRemovalDelay, sizeof(m_auCpbRemovalDelay)); ::memcpy(target.m_subLayerDelaysPresentFlag, m_subLayerDelaysPresentFlag, sizeof(m_subLayerDelaysPresentFlag)); ::memcpy(target.m_cpbRemovalDelayDeltaEnabledFlag, m_cpbRemovalDelayDeltaEnabledFlag, sizeof(m_cpbRemovalDelayDeltaEnabledFlag)); ::memcpy(target.m_cpbRemovalDelayDeltaIdx, m_cpbRemovalDelayDeltaIdx, sizeof(m_cpbRemovalDelayDeltaIdx)); target.m_ptMaxSubLayers = m_ptMaxSubLayers; -#endif target.m_picDpbOutputDelay = m_picDpbOutputDelay; target.m_picDpbOutputDuDelay = m_picDpbOutputDuDelay; target.m_numDecodingUnitsMinus1 = m_numDecodingUnitsMinus1; @@ -206,9 +167,7 @@ const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) case SEI::TEMPORAL_LEVEL0_INDEX: return "Temporal sub-layer zero index"; #endif case SEI::DECODED_PICTURE_HASH: return "Decoded picture hash"; -#if JVET_N0494_DRAP case SEI::DEPENDENT_RAP_INDICATION: return "Dependent RAP indication"; -#endif #if HEVC_SEI case SEI::SCALABLE_NESTING: return "Scalable nesting"; case SEI::REGION_REFRESH_INFO: return "Region refresh information"; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 08a167f33343f2a569c830544a4f84df23195f4e..4f5cf92a922a007f431a3773b675c7529d9bee31 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -94,17 +94,13 @@ public: KNEE_FUNCTION_INFO = 141, COLOUR_REMAPPING_INFO = 142, #endif -#if JVET_N0494_DRAP DEPENDENT_RAP_INDICATION = 145, -#endif #if HEVC_SEI #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI ALTERNATIVE_TRANSFER_CHARACTERISTICS = 182, #endif #endif -#if JVET_O0041_FRAME_FIELD_SEI FRAME_FIELD_INFO = 168, -#endif }; SEI() {} @@ -151,7 +147,6 @@ public: PictureHash m_pictureHash; }; -#if JVET_N0494_DRAP class SEIDependentRAPIndication : public SEI { public: @@ -160,7 +155,6 @@ public: virtual ~SEIDependentRAPIndication() { } }; -#endif #if HEVC_SEI class SEIActiveParameterSets : public SEI @@ -189,99 +183,44 @@ public: void copyTo (SEIBufferingPeriod& target) const; SEIBufferingPeriod() -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - : m_bpSeqParameterSetId (0) - , m_rapCpbParamsPresentFlag (false) -#else : m_bpNalCpbParamsPresentFlag (false) , m_bpVclCpbParamsPresentFlag (false) , m_initialCpbRemovalDelayLength (0) , m_cpbRemovalDelayLength (0) , m_dpbOutputDelayLength (0) -#if !JVET_N0867_TEMP_SCAL_HRD - , m_bpCpbCnt (0) -#endif -#endif -#if JVET_O0189_DU , m_duCpbRemovalDelayIncrementLength (0) , m_dpbOutputDelayDuLength (0) -#endif -#if !FIX_SEI_O0189 - , m_cpbDelayOffset (0) - , m_dpbDelayOffset (0) -#endif -#if JVET_N0867_TEMP_SCAL_HRD , m_cpbRemovalDelayDeltasPresentFlag (false) , m_numCpbRemovalDelayDeltas (0) , m_bpMaxSubLayers (0) -#endif { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - ::memset(m_initialCpbRemovalDelay, 0, sizeof(m_initialCpbRemovalDelay)); - ::memset(m_initialCpbRemovalDelayOffset, 0, sizeof(m_initialCpbRemovalDelayOffset)); - ::memset(m_initialAltCpbRemovalDelay, 0, sizeof(m_initialAltCpbRemovalDelay)); - ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset)); -#endif -#if JVET_N0867_TEMP_SCAL_HRD ::memset(m_initialCpbRemovalDelay, 0, sizeof(m_initialCpbRemovalDelay)); ::memset(m_initialCpbRemovalOffset, 0, sizeof(m_initialCpbRemovalOffset)); ::memset(m_cpbRemovalDelayDelta, 0, sizeof(m_cpbRemovalDelayDelta)); ::memset(m_bpCpbCnt, 0, sizeof(m_bpCpbCnt)); -#endif } virtual ~SEIBufferingPeriod() {} -#if JVET_O0189_DU void setDuCpbRemovalDelayIncrementLength( uint32_t value ) { m_duCpbRemovalDelayIncrementLength = value; } uint32_t getDuCpbRemovalDelayIncrementLength( ) const { return m_duCpbRemovalDelayIncrementLength; } void setDpbOutputDelayDuLength( uint32_t value ) { m_dpbOutputDelayDuLength = value; } uint32_t getDpbOutputDelayDuLength( ) const { return m_dpbOutputDelayDuLength; } -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - uint32_t m_bpSeqParameterSetId; - bool m_rapCpbParamsPresentFlag; -#else bool m_bpNalCpbParamsPresentFlag; bool m_bpVclCpbParamsPresentFlag; uint32_t m_initialCpbRemovalDelayLength; uint32_t m_cpbRemovalDelayLength; uint32_t m_dpbOutputDelayLength; -#if !JVET_N0867_TEMP_SCAL_HRD - int m_bpCpbCnt; -#else int m_bpCpbCnt[MAX_TLAYER]; -#endif -#endif -#if JVET_O0189_DU uint32_t m_duCpbRemovalDelayIncrementLength; uint32_t m_dpbOutputDelayDuLength; -#endif -#if !FIX_SEI_O0189 - uint32_t m_cpbDelayOffset; - uint32_t m_dpbDelayOffset; -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - uint32_t m_initialCpbRemovalDelay [MAX_CPB_CNT][2]; - uint32_t m_initialCpbRemovalDelayOffset [MAX_CPB_CNT][2]; - uint32_t m_initialAltCpbRemovalDelay [MAX_CPB_CNT][2]; - uint32_t m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2]; -#else -#if !JVET_N0867_TEMP_SCAL_HRD - std::vector<uint32_t> m_initialCpbRemovalDelay [2]; - std::vector<uint32_t> m_initialCpbRemovalOffset [2]; -#else uint32_t m_initialCpbRemovalDelay [MAX_TLAYER][MAX_CPB_CNT][2]; uint32_t m_initialCpbRemovalOffset [MAX_TLAYER][MAX_CPB_CNT][2]; -#endif -#endif bool m_concatenationFlag; uint32_t m_auCpbRemovalDelayDelta; -#if JVET_N0867_TEMP_SCAL_HRD bool m_cpbRemovalDelayDeltasPresentFlag; int m_numCpbRemovalDelayDeltas; int m_bpMaxSubLayers; uint32_t m_cpbRemovalDelayDelta [15]; -#endif }; class SEIPictureTiming : public SEI @@ -291,55 +230,28 @@ public: void copyTo (SEIPictureTiming& target) const; SEIPictureTiming() -#if !JVET_O0041_FRAME_FIELD_SEI - : m_picStruct (0) - , m_sourceScanType (0) - , m_duplicateFlag (false) - , m_picDpbOutputDuDelay (0) -#else -#if JVET_N0867_TEMP_SCAL_HRD : m_ptMaxSubLayers (0) , m_picDpbOutputDelay (0) , m_picDpbOutputDuDelay (0) , m_numDecodingUnitsMinus1 (0) , m_duCommonCpbRemovalDelayFlag (false) , m_duCommonCpbRemovalDelayMinus1 (0) -#else - : m_auCpbRemovalDelay (0) - , m_picDpbOutputDelay (0) - , m_picDpbOutputDuDelay (0) - , m_numDecodingUnitsMinus1 (0) - , m_duCommonCpbRemovalDelayFlag (false) - , m_duCommonCpbRemovalDelayMinus1 (0) -#endif -#endif { -#if JVET_N0867_TEMP_SCAL_HRD ::memset(m_subLayerDelaysPresentFlag, 0, sizeof(m_subLayerDelaysPresentFlag)); ::memset(m_cpbRemovalDelayDeltaEnabledFlag, 0, sizeof(m_cpbRemovalDelayDeltaEnabledFlag)); ::memset(m_cpbRemovalDelayDeltaIdx, 0, sizeof(m_cpbRemovalDelayDeltaIdx)); ::memset(m_auCpbRemovalDelay, 0, sizeof(m_auCpbRemovalDelay)); -#endif } virtual ~SEIPictureTiming() { } -#if !JVET_O0041_FRAME_FIELD_SEI - uint32_t m_picStruct; - uint32_t m_sourceScanType; - bool m_duplicateFlag; -#endif -#if JVET_N0867_TEMP_SCAL_HRD int m_ptMaxSubLayers; bool m_subLayerDelaysPresentFlag[MAX_TLAYER]; bool m_cpbRemovalDelayDeltaEnabledFlag[MAX_TLAYER]; uint32_t m_cpbRemovalDelayDeltaIdx[MAX_TLAYER]; uint32_t m_auCpbRemovalDelay[MAX_TLAYER]; -#else - uint32_t m_auCpbRemovalDelay; -#endif uint32_t m_picDpbOutputDelay; uint32_t m_picDpbOutputDuDelay; uint32_t m_numDecodingUnitsMinus1; @@ -368,7 +280,6 @@ public: }; -#if JVET_O0041_FRAME_FIELD_SEI class SEIFrameFieldInfo : public SEI { public: @@ -397,7 +308,6 @@ public: int m_sourceScanType; bool m_duplicateFlag; }; -#endif #if HEVC_SEI class SEIRecoveryPoint : public SEI diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index 37ca91c90e1fb3ff2a62b72a898f691ad60a6b80..cacc1ce19ebcb65adca27890337b808422bb4923 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -661,27 +661,13 @@ void SampleAdaptiveOffset::SAOProcess( CodingStructure& cs, SAOBlkParam* saoBlkP DTRACE ( g_trace_ctx, D_CRC, "SAO" ); DTRACE_CRC( g_trace_ctx, D_CRC, cs, cs.getRecoBuf() ); -#if !JVET_O0525_REMOVE_PCM - xPCMLFDisableProcess(cs); -#else xLosslessDisableProcess(cs); -#endif } -#if !JVET_O0525_REMOVE_PCM -void SampleAdaptiveOffset::xPCMLFDisableProcess(CodingStructure& cs) -#else void SampleAdaptiveOffset::xLosslessDisableProcess(CodingStructure& cs) -#endif { const PreCalcValues& pcv = *cs.pcv; -#if !JVET_O0525_REMOVE_PCM - const bool bPCMFilter = (cs.sps->getPCMEnabledFlag() && cs.sps->getPCMFilterDisableFlag()) ? true : false; - - if( bPCMFilter || cs.pps->getTransquantBypassEnabledFlag() ) -#else if( cs.pps->getTransquantBypassEnabledFlag() ) -#endif { for( uint32_t yPos = 0; yPos < pcv.lumaHeight; yPos += pcv.maxCUHeight ) { @@ -689,37 +675,20 @@ void SampleAdaptiveOffset::xLosslessDisableProcess(CodingStructure& cs) { UnitArea ctuArea( cs.area.chromaFormat, Area( xPos, yPos, pcv.maxCUWidth, pcv.maxCUHeight ) ); -#if !JVET_O0525_REMOVE_PCM - // CU-based deblocking - xPCMCURestoration(cs, ctuArea); -#else xLosslessCURestoration(cs, ctuArea); -#endif } } } } -#if !JVET_O0525_REMOVE_PCM -void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea) -#else void SampleAdaptiveOffset::xLosslessCURestoration(CodingStructure& cs, const UnitArea &ctuArea) -#endif { -#if !JVET_O0525_REMOVE_PCM - const SPS& sps = *cs.sps; -#endif uint32_t numComponents; bool anyDualTree = false; for( auto &cu : cs.traverseCUs( ctuArea, CH_L ) ) { -#if !JVET_O0525_REMOVE_PCM - // restore PCM samples - if( ( cu.ipcm && sps.getPCMFilterDisableFlag() ) || CU::isLosslessCoded( cu ) ) -#else // restore lossless samples if( CU::isLosslessCoded( cu ) ) -#endif { cs.slice = cu.slice; @@ -727,11 +696,7 @@ void SampleAdaptiveOffset::xLosslessCURestoration(CodingStructure& cs, const Uni numComponents = CS::isDualITree(cs) ? 1 : m_numberOfComponents; for( uint32_t comp = 0; comp < numComponents; comp++ ) { -#if !JVET_O0525_REMOVE_PCM - xPCMSampleRestoration( cu, ComponentID( comp ) ); -#else xLosslessSampleRestoration( cu, ComponentID( comp ) ); -#endif } } } @@ -745,39 +710,21 @@ void SampleAdaptiveOffset::xLosslessCURestoration(CodingStructure& cs, const Uni continue; } -#if !JVET_O0525_REMOVE_PCM - // restore PCM samples - if ((cu.ipcm && sps.getPCMFilterDisableFlag()) || CU::isLosslessCoded(cu)) -#else // restore lossless samples if (CU::isLosslessCoded(cu)) -#endif { for (uint32_t comp = 1; comp < numComponents; comp++) { -#if !JVET_O0525_REMOVE_PCM - xPCMSampleRestoration(cu, ComponentID(comp)); -#else xLosslessSampleRestoration(cu, ComponentID(comp)); -#endif } } } } } -#if !JVET_O0525_REMOVE_PCM -void SampleAdaptiveOffset::xPCMSampleRestoration(CodingUnit& cu, const ComponentID compID) -#else void SampleAdaptiveOffset::xLosslessSampleRestoration(CodingUnit& cu, const ComponentID compID) -#endif { -#if !JVET_O0525_REMOVE_PCM - const CompArea& ca = cu.block(compID); - if( CU::isLosslessCoded( cu ) && !cu.ipcm ) -#else if( CU::isLosslessCoded( cu ) ) -#endif { for( auto &currTU : CU::traverseTUs( cu ) ) { @@ -794,25 +741,6 @@ void SampleAdaptiveOffset::xLosslessSampleRestoration(CodingUnit& cu, const Comp return; } -#if !JVET_O0525_REMOVE_PCM - const TransformUnit& tu = *cu.firstTU; CHECK( cu.firstTU != cu.lastTU, "Multiple TUs present in a PCM CU" ); - const CPelBuf& pcmBuf = tu.getPcmbuf( compID ); - PelBuf dstBuf = cu.cs->getRecoBuf( ca ); - const SPS &sps = *cu.cs->sps; - const uint32_t uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID)); - - for (uint32_t y = 0; y < ca.height; y++) - { - for (uint32_t x = 0; x < ca.width; x++) - { - dstBuf.at(x,y) = (pcmBuf.at(x,y) << uiPcmLeftShiftBit); - } - } - if (cu.slice->getLmcsEnabledFlag()&& isLuma(compID)) - { - dstBuf.rspSignal(m_pcReshape->getInvLUT()); - } -#endif } void SampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructure& cs, const Position &pos, diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.h b/source/Lib/CommonLib/SampleAdaptiveOffset.h index b2cdcb3da82a2b79a0a37d162fd7ce572c93051f..e3e75f39925949d3f572def6d105b65ded0130fd 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.h +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.h @@ -91,15 +91,9 @@ protected: void reconstructBlkSAOParam(SAOBlkParam& recParam, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES]); int getMergeList(CodingStructure& cs, int ctuRsAddr, SAOBlkParam* blkParams, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES]); void offsetCTU(const UnitArea& area, const CPelUnitBuf& src, PelUnitBuf& res, SAOBlkParam& saoblkParam, CodingStructure& cs); -#if !JVET_O0525_REMOVE_PCM - void xPCMLFDisableProcess(CodingStructure& cs); - void xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea); - void xPCMSampleRestoration(CodingUnit& cu, const ComponentID compID); -#else void xLosslessDisableProcess(CodingStructure& cs); void xLosslessCURestoration(CodingStructure& cs, const UnitArea &ctuArea); void xLosslessSampleRestoration(CodingUnit& cu, const ComponentID compID); -#endif void xReconstructBlkSAOParams(CodingStructure& cs, SAOBlkParam* saoBlkParams); 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[]) diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index adeb573e4b434b9c7387c287272c71975d6668a4..2890f78484c663b46ce661b2a791b09beb020ad3 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -76,23 +76,15 @@ Slice::Slice() , m_pcPic ( NULL ) , m_colFromL0Flag ( true ) , m_noOutputPriorPicsFlag ( false ) -#if JVET_N0865_NONSYNTAX , m_noIncorrectPicOutputFlag ( false ) -#else -, m_noRaslOutputFlag ( false ) -#endif , m_handleCraAsCvsStartFlag ( false ) , m_colRefIdx ( 0 ) , m_maxNumMergeCand ( 0 ) , m_maxNumAffineMergeCand ( 0 ) , m_maxNumTriangleCand ( 0 ) -#if JVET_O0455_IBC_MAX_MERGE_NUM , m_maxNumIBCMergeCand ( 0 ) -#endif , m_disFracMMVD ( false ) -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG , m_disBdofDmvrFlag ( false ) -#endif , m_uiTLayer ( 0 ) , m_bTLayerSwitchingFlag ( false ) , m_sliceMode ( NO_SLICES ) @@ -107,9 +99,7 @@ Slice::Slice() , m_bTestWeightBiPred ( false ) , m_substreamSizes ( ) , m_cabacInitFlag ( false ) -#if JVET_O0105_ICT , m_jointCbCrSignFlag ( false ) -#endif , m_bLMvdL1Zero ( false ) , m_LFCrossSliceBoundaryFlag ( false ) , m_enableTMVPFlag ( true ) @@ -129,14 +119,10 @@ Slice::Slice() , m_lmcsAps (nullptr) , m_tileGroupLmcsEnabledFlag (false) , m_tileGroupLmcsChromaResidualScaleFlag (false) -#if JVET_O0299_APS_SCALINGLIST , m_scalingListApsId ( -1 ) , m_scalingListAps ( nullptr ) , m_tileGroupscalingListPresentFlag ( false ) -#endif -#if JVET_O0181 , m_nonReferencePicFlag ( 0 ) -#endif { for(uint32_t i=0; i<NUM_REF_PIC_LIST_01; i++) { @@ -207,31 +193,21 @@ void Slice::initSlice() m_maxNumMergeCand = MRG_MAX_NUM_CANDS; m_maxNumAffineMergeCand = AFFINE_MRG_MAX_NUM_CANDS; -#if JVET_O0455_IBC_MAX_MERGE_NUM m_maxNumIBCMergeCand = IBC_MRG_MAX_NUM_CANDS; -#endif m_bFinalized=false; m_disFracMMVD = false; -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG m_disBdofDmvrFlag = false; -#endif m_substreamSizes.clear(); m_cabacInitFlag = false; -#if JVET_O0105_ICT m_jointCbCrSignFlag = false; -#endif m_enableTMVPFlag = true; -#if JVET_N0494_DRAP m_enableDRAPSEI = false; m_useLTforDRAP = false; m_isDRAP = false; m_latestDRAPPOC = MAX_INT; -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB resetTileGroupAlfEnabledFlag(); -#endif } void Slice::setDefaultClpRng( const SPS& sps ) @@ -711,9 +687,7 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) } m_cabacInitFlag = pSrc->m_cabacInitFlag; -#if JVET_O0105_ICT m_jointCbCrSignFlag = pSrc->m_jointCbCrSignFlag; -#endif memcpy(m_alfApss, pSrc->m_alfApss, sizeof(m_alfApss)); // this might be quite unsafe memcpy( m_tileGroupAlfEnabledFlag, pSrc->m_tileGroupAlfEnabledFlag, sizeof(m_tileGroupAlfEnabledFlag)); m_tileGroupNumAps = pSrc->m_tileGroupNumAps; @@ -727,13 +701,9 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_maxNumMergeCand = pSrc->m_maxNumMergeCand; m_maxNumAffineMergeCand = pSrc->m_maxNumAffineMergeCand; m_maxNumTriangleCand = pSrc->m_maxNumTriangleCand; -#if JVET_O0455_IBC_MAX_MERGE_NUM m_maxNumIBCMergeCand = pSrc->m_maxNumIBCMergeCand; -#endif m_disFracMMVD = pSrc->m_disFracMMVD; -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG m_disBdofDmvrFlag = pSrc->m_disBdofDmvrFlag; -#endif if( cpyAlmostAll ) m_encCABACTableIdx = pSrc->m_encCABACTableIdx; m_splitConsOverrideFlag = pSrc->m_splitConsOverrideFlag; m_uiMinQTSize = pSrc->m_uiMinQTSize; @@ -753,13 +723,9 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_lmcsAps = pSrc->m_lmcsAps; m_lmcsApsId = pSrc->m_lmcsApsId; -#if JVET_O0299_APS_SCALINGLIST m_tileGroupscalingListPresentFlag = pSrc->m_tileGroupscalingListPresentFlag; m_scalingListAps = pSrc->m_scalingListAps; m_scalingListApsId = pSrc->m_scalingListApsId; -#endif -#if JVET_O0189_DU -#if JVET_O1164_RPR for( int i = 0; i < NUM_REF_PIC_LIST_01; i ++ ) { for (int j = 0; j < MAX_NUM_REF_PICS; j ++ ) @@ -767,8 +733,6 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_scalingRatio[i][j] = pSrc->m_scalingRatio[i][j]; } } -#endif -#endif } @@ -854,9 +818,7 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const // loop through all pictures in the reference picture buffer PicList::iterator iterPic = rcListPic.begin(); -#if JVET_OO147_LEADING_PIC_CHECKING int numLeadingPicsFound = 0; -#endif while ( iterPic != rcListPic.end()) { Picture* pcPic = *(iterPic++); @@ -904,7 +866,6 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const // 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_OO147_LEADING_PIC_CHECKING if ((nalUnitType == NAL_UNIT_CODED_SLICE_RASL || nalUnitType == NAL_UNIT_CODED_SLICE_RADL) && (pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL && pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL) ) { @@ -917,18 +878,6 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const CHECK(pcPic->poc > this->getAssociatedIRAPPOC() && numLeadingPicsFound > limitNonLP, "Invalid POC"); } } -#else - if (nalUnitType == NAL_UNIT_CODED_SLICE_RASL || - nalUnitType == NAL_UNIT_CODED_SLICE_RADL ) - { - 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"); - } - } -#endif // 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 @@ -1136,7 +1085,6 @@ int Slice::checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePi return 0; } -#if JVET_O0241 int Slice::checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList *pRPL, int rplIdx, bool printErrors, int *refPicIndex) const { Picture* rpcPic; @@ -1230,9 +1178,7 @@ int Slice::checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePi } return 0; } -#endif -#if JVET_N0494_DRAP bool Slice::isPOCInRefPicList(const ReferencePictureList *rpl, int poc ) { for (int i = 0; i < rpl->getNumberOfLongtermPictures() + rpl->getNumberOfShorttermPictures(); i++) @@ -1325,7 +1271,6 @@ void Slice::checkConformanceForDRAP( uint32_t temporalId ) } } } -#endif void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1) { @@ -1350,20 +1295,12 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c while (iterPic != rcListPic.end()) { rpcPic = *(iterPic++); -#if JVET_N0494_DRAP if (!pRPL0->isRefPicLongterm(ii) && rpcPic->referenced && rpcPic->getPOC() == this->getPOC() - pRPL0->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP)) -#else - if (!pRPL0->isRefPicLongterm(ii) && rpcPic->referenced && rpcPic->getPOC() == this->getPOC() - pRPL0->getRefPicIdentifier(ii)) -#endif { isAvailable = true; break; } -#if JVET_N0494_DRAP else if (pRPL0->isRefPicLongterm(ii) && rpcPic->referenced && (rpcPic->getPOC() & (pocCycle - 1)) == pRPL0->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP)) -#else - else if (pRPL0->isRefPicLongterm(ii) && rpcPic->referenced && (rpcPic->getPOC() & (pocCycle - 1)) == pRPL0->getRefPicIdentifier(ii)) -#endif { isAvailable = true; break; @@ -1379,7 +1316,6 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c } } -#if JVET_N0494_DRAP if (getEnableDRAPSEI()) { pLocalRPL0->setNumberOfShorttermPictures(numOfSTRPL0); @@ -1402,7 +1338,6 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c } } } -#endif ReferencePictureList* pLocalRPL1 = this->getLocalRPL1(); (*pLocalRPL1) = ReferencePictureList(); @@ -1420,20 +1355,12 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c while (iterPic != rcListPic.end()) { rpcPic = *(iterPic++); -#if JVET_N0494_DRAP if (!pRPL1->isRefPicLongterm(ii) && rpcPic->referenced && rpcPic->getPOC() == this->getPOC() - pRPL1->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP)) -#else - if (!pRPL1->isRefPicLongterm(ii) && rpcPic->referenced && rpcPic->getPOC() == this->getPOC() - pRPL1->getRefPicIdentifier(ii)) -#endif { isAvailable = true; break; } -#if JVET_N0494_DRAP else if (pRPL1->isRefPicLongterm(ii) && rpcPic->referenced && (rpcPic->getPOC() & (pocCycle - 1)) == pRPL1->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP)) -#else - else if (pRPL1->isRefPicLongterm(ii) && rpcPic->referenced && (rpcPic->getPOC() & (pocCycle - 1)) == pRPL1->getRefPicIdentifier(ii)) -#endif { isAvailable = true; break; @@ -1482,9 +1409,7 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c pLocalRPL0->setNumberOfLongtermPictures(numOfLTRPL0); pLocalRPL0->setNumberOfShorttermPictures(numOfSTRPL0); pLocalRPL0->setNumberOfActivePictures((numOfLTRPL0 + numOfSTRPL0 < pRPL0->getNumberOfActivePictures()) ? numOfLTRPL0 + numOfSTRPL0 : pRPL0->getNumberOfActivePictures()); -#if JVET_N0100_PROPOSAL1 pLocalRPL0->setLtrpInSliceHeaderFlag(pRPL0->getLtrpInSliceHeaderFlag()); -#endif this->setRPL0idx(-1); this->setRPL0(pLocalRPL0); @@ -1508,13 +1433,8 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c { pLocalRPL1->setRefPicIdentifier(refPicIdxL1, pLocalRPL0->getRefPicIdentifier(ii), pLocalRPL0->isRefPicLongterm(ii)); refPicIdxL1++; -#if JVET_N0494_DRAP numOfSTRPL1 = numOfSTRPL1 + ((pLocalRPL0->isRefPicLongterm(ii)) ? 0 : 1); numOfLTRPL1 = numOfLTRPL1 + ((pLocalRPL0->isRefPicLongterm(ii)) ? 1 : 0); -#else - numOfSTRPL1 = numOfSTRPL1 + ((pRPL0->isRefPicLongterm(ii)) ? 0 : 1); - numOfLTRPL1 = numOfLTRPL1 + ((pRPL0->isRefPicLongterm(ii)) ? 1 : 0); -#endif numOfNeedToFill--; } } @@ -1522,9 +1442,7 @@ void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, c pLocalRPL1->setNumberOfLongtermPictures(numOfLTRPL1); pLocalRPL1->setNumberOfShorttermPictures(numOfSTRPL1); pLocalRPL1->setNumberOfActivePictures((isDisallowMixedRefPic) ? (numOfLTRPL1 + numOfSTRPL1) : (((numOfLTRPL1 + numOfSTRPL1) < pRPL1->getNumberOfActivePictures()) ? (numOfLTRPL1 + numOfSTRPL1) : pRPL1->getNumberOfActivePictures())); -#if JVET_N0100_PROPOSAL1 pLocalRPL1->setLtrpInSliceHeaderFlag(pRPL1->getLtrpInSliceHeaderFlag()); -#endif this->setRPL1idx(-1); this->setRPL1(pLocalRPL1); } @@ -1689,13 +1607,8 @@ SPS::SPS() , m_chromaFormatIdc (CHROMA_420) , m_uiMaxTLayers ( 1) // Structure -#if JVET_O1164_PS , m_maxWidthInLumaSamples (352) , m_maxHeightInLumaSamples (288) -#else -, m_picWidthInLumaSamples (352) -, m_picHeightInLumaSamples (288) -#endif , m_log2MinCodingBlockSize ( 0) , m_log2DiffMaxMinCodingBlockSize(0) , m_CTUSize(0) @@ -1713,50 +1626,28 @@ SPS::SPS() , m_allRplEntriesHasSameSignFlag ( true ) , m_bLongTermRefsPresent (false) // Tool list -#if !JVET_O0525_REMOVE_PCM -, m_pcmEnabledFlag (false) -, m_pcmLog2MaxSize ( 5) -, m_uiPCMLog2MinSize ( 7) -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING , m_transformSkipEnabledFlag (false) , m_BDPCMEnabledFlag (false) -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG , m_JointCbCrEnabledFlag (false) -#endif -#if !JVET_O0525_REMOVE_PCM -, m_bPCMFilterDisableFlag (false) -#endif , m_sbtmvpEnabledFlag (false) , m_bdofEnabledFlag (false) , m_fpelMmvdEnabledFlag ( false ) -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG , m_BdofDmvrSlicePresentFlag ( false ) -#endif , m_uiBitsForPOC ( 8) , m_numLongTermRefPicSPS ( 0) -#if MAX_TB_SIZE_SIGNALLING , m_log2MaxTbSize ( 6) -#endif -#if JVET_O0244_DELTA_POC , m_useWeightPred (false) , m_useWeightedBiPred (false) -#endif , m_saoEnabledFlag (false) , m_bTemporalIdNestingFlag (false) , m_scalingListEnabledFlag (false) -#if FIX_HRD_O0189 , m_hrdParametersPresentFlag (false) -#endif , m_vuiParametersPresentFlag (false) , m_vuiParameters () , m_wrapAroundEnabledFlag (false) , m_wrapAroundOffset ( 0) , m_IBCFlag ( 0) -#if JVET_O0119_BASE_PALETTE_444 , m_PLTMode ( 0) -#endif , m_lumaReshapeEnable (false) , m_AMVREnabledFlag ( false ) , m_LMChroma ( false ) @@ -1766,9 +1657,7 @@ SPS::SPS() , m_LFNST ( false ) , m_Affine ( false ) , m_AffineType ( false ) -#if JVET_O0070_PROF , m_PROF ( false ) -#endif , m_MHIntra ( false ) , m_Triangle ( false ) #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET @@ -1778,20 +1667,13 @@ SPS::SPS() , m_LadfIntervalLowerBound { 0 } #endif , m_MIP ( false ) -#if JVET_N0865_SYNTAX ,m_GDREnabledFlag (1) -#endif -#if JVET_O0177_PROPOSAL1 , m_SubLayerCbpParametersPresentFlag (1) -#endif { for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) { m_bitDepths.recon[ch] = 8; -#if !JVET_O0525_REMOVE_PCM - m_pcmBitDepths[ch] = 8; -#endif m_qpBDOffset [ch] = 0; } @@ -1830,7 +1712,6 @@ void SPS::createRPLList1(int numRPL) const int SPS::m_winUnitX[]={1,2,2,1}; const int SPS::m_winUnitY[]={1,2,1,1}; -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE void ChromaQpMappingTable::setParams(const ChromaQpMappingTableParams ¶ms, const int qpBdOffset) { m_qpBdOffset = qpBdOffset; @@ -1884,7 +1765,6 @@ void ChromaQpMappingTable::derivedChromaQPMappingTables() } } } -#endif PPSRExt::PPSRExt() : m_crossComponentPredictionEnabledFlag(false) @@ -1913,11 +1793,7 @@ PPS::PPS() , m_numRefIdxL1DefaultActive (1) , m_rpl1IdxPresentFlag (false) , m_TransquantBypassEnabledFlag (false) -#if JVET_O1136_TS_BDPCM_SIGNALLING , m_log2MaxTransformSkipBlockSize (2) -#else -, m_useTransformSkip (false) -#endif , m_entropyCodingSyncEnabledFlag (false) , m_loopFilterAcrossBricksEnabledFlag (true) , m_uniformTileSpacingFlag (false) @@ -1934,7 +1810,6 @@ PPS::PPS() , m_numBricksInPic (1) , m_signalledSliceIdFlag (false) ,m_signalledSliceIdLengthMinus1 (0) -#if JVET_O0238_PPS_OR_SLICE , m_constantSliceHeaderParamsEnabledFlag (false) , m_PPSDepQuantEnabledIdc (0) , m_PPSRefPicListSPSIdc0 (0) @@ -1945,7 +1820,6 @@ PPS::PPS() , m_PPSSixMinusMaxNumMergeCandPlus1 (0) , m_PPSFiveMinusMaxNumSubblockMergeCandPlus1 (0) , m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 (0) -#endif , m_cabacInitPresentFlag (false) , m_sliceHeaderExtensionPresentFlag (false) , m_loopFilterAcrossSlicesEnabledFlag(false) @@ -1954,18 +1828,14 @@ PPS::PPS() , m_loopFilterAcrossVirtualBoundariesDisabledFlag(false) , m_numVerVirtualBoundaries (0) , m_numHorVirtualBoundaries (0) -#if JVET_O1164_PS , m_picWidthInLumaSamples( 352 ) , m_picHeightInLumaSamples( 288 ) -#endif , m_ppsRangeExtension () , pcv (NULL) { m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CbOffset = 0; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0. This is initialised here and never subsequently changed. m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CrOffset = 0; -#if JVET_O1168_CU_CHROMA_QP_OFFSET m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.JointCbCrOffset = 0; -#endif ::memset(m_virtualBoundariesPosX, 0, sizeof(m_virtualBoundariesPosX)); ::memset(m_virtualBoundariesPosY, 0, sizeof(m_virtualBoundariesPosY)); } @@ -1977,9 +1847,7 @@ PPS::~PPS() APS::APS() : m_APSId(0) -#if JVET_O0245_VPS_DPS_APS , m_temporalId( 0 ) -#endif { } @@ -1992,9 +1860,7 @@ ReferencePictureList::ReferencePictureList() : m_numberOfShorttermPictures(0) , m_numberOfLongtermPictures(0) , m_numberOfActivePictures(MAX_INT) -#if JVET_N0100_PROPOSAL1 , m_ltrp_in_slice_header_flag(0) -#endif { ::memset(m_isLongtermRefPic, 0, sizeof(m_isLongtermRefPic)); ::memset(m_refPicIdentifier, 0, sizeof(m_refPicIdentifier)); @@ -2548,12 +2414,8 @@ void ParameterSetMap<SPS>::setID(SPS* parameterSet, const int psId) ProfileTierLevel::ProfileTierLevel() : m_tierFlag (Level::MAIN) , m_profileIdc (Profile::NONE) -#if JVET_O0044_MULTI_SUB_PROFILE , m_numSubProfile(0) , m_subProfileIdc(0) -#else - , m_subProfileIdc(0) -#endif , m_levelIdc (Level::NONE) { ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); @@ -2636,12 +2498,7 @@ uint32_t PreCalcValues::getMinQtSize( const Slice &slice, const ChannelType chTy return minQtSize[getValIdx( slice, chType )]; } -#if JVET_O1164_RPR -#if JVET_O0299_APS_SCALINGLIST void Slice::scaleRefPicList( Picture *scaledRefPic[ ], APS** apss, APS* lmcsAps, APS* scalingListAps, const bool isDecoder ) -#else -void Slice::scaleRefPicList( Picture *scaledRefPic[], APS** apss, APS* lmcsAps, const bool isDecoder ) -#endif { int i; const SPS* sps = getSPS(); @@ -2716,11 +2573,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[], APS** apss, APS* lmcsAps, scaledRefPic[j]->reconstructed = false; scaledRefPic[j]->referenced = true; -#if JVET_O0299_APS_SCALINGLIST scaledRefPic[ j ]->finalInit( *sps, *pps, apss, lmcsAps, scalingListAps ); -#else - scaledRefPic[j]->finalInit( *sps, *pps, apss, lmcsAps ); -#endif scaledRefPic[j]->poc = -1; @@ -2732,11 +2585,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[], APS** apss, APS* lmcsAps, // rescale the reference picture const bool downsampling = m_apcRefPicList[refList][rIdx]->getRecoBuf().Y().width >= scaledRefPic[j]->getRecoBuf().Y().width && m_apcRefPicList[refList][rIdx]->getRecoBuf().Y().height >= scaledRefPic[j]->getRecoBuf().Y().height; -#if RPR_CONF_WINDOW Picture::rescalePicture( m_apcRefPicList[refList][rIdx]->getRecoBuf(), m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getConformanceWindow(), scaledRefPic[j]->getRecoBuf(), pps->getConformanceWindow(), sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling ); -#else - Picture::rescalePicture(m_apcRefPicList[refList][rIdx]->getRecoBuf(), scaledRefPic[j]->getRecoBuf(), sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling); -#endif scaledRefPic[j]->extendPicBorder(); m_scaledRefPicList[refList][rIdx] = scaledRefPic[j]; @@ -2807,7 +2656,6 @@ bool Slice::checkRPR() return false; } -#endif #if ENABLE_TRACING void xTraceVPSHeader() diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 0f0b23f5fe41c00e7ccfdb1ae8b3ea1a0d6a8e45..ebc1aaed370b5188ee2286cc15e8d8fe83854095 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -47,9 +47,7 @@ #include "ChromaFormat.h" #include "Common.h" #include "HRD.h" -#if JVET_O0119_BASE_PALETTE_444 #include <unordered_map> -#endif #include "AlfParameters.h" //! \ingroup CommonLib @@ -85,9 +83,7 @@ private: int m_numberOfActivePictures; bool m_deltaPocMSBPresentFlag[MAX_NUM_REF_PICS]; int m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS]; -#if JVET_N0100_PROPOSAL1 bool m_ltrp_in_slice_header_flag; -#endif public: ReferencePictureList(); @@ -103,10 +99,8 @@ public: void setNumberOfLongtermPictures(int numberOfLtrp); int getNumberOfLongtermPictures() const; -#if JVET_N0100_PROPOSAL1 void setLtrpInSliceHeaderFlag(bool flag) { m_ltrp_in_slice_header_flag = flag; } bool getLtrpInSliceHeaderFlag() const { return m_ltrp_in_slice_header_flag; } -#endif int getNumRefEntries() const { return m_numberOfShorttermPictures + m_numberOfLongtermPictures; } @@ -172,7 +166,6 @@ public: void setDefaultScalingList(); bool isNotDefaultScalingList(); -#if JVET_O0245_VPS_DPS_APS bool operator==( const ScalingList& other ) { if( memcmp( m_scalingListPredModeFlagIsDPCM, other.m_scalingListPredModeFlagIsDPCM, sizeof( m_scalingListPredModeFlagIsDPCM ) ) ) @@ -199,7 +192,6 @@ public: { return !( *this == other ); } -#endif private: void outputScalingLists(std::ostream &os) const; @@ -225,9 +217,6 @@ class ConstraintInfo bool m_noPartitionConstraintsOverrideConstraintFlag; bool m_noSaoConstraintFlag; bool m_noAlfConstraintFlag; -#if !JVET_O0525_REMOVE_PCM - bool m_noPcmConstraintFlag; -#endif bool m_noRefWraparoundConstraintFlag; bool m_noTemporalMvpConstraintFlag; bool m_noSbtmvpConstraintFlag; @@ -245,12 +234,8 @@ class ConstraintInfo bool m_noTriangleConstraintFlag; bool m_noLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; -#if JVET_O1136_TS_BDPCM_SIGNALLING bool m_noBDPCMConstraintFlag; -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool m_noJointCbCrConstraintFlag; -#endif bool m_noQpDeltaConstraintFlag; bool m_noDepQuantConstraintFlag; bool m_noSignDataHidingConstraintFlag; @@ -268,9 +253,6 @@ public: , m_noPartitionConstraintsOverrideConstraintFlag(false) , m_noSaoConstraintFlag (false) , m_noAlfConstraintFlag (false) -#if !JVET_O0525_REMOVE_PCM - , m_noPcmConstraintFlag (false) -#endif , m_noRefWraparoundConstraintFlag(false) , m_noTemporalMvpConstraintFlag(false) , m_noSbtmvpConstraintFlag (false) @@ -288,12 +270,8 @@ public: , m_noTriangleConstraintFlag (false) , m_noLadfConstraintFlag (false) , m_noTransformSkipConstraintFlag(false) -#if JVET_O1136_TS_BDPCM_SIGNALLING , m_noBDPCMConstraintFlag (false) -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG , m_noJointCbCrConstraintFlag (false) -#endif , m_noQpDeltaConstraintFlag (false) , m_noDepQuantConstraintFlag (false) , m_noSignDataHidingConstraintFlag(false) @@ -334,14 +312,8 @@ public: void setNoSaoConstraintFlag(bool bVal) { m_noSaoConstraintFlag = bVal; } bool getNoAlfConstraintFlag() const { return m_noAlfConstraintFlag; } void setNoAlfConstraintFlag(bool bVal) { m_noAlfConstraintFlag = bVal; } -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool getNoJointCbCrConstraintFlag() const { return m_noJointCbCrConstraintFlag; } void setNoJointCbCrConstraintFlag(bool bVal) { m_noJointCbCrConstraintFlag = bVal; } -#endif -#if !JVET_O0525_REMOVE_PCM - bool getNoPcmConstraintFlag() const { return m_noPcmConstraintFlag; } - void setNoPcmConstraintFlag(bool bVal) { m_noPcmConstraintFlag = bVal; } -#endif bool getNoRefWraparoundConstraintFlag() const { return m_noRefWraparoundConstraintFlag; } void setNoRefWraparoundConstraintFlag(bool bVal) { m_noRefWraparoundConstraintFlag = bVal; } bool getNoTemporalMvpConstraintFlag() const { return m_noTemporalMvpConstraintFlag; } @@ -376,10 +348,8 @@ public: void setNoLadfConstraintFlag(bool bVal) { m_noLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } void setNoTransformSkipConstraintFlag(bool bVal) { m_noTransformSkipConstraintFlag = bVal; } -#if JVET_O1136_TS_BDPCM_SIGNALLING bool getNoBDPCMConstraintFlag() const { return m_noBDPCMConstraintFlag; } void setNoBDPCMConstraintFlag(bool bVal) { m_noBDPCMConstraintFlag = bVal; } -#endif bool getNoQpDeltaConstraintFlag() const { return m_noQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_noQpDeltaConstraintFlag = bVal; } bool getNoDepQuantConstraintFlag() const { return m_noDepQuantConstraintFlag; } @@ -392,12 +362,8 @@ class ProfileTierLevel { Level::Tier m_tierFlag; Profile::Name m_profileIdc; -#if JVET_O0044_MULTI_SUB_PROFILE uint8_t m_numSubProfile; std::vector<uint32_t> m_subProfileIdc; -#else - uint32_t m_subProfileIdc; -#endif Level::Name m_levelIdc; ConstraintInfo m_constraintInfo; @@ -413,16 +379,11 @@ public: Profile::Name getProfileIdc() const { return m_profileIdc; } void setProfileIdc(Profile::Name x) { m_profileIdc = x; } -#if JVET_O0044_MULTI_SUB_PROFILE uint32_t getSubProfileIdc(int i) const { return m_subProfileIdc[i]; } void setSubProfileIdc(int i, uint32_t x) { m_subProfileIdc[i] = x; } uint8_t getNumSubProfile() const { return m_numSubProfile; } void setNumSubProfile(uint8_t x) { m_numSubProfile = x; m_subProfileIdc.resize(m_numSubProfile); } -#else - uint32_t getSubProfileIdc() const { return m_subProfileIdc; } - void setSubProfileIdc(uint32_t x) { m_subProfileIdc = x; } -#endif Level::Name getLevelIdc() const { return m_levelIdc; } void setLevelIdc(Level::Name x) { m_levelIdc = x; } @@ -458,7 +419,6 @@ public: void setSliceReshapeChromaAdj(unsigned adj) { enableChromaAdj = adj; } unsigned getSliceReshapeChromaAdj() const { return enableChromaAdj; } -#if JVET_O0245_VPS_DPS_APS bool operator==( const SliceReshapeInfo& other ) { if( sliceReshaperEnableFlag != other.sliceReshaperEnableFlag ) @@ -497,21 +457,15 @@ public: { return !( *this == other ); } -#endif }; struct ReshapeCW { std::vector<uint32_t> binCW; -#if JVET_O0432_LMCS_ENCODER int updateCtrl; int adpOption; uint32_t initialCW; -#endif int rspPicSize; -#if !JVET_O0432_LMCS_ENCODER - int rspIntraPeriod; -#endif int rspFps; int rspBaseQP; int rspTid; @@ -526,18 +480,11 @@ struct ChromaQpAdj struct { int CbOffset; int CrOffset; -#if JVET_O1168_CU_CHROMA_QP_OFFSET int JointCbCrOffset; -#endif } comp; -#if JVET_O1168_CU_CHROMA_QP_OFFSET int offset[3]; -#else - int offset[2]; /* two chroma components */ -#endif } u; }; -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE struct ChromaQpMappingTableParams { int m_qpBdOffset; bool m_sameCQPTableForAllChromaFlag; @@ -573,7 +520,6 @@ struct ChromaQpMappingTable : ChromaQpMappingTableParams void derivedChromaQPMappingTables(); void setParams(const ChromaQpMappingTableParams ¶ms, const int qpBdOffset); }; -#endif class DPS { private: @@ -836,13 +782,8 @@ private: uint32_t m_uiMaxTLayers; // maximum number of temporal layers // Structure -#if JVET_O1164_PS uint32_t m_maxWidthInLumaSamples; uint32_t m_maxHeightInLumaSamples; -#else - uint32_t m_picWidthInLumaSamples; - uint32_t m_picHeightInLumaSamples; -#endif int m_log2MinCodingBlockSize; int m_log2DiffMaxMinCodingBlockSize; @@ -858,9 +799,6 @@ private: uint32_t m_uiMaxCUHeight; uint32_t m_uiMaxCodingDepth; ///< Total CU depth, relative to the smallest possible transform block size. -#if !JVET_O1164_PS - Window m_conformanceWindow; -#endif RPLList m_RPLList0; RPLList m_RPLList1; @@ -874,57 +812,32 @@ private: int m_numReorderPics[MAX_TLAYER]; // Tool list -#if !JVET_O0525_REMOVE_PCM - bool m_pcmEnabledFlag; - uint32_t m_pcmLog2MaxSize; - uint32_t m_uiPCMLog2MinSize; -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING bool m_transformSkipEnabledFlag; bool m_BDPCMEnabledFlag; -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool m_JointCbCrEnabledFlag; -#endif // Parameter BitDepths m_bitDepths; int m_qpBDOffset[MAX_NUM_CHANNEL_TYPE]; -#if JVET_O0919_TS_MIN_QP int m_minQpMinus4[MAX_NUM_CHANNEL_TYPE]; // QP_internal - QP_input; -#endif -#if !JVET_O0525_REMOVE_PCM - int m_pcmBitDepths[MAX_NUM_CHANNEL_TYPE]; - bool m_bPCMFilterDisableFlag; -#endif bool m_sbtmvpEnabledFlag; bool m_bdofEnabledFlag; bool m_fpelMmvdEnabledFlag; -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG bool m_BdofDmvrSlicePresentFlag; -#endif uint32_t m_uiBitsForPOC; uint32_t m_numLongTermRefPicSPS; uint32_t m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]; bool m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS]; -#if MAX_TB_SIZE_SIGNALLING uint32_t m_log2MaxTbSize; -#endif -#if JVET_O0244_DELTA_POC bool m_useWeightPred; //!< Use of Weighting Prediction (P_SLICE) bool m_useWeightedBiPred; //!< Use of Weighting Bi-Prediction (B_SLICE) -#endif bool m_saoEnabledFlag; bool m_bTemporalIdNestingFlag; // temporal_id_nesting_flag bool m_scalingListEnabledFlag; -#if !JVET_O0299_APS_SCALINGLIST - bool m_scalingListPresentFlag; - ScalingList m_scalingList; -#endif uint32_t m_uiMaxDecPicBuffering[MAX_TLAYER]; uint32_t m_uiMaxLatencyIncreasePlus1[MAX_TLAYER]; @@ -947,9 +860,7 @@ private: bool m_wrapAroundEnabledFlag; unsigned m_wrapAroundOffset; unsigned m_IBCFlag; -#if JVET_O0119_BASE_PALETTE_444 unsigned m_PLTMode; -#endif bool m_lumaReshapeEnable; bool m_AMVREnabledFlag; @@ -962,9 +873,7 @@ private: bool m_SMVD; bool m_Affine; bool m_AffineType; -#if JVET_O0070_PROF bool m_PROF; -#endif bool m_GBi; // bool m_MHIntra; bool m_Triangle; @@ -975,15 +884,9 @@ private: int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS]; #endif bool m_MIP; -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE ChromaQpMappingTable m_chromaQpMappingTable; -#endif -#if JVET_N0865_SYNTAX bool m_GDREnabledFlag; -#endif -#if JVET_O0177_PROPOSAL1 bool m_SubLayerCbpParametersPresentFlag; -#endif public: @@ -1001,21 +904,10 @@ public: static int getWinUnitY (int chromaFormatIdc) { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitY[chromaFormatIdc]; } // structure -#if JVET_O1164_PS void setMaxPicWidthInLumaSamples( uint32_t u ) { m_maxWidthInLumaSamples = u; } uint32_t getMaxPicWidthInLumaSamples() const { return m_maxWidthInLumaSamples; } void setMaxPicHeightInLumaSamples( uint32_t u ) { m_maxHeightInLumaSamples = u; } uint32_t getMaxPicHeightInLumaSamples() const { return m_maxHeightInLumaSamples; } -#else - void setPicWidthInLumaSamples( uint32_t u ) { m_picWidthInLumaSamples = u; } - uint32_t getPicWidthInLumaSamples() const { return m_picWidthInLumaSamples; } - void setPicHeightInLumaSamples( uint32_t u ) { m_picHeightInLumaSamples = u; } - uint32_t getPicHeightInLumaSamples() const { return m_picHeightInLumaSamples; } - - Window& getConformanceWindow() { return m_conformanceWindow; } - const Window& getConformanceWindow() const { return m_conformanceWindow; } - void setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } -#endif uint32_t getNumLongTermRefPicSPS() const { return m_numLongTermRefPicSPS; } void setNumLongTermRefPicSPS(uint32_t val) { m_numLongTermRefPicSPS = val; } @@ -1070,20 +962,10 @@ public: uint32_t getMaxCUHeight() const { return m_uiMaxCUHeight; } void setMaxCodingDepth( uint32_t u ) { m_uiMaxCodingDepth = u; } uint32_t getMaxCodingDepth() const { return m_uiMaxCodingDepth; } -#if !JVET_O0525_REMOVE_PCM - void setPCMEnabledFlag( bool b ) { m_pcmEnabledFlag = b; } - bool getPCMEnabledFlag() const { return m_pcmEnabledFlag; } - void setPCMLog2MaxSize( uint32_t u ) { m_pcmLog2MaxSize = u; } - uint32_t getPCMLog2MaxSize() const { return m_pcmLog2MaxSize; } - void setPCMLog2MinSize( uint32_t u ) { m_uiPCMLog2MinSize = u; } - uint32_t getPCMLog2MinSize() const { return m_uiPCMLog2MinSize; } -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING bool getTransformSkipEnabledFlag() const { return m_transformSkipEnabledFlag; } void setTransformSkipEnabledFlag( bool b ) { m_transformSkipEnabledFlag = b; } bool getBDPCMEnabledFlag() const { return m_BDPCMEnabledFlag; } void setBDPCMEnabledFlag( bool b ) { m_BDPCMEnabledFlag = b; } -#endif void setBitsForPOC( uint32_t u ) { m_uiBitsForPOC = u; } uint32_t getBitsForPOC() const { return m_uiBitsForPOC; } void setNumReorderPics(int i, uint32_t tlayer) { m_numReorderPics[tlayer] = i; } @@ -1105,11 +987,9 @@ public: void setLongTermRefsPresent(bool b) { m_bLongTermRefsPresent=b; } bool getSPSTemporalMVPEnabledFlag() const { return m_SPSTemporalMVPEnabledFlag; } void setSPSTemporalMVPEnabledFlag(bool b) { m_SPSTemporalMVPEnabledFlag=b; } -#if MAX_TB_SIZE_SIGNALLING void setLog2MaxTbSize( uint32_t u ) { m_log2MaxTbSize = u; } uint32_t getLog2MaxTbSize() const { return m_log2MaxTbSize; } uint32_t getMaxTbSize() const { return 1 << m_log2MaxTbSize; } -#endif // Bit-depth int getBitDepth(ChannelType type) const { return m_bitDepths.recon[type]; } void setBitDepth(ChannelType type, int u ) { m_bitDepths.recon[type] = u; } @@ -1119,20 +999,16 @@ public: int getDifferentialLumaChromaBitDepth() const { return int(m_bitDepths.recon[CHANNEL_TYPE_LUMA]) - int(m_bitDepths.recon[CHANNEL_TYPE_CHROMA]); } int getQpBDOffset(ChannelType type) const { return m_qpBDOffset[type]; } void setQpBDOffset(ChannelType type, int i) { m_qpBDOffset[type] = i; } -#if JVET_O0919_TS_MIN_QP int getMinQpPrimeTsMinus4(ChannelType type) const { return m_minQpMinus4[type]; } void setMinQpPrimeTsMinus4(ChannelType type, int i) { m_minQpMinus4[type] = i; } -#endif void setSAOEnabledFlag(bool bVal) { m_saoEnabledFlag = bVal; } bool getSAOEnabledFlag() const { return m_saoEnabledFlag; } bool getALFEnabledFlag() const { return m_alfEnabledFlag; } void setALFEnabledFlag( bool b ) { m_alfEnabledFlag = b; } -#if JVET_O0376_SPS_JOINTCBCR_FLAG void setJointCbCrEnabledFlag(bool bVal) { m_JointCbCrEnabledFlag = bVal; } bool getJointCbCrEnabledFlag() const { return m_JointCbCrEnabledFlag; } -#endif bool getSBTMVPEnabledFlag() const { return m_sbtmvpEnabledFlag; } void setSBTMVPEnabledFlag(bool b) { m_sbtmvpEnabledFlag = b; } @@ -1146,30 +1022,16 @@ public: void setUseDMVR(bool b) { m_DMVR = b; } bool getUseMMVD()const { return m_MMVD; } void setUseMMVD(bool b) { m_MMVD = b; } -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG bool getBdofDmvrSlicePresentFlag()const { return m_BdofDmvrSlicePresentFlag; } void setBdofDmvrSlicePresentFlag(bool b) { m_BdofDmvrSlicePresentFlag = 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; } bool getTemporalIdNestingFlag() const { return m_bTemporalIdNestingFlag; } void setTemporalIdNestingFlag( bool bValue ) { m_bTemporalIdNestingFlag = bValue; } -#if !JVET_O0525_REMOVE_PCM - uint32_t getPCMBitDepth(ChannelType type) const { return m_pcmBitDepths[type]; } - void setPCMBitDepth(ChannelType type, uint32_t u) { m_pcmBitDepths[type] = u; } - void setPCMFilterDisableFlag( bool bValue ) { m_bPCMFilterDisableFlag = bValue; } - bool getPCMFilterDisableFlag() const { return m_bPCMFilterDisableFlag; } -#endif bool getScalingListFlag() const { return m_scalingListEnabledFlag; } void setScalingListFlag( bool b ) { m_scalingListEnabledFlag = b; } -#if !JVET_O0299_APS_SCALINGLIST // remove from SPS - 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]; } @@ -1201,10 +1063,8 @@ public: bool getUseReshaper() const { return m_lumaReshapeEnable; } void setIBCFlag(unsigned IBCFlag) { m_IBCFlag = IBCFlag; } unsigned getIBCFlag() const { return m_IBCFlag; } -#if JVET_O0119_BASE_PALETTE_444 void setPLTMode(unsigned PLTMode) { m_PLTMode = PLTMode; } unsigned getPLTMode() const { return m_PLTMode; } -#endif void setUseSBT( bool b ) { m_SBT = b; } bool getUseSBT() const { return m_SBT; } void setUseISP( bool b ) { m_ISP = b; } @@ -1218,21 +1078,15 @@ public: bool getUseAffine () const { return m_Affine; } void setUseAffineType ( bool b ) { m_AffineType = b; } bool getUseAffineType () const { return m_AffineType; } -#if JVET_O0070_PROF void setUsePROF ( bool b ) { m_PROF = b; } bool getUsePROF () const { return m_PROF; } -#endif void setUseLMChroma ( bool b ) { m_LMChroma = b; } bool getUseLMChroma () const { return m_LMChroma; } void setCclmCollocatedChromaFlag( bool b ) { m_cclmCollocatedChromaFlag = b; } bool getCclmCollocatedChromaFlag() const { return m_cclmCollocatedChromaFlag; } void setUseMTS ( bool b ) { m_MTS = b; } bool getUseMTS () const { return m_MTS; } -#if JVET_O0541_IMPLICIT_MTS_CONDITION bool getUseImplicitMTS () const { return m_MTS && !m_IntraMTS; } -#else - bool getUseImplicitMTS () const { return m_MTS && !m_IntraMTS && !m_InterMTS; } -#endif void setUseIntraMTS ( bool b ) { m_IntraMTS = b; } bool getUseIntraMTS () const { return m_IntraMTS; } void setUseInterMTS ( bool b ) { m_InterMTS = b; } @@ -1261,26 +1115,18 @@ public: void setUseMIP ( bool b ) { m_MIP = b; } bool getUseMIP () const { return m_MIP; } -#if JVET_O0244_DELTA_POC bool getUseWP () const { return m_useWeightPred; } bool getUseWPBiPred () const { return m_useWeightedBiPred; } void setUseWP ( bool b ) { m_useWeightPred = b; } void setUseWPBiPred ( bool b ) { m_useWeightedBiPred = b; } -#endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE void setChromaQpMappingTableFromParams(const ChromaQpMappingTableParams ¶ms, const int qpBdOffset) { m_chromaQpMappingTable.setParams(params, qpBdOffset); } void derivedChromaQPMappingTables() { m_chromaQpMappingTable.derivedChromaQPMappingTables(); } const ChromaQpMappingTable& getChromaQpMappingTable() const { return m_chromaQpMappingTable;} int getMappedChromaQpValue(ComponentID compID, int qpVal) const { return m_chromaQpMappingTable.getMappedChromaQpValue(compID, qpVal); } -#endif -#if JVET_N0865_SYNTAX void setGDREnabledFlag(bool flag) { m_GDREnabledFlag = flag; } bool getGDREnabledFlag() const { return m_GDREnabledFlag; } -#endif -#if JVET_O0177_PROPOSAL1 void setSubLayerParametersPresentFlag(bool flag) { m_SubLayerCbpParametersPresentFlag = flag; } bool getSubLayerParametersPresentFlag() const { return m_SubLayerCbpParametersPresentFlag; } -#endif }; @@ -1326,10 +1172,8 @@ private: bool m_bConstrainedIntraPred; // constrained_intra_pred_flag bool m_bSliceChromaQpFlag; // slicelevel_chroma_qp_flag -#if JVET_O0245_VPS_DPS_APS int m_layerId; int m_temporalId; -#endif // access channel uint32_t m_cuQpDeltaSubdiv; // cu_qp_delta_subdiv @@ -1352,11 +1196,7 @@ private: 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. -#if JVET_O1136_TS_BDPCM_SIGNALLING int m_log2MaxTransformSkipBlockSize; -#else - bool m_useTransformSkip; -#endif bool m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts bool m_loopFilterAcrossBricksEnabledFlag; @@ -1365,9 +1205,7 @@ private: int m_numTileRowsMinus1; std::vector<int> m_tileColumnWidth; std::vector<int> m_tileRowHeight; -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION std::vector<int> m_tileHeight; -#endif bool m_singleTileInPicFlag; int m_tileColsWidthMinus1; @@ -1376,27 +1214,20 @@ private: std::vector<bool> m_brickSplitFlag; std::vector<bool> m_uniformBrickSpacingFlag; std::vector<int> m_brickHeightMinus1; -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 std::vector<int> m_numBrickRowsMinus2; -#else - std::vector<int> m_numBrickRowsMinus1; -#endif std::vector<std::vector<int>> m_brickRowHeightMinus1; bool m_singleBrickPerSliceFlag; bool m_rectSliceFlag; int m_numSlicesInPicMinus1; std::vector<int> m_topLeftBrickIdx; std::vector<int> m_bottomRightBrickIdx; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA std::vector<int> m_bottomRightBrickIdxDelta; -#endif int m_numTilesInPic; int m_numBricksInPic; bool m_signalledSliceIdFlag; int m_signalledSliceIdLengthMinus1; std::vector<int> m_sliceId; -#if JVET_O0238_PPS_OR_SLICE bool m_constantSliceHeaderParamsEnabledFlag; int m_PPSDepQuantEnabledIdc; int m_PPSRefPicListSPSIdc0; @@ -1407,7 +1238,6 @@ private: uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; uint32_t m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#endif bool m_cabacInitPresentFlag; @@ -1418,10 +1248,6 @@ private: bool m_ppsDeblockingFilterDisabledFlag; int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter -#if !JVET_O0299_APS_SCALINGLIST // PPS - bool m_scalingListPresentFlag; - ScalingList m_scalingList; //!< ScalingList class -#endif bool m_listsModificationPresentFlag; uint32_t m_log2ParallelMergeLevelMinus2; int m_numExtraSliceHeaderBits; @@ -1432,11 +1258,9 @@ private: unsigned m_virtualBoundariesPosX[3]; unsigned m_virtualBoundariesPosY[3]; -#if JVET_O1164_PS uint32_t m_picWidthInLumaSamples; uint32_t m_picHeightInLumaSamples; Window m_conformanceWindow; -#endif PPSRExt m_ppsRangeExtension; @@ -1452,12 +1276,10 @@ public: int getSPSId() const { return m_SPSId; } void setSPSId(int i) { m_SPSId = i; } -#if JVET_O0245_VPS_DPS_APS void setTemporalId( int i ) { m_temporalId = i; } int getTemporalId() const { return m_temporalId; } void setLayerId( int i ) { m_layerId = i; } int getLayerId() const { return m_layerId; } -#endif int getPicInitQPMinus26() const { return m_picInitQPMinus26; } void setPicInitQPMinus26( int i ) { m_picInitQPMinus26 = i; } @@ -1508,18 +1330,12 @@ public: return m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1]; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise } -#if JVET_O1168_CU_CHROMA_QP_OFFSET void setChromaQpOffsetListEntry( int cuChromaQpOffsetIdxPlus1, int cbOffset, int crOffset, int jointCbCrOffset ) -#else - void setChromaQpOffsetListEntry( int cuChromaQpOffsetIdxPlus1, int cbOffset, int crOffset ) -#endif { CHECK(cuChromaQpOffsetIdxPlus1 == 0 || cuChromaQpOffsetIdxPlus1 > MAX_QP_OFFSET_LIST_SIZE, "Invalid chroma QP offset"); m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CbOffset = cbOffset; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CrOffset = crOffset; -#if JVET_O1168_CU_CHROMA_QP_OFFSET m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.JointCbCrOffset = jointCbCrOffset; -#endif m_chromaQpOffsetListLen = std::max(m_chromaQpOffsetListLen, cuChromaQpOffsetIdxPlus1); } @@ -1541,13 +1357,8 @@ public: void setTransquantBypassEnabledFlag( bool b ) { m_TransquantBypassEnabledFlag = b; } bool getTransquantBypassEnabledFlag() const { return m_TransquantBypassEnabledFlag; } -#if JVET_O1136_TS_BDPCM_SIGNALLING uint32_t getLog2MaxTransformSkipBlockSize() const { return m_log2MaxTransformSkipBlockSize; } void setLog2MaxTransformSkipBlockSize(uint32_t u) { m_log2MaxTransformSkipBlockSize = u; } -#else - bool getUseTransformSkip() const { return m_useTransformSkip; } - void setUseTransformSkip( bool b ) { m_useTransformSkip = b; } -#endif void setLoopFilterAcrossBricksEnabledFlag(bool b) { m_loopFilterAcrossBricksEnabledFlag = b; } bool getLoopFilterAcrossBricksEnabledFlag() const { return m_loopFilterAcrossBricksEnabledFlag; } @@ -1564,10 +1375,8 @@ public: int getNumTileRowsMinus1() const { return m_numTileRowsMinus1; } void setTileRowHeight(const std::vector<int>& rowHeight) { m_tileRowHeight = rowHeight; } uint32_t getTileRowHeight(uint32_t rowIdx) const { return m_tileRowHeight[rowIdx]; } -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION void setTileHeight(const std::vector<int>& tileHeight) { m_tileHeight = tileHeight; } uint32_t getTileHeight(uint32_t tileIdx) const { return m_tileHeight[tileIdx]; } -#endif bool getSingleTileInPicFlag() const { return m_singleTileInPicFlag; } void setSingleTileInPicFlag(bool val) { m_singleTileInPicFlag = val; } @@ -1583,13 +1392,8 @@ public: void setUniformBrickSpacingFlag(std::vector<bool>& val) { m_uniformBrickSpacingFlag = val; } int getBrickHeightMinus1(int i) const { return m_brickHeightMinus1[i]; } void setBrickHeightMinus1(std::vector<int>& val) { m_brickHeightMinus1 = val; } -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 int getNumBrickRowsMinus2(int i) const { return m_numBrickRowsMinus2[i]; } void setNumBrickRowsMinus2(std::vector<int> &val) { m_numBrickRowsMinus2 = val; } -#else - int getNumBrickRowsMinus1(int i) const { return m_numBrickRowsMinus1[i]; } - void setNumBrickRowsMinus1(std::vector<int>& val) { m_numBrickRowsMinus1 = val; } - #endif int getBrickRowHeightMinus1(int i, int j) const { return m_brickRowHeightMinus1[i][j]; } void setBrickRowHeightMinus1(std::vector<std::vector<int>>& val) { m_brickRowHeightMinus1 = val; } bool getSingleBrickPerSliceFlag() const { return m_singleBrickPerSliceFlag; } @@ -1602,10 +1406,8 @@ public: void setTopLeftBrickIdx(const std::vector<int>& val) { m_topLeftBrickIdx = val; } int getBottomRightBrickIdx(uint32_t columnIdx) const { return m_bottomRightBrickIdx[columnIdx]; } void setBottomRightBrickIdx(const std::vector<int>& val) { m_bottomRightBrickIdx = val; } -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int getBottomRightBrickIdxDelta(uint32_t delta) const { return m_bottomRightBrickIdxDelta[delta]; } void setBottomRightBrickIdxDelta(const std::vector<int>& val) { m_bottomRightBrickIdxDelta = val; } -#endif int getNumTilesInPic() const { return m_numTilesInPic; } void setNumTilesInPic(int val) { m_numTilesInPic = val; } int getNumBricksInPic() const { return m_numBricksInPic; } @@ -1617,7 +1419,6 @@ public: int getSliceId(uint32_t columnIdx) const { return m_sliceId[columnIdx]; } void setSliceId(const std::vector<int>& val) { m_sliceId = val; } - #if JVET_O0238_PPS_OR_SLICE bool getConstantSliceHeaderParamsEnabledFlag() const { return m_constantSliceHeaderParamsEnabledFlag; } void setConstantSliceHeaderParamsEnabledFlag(bool b) { m_constantSliceHeaderParamsEnabledFlag = b; } int getPPSDepQuantEnabledIdc() const { return m_PPSDepQuantEnabledIdc; } @@ -1638,7 +1439,6 @@ public: void setPPSFiveMinusMaxNumSubblockMergeCandPlus1(uint32_t u) { m_PPSFiveMinusMaxNumSubblockMergeCandPlus1 = u; } uint32_t getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() const { return m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; } void setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(uint32_t u) { m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = u; } -#endif void setCabacInitPresentFlag( bool flag ) { m_cabacInitPresentFlag = flag; } bool getCabacInitPresentFlag() const { return m_cabacInitPresentFlag; } @@ -1652,12 +1452,6 @@ 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! JVET_O0299_APS_SCALINGLIST // PPS - 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; } @@ -1683,7 +1477,6 @@ public: const PPSRExt& getPpsRangeExtension() const { return m_ppsRangeExtension; } PPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; } -#if JVET_O1164_PS void setPicWidthInLumaSamples( uint32_t u ) { m_picWidthInLumaSamples = u; } uint32_t getPicWidthInLumaSamples() const { return m_picWidthInLumaSamples; } void setPicHeightInLumaSamples( uint32_t u ) { m_picHeightInLumaSamples = u; } @@ -1692,25 +1485,18 @@ public: Window& getConformanceWindow() { return m_conformanceWindow; } const Window& getConformanceWindow() const { return m_conformanceWindow; } void setConformanceWindow( Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } -#endif }; class APS { private: int m_APSId; // adaptation_parameter_set_id -#if JVET_O0245_VPS_DPS_APS int m_temporalId; int m_layerId; ApsType m_APSType; // aps_params_type -#else - int m_APSType; // aps_params_type -#endif AlfParam m_alfAPSParam; SliceReshapeInfo m_reshapeAPSInfo; -#if JVET_O0299_APS_SCALINGLIST ScalingList m_scalingListApsInfo; -#endif public: APS(); @@ -1719,32 +1505,20 @@ public: int getAPSId() const { return m_APSId; } void setAPSId(int i) { m_APSId = i; } -#if JVET_O0245_VPS_DPS_APS ApsType getAPSType() const { return m_APSType; } void setAPSType( ApsType type ) { m_APSType = type; } -#else - int getAPSType() const { return m_APSType; } - void setAPSType(int type) { m_APSType = type; } -#endif void setAlfAPSParam(AlfParam& alfAPSParam) { m_alfAPSParam = alfAPSParam; } -#if JVET_O0245_VPS_DPS_APS void setTemporalId( int i ) { m_temporalId = i; } int getTemporalId() const { return m_temporalId; } void setLayerId( int i ) { m_layerId = i; } int getLayerId() const { return m_layerId; } -#else - void setTemporalId(int i) { m_alfAPSParam.tLayer = i; } - int getTemporalId() { return m_alfAPSParam.tLayer; } -#endif AlfParam& getAlfAPSParam() { return m_alfAPSParam; } void setReshaperAPSInfo(SliceReshapeInfo& reshapeAPSInfo) { m_reshapeAPSInfo = reshapeAPSInfo; } SliceReshapeInfo& getReshaperAPSInfo() { return m_reshapeAPSInfo; } -#if JVET_O0299_APS_SCALINGLIST void setScalingList( ScalingList& scalingListAPSInfo ) { m_scalingListApsInfo = scalingListAPSInfo; } ScalingList& getScalingList() { return m_scalingListApsInfo; } -#endif }; struct WPScalingParam { @@ -1782,12 +1556,10 @@ private: int m_iLastIDR; int m_iAssociatedIRAP; NalUnitType m_iAssociatedIRAPType; -#if JVET_N0494_DRAP bool m_enableDRAPSEI; bool m_useLTforDRAP; bool m_isDRAP; int m_latestDRAPPOC; -#endif 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 @@ -1821,11 +1593,9 @@ private: int m_aiRefPOCList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; bool m_bIsUsedAsLongTerm[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; int m_iDepth; -#if JVET_O1164_RPR Picture* m_scaledRefPicList[NUM_REF_PIC_LIST_01][MAX_NUM_REF + 1]; Picture* m_savedRefPicList[NUM_REF_PIC_LIST_01][MAX_NUM_REF + 1]; std::pair<int, int> m_scalingRatio[NUM_REF_PIC_LIST_01][MAX_NUM_REF_PICS]; -#endif // access channel @@ -1836,24 +1606,16 @@ private: bool m_colFromL0Flag; // collocated picture from List0 flag bool m_noOutputPriorPicsFlag; -#if JVET_N0865_NONSYNTAX bool m_noIncorrectPicOutputFlag; -#else - bool m_noRaslOutputFlag; -#endif bool m_handleCraAsCvsStartFlag; uint32_t m_colRefIdx; uint32_t m_maxNumMergeCand; uint32_t m_maxNumAffineMergeCand; uint32_t m_maxNumTriangleCand; -#if JVET_O0455_IBC_MAX_MERGE_NUM uint32_t m_maxNumIBCMergeCand; -#endif bool m_disFracMMVD; -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG bool m_disBdofDmvrFlag; -#endif double m_lambdas[MAX_NUM_COMPONENT]; bool m_abEqualRef [NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_REF]; @@ -1883,9 +1645,7 @@ private: bool m_cabacInitFlag; -#if JVET_O0105_ICT bool m_jointCbCrSignFlag; -#endif bool m_bLMvdL1Zero; bool m_LFCrossSliceBoundaryFlag; @@ -1908,15 +1668,9 @@ private: uint32_t m_uiMaxTTSizeIChroma; uint32_t m_uiMaxBTSize; -#if JVET_N0865_SYNTAX int m_recoveryPocCnt; int m_rpPicOrderCntVal; -#endif -#if JVET_O_MAX_NUM_ALF_APS_8 APS* m_alfApss[ALF_CTB_MAX_NUM_APS]; -#else - APS* m_alfApss[MAX_NUM_APS]; -#endif bool m_tileGroupAlfEnabledFlag[MAX_NUM_COMPONENT]; int m_tileGroupNumAps; std::vector<int> m_tileGroupLumaApsId; @@ -1926,14 +1680,10 @@ private: APS* m_lmcsAps; bool m_tileGroupLmcsEnabledFlag; bool m_tileGroupLmcsChromaResidualScaleFlag; -#if JVET_O0299_APS_SCALINGLIST int m_scalingListApsId; APS* m_scalingListAps; bool m_tileGroupscalingListPresentFlag; -#endif -#if JVET_O0181 bool m_nonReferencePicFlag; -#endif public: Slice(); virtual ~Slice(); @@ -1962,7 +1712,6 @@ public: void setLmcsChromaResidualScaleFlag(bool b) { m_tileGroupLmcsChromaResidualScaleFlag = b; } bool getLmcsChromaResidualScaleFlag() { return m_tileGroupLmcsChromaResidualScaleFlag; } const bool getLmcsChromaResidualScaleFlag() const { return m_tileGroupLmcsChromaResidualScaleFlag; } -#if JVET_O0299_APS_SCALINGLIST void setscalingListAPS( APS* scalingListAps ) { m_scalingListAps = scalingListAps; m_scalingListApsId = ( scalingListAps ) ? scalingListAps->getAPSId() : -1; } APS* getscalingListAPS() { return m_scalingListAps; } void setscalingListAPSId( int scalingListApsId ) { m_scalingListApsId = scalingListApsId; } @@ -1970,7 +1719,6 @@ public: void setscalingListPresentFlag( bool b ) { m_tileGroupscalingListPresentFlag = b; } bool getscalingListPresentFlag() { return m_tileGroupscalingListPresentFlag; } const bool getscalingListPresentFlag() const { return m_tileGroupscalingListPresentFlag; } -#endif void setPicOutputFlag( bool b ) { m_PicOutputFlag = b; } bool getPicOutputFlag() const { return m_PicOutputFlag; } void setSaoEnabledFlag(ChannelType chType, bool s) {m_saoEnabledFlag[chType] =s; } @@ -2058,7 +1806,6 @@ public: bool isInterB() const { return m_eSliceType == B_SLICE; } bool isInterP() const { return m_eSliceType == P_SLICE; } -#if JVET_N0494_DRAP bool getEnableDRAPSEI () const { return m_enableDRAPSEI; } void setEnableDRAPSEI ( bool b ) { m_enableDRAPSEI = b; } bool getUseLTforDRAP () const { return m_useLTforDRAP; } @@ -2071,7 +1818,6 @@ public: bool isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder ); bool isPOCInRefPicList( const ReferencePictureList *rpl, int poc ); void checkConformanceForDRAP( uint32_t temporalId ); -#endif void setLambdas( const double lambdas[MAX_NUM_COMPONENT] ) { for (int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; } const double* getLambdas() const { return m_lambdas; } @@ -2128,9 +1874,7 @@ public: void setTLayer( uint32_t uiTLayer ) { m_uiTLayer = uiTLayer; } void checkLeadingPictureRestrictions( PicList& rcListPic ) const; - #if JVET_O0241 int checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList* pRPL, int rplIdx, bool printErrors, int* refPicIndex) const; -#endif void applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1 ) const; bool isTemporalLayerSwitchingPoint( PicList& rcListPic ) const; bool isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic ) const; @@ -2142,26 +1886,17 @@ public: uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; } void setMaxNumTriangleCand(uint32_t val) { m_maxNumTriangleCand = val;} uint32_t getMaxNumTriangleCand() const { return m_maxNumTriangleCand;} -#if JVET_O0455_IBC_MAX_MERGE_NUM void setMaxNumIBCMergeCand( uint32_t val ) { m_maxNumIBCMergeCand = val; } uint32_t getMaxNumIBCMergeCand() const { return m_maxNumIBCMergeCand; } -#endif void setDisFracMMVD( bool val ) { m_disFracMMVD = val; } bool getDisFracMMVD() const { return m_disFracMMVD; } -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG void setDisBdofDmvrFlag(bool val) { m_disBdofDmvrFlag = val; } bool getDisBdofDmvrFlag() const { return m_disBdofDmvrFlag; } -#endif void setNoOutputPriorPicsFlag( bool val ) { m_noOutputPriorPicsFlag = val; } bool getNoOutputPriorPicsFlag() const { return m_noOutputPriorPicsFlag; } -#if JVET_N0865_NONSYNTAX void setNoIncorrectPicOutputFlag(bool val) { m_noIncorrectPicOutputFlag = val; } bool getNoIncorrectPicOutputFlag() const { return m_noIncorrectPicOutputFlag; } -#else - void setNoRaslOutputFlag( bool val ) { m_noRaslOutputFlag = val; } - bool getNoRaslOutputFlag() const { return m_noRaslOutputFlag; } -#endif void setHandleCraAsCvsStartFlag( bool val ) { m_handleCraAsCvsStartFlag = val; } bool getHandleCraAsCvsStartFlag() const { return m_handleCraAsCvsStartFlag; } @@ -2216,10 +1951,8 @@ public: void setCabacInitFlag( bool val ) { m_cabacInitFlag = val; } //!< set CABAC initial flag bool getCabacInitFlag() const { return m_cabacInitFlag; } //!< get CABAC initial flag -#if JVET_O0105_ICT void setJointCbCrSignFlag( bool b ) { m_jointCbCrSignFlag = b; } bool getJointCbCrSignFlag() const { return m_jointCbCrSignFlag; } -#endif void setLFCrossSliceBoundaryFlag( bool val ) { m_LFCrossSliceBoundaryFlag = val; } bool getLFCrossSliceBoundaryFlag() const { return m_LFCrossSliceBoundaryFlag; } @@ -2262,35 +1995,23 @@ public: } void setDisableSATDForRD(bool b) { m_disableSATDForRd = b; } bool getDisableSATDForRD() { return m_disableSATDForRd; } -#if JVET_O1164_RPR -#if JVET_O0299_APS_SCALINGLIST void scaleRefPicList( Picture *scaledRefPic[ ], APS** apss, APS* lmcsAps, APS* scalingListAps, const bool isDecoder ); -#else - void scaleRefPicList( Picture *scaledRefPic[], APS** apss, APS& lmcsAps, const bool isDecoder ); -#endif void freeScaledRefPicList( Picture *scaledRefPic[] ); bool checkRPR(); const std::pair<int, int>& getScalingRatio( const RefPicList refPicList, const int refIdx ) const { return m_scalingRatio[refPicList][refIdx]; } -#endif -#if JVET_N0865_SYNTAX void setRecoveryPocCnt(int value) { m_recoveryPocCnt = value; } int getRecoveryPocCnt() const { return m_recoveryPocCnt; } void setRpPicOrderCntVal(int value) { m_rpPicOrderCntVal = value; } int getRpPicOrderCntVal() const { return m_rpPicOrderCntVal; } -#endif -#if JVET_O0181 void setNonRefPictFlag(bool value) { m_nonReferencePicFlag = value; } bool getNonRefPictFlag() const { return m_nonReferencePicFlag; } -#endif protected: Picture* xGetRefPic (PicList& rcListPic, int poc); Picture* xGetLongTermRefPic(PicList& rcListPic, int poc, bool pocHasMsb); -#if JVET_O0119_BASE_PALETTE_444 public: std::unordered_map< Position, std::unordered_map< Size, double> > m_mapPltCost; private: -#endif };// END CLASS DEFINITION Slice void calculateParameterSetChangedFlag(bool &bChanged, const std::vector<uint8_t> *pOldData, const std::vector<uint8_t> *pNewData); @@ -2383,7 +2104,6 @@ public: } } -#if JVET_O0245_VPS_DPS_APS void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals ) { int apsId = ( aps->getAPSId() << NUM_APS_TYPE_LEN ) + (int)aps->getAPSType(); @@ -2415,7 +2135,6 @@ public: accessUnitApsNals.push_back( apsId ); } } -#endif void setChangedFlag(int psId, bool bChanged=true) @@ -2519,9 +2238,7 @@ public: const SPS* getActiveSPS()const { return m_spsMap.getPS(m_activeSPSId); }; const DPS* getActiveDPS()const { return m_dpsMap.getPS(m_activeDPSId); }; -#if JVET_O0245_VPS_DPS_APS void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals ) { m_apsMap.checkAuApsContent( aps, accessUnitApsNals ); } -#endif protected: ParameterSetMap<SPS> m_spsMap; @@ -2529,11 +2246,7 @@ protected: ParameterSetMap<APS> m_apsMap; ParameterSetMap<DPS> m_dpsMap; -#if JVET_O_MAX_NUM_ALF_APS_8 APS* m_apss[ALF_CTB_MAX_NUM_APS]; -#else - APS* m_apss[MAX_NUM_APS]; -#endif int m_activeDPSId; // -1 for nothing active int m_activeSPSId; // -1 for nothing active @@ -2558,21 +2271,11 @@ public: , partsInCtuWidth ( 1 << sps.getMaxCodingDepth() ) , partsInCtuHeight ( 1 << sps.getMaxCodingDepth() ) , partsInCtu ( 1 << (sps.getMaxCodingDepth() << 1) ) -#if JVET_O1164_PS , widthInCtus ( (pps.getPicWidthInLumaSamples () + sps.getMaxCUWidth () - 1) / sps.getMaxCUWidth () ) , heightInCtus ( (pps.getPicHeightInLumaSamples() + sps.getMaxCUHeight() - 1) / sps.getMaxCUHeight() ) -#else - , widthInCtus ( (sps.getPicWidthInLumaSamples () + sps.getMaxCUWidth () - 1) / sps.getMaxCUWidth () ) - , heightInCtus ( (sps.getPicHeightInLumaSamples() + sps.getMaxCUHeight() - 1) / sps.getMaxCUHeight() ) -#endif , sizeInCtus ( widthInCtus * heightInCtus ) -#if JVET_O1164_PS , lumaWidth ( pps.getPicWidthInLumaSamples() ) , lumaHeight ( pps.getPicHeightInLumaSamples() ) -#else - , lumaWidth ( sps.getPicWidthInLumaSamples() ) - , lumaHeight ( sps.getPicHeightInLumaSamples() ) -#endif , fastDeltaQPCuMaxSize( Clip3(sps.getMaxCUHeight() >> (sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u) ) , noChroma2x2 ( false ) , isEncoder ( _isEncoder ) diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index 821319c8c50ae259cbb7e3d2e58555d2126e25c6..11ecdde1833448b1756b3609ba55a0592e4680f7 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -83,7 +83,6 @@ InvTrans *fastInvTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] = //! \ingroup CommonLib //! \{ -#if JVET_O0105_ICT static inline int64_t square( const int d ) { return d * (int64_t)d; } template<int signedMode> std::pair<int64_t,int64_t> fwdTransformCbCr( const PelBuf &resCb, const PelBuf &resCr, PelBuf& resC1, PelBuf& resC2 ) @@ -156,7 +155,6 @@ template<int signedMode> void invTransformCbCr( PelBuf &resCb, PelBuf &resCr ) } } } -#endif // ==================================================================================================================== // TrQuant class member functions @@ -164,7 +162,6 @@ template<int signedMode> void invTransformCbCr( PelBuf &resCb, PelBuf &resCr ) TrQuant::TrQuant() : m_quant( nullptr ) { // allocate temporary buffers -#if JVET_O0105_ICT { m_invICT = m_invICTMem + maxAbsIctMode; m_invICT[ 0] = invTransformCbCr< 0>; @@ -183,7 +180,6 @@ TrQuant::TrQuant() : m_quant( nullptr ) m_fwdICT[ 3] = fwdTransformCbCr< 3>; m_fwdICT[-3] = fwdTransformCbCr<-3>; } -#endif } TrQuant::~TrQuant() @@ -326,18 +322,12 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID ) if( PU::isLMCMode( tu.cs->getPU( area.pos(), toChannelType( compID ) )->intraDir[ toChannelType( compID ) ] ) ) { -#if JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE intraMode = PU::getCoLocatedIntraLumaMode( *tu.cs->getPU( area.pos(), toChannelType( compID ) ) ); -#else - intraMode = PLANAR_IDX; -#endif } -#if JVET_O0925_MIP_SIMPLIFICATIONS if (PU::isMIP(*tu.cs->getPU(area.pos(), toChannelType(compID)), toChannelType(compID))) { intraMode = PLANAR_IDX; } -#endif CHECK( intraMode >= NUM_INTRA_MODE - 1, "Invalid intra mode" ); if( lfnstIdx < 3 ) @@ -348,29 +338,13 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID ) #endif bool transposeFlag = getTransposeFlag( intraMode ); const int sbSize = whge3 ? 8 : 4; -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - const int subGrpXMax = ( height == 4 && width > 8 ) ? 2 : 1; - const int subGrpYMax = ( width == 4 && height > 8 ) ? 2 : 1; -#endif bool tu4x4Flag = ( width == 4 && height == 4 ); bool tu8x8Flag = ( width == 8 && height == 8 ); TCoeff* lfnstTemp; TCoeff* coeffTemp; -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - for( int subGroupX = 0; subGroupX < subGrpXMax; subGroupX++ ) - { - for( int subGroupY = 0; subGroupY < subGrpYMax; subGroupY++ ) - { - const int offsetX = sbSize * subGroupX; - const int offsetY = sbSize * subGroupY * width; - int y; - lfnstTemp = m_tempInMatrix; // inverse spectral rearrangement - coeffTemp = m_tempCoeff + offsetX + offsetY; -#else int y; lfnstTemp = m_tempInMatrix; // inverse spectral rearrangement coeffTemp = m_tempCoeff; -#endif TCoeff * dst = lfnstTemp; const ScanElement * scanPtr = scan; for( y = 0; y < 16; y++ ) @@ -421,10 +395,6 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID ) coeffTemp += width; } } -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - } - } // subGroupX -#endif } } } @@ -444,18 +414,12 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons if( PU::isLMCMode( tu.cs->getPU( area.pos(), toChannelType( compID ) )->intraDir[ toChannelType( compID ) ] ) ) { -#if JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE intraMode = PU::getCoLocatedIntraLumaMode( *tu.cs->getPU( area.pos(), toChannelType( compID ) ) ); -#else - intraMode = PLANAR_IDX; -#endif } -#if JVET_O0925_MIP_SIMPLIFICATIONS if (PU::isMIP(*tu.cs->getPU(area.pos(), toChannelType(compID)), toChannelType(compID))) { intraMode = PLANAR_IDX; } -#endif CHECK( intraMode >= NUM_INTRA_MODE - 1, "Invalid intra mode" ); if( lfnstIdx < 3 ) @@ -464,31 +428,15 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons bool transposeFlag = getTransposeFlag( intraMode ); const int sbSize = whge3 ? 8 : 4; -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - const int subGrpXMax = ( height == 4 && width > 8 ) ? 2 : 1; - const int subGrpYMax = ( width == 4 && height > 8 ) ? 2 : 1; -#endif bool tu4x4Flag = ( width == 4 && height == 4 ); bool tu8x8Flag = ( width == 8 && height == 8 ); TCoeff* lfnstTemp; TCoeff* coeffTemp; TCoeff * tempCoeff = loadTr ? m_mtsCoeffs[tu.mtsIdx] : m_tempCoeff; -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - for( int subGroupX = 0; subGroupX < subGrpXMax; subGroupX++ ) - { - for( int subGroupY = 0; subGroupY < subGrpYMax; subGroupY++ ) - { - const int offsetX = sbSize * subGroupX; - const int offsetY = sbSize * subGroupY * width; - int y; - lfnstTemp = m_tempInMatrix; // forward low frequency non-separable transform - coeffTemp = tempCoeff + offsetX + offsetY; -#else int y; lfnstTemp = m_tempInMatrix; // forward low frequency non-separable transform coeffTemp = tempCoeff; -#endif if( transposeFlag ) { @@ -532,11 +480,7 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons fwdLfnstNxN( m_tempInMatrix, m_tempOutMatrix, g_lfnstLut[ intraMode ], lfnstIdx - 1, sbSize, ( tu4x4Flag || tu8x8Flag ) ? 8 : 16 ); lfnstTemp = m_tempOutMatrix; // forward spectral rearrangement -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - coeffTemp = tempCoeff + offsetX + offsetY; -#else coeffTemp = tempCoeff; -#endif const ScanElement * scanPtr = scan; int lfnstCoeffNum = ( sbSize == 4 ) ? sbSize * sbSize : 48; for( y = 0; y < lfnstCoeffNum; y++ ) @@ -544,10 +488,6 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons coeffTemp[ scanPtr->idx ] = *lfnstTemp++; scanPtr++; } -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - } - } // subGroupX -#endif } } } @@ -559,11 +499,7 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel const uint32_t uiWidth = area.width; const uint32_t uiHeight = area.height; -#if MAX_TB_SIZE_SIGNALLING CHECK( uiWidth > tu.cs->sps->getMaxTbSize() || uiHeight > tu.cs->sps->getMaxTbSize(), "Maximal allowed transformation size exceeded!" ); -#else - CHECK( uiWidth > MAX_TB_SIZEY || uiHeight > MAX_TB_SIZEY, "Maximal allowed transformation size exceeded!" ); -#endif if (tu.cu->transQuantBypass) { // where should this logic go? @@ -663,7 +599,6 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf & } } -#if JVET_O0105_ICT std::pair<int64_t,int64_t> TrQuant::fwdTransformICT( const TransformUnit &tu, const PelBuf &resCb, const PelBuf &resCr, PelBuf &resC1, PelBuf &resC2, int jointCbCr ) { @@ -683,7 +618,6 @@ std::vector<int> TrQuant::selectICTCandidates( const TransformUnit &tu, CompStor { CHECK( !resCb[0].valid() || !resCr[0].valid(), "standard components are not valid" ); -#if JVET_O0543_ICT_ICU_ONLY if( !CU::isIntra( *tu.cu ) ) { int cbfMask = 3; @@ -694,7 +628,6 @@ std::vector<int> TrQuant::selectICTCandidates( const TransformUnit &tu, CompStor cbfMasksToTest.push_back( cbfMask ); return cbfMasksToTest; } -#endif std::pair<int64_t,int64_t> pairDist[4]; for( int cbfMask = 0; cbfMask < 4; cbfMask++ ) @@ -737,7 +670,6 @@ std::vector<int> TrQuant::selectICTCandidates( const TransformUnit &tu, CompStor return cbfMasksToTest; } -#endif // ------------------------------------------------------------------------------------------------ @@ -747,21 +679,15 @@ std::vector<int> TrQuant::selectICTCandidates( const TransformUnit &tu, CompStor void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer) { const bool isExplicitMTS = (CU::isIntra(*tu.cu) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS() && CU::isInter(*tu.cu)) && isLuma(compID); -#if JVET_O0529_IMPLICIT_MTS_HARMONIZE const bool isImplicitMTS = CU::isIntra(*tu.cu) && tu.cs->sps->getUseImplicitMTS() && isLuma(compID) && tu.cu->lfnstIdx == 0 && tu.cu->mipFlag == 0; -#else - const bool isImplicitMTS = CU::isIntra(*tu.cu) && tu.cs->sps->getUseImplicitMTS() && isLuma(compID); -#endif const bool isISP = CU::isIntra(*tu.cu) && tu.cu->ispMode && isLuma(compID); const bool isSBT = CU::isInter(*tu.cu) && tu.cu->sbtInfo && isLuma(compID); trTypeHor = DCT2; trTypeVer = DCT2; -#if JVET_O0538_SPS_CONTROL_ISP_SBT if (!tu.cs->sps->getUseMTS()) return; -#endif if (isImplicitMTS || isISP) { @@ -841,10 +767,6 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel getTrTypes ( tu, compID, trTypeHor, trTypeVer ); -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - const int skipWidth = ( trTypeHor != DCT2 && width == 32 ) ? 16 : width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; - const int skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; -#else int skipWidth = ( trTypeHor != DCT2 && width == 32 ) ? 16 : width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; int skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; if( tu.cs->sps->getUseLFNST() && tu.cu->lfnstIdx ) @@ -860,7 +782,6 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel skipHeight = height - 8; } } -#endif #if RExt__DECODER_DEBUG_TOOL_STATISTICS if ( trTypeHor != DCT2 ) @@ -926,10 +847,6 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo int trTypeVer = DCT2; getTrTypes ( tu, compID, trTypeHor, trTypeVer ); -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS - const int skipWidth = ( trTypeHor != DCT2 && width == 32 ) ? 16 : width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; - const int skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; -#else int skipWidth = ( trTypeHor != DCT2 && width == 32 ) ? 16 : width > JVET_C0024_ZERO_OUT_TH ? width - JVET_C0024_ZERO_OUT_TH : 0; int skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; if( tu.cs->sps->getUseLFNST() && tu.cu->lfnstIdx ) @@ -945,7 +862,6 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo skipHeight = height - 8; } } -#endif TCoeff *block = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); @@ -1040,11 +956,7 @@ void TrQuant::xQuant(TransformUnit &tu, const ComponentID &compID, const CCoeffB m_quant->quant( tu, compID, pSrc, uiAbsSum, cQP, ctx ); } -#if JVET_O0502_ISP_CLEANUP void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const QpParam& cQP, std::vector<TrMode>* trModes, const int maxCand ) -#else -void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, std::vector<TrMode>* trModes, const int maxCand, double* diagRatio, double* horVerRatio ) -#endif { CodingStructure &cs = *tu.cs; const CompArea &rect = tu.blocks[compID]; @@ -1053,11 +965,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const const CPelBuf resiBuf = cs.getResiBuf(rect); -#if MAX_TB_SIZE_SIGNALLING CHECK( cs.sps->getMaxTbSize() < width, "Unsupported transformation size" ); -#else - CHECK( MAX_TB_SIZEY < width, "Unsupported transformation size" ); -#endif int pos = 0; std::vector<TrCost> trCosts; @@ -1099,11 +1007,6 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const it++; } -#if !JVET_O0502_ISP_CLEANUP - // it gets the distribution of the DCT-II coefficients energy, which will be useful to discard ISP tests - CoeffBuf coeffsDCT( m_mtsCoeffs[0], rect ); - xGetCoeffEnergy( tu, compID, coeffsDCT, diagRatio, horVerRatio ); -#endif int numTests = 0; std::vector<TrCost>::iterator itC = trCosts.begin(); const double fac = facBB[floorLog2(std::max(width, height))-2]; @@ -1118,11 +1021,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const } } -#if JVET_O0502_ISP_CLEANUP void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const QpParam& cQP, TCoeff& uiAbsSum, const Ctx& ctx, const bool loadTr ) -#else -void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr, double* diagRatio, double* horVerRatio ) -#endif { CodingStructure &cs = *tu.cs; const SPS &sps = *cs.sps; @@ -1178,12 +1077,8 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const } else { -#if MAX_TB_SIZE_SIGNALLING CHECK( cs.sps->getMaxTbSize() < uiWidth, "Unsupported transformation size" ); -#else - CHECK( MAX_TB_SIZEY < uiWidth, "Unsupported transformation size" ); -#endif CoeffBuf tempCoeff(loadTr ? m_mtsCoeffs[tu.mtsIdx] : m_tempCoeff, rect); @@ -1201,16 +1096,6 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const } } -#if !JVET_O0502_ISP_CLEANUP - //we do this only with the DCT-II coefficients - if( isLuma(compID) && - !loadTr && tu.mtsIdx == MTS_DCT2_DCT2 - ) - { - //it gets the distribution of the coefficients energy, which will be useful to discard ISP tests - xGetCoeffEnergy( tu, compID, tempCoeff, diagRatio, horVerRatio ); - } -#endif if( sps.getUseLFNST() ) { @@ -1229,41 +1114,6 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const TU::setCbfAtDepth (tu, compID, tu.depth, uiAbsSum > 0); } -#if !JVET_O0502_ISP_CLEANUP -void TrQuant::xGetCoeffEnergy( TransformUnit &tu, const ComponentID &compID, const CoeffBuf& coeffs, double* diagRatio, double* horVerRatio ) -{ - if( nullptr == diagRatio || nullptr == horVerRatio ) return; - if( tu.cu->predMode == MODE_INTRA && !tu.cu->ispMode && isLuma( compID ) && tu.cs->sps->getUseISP() && CU::canUseISP( *tu.cu, compID ) ) - { - const int width = tu.cu->blocks[compID].width; - const int height = tu.cu->blocks[compID].height; - const int log2Sl = width <= height ? floorLog2(height >> floorLog2(width)) : floorLog2(width >> floorLog2(height)); - const int diPos1 = width <= height ? width : height; - const int diPos2 = width <= height ? height : width; - const int ofsPos1 = width <= height ? 1 : coeffs.stride; - const int ofsPos2 = width <= height ? coeffs.stride : 1; - - int wdtE = 0, hgtE = 0, diaE = 0; - int* gtE = width <= height ? &wdtE : &hgtE; - int* stE = width <= height ? &hgtE : &wdtE; - - for( int pos1 = 0; pos1 < diPos1; pos1++ ) - { - const int posN = pos1 << log2Sl; - for( int pos2 = 0; pos2 < diPos2; pos2++ ) - { - const int blkP = pos1 * ofsPos1 + pos2 * ofsPos2; - if( posN > pos2 ) *gtE += abs( coeffs.buf[ blkP ] ); - if( posN < pos2 ) *stE += abs( coeffs.buf[ blkP ] ); - if( posN == pos2 ) diaE += abs( coeffs.buf[ blkP ] ); - } - } - - *horVerRatio = 0 == wdtE && 0 == hgtE ? 1 : double( wdtE ) / double( hgtE ); - *diagRatio = 0 == wdtE && 0 == hgtE && 0 == diaE ? 1 : double( diaE ) / double( wdtE + hgtE ); - } -} -#endif void TrQuant::applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const RDPCMMode &mode) { diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h index bbcf2c80647ad41fca02427c39978447fd69ac15..f2afdbb0862893d7a82685fc7d59fa49099e8445 100644 --- a/source/Lib/CommonLib/TrQuant.h +++ b/source/Lib/CommonLib/TrQuant.h @@ -93,24 +93,17 @@ protected: public: void invTransformNxN (TransformUnit &tu, const ComponentID &compID, PelBuf &pResi, const QpParam &cQPs); -#if JVET_O0502_ISP_CLEANUP void transformNxN ( TransformUnit& tu, const ComponentID& compID, const QpParam& cQP, std::vector<TrMode>* trModes, const int maxCand ); void transformNxN ( TransformUnit& tu, const ComponentID& compID, const QpParam& cQP, TCoeff& uiAbsSum, const Ctx& ctx, const bool loadTr = false ); -#else - void transformNxN ( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, std::vector<TrMode>* trModes, const int maxCand, double* diagRatio = nullptr, double* horVerRatio = nullptr ); - void transformNxN ( TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const Ctx &ctx, const bool loadTr = false, double* diagRatio = nullptr, double* horVerRatio = nullptr ); -#endif void rdpcmNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, RDPCMMode &rdpcmMode); void applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const RDPCMMode &rdpcmMode); void transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &compID, const TCoeff &resiDiff, TCoeff &coeff, const uint32_t &uiPos, const QpParam &cQP, const bool bUseHalfRoundingPoint); void invTrSkipDeQuantOneSample (TransformUnit &tu, const ComponentID &compID, const TCoeff &pcCoeff, Pel &reconSample, const uint32_t &uiPos, const QpParam &cQP); -#if JVET_O0105_ICT void invTransformICT ( const TransformUnit &tu, PelBuf &resCb, PelBuf &resCr ); std::pair<int64_t,int64_t> fwdTransformICT ( const TransformUnit &tu, const PelBuf &resCb, const PelBuf &resCr, PelBuf& resC1, PelBuf& resC2, int jointCbCr = -1 ); std::vector<int> selectICTCandidates ( const TransformUnit &tu, CompStorage* resCb, CompStorage* resCr ); -#endif void invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf &pcResidual); #if RDOQ_CHROMA_LAMBDA @@ -136,13 +129,11 @@ private: TCoeff m_mtsCoeffs[NUM_TRAFO_MODES_MTS][MAX_TB_SIZEY * MAX_TB_SIZEY]; TCoeff m_tempInMatrix [ 48 ]; TCoeff m_tempOutMatrix[ 48 ]; -#if JVET_O0105_ICT static const int maxAbsIctMode = 3; void (*m_invICTMem[1+2*maxAbsIctMode])(PelBuf&,PelBuf&); std::pair<int64_t,int64_t>(*m_fwdICTMem[1+2*maxAbsIctMode])(const PelBuf&,const PelBuf&,PelBuf&,PelBuf&); void (**m_invICT)(PelBuf&,PelBuf&); std::pair<int64_t,int64_t>(**m_fwdICT)(const PelBuf&,const PelBuf&,PelBuf&,PelBuf&); -#endif // forward Transform diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 5f79ef8e45d905474dd2e069c69dc1f608acfcbd..bdc7a63d15ebaec8cb171fb2a5f68d283da66063 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,286 +50,31 @@ #include <assert.h> #include <cassert> -#define JVET_O0245_VPS_DPS_APS 1 // JVET-O0245: constraints for VPS, DPS, and APS +#define JVET_P0164_ALF_SYNTAX_SIMP 1 // JVET-p0164: simplify alf syntax with method2 -#define JVET_O0044_MULTI_SUB_PROFILE 1 // JVET-O0044: Zero or more sub profile fields +#define JVET_P0042_FIX_INTER_DIR_CTX 1 // JVET-P0042: Fix overlap in context between the bi-pred flag for 8x8 CUs and the L0/L1 flag for all size CUs -#define JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA 1 // JVET-O0143: Remove signaling of top_right_brick_idx +#define JVET_P0111_CHROMA_422_FIX 1 // JVET-P0422: Bug fix of chroma 422 intra mode mapping -#define JVET_O0236_PPS_PARSING_DEPENDENCY 1 // JVET-O0236: Resolves a PPS parsing dependency +#define JVET_P0329_PLANAR_SIMPLIFICATION 1 // JVET-P0329: simplify planar prediction by comparison removal -#define JVET_O0148_NUM_ACTIVE_REF_PIC_CHECK 1 // JVET-O0148: Constraint that num active entries in RPL 0 and RPL 1 for P and B pictures +#define JVET_P0516_PLT_BINARIZATION 1 // JVET-P0516: PLT is always signaled when pred mode is euqal to 1 (intra mode) -#define JVET_O0145_ENTRYPOINT_SIGNALLING 0 // JVET-O0145: Not signalling num_entry_point_offsets but derive it at decoder - -#define JVET_N0494_DRAP 1 // JVET-N0494: Dependent random access point indication SEI - -#define JVET_O0173_O0176_O0338_NUMBRICK_M2 1 // JVET-O0173, O0176, O0338 : Replacing num_brick_rows_minus1 with num_brick_rows_minus2 +#define JVET_P0562_TS_RESIDUAL_CODING_SIMP 1 // JVET-P0562: Fix the Rice parameter equal to 1 for the remainder of TS residual coding -#define JVET_OO152_BP_SEI_GDR 1 // JVET-O0152: Allowing association of a buffering period SEI with GDR picture +#define JVET_P0385_UNIFIED_MV_ROUNDING 1 -#define JVET_OO147_LEADING_PIC_CHECKING 1 // JVET-O0147: Constraints on leading pictures +#define JVET_P0418_ALIGN_MLRP_CCLM 1 // JVET-P0418: Align MLRP with CCLM in terms of reference lines/columns -#define JVET_O0299_APS_SCALINGLIST 1 // JVET-O0299: Scaling List Matrices Support in APS - -#define JVET_O1164_RPR 1 // JVET-O1164: Reference picture resampling -#if JVET_O1164_RPR -#define JVET_O1164_PS 1 -#define RPR_BUFFER 1 // lossless -#define RPR_CTC_PRINT 1 -#define RPR_CONF_WINDOW 1 -#define RPR_MAX_SCALE_FACTOR 2 -#endif +#define JVET_O0145_ENTRYPOINT_SIGNALLING 0 // JVET-O0145: Not signalling num_entry_point_offsets but derive it at decoder #define JVET_O0625_ALF_PADDING 1 // JVET-O0625/O0654/O0662: Unified padding method in ALF -#define JVET_O0238_PPS_OR_SLICE 1 // JVET-O0238: Signal certain parameters either in PPS or per slice -#define SUPPORT_FOR_RECT_SLICES_WITH_VARYING_NUMBER_OF_TILES 1 - -#define JVET_O0452_PPS_BRICK_SIGNALING_CONDITION 1 // JVET-O0452: brick_split_flag signaled as RowHeight > 1 and uniform_brick_spacing_flag signaled as RowHeight > 2 - -#define FLATTEN_BUFFERS \ - (1 && JVET_O0502_ISP_CLEANUP && JVET_O0364_PADDING && JVET_O0426_MRL_REF_SAMPLES_DC_MODE \ - && JVET_O0925_MIP_SIMPLIFICATIONS && JVET_O0364_PDPC_DC) - -#define JVET_O0119_BASE_PALETTE_444 1 // JVET-O0119: Palette mode in HEVC and palette mode signaling in JVET-N0258. Only enabled for YUV444. - -#define JVET_O0304_SIMPLIFIED_BDOF 1 // JVET-O0304: Reduction of number of multiplications in BDOF - -#define JVET_O0455_IBC_MAX_MERGE_NUM 1 // JVET-O0455: Control the max number of IBC merge candidates independently from regular merge candidates - -#define JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE 1 // JVET-O0650: Signal chroma QP mapping tables and move chroma PPS/slice offsets after mapping table - -#define JVET_O0502_ISP_CLEANUP 1 // JVET-O0502: Enable PDPC and all 67 intra modes and apply the cubic filter always (also included in JVET-O0341) for ISP - -#define JVET_O0640_PICTURE_SIZE_CONSTRAINT 1 // JVET-O0640: Picture width and height shall be a multiple of Max(8, minCU size) - -#define JVET_O_MAX_NUM_ALF_APS_8 1 // JVET-O: number of ALF APSs is reduced to 8 - -#define JVET_O0925_MIP_SIMPLIFICATIONS 1 // JVET-O0925: Simplifications of MIP - -#define JVET_O0070_PROF 1 // JVET-O0070 method 4-2.1a: Prediction refinement with optical flow for affine mode - -#define JVET_O0570_GRAD_SIMP 1 // JVET-O0570/JVET-O0211, SMID friendly spatial gradient calculation - -#define JVET_O1170_IBC_VIRTUAL_BUFFER 1 // JVET-O1170/O1171: IBC virtual buffer -#if JVET_O1170_IBC_VIRTUAL_BUFFER -#define JVET_O1170_CHECK_BV_AT_DECODER 1 // For decoder to check if a BV is valid or not -#endif - -#define JVET_O0538_SPS_CONTROL_ISP_SBT 1 // JVET-O0538: SPS control for ISP and SBT transform - -#define JVET_O0634_BDOF_SIZE_CONSTRAINT 1 // JVET-O0634: BDOF applied CU size align with DMVR - -#define JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE 1 // JVET-O0213: Block size restriction of LFNST to maximum transform size - -#define JVET_O0617_SIG_FLAG_CONTEXT_REDUCTION 1 // JVET-O0617: Significant flag context reduction - -#define JVET_O0244_DELTA_POC 1 // JVET-O0244: weighted prediction in SPS and delta POC - -#define JVET_O1153_INTRA_CHROMAMODE_CODING 1 //JVET-O1153: simplified intra chromamode coding - -#define JVET_O0159_10BITTCTABLE_DEBLOCKING 1 // tc table for 10-bit video - -#define JVET_O0061_MV_THR_DEBLOCKING 1 // a deblocking mv threshold of half pel - -#define JVET_O0220_METHOD1_SUBBLK_FLAG_PARSING 1 // JVET-O0220 method-1: Parse merge_subblock_flag conditioned on MaxNumSubblockMergeCand - -#define JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP 1 // JVET-O0263/ JVET-O0220: Syntax cleanup on subblock merge - -#define JVET_O0060_4x4_deblocking 1 // deblock on 4x4 grid - -#define JVET_O0046_DQ_SIGNALLING 1 // JVET-O0046: Move delta-QP earlier for 64x64 VPDU processing, applied to CUs >64x64 only - -#define JVET_O0616_400_CHROMA_SUPPORT 1 // JVET-O0616: Various chroma format support in VVC - -#define JVET_O0265_TPM_SIMPLIFICATION 1 // JVET-O0265/JVET-O0629/JVET-O0418/JVET-O0329/JVET-O0378/JVET-O0411/JVET-O0279:Simplified motion field storage for TPM - -#define JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT 1 // JVET-O0409: exclude coded_subblock_flag from counting context-coded bins in transform skip - -#define JVET_O0057_ALTHPELIF 1 //AMVR_HPEL - -#define JVET_O1136_TS_BDPCM_SIGNALLING 1 // JVET-O1136: Unified syntax for JVET-O0165/O0200/O0783 on TS and BDPCM signalling - -#define JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE 1 - -#define JVET_O0426_MRL_REF_SAMPLES_DC_MODE 1 // JVET-O0426: align MRL reference samples used for DC intra mode prediction - -#define JVET_O0366_AFFINE_BCW 1 // JVET-O0366: Simplifications on BCW index derivation process - -#define JVET_O0919_TS_MIN_QP 1 // JVET-O0919: Minimum QP for Transform Skip Mode - -#define JVET_O1168_CU_CHROMA_QP_OFFSET 1 // JVET-O1168: cu chroma QP offset - -#define JVET_O0368_LFNST_WITH_DCT2_ONLY 1 // JVET-O0368/O0292/O0521/O0466: disable LFNST for non-DCT2 MTS candidates normatively - -#define JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN 1 // JVET-O0106: use 4xN prediction regions for 1xN and 2xN subblocks - -#define JVET_O0500_SEP_CTX_AFFINE_SUBBLOCK_MRG 1 // JVET-O0500: Different ctx models for inter affine flag and subblock merge flag - -#define JVET_O0414_SMVD_LTRP 1 // JVET-O0414: long-term reference picture restriction for SMVD - -#define JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE 1 // JVET-O0258 Remove chroma IBC when dualtree is used - -#define JVET_O1161_IBC_MAX_SIZE 1 // Limit largest IBC luma CU size to 64x64 per discussion of JVET-O1161 - -#define JVET_O0315_RDPCM_INTRAMODE_ALIGN 1 // JVET-O0200/O0205/O0296/O0342/O0463/O0542: Intra prediction mode alignment for BDPCM - -#define JVET_O0284_CONDITION_SMVD_MVDL1ZEROFLAG 1 // JVET-O0284: condition sym_mvd_flag on mvd_l1_zero_flag - -#define JVET_O0122_TS_SIGN_LEVEL 1 // JVET-O0122: Sign context and level mapping of TS residual coding. - -#define JVET_O0438_SPS_AFFINE_AMVR_FLAG 1 // JVET-O0438: affine AMVR control flag conditioned on affine control flag in SPS - -#define JVET_O0065_CABAC_INIT 1 // JVET-O0065: CABAC initialization - -#define JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT 1 // JVET-O0052 Method-1: TU-level context coded bin constraint - -#define JVET_O0105_ICT 1 // JVET-O0105: inter-chroma transform (ICT) as extension of joint chroma coding (JCC) -#define JVET_O0543_ICT_ICU_ONLY 1 // JVET-O0543: ICT only in Intra CUs (was Intra slices, modified during adoption) -#define JVET_N0288_PROPOSAL1 1 // JVET-N0288 Proposal 1 - -#define JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB 1 // JVET-O0090 test 2: CTB selection of ALF alternative chroma filters -#define JVET_O0050_LOCAL_DUAL_TREE 1 // JVET-O0050: avoid small intra chroma block by a "local dual-tree" technique - -#define JVET_O0216_ALF_COEFF_EG3 1 // JVET-O0216/O0302/O0648: using EG3 for ALF coefficients coding - -#define JVET_O0256_ADJUST_THD_DEPQUANT 1 // JVET-O0256: Fast encoder with adjusted threshold in dependent quantization - -#define JVET_O0619_GTX_SINGLE_PASS_TS_RESIDUAL_CODING 1 // JVET-O0619/O0623 : Single pass coding of abs_level_gtx_flag[x] for TS residual coding - -#define JVET_O0272_LMCS_SIMP_INVERSE_MAPPING 1 // JVET-O0272: LMCS simplified inverse mapping - -#define JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL 1 // JVET-O0247: not signal APS index when number APS is 2 - -#define JVET_O0297_DMVR_PADDING 1 // JVET-O0297 DMVR Padding - -#define JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION 1 // Choose line0 and line3 for gradient computation when chroma is same size as luma - -#define JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL 1 // JVET-O0288: remove slice type dependency in ALF - -#define JVET_O0064_SIMP_ALF_CLIP_CODING 1 // JVET-O0047/O0058/O0064/O0067/O0290/O0301/O0430: use FLC for alf clipping indices, always signal alf clipping indices - -#define JVET_O0529_IMPLICIT_MTS_HARMONIZE 1 // JVET-O0529/O0540: Harmonization of LFNST, MIP and implicit MTS - -#define JVET_O0669_REMOVE_ALF_COEFF_PRED 1 // JVET-O0425/O0427/O0669: remove prediction in ALF coefficients coding - -#define JVET_O0526_MIN_CTU_SIZE 1 // JVET-O0526: Minimum CTU size 32x32 - -#define JVET_O0545_MAX_TB_SIGNALLING 1 // JVET-O0545: Configurable maximum transform size - -#define JVET_O0525_REMOVE_PCM 1 // JVET-O0525: Removal of PCM mode - -#define JVET_O0541_IMPLICIT_MTS_CONDITION 1 // JVET_O0541: Decouple the intra implicit transform selection from an inter MTS related SPS flag -#define JVET_O0163_REMOVE_SWITCHING_TMV 1 // JVET-O0163/JVET-O0588: Remove switching between L0 and L1 for temporal MV -#define JVET_O0655_422_CHROMA_DM_MAPPING_FIX 1 // JVET-O0655: modify chroma DM derivation table for 4:2:2 chroma format - -#define JVET_O1109_UNFIY_CRS 1 // JVET-O1109: Unified CRS derivation - -#define JVET_O0590_REDUCE_DMVR_ORIG_MV_COST 1 // Reduce the DMVR cost of the original MV - -#define JVET_O0432_LMCS_ENCODER 1 // JVET-O0432: LMCS encoder improvement - -#define JVET_O0429_CRS_LAMBDA_FIX 1 // JVET-O0429: fix encoder lambda rounding used in CRS - -#define JVET_O0428_LMCS_CLEANUP 1 // JVET-O0428: LMCS cleanups - -#define JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING 1 // JVET-O0164/JVET-O0587: remove spatial AMVP candidate scaling - -#define JVET_O0162_IBC_MVP_FLAG 1 // JVET-O0162/O0331/O0480/O0574: IBC mvp flag conditioned on MaxNumMergeCand>1 - -#define JVET_O0055_INT_DMVR_DIS_BDOF 1 // integer-distance DMVR cost to disable BDOF and disable BDOF early termination - -#define JVET_O0277_INTRA_SMALL_BLOCK_DCTIF 1 // JVET-O0277: DCT-IF interpolation filter is always used for 4x4, 4x8, and 8x4 luma CB - -#define JVET_O0267_IBC_SCALING_LIST 1 - -#define JVET_O0280_SIMD_TRIANGLE_WEIGHTING 1 // JVET-O0280: SIMD implementation for weighted sample prediction process of triangle prediction mode - -#define JVET_O0379_SPEEDUP_TPM_ENCODER 1 // JVET_O0379: Speedup mode decision process for triangle prediction mode - -#define JVET_O0364_PADDING 1 // JVET-O0364 Part 2: clean up padding process in intra prediction -#define JVET_O0364_PDPC_DC 1 // JVET-O0364 Part 4: align PDPC process for DC with the one for Planar -#define JVET_O0364_PDPC_ANGULAR 1 // JVET-O0364 Part 5: simplify PDPC process for angular modes - -#define JVET_O0094_LFNST_ZERO_PRIM_COEFFS 1 // JVET-O0094: CE6-2.1a, LFNST involves zeroing of primary only coefficient positions - -#define JVET_O0294_TRANSFORM_CLEANUP 1 // JVET-O0294: Context modelling for MTS index - -#define JVET_O1124_ALLOW_CCLM_COND 1 // JVET-O1124/JVET-O0196: CCLM restriction to reduce luma-chroma latency for chroma separate tree - -#define JVET_O0078_SINGLE_HMVPLUT 1 // JVET-O0078Single HMVP table for all CUs inside the shared merge list region for IBC - -#define JVET_O0126_BPWA_INDEX_CODING_FIX 1 // JVET-O0126 align BPWA index coding with specification - -#define JVET_O0592_ENC_ME_IMP 1 // JVET-O0592 encoder ME improvement - -#define JVET_O0108_DIS_DMVR_BDOF_CIIP 1 // JVET_O0108 CE9-2.2: disable DMVR and BDOF for CIIP - -#define JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG 1 // JVET-O1140 slice level disable flag for BDOF and DMVR - -#define JVET_O0567_MVDRange_Constraint 1 // JVET-O0567: constrain the signalled MVD value to the range of [-2^17, 2^17-1] - -#define JVET_O0596_CBF_SIG_ALIGN_TO_SPEC 1 // JVET-O0596 align cbf signaling with specification -#define JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX 1 // JVET-O0193/JVET-O0375: remove transform depth in cbf context modeling -#define JVET_O0681_DIS_BPWA_CIIP 1 // JVET-O0681 disable BCW for CIIP, method 2 inherit BCW index -#define JVET_O0249_MERGE_SYNTAX 1 // JVET-O0249: merge syntax change -#define JVET_O0594_BDOF_REF_SAMPLE_PADDING 1 // JVET-O0594/O0252/O0506/O0615/O0624: BDOF reference sample padding using the nearest integer sample position - -#define JVET_O0610_CFG 1 // config default change for "Adopt to mandate the presence of AU delimiter for each AU", config parameter should be removed later -#define JVET_O0610_DETECT_AUD 1 // JVET-O0610: detect presence of mandatory access unit delimiters - -#define JVET_O0491_HLS_CLEANUP 1 -#define JVET_O0041_FRAME_FIELD_SEI 1 - -#define JVET_O0376_SPS_JOINTCBCR_FLAG 1 // JVET-O0376: add the JointCbCr control flag in SPS -#define JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS 1 // JVET-O0472: LFNST index signalling depends on the position of last significant coefficient - -#define JVET_O0189_DU 1 -#if JVET_O0189_DU -#define FIX_SEI_O0189 1 -#define FIX_HRD_O0189 1 -#endif -#define JVET_N0353_INDEP_BUFF_TIME_SEI 1 // JVET-N0353 independent parsing of buffering and timing info SEIs -#define JVET_N0867_TEMP_SCAL_HRD 1 // JVET-N0867 temporal scalability support for HRD in buffering period and picture timing SEIs - -#define FIX_DB_MAX_TRANSFORM_SIZE 1 - #define MRG_SHARELIST_SHARSIZE 32 #define JVET_M0497_MATRIX_MULT 0 // 0: Fast method; 1: Matrix multiplication #define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on -#if !JVET_O0525_REMOVE_PCM -#define FIX_PCM 1 // Fix PCM bugs in VTM3 -#endif - -#if JVET_O0545_MAX_TB_SIGNALLING -#define MAX_TB_SIZE_SIGNALLING 1 -#else -#define MAX_TB_SIZE_SIGNALLING 0 -#endif - -#define JVET_N0100_PROPOSAL1 1 // JVET-N0100: ltrp picture signalling - -#define JVET_N0865_SYNTAX 1 // JVET_N0865 syntax elements -#define JVET_N0865_NONSYNTAX 1 // JVET_N0865 other than syntax parts -#define JVET_N0865_GRA2GDR 1 // Changing the name of GRA to GDR - -#define JVET_O0178 1 // JVET_O0178 - conditionally signal sps_sub_layer_ordering_info_present_flag - -#define RPL_IN_IDR_FIX 1 // JVET_N0865 syntax elements - -#define JVET_O0179 1 // JVET_O0179: Implement NAL unit header syntax proposal B - -#define JVET_O0176_PROPOSAL3 1 // JVET_O0176 check for rect_slice_flag - -#define JVET_O0181 1 // JVET_O0181: non_reference_picture_flag - -#define JVET_O0177_PROPOSAL1 1 // JVET_O0177 proposal 1: Allow signaling of HRD parameters for temporal sub-layers optionally controlled by a flag - -#define JVET_O0241 1 // JVET_O0241 : decoding process for generating unavailable reference pictures - #define HEVC_SEI 0 // SEI messages that are defined in HEVC, but not in VVC @@ -337,14 +82,9 @@ typedef std::pair<int, bool> TrMode; typedef std::pair<int, int> TrCost; // clang-format off -#define ENABLE_JVET_L0283_MRL 1 // 1: Enable MRL, 0: Disable MRL -#define JVET_L0090_PAIR_AVG 1 // Add pairwise average candidates, replace HEVC combined candidates #define REUSE_CU_RESULTS 1 #if REUSE_CU_RESULTS #define REUSE_CU_RESULTS_WITH_MULTIPLE_TUS 1 -#if !JVET_O0545_MAX_TB_SIGNALLING -#define MAX_NUM_TUS 4 -#endif #endif // clang-format on @@ -545,26 +285,18 @@ typedef uint32_t Intermediate_UInt; ///< used as intermediate v #endif typedef uint64_t SplitSeries; ///< used to encoded the splits that caused a particular CU size -#if JVET_O0050_LOCAL_DUAL_TREE typedef uint64_t ModeTypeSeries; ///< used to encoded the ModeType at different split depth -#endif typedef uint64_t Distortion; ///< distortion measurement // ==================================================================================================================== // Enumeration // ==================================================================================================================== -#if JVET_O0245_VPS_DPS_APS enum ApsType -#else -enum ApsTypeValues -#endif { ALF_APS = 0, LMCS_APS = 1, -#if JVET_O0299_APS_SCALINGLIST SCALING_LIST_APS = 2, -#endif }; enum QuantFlags @@ -600,12 +332,8 @@ enum ISPType NOT_INTRA_SUBPARTITIONS = 0, HOR_INTRA_SUBPARTITIONS = 1, VER_INTRA_SUBPARTITIONS = 2, -#if JVET_O0502_ISP_CLEANUP NUM_INTRA_SUBPARTITIONS_MODES = 3, INTRA_SUBPARTITIONS_RESERVED = 4 -#else - NUM_INTRA_SUBPARTITIONS_MODES = 3 -#endif }; enum SbtIdx @@ -680,7 +408,6 @@ enum ChannelType MAX_NUM_CHANNEL_TYPE = 2 }; -#if JVET_O0050_LOCAL_DUAL_TREE enum TreeType { TREE_D = 0, //default tree status (for single-tree slice, TREE_D means joint tree; for dual-tree I slice, TREE_D means TREE_L for luma and TREE_C for chroma) @@ -694,7 +421,6 @@ enum ModeType MODE_TYPE_INTER = 1, //can try inter MODE_TYPE_INTRA = 2, //can try intra, ibc, palette }; -#endif #define CH_L CHANNEL_TYPE_LUMA #define CH_C CHANNEL_TYPE_CHROMA @@ -748,12 +474,8 @@ enum PredMode MODE_INTER = 0, ///< inter-prediction mode MODE_INTRA = 1, ///< intra-prediction mode MODE_IBC = 2, ///< ibc-prediction mode -#if JVET_O0119_BASE_PALETTE_444 MODE_PLT = 3, ///< plt-prediction mode NUMBER_OF_PREDICTION_MODES = 4, -#else - NUMBER_OF_PREDICTION_MODES = 3, -#endif }; /// reference list index @@ -879,10 +601,8 @@ enum MESearchMethod enum CoeffScanType { SCAN_DIAG = 0, ///< up-right diagonal scan -#if JVET_O0119_BASE_PALETTE_444 SCAN_TRAV_HOR = 1, SCAN_TRAV_VER = 2, -#endif SCAN_NUMBER_OF_TYPES }; @@ -1071,7 +791,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_O0179 NAL_UNIT_CODED_SLICE_TRAIL = 0, // 0 NAL_UNIT_CODED_SLICE_STSA, // 1 NAL_UNIT_CODED_SLICE_RASL, // 2 @@ -1085,11 +804,7 @@ enum NalUnitType NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 8 NAL_UNIT_CODED_SLICE_IDR_N_LP, // 9 NAL_UNIT_CODED_SLICE_CRA, // 10 -#if JVET_N0865_GRA2GDR NAL_UNIT_CODED_SLICE_GDR, // 11 -#else - NAL_UNIT_CODED_SLICE_GRA, // 11 -#endif NAL_UNIT_RESERVED_IRAP_VCL_12, NAL_UNIT_RESERVED_IRAP_VCL_13, @@ -1116,45 +831,6 @@ enum NalUnitType NAL_UNIT_UNSPECIFIED_30, NAL_UNIT_UNSPECIFIED_31, NAL_UNIT_INVALID -#else - NAL_UNIT_PPS = 0, // 0 - NAL_UNIT_ACCESS_UNIT_DELIMITER, // 1 - NAL_UNIT_PREFIX_SEI, // 2 - NAL_UNIT_SUFFIX_SEI, // 3 - NAL_UNIT_APS, // 4 - NAL_UNIT_RESERVED_NVCL_5, // 5 - NAL_UNIT_RESERVED_NVCL_6, // 6 - NAL_UNIT_RESERVED_NVCL_7, // 7 - NAL_UNIT_CODED_SLICE_TRAIL, // 8 - NAL_UNIT_CODED_SLICE_STSA, // 9 - NAL_UNIT_CODED_SLICE_RADL, // 10 - NAL_UNIT_CODED_SLICE_RASL, // 11 - NAL_UNIT_RESERVED_VCL_12, // 12 - NAL_UNIT_RESERVED_VCL_13, // 13 - NAL_UNIT_RESERVED_VCL_14, // 14 - NAL_UNIT_RESERVED_VCL_15, // 15 - NAL_UNIT_DPS, // 16 - NAL_UNIT_SPS, // 17 - NAL_UNIT_EOS, // 18 - NAL_UNIT_EOB, // 19 - NAL_UNIT_VPS, // 20 - NAL_UNIT_RESERVED_NVCL_21, // 21 - NAL_UNIT_RESERVED_NVCL_22, // 22 - NAL_UNIT_RESERVED_NVCL_23, // 23 - NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 24 - NAL_UNIT_CODED_SLICE_IDR_N_LP, // 25 - NAL_UNIT_CODED_SLICE_CRA, // 26 -#if JVET_N0865_GRA2GDR - NAL_UNIT_CODED_SLICE_GDR, // 27 -#else - NAL_UNIT_CODED_SLICE_GRA, // 27 -#endif - NAL_UNIT_UNSPECIFIED_28, // 29 - NAL_UNIT_UNSPECIFIED_29, // 30 - NAL_UNIT_UNSPECIFIED_30, // 31 - NAL_UNIT_UNSPECIFIED_31, // 32 - NAL_UNIT_INVALID -#endif }; #if SHARP_LUMA_DELTA_QP @@ -1205,14 +881,9 @@ enum EncModeFeature enum ImvMode { IMV_OFF = 0, -#if JVET_O0057_ALTHPELIF IMV_FPEL, IMV_4PEL, IMV_HPEL, -#else - IMV_DEFAULT, - IMV_4PEL, -#endif NUM_IMV_MODES }; @@ -1261,14 +932,12 @@ struct BitDepths int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth as indicated in the SPS }; -#if JVET_O0119_BASE_PALETTE_444 enum PLTRunMode { PLT_RUN_INDEX = 0, PLT_RUN_COPY = 1, NUM_PLT_RUN = 2 }; -#endif /// parameters for deblocking filter struct LFCUParam { diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index b603e3fe0383b0fa0733cf6de8faed1a1293bdc7..332628ec5acd68d77aba84b5a1cdbb0461d64ba8 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -268,9 +268,6 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) triangle = other.triangle; transQuantBypass = other.transQuantBypass; bdpcmMode = other.bdpcmMode; -#if !JVET_O0525_REMOVE_PCM - ipcm = other.ipcm; -#endif qp = other.qp; chromaQpAdj = other.chromaQpAdj; rootCbf = other.rootCbf; @@ -289,7 +286,6 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) smvdMode = other.smvdMode; ispMode = other.ispMode; mipFlag = other.mipFlag; -#if JVET_O0119_BASE_PALETTE_444 for (int idx = 0; idx < MAX_NUM_COMPONENT; idx++) { curPLTSize[idx] = other.curPLTSize[idx]; @@ -300,12 +296,9 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) memcpy( curPLT[idx], other.curPLT[idx], MAXPLTSIZE * sizeof(Pel) ); memcpy( reuseflag[idx], other.reuseflag[idx], MAXPLTPREDSIZE * sizeof(bool)); } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE treeType = other.treeType; modeType = other.modeType; modeTypeSeries = other.modeTypeSeries; -#endif return *this; } @@ -324,9 +317,6 @@ void CodingUnit::initData() triangle = false; transQuantBypass = false; bdpcmMode = 0; -#if !JVET_O0525_REMOVE_PCM - ipcm = false; -#endif qp = 0; chromaQpAdj = 0; rootCbf = true; @@ -345,7 +335,6 @@ void CodingUnit::initData() smvdMode = 0; ispMode = 0; mipFlag = false; -#if JVET_O0119_BASE_PALETTE_444 for (int idx = 0; idx < MAX_NUM_COMPONENT; idx++) { curPLTSize[idx] = 0; @@ -356,31 +345,21 @@ void CodingUnit::initData() memset(curPLT[idx], 0, MAXPLTSIZE * sizeof(Pel) ); memset(reuseflag[idx], false, MAXPLTPREDSIZE * sizeof(bool)); } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE treeType = TREE_D; modeType = MODE_TYPE_ALL; modeTypeSeries = 0; -#endif } -#if JVET_O0050_LOCAL_DUAL_TREE const bool CodingUnit::isSepTree() const { return treeType != TREE_D || CS::isDualITree( *cs ); } -#endif -#if JVET_O1124_ALLOW_CCLM_COND const bool CodingUnit::checkCCLMAllowed() const { bool allowCCLM = false; -#if JVET_O0050_LOCAL_DUAL_TREE if( !CS::isDualITree( *cs ) ) //single tree I slice or non-I slice (Note: judging chType is no longer equivalent to checking dual-tree I slice since the local dual-tree is introduced) -#else - if( chType != CHANNEL_TYPE_CHROMA ) //single tree I slice or non-I slice -#endif { allowCCLM = true; } @@ -447,7 +426,6 @@ const bool CodingUnit::checkCCLMAllowed() const return allowCCLM; } -#endif const uint8_t CodingUnit::checkAllowedSbt() const { @@ -457,11 +435,7 @@ const uint8_t CodingUnit::checkAllowedSbt() const } //check on prediction mode -#if JVET_O0119_BASE_PALETTE_444 if (predMode == MODE_INTRA || predMode == MODE_IBC || predMode == MODE_PLT ) //intra, palette or IBC -#else - if( predMode == MODE_INTRA || predMode == MODE_IBC ) //intra or IBC -#endif { return 0; } @@ -719,10 +693,8 @@ TransformUnit::TransformUnit(const UnitArea& unit) : UnitArea(unit), cu(nullptr) { m_coeffs[i] = nullptr; m_pcmbuf[i] = nullptr; -#if JVET_O0119_BASE_PALETTE_444 m_runType[i] = nullptr; m_runLength[i] = nullptr; -#endif } initData(); @@ -734,10 +706,8 @@ TransformUnit::TransformUnit(const ChromaFormat _chromaFormat, const Area &_area { m_coeffs[i] = nullptr; m_pcmbuf[i] = nullptr; -#if JVET_O0119_BASE_PALETTE_444 m_runType[i] = nullptr; m_runLength[i] = nullptr; -#endif } initData(); @@ -758,11 +728,7 @@ void TransformUnit::initData() m_chromaResScaleInv = 0; } -#if JVET_O0119_BASE_PALETTE_444 void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf, Pel **runLength, bool **runType) -#else -void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf) -#endif { uint32_t numBlocks = getNumberValidTBlocks(*cs->pcv); @@ -770,10 +736,8 @@ void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf) { m_coeffs[i] = coeffs[i]; m_pcmbuf[i] = pcmbuf[i]; -#if JVET_O0119_BASE_PALETTE_444 m_runType[i] = runType[i]; m_runLength[i] = runLength[i]; -#endif } } @@ -790,10 +754,8 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other) if (m_coeffs[i] && other.m_coeffs[i] && m_coeffs[i] != other.m_coeffs[i]) memcpy(m_coeffs[i], other.m_coeffs[i], sizeof(TCoeff) * area); if (m_pcmbuf[i] && other.m_pcmbuf[i] && m_pcmbuf[i] != other.m_pcmbuf[i]) memcpy(m_pcmbuf[i], other.m_pcmbuf[i], sizeof(Pel ) * area); -#if JVET_O0119_BASE_PALETTE_444 if (m_runType[i] && other.m_runType[i] && m_runType[i] != other.m_runType[i] ) memcpy(m_runType[i], other.m_runType[i], sizeof(bool) * area); if (m_runLength[i] && other.m_runLength[i] && m_runLength[i] != other.m_runLength[i]) memcpy(m_runLength[i], other.m_runLength[i], sizeof(Pel) * area ); -#endif cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; @@ -816,10 +778,8 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen if (m_coeffs[i] && other.m_coeffs[i] && m_coeffs[i] != other.m_coeffs[i]) memcpy(m_coeffs[i], other.m_coeffs[i], sizeof(TCoeff) * area); if (m_pcmbuf[i] && other.m_pcmbuf[i] && m_pcmbuf[i] != other.m_pcmbuf[i]) memcpy(m_pcmbuf[i], other.m_pcmbuf[i], sizeof(Pel ) * area); -#if JVET_O0119_BASE_PALETTE_444 if (m_runType[i] && other.m_runType[i] && m_runType[i] != other.m_runType[i]) memcpy(m_runType[i], other.m_runType[i], sizeof(bool) * area); if (m_runLength[i] && other.m_runLength[i] && m_runLength[i] != other.m_runLength[i]) memcpy(m_runLength[i], other.m_runLength[i], sizeof(Pel) * area ); -#endif cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; @@ -837,7 +797,6 @@ const CCoeffBuf TransformUnit::getCoeffs(const ComponentID id) const { return CC PelBuf TransformUnit::getPcmbuf(const ComponentID id) { return PelBuf (m_pcmbuf[id], blocks[id]); } const CPelBuf TransformUnit::getPcmbuf(const ComponentID id) const { return CPelBuf (m_pcmbuf[id], blocks[id]); } -#if JVET_O0119_BASE_PALETTE_444 PelBuf TransformUnit::getcurPLTIdx(const ComponentID id) { return PelBuf(m_pcmbuf[id], blocks[id]); } const CPelBuf TransformUnit::getcurPLTIdx(const ComponentID id) const { return CPelBuf(m_pcmbuf[id], blocks[id]); } @@ -853,7 +812,6 @@ const CPLTescapeBuf TransformUnit::getescapeValue(const ComponentID id) const { Pel* TransformUnit::getPLTIndex (const ComponentID id) { return m_pcmbuf[id]; } Pel* TransformUnit::getRunLens (const ComponentID id) { return m_runLength[id]; } bool* TransformUnit::getRunTypes (const ComponentID id) { return m_runType[id]; } -#endif void TransformUnit::checkTuNoResidual( unsigned idx ) { @@ -868,17 +826,12 @@ void TransformUnit::checkTuNoResidual( unsigned idx ) } } -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int TransformUnit::getTbAreaAfterCoefZeroOut(ComponentID compID) const { int tbArea = blocks[compID].width * blocks[compID].height; int tbZeroOutWidth = blocks[compID].width; int tbZeroOutHeight = blocks[compID].height; -#if JVET_O0538_SPS_CONTROL_ISP_SBT if ((mtsIdx > MTS_SKIP || (cs->sps->getUseMTS() && cu->sbtInfo != 0 && blocks[compID].width <= 32 && blocks[compID].height <= 32)) && !cu->transQuantBypass && compID == COMPONENT_Y) -#else - if ((mtsIdx > MTS_SKIP || (cu->sbtInfo != 0 && blocks[compID].width <= 32 && blocks[compID].height <= 32)) && !cu->transQuantBypass && compID == COMPONENT_Y) -#endif { tbZeroOutWidth = (blocks[compID].width == 32) ? 16 : tbZeroOutWidth; tbZeroOutHeight = (blocks[compID].height == 32) ? 16 : tbZeroOutHeight; @@ -888,7 +841,6 @@ int TransformUnit::getTbAreaAfterCoefZeroOut(ComponentID compID) const tbArea = tbZeroOutWidth * tbZeroOutHeight; return tbArea; } -#endif int TransformUnit::getChromaAdj() const { return m_chromaResScaleInv; } void TransformUnit::setChromaAdj(int i) { m_chromaResScaleInv = i; } diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index d2cd41d67e7d3c6736fdd98f08e8234c59ed716f..739b51f44c6a69e14fba1cdcdc4d3dccb1d8fee2 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -48,12 +48,10 @@ // --------------------------------------------------------------------------- // tools // --------------------------------------------------------------------------- -#if JVET_O0119_BASE_PALETTE_444 struct PLTBuf { uint32_t curPLTSize[MAX_NUM_COMPONENT]; Pel curPLT[MAX_NUM_COMPONENT][MAXPLTPREDSIZE]; }; -#endif inline Position recalcPosition(const ChromaFormat _cf, const ComponentID srcCId, const ComponentID dstCId, const Position &pos) { if( toChannelType( srcCId ) == toChannelType( dstCId ) ) @@ -303,11 +301,9 @@ struct CodingUnit : public UnitArea int8_t chromaQpAdj; int8_t qp; SplitSeries splitSeries; -#if JVET_O0050_LOCAL_DUAL_TREE TreeType treeType; ModeType modeType; ModeTypeSeries modeTypeSeries; -#endif bool skip; bool mmvdSkip; bool affine; @@ -315,9 +311,6 @@ struct CodingUnit : public UnitArea bool triangle; bool transQuantBypass; int bdpcmMode; -#if !JVET_O0525_REMOVE_PCM - bool ipcm; -#endif uint8_t imv; bool rootCbf; uint8_t sbtInfo; @@ -334,7 +327,6 @@ struct CodingUnit : public UnitArea Size shareParentSize; uint8_t smvdMode; uint8_t ispMode; -#if JVET_O0119_BASE_PALETTE_444 bool useEscape[MAX_NUM_COMPONENT]; bool useRotation[MAX_NUM_COMPONENT]; bool reuseflag[MAX_NUM_COMPONENT][MAXPLTPREDSIZE]; @@ -342,7 +334,6 @@ struct CodingUnit : public UnitArea uint32_t reusePLTSize[MAX_NUM_COMPONENT]; uint32_t curPLTSize[MAX_NUM_COMPONENT]; Pel curPLT[MAX_NUM_COMPONENT][MAXPLTSIZE]; -#endif CodingUnit() : chType( CH_L ) { } CodingUnit(const UnitArea &unit); @@ -371,14 +362,10 @@ struct CodingUnit : public UnitArea void setSbtPos( uint8_t pos ) { CHECK( pos >= 4, "sbt_pos wrong" ); sbtInfo = ( pos << 4 ) + ( sbtInfo & 0xcf ); } uint8_t getSbtTuSplit() const; const uint8_t checkAllowedSbt() const; -#if JVET_O1124_ALLOW_CCLM_COND const bool checkCCLMAllowed() const; -#endif -#if JVET_O0050_LOCAL_DUAL_TREE const bool isSepTree() const; const bool isConsInter() const { return modeType == MODE_TYPE_INTER; } const bool isConsIntra() const { return modeType == MODE_TYPE_INTRA; } -#endif }; // --------------------------------------------------------------------------- @@ -487,18 +474,12 @@ struct TransformUnit : public UnitArea TransformUnit *next; TransformUnit *prev; -#if JVET_O0119_BASE_PALETTE_444 void init(TCoeff **coeffs, Pel **pcmbuf, Pel **runLength, bool **runType); -#else - void init(TCoeff **coeffs, Pel **pcmbuf); -#endif TransformUnit& operator=(const TransformUnit& other); void copyComponentFrom (const TransformUnit& other, const ComponentID compID); void checkTuNoResidual( unsigned idx ); -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int getTbAreaAfterCoefZeroOut(ComponentID compID) const; -#endif CoeffBuf getCoeffs(const ComponentID id); const CCoeffBuf getCoeffs(const ComponentID id) const; @@ -506,7 +487,6 @@ struct TransformUnit : public UnitArea const CPelBuf getPcmbuf(const ComponentID id) const; int getChromaAdj( ) const; void setChromaAdj(int i); -#if JVET_O0119_BASE_PALETTE_444 PelBuf getcurPLTIdx(const ComponentID id); const CPelBuf getcurPLTIdx(const ComponentID id) const; PelBuf getrunLength(const ComponentID id); @@ -518,7 +498,6 @@ struct TransformUnit : public UnitArea Pel* getPLTIndex(const ComponentID id); Pel* getRunLens(const ComponentID id); bool* getRunTypes(const ComponentID id); -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM int64_t cacheId; @@ -528,10 +507,8 @@ struct TransformUnit : public UnitArea private: TCoeff *m_coeffs[ MAX_NUM_TBLOCKS ]; Pel *m_pcmbuf[ MAX_NUM_TBLOCKS ]; -#if JVET_O0119_BASE_PALETTE_444 bool *m_runType[MAX_NUM_TBLOCKS]; Pel *m_runLength[MAX_NUM_TBLOCKS]; -#endif }; // --------------------------------------------------------------------------- diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index 83df220313c52c228d714631eef9c485e6ba0e73..0d34265b8d2de223766fcfa2108040a296cc8c19 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -55,9 +55,7 @@ PartLevel::PartLevel() , canQtSplit ( true ) , qgEnable ( true ) , qgChromaEnable ( true ) -#if JVET_O0050_LOCAL_DUAL_TREE , modeType ( MODE_TYPE_ALL ) -#endif { } @@ -72,9 +70,7 @@ PartLevel::PartLevel( const PartSplit _split, const Partitioning& _parts ) , canQtSplit ( true ) , qgEnable ( true ) , qgChromaEnable ( true ) -#if JVET_O0050_LOCAL_DUAL_TREE , modeType ( MODE_TYPE_ALL ) -#endif { } @@ -89,9 +85,7 @@ PartLevel::PartLevel( const PartSplit _split, Partitioning&& _parts ) , canQtSplit ( true ) , qgEnable ( true ) , qgChromaEnable ( true ) -#if JVET_O0050_LOCAL_DUAL_TREE , modeType ( MODE_TYPE_ALL ) -#endif { } @@ -115,7 +109,6 @@ SplitSeries Partitioner::getSplitSeries() const return splitSeries; } -#if JVET_O0050_LOCAL_DUAL_TREE ModeTypeSeries Partitioner::getModeTypeSeries() const { ModeTypeSeries modeTypeSeries = 0; @@ -136,7 +129,6 @@ bool Partitioner::isSepTree( const CodingStructure &cs ) { return treeType != TREE_D || CS::isDualITree( cs ); } -#endif void Partitioner::setCUData( CodingUnit& cu ) { @@ -145,9 +137,7 @@ void Partitioner::setCUData( CodingUnit& cu ) cu.mtDepth = currMtDepth; cu.qtDepth = currQtDepth; cu.splitSeries = getSplitSeries(); -#if JVET_O0050_LOCAL_DUAL_TREE cu.modeTypeSeries = getModeTypeSeries(); -#endif } void Partitioner::copyState( const Partitioner& other ) @@ -269,10 +259,8 @@ void QTBTPartitioner::initCtu( const UnitArea& ctuArea, const ChannelType _chTyp m_partStack.clear(); m_partStack.push_back( PartLevel( CTU_LEVEL, Partitioning{ ctuArea } ) ); -#if JVET_O0050_LOCAL_DUAL_TREE treeType = TREE_D; modeType = MODE_TYPE_ALL; -#endif } void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructure& cs ) @@ -288,23 +276,17 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur { case CU_QUAD_SPLIT: m_partStack.push_back( PartLevel( split, PartitionerImpl::getCUSubPartitions( currArea(), cs ) ) ); -#if JVET_O0050_LOCAL_DUAL_TREE m_partStack.back().modeType = modeType; -#endif break; case CU_HORZ_SPLIT: case CU_VERT_SPLIT: m_partStack.push_back( PartLevel( split, PartitionerImpl::getCUSubPartitions( currArea(), cs, split ) ) ); -#if JVET_O0050_LOCAL_DUAL_TREE m_partStack.back().modeType = modeType; -#endif break; case CU_TRIH_SPLIT: case CU_TRIV_SPLIT: m_partStack.push_back( PartLevel( split, PartitionerImpl::getCUSubPartitions( currArea(), cs, split ) ) ); -#if JVET_O0050_LOCAL_DUAL_TREE m_partStack.back().modeType = modeType; -#endif break; case TU_MAX_TR_SPLIT: m_partStack.push_back( PartLevel( split, PartitionerImpl::getMaxTuTiling( currArea(), cs ) ) ); @@ -402,13 +384,11 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca if( lastSplit != CTU_LEVEL && lastSplit != CU_QUAD_SPLIT ) canQt = false; if( area.width <= minQtSize ) canQt = false; if( chType == CHANNEL_TYPE_CHROMA && areaC.width <= MIN_DUALTREE_CHROMA_WIDTH ) canQt = false; -#if JVET_O0050_LOCAL_DUAL_TREE if( treeType == TREE_C ) { canQt = canBh = canTh = canBv = canTv = false; return; } -#endif if( implicitSplit != CU_DONT_SPLIT ) { canNo = canTh = canTv = false; @@ -468,11 +448,7 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs ) { const CompArea area = currArea().Y(); -#if MAX_TB_SIZE_SIGNALLING const unsigned maxTrSize = cs.sps->getMaxTbSize(); -#else - const unsigned maxTrSize = MAX_TB_SIZEY; -#endif bool canNo, canQt, canBh, canTh, canBv, canTv; @@ -980,11 +956,7 @@ void PartitionerImpl::getTUIntraSubPartitions( Partitioning &sub, const UnitArea uint32_t nPartitions; uint32_t splitDimensionSize = CU::getISPSplitDim( tuArea.lumaSize().width, tuArea.lumaSize().height, splitType ); -#if JVET_O0050_LOCAL_DUAL_TREE bool isDualTree = CS::isDualITree( cs ) || cs.treeType != TREE_D; -#else - bool isDualTree = CS::isDualITree( cs ); -#endif if( splitType == TU_1D_HORZ_SPLIT ) { @@ -1054,15 +1026,9 @@ static const int g_zScanToY[1 << ( g_maxRtGridSize << 1 )] = 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3, 4, 4, 5, 5, 4, 4, 5, 5, -#if JVET_O0545_MAX_TB_SIGNALLING 6, 6, 7, 7, 6, 6, 7, 7, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, -#else - 6, 6, 7, 7, 6, 5, 7, 7, - 4, 4, 5, 5, 4, 4, 5, 5, - 6, 6, 7, 7, 6, 5, 7, 7, -#endif }; static const int g_rsScanToZ[1 << ( g_maxRtGridSize << 1 )] = { @@ -1080,17 +1046,8 @@ Partitioning PartitionerImpl::getMaxTuTiling( const UnitArea &cuArea, const Codi { static_assert( MAX_LOG2_DIFF_CU_TR_SIZE <= g_maxRtGridSize, "Z-scan tables are only provided for MAX_LOG2_DIFF_CU_TR_SIZE for up to 3 (8x8 tiling)!" ); -#if JVET_O0545_MAX_TB_SIGNALLING const Size area = cuArea.lumaSize(); const int maxTrSize = (area.width>64 || area.height>64) ? 64 : cs.sps->getMaxTbSize(); -#else - const CompArea area = cuArea.Y().valid() ? cuArea.Y() : cuArea.Cb(); -#if MAX_TB_SIZE_SIGNALLING - const int maxTrSize = cs.sps->getMaxTbSize() >> ( isLuma( area.compID ) ? 0 : 1 ); -#else - const int maxTrSize = MAX_TB_SIZEY >> ( isLuma( area.compID ) ? 0 : 1 ); -#endif -#endif const int numTilesH = std::max<int>( 1, area.width / maxTrSize ); const int numTilesV = std::max<int>( 1, area.height / maxTrSize ); const int numTiles = numTilesH * numTilesV; diff --git a/source/Lib/CommonLib/UnitPartitioner.h b/source/Lib/CommonLib/UnitPartitioner.h index b83043d768d1a7edb0955987e77daf6395cd073a..64fbdd08cdb80f5be3ee80211a7b7379d785587d 100644 --- a/source/Lib/CommonLib/UnitPartitioner.h +++ b/source/Lib/CommonLib/UnitPartitioner.h @@ -94,9 +94,7 @@ struct PartLevel bool canQtSplit; bool qgEnable; bool qgChromaEnable; -#if JVET_O0050_LOCAL_DUAL_TREE int modeType; -#endif PartLevel(); PartLevel( const PartSplit _split, const Partitioning& _parts ); @@ -126,10 +124,8 @@ public: unsigned currImplicitBtDepth; ChannelType chType; -#if JVET_O0050_LOCAL_DUAL_TREE TreeType treeType; ModeType modeType; -#endif virtual ~Partitioner () { } @@ -141,9 +137,7 @@ public: const bool currQgChromaEnable () const { return currPartLevel().qgChromaEnable; } SplitSeries getSplitSeries () const; -#if JVET_O0050_LOCAL_DUAL_TREE ModeTypeSeries getModeTypeSeries () const; -#endif virtual void initCtu ( const UnitArea& ctuArea, const ChannelType _chType, const Slice& slice ) = 0; virtual void splitCurrArea ( const PartSplit split, const CodingStructure &cs ) = 0; @@ -160,11 +154,9 @@ public: virtual bool canSplit ( const PartSplit split, const CodingStructure &cs ) = 0; virtual bool isSplitImplicit ( const PartSplit split, const CodingStructure &cs ) = 0; virtual PartSplit getImplicitSplit ( const CodingStructure &cs ) = 0; -#if JVET_O0050_LOCAL_DUAL_TREE bool isSepTree ( const CodingStructure &cs ); bool isConsInter () { return modeType == MODE_TYPE_INTER; } bool isConsIntra () { return modeType == MODE_TYPE_INTRA; } -#endif }; class AdaptiveDepthPartitioner : public Partitioner @@ -205,10 +197,8 @@ public: #if _DEBUG m_currArea = _initialState.currArea(); #endif -#if JVET_O0050_LOCAL_DUAL_TREE treeType = _initialState.treeType; modeType = _initialState.modeType; -#endif } void initCtu (const UnitArea& ctuArea, const ChannelType chType, const Slice& slice) {}; // not needed diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index e1c5cc8490976d089da2c38bc039cbdaa054db28..5b7f6a6a0cee3d99712f7ec8417b6f22ee26f39b 100755 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -63,11 +63,7 @@ bool CS::isDualITree( const CodingStructure &cs ) UnitArea CS::getArea( const CodingStructure &cs, const UnitArea &area, const ChannelType chType ) { -#if JVET_O0050_LOCAL_DUAL_TREE return isDualITree( cs ) || cs.treeType != TREE_D ? area.singleChan( chType ) : area; -#else - return isDualITree( cs ) ? area.singleChan( chType ) : area; -#endif } void CS::setRefinedMotionField(CodingStructure &cs) { @@ -104,29 +100,20 @@ void CS::setRefinedMotionField(CodingStructure &cs) } // CU tools -#if JVET_O1164_RPR bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int& xScale, int& yScale ) { -#if RPR_CONF_WINDOW const Window& curConfWindow = curPPS->getConformanceWindow(); int curPicWidth = curPPS->getPicWidthInLumaSamples() - (curConfWindow.getWindowLeftOffset() + curConfWindow.getWindowRightOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); int curPicHeight = curPPS->getPicHeightInLumaSamples() - (curConfWindow.getWindowTopOffset() + curConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); const Window& refConfWindow = refPic->getConformanceWindow(); int refPicWidth = refPic->getPicWidthInLumaSamples() - (refConfWindow.getWindowLeftOffset() + refConfWindow.getWindowRightOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); int refPicHeight = refPic->getPicHeightInLumaSamples() - (refConfWindow.getWindowTopOffset() + refConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps->getChromaFormatIdc()); -#else - int curPicWidth = curPPS->getPicWidthInLumaSamples(); - int curPicHeight = curPPS->getPicHeightInLumaSamples(); - int refPicWidth = refPic->getPicWidthInLumaSamples(); - int refPicHeight = refPic->getPicHeightInLumaSamples(); -#endif xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; return refPicWidth != curPicWidth || refPicHeight != curPicHeight; } -#endif bool CU::isIntra(const CodingUnit &cu) { @@ -143,12 +130,10 @@ bool CU::isIBC(const CodingUnit &cu) return cu.predMode == MODE_IBC; } -#if JVET_O0119_BASE_PALETTE_444 bool CU::isPLT(const CodingUnit &cu) { return cu.predMode == MODE_PLT; } -#endif bool CU::isRDPCMEnabled(const CodingUnit& cu) { @@ -199,23 +184,11 @@ bool CU::isSameCtu(const CodingUnit& cu, const CodingUnit& cu2) bool CU::isLastSubCUOfCtu( const CodingUnit &cu ) { -#if !JVET_O1164_PS - const SPS &sps = *cu.cs->sps; -#endif -#if JVET_O0050_LOCAL_DUAL_TREE const Area cuAreaY = cu.isSepTree() ? 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() ) ) : (const Area&)cu.Y(); -#else - const Area cuAreaY = CS::isDualITree( *cu.cs ) ? 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() ) ) : ( const Area& ) cu.Y(); -#endif -#if JVET_O1164_PS return ( ( ( ( cuAreaY.x + cuAreaY.width ) & cu.cs->pcv->maxCUWidthMask ) == 0 || cuAreaY.x + cuAreaY.width == cu.cs->pps->getPicWidthInLumaSamples() ) && ( ( ( cuAreaY.y + cuAreaY.height ) & cu.cs->pcv->maxCUHeightMask ) == 0 || cuAreaY.y + cuAreaY.height == cu.cs->pps->getPicHeightInLumaSamples() ) ); -#else - return ( ( ( ( cuAreaY.x + cuAreaY.width ) & cu.cs->pcv->maxCUWidthMask ) == 0 || cuAreaY.x + cuAreaY.width == sps.getPicWidthInLumaSamples() ) && - ( ( ( cuAreaY.y + cuAreaY.height ) & cu.cs->pcv->maxCUHeightMask ) == 0 || cuAreaY.y + cuAreaY.height == sps.getPicHeightInLumaSamples() ) ); -#endif } uint32_t CU::getCtuAddr( const CodingUnit &cu ) @@ -277,40 +250,14 @@ PartSplit CU::getSplitAtDepth( const CodingUnit& cu, const unsigned depth ) else { THROW( "Unknown split mode" ); return CU_QUAD_SPLIT; } } -#if JVET_O0050_LOCAL_DUAL_TREE ModeType CU::getModeTypeAtDepth( const CodingUnit& cu, const unsigned depth ) { ModeType modeType = ModeType( (cu.modeTypeSeries >> (depth * 3)) & 0x07 ); CHECK( depth > cu.depth, " depth is wrong" ); return modeType; } -#endif -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS -uint32_t CU::getNumNonZeroCoeffNonTs( const CodingUnit& cu, const bool lumaFlag, const bool chromaFlag ) -{ - uint32_t count = 0; - for( auto &currTU : traverseTUs( cu ) ) - { - count += TU::getNumNonZeroCoeffsNonTS( currTU, lumaFlag, chromaFlag ); - } - return count; -} -#endif - -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS -uint32_t CU::getNumNonZeroCoeffNonTsCorner8x8( const CodingUnit& cu, const bool lumaFlag, const bool chromaFlag ) -{ - uint32_t count = 0; - for( auto &currTU : traverseTUs( cu ) ) - { - count += TU::getNumNonZeroCoeffsNonTSCorner8x8( currTU, lumaFlag, chromaFlag ); - } - - return count; -} -#endif bool CU::divideTuInRows( const CodingUnit &cu ) { @@ -318,77 +265,6 @@ bool CU::divideTuInRows( const CodingUnit &cu ) return cu.ispMode == HOR_INTRA_SUBPARTITIONS ? true : false; } -#if !JVET_O0502_ISP_CLEANUP -bool CU::firstTestISPHorSplit( const int width, const int height, const ComponentID compID, const CodingUnit *cuLeft, const CodingUnit *cuAbove ) -{ - //this function decides which split mode (horizontal or vertical) is tested first (encoder only) - //we check the logarithmic aspect ratios of the block - int aspectRatio = floorLog2(width) - floorLog2(height); - if( aspectRatio > 0 ) - { - return true; - } - else if( aspectRatio < 0 ) - { - return false; - } - else //if (aspectRatio == 0) - { - //we gather data from the neighboring CUs - const int cuLeftWidth = cuLeft != nullptr ? cuLeft->blocks[compID].width : -1; - const int cuLeftHeight = cuLeft != nullptr ? cuLeft->blocks[compID].height : -1; - const int cuAboveWidth = cuAbove != nullptr ? cuAbove->blocks[compID].width : -1; - const int cuAboveHeight = cuAbove != nullptr ? cuAbove->blocks[compID].height : -1; - const int cuLeft1dSplit = cuLeft != nullptr && cuLeft->predMode == MODE_INTRA ? cuLeft->ispMode : 0; - const int cuAbove1dSplit = cuAbove != nullptr && cuAbove->predMode == MODE_INTRA ? cuAbove->ispMode : 0; - if( cuLeftWidth != -1 && cuAboveWidth == -1 ) - { - int cuLeftAspectRatio = floorLog2(cuLeftWidth) - floorLog2(cuLeftHeight); - return cuLeftAspectRatio < 0 ? false : cuLeftAspectRatio > 0 ? true : cuLeft1dSplit == VER_INTRA_SUBPARTITIONS ? false : true; - } - else if( cuLeftWidth == -1 && cuAboveWidth != -1 ) - { - int cuAboveAspectRatio = floorLog2(cuAboveWidth) - floorLog2(cuAboveHeight); - return cuAboveAspectRatio < 0 ? false : cuAboveAspectRatio > 0 ? true : cuAbove1dSplit == VER_INTRA_SUBPARTITIONS ? false : true; - } - else if( cuLeftWidth != -1 && cuAboveWidth != -1 ) - { - int cuLeftAspectRatio = floorLog2(cuLeftWidth) - floorLog2(cuLeftHeight); - int cuAboveAspectRatio = floorLog2(cuAboveWidth) - floorLog2(cuAboveHeight); - if( cuLeftAspectRatio < 0 && cuAboveAspectRatio < 0 ) - { - return false; - } - else if( cuLeftAspectRatio > 0 && cuAboveAspectRatio > 0 ) - { - return true; - } - else if( cuLeftAspectRatio == 0 && cuAboveAspectRatio == 0 ) - { - if( cuLeft1dSplit != 0 && cuAbove1dSplit != 0 ) - { - return cuLeft1dSplit == VER_INTRA_SUBPARTITIONS && cuAbove1dSplit == VER_INTRA_SUBPARTITIONS ? false : true; - } - else if( cuLeft1dSplit != 0 && cuAbove1dSplit == 0 ) - { - return cuLeft1dSplit == VER_INTRA_SUBPARTITIONS ? false : true; - } - else if( cuLeft1dSplit == 0 && cuAbove1dSplit != 0 ) - { - return cuAbove1dSplit == VER_INTRA_SUBPARTITIONS ? false : true; - } - return true; - } - else - { - return cuLeftAspectRatio > cuAboveAspectRatio ? cuLeftAspectRatio > 0 : cuAboveAspectRatio > 0; - } - //return true; - } - return true; - } -} -#endif PartSplit CU::getISPType( const CodingUnit &cu, const ComponentID compID ) { @@ -427,11 +303,7 @@ bool CU::canUseISP( const CodingUnit &cu, const ComponentID compID ) { const int width = cu.blocks[compID].width; const int height = cu.blocks[compID].height; -#if MAX_TB_SIZE_SIGNALLING const int maxTrSize = cu.cs->sps->getMaxTbSize(); -#else - const int maxTrSize = MAX_TB_SIZEY; -#endif return CU::canUseISP( width, height, maxTrSize ); } @@ -470,7 +342,6 @@ uint32_t CU::getISPSplitDim( const int width, const int height, const PartSplit return partitionSize; } -#if JVET_O0502_ISP_CLEANUP bool CU::allLumaCBFsAreZero(const CodingUnit& cu) { if (!cu.ispMode) @@ -492,7 +363,6 @@ bool CU::allLumaCBFsAreZero(const CodingUnit& cu) return true; } } -#endif PUTraverser CU::traversePUs( CodingUnit& cu ) @@ -565,13 +435,8 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType mpm[1] = leftIntraDir; mpm[2] = ((leftIntraDir + offset) % mod) + 2; mpm[3] = ((leftIntraDir - 1) % mod) + 2; -#if JVET_O0925_MIP_SIMPLIFICATIONS mpm[4] = ((leftIntraDir + offset - 1) % mod) + 2; mpm[5] = ( leftIntraDir % mod) + 2; -#else - mpm[4] = DC_IDX; - mpm[5] = ((leftIntraDir + offset - 1) % mod) + 2; -#endif } } else //L!=A @@ -586,7 +451,6 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType mpm[2] = aboveIntraDir; maxCandModeIdx = mpm[1] > mpm[2] ? 1 : 2; int minCandModeIdx = mpm[1] > mpm[2] ? 2 : 1; -#if JVET_O0925_MIP_SIMPLIFICATIONS if (mpm[maxCandModeIdx] - mpm[minCandModeIdx] == 1) { mpm[3] = ((mpm[minCandModeIdx] + offset) % mod) + 2; @@ -611,36 +475,16 @@ int PU::getIntraMPMs( const PredictionUnit &pu, unsigned* mpm, const ChannelType mpm[4] = ((mpm[minCandModeIdx] - 1) % mod) + 2; mpm[5] = ((mpm[maxCandModeIdx] + offset) % mod) + 2; } -#else - mpm[3] = DC_IDX; - if ((mpm[maxCandModeIdx] - mpm[minCandModeIdx] < 63) && (mpm[maxCandModeIdx] - mpm[minCandModeIdx] > 1)) - { - mpm[4] = ((mpm[maxCandModeIdx] + offset) % mod) + 2; - mpm[5] = ((mpm[maxCandModeIdx] - 1) % mod) + 2; - } - else - { - mpm[4] = ((mpm[maxCandModeIdx] + offset - 1) % mod) + 2; - mpm[5] = ((mpm[maxCandModeIdx]) % mod) + 2; - } -#endif } else if (leftIntraDir + aboveIntraDir >= 2) { mpm[0] = PLANAR_IDX; mpm[1] = (leftIntraDir < aboveIntraDir) ? aboveIntraDir : leftIntraDir; maxCandModeIdx = 1; -#if JVET_O0925_MIP_SIMPLIFICATIONS mpm[2] = ((mpm[maxCandModeIdx] + offset) % mod) + 2; mpm[3] = ((mpm[maxCandModeIdx] - 1) % mod) + 2; mpm[4] = ((mpm[maxCandModeIdx] + offset - 1) % mod) + 2; mpm[5] = ( mpm[maxCandModeIdx] % mod) + 2; -#else - mpm[2] = DC_IDX; - mpm[3] = ((mpm[maxCandModeIdx] + offset) % mod) + 2; - mpm[4] = ((mpm[maxCandModeIdx] - 1) % mod) + 2; - mpm[5] = ((mpm[maxCandModeIdx] + offset - 1) % mod) + 2; -#endif } } } @@ -658,152 +502,12 @@ bool PU::isMIP(const PredictionUnit &pu, const ChannelType &chType) return (chType == CHANNEL_TYPE_LUMA && pu.cu->mipFlag); } -#if !JVET_O0925_MIP_SIMPLIFICATIONS -int PU::getMipSizeId(const PredictionUnit &pu) -{ - if ((pu.lwidth() == 4) && (pu.lheight() == 4)) - { - return 0; // MIP with 16x4 matrix - } - else if (pu.lwidth() <= 8 && pu.lheight() <= 8) - { - return 1; // MIP with 16x8 matrix - } - else - { - return 2; // MIP with 64x8 matrix - } -} - -int PU::getMipMPMs(const PredictionUnit &pu, unsigned *mpm) -{ - const CompArea &area = pu.block( getFirstComponentOfChannel( CHANNEL_TYPE_LUMA ) ); - const Position &pos = area.pos(); - - bool realMode = false; - - // Get intra mode of left PU - int leftIntraMode = -1; - const PredictionUnit *puLeft = pu.cs->getPURestricted( pos.offset( -1, 0 ), pu, CHANNEL_TYPE_LUMA ); - - if( puLeft && CU::isIntra( *puLeft->cu ) ) - { - if( PU::isMIP( *puLeft ) ) - { - if (getMipSizeId(*puLeft) == getMipSizeId(pu)) - { - leftIntraMode = puLeft->intraDir[CHANNEL_TYPE_LUMA]; - realMode = true; - } - } - else - { - leftIntraMode = g_mapAngular33ToMip[getMipSizeId(pu)][g_intraMode65to33AngMapping[puLeft->intraDir[CHANNEL_TYPE_LUMA]]]; - } - } - - // Get intra mode of above PU - int aboveIntraMode = -1; - const PredictionUnit *puAbove = pu.cs->getPURestricted( pos.offset( 0, -1 ), pu, CHANNEL_TYPE_LUMA ); - - if( puAbove && CU::isIntra( *puAbove->cu ) && CU::isSameCtu(*pu.cu, *puAbove->cu) ) - { - if( PU::isMIP( *puAbove ) ) - { - if (getMipSizeId(*puAbove) == getMipSizeId(pu)) - { - aboveIntraMode = puAbove->intraDir[CHANNEL_TYPE_LUMA]; - realMode = true; - } - } - else - { - aboveIntraMode = g_mapAngular33ToMip[getMipSizeId(pu)][g_intraMode65to33AngMapping[puAbove->intraDir[CHANNEL_TYPE_LUMA]]]; - } - } - - // derive MPMs - CHECKD(NUM_MPM_MIP != 3, "Error: wrong number of MPMs for MIP"); - - const int* modeList = g_sortedMipMpms[getMipSizeId(pu)]; - - int numCand = 0; - if( leftIntraMode == aboveIntraMode ) - { - if( leftIntraMode > -1 ) - { - mpm[0] = leftIntraMode; - numCand = 1; - - if( leftIntraMode != modeList[0] ) - { - mpm[1] = modeList[0]; - mpm[2] = (leftIntraMode != modeList[1]) ? modeList[1] : modeList[2]; - } - else - { - mpm[1] = modeList[1]; - mpm[2] = modeList[2]; - } - } - else - { - mpm[0] = modeList[0]; - mpm[1] = modeList[1]; - mpm[2] = modeList[2]; - } - } - else - { - if( leftIntraMode > -1 && aboveIntraMode > -1 ) - { - mpm[0] = leftIntraMode; - mpm[1] = aboveIntraMode; - numCand = 2; - - int index = 0; - for( int i = 0; i < 3; i++ ) - { - if( (leftIntraMode != modeList[i]) && (aboveIntraMode != modeList[i]) ) - { - index = i; - break; - } - } - CHECK( index > 2, "Error" ); - mpm[2] = modeList[index]; - } - else - { - mpm[0] = leftIntraMode > -1 ? leftIntraMode : aboveIntraMode; - numCand = 1; - - if( mpm[0] != modeList[0] ) - { - mpm[1] = modeList[0]; - mpm[2] = (mpm[0] != modeList[1]) ? modeList[1] : modeList[2]; - } - else - { - mpm[1] = modeList[1]; - mpm[2] = modeList[2]; - } - } - } - - return (realMode ? numCand : 0); -} -#endif uint32_t PU::getIntraDirLuma( const PredictionUnit &pu ) { if (isMIP(pu)) { -#if JVET_O0925_MIP_SIMPLIFICATIONS return PLANAR_IDX; -#else - return g_mapMipToAngular65[getMipSizeId(pu)][pu.intraDir[CHANNEL_TYPE_LUMA]]; -#endif } else { @@ -811,43 +515,6 @@ uint32_t PU::getIntraDirLuma( const PredictionUnit &pu ) } } -#if !JVET_O0925_MIP_SIMPLIFICATIONS -AvailableInfo PU::getAvailableInfoLuma(const PredictionUnit &pu) -{ - const Area puArea = pu.Y(); - const CodingStructure &cs = *pu.cs; - CHECK(cs.pps->getConstrainedIntraPred(), "Error: constrained intra prediction not supported"); - - AvailableInfo availInfo(0, 0); - - // above - const int unitWidth = cs.pcv->minCUWidth; - const int numAboveUnits = (puArea.width + (unitWidth - 1)) / unitWidth; - for (int uX = 0; uX < numAboveUnits; uX++) - { - const Position topPos = puArea.offset(availInfo.maxPosTop, -1); - const CodingUnit* pcCUAbove = cs.isDecomp(topPos, CHANNEL_TYPE_LUMA) ? cs.getCURestricted(topPos, *(pu.cu), CHANNEL_TYPE_LUMA) : nullptr; - if (!pcCUAbove) { break; } - - availInfo.maxPosTop += unitWidth; - } - - // left - const int unitHeight = cs.pcv->minCUHeight; - const int numLeftUnits = (puArea.height + (unitHeight - 1)) / unitHeight; - for (int uY = 0; uY < numLeftUnits; uY++) - { - const Position leftPos = puArea.offset(-1, availInfo.maxPosLeft); - const CodingUnit* pcCULeft = cs.isDecomp(leftPos, CHANNEL_TYPE_LUMA) ? cs.getCURestricted(leftPos, *(pu.cu), CHANNEL_TYPE_LUMA) : nullptr; - if (!pcCULeft) { break; } - - availInfo.maxPosLeft += unitHeight; - } - - CHECKD(availInfo.maxPosTop > puArea.width || availInfo.maxPosLeft > puArea.height, "Error"); - return availInfo; -} -#endif void PU::getIntraChromaCandModes( const PredictionUnit &pu, unsigned modeList[NUM_CHROMA_MODE] ) { @@ -861,18 +528,7 @@ void PU::getIntraChromaCandModes( const PredictionUnit &pu, unsigned modeList[NU modeList[6] = MDLM_T_IDX; modeList[7] = DM_CHROMA_IDX; -#if JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE const uint32_t lumaMode = getCoLocatedIntraLumaMode(pu); -#else - 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 ); -#if JVET_O0050_LOCAL_DUAL_TREE - const PredictionUnit *lumaPU = pu.cu->isSepTree() ? pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : &pu; -#else - const PredictionUnit *lumaPU = CS::isDualITree( *pu.cs ) ? pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : &pu; -#endif - const uint32_t lumaMode = PU::getIntraDirLuma( *lumaPU ); -#endif for( int i = 0; i < 4; i++ ) { if( lumaMode == modeList[i] ) @@ -891,18 +547,13 @@ bool PU::isLMCMode(unsigned mode) bool PU::isLMCModeEnabled(const PredictionUnit &pu, unsigned mode) { -#if JVET_O1124_ALLOW_CCLM_COND if ( pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed() ) -#else - if ( pu.cs->sps->getUseLMChroma() ) -#endif { return true; } return false; } -#if JVET_O1153_INTRA_CHROMAMODE_CODING int PU::getLMSymbolList(const PredictionUnit &pu, int *modeList) { int idx = 0; @@ -912,18 +563,6 @@ int PU::getLMSymbolList(const PredictionUnit &pu, int *modeList) modeList[idx++] = MDLM_T_IDX; return idx; } -#else -int PU::getLMSymbolList(const PredictionUnit &pu, int *modeList) -{ - int idx = 0; - - modeList[idx++] = LM_CHROMA_IDX; - modeList[idx++] = -1; - modeList[idx++] = MDLM_L_IDX; - modeList[idx++] = MDLM_T_IDX; - return idx; -} -#endif bool PU::isChromaIntraModeCrossCheckMode( const PredictionUnit &pu ) { @@ -936,19 +575,7 @@ uint32_t PU::getFinalIntraMode( const PredictionUnit &pu, const ChannelType &chT if( uiIntraMode == DM_CHROMA_IDX && !isLuma( chType ) ) { -#if JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE uiIntraMode = getCoLocatedIntraLumaMode(pu); -#else - 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 ); -#if JVET_O0050_LOCAL_DUAL_TREE - const PredictionUnit &lumaPU = pu.cu->isSepTree() ? *pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : *pu.cs->getPU( topLeftPos, CHANNEL_TYPE_LUMA ); -#else - const PredictionUnit &lumaPU = CS::isDualITree( *pu.cs ) ? *pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : *pu.cs->getPU( topLeftPos, CHANNEL_TYPE_LUMA ); -#endif - - uiIntraMode = PU::getIntraDirLuma( lumaPU ); -#endif } if( pu.chromaFormat == CHROMA_422 && !isLuma( chType ) && uiIntraMode < NUM_LUMA_MODE ) // map directional, planar and dc { @@ -957,20 +584,14 @@ uint32_t PU::getFinalIntraMode( const PredictionUnit &pu, const ChannelType &chT return uiIntraMode; } -#if JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE uint32_t PU::getCoLocatedIntraLumaMode( const PredictionUnit &pu ) { 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 ); -#if JVET_O0050_LOCAL_DUAL_TREE const PredictionUnit &lumaPU = pu.cu->isSepTree() ? *pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : *pu.cs->getPU( topLeftPos, CHANNEL_TYPE_LUMA ); -#else - const PredictionUnit &lumaPU = CS::isDualITree( *pu.cs ) ? *pu.cs->picture->cs->getPU( refPos, CHANNEL_TYPE_LUMA ) : *pu.cs->getPU( topLeftPos, CHANNEL_TYPE_LUMA ); -#endif return PU::getIntraDirLuma( lumaPU ); } -#endif int PU::getWideAngIntraMode( const TransformUnit &tu, const uint32_t dirMode, const ComponentID compID ) { @@ -1042,16 +663,10 @@ bool PU::xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const return false; } -#if JVET_L0090_PAIR_AVG bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos , bool ibcFlag , bool isShared ) -#else -bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCandInter[MRG_MAX_NUM_CANDS], bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos - , int mmvdList -) -#endif { const Slice& slice = *cs.slice; MotionInfo miNeighbor; @@ -1061,11 +676,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa { hasPruned[subPuMvpPos] = true; } -#if JVET_O0078_SINGLE_HMVPLUT auto &lut = ibcFlag ? cs.motionLut.lutIbc : cs.motionLut.lut; -#else - auto &lut = ibcFlag ? ( isShared ? cs.motionLut.lutShareIbc : cs.motionLut.lutIbc ) : cs.motionLut.lut; -#endif int num_avai_candInLUT = (int) lut.size(); for (int mrgIdx = 1; mrgIdx <= num_avai_candInLUT; mrgIdx++) @@ -1073,18 +684,13 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa miNeighbor = lut[num_avai_candInLUT - mrgIdx]; mrgCtx.interDirNeighbours[cnt] = miNeighbor.interDir; mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miNeighbor.mv[0], miNeighbor.refIdx[0]); -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = !ibcFlag && miNeighbor.useAltHpelIf; -#endif if (slice.isInterB()) { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]); } if (mrgIdx > 2 || (mrgIdx > 1 && ibcFlag) || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) { -#if !JVET_L0090_PAIR_AVG - isCandInter[cnt] = true; -#endif mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? miNeighbor.GBiIdx : GBI_DEFAULT; if (mrgCandIdx == cnt && canFastExit) { @@ -1097,12 +703,10 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa } } } -#if JVET_O0057_ALTHPELIF if (cnt < maxNumMergeCandMin1) { mrgCtx.useAltHpelIf[cnt] = false; } -#endif return false; } @@ -1110,11 +714,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const { const CodingStructure &cs = *pu.cs; const Slice &slice = *pu.cs->slice; -#if JVET_O0455_IBC_MAX_MERGE_NUM const uint32_t maxNumMergeCand = slice.getMaxNumIBCMergeCand(); -#else - const uint32_t maxNumMergeCand = slice.getMaxNumMergeCand(); -#endif const bool canFastExit = pu.cs->pps->getLog2ParallelMergeLevelMinus2() == 0; for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui) @@ -1124,9 +724,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const mrgCtx.mrgTypeNeighbours[ui] = MRG_TYPE_IBC; mrgCtx.mvFieldNeighbours[ui * 2].refIdx = NOT_VALID; mrgCtx.mvFieldNeighbours[ui * 2 + 1].refIdx = NOT_VALID; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[ui] = false; -#endif } mrgCtx.numValidMergeCand = maxNumMergeCand; @@ -1203,7 +801,6 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const bool isShared = ((pu.Y().lumaSize().width != pu.shareParentSize.width) || (pu.Y().lumaSize().height != pu.shareParentSize.height)); -#if JVET_L0090_PAIR_AVG bool bFound = addMergeHMVPCand(cs, mrgCtx, canFastExit , mrgCandIdx , maxNumMergeCandMin1, cnt @@ -1212,12 +809,6 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const , true , isShared ); -#else - bool bFound = addMergeHMVPCand(slice, mrgCtx, isCandInter, canFastExit - , mrgCandIdx - , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos - ); -#endif if (bFound) { return; @@ -1249,24 +840,15 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, const uint32_t maxNumMergeCand = slice.getMaxNumMergeCand(); const bool canFastExit = pu.cs->pps->getLog2ParallelMergeLevelMinus2() == 0; -#if !JVET_L0090_PAIR_AVG - // this variable is unused if remove HEVC combined candidates - bool isCandInter[MRG_MAX_NUM_CANDS]; -#endif for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui) { -#if !JVET_L0090_PAIR_AVG - isCandInter[ui] = false; -#endif mrgCtx.GBiIdx[ui] = GBI_DEFAULT; mrgCtx.interDirNeighbours[ui] = 0; mrgCtx.mrgTypeNeighbours [ui] = MRG_TYPE_DEFAULT_N; mrgCtx.mvFieldNeighbours[(ui << 1) ].refIdx = NOT_VALID; mrgCtx.mvFieldNeighbours[(ui << 1) + 1].refIdx = NOT_VALID; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[ui] = false; -#endif } mrgCtx.numValidMergeCand = maxNumMergeCand; @@ -1288,15 +870,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { miLeft = puLeft->getMotionInfo( posLB.offset(-1, 0) ); -#if !JVET_L0090_PAIR_AVG - isCandInter[cnt] = true; -#endif // get Inter Dir mrgCtx.interDirNeighbours[cnt] = miLeft.interDir; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = miLeft.useAltHpelIf; -#endif mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puLeft->cu->GBiIdx : GBI_DEFAULT; // get Mv from Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miLeft.mv[0], miLeft.refIdx[0]); @@ -1331,15 +908,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if( !isAvailableA1 || ( miAbove != miLeft ) ) { -#if !JVET_L0090_PAIR_AVG - isCandInter[cnt] = true; -#endif // get Inter Dir mrgCtx.interDirNeighbours[cnt] = miAbove.interDir; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = miAbove.useAltHpelIf; -#endif // get Mv from Above mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAbove->cu->GBiIdx : GBI_DEFAULT; mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); @@ -1376,15 +948,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if( !isAvailableB1 || ( miAbove != miAboveRight ) ) { -#if !JVET_L0090_PAIR_AVG - isCandInter[cnt] = true; -#endif // get Inter Dir mrgCtx.interDirNeighbours[cnt] = miAboveRight.interDir; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = miAboveRight.useAltHpelIf; -#endif // get Mv from Above-right mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveRight->cu->GBiIdx : GBI_DEFAULT; mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); @@ -1419,15 +986,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if( !isAvailableA1 || ( miBelowLeft != miLeft ) ) { -#if !JVET_L0090_PAIR_AVG - isCandInter[cnt] = true; -#endif // get Inter Dir mrgCtx.interDirNeighbours[cnt] = miBelowLeft.interDir; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = miBelowLeft.useAltHpelIf; -#endif mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puLeftBottom->cu->GBiIdx : GBI_DEFAULT; // get Mv from Bottom-Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); @@ -1465,15 +1027,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if( ( !isAvailableA1 || ( miLeft != miAboveLeft ) ) && ( !isAvailableB1 || ( miAbove != miAboveLeft ) ) ) { -#if !JVET_L0090_PAIR_AVG - isCandInter[cnt] = true; -#endif // get Inter Dir mrgCtx.interDirNeighbours[cnt] = miAboveLeft.interDir; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = miAboveLeft.useAltHpelIf; -#endif mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveLeft->cu->GBiIdx : GBI_DEFAULT; // get Mv from Above-Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveLeft.mv[0], miAboveLeft.refIdx[0] ); @@ -1547,13 +1104,8 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if( addTMvp ) { mrgCtx.interDirNeighbours[uiArrayAddr] = dir; -#if !JVET_L0090_PAIR_AVG - isCandInter [uiArrayAddr] = true; -#endif mrgCtx.GBiIdx[uiArrayAddr] = GBI_DEFAULT; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[uiArrayAddr] = false; -#endif if (mrgCandIdx == cnt && canFastExit) { return; @@ -1575,7 +1127,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { bool isAvailableSubPu = false; unsigned subPuMvpPos = 0; -#if JVET_L0090_PAIR_AVG bool isShared = false; bool bFound = addMergeHMVPCand(cs, mrgCtx, canFastExit , mrgCandIdx @@ -1585,20 +1136,12 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, , CU::isIBC(*pu.cu) , isShared ); -#else - bool bFound = addMergeHMVPCand(slice, mrgCtx, isCandInter, canFastExit - , (mmvdList != 0 && mrgCandIdx != -1) ? (const int)mrgCandIdxIBC : mrgCandIdx - , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos - , mmvdList - ); -#endif if (bFound) { return; } } -#if JVET_L0090_PAIR_AVG // pairwise-average candidates { @@ -1611,9 +1154,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, unsigned char interDir = 0; -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[cnt] = (mrgCtx.useAltHpelIf[0] == mrgCtx.useAltHpelIf[1]) ? mrgCtx.useAltHpelIf[0] : false; -#endif for( int refListId = 0; refListId < (slice.isInterB() ? 2 : 1); refListId++ ) { const short refIdxI = mrgCtx.mvFieldNeighbours[0 * 2 + refListId].refIdx; @@ -1665,53 +1206,8 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, return; } } -#endif uint32_t uiArrayAddr = cnt; -#if !JVET_L0090_PAIR_AVG - uint32_t uiCutoff = std::min( uiArrayAddr, 3u ); - if (slice.isInterB()) - { - static const uint32_t NUM_PRIORITY_LIST = 12; - static const uint32_t uiPriorityList0[NUM_PRIORITY_LIST] = { 0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3 }; - static const uint32_t uiPriorityList1[NUM_PRIORITY_LIST] = { 1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2 }; - - for (int idx = 0; idx < uiCutoff * (uiCutoff - 1) && uiArrayAddr != maxNumMergeCand; idx++) - { - CHECK( idx >= NUM_PRIORITY_LIST, "Invalid priority list number" ); - int i = uiPriorityList0[idx]; - int j = uiPriorityList1[idx]; - if (isCandInter[i] && isCandInter[j] && (mrgCtx.interDirNeighbours[i] & 0x1) && (mrgCtx.interDirNeighbours[j] & 0x2)) - { - isCandInter[uiArrayAddr] = true; - mrgCtx.interDirNeighbours[uiArrayAddr] = 3; - mrgCtx.GBiIdx[uiArrayAddr] = ((mrgCtx.interDirNeighbours[uiArrayAddr] == 3)) ? CU::deriveGbiIdx(mrgCtx.GBiIdx[i], mrgCtx.GBiIdx[j]) : GBI_DEFAULT; - - // get Mv from cand[i] and cand[j] - mrgCtx.mvFieldNeighbours[ uiArrayAddr << 1 ].setMvField(mrgCtx.mvFieldNeighbours[ i << 1 ].mv, mrgCtx.mvFieldNeighbours[ i << 1 ].refIdx); - mrgCtx.mvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(mrgCtx.mvFieldNeighbours[(j << 1) + 1].mv, mrgCtx.mvFieldNeighbours[(j << 1) + 1].refIdx); - - int iRefPOCL0 = slice.getRefPOC(REF_PIC_LIST_0, mrgCtx.mvFieldNeighbours[(uiArrayAddr << 1) ].refIdx); - int iRefPOCL1 = slice.getRefPOC(REF_PIC_LIST_1, mrgCtx.mvFieldNeighbours[(uiArrayAddr << 1) + 1].refIdx); - - if( iRefPOCL0 == iRefPOCL1 && mrgCtx.mvFieldNeighbours[( uiArrayAddr << 1 )].mv == mrgCtx.mvFieldNeighbours[( uiArrayAddr << 1 ) + 1].mv ) - { - isCandInter[uiArrayAddr] = false; - } - else - { - uiArrayAddr++; - } - } - } - } - - // early termination - if (uiArrayAddr == maxNumMergeCand) - { - return; - } -#endif int iNumRefIdx = slice.isInterB() ? std::min(slice.getNumRefIdx(REF_PIC_LIST_0), slice.getNumRefIdx(REF_PIC_LIST_1)) : slice.getNumRefIdx(REF_PIC_LIST_0); @@ -1719,15 +1215,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int refcnt = 0; while (uiArrayAddr < maxNumMergeCand) { -#if !JVET_L0090_PAIR_AVG - isCandInter [uiArrayAddr ] = true; -#endif mrgCtx.interDirNeighbours [uiArrayAddr ] = 1; mrgCtx.GBiIdx [uiArrayAddr ] = GBI_DEFAULT; mrgCtx.mvFieldNeighbours [uiArrayAddr << 1].setMvField(Mv(0, 0), r); -#if JVET_O0057_ALTHPELIF mrgCtx.useAltHpelIf[uiArrayAddr] = false; -#endif if (slice.isInterB()) { @@ -1762,17 +1253,11 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) int refIdx1 = pu.refIdx[REF_PIC_LIST_1]; pu.cu->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0); pu.cu->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if (pu.cs->sps->getUseDMVR() && (!pu.cs->slice->getDisBdofDmvrFlag())) -#else - if (pu.cs->sps->getUseDMVR()) -#endif { return pu.mergeFlag && pu.mergeType == MRG_TYPE_DEFAULT_N -#if JVET_O0108_DIS_DMVR_BDOF_CIIP && !pu.mhIntraFlag -#endif && !pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip @@ -1782,9 +1267,7 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) && ((pu.lheight() * pu.lwidth()) >= 128) && (pu.cu->GBiIdx == GBI_DEFAULT) && ((!wp0[COMPONENT_Y].bPresentFlag) && (!wp1[COMPONENT_Y].bPresentFlag)) -#if JVET_O1164_RPR && PU::isRefPicSameSize( pu ) -#endif ; } else @@ -1793,85 +1276,6 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) } } -#if !JVET_O1170_IBC_VIRTUAL_BUFFER -// for ibc pu validation -bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xStartInCU, int yStartInCU, int xBv, int yBv, int ctuSize) -{ - const int ctuSizeLog2 = floorLog2(ctuSize); - - int refRightX = xPos + xBv + width - 1; - int refBottomY = yPos + yBv + height - 1; - - int refLeftX = xPos + xBv; - int refTopY = yPos + yBv; - - if ((xPos + xBv) < 0) - { - return false; - } - if (refRightX >= picWidth) - { - return false; - } - - if ((yPos + yBv) < 0) - { - return false; - } - if (refBottomY >= picHeight) - { - return false; - } - if ((xBv + width) > 0 && (yBv + height) > 0) - { - return false; - } - - // cannot be in the above CTU row - if (refTopY >> ctuSizeLog2 < yPos >> ctuSizeLog2) - return false; - - // cannot be in the below CTU row - if (refBottomY >> ctuSizeLog2 > yPos >> ctuSizeLog2) - { - return false; - } - - // in the same CTU line - int numLeftCTUs = (1 << ((7 - ctuSizeLog2) << 1)) - ((ctuSizeLog2 < 7) ? 1 : 0); - if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2) - numLeftCTUs)) - { - - // in the same CTU, or left CTU - // if part of ref block is in the left CTU, some area can be referred from the not-yet updated local CTU buffer - if (((refLeftX >> ctuSizeLog2) == ((xPos >> ctuSizeLog2) - 1)) && (ctuSizeLog2 == 7)) - { - // ref block's collocated block in current CTU - const Position refPosCol = pu.Y().topLeft().offset(xBv + ctuSize, yBv); - int offset64x = (refPosCol.x >> (ctuSizeLog2 - 1)) << (ctuSizeLog2 - 1); - int offset64y = (refPosCol.y >> (ctuSizeLog2 - 1)) << (ctuSizeLog2 - 1); - const Position refPosCol64x64 = {offset64x, offset64y}; - if (pu.cs->isDecomp(refPosCol64x64, toChannelType(COMPONENT_Y))) - return false; - if (refPosCol64x64 == pu.Y().topLeft()) - return false; - } - } - else - return false; - - // in the same CTU, or valid area from left CTU. Check if the reference block is already coded - const Position refPosLT = pu.Y().topLeft().offset(xBv, yBv); - const Position refPosBR = pu.Y().bottomRight().offset(xBv, yBv); - const ChannelType chType = toChannelType(COMPONENT_Y); - if (!pu.cs->isDecomp(refPosBR, chType)) - return false; - if (!pu.cs->isDecomp(refPosLT, chType)) - return false; - return true; - -}// for ibc pu validation -#endif static int xGetDistScaleFactor(const int &iCurrPOC, const int &iCurrRefPOC, const int &iColPOC, const int &iColRefPOC) { @@ -1961,9 +1365,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mmvdBaseMv[currBaseNum][0] = MvField(Mv(0, 0), -1); mrgCtx.mmvdBaseMv[currBaseNum][1] = mrgCtx.mvFieldNeighbours[(k << 1) + 1]; } -#if JVET_O0057_ALTHPELIF mrgCtx.mmvdUseAltHpelIf[currBaseNum] = mrgCtx.useAltHpelIf[k]; -#endif currBaseNum++; @@ -2225,11 +1627,7 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) int offsetY = currentMv.getVer(); -#if JVET_O1164_PS if( rX < 0 || rY < 0 || rX >= pu.cs->slice->getPPS()->getPicWidthInLumaSamples() || rY >= pu.cs->slice->getPPS()->getPicHeightInLumaSamples() ) -#else - if (rX < 0 || rY < 0 || rX >= pu.cs->slice->getSPS()->getPicWidthInLumaSamples() || rY >= pu.cs->slice->getSPS()->getPicHeightInLumaSamples()) -#endif { return false; } @@ -2299,23 +1697,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in Position posRT = pu.Y().topRight(); Position posLB = pu.Y().bottomLeft(); -#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING - 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::isInter( *tmpPU->cu ); - - if( !isScaledFlagLX ) - { - tmpPU = cs.getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType ); - isScaledFlagLX = tmpPU != NULL && CU::isInter( *tmpPU->cu ); - } - } - - // Left predictor search - if( isScaledFlagLX ) -#endif { bool bAdded = addMVPCandUnscaled( pu, eRefPicList, refIdx, posLB, MD_BELOW_LEFT, *pInfo ); @@ -2323,17 +1704,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in { bAdded = addMVPCandUnscaled( pu, eRefPicList, refIdx, posLB, MD_LEFT, *pInfo ); -#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING - if( !bAdded ) - { - bAdded = addMVPCandWithScaling( pu, eRefPicList, refIdx, posLB, MD_BELOW_LEFT, *pInfo ); - - if( !bAdded ) - { - addMVPCandWithScaling( pu, eRefPicList, refIdx, posLB, MD_LEFT, *pInfo ); - } - } -#endif } } @@ -2352,22 +1722,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in } } -#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING - if( !isScaledFlagLX ) - { - bool bAdded = addMVPCandWithScaling( pu, eRefPicList, refIdx, posRT, MD_ABOVE_RIGHT, *pInfo ); - - if( !bAdded ) - { - bAdded = addMVPCandWithScaling( pu, eRefPicList, refIdx, posRT, MD_ABOVE, *pInfo ); - - if( !bAdded ) - { - addMVPCandWithScaling( pu, eRefPicList, refIdx, posLT, MD_ABOVE_LEFT, *pInfo ); - } - } - } -#endif for( int i = 0; i < pInfo->numCand; i++ ) { @@ -2806,91 +2160,6 @@ bool PU::addMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &eRefPic return false; } -#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING -/** -* \param pInfo -* \param eRefPicList -* \param iRefIdx -* \param uiPartUnitIdx -* \param eDir -* \returns bool -*/ -bool PU::addMVPCandWithScaling( const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &info ) -{ - CodingStructure &cs = *pu.cs; - const Slice &slice = *cs.slice; - const PredictionUnit *neibPU = NULL; - Position neibPos; - - switch( eDir ) - { - case MD_LEFT: - neibPos = pos.offset( -1, 0 ); - break; - case MD_ABOVE: - neibPos = pos.offset( 0, -1 ); - break; - case MD_ABOVE_RIGHT: - neibPos = pos.offset( 1, -1 ); - break; - case MD_BELOW_LEFT: - neibPos = pos.offset( -1, 1 ); - break; - case MD_ABOVE_LEFT: - neibPos = pos.offset( -1, -1 ); - break; - default: - break; - } - - neibPU = cs.getPURestricted( neibPos, pu, pu.chType ); - - if (neibPU == NULL || !CU::isInter(*neibPU->cu) || !CU::isInter(*pu.cu)) - { - return false; - } - - const MotionInfo& neibMi = neibPU->getMotionInfo( neibPos ); - - const RefPicList eRefPicList2nd = ( eRefPicList == REF_PIC_LIST_0 ) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; - - const int currPOC = slice.getPOC(); - const int currRefPOC = slice.getRefPic( eRefPicList, iRefIdx )->poc; - const bool bIsCurrRefLongTerm = slice.getRefPic( eRefPicList, iRefIdx )->longTerm; - const int neibPOC = currPOC; - - for( int predictorSource = 0; predictorSource < 2; predictorSource++ ) // examine the indicated reference picture list, then if not available, examine the other list. - { - const RefPicList eRefPicListIndex = (predictorSource == 0) ? eRefPicList : eRefPicList2nd; - const int neibRefIdx = neibMi.refIdx[eRefPicListIndex]; - if( neibRefIdx >= 0 ) - { - const bool bIsNeibRefLongTerm = slice.getRefPic(eRefPicListIndex, neibRefIdx)->longTerm; - - if (bIsCurrRefLongTerm == bIsNeibRefLongTerm) - { - Mv cMv = neibMi.mv[eRefPicListIndex]; - - if( !( bIsCurrRefLongTerm /* || bIsNeibRefLongTerm*/) ) - { - const int neibRefPOC = slice.getRefPOC( eRefPicListIndex, neibRefIdx ); - const int scale = xGetDistScaleFactor( currPOC, currRefPOC, neibPOC, neibRefPOC ); - - if( scale != 4096 ) - { - cMv = cMv.scaleMv( scale ); - } - } - - info.mvCand[info.numCand++] = cMv; - return true; - } - } - } - - return false; -} -#endif void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicList2nd, const int currRefPOC, AMVPInfo &info, uint8_t imv) { @@ -2943,11 +2212,7 @@ bool PU::isBipredRestriction(const PredictionUnit &pu) return false; } -#if JVET_O0366_AFFINE_BCW void PU::getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], bool isAvailable[4], int verIdx[4], int8_t gbiIdx, int modelIdx, int verNum, AffineMergeCtx& affMrgType) -#else -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) -#endif { int cuW = pu.Y().width; int cuH = pu.Y().height; @@ -2959,9 +2224,6 @@ void PU::getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], i Mv cMv[2][4]; int refIdx[2] = { -1, -1 }; int dir = 0; -#if !JVET_O0366_AFFINE_BCW - int8_t gbiIdx = GBI_DEFAULT; -#endif EAffineModel curType = (verNum == 2) ? AFFINEMODEL_4PARAM : AFFINEMODEL_6PARAM; if ( verNum == 2 ) @@ -2984,15 +2246,6 @@ void PU::getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], i } } } -#if !JVET_O0366_AFFINE_BCW - if (dir == 3) - { - if (neighGbi[idx0] == neighGbi[idx1]) - { - gbiIdx = neighGbi[idx0]; - } - } -#endif } else if ( verNum == 3 ) @@ -3015,30 +2268,6 @@ void PU::getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], i } } } -#if !JVET_O0366_AFFINE_BCW - int gbiClass[5] = { -1,0,0,0,1 }; - if (dir == 3) - { - if (neighGbi[idx0] == neighGbi[idx1] && gbiClass[neighGbi[idx0]] == gbiClass[neighGbi[idx2]]) - { - gbiIdx = neighGbi[idx0]; - } - else if (neighGbi[idx0] == neighGbi[idx2] && gbiClass[neighGbi[idx0]] == gbiClass[neighGbi[idx1]]) - { - gbiIdx = neighGbi[idx0]; - - } - else if (neighGbi[idx1] == neighGbi[idx2] && gbiClass[neighGbi[idx0]] == gbiClass[neighGbi[idx1]]) - { - gbiIdx = neighGbi[idx1]; - } - else - { - gbiIdx = GBI_DEFAULT; - } - - } -#endif } @@ -3117,11 +2346,7 @@ void PU::getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], i } affMrgType.interDirNeighbours[affMrgType.numValidMergeCand] = dir; affMrgType.affineType[affMrgType.numValidMergeCand] = curType; -#if JVET_O0366_AFFINE_BCW affMrgType.GBiIdx[affMrgType.numValidMergeCand] = (dir == 3) ? gbiIdx : GBI_DEFAULT; -#else - affMrgType.GBiIdx[affMrgType.numValidMergeCand] = gbiIdx; -#endif affMrgType.numValidMergeCand++; @@ -3329,11 +2554,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx MotionInfo mi[4]; bool isAvailable[4] = { false }; -#if JVET_O0366_AFFINE_BCW int8_t neighGbi[2] = { GBI_DEFAULT, GBI_DEFAULT }; -#else - 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++ ) @@ -3382,9 +2603,6 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { isAvailable[2] = true; mi[2] = puNeigh->getMotionInfo( pos ); -#if !JVET_O0366_AFFINE_BCW - neighGbi[2] = puNeigh->cu->GBiIdx; -#endif break; } } @@ -3451,11 +2669,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx for ( int idx = startIdx; idx < modelNum; idx++ ) { int modelIdx = order[idx]; -#if JVET_O0366_AFFINE_BCW getAffineControlPointCand(pu, mi, isAvailable, model[modelIdx], ((modelIdx == 3) ? neighGbi[1] : neighGbi[0]), modelIdx, verNum[modelIdx], affMrgCtx); -#else - getAffineControlPointCand(pu, mi, neighGbi, isAvailable, model[modelIdx], modelIdx, verNum[modelIdx], affMrgCtx); -#endif if ( affMrgCtx.numValidMergeCand != 0 && affMrgCtx.numValidMergeCand - 1 == mrgCandIdx ) { return; @@ -3594,17 +2808,9 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu) int log2CtuSize = floorLog2(pu.cs->sps->getCTUSize()); int ctuX = ((puPos.x >> log2CtuSize) << log2CtuSize); int ctuY = ((puPos.y >> log2CtuSize) << log2CtuSize); -#if JVET_O1164_PS int horMax = std::min( (int)pu.cs->pps->getPicWidthInLumaSamples() - 1, ctuX + (int)pu.cs->sps->getCTUSize() + 3 ); -#else - int horMax = std::min((int)pu.cs->sps->getPicWidthInLumaSamples() - 1, ctuX + (int)pu.cs->sps->getCTUSize() + 3); -#endif int horMin = std::max((int)0, ctuX); -#if JVET_O1164_PS int verMax = std::min( (int)pu.cs->pps->getPicHeightInLumaSamples() - 1, ctuY + (int)pu.cs->sps->getCTUSize() - 1 ); -#else - int verMax = std::min((int)pu.cs->sps->getPicHeightInLumaSamples() - 1, ctuY + (int)pu.cs->sps->getCTUSize() - 1); -#endif int verMin = std::max((int)0, ctuY); posX = std::min(horMax, std::max(horMin, posX)); @@ -3622,7 +2828,6 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b const Picture *pColPic = slice.getRefPic(RefPicList(slice.isInterB() ? 1 - slice.getColFromL0Flag() : 0), slice.getColRefIdx()); Mv cTMv; -#if JVET_O0163_REMOVE_SWITCHING_TMV if ( count ) { if ( (mrgCtx.interDirNeighbours[0] & (1 << REF_PIC_LIST_0)) && slice.getRefPic( REF_PIC_LIST_0, mrgCtx.mvFieldNeighbours[REF_PIC_LIST_0].refIdx ) == pColPic ) @@ -3634,28 +2839,13 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b cTMv = mrgCtx.mvFieldNeighbours[REF_PIC_LIST_1].mv; } } -#else - bool terminate = false; - for (unsigned currRefListId = 0; currRefListId < (slice.getSliceType() == B_SLICE ? 2 : 1) && !terminate; currRefListId++) - { - if ( count ) - { - RefPicList currRefPicList = RefPicList(slice.getCheckLDC() ? (slice.getColFromL0Flag() ? currRefListId : 1 - currRefListId) : currRefListId); - - if ((mrgCtx.interDirNeighbours[0] & (1 << currRefPicList)) && slice.getRefPic(currRefPicList, mrgCtx.mvFieldNeighbours[0 * 2 + currRefPicList].refIdx) == pColPic) - { - cTMv = mrgCtx.mvFieldNeighbours[0 * 2 + currRefPicList].mv; - terminate = true; - break; - } - } - } -#endif /////////////////////////////////////////////////////////////////////// //////// GET Initial Temporal Vector //////// /////////////////////////////////////////////////////////////////////// +#if !JVET_P0385_UNIFIED_MV_ROUNDING int mvPrec = MV_FRACTIONAL_BITS_INTERNAL; +#endif Mv cTempVector = cTMv; bool tempLICFlag = false; @@ -3677,8 +2867,15 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b bool found = false; cTempVector = cTMv; + +#if JVET_P0385_UNIFIED_MV_ROUNDING + cTempVector.changePrecision(MV_PRECISION_SIXTEENTH, MV_PRECISION_INT); + int tempX = cTempVector.getHor(); + int tempY = cTempVector.getVer(); +#else int tempX = cTempVector.getHor() >> mvPrec; int tempY = cTempVector.getVer() >> mvPrec; +#endif centerPos.x = puPos.x + (puSize.width >> 1) + tempX; centerPos.y = puPos.y + (puSize.height >> 1) + tempY; @@ -3800,9 +2997,7 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) if( mi.isInter ) { mi.interDir = pu.interDir; -#if JVET_O0057_ALTHPELIF mi.useAltHpelIf = pu.cu->imv == IMV_HPEL; -#endif for( int i = 0; i < NUM_REF_PIC_LIST_01; i++ ) { @@ -3985,9 +3180,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl triangleMrgCtx.mvFieldNeighbours[(i << 1) + 1].refIdx = NOT_VALID; triangleMrgCtx.mvFieldNeighbours[(i << 1)].mv = Mv(); triangleMrgCtx.mvFieldNeighbours[(i << 1) + 1].mv = Mv(); -#if JVET_O0057_ALTHPELIF triangleMrgCtx.useAltHpelIf[i] = false; -#endif } PU::getInterMergeCandidates(pu, tmpMergeCtx, 0); @@ -4057,61 +3250,19 @@ void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, c } else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 1 && triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ) { -#if JVET_O0265_TPM_SIMPLIFICATION biMv.interDir = 1; biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].mv; biMv.mv[1] = Mv(0, 0); biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].refIdx; biMv.refIdx[1] = -1; -#else - int32_t refIdx = mappingRefPic( pu, pu.cs->slice->getRefPOC( REF_PIC_LIST_0, triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].refIdx ), REF_PIC_LIST_1 ); - if( refIdx != -1 ) - { - biMv.interDir = 3; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[candIdx0 << 1].mv; - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].mv; - biMv.refIdx[0] = triangleMrgCtx.mvFieldNeighbours[candIdx0 << 1].refIdx; - biMv.refIdx[1] = refIdx; - } - else - { - refIdx = mappingRefPic( pu, pu.cs->slice->getRefPOC( REF_PIC_LIST_0, triangleMrgCtx.mvFieldNeighbours[candIdx0 << 1].refIdx), REF_PIC_LIST_1 ); - biMv.interDir = ( refIdx != -1 ) ? 3 : 1; - biMv.mv[0] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].mv : triangleMrgCtx.mvFieldNeighbours[candIdx0 << 1].mv; - biMv.mv[1] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[candIdx0 << 1].mv : Mv(0, 0); - biMv.refIdx[0] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[candIdx1 << 1].refIdx : triangleMrgCtx.mvFieldNeighbours[candIdx0 << 1].refIdx; - biMv.refIdx[1] = ( refIdx != -1 ) ? refIdx : -1; - } -#endif } else if( triangleMrgCtx.interDirNeighbours[candIdx0] == 2 && triangleMrgCtx.interDirNeighbours[candIdx1] == 2 ) { -#if JVET_O0265_TPM_SIMPLIFICATION biMv.interDir = 2; biMv.mv[0] = Mv(0, 0); biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; biMv.refIdx[0] = -1; biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx; -#else - int32_t refIdx = mappingRefPic( pu, pu.cs->slice->getRefPOC( REF_PIC_LIST_1, triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx ), REF_PIC_LIST_0 ); - if( refIdx != -1 ) - { - biMv.interDir = 3; - biMv.mv[0] = triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv; - biMv.mv[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv; - biMv.refIdx[0] = refIdx; - biMv.refIdx[1] = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx; - } - else - { - refIdx = mappingRefPic( pu, pu.cs->slice->getRefPOC( REF_PIC_LIST_1, triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx ), REF_PIC_LIST_0 ); - biMv.interDir = ( refIdx != -1 ) ? 3 : 2; - biMv.mv[0] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv : Mv(0, 0); - biMv.mv[1] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv : triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv; - biMv.refIdx[0] = ( refIdx != -1 ) ? refIdx : -1; - biMv.refIdx[1] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx : triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx; - } -#endif } int32_t idxW = (int32_t)(floorLog2(pu.lwidth() ) - MIN_CU_LOG2); @@ -4342,7 +3493,6 @@ bool CU::isSameSbtSize( const uint8_t sbtInfo1, const uint8_t sbtInfo2 ) return false; } -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN bool CU::isPredRegDiffFromTB(const CodingUnit &cu, const ComponentID compID) { return (compID == COMPONENT_Y) @@ -4365,7 +3515,6 @@ void CU::adjustPredArea(CompArea &area) { area.width = std::max<int>(PRED_REG_MIN_WIDTH, area.width); } -#endif bool CU::isGBiIdxCoded( const CodingUnit &cu ) { @@ -4490,17 +3639,11 @@ uint8_t CU::deriveGbiIdx( uint8_t gbiLO, uint8_t gbiL1 ) bool CU::bdpcmAllowed( const CodingUnit& cu, const ComponentID compID ) { -#if JVET_O1136_TS_BDPCM_SIGNALLING SizeType transformSkipMaxSize = 1 << cu.cs->pps->getLog2MaxTransformSkipBlockSize(); -#endif bool bdpcmAllowed = compID == COMPONENT_Y; bdpcmAllowed &= CU::isIntra( cu ); -#if JVET_O1136_TS_BDPCM_SIGNALLING bdpcmAllowed &= ( cu.lwidth() <= transformSkipMaxSize && cu.lheight() <= transformSkipMaxSize ); -#else - bdpcmAllowed &= ( cu.lwidth() <= 32 && cu.lheight() <= 32 ); -#endif return bdpcmAllowed; } @@ -4518,10 +3661,8 @@ bool TU::getCbf( const TransformUnit &tu, const ComponentID &compID ) bool TU::getCbfAtDepth(const TransformUnit &tu, const ComponentID &compID, const unsigned &depth) { -#if JVET_O0050_LOCAL_DUAL_TREE if( !tu.blocks[compID].valid() ) CHECK( tu.cbf[compID] != 0, "cbf must be 0 if the component is not available" ); -#endif return ((tu.cbf[compID] >> depth) & 1) == 1; } @@ -4538,20 +3679,11 @@ bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) bool tsAllowed = compID == COMPONENT_Y; const int maxSize = tu.cs->pps->getLog2MaxTransformSkipBlockSize(); -#if JVET_O1136_TS_BDPCM_SIGNALLING tsAllowed &= tu.cs->sps->getTransformSkipEnabledFlag(); -#else - tsAllowed &= tu.cs->pps->getUseTransformSkip(); -#endif tsAllowed &= !tu.cu->transQuantBypass; tsAllowed &= ( !tu.cu->ispMode || !isLuma(compID) ); -#if JVET_O1136_TS_BDPCM_SIGNALLING SizeType transformSkipMaxSize = 1 << maxSize; tsAllowed &= !(tu.cu->bdpcmMode && tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize); -#else - tsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= BDPCM_MAX_CU_SIZE && tu.lheight() <= BDPCM_MAX_CU_SIZE ); - SizeType transformSkipMaxSize = 1 << maxSize; -#endif tsAllowed &= tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize; tsAllowed &= !tu.cu->sbtInfo; @@ -4567,16 +3699,11 @@ 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_O1136_TS_BDPCM_SIGNALLING SizeType transformSkipMaxSize = 1 << tu.cs->pps->getLog2MaxTransformSkipBlockSize(); mtsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize); -#else - mtsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= BDPCM_MAX_CU_SIZE && tu.lheight() <= BDPCM_MAX_CU_SIZE ); -#endif return mtsAllowed; } -#if JVET_O0105_ICT int TU::getICTMode( const TransformUnit& tu, int jointCbCr ) { if( jointCbCr < 0 ) @@ -4585,7 +3712,6 @@ int TU::getICTMode( const TransformUnit& tu, int jointCbCr ) } return g_ictModes[ tu.cs->slice->getJointCbCrSignFlag() ][ jointCbCr ]; } -#endif bool TU::hasCrossCompPredInfo( const TransformUnit &tu, const ComponentID &compID ) { @@ -4593,71 +3719,6 @@ bool TU::hasCrossCompPredInfo( const TransformUnit &tu, const ComponentID &compI (!CU::isIntra(*tu.cu) || PU::isChromaIntraModeCrossCheckMode(*tu.cs->getPU(tu.blocks[compID].pos(), toChannelType(compID))))); } -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS -uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma, const bool bChroma ) -{ - uint32_t count = 0; - for( uint32_t i = 0; i < ::getNumberValidTBlocks( *tu.cs->pcv ); i++ ) - { - if( tu.blocks[ i ].valid() && tu.mtsIdx != MTS_SKIP && TU::getCbf( tu, ComponentID( i ) ) ) - { - if( isLuma ( tu.blocks[i].compID ) && !bLuma ) continue; - if( isChroma( tu.blocks[i].compID ) && !bChroma ) continue; - - uint32_t area = tu.blocks[i].area(); - const TCoeff* coeff = tu.getCoeffs( ComponentID( i ) ).buf; - for( uint32_t j = 0; j < area; j++ ) - { - count += coeff[j] != 0; - } - } - } - return count; -} -#endif -#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS -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; - const uint32_t lumaHeight = tu.blocks[ 0 ].height, chromaHeight = tu.blocks[ 1 ].height; - bool luma4x4TUFlag = lumaWidth == 4 && lumaHeight == 4; - bool chroma4x4TUFlag = chromaWidth == 4 && chromaHeight == 4; - bool luma8x8TUFlag = lumaWidth == 8 && lumaHeight == 8; - bool chroma8x8TUFlag = chromaWidth == 8 && chromaHeight == 8; - bool lumaCountFlag = ( lumaWidth >= 8 && lumaHeight >= 8 ) || luma4x4TUFlag; - bool chromaCountFlag = ( chromaWidth >= 8 && chromaHeight >= 8 ) || chroma4x4TUFlag; - - uint32_t count = 0; - for( uint32_t i = 0; i < ::getNumberValidTBlocks( *tu.cs->pcv ); i++ ) - { - if( tu.blocks[ i ].valid() && tu.mtsIdx != MTS_SKIP && TU::getCbf( tu, ComponentID( i ) ) ) - { - if( isLuma( tu.blocks[ i ].compID ) && ( !lumaFlag || !lumaCountFlag ) ) continue; - if( isChroma( tu.blocks[ i ].compID ) && ( !chromaFlag || !chromaCountFlag ) ) continue; - - const ScanElement * scan = g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( tu.blocks[ i ].width ) ]; - const TCoeff* coeff = tu.getCoeffs( ComponentID( i ) ).buf; - - int startPos = MAX_LFNST_COEF_NUM, endPos = 47; - if( ( isLuma( tu.blocks[ i ].compID ) && luma4x4TUFlag ) || ( isChroma( tu.blocks[ i ].compID ) && chroma4x4TUFlag ) ) - { - startPos = 8; endPos = 15; - } - else if( ( isLuma( tu.blocks[ i ].compID ) && luma8x8TUFlag ) || ( isChroma( tu.blocks[ i ].compID ) && chroma8x8TUFlag ) ) - { - startPos = 8; endPos = 47; - } - const ScanElement *scanPtr = scan + startPos; - for( uint32_t j = startPos; j <= endPos; j++ ) - { - count += coeff[ scanPtr->idx ] != 0; - scanPtr++; - } - } - } - return count; -} -#endif bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID ) { @@ -4718,20 +3779,12 @@ int getNumModesMip(const Size& block) } } -#if !JVET_O0925_MIP_SIMPLIFICATIONS -int getNumEpBinsMip(const Size& block) -{ - int numModes = getNumModesMip(block); - return int(std::ceil((std::log2(numModes - NUM_MPM_MIP - 1)))); -} -#endif bool mipModesAvailable(const Size& block) { return (getNumModesMip(block)); } -#if JVET_O0925_MIP_SIMPLIFICATIONS bool allowLfnstWithMip(const Size& block) { if (block.width >= 16 && block.height >= 16) @@ -4740,9 +3793,7 @@ bool allowLfnstWithMip(const Size& block) } return false; } -#endif -#if JVET_O1164_RPR bool PU::isRefPicSameSize( const PredictionUnit& pu ) { bool samePicSize = true; @@ -4767,7 +3818,6 @@ bool PU::isRefPicSameSize( const PredictionUnit& pu ) return samePicSize; } -#endif diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index e6023bd46612b3d139f4f66165201d6dd30d3d6e..aad11eff74f2a37a46a1666d174e523893b75632 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -59,9 +59,7 @@ namespace CU bool isIntra (const CodingUnit &cu); bool isInter (const CodingUnit &cu); bool isIBC (const CodingUnit &cu); -#if JVET_O0119_BASE_PALETTE_444 bool isPLT (const CodingUnit &cu); -#endif bool isRDPCMEnabled (const CodingUnit &cu); bool isLosslessCoded (const CodingUnit &cu); @@ -80,20 +78,13 @@ namespace CU void addPUs ( CodingUnit& cu); PartSplit getSplitAtDepth (const CodingUnit& cu, const unsigned depth); -#if JVET_O0050_LOCAL_DUAL_TREE ModeType getModeTypeAtDepth (const CodingUnit& cu, const unsigned depth); -#endif -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS - uint32_t getNumNonZeroCoeffNonTs ( const CodingUnit& cu, const bool lumaFlag = true, const bool chromaFlag = true ); -#endif uint32_t getNumNonZeroCoeffNonTsCorner8x8( const CodingUnit& cu, const bool lumaFlag = true, const bool chromaFlag = true ); -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN bool isPredRegDiffFromTB(const CodingUnit& cu, const ComponentID compID); bool isFirstTBInPredReg(const CodingUnit& cu, const ComponentID compID, const CompArea &area); bool isMinWidthPredEnabledForBlkSize(const int w, const int h); void adjustPredArea(CompArea &area); -#endif bool isGBiIdxCoded (const CodingUnit& cu); uint8_t getValidGbiIdx (const CodingUnit& cu); void setGbiIdx (CodingUnit& cu, uint8_t uh); @@ -102,18 +93,13 @@ namespace CU bool divideTuInRows ( const CodingUnit &cu ); -#if !JVET_O0502_ISP_CLEANUP - bool firstTestISPHorSplit ( const int width, const int height, const ComponentID compID, const CodingUnit *cuLeft = nullptr, const CodingUnit *cuAbove = nullptr ); -#endif PartSplit getISPType ( const CodingUnit &cu, const ComponentID compID ); bool isISPLast ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID ); bool isISPFirst ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID ); bool canUseISP ( const CodingUnit &cu, const ComponentID compID ); bool canUseISP ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY ); uint32_t getISPSplitDim ( const int width, const int height, const PartSplit ispType ); -#if JVET_O0502_ISP_CLEANUP bool allLumaCBFsAreZero ( const CodingUnit& cu ); -#endif PUTraverser traversePUs ( CodingUnit& cu); TUTraverser traverseTUs ( CodingUnit& cu); @@ -133,9 +119,7 @@ namespace CU uint8_t numSbtModeRdo (uint8_t sbtAllowed); bool isSbtMode (const uint8_t sbtInfo); bool isSameSbtSize (const uint8_t sbtInfo1, const uint8_t sbtInfo2); -#if JVET_O1164_RPR bool getRprScaling ( const SPS* sps, const PPS* curPPS, Picture* refPic, int& xScale, int& yScale ); -#endif } // PU tools namespace PU @@ -143,19 +127,10 @@ namespace PU int getLMSymbolList(const PredictionUnit &pu, int *modeList); int getIntraMPMs(const PredictionUnit &pu, unsigned *mpm, const ChannelType &channelType = CHANNEL_TYPE_LUMA); bool isMIP (const PredictionUnit &pu, const ChannelType &chType = CHANNEL_TYPE_LUMA); -#if !JVET_O0925_MIP_SIMPLIFICATIONS - int getMipMPMs (const PredictionUnit &pu, unsigned *mpm); - int getMipSizeId (const PredictionUnit &pu); -#endif uint32_t getIntraDirLuma (const PredictionUnit &pu); -#if !JVET_O0925_MIP_SIMPLIFICATIONS - 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_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE uint32_t getCoLocatedIntraLumaMode (const PredictionUnit &pu); -#endif int getWideAngIntraMode ( const TransformUnit &tu, const uint32_t dirMode, const ComponentID compID ); void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, int mmvdList, @@ -169,30 +144,18 @@ namespace PU void fillIBCMvpCand (PredictionUnit &pu, AMVPInfo &amvpInfo); void fillAffineMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AffineAMVPInfo &affiAMVPInfo); bool addMVPCandUnscaled (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo); -#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING - bool addMVPCandWithScaling (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo); -#endif void xInheritedAffineMv ( const PredictionUnit &pu, const PredictionUnit* puNeighbour, RefPicList eRefPicList, Mv rcMv[3] ); bool xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const MergeCtx mergeCandList, bool hasPruned[MRG_MAX_NUM_CANDS]); -#if JVET_L0090_PAIR_AVG bool addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos , bool ibcFlag , bool isShared ); -#else - bool addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCandInter[MRG_MAX_NUM_CANDS], bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos - ); -#endif void addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicList2nd, const int currRefPOC, AMVPInfo &info, uint8_t imv); bool addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &refPicList, const int &refIdx, const Position &pos, const MvpDir &dir, AffineAMVPInfo &affiAmvpInfo ); bool isBipredRestriction (const PredictionUnit &pu); void spanMotionInfo ( PredictionUnit &pu, const MergeCtx &mrgCtx = MergeCtx() ); void applyImv ( PredictionUnit &pu, MergeCtx &mrgCtx, InterPrediction *interPred = NULL ); -#if JVET_O0366_AFFINE_BCW void getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], bool isAvailable[4], int verIdx[4], int8_t gbiIdx, int modelIdx, int verNum, AffineMergeCtx& affMrgCtx); -#else - void getAffineControlPointCand(const PredictionUnit &pu, MotionInfo mi[4], int8_t neighGbi[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 @@ -215,22 +178,14 @@ namespace PU bool isAddNeighborMv (const Mv& currMv, Mv* neighborMvs, int numNeighborMv); void getIbcMVPsEncOnly(PredictionUnit &pu, Mv* mvPred, int& nbPred); bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); -#if !JVET_O1170_IBC_VIRTUAL_BUFFER - 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); -#endif bool checkDMVRCondition(const PredictionUnit& pu); -#if JVET_O1164_RPR bool isRefPicSameSize( const PredictionUnit& pu ); -#endif } // TU tools namespace TU { -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS - uint32_t getNumNonZeroCoeffsNonTS (const TransformUnit &tu, const bool bLuma = true, const bool bChroma = true); -#endif uint32_t getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit &tu, const bool bLuma = true, const bool bChroma = true ); bool isNonTransformedResidualRotated(const TransformUnit &tu, const ComponentID &compID); bool getCbf (const TransformUnit &tu, const ComponentID &compID); @@ -245,20 +200,13 @@ namespace TU bool needsBlockSizeTrafoScale ( const TransformUnit &tu, const ComponentID &compID ); TransformUnit* getPrevTU ( const TransformUnit &tu, const ComponentID compID ); bool getPrevTuCbfAtDepth( const TransformUnit &tu, const ComponentID compID, const int trDepth ); -#if JVET_O0105_ICT int getICTMode ( const TransformUnit &tu, int jointCbCr = -1 ); -#endif } uint32_t getCtuAddr (const Position& pos, const PreCalcValues &pcv); int getNumModesMip (const Size& block); -#if !JVET_O0925_MIP_SIMPLIFICATIONS -int getNumEpBinsMip (const Size& block); -#endif bool mipModesAvailable(const Size& block); -#if JVET_O0925_MIP_SIMPLIFICATIONS bool allowLfnstWithMip(const Size& block); -#endif template<typename T, size_t N> uint32_t updateCandList(T uiMode, double uiCost, static_vector<T, N>& candModeList, static_vector<double, N>& candCostList diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index ab01b47539212894db40e0c827270998cf370d7b..350af8f22b00d2070b3859ebb7053c71ae34b9ab 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -376,11 +376,7 @@ void writeBlockStatisticsHeader(const SPS *sps) DTRACE_HEADER( g_trace_ctx, "# VTMBMS Block Statistics\n"); // sequence info -#if JVET_O1164_PS DTRACE_HEADER( g_trace_ctx, "# Sequence size: [%dx %d]\n", sps->getMaxPicWidthInLumaSamples(), sps->getMaxPicHeightInLumaSamples() ); -#else - DTRACE_HEADER( g_trace_ctx, "# Sequence size: [%dx %d]\n", sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples()); -#endif // list statistics for( auto i = static_cast<int>(BlockStatistic::PredMode); i < static_cast<int>(BlockStatistic::NumBlockStatistics); i++) { @@ -677,18 +673,9 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) { if(chType == CHANNEL_TYPE_LUMA) { -#if !JVET_O0525_REMOVE_PCM - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IPCM), cu.ipcm); -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::MIPFlag), cu.mipFlag); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::ISPMode), cu.ispMode); } -#if !JVET_O0525_REMOVE_PCM - else if(chType == CHANNEL_TYPE_CHROMA) - { - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IPCM_Chroma), cu.ipcm); - } -#endif const uint32_t numChType = ::getNumberValidChannels( cu.chromaFormat ); @@ -761,11 +748,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } -#if JVET_O0050_LOCAL_DUAL_TREE if( !(cu.chromaFormat == CHROMA_400 || (cu.isSepTree() && cu.chType == CHANNEL_TYPE_LUMA)) ) -#else - if (!(cu.chromaFormat == CHROMA_400 || (CS::isDualITree(*cu.cs) && cu.chType == CHANNEL_TYPE_LUMA))) -#endif { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cr), tu.cbf[COMPONENT_Cr]); @@ -784,9 +767,6 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) for (int ch = 0; ch < maxNumChannelType; ch++) { const ChannelType chType = ChannelType(ch); -#if !JVET_O0525_REMOVE_PCM - const SPS& sps = *cs.sps; -#endif for (const CodingUnit &cu : cs.traverseCUs(CS::getArea(cs, ctuArea, chType), chType)) { @@ -817,15 +797,6 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) // prediction mode and partitioning data DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::PredMode), cu.predMode); -#if !JVET_O0525_REMOVE_PCM - if (CU::isIntra(cu)) - { - if (!(!sps.getPCMEnabledFlag() || cu.lumaSize().width > (1 << sps.getPCMLog2MaxSize()) || cu.lumaSize().width < (1 << sps.getPCMLog2MinSize()))) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::IPCM), cu.ipcm); - } - } -#endif } else if (chType == CHANNEL_TYPE_CHROMA ) { @@ -842,15 +813,6 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TransQuantBypassFlag_Chroma), cu.transQuantBypass); } -#if !JVET_O0525_REMOVE_PCM - if (CU::isIntra(cu)) - { - if (!(!sps.getPCMEnabledFlag() || cu.lumaSize().width > (1 << sps.getPCMLog2MaxSize()) || cu.lumaSize().width < (1 << sps.getPCMLog2MinSize()))) - { - DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::IPCM_Chroma), cu.ipcm); - } - } -#endif } for (const PredictionUnit &pu : CU::traversePUs(cu)) @@ -863,11 +825,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::Luma_IntraMode), PU::getFinalIntraMode(pu, ChannelType(chType))); } -#if JVET_O0050_LOCAL_DUAL_TREE if (!(pu.chromaFormat == CHROMA_400 || (pu.cu->isSepTree() && pu.chType == CHANNEL_TYPE_LUMA))) -#else - if (!(pu.chromaFormat == CHROMA_400 || (CS::isDualITree(*pu.cs) && pu.chType == CHANNEL_TYPE_LUMA))) -#endif { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::Chroma_IntraMode), PU::getFinalIntraMode(pu, CHANNEL_TYPE_CHROMA)); } @@ -1053,11 +1011,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Y), tu.cbf[COMPONENT_Y]); DTRACE_BLOCK_SCALAR( g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName( BlockStatistic::MTSIdx ), tu.mtsIdx ); } -#if JVET_O0050_LOCAL_DUAL_TREE if (!(cu.chromaFormat == CHROMA_400 || (cu.isSepTree() && cu.chType == CHANNEL_TYPE_LUMA))) -#else - if (!(cu.chromaFormat == CHROMA_400 || (CS::isDualITree(*cu.cs) && cu.chType == CHANNEL_TYPE_LUMA))) -#endif { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cr), tu.cbf[COMPONENT_Cr]); diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index 42ec6f0776e2bf1b58e90602c23272ce9f08fb54..b802f1183fd303c02e654cf27dc3ea139f8600db 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -77,9 +77,6 @@ enum class BlockStatistic { RDPCM_Cr, // intra -#if !JVET_O0525_REMOVE_PCM - IPCM, -#endif Luma_IntraMode, Chroma_IntraMode, MultiRefIdx, @@ -135,9 +132,6 @@ enum class BlockStatistic { TransQuantBypassFlag_Chroma, // intra -#if !JVET_O0525_REMOVE_PCM - IPCM_Chroma, -#endif NumBlockStatistics, }; @@ -162,9 +156,6 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::RegularMergeFlag, std::tuple<std::string, BlockStatisticType, std::string>{"RegularMergeFlag", BlockStatisticType::Flag, ""}}, { BlockStatistic::MVL0, std::tuple<std::string, BlockStatisticType, std::string>{"MVL0", BlockStatisticType::Vector, "Scale: 4"}}, { BlockStatistic::MVL1, std::tuple<std::string, BlockStatisticType, std::string>{"MVL1", BlockStatisticType::Vector, "Scale: 4"}}, -#if !JVET_O0525_REMOVE_PCM - { BlockStatistic::IPCM, std::tuple<std::string, BlockStatisticType, std::string>{"IPCM", BlockStatisticType::Flag, ""}}, -#endif { BlockStatistic::Luma_IntraMode, std::tuple<std::string, BlockStatisticType, std::string>{"Luma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::Chroma_IntraMode, std::tuple<std::string, BlockStatisticType, std::string>{"Chroma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::SkipFlag, std::tuple<std::string, BlockStatisticType, std::string>{"SkipFlag", BlockStatisticType::Flag, ""}}, @@ -231,9 +222,6 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::QP_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"QP_Chroma", BlockStatisticType::Integer, "[0, 51]"}}, { BlockStatistic::SplitSeries_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"SplitSeries_Chroma", BlockStatisticType::Integer, "[0, " + std::to_string(std::numeric_limits<SplitSeries>::max()) + "]"}}, { BlockStatistic::TransQuantBypassFlag_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"TransQuantBypassFlag_Chroma", BlockStatisticType::Flag, ""}}, -#if !JVET_O0525_REMOVE_PCM - { BlockStatistic::IPCM_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"IPCM_Chroma", BlockStatisticType::Flag, ""}}, -#endif }; diff --git a/source/Lib/CommonLib/version.h b/source/Lib/CommonLib/version.h index f87ed7c41a537b9543e2b387f4cb784bababafe9..aa36df5cd903755a2af7c7b00e31257dd7e1f6e8 100644 --- a/source/Lib/CommonLib/version.h +++ b/source/Lib/CommonLib/version.h @@ -1,3 +1,3 @@ #if ! defined( VTM_VERSION ) -#define VTM_VERSION "6.2" +#define VTM_VERSION "6.3" #endif diff --git a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h index 165febc779ec74c3aef3e531bab1031addc83cae..ba1c0731e6977e8d069c128d519be40d4562ec50 100644 --- a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h +++ b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h @@ -403,12 +403,6 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs CHECK((vbCTUHeight & (vbCTUHeight - 1)) != 0, "vbCTUHeight must be a power of 2"); CHECK(!isChroma(compId), "ALF 5x5 filter is for chroma only"); -#if !JVET_O0525_REMOVE_PCM - const SPS* sps = cs.slice->getSPS(); - bool isDualTree = CS::isDualITree(cs); - bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); - ChromaFormat nChromaFormat = sps->getChromaFormatIdc(); -#endif const CPelBuf srcBuffer = recSrc.get(compId); PelBuf dstBuffer = recDst.get(compId); @@ -448,10 +442,6 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs int botBryLines = ((((alfBotBryPos - (4 >> chromaScaleY)) & (vbCTUHeight - 1)) == vbPos) && alfBotBryPos != ALF_NONE_BOUNDARY) ? 1 : 2; #endif -#if !JVET_O0525_REMOVE_PCM - bool pcmFlags2x2[8] = {0,0,0,0,0,0,0,0}; - Pel pcmRec2x2[32]; -#endif const __m128i mmOffset = _mm_set1_epi32(ROUND); const __m128i mmMin = _mm_set1_epi16( clpRng.min ); @@ -471,49 +461,6 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs { for (size_t j = 0; j < width; j += STEP_X) { -#if !JVET_O0525_REMOVE_PCM - if (isPCMFilterDisabled) - { - size_t 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 < STEP_Y; blkY += 2) - { - for (blkX = 0; blkX < STEP_X; blkX += 2) - { - Position pos((PosType)(j + blkDst.x + blkX), (PosType)(i + blkDst.y + blkY)); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB && !JVET_O0050_LOCAL_DUAL_TREE - const CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); -#else - CodingUnit* cu = isDualTree ? cs.getCU(pos, CH_C) : cs.getCU(recalcPosition(nChromaFormat, CH_C, CH_L, pos), CH_L); -#endif -#if JVET_O0050_LOCAL_DUAL_TREE - cu = cu != NULL && cu->isSepTree() ? cs.getCU( pos, CH_C ) : cu; -#endif - if(cu != NULL) - { - *flags++ = cu->ipcm ? 1 : 0; - } - else - { - *flags++ = 0; - } - - // save original samples from 2x2 PCM blocks - if( cu != NULL && cu->ipcm ) - { - *pcmRec++ = dst[(blkY + 0) * dstStride + (blkX + 0) + j]; - *pcmRec++ = dst[(blkY + 0) * dstStride + (blkX + 1) + j]; - *pcmRec++ = dst[(blkY + 1) * dstStride + (blkX + 0) + j]; - *pcmRec++ = dst[(blkY + 1) * dstStride + (blkX + 1) + j]; - } - } - } - } -#endif for (size_t ii = 0; ii < STEP_Y; ii++) { @@ -665,28 +612,6 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs _mm_storel_epi64((__m128i *) (dst + ii * dstStride + j), accumA); } } -#if !JVET_O0525_REMOVE_PCM - // restore 2x2 PCM chroma blocks - if (isPCMFilterDisabled) - { - size_t blkX, blkY; - bool *flags = pcmFlags2x2; - Pel *pcmRec = pcmRec2x2; - for (blkY = 0; blkY < STEP_Y; blkY += 2) - { - for (blkX = 0; blkX < STEP_X; blkX += 2) - { - if( *flags++ ) - { - dst[(blkY + 0) * dstStride + (blkX + 0) + j] = *pcmRec++; - dst[(blkY + 0) * dstStride + (blkX + 1) + j] = *pcmRec++; - dst[(blkY + 1) * dstStride + (blkX + 0) + j] = *pcmRec++; - dst[(blkY + 1) * dstStride + (blkX + 1) + j] = *pcmRec++; - } - } - } - } -#endif } @@ -735,11 +660,6 @@ static void simdFilter7x7Blk(AlfClassifier **classifier, const PelUnitBuf &recDs CHECK((vbCTUHeight & (vbCTUHeight - 1)) != 0, "vbCTUHeight must be a power of 2"); CHECK(isChroma(compId), "7x7 ALF filter is meant for luma only"); -#if !JVET_O0525_REMOVE_PCM - const SPS *sps = cs.slice->getSPS(); - - bool isPCMFilterDisabled = sps->getPCMFilterDisableFlag(); -#endif const CPelBuf srcBuffer = recSrc.get(compId); PelBuf dstBuffer = recDst.get(compId); @@ -802,26 +722,11 @@ static void simdFilter7x7Blk(AlfClassifier **classifier, const PelUnitBuf &recDs __m128i rawCoeff0, rawCoeff1; __m128i rawClip0, rawClip1; -#if !JVET_O0525_REMOVE_PCM - if (isPCMFilterDisabled && classIdx == AdaptiveLoopFilter::m_ALF_UNUSED_CLASSIDX - && transposeIdx == AdaptiveLoopFilter::m_ALF_UNUSED_TRANSPOSIDX) - { - rawCoeff0 = _mm_setzero_si128(); - rawCoeff1 = _mm_setzero_si128(); - rawClip0 = _mm_setzero_si128(); - rawClip1 = _mm_setzero_si128(); - } - else - { -#endif rawCoeff0 = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF)); rawCoeff1 = _mm_loadl_epi64((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 8)); rawClip0 = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF)); rawClip1 = _mm_loadl_epi64((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 8)); -#if !JVET_O0525_REMOVE_PCM - } -#endif const __m128i s0 = _mm_loadu_si128((const __m128i *) shuffleTab[transposeIdx][0]); const __m128i s1 = _mm_xor_si128(s0, _mm_set1_epi8((char) 0x80)); diff --git a/source/Lib/CommonLib/x86/BufferX86.h b/source/Lib/CommonLib/x86/BufferX86.h index 7d8771174dd1471eb1e39a1c3eae6b506248a36c..be2d68c96b024ebace4e4684e6d58fe37cc36045 100644 --- a/source/Lib/CommonLib/x86/BufferX86.h +++ b/source/Lib/CommonLib/x86/BufferX86.h @@ -261,7 +261,6 @@ void addBIOAvg4_SSE(const Pel* src0, int src0Stride, const Pel* src1, int src1St } } -#if JVET_O0304_SIMPLIFIED_BDOF template< X86_VEXT vext > void calcBIOSums_SSE(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel* gradX1, Pel* gradY0, Pel* gradY1, int xu, int yu, const int src0Stride, const int src1Stride, const int widthG, const int bitDepth, int* sumAbsGX, int* sumAbsGY, int* sumDIX, int* sumDIY, int* sumSignGY_GX) @@ -339,9 +338,7 @@ void calcBIOSums_SSE(const Pel* srcY0Tmp, const Pel* srcY1Tmp, Pel* gradX0, Pel* sumSignGyGxTmp = _mm_add_epi32(sumSignGyGxTmp, _mm_shuffle_epi32(sumSignGyGxTmp, 0xb1)); // 10110001 *sumSignGY_GX = _mm_cvtsi128_si32(sumSignGyGxTmp); } -#endif -#if JVET_O0070_PROF template< X86_VEXT vext > void applyPROF_SSE(Pel* dstPel, int dstStride, const Pel* srcPel, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, int shiftNum, Pel offset, const ClpRng& clpRng) { @@ -545,18 +542,10 @@ void roundIntVector_SIMD(int* v, int size, unsigned int nShift, const int dmvLim } } } -#endif -#if JVET_O0070_PROF template< X86_VEXT vext, bool PAD = true> -#else -template< X86_VEXT vext > -#endif void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth) { -#if !JVET_O0570_GRAD_SIMP - __m128i vzero = _mm_setzero_si128(); -#endif Pel* srcTmp = src + srcStride + 1; Pel* gradXTmp = gradX + gradStride + 1; Pel* gradYTmp = gradY + gradStride + 1; @@ -564,19 +553,14 @@ 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; int shift1 = std::max<int>(6, bitDepth - 6); -#if JVET_O0570_GRAD_SIMP __m128i mmShift1 = _mm_cvtsi32_si128( shift1 ); -#endif assert((widthInside & 3) == 0); -#if JVET_O0570_GRAD_SIMP if ( ( widthInside & 7 ) == 0 ) { -#endif for (int y = 0; y < heightInside; y++) { int x = 0; -#if JVET_O0570_GRAD_SIMP for ( ; x < widthInside; x += 8 ) { __m128i mmPixTop = _mm_sra_epi16( _mm_loadu_si128( ( __m128i* ) ( srcTmp + x - srcStride ) ), mmShift1 ); @@ -590,28 +574,10 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri _mm_storeu_si128( ( __m128i * ) ( gradYTmp + x ), mmGradVer ); _mm_storeu_si128( ( __m128i * ) ( gradXTmp + x ), mmGradHor ); } -#else - for (; x < widthInside; x += 4) - { - __m128i mmPixTop = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(srcTmp + x - srcStride))); - __m128i mmPixBottom = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(srcTmp + x + srcStride))); - __m128i mmPixLeft = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(srcTmp + x - 1))); - __m128i mmPixRight = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(srcTmp + x + 1))); - - __m128i mmGradVer = _mm_sra_epi32(_mm_sub_epi32(mmPixBottom, mmPixTop), _mm_cvtsi32_si128(shift1)); - __m128i mmGradHor = _mm_sra_epi32(_mm_sub_epi32(mmPixRight, mmPixLeft), _mm_cvtsi32_si128(shift1)); - mmGradVer = _mm_packs_epi32(mmGradVer, vzero); - mmGradHor = _mm_packs_epi32(mmGradHor, vzero); - - _mm_storel_epi64((__m128i *)(gradYTmp + x), mmGradVer); - _mm_storel_epi64((__m128i *)(gradXTmp + x), mmGradHor); - } -#endif gradXTmp += gradStride; gradYTmp += gradStride; srcTmp += srcStride; } -#if JVET_O0570_GRAD_SIMP } else { @@ -636,12 +602,9 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri srcTmp += srcStride << 1; } } -#endif -#if JVET_O0070_PROF if (PAD) { -#endif gradXTmp = gradX + gradStride + 1; gradYTmp = gradY + gradStride + 1; for (int y = 0; y < heightInside; y++) @@ -661,9 +624,7 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri ::memcpy(gradXTmp + heightInside*gradStride, gradXTmp + (heightInside - 1)*gradStride, sizeof(Pel)*(width)); ::memcpy(gradYTmp - gradStride, gradYTmp, sizeof(Pel)*(width)); ::memcpy(gradYTmp + heightInside*gradStride, gradYTmp + (heightInside - 1)*gradStride, sizeof(Pel)*(width)); -#if JVET_O0070_PROF } -#endif } template< X86_VEXT vext > @@ -1247,12 +1208,7 @@ void PelBufferOps::_initPelBufOpsX86() addBIOAvg4 = addBIOAvg4_SSE<vext>; bioGradFilter = gradFilter_SSE<vext>; -#if !JVET_O0304_SIMPLIFIED_BDOF - calcBIOPar = calcBIOPar_SSE<vext>; - calcBlkGradient = calcBlkGradient_SSE<vext>; -#else calcBIOSums = calcBIOSums_SSE<vext>; -#endif copyBuffer = copyBufferSimd<vext>; padding = paddingSimd<vext>; @@ -1267,13 +1223,11 @@ void PelBufferOps::_initPelBufOpsX86() removeHighFreq8 = removeHighFreq_SSE<vext, 8>; removeHighFreq4 = removeHighFreq_SSE<vext, 4>; #endif -#if JVET_O0070_PROF profGradFilter = gradFilter_SSE<vext, false>; applyPROF = applyPROF_SSE<vext>; applyBiPROF[1] = applyBiPROF_SSE<vext>; applyBiPROF[0] = applyBiPROF_SSE<vext, false>; roundIntVector = roundIntVector_SIMD<vext>; -#endif } template void PelBufferOps::_initPelBufOpsX86<SIMDX86>(); diff --git a/source/Lib/CommonLib/x86/InterpolationFilterX86.h b/source/Lib/CommonLib/x86/InterpolationFilterX86.h index 04116b8e74e73cd28b80552371ceee897580bd8c..6d94bd153fe2273170fc05df1dfb41ea19842777 100644 --- a/source/Lib/CommonLib/x86/InterpolationFilterX86.h +++ b/source/Lib/CommonLib/x86/InterpolationFilterX86.h @@ -1217,7 +1217,6 @@ static void simdFilter( const ClpRng& clpRng, Pel const *src, int srcStride, Pel } } -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING template< X86_VEXT vext > void xWeightedTriangleBlk_SSE(const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1) { @@ -1321,7 +1320,6 @@ void xWeightedTriangleBlk_SSE(const PredictionUnit &pu, const uint32_t width, co } } } -#endif template <X86_VEXT vext> void InterpolationFilter::_initInterpolationFilterX86() @@ -1362,9 +1360,7 @@ void InterpolationFilter::_initInterpolationFilterX86() m_filterCopy[1][0] = simdFilterCopy<vext, true, false>; m_filterCopy[1][1] = simdFilterCopy<vext, true, true>; -#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING m_weightedTriangleBlk = xWeightedTriangleBlk_SSE<vext>; -#endif } template void InterpolationFilter::_initInterpolationFilterX86<SIMDX86>(); diff --git a/source/Lib/DecoderLib/BinDecoder.cpp b/source/Lib/DecoderLib/BinDecoder.cpp index 03f63b0e62219b4b9fb04781ba507191acc09584..cd2ad66795b1b12484ea9e429e318d9547bf6d58 100644 --- a/source/Lib/DecoderLib/BinDecoder.cpp +++ b/source/Lib/DecoderLib/BinDecoder.cpp @@ -257,17 +257,6 @@ unsigned BinDecoderBase::decodeBinTrm() } -#if !JVET_O0525_REMOVE_PCM -unsigned BinDecoderBase::decodeBinsPCM( unsigned numBins ) -{ - unsigned bins = 0; - m_Bitstream->read( numBins, bins ); -#if RExt__DECODER_DEBUG_BIT_STATISTICS - CodingStatistics::IncrementStatisticEP( STATS__CABAC_PCM_CODE_BITS, numBins, int(bins) ); -#endif - return bins; -} -#endif void BinDecoderBase::align() diff --git a/source/Lib/DecoderLib/BinDecoder.h b/source/Lib/DecoderLib/BinDecoder.h index 6a8ef0e0d394c14c50e013bdff3e6368ea291602..8b056bbf98a7a3aa48b76b6169b4a3861197569e 100644 --- a/source/Lib/DecoderLib/BinDecoder.h +++ b/source/Lib/DecoderLib/BinDecoder.h @@ -73,9 +73,6 @@ public: unsigned decodeBinsEP ( unsigned numBins ); unsigned decodeRemAbsEP ( unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ); unsigned decodeBinTrm (); -#if !JVET_O0525_REMOVE_PCM - unsigned decodeBinsPCM ( unsigned numBins ); -#endif void align (); unsigned getNumBitsRead () { return m_Bitstream->getNumBitsRead() + m_bitsNeeded; } private: diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index f32b7e01df16e471a21a9fe9c24f052e0375337e..f130de9d49a126ceb5eced519bbec1a5fa478fc8 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -139,10 +139,8 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i QTBTPartitioner partitioner; partitioner.initCtu(area, CH_L, *cs.slice); -#if JVET_O0050_LOCAL_DUAL_TREE cs.treeType = partitioner.treeType = TREE_D; cs.modeType = partitioner.modeType = MODE_TYPE_ALL; -#endif sao( cs, ctuRsAddr ); @@ -177,7 +175,6 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i { readAlfCtuFilterIndex(cs, ctuRsAddr); } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isChroma( (ComponentID)compIdx ) ) { int apsIdx = cs.slice->getTileGroupApsIdChroma(); @@ -194,7 +191,6 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i ctbAlfAlternative[ctuRsAddr] = decoded; } } -#endif } } } @@ -253,14 +249,10 @@ void CABACReader::readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr) unsigned usePrevFilt = m_BinDecoder.decodeBin(Ctx::AlfUseTemporalFilt()); if (usePrevFilt) { -#if JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL if (numAps > 2) { -#endif xReadTruncBinCode(filtIndex, numAvailableFiltSets - (NUM_FIXED_FILTER_SETS + 1)); -#if JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL } -#endif filtIndex += (unsigned)(NUM_FIXED_FILTER_SETS + 1); } else @@ -440,12 +432,8 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU bool lastSegment = false; // Reset delta QP coding flag and ChromaQPAdjustemt coding flag -#if JVET_O0050_LOCAL_DUAL_TREE //Note: do not reset qg at chroma CU if( pps.getUseDQP() && partitioner.currQgEnable() && !isChroma(partitioner.chType) ) -#else - if( pps.getUseDQP() && partitioner.currQgEnable() ) -#endif { cuCtx.qgStart = true; cuCtx.isDQPCoded = false; @@ -580,7 +568,6 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU } else { -#if JVET_O0050_LOCAL_DUAL_TREE const ModeType modeTypeParent = partitioner.modeType; cs.modeType = partitioner.modeType = mode_constraint( cs, partitioner, splitMode ); //change for child nodes //decide chroma split or not @@ -590,7 +577,6 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU { cs.treeType = partitioner.treeType = chromaNotSplit ? TREE_L : TREE_D; } -#endif partitioner.splitCurrArea( splitMode, cs ); do { @@ -601,7 +587,6 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); -#if JVET_O0050_LOCAL_DUAL_TREE if( chromaNotSplit ) { CHECK( partitioner.chType != CHANNEL_TYPE_LUMA, "must be luma status" ); @@ -620,7 +605,6 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU //recover ModeType cs.modeType = partitioner.modeType = modeTypeParent; -#endif } if (startShareThisLevel == 1) shareStateDec = NO_SHARE; @@ -632,10 +616,8 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU partitioner.setCUData( cu ); cu.slice = cs.slice; cu.tileIdx = cs.picture->brickMap->getBrickIdxRsMap( currArea.lumaPos() ); -#if JVET_O0050_LOCAL_DUAL_TREE CHECK( cu.cs->treeType != partitioner.treeType, "treeType mismatch" ); int lumaQPinLocalDualTree = -1; -#endif // Predict QP on start of quantization group if( cuCtx.qgStart ) @@ -644,23 +626,15 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU cuCtx.qp = CU::predictQP( cu, cuCtx.qp ); } -#if JVET_O0050_LOCAL_DUAL_TREE if (pps.getUseDQP() && partitioner.isSepTree(cs) && isChroma(cu.chType)) -#else - if (pps.getUseDQP() && CS::isDualITree(cs) && isChroma(cu.chType)) -#endif { const Position chromaCentral(cu.chromaPos().offset(cu.chromaSize().width >> 1, cu.chromaSize().height >> 1)); const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, cu.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, cu.chromaFormat)); -#if JVET_O0050_LOCAL_DUAL_TREE //derive chroma qp, but the chroma qp is saved in cuCtx.qp which is used for luma qp //therefore, after decoding the chroma CU, the cuCtx.qp shall be recovered to luma qp in order to decode next luma cu qp const CodingUnit* colLumaCu = cs.getLumaCU( lumaRefPos ); CHECK( colLumaCu == nullptr, "colLumaCU shall exist" ); lumaQPinLocalDualTree = cuCtx.qp; -#else - const CodingUnit* colLumaCu = cs.getCU(lumaRefPos, CHANNEL_TYPE_LUMA); -#endif if (colLumaCu) cuCtx.qp = colLumaCu->qp; } @@ -673,23 +647,16 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU cu.shareParentSize = (shareStateDec == SHARING) ? shareParentSize : partitioner.currArea().lumaSize(); bool isLastCtu = coding_unit( cu, partitioner, cuCtx ); -#if JVET_O0050_LOCAL_DUAL_TREE //recover cuCtx.qp to luma qp after decoding the chroma CU if( pps.getUseDQP() && partitioner.isSepTree( cs ) && isChroma( cu.chType ) ) { cuCtx.qp = lumaQPinLocalDualTree; } -#endif -#if JVET_O0119_BASE_PALETTE_444 uint32_t compBegin; uint32_t numComp; bool jointPLT = false; -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.isSepTree()) -#else - if (CS::isDualITree(*cu.cs)) -#endif { if (isLuma(partitioner.chType)) { @@ -712,25 +679,19 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU { cs.reorderPrevPLT(cs.prevPLT, cu.curPLTSize, cu.curPLT, cu.reuseflag, compBegin, numComp, jointPLT); } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.chType == CHANNEL_TYPE_CHROMA ) { DTRACE( g_trace_ctx, D_QP, "[chroma CU]x=%d, y=%d, w=%d, h=%d, qp=%d\n", cu.Cb().x, cu.Cb().y, cu.Cb().width, cu.Cb().height, cu.qp ); } else { -#endif DTRACE( g_trace_ctx, D_QP, "x=%d, y=%d, w=%d, h=%d, qp=%d\n", cu.Y().x, cu.Y().y, cu.Y().width, cu.Y().height, cu.qp ); -#if JVET_O0050_LOCAL_DUAL_TREE } -#endif if (startShareThisLevel == 1) shareStateDec = NO_SHARE; return isLastCtu; } -#if JVET_O0050_LOCAL_DUAL_TREE ModeType CABACReader::mode_constraint( CodingStructure& cs, Partitioner &partitioner, PartSplit splitMode ) { int val = cs.signalModeCons( splitMode, partitioner, partitioner.modeType ); @@ -751,7 +712,6 @@ ModeType CABACReader::mode_constraint( CodingStructure& cs, Partitioner &partiti return partitioner.modeType; } } -#endif PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitioner ) { @@ -830,10 +790,6 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio // void cu_skip_flag ( cu ) // void pred_mode ( cu ) // void part_mode ( cu ) -#if !JVET_O0525_REMOVE_PCM -// void pcm_flag ( cu ) -// void pcm_samples ( tu ) -#endif // void cu_pred_data ( pus ) // void cu_lic_flag ( cu ) // void intra_luma_pred_modes ( pus ) @@ -846,10 +802,8 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& cuCtx ) { CodingStructure& cs = *cu.cs; -#if JVET_O0050_LOCAL_DUAL_TREE CHECK( cu.treeType != partitioner.treeType || cu.modeType != partitioner.modeType, "treeType or modeType mismatch" ); DTRACE( g_trace_ctx, D_SYNTAX, "coding_unit() treeType=%d modeType=%d\n", cu.treeType, cu.modeType ); -#endif // transquant bypass flag if( cs.pps->getTransquantBypassEnabledFlag() ) { @@ -875,15 +829,10 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& // prediction mode and partitioning data pred_mode ( cu ); -#if JVET_O0119_BASE_PALETTE_444 if (CU::isPLT(cu)) { cs.addTU(cu, partitioner.chType); -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.isSepTree()) -#else - if (CS::isDualITree(*cu.cs)) -#endif { if (isLuma(partitioner.chType)) { @@ -900,24 +849,9 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& } return end_of_ctu(cu, cuCtx); } -#endif bdpcm_mode( cu, ComponentID( partitioner.chType ) ); // --> create PUs -#if !JVET_O0525_REMOVE_PCM - // pcm samples - if( CU::isIntra(cu) ) - { - pcm_flag( cu, partitioner ); - if( cu.ipcm ) - { - TransformUnit& tu = cs.addTU( cu, partitioner.chType ); - pcm_samples( tu ); - return end_of_ctu( cu, cuCtx ); - } - } - -#endif // prediction data ( intra prediction modes / reference indexes + motion vectors ) cu_pred_data( cu ); @@ -942,21 +876,13 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SKIP_FLAG ); -#if JVET_O0050_LOCAL_DUAL_TREE if ((cu.slice->isIntra() || cu.isConsIntra()) && cu.cs->slice->getSPS()->getIBCFlag()) -#else - if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag()) -#endif { cu.skip = false; cu.rootCbf = false; cu.predMode = MODE_INTRA; cu.mmvdSkip = false; -#if JVET_O1161_IBC_MAX_SIZE if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#else - 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)); @@ -975,12 +901,10 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) { return; } -#if JVET_O0050_LOCAL_DUAL_TREE if( !cu.cs->slice->getSPS()->getIBCFlag() && cu.isConsIntra() ) { return; } -#endif unsigned ctxId = DeriveCtx::CtxSkipFlag(cu); unsigned skip = m_BinDecoder.decodeBin( Ctx::SkipFlag(ctxId) ); @@ -988,19 +912,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) if (skip && cu.cs->slice->getSPS()->getIBCFlag()) { -#if JVET_O1161_IBC_MAX_SIZE -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.lwidth() < 128 && cu.lheight() < 128 && !cu.isConsInter()) // disable IBC mode larger than 64x64 and disable IBC when only allowing inter mode -#else - if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#endif -#else -#if JVET_O0050_LOCAL_DUAL_TREE - if ((cu.lwidth() < 128 || cu.lheight() < 128) && !cu.isConsInter()) // disable IBC mode larger than 64x64 and disable IBC when only allowing inter mode -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif -#endif { if ( cu.lwidth() == 4 && cu.lheight() == 4 ) { @@ -1033,47 +945,6 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getIBCFlag()) || (skip && !cu.cs->slice->getSPS()->getIBCFlag())) { -#if !JVET_O0249_MERGE_SYNTAX - if (!cu.cs->slice->getSPS()->getUseMMVD() && (cu.firstPU->lwidth() * cu.firstPU->lheight() == 32)) - { - cu.firstPU->regularMergeFlag = true; - } - else - { - unsigned regularMergeFlag = (m_BinDecoder.decodeBin(Ctx::RegularMergeFlag(0))); - DTRACE(g_trace_ctx, D_SYNTAX, "regular_merge_flag() ctx=%d regularMergeFlag=%d\n", 0, regularMergeFlag?1:0); - cu.firstPU->regularMergeFlag = regularMergeFlag; - } - if (cu.firstPU->regularMergeFlag) - { - cu.mmvdSkip = false; - cu.firstPU->mmvdMergeFlag = false; - cu.firstPU->mhIntraFlag = false; - cu.affine = false; - cu.triangle = false; - } - else - { - if (cu.cs->slice->getSPS()->getUseMMVD()) - { - bool isCUWithOnlyRegularAndMMVD=((cu.firstPU->lwidth() == 8 && cu.firstPU->lheight() == 4) || (cu.firstPU->lwidth() == 4 && cu.firstPU->lheight() == 8)); - if (isCUWithOnlyRegularAndMMVD) - { - cu.mmvdSkip = !(cu.firstPU->regularMergeFlag); - } - else - { - 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); - } - } - else - { - cu.mmvdSkip = false; - } - } -#endif cu.skip = true; cu.rootCbf = false; cu.predMode = MODE_INTER; @@ -1109,12 +980,9 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 0 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 0 ); -#if JVET_O0057_ALTHPELIF cu.imv = value; -#endif if( sps->getAMVREnabledFlag() && value ) { -#if JVET_O0057_ALTHPELIF if (!CU::isIBC(cu)) { value = m_BinDecoder.decodeBin(Ctx::ImvFlag(4)); @@ -1123,19 +991,13 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) } if (value) { -#endif value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 1 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 1 ); value++; -#if JVET_O0057_ALTHPELIF cu.imv = value; } -#endif } -#if !JVET_O0057_ALTHPELIF - cu.imv = value; -#endif DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() IMVFlag=%d\n", cu.imv ); } @@ -1173,32 +1035,18 @@ void CABACReader::affine_amvr_mode( CodingUnit& cu, MergeCtx& mrgCtx ) void CABACReader::pred_mode( CodingUnit& cu ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__PRED_MODE ); -#if JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE if (cu.cs->slice->getSPS()->getIBCFlag() && cu.chType != CHANNEL_TYPE_CHROMA) -#else - if (cu.cs->slice->getSPS()->getIBCFlag()) -#endif { -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.isConsInter() ) { cu.predMode = MODE_INTER; return; } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) || cu.isConsIntra() ) -#else - if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) ) -#endif { cu.predMode = MODE_INTRA; -#if JVET_O1161_IBC_MAX_SIZE if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx))) @@ -1206,7 +1054,6 @@ void CABACReader::pred_mode( CodingUnit& cu ) cu.predMode = MODE_IBC; } } -#if JVET_O0119_BASE_PALETTE_444 if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) @@ -1214,14 +1061,12 @@ void CABACReader::pred_mode( CodingUnit& cu ) cu.predMode = MODE_PLT; } } -#endif } else { if (m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)))) { cu.predMode = MODE_INTRA; -#if JVET_O0119_BASE_PALETTE_444 if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) @@ -1229,16 +1074,11 @@ void CABACReader::pred_mode( CodingUnit& cu ) cu.predMode = MODE_PLT; } } -#endif } else { cu.predMode = MODE_INTER; -#if JVET_O1161_IBC_MAX_SIZE if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx))) @@ -1251,20 +1091,13 @@ void CABACReader::pred_mode( CodingUnit& cu ) } else { -#if JVET_O0119_BASE_PALETTE_444 -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.isConsInter() ) { cu.predMode = MODE_INTER; return; } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE if ( cu.cs->slice->isIntra() || (cu.lwidth() == 4 && cu.lheight() == 4) || cu.isConsIntra() ) -#else - if ( cu.cs->slice->isIntra() || (cu.lwidth() == 4 && cu.lheight() == 4) ) -#endif { cu.predMode = MODE_INTRA; if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) @@ -1278,7 +1111,11 @@ void CABACReader::pred_mode( CodingUnit& cu ) else { cu.predMode = m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))) ? MODE_INTRA : MODE_INTER; +#if JVET_P0516_PLT_BINARIZATION + if (CU::isIntra(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) +#else if (!CU::isIntra(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) +#endif { if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0))) { @@ -1286,32 +1123,13 @@ void CABACReader::pred_mode( CodingUnit& cu ) } } } -#else -#if JVET_O0050_LOCAL_DUAL_TREE - if( cu.isConsIntra() || cu.isConsInter() ) - { - cu.predMode = cu.isConsIntra() ? MODE_INTRA : MODE_INTER; - return; - } -#endif - if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) || m_BinDecoder.decodeBin( Ctx::PredMode( DeriveCtx::CtxPredModeFlag( cu ) ) ) ) - { - cu.predMode = MODE_INTRA; - } - else - { - cu.predMode = MODE_INTER; - } -#endif } } void CABACReader::bdpcm_mode( CodingUnit& cu, const ComponentID compID ) { cu.bdpcmMode = 0; -#if JVET_O1136_TS_BDPCM_SIGNALLING if( !cu.cs->sps->getBDPCMEnabledFlag() ) return; -#endif if( !CU::bdpcmAllowed( cu, compID ) ) return; RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__BDPCM_MODE, cu.block(compID).lumaSize(), compID ); @@ -1325,20 +1143,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 ); } -#if !JVET_O0525_REMOVE_PCM -void CABACReader::pcm_flag( CodingUnit& cu, Partitioner &partitioner ) -{ - const SPS& sps = *cu.cs->sps; - if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) - || partitioner.currArea().lheight() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lheight() < (1 << sps.getPCMLog2MinSize()) ) - { - cu.ipcm = false; - return; - } - cu.ipcm = ( m_BinDecoder.decodeBinTrm() ); -} - -#endif void CABACReader::cu_pred_data( CodingUnit &cu ) { @@ -1384,11 +1188,7 @@ void CABACReader::cu_gbi_flag(CodingUnit& cu) uint32_t symbol = m_BinDecoder.decodeBin(Ctx::GBiIdx(0)); int32_t numGBi = (cu.slice->getCheckLDC()) ? 5 : 3; -#if JVET_O0126_BPWA_INDEX_CODING_FIX if(symbol == 1) -#else - if(symbol == 0) -#endif { uint32_t prefixNumBits = numGBi - 2; uint32_t step = 1; @@ -1398,11 +1198,7 @@ void CABACReader::cu_gbi_flag(CodingUnit& cu) for(int ui = 0; ui < prefixNumBits; ++ui) { symbol = m_BinDecoder.decodeBinEP(); -#if JVET_O0126_BPWA_INDEX_CODING_FIX if (symbol == 0) -#else - if (symbol == 1) -#endif { break; } @@ -1450,14 +1246,7 @@ void CABACReader::xReadTruncBinCode(uint32_t& symbol, uint32_t maxSymbol) void CABACReader::extend_ref_line(CodingUnit& cu) { -#if !ENABLE_JVET_L0283_MRL - return; -#endif -#if !JVET_O0525_REMOVE_PCM - 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.bdpcmMode ) -#endif { cu.firstPU->multiRefIdx = 0; return; @@ -1500,14 +1289,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) if( cu.bdpcmMode ) { -#if JVET_O0315_RDPCM_INTRAMODE_ALIGN cu.firstPU->intraDir[0] = cu.bdpcmMode == 2? VER_IDX : HOR_IDX; -#else - PredictionUnit *pu = cu.firstPU; - unsigned mpm_pred[NUM_MOST_PROBABLE_MODES]; - PU::getIntraMPMs(*pu, mpm_pred); - cu.firstPU->intraDir[0] = mpm_pred[0]; -#endif return; } @@ -1528,11 +1310,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) for( int k = 0; k < numBlocks; k++ ) { CHECK(numBlocks != 1, "not supported yet"); -#if JVET_O0502_ISP_CLEANUP if ( cu.firstPU->multiRefIdx ) -#else - if( cu.firstPU->multiRefIdx || ( cu.ispMode && isLuma( cu.chType ) ) ) -#endif { mpmFlag[0] = true; } @@ -1602,11 +1380,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) void CABACReader::intra_chroma_pred_modes( CodingUnit& cu ) { -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.chromaFormat == CHROMA_400 || ( cu.isSepTree() && cu.chType == CHANNEL_TYPE_LUMA ) ) -#else - if( cu.chromaFormat == CHROMA_400 || ( CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_LUMA ) ) -#endif { return; } @@ -1618,7 +1392,6 @@ void CABACReader::intra_chroma_pred_modes( CodingUnit& cu ) intra_chroma_pred_mode( *pu ); } } -#if JVET_O1153_INTRA_CHROMAMODE_CODING bool CABACReader::intra_chroma_lmc_mode(PredictionUnit& pu) { int lmModeList[10]; @@ -1643,11 +1416,7 @@ void CABACReader::intra_chroma_pred_mode(PredictionUnit& pu) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__INTRA_DIR_ANG, pu.cu->blocks[pu.chType].lumaSize(), CHANNEL_TYPE_CHROMA); // LM chroma mode -#if JVET_O1124_ALLOW_CCLM_COND if (pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed()) -#else - if (pu.cs->sps->getUseLMChroma()) -#endif { bool isLMCMode = m_BinDecoder.decodeBin(Ctx::CclmModeFlag(0)) ? true : false; if (isLMCMode) @@ -1674,54 +1443,6 @@ void CABACReader::intra_chroma_pred_mode(PredictionUnit& pu) pu.intraDir[1] = chromaCandModes[candId]; } -#else -bool CABACReader::intra_chroma_lmc_mode( PredictionUnit& pu ) -{ - int lmModeList[10]; - int maxSymbol = PU::getLMSymbolList(pu, lmModeList); - int symbol = unary_max_symbol(Ctx::IntraChromaPredMode(1), Ctx::IntraChromaPredMode(2), maxSymbol - 1); - if (lmModeList[symbol] != -1) - { - pu.intraDir[1] = lmModeList[symbol]; - return true; - } - return false; -} - -void CABACReader::intra_chroma_pred_mode( PredictionUnit& pu ) -{ - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__INTRA_DIR_ANG, pu.cu->blocks[pu.chType].lumaSize(), CHANNEL_TYPE_CHROMA ); - - if (m_BinDecoder.decodeBin(Ctx::IntraChromaPredMode(0)) == 0) - { - pu.intraDir[1] = DM_CHROMA_IDX; - return; - } - - // LM chroma mode -#if JVET_O1124_ALLOW_CCLM_COND - if( pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed() ) -#else - if( pu.cs->sps->getUseLMChroma() ) -#endif - { - if( intra_chroma_lmc_mode( pu ) ) - { - return; - } - } - unsigned candId = m_BinDecoder.decodeBinsEP( 2 ); - - unsigned chromaCandModes[ NUM_CHROMA_MODE ]; - PU::getIntraChromaCandModes( pu, chromaCandModes ); - - CHECK( candId >= NUM_CHROMA_MODE, "Chroma prediction mode index out of bounds" ); - CHECK( PU::isLMCMode( chromaCandModes[ candId ] ), "The intra dir cannot be LM_CHROMA for this path" ); - CHECK( chromaCandModes[ candId ] == DM_CHROMA_IDX, "The intra dir cannot be DM_CHROMA for this path" ); - - pu.intraDir[1] = chromaCandModes[ candId ]; -} -#endif void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& cuCtx ) { if (!CU::isIntra(cu)) @@ -1753,37 +1474,21 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& return; } } -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] = false; cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; -#endif -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS cuCtx.lfnstLastScanPos = false; -#endif ChromaCbfs chromaCbfs; if( cu.ispMode && isLuma( partitioner.chType ) ) { TUIntraSubPartitioner subTuPartitioner( partitioner ); -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_tree( *cu.cs, subTuPartitioner, cuCtx, CU::getISPType(cu, getFirstComponentOfChannel(partitioner.chType)), 0 ); -#else - transform_tree( *cu.cs, subTuPartitioner, cuCtx, chromaCbfs, CU::getISPType( cu, getFirstComponentOfChannel( partitioner.chType ) ), 0 ); -#endif } else { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_tree( *cu.cs, partitioner, cuCtx ); -#else - transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); -#endif } -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS residual_lfnst_mode( cu, cuCtx ); -#else - residual_lfnst_mode( cu ); -#endif } void CABACReader::rqt_root_cbf( CodingUnit& cu ) @@ -1854,23 +1559,11 @@ void CABACReader::sbt_mode( CodingUnit& cu ) bool CABACReader::end_of_ctu( CodingUnit& cu, CUCtx& cuCtx ) { -#if !JVET_O1164_PS - const SPS &sps = *cu.cs->sps; -#endif const Position rbPos = recalcPosition( cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].bottomRight().offset( 1, 1 ) ); -#if JVET_O1164_PS if( ( ( rbPos.x & cu.cs->pcv->maxCUWidthMask ) == 0 || rbPos.x == cu.cs->pps->getPicWidthInLumaSamples() ) && ( ( rbPos.y & cu.cs->pcv->maxCUHeightMask ) == 0 || rbPos.y == cu.cs->pps->getPicHeightInLumaSamples() ) -#else - if ( ( ( rbPos.x & cu.cs->pcv->maxCUWidthMask ) == 0 || rbPos.x == sps.getPicWidthInLumaSamples () ) - && ( ( rbPos.y & cu.cs->pcv->maxCUHeightMask ) == 0 || rbPos.y == sps.getPicHeightInLumaSamples() ) -#endif -#if JVET_O0050_LOCAL_DUAL_TREE && ( !cu.isSepTree() || cu.chromaFormat == CHROMA_400 || isChroma( cu.chType ) ) -#else - && ( !CS::isDualITree( *cu.cs ) || cu.chromaFormat == CHROMA_400 || isChroma( cu.chType ) ) -#endif ) { cuCtx.isDQPCoded = ( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded ); @@ -1881,7 +1574,6 @@ bool CABACReader::end_of_ctu( CodingUnit& cu, CUCtx& cuCtx ) return false; } -#if JVET_O0119_BASE_PALETTE_444 void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_t numComp, CUCtx& cuCtx) { const SPS& sps = *(cu.cs->sps); @@ -1968,28 +1660,16 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ if (cu.useEscape[compBegin] && cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded) { -#if JVET_O0050_LOCAL_DUAL_TREE if (!cu.isSepTree() || isLuma(tu.chType)) -#else - if (!CS::isDualITree(*tu.cs) || isLuma(tu.chType)) -#endif { cu_qp_delta(cu, cuCtx.qp, cu.qp); cuCtx.qp = cu.qp; cuCtx.isDQPCoded = true; } } -#if JVET_O1168_CU_CHROMA_QP_OFFSET if (cu.useEscape[compBegin] && cu.cs->slice->getUseChromaQpAdj() && !cuCtx.isChromaQpAdjCoded) -#else - if (cu.cs->slice->getUseChromaQpAdj() && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded) -#endif { -#if JVET_O0050_LOCAL_DUAL_TREE if (!cu.isSepTree() || isChroma(tu.chType)) -#else - if (!CS::isDualITree(*tu.cs) || isChroma(tu.chType)) -#endif { cu_chroma_qp_offset(cu); cuCtx.isChromaQpAdjCoded = true; @@ -2289,7 +1969,6 @@ uint32_t CABACReader::xReadTruncMsbP1RefinementBits(PLTRunMode runtype, uint32_t return symbol; } -#endif //================================================================================ // clause 7.3.8.6 @@ -2315,41 +1994,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) } if( pu.mergeFlag ) { -#if JVET_O0249_MERGE_SYNTAX merge_data(pu); -#else - if (CU::isIBC(*pu.cu)) - { - merge_idx(pu); - } - else - { - if (pu.regularMergeFlag) - { - merge_idx(pu); - } - else - { - subblock_merge_flag( *pu.cu ); - MHIntra_flag(pu); - if (pu.mhIntraFlag) - { - pu.intraDir[0] = PLANAR_IDX; - pu.intraDir[1] = DM_CHROMA_IDX; - } - else - { - pu.cu->triangle = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && !pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip && pu.cs->slice->getMaxNumTriangleCand() >= 2; - } - if (pu.mmvdMergeFlag) - { - mmvd_merge_idx(pu); - } - else - merge_data ( pu ); - } - } -#endif } else if (CU::isIBC(*pu.cu)) { @@ -2357,17 +2002,11 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) pu.cu->affine = false; pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF; mvd_coding(pu.mvd[REF_PIC_LIST_0]); -#if JVET_O0162_IBC_MVP_FLAG -#if JVET_O0455_IBC_MAX_MERGE_NUM if ( pu.cu->slice->getMaxNumIBCMergeCand() == 1 ) -#else - if ( pu.cu->slice->getMaxNumMergeCand() == 1 ) -#endif { pu.mvpIdx[REF_PIC_LIST_0] = 0; } else -#endif mvp_flag(pu, REF_PIC_LIST_0); } else @@ -2436,9 +2075,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) { RefPicList eCurRefList = (RefPicList)(pu.cu->smvdMode - 1); pu.mvd[1 - eCurRefList].set( -pu.mvd[eCurRefList].hor, -pu.mvd[eCurRefList].ver ); -#if JVET_O0567_MVDRange_Constraint CHECK(!((pu.mvd[1 - eCurRefList].getHor() >= MVD_MIN) && (pu.mvd[1 - eCurRefList].getHor() <= MVD_MAX)) || !((pu.mvd[1 - eCurRefList].getVer() >= MVD_MIN) && (pu.mvd[1 - eCurRefList].getVer() <= MVD_MAX)), "Illegal MVD value"); -#endif pu.refIdx[1 - eCurRefList] = pu.cs->slice->getSymRefIdx( 1 - eCurRefList ); } @@ -2467,29 +2104,14 @@ void CABACReader::smvd_mode( PredictionUnit& pu ) void CABACReader::subblock_merge_flag( CodingUnit& cu ) { -#if JVET_O0249_MERGE_SYNTAX cu.affine = false; -#else - if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) ) - { - return; - } -#endif -#if JVET_O0220_METHOD1_SUBBLK_FLAG_PARSING if ( !cu.cs->slice->isIntra() && (cu.slice->getMaxNumAffineMergeCand() > 0) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) -#else - if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getUseAffine() || cu.cs->sps->getSBTMVPEnabledFlag()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) -#endif { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG ); unsigned ctxId = DeriveCtx::CtxAffineFlag( cu ); -#if JVET_O0500_SEP_CTX_AFFINE_SUBBLOCK_MRG cu.affine = m_BinDecoder.decodeBin( Ctx::SubblockMergeFlag( ctxId ) ); -#else - cu.affine = m_BinDecoder.decodeBin( Ctx::AffineFlag( ctxId ) ); -#endif DTRACE( g_trace_ctx, D_SYNTAX, "subblock_merge_flag() subblock_merge_flag=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y ); } } @@ -2531,53 +2153,11 @@ void CABACReader::merge_flag( PredictionUnit& pu ) pu.regularMergeFlag = false; return; } -#if !JVET_O0249_MERGE_SYNTAX - if (pu.mergeFlag) - { - if (!pu.cs->sps->getUseMMVD() && (pu.lwidth() * pu.lheight() == 32)) - { - pu.regularMergeFlag = true; - } - else - { - pu.regularMergeFlag = (m_BinDecoder.decodeBin(Ctx::RegularMergeFlag(1))); - DTRACE(g_trace_ctx, D_SYNTAX, "regular_merge_flag() ctx=%d pu.regularMergeFlag=%d\n", 1, pu.regularMergeFlag?1:0); - } - if (pu.regularMergeFlag) - { - pu.mmvdMergeFlag = false; - pu.mhIntraFlag = false; - pu.cu->affine = false; - pu.cu->triangle = false; - } - else - { - if (pu.cs->sps->getUseMMVD()) - { - bool isCUWithOnlyRegularAndMMVD=((pu.lwidth() == 8 && pu.lheight() == 4) || (pu.lwidth() == 4 && pu.lheight() == 8)); - if (isCUWithOnlyRegularAndMMVD) - { - pu.mmvdMergeFlag = !(pu.regularMergeFlag); - } - else - { - 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); - } - } - else - { - pu.mmvdMergeFlag = false; - } - } - } -#endif } void CABACReader::merge_data( PredictionUnit& pu ) { -#if JVET_O0249_MERGE_SYNTAX if (CU::isIBC(*pu.cu)) { merge_idx(pu); @@ -2649,9 +2229,6 @@ void CABACReader::merge_data( PredictionUnit& pu ) } } if (pu.mmvdMergeFlag || pu.cu->mmvdSkip) -#else - if (pu.cu->mmvdSkip) -#endif { mmvd_merge_idx(pu); } @@ -2729,12 +2306,10 @@ void CABACReader::merge_idx( PredictionUnit& pu ) return; } -#if JVET_O0455_IBC_MAX_MERGE_NUM if (pu.cu->predMode == MODE_IBC) { numCandminus1 = int(pu.cs->slice->getMaxNumIBCMergeCand()) - 1; } -#endif if( numCandminus1 > 0 ) { if( m_BinDecoder.decodeBin( Ctx::MergeIdx() ) ) @@ -2820,13 +2395,25 @@ void CABACReader::inter_pred_idc( PredictionUnit& pu ) return; } } +#if JVET_P0042_FIX_INTER_DIR_CTX + if( m_BinDecoder.decodeBin( Ctx::InterDir(5) ) ) +#else if( m_BinDecoder.decodeBin( Ctx::InterDir(4) ) ) +#endif { +#if JVET_P0042_FIX_INTER_DIR_CTX + DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", 2, pu.lumaPos().x, pu.lumaPos().y ); +#else DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=4 value=%d pos=(%d,%d)\n", 2, pu.lumaPos().x, pu.lumaPos().y ); +#endif pu.interDir = 2; return; } +#if JVET_P0042_FIX_INTER_DIR_CTX + DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", 1, pu.lumaPos().x, pu.lumaPos().y ); +#else DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=4 value=%d pos=(%d,%d)\n", 1, pu.lumaPos().x, pu.lumaPos().y ); +#endif pu.interDir = 1; return; } @@ -2896,23 +2483,6 @@ void CABACReader::MHIntra_flag(PredictionUnit& pu) return; } -#if !JVET_O0249_MERGE_SYNTAX - if (pu.mmvdMergeFlag) - { - pu.mhIntraFlag = false; - return; - } - if (pu.cu->affine) - { - pu.mhIntraFlag = false; - return; - } - if (pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE) - { - pu.mhIntraFlag = false; - return; - } -#endif RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__MH_INTRA_FLAG); pu.mhIntraFlag = (m_BinDecoder.decodeBin(Ctx::MHIntraFlag())); @@ -2921,46 +2491,6 @@ void CABACReader::MHIntra_flag(PredictionUnit& pu) -#if !JVET_O0525_REMOVE_PCM -//================================================================================ -// clause 7.3.8.7 -//-------------------------------------------------------------------------------- -// void pcm_samples( tu ) -//================================================================================ - -void CABACReader::pcm_samples( TransformUnit& tu ) -{ - CHECK( !tu.cu->ipcm, "pcm mode expected" ); -#if !JVET_O0050_LOCAL_DUAL_TREE - const CodingStructure *cs = tu.cs; -#endif - const ChannelType chType = tu.chType; - - const SPS& sps = *tu.cu->cs->sps; - tu.depth = 0; - -#if JVET_O0050_LOCAL_DUAL_TREE - ComponentID compStr = (tu.cu->isSepTree() && !isLuma( chType )) ? COMPONENT_Cb : COMPONENT_Y; - ComponentID compEnd = (tu.cu->isSepTree() && isLuma( chType )) ? COMPONENT_Y : COMPONENT_Cr; -#else - ComponentID compStr = (CS::isDualITree(*cs) && !isLuma(chType)) ? COMPONENT_Cb: COMPONENT_Y; - ComponentID compEnd = (CS::isDualITree(*cs) && isLuma(chType)) ? COMPONENT_Y : COMPONENT_Cr; -#endif - for( ComponentID compID = compStr; compID <= compEnd; compID = ComponentID(compID+1) ) - { - PelBuf samples = tu.getPcmbuf( compID ); - const unsigned sampleBits = sps.getPCMBitDepth( toChannelType(compID) ); - for( unsigned y = 0; y < samples.height; y++ ) - { - for( unsigned x = 0; x < samples.width; x++ ) - { - samples.at(x, y) = m_BinDecoder.decodeBinsPCM( sampleBits ); - } - } - } - m_BinDecoder.start(); -} -#endif //================================================================================ // clause 7.3.8.8 @@ -2970,13 +2500,8 @@ void CABACReader::pcm_samples( TransformUnit& tu ) // bool cbf_comp ( area, depth ) //================================================================================ -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, CUCtx& cuCtx, const PartSplit ispType, const int subTuIdx ) -#else -void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType, const int subTuIdx ) -#endif { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC const UnitArea& area = partitioner.currArea(); CodingUnit& cu = *cs.getCU(area.blocks[partitioner.chType], partitioner.chType); int subTuCounter = subTuIdx; @@ -2984,23 +2509,6 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, // split_transform_flag bool split = partitioner.canSplit(TU_MAX_TR_SPLIT, cs); const unsigned trDepth = partitioner.currTrDepth; -#else - ChromaCbfs chromaCbfsLastDepth; - chromaCbfsLastDepth.Cb = chromaCbfs.Cb; - chromaCbfsLastDepth.Cr = chromaCbfs.Cr; - const UnitArea& area = partitioner.currArea(); - - CodingUnit& cu = *cs.getCU( area.blocks[partitioner.chType], partitioner.chType ); - const unsigned trDepth = partitioner.currTrDepth; - int subTuCounter = subTuIdx; - - // split_transform_flag - bool split = false; - - split = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); - - bool max_tu_split = split; -#endif if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) { @@ -3011,38 +2519,6 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, { split = partitioner.canSplit( ispType, cs ); } -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode && !split; - - // cbf_cb & cbf_cr -#if JVET_O0050_LOCAL_DUAL_TREE - if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !cu.isSepTree() || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) -#else - if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) -#endif - { - const int cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; - if (!max_tu_split) - { - { - if (!(cu.sbtInfo && trDepth == 1)) - chromaCbfs.Cb &= cbf_comp(cs, area.blocks[COMPONENT_Cb], cbfDepth); - } - { - if (!(cu.sbtInfo && trDepth == 1)) - chromaCbfs.Cr &= cbf_comp(cs, area.blocks[COMPONENT_Cr], cbfDepth, chromaCbfs.Cb); - } - } - } -#if JVET_O0050_LOCAL_DUAL_TREE - else if( cu.isSepTree() ) -#else - else if( CS::isDualITree( cs ) ) -#endif - { - chromaCbfs = ChromaCbfs( false ); - } -#endif if( split ) { @@ -3071,53 +2547,18 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, do { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_tree( cs, partitioner, cuCtx, ispType, subTuCounter ); -#else - ChromaCbfs subCbfs = chromaCbfs; - transform_tree( cs, partitioner, cuCtx, subCbfs, ispType, subTuCounter ); -#endif subTuCounter += subTuCounter != -1 ? 1 : 0; } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - const UnitArea &currArea = partitioner.currArea(); - const unsigned currDepth = partitioner.currTrDepth; - const unsigned numTBlocks = getNumberValidTBlocks( *cs.pcv ); - - unsigned compCbf[3] = { 0, 0, 0 }; - unsigned cbfDepth = 0; - for( auto &currTU : cs.traverseTUs( currArea, partitioner.chType ) ) - { - for( unsigned ch = 0; ch < numTBlocks; ch++ ) - { - cbfDepth = !isLuma( ComponentID( ch ) ) && cu.ispMode ? currDepth : currDepth + 1; - compCbf[ch] |= ( TU::getCbfAtDepth( currTU, ComponentID( ch ), cbfDepth ) ? 1 : 0 ); - } - } - - for (auto &currTU: cs.traverseTUs(currArea, partitioner.chType)) - { - TU::setCbfAtDepth(currTU, COMPONENT_Y, currDepth, compCbf[COMPONENT_Y]); - if (currArea.chromaFormat != CHROMA_400) - { - TU::setCbfAtDepth(currTU, COMPONENT_Cb, currDepth, compCbf[COMPONENT_Cb]); - TU::setCbfAtDepth(currTU, COMPONENT_Cr, currDepth, compCbf[COMPONENT_Cr]); - } - } -#endif } else { TransformUnit &tu = cs.addTU( CS::getArea( cs, area, partitioner.chType ), partitioner.chType ); unsigned numBlocks = ::getNumberValidTBlocks( *cs.pcv ); tu.checkTuNoResidual( partitioner.currPartIdx() ); -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - chromaCbfs.Cb &= !tu.noResidual; - chromaCbfs.Cr &= !tu.noResidual; -#endif for( unsigned compID = COMPONENT_Y; compID < numBlocks; compID++ ) { @@ -3130,72 +2571,13 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, tu.depth = trDepth; DTRACE( g_trace_ctx, D_SYNTAX, "transform_unit() pos=(%d,%d) size=%dx%d depth=%d trDepth=%d\n", tu.blocks[tu.chType].x, tu.blocks[tu.chType].y, tu.blocks[tu.chType].width, tu.blocks[tu.chType].height, cu.depth, partitioner.currTrDepth ); -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_unit(tu, cuCtx, partitioner, subTuCounter); -#else - if( !isChroma( partitioner.chType ) ) - { - if( !CU::isIntra( cu ) && trDepth == 0 && !chromaCbfs.sigChroma( area.chromaFormat ) ) - { - TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, 1 ); - } - else if( cu.sbtInfo && tu.noResidual ) - { - TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, 0 ); - } - else if( cu.sbtInfo && !chromaCbfsLastDepth.sigChroma( area.chromaFormat ) ) - { - assert( !tu.noResidual ); - TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, 1 ); - } - else - { - bool previousCbf = false; - bool rootCbfSoFar = false; - bool lastCbfIsInferred = false; - if( cu.ispMode ) - { - uint32_t nTus = cu.ispMode == HOR_INTRA_SUBPARTITIONS ? cu.lheight() >> floorLog2(tu.lheight()) : cu.lwidth() >> floorLog2(tu.lwidth()); - if( subTuCounter == nTus - 1 ) - { - TransformUnit* tuPointer = cu.firstTU; - for( int tuIdx = 0; tuIdx < nTus - 1; tuIdx++ ) - { - rootCbfSoFar |= TU::getCbfAtDepth( *tuPointer, COMPONENT_Y, trDepth ); - tuPointer = tuPointer->next; - } - if( !rootCbfSoFar ) - { - lastCbfIsInferred = true; - } - } - if( !lastCbfIsInferred ) - { - previousCbf = TU::getPrevTuCbfAtDepth( tu, COMPONENT_Y, trDepth ); - } - } - bool cbfY = lastCbfIsInferred ? true : cbf_comp( cs, tu.Y(), trDepth, previousCbf, cu.ispMode ); - TU::setCbfAtDepth( tu, COMPONENT_Y, trDepth, ( cbfY ? 1 : 0 ) ); - } - } - if( area.chromaFormat != CHROMA_400 && ( !cu.ispMode || chromaCbfISP ) ) - { - TU::setCbfAtDepth( tu, COMPONENT_Cb, trDepth, ( chromaCbfs.Cb ? 1 : 0 ) ); - TU::setCbfAtDepth( tu, COMPONENT_Cr, trDepth, ( chromaCbfs.Cr ? 1 : 0 ) ); - } - - transform_unit(tu, cuCtx, chromaCbfs); -#endif } } bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbf, const bool useISP ) { -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, prevCbf, useISP && isLuma( area.compID ) ); -#else - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbf, useISP && isLuma( area.compID ) ); -#endif const CtxSet& ctxSet = Ctx::QtCbf[ area.compID ]; RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(STATS__CABAC_BITS__QT_CBF, area.size(), area.compID); @@ -3203,11 +2585,7 @@ bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned unsigned cbf = 0; if( area.compID == COMPONENT_Y && cs.getCU( area.pos(), ChannelType( area.compID ) )->bdpcmMode ) { -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX cbf = m_BinDecoder.decodeBin( ctxSet( 1 ) ); -#else - cbf = m_BinDecoder.decodeBin( ctxSet( 4 ) ); -#endif } else { @@ -3273,9 +2651,7 @@ void CABACReader::mvd_coding( Mv &rMvd ) } } rMvd = Mv(horAbs, verAbs); -#if JVET_O0567_MVDRange_Constraint CHECK(!((horAbs >= MVD_MIN) && (horAbs <= MVD_MAX)) || !((verAbs >= MVD_MIN) && (verAbs <= MVD_MAX)), "Illegal MVD value"); -#endif } @@ -3286,13 +2662,8 @@ void CABACReader::mvd_coding( Mv &rMvd ) // void cu_qp_delta ( cu ) // void cu_chroma_qp_offset ( cu ) //================================================================================ -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, Partitioner& partitioner, const int subTuCounter) -#else -void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ) -#endif { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC const UnitArea& area = partitioner.currArea(); const unsigned trDepth = partitioner.currTrDepth; @@ -3304,11 +2675,7 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode; // cbf_cb & cbf_cr -#if JVET_O0050_LOCAL_DUAL_TREE if (area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && (!cu.isSepTree() || partitioner.chType == CHANNEL_TYPE_CHROMA) && (!cu.ispMode || chromaCbfISP)) -#else - if (area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && (!CS::isDualITree(cs) || partitioner.chType == CHANNEL_TYPE_CHROMA) && (!cu.ispMode || chromaCbfISP)) -#endif { const int cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; { @@ -3319,11 +2686,7 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c chromaCbfs.Cr = cbf_comp(cs, area.blocks[COMPONENT_Cr], cbfDepth, chromaCbfs.Cb); } } -#if JVET_O0050_LOCAL_DUAL_TREE else if (cu.isSepTree()) -#else - else if (CS::isDualITree(cs)) -#endif { chromaCbfs = ChromaCbfs(false); } @@ -3378,23 +2741,12 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c TU::setCbfAtDepth(tu, COMPONENT_Cb, trDepth, (chromaCbfs.Cb ? 1 : 0)); TU::setCbfAtDepth(tu, COMPONENT_Cr, trDepth, (chromaCbfs.Cr ? 1 : 0)); } -#else - CodingUnit& cu = *tu.cu; -#endif bool lumaOnly = ( cu.chromaFormat == CHROMA_400 || !tu.blocks[COMPONENT_Cb].valid() ); bool cbfLuma = ( tu.cbf[ COMPONENT_Y ] != 0 ); bool cbfChroma = ( lumaOnly ? false : ( chromaCbfs.Cb || chromaCbfs.Cr ) ); -#if JVET_O0046_DQ_SIGNALLING if( ( cu.lwidth() > 64 || cu.lheight() > 64 || cbfLuma || cbfChroma ) && -#else - if( ( cbfLuma || cbfChroma ) && -#endif -#if JVET_O0050_LOCAL_DUAL_TREE (!tu.cu->isSepTree() || isLuma(tu.chType)) ) -#else - (!CS::isDualITree(*tu.cs) || isLuma(tu.chType)) ) -#endif { if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded ) { @@ -3403,30 +2755,20 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c cuCtx.isDQPCoded = true; } } -#if JVET_O1168_CU_CHROMA_QP_OFFSET if (cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cuCtx.isChromaQpAdjCoded) -#else - if( cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded ) -#endif { cu_chroma_qp_offset( cu ); cuCtx.isChromaQpAdjCoded = true; } -#if JVET_O0105_ICT if( !lumaOnly ) { joint_cb_cr( tu, ( tu.cbf[COMPONENT_Cb] ? 2 : 0 ) + ( tu.cbf[COMPONENT_Cr] ? 1 : 0 ) ); } -#endif if( cbfLuma ) { -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS residual_coding( tu, COMPONENT_Y, cuCtx ); -#else - residual_coding( tu, COMPONENT_Y ); -#endif } if( !lumaOnly ) { @@ -3438,11 +2780,7 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c } if( tu.cbf[ compID ] ) { -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS residual_coding( tu, compID, cuCtx ); -#else - residual_coding( tu, compID ); -#endif } } } @@ -3502,57 +2840,27 @@ void CABACReader::cu_chroma_qp_offset( CodingUnit& cu ) // void residual_coding_subblock( coeffCtx ) //================================================================================ -#if JVET_O0105_ICT void CABACReader::joint_cb_cr( TransformUnit& tu, const int cbfMask ) { -#if JVET_O0376_SPS_JOINTCBCR_FLAG if ( !tu.cu->slice->getSPS()->getJointCbCrEnabledFlag() ) { return; } -#endif -#if JVET_O0543_ICT_ICU_ONLY if( ( CU::isIntra( *tu.cu ) && cbfMask ) || ( cbfMask == 3 ) ) -#else - if( cbfMask ) -#endif { 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( cbfMask-1 ) ) ? cbfMask : 0 ); } } -#else -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 -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& cuCtx ) -#else -void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) -#endif { 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_O0105_ICT if( compID == COMPONENT_Cr && tu.jointCbCr == 3 ) return; -#else - // Joint Cb-Cr residual mode is signalled if both Cb and Cr cbfs are true - if ( compID == COMPONENT_Cr && TU::getCbf( tu, COMPONENT_Cb ) ) - { - joint_cb_cr( tu ); - - // No Cr residual in bitstream in joint Cb-Cr residual mode - if ( tu.jointCbCr ) - return; - } -#endif // parse transform skip and explicit rdpcm mode mts_coding ( tu, compID ); @@ -3582,37 +2890,27 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) // parse last coeff position cctx.setScanPosLast( last_sig_coeff( cctx, tu, compID ) ); -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS if( tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) { const int maxLfnstPos = ((tu.blocks[compID].height == 4 && tu.blocks[compID].width == 4) || (tu.blocks[compID].height == 8 && tu.blocks[compID].width == 8)) ? 7 : 15; cuCtx.violatesLfnstConstrained[ toChannelType(compID) ] |= cctx.scanPosLast() > maxLfnstPos; } -#endif -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS if( tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) { const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; cuCtx.lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; } -#endif // parse subblocks const int stateTransTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int ctxBinSampleRatio = (compID == COMPONENT_Y) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA; cctx.regBinLimit = (tu.getTbAreaAfterCoefZeroOut(compID) * ctxBinSampleRatio) >> 4; -#endif for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--) { cctx.initSubblock ( subSetId ); -#if JVET_O0538_SPS_CONTROL_ISP_SBT if( ( tu.mtsIdx > MTS_SKIP || ( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif { if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) ) || ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) ) { @@ -3626,9 +2924,6 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) { -#if !JVET_O0294_TRANSFORM_CLEANUP - const CodingUnit &cu = *tu.cu; -#endif const bool tsAllowed = TU::isTSAllowed ( tu, compID ); const bool mtsAllowed = TU::isMTSAllowed( tu, compID ); @@ -3644,22 +2939,14 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) { ctxIdx = 6; symbol = m_BinDecoder.decodeBin( Ctx::MTSIndex( ctxIdx ) ); -#if JVET_O0294_TRANSFORM_CLEANUP tu.mtsIdx = symbol ? MTS_SKIP : MTS_DCT2_DCT2; -#else - tu.mtsIdx = symbol ? MTS_DCT2_DCT2 : MTS_SKIP; -#endif } if( tu.mtsIdx != MTS_SKIP ) { if( mtsAllowed ) { -#if JVET_O0294_TRANSFORM_CLEANUP ctxIdx = 0; -#else - ctxIdx = std::min( (int)cu.qtDepth, 5 ); -#endif symbol = m_BinDecoder.decodeBin( Ctx::MTSIndex( ctxIdx ) ); if( symbol ) @@ -3679,20 +2966,12 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID ) } } } -#if JVET_O0294_TRANSFORM_CLEANUP DTRACE(g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tu.mtsIdx); -#else - DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), tu.mtsIdx ); -#endif } void CABACReader::isp_mode( CodingUnit& cu ) { -#if !JVET_O0525_REMOVE_PCM - if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || !cu.cs->sps->getUseISP() || cu.bdpcmMode || !CU::canUseISP( cu, getFirstComponentOfChannel( cu.chType ) ) ) -#else if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || !cu.cs->sps->getUseISP() || cu.bdpcmMode || !CU::canUseISP( cu, getFirstComponentOfChannel( cu.chType ) ) ) -#endif { cu.ispMode = NOT_INTRA_SUBPARTITIONS; return; @@ -3735,33 +3014,13 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) } } -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) -#else -void CABACReader::residual_lfnst_mode( CodingUnit& cu ) -#endif { -#if JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE int chIdx = CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0; -#endif if( cu.ispMode != NOT_INTRA_SUBPARTITIONS || -#if JVET_O0925_MIP_SIMPLIFICATIONS (cu.cs->sps->getUseLFNST() && CU::isIntra(cu) && cu.mipFlag && !allowLfnstWithMip(cu.firstPU->lumaSize())) || -#else - cu.mipFlag == true || -#endif -#if JVET_O0050_LOCAL_DUAL_TREE ( cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) -#else - ( CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) -#endif -#if JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE -#if JVET_O0545_MAX_TB_SIGNALLING || ( cu.blocks[ chIdx ].lumaSize().width > cu.cs->sps->getMaxTbSize() || cu.blocks[ chIdx ].lumaSize().height > cu.cs->sps->getMaxTbSize() ) -#else - || ( cu.blocks[ chIdx ].lumaSize().width > MAX_TB_SIZEY || cu.blocks[ chIdx ].lumaSize().height > MAX_TB_SIZEY ) -#endif -#endif ) { return; @@ -3771,43 +3030,11 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu ) if( cu.cs->sps->getUseLFNST() && CU::isIntra( cu ) && !CU::isLosslessCoded( cu ) ) { -#if JVET_O0050_LOCAL_DUAL_TREE const bool lumaFlag = cu.isSepTree() ? ( isLuma( cu.chType ) ? true : false ) : true; const bool chromaFlag = cu.isSepTree() ? ( isChroma( cu.chType ) ? true : false ) : true; -#else - const bool lumaFlag = CS::isDualITree( *cu.cs ) ? ( isLuma( cu.chType ) ? true : false ) : true; - const bool chromaFlag = CS::isDualITree( *cu.cs ) ? ( isChroma( cu.chType ) ? true : false ) : true; -#endif -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS - bool nonZeroCoeffNonTs; -#endif -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS bool nonZeroCoeffNonTsCorner8x8 = ( lumaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] ) || (chromaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] ); -#else - bool nonZeroCoeffNonTsCorner8x8 = CU::getNumNonZeroCoeffNonTsCorner8x8( cu, lumaFlag, chromaFlag ) > 0; -#endif -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS -#if JVET_O0050_LOCAL_DUAL_TREE - const int nonZeroCoeffThr = cu.isSepTree() ? ( isLuma( cu.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA; -#else - const int nonZeroCoeffThr = CS::isDualITree( *cu.cs ) ? ( isLuma( cu.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA; -#endif - nonZeroCoeffNonTs = CU::getNumNonZeroCoeffNonTs( cu, lumaFlag, chromaFlag ) > nonZeroCoeffThr; -#endif -#if JVET_O0368_LFNST_WITH_DCT2_ONLY const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2); -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 ) -#else - if (!nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 || isNonDCT2) -#endif -#else -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS - if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 ) -#else - if( !nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 ) -#endif -#endif { cu.lfnstIdx = 0; return; @@ -3821,19 +3048,7 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu ) unsigned cctx = 0; -#if JVET_O0368_LFNST_WITH_DCT2_ONLY -#if JVET_O0050_LOCAL_DUAL_TREE if ( cu.isSepTree() ) cctx++; -#else - if ( CS::isDualITree(*cu.cs) ) cctx++; -#endif -#else -#if JVET_O0050_LOCAL_DUAL_TREE - if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && cu.isSepTree() ) cctx++; -#else - if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++; -#endif -#endif uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( cctx ) ); if( idxLFNST ) @@ -3853,11 +3068,7 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co unsigned maxLastPosX = cctx.maxLastPosX(); unsigned maxLastPosY = cctx.maxLastPosY(); -#if JVET_O0538_SPS_CONTROL_ISP_SBT if( ( tu.mtsIdx > MTS_SKIP || ( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif { maxLastPosX = ( tu.blocks[ compID ].width == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosX; maxLastPosY = ( tu.blocks[ compID ].height == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosY; @@ -3957,12 +3168,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co int firstNZPos = nextSigPos; int lastNZPos = -1; int numNonZero = 0; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int remRegBins = cctx.regBinLimit; -#else - bool is2x2subblock = ( cctx.log2CGSize() == 2 ); - int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); -#endif int firstPosMode2 = minSubPos - 1; int sigBlkPos[ 1 << MLS_CG_SIZE ]; @@ -4016,9 +3222,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co state = ( stateTransTable >> ((state<<2)+((coeff[blkPos]&1)<<1)) ) & 3; } firstPosMode2 = nextSigPos; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT cctx.regBinLimit = remRegBins; -#endif //===== 2nd PASS: Go-rice codes ===== @@ -4130,20 +3334,8 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* bool sigGroup = cctx.isLastSubSet() && cctx.noneSigGroup(); if( !sigGroup ) { -#if !JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT - if( cctx.isContextCoded() ) - { -#endif sigGroup = m_BinDecoder.decodeBin( cctx.sigGroupCtxId( true ) ); DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() bin=%d ctx=%d\n", sigGroup, cctx.sigGroupCtxId() ); -#if !JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT - } - else - { - sigGroup = m_BinDecoder.decodeBinEP( ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() EPbin=%d\n", sigGroup ); - } -#endif } if( sigGroup ) { @@ -4190,12 +3382,8 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* int sign; if( cctx.isContextCoded() ) { -#if JVET_O0122_TS_SIGN_LEVEL const unsigned signCtxId = cctx.signCtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm()); sign = m_BinDecoder.decodeBin(signCtxId); -#else - sign = m_BinDecoder.decodeBin( Ctx::TsResidualSign( cctx.bdpcm() ? 1 : 0 ) ); -#endif } else { @@ -4208,7 +3396,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 ); unsigned gt1Flag; -#if JVET_O0122_TS_SIGN_LEVEL const unsigned gt1CtxId = cctx.lrg1CtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm()); if( cctx.isContextCoded() ) { @@ -4220,18 +3407,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* gt1Flag = m_BinDecoder.decodeBinEP( ); DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() EPbin=%d\n", gt1Flag ); } -#else - if( cctx.isContextCoded() ) - { - gt1Flag = m_BinDecoder.decodeBin( cctx.greaterXCtxIdAbsTS(0) ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() bin=%d ctx=%d\n", gt1Flag, cctx.greaterXCtxIdAbsTS(0) ); - } - else - { - gt1Flag = m_BinDecoder.decodeBinEP( ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() EPbin=%d\n", gt1Flag ); - } -#endif unsigned parFlag = 0; if( gt1Flag ) @@ -4248,11 +3423,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_par_flag() EPbin=%d\n", parFlag ); } } -#if JVET_O0122_TS_SIGN_LEVEL coeff[ blkPos ] = (sign ? -1 : 1 ) * (1 + parFlag + gt1Flag); -#else - coeff[ blkPos ] += 1 + parFlag + gt1Flag; -#endif } } @@ -4260,19 +3431,16 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* const int numGtBins = 4; //===== 2nd PASS: gt2 ===== -#if JVET_O0619_GTX_SINGLE_PASS_TS_RESIDUAL_CODING for (int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++) { TCoeff& tcoeff = coeff[cctx.blockPos(scanPos)]; cutoffVal = 2; for (int i = 0; i < numGtBins; i++) { -#if JVET_O0122_TS_SIGN_LEVEL if( tcoeff < 0) { tcoeff = -tcoeff; } -#endif if (tcoeff >= cutoffVal) { RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_gt2); @@ -4293,39 +3461,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* cutoffVal += 2; } } -#else - for( int i = 0; i < numGtBins; i++ ) - { - for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ ) - { - TCoeff& tcoeff = coeff[cctx.blockPos( scanPos )]; -#if JVET_O0122_TS_SIGN_LEVEL - if( tcoeff < 0) - { - tcoeff = -tcoeff; - } -#endif - if( tcoeff >= cutoffVal ) - { - RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt2 ); - unsigned gt2Flag; - if( cctx.isContextCoded() ) - { - gt2Flag = m_BinDecoder.decodeBin( cctx.greaterXCtxIdAbsTS(cutoffVal>>1) ); - tcoeff += ( gt2Flag << 1 ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2Flag, cctx.greaterXCtxIdAbsTS(cutoffVal>>1), scanPos, tcoeff ); - } - else - { - gt2Flag = m_BinDecoder.decodeBinEP( ); - tcoeff += ( gt2Flag << 1 ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() EPbin=%d sp=%d coeff=%d\n", i, gt2Flag, scanPos, tcoeff ); - } - } - } - cutoffVal += 2; - } -#endif //===== 3rd PASS: Go-rice codes ===== for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ ) { @@ -4338,7 +3473,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_rem_val() bin=%d ctx=%d sp=%d\n", rem, rice, scanPos ); tcoeff += ( rem << 1 ); } -#if JVET_O0122_TS_SIGN_LEVEL if (!cctx.bdpcm()) { if (tcoeff > 0) @@ -4348,7 +3482,6 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* tcoeff = cctx.decDeriveModCoeff(rightPixel, belowPixel, tcoeff); } } -#endif } //===== set final coefficents ===== @@ -4472,11 +3605,7 @@ void CABACReader::mip_flag( CodingUnit& cu ) cu.mipFlag = false; return; } -#if JVET_O0545_MAX_TB_SIGNALLING if( cu.lwidth() > cu.cs->sps->getMaxTbSize() || cu.lheight() > cu.cs->sps->getMaxTbSize()) -#else - if( cu.lwidth() > MIP_MAX_WIDTH || cu.lheight() > MIP_MAX_HEIGHT ) -#endif { cu.mipFlag = false; return; @@ -4508,44 +3637,13 @@ void CABACReader::mip_pred_modes( CodingUnit &cu ) void CABACReader::mip_pred_mode( PredictionUnit &pu ) { -#if JVET_O0545_MAX_TB_SIGNALLING CHECK( pu.lwidth() > pu.cs->sps->getMaxTbSize() || pu.lheight() > pu.cs->sps->getMaxTbSize(), "Error: block size not supported" ); -#else - CHECK( pu.lwidth() > MIP_MAX_WIDTH || pu.lheight() > MIP_MAX_HEIGHT, "Error: block size not supported" ); -#endif const int numModes = getNumModesMip( pu.Y() ); CHECKD( numModes > MAX_NUM_MIP_MODE, "Error: too many MIP modes" ); -#if JVET_O0925_MIP_SIMPLIFICATIONS uint32_t mipMode; xReadTruncBinCode( mipMode, numModes ); pu.intraDir[CHANNEL_TYPE_LUMA] = mipMode; -#else - int unaryMax = NUM_MPM_MIP - 1; - int fixedLength = getNumEpBinsMip( pu.Y() ); - unsigned modeIdx = code_unary_fixed( Ctx::MipMode( 0 ), unaryMax, fixedLength ); - CHECK( modeIdx >= numModes, "modeIdx out of range" ); - - // derive true MIP mode from modeIdx - unsigned mpm[NUM_MPM_MIP]; - PU::getMipMPMs(pu, mpm); - - if (modeIdx < NUM_MPM_MIP) - { - pu.intraDir[CHANNEL_TYPE_LUMA] = mpm[modeIdx]; - } - else - { - modeIdx -= NUM_MPM_MIP; - std::sort(mpm, mpm + NUM_MPM_MIP); - - for( unsigned i = 0; i < NUM_MPM_MIP; i++ ) - { - modeIdx += (modeIdx >= mpm[i]); - } - pu.intraDir[CHANNEL_TYPE_LUMA] = modeIdx; - } -#endif CHECKD(pu.intraDir[CHANNEL_TYPE_LUMA] < 0 || pu.intraDir[CHANNEL_TYPE_LUMA] >= numModes, "Invalid MIP mode"); 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] ); diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index cf3d7b88cdced73d8af614cee3d32922e2cca2a0..2fc6a6e336948365296257a3460777c6243cf899 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -73,9 +73,7 @@ public: // coding (quad)tree (clause 7.3.8.4) bool coding_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, Partitioner* pPartitionerChroma = nullptr, CUCtx* pCuCtxChroma = nullptr); PartSplit split_cu_mode ( CodingStructure& cs, Partitioner& pm ); -#if JVET_O0050_LOCAL_DUAL_TREE ModeType mode_constraint ( CodingStructure& cs, Partitioner& pm, const PartSplit splitMode ); -#endif // coding unit (clause 7.3.8.5) bool coding_unit ( CodingUnit& cu, Partitioner& pm, CUCtx& cuCtx ); @@ -83,9 +81,6 @@ public: void cu_skip_flag ( CodingUnit& cu ); void pred_mode ( CodingUnit& cu ); void bdpcm_mode ( CodingUnit& cu, const ComponentID compID ); -#if !JVET_O0525_REMOVE_PCM - void pcm_flag ( CodingUnit& cu, Partitioner& pm ); -#endif void cu_pred_data ( CodingUnit& cu ); void cu_gbi_flag ( CodingUnit& cu ); void extend_ref_line (CodingUnit& cu); @@ -100,9 +95,7 @@ public: void mip_flag ( CodingUnit& cu ); void mip_pred_modes ( CodingUnit& cu ); void mip_pred_mode ( PredictionUnit& pu ); -#if JVET_O0119_BASE_PALETTE_444 void cu_palette_info ( CodingUnit& cu, ComponentID compBegin, uint32_t numComp, CUCtx& cuCtx ); -#endif // prediction unit (clause 7.3.8.6) void prediction_unit ( PredictionUnit& pu, MergeCtx& mrgCtx ); @@ -120,54 +113,30 @@ public: void MHIntra_flag ( PredictionUnit& pu ); void smvd_mode ( PredictionUnit& pu ); -#if !JVET_O0525_REMOVE_PCM - // pcm samples (clause 7.3.8.7) - void pcm_samples ( TransformUnit& tu ); -#endif // transform tree (clause 7.3.8.8) -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void transform_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, const PartSplit ispType = TU_NO_ISP, const int subTuIdx = -1 ); -#else - void transform_tree ( CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType = TU_NO_ISP, const int subTuIdx = -1 ); -#endif bool cbf_comp ( CodingStructure& cs, const CompArea& area, unsigned depth, const bool prevCbf = false, const bool useISP = false ); // mvd coding (clause 7.3.8.9) void mvd_coding ( Mv &rMvd ); // transform unit (clause 7.3.8.10) -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void transform_unit ( TransformUnit& tu, CUCtx& cuCtx, Partitioner& pm, const int subTuCounter = -1 ); -#else - void transform_unit ( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); -#endif void cu_qp_delta ( CodingUnit& cu, int predQP, int8_t& qp ); void cu_chroma_qp_offset ( CodingUnit& cu ); // residual coding (clause 7.3.8.11) -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS void residual_coding ( TransformUnit& tu, ComponentID compID, CUCtx& cuCtx ); -#else - void residual_coding ( TransformUnit& tu, ComponentID compID ); -#endif void mts_coding ( TransformUnit& tu, ComponentID compID ); -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS void residual_lfnst_mode ( CodingUnit& cu, CUCtx& cuCtx ); -#else - 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 ); void residual_codingTS ( TransformUnit& tu, ComponentID compID ); void residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* coeff ); -#if JVET_O0105_ICT void joint_cb_cr ( TransformUnit& tu, const int cbfMask ); -#else - void joint_cb_cr ( TransformUnit& tu ); -#endif // cross component prediction (clause 7.3.8.12) void cross_comp_pred ( TransformUnit& tu, ComponentID compID ); @@ -180,14 +149,12 @@ private: unsigned code_unary_fixed ( unsigned ctxId, unsigned unary_max, unsigned fixed ); void xReadTruncBinCode(uint32_t& symbol, uint32_t maxSymbol); -#if JVET_O0119_BASE_PALETTE_444 void parseScanRotationModeFlag ( CodingUnit& cu, ComponentID compBegin ); void xDecodePLTPredIndicator ( CodingUnit& cu, uint32_t maxPLTSize, ComponentID compBegin ); void xAdjustPLTIndex ( CodingUnit& cu, Pel curLevel, uint32_t idx, PelBuf& paletteIdx, PLTtypeBuf& paletteRunType, int maxSymbol, ComponentID compBegin ); uint32_t cu_run_val ( PLTRunMode runtype, const uint32_t pltIdx, const uint32_t maxRun ); uint32_t xReadTruncUnarySymbol ( PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT ); uint32_t xReadTruncMsbP1RefinementBits( PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT ); -#endif public: int shareStateDec; Position shareParentPos; @@ -195,9 +162,7 @@ public: private: BinDecoderBase& m_BinDecoder; InputBitstream* m_Bitstream; -#if JVET_O0119_BASE_PALETTE_444 ScanElement* m_scanOrder; -#endif }; diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index f71c5f161d711c480f949377de1de2b95291685a..1718b640d96f010fbc146342cb59a5a01c08aa64 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -109,13 +109,11 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) } bool sharePrepareCondition = ((!cs.pcv->isEncoder) && (!(cs.slice->isIntra()) || cs.slice->getSPS()->getIBCFlag())); -#if JVET_O1170_CHECK_BV_AT_DECODER if (cs.resetIBCBuffer) { m_pcInterPred->resetIBCBuffer(cs.pcv->chrFormat, cs.slice->getSPS()->getMaxCUHeight()); cs.resetIBCBuffer = false; } -#endif for( int ch = 0; ch < maxNumChannelType; ch++ ) { const ChannelType chType = ChannelType( ch ); @@ -124,7 +122,6 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, chType ), chType ) ) { -#if JVET_O1170_CHECK_BV_AT_DECODER if(currCU.Y().valid()) { const int vSize = cs.slice->getSPS()->getMaxCUHeight() > 64 ? 64 : cs.slice->getSPS()->getMaxCUHeight(); @@ -133,15 +130,11 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) m_pcInterPred->resetVPDUforIBC(cs.pcv->chrFormat, cs.slice->getSPS()->getMaxCUHeight(), vSize, currCU.Y().x, currCU.Y().y); } } -#endif if(sharePrepareCondition) { if ((currCU.shareParentPos.x >= 0) && (!(currCU.shareParentPos.x == prevTmpPos.x && currCU.shareParentPos.y == prevTmpPos.y))) { m_shareStateDec = GEN_ON_SHARED_BOUND; -#if !JVET_O0078_SINGLE_HMVPLUT - cs.motionLut.lutShareIbc = cs.motionLut.lutIbc; -#endif } if (currCU.shareParentPos.x < 0) @@ -150,11 +143,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) } prevTmpPos = currCU.shareParentPos; } -#if JVET_O0119_BASE_PALETTE_444 if (currCU.predMode != MODE_INTRA && currCU.predMode != MODE_PLT && currCU.Y().valid()) -#else - if (currCU.predMode != MODE_INTRA && currCU.Y().valid()) -#endif { xDeriveCUMV(currCU); } @@ -164,9 +153,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) case MODE_IBC: xReconInter( currCU ); break; -#if JVET_O0119_BASE_PALETTE_444 case MODE_PLT: -#endif case MODE_INTRA: xReconIntraQT( currCU ); break; @@ -175,17 +162,11 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) break; } -#if !JVET_O0525_REMOVE_PCM - if( CU::isLosslessCoded( currCU ) && !currCU.ipcm ) -#else if( CU::isLosslessCoded( currCU ) ) -#endif { xFillPCMBuffer( currCU ); } -#if JVET_O1170_IBC_VIRTUAL_BUFFER m_pcInterPred->xFillIBCBuffer(currCU); -#endif DTRACE_BLOCK_REC( cs.picture->getRecoBuf( currCU ), currCU, currCU.predMode ); } @@ -215,20 +196,14 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) const PredictionUnit &pu = *tu.cs->getPU( area.pos(), chType ); const uint32_t uiChFinalMode = PU::getFinalIntraMode( pu, chType ); -#if JVET_O0502_ISP_CLEANUP PelBuf pReco = cs.getRecoBuf(area); -#endif //===== init availability pattern ===== -#if JVET_O0502_ISP_CLEANUP -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN bool predRegDiffFromTB = CU::isPredRegDiffFromTB(*tu.cu, compID); bool firstTBInPredReg = CU::isFirstTBInPredReg(*tu.cu, compID, area); CompArea areaPredReg(COMPONENT_Y, tu.chromaFormat, area); -#endif if (tu.cu->ispMode && isLuma(compID)) { -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN if (predRegDiffFromTB) { if (firstTBInPredReg) @@ -238,7 +213,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } } else -#endif { m_pcIntraPred->initIntraPatternChTypeISP(*tu.cu, area, pReco); } @@ -247,23 +221,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) { m_pcIntraPred->initIntraPatternChType(*tu.cu, area); } -#else -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN - bool predRegDiffFromTB = CU::isPredRegDiffFromTB(*tu.cu, compID); - bool firstTBInPredReg = CU::isFirstTBInPredReg (*tu.cu, compID, area); - CompArea areaPredReg(COMPONENT_Y, tu.chromaFormat, area); - if (predRegDiffFromTB) - { - if (firstTBInPredReg) - { - CU::adjustPredArea(areaPredReg); - m_pcIntraPred->initIntraPatternChType(*tu.cu, areaPredReg); - } - } - else -#endif - m_pcIntraPred->initIntraPatternChType(*tu.cu, area); -#endif //===== get prediction signal ===== if( compID != COMPONENT_Y && PU::isLMCMode( uiChFinalMode ) ) @@ -281,7 +238,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } else { -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN if (predRegDiffFromTB) { if (firstTBInPredReg) @@ -291,7 +247,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } } else -#endif m_pcIntraPred->predIntraAng(compID, piPred, pu); } } @@ -301,14 +256,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); const CompArea &areaY = CompArea(COMPONENT_Y, tu.chromaFormat, area); -#if JVET_O1109_UNFIY_CRS int adj = m_pcReshape->calculateChromaAdjVpduNei(tu, areaY); -#else - PelBuf piPredY; - piPredY = cs.picture->getPredBuf(areaY); - const Pel avgLuma = piPredY.computeAvg(); - int adj = m_pcReshape->calculateChromaAdj(avgLuma); -#endif tu.setChromaAdj(adj); } //===== inverse transform ===== @@ -316,7 +264,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) const QpParam cQP( tu, compID ); -#if JVET_O0105_ICT if( tu.jointCbCr && isChroma(compID) ) { if( compID == COMPONENT_Cb ) @@ -335,12 +282,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } } else -#else - // 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 ); @@ -352,14 +293,8 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) //===== reconstruction ===== flag = flag && (tu.blocks[compID].width*tu.blocks[compID].height > 4); -#if JVET_O0105_ICT if (flag && (TU::getCbf(tu, compID) || tu.jointCbCr) && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag()) { -#else - if (flag && TU::getCbf(tu, compID) && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag()) - { - 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 ) @@ -367,9 +302,6 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) CrossComponentPrediction::crossComponentPrediction( tu, compID, cs.getResiBuf( tu.Y() ), piResi, piResi, true ); } -#if !JVET_O0502_ISP_CLEANUP - PelBuf pReco = cs.getRecoBuf( area ); -#endif if( !tu.cu->ispMode || !isLuma( compID ) ) { @@ -420,22 +352,10 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) void DecCu::xReconIntraQT( CodingUnit &cu ) { -#if !JVET_O0525_REMOVE_PCM - if( cu.ipcm ) - { - xReconPCM( *cu.firstTU ); - return; - } -#endif -#if JVET_O0119_BASE_PALETTE_444 if (CU::isPLT(cu)) { -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.isSepTree()) -#else - if (CS::isDualITree(*cu.cs)) -#endif { if (cu.chType == CHANNEL_TYPE_LUMA) { @@ -452,7 +372,6 @@ void DecCu::xReconIntraQT( CodingUnit &cu ) } return; } -#endif const uint32_t numChType = ::getNumberValidChannels( cu.chromaFormat ); for( uint32_t chType = CHANNEL_TYPE_LUMA; chType < numChType; chType++ ) @@ -464,7 +383,6 @@ void DecCu::xReconIntraQT( CodingUnit &cu ) } } -#if JVET_O0119_BASE_PALETTE_444 void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp) { const SPS& sps = *(cu.cs->sps); @@ -493,11 +411,7 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp) Pel value; QpParam cQP(tu, (ComponentID)compID); -#if JVET_O0919_TS_MIN_QP int qp = cQP.Qp(false); -#else - int qp = cQP.Qp; -#endif int qpRem = qp % 6; int qpPer = qp / 6; if (compBegin != COMPONENT_Y || compID == COMPONENT_Y) @@ -545,65 +459,6 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp) cu.cs->setDecomp(area); } } -#endif -#if !JVET_O0525_REMOVE_PCM -/** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. -* \param pcCU pointer to current CU -* \param uiPartIdx part index -* \param piPCM pointer to PCM code arrays -* \param piReco pointer to reconstructed sample arrays -* \param uiStride stride of reconstructed sample arrays -* \param uiWidth CU width -* \param uiHeight CU height -* \param compID colour component ID -* \returns void -*/ -void DecCu::xDecodePCMTexture(TransformUnit &tu, const ComponentID compID) -{ - const CompArea &area = tu.blocks[compID]; - PelBuf piPicReco = tu.cs->getRecoBuf( area ); - const CPelBuf piPicPcm = tu.getPcmbuf(compID); - const SPS &sps = *tu.cs->sps; - const uint32_t uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID)); - - for (uint32_t uiY = 0; uiY < area.height; uiY++) - { - for (uint32_t uiX = 0; uiX < area.width; uiX++) - { - piPicReco.at(uiX, uiY) = (piPicPcm.at(uiX, uiY) << uiPcmLeftShiftBit); - } - } - - tu.cs->picture->getRecoBuf( area ).copyFrom( piPicReco ); - tu.cs->setDecomp( area ); -} - -/** Function for reconstructing a PCM mode CU. -* \param pcCU pointer to current CU -* \param uiDepth CU Depth -* \returns void -*/ -void DecCu::xReconPCM(TransformUnit &tu) -{ -#if !JVET_O0050_LOCAL_DUAL_TREE - const CodingStructure *cs = tu.cs; -#endif - const ChannelType chType = tu.chType; - -#if JVET_O0050_LOCAL_DUAL_TREE - ComponentID compStr = (tu.cu->isSepTree() && !isLuma( chType )) ? COMPONENT_Cb : COMPONENT_Y; - ComponentID compEnd = (tu.cu->isSepTree() && isLuma( chType )) ? COMPONENT_Y : COMPONENT_Cr; -#else - ComponentID compStr = (CS::isDualITree(*cs) && !isLuma(chType)) ? COMPONENT_Cb: COMPONENT_Y; - ComponentID compEnd = (CS::isDualITree(*cs) && isLuma(chType)) ? COMPONENT_Y : COMPONENT_Cr; -#endif - for( ComponentID compID = compStr; compID <= compEnd; compID = ComponentID(compID+1) ) - { - - xDecodePCMTexture(tu, compID); - } -} -#endif /** Function for deriving reconstructed PU/CU chroma samples with QTree structure * \param pcRecoYuv pointer to reconstructed sample arrays @@ -691,12 +546,8 @@ void DecCu::xReconInter(CodingUnit &cu) if (cu.Y().valid()) { const PredictionUnit &pu = *cu.firstPU; -#if JVET_O0078_SINGLE_HMVPLUT bool isShare = ((CU::isIBC(cu) && (cu.shareParentSize.width != cu.Y().lumaSize().width || cu.shareParentSize.height != cu.Y().lumaSize().height)) ? true : false); if (!cu.affine && !cu.triangle && !isShare) -#else - if (!cu.affine && !cu.triangle) -#endif { MotionInfo mi = pu.getMotionInfo(); mi.GBiIdx = (mi.interDir == 3) ? cu.GBiIdx : GBI_DEFAULT; @@ -787,7 +638,6 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) const QpParam cQP(currTU, compID); -#if JVET_O0105_ICT if( currTU.jointCbCr && isChroma(compID) ) { if( compID == COMPONENT_Cb ) @@ -806,12 +656,6 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) } } else -#else - // 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 ); @@ -823,15 +667,9 @@ void DecCu::xDecodeInterTU( TransformUnit & currTU, const ComponentID compID ) //===== reconstruction ===== const Slice &slice = *cs.slice; -#if JVET_O0105_ICT if (slice.getLmcsEnabledFlag() && isChroma(compID) && (TU::getCbf(currTU, compID) || currTU.jointCbCr) && slice.getLmcsChromaResidualScaleFlag() && currTU.blocks[compID].width * currTU.blocks[compID].height > 4) { -#else - if (slice.getLmcsEnabledFlag() && isChroma(compID) && TU::getCbf(currTU, compID) && slice.getLmcsChromaResidualScaleFlag() && currTU.blocks[compID].width*currTU.blocks[compID].height > 4) - { - 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 ) @@ -860,18 +698,7 @@ void DecCu::xDecodeInterTexture(CodingUnit &cu) if (slice.getLmcsEnabledFlag() && slice.getLmcsChromaResidualScaleFlag() && (compID == COMPONENT_Y) && (currTU.cbf[COMPONENT_Cb] || currTU.cbf[COMPONENT_Cr])) { const CompArea &areaY = currTU.blocks[COMPONENT_Y]; -#if JVET_O1109_UNFIY_CRS int adj = m_pcReshape->calculateChromaAdjVpduNei(currTU, areaY); -#else - PelBuf predY = cs.getPredBuf(areaY); - CompArea tmpArea(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size()); - PelBuf tmpPred = m_tmpStorageLCU->getBuf(tmpArea); - tmpPred.copyFrom(predY); - if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) - tmpPred.rspSignal(m_pcReshape->getFwdLUT()); - const Pel avgLuma = tmpPred.computeAvg(); - int adj = m_pcReshape->calculateChromaAdj(avgLuma); -#endif currTU.setChromaAdj(adj); } xDecodeInterTU( currTU, compID ); @@ -1041,16 +868,10 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) { mvd.changeIbcPrecAmvr2Internal(pu.cu->imv); } -#if JVET_O0162_IBC_MVP_FLAG -#if JVET_O0455_IBC_MAX_MERGE_NUM if ( pu.cu->slice->getMaxNumIBCMergeCand() == 1 ) -#else - if ( pu.cu->slice->getMaxNumMergeCand() == 1 ) -#endif { CHECK( pu.mvpIdx[REF_PIC_LIST_0], "mvpIdx for IBC mode should be 0" ); } -#endif pu.mv[REF_PIC_LIST_0] = amvpInfo.mvCand[pu.mvpIdx[REF_PIC_LIST_0]] + mvd; pu.mv[REF_PIC_LIST_0].mvCliptoStorageBitDepth(); } @@ -1089,25 +910,10 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) const int cuPelY = pu.Y().y; int roiWidth = pu.lwidth(); int roiHeight = pu.lheight(); -#if !JVET_O1170_CHECK_BV_AT_DECODER -#if JVET_O1164_PS - const int picWidth = pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); - const int picHeight = pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); -#else - const int picWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); - const int picHeight = pu.cs->slice->getSPS()->getPicHeightInLumaSamples(); -#endif -#endif const unsigned int lcuWidth = pu.cs->slice->getSPS()->getMaxCUWidth(); int xPred = pu.mv[0].getHor() >> MV_FRACTIONAL_BITS_INTERNAL; int yPred = pu.mv[0].getVer() >> MV_FRACTIONAL_BITS_INTERNAL; -#if JVET_O1170_CHECK_BV_AT_DECODER CHECK(!m_pcInterPred->isLumaBvValid(lcuWidth, cuPelX, cuPelY, roiWidth, roiHeight, xPred, yPred), "invalid block vector for IBC detected."); -#else -#if !JVET_O1170_IBC_VIRTUAL_BUFFER - CHECK(!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, xPred, yPred, lcuWidth), "invalid block vector for IBC detected."); -#endif -#endif } } } diff --git a/source/Lib/DecoderLib/DecCu.h b/source/Lib/DecoderLib/DecCu.h index 21564ba03398bedd78775ed886ef88b32ae7c089..0fb25d76565075abf41d0e5eda3f45279ec33b2d 100644 --- a/source/Lib/DecoderLib/DecCu.h +++ b/source/Lib/DecoderLib/DecCu.h @@ -87,16 +87,10 @@ protected: void xFillPCMBuffer ( CodingUnit& cu ); void xIntraRecBlk ( TransformUnit& tu, const ComponentID compID ); -#if !JVET_O0525_REMOVE_PCM - void xReconPCM ( TransformUnit& tu); - void xDecodePCMTexture ( TransformUnit& tu, const ComponentID compID ); -#endif void xDecodeInterTU ( TransformUnit& tu, const ComponentID compID ); void xDeriveCUMV ( CodingUnit& cu ); -#if JVET_O0119_BASE_PALETTE_444 void xReconPLT ( CodingUnit& cu, ComponentID compBegin, uint32_t numComp ); -#endif PelStorage *m_tmpStorageLCU; private: TrQuant* m_pcTrQuant; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 1b212de16eae649ef7a0a4f9aaaa0ab9404625cc..58b680f472034e721f325330d8228222af96004f 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -209,11 +209,9 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri pcEncPic->resizeAlfCtbFilterIndex(pic->cs->pcv->sizeInCtus); memcpy( pcEncPic->getAlfCtbFilterIndex(), pic->getAlfCtbFilterIndex(), sizeof(short)*pic->cs->pcv->sizeInCtus ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB std::copy( pic->getAlfCtuAlternative(COMPONENT_Cb).begin(), pic->getAlfCtuAlternative(COMPONENT_Cb).end(), pcEncPic->getAlfCtuAlternative(COMPONENT_Cb).begin() ); std::copy( pic->getAlfCtuAlternative(COMPONENT_Cr).begin(), pic->getAlfCtuAlternative(COMPONENT_Cr).end(), pcEncPic->getAlfCtuAlternative(COMPONENT_Cr).begin() ); -#endif for( int i = 0; i < pic->slices.size(); i++ ) { pcEncPic->slices[i]->setTileGroupNumAps(pic->slices[i]->getTileGroupNumAps()); @@ -406,14 +404,8 @@ DecLib::DecLib() , m_bFirstSliceInBitstream(true) , m_lastPOCNoOutputPriorPics(-1) , m_isNoOutputPriorPics(false) -#if JVET_N0865_NONSYNTAX , m_lastNoIncorrectPicOutputFlag(false) -#else - , m_craNoRaslOutputFlag(false) -#endif -#if JVET_O0428_LMCS_CLEANUP , m_sliceLmcsApsId(-1) -#endif , m_pDecodedSEIOutputStream(NULL) , m_decodedPictureHashSEIEnabled(false) , m_numberOfChecksumErrorsDetected(0) @@ -497,11 +489,7 @@ Picture* DecLib::xGetNewPicBuffer ( const SPS &sps, const PPS &pps, const uint32 { pcPic = new Picture(); -#if JVET_O1164_PS pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#else - pcPic->create( sps.getChromaFormatIdc(), Size( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#endif m_cListPic.push_back( pcPic ); @@ -537,27 +525,15 @@ Picture* DecLib::xGetNewPicBuffer ( const SPS &sps, const PPS &pps, const uint32 m_cListPic.push_back( pcPic ); -#if JVET_O1164_PS pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#else - pcPic->create( sps.getChromaFormatIdc(), Size( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#endif } else { -#if JVET_O1164_PS if( !pcPic->Y().Size::operator==( Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ) ) || pcPic->cs->pcv->maxCUWidth != sps.getMaxCUWidth() || pcPic->cs->pcv->maxCUHeight != sps.getMaxCUHeight() ) { pcPic->destroy(); pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); } -#else - if( !pcPic->Y().Size::operator==( Size( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples() ) ) || pcPic->cs->pcv->maxCUWidth != sps.getMaxCUWidth() || pcPic->cs->pcv->maxCUHeight != sps.getMaxCUHeight() ) - { - pcPic->destroy(); - pcPic->create( sps.getChromaFormatIdc(), Size( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); - } -#endif } pcPic->setBorderExtension( false ); @@ -637,9 +613,7 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) c += 32; // tolower } -#if JVET_N0494_DRAP if (pcSlice->isDRAP()) c = 'D'; -#endif //-- For time output for each slice msg( msgl, "POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(), @@ -653,7 +627,6 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) msg( msgl, "[L%d ", iRefList); for (int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) { -#if RPR_CTC_PRINT const std::pair<int, int>& scaleRatio = pcSlice->getScalingRatio( RefPicList( iRefList ), iRefIndex ); if( pcSlice->getEnableTMVPFlag() && pcSlice->getColFromL0Flag() == bool(1 - iRefList) && pcSlice->getColRefIdx() == iRefIndex ) @@ -664,9 +637,6 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) { msg( msgl, "%d(%1.2lfx, %1.2lfx) ", pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ), double( scaleRatio.first ) / ( 1 << SCALE_RATIO_BITS ), double( scaleRatio.second ) / ( 1 << SCALE_RATIO_BITS ) ); } -#else - msg( msgl, "%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); -#endif } msg( msgl, "] "); } @@ -774,7 +744,6 @@ void DecLib::xCreateLostPicture(int iLostPoc) } -#if JVET_O0241 void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag) { msg(INFO, "\ninserting unavailable poc : %d\n", iUnavailablePoc); @@ -804,13 +773,8 @@ void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag) } } -#endif -#if JVET_O0299_APS_SCALINGLIST void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** apss, APS* lmcsAPS, APS* scalingListAPS) -#else -void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** apss, APS* lmcsAPS) -#endif { //luma APSs if (pSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) @@ -828,10 +792,8 @@ void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** THROW("APS activation failed!"); } -#if JVET_O0245_VPS_DPS_APS CHECK( aps->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" ); //ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it. -#endif } } } @@ -848,10 +810,8 @@ void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** THROW("APS activation failed!"); } -#if JVET_O0245_VPS_DPS_APS CHECK( aps->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" ); //ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it. -#endif } } @@ -867,15 +827,12 @@ void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** THROW("LMCS APS activation failed!"); } -#if JVET_O0245_VPS_DPS_APS CHECK( lmcsAPS->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" ); //ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it. -#endif } } pSlice->setLmcsAPS(lmcsAPS); -#if JVET_O0299_APS_SCALINGLIST if( pSlice->getscalingListPresentFlag() && scalingListAPS == nullptr) { scalingListAPS = parameterSetManager.getAPS( pSlice->getscalingListAPSId(), SCALING_LIST_APS ); @@ -888,14 +845,11 @@ void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** THROW( "SCALING LIST APS activation failed!" ); } -#if JVET_O0245_VPS_DPS_APS CHECK( scalingListAPS->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" ); //ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it. -#endif } } pSlice->setscalingListAPS(scalingListAPS); -#endif } void DecLib::xActivateParameterSets() @@ -903,11 +857,7 @@ void DecLib::xActivateParameterSets() if (m_bFirstSliceInPicture) { APS** apss = m_parameterSetManager.getAPSs(); -#if JVET_O_MAX_NUM_ALF_APS_8 memset(apss, 0, sizeof(*apss) * ALF_CTB_MAX_NUM_APS); -#else - memset(apss, 0, sizeof(*apss) * MAX_NUM_APS); -#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"); @@ -926,11 +876,7 @@ void DecLib::xActivateParameterSets() THROW("Parameter set activation failed!"); } m_parameterSetManager.getApsMap()->clear(); -#if JVET_O_MAX_NUM_ALF_APS_8 for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) -#else - for (int i = 0; i < MAX_NUM_APS; i++) -#endif { APS* aps = m_parameterSetManager.getAPS(i, ALF_APS); if (aps) @@ -939,12 +885,8 @@ void DecLib::xActivateParameterSets() } } APS* lmcsAPS = nullptr; -#if JVET_O0299_APS_SCALINGLIST APS* scalinglistAPS = nullptr; activateAPS(m_apcSlicePilot, m_parameterSetManager, apss, lmcsAPS, scalinglistAPS); -#else - activateAPS(m_apcSlicePilot, m_parameterSetManager, apss, lmcsAPS); -#endif xParsePrefixSEImessages(); @@ -959,11 +901,7 @@ void DecLib::xActivateParameterSets() m_pcPic = xGetNewPicBuffer (*sps, *pps, m_apcSlicePilot->getTLayer()); m_apcSlicePilot->applyReferencePictureListBasedMarking(m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1()); -#if JVET_O0299_APS_SCALINGLIST m_pcPic->finalInit( *sps, *pps, apss, lmcsAPS, scalinglistAPS ); -#else - m_pcPic->finalInit(*sps, *pps, apss, lmcsAPS); -#endif m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId())->setNumBricksInPic((int)m_pcPic->brickMap->bricks.size()); m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth ); m_pcPic->cs->createCoeffs(); @@ -984,33 +922,23 @@ void DecLib::xActivateParameterSets() m_pcPic->cs->slice = pSlice; m_pcPic->cs->sps = sps; m_pcPic->cs->pps = pps; -#if JVET_O1164_RPR + Window confWin = pps->getConformanceWindow( ); m_pcPic->setPicWidthInLumaSamples( pps->getPicWidthInLumaSamples() ); m_pcPic->setPicHeightInLumaSamples( pps->getPicHeightInLumaSamples() ); m_pcPic->setConformanceWindow( confWin ); -#endif + memcpy(m_pcPic->cs->alfApss, apss, sizeof(m_pcPic->cs->alfApss)); m_pcPic->cs->lmcsAps = lmcsAPS; -#if JVET_O0299_APS_SCALINGLIST m_pcPic->cs->scalinglistAps = scalinglistAPS; -#endif m_pcPic->cs->pcv = pps->pcv; // Initialise the various objects for the new set of settings -#if JVET_O1164_PS m_cSAO.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale( CHANNEL_TYPE_LUMA ), pps->getPpsRangeExtension().getLog2SaoOffsetScale( CHANNEL_TYPE_CHROMA ) ); -#else - m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) ); -#endif m_cLoopFilter.create( sps->getMaxCodingDepth() ); m_cIntraPred.init( sps->getChromaFormatIdc(), sps->getBitDepth( CHANNEL_TYPE_LUMA ) ); -#if JVET_O1170_IBC_VIRTUAL_BUFFER m_cInterPred.init( &m_cRdCost, sps->getChromaFormatIdc(), sps->getMaxCUHeight() ); -#else - m_cInterPred.init( &m_cRdCost, sps->getChromaFormatIdc() ); -#endif if (sps->getUseReshaper()) { m_cReshaper.createDec(sps->getBitDepth(CHANNEL_TYPE_LUMA)); @@ -1021,16 +949,6 @@ void DecLib::xActivateParameterSets() if(!m_SEIs.empty()) { -#if !JVET_O0041_FRAME_FIELD_SEI - // Check if any new Picture Timing SEI has arrived - SEIMessages pictureTimingSEIs = getSeisByType(m_SEIs, SEI::PICTURE_TIMING); - if (pictureTimingSEIs.size()>0) - { - SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin()); - isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 10) || (pictureTiming->m_picStruct == 11) || (pictureTiming->m_picStruct == 12); - isTopField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 11); - } -#else // Check if any new Frame Field Info SEI has arrived SEIMessages frameFieldSEIs = getSeisByType(m_SEIs, SEI::FRAME_FIELD_INFO); if (frameFieldSEIs.size()>0) @@ -1039,7 +957,6 @@ void DecLib::xActivateParameterSets() isField = ff->m_fieldPicFlag; isTopField = isField && (!ff->m_bottomFieldFlag); } -#endif } //Set Field/Frame coding mode @@ -1056,11 +973,7 @@ void DecLib::xActivateParameterSets() { m_cCuDecoder.initDecCuReshaper(&m_cReshaper, sps->getChromaFormatIdc()); } -#if MAX_TB_SIZE_SIGNALLING m_cTrQuant.init( nullptr, sps->getMaxTbSize(), false, false, false, false ); -#else - m_cTrQuant.init( nullptr, MAX_TB_SIZEY, false, false, false, false ); -#endif // RdCost m_cRdCost.setCostMode ( COST_STANDARD_LOSSY ); // not used in decoder side RdCost stuff -> set to default @@ -1069,11 +982,7 @@ void DecLib::xActivateParameterSets() if( sps->getALFEnabledFlag() ) { -#if JVET_O1164_PS m_cALF.create( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), sps->getBitDepths().recon ); -#else - m_cALF.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), sps->getBitDepths().recon ); -#endif } } else @@ -1089,9 +998,7 @@ void DecLib::xActivateParameterSets() const PPS *pps = pSlice->getPPS(); APS** apss = pSlice->getAlfAPSs(); APS *lmcsAPS = pSlice->getLmcsAPS(); -#if JVET_O0299_APS_SCALINGLIST APS *scalinglistAPS = pSlice->getscalingListAPS(); -#endif // fix Parameter Sets, now that we have the real slice m_pcPic->cs->slice = pSlice; @@ -1099,9 +1006,7 @@ void DecLib::xActivateParameterSets() m_pcPic->cs->pps = pps; memcpy(m_pcPic->cs->alfApss, apss, sizeof(m_pcPic->cs->alfApss)); m_pcPic->cs->lmcsAps = lmcsAPS; -#if JVET_O0299_APS_SCALINGLIST m_pcPic->cs->scalinglistAps = scalinglistAPS; -#endif m_pcPic->cs->pcv = pps->pcv; @@ -1114,11 +1019,7 @@ void DecLib::xActivateParameterSets() { EXIT("Error - a new PPS has been decoded while processing a picture"); } -#if JVET_O_MAX_NUM_ALF_APS_8 for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) -#else - for (int i = 0; i < MAX_NUM_APS; i++) -#endif { APS* aps = m_parameterSetManager.getAPS(i, ALF_APS); if (aps && m_parameterSetManager.getAPSChangedFlag(i, ALF_APS)) @@ -1131,23 +1032,15 @@ void DecLib::xActivateParameterSets() { EXIT("Error - a new LMCS APS has been decoded while processing a picture"); } -#if JVET_O0299_APS_SCALINGLIST if( scalinglistAPS && m_parameterSetManager.getAPSChangedFlag( scalinglistAPS->getAPSId(), SCALING_LIST_APS ) ) { EXIT( "Error - a new SCALING LIST APS has been decoded while processing a picture" ); } -#endif -#if JVET_O0299_APS_SCALINGLIST activateAPS(pSlice, m_parameterSetManager, apss, lmcsAPS, scalinglistAPS); -#else - activateAPS(pSlice, m_parameterSetManager, apss, lmcsAPS); -#endif m_pcPic->cs->lmcsAps = lmcsAPS; -#if JVET_O0299_APS_SCALINGLIST m_pcPic->cs->scalinglistAps = scalinglistAPS; -#endif xParsePrefixSEImessages(); @@ -1163,7 +1056,6 @@ void DecLib::xActivateParameterSets() } // Conformance checks -#if JVET_O0244_DELTA_POC Slice *pSlice = m_pcPic->slices[m_uiSliceSegmentIdx]; const SPS *sps = pSlice->getSPS(); const PPS *pps = pSlice->getPPS(); @@ -1177,19 +1069,14 @@ void DecLib::xActivateParameterSets() { CHECK( pps->getWPBiPred(), "When sps_weighted_bipred_flag is equal to 0, the value of pps_weighted_bipred_flag shall be equal to 0." ); } -#endif -#if JVET_O1164_PS -#if JVET_O0640_PICTURE_SIZE_CONSTRAINT CHECK( ( pps->getPicWidthInLumaSamples() % ( std::max( 8, int( sps->getMaxCUWidth() >> ( sps->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); CHECK( ( pps->getPicHeightInLumaSamples() % ( std::max( 8, int( sps->getMaxCUHeight() >> ( sps->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#endif if( sps->getCTUSize() + 2 * ( 1 << sps->getLog2MinCodingBlockSize() ) > pps->getPicWidthInLumaSamples() ) { CHECK( sps->getWrapAroundEnabledFlag(), "Wraparound shall be disabled when the value of ( CtbSizeY / MinCbSizeY + 1) is less than or equal to ( pic_width_in_luma_samples / MinCbSizeY - 1 )" ); } -#endif } @@ -1210,11 +1097,7 @@ void DecLib::xParsePrefixSEImessages() while (!m_prefixSEINALUs.empty()) { InputNALUnit &nalu=*m_prefixSEINALUs.front(); -#if !JVET_N0867_TEMP_SCAL_HRD - m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_HRD, m_pDecodedSEIOutputStream ); -#else m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, nalu.m_temporalId, m_parameterSetManager.getActiveSPS(), m_HRD, m_pDecodedSEIOutputStream ); -#endif delete m_prefixSEINALUs.front(); m_prefixSEINALUs.pop_front(); } @@ -1226,9 +1109,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice // it is not associated with picture, sps or pps structures. -#if JVET_O1164_RPR Picture* scaledRefPic[MAX_NUM_REF] = {}; -#endif if (m_bFirstSliceInPicture) { @@ -1246,7 +1127,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); m_apcSlicePilot->setTLayer(nalu.m_temporalId); -#if JVET_O0245_VPS_DPS_APS for( auto& naluTemporalId : m_accessUnitNals ) { if( naluTemporalId.first != NAL_UNIT_DPS @@ -1258,12 +1138,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl CHECK( naluTemporalId.second < nalu.m_temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); } } -#endif -#if JVET_N0865_NONSYNTAX if (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR) CHECK(nalu.m_temporalId != 0, "Current GDR picture has TemporalId not equal to 0"); -#endif m_HLSReader.setBitstream( &nalu.getBitstream() ); m_HLSReader.parseSliceHeader( m_apcSlicePilot, &m_parameterSetManager, m_prevTid0POC ); @@ -1288,22 +1165,14 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl DTRACE_UPDATE( g_trace_ctx, std::make_pair( "poc", m_apcSlicePilot->getPOC() ) ); -#if JVET_O0610_DETECT_AUD -#if JVET_N0865_NONSYNTAX if ((m_bFirstSliceInPicture || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && getNoOutputPriorPicsFlag()) -#else - if ((m_bFirstSliceInPicture || - m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) - && getNoOutputPriorPicsFlag() ) -#endif { checkNoOutputPriorPics(&m_cListPic); setNoOutputPriorPicsFlag (false); } -#endif xUpdatePreviousTid0POC(m_apcSlicePilot); @@ -1311,28 +1180,15 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); //For inference of NoOutputOfPriorPicsFlag -#if JVET_N0865_NONSYNTAX if (m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) -#else - if (m_apcSlicePilot->getRapPicFlag()) -#endif { -#if JVET_N0865_NONSYNTAX if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsCvsStartFlag()) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR && m_bFirstSliceInSequence)) { m_apcSlicePilot->setNoIncorrectPicOutputFlag(true); } -#else - if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) || - (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsCvsStartFlag())) - { - m_apcSlicePilot->setNoRaslOutputFlag(true); - } -#endif //the inference for NoOutputPriorPicsFlag -#if JVET_N0865_NONSYNTAX if (!m_bFirstSliceInBitstream && (m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && m_apcSlicePilot->getNoIncorrectPicOutputFlag()) @@ -1342,37 +1198,17 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_apcSlicePilot->setNoOutputPriorPicsFlag(true); } } -#else - if (!m_bFirstSliceInBitstream && m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag()) - { - if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) - { - m_apcSlicePilot->setNoOutputPriorPicsFlag(true); - } - } -#endif else { m_apcSlicePilot->setNoOutputPriorPicsFlag(false); } -#if JVET_N0865_NONSYNTAX if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) { m_lastNoIncorrectPicOutputFlag = m_apcSlicePilot->getNoIncorrectPicOutputFlag(); } -#else - if(m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) - { - m_craNoRaslOutputFlag = m_apcSlicePilot->getNoRaslOutputFlag(); - } -#endif } -#if JVET_N0865_NONSYNTAX if ((m_apcSlicePilot->getRapPicFlag() || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && m_apcSlicePilot->getNoOutputPriorPicsFlag()) -#else - if (m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoOutputPriorPicsFlag()) -#endif { m_lastPOCNoOutputPriorPics = m_apcSlicePilot->getPOC(); m_isNoOutputPriorPics = true; @@ -1385,22 +1221,14 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl //For inference of PicOutputFlag if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL) { -#if JVET_N0865_NONSYNTAX if (m_lastNoIncorrectPicOutputFlag) -#else - if ( m_craNoRaslOutputFlag ) -#endif { m_apcSlicePilot->setPicOutputFlag(false); } } -#if JVET_N0865_NONSYNTAX if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && m_lastNoIncorrectPicOutputFlag) //Reset POC MSB when CRA or GDR has NoIncorrectPicOutputFlag equal to 1 -#else - if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1 -#endif { PPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); CHECK(pps == 0, "No PPS present"); @@ -1449,15 +1277,10 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl //detect lost reference picture and insert copy of earlier frame. { int lostPoc; - #if JVET_O0241 int refPicIndex; while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL0(), 0, true, &refPicIndex)) > 0) { -#if JVET_N0865_GRA2GDR if ( ( (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) ) && m_apcSlicePilot->getNoIncorrectPicOutputFlag() ) -#else - if (((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) && m_apcSlicePilot->getNoIncorrectPicOutputFlag()) -#endif { xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL0()->isRefPicLongterm(refPicIndex)); @@ -1469,11 +1292,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL1(), 0, true, &refPicIndex)) > 0) { -#if JVET_N0865_GRA2GDR if (((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) && m_apcSlicePilot->getNoIncorrectPicOutputFlag()) -#else - if (((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) && m_apcSlicePilot->getNoIncorrectPicOutputFlag()) -#endif { xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL1()->isRefPicLongterm(refPicIndex)); @@ -1483,12 +1302,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl xCreateLostPicture(lostPoc - 1); } } -#else - 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); -#endif } m_prevPOC = m_apcSlicePilot->getPOC(); @@ -1512,7 +1325,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_pcPic->referenced = true; m_pcPic->layer = nalu.m_temporalId; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (pcSlice->getPPS()->getRectSliceFlag()) { int sliceIdx = pcSlice->getSliceIndex(); @@ -1523,7 +1335,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->setSliceCurEndBrickIdx(bottomRight); pcSlice->setSliceCurStartCtuTsAddr(pcSlice->getSliceCurStartBrickIdx()); } -#endif // 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. @@ -1556,13 +1367,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->checkCRA(pcSlice->getRPL0(), pcSlice->getRPL1(), m_pocCRA, m_associatedIRAPType, m_cListPic); pcSlice->constructRefPicList(m_cListPic); -#if JVET_O1164_RPR -#if JVET_O0299_APS_SCALINGLIST pcSlice->scaleRefPicList( scaledRefPic, m_parameterSetManager.getAPSs(), pcSlice->getLmcsAPS(), pcSlice->getscalingListAPS(), true ); -#else - pcSlice->scaleRefPicList( scaledRefPic, m_parameterSetManager.getAPSs(), pcSlice->getLmcsAPS(), true ); -#endif -#endif if (!pcSlice->isIntra()) { @@ -1592,9 +1397,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } if (pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false -#if JVET_O0284_CONDITION_SMVD_MVDL1ZEROFLAG && pcSlice->getMvdL1ZeroFlag() == false -#endif ) { int currPOC = pcSlice->getPOC(); @@ -1609,12 +1412,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_0 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_0, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_0, ref)->longTerm; if ( poc < currPOC && (poc > forwardPOC || refIdx0 == -1) && !isRefLongTerm ) -#else - if ( poc < currPOC && (poc > forwardPOC || refIdx0 == -1) ) -#endif { forwardPOC = poc; refIdx0 = ref; @@ -1625,12 +1424,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_1 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_1, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_1, ref)->longTerm; if ( poc > currPOC && (poc < backwardPOC || refIdx1 == -1) && !isRefLongTerm ) -#else - if ( poc > currPOC && (poc < backwardPOC || refIdx1 == -1) ) -#endif { backwardPOC = poc; refIdx1 = ref; @@ -1648,12 +1443,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_0 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_0, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_0, ref)->longTerm; if ( poc > currPOC && (poc < backwardPOC || refIdx0 == -1) && !isRefLongTerm ) -#else - if ( poc > currPOC && (poc < backwardPOC || refIdx0 == -1) ) -#endif { backwardPOC = poc; refIdx0 = ref; @@ -1664,12 +1455,8 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_1 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_1, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_1, ref)->longTerm; if ( poc < currPOC && (poc > forwardPOC || refIdx1 == -1) && !isRefLongTerm ) -#else - if ( poc < currPOC && (poc > forwardPOC || refIdx1 == -1) ) -#endif { forwardPOC = poc; refIdx1 = ref; @@ -1694,7 +1481,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl //--------------- pcSlice->setRefPOCList(); -#if JVET_N0494_DRAP SEIMessages drapSEIs = getSeisByType(m_pcPic->SEIs, SEI::DEPENDENT_RAP_INDICATION ); if (!drapSEIs.empty()) { @@ -1703,11 +1489,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->setLatestDRAPPOC(pcSlice->getPOC()); } pcSlice->checkConformanceForDRAP(nalu.m_temporalId); -#endif Quant *quant = m_cTrQuant.getQuant(); -#if JVET_O0299_APS_SCALINGLIST if( pcSlice->getSPS()->getScalingListFlag() ) { ScalingList scalingList; @@ -1727,42 +1511,15 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { quant->setUseScalingList( false ); } -#else - if(pcSlice->getSPS()->getScalingListFlag()) - { - ScalingList scalingList; - if(pcSlice->getPPS()->getScalingListPresentFlag()) - { - scalingList = pcSlice->getPPS()->getScalingList(); - } - else if (pcSlice->getSPS()->getScalingListPresentFlag()) - { - scalingList = pcSlice->getSPS()->getScalingList(); - } - else - { - scalingList.setDefaultScalingList(); - } - quant->setScalingListDec(scalingList); - quant->setUseScalingList(true); - } - else - { - quant->setUseScalingList(false); - } -#endif if (pcSlice->getSPS()->getUseReshaper()) { -#if JVET_O0428_LMCS_CLEANUP if (m_bFirstSliceInPicture) m_sliceLmcsApsId = -1; -#endif if (pcSlice->getLmcsEnabledFlag()) { APS* lmcsAPS = pcSlice->getLmcsAPS(); -#if JVET_O0428_LMCS_CLEANUP if (m_sliceLmcsApsId == -1) { m_sliceLmcsApsId = lmcsAPS->getAPSId(); @@ -1771,7 +1528,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { CHECK(lmcsAPS->getAPSId() != m_sliceLmcsApsId, "same APS ID shall be used for all slices in one picture"); } -#endif SliceReshapeInfo& sInfo = lmcsAPS->getReshaperAPSInfo(); SliceReshapeInfo& tInfo = m_cReshaper.getSliceReshaperInfo(); tInfo.reshaperModelMaxBinIdx = sInfo.reshaperModelMaxBinIdx; @@ -1815,9 +1571,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_cReshaper.setRecReshaped(false); } } -#if JVET_O1109_UNFIY_CRS m_cReshaper.setVPDULoc(-1, -1); -#endif } else { @@ -1831,9 +1585,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_bFirstSliceInPicture = false; m_uiSliceSegmentIdx++; -#if JVET_O1164_RPR pcSlice->freeScaledRefPicList( scaledRefPic ); -#endif return false; } @@ -1843,9 +1595,7 @@ void DecLib::xDecodeVPS( InputNALUnit& nalu ) VPS* vps = new VPS(); m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_O0245_VPS_DPS_APS CHECK( nalu.m_temporalId, "The value of TemporalId of VPS NAL units shall be equal to 0" ); -#endif m_HLSReader.parseVPS( vps ); delete vps; @@ -1856,9 +1606,7 @@ void DecLib::xDecodeDPS( InputNALUnit& nalu ) DPS* dps = new DPS(); m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_O0245_VPS_DPS_APS CHECK( nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0" ); -#endif m_HLSReader.parseDPS( dps ); m_parameterSetManager.storeDPS( dps, nalu.getBitstream().getFifo() ); @@ -1869,9 +1617,7 @@ void DecLib::xDecodeSPS( InputNALUnit& nalu ) SPS* sps = new SPS(); m_HLSReader.setBitstream( &nalu.getBitstream() ); -#if JVET_O0245_VPS_DPS_APS CHECK( nalu.m_temporalId, "The value of TemporalId of SPS NAL units shall be equal to 0" ); -#endif m_HLSReader.parseSPS( sps ); DTRACE( g_trace_ctx, D_QP_PER_CTU, "CTU Size: %dx%d", sps->getMaxCUWidth(), sps->getMaxCUHeight() ); @@ -1883,10 +1629,8 @@ void DecLib::xDecodePPS( InputNALUnit& nalu ) PPS* pps = new PPS(); m_HLSReader.setBitstream( &nalu.getBitstream() ); m_HLSReader.parsePPS( pps, &m_parameterSetManager ); -#if JVET_O0245_VPS_DPS_APS pps->setLayerId( nalu.m_nuhLayerId ); pps->setTemporalId( nalu.m_temporalId ); -#endif m_parameterSetManager.storePPS( pps, nalu.getBitstream().getFifo() ); } @@ -1896,10 +1640,8 @@ void DecLib::xDecodeAPS(InputNALUnit& nalu) m_HLSReader.setBitstream(&nalu.getBitstream()); m_HLSReader.parseAPS(aps); aps->setTemporalId(nalu.m_temporalId); -#if JVET_O0245_VPS_DPS_APS aps->setLayerId( nalu.m_nuhLayerId ); m_parameterSetManager.checkAuApsContent( aps, m_accessUnitApsNals ); -#endif m_parameterSetManager.storeAPS(aps, nalu.getBitstream().getFifo()); } bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) @@ -1912,9 +1654,7 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) return false; } -#if JVET_O0245_VPS_DPS_APS m_accessUnitNals.push_back( std::pair<NalUnitType, int>( nalu.m_nalUnitType, nalu.m_temporalId ) ); -#endif switch (nalu.m_nalUnitType) { @@ -1945,11 +1685,7 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) case NAL_UNIT_SUFFIX_SEI: if (m_pcPic) { -#if !JVET_N0867_TEMP_SCAL_HRD - m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_HRD, m_pDecodedSEIOutputStream ); -#else m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->SEIs, nalu.m_nalUnitType, nalu.m_temporalId, m_parameterSetManager.getActiveSPS(), m_HRD, m_pDecodedSEIOutputStream ); -#endif } else { @@ -1962,9 +1698,7 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) case NAL_UNIT_CODED_SLICE_IDR_W_RADL: case NAL_UNIT_CODED_SLICE_IDR_N_LP: case NAL_UNIT_CODED_SLICE_CRA: -#if JVET_N0865_NONSYNTAX case NAL_UNIT_CODED_SLICE_GDR: -#endif case NAL_UNIT_CODED_SLICE_RADL: case NAL_UNIT_CODED_SLICE_RASL: ret = xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); @@ -1992,50 +1726,29 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) AUDReader audReader; uint32_t picType; audReader.parseAccessUnitDelimiter(&(nalu.getBitstream()),picType); -#if JVET_O0245_VPS_DPS_APS // vectors clearing shall be moved to the right place if mandatory AUD starting an AU is removed m_accessUnitNals.clear(); m_accessUnitApsNals.clear(); m_accessUnitNals.push_back( std::pair<NalUnitType, int>( NAL_UNIT_ACCESS_UNIT_DELIMITER, nalu.m_temporalId ) ); -#endif -#if JVET_O0610_DETECT_AUD return !m_bFirstSliceInPicture; -#else - msg( NOTICE, "Note: found NAL_UNIT_ACCESS_UNIT_DELIMITER\n"); - return false; -#endif } case NAL_UNIT_EOB: return false; -#if JVET_O0179 case NAL_UNIT_RESERVED_IRAP_VCL_12: case NAL_UNIT_RESERVED_IRAP_VCL_13: -#else - case NAL_UNIT_RESERVED_VCL_12: - case NAL_UNIT_RESERVED_VCL_13: -#endif case NAL_UNIT_RESERVED_VCL_14: case NAL_UNIT_RESERVED_VCL_15: msg( NOTICE, "Note: found reserved VCL NAL unit.\n"); xParsePrefixSEIsForUnknownVCLNal(); return false; -#if JVET_O0179 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_NVCL_26: case NAL_UNIT_RESERVED_NVCL_27: -#else - 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: -#endif msg( NOTICE, "Note: found reserved NAL unit.\n"); return false; case NAL_UNIT_UNSPECIFIED_28: diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index d01ffd9e0fea62308904eda5cabceeca3df841e4..d21981ae15d78e47d17b564828fa4c5d4fdf9dd1 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -97,9 +97,7 @@ private: SampleAdaptiveOffset m_cSAO; AdaptiveLoopFilter m_cALF; Reshape m_cReshaper; ///< reshaper class -#if JVET_N0353_INDEP_BUFF_TIME_SEI HRD m_HRD; -#endif // decoder side RD cost computation RdCost m_cRdCost; ///< RD cost computation class #if JVET_J0090_MEMORY_BANDWITH_MEASURE @@ -117,14 +115,8 @@ private: bool m_bFirstSliceInBitstream; int m_lastPOCNoOutputPriorPics; bool m_isNoOutputPriorPics; -#if JVET_N0865_NONSYNTAX bool m_lastNoIncorrectPicOutputFlag; //value of variable NoIncorrectPicOutputFlag of the last CRA / GDR pic -#else - bool m_craNoRaslOutputFlag; //value of variable NoRaslOutputFlag of the last CRA pic -#endif -#if JVET_O0428_LMCS_CLEANUP int m_sliceLmcsApsId; //value of LmcsApsId, constraint is same id for all slices in one picture -#endif std::ostream *m_pDecodedSEIOutputStream; int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message @@ -136,10 +128,8 @@ private: int m_debugPOC; int m_debugCTU; -#if JVET_O0245_VPS_DPS_APS std::vector<std::pair<NalUnitType, int>> m_accessUnitNals; std::vector<int> m_accessUnitApsNals; -#endif public: DecLib(); @@ -185,9 +175,7 @@ protected: Picture * xGetNewPicBuffer(const SPS &sps, const PPS &pps, const uint32_t temporalLayer); void xCreateLostPicture (int iLostPOC); -#if JVET_O0241 void xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag); -#endif void xActivateParameterSets(); bool xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDisplay); diff --git a/source/Lib/DecoderLib/DecSlice.cpp b/source/Lib/DecoderLib/DecSlice.cpp index 515178e195e2bb7b5531ce145919047043d7e9e7..b4a5da3955f15e6bee61fbdb09c7af4eb1aadfd2 100644 --- a/source/Lib/DecoderLib/DecSlice.cpp +++ b/source/Lib/DecoderLib/DecSlice.cpp @@ -88,26 +88,20 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb memcpy(cs.alfApss, slice->getAlfAPSs(), sizeof(cs.alfApss)); cs.lmcsAps = slice->getLmcsAPS(); -#if JVET_O0299_APS_SCALINGLIST cs.scalinglistAps = slice->getscalingListAPS(); -#endif cs.pcv = slice->getPPS()->pcv; cs.chromaQpAdj = 0; cs.picture->resizeSAO(cs.pcv->sizeInCtus, 0); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif if (slice->getSliceCurStartCtuTsAddr() == 0) { cs.picture->resizeAlfCtuEnableFlag( cs.pcv->sizeInCtus ); cs.picture->resizeAlfCtbFilterIndex(cs.pcv->sizeInCtus); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB cs.picture->resizeAlfCtuAlternative( cs.pcv->sizeInCtus ); -#endif } const unsigned numSubstreams = slice->getNumberOfSubstreamSizes() + 1; @@ -170,9 +164,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb if( ctuTsAddr != startCtuTsAddr ) // if it is the first CTU, then the entropy coder has already been reset { cabacReader.initCtxModels( *slice ); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif } pic->m_prevQP[0] = pic->m_prevQP[1] = slice->getSliceQp(); } @@ -182,9 +174,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb if( ctuTsAddr != startCtuTsAddr ) // if it is the first CTU, then the entropy coder has already been reset { cabacReader.initCtxModels( *slice ); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif } if( cs.getCURestricted( pos.offset(0, -1), pos, slice->getIndependentSliceIdx(), tileMap.getBrickIdxRsMap( pos ), CH_L ) ) { @@ -204,12 +194,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb { cs.motionLut.lut.resize(0); cs.motionLut.lutIbc.resize(0); -#if JVET_O1170_CHECK_BV_AT_DECODER cs.resetIBCBuffer = true; -#endif -#if !JVET_O0078_SINGLE_HMVPLUT - cs.motionLut.lutShareIbc.resize(0); -#endif } if( !cs.slice->isIntra() ) diff --git a/source/Lib/DecoderLib/NALread.cpp b/source/Lib/DecoderLib/NALread.cpp index a9d1f187ba3a019a247084a1e1e17ec245bbca13..73e82cbf1d04b950786e49f14f5b45d2ab7c2303 100644 --- a/source/Lib/DecoderLib/NALread.cpp +++ b/source/Lib/DecoderLib/NALread.cpp @@ -126,26 +126,11 @@ void readNalUnitHeader(InputNALUnit& nalu) { InputBitstream& bs = nalu.getBitstream(); -#if JVET_O0179 nalu.m_forbiddenZeroBit = bs.read(1); // forbidden zero bit nalu.m_nuhReservedZeroBit = bs.read(1); // nuh_reserved_zero_bit nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id nalu.m_nalUnitType = (NalUnitType) bs.read(5); // nal_unit_type nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 -#else - 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. - CHECK((zeroTidRequiredFlag == 1) && (nalu.m_temporalId != 0), "Temporal ID is not '0' when zero tid is required."); - uint32_t nalUnitTypeLsb = bs.read(4); // nal_unit_type_lsb - nalu.m_nalUnitType = (NalUnitType) ((zeroTidRequiredFlag << 4) + nalUnitTypeLsb); - nalu.m_nuhLayerId = bs.read(7); // nuh_layer_id - CHECK (nalu.m_nuhLayerId == 0, "nuh_layer_id_plus1 must be greater than zero"); - nalu.m_nuhLayerId--; - CHECK(nalu.m_nuhLayerId > 125, "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'"); -#endif #if RExt__DECODER_DEBUG_BIT_STATISTICS CodingStatistics::IncrementStatisticEP(STATS__NAL_UNIT_HEADER_BITS, 1+3+4+7+1, 0); @@ -160,12 +145,6 @@ void readNalUnitHeader(InputNALUnit& nalu) { if ( nalu.m_temporalId ) { -#if !JVET_O0179 - CHECK( - (uint32_t)nalu.m_nalUnitType >= 16 - && (uint32_t)nalu.m_nalUnitType <= 31 - , "Invalid NAL type" ); -#endif } else { diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 357988dd04ef3a90dcf588cdff9f091d3c02a096..dee3e96df7cef5b4557d384f442a1083604daa46 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -104,31 +104,15 @@ static inline void output_sei_message_header(SEI &sei, std::ostream *pDecodedMes /** * unmarshal a single SEI message from bitstream bs */ -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#else // note: for independent parsing no parameter set should not be required here -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#else void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#endif -#endif { setBitstream(bs); CHECK(m_pcBitstream->getNumBitsUntilByteAligned(), "Bitstream not aligned"); do { -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if !JVET_N0867_TEMP_SCAL_HRD - xReadSEImessage(seis, nalUnitType, sps, hrd, pDecodedMessageOutputStream); -#else xReadSEImessage(seis, nalUnitType, temporalId, sps, hrd, pDecodedMessageOutputStream); -#endif -#else - xReadSEImessage(seis, nalUnitType, sps, pDecodedMessageOutputStream); -#endif /* SEI messages are an integer number of bytes, something has failed * in the parsing if bitstream not byte-aligned */ @@ -139,15 +123,7 @@ void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const Nal xReadRbspTrailingBits(); } -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#else -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#else void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#endif -#endif { #if ENABLE_TRACING xTraceSEIHeader(); @@ -205,46 +181,15 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType else { sei = new SEIDecodingUnitInfo; -#if JVET_O0189_DU xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps, hrd, pDecodedMessageOutputStream); -#else - xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps, pDecodedMessageOutputStream); -#endif } break; case SEI::BUFFERING_PERIOD: -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if (!sps) - { - msg( WARNING, "Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring."); - } - else - { - sei = new SEIBufferingPeriod; - xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, pDecodedMessageOutputStream); - } -#else sei = new SEIBufferingPeriod; -#if JVET_O0189_DU xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, pDecodedMessageOutputStream); -#else - xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, pDecodedMessageOutputStream); -#endif hrd.setBufferingPeriodSEI((SEIBufferingPeriod*) sei); -#endif break; case SEI::PICTURE_TIMING: -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if (!sps) - { - msg( WARNING, "Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring."); - } - else - { - sei = new SEIPictureTiming; - xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, pDecodedMessageOutputStream); - } -#else { const SEIBufferingPeriod *bp= hrd.getBufferingPeriodSEI(); if (!bp) @@ -254,31 +199,18 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType else { sei = new SEIPictureTiming; -#if JVET_O0189_DU -#if !JVET_N0867_TEMP_SCAL_HRD - xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, *bp, pDecodedMessageOutputStream); -#else xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, temporalId, *bp, pDecodedMessageOutputStream); -#endif -#else - xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, *bp, pDecodedMessageOutputStream); -#endif } } -#endif break; -#if JVET_O0041_FRAME_FIELD_SEI case SEI::FRAME_FIELD_INFO: sei = new SEIFrameFieldInfo; xParseSEIFrameFieldinfo((SEIFrameFieldInfo&) *sei, payloadSize, pDecodedMessageOutputStream); break; -#endif -#if JVET_N0494_DRAP case SEI::DEPENDENT_RAP_INDICATION: sei = new SEIDependentRAPIndication; xParseSEIDependentRAPIndication((SEIDependentRAPIndication&) *sei, payloadSize, pDecodedMessageOutputStream); break; -#endif #if HEVC_SEI case SEI::RECOVERY_POINT: sei = new SEIRecoveryPoint; @@ -550,28 +482,16 @@ void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, uint32 } #endif -#if JVET_O0189_DU void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t payloadSize, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#endif { uint32_t val; output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); sei_read_uvlc( pDecodedMessageOutputStream, val, "decoding_unit_idx"); sei.m_decodingUnitIdx = val; -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if(sps->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) -#else if(sps->getHrdParameters()->getDecodingUnitHrdParamsPresentFlag()) -#endif { -#if JVET_O0189_DU sei_read_code( pDecodedMessageOutputStream, hrd.getBufferingPeriodSEI()->getDuCpbRemovalDelayIncrementLength(), val, "du_spt_cpb_removal_delay_increment"); -#else - sei_read_code( pDecodedMessageOutputStream, ( sps->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment"); -#endif sei.m_duSptCpbRemovalDelay = val; } else @@ -581,74 +501,19 @@ void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t pay sei_read_flag( pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0); if(sei.m_dpbOutputDuDelayPresentFlag) { -#if JVET_O0189_DU sei_read_code( pDecodedMessageOutputStream, hrd.getBufferingPeriodSEI()->getDpbOutputDelayDuLength(), val, "pic_spt_dpb_output_du_delay"); -#else - sei_read_code( pDecodedMessageOutputStream, sps->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); -#endif sei.m_picSptDpbOutputDuDelay = val; } } -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if JVET_O0189_DU void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#else -void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) -#endif -#else -void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#endif { int i, nalOrVcl; uint32_t code; -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - const HRDParameters *pHRD = sps->getHrdParameters(); -#endif output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code; - if( !pHRD->getSubPicCpbParamsPresentFlag() ) - { - sei_read_flag( pDecodedMessageOutputStream, code, "irap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; - } - if( sei.m_rapCpbParamsPresentFlag ) - { - sei_read_code( pDecodedMessageOutputStream, pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" ); sei.m_cpbDelayOffset = code; - sei_read_code( pDecodedMessageOutputStream, pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; - } - - //read splicing flag and cpb_removal_delay_delta - sei_read_flag( pDecodedMessageOutputStream, code, "concatenation_flag"); - sei.m_concatenationFlag = code; - sei_read_code( pDecodedMessageOutputStream, ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); - sei.m_auCpbRemovalDelayDelta = code + 1; - - for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) - { - if( ( ( nalOrVcl == 0 ) && ( pHRD->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( pHRD->getVclHrdParametersPresentFlag() ) ) ) - { - for( i = 0; i < ( pHRD->getCpbCntMinus1( 0 ) + 1 ); i ++ ) - { - sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_cpb_removal_delay":"nal_initial_cpb_removal_delay" ); - sei.m_initialCpbRemovalDelay[i][nalOrVcl] = code; - sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_cpb_removal_offset":"nal_initial_cpb_removal_offset" ); - sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl] = code; - if( pHRD->getSubPicCpbParamsPresentFlag() || sei.m_rapCpbParamsPresentFlag ) - { - sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_alt_cpb_removal_delay":"nal_initial_alt_cpb_removal_delay" ); - sei.m_initialAltCpbRemovalDelay[i][nalOrVcl] = code; - sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_alt_cpb_removal_offset":"nal_initial_alt_cpb_removal_offset" ); - sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl] = code; - } - } - } - } -#else sei_read_flag( pDecodedMessageOutputStream, code, "bp_nal_hrd_parameters_present_flag" ); sei.m_bpNalCpbParamsPresentFlag = code; sei_read_flag( pDecodedMessageOutputStream, code, "bp_vcl_hrd_parameters_present_flag" ); sei.m_bpVclCpbParamsPresentFlag = code; @@ -657,20 +522,17 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo sei_read_code( pDecodedMessageOutputStream, 5, code, "initial_cpb_removal_delay_length_minus1" ); sei.m_initialCpbRemovalDelayLength = code + 1; sei_read_code( pDecodedMessageOutputStream, 5, code, "cpb_removal_delay_length_minus1" ); sei.m_cpbRemovalDelayLength = code + 1; sei_read_code( pDecodedMessageOutputStream, 5, code, "dpb_output_delay_length_minus1" ); sei.m_dpbOutputDelayLength = code + 1; -#if JVET_O0189_DU if( sps->getHrdParameters()->getDecodingUnitHrdParamsPresentFlag() ) { sei_read_code( pDecodedMessageOutputStream, 5, code, "du_cpb_removal_delay_increment_length_minus1" ); sei.m_duCpbRemovalDelayIncrementLength = code + 1; sei_read_code( pDecodedMessageOutputStream, 5, code, "dpb_output_delay_du_length_minus1" ); sei.m_dpbOutputDelayDuLength = code + 1; } -#endif } sei_read_flag( pDecodedMessageOutputStream, code, "concatenation_flag"); sei.m_concatenationFlag = code; sei_read_code( pDecodedMessageOutputStream, ( sei.m_cpbRemovalDelayLength ), code, "au_cpb_removal_delay_delta_minus1" ); sei.m_auCpbRemovalDelayDelta = code + 1; -#if JVET_N0867_TEMP_SCAL_HRD sei_read_flag( pDecodedMessageOutputStream, code, "cpb_removal_delay_deltas_present_flag" ); sei.m_cpbRemovalDelayDeltasPresentFlag = code; if (sei.m_cpbRemovalDelayDeltasPresentFlag) { @@ -700,112 +562,14 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo } } } -#else - sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_cpb_cnt_minus1" ); sei.m_bpCpbCnt = code + 1; - for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) - { - if( ( ( nalOrVcl == 0 ) && ( sei.m_bpNalCpbParamsPresentFlag ) ) || - ( ( nalOrVcl == 1 ) && ( sei.m_bpVclCpbParamsPresentFlag ) ) ) - { - sei.m_initialCpbRemovalDelay[nalOrVcl].resize(sei.m_bpCpbCnt); - sei.m_initialCpbRemovalDelay[nalOrVcl].resize(sei.m_bpCpbCnt); - for( i = 0; i < ( sei.m_bpCpbCnt ); i ++ ) - { - sei_read_code( pDecodedMessageOutputStream, sei.m_initialCpbRemovalDelayLength, code, nalOrVcl ? "vcl_initial_cpb_removal_delay" : "nal_initial_cpb_removal_delay" ); - sei.m_initialCpbRemovalDelay[nalOrVcl][i] = code; - sei_read_code( pDecodedMessageOutputStream, sei.m_initialCpbRemovalDelayLength, code, nalOrVcl ? "vcl_initial_cpb_removal_offset" : "nal_initial_cpb_removal_offset" ); - sei.m_initialCpbRemovalDelay[nalOrVcl][i] = code; - } - } - } -#endif -#endif } -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream) -#else -#if JVET_O0189_DU -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSize, const SPS *sps, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream) -#else void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSize, const SPS *sps, const uint32_t temporalId, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream) -#endif -#else -void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSize, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream) -#endif -#endif { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - int i; -#endif -#if !JVET_O0041_FRAME_FIELD_SEI - uint32_t code; -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - const HRDParameters *hrd = sps->getHrdParameters(); -#endif -#if JVET_O0189_DU const HRDParameters *hrd = sps->getHrdParameters(); -#endif output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); -#if !JVET_O0041_FRAME_FIELD_SEI - { - 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; - sei_read_flag( pDecodedMessageOutputStream, code, "duplicate_flag" ); sei.m_duplicateFlag = (code == 1); - } -#endif - -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if( hrd->getCpbDpbDelaysPresentFlag()) - { - sei_read_code( pDecodedMessageOutputStream, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); - sei.m_auCpbRemovalDelay = code + 1; - sei_read_code( pDecodedMessageOutputStream, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), code, "pic_dpb_output_delay" ); - sei.m_picDpbOutputDelay = code; - - if(hrd->getSubPicCpbParamsPresentFlag()) - { - sei_read_code( pDecodedMessageOutputStream, hrd->getDpbOutputDelayDuLengthMinus1()+1, code, "pic_dpb_output_du_delay" ); - sei.m_picDpbOutputDuDelay = code; - } - if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) - { - sei_read_uvlc( pDecodedMessageOutputStream, code, "num_decoding_units_minus1"); - sei.m_numDecodingUnitsMinus1 = code; - sei_read_flag( pDecodedMessageOutputStream, code, "du_common_cpb_removal_delay_flag" ); - sei.m_duCommonCpbRemovalDelayFlag = code; - if( sei.m_duCommonCpbRemovalDelayFlag ) - { - sei_read_code( pDecodedMessageOutputStream, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_common_cpb_removal_delay_increment_minus1" ); - sei.m_duCommonCpbRemovalDelayMinus1 = code; - } - sei.m_numNalusInDuMinus1.resize(sei.m_numDecodingUnitsMinus1 + 1 ); - sei.m_duCpbRemovalDelayMinus1.resize( sei.m_numDecodingUnitsMinus1 + 1 ); - - for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ ) - { - sei_read_uvlc( pDecodedMessageOutputStream, code, "num_nalus_in_du_minus1[i]"); - sei.m_numNalusInDuMinus1[ i ] = code; - if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) ) - { - sei_read_code( pDecodedMessageOutputStream, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_cpb_removal_delay_minus1[i]" ); - sei.m_duCpbRemovalDelayMinus1[ i ] = code; - } - } - } - } -#else -#if !JVET_N0867_TEMP_SCAL_HRD - uint32_t symbol; - sei_read_code( pDecodedMessageOutputStream, bp.m_cpbRemovalDelayLength, symbol, "cpb_removal_delay_minus1" ); - sei.m_auCpbRemovalDelay = symbol + 1; - sei_read_code( pDecodedMessageOutputStream, bp.m_dpbOutputDelayLength, symbol, "dpb_output_delay" ); - sei.m_picDpbOutputDelay = symbol; -#else uint32_t symbol; sei_read_code( pDecodedMessageOutputStream, 3, symbol, "pt_max_sub_layers_minus1" ); sei.m_ptMaxSubLayers = symbol + 1; @@ -831,9 +595,6 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi } sei_read_code( pDecodedMessageOutputStream, bp.m_dpbOutputDelayLength, symbol, "dpb_output_delay" ); sei.m_picDpbOutputDelay = symbol; -#endif -#endif -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) { sei_read_code( pDecodedMessageOutputStream, bp.getDpbOutputDelayDuLength(), symbol, "pic_dpb_output_du_delay" ); @@ -864,10 +625,8 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi } } } -#endif } -#if JVET_O0041_FRAME_FIELD_SEI void SEIReader::xParseSEIFrameFieldinfo(SEIFrameFieldInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); @@ -904,14 +663,11 @@ void SEIReader::xParseSEIFrameFieldinfo(SEIFrameFieldInfo& sei, uint32_t payload sei_read_flag( pDecodedMessageOutputStream, symbol, "duplicate_flag" ); sei.m_duplicateFlag = symbol; } -#endif -#if JVET_N0494_DRAP void SEIReader::xParseSEIDependentRAPIndication( SEIDependentRAPIndication& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream ) { output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); } -#endif #if HEVC_SEI diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 351bc2956ef55c006ef210e1efb7a0aba2c04763..c61649c823440fac3c7155099eac484829bb258b 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -55,58 +55,20 @@ class SEIReader: public VLCReader public: SEIReader() {}; virtual ~SEIReader() {}; -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#else -#if !JVET_N0867_TEMP_SCAL_HRD - void parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#else void parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#endif -#endif protected: -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#else -#if !JVET_N0867_TEMP_SCAL_HRD - void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#else void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t temporalId, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#endif -#endif #if HEVC_SEI void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIActiveParameterSets (SEIActiveParameterSets &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); #endif -#if JVET_O0189_DU void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, uint32_t payloadSize, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); -#else - void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#endif void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if JVET_O0189_DU void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#if !JVET_N0867_TEMP_SCAL_HRD - void xParseSEIPictureTiming (SEIPictureTiming& sei, uint32_t payloadSize, const SPS *sps, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream); -#else void xParseSEIPictureTiming (SEIPictureTiming& sei, uint32_t payloadSize, const SPS *sps, const uint32_t temporalId, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream); -#endif -#else - void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); - void xParseSEIPictureTiming (SEIPictureTiming& sei, uint32_t payloadSize, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream); -#endif -#else - void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream); - void xParseSEIPictureTiming (SEIPictureTiming& sei, uint32_t payloadSize, const SPS *sps, std::ostream *pDecodedMessageOutputStream); -#endif -#if JVET_O0041_FRAME_FIELD_SEI void xParseSEIFrameFieldinfo (SEIFrameFieldInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); -#endif -#if JVET_N0494_DRAP void xParseSEIDependentRAPIndication (SEIDependentRAPIndication& sei, uint32_t payLoadSize, std::ostream *pDecodedMessageOutputStream); -#endif #if HEVC_SEI void xParseSEIRecoveryPoint (SEIRecoveryPoint& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIFramePacking (SEIFramePacking& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index bf1e66463237fa4864e8eb1a51518f7c85673431..0760ec1efe64d9386e09ec9080f9f7b6923a6ef5 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -291,13 +291,11 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl) uint32_t numStrp = 0; uint32_t numLtrp = 0; -#if JVET_N0100_PROPOSAL1 if (sps->getLongTermRefsPresent()) { READ_FLAG(code, "ltrp_in_slice_header_flag[ listIdx ][ rplsIdx ]"); rpl->setLtrpInSliceHeaderFlag(code); } -#endif bool isLongTerm; int prevDelta = MAX_INT; @@ -318,12 +316,10 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl) if (!isLongTerm) { READ_UVLC(code, "abs_delta_poc_st[ listIdx ][ rplsIdx ][ i ]"); -#if JVET_O0244_DELTA_POC if( !sps->getUseWP() && !sps->getUseWPBiPred() ) { code++; } -#endif int readValue = code; if (readValue > 0) READ_FLAG(code, "strp_entry_sign_flag[ listIdx ][ rplsIdx ][ i ]"); @@ -343,7 +339,6 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl) rpl->setRefPicIdentifier(ii, deltaValue, isLongTerm); numStrp++; } -#if JVET_N0100_PROPOSAL1 else { if (!rpl->getLtrpInSliceHeaderFlag()) @@ -351,14 +346,6 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl) rpl->setRefPicIdentifier(ii, code, isLongTerm); numLtrp++; } -#else - else // else if( !ltrp_in_slice_header_flag[ listIdx ][ rplsIdx ] ) - { - READ_CODE(sps->getBitsForPOC(), code, "poc_lsb_lt[listIdx][rplsIdx][i]"); - rpl->setRefPicIdentifier(ii, code, isLongTerm); - numLtrp++; - } -#endif } rpl->setNumberOfShorttermPictures(numStrp); rpl->setNumberOfLongtermPictures(numLtrp); @@ -381,7 +368,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana CHECK(uiCode > 15, "SPS id exceeds boundary (15)"); pcPPS->setSPSId (uiCode); -#if JVET_O1164_PS READ_UVLC( uiCode, "pic_width_in_luma_samples" ); pcPPS->setPicWidthInLumaSamples( uiCode ); READ_UVLC( uiCode, "pic_height_in_luma_samples" ); pcPPS->setPicHeightInLumaSamples( uiCode ); @@ -394,7 +380,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset( uiCode ); READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); } -#endif READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); @@ -415,7 +400,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_FLAG(uiCode, "rpl1_idx_present_flag"); pcPPS->setRpl1IdxPresentFlag(uiCode); -#if JVET_O0238_PPS_OR_SLICE READ_FLAG( uiCode, "constant_slice_header_params_enabled_flag"); pcPPS->setConstantSliceHeaderParamsEnabledFlag(uiCode); if ( pcPPS->getConstantSliceHeaderParamsEnabledFlag() ) { READ_CODE( 2, uiCode, "pps_dep_quant_enabled_idc"); pcPPS->setPPSDepQuantEnabledIdc(uiCode); @@ -440,20 +424,14 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana pcPPS->setPPSFiveMinusMaxNumSubblockMergeCandPlus1(0); pcPPS->setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(0); } -#endif READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); -#if JVET_O1136_TS_BDPCM_SIGNALLING if (parameterSetManager->getSPS(pcPPS->getSPSId())->getTransformSkipEnabledFlag()) { READ_UVLC(uiCode, "log2_max_transform_skip_block_size_minus2"); pcPPS->setLog2MaxTransformSkipBlockSize(uiCode + 2); } -#else - READ_FLAG( uiCode, "transform_skip_enabled_flag" ); - pcPPS->setUseTransformSkip ( uiCode ? true : false ); -#endif READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); if( pcPPS->getUseDQP() ) @@ -502,23 +480,15 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana { int cbOffset; int crOffset; -#if JVET_O1168_CU_CHROMA_QP_OFFSET int jointCbCrOffset; -#endif READ_SVLC(cbOffset, "cb_qp_offset_list[i]"); CHECK(cbOffset < -12 || cbOffset > 12, "Invalid chroma QP offset"); READ_SVLC(crOffset, "cr_qp_offset_list[i]"); CHECK(crOffset < -12 || crOffset > 12, "Invalid chroma QP offset"); -#if JVET_O1168_CU_CHROMA_QP_OFFSET READ_SVLC(jointCbCrOffset, "joint_cbcr_qp_offset_list[i]"); CHECK(jointCbCrOffset < -12 || jointCbCrOffset > 12, "Invalid chroma QP offset"); -#endif // table uses +1 for index (see comment inside the function) -#if JVET_O1168_CU_CHROMA_QP_OFFSET pcPPS->setChromaQpOffsetListEntry(cuChromaQpOffsetIdx + 1, cbOffset, crOffset, jointCbCrOffset); -#else - pcPPS->setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset); -#endif } CHECK(pcPPS->getChromaQpOffsetListLen() != tableSizeMinus1 + 1, "Invalid chroma QP offset list length"); } @@ -576,7 +546,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_FLAG( uiCode, "brick_splitting_present_flag" ); pcPPS->setBrickSplittingPresentFlag(uiCode == 1); -#if JVET_O0236_PPS_PARSING_DEPENDENCY int numTilesInPic = 0; if (pcPPS->getUniformTileSpacingFlag()) { @@ -590,9 +559,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana { numTilesInPic = (pcPPS->getNumTileColumnsMinus1() + 1) * (pcPPS->getNumTileRowsMinus1() + 1); } -#else - int numTilesInPic = pcPPS->getUniformTileSpacingFlag() ? 0 : (pcPPS->getNumTileColumnsMinus1() + 1) * (pcPPS->getNumTileRowsMinus1() + 1); -#endif pcPPS->setNumTilesInPic(numTilesInPic); @@ -601,22 +567,12 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana std::vector<bool> brickSplitFlag (numTilesInPic); std::vector<bool> uniformBrickSpacingFlag (numTilesInPic); std::vector<int> brickHeightMinus1 (numTilesInPic); -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 std::vector<int> numBrickRowsMinus2(numTilesInPic); -#else - std::vector<int> numBrickRowsMinus1 (numTilesInPic); -#endif std::vector<std::vector<int>> brickRowHeightMinus1 (numTilesInPic); -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION int m_maxCUHeight = parameterSetManager->getSPS(pcPPS->getSPSId())->getMaxCUHeight(); int m_maxCUWidth = parameterSetManager->getSPS(pcPPS->getSPSId())->getMaxCUWidth(); -#if JVET_O1164_RPR int picHeightInCtus = (pcPPS->getPicHeightInLumaSamples() + m_maxCUHeight - 1) / m_maxCUHeight; int picWidthInCtus = (pcPPS->getPicWidthInLumaSamples() + m_maxCUWidth - 1) / m_maxCUWidth; -#else - int picHeightInCtus = (parameterSetManager->getSPS(pcPPS->getSPSId())->getPicHeightInLumaSamples() + m_maxCUHeight - 1) / m_maxCUHeight; - int picWidthInCtus = (parameterSetManager->getSPS(pcPPS->getSPSId())->getPicWidthInLumaSamples() + m_maxCUWidth - 1) / m_maxCUWidth; -#endif if (pcPPS->getUniformTileSpacingFlag()) { @@ -665,38 +621,29 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana } pcPPS->setTileHeight(tileHeight); } -#endif for( int i = 0; i < numTilesInPic; i++ ) { -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION if (pcPPS->getTileHeight(i) > 1) { -#endif READ_FLAG(uiCode, "brick_split_flag [i]"); brickSplitFlag[i] = (uiCode == 1); -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION } else { brickSplitFlag[i] = 0; } -#endif if( brickSplitFlag[i] ) { -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION if (pcPPS->getTileHeight(i) > 2) { -#endif READ_FLAG(uiCode, "uniform_brick_spacing_flag [i]"); uniformBrickSpacingFlag[i] = (uiCode == 1); -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION } else { uniformBrickSpacingFlag[i] = 1; } -#endif if( uniformBrickSpacingFlag[i] ) { READ_UVLC( uiCode, "brick_height_minus1" ); @@ -704,7 +651,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana } else { -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 READ_UVLC(uiCode, "num_brick_rows_minus2 [i]"); numBrickRowsMinus2[i] = uiCode; for (int j = 0; j < numBrickRowsMinus2[i] + 1; j++) @@ -713,27 +659,13 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_UVLC(uiCode, "brick_row_height_minus1 [i][j]"); brickRowHeightMinus1[i][j] = uiCode; } -#else - READ_UVLC( uiCode, "num_brick_rows_minus1 [i]" ); - numBrickRowsMinus1[i] = uiCode; - for(int j = 0; j < numBrickRowsMinus1[i]; j++ ) - { - brickRowHeightMinus1[i].resize(numBrickRowsMinus1[i]); - READ_UVLC( uiCode, "brick_row_height_minus1 [i][j]" ); - brickRowHeightMinus1[i][j]=uiCode; - } -#endif } } } pcPPS->setBrickSplitFlag(brickSplitFlag); pcPPS->setUniformBrickSpacingFlag(uniformBrickSpacingFlag); pcPPS->setBrickHeightMinus1(brickHeightMinus1); -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 pcPPS->setNumBrickRowsMinus2(numBrickRowsMinus2); -#else - pcPPS->setNumBrickRowsMinus1(numBrickRowsMinus1); -#endif pcPPS->setBrickRowHeightMinus1(brickRowHeightMinus1); } READ_FLAG (uiCode, "single_brick_per_slice_flag" ); pcPPS->setSingleBrickPerSliceFlag(uiCode == 1); @@ -749,32 +681,14 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana if(pcPPS->getRectSliceFlag() && !pcPPS->getSingleBrickPerSliceFlag()) { READ_UVLC (uiCode, "num_slices_in_pic_minus1" ); pcPPS->setNumSlicesInPicMinus1(uiCode); -#if JVET_O0236_PPS_PARSING_DEPENDENCY const uint32_t numSlicesInPic = pcPPS->getNumSlicesInPicMinus1() + 1; -#else - const uint32_t tileColumnsMinus1 = pcPPS->getNumTileColumnsMinus1(); - const uint32_t tileRowsMinus1 = pcPPS->getNumTileRowsMinus1(); - const uint32_t numSlicesInPic = pcPPS->getNumSlicesInPicMinus1() + 1; - const uint32_t numTilesInPic = (tileColumnsMinus1 + 1) * (tileRowsMinus1 + 1); - int codeLength = ceilLog2(numTilesInPic); - int codeLength2 = codeLength; -#endif -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA uint32_t codeLen; READ_UVLC(codeLen, "bottom_right_brick_idx_length_minus1 "); -#endif if (numSlicesInPic > 0) { -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA std::vector<int> bottomRightBrickIdxDelta(numSlicesInPic); -#else - std::vector<int> topLeft(numSlicesInPic); - std::vector<int> bottomRight(numSlicesInPic); - topLeft[0] = 0; -#endif for (uint32_t i = 0; i < numSlicesInPic; i++) { -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA READ_CODE(codeLen, uiCode, "bottom_right_brick_idx_delta"); int delta = uiCode; READ_FLAG(uiCode, "brick_idx_delta_sign_flag"); @@ -784,23 +698,8 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana delta = -delta; } bottomRightBrickIdxDelta[i] = delta; -#else - if (i > 0) - { - READ_CODE( codeLength, uiCode, "top_left_brick_idx" ); - topLeft[i] = uiCode; - codeLength2 = ceilLog2((numTilesInPic - topLeft[i] < 2) ? 2 : numTilesInPic - topLeft[i]); - } - READ_CODE( codeLength2, uiCode, "bottom_right_brick_idx_delta"); - bottomRight[i] = topLeft[i] + uiCode; -#endif } -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA pcPPS->setBottomRightBrickIdxDelta(bottomRightBrickIdxDelta); -#else - pcPPS->setTopLeftBrickIdx(topLeft); - pcPPS->setBottomRightBrickIdx(bottomRight); -#endif } } if (pcPPS->getRectSliceFlag() && pcPPS->getSingleBrickPerSliceFlag()) @@ -893,13 +792,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana } } -#if !JVET_O0299_APS_SCALINGLIST - READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); - if(pcPPS->getScalingListPresentFlag ()) - { - parseScalingList( &(pcPPS->getScalingList()) ); - } -#endif READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); @@ -980,12 +872,7 @@ void HLSyntaxReader::parseAPS( APS* aps ) aps->setAPSId(code); READ_CODE(3, code, "aps_params_type"); -#if JVET_O0245_VPS_DPS_APS aps->setAPSType( ApsType(code) ); -#else - aps->setAPSType(code); -#endif -#if JVET_O0299_APS_SCALINGLIST if( code == ALF_APS ) { parseAlfAps( aps ); @@ -998,16 +885,6 @@ void HLSyntaxReader::parseAPS( APS* aps ) { parseScalingListAps( aps ); } -#else - if (code == ALF_APS) - { - parseAlfAps(aps); - } - else if (code == LMCS_APS) - { - parseLmcsAps(aps); - } -#endif READ_FLAG(code, "aps_extension_flag"); if (code) { @@ -1024,9 +901,7 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) uint32_t code; AlfParam param = aps->getAlfAPSParam(); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB param.reset(); -#endif 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; @@ -1037,29 +912,15 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) if (param.newFilterFlag[CHANNEL_TYPE_LUMA]) { READ_FLAG(code, "alf_luma_clip"); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB param.nonLinearFlag[CHANNEL_TYPE_LUMA][0] = code ? true : false; -#else - param.nonLinearFlag[CHANNEL_TYPE_LUMA] = code ? true : false; -#endif -#if JVET_O0491_HLS_CLEANUP READ_UVLC(code, "alf_luma_num_filters_signalled_minus1"); -#else - xReadTruncBinCode(code, MAX_NUM_ALF_CLASSES); //number_of_filters_minus1 -#endif param.numLumaFilters = code + 1; if (param.numLumaFilters > 1) { -#if JVET_O0491_HLS_CLEANUP const int length = ceilLog2(param.numLumaFilters); -#endif for (int i = 0; i < MAX_NUM_ALF_CLASSES; i++) { -#if JVET_O0491_HLS_CLEANUP READ_CODE(length, code, "alf_luma_coeff_delta_idx"); -#else - xReadTruncBinCode(code, param.numLumaFilters); -#endif param.filterCoeffDeltaIdx[i] = code; } } @@ -1067,35 +928,10 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) { memset(param.filterCoeffDeltaIdx, 0, sizeof(param.filterCoeffDeltaIdx)); } -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - 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 -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB alfFilter( param, false, 0 ); -#else - alfFilter(param, false); -#endif } if (param.newFilterFlag[CHANNEL_TYPE_CHROMA]) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( MAX_NUM_ALF_ALTERNATIVES_CHROMA > 1 ) READ_UVLC( code, "alf_chroma_num_alts_minus1" ); else @@ -1109,11 +945,6 @@ void HLSyntaxReader::parseAlfAps( APS* aps ) param.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] = code ? true : false; alfFilter( param, true, altIdx ); } -#else - READ_FLAG(code, "alf_luma_clip"); - param.nonLinearFlag[CHANNEL_TYPE_CHROMA] = code ? true : false; - alfFilter(param, true); -#endif } aps->setAlfAPSParam(param); } @@ -1142,13 +973,11 @@ void HLSyntaxReader::parseLmcsAps( APS* aps ) aps->setReshaperAPSInfo(info); } -#if JVET_O0299_APS_SCALINGLIST void HLSyntaxReader::parseScalingListAps( APS* aps ) { ScalingList& info = aps->getScalingList(); parseScalingList( &info ); } -#endif void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) { @@ -1208,119 +1037,26 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS) } -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, bool commonInfPresentFlag, uint32_t maxNumSubLayersMinus1) -#else void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLayer, uint32_t maxNumSubLayersMinus1) -#endif { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - uint32_t uiCode; - if( commonInfPresentFlag ) - { - READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); - READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); - if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) - { - READ_FLAG( uiCode, "sub_pic_hrd_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); - READ_CODE( 5, uiCode, "du_cpb_removal_delay_increment_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); - READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); - READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); - } - READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); - READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); - } - READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); - READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); - READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); - } - } - int i, j, nalOrVcl; - for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) - { - READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); - if( !hrd->getFixedPicRateFlag( i ) ) - { - READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); - } - else - { - hrd->setFixedPicRateWithinCvsFlag( i, true ); - } - - hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present - hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present - - if( hrd->getFixedPicRateWithinCvsFlag( i ) ) - { - READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); - } - else - { - READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); - } - if (!hrd->getLowDelayHrdFlag( i )) - { - READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); - } - - for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) - { - if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) - { - for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) - { - READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); - READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); - READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); - } - READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); - } - } - } - } -#else uint32_t symbol; READ_FLAG( symbol, "general_nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( symbol == 1 ? true : false ); READ_FLAG( symbol, "general_vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( symbol == 1 ? true : false ); if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) { -#if JVET_O0189_DU READ_FLAG( symbol, "decoding_unit_hrd_params_present_flag" ); hrd->setDecodingUnitHrdParamsPresentFlag( symbol == 1 ? true : false ); -#else - READ_FLAG( symbol, "decoding_unit_hrd_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( symbol == 1 ? true : false ); -#endif -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) { READ_CODE( 8, symbol, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( symbol ); READ_FLAG( symbol, "decoding_unit_cpb_params_in_pic_timing_sei_flag" ); hrd->setDecodingUnitCpbParamsInPicTimingSeiFlag( symbol == 1 ? true : false ); } -#endif READ_CODE( 4, symbol, "bit_rate_scale" ); hrd->setBitRateScale( symbol ); READ_CODE( 4, symbol, "cpb_size_scale" ); hrd->setCpbSizeScale( symbol ); -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) { READ_CODE( 4, symbol, "cpb_size_du_scale" ); hrd->setCpbSizeDuScale( symbol ); } -#else - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - READ_CODE( 4, symbol, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( symbol ); - } -#endif } for( int i = firstSubLayer; i <= maxNumSubLayersMinus1; i ++ ) @@ -1365,7 +1101,6 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLay } } } -#if JVET_O0177_PROPOSAL1 for (int i = 0; i < firstSubLayer; i++) { for (int nalOrVcl = 0; nalOrVcl < 2; nalOrVcl++) @@ -1385,8 +1120,6 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLay } } } -#endif -#endif } @@ -1405,10 +1138,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); -#if JVET_N0865_SYNTAX READ_FLAG(uiCode, "gdr_enabled_flag"); pcSPS->setGDREnabledFlag(uiCode); -#endif READ_UVLC(uiCode, "sps_seq_parameter_set_id"); pcSPS->setSPSId(uiCode); @@ -1422,24 +1153,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "separate_colour_plane_flag"); CHECK(uiCode != 0, "Invalid code"); } -#if JVET_O1164_PS READ_UVLC( uiCode, "pic_width_max_in_luma_samples" ); pcSPS->setMaxPicWidthInLumaSamples( uiCode ); READ_UVLC( uiCode, "pic_height_max_in_luma_samples" ); pcSPS->setMaxPicHeightInLumaSamples( uiCode ); -#else - READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); - READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); - - // KJS: not removing yet - READ_FLAG( uiCode, "conformance_window_flag"); - if (uiCode != 0) - { - Window &conf = pcSPS->getConformanceWindow(); - READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * SPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); - READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * SPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); - READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * SPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); - READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * SPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); - } -#endif READ_UVLC( uiCode, "bit_depth_luma_minus8" ); CHECK(uiCode > 8, "Invalid luma bit depth signalled"); @@ -1452,17 +1167,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (int) (6*uiCode) ); -#if JVET_O0919_TS_MIN_QP READ_UVLC( uiCode, "min_qp_prime_ts_minus4" ); pcSPS->setMinQpPrimeTsMinus4(CHANNEL_TYPE_LUMA, uiCode); -#endif READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); CHECK(uiCode > 12, "Invalid code"); READ_FLAG( uiCode, "sps_idr_rpl_present_flag" ); pcSPS->setIDRRefParamListPresent( (bool) uiCode); // KJS: Marakech decision: sub-layers added back uint32_t subLayerOrderingInfoPresentFlag; -#if JVET_O0178 if (pcSPS->getMaxTLayers() > 1) { READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); @@ -1471,9 +1183,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { subLayerOrderingInfoPresentFlag = 0; } -#else - READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); -#endif for(uint32_t i=0; i <= pcSPS->getMaxTLayers()-1; i++) { @@ -1542,18 +1251,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) unsigned maxTTSize[3] = { 0, 0, 0 }; READ_FLAG(uiCode, "qtbtt_dual_tree_intra_flag"); pcSPS->setUseDualITree(uiCode); -#if JVET_O0526_MIN_CTU_SIZE READ_CODE(2, uiCode, "log2_ctu_size_minus5"); pcSPS->setCTUSize(1 << (uiCode + 5)); CHECK(uiCode > 2, "log2_ctu_size_minus5 must be less than or equal to 2"); unsigned ctbLog2SizeY = uiCode + 5; pcSPS->setMaxCodingDepth(uiCode+3); pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode+3); -#else - READ_UVLC(uiCode, "log2_ctu_size_minus2"); pcSPS->setCTUSize(1 << (uiCode + 2)); - unsigned ctbLog2SizeY = uiCode + 2; - pcSPS->setMaxCodingDepth(uiCode); - pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); -#endif pcSPS->setMaxCUWidth(pcSPS->getCTUSize()); pcSPS->setMaxCUHeight(pcSPS->getCTUSize()); @@ -1561,15 +1263,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) int log2MinCUSize = uiCode + 2; pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); -#if JVET_O0640_PICTURE_SIZE_CONSTRAINT -#if JVET_O1164_PS CHECK( ( pcSPS->getMaxPicWidthInLumaSamples() % ( std::max( 8, int( pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" ); CHECK( ( pcSPS->getMaxPicHeightInLumaSamples() % ( std::max( 8, int( pcSPS->getMaxCUHeight() >> ( pcSPS->getMaxCodingDepth() - 1 ) ) ) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" ); -#else - CHECK((pcSPS->getPicWidthInLumaSamples() % (std::max(8, int(pcSPS->getMaxCUWidth() >> (pcSPS->getMaxCodingDepth() - 1))))) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)"); - CHECK((pcSPS->getPicHeightInLumaSamples() % (std::max(8, int(pcSPS->getMaxCUHeight() >> (pcSPS->getMaxCodingDepth() - 1))))) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)"); -#endif -#endif READ_FLAG(uiCode, "partition_constraints_override_enabled_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode); READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_slice_luma"); @@ -1615,16 +1310,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setMaxTTSize(maxTTSize[1], maxTTSize[0], maxTTSize[2]); -#if MAX_TB_SIZE_SIGNALLING -#if JVET_O0545_MAX_TB_SIGNALLING READ_FLAG( uiCode, "sps_max_luma_transform_size_64_flag"); pcSPS->setLog2MaxTbSize( (uiCode ? 1 : 0) + 5 ); -#else - // KJS: Not in syntax - READ_UVLC( uiCode, "log2_max_luma_transform_block_size_minus2" ); pcSPS->setLog2MaxTbSize( uiCode + 2 ); -#endif -#endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE if (pcSPS->getChromaFormatIdc() != CHROMA_400) { ChromaQpMappingTableParams chromaQpMappingTableParams; @@ -1645,56 +1332,27 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setChromaQpMappingTableFromParams(chromaQpMappingTableParams, pcSPS->getQpBDOffset(CHANNEL_TYPE_CHROMA)); pcSPS->derivedChromaQPMappingTables(); } -#endif -#if JVET_O0244_DELTA_POC READ_FLAG( uiCode, "sps_weighted_pred_flag" ); pcSPS->setUseWP( uiCode ? true : false ); READ_FLAG( uiCode, "sps_weighted_bipred_flag" ); pcSPS->setUseWPBiPred( uiCode ? true : false ); -#endif READ_FLAG( uiCode, "sps_sao_enabled_flag" ); pcSPS->setSAOEnabledFlag ( uiCode ? true : false ); READ_FLAG( uiCode, "sps_alf_enabled_flag" ); pcSPS->setALFEnabledFlag ( uiCode ? true : false ); -#if !JVET_O0525_REMOVE_PCM - READ_FLAG( uiCode, "sps_pcm_enabled_flag" ); pcSPS->setPCMEnabledFlag( uiCode ? true : false ); - if( pcSPS->getPCMEnabledFlag() ) - { - READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode ); - READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode ); - READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize ( uiCode+3 ); - READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); - READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); - } -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false); if (pcSPS->getTransformSkipEnabledFlag()) { READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false); } -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG READ_FLAG( uiCode, "sps_joint_cbcr_enabled_flag"); pcSPS->setJointCbCrEnabledFlag (uiCode ? true : false); -#endif -#if !JVET_O1164_PS - 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_O1164_PS - } - else - { - pcSPS->setWrapAroundEnabledFlag(0); - } -#endif READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode); @@ -1710,9 +1368,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_amvr_enabled_flag" ); pcSPS->setAMVREnabledFlag ( uiCode != 0 ); READ_FLAG( uiCode, "sps_bdof_enabled_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 ); -#if !JVET_O0438_SPS_AFFINE_AMVR_FLAG - READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); -#endif READ_FLAG(uiCode, "sps_dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0); READ_FLAG(uiCode, "sps_mmvd_enable_flag"); pcSPS->setUseMMVD(uiCode != 0); // KJS: sps_cclm_enabled_flag @@ -1735,15 +1390,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if ( pcSPS->getUseAffine() ) { READ_FLAG( uiCode, "affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 ); -#if JVET_O0070_PROF READ_FLAG( uiCode, "sps_prof_enabled_flag"); pcSPS->setUsePROF ( uiCode != 0 ); -#endif -#if JVET_O0438_SPS_AFFINE_AMVR_FLAG READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); -#endif } READ_FLAG( uiCode, "gbi_flag" ); pcSPS->setUseGBi ( uiCode != 0 ); -#if JVET_O0119_BASE_PALETTE_444 if (pcSPS->getChromaFormatIdc() == CHROMA_444) { READ_FLAG( uiCode, "plt_flag"); pcSPS->setPLTMode ( uiCode != 0 ); @@ -1752,7 +1402,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { pcSPS->setPLTMode(false); } -#endif READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode); // KJS: sps_ciip_enabled_flag READ_FLAG( uiCode, "mhintra_flag" ); pcSPS->setUseMHIntra ( uiCode != 0 ); @@ -1761,12 +1410,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { READ_FLAG( uiCode, "sps_fpel_mmvd_enabled_flag" ); pcSPS->setFpelMmvdEnabledFlag ( uiCode != 0 ); } -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if (pcSPS->getBDOFEnabledFlag() || pcSPS->getUseDMVR()) { READ_FLAG(uiCode, "sps_bdof_dmvr_slice_level_present_flag"); pcSPS->setBdofDmvrSlicePresentFlag(uiCode != 0); } -#endif READ_FLAG( uiCode, "triangle_flag" ); pcSPS->setUseTriangle ( uiCode != 0 ); READ_FLAG( uiCode, "sps_mip_flag"); pcSPS->setUseMIP ( uiCode != 0 ); @@ -1774,11 +1421,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG(uiCode, "sbt_enable_flag"); pcSPS->setUseSBT(uiCode != 0); if( pcSPS->getUseSBT() ) { -#if JVET_O0545_MAX_TB_SIGNALLING READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(std::min((int)(1 << pcSPS->getLog2MaxTbSize()), uiCode != 0 ? 64 : 32)); -#else - READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(uiCode != 0 ? 64 : 32); -#endif } // KJS: not in draft yet READ_FLAG(uiCode, "sps_reshaper_enable_flag"); pcSPS->setUseReshaper(uiCode == 1); @@ -1806,33 +1449,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) // KJS: remove scaling lists? READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); -#if !JVET_O0299_APS_SCALINGLIST - if(pcSPS->getScalingListFlag()) - { - READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); - if(pcSPS->getScalingListPresentFlag ()) - { - parseScalingList( &(pcSPS->getScalingList()) ); - } - } -#endif TimingInfo *timingInfo = pcSPS->getTimingInfo(); -#if JVET_O0189_DU READ_FLAG( uiCode, "general_hrd_parameters_present_flag"); pcSPS->setHrdParametersPresentFlag(uiCode); if( pcSPS->getHrdParametersPresentFlag() ) -#else - READ_FLAG( uiCode, "timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); - if(timingInfo->getTimingInfoPresentFlag()) -#endif { READ_CODE( 32, uiCode, "num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); READ_CODE( 32, uiCode, "time_scale"); timingInfo->setTimeScale (uiCode); -#if !JVET_O0189_DU - READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcSPS->setHrdParametersPresentFlag(uiCode); -#endif -#if JVET_O0177_PROPOSAL1 READ_FLAG( uiCode, "sub_layer_cpb_parameters_present_flag"); pcSPS->setSubLayerParametersPresentFlag(uiCode); if (pcSPS->getSubLayerParametersPresentFlag()) { @@ -1842,12 +1466,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { parseHrdParameters(pcSPS->getHrdParameters(), pcSPS->getMaxTLayers() - 1, pcSPS->getMaxTLayers() - 1); } -#else - if( pcSPS->getHrdParametersPresentFlag() ) - { - parseHrdParameters( pcSPS->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); - } -#endif } READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); @@ -1986,13 +1604,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para PPS* pps = NULL; SPS* sps = NULL; -#if !JVET_N0865_SYNTAX - if (pcSlice->getRapPicFlag()) - { - READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); // ignored -- updated already - pcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false); - } -#endif READ_UVLC(uiCode, "slice_pic_parameter_set_id"); pcSlice->setPPSId(uiCode); pps = parameterSetManager->getPPS(uiCode); @@ -2038,12 +1649,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { sliceIdx++; } -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA pcSlice->setSliceIndex(sliceIdx); -#else - pcSlice->setSliceCurStartBrickIdx(pps->getTopLeftBrickIdx(sliceIdx)); - pcSlice->setSliceCurEndBrickIdx(pps->getBottomRightBrickIdx(sliceIdx)); -#endif } else { @@ -2057,13 +1663,10 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setSliceNumBricks(uiCode + 1); pcSlice->setSliceCurEndBrickIdx(pcSlice->getSliceCurStartBrickIdx() + uiCode); } -#if JVET_N0288_PROPOSAL1 else if (pps->getSingleBrickPerSliceFlag()) { pcSlice->setSliceNumBricks(1); } -#endif -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (pps->getRectSliceFlag()) { if (pcSlice->getSliceIndex() != 0) @@ -2072,12 +1675,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setSliceCurEndBrickIdx(pcSlice->getPic()->brickMap->getBottomRightBrickIdx(pcSlice->getSliceIndex())); } } -#endif pcSlice->setSliceCurStartCtuTsAddr(pcSlice->getSliceCurStartBrickIdx()); -#if JVET_O0181 READ_FLAG(uiCode, "non_reference_picture_flag"); pcSlice->setNonRefPictFlag(uiCode); -#endif for (int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) { @@ -2085,23 +1685,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } READ_UVLC ( uiCode, "slice_type" ); pcSlice->setSliceType((SliceType)uiCode); -#if !JVET_N0865_SYNTAX - if (pps->getOutputFlagPresentFlag()) - { - READ_FLAG(uiCode, "pic_output_flag"); - pcSlice->setPicOutputFlag(uiCode ? true : false); - } - else - { - pcSlice->setPicOutputFlag(true); - } -#endif // if (separate_colour_plane_flag == 1) // read colour_plane_id // (separate_colour_plane_flag == 1) is not supported in this version of the standard. -#if RPL_IN_IDR_FIX READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); if (pcSlice->getIdrPicFlag()) pcSlice->setPOC(uiCode); @@ -2128,12 +1716,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setPOC(iPOCmsb + iPOClsb); } -#if JVET_N0865_SYNTAX -#if !JVET_N0865_GRA2GDR - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA) -#else if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) -#endif { READ_UVLC(uiCode, "recovery_poc_cnt"); int maxPicOrderCntLsb = (int)pow(2, pcSlice->getSPS()->getBitsForPOC()); @@ -2141,11 +1724,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setRecoveryPocCnt(uiCode); pcSlice->setRpPicOrderCntVal(pcSlice->getPOC() + pcSlice->getRecoveryPocCnt()); } -#if !JVET_N0865_GRA2GDR - if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA)) -#else if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR)) -#endif { READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); pcSlice->setNoOutputPriorPicsFlag(uiCode); @@ -2159,47 +1738,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { pcSlice->setPicOutputFlag(true); } -#endif -#endif if( pcSlice->getIdrPicFlag() && !(sps->getIDRRefParamListPresent())) { -#if !RPL_IN_IDR_FIX - READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); - pcSlice->setPOC(uiCode); -#if JVET_N0865_SYNTAX -#if JVET_N0865_GRA2GDR - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) -#else - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA) -#endif - { - READ_UVLC(uiCode, "recovery_poc_cnt"); - int maxPicOrderCntLsb = (int) pow(2, pcSlice->getSPS()->getBitsForPOC()); - CHECK(uiCode < maxPicOrderCntLsb, "recovery_poc_cnt > MaxPicOrderCntLsb ? 1"); - pcSlice->setRecoveryPocCnt(uiCode); - pcSlice->setRpPicOrderCntVal(pcSlice->getPOC() + pcSlice->getRecoveryPocCnt()); - } -#if JVET_N0865_GRA2GDR - if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR)) -#else - if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA)) -#endif - { - READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); - pcSlice->setNoOutputPriorPicsFlag(uiCode); - } - if (pps->getOutputFlagPresentFlag()) - { - READ_FLAG(uiCode, "pic_output_flag"); - pcSlice->setPicOutputFlag(uiCode ? true : false); - } - else - { - pcSlice->setPicOutputFlag(true); - } -#endif -#endif ReferencePictureList* rpl0 = pcSlice->getLocalRPL0(); (*rpl0) = ReferencePictureList(); pcSlice->setRPL0(rpl0); @@ -2211,64 +1752,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } else { -#if !RPL_IN_IDR_FIX - READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); - int iPOClsb = uiCode; - int iPrevPOC = prevTid0POC; - int iMaxPOClsb = 1<< sps->getBitsForPOC(); - int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); - int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; - int iPOCmsb; - if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) - { - iPOCmsb = iPrevPOCmsb + iMaxPOClsb; - } - else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) - { - iPOCmsb = iPrevPOCmsb - iMaxPOClsb; - } - else - { - iPOCmsb = iPrevPOCmsb; - } - pcSlice->setPOC (iPOCmsb+iPOClsb); -#if JVET_N0865_SYNTAX -#if JVET_N0865_GRA2GDR - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) -#else - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA) -#endif - { - READ_UVLC(uiCode, "recovery_poc_cnt"); - int maxPicOrderCntLsb = (int) pow(2, pcSlice->getSPS()->getBitsForPOC()); - CHECK(uiCode < maxPicOrderCntLsb, "recovery_poc_cnt > MaxPicOrderCntLsb ? 1"); - pcSlice->setRecoveryPocCnt(uiCode); - pcSlice->setRpPicOrderCntVal(pcSlice->getPOC() + pcSlice->getRecoveryPocCnt()); - } -#if JVET_N0865_GRA2GDR - if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR)) -#else - if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA)) -#endif - { - READ_FLAG(uiCode, "no_output_of_prior_pics_flag"); - pcSlice->setNoOutputPriorPicsFlag(uiCode); - } - if (pps->getOutputFlagPresentFlag()) - { - READ_FLAG(uiCode, "pic_output_flag"); - pcSlice->setPicOutputFlag(uiCode ? true : false); - } - else - { - pcSlice->setPicOutputFlag(true); - } -#endif -#endif //Read L0 related syntax elements if (sps->getNumRPL0() > 0) { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSRefPicListSPSIdc0()) { READ_FLAG(uiCode, "ref_pic_list_sps_flag[0]"); @@ -2277,9 +1763,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSRefPicListSPSIdc0() - 1; } -#else - READ_FLAG(uiCode, "ref_pic_list_sps_flag[0]"); -#endif } else { @@ -2321,13 +1804,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { if (pcSlice->getRPL0()->isRefPicLongterm(i)) { -#if JVET_N0100_PROPOSAL1 if (pcSlice->getRPL0()->getLtrpInSliceHeaderFlag()) { READ_CODE(sps->getBitsForPOC(), uiCode, "slice_poc_lsb_lt[i][j]"); pcSlice->getLocalRPL0()->setRefPicIdentifier(i, uiCode, true); } -#endif READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]"); pcSlice->getLocalRPL0()->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); if (uiCode) @@ -2350,7 +1831,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { if (sps->getNumRPL1() > 0) { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSRefPicListSPSIdc1()) { READ_FLAG(uiCode, "ref_pic_list_sps_flag[1]"); @@ -2359,9 +1839,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSRefPicListSPSIdc1() - 1; } -#else - READ_FLAG(uiCode, "ref_pic_list_sps_flag[1]"); -#endif } else { @@ -2408,13 +1885,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { if (pcSlice->getRPL1()->isRefPicLongterm(i)) { -#if JVET_N0100_PROPOSAL1 if (pcSlice->getRPL1()->getLtrpInSliceHeaderFlag()) { READ_CODE(sps->getBitsForPOC(), uiCode, "slice_poc_lsb_lt[i][j]"); pcSlice->getLocalRPL1()->setRefPicIdentifier(i, uiCode, true); } -#endif READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]"); pcSlice->getLocalRPL1()->setDeltaPocMSBPresentFlag(i, uiCode ? true : false); if (uiCode) @@ -2499,14 +1974,12 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } } -#if JVET_O0148_NUM_ACTIVE_REF_PIC_CHECK if (pcSlice->isInterP() || pcSlice->isInterB()) { CHECK(pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 0, "Number of active entries in RPL0 of P or B picture shall be greater than 0"); if (pcSlice->isInterB()) CHECK(pcSlice->getNumRefIdx(REF_PIC_LIST_1) == 0, "Number of active entries in RPL1 of B picture shall be greater than 0"); } -#endif if ( sps->getSplitConsOverrideEnabledFlag() @@ -2549,18 +2022,13 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para if(!pcSlice->isIntra()) { -#if JVET_O0238_PPS_OR_SLICE if (sps->getSPSTemporalMVPEnabledFlag() && !pps->getPPSTemporalMVPEnabledIdc()) -#else - if (sps->getSPSTemporalMVPEnabledFlag()) -#endif { READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); } else { -#if JVET_O0238_PPS_OR_SLICE if (!sps->getSPSTemporalMVPEnabledFlag()) { pcSlice->setEnableTMVPFlag(false); @@ -2569,9 +2037,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { pcSlice->setEnableTMVPFlag((pps->getPPSTemporalMVPEnabledIdc() - 1) == 1 ? true: false); } -#else - pcSlice->setEnableTMVPFlag(false); -#endif } } @@ -2582,7 +2047,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para if (pcSlice->isInterB()) { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSMvdL1ZeroIdc()) { READ_FLAG(uiCode, "mvd_l1_zero_flag"); @@ -2591,9 +2055,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSMvdL1ZeroIdc() - 1; } -#else - READ_FLAG( uiCode, "mvd_l1_zero_flag" ); -#endif pcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); } @@ -2610,7 +2071,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { if ( pcSlice->getSliceType() == B_SLICE ) { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSCollocatedFromL0Idc()) { READ_FLAG(uiCode, "collocated_from_l0_flag"); @@ -2619,9 +2079,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSCollocatedFromL0Idc() - 1; } -#else - READ_FLAG( uiCode, "collocated_from_l0_flag" ); -#endif pcSlice->setColFromL0Flag(uiCode); } else @@ -2662,13 +2119,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } } -#if JVET_O0455_IBC_MAX_MERGE_NUM if (!pcSlice->isIntra()) -#else - if (!pcSlice->isIntra() || sps->getIBCFlag()) -#endif { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSSixMinusMaxNumMergeCandPlus1()) { READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); @@ -2677,35 +2129,23 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSSixMinusMaxNumMergeCandPlus1() - 1; } -#else - READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); -#endif pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); } if (!pcSlice->isIntra()) { -#if JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP if (sps->getSBTMVPEnabledFlag() && pcSlice->getEnableTMVPFlag() && !sps->getUseAffine()) // ATMVP only -#else - if ( sps->getSBTMVPEnabledFlag() && !sps->getUseAffine() ) // ATMVP only -#endif { pcSlice->setMaxNumAffineMergeCand( 1 ); } -#if JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP else if (!(sps->getSBTMVPEnabledFlag() && pcSlice->getEnableTMVPFlag()) && !sps->getUseAffine())// both off -#else - else if ( !sps->getSBTMVPEnabledFlag() && !sps->getUseAffine() ) // both off -#endif { pcSlice->setMaxNumAffineMergeCand( 0 ); } else if ( sps->getUseAffine() ) { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSFiveMinusMaxNumSubblockMergeCandPlus1()) { READ_UVLC(uiCode, "five_minus_max_num_subblock_merge_cand"); @@ -2714,9 +2154,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSFiveMinusMaxNumSubblockMergeCandPlus1() - 1; } -#else - READ_UVLC( uiCode, "five_minus_max_num_affine_merge_cand" ); -#endif pcSlice->setMaxNumAffineMergeCand( AFFINE_MRG_MAX_NUM_CANDS - uiCode ); } if ( sps->getFpelMmvdEnabledFlag() ) @@ -2724,16 +2161,13 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para READ_FLAG( uiCode, "slice_fpel_mmvd_enabled_flag" ); pcSlice->setDisFracMMVD( uiCode ? true : false ); } -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if (sps->getBdofDmvrSlicePresentFlag()) { READ_FLAG(uiCode, "slice_disable_bdof_dmvr_flag"); pcSlice->setDisBdofDmvrFlag(uiCode ? true : false); } -#endif if (sps->getUseTriangle() && pcSlice->getMaxNumMergeCand() >= 2) { -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1()) { READ_UVLC(uiCode, "max_num_merge_cand_minus_max_num_triangle_cand"); @@ -2742,9 +2176,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() - 1; } -#else - READ_UVLC(uiCode, "max_num_merge_cand_minus_max_num_triangle_cand"); -#endif CHECK(pcSlice->getMaxNumMergeCand() < uiCode, "Incorrrect max number of triangle candidates!"); pcSlice->setMaxNumTriangleCand((uint32_t)(pcSlice->getMaxNumMergeCand() - uiCode)); } @@ -2753,16 +2184,12 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setMaxNumTriangleCand(0); } } -#if JVET_O0455_IBC_MAX_MERGE_NUM if (sps->getIBCFlag()) { READ_UVLC(uiCode, "slice_six_minus_max_num_ibc_merge_cand"); pcSlice->setMaxNumIBCMergeCand(IBC_MRG_MAX_NUM_CANDS - uiCode); } -#endif -#if JVET_O0105_ICT -#if JVET_O0376_SPS_JOINTCBCR_FLAG if (sps->getJointCbCrEnabledFlag()) { READ_FLAG( uiCode, "slice_joint_cbcr_sign_flag" ); pcSlice->setJointCbCrSignFlag(uiCode != 0); @@ -2771,13 +2198,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { pcSlice->setJointCbCrSignFlag(0); } -#else - if (bChroma) - { - READ_FLAG( uiCode, "slice_joint_cbcr_sign_flag" ); pcSlice->setJointCbCrSignFlag(uiCode != 0); - } -#endif -#endif READ_SVLC( iCode, "slice_qp_delta" ); pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); @@ -2806,7 +2226,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para CHECK( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) > 12, "Invalid chroma QP offset" ); CHECK( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) < -12, "Invalid chroma QP offset" ); CHECK( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) > 12, "Invalid chroma QP offset" ); -#if JVET_O0376_SPS_JOINTCBCR_FLAG if (sps->getJointCbCrEnabledFlag()) { READ_SVLC(iCode, "slice_joint_cbcr_qp_offset" ); @@ -2816,14 +2235,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para CHECK( (pps->getQpOffset(JOINT_CbCr) + pcSlice->getSliceChromaQpDelta(JOINT_CbCr)) < -12, "Invalid chroma QP offset"); CHECK( (pps->getQpOffset(JOINT_CbCr) + pcSlice->getSliceChromaQpDelta(JOINT_CbCr)) > 12, "Invalid chroma QP offset"); } -#else - READ_SVLC(iCode, "slice_joint_cbcr_qp_offset"); - pcSlice->setSliceChromaQpDelta(JOINT_CbCr, iCode); - CHECK( pcSlice->getSliceChromaQpDelta(JOINT_CbCr) < -12, "Invalid chroma QP offset"); - CHECK( pcSlice->getSliceChromaQpDelta(JOINT_CbCr) > 12, "Invalid chroma QP offset"); - CHECK( (pps->getQpOffset(JOINT_CbCr) + pcSlice->getSliceChromaQpDelta(JOINT_CbCr)) < -12, "Invalid chroma QP offset"); - CHECK( (pps->getQpOffset(JOINT_CbCr) + pcSlice->getSliceChromaQpDelta(JOINT_CbCr)) > 12, "Invalid chroma QP offset"); -#endif } } @@ -2853,79 +2264,29 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para int alfChromaIdc = 0; if (uiCode) { -#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL -#if JVET_O_MAX_NUM_ALF_APS_8 READ_CODE(3, uiCode, "slice_num_alf_aps_ids_luma"); -#else - xReadTruncBinCode(uiCode, ALF_CTB_MAX_NUM_APS + 1); -#endif -#else - if (pcSlice->isIntra()) - { - READ_FLAG(uiCode, "slice_num_alf_aps_ids_luma"); - } - else - { -#if JVET_O_MAX_NUM_ALF_APS_8 - READ_CODE(3, uiCode, "slice_num_alf_aps_ids_luma"); -#else - xReadTruncBinCode(uiCode, ALF_CTB_MAX_NUM_APS + 1); -#endif - } -#endif int numAps = uiCode; pcSlice->setTileGroupNumAps(numAps); std::vector<int> apsId(numAps, -1); for (int i = 0; i < numAps; i++) { -#if JVET_O_MAX_NUM_ALF_APS_8 READ_CODE(3, uiCode, "slice_alf_aps_id_luma"); -#else - READ_CODE(5, uiCode, "slice_alf_aps_id_luma"); -#endif apsId[i] = uiCode; } pcSlice->setAlfAPSs(apsId); -#if JVET_O0616_400_CHROMA_SUPPORT if (bChroma) { -#endif -#if JVET_O0491_HLS_CLEANUP READ_CODE(2, uiCode, "slice_alf_chroma_idc"); alfChromaIdc = uiCode; -#else - alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc -#endif -#if JVET_O0616_400_CHROMA_SUPPORT } else { alfChromaIdc = 0; } -#endif if (alfChromaIdc) { -#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL -#if JVET_O_MAX_NUM_ALF_APS_8 READ_CODE(3, uiCode, "slice_alf_aps_id_chroma"); -#else - READ_CODE(5, uiCode, "slice_alf_aps_id_chroma"); -#endif -#else - if (pcSlice->isIntra() && pcSlice->getTileGroupNumAps() == 1) - { - uiCode = apsId[0]; - } - else - { -#if JVET_O_MAX_NUM_ALF_APS_8 - READ_CODE(3, uiCode, "slice_alf_aps_id_chroma"); -#else - READ_CODE(5, uiCode, "slice_alf_aps_id_chroma"); -#endif - } -#endif pcSlice->setTileGroupApsIdChroma(uiCode); } } @@ -2937,7 +2298,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setTileGroupAlfEnabledFlag(COMPONENT_Cr, alfChromaIdc >> 1); } -#if JVET_O0238_PPS_OR_SLICE if (!pps->getPPSDepQuantEnabledIdc()) { READ_FLAG(uiCode, "dep_quant_enabled_flag"); @@ -2946,9 +2306,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para { uiCode = pps->getPPSDepQuantEnabledIdc() - 1; } -#else - READ_FLAG( uiCode, "dep_quant_enabled_flag" ); -#endif pcSlice->setDepQuantEnabledFlag( uiCode != 0 ); if( !pcSlice->getDepQuantEnabledFlag() ) @@ -3018,34 +2375,21 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para if (pcSlice->getLmcsEnabledFlag()) { -#if JVET_O0428_LMCS_CLEANUP READ_CODE(2, uiCode, "slice_lmcs_aps_id"); -#else - READ_CODE(5, uiCode, "slice_lmcs_aps_id"); -#endif pcSlice->setLmcsAPSId(uiCode); -#if !JVET_O1109_UNFIY_CRS - if (!(sps->getUseDualITree() && pcSlice->isIntra())) - { -#endif -#if JVET_O0616_400_CHROMA_SUPPORT if (bChroma) { -#endif READ_FLAG(uiCode, "slice_chroma_residual_scale_flag"); pcSlice->setLmcsChromaResidualScaleFlag(uiCode == 1); -#if !JVET_O1109_UNFIY_CRS || JVET_O0616_400_CHROMA_SUPPORT } else { pcSlice->setLmcsChromaResidualScaleFlag(false); } -#endif } } -#if JVET_O0299_APS_SCALINGLIST if( sps->getScalingListFlag() ) { READ_FLAG( uiCode, "slice_scaling_list_present_flag" ); @@ -3056,7 +2400,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para READ_CODE( 3, uiCode, "slice_scaling_list_aps_id" ); pcSlice->setscalingListAPSId( uiCode ); } -#endif if( pcSlice->getSliceCurStartBrickIdx() == 0 ) { @@ -3172,13 +2515,8 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "no_partition_constraints_override_constraint_flag"); cinfo->setNoPartitionConstraintsOverrideConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sao_constraint_flag"); cinfo->setNoSaoConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_alf_constraint_flag"); cinfo->setNoAlfConstraintFlag(symbol > 0 ? true : false); -#if JVET_O0376_SPS_JOINTCBCR_FLAG READ_FLAG(symbol, "no_joint_cbcr_constraint_flag"); cinfo->setNoJointCbCrConstraintFlag(symbol > 0 ? true : false); -#endif -#if !JVET_O0525_REMOVE_PCM - READ_FLAG(symbol, "no_pcm_constraint_flag"); cinfo->setNoPcmConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_ref_wraparound_constraint_flag"); cinfo->setNoRefWraparoundConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_temporal_mvp_constraint_flag"); cinfo->setNoTemporalMvpConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sbtmvp_constraint_flag"); cinfo->setNoSbtmvpConstraintFlag(symbol > 0 ? true : false); @@ -3196,9 +2534,7 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "no_triangle_constraint_flag"); cinfo->setNoTriangleConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_ladf_constraint_flag"); cinfo->setNoLadfConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_transform_skip_constraint_flag"); cinfo->setNoTransformSkipConstraintFlag(symbol > 0 ? true : false); -#if JVET_O1136_TS_BDPCM_SIGNALLING READ_FLAG(symbol, "no_bdpcm_constraint_flag"); cinfo->setNoBDPCMConstraintFlag(symbol > 0 ? true : false); -#endif READ_FLAG(symbol, "no_qp_delta_constraint_flag"); cinfo->setNoQpDeltaConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_dep_quant_constraint_flag"); cinfo->setNoDepQuantConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sign_data_hiding_constraint_flag"); cinfo->setNoSignDataHidingConstraintFlag(symbol > 0 ? true : false); @@ -3211,7 +2547,6 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL READ_CODE(7 , symbol, "general_profile_idc" ); ptl->setProfileIdc (Profile::Name(symbol)); READ_FLAG( symbol, "general_tier_flag" ); ptl->setTierFlag (symbol ? Level::HIGH : Level::MAIN); -#if JVET_O0044_MULTI_SUB_PROFILE READ_CODE(8, symbol, "num_sub_profiles"); uint8_t numSubProfiles = symbol; ptl->setNumSubProfile( numSubProfiles ); @@ -3219,9 +2554,6 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL { READ_CODE(32, symbol, "general_sub_profile_idc[i]"); ptl->setSubProfileIdc(i, symbol); } -#else - READ_CODE(24, symbol, "general_sub_profile_idc"); ptl->setSubProfileIdc(symbol); -#endif parseConstraintInfo( ptl->getConstraintInfo() ); @@ -3550,13 +2882,10 @@ int HLSyntaxReader::alfGolombDecode( const int k, const bool signed_val ) return symbol; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma, const int altIdx ) -#else -void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma ) -#endif { uint32_t code; +#if !JVET_P0164_ALF_SYNTAX_SIMP if( !isChroma ) { READ_FLAG( code, "alf_luma_coeff_delta_flag" ); @@ -3565,56 +2894,17 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma ) if( !alfParam.alfLumaCoeffDeltaFlag ) { std::memset( alfParam.alfLumaCoeffFlag, true, sizeof( alfParam.alfLumaCoeffFlag ) ); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if( alfParam.numLumaFilters > 1 ) - { - READ_FLAG( code, "alf_luma_coeff_delta_prediction_flag" ); - alfParam.alfLumaCoeffDeltaPredictionFlag = code; - } - else - { - alfParam.alfLumaCoeffDeltaPredictionFlag = 0; - } -#endif } -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - else - { - alfParam.alfLumaCoeffDeltaPredictionFlag = 0; - } -#endif } +#endif // derive maxGolombIdx AlfFilterShape alfShape( isChroma ? 5 : 7 ); -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - const int maxGolombIdx = AdaptiveLoopFilter::getMaxGolombIdx( alfShape.filterType ); -#endif -#if !JVET_O0216_ALF_COEFF_EG3 - READ_UVLC( code, isChroma ? "alf_chroma_min_eg_order_minus1" : "alf_luma_min_eg_order_minus1" ); -#endif -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - int kMin = code + 1; - static int kMinTab[MAX_NUM_ALF_COEFF]; -#endif const int numFilters = isChroma ? 1 : alfParam.numLumaFilters; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB short* coeff = isChroma ? alfParam.chromaCoeff[altIdx] : alfParam.lumaCoeff; short* clipp = isChroma ? alfParam.chromaClipp[altIdx] : alfParam.lumaClipp; -#else - short* coeff = isChroma ? alfParam.chromaCoeff : alfParam.lumaCoeff; - short* clipp = isChroma ? alfParam.chromaClipp : alfParam.lumaClipp; -#endif -#if !JVET_O0216_ALF_COEFF_EG3 - for( int idx = 0; idx < maxGolombIdx; idx++ ) - { - READ_FLAG( code, isChroma ? "alf_chroma_eg_order_increase_flag" : "alf_luma_eg_order_increase_flag" ); - CHECK( code > 1, "Wrong golomb_order_increase_flag" ); - kMinTab[idx] = kMin + code; - kMin = kMinTab[idx]; - } -#endif +#if !JVET_P0164_ALF_SYNTAX_SIMP if( !isChroma ) { if( alfParam.alfLumaCoeffDeltaFlag ) @@ -3626,23 +2916,22 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma ) } } } +#endif // Filter coefficients for( int ind = 0; ind < numFilters; ++ind ) { +#if !JVET_P0164_ALF_SYNTAX_SIMP if( !isChroma && !alfParam.alfLumaCoeffFlag[ind] && alfParam.alfLumaCoeffDeltaFlag ) { memset( coeff + ind * MAX_NUM_ALF_LUMA_COEFF, 0, sizeof( *coeff ) * alfShape.numCoeff ); continue; } +#endif for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0216_ALF_COEFF_EG3 coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = alfGolombDecode( 3 ); -#else - coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = alfGolombDecode( kMinTab[alfShape.golombIdx[i]] ); -#endif CHECK( isChroma && ( coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] > 127 || coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] < -127 ) , "AlfCoeffC shall be in the range of -127 to 127, inclusive" ); @@ -3650,72 +2939,17 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma ) } // Clipping values coding -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if ( alfParam.nonLinearFlag[isChroma][altIdx] ) -#else - if ( alfParam.nonLinearFlag[isChroma] ) -#endif { -#if !JVET_O0064_SIMP_ALF_CLIP_CODING - READ_UVLC( code, "clip_min_golomb_order" ); - - kMin = code + 1; - - for( int idx = 0; idx < maxGolombIdx; idx++ ) - { - READ_FLAG( code, "clip_golomb_order_increase_flag" ); - CHECK( code > 1, "Wrong golomb_order_increase_flag" ); - kMinTab[idx] = kMin + code; - kMin = kMinTab[idx]; - } - - short recCoeff[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; - if( isChroma ) - { - memcpy( recCoeff, coeff, sizeof(short) * MAX_NUM_ALF_CHROMA_COEFF ); - } - else - { - memcpy( recCoeff, coeff, sizeof(short) * numFilters * MAX_NUM_ALF_LUMA_COEFF ); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if( alfParam.alfLumaCoeffDeltaPredictionFlag ) - { - for( int i = 1; i < numFilters; i++ ) - { - for( int j = 0; j < alfShape.numCoeff - 1; j++ ) - { - recCoeff[i * MAX_NUM_ALF_LUMA_COEFF + j] += recCoeff[( i - 1 ) * MAX_NUM_ALF_LUMA_COEFF + j]; - } - } - } -#endif - CHECK( std::any_of( recCoeff, recCoeff + numFilters * MAX_NUM_ALF_LUMA_COEFF, [](short c) {return (c <-128 || c > 127);} ) - , "AlfCoeffL shall be in the range of -128 to 127, inclusive" ); - } -#endif // Filter coefficients for( int ind = 0; ind < numFilters; ++ind ) { -#if !JVET_O0064_SIMP_ALF_CLIP_CODING - if( !isChroma && !alfParam.alfLumaCoeffFlag[ind] && alfParam.alfLumaCoeffDeltaFlag ) - { - std::fill_n( clipp + ind * MAX_NUM_ALF_LUMA_COEFF, alfShape.numCoeff, 0 ); - continue; - } -#endif for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0064_SIMP_ALF_CLIP_CODING READ_CODE(2, code, "alf_clipping_index"); clipp[ind * MAX_NUM_ALF_LUMA_COEFF + i] = code; -#else - if( recCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] ) - clipp[ind * MAX_NUM_ALF_LUMA_COEFF + i] = alfGolombDecode( kMinTab[alfShape.golombIdx[i]], false ); - else - clipp[ind * MAX_NUM_ALF_LUMA_COEFF + i] = 0; -#endif } } } @@ -3728,66 +2962,6 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma ) } } -#if !JVET_O0491_HLS_CLEANUP -int HLSyntaxReader::truncatedUnaryEqProb( const int maxSymbol ) -{ - for( int k = 0; k < maxSymbol; k++ ) - { - uint32_t symbol; -#if RExt__DECODER_DEBUG_BIT_STATISTICS - xReadFlag( symbol, "" ); -#else - xReadFlag( symbol ); -#endif - - if( !symbol ) - { - return k; - } - } - return maxSymbol; -} - -void HLSyntaxReader::xReadTruncBinCode( uint32_t& ruiSymbol, const int uiMaxSymbol ) -{ - int uiThresh; - if( uiMaxSymbol > 256 ) - { - int uiThreshVal = 1 << 8; - uiThresh = 8; - while( uiThreshVal <= uiMaxSymbol ) - { - uiThresh++; - uiThreshVal <<= 1; - } - uiThresh--; - } - else - { - uiThresh = g_tbMax[uiMaxSymbol]; - } - - int uiVal = 1 << uiThresh; - int b = uiMaxSymbol - uiVal; -#if RExt__DECODER_DEBUG_BIT_STATISTICS - xReadCode( uiThresh, ruiSymbol, "" ); -#else - xReadCode( uiThresh, ruiSymbol ); -#endif - if( ruiSymbol >= uiVal - b ) - { - uint32_t uiSymbol; -#if RExt__DECODER_DEBUG_BIT_STATISTICS - xReadFlag( uiSymbol, "" ); -#else - xReadFlag( uiSymbol ); -#endif - ruiSymbol <<= 1; - ruiSymbol += uiSymbol; - ruiSymbol -= ( uiVal - b ); - } -} -#endif //! \} diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h index b0f2e63f0cebe031b59e15b6dbcce63cbc2f6ac3..0c976026a10c17565c87c5688af6b2a7e6a71006 100644 --- a/source/Lib/DecoderLib/VLCReader.h +++ b/source/Lib/DecoderLib/VLCReader.h @@ -153,17 +153,11 @@ public: void parseAPS ( APS* pcAPS ); void parseAlfAps ( APS* pcAPS ); void parseLmcsAps ( APS* pcAPS ); -#if JVET_O0299_APS_SCALINGLIST void parseScalingListAps ( APS* pcAPS ); -#endif void parseVUI ( VUI* pcVUI, SPS* pcSPS ); void parseConstraintInfo (ConstraintInfo *cinfo); void parseProfileTierLevel ( ProfileTierLevel *ptl, int maxNumSubLayersMinus1); -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void parseHrdParameters ( HRDParameters *hrd, bool cprms_present_flag, uint32_t tempLevelHigh ); -#else void parseHrdParameters ( HRDParameters *hrd, uint32_t firstSubLayer, uint32_t tempLevelHigh ); -#endif void parseSliceHeader ( Slice* pcSlice, ParameterSetManager *parameterSetManager, const int prevTid0POC ); void parseTerminatingBit ( uint32_t& ruiBit ); void parseRemainingBytes ( bool noTrailingBytesExpected ); @@ -172,17 +166,9 @@ public: void parseScalingList ( ScalingList* scalingList ); void decodeScalingList ( ScalingList *scalingList, uint32_t sizeId, uint32_t listId); void parseReshaper ( SliceReshapeInfo& sliceReshaperInfo, const SPS* pcSPS, const bool isIntra ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void alfFilter( AlfParam& alfParam, const bool isChroma, const int altIdx ); -#else - void alfFilter( AlfParam& alfParam, const bool isChroma ); -#endif private: -#if !JVET_O0491_HLS_CLEANUP - int truncatedUnaryEqProb( const int maxSymbol ); - void xReadTruncBinCode( uint32_t& ruiSymbol, const int uiMaxSymbol ); -#endif int alfGolombDecode( const int k, const bool signed_val=true ); protected: diff --git a/source/Lib/EncoderLib/Analyze.h b/source/Lib/EncoderLib/Analyze.h index 7c14684e8a640739b2b343cf4e7db73f15c0509c..0f445d4eb8990ff41719c0b5cbba50a8dfb81a7e 100644 --- a/source/Lib/EncoderLib/Analyze.h +++ b/source/Lib/EncoderLib/Analyze.h @@ -69,9 +69,7 @@ private: uint32_t m_uiNumPic; double m_dFrmRate; //--CFG_KDY double m_MSEyuvframe[MAX_NUM_COMPONENT]; // sum of MSEs -#if RPR_CTC_PRINT double m_upscaledPSNR[MAX_NUM_COMPONENT]; -#endif #if EXTENSION_360_VIDEO TExt360EncAnalyze m_ext360; #endif @@ -85,9 +83,7 @@ public: Analyze() { clear(); } void addResult( double psnr[MAX_NUM_COMPONENT], double bits, const double MSEyuvframe[MAX_NUM_COMPONENT] -#if RPR_CTC_PRINT , const double upscaledPSNR[MAX_NUM_COMPONENT] -#endif , bool isEncodeLtRef ) { @@ -98,9 +94,7 @@ public: { m_dPSNRSum[i] += psnr[i]; m_MSEyuvframe[i] += MSEyuvframe[i]; -#if RPR_CTC_PRINT m_upscaledPSNR[i] += upscaledPSNR[i]; -#endif } m_uiNumPic++; @@ -138,9 +132,7 @@ public: { m_dPSNRSum[i] = 0; m_MSEyuvframe[i] = 0; -#if RPR_CTC_PRINT m_upscaledPSNR[i] = 0; -#endif } m_uiNumPic = 0; #if EXTENSION_360_VIDEO @@ -196,19 +188,11 @@ public: } #if ENABLE_QPA || WCG_WPSNR -#if RPR_CTC_PRINT void printOut( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const bool printRprPSNR, const BitDepths &bitDepths, const bool useWPSNR = false #if JVET_O0756_CALCULATE_HDRMETRICS , const bool printHdrMetrics = false #endif ) -#else - void printOut ( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths, const bool useWPSNR = false -#if JVET_O0756_CALCULATE_HDRMETRICS - , const bool printHdrMetrics = false -#endif - ) -#endif #else void printOut ( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths #if JVET_O0756_CALCULATE_HDRMETRICS @@ -572,7 +556,6 @@ public: { msg( e_msg_level, "\n"); } -#if RPR_CTC_PRINT if( printRprPSNR ) { double psnr[MAX_NUM_COMPONENT]; @@ -601,7 +584,6 @@ public: m_upscaledPSNR[COMPONENT_Cb] / (double)getNumPic(), m_upscaledPSNR[COMPONENT_Cr] / (double)getNumPic()); } -#endif } } break; diff --git a/source/Lib/EncoderLib/BinEncoder.cpp b/source/Lib/EncoderLib/BinEncoder.cpp index 3fd167fcd42da2059078375f1fbfa24cb26ad8e1..9f9b9b8cd0b1292829bed1a5faab71e809ab7fb8 100644 --- a/source/Lib/EncoderLib/BinEncoder.cpp +++ b/source/Lib/EncoderLib/BinEncoder.cpp @@ -285,26 +285,12 @@ void BinEncoderBase::encodeBinTrm( unsigned bin ) } } -#if !JVET_O0525_REMOVE_PCM -void BinEncoderBase::encodeBinsPCM( unsigned bins, unsigned numBins ) -{ - m_Bitstream->write( bins, numBins ); -} -#endif void BinEncoderBase::align() { m_Range = 256; } -#if !JVET_O0525_REMOVE_PCM -void BinEncoderBase::pcmAlignBits() -{ - finish(); - m_Bitstream->write( 1, 1 ); - m_Bitstream->writeAlignZero(); // pcm align zero -} -#endif void BinEncoderBase::encodeAlignedBinsEP( unsigned bins, unsigned numBins ) { @@ -492,15 +478,6 @@ void BitEstimatorBase::align() m_EstFracBits &= mask; } -#if !JVET_O0525_REMOVE_PCM -void BitEstimatorBase::pcmAlignBits() -{ - uint64_t numCurrBits = ( m_EstFracBits >> SCALE_BITS ); - uint64_t filledBytes = ( numCurrBits + 8 ) >> 3; // including aligned_one_bit and aligned_zero_bits - unsigned bitsToAdd = unsigned( ( filledBytes << 3 ) - numCurrBits ); - m_EstFracBits += BinProbModelBase::estFracBitsEP( bitsToAdd ); -} -#endif diff --git a/source/Lib/EncoderLib/BinEncoder.h b/source/Lib/EncoderLib/BinEncoder.h index d829a04eee769ea38201205894734bed40e88ba1..9a36db238a7dcdf07dfccb1e1e229986c072537f 100644 --- a/source/Lib/EncoderLib/BinEncoder.h +++ b/source/Lib/EncoderLib/BinEncoder.h @@ -121,13 +121,7 @@ public: bool useLimitedPrefixLength, int maxLog2TrDynamicRange ) = 0; virtual void encodeBinTrm ( unsigned bin ) = 0; -#if !JVET_O0525_REMOVE_PCM - virtual void encodeBinsPCM ( unsigned bins, unsigned numBins ) = 0; -#endif virtual void align () = 0; -#if !JVET_O0525_REMOVE_PCM - virtual void pcmAlignBits () = 0; -#endif public: virtual uint32_t getNumBins () = 0; virtual bool isEncoding () = 0; @@ -190,13 +184,7 @@ public: bool useLimitedPrefixLength, int maxLog2TrDynamicRange ); void encodeBinTrm ( unsigned bin ); -#if !JVET_O0525_REMOVE_PCM - void encodeBinsPCM ( unsigned bins, unsigned numBins ); -#endif void align (); -#if !JVET_O0525_REMOVE_PCM - void pcmAlignBits (); -#endif unsigned getNumWrittenBits () { return ( m_Bitstream->getNumberOfWrittenBits() + 8 * m_numBufferedBytes + 23 - m_bitsLeft ); } public: uint32_t getNumBins () { return BinCounter::getAll(); } @@ -261,13 +249,7 @@ public: unsigned goRicePar, bool useLimitedPrefixLength, int maxLog2TrDynamicRange ); -#if !JVET_O0525_REMOVE_PCM - void encodeBinsPCM ( unsigned bins, unsigned numBins ) { m_EstFracBits += BinProbModelBase::estFracBitsEP ( numBins ); } -#endif void align (); -#if !JVET_O0525_REMOVE_PCM - void pcmAlignBits (); -#endif public: uint32_t getNumBins () { THROW("Not supported"); return 0; } bool isEncoding () { return false; } diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 52818c098e2365816582737a0ea852509147c20e..afa561e6ac5c0e7b1b0b1b58e086982d336c794a 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -176,7 +176,6 @@ void CABACWriter::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i { codeAlfCtuFilterIndex(cs, ctuRsAddr, cs.slice->getTileGroupAlfEnabledFlag(COMPONENT_Y)); } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if (isChroma(ComponentID(compIdx))) { uint8_t* ctbAlfFlag = cs.slice->getTileGroupAlfEnabledFlag((ComponentID)compIdx) ? cs.slice->getPic()->getAlfCtuEnableFlag( compIdx ) : nullptr; @@ -185,7 +184,6 @@ void CABACWriter::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i codeAlfCtuAlternative( cs, ctuRsAddr, compIdx ); } } -#endif } } @@ -382,12 +380,8 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione const CodingUnit &cu = *cs.getCU( currArea.blocks[partitioner.chType], partitioner.chType ); // Reset delta QP coding flag and ChromaQPAdjustemt coding flag -#if JVET_O0050_LOCAL_DUAL_TREE //Note: do not reset qg at chroma CU if( pps.getUseDQP() && partitioner.currQgEnable() && !isChroma( partitioner.chType ) ) -#else - if( pps.getUseDQP() && partitioner.currQgEnable() ) -#endif { cuCtx.qgStart = true; cuCtx.isDQPCoded = false; @@ -462,7 +456,6 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione } else { -#if JVET_O0050_LOCAL_DUAL_TREE const ModeType modeTypeParent = partitioner.modeType; const ModeType modeTypeChild = CU::getModeTypeAtDepth( cu, partitioner.currDepth ); mode_constraint( splitMode, cs, partitioner, modeTypeChild ); @@ -474,7 +467,6 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione { partitioner.treeType = chromaNotSplit ? TREE_L : TREE_D; } -#endif partitioner.splitCurrArea( splitMode, cs ); do @@ -486,7 +478,6 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione } while( partitioner.nextPart( cs ) ); partitioner.exitCurrSplit(); -#if JVET_O0050_LOCAL_DUAL_TREE if( chromaNotSplit ) { CHECK( partitioner.chType != CHANNEL_TYPE_LUMA, "must be luma status" ); @@ -503,7 +494,6 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione partitioner.treeType = TREE_D; } partitioner.modeType = modeTypeParent; -#endif } return; } @@ -514,30 +504,23 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione cuCtx.qgStart = false; cuCtx.qp = CU::predictQP( cu, cuCtx.qp ); } -#if JVET_O0050_LOCAL_DUAL_TREE CHECK( cu.treeType != partitioner.treeType, "treeType mismatch" ); -#endif // coding unit coding_unit( cu, partitioner, cuCtx ); -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.chType == CHANNEL_TYPE_CHROMA ) { DTRACE_COND( (isEncoding()), g_trace_ctx, D_QP, "[chroma CU]x=%d, y=%d, w=%d, h=%d, qp=%d\n", cu.Cb().x, cu.Cb().y, cu.Cb().width, cu.Cb().height, cu.qp ); } else { -#endif DTRACE_COND( ( isEncoding() ), g_trace_ctx, D_QP, "x=%d, y=%d, w=%d, h=%d, qp=%d\n", cu.Y().x, cu.Y().y, cu.Y().width, cu.Y().height, cu.qp ); -#if JVET_O0050_LOCAL_DUAL_TREE } -#endif DTRACE_BLOCK_REC_COND( ( !isEncoding() ), cs.picture->getRecoBuf( cu ), cu, cu.predMode ); } -#if JVET_O0050_LOCAL_DUAL_TREE void CABACWriter::mode_constraint( const PartSplit split, const CodingStructure& cs, Partitioner& partitioner, const ModeType modeType ) { CHECK( split == CU_DONT_SPLIT, "splitMode shall not be no split" ); @@ -559,7 +542,6 @@ void CABACWriter::mode_constraint( const PartSplit split, const CodingStructure& assert( modeType == partitioner.modeType ); } } -#endif void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& cs, Partitioner& partitioner ) { @@ -630,10 +612,6 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c // void cu_skip_flag ( cu ) // void pred_mode ( cu ) // void part_mode ( cu ) -#if !JVET_O0525_REMOVE_PCM -// void pcm_flag ( cu ) -// void pcm_samples ( tu ) -#endif // void cu_pred_data ( pus ) // void cu_lic_flag ( cu ) // void intra_luma_pred_modes ( pus ) @@ -645,9 +623,7 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, CUCtx& cuCtx ) { -#if JVET_O0050_LOCAL_DUAL_TREE DTRACE( g_trace_ctx, D_SYNTAX, "coding_unit() treeType=%d modeType=%d\n", cu.treeType, cu.modeType ); -#endif CodingStructure& cs = *cu.cs; // transquant bypass flag if( cs.pps->getTransquantBypassEnabledFlag() ) @@ -672,31 +648,12 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C return; } -#if !JVET_O0525_REMOVE_PCM -#if !FIX_PCM - // pcm samples - if( CU::isIntra(cu) ) - { - pcm_data( cu, partitioner ); - if( cu.ipcm ) - { - end_of_ctu( cu, cuCtx ); - return; - } - } -#endif -#endif // prediction mode and partitioning data pred_mode ( cu ); -#if JVET_O0119_BASE_PALETTE_444 if (CU::isPLT(cu)) { -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.isSepTree()) -#else - if (CS::isDualITree(*cu.cs)) -#endif { if (isLuma(partitioner.chType)) { @@ -714,23 +671,8 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C end_of_ctu(cu, cuCtx); return; } -#endif bdpcm_mode( cu, ComponentID( partitioner.chType ) ); -#if !JVET_O0525_REMOVE_PCM -#if FIX_PCM - // pcm samples - if( CU::isIntra(cu) ) - { - pcm_data( cu, partitioner ); - if( cu.ipcm ) - { - end_of_ctu( cu, cuCtx ); - return; - } - } -#endif -#endif // prediction data ( intra prediction modes / reference indexes + motion vectors ) cu_pred_data( cu ); @@ -753,17 +695,9 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) { unsigned ctxId = DeriveCtx::CtxSkipFlag( cu ); -#if JVET_O0050_LOCAL_DUAL_TREE if ((cu.slice->isIntra() || cu.isConsIntra()) && cu.cs->slice->getSPS()->getIBCFlag()) -#else - if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag()) -#endif { -#if JVET_O1161_IBC_MAX_SIZE if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif { m_BinEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId)); DTRACE(g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0); @@ -774,30 +708,16 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) { return; } -#if JVET_O0050_LOCAL_DUAL_TREE if( !cu.cs->slice->getSPS()->getIBCFlag() && cu.isConsIntra() ) { return; } -#endif m_BinEncoder.encodeBin( ( cu.skip ), Ctx::SkipFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0 ); if (cu.skip && cu.cs->slice->getSPS()->getIBCFlag()) { -#if JVET_O1161_IBC_MAX_SIZE -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.lwidth() < 128 && cu.lheight() < 128 && !cu.isConsInter()) // disable IBC mode larger than 64x64 and disable IBC when only allowing inter mode -#else - if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#endif -#else -#if JVET_O0050_LOCAL_DUAL_TREE - if ((cu.lwidth() < 128 || cu.lheight() < 128) && !cu.isConsInter()) // disable 128x128 IBC mode and disable IBC when only allowing inter mode -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif -#endif { if ( cu.lwidth() == 4 && cu.lheight() == 4 ) { @@ -807,111 +727,38 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) m_BinEncoder.encodeBin(CU::isIBC(cu) ? 1 : 0, Ctx::IBCFlag(ctxidx)); DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode); } -#if !JVET_O0249_MERGE_SYNTAX - if (CU::isInter(cu)) - { - if (!cu.cs->slice->getSPS()->getUseMMVD() && (cu.firstPU->lwidth() * cu.firstPU->lheight() == 32)) - { - CHECK(!cu.firstPU->regularMergeFlag, "regular_merge_flag must be true!"); - } - else - { - m_BinEncoder.encodeBin(cu.firstPU->regularMergeFlag, Ctx::RegularMergeFlag(0)); - DTRACE(g_trace_ctx, D_SYNTAX, "regularMergeFlag() ctx=%d regularMergeFlag=%d\n", 0, cu.firstPU->regularMergeFlag?1:0); - } - if (cu.cs->slice->getSPS()->getUseMMVD()) - { - bool isCUWithOnlyRegularAndMMVD=((cu.firstPU->lwidth() == 8 && cu.firstPU->lheight() == 4) || (cu.firstPU->lwidth() == 4 && cu.firstPU->lheight() == 8)); - if (isCUWithOnlyRegularAndMMVD) - { - CHECK(cu.mmvdSkip==cu.firstPU->regularMergeFlag, "mmvdSkip_flag must be !regularMergeFlag"); - } - else if (!cu.firstPU->regularMergeFlag) - { - m_BinEncoder.encodeBin(cu.mmvdSkip, Ctx::MmvdFlag(0)); - DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0); - } - } - } -#endif - } -#if !JVET_O0249_MERGE_SYNTAX - if (cu.skip && !cu.cs->slice->getSPS()->getIBCFlag()) - { - if (!cu.cs->slice->getSPS()->getUseMMVD() && (cu.firstPU->lwidth() * cu.firstPU->lheight() == 32)) - { - CHECK(!cu.firstPU->regularMergeFlag, "regular_merge_flag must be true!"); - } - else - { - m_BinEncoder.encodeBin(cu.firstPU->regularMergeFlag, Ctx::RegularMergeFlag(0)); - DTRACE(g_trace_ctx, D_SYNTAX, "regularMergeFlag() ctx=%d regularMergeFlag=%d\n", 0, cu.firstPU->regularMergeFlag?1:0); - } - if (cu.cs->slice->getSPS()->getUseMMVD()) - { - bool isCUWithOnlyRegularAndMMVD=((cu.firstPU->lwidth() == 8 && cu.firstPU->lheight() == 4) || (cu.firstPU->lwidth() == 4 && cu.firstPU->lheight() == 8)); - if (isCUWithOnlyRegularAndMMVD) - { - CHECK(cu.mmvdSkip==cu.firstPU->regularMergeFlag, "mmvdSkip_flag must be !regularMergeFlag"); - } - else if (!cu.firstPU->regularMergeFlag) - { - m_BinEncoder.encodeBin(cu.mmvdSkip, Ctx::MmvdFlag(0)); - DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0); - } - } } -#endif } void CABACWriter::pred_mode( const CodingUnit& cu ) { -#if JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE if (cu.cs->slice->getSPS()->getIBCFlag() && cu.chType != CHANNEL_TYPE_CHROMA) -#else - if (cu.cs->slice->getSPS()->getIBCFlag()) -#endif { -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.isConsInter() ) { assert( CU::isInter( cu ) ); return; } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) || cu.isConsIntra() ) -#else - if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) ) -#endif { -#if JVET_O1161_IBC_MAX_SIZE if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); m_BinEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx)); } -#if JVET_O0119_BASE_PALETTE_444 if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) { m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0)); } -#endif } else { -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.isConsInter() ) { return; } -#endif -#if JVET_O0119_BASE_PALETTE_444 m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); if (CU::isIntra(cu) || CU::isPLT(cu)) { @@ -920,16 +767,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) } else { -#else - m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); - if (!CU::isIntra(cu)) - { -#endif -#if JVET_O1161_IBC_MAX_SIZE if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64 -#else - if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode -#endif { unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); m_BinEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx)); @@ -939,40 +777,33 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) } else { -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.isConsInter() ) { assert( CU::isInter( cu ) ); return; } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) || cu.isConsIntra() ) -#else - if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) ) -#endif { -#if JVET_O0119_BASE_PALETTE_444 if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) m_BinEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0)); -#endif return; } +#if JVET_P0516_PLT_BINARIZATION + m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); + if ((CU::isIntra(cu) || CU::isPLT(cu)) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) +#else m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); -#if JVET_O0119_BASE_PALETTE_444 if (!CU::isIntra(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64) +#endif { m_BinEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0)); } -#endif } } void CABACWriter::bdpcm_mode( const CodingUnit& cu, const ComponentID compID ) { -#if JVET_O1136_TS_BDPCM_SIGNALLING if( !cu.cs->sps->getBDPCMEnabledFlag() ) return; -#endif if( !CU::bdpcmAllowed( cu, compID ) ) return; m_BinEncoder.encodeBin( cu.bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode( 0 ) ); @@ -983,28 +814,6 @@ void CABACWriter::bdpcm_mode( const 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 ); } -#if !JVET_O0525_REMOVE_PCM -void CABACWriter::pcm_data( const CodingUnit& cu, Partitioner& partitioner ) -{ - pcm_flag( cu, partitioner ); - if( cu.ipcm ) - { - m_BinEncoder.pcmAlignBits(); - pcm_samples( *cu.firstTU ); - } -} - -void CABACWriter::pcm_flag( const CodingUnit& cu, Partitioner& partitioner ) -{ - const SPS& sps = *cu.cs->sps; - if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) - || partitioner.currArea().lheight() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lheight() < (1 << sps.getPCMLog2MinSize()) ) - { - return; - } - m_BinEncoder.encodeBinTrm( cu.ipcm ); -} -#endif void CABACWriter::cu_pred_data( const CodingUnit& cu ) @@ -1042,11 +851,7 @@ void CABACWriter::cu_gbi_flag(const CodingUnit& cu) const uint8_t gbiCodingIdx = (uint8_t)g_GbiCodingOrder[CU::getValidGbiIdx(cu)]; const int32_t numGBi = (cu.slice->getCheckLDC()) ? 5 : 3; -#if JVET_O0126_BPWA_INDEX_CODING_FIX m_BinEncoder.encodeBin((gbiCodingIdx == 0 ? 0 : 1), Ctx::GBiIdx(0)); -#else - m_BinEncoder.encodeBin((gbiCodingIdx == 0 ? 1 : 0), Ctx::GBiIdx(0)); -#endif if(numGBi > 2 && gbiCodingIdx != 0) { const uint32_t prefixNumBits = numGBi - 2; @@ -1057,20 +862,12 @@ void CABACWriter::cu_gbi_flag(const CodingUnit& cu) { if (gbiCodingIdx == idx) { -#if JVET_O0126_BPWA_INDEX_CODING_FIX m_BinEncoder.encodeBinEP(0); -#else - m_BinEncoder.encodeBinEP(1); -#endif break; } else { -#if JVET_O0126_BPWA_INDEX_CODING_FIX m_BinEncoder.encodeBinEP(1); -#else - m_BinEncoder.encodeBinEP(0); -#endif idx += step; } } @@ -1119,9 +916,6 @@ void CABACWriter::xWriteTruncBinCode(uint32_t symbol, uint32_t maxSymbol) void CABACWriter::extend_ref_line(const PredictionUnit& pu) { -#if !ENABLE_JVET_L0283_MRL - return; -#endif const CodingUnit& cu = *pu.cu; if( !cu.Y().valid() || cu.predMode != MODE_INTRA || !isLuma( cu.chType ) || cu.bdpcmMode ) @@ -1146,15 +940,8 @@ void CABACWriter::extend_ref_line(const PredictionUnit& pu) void CABACWriter::extend_ref_line(const CodingUnit& cu) { -#if !ENABLE_JVET_L0283_MRL - return; -#endif -#if !JVET_O0525_REMOVE_PCM - 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.bdpcmMode ) -#endif { return; } @@ -1192,14 +979,7 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu ) if( cu.bdpcmMode ) { -#if JVET_O0315_RDPCM_INTRAMODE_ALIGN cu.firstPU->intraDir[0] = cu.bdpcmMode == 2? VER_IDX : HOR_IDX; -#else - PredictionUnit *pu = cu.firstPU; - unsigned mpm_pred[NUM_MOST_PROBABLE_MODES]; - PU::getIntraMPMs( *pu, mpm_pred ); - cu.firstPU->intraDir[0] = mpm_pred[0]; -#endif return; } @@ -1240,11 +1020,7 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu ) break; } } -#if JVET_O0502_ISP_CLEANUP if ( pu->multiRefIdx ) -#else - if( pu->multiRefIdx || ( cu.ispMode && isLuma( cu.chType ) ) ) -#endif { CHECK(mpm_idx >= numMPMs, "use of non-MPM"); } @@ -1344,11 +1120,7 @@ void CABACWriter::intra_luma_pred_mode( const PredictionUnit& pu ) break; } } -#if JVET_O0502_ISP_CLEANUP if ( pu.multiRefIdx ) -#else - if( pu.multiRefIdx || ( pu.cu->ispMode && isLuma( pu.cu->chType ) ) ) -#endif { CHECK(mpm_idx >= numMPMs, "use of non-MPM"); } @@ -1401,11 +1173,7 @@ void CABACWriter::intra_luma_pred_mode( const PredictionUnit& pu ) void CABACWriter::intra_chroma_pred_modes( const CodingUnit& cu ) { -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.chromaFormat == CHROMA_400 || ( cu.isSepTree() && cu.chType == CHANNEL_TYPE_LUMA ) ) -#else - if( cu.chromaFormat == CHROMA_400 || ( CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_LUMA ) ) -#endif { return; } @@ -1414,7 +1182,6 @@ void CABACWriter::intra_chroma_pred_modes( const CodingUnit& cu ) intra_chroma_pred_mode( *pu ); } -#if JVET_O1153_INTRA_CHROMAMODE_CODING void CABACWriter::intra_chroma_lmc_mode(const PredictionUnit& pu) { const unsigned intraDir = pu.intraDir[1]; @@ -1445,11 +1212,7 @@ void CABACWriter::intra_chroma_lmc_mode(const PredictionUnit& pu) void CABACWriter::intra_chroma_pred_mode(const PredictionUnit& pu) { const unsigned intraDir = pu.intraDir[1]; -#if JVET_O1124_ALLOW_CCLM_COND if (pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed()) -#else - if (pu.cs->sps->getUseLMChroma()) -#endif { m_BinEncoder.encodeBin(PU::isLMCMode(intraDir) ? 1 : 0, Ctx::CclmModeFlag(0)); if (PU::isLMCMode(intraDir)) @@ -1485,73 +1248,6 @@ void CABACWriter::intra_chroma_pred_mode(const PredictionUnit& pu) m_BinEncoder.encodeBinsEP(candId, 2); } } -#else -void CABACWriter::intra_chroma_lmc_mode( const PredictionUnit& pu ) -{ - const unsigned intraDir = pu.intraDir[1]; - int lmModeList[10]; - int maxSymbol = PU::getLMSymbolList( pu, lmModeList ); - int symbol = -1; - for ( int k = 0; k < LM_SYMBOL_NUM; k++ ) - { - if ( lmModeList[k] == intraDir || ( lmModeList[k] == -1 && intraDir < LM_CHROMA_IDX ) ) - { - symbol = k; - break; - } - } - CHECK( symbol < 0, "invalid symbol found" ); - - unary_max_symbol(symbol, Ctx::IntraChromaPredMode(1), Ctx::IntraChromaPredMode(2), maxSymbol - 1); -} - - -void CABACWriter::intra_chroma_pred_mode( const PredictionUnit& pu ) -{ - const unsigned intraDir = pu.intraDir[1]; - const bool isDerivedMode = intraDir == DM_CHROMA_IDX; - - m_BinEncoder.encodeBin(isDerivedMode ? 0 : 1, Ctx::IntraChromaPredMode(0)); - - if (isDerivedMode) - { - return; - } - - // LM chroma mode -#if JVET_O1124_ALLOW_CCLM_COND - if( pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed() ) -#else - if( pu.cs->sps->getUseLMChroma() ) -#endif - { - intra_chroma_lmc_mode( pu ); - if ( PU::isLMCMode( intraDir ) ) - { - return; - } - } - - // chroma candidate index - unsigned chromaCandModes[ NUM_CHROMA_MODE ]; - PU::getIntraChromaCandModes( pu, chromaCandModes ); - - int candId = 0; - for ( ; candId < NUM_CHROMA_MODE; candId++ ) - { - if( intraDir == chromaCandModes[ candId ] ) - { - break; - } - } - - CHECK( candId >= NUM_CHROMA_MODE, "Chroma prediction mode index out of bounds" ); - CHECK( chromaCandModes[ candId ] == DM_CHROMA_IDX, "The intra dir cannot be DM_CHROMA for this path" ); - { - m_BinEncoder.encodeBinsEP( candId, 2 ); - } -} -#endif void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, CUCtx& cuCtx ) { @@ -1573,33 +1269,18 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C } } -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] = false; cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; -#endif -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS cuCtx.lfnstLastScanPos = false; -#endif -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - ChromaCbfs chromaCbfs; -#endif if( cu.ispMode && isLuma( partitioner.chType ) ) { TUIntraSubPartitioner subTuPartitioner( partitioner ); -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_tree( *cu.cs, subTuPartitioner, cuCtx, CU::getISPType( cu, getFirstComponentOfChannel( partitioner.chType) ), 0 ); -#else - transform_tree( *cu.cs, subTuPartitioner, cuCtx, chromaCbfs, CU::getISPType( cu, getFirstComponentOfChannel( partitioner.chType ) ), 0 ); -#endif } else { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_tree( *cu.cs, partitioner, cuCtx ); -#else - transform_tree( *cu.cs, partitioner, cuCtx, chromaCbfs ); -#endif } residual_lfnst_mode( cu, cuCtx ); @@ -1676,11 +1357,7 @@ void CABACWriter::end_of_ctu( const CodingUnit& cu, CUCtx& cuCtx ) const bool isLastSubCUOfCtu = CU::isLastSubCUOfCtu( cu ); if ( isLastSubCUOfCtu -#if JVET_O0050_LOCAL_DUAL_TREE && ( !cu.isSepTree() || cu.chromaFormat == CHROMA_400 || isChroma( cu.chType ) ) -#else - && ( !CS::isDualITree( *cu.cs ) || cu.chromaFormat == CHROMA_400 || isChroma( cu.chType ) ) -#endif ) { cuCtx.isDQPCoded = ( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded ); @@ -1694,7 +1371,6 @@ void CABACWriter::end_of_ctu( const CodingUnit& cu, CUCtx& cuCtx ) } } -#if JVET_O0119_BASE_PALETTE_444 void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, uint32_t numComp, CUCtx& cuCtx) { const SPS& sps = *(cu.cs->sps); @@ -1785,22 +1461,14 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u if (cu.useEscape[compBegin] && cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded) { -#if JVET_O0050_LOCAL_DUAL_TREE if (!cu.isSepTree() || isLuma(tu.chType)) -#else - if (!CS::isDualITree(*tu.cs) || isLuma(tu.chType)) -#endif { cu_qp_delta(cu, cuCtx.qp, cu.qp); cuCtx.qp = cu.qp; cuCtx.isDQPCoded = true; } } -#if JVET_O1168_CU_CHROMA_QP_OFFSET if ( cu.useEscape[compBegin] && cu.cs->slice->getUseChromaQpAdj() && !cuCtx.isChromaQpAdjCoded) -#else - if (cu.cs->slice->getUseChromaQpAdj() && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded) -#endif { if (!CS::isDualITree(*tu.cs) || isChroma(tu.chType)) { @@ -2091,7 +1759,6 @@ void CABACWriter::xWriteTruncMsbP1RefinementBits(uint32_t symbol, PLTRunMode run } } -#endif //================================================================================ // clause 7.3.8.6 @@ -2106,9 +1773,7 @@ void CABACWriter::xWriteTruncMsbP1RefinementBits(uint32_t symbol, PLTRunMode run void CABACWriter::prediction_unit( const PredictionUnit& pu ) { -#if JVET_O0050_LOCAL_DUAL_TREE CHECK( pu.cu->treeType == TREE_C, "cannot be chroma CU" ); -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM CHECK( pu.cacheUsed, "Processing a PU that should be in cache!" ); CHECK( pu.cu->cacheUsed, "Processing a CU that should be in cache!" ); @@ -2124,37 +1789,7 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) } if( pu.mergeFlag ) { -#if JVET_O0249_MERGE_SYNTAX merge_data(pu); -#else - if (CU::isIBC(*pu.cu)) - { - merge_idx(pu); - return; - } - if (pu.regularMergeFlag) - { - merge_idx(pu); - } - else - { - subblock_merge_flag( *pu.cu ); - MHIntra_flag( pu ); - if (!pu.mhIntraFlag) - { - if (!pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip) - { - CHECK(!pu.cu->triangle, "triangle_flag must be true"); - } - } - if (pu.mmvdMergeFlag) - { - mmvd_merge_idx(pu); - } - else - merge_idx ( pu ); - } -#endif } else if (CU::isIBC(*pu.cu)) { @@ -2162,17 +1797,11 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) Mv mvd = pu.mvd[REF_PIC_LIST_0]; mvd.changeIbcPrecInternal2Amvr(pu.cu->imv); mvd_coding(mvd, 0); // already changed to signaling precision -#if JVET_O0162_IBC_MVP_FLAG -#if JVET_O0455_IBC_MAX_MERGE_NUM if ( pu.cu->slice->getMaxNumIBCMergeCand() == 1 ) -#else - if ( pu.cu->slice->getMaxNumMergeCand() == 1 ) -#endif { CHECK( pu.mvpIdx[REF_PIC_LIST_0], "mvpIdx for IBC mode should be 0" ); } else -#endif mvp_flag(pu, REF_PIC_LIST_0); } else @@ -2260,25 +1889,11 @@ void CABACWriter::smvd_mode( const PredictionUnit& pu ) void CABACWriter::subblock_merge_flag( const CodingUnit& cu ) { -#if !JVET_O0249_MERGE_SYNTAX - if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) ) - { - return; - } -#endif -#if JVET_O0220_METHOD1_SUBBLK_FLAG_PARSING if ( !cu.cs->slice->isIntra() && (cu.slice->getMaxNumAffineMergeCand() > 0) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) -#else - if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getUseAffine() || cu.cs->sps->getSBTMVPEnabledFlag()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) -#endif { unsigned ctxId = DeriveCtx::CtxAffineFlag( cu ); -#if JVET_O0500_SEP_CTX_AFFINE_SUBBLOCK_MRG m_BinEncoder.encodeBin( cu.affine, Ctx::SubblockMergeFlag( ctxId ) ); -#else - m_BinEncoder.encodeBin( cu.affine, Ctx::AffineFlag( ctxId ) ); -#endif DTRACE( g_trace_ctx, D_SYNTAX, "subblock_merge_flag() subblock_merge_flag=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y ); } } @@ -2306,40 +1921,8 @@ void CABACWriter::merge_flag( const PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height ); -#if !JVET_O0249_MERGE_SYNTAX - if (pu.mergeFlag && CU::isIBC(*pu.cu)) - { - return; - } - if (pu.mergeFlag) - { - if (!pu.cs->sps->getUseMMVD() && (pu.lwidth() * pu.lheight() == 32)) - { - CHECK(!pu.regularMergeFlag, "regular_merge_flag must be true!"); - } - else - { - m_BinEncoder.encodeBin(pu.regularMergeFlag, Ctx::RegularMergeFlag(1)); - DTRACE(g_trace_ctx, D_SYNTAX, "regularMergeFlag() ctx=%d regularMergeFlag=%d\n", 1, pu.regularMergeFlag?1:0); - } - if (pu.cs->sps->getUseMMVD()) - { - bool isCUWithOnlyRegularAndMMVD=((pu.lwidth() == 8 && pu.lheight() == 4) || (pu.lwidth() == 4 && pu.lheight() == 8)); - if (isCUWithOnlyRegularAndMMVD) - { - CHECK(pu.mmvdMergeFlag==pu.regularMergeFlag, "mmvdMergeFlag must be !regularMergeFlag"); - } - else if (!pu.regularMergeFlag) - { - m_BinEncoder.encodeBin(pu.mmvdMergeFlag, 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); - } - } - } -#endif } -#if JVET_O0249_MERGE_SYNTAX void CABACWriter::merge_data(const PredictionUnit& pu) { if (CU::isIBC(*pu.cu)) @@ -2385,7 +1968,6 @@ void CABACWriter::merge_data(const PredictionUnit& pu) merge_idx(pu); } } -#endif void CABACWriter::imv_mode( const CodingUnit& cu ) { @@ -2412,7 +1994,6 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) if( sps->getAMVREnabledFlag() && cu.imv > 0 ) { -#if JVET_O0057_ALTHPELIF if (!CU::isIBC(cu)) { m_BinEncoder.encodeBin(cu.imv < IMV_HPEL, Ctx::ImvFlag(4)); @@ -2420,12 +2001,9 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) } if (cu.imv < IMV_HPEL) { -#endif m_BinEncoder.encodeBin( (cu.imv > 1), Ctx::ImvFlag( 1 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 1), 1 ); -#if JVET_O0057_ALTHPELIF } -#endif } DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() IMVFlag=%d\n", cu.imv ); @@ -2530,15 +2108,11 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) encodeOneIdx(candIdx1, maxNumTriangleCand - 2); return; } -#if JVET_O0455_IBC_MAX_MERGE_NUM int numCandminus1; if (pu.cu->predMode == MODE_IBC) numCandminus1 = int(pu.cs->slice->getMaxNumIBCMergeCand()) - 1; else numCandminus1 = int(pu.cs->slice->getMaxNumMergeCand()) - 1; -#else - int numCandminus1 = int(pu.cs->slice->getMaxNumMergeCand()) - 1; -#endif if( numCandminus1 > 0 ) { if( pu.mergeIdx == 0 ) @@ -2626,8 +2200,13 @@ void CABACWriter::inter_pred_idc( const PredictionUnit& pu ) m_BinEncoder.encodeBin( 0, Ctx::InterDir(ctxId) ); } } +#if JVET_P0042_FIX_INTER_DIR_CTX + m_BinEncoder.encodeBin( ( pu.interDir == 2 ), Ctx::InterDir( 5 ) ); + DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", pu.interDir, pu.lumaPos().x, pu.lumaPos().y ); +#else m_BinEncoder.encodeBin( ( pu.interDir == 2 ), Ctx::InterDir( 4 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=4 value=%d pos=(%d,%d)\n", pu.interDir, pu.lumaPos().x, pu.lumaPos().y ); +#endif } @@ -2698,69 +2277,12 @@ void CABACWriter::MHIntra_flag(const PredictionUnit& pu) CHECK(pu.mhIntraFlag == true, "invalid MHIntra and skip"); return; } -#if !JVET_O0249_MERGE_SYNTAX - if (pu.mmvdMergeFlag) - { - CHECK(pu.mhIntraFlag == true, "invalid MHIntra and mmvd"); - return; - } - if (pu.cu->affine) - { - CHECK(pu.mhIntraFlag == true, "invalid MHIntra and affine"); - return; - } - if (pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE) - { - CHECK(pu.mhIntraFlag == true, "invalid MHIntra and blk"); - return; - } -#endif m_BinEncoder.encodeBin(pu.mhIntraFlag, Ctx::MHIntraFlag()); 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_O0525_REMOVE_PCM -//================================================================================ -// clause 7.3.8.7 -//-------------------------------------------------------------------------------- -// void pcm_samples( tu ) -//================================================================================ - -void CABACWriter::pcm_samples( const TransformUnit& tu ) -{ - CHECK( !tu.cu->ipcm, "pcm mode expected" ); - - const SPS& sps = *tu.cu->cs->sps; -#if !JVET_O0050_LOCAL_DUAL_TREE - const CodingStructure *cs = tu.cs; -#endif - const ChannelType chType = tu.chType; - -#if JVET_O0050_LOCAL_DUAL_TREE - ComponentID compStr = (tu.cu->isSepTree() && !isLuma( chType )) ? COMPONENT_Cb : COMPONENT_Y; - ComponentID compEnd = (tu.cu->isSepTree() && isLuma( chType )) ? COMPONENT_Y : COMPONENT_Cr; -#else - ComponentID compStr = (CS::isDualITree(*cs) && !isLuma(chType)) ? COMPONENT_Cb: COMPONENT_Y; - ComponentID compEnd = (CS::isDualITree(*cs) && isLuma(chType)) ? COMPONENT_Y : COMPONENT_Cr; -#endif - for( ComponentID compID = compStr; compID <= compEnd; compID = ComponentID(compID+1) ) - { - const CPelBuf samples = tu.getPcmbuf( compID ); - const unsigned sampleBits = sps.getPCMBitDepth( toChannelType(compID) ); - for( unsigned y = 0; y < samples.height; y++ ) - { - for( unsigned x = 0; x < samples.width; x++ ) - { - m_BinEncoder.encodeBinsPCM( samples.at(x, y), sampleBits ); - } - } - } - m_BinEncoder.restart(); -} - -#endif //================================================================================ @@ -2770,39 +2292,18 @@ void CABACWriter::pcm_samples( const TransformUnit& tu ) // bool split_transform_flag( split, depth ) // bool cbf_comp ( cbf, area, depth ) //================================================================================ -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partitioner, CUCtx& cuCtx, const PartSplit ispType, const int subTuIdx ) -#else -void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partitioner, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType, const int subTuIdx ) -#endif { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC const UnitArea& area = partitioner.currArea(); int subTuCounter = subTuIdx; const TransformUnit& tu = *cs.getTU(area.blocks[partitioner.chType].pos(), partitioner.chType, subTuIdx); const CodingUnit& cu = *tu.cu; const unsigned trDepth = partitioner.currTrDepth; const bool split = (tu.depth > trDepth); -#else - ChromaCbfs chromaCbfsLastDepth; - chromaCbfsLastDepth.Cb = chromaCbfs.Cb; - chromaCbfsLastDepth.Cr = chromaCbfs.Cr; - const UnitArea& area = partitioner.currArea(); - int subTuCounter = subTuIdx; - const TransformUnit& tu = *cs.getTU( area.blocks[partitioner.chType].pos(), partitioner.chType, subTuIdx ); - const CodingUnit& cu = *tu.cu; - const unsigned trDepth = partitioner.currTrDepth; - const bool split = ( tu.depth > trDepth ); - const bool chromaCbfISP = area.blocks[COMPONENT_Cb].valid() && cu.ispMode && !split; - bool max_tu_split = false; -#endif // split_transform_flag if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - max_tu_split = true; -#endif CHECK( !split, "transform split implied" ); } else if( cu.sbtInfo && partitioner.canSplit( PartSplit( cu.getSbtTuSplit() ), cs ) ) @@ -2812,50 +2313,9 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit else CHECK( split && !cu.ispMode, "transform split not allowed with QTBT" ); -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - // cbf_cb & cbf_cr -#if JVET_O0050_LOCAL_DUAL_TREE - if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !cu.isSepTree() || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) -#else - if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) && ( !cu.ispMode || chromaCbfISP ) ) -#endif - { - { - unsigned cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; - if (!max_tu_split || chromaCbfISP) - { - chromaCbfs.Cb = TU::getCbfAtDepth( tu, COMPONENT_Cb, trDepth ); - if( !( cu.sbtInfo && trDepth == 1 ) ) - cbf_comp( cs, chromaCbfs.Cb, area.blocks[COMPONENT_Cb], cbfDepth ); - } - - if (!max_tu_split || chromaCbfISP) - { - chromaCbfs.Cr = TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ); - if( !( cu.sbtInfo && trDepth == 1 ) ) - cbf_comp( cs, chromaCbfs.Cr, area.blocks[COMPONENT_Cr], cbfDepth, chromaCbfs.Cb ); - } - } - } -#if JVET_O0050_LOCAL_DUAL_TREE - else if( cu.isSepTree() ) -#else - else if( CS::isDualITree( cs ) ) -#endif - { - chromaCbfs = ChromaCbfs( false ); - } -#endif if( split ) { -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - if( area.chromaFormat != CHROMA_400 ) - { - chromaCbfs.Cb = TU::getCbfAtDepth( tu, COMPONENT_Cb, trDepth ); - chromaCbfs.Cr = TU::getCbfAtDepth( tu, COMPONENT_Cr, trDepth ); - } -#endif if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { @@ -2879,12 +2339,7 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit do { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_tree( cs, partitioner, cuCtx, ispType, subTuCounter ); -#else - ChromaCbfs subChromaCbfs = chromaCbfs; - transform_tree( cs, partitioner, cuCtx, subChromaCbfs, ispType, subTuCounter ); -#endif subTuCounter += subTuCounter != -1 ? 1 : 0; } while( partitioner.nextPart( cs ) ); @@ -2894,78 +2349,17 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit { DTRACE( g_trace_ctx, D_SYNTAX, "transform_unit() pos=(%d,%d) size=%dx%d depth=%d trDepth=%d\n", tu.blocks[tu.chType].x, tu.blocks[tu.chType].y, tu.blocks[tu.chType].width, tu.blocks[tu.chType].height, cu.depth, partitioner.currTrDepth ); -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC transform_unit( tu, cuCtx, partitioner, subTuCounter); -#else - if( !isChroma( partitioner.chType ) ) - { - if( !CU::isIntra( cu ) && trDepth == 0 && !chromaCbfs.sigChroma( area.chromaFormat ) ) - { - CHECK( !TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), "Luma cbf must be true for inter units with no chroma coeffs" ); - } - else if( cu.sbtInfo && tu.noResidual ) - { - CHECK( TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), "Luma cbf must be false for inter sbt no-residual tu" ); - } - else if( cu.sbtInfo && !chromaCbfsLastDepth.sigChroma( area.chromaFormat ) ) - { - assert( !tu.noResidual ); - CHECK( !TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), "Luma cbf must be true for inter sbt residual tu" ); - } - else - { - bool previousCbf = false; - bool rootCbfSoFar = false; - bool lastCbfIsInferred = false; - if( cu.ispMode ) - { - uint32_t nTus = cu.ispMode == HOR_INTRA_SUBPARTITIONS ? cu.lheight() >> floorLog2(tu.lheight()) : cu.lwidth() >> floorLog2(tu.lwidth()); - if( subTuCounter == nTus - 1 ) - { - TransformUnit* tuPointer = cu.firstTU; - for( int tuIdx = 0; tuIdx < subTuCounter; tuIdx++ ) - { - rootCbfSoFar |= TU::getCbfAtDepth( *tuPointer, COMPONENT_Y, trDepth ); - tuPointer = tuPointer->next; - } - if( !rootCbfSoFar ) - { - lastCbfIsInferred = true; - } - } - if( !lastCbfIsInferred ) - { - previousCbf = TU::getPrevTuCbfAtDepth( tu, COMPONENT_Y, partitioner.currTrDepth ); - } - } - if( !lastCbfIsInferred ) - { - cbf_comp( cs, TU::getCbfAtDepth( tu, COMPONENT_Y, trDepth ), tu.Y(), trDepth, previousCbf, cu.ispMode ); - } - } - } - - - transform_unit( tu, cuCtx, chromaCbfs ); -#endif } } void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbf, const bool useISP ) { -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, prevCbf, useISP && isLuma(area.compID) ); -#else - const unsigned ctxId = DeriveCtx::CtxQtCbf( area.compID, depth, prevCbf, useISP && isLuma(area.compID) ); -#endif const CtxSet& ctxSet = Ctx::QtCbf[ area.compID ]; if( area.compID == COMPONENT_Y && cs.getCU( area.pos(), ChannelType( area.compID ) )->bdpcmMode ) { -#if JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX m_BinEncoder.encodeBin( cbf, ctxSet( 1 ) ); -#else - m_BinEncoder.encodeBin( cbf, ctxSet( 4 ) ); -#endif } else { @@ -2989,7 +2383,6 @@ void CABACWriter::mvd_coding( const Mv &rMvd, int8_t imv ) int verMvd = rMvd.getVer(); if ( imv > 0 ) { -#if JVET_O0057_ALTHPELIF CHECK((horMvd % 2) != 0 && (verMvd % 2) != 0, "IMV: MVD is not a multiple of 2"); horMvd >>= 1; verMvd >>= 1; @@ -3005,17 +2398,6 @@ void CABACWriter::mvd_coding( const Mv &rMvd, int8_t imv ) verMvd >>= 2; } } -#else - CHECK( (horMvd % 4) != 0 && (verMvd % 4) != 0, "IMV: MVD is not a multiple of 4" ); - horMvd >>= 2; - verMvd >>= 2; - if( imv == 2 )//IMV_4PEL - { - CHECK( (horMvd % 4) != 0 && (verMvd % 4) != 0, "IMV: MVD is not a multiple of 16" ); - horMvd >>= 2; - verMvd >>= 2; - } -#endif } unsigned horAbs = unsigned( horMvd < 0 ? -horMvd : horMvd ); unsigned verAbs = unsigned( verMvd < 0 ? -verMvd : verMvd ); @@ -3064,13 +2446,8 @@ void CABACWriter::mvd_coding( const Mv &rMvd, int8_t imv ) // void cu_qp_delta ( cu ) // void cu_chroma_qp_offset ( cu ) //================================================================================ -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, Partitioner& partitioner, const int subTuCounter) -#else -void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ) -#endif { -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC const CodingStructure& cs = *tu.cs; const CodingUnit& cu = *tu.cu; const UnitArea& area = partitioner.currArea(); @@ -3080,11 +2457,7 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC CHECK(tu.depth != trDepth, " transform unit should be not be futher partitioned"); // cbf_cb & cbf_cr -#if JVET_O0050_LOCAL_DUAL_TREE if (area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && (!cu.isSepTree() || partitioner.chType == CHANNEL_TYPE_CHROMA) && (!cu.ispMode || chromaCbfISP)) -#else - if (area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && (!CS::isDualITree(cs) || partitioner.chType == CHANNEL_TYPE_CHROMA) && (!cu.ispMode || chromaCbfISP)) -#endif { { unsigned cbfDepth = chromaCbfISP ? trDepth - 1 : trDepth; @@ -3103,11 +2476,7 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC } } } -#if JVET_O0050_LOCAL_DUAL_TREE else if (cu.isSepTree()) -#else - else if (CS::isDualITree(cs)) -#endif { chromaCbfs = ChromaCbfs(false); } @@ -3159,9 +2528,6 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC } } } -#else - CodingUnit& cu = *tu.cu; -#endif bool lumaOnly = ( cu.chromaFormat == CHROMA_400 || !tu.blocks[COMPONENT_Cb].valid() ); bool cbf[3] = { TU::getCbf( tu, COMPONENT_Y ), chromaCbfs.Cb, chromaCbfs.Cr }; bool cbfLuma = ( cbf[ COMPONENT_Y ] != 0 ); @@ -3177,16 +2543,8 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC cbfChroma = ( cbf[ COMPONENT_Cb ] || cbf[ COMPONENT_Cr ] ); } -#if JVET_O0046_DQ_SIGNALLING if( ( cu.lwidth() > 64 || cu.lheight() > 64 || cbfLuma || cbfChroma ) && -#else - if( ( cbfLuma || cbfChroma ) && -#endif -#if JVET_O0050_LOCAL_DUAL_TREE (!tu.cu->isSepTree() || isLuma(tu.chType)) ) -#else - (!CS::isDualITree(*tu.cs) || isLuma(tu.chType)) ) -#endif { if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded ) { @@ -3195,30 +2553,20 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC cuCtx.isDQPCoded = true; } } -#if JVET_O1168_CU_CHROMA_QP_OFFSET if (cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cuCtx.isChromaQpAdjCoded) -#else - if( cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded ) -#endif { cu_chroma_qp_offset( cu ); cuCtx.isChromaQpAdjCoded = true; } -#if JVET_O0105_ICT if( !lumaOnly ) { joint_cb_cr( tu, ( cbf[COMPONENT_Cb] ? 2 : 0 ) + ( cbf[COMPONENT_Cr] ? 1 : 0 ) ); } -#endif if( cbfLuma ) { -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS residual_coding( tu, COMPONENT_Y, &cuCtx ); -#else - residual_coding( tu, COMPONENT_Y ); -#endif } if( !lumaOnly ) { @@ -3230,11 +2578,7 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC } if( cbf[ compID ] ) { -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS residual_coding( tu, compID, &cuCtx ); -#else - residual_coding( tu, compID ); -#endif } } } @@ -3296,56 +2640,27 @@ void CABACWriter::cu_chroma_qp_offset( const CodingUnit& cu ) // void residual_coding_subblock( coeffCtx ) //================================================================================ -#if JVET_O0105_ICT void CABACWriter::joint_cb_cr( const TransformUnit& tu, const int cbfMask ) { -#if JVET_O0376_SPS_JOINTCBCR_FLAG if ( !tu.cu->slice->getSPS()->getJointCbCrEnabledFlag() ) { return; } -#endif CHECK( tu.jointCbCr && tu.jointCbCr != cbfMask, "wrong value of jointCbCr (" << (int)tu.jointCbCr << " vs " << (int)cbfMask << ")" ); -#if JVET_O0543_ICT_ICU_ONLY if( ( CU::isIntra( *tu.cu ) && cbfMask ) || ( cbfMask == 3 ) ) -#else - if( cbfMask ) -#endif { m_BinEncoder.encodeBin( tu.jointCbCr ? 1 : 0, Ctx::JointCbCrFlag( cbfMask - 1 ) ); } } -#else -void CABACWriter::joint_cb_cr( const TransformUnit& tu ) -{ - m_BinEncoder.encodeBin( tu.jointCbCr ? 1 : 0, Ctx::JointCbCrFlag( 0 ) ); -} -#endif -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, CUCtx* cuCtx ) -#else -void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID) -#endif { 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_O0105_ICT if( compID == COMPONENT_Cr && tu.jointCbCr == 3 ) return; -#else - // Joint Cb-Cr residual mode is signalled if both Cb and Cr cbfs are true - if ( compID == COMPONENT_Cr && TU::getCbf( tu, COMPONENT_Cb ) ) - { - joint_cb_cr( tu ); - - // No Cr residual in bitstream in joint Cb-Cr residual mode - if ( tu.jointCbCr ) - return; - } -#endif // code transform skip and explicit rdpcm mode mts_coding ( tu, compID ); @@ -3388,20 +2703,16 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID) CHECK( scanPosLast < 0, "Coefficient coding called for empty TU" ); cctx.setScanPosLast(scanPosLast); -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS if( cuCtx && tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) { const int maxLfnstPos = ((tu.blocks[compID].height == 4 && tu.blocks[compID].width == 4) || (tu.blocks[compID].height == 8 && tu.blocks[compID].width == 8)) ? 7 : 15; cuCtx->violatesLfnstConstrained[ toChannelType(compID) ] |= cctx.scanPosLast() > maxLfnstPos; } -#endif -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS if( cuCtx && tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) { const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; cuCtx->lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; } -#endif // code last coeff position last_sig_coeff( cctx, tu, compID ); @@ -3409,19 +2720,13 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID) const int stateTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int ctxBinSampleRatio = (compID == COMPONENT_Y) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA; cctx.regBinLimit = (tu.getTbAreaAfterCoefZeroOut(compID) * ctxBinSampleRatio) >> 4; -#endif for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--) { cctx.initSubblock ( subSetId, sigGroupFlags[subSetId] ); -#if JVET_O0538_SPS_CONTROL_ISP_SBT if( ( tu.mtsIdx > MTS_SKIP || ( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif { if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) ) || ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) ) @@ -3438,9 +2743,6 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID) void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID ) { -#if !JVET_O0294_TRANSFORM_CLEANUP - const CodingUnit &cu = *tu.cu; -#endif const bool tsAllowed = TU::isTSAllowed ( tu, compID ); const bool mtsAllowed = TU::isMTSAllowed( tu, compID ); @@ -3451,11 +2753,7 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID ) if( tsAllowed ) { -#if JVET_O0294_TRANSFORM_CLEANUP symbol = (tu.mtsIdx == MTS_SKIP) ? 1 : 0; -#else - symbol = (tu.mtsIdx == MTS_SKIP) ? 0 : 1; -#endif ctxIdx = 6; m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) ); } @@ -3465,11 +2763,7 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID ) if( mtsAllowed ) { symbol = tu.mtsIdx != MTS_DCT2_DCT2 ? 1 : 0; -#if JVET_O0294_TRANSFORM_CLEANUP ctxIdx = 0; -#else - ctxIdx = std::min( (int)cu.qtDepth, 5 ); -#endif m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) ); if( symbol ) @@ -3488,20 +2782,12 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID ) } } } -#if JVET_O0294_TRANSFORM_CLEANUP DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tu.mtsIdx); -#else - DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), tu.mtsIdx ); -#endif } void CABACWriter::isp_mode( const CodingUnit& cu ) { -#if !JVET_O0525_REMOVE_PCM - if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || !cu.cs->sps->getUseISP() || cu.bdpcmMode || !CU::canUseISP( cu, getFirstComponentOfChannel( cu.chType ) ) ) -#else if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || !cu.cs->sps->getUseISP() || cu.bdpcmMode || !CU::canUseISP( cu, getFirstComponentOfChannel( cu.chType ) ) ) -#endif { CHECK( cu.ispMode != NOT_INTRA_SUBPARTITIONS, "cu.ispMode != 0" ); return; @@ -3542,27 +2828,11 @@ void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID comp void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) { -#if JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE int chIdx = CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0; -#endif if( cu.ispMode != NOT_INTRA_SUBPARTITIONS || -#if JVET_O0925_MIP_SIMPLIFICATIONS (cu.cs->sps->getUseLFNST() && CU::isIntra(cu) && cu.mipFlag && !allowLfnstWithMip(cu.firstPU->lumaSize())) || -#else - cu.mipFlag == true || -#endif -#if JVET_O0050_LOCAL_DUAL_TREE ( cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) -#else - ( CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) -#endif -#if JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE -#if JVET_O0545_MAX_TB_SIGNALLING || ( cu.blocks[ chIdx ].lumaSize().width > cu.cs->sps->getMaxTbSize() || cu.blocks[ chIdx ].lumaSize().height > cu.cs->sps->getMaxTbSize() ) -#else - || ( cu.blocks[ chIdx ].lumaSize().width > MAX_TB_SIZEY || cu.blocks[ chIdx ].lumaSize().height > MAX_TB_SIZEY ) -#endif -#endif ) { return; @@ -3570,44 +2840,11 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) if( cu.cs->sps->getUseLFNST() && CU::isIntra( cu ) && !CU::isLosslessCoded( cu ) ) { -#if JVET_O0050_LOCAL_DUAL_TREE const bool lumaFlag = cu.isSepTree() ? ( isLuma( cu.chType ) ? true : false ) : true; const bool chromaFlag = cu.isSepTree() ? ( isChroma( cu.chType ) ? true : false ) : true; -#else - const bool lumaFlag = CS::isDualITree( *cu.cs ) ? ( isLuma( cu.chType ) ? true : false ) : true; - const bool chromaFlag = CS::isDualITree( *cu.cs ) ? ( isChroma( cu.chType ) ? true : false ) : true; -#endif -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS - bool nonZeroCoeffNonTs; -#endif -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS bool nonZeroCoeffNonTsCorner8x8 = ( lumaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] ) || (chromaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] ); -#else - bool nonZeroCoeffNonTsCorner8x8 = CU::getNumNonZeroCoeffNonTsCorner8x8( cu, lumaFlag, chromaFlag ) > 0; -#endif -#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS -#if JVET_O0050_LOCAL_DUAL_TREE - const int nonZeroCoeffThr = cu.isSepTree() ? ( isLuma( cu.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA; -#else - const int nonZeroCoeffThr = CS::isDualITree( *cu.cs ) ? ( isLuma( cu.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA; -#endif - cuCtx.numNonZeroCoeffNonTs = CU::getNumNonZeroCoeffNonTs( cu, lumaFlag, chromaFlag ); - nonZeroCoeffNonTs = cuCtx.numNonZeroCoeffNonTs > nonZeroCoeffThr; -#endif -#if JVET_O0368_LFNST_WITH_DCT2_ONLY const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2); -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 ) -#else - if (!nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 ) -#endif -#else -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS - if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 ) -#else - if( !nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 ) -#endif -#endif { return; } @@ -3619,27 +2856,7 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) unsigned cctx = 0; -#if JVET_O0368_LFNST_WITH_DCT2_ONLY -#if JVET_O0050_LOCAL_DUAL_TREE if ( cu.isSepTree() ) cctx++; -#else - if ( CS::isDualITree(*cu.cs) ) cctx++; -#endif -#else -#if JVET_O0545_MAX_TB_SIGNALLING -#if JVET_O0050_LOCAL_DUAL_TREE - if( ( cu.firstTU->mtsIdx < MTS_DST7_DST7 || !TU::getCbf(*cu.firstTU, COMPONENT_Y) ) && cu.isSepTree() ) cctx++; -#else - if( ( cu.firstTU->mtsIdx < MTS_DST7_DST7 || !TU::getCbf(*cu.firstTU, COMPONENT_Y) ) && CS::isDualITree( *cu.cs ) ) cctx++; -#endif -#else -#if JVET_O0050_LOCAL_DUAL_TREE - if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && cu.isSepTree() ) cctx++; -#else - if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++; -#endif -#endif -#endif const uint32_t idxLFNST = cu.lfnstIdx; assert( idxLFNST < 3 ); @@ -3669,11 +2886,7 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx, const TransformUnit& unsigned maxLastPosX = cctx.maxLastPosX(); unsigned maxLastPosY = cctx.maxLastPosY(); -#if JVET_O0538_SPS_CONTROL_ISP_SBT if( ( tu.mtsIdx > MTS_SKIP || ( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#else - if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y ) -#endif { maxLastPosX = ( tu.blocks[compID].width == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosX; maxLastPosY = ( tu.blocks[compID].height == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosY; @@ -3746,12 +2959,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe int remAbsLevel = -1; int numNonZero = 0; unsigned signPattern = 0; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT int remRegBins = cctx.regBinLimit; -#else - bool is2x2subblock = ( cctx.log2CGSize() == 2 ); - int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ); -#endif int firstPosMode2 = minSubPos - 1; for( ; nextSigPos >= minSubPos && remRegBins >= 4; nextSigPos-- ) @@ -3805,9 +3013,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe state = ( stateTransTable >> ((state<<2)+((Coeff&1)<<1)) ) & 3; } firstPosMode2 = nextSigPos; -#if JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT cctx.regBinLimit = remRegBins; -#endif //===== 2nd PASS: Go-rice codes ===== @@ -3898,37 +3104,13 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC { if( cctx.isSigGroup() ) { -#if !JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT - if( cctx.isContextCoded() ) - { -#endif m_BinEncoder.encodeBin( 1, cctx.sigGroupCtxId( true ) ); DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() bin=%d ctx=%d\n", 1, cctx.sigGroupCtxId() ); -#if !JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT - } - else - { - m_BinEncoder.encodeBinEP( 1 ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() EPbin=%d\n", 1 ); - } -#endif } else { -#if !JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT - if( cctx.isContextCoded() ) - { -#endif m_BinEncoder.encodeBin( 0, cctx.sigGroupCtxId( true ) ); DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() bin=%d ctx=%d\n", 0, cctx.sigGroupCtxId() ); -#if !JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT - } - else - { - m_BinEncoder.encodeBinEP( 0 ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() EPbin=%d\n", 0 ); - } -#endif return; } } @@ -3938,9 +3120,7 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC int remAbsLevel = -1; int numNonZero = 0; -#if JVET_O0122_TS_SIGN_LEVEL int rightPixel, belowPixel, modAbsCoeff; -#endif for( ; nextSigPos <= minSubPos; nextSigPos++ ) { @@ -3967,28 +3147,19 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC int sign = Coeff < 0; if( cctx.isContextCoded() ) { -#if JVET_O0122_TS_SIGN_LEVEL const unsigned signCtxId = cctx.signCtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm()); m_BinEncoder.encodeBin(sign, signCtxId); -#else - m_BinEncoder.encodeBin( sign, Ctx::TsResidualSign( cctx.bdpcm() ? 1 : 0 ) ); -#endif } else { m_BinEncoder.encodeBinEP( sign ); } numNonZero++; -#if JVET_O0122_TS_SIGN_LEVEL cctx.neighTS(rightPixel, belowPixel, nextSigPos, coeff); modAbsCoeff = cctx.deriveModCoeff(rightPixel, belowPixel, abs(Coeff), cctx.bdpcm()); remAbsLevel = modAbsCoeff - 1; -#else - remAbsLevel = abs( Coeff ) - 1; -#endif unsigned gt1 = !!remAbsLevel; -#if JVET_O0122_TS_SIGN_LEVEL const unsigned gt1CtxId = cctx.lrg1CtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm()); if (cctx.isContextCoded()) { @@ -4000,18 +3171,6 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC m_BinEncoder.encodeBinEP(gt1); DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() EPbin=%d\n", gt1); } -#else - if( cctx.isContextCoded() ) - { - m_BinEncoder.encodeBin( gt1, cctx.greaterXCtxIdAbsTS(0) ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() bin=%d ctx=%d\n", gt1, cctx.greaterXCtxIdAbsTS(0) ); - } - else - { - m_BinEncoder.encodeBinEP( gt1 ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() EPbin=%d\n", gt1 ); - } -#endif if( gt1 ) { @@ -4033,16 +3192,11 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC int cutoffVal = 2; int numGtBins = 4; -#if JVET_O0619_GTX_SINGLE_PASS_TS_RESIDUAL_CODING for (int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++) { -#if JVET_O0122_TS_SIGN_LEVEL unsigned absLevel; cctx.neighTS(rightPixel, belowPixel, scanPos, coeff); absLevel = cctx.deriveModCoeff(rightPixel, belowPixel, abs(coeff[cctx.blockPos(scanPos)]), cctx.bdpcm()); -#else - unsigned absLevel = abs(coeff[cctx.blockPos(scanPos)]); -#endif cutoffVal = 2; for (int i = 0; i < numGtBins; i++) { @@ -4063,48 +3217,13 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC cutoffVal += 2; } } -#else - for( int i = 0; i < numGtBins; i++ ) - { - for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ ) - { -#if JVET_O0122_TS_SIGN_LEVEL - unsigned absLevel; - cctx.neighTS(rightPixel, belowPixel, scanPos, coeff); - absLevel = cctx.deriveModCoeff(rightPixel, belowPixel, abs(coeff[cctx.blockPos(scanPos)]), cctx.bdpcm()); -#else - unsigned absLevel = abs( coeff[cctx.blockPos( scanPos )] ); -#endif - if( absLevel >= cutoffVal ) - { - unsigned gt2 = ( absLevel >= ( cutoffVal + 2 ) ); - if( cctx.isContextCoded() ) - { - m_BinEncoder.encodeBin( gt2, cctx.greaterXCtxIdAbsTS( cutoffVal>>1 ) ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2, cctx.greaterXCtxIdAbsTS( cutoffVal>>1 ), scanPos, min<int>( absLevel, cutoffVal+2 ) ); - } - else - { - m_BinEncoder.encodeBinEP( gt2 ); - DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() EPbin=%d sp=%d coeff=%d\n", i, gt2, scanPos, min<int>( absLevel, cutoffVal+2 ) ); - } - } - } - cutoffVal += 2; - } -#endif //===== coeff bypass ==== for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ ) { -#if JVET_O0122_TS_SIGN_LEVEL unsigned absLevel; cctx.neighTS(rightPixel, belowPixel, scanPos, coeff); absLevel = cctx.deriveModCoeff(rightPixel, belowPixel, abs(coeff[cctx.blockPos(scanPos)]), cctx.bdpcm()); -#else - TCoeff Coeff = coeff[ cctx.blockPos( scanPos ) ]; - unsigned absLevel = abs( Coeff ); -#endif if( absLevel >= cutoffVal ) { int rice = cctx.templateAbsSumTS( scanPos, coeff ); @@ -4302,11 +3421,7 @@ void CABACWriter::mip_flag( const CodingUnit& cu ) { return; } -#if JVET_O0545_MAX_TB_SIGNALLING if( cu.lwidth() > cu.cs->sps->getMaxTbSize() || cu.lheight() > cu.cs->sps->getMaxTbSize()) -#else - if( cu.lwidth() > MIP_MAX_WIDTH || cu.lheight() > MIP_MAX_HEIGHT ) -#endif { return; } @@ -4336,50 +3451,7 @@ void CABACWriter::mip_pred_mode( const PredictionUnit& pu ) { const int numModes = getNumModesMip( pu.Y() ); CHECKD( numModes > MAX_NUM_MIP_MODE, "Error: too many MIP modes" ); -#if JVET_O0925_MIP_SIMPLIFICATIONS xWriteTruncBinCode( pu.intraDir[CHANNEL_TYPE_LUMA], numModes ); -#else - // derive modeIdx from true MIP mode - unsigned mpm[NUM_MPM_MIP]; - PU::getMipMPMs(pu, mpm); - - unsigned mipMode = pu.intraDir[CHANNEL_TYPE_LUMA]; - unsigned mpmIdx = NUM_MPM_MIP; - for( auto k = 0; k < NUM_MPM_MIP; k++ ) - { - if( mipMode == mpm[k] ) - { - mpmIdx = k; - break; - } - } - - unsigned modeIdx; - if (mpmIdx < NUM_MPM_MIP) - { - modeIdx = mpmIdx; - } - else - { - std::sort( mpm, mpm + NUM_MPM_MIP); - - modeIdx = mipMode; - for( auto k = (NUM_MPM_MIP - 1); k >= 0; k-- ) - { - if( modeIdx > mpm[k] ) - { - modeIdx--; - } - } - CHECK( modeIdx >= (1<<getNumEpBinsMip( pu.Y() )), "Incorrect mode" ); - modeIdx += NUM_MPM_MIP; - } - - CHECK( modeIdx >= numModes, "modeIdx out of range" ); - int unaryMax = NUM_MPM_MIP - 1; - int fixedLength = getNumEpBinsMip( pu.Y() ); - code_unary_fixed( modeIdx, Ctx::MipMode( 0 ), unaryMax, fixedLength ); -#endif 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] ); } @@ -4421,14 +3493,10 @@ void CABACWriter::codeAlfCtuFilterIndex(CodingStructure& cs, uint32_t ctuRsAddr, if (useTemporalFilt) { CHECK((filterSetIdx - (NUM_FIXED_FILTER_SETS + 1)) >= (numAvailableFiltSets - (NUM_FIXED_FILTER_SETS + 1)), "temporal non-latest set"); -#if JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL if (numAps > 2) { -#endif xWriteTruncBinCode(filterSetIdx - (NUM_FIXED_FILTER_SETS + 1), numAvailableFiltSets - (NUM_FIXED_FILTER_SETS + 1)); -#if JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL } -#endif } else { @@ -4444,7 +3512,6 @@ void CABACWriter::codeAlfCtuFilterIndex(CodingStructure& cs, uint32_t ctuRsAddr, xWriteTruncBinCode(filterSetIdx, NUM_FIXED_FILTER_SETS); } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void CABACWriter::codeAlfCtuAlternatives( CodingStructure& cs, ChannelType channel, AlfParam* alfParam) { if( isChroma( channel ) ) @@ -4496,6 +3563,5 @@ void CABACWriter::codeAlfCtuAlternative( CodingStructure& cs, uint32_t ctuRsAddr } } -#endif //! \} diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index 780ded7fa71e7ac9bf25d4f5c1b17dfd34013275..d1821b30a1e4e6eb17dfba6de2c0da93a6dd69d3 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -83,9 +83,7 @@ public: // coding (quad)tree (clause 7.3.8.4) void coding_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, Partitioner* pPartitionerChroma = nullptr, CUCtx* pCuCtxChroma = nullptr); void split_cu_mode ( const PartSplit split, const CodingStructure& cs, Partitioner& pm ); -#if JVET_O0050_LOCAL_DUAL_TREE void mode_constraint ( const PartSplit split, const CodingStructure& cs, Partitioner& pm, const ModeType modeType ); -#endif // coding unit (clause 7.3.8.5) void coding_unit ( const CodingUnit& cu, Partitioner& pm, CUCtx& cuCtx ); @@ -94,10 +92,6 @@ public: void pred_mode ( const CodingUnit& cu ); void bdpcm_mode ( const CodingUnit& cu, const ComponentID compID ); -#if !JVET_O0525_REMOVE_PCM - void pcm_data ( const CodingUnit& cu, Partitioner& pm ); - void pcm_flag ( const CodingUnit& cu, Partitioner& pm ); -#endif void cu_pred_data ( const CodingUnit& cu ); void cu_gbi_flag ( const CodingUnit& cu ); void extend_ref_line (const PredictionUnit& pu ); @@ -114,18 +108,14 @@ public: void mip_flag ( const CodingUnit& cu ); void mip_pred_modes ( const CodingUnit& cu ); void mip_pred_mode ( const PredictionUnit& pu ); -#if JVET_O0119_BASE_PALETTE_444 void cu_palette_info ( const CodingUnit& cu, ComponentID compBegin, uint32_t numComp, CUCtx& cuCtx); void cu_run_val ( uint32_t run, PLTRunMode runtype, const uint32_t paletteIdx, const uint32_t maxRun); void encodeRunType ( const CodingUnit& cu, PLTtypeBuf& runType, uint32_t idx, ScanElement *refScanOrder, ComponentID compBegin); Pel writePLTIndex ( const CodingUnit& cu, uint32_t idx, PelBuf& paletteIdx, PLTtypeBuf& paletteRunType, int maxSymbol, ComponentID compBegin ); -#endif // prediction unit (clause 7.3.8.6) void prediction_unit ( const PredictionUnit& pu ); void merge_flag ( const PredictionUnit& pu ); -#if JVET_O0249_MERGE_SYNTAX void merge_data ( const PredictionUnit& pu ); -#endif void affine_flag ( const CodingUnit& cu ); void subblock_merge_flag ( const CodingUnit& cu ); void merge_idx ( const PredictionUnit& pu ); @@ -139,36 +129,20 @@ public: void MHIntra_flag ( const PredictionUnit& pu ); void smvd_mode ( const PredictionUnit& pu ); -#if !JVET_O0525_REMOVE_PCM - // pcm samples (clause 7.3.8.7) - void pcm_samples ( const TransformUnit& tu ); -#endif // transform tree (clause 7.3.8.8) -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void transform_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, const PartSplit ispType = TU_NO_ISP, const int subTuIdx = -1 ); -#else - void transform_tree ( const CodingStructure& cs, Partitioner& pm, CUCtx& cuCtx, ChromaCbfs& chromaCbfs, const PartSplit ispType = TU_NO_ISP, const int subTuIdx = -1 ); -#endif void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, unsigned depth, const bool prevCbf = false, const bool useISP = false ); // mvd coding (clause 7.3.8.9) void mvd_coding ( const Mv &rMvd, int8_t imv ); // transform unit (clause 7.3.8.10) -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC void transform_unit ( const TransformUnit& tu, CUCtx& cuCtx, Partitioner& pm, const int subTuCounter = -1 ); -#else - void transform_unit ( const TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); -#endif void cu_qp_delta ( const CodingUnit& cu, int predQP, const int8_t qp ); void cu_chroma_qp_offset ( const CodingUnit& cu ); // residual coding (clause 7.3.8.11) -#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS void residual_coding ( const TransformUnit& tu, ComponentID compID, CUCtx* cuCtx = nullptr ); -#else - void residual_coding ( const TransformUnit& tu, ComponentID compID ); -#endif void mts_coding ( const TransformUnit& tu, ComponentID compID ); void residual_lfnst_mode ( const CodingUnit& cu, CUCtx& cuCtx ); void isp_mode ( const CodingUnit& cu ); @@ -177,11 +151,7 @@ public: void residual_coding_subblock ( CoeffCodingContext& cctx, const TCoeff* coeff, const int stateTransTable, int& state ); void residual_codingTS ( const TransformUnit& tu, ComponentID compID ); void residual_coding_subblockTS( CoeffCodingContext& cctx, const TCoeff* coeff ); -#if JVET_O0105_ICT void joint_cb_cr ( const TransformUnit& tu, const int cbfMask ); -#else - void joint_cb_cr ( const TransformUnit& tu ); -#endif // cross component prediction (clause 7.3.8.12) void cross_comp_pred ( const TransformUnit& tu, ComponentID compID ); @@ -190,12 +160,10 @@ public: void codeAlfCtuEnableFlags ( CodingStructure& cs, ComponentID compID, AlfParam* alfParam); void codeAlfCtuEnableFlag ( CodingStructure& cs, uint32_t ctuRsAddr, const int compIdx, AlfParam* alfParam ); void codeAlfCtuFilterIndex(CodingStructure& cs, uint32_t ctuRsAddr, bool alfEnableLuma); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void codeAlfCtuAlternatives ( CodingStructure& cs, ChannelType channel, AlfParam* alfParam); void codeAlfCtuAlternatives ( CodingStructure& cs, ComponentID compID, AlfParam* alfParam); void codeAlfCtuAlternative ( CodingStructure& cs, uint32_t ctuRsAddr, const int compIdx, const AlfParam* alfParam = NULL ); -#endif private: void unary_max_symbol ( unsigned symbol, unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol ); @@ -207,20 +175,16 @@ private: unsigned get_num_written_bits() { return m_BinEncoder.getNumWrittenBits(); } void xWriteTruncBinCode(uint32_t uiSymbol, uint32_t uiMaxSymbol); -#if JVET_O0119_BASE_PALETTE_444 void codeScanRotationModeFlag ( const CodingUnit& cu, ComponentID compBegin); void xEncodePLTPredIndicator ( const CodingUnit& cu, uint32_t maxPltSize, ComponentID compBegin); uint32_t xWriteTruncMsbP1 ( uint32_t symbol, PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT); void xWriteTruncMsbP1RefinementBits( uint32_t symbol, PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT); -#endif private: BinEncIf& m_BinEncoder; OutputBitstream* m_Bitstream; Ctx m_TestCtx; EncCu* m_EncCu; -#if JVET_O0119_BASE_PALETTE_444 ScanElement* m_scanOrder; -#endif }; diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index 1a1c782d65a56c8cbd8acdff54d29ec3fc490b4a..35aa25c7688bbbce6656b98bfb2cff2d4405a3f4 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -402,11 +402,7 @@ int AlfCovariance::gnsSolveByChol( TE LHS, double* rhs, double *x, int numEq ) c EncAdaptiveLoopFilter::EncAdaptiveLoopFilter() : m_CABACEstimator( nullptr ) -#if JVET_O_MAX_NUM_ALF_APS_8 , m_apsIdStart( ALF_CTB_MAX_NUM_APS ) -#else - , m_apsIdStart( MAX_NUM_APS ) -#endif { for( int i = 0; i < MAX_NUM_COMPONENT; i++ ) { @@ -432,11 +428,7 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co for( int channelIdx = 0; channelIdx < MAX_NUM_CHANNEL_TYPE; channelIdx++ ) { ChannelType chType = (ChannelType)channelIdx; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB int numClasses = channelIdx ? MAX_NUM_ALF_ALTERNATIVES_CHROMA : MAX_NUM_ALF_CLASSES; -#else - int numClasses = channelIdx ? 1 : MAX_NUM_ALF_CLASSES; -#endif m_alfCovarianceFrame[chType] = new AlfCovariance*[m_filterShapes[chType].size()]; for( int i = 0; i != m_filterShapes[chType].size(); i++ ) { @@ -451,7 +443,6 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { m_ctuEnableFlagTmp[compIdx] = new uint8_t[m_numCTUsInPic]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_ctuEnableFlagTmp2[compIdx] = new uint8_t[m_numCTUsInPic]; if( isLuma( ComponentID(compIdx) ) ) { @@ -462,7 +453,6 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co m_ctuAlternativeTmp[compIdx] = new uint8_t[m_numCTUsInPic]; std::fill_n( m_ctuAlternativeTmp[compIdx], m_numCTUsInPic, 0 ); } -#endif ChannelType chType = toChannelType( ComponentID( compIdx ) ); int numClasses = compIdx ? 1 : MAX_NUM_ALF_CLASSES; @@ -490,13 +480,8 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_filterCoeffSet = new int*[std::max(MAX_NUM_ALF_CLASSES, MAX_NUM_ALF_ALTERNATIVES_CHROMA)]; m_filterClippSet = new int*[std::max(MAX_NUM_ALF_CLASSES, MAX_NUM_ALF_ALTERNATIVES_CHROMA)]; -#else - m_filterCoeffSet = new int*[MAX_NUM_ALF_CLASSES]; - m_filterClippSet = new int*[MAX_NUM_ALF_CLASSES]; -#endif m_diffFilterCoeff = new int*[MAX_NUM_ALF_CLASSES]; for( int i = 0; i < MAX_NUM_ALF_CLASSES; i++ ) @@ -506,13 +491,6 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co m_diffFilterCoeff[i] = new int[MAX_NUM_ALF_LUMA_COEFF]; } -#if !JVET_O1164_PS -#if JVET_O_MAX_NUM_ALF_APS_8 - m_apsIdStart = ALF_CTB_MAX_NUM_APS; -#else - m_apsIdStart = (int)MAX_NUM_APS; -#endif -#endif m_ctbDistortionFixedFilter = new double[m_numCTUsInPic]; for (int comp = 0; comp < MAX_NUM_COMPONENT; comp++) @@ -557,7 +535,6 @@ void EncAdaptiveLoopFilter::destroy() m_ctuEnableFlagTmp[compIdx] = nullptr; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( m_ctuEnableFlagTmp2[compIdx] ) { delete[] m_ctuEnableFlagTmp2[compIdx]; @@ -570,7 +547,6 @@ void EncAdaptiveLoopFilter::destroy() m_ctuAlternativeTmp[compIdx] = nullptr; } -#endif if( m_alfCovariance[compIdx] ) { ChannelType chType = toChannelType( ComponentID( compIdx ) ); @@ -666,19 +642,10 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda { if (cs.slice->getPendingRasInit() || cs.slice->isIDRorBLA()) { -#if JVET_O_MAX_NUM_ALF_APS_8 memset(cs.slice->getAlfAPSs(), 0, sizeof(*cs.slice->getAlfAPSs())*ALF_CTB_MAX_NUM_APS); m_apsIdStart = ALF_CTB_MAX_NUM_APS; -#else - memset(cs.slice->getAlfAPSs(), 0, sizeof(*cs.slice->getAlfAPSs())*MAX_NUM_APS); - m_apsIdStart = (int)MAX_NUM_APS; -#endif m_apsMap->clear(); -#if JVET_O_MAX_NUM_ALF_APS_8 for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) -#else - for (int i = 0; i < MAX_NUM_APS; i++) -#endif { APS* alfAPS = m_apsMap->getPS((i << NUM_APS_TYPE_LEN) + ALF_APS); m_apsMap->clearChangedFlag((i << NUM_APS_TYPE_LEN) + ALF_APS); @@ -702,9 +669,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { m_ctuEnableFlag[compIdx] = cs.picture->getAlfCtuEnableFlag( compIdx ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_ctuAlternative[compIdx] = cs.picture->getAlfCtuAlternativeData( compIdx ); -#endif } // reset ALF parameters @@ -784,10 +749,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda #else deriveClassification( m_classifier, buf.get(COMPONENT_Y), blkDst, blkSrc ); #endif -#if !JVET_O0525_REMOVE_PCM - Area blkPCM( xStart, yStart, w, h ); - resetPCMBlkClassInfo( cs, m_classifier, buf.get(COMPONENT_Y), blkPCM ); -#endif xStart = xEnd; } @@ -802,10 +763,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda deriveClassification( m_classifier, recLuma, blk, blk, alfBryList ); #else deriveClassification( m_classifier, recLuma, blk, blk ); -#endif -#if !JVET_O0525_REMOVE_PCM - Area blkPCM( xPos, yPos, width, height ); - resetPCMBlkClassInfo( cs, m_classifier, recLuma, blkPCM ); #endif } } @@ -814,7 +771,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda // get CTB stats for filtering deriveStatsForFiltering( orgYuv, recYuv, cs ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for (int ctbIdx = 0; ctbIdx < m_numCTUsInPic; ctbIdx++) { cs.slice->getPic()->getAlfCtbFilterIndex()[ctbIdx] = NUM_FIXED_FILTER_SETS; @@ -823,7 +779,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda alfParam.newFilterFlag[CHANNEL_TYPE_LUMA] = true; alfParam.newFilterFlag[CHANNEL_TYPE_CHROMA] = true; cs.slice->setTileGroupNumAps(1); // Only new filter for RD cost optimization -#endif // derive filter (luma) alfEncoder( cs, alfParam, orgYuv, recYuv, cs.getRecoBuf(), CHANNEL_TYPE_LUMA #if ENABLE_QPA @@ -840,12 +795,10 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda ); } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB // let alfEncoderCtb decide now alfParam.newFilterFlag[CHANNEL_TYPE_LUMA] = false; alfParam.newFilterFlag[CHANNEL_TYPE_CHROMA] = false; cs.slice->setTileGroupNumAps(0); -#endif m_CABACEstimator->getCtx() = AlfCtx(ctxStart); alfEncoderCtb(cs, alfParam #if ENABLE_QPA @@ -864,15 +817,11 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons { TempCtx ctxTempStart( m_CtxCache ); TempCtx ctxTempBest( m_CtxCache ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB TempCtx ctxTempAltStart( m_CtxCache ); TempCtx ctxTempAltBest( m_CtxCache ); -#endif const ComponentID compIDFirst = isLuma( channel ) ? COMPONENT_Y : COMPONENT_Cb; const ComponentID compIDLast = isLuma( channel ) ? COMPONENT_Y : COMPONENT_Cr; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const int numAlts = isLuma( channel ) ? 1 : m_alfParamTemp.numAlternativesChroma; -#endif double cost = 0; distUnfilter = 0; @@ -883,7 +832,6 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons #endif reconstructCoeff(m_alfParamTemp, channel, true, isLuma(channel)); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for( int altIdx = 0; altIdx < (isLuma(channel) ? 1 : MAX_NUM_ALF_ALTERNATIVES_CHROMA); altIdx++) { for (int classIdx = 0; classIdx < (isLuma(channel) ? MAX_NUM_ALF_CLASSES : 1); classIdx++) @@ -895,27 +843,15 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons } } } -#else - for (int classIdx = 0; classIdx < (isLuma(channel) ? MAX_NUM_ALF_CLASSES : 1); classIdx++) - { - for (int i = 0; i < (isLuma(channel) ? MAX_NUM_ALF_LUMA_COEFF : MAX_NUM_ALF_CHROMA_COEFF); i++) - { - m_filterCoeffSet[classIdx][i] = isLuma(channel) ? m_coeffFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + i] : m_chromaCoeffFinal[i]; - m_filterClippSet[classIdx][i] = isLuma(channel) ? m_clippFinal[classIdx* MAX_NUM_ALF_LUMA_COEFF + i] : m_chromaClippFinal[i]; - } - } -#endif for( int ctuIdx = 0; ctuIdx < m_numCTUsInPic; ctuIdx++ ) { for( int compID = compIDFirst; compID <= compIDLast; compID++ ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB #if ENABLE_QPA const double ctuLambda = chromaWeight > 0.0 ? (isLuma (channel) ? cs.picture->m_uEnerHpCtu[ctuIdx] : cs.picture->m_uEnerHpCtu[ctuIdx] / chromaWeight) : m_lambda[compID]; #else const double ctuLambda = m_lambda[compID]; -#endif #endif double distUnfilterCtu = getUnfilteredDistortion( m_alfCovariance[compID][iShapeIdx][ctuIdx], numClasses ); @@ -924,7 +860,6 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons m_CABACEstimator->resetBits(); m_ctuEnableFlag[compID][ctuIdx] = 1; m_CABACEstimator->codeAlfCtuEnableFlag( cs, ctuIdx, compID, &m_alfParamTemp ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isLuma( channel ) ) { // Evaluate cost of signaling filter set index for convergence of filters enabled flag / filter derivation @@ -934,17 +869,7 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons } double costOn = distUnfilterCtu + ctuLambda * FRAC_BITS_SCALE * m_CABACEstimator->getEstFracBits(); -#else - double costOn = distUnfilterCtu + getFilteredDistortion( m_alfCovariance[compID][iShapeIdx][ctuIdx], numClasses, m_alfParamTemp.numLumaFilters - 1, numCoeff ); -#if ENABLE_QPA - const double ctuLambda = chromaWeight > 0.0 ? (isLuma (channel) ? cs.picture->m_uEnerHpCtu[ctuIdx] : cs.picture->m_uEnerHpCtu[ctuIdx] / chromaWeight) : m_lambda[compID]; -#else - const double ctuLambda = m_lambda[compID]; -#endif - costOn += ctuLambda * FRAC_BITS_SCALE * m_CABACEstimator->getEstFracBits(); -#endif ctxTempBest = AlfCtx( m_CABACEstimator->getCtx() ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isLuma( channel ) ) { costOn += getFilteredDistortion( m_alfCovariance[compID][iShapeIdx][ctuIdx], numClasses, m_alfParamTemp.numLumaFilters - 1, numCoeff ); @@ -977,7 +902,6 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons m_ctuAlternative[compID][ctuIdx] = bestAltIdx; costOn += bestAltCost; } -#endif m_CABACEstimator->getCtx() = AlfCtx( ctxTempStart ); m_CABACEstimator->resetBits(); @@ -1003,10 +927,6 @@ double EncAdaptiveLoopFilter::deriveCtbAlfEnableFlags( CodingStructure& cs, cons if( isChroma( channel ) ) { setEnableFlag(m_alfParamTemp, channel, m_ctuEnableFlag); -#if !JVET_O0491_HLS_CLEANUP - const int alfChromaIdc = m_alfParamTemp.enabledFlag[COMPONENT_Cb] * 2 + m_alfParamTemp.enabledFlag[COMPONENT_Cr]; - cost += lengthTruncatedUnary(alfChromaIdc, 3) * m_lambda[channel]; -#endif } return cost; @@ -1032,10 +952,8 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam, { m_alfParamTemp = alfParam; //1. get unfiltered distortion -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isChroma(channel) ) m_alfParamTemp.numAlternativesChroma = 1; -#endif double cost = getUnfilteredDistortion( m_alfCovarianceFrame[channel][iShapeIdx], channel ); cost /= 1.001; // slight preference for unfiltered choice @@ -1046,46 +964,30 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam, // no CABAC signalling ctxBest = AlfCtx( ctxStart ); setCtuEnableFlag( m_ctuEnableFlagTmp, channel, 0 ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isChroma(channel) ) setCtuAlternativeChroma( m_ctuAlternativeTmp, 0 ); -#endif } const int nonLinearFlagMax = -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB ( isLuma( channel ) ? m_encCfg->getUseNonLinearAlfLuma() : 0 ) // For Chroma non linear flag is check for each alternative filter -#else - ( isLuma( channel ) ? m_encCfg->getUseNonLinearAlfLuma() : m_encCfg->getUseNonLinearAlfChroma() ) -#endif ? 2 : 1; for( int nonLinearFlag = 0; nonLinearFlag < nonLinearFlagMax; nonLinearFlag++ ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for( int numAlternatives = isLuma( channel ) ? 1 : getMaxNumAlternativesChroma(); numAlternatives > 0; numAlternatives-- ) { if( isChroma( channel ) ) m_alfParamTemp.numAlternativesChroma = numAlternatives; -#endif //2. all CTUs are on setEnableFlag( m_alfParamTemp, channel, true ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isLuma( channel ) ) m_alfParamTemp.nonLinearFlag[channel][0] = nonLinearFlag; -#else - m_alfParamTemp.nonLinearFlag[channel] = nonLinearFlag; -#endif m_CABACEstimator->getCtx() = AlfCtx( ctxStart ); setCtuEnableFlag( m_ctuEnableFlag, channel, 1 ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB // all alternatives are on if( isChroma( channel ) ) initCtuAlternativeChroma( m_ctuAlternative ); cost = getFilterCoeffAndCost( cs, 0, channel, true, iShapeIdx, uiCoeffBits ); -#else - cost = getFilterCoeffAndCost( cs, 0, channel, nonLinearFlag != 0, iShapeIdx, uiCoeffBits ); -#endif if( cost < costMin ) { @@ -1094,22 +996,14 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam, copyAlfParam( alfParam, m_alfParamTemp, channel ); ctxBest = AlfCtx( m_CABACEstimator->getCtx() ); setCtuEnableFlag( m_ctuEnableFlagTmp, channel, 1 ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isChroma(channel) ) copyCtuAlternativeChroma( m_ctuAlternativeTmp, m_ctuAlternative ); -#endif } //3. CTU decision double distUnfilter = 0; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB double prevItCost = MAX_DOUBLE; -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const int iterNum = isLuma(channel) ? (2 * 4 + 1) : (2 * (2 + m_alfParamTemp.numAlternativesChroma - 1) + 1); -#else - const int iterNum = isLuma(channel) ? (2 * 4 + 1) : (2 * 2 + 1); -#endif for( int iter = 0; iter < iterNum; iter++ ) { @@ -1128,44 +1022,32 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam, costMin = cost; ctxBest = AlfCtx(m_CABACEstimator->getCtx()); copyCtuEnableFlag(m_ctuEnableFlagTmp, m_ctuEnableFlag, channel); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isChroma(channel) ) copyCtuAlternativeChroma( m_ctuAlternativeTmp, m_ctuAlternative ); -#endif copyAlfParam(alfParam, m_alfParamTemp, channel); } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB else if ( cost >= prevItCost ) { // High probability that we have converged or we are diverging break; } prevItCost = cost; -#endif } else { // unfiltered distortion is added due to some CTBs may not use filter -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB // no need to reset CABAC here, since uiCoeffBits is not affected /*cost = */getFilterCoeffAndCost( cs, distUnfilter, channel, true, iShapeIdx, uiCoeffBits ); -#else - cost = getFilterCoeffAndCost(cs, distUnfilter, channel, true, iShapeIdx, uiCoeffBits); -#endif } }//for iter // Decrease number of alternatives and reset ctu params and filters -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB } -#endif }// for nonLineaFlag }//for shapeIdx m_CABACEstimator->getCtx() = AlfCtx( ctxBest ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( isChroma(channel) ) copyCtuAlternativeChroma( m_ctuAlternative, m_ctuAlternativeTmp ); copyCtuEnableFlag( m_ctuEnableFlag, m_ctuEnableFlagTmp, channel ); -#endif } void EncAdaptiveLoopFilter::copyAlfParam( AlfParam& alfParamDst, AlfParam& alfParamSrc, ChannelType channel ) @@ -1176,15 +1058,10 @@ void EncAdaptiveLoopFilter::copyAlfParam( AlfParam& alfParamDst, AlfParam& alfPa } else { -#if !JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - alfParamDst.nonLinearFlag[channel] = alfParamSrc.nonLinearFlag[channel]; -#endif alfParamDst.enabledFlag[COMPONENT_Cb] = alfParamSrc.enabledFlag[COMPONENT_Cb]; alfParamDst.enabledFlag[COMPONENT_Cr] = alfParamSrc.enabledFlag[COMPONENT_Cr]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB alfParamDst.numAlternativesChroma = alfParamSrc.numAlternativesChroma; memcpy( alfParamDst.nonLinearFlag[CHANNEL_TYPE_CHROMA], alfParamSrc.nonLinearFlag[CHANNEL_TYPE_CHROMA], sizeof( alfParamDst.nonLinearFlag[CHANNEL_TYPE_CHROMA] ) ); -#endif memcpy( alfParamDst.chromaCoeff, alfParamSrc.chromaCoeff, sizeof( alfParamDst.chromaCoeff ) ); memcpy( alfParamDst.chromaClipp, alfParamSrc.chromaClipp, sizeof( alfParamDst.chromaClipp ) ); } @@ -1200,18 +1077,11 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double double dist = distUnfilter; uiCoeffBits = 0; -#if !JVET_O0491_HLS_CLEANUP - int uiSliceFlag = 0; -#endif AlfFilterShape& alfFilterShape = m_alfParamTemp.filterShapes[channel][iShapeIdx]; //get filter coeff if( isLuma( channel ) ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB std::fill_n(m_alfClipMerged[iShapeIdx][0][0], MAX_NUM_ALF_LUMA_COEFF*MAX_NUM_ALF_CLASSES*MAX_NUM_ALF_CLASSES, m_alfParamTemp.nonLinearFlag[channel][0] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); -#else - std::fill_n(m_alfClipMerged[iShapeIdx][0][0], MAX_NUM_ALF_LUMA_COEFF*MAX_NUM_ALF_CLASSES*MAX_NUM_ALF_CLASSES, m_alfParamTemp.nonLinearFlag[channel] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); -#endif // Reset Merge Tmp Cov m_alfCovarianceMerged[iShapeIdx][MAX_NUM_ALF_CLASSES].reset(AlfNumClippingValues[channel]); m_alfCovarianceMerged[iShapeIdx][MAX_NUM_ALF_CLASSES + 1].reset(AlfNumClippingValues[channel]); @@ -1221,16 +1091,6 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double else { //distortion -#if !JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - assert(alfFilterShape.numCoeff == m_alfCovarianceFrame[channel][iShapeIdx][0].numCoeff); - std::fill_n(m_filterClippSet[0], MAX_NUM_ALF_CHROMA_COEFF, m_alfParamTemp.nonLinearFlag[channel] ? AlfNumClippingValues[CHANNEL_TYPE_CHROMA] / 2 : 0); - dist += m_alfCovarianceFrame[channel][iShapeIdx][0].pixAcc + deriveCoeffQuant( m_filterClippSet[0], m_filterCoeffSet[0], m_alfCovarianceFrame[channel][iShapeIdx][0], alfFilterShape, m_NUM_BITS, m_alfParamTemp.nonLinearFlag[channel] ); -#endif -#if !JVET_O0491_HLS_CLEANUP - //setEnableFlag( m_alfParamTemp, channel, m_ctuEnableFlag ); - const int alfChromaIdc = m_alfParamTemp.enabledFlag[COMPONENT_Cb] * 2 + m_alfParamTemp.enabledFlag[COMPONENT_Cr]; -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for( int altIdx = 0; altIdx < m_alfParamTemp.numAlternativesChroma; ++altIdx ) { assert(alfFilterShape.numCoeff == m_alfCovarianceFrame[channel][iShapeIdx][altIdx].numCoeff); @@ -1267,32 +1127,14 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double } uiCoeffBits += lengthUvlc( m_alfParamTemp.numAlternativesChroma-1 ); uiCoeffBits += m_alfParamTemp.numAlternativesChroma; // non-linear flags -#if !JVET_O0491_HLS_CLEANUP - uiSliceFlag = lengthTruncatedUnary(alfChromaIdc, 3) - - lengthTruncatedUnary( 0, 3 ); // rate already put on Luma -#endif -#else - for( int i = 0; i < MAX_NUM_ALF_CHROMA_COEFF; i++ ) - { - m_alfParamTemp.chromaCoeff[i] = m_filterCoeffSet[0][i]; - m_alfParamTemp.chromaClipp[i] = m_filterClippSet[0][i]; - } - uiCoeffBits += getCoeffRate( m_alfParamTemp, true ); - uiSliceFlag = lengthTruncatedUnary(alfChromaIdc, 3); -#endif } if (onlyFilterCost) { return dist + m_lambda[channel] * uiCoeffBits; } -#if !JVET_O0491_HLS_CLEANUP - double rate = uiCoeffBits + uiSliceFlag; -#else double rate = uiCoeffBits; -#endif m_CABACEstimator->resetBits(); m_CABACEstimator->codeAlfCtuEnableFlags( cs, channel, &m_alfParamTemp); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for( int ctuIdx = 0; ctuIdx < m_numCTUsInPic; ctuIdx++ ) { if( isLuma( channel ) ) @@ -1304,159 +1146,31 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double } } m_CABACEstimator->codeAlfCtuAlternatives( cs, channel, &m_alfParamTemp ); -#endif rate += FRAC_BITS_SCALE * m_CABACEstimator->getEstFracBits(); return dist + m_lambda[channel] * rate; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB int EncAdaptiveLoopFilter::getChromaCoeffRate( AlfParam& alfParam, int altIdx ) -#else -int EncAdaptiveLoopFilter::getCoeffRate( AlfParam& alfParam, bool isChroma ) -#endif { int iBits = 0; -#if !JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - assert( isChroma ); -#endif AlfFilterShape alfShape(5); -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); - const int maxGolombIdx = AdaptiveLoopFilter::getMaxGolombIdx( alfShape.filterType ); - const int numFilters = 1; -#endif -#if !JVET_O0216_ALF_COEFF_EG3 - // vlc for all - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - int coeffVal = abs( alfParam.chromaCoeff[altIdx][i] ); -#else - int coeffVal = abs( alfParam.chromaCoeff[i] ); -#endif - - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k ); - } - } - - int kMin = getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); - - // Golomb parameters - iBits += lengthUvlc( kMin - 1 ); // "min_golomb_order" - int golombOrderIncreaseFlag = 0; - - for( int idx = 0; idx < maxGolombIdx; idx++ ) - { - golombOrderIncreaseFlag = ( m_kMinTab[idx] != kMin ) ? 1 : 0; - CHECK( !( m_kMinTab[idx] <= kMin + 1 ), "ALF Golomb parameter not consistent" ); - iBits += golombOrderIncreaseFlag; //golomb_order_increase_flag - kMin = m_kMinTab[idx]; - } -#endif // Filter coefficients for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0216_ALF_COEFF_EG3 -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB iBits += lengthGolomb( alfParam.chromaCoeff[altIdx][i], 3 ); // alf_coeff_chroma[altIdx][i] -#else - iBits += lengthGolomb( alfParam.chromaCoeff[i], 3 ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#endif -#else -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - iBits += lengthGolomb( alfParam.chromaCoeff[altIdx][i], m_kMinTab[alfShape.golombIdx[i]] ); // alf_coeff_chroma[altIdx][i] -#else - iBits += lengthGolomb( alfParam.chromaCoeff[i], m_kMinTab[alfShape.golombIdx[i]] ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#endif -#endif } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] ) -#else - if( m_alfParamTemp.nonLinearFlag[isChroma] ) -#endif { -#if JVET_O0064_SIMP_ALF_CLIP_CODING for (int i = 0; i < alfShape.numCoeff - 1; i++) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( !abs( alfParam.chromaCoeff[altIdx][i] ) ) -#else - if( !abs( alfParam.chromaCoeff[i] ) ) -#endif { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB alfParam.chromaClipp[altIdx][i] = 0; -#else - alfParam.chromaClipp[i] = 0; -#endif } } iBits += ((alfShape.numCoeff - 1) << 1); -#else - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); - // vlc for all - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - if( !abs( alfParam.chromaCoeff[altIdx][i] ) ) -#else - if( !abs( alfParam.chromaCoeff[i] ) ) -#endif - continue; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - int coeffVal = abs( alfParam.chromaClipp[altIdx][i] ); -#else - int coeffVal = abs( alfParam.chromaClipp[i] ); -#endif - - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k, false ); - } - } -#if JVET_O0216_ALF_COEFF_EG3 - int kMin = getGolombKMin(alfShape, numFilters, m_kMinTab, m_bitsCoeffScan); -#else - kMin = getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); -#endif - - // Golomb parameters - iBits += lengthUvlc( kMin - 1 ); // "min_golomb_order" -#if JVET_O0216_ALF_COEFF_EG3 - int golombOrderIncreaseFlag = 0; -#else - golombOrderIncreaseFlag = 0; -#endif - - for( int idx = 0; idx < maxGolombIdx; idx++ ) - { - golombOrderIncreaseFlag = ( m_kMinTab[idx] != kMin ) ? 1 : 0; - CHECK( !( m_kMinTab[idx] <= kMin + 1 ), "ALF Golomb parameter not consistent" ); - iBits += golombOrderIncreaseFlag; //golomb_order_increase_flag - kMin = m_kMinTab[idx]; - } - - // Filter coefficients - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - if( !abs( alfParam.chromaCoeff[altIdx][i] ) ) -#else - if( !abs( alfParam.chromaCoeff[i] ) ) -#endif - continue; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - iBits += lengthGolomb( alfParam.chromaClipp[altIdx][i], m_kMinTab[alfShape.golombIdx[i]], false ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#else - iBits += lengthGolomb( alfParam.chromaClipp[i], m_kMinTab[alfShape.golombIdx[i]], false ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#endif - } -#endif } return iBits; } @@ -1470,11 +1184,7 @@ double EncAdaptiveLoopFilter::getUnfilteredDistortion( AlfCovariance* cov, Chann } else { -#if !JVET_O0491_HLS_CLEANUP - dist = getUnfilteredDistortion( cov, 1 ) + lengthTruncatedUnary( 0, 3 ) * m_lambda[COMPONENT_Cb]; -#else dist = getUnfilteredDistortion( cov, 1 ); -#endif } return dist; } @@ -1509,11 +1219,7 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter static double errorForce0CoeffTab[MAX_NUM_ALF_CLASSES][2]; double cost, cost0, dist, distForce0, costMin = MAX_DOUBLE; -#if JVET_O0669_REMOVE_ALF_COEFF_PRED int coeffBits, coeffBitsForce0; -#else - int predMode = 0, bestPredMode = 0, coeffBits, coeffBitsForce0; -#endif mergeClasses( alfShape, covFrame, covMerged, clipMerged, MAX_NUM_ALF_CLASSES, m_filterIndices ); @@ -1522,11 +1228,7 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter dist = deriveFilterCoeffs(covFrame, covMerged, clipMerged, alfShape, m_filterIndices[numFilters - 1], numFilters, errorForce0CoeffTab, alfParam); // filter coeffs are stored in m_filterCoeffSet distForce0 = getDistForce0( alfShape, numFilters, errorForce0CoeffTab, codedVarBins ); -#if JVET_O0669_REMOVE_ALF_COEFF_PRED coeffBits = deriveFilterCoefficientsPredictionMode( alfShape, m_filterCoeffSet, m_diffFilterCoeff, numFilters ); -#else - coeffBits = deriveFilterCoefficientsPredictionMode( alfShape, m_filterCoeffSet, m_diffFilterCoeff, numFilters, predMode ); -#endif coeffBitsForce0 = getCostFilterCoeffForce0( alfShape, m_filterCoeffSet, numFilters, codedVarBins ); cost = dist + m_lambda[COMPONENT_Y] * coeffBits; @@ -1536,37 +1238,17 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter { cost = cost0; } -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if (alfParam.fixedFilterSetIndex > 0) - { - int len = 0; - len += getTBlength(alfParam.fixedFilterSetIndex - 1, NUM_FIXED_FILTER_SETS); - len += 1; //fixed filter flag pattern - if (alfParam.fixedFilterPattern > 0) - { - len += MAX_NUM_ALF_CLASSES; //"fixed_filter_flag" for each class - } - cost += m_lambda[COMPONENT_Y] * len; - } -#endif if( cost <= costMin ) { costMin = cost; numFiltersBest = numFilters; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - bestPredMode = predMode; -#endif } numFilters--; } dist = deriveFilterCoeffs( covFrame, covMerged, clipMerged, alfShape, m_filterIndices[numFiltersBest - 1], numFiltersBest, errorForce0CoeffTab, alfParam ); -#if JVET_O0669_REMOVE_ALF_COEFF_PRED coeffBits = deriveFilterCoefficientsPredictionMode( alfShape, m_filterCoeffSet, m_diffFilterCoeff, numFiltersBest ); -#else - coeffBits = deriveFilterCoefficientsPredictionMode( alfShape, m_filterCoeffSet, m_diffFilterCoeff, numFiltersBest, predMode ); -#endif distForce0 = getDistForce0( alfShape, numFiltersBest, errorForce0CoeffTab, codedVarBins ); coeffBitsForce0 = getCostFilterCoeffForce0( alfShape, m_filterCoeffSet, numFiltersBest, codedVarBins ); @@ -1580,9 +1262,6 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter distReturn = dist; alfParam.alfLumaCoeffDeltaFlag = 0; uiCoeffBits = coeffBits; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - alfParam.alfLumaCoeffDeltaPredictionFlag = bestPredMode; -#endif } else { @@ -1590,9 +1269,6 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter alfParam.alfLumaCoeffDeltaFlag = 1; uiCoeffBits = coeffBitsForce0; memcpy( alfParam.alfLumaCoeffFlag, codedVarBins, sizeof( codedVarBins ) ); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - alfParam.alfLumaCoeffDeltaPredictionFlag = 0; -#endif for( int varInd = 0; varInd < numFiltersBest; varInd++ ) { @@ -1608,18 +1284,7 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter { for( int i = 0; i < alfShape.numCoeff; i++ ) { -#if JVET_O0669_REMOVE_ALF_COEFF_PRED alfParam.lumaCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = m_filterCoeffSet[ind][i]; -#else - if( alfParam.alfLumaCoeffDeltaPredictionFlag ) - { - alfParam.lumaCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = m_diffFilterCoeff[ind][i]; - } - else - { - alfParam.lumaCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = m_filterCoeffSet[ind][i]; - } -#endif alfParam.lumaClipp[ind * MAX_NUM_ALF_LUMA_COEFF + i] = m_filterClippSet[ind][i]; } } @@ -1631,131 +1296,32 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfParam& alfParam, AlfFilter int EncAdaptiveLoopFilter::getNonFilterCoeffRate( AlfParam& alfParam ) { - int len = 1 // alf_coefficients_delta_flag -#if !JVET_O0491_HLS_CLEANUP - + lengthTruncatedUnary( 0, 3 ) // chroma_idc = 0, it is signalled when ALF is enabled for luma - + getTBlength( alfParam.numLumaFilters - 1, MAX_NUM_ALF_CLASSES ); //numLumaFilters +#if JVET_P0164_ALF_SYNTAX_SIMP + int len = 0 // alf_coefficients_delta_flag #else + int len = 1 // alf_coefficients_delta_flag +#endif + 2 // slice_alf_chroma_idc u(2) + lengthUvlc (alfParam.numLumaFilters - 1); // alf_luma_num_filters_signalled_minus1 ue(v) -#endif if( alfParam.numLumaFilters > 1 ) { -#if JVET_O0491_HLS_CLEANUP const int coeffLength = ceilLog2(alfParam.numLumaFilters); -#endif for( int i = 0; i < MAX_NUM_ALF_CLASSES; i++ ) { -#if !JVET_O0491_HLS_CLEANUP - len += getTBlength( (int)alfParam.filterCoeffDeltaIdx[i], alfParam.numLumaFilters ); //filter_coeff_delta[i] -#else len += coeffLength; // alf_luma_coeff_delta_idx u(v) -#endif } } -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - len++; //fixed filter set flag - if (alfParam.fixedFilterSetIndex > 0) - { - len += getTBlength(alfParam.fixedFilterSetIndex - 1, NUM_FIXED_FILTER_SETS); - len += 1; //fixed filter flag pattern - if (alfParam.fixedFilterPattern > 0) - len += MAX_NUM_ALF_CLASSES; //"fixed_filter_flag" for each class - } -#endif return len; } -#if !JVET_O0491_HLS_CLEANUP -int EncAdaptiveLoopFilter::lengthTruncatedUnary( int symbol, int maxSymbol ) -{ - if( maxSymbol == 0 ) - { - return 0; - } - - bool codeLast = ( maxSymbol > symbol ); - int numBins = 0; - while( symbol-- ) - { - numBins++; - } - if( codeLast ) - { - numBins++; - } - - return numBins; -} - -int EncAdaptiveLoopFilter::getTBlength( int uiSymbol, const int uiMaxSymbol ) -{ - int uiThresh; - if( uiMaxSymbol > 256 ) - { - int uiThreshVal = 1 << 8; - uiThresh = 8; - while( uiThreshVal <= uiMaxSymbol ) - { - uiThresh++; - uiThreshVal <<= 1; - } - uiThresh--; - } - else - { - uiThresh = g_tbMax[uiMaxSymbol]; - } - - int uiVal = 1 << uiThresh; - assert( uiVal <= uiMaxSymbol ); - assert( ( uiVal << 1 ) > uiMaxSymbol ); - assert( uiSymbol < uiMaxSymbol ); - int b = uiMaxSymbol - uiVal; - assert( b < uiVal ); - if( uiSymbol < uiVal - b ) - { - return uiThresh; - } - else - { - return uiThresh + 1; - } -} -#endif int EncAdaptiveLoopFilter::getCostFilterCoeffForce0( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters, bool* codedVarBins ) { -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - const int maxGolombIdx = getMaxGolombIdx( alfShape.filterType ); - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); -#endif -#if JVET_O0216_ALF_COEFF_EG3 - int len = numFilters; //filter_coefficient_flag[i] +#if JVET_P0164_ALF_SYNTAX_SIMP + int len = 0; #else - for( int ind = 0; ind < numFilters; ++ind ) - { - if( !codedVarBins[ind] ) - { - continue; - } - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - int coeffVal = abs( pDiffQFilterCoeffIntPP[ind][i] ); - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k ); - } - } - } - - int kMin = getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); - - // Coding parameters - int len = kMin //min_golomb_order - + maxGolombIdx //golomb_order_increase_flag - + numFilters; //filter_coefficient_flag[i] + int len = numFilters; //filter_coefficient_flag[i] #endif // Filter coefficients for( int ind = 0; ind < numFilters; ++ind ) @@ -1764,159 +1330,50 @@ int EncAdaptiveLoopFilter::getCostFilterCoeffForce0( AlfFilterShape& alfShape, i { for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0216_ALF_COEFF_EG3 len += lengthGolomb( abs( pDiffQFilterCoeffIntPP[ind][i] ), 3 ); // alf_coeff_luma_delta[i][j] -#else - len += lengthGolomb( abs( pDiffQFilterCoeffIntPP[ind][i] ), m_kMinTab[alfShape.golombIdx[i]] ); // alf_coeff_luma_delta[i][j] -#endif } } - } - -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) -#else - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ) -#endif - { -#if JVET_O0064_SIMP_ALF_CLIP_CODING - for (int ind = 0; ind < numFilters; ++ind) +#if JVET_P0164_ALF_SYNTAX_SIMP + else { for (int i = 0; i < alfShape.numCoeff - 1; i++) { - if (!abs(pDiffQFilterCoeffIntPP[ind][i])) - { - m_filterClippSet[ind][i] = 0; - } - len += 2; - } - } -#else - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); - - for( int ind = 0; ind < numFilters; ++ind ) - { - if( !codedVarBins[ind] ) - { - continue; - } - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( pDiffQFilterCoeffIntPP[ind][i] ) ) - continue; - int coeffVal = abs( m_filterClippSet[ind][i] ); - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k, false ); - } - } - } -#if JVET_O0216_ALF_COEFF_EG3 - int kMin = getGolombKMin(alfShape, numFilters, m_kMinTab, m_bitsCoeffScan); -#else - kMin = getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); -#endif - - // Coding parameters - len += kMin //min_golomb_order - + maxGolombIdx //golomb_order_increase_flag - ; - - // Filter coefficients - for( int ind = 0; ind < numFilters; ++ind ) - { - if( codedVarBins[ind] ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( pDiffQFilterCoeffIntPP[ind][i] ) ) - continue; - len += lengthGolomb( abs( m_filterClippSet[ind][i] ), m_kMinTab[alfShape.golombIdx[i]], false ); // alf_coeff_luma_delta[i][j] - } + len += lengthGolomb(0, 3); // alf_coeff_luma_delta[i][j] } } #endif } - return len; -} - -#if JVET_O0669_REMOVE_ALF_COEFF_PRED -int EncAdaptiveLoopFilter::deriveFilterCoefficientsPredictionMode( AlfFilterShape& alfShape, int **filterSet, int** filterCoeffDiff, const int numFilters ) -{ - return (m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? getCostFilterClipp(alfShape, filterSet, numFilters) : 0) + getCostFilterCoeff(alfShape, filterSet, numFilters); -#else -int EncAdaptiveLoopFilter::deriveFilterCoefficientsPredictionMode( AlfFilterShape& alfShape, int **filterSet, int** filterCoeffDiff, const int numFilters, int& predMode ) -{ - int ratePredMode0 = getCostFilterCoeff( alfShape, filterSet, numFilters ); - - for( int ind = 0; ind < numFilters; ++ind ) - { - if( ind == 0 ) - { - memcpy( filterCoeffDiff[ind], filterSet[ind], sizeof( int ) * alfShape.numCoeff ); - } - else - { - for( int i = 0; i < alfShape.numCoeff; i++ ) - { - filterCoeffDiff[ind][i] = filterSet[ind][i] - filterSet[ind - 1][i]; - } - } - } - - int ratePredMode1 = getCostFilterCoeff( alfShape, filterCoeffDiff, numFilters ); - - predMode = ( ratePredMode1 < ratePredMode0 && numFilters > 1 ) ? 1 : 0; - -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - int rateClipp = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? getCostFilterClipp( alfShape, filterSet, numFilters ) : 0; -#else - int rateClipp = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? getCostFilterClipp( alfShape, filterSet, numFilters ) : 0; -#endif - - return ( numFilters > 1 ? 1 : 0 ) // coeff_delta_pred_mode_flag - + rateClipp - + ( predMode ? ratePredMode1 : ratePredMode0 ); // min_golomb_order, golomb_order_increase_flag, alf_coeff_luma_delta -#endif -} - -int EncAdaptiveLoopFilter::getCostFilterCoeff( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters ) -{ -#if JVET_O0216_ALF_COEFF_EG3 - return lengthFilterCoeffs( alfShape, numFilters, pDiffQFilterCoeffIntPP ); // alf_coeff_luma_delta[i][j]; -#else - const int maxGolombIdx = getMaxGolombIdx( alfShape.filterType ); - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); - - for( int ind = 0; ind < numFilters; ++ind ) + if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) + for (int ind = 0; ind < numFilters; ++ind) { - int coeffVal = abs( pDiffQFilterCoeffIntPP[ind][i] ); - for( int k = 1; k < 15; k++ ) + for (int i = 0; i < alfShape.numCoeff - 1; i++) { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k ); + if (!abs(pDiffQFilterCoeffIntPP[ind][i])) + { + m_filterClippSet[ind][i] = 0; + } + len += 2; } } } - int kMin = getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); - - // Coding parameters - int len = kMin //min_golomb_order - + maxGolombIdx; //golomb_order_increase_flag + return len; +} - // Filter coefficients - len += lengthFilterCoeffs( alfShape, numFilters, pDiffQFilterCoeffIntPP, m_kMinTab ); // alf_coeff_luma_delta[i][j] +int EncAdaptiveLoopFilter::deriveFilterCoefficientsPredictionMode( AlfFilterShape& alfShape, int **filterSet, int** filterCoeffDiff, const int numFilters ) +{ + return (m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? getCostFilterClipp(alfShape, filterSet, numFilters) : 0) + getCostFilterCoeff(alfShape, filterSet, numFilters); +} - return len; -#endif +int EncAdaptiveLoopFilter::getCostFilterCoeff( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters ) +{ + return lengthFilterCoeffs( alfShape, numFilters, pDiffQFilterCoeffIntPP ); // alf_coeff_luma_delta[i][j]; } int EncAdaptiveLoopFilter::getCostFilterClipp( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters ) { -#if JVET_O0064_SIMP_ALF_CLIP_CODING for (int filterIdx = 0; filterIdx < numFilters; ++filterIdx) { for (int i = 0; i < alfShape.numCoeff - 1; i++) @@ -1928,35 +1385,9 @@ int EncAdaptiveLoopFilter::getCostFilterClipp( AlfFilterShape& alfShape, int **p } } return (numFilters * (alfShape.numCoeff - 1)) << 1; -#else - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); - - for( int filterIdx = 0; filterIdx < numFilters; ++filterIdx ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( pDiffQFilterCoeffIntPP[filterIdx][i] ) ) - continue; - int clippVal = abs( m_filterClippSet[filterIdx][i] ); - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( clippVal, k ); - } - } - } - - int len = getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); - return len //min_golomb_order - + getMaxGolombIdx( alfShape.filterType ) //golomb_order_increase_flag - + lengthFilterClipps( alfShape, numFilters, pDiffQFilterCoeffIntPP, m_kMinTab ); // Filter clippings -#endif } -#if JVET_O0216_ALF_COEFF_EG3 int EncAdaptiveLoopFilter::lengthFilterCoeffs( AlfFilterShape& alfShape, const int numFilters, int **FilterCoeff ) -#else -int EncAdaptiveLoopFilter::lengthFilterCoeffs( AlfFilterShape& alfShape, const int numFilters, int **FilterCoeff, int* kMinTab ) -#endif { int bitCnt = 0; @@ -1964,75 +1395,34 @@ int EncAdaptiveLoopFilter::lengthFilterCoeffs( AlfFilterShape& alfShape, const i { for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0216_ALF_COEFF_EG3 bitCnt += lengthGolomb( abs( FilterCoeff[ind][i] ), 3 ); -#else - bitCnt += lengthGolomb( abs( FilterCoeff[ind][i] ), kMinTab[alfShape.golombIdx[i]] ); -#endif } } return bitCnt; } -#if !JVET_O0064_SIMP_ALF_CLIP_CODING -int EncAdaptiveLoopFilter::lengthFilterClipps( AlfFilterShape& alfShape, const int numFilters, int **FilterCoeff, int* kMinTab ) -{ - int bitCnt = 0; - - for( int ind = 0; ind < numFilters; ++ind ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( FilterCoeff[ind][i] ) ) - continue; - bitCnt += lengthGolomb( abs( m_filterClippSet[ind][i] ), kMinTab[alfShape.golombIdx[i]], false ); - } - } - return bitCnt; -} -#endif double EncAdaptiveLoopFilter::getDistForce0( AlfFilterShape& alfShape, const int numFilters, double errorTabForce0Coeff[MAX_NUM_ALF_CLASSES][2], bool* codedVarBins ) { static int bitsVarBin[MAX_NUM_ALF_CLASSES]; -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); -#endif -#if !JVET_O0216_ALF_COEFF_EG3 - for( int ind = 0; ind < numFilters; ++ind ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - int coeffVal = abs( m_filterCoeffSet[ind][i] ); - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k ); - } - } - } - - getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); -#endif for( int ind = 0; ind < numFilters; ++ind ) { bitsVarBin[ind] = 0; for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0216_ALF_COEFF_EG3 bitsVarBin[ind] += lengthGolomb( abs( m_filterCoeffSet[ind][i] ), 3 ); -#else - bitsVarBin[ind] += lengthGolomb( abs( m_filterCoeffSet[ind][i] ), m_kMinTab[alfShape.golombIdx[i]] ); -#endif } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) -#else - if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ) +#if JVET_P0164_ALF_SYNTAX_SIMP + static int zeroBitsVarBin = 0; + for (int i = 0; i < alfShape.numCoeff - 1; i++) + { + zeroBitsVarBin += lengthGolomb(0, 3); + } #endif -#if JVET_O0064_SIMP_ALF_CLIP_CODING + if( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) { for (int ind = 0; ind < numFilters; ++ind) { @@ -2045,100 +1435,31 @@ double EncAdaptiveLoopFilter::getDistForce0( AlfFilterShape& alfShape, const int } } } -#else - { - memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) ); - for( int ind = 0; ind < numFilters; ++ind ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( m_filterCoeffSet[ind][i] ) ) - continue; - int coeffVal = abs( m_filterClippSet[ind][i] ); - for( int k = 1; k < 15; k++ ) - { - m_bitsCoeffScan[alfShape.golombIdx[i]][k] += lengthGolomb( coeffVal, k, false ); - } - } - } - - getGolombKMin( alfShape, numFilters, m_kMinTab, m_bitsCoeffScan ); - - for( int ind = 0; ind < numFilters; ++ind ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( m_filterCoeffSet[ind][i] ) ) - continue; - bitsVarBin[ind] += lengthGolomb( abs( m_filterClippSet[ind][i] ), m_kMinTab[alfShape.golombIdx[i]], false ); - } - } - } -#endif +#if JVET_P0164_ALF_SYNTAX_SIMP + double distForce0 = getDistCoeffForce0( codedVarBins, errorTabForce0Coeff, bitsVarBin, zeroBitsVarBin, numFilters); +#else double distForce0 = getDistCoeffForce0( codedVarBins, errorTabForce0Coeff, bitsVarBin, numFilters ); +#endif return distForce0; } -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING -int EncAdaptiveLoopFilter::getGolombKMin( AlfFilterShape& alfShape, const int numFilters, int kMinTab[MAX_NUM_ALF_LUMA_COEFF], int bitsCoeffScan[m_MAX_SCAN_VAL][m_MAX_EXP_GOLOMB] ) -{ - int kStart; - const int maxGolombIdx = getMaxGolombIdx( alfShape.filterType ); - - int minBitsKStart = MAX_INT; - int minKStart = -1; - - for( int k = 1; k < 8; k++ ) - { - int bitsKStart = 0; kStart = k; - for( int scanPos = 0; scanPos < maxGolombIdx; scanPos++ ) - { - int kMin = kStart; - int minBits = bitsCoeffScan[scanPos][kMin]; - - if( bitsCoeffScan[scanPos][kStart + 1] < minBits ) - { - kMin = kStart + 1; - minBits = bitsCoeffScan[scanPos][kMin]; - } - kStart = kMin; - bitsKStart += minBits; - } - if( bitsKStart < minBitsKStart ) - { - minBitsKStart = bitsKStart; - minKStart = k; - } - } - - kStart = minKStart; - for( int scanPos = 0; scanPos < maxGolombIdx; scanPos++ ) - { - int kMin = kStart; - int minBits = bitsCoeffScan[scanPos][kMin]; - - if( bitsCoeffScan[scanPos][kStart + 1] < minBits ) - { - kMin = kStart + 1; - minBits = bitsCoeffScan[scanPos][kMin]; - } - - kMinTab[scanPos] = kMin; - kStart = kMin; - } - - return minKStart; -} -#endif +#if JVET_P0164_ALF_SYNTAX_SIMP +double EncAdaptiveLoopFilter::getDistCoeffForce0( bool* codedVarBins, double errorForce0CoeffTab[MAX_NUM_ALF_CLASSES][2], int* bitsVarBin, int zeroBitsVarBin, const int numFilters) +#else double EncAdaptiveLoopFilter::getDistCoeffForce0( bool* codedVarBins, double errorForce0CoeffTab[MAX_NUM_ALF_CLASSES][2], int* bitsVarBin, const int numFilters ) +#endif { double distForce0 = 0; std::memset( codedVarBins, 0, sizeof( *codedVarBins ) * MAX_NUM_ALF_CLASSES ); for( int filtIdx = 0; filtIdx < numFilters; filtIdx++ ) { +#if JVET_P0164_ALF_SYNTAX_SIMP + double costDiff = (errorForce0CoeffTab[filtIdx][0] + m_lambda[COMPONENT_Y] * zeroBitsVarBin) - (errorForce0CoeffTab[filtIdx][1] + m_lambda[COMPONENT_Y] * bitsVarBin[filtIdx]); +#else double costDiff = errorForce0CoeffTab[filtIdx][0] - ( errorForce0CoeffTab[filtIdx][1] + m_lambda[COMPONENT_Y] * bitsVarBin[filtIdx] ); +#endif codedVarBins[filtIdx] = costDiff > 0 ? true : false; distForce0 += errorForce0CoeffTab[filtIdx][codedVarBins[filtIdx] ? 1 : 0]; } @@ -2185,67 +1506,6 @@ double EncAdaptiveLoopFilter::deriveFilterCoeffs( AlfCovariance* cov, AlfCovaria double error = 0.0; AlfCovariance& tmpCov = covMerged[MAX_NUM_ALF_CLASSES]; -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - alfParam.fixedFilterSetIndex = 0; - AlfCovariance& tmpCovFf = covMerged[MAX_NUM_ALF_CLASSES + 1]; - double factor = 1 << (m_NUM_BITS - 1); - double errorMin = 0; - double errorMinPerClass[MAX_NUM_ALF_CLASSES] = { 0 }; - double errorCurSetPerClass[MAX_NUM_ALF_CLASSES] = { 0 }; - int fixedFilterFlagPerClass[MAX_NUM_ALF_CLASSES] = { 0 }; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - if (!alfParam.nonLinearFlag[CHANNEL_TYPE_LUMA][0]) -#else - if (!alfParam.nonLinearFlag[CHANNEL_TYPE_LUMA]) -#endif - { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB -#else - alfParam.fixedFilterSetIndex = 0; -#endif - for (int filterSetIdx = 0; filterSetIdx < NUM_FIXED_FILTER_SETS; filterSetIdx++) - { - double errorCur = 0; - for (int classIdx = 0; classIdx < MAX_NUM_ALF_CLASSES; classIdx++) - { - int fixedFilterIdx = m_classToFilterMapping[filterSetIdx][classIdx]; - errorCurSetPerClass[classIdx] = cov[classIdx].calcErrorForCoeffs(clipMerged[numFilters - 1][filterIndices[classIdx]], m_fixedFilterSetCoeff[fixedFilterIdx], MAX_NUM_ALF_LUMA_COEFF, m_NUM_BITS); - - if (errorCurSetPerClass[classIdx] >= 0) - { - errorCurSetPerClass[classIdx] = 0; - fixedFilterFlagPerClass[classIdx] = 0; - } - else - { - errorCur += errorCurSetPerClass[classIdx]; - fixedFilterFlagPerClass[classIdx] = 1; - } - } - - if (errorCur < errorMin) - { - memcpy(alfParam.fixedFilterIdx, fixedFilterFlagPerClass, sizeof(fixedFilterFlagPerClass)); - alfParam.fixedFilterSetIndex = filterSetIdx + 1; - errorMin = errorCur; - std::memcpy(errorMinPerClass, errorCurSetPerClass, sizeof(errorMinPerClass)); - } - } - - alfParam.fixedFilterPattern = 0; - if (alfParam.fixedFilterSetIndex > 0) - { - for (int classIdx = 0; classIdx < MAX_NUM_ALF_CLASSES; classIdx++) - { - if (alfParam.fixedFilterIdx[classIdx] == 0) - { - alfParam.fixedFilterPattern = 1; - break; - } - } - } - } -#endif for( int filtIdx = 0; filtIdx < numFilters; filtIdx++ ) @@ -2256,34 +1516,7 @@ double EncAdaptiveLoopFilter::deriveFilterCoeffs( AlfCovariance* cov, AlfCovaria { if( filterIndices[classIdx] == filtIdx ) { -#if JVET_O0669_REMOVE_ALF_COEFF_PRED tmpCov += cov[classIdx]; -#else - //adjust stat - tmpCovFf = cov[classIdx]; - if (alfParam.fixedFilterSetIndex > 0 && alfParam.fixedFilterIdx[classIdx] > 0 -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB - && alfParam.nonLinearFlag[CHANNEL_TYPE_LUMA][0] == false -#else - && alfParam.nonLinearFlag[CHANNEL_TYPE_LUMA] == false -#endif - ) - { - int fixedFilterIdx = m_classToFilterMapping[alfParam.fixedFilterSetIndex - 1][classIdx]; - tmpCovFf.pixAcc += errorMinPerClass[classIdx]; - for (int i = 0; i < MAX_NUM_ALF_LUMA_COEFF; i++) - { - double sum = 0; - for (int j = 0; j < MAX_NUM_ALF_LUMA_COEFF; j++) - { - sum += tmpCovFf.E[clipMerged[numFilters - 1][classIdx][i]][clipMerged[numFilters - 1][classIdx][j]][i][j] * m_fixedFilterSetCoeff[fixedFilterIdx][j]; - } - sum /= factor; - tmpCovFf.y[clipMerged[numFilters - 1][classIdx][i]][i] -= sum; - } - } - tmpCov += tmpCovFf; -#endif if( !found_clip ) { found_clip = true; // clip should be at the adress of shortest one @@ -2385,33 +1618,20 @@ void EncAdaptiveLoopFilter::mergeClasses( const AlfFilterShape& alfShape, AlfCov indexList[i] = i; availableClass[i] = true; covMerged[i] = cov[i]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB covMerged[i].numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#else - covMerged[i].numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#endif } // Try merging different covariance matrices // temporal AlfCovariance structure is allocated as the last element in covMerged array, the size of covMerged is MAX_NUM_ALF_CLASSES + 1 AlfCovariance& tmpCov = covMerged[MAX_NUM_ALF_CLASSES]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB tmpCov.numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#else - tmpCov.numBins = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? AlfNumClippingValues[COMPONENT_Y] : 1; -#endif // init Clip for( int i = 0; i < numClasses; i++ ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB std::fill_n(clipMerged[numRemaining-1][i], MAX_NUM_ALF_LUMA_COEFF, m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); if ( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ) -#else - std::fill_n(clipMerged[numRemaining-1][i], MAX_NUM_ALF_LUMA_COEFF, m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? AlfNumClippingValues[CHANNEL_TYPE_LUMA] / 2 : 0); - if ( m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ) -#endif { err[i] = covMerged[i].optimizeFilterClip( alfShape, clipMerged[numRemaining-1][i] ); } @@ -2442,11 +1662,7 @@ void EncAdaptiveLoopFilter::mergeClasses( const AlfFilterShape& alfShape, AlfCov { tmpClip[l] = (clipMerged[numRemaining-1][i][l] + clipMerged[numRemaining-1][j][l] + 1 ) >> 1; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB double errorMerged = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] ? tmpCov.optimizeFilterClip( alfShape, tmpClip ) : tmpCov.calculateError( tmpClip ); -#else - double errorMerged = m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] ? tmpCov.optimizeFilterClip( alfShape, tmpClip ) : tmpCov.calculateError( tmpClip ); -#endif double error = errorMerged - error1 - error2; if( error < errorMin ) @@ -2516,7 +1732,6 @@ void EncAdaptiveLoopFilter::mergeClasses( const AlfFilterShape& alfShape, AlfCov void EncAdaptiveLoopFilter::getFrameStats( ChannelType channel, int iShapeIdx ) { int numClasses = isLuma( channel ) ? MAX_NUM_ALF_CLASSES : 1; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB int numAlternatives = isLuma( channel ) ? 1 : m_alfParamTemp.numAlternativesChroma; // When calling this function m_ctuEnableFlag shall be set to 0 for CTUs using alternative APS // Here we compute frame stats for building new alternative filters @@ -2536,30 +1751,10 @@ void EncAdaptiveLoopFilter::getFrameStats( ChannelType channel, int iShapeIdx ) getFrameStat( m_alfCovarianceFrame[CHANNEL_TYPE_CHROMA][iShapeIdx], m_alfCovariance[COMPONENT_Cr][iShapeIdx], m_ctuEnableFlag[COMPONENT_Cr], m_ctuAlternative[COMPONENT_Cr], numClasses, altIdx ); } } -#else - for( int i = 0; i < numClasses; i++ ) - { - m_alfCovarianceFrame[channel][iShapeIdx][i].reset(AlfNumClippingValues[channel]); - } - if( isLuma( channel ) ) - { - getFrameStat( m_alfCovarianceFrame[CHANNEL_TYPE_LUMA][iShapeIdx], m_alfCovariance[COMPONENT_Y][iShapeIdx], m_ctuEnableFlag[COMPONENT_Y], numClasses ); - } - else - { - getFrameStat( m_alfCovarianceFrame[CHANNEL_TYPE_CHROMA][iShapeIdx], m_alfCovariance[COMPONENT_Cb][iShapeIdx], m_ctuEnableFlag[COMPONENT_Cb], numClasses ); - getFrameStat( m_alfCovarianceFrame[CHANNEL_TYPE_CHROMA][iShapeIdx], m_alfCovariance[COMPONENT_Cr][iShapeIdx], m_ctuEnableFlag[COMPONENT_Cr], numClasses ); - } -#endif } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void EncAdaptiveLoopFilter::getFrameStat( AlfCovariance* frameCov, AlfCovariance** ctbCov, uint8_t* ctbEnableFlags, uint8_t* ctbAltIdx, const int numClasses, int altIdx ) -#else -void EncAdaptiveLoopFilter::getFrameStat( AlfCovariance* frameCov, AlfCovariance** ctbCov, uint8_t* ctbEnableFlags, const int numClasses ) -#endif { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const ChannelType channel = (!ctbAltIdx ? CHANNEL_TYPE_LUMA : CHANNEL_TYPE_CHROMA); for( int ctuIdx = 0; ctuIdx < m_numCTUsInPic; ctuIdx++ ) { @@ -2574,18 +1769,6 @@ void EncAdaptiveLoopFilter::getFrameStat( AlfCovariance* frameCov, AlfCovariance } } } -#else - for( int i = 0; i < m_numCTUsInPic; i++ ) - { - if( ctbEnableFlags[i] ) - { - for( int j = 0; j < numClasses; j++ ) - { - frameCov[j] += ctbCov[i][j]; - } - } - } -#endif } void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnitBuf& recYuv, CodingStructure& cs ) @@ -2616,23 +1799,15 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit for( int channelIdx = 0; channelIdx < numberOfChannels; channelIdx++ ) { const ChannelType channelID = ChannelType( channelIdx ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const int numAlts = channelID == CHANNEL_TYPE_LUMA ? 1 : MAX_NUM_ALF_ALTERNATIVES_CHROMA; -#endif const int numClasses = isLuma( channelID ) ? MAX_NUM_ALF_CLASSES : 1; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for( int altIdx = 0; altIdx < numAlts; ++altIdx ) -#endif for( int shape = 0; shape != m_filterShapes[channelIdx].size(); shape++ ) { for( int classIdx = 0; classIdx < numClasses; classIdx++ ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfCovarianceFrame[channelIdx][shape][isLuma( channelID ) ? classIdx : altIdx].reset(AlfNumClippingValues[channelID]); -#else - m_alfCovarianceFrame[channelIdx][shape][classIdx].reset(AlfNumClippingValues[channelID]); -#endif } } } @@ -2743,11 +1918,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit for( int classIdx = 0; classIdx < numClasses; classIdx++ ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfCovarianceFrame[chType][shape][isLuma( compID ) ? classIdx : 0] += m_alfCovariance[compIdx][shape][ctuRsAddr][classIdx]; -#else - m_alfCovarianceFrame[chType][shape][classIdx] += m_alfCovariance[compIdx][shape][ctuRsAddr][classIdx]; -#endif } } } @@ -2784,11 +1955,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit for( int classIdx = 0; classIdx < numClasses; classIdx++ ) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfCovarianceFrame[chType][shape][isLuma( compID ) ? classIdx : 0] += m_alfCovariance[compIdx][shape][ctuRsAddr][classIdx]; -#else - m_alfCovarianceFrame[chType][shape][classIdx] += m_alfCovariance[compIdx][shape][ctuRsAddr][classIdx]; -#endif } } } @@ -3186,28 +2353,16 @@ void EncAdaptiveLoopFilter::setCtuEnableFlag( uint8_t** ctuFlags, ChannelType ch std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, int &newApsId) { APS** apss = cs.slice->getAlfAPSs(); -#if JVET_O_MAX_NUM_ALF_APS_8 for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) -#else - for (int i = 0; i < MAX_NUM_APS; i++) -#endif { apss[i] = m_apsMap->getPS((i << NUM_APS_TYPE_LEN) + ALF_APS); } std::vector<int> result; int apsIdChecked = 0, curApsId = m_apsIdStart; -#if JVET_O_MAX_NUM_ALF_APS_8 if (curApsId < ALF_CTB_MAX_NUM_APS) -#else - if (curApsId < int(MAX_NUM_APS)) -#endif { -#if JVET_O_MAX_NUM_ALF_APS_8 while (apsIdChecked < ALF_CTB_MAX_NUM_APS && !cs.slice->isIntra() && result.size() < ALF_CTB_MAX_NUM_APS && !cs.slice->getPendingRasInit() && !cs.slice->isIDRorBLA()) -#else - while (apsIdChecked < MAX_NUM_APS && !cs.slice->isIntra() && result.size() < (ALF_CTB_MAX_NUM_APS - 1) && !cs.slice->getPendingRasInit() && !cs.slice->isIDRorBLA()) -#endif { APS* curAPS = cs.slice->getAlfAPSs()[curApsId]; if (curAPS && curAPS->getTemporalId() <= cs.slice->getTLayer() && curAPS->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA]) @@ -3215,11 +2370,7 @@ std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, i result.push_back(curApsId); } apsIdChecked++; -#if JVET_O_MAX_NUM_ALF_APS_8 curApsId = (curApsId + 1) % ALF_CTB_MAX_NUM_APS; -#else - curApsId = (curApsId + 1) % MAX_NUM_APS; -#endif } } cs.slice->setTileGroupNumAps((int)result.size()); @@ -3227,17 +2378,9 @@ std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, i newApsId = m_apsIdStart - 1; if (newApsId < 0) { -#if JVET_O_MAX_NUM_ALF_APS_8 newApsId = ALF_CTB_MAX_NUM_APS - 1; -#else - newApsId = (int)MAX_NUM_APS - 1; -#endif } -#if JVET_O_MAX_NUM_ALF_APS_8 CHECK(newApsId >= ALF_CTB_MAX_NUM_APS, "Wrong APS index assignment in getAvaiApsIdsLuma"); -#else - CHECK(newApsId >= (int)MAX_NUM_APS, "Wrong APS index assignment in getAvaiApsIdsLuma"); -#endif return result; } void EncAdaptiveLoopFilter::initDistortion() @@ -3260,10 +2403,8 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar TempCtx ctxBest(m_CtxCache); TempCtx ctxTempStart(m_CtxCache); TempCtx ctxTempBest(m_CtxCache); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB TempCtx ctxTempAltStart( m_CtxCache ); TempCtx ctxTempAltBest( m_CtxCache ); -#endif AlfParam alfParamNewFiltersBest = alfParamNewFilters; APS** apss = cs.slice->getAlfAPSs(); short* alfCtbFilterSetIndex = cs.picture->getAlfCtbFilterIndex(); @@ -3271,9 +2412,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar initDistortion(); //luma -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfParamTemp = alfParamNewFilters; -#endif setCtuEnableFlag(m_ctuEnableFlag, CHANNEL_TYPE_LUMA, 1); getFrameStats(CHANNEL_TYPE_LUMA, 0); setCtuEnableFlag(m_ctuEnableFlag, CHANNEL_TYPE_LUMA, 0); @@ -3304,12 +2443,10 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar int numIter = useNewFilter ? 2 : 1; for (int numTemporalAps = 0; numTemporalAps <= apsIds.size(); numTemporalAps++) { -#if JVET_O_MAX_NUM_ALF_APS_8 if (numTemporalAps + useNewFilter >= ALF_CTB_MAX_NUM_APS) { continue; } -#endif cs.slice->setTileGroupNumAps(numTemporalAps + useNewFilter); int numFilterSet = NUM_FIXED_FILTER_SETS + numTemporalAps + useNewFilter; if (numTemporalAps == apsIds.size() && numTemporalAps > 0 && useNewFilter && newApsId == apsIds.back()) //last temporalAPS is occupied by new filter set and this temporal APS becomes unavailable @@ -3320,11 +2457,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar { m_alfParamTemp = alfParamNewFilters; m_alfParamTemp.enabledFlag[CHANNEL_TYPE_LUMA] = true; -#if JVET_O_MAX_NUM_ALF_APS_8 double curCost = 3 * m_lambda[CHANNEL_TYPE_LUMA]; -#else - double curCost = getTBlength(numTemporalAps + useNewFilter, ALF_CTB_MAX_NUM_APS + 1) * m_lambda[CHANNEL_TYPE_LUMA]; -#endif if (iter > 0) //re-derive new filter-set { double dDistOrgNewFilter = 0; @@ -3356,11 +2489,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar { int bitNL[2] = { 0, 0 }; double errNL[2] = { 0.0, 0.0 }; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] = 1; -#else - m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] = 1; -#endif if (m_encCfg->getUseNonLinearAlfLuma()) { errNL[1] = getFilterCoeffAndCost(cs, 0, CHANNEL_TYPE_LUMA, true, 0, bitNL[1], true); @@ -3370,11 +2499,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar { errNL[1] = MAX_DOUBLE; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA][0] = 0; -#else - m_alfParamTemp.nonLinearFlag[CHANNEL_TYPE_LUMA] = 0; -#endif errNL[0] = getFilterCoeffAndCost(cs, 0, CHANNEL_TYPE_LUMA, true, 0, bitNL[0], true); int bitsNewFilterTempLuma = bitNL[0]; @@ -3483,19 +2608,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar curCost += costOff; } } //for(ctbIdx) -#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL -#if JVET_O_MAX_NUM_ALF_APS_8 int tmpBits = bitsNewFilter + 3 * (numFilterSet - NUM_FIXED_FILTER_SETS); -#else - int tmpBits = bitsNewFilter + 5 * (numFilterSet - NUM_FIXED_FILTER_SETS) + getTBlength(numFilterSet - NUM_FIXED_FILTER_SETS, ALF_CTB_MAX_NUM_APS + 1); -#endif -#else -#if JVET_O_MAX_NUM_ALF_APS_8 - int tmpBits = bitsNewFilter + 3 * (numFilterSet - NUM_FIXED_FILTER_SETS) + (cs.slice->isIntra() ? 1 : 3); -#else - int tmpBits = bitsNewFilter + 5 * (numFilterSet - NUM_FIXED_FILTER_SETS) + (cs.slice->isIntra() ? 1 : getTBlength(numFilterSet - NUM_FIXED_FILTER_SETS, ALF_CTB_MAX_NUM_APS + 1)); -#endif -#endif curCost += tmpBits * m_lambda[COMPONENT_Y]; if (curCost < costMin) { @@ -3535,9 +2648,6 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } else { -#if !JVET_O0245_VPS_DPS_APS - alfParamNewFiltersBest.tLayer = cs.slice->getTLayer(); -#endif cs.slice->setTileGroupAlfEnabledFlag(COMPONENT_Y, true); cs.slice->setTileGroupNumAps((int)bestApsIds.size()); cs.slice->setAlfAPSs(bestApsIds); @@ -3556,9 +2666,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar newAPS->setAPSType(ALF_APS); } newAPS->setAlfAPSParam(alfParamNewFiltersBest); -#if JVET_O0245_VPS_DPS_APS newAPS->setTemporalId( cs.slice->getTLayer() ); -#endif newAPS->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_CHROMA] = false; m_apsMap->setChangedFlag((newApsId << NUM_APS_TYPE_LEN) + ALF_APS); m_apsIdStart = newApsId; @@ -3572,14 +2680,12 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } //chroma -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB m_alfParamTemp = alfParamNewFiltersBest; if( m_alfParamTemp.numAlternativesChroma < 1 ) { m_alfParamTemp.numAlternativesChroma = 1; } setCtuAlternativeChroma( m_ctuAlternative, 0 ); -#endif setCtuEnableFlag(m_ctuEnableFlag, CHANNEL_TYPE_CHROMA, 1); getFrameStats(CHANNEL_TYPE_CHROMA, 0); costOff = getUnfilteredDistortion(m_alfCovarianceFrame[CHANNEL_TYPE_CHROMA][0], CHANNEL_TYPE_CHROMA); @@ -3599,11 +2705,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar curId--; if (curId < 0) { -#if JVET_O_MAX_NUM_ALF_APS_8 curId = ALF_CTB_MAX_NUM_APS - 1; -#else - curId = (int)MAX_NUM_APS - 1; -#endif } if (std::find(bestApsIds.begin(), bestApsIds.end(), curId) == bestApsIds.end()) { @@ -3611,30 +2713,14 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } } } -#if JVET_O_MAX_NUM_ALF_APS_8 for (int curApsId = 0; curApsId < ALF_CTB_MAX_NUM_APS; curApsId++) -#else - for (int curApsId = 0; curApsId < MAX_NUM_APS; curApsId++) -#endif { if ((cs.slice->getPendingRasInit() || cs.slice->isIDRorBLA() || cs.slice->isIntra()) && curApsId != newApsIdChroma) { continue; } APS* curAPS = m_apsMap->getPS((curApsId << NUM_APS_TYPE_LEN) + ALF_APS); -#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL -#if JVET_O_MAX_NUM_ALF_APS_8 double curCost = m_lambda[CHANNEL_TYPE_CHROMA] * 3; -#else - double curCost = m_lambda[CHANNEL_TYPE_CHROMA] * 5; -#endif -#else -#if JVET_O_MAX_NUM_ALF_APS_8 - double curCost = (cs.slice->isIntra() && cs.slice->getTileGroupNumAps() == 1) ? 0 : (m_lambda[CHANNEL_TYPE_CHROMA] * 3); -#else - double curCost = (cs.slice->isIntra() && cs.slice->getTileGroupNumAps() == 1) ? 0 : (m_lambda[CHANNEL_TYPE_CHROMA] * 5); -#endif -#endif if (curApsId == newApsIdChroma) { m_alfParamTemp = alfParamNewFilters; @@ -3665,7 +2751,6 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar //ctb flag m_CABACEstimator->codeAlfCtuEnableFlag(cs, ctbIdx, compId, &m_alfParamTemp); double rateOn = FRAC_BITS_SCALE * m_CABACEstimator->getEstFracBits(); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB #if ENABLE_QPA const double ctuLambda = lambdaChromaWeight > 0.0 ? cs.picture->m_uEnerHpCtu[ctbIdx] / lambdaChromaWeight : m_lambda[compId]; #else @@ -3710,17 +2795,6 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar dist += distUnfilterCtu; //cost double costOn = dist + ctuLambda * rateOn; -#else - //distortion - for (int i = 0; i < MAX_NUM_ALF_CHROMA_COEFF; i++) - { - m_filterTmp[i] = m_chromaCoeffFinal[i]; - m_clipTmp[i] = m_chromaClippFinal[i]; - } - double dist = distUnfilterCtu + m_alfCovariance[compId][0][ctbIdx][0].calcErrorForCoeffs(m_clipTmp, m_filterTmp, MAX_NUM_ALF_CHROMA_COEFF, m_NUM_BITS); - double costOn = dist + m_lambda[compId] * rateOn; - ctxTempBest = AlfCtx(m_CABACEstimator->getCtx()); -#endif //cost off m_ctuEnableFlag[compId][ctbIdx] = 0; //rate @@ -3744,16 +2818,6 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } //chroma idc setEnableFlag(m_alfParamTemp, CHANNEL_TYPE_CHROMA, m_ctuEnableFlag); -#if !JVET_O0491_HLS_CLEANUP - const int alfChromaIdc = m_alfParamTemp.enabledFlag[COMPONENT_Cb] * 2 + m_alfParamTemp.enabledFlag[COMPONENT_Cr]; -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB -#if !JVET_O0491_HLS_CLEANUP - curCost += (lengthTruncatedUnary(alfChromaIdc, 3) - lengthTruncatedUnary(0, 3)) * m_lambda[CHANNEL_TYPE_CHROMA]; -#endif -#else - curCost += lengthTruncatedUnary(alfChromaIdc, 3) * m_lambda[CHANNEL_TYPE_CHROMA]; -#endif if (curCost < costMin) { @@ -3762,9 +2826,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar cs.slice->setTileGroupAlfEnabledFlag(COMPONENT_Cb, m_alfParamTemp.enabledFlag[COMPONENT_Cb]); cs.slice->setTileGroupAlfEnabledFlag(COMPONENT_Cr, m_alfParamTemp.enabledFlag[COMPONENT_Cr]); copyCtuEnableFlag(m_ctuEnableFlagTmp, m_ctuEnableFlag, CHANNEL_TYPE_CHROMA); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB copyCtuAlternativeChroma(m_ctuAlternativeTmp, m_ctuAlternative); -#endif } } if (costOff < costMin) @@ -3776,9 +2838,7 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar else { copyCtuEnableFlag(m_ctuEnableFlag, m_ctuEnableFlagTmp, CHANNEL_TYPE_CHROMA); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB copyCtuAlternativeChroma(m_ctuAlternative, m_ctuAlternativeTmp); -#endif if (cs.slice->getTileGroupApsIdChroma() == newApsIdChroma) //new filter { APS* newAPS = m_apsMap->getPS((newApsIdChroma << NUM_APS_TYPE_LEN) + ALF_APS); @@ -3794,32 +2854,16 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar { newAPS->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA] = false; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB newAPS->getAlfAPSParam().numAlternativesChroma = alfParamNewFilters.numAlternativesChroma; for( int altIdx = 0; altIdx < MAX_NUM_ALF_ALTERNATIVES_CHROMA; ++altIdx ) newAPS->getAlfAPSParam().nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] = alfParamNewFilters.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx]; -#else - newAPS->getAlfAPSParam().nonLinearFlag[CHANNEL_TYPE_CHROMA] = alfParamNewFilters.nonLinearFlag[CHANNEL_TYPE_CHROMA]; -#endif -#if JVET_O0245_VPS_DPS_APS newAPS->setTemporalId( cs.slice->getTLayer() ); -#else - newAPS->getAlfAPSParam().tLayer = cs.slice->getTLayer(); -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB for (int altIdx = 0; altIdx < MAX_NUM_ALF_ALTERNATIVES_CHROMA; ++altIdx ) for (int i = 0; i < MAX_NUM_ALF_CHROMA_COEFF; i++) { newAPS->getAlfAPSParam().chromaCoeff[altIdx][i] = alfParamNewFilters.chromaCoeff[altIdx][i]; newAPS->getAlfAPSParam().chromaClipp[altIdx][i] = alfParamNewFilters.chromaClipp[altIdx][i]; } -#else - for (int i = 0; i < MAX_NUM_ALF_CHROMA_COEFF; i++) - { - newAPS->getAlfAPSParam().chromaCoeff[i] = alfParamNewFilters.chromaCoeff[i]; - newAPS->getAlfAPSParam().chromaClipp[i] = alfParamNewFilters.chromaClipp[i]; - } -#endif m_apsMap->setChangedFlag((newApsIdChroma << NUM_APS_TYPE_LEN) + ALF_APS); m_apsIdStart = newApsIdChroma; } @@ -3933,7 +2977,6 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB { const Area blkSrc(0, 0, w >> chromaScaleX, h >> chromaScaleY); const Area blkDst(xStart >> chromaScaleX, yStart >> chromaScaleY, w >> chromaScaleX, h >> chromaScaleY); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const int alt_num = m_ctuAlternative[compID][ctuIdx]; m_filter5x5Blk(m_classifier, recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs , m_alfVBChmaCTUHeight @@ -3941,11 +2984,6 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB , ( ( yPos + pcv.maxCUHeight >= pcv.lumaHeight ) ? pcv.lumaHeight : m_alfVBChmaPos ), alfBryList #else , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) -#endif -#else - m_filter5x5Blk(m_classifier, recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) #endif ); } @@ -3995,7 +3033,6 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB if (m_ctuEnableFlag[compIdx][ctuIdx]) { Area blk(xPos >> chromaScaleX, yPos >> chromaScaleY, width >> chromaScaleX, height >> chromaScaleY); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB const int alt_num = m_ctuAlternative[compID][ctuIdx]; m_filter5x5Blk(m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs , m_alfVBChmaCTUHeight @@ -4003,11 +3040,6 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB , ( ( yPos + pcv.maxCUHeight >= pcv.lumaHeight ) ? pcv.lumaHeight : m_alfVBChmaPos ), alfBryList #else , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) -#endif -#else - m_filter5x5Blk(m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal, m_chromaClippFinal, m_clpRngs.comp[compIdx], cs - , m_alfVBChmaCTUHeight - , ((yPos + pcv.maxCUHeight >= pcv.lumaHeight) ? pcv.lumaHeight : m_alfVBChmaPos) #endif ); } @@ -4017,7 +3049,6 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB } } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void EncAdaptiveLoopFilter::copyCtuAlternativeChroma( uint8_t* ctuAltsDst[MAX_NUM_COMPONENT], uint8_t* ctuAltsSrc[MAX_NUM_COMPONENT] ) { @@ -4053,4 +3084,3 @@ int EncAdaptiveLoopFilter::getMaxNumAlternativesChroma( ) { return std::min<int>( m_numCTUsInPic * 2, m_encCfg->getMaxNumAlfAlternativesChroma() ); } -#endif diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h index 3b6c78879827c49706488489abc900bf5dea0f5d..4573840ba301b7f1a25839555ed3458270ac11b7 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h @@ -219,10 +219,6 @@ private: class EncAdaptiveLoopFilter : public AdaptiveLoopFilter { public: -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - static constexpr int m_MAX_SCAN_VAL = 11; - static constexpr int m_MAX_EXP_GOLOMB = 16; -#endif inline void setAlfWSSD(int alfWSSD) { m_alfWSSD = alfWSSD; } static std::vector<double> m_lumaLevelToWeightPLUT; inline std::vector<double>& getLumaLevelWeightTable() { return m_lumaLevelToWeightPLUT; } @@ -231,15 +227,10 @@ private: int m_alfWSSD; const EncCfg* m_encCfg; AlfCovariance*** m_alfCovariance[MAX_NUM_COMPONENT]; // [compIdx][shapeIdx][ctbAddr][classIdx] -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB AlfCovariance** m_alfCovarianceFrame[MAX_NUM_CHANNEL_TYPE]; // [CHANNEL][shapeIdx][lumaClassIdx/chromaAltIdx] uint8_t* m_ctuEnableFlagTmp[MAX_NUM_COMPONENT]; uint8_t* m_ctuEnableFlagTmp2[MAX_NUM_COMPONENT]; uint8_t* m_ctuAlternativeTmp[MAX_NUM_COMPONENT]; -#else - AlfCovariance** m_alfCovarianceFrame[MAX_NUM_CHANNEL_TYPE]; // [CHANNEL][shapeIdx][classIdx] - uint8_t* m_ctuEnableFlagTmp[MAX_NUM_COMPONENT]; -#endif //for RDO AlfParam m_alfParamTemp; @@ -250,18 +241,9 @@ private: CtxCache* m_CtxCache; double m_lambda[MAX_NUM_COMPONENT]; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB int** m_filterCoeffSet; // [lumaClassIdx/chromaAltIdx][coeffIdx] int** m_filterClippSet; // [lumaClassIdx/chromaAltIdx][coeffIdx] -#else - int** m_filterCoeffSet; - int** m_filterClippSet; -#endif int** m_diffFilterCoeff; -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - int m_kMinTab[MAX_NUM_ALF_LUMA_COEFF]; - int m_bitsCoeffScan[m_MAX_SCAN_VAL][m_MAX_EXP_GOLOMB]; -#endif short m_filterIndices[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES]; unsigned m_bitsNewFilter[MAX_NUM_CHANNEL_TYPE]; int m_apsIdStart; @@ -293,9 +275,6 @@ public: void create( const EncCfg* encCfg, const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], const int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); void destroy(); static int lengthGolomb( int coeffVal, int k, bool signed_coeff=true ); -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - static int getGolombKMin( AlfFilterShape& alfShape, const int numFilters, int kMinTab[MAX_NUM_ALF_LUMA_COEFF], int bitsCoeffScan[m_MAX_SCAN_VAL][m_MAX_EXP_GOLOMB] ); -#endif void setApsIdStart( int i) { m_apsIdStart = i; } private: @@ -309,11 +288,7 @@ private: double mergeFiltersAndCost( AlfParam& alfParam, AlfFilterShape& alfShape, AlfCovariance* covFrame, AlfCovariance* covMerged, int clipMerged[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_LUMA_COEFF], int& uiCoeffBits ); void getFrameStats( ChannelType channel, int iShapeIdx ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void getFrameStat( AlfCovariance* frameCov, AlfCovariance** ctbCov, uint8_t* ctbEnableFlags, uint8_t* ctbAltIdx, const int numClasses, int altIdx ); -#else - void getFrameStat( AlfCovariance* frameCov, AlfCovariance** ctbCov, uint8_t* ctbEnableFlags, const int numClasses ); -#endif void deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnitBuf& recYuv, CodingStructure& cs ); #if JVET_O0625_ALF_PADDING void getBlkStats( AlfCovariance* alfCovariace, const AlfFilterShape& shape, AlfClassifier** classifier, Pel* org, const int orgStride, Pel* rec, @@ -329,11 +304,7 @@ private: double getFilterCoeffAndCost( CodingStructure& cs, double distUnfilter, ChannelType channel, bool bReCollectStat, int iShapeIdx, int& uiCoeffBits, bool onlyFilterCost = false ); double deriveFilterCoeffs(AlfCovariance* cov, AlfCovariance* covMerged, int clipMerged[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_LUMA_COEFF], AlfFilterShape& alfShape, short* filterIndices, int numFilters, double errorTabForce0Coeff[MAX_NUM_ALF_CLASSES][2], AlfParam& alfParam); -#if JVET_O0669_REMOVE_ALF_COEFF_PRED int deriveFilterCoefficientsPredictionMode( AlfFilterShape& alfShape, int **filterSet, int** filterCoeffDiff, const int numFilters ); -#else - int deriveFilterCoefficientsPredictionMode( AlfFilterShape& alfShape, int **filterSet, int** filterCoeffDiff, const int numFilters, int& predMode ); -#endif double deriveCoeffQuant( int *filterClipp, int *filterCoeffQuant, const AlfCovariance& cov, const AlfFilterShape& shape, const int bitDepth, const bool optimizeClip ); double deriveCtbAlfEnableFlags( CodingStructure& cs, const int iShapeIdx, ChannelType channel, #if ENABLE_QPA @@ -342,33 +313,20 @@ private: const int numClasses, const int numCoeff, double& distUnfilter ); void roundFiltCoeff( int *filterCoeffQuant, double *filterCoeff, const int numCoeff, const int factor ); +#if JVET_P0164_ALF_SYNTAX_SIMP + double getDistCoeffForce0( bool* codedVarBins, double errorForce0CoeffTab[MAX_NUM_ALF_CLASSES][2], int* bitsVarBin, int zeroBitsVarBin, const int numFilters); +#else double getDistCoeffForce0( bool* codedVarBins, double errorForce0CoeffTab[MAX_NUM_ALF_CLASSES][2], int* bitsVarBin, const int numFilters ); -#if !JVET_O0491_HLS_CLEANUP - int lengthTruncatedUnary( int symbol, int maxSymbol ); #endif int lengthUvlc( int uiCode ); int getNonFilterCoeffRate( AlfParam& alfParam ); -#if !JVET_O0491_HLS_CLEANUP - int getTBlength( int uiSymbol, const int uiMaxSymbol ); -#endif int getCostFilterCoeffForce0( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters, bool* codedVarBins ); int getCostFilterCoeff( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters ); int getCostFilterClipp( AlfFilterShape& alfShape, int **pDiffQFilterCoeffIntPP, const int numFilters ); -#if JVET_O0216_ALF_COEFF_EG3 int lengthFilterCoeffs( AlfFilterShape& alfShape, const int numFilters, int **FilterCoeff ); -#else - int lengthFilterCoeffs( AlfFilterShape& alfShape, const int numFilters, int **FilterCoeff, int* kMinTab ); -#endif -#if !JVET_O0064_SIMP_ALF_CLIP_CODING - int lengthFilterClipps( AlfFilterShape& alfShape, const int numFilters, int **FilterCoeff, int* kMinTab ); -#endif double getDistForce0( AlfFilterShape& alfShape, const int numFilters, double errorTabForce0Coeff[MAX_NUM_ALF_CLASSES][2], bool* codedVarBins ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB int getChromaCoeffRate( AlfParam& alfParam, int altIdx ); -#else - int getCoeffRate( AlfParam& alfParam, bool isChroma ); -#endif double getUnfilteredDistortion( AlfCovariance* cov, ChannelType channel ); double getUnfilteredDistortion( AlfCovariance* cov, const int numClasses ); @@ -378,12 +336,10 @@ private: void setEnableFlag( AlfParam& alfSlicePara, ChannelType channel, uint8_t** ctuFlags ); void setCtuEnableFlag( uint8_t** ctuFlags, ChannelType channel, uint8_t val ); void copyCtuEnableFlag( uint8_t** ctuFlagsDst, uint8_t** ctuFlagsSrc, ChannelType channel ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void initCtuAlternativeChroma( uint8_t* ctuAlts[MAX_NUM_COMPONENT] ); void setCtuAlternativeChroma( uint8_t* ctuAlts[MAX_NUM_COMPONENT], uint8_t val ); void copyCtuAlternativeChroma( uint8_t* ctuAltsDst[MAX_NUM_COMPONENT], uint8_t* ctuAltsSrc[MAX_NUM_COMPONENT] ); int getMaxNumAlternativesChroma( ); -#endif }; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 3bfaa3d28d3b859822cb68c736d0278bb9b8cfd9..1d97cf8dfadcb3c13120200c1365183d4efa453f 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -76,9 +76,7 @@ struct GOPEntry int m_numRefPics1; int m_deltaRefPics1[MAX_NUM_REF_PICS]; bool m_isEncoded; -#if JVET_N0100_PROPOSAL1 bool m_ltrp_in_slice_header_flag; -#endif GOPEntry() : m_POC(-1) , m_QPOffset(0) @@ -101,9 +99,7 @@ struct GOPEntry , m_numRefPicsActive1(0) , m_numRefPics1(0) , m_isEncoded(false) -#if JVET_N0100_PROPOSAL1 , m_ltrp_in_slice_header_flag(false) -#endif { ::memset(m_deltaRefPics0, 0, sizeof(m_deltaRefPics0)); ::memset(m_deltaRefPics1, 0, sizeof(m_deltaRefPics1)); @@ -120,9 +116,7 @@ struct RPLEntry int m_numRefPics; int m_deltaRefPics[MAX_NUM_REF_PICS]; bool m_isEncoded; -#if JVET_N0100_PROPOSAL1 bool m_ltrp_in_slice_header_flag; -#endif RPLEntry() : m_POC(-1) , m_temporalId(0) @@ -131,9 +125,7 @@ struct RPLEntry , m_sliceType('P') , m_numRefPics(0) , m_isEncoded(false) -#if JVET_N0100_PROPOSAL1 , m_ltrp_in_slice_header_flag(false) -#endif { ::memset(m_deltaRefPics, 0, sizeof(m_deltaRefPics)); } @@ -200,9 +192,6 @@ protected: bool m_noPartitionConstraintsOverrideConstraintFlag; bool m_bNoSaoConstraintFlag; bool m_bNoAlfConstraintFlag; -#if !JVET_O0525_REMOVE_PCM - bool m_bNoPcmConstraintFlag; -#endif bool m_bNoRefWraparoundConstraintFlag; bool m_bNoTemporalMvpConstraintFlag; bool m_bNoSbtmvpConstraintFlag; @@ -220,12 +209,8 @@ protected: bool m_bNoTriangleConstraintFlag; bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; -#if JVET_O1136_TS_BDPCM_SIGNALLING bool m_noBDPCMConstraintFlag; -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool m_noJointCbCrConstraintFlag; -#endif bool m_bNoQpDeltaConstraintFlag; bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -234,12 +219,8 @@ protected: Profile::Name m_profile; Level::Tier m_levelTier; Level::Name m_level; -#if JVET_O0044_MULTI_SUB_PROFILE std::vector<uint32_t> m_subProfile; uint8_t m_numSubProfile; -#else - uint32_t m_subProfile; -#endif bool m_progressiveSourceFlag; bool m_interlacedSourceFlag; bool m_nonPackedConstraintFlag; @@ -263,14 +244,10 @@ protected: GOPEntry m_GOPList[MAX_GOP]; int m_maxDecPicBuffering[MAX_TLAYER]; int m_numReorderPics[MAX_TLAYER]; -#if JVET_N0494_DRAP int m_drapPeriod; -#endif int m_iQP; // if (AdaptiveQP == OFF) -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE ChromaQpMappingTableParams m_chromaQpMappingTableParams; -#endif #if X0038_LAMBDA_FROM_QP_CAPABILITY int m_intraQPOffset; ///< QP offset for intra slice (integer) int m_lambdaFromQPEnable; ///< enable lambda derivation from QP @@ -308,9 +285,7 @@ protected: int m_SubPuMvpMode; bool m_Affine; bool m_AffineType; -#if JVET_O0070_PROF bool m_PROF; -#endif bool m_BIO; bool m_SMVD; @@ -333,15 +308,8 @@ protected: bool m_DMVR; bool m_MMVD; int m_MmvdDisNum; -#if !JVET_O1136_TS_BDPCM_SIGNALLING - bool m_RdpcmMode; -#endif -#if JVET_O0119_BASE_PALETTE_444 unsigned m_PLTMode; -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool m_JointCbCrMode; -#endif unsigned m_IBCMode; unsigned m_IBCLocalSearchRangeX; unsigned m_IBCLocalSearchRangeY; @@ -372,17 +340,11 @@ protected: bool m_contentBasedFastQtbt; bool m_useNonLinearAlfLuma; bool m_useNonLinearAlfChroma; -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB unsigned m_maxNumAlfAlternativesChroma; -#endif bool m_MIP; bool m_useFastMIP; -#if JVET_O0050_LOCAL_DUAL_TREE int m_fastLocalDualTreeMode; -#endif -#if MAX_TB_SIZE_SIGNALLING uint32_t m_log2MaxTbSize; -#endif //====== Loop/Deblock Filter ======== bool m_bLoopFilterDisable; @@ -463,9 +425,7 @@ protected: uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; bool m_useTransformSkip; bool m_useTransformSkipFast; -#if JVET_O1136_TS_BDPCM_SIGNALLING bool m_useBDPCM; -#endif uint32_t m_log2MaxTransformSkipBlockSize; bool m_transformSkipRotationEnabledFlag; bool m_transformSkipContextEnabledFlag; @@ -485,12 +445,6 @@ protected: bool m_bFastUDIUseMPMEnabled; bool m_bFastMEForGenBLowDelayEnabled; bool m_bUseBLambdaForNonKeyLowDelayPictures; -#if !JVET_O0525_REMOVE_PCM - bool m_usePCM; - int m_PCMBitDepth[MAX_NUM_CHANNEL_TYPE]; - uint32_t m_pcmLog2MaxSize; - uint32_t m_uiPCMLog2MinSize; -#endif //====== Slice ======== SliceConstraint m_sliceMode; int m_sliceArgument; @@ -499,19 +453,13 @@ protected: int m_sliceSegmentArgument; bool m_bLFCrossSliceBoundaryFlag; -#if !JVET_O0525_REMOVE_PCM - bool m_bPCMInputBitDepthFlag; - bool m_bPCMFilterDisableFlag; -#endif bool m_intraSmoothingDisabledFlag; bool m_loopFilterAcrossBricksEnabledFlag; bool m_tileUniformSpacingFlag; int m_iNumColumnsMinus1; int m_iNumRowsMinus1; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int m_uniformTileColsWidthMinus1; int m_uniformTileRowHeightMinus1; -#endif std::vector<int> m_tileColumnWidth; std::vector<int> m_tileRowHeight; @@ -530,12 +478,8 @@ protected: HashType m_decodedPictureHashSEIType; bool m_bufferingPeriodSEIEnabled; bool m_pictureTimingSEIEnabled; -#if JVET_O0041_FRAME_FIELD_SEI bool m_frameFieldInfoSEIEnabled; -#endif -#if JVET_N0494_DRAP bool m_dependentRAPIndicationSEIEnabled; -#endif #if HEVC_SEI bool m_recoveryPointSEIEnabled; bool m_toneMappingInfoSEIEnabled; @@ -579,9 +523,7 @@ protected: bool m_gradualDecodingRefreshInfoEnabled; int m_noDisplaySEITLayer; #endif -#if JVET_N0867_TEMP_SCAL_HRD bool m_bpDeltasGOPStructure; -#endif bool m_decodingUnitInfoSEIEnabled; #if HEVC_SEI bool m_SOPDescriptionSEIEnabled; @@ -622,13 +564,10 @@ protected: uint32_t m_maxNumMergeCand; ///< Maximum number of merge candidates uint32_t m_maxNumAffineMergeCand; ///< Maximum number of affine merge candidates uint32_t m_maxNumTriangleCand; -#if JVET_O0455_IBC_MAX_MERGE_NUM uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates -#endif ScalingListMode m_useScalingListId; ///< Using quantization matrix i.e. 0=off, 1=default, 2=file. std::string m_scalingListFileName; ///< quantization matrix file name int m_TMVPModeId; -#if JVET_O0238_PPS_OR_SLICE bool m_constantSliceHeaderParamsEnabledFlag; int m_PPSDepQuantEnabledIdc; int m_PPSRefPicListSPSIdc0; @@ -639,7 +578,6 @@ protected: uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; uint32_t m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#endif bool m_DepQuantEnabledFlag; bool m_SignDataHidingEnabledFlag; bool m_RCEnableRateControl; @@ -666,9 +604,7 @@ protected: #if HEVC_SEI int m_activeParameterSetsSEIEnabled; ///< enable active parameter set SEI message #endif -#if FIX_HRD_O0189 bool m_hrdParametersPresentFlag; ///< enable generation of HRD parameters -#endif bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present #if HEVC_SEI @@ -736,23 +672,17 @@ protected: int m_cropOffsetBottom; bool m_calculateHdrMetrics; #endif -#if JVET_O1164_RPR double m_scalingRatioHor; double m_scalingRatioVer; bool m_rprEnabled; int m_switchPocPeriod; int m_upscaledOutput; -#endif public: EncCfg() : m_tileColumnWidth() , m_tileRowHeight() { -#if !JVET_O0525_REMOVE_PCM - m_PCMBitDepth[CHANNEL_TYPE_LUMA]=8; - m_PCMBitDepth[CHANNEL_TYPE_CHROMA]=8; -#endif } virtual ~EncCfg() @@ -760,12 +690,8 @@ public: void setProfile(Profile::Name profile) { m_profile = profile; } void setLevel(Level::Tier tier, Level::Name level) { m_levelTier = tier; m_level = level; } -#if JVET_O0044_MULTI_SUB_PROFILE void setNumSubProfile( uint8_t numSubProfile) { m_numSubProfile = numSubProfile; m_subProfile.resize(m_numSubProfile); } void setSubProfile( int i, uint32_t subProfile) { m_subProfile[i] = subProfile; } -#else - void setSubProfile(uint32_t subProfile) { m_subProfile = subProfile; } -#endif bool getIntraOnlyConstraintFlag() const { return m_bIntraOnlyConstraintFlag; } void setIntraOnlyConstraintFlag(bool bVal) { m_bIntraOnlyConstraintFlag = bVal; } uint32_t getMaxBitDepthConstraintIdc() const { return m_maxBitDepthConstraintIdc; } @@ -782,10 +708,6 @@ public: void setNoSaoConstraintFlag(bool bVal) { m_bNoSaoConstraintFlag = bVal; } bool getNoAlfConstraintFlag() const { return m_bNoAlfConstraintFlag; } void setNoAlfConstraintFlag(bool bVal) { m_bNoAlfConstraintFlag = bVal; } -#if !JVET_O0525_REMOVE_PCM - bool getNoPcmConstraintFlag() const { return m_bNoPcmConstraintFlag; } - void setNoPcmConstraintFlag(bool bVal) { m_bNoPcmConstraintFlag = bVal; } -#endif bool getNoRefWraparoundConstraintFlag() const { return m_bNoRefWraparoundConstraintFlag; } void setNoRefWraparoundConstraintFlag(bool bVal) { m_bNoRefWraparoundConstraintFlag = bVal; } bool getNoTemporalMvpConstraintFlag() const { return m_bNoTemporalMvpConstraintFlag; } @@ -820,14 +742,10 @@ public: void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } void setNoTransformSkipConstraintFlag(bool bVal) { m_noTransformSkipConstraintFlag = bVal; } -#if JVET_O1136_TS_BDPCM_SIGNALLING bool getNoBDPCMConstraintFlag() const { return m_noBDPCMConstraintFlag; } void setNoBDPCMConstraintFlag(bool bVal) { m_noBDPCMConstraintFlag = bVal; } -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool getNoJointCbCrConstraintFlag() const { return m_noJointCbCrConstraintFlag; } void setNoJointCbCrConstraintFlag(bool bVal) { m_noJointCbCrConstraintFlag = bVal; } -#endif bool getNoQpDeltaConstraintFlag() const { return m_bNoQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_bNoQpDeltaConstraintFlag = bVal; } bool getNoDepQuantConstraintFlag() const { return m_bNoDepQuantConstraintFlag; } @@ -893,18 +811,14 @@ public: void setEncodedFlag(uint32_t i, bool value) { m_RPLList0[i].m_isEncoded = value; m_RPLList1[i].m_isEncoded = value; } void setMaxDecPicBuffering ( uint32_t u, uint32_t tlayer ) { m_maxDecPicBuffering[tlayer] = u; } void setNumReorderPics ( int i, uint32_t tlayer ) { m_numReorderPics[tlayer] = i; } -#if JVET_N0494_DRAP void setDrapPeriod (int drapPeriod) { m_drapPeriod = drapPeriod; } -#endif void setBaseQP ( int i ) { m_iQP = i; } #if X0038_LAMBDA_FROM_QP_CAPABILITY void setIntraQPOffset ( int i ) { m_intraQPOffset = i; } void setLambdaFromQPEnable ( bool b ) { m_lambdaFromQPEnable = b; } #endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE void setChromaQpMappingTableParams (const ChromaQpMappingTableParams ¶ms) { m_chromaQpMappingTableParams = params; } -#endif void setPad ( int* iPad ) { for ( int i = 0; i < 2; i++ ) m_aiPad[i] = iPad[i]; } @@ -944,10 +858,8 @@ public: bool getAffine () const { return m_Affine; } void setAffineType( bool b ) { m_AffineType = b; } bool getAffineType() const { return m_AffineType; } -#if JVET_O0070_PROF void setPROF (bool b) { m_PROF = b; } bool getPROF () const { return m_PROF; } -#endif void setBIO(bool b) { m_BIO = b; } bool getBIO() const { return m_BIO; } @@ -1003,18 +915,10 @@ public: bool getMMVD () const { return m_MMVD; } void setMmvdDisNum ( int b ) { m_MmvdDisNum = b; } int getMmvdDisNum () const { return m_MmvdDisNum; } - #if !JVET_O1136_TS_BDPCM_SIGNALLING - void setRDPCM ( bool b ) { m_RdpcmMode = b; } - bool getRDPCM () const { return m_RdpcmMode; } - #endif -#if JVET_O0119_BASE_PALETTE_444 void setPLTMode ( unsigned n) { m_PLTMode = n; } unsigned getPLTMode () const { return m_PLTMode; } -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG void setJointCbCr ( bool b ) { m_JointCbCrMode = b; } bool getJointCbCr () const { return m_JointCbCrMode; } -#endif void setIBCMode (unsigned n) { m_IBCMode = n; } unsigned getIBCMode () const { return m_IBCMode; } void setIBCLocalSearchRangeX (unsigned n) { m_IBCLocalSearchRangeX = n; } @@ -1083,22 +987,16 @@ public: bool getUseNonLinearAlfLuma () const { return m_useNonLinearAlfLuma; } void setUseNonLinearAlfChroma ( bool b ) { m_useNonLinearAlfChroma = b; } bool getUseNonLinearAlfChroma () const { return m_useNonLinearAlfChroma; } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void setMaxNumAlfAlternativesChroma ( uint32_t u ) { m_maxNumAlfAlternativesChroma = u; } uint32_t getMaxNumAlfAlternativesChroma () const { return m_maxNumAlfAlternativesChroma; } -#endif void setUseMIP ( bool b ) { m_MIP = b; } bool getUseMIP () const { return m_MIP; } void setUseFastMIP ( bool b ) { m_useFastMIP = b; } bool getUseFastMIP () const { return m_useFastMIP; } -#if JVET_O0050_LOCAL_DUAL_TREE void setFastLocalDualTreeMode ( int i ) { m_fastLocalDualTreeMode = i; } int getFastLocalDualTreeMode () const { return m_fastLocalDualTreeMode; } -#endif -#if MAX_TB_SIZE_SIGNALLING void setLog2MaxTbSize ( uint32_t u ) { m_log2MaxTbSize = u; } -#endif //====== Loop/Deblock Filter ======== void setLoopFilterDisable ( bool b ) { m_bLoopFilterDisable = b; } @@ -1193,9 +1091,7 @@ public: int getGOPSize () const { return m_iGOPSize; } int getMaxDecPicBuffering (uint32_t tlayer) { return m_maxDecPicBuffering[tlayer]; } int getNumReorderPics (uint32_t tlayer) { return m_numReorderPics[tlayer]; } -#if JVET_N0494_DRAP int getDrapPeriod () { return m_drapPeriod; } -#endif #if X0038_LAMBDA_FROM_QP_CAPABILITY int getIntraQPOffset () const { return m_intraQPOffset; } int getLambdaFromQPEnable () const { return m_lambdaFromQPEnable; } @@ -1243,9 +1139,7 @@ public: //==== Tool list ======== void setBitDepth( const ChannelType chType, int internalBitDepthForChannel ) { m_bitDepth[chType] = internalBitDepthForChannel; } void setInputBitDepth( const ChannelType chType, int internalBitDepthForChannel ) { m_inputBitDepth[chType] = internalBitDepthForChannel; } -#if JVET_O1164_PS int* getInputBitDepth() { return m_inputBitDepth; } -#endif void setUseASR ( bool b ) { m_bUseASR = b; } void setUseHADME ( bool b ) { m_bUseHADME = b; } void setUseRDOQ ( bool b ) { m_useRDOQ = b; } @@ -1264,21 +1158,11 @@ public: void setFastMEForGenBLowDelayEnabled ( bool b ) { m_bFastMEForGenBLowDelayEnabled = b; } void setUseBLambdaForNonKeyLowDelayPictures ( bool b ) { m_bUseBLambdaForNonKeyLowDelayPictures = b; } -#if !JVET_O0525_REMOVE_PCM - void setPCMInputBitDepthFlag ( bool b ) { m_bPCMInputBitDepthFlag = b; } - void setPCMFilterDisableFlag ( bool b ) { m_bPCMFilterDisableFlag = b; } - void setUsePCM ( bool b ) { m_usePCM = b; } - void setPCMBitDepth( const ChannelType chType, int pcmBitDepthForChannel ) { m_PCMBitDepth[chType] = pcmBitDepthForChannel; } - void setPCMLog2MaxSize ( uint32_t u ) { m_pcmLog2MaxSize = u; } - void setPCMLog2MinSize ( uint32_t u ) { m_uiPCMLog2MinSize = u; } -#endif void setdQPs ( int* p ) { m_aidQP = p; } void setDeltaQpRD ( uint32_t u ) {m_uiDeltaQpRD = u; } void setFastDeltaQp ( bool b ) {m_bFastDeltaQP = b; } int getBitDepth (const ChannelType chType) const { return m_bitDepth[chType]; } -#if JVET_O1164_PS int* getBitDepth () { return m_bitDepth; } -#endif bool getUseASR () { return m_bUseASR; } bool getUseHADME () { return m_bUseHADME; } bool getUseRDOQ () { return m_useRDOQ; } @@ -1296,13 +1180,6 @@ public: bool getFastUDIUseMPMEnabled () { return m_bFastUDIUseMPMEnabled; } bool getFastMEForGenBLowDelayEnabled () { return m_bFastMEForGenBLowDelayEnabled; } bool getUseBLambdaForNonKeyLowDelayPictures () { return m_bUseBLambdaForNonKeyLowDelayPictures; } -#if !JVET_O0525_REMOVE_PCM - bool getPCMInputBitDepthFlag () { return m_bPCMInputBitDepthFlag; } - bool getPCMFilterDisableFlag () { return m_bPCMFilterDisableFlag; } - bool getUsePCM () { return m_usePCM; } - uint32_t getPCMLog2MaxSize () { return m_pcmLog2MaxSize; } - uint32_t getPCMLog2MinSize () { return m_uiPCMLog2MinSize; } -#endif bool getCrossComponentPredictionEnabledFlag () const { return m_crossComponentPredictionEnabledFlag; } void setCrossComponentPredictionEnabledFlag (const bool value) { m_crossComponentPredictionEnabledFlag = value; } @@ -1316,14 +1193,10 @@ public: void setTransformSkipRotationEnabledFlag (const bool value) { m_transformSkipRotationEnabledFlag = value; } bool getTransformSkipContextEnabledFlag () const { return m_transformSkipContextEnabledFlag; } void setTransformSkipContextEnabledFlag (const bool value) { m_transformSkipContextEnabledFlag = value; } -#if JVET_O1136_TS_BDPCM_SIGNALLING bool getUseBDPCM () { return m_useBDPCM; } void setUseBDPCM ( bool b ) { m_useBDPCM = b; } -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool getUseJointCbCr () { return m_JointCbCrMode; } void setUseJointCbCr (bool b) { m_JointCbCrMode = b; } -#endif bool getPersistentRiceAdaptationEnabledFlag () const { return m_persistentRiceAdaptationEnabledFlag; } void setPersistentRiceAdaptationEnabledFlag (const bool value) { m_persistentRiceAdaptationEnabledFlag = value; } bool getCabacBypassAlignmentEnabledFlag () const { return m_cabacBypassAlignmentEnabledFlag; } @@ -1378,12 +1251,10 @@ public: bool getTileUniformSpacingFlag () { return m_tileUniformSpacingFlag; } void setNumColumnsMinus1 ( int i ) { m_iNumColumnsMinus1 = i; } int getNumColumnsMinus1 () { return m_iNumColumnsMinus1; } -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA void setUniformTileColsWidthMinus1 (int i) { m_uniformTileColsWidthMinus1 = i; } int getUniformTileColsWidthMinus1 () { return m_uniformTileColsWidthMinus1; } void setUniformTileRowHeightMinus1 (int i) { m_uniformTileRowHeightMinus1 = i; } int getUniformTileRowHeightMinus1 () { return m_uniformTileRowHeightMinus1; } -#endif void setColumnWidth ( const std::vector<int>& columnWidth ) { m_tileColumnWidth = columnWidth; } uint32_t getColumnWidth ( uint32_t columnIdx ) { return m_tileColumnWidth[columnIdx]; } void setNumRowsMinus1 ( int i ) { m_iNumRowsMinus1 = i; } @@ -1419,14 +1290,10 @@ public: bool getBufferingPeriodSEIEnabled() const { return m_bufferingPeriodSEIEnabled; } void setPictureTimingSEIEnabled(bool b) { m_pictureTimingSEIEnabled = b; } bool getPictureTimingSEIEnabled() const { return m_pictureTimingSEIEnabled; } -#if JVET_O0041_FRAME_FIELD_SEI void setFrameFieldInfoSEIEnabled(bool b) { m_frameFieldInfoSEIEnabled = b; } bool getFrameFieldInfoSEIEnabled() const { return m_frameFieldInfoSEIEnabled; } -#endif -#if JVET_N0494_DRAP void setDependentRAPIndicationSEIEnabled(bool b) { m_dependentRAPIndicationSEIEnabled = b; } int getDependentRAPIndicationSEIEnabled() const { return m_dependentRAPIndicationSEIEnabled; } -#endif #if HEVC_SEI void setRecoveryPointSEIEnabled(bool b) { m_recoveryPointSEIEnabled = b; } bool getRecoveryPointSEIEnabled() const { return m_recoveryPointSEIEnabled; } @@ -1511,10 +1378,8 @@ public: void setNoDisplaySEITLayer(int b) { m_noDisplaySEITLayer = b; } int getNoDisplaySEITLayer() { return m_noDisplaySEITLayer; } #endif -#if JVET_N0867_TEMP_SCAL_HRD void setBpDeltasGOPStructure(bool b) { m_bpDeltasGOPStructure = b; } bool getBpDeltasGOPStructure() const { return m_bpDeltasGOPStructure; } -#endif void setDecodingUnitInfoSEIEnabled(bool b) { m_decodingUnitInfoSEIEnabled = b; } bool getDecodingUnitInfoSEIEnabled() const { return m_decodingUnitInfoSEIEnabled; } #if HEVC_SEI @@ -1587,17 +1452,14 @@ public: uint32_t getMaxNumAffineMergeCand () { return m_maxNumAffineMergeCand; } void setMaxNumTriangleCand ( uint32_t u ) { m_maxNumTriangleCand = u; } uint32_t getMaxNumTriangleCand () { return m_maxNumTriangleCand; } -#if JVET_O0455_IBC_MAX_MERGE_NUM void setMaxNumIBCMergeCand ( uint32_t u ) { m_maxNumIBCMergeCand = u; } uint32_t getMaxNumIBCMergeCand () { return m_maxNumIBCMergeCand; } -#endif void setUseScalingListId ( ScalingListMode u ) { m_useScalingListId = u; } ScalingListMode getUseScalingListId () { return m_useScalingListId; } void setScalingListFileName ( const std::string &s ) { m_scalingListFileName = s; } const std::string& getScalingListFileName () const { return m_scalingListFileName; } void setTMVPModeId ( int u ) { m_TMVPModeId = u; } int getTMVPModeId () { return m_TMVPModeId; } -#if JVET_O0238_PPS_OR_SLICE void setConstantSliceHeaderParamsEnabledFlag ( bool u ) { m_constantSliceHeaderParamsEnabledFlag = u; } bool getConstantSliceHeaderParamsEnabledFlag () { return m_constantSliceHeaderParamsEnabledFlag; } void setPPSDepQuantEnabledIdc ( int u ) { m_PPSDepQuantEnabledIdc = u; } @@ -1618,7 +1480,6 @@ public: uint32_t getPPSFiveMinusMaxNumSubblockMergeCandPlus1 () { return m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; } void setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ( uint32_t u ) { m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = u; } uint32_t getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 () { return m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; } -#endif WeightedPredictionMethod getWeightedPredictionMethod() const { return m_weightedPredictionMethod; } void setWeightedPredictionMethod( WeightedPredictionMethod m ) { m_weightedPredictionMethod = m; } void setDepQuantEnabledFlag( bool b ) { m_DepQuantEnabledFlag = b; } @@ -1674,10 +1535,8 @@ public: bool getDecodingParameterSetEnabled() { return m_decodingParameterSetEnabled; } void setDecodingParameterSetEnabled(bool i) { m_decodingParameterSetEnabled = i; } -#if FIX_HRD_O0189 bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; } void setHrdParametersPresentFlag(bool i) { m_hrdParametersPresentFlag = i; } -#endif bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; } void setVuiParametersPresentFlag(bool i) { m_vuiParametersPresentFlag = i; } bool getAspectRatioInfoPresentFlag() { return m_aspectRatioInfoPresentFlag; } @@ -1822,14 +1681,12 @@ public: bool getCalcluateHdrMetrics() const { return m_calculateHdrMetrics;} #endif -#if JVET_O1164_RPR void setScalingRatio( double hor, double ver ) { m_scalingRatioHor = hor, m_scalingRatioVer = ver; } void setRPREnabled( bool b ) { m_rprEnabled = b; } bool isRPREnabled() const { return m_rprEnabled; } void setSwitchPocPeriod( int p ) { m_switchPocPeriod = p;} void setUpscaledOutput( int b ) { m_upscaledOutput = b; } int getUpscaledOutput() const { return m_upscaledOutput; } -#endif }; //! \} diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 44817b99a9e6f54e8b22a8dae485508039130b5c..d315172bb131403f6d6c149d50ccb9a9583ac545 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -86,19 +86,15 @@ void EncCu::create( EncCfg* encCfg ) unsigned numHeights = gp_sizeIdxInfo->numHeights(); m_pTempCS = new CodingStructure** [numWidths]; m_pBestCS = new CodingStructure** [numWidths]; -#if JVET_O0050_LOCAL_DUAL_TREE m_pTempCS2 = new CodingStructure** [numWidths]; m_pBestCS2 = new CodingStructure** [numWidths]; -#endif for( unsigned w = 0; w < numWidths; w++ ) { m_pTempCS[w] = new CodingStructure* [numHeights]; m_pBestCS[w] = new CodingStructure* [numHeights]; -#if JVET_O0050_LOCAL_DUAL_TREE m_pTempCS2[w] = new CodingStructure* [numHeights]; m_pBestCS2[w] = new CodingStructure* [numHeights]; -#endif for( unsigned h = 0; h < numHeights; h++ ) { @@ -113,22 +109,18 @@ void EncCu::create( EncCfg* encCfg ) m_pTempCS[w][h]->create( chromaFormat, Area( 0, 0, width, height ), false ); m_pBestCS[w][h]->create( chromaFormat, Area( 0, 0, width, height ), false ); -#if JVET_O0050_LOCAL_DUAL_TREE m_pTempCS2[w][h] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); m_pBestCS2[w][h] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); m_pTempCS2[w][h]->create( chromaFormat, Area( 0, 0, width, height ), false ); m_pBestCS2[w][h]->create( chromaFormat, Area( 0, 0, width, height ), false ); -#endif } else { m_pTempCS[w][h] = nullptr; m_pBestCS[w][h] = nullptr; -#if JVET_O0050_LOCAL_DUAL_TREE m_pTempCS2[w][h] = nullptr; m_pBestCS2[w][h] = nullptr; -#endif } } } @@ -148,9 +140,7 @@ void EncCu::create( EncCfg* encCfg ) for (unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++) { m_acRealMergeBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP m_acMergeTmpBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); -#endif } const unsigned maxNumTriangleCand = encCfg->getMaxNumTriangleCand(); for (unsigned i = 0; i < maxNumTriangleCand; i++) @@ -209,29 +199,23 @@ void EncCu::destroy() delete m_pBestCS[w][h]; delete m_pTempCS[w][h]; -#if JVET_O0050_LOCAL_DUAL_TREE if( m_pBestCS2[w][h] ) m_pBestCS2[w][h]->destroy(); if( m_pTempCS2[w][h] ) m_pTempCS2[w][h]->destroy(); delete m_pBestCS2[w][h]; delete m_pTempCS2[w][h]; -#endif } delete[] m_pTempCS[w]; delete[] m_pBestCS[w]; -#if JVET_O0050_LOCAL_DUAL_TREE delete[] m_pTempCS2[w]; delete[] m_pBestCS2[w]; -#endif } delete[] m_pBestCS; m_pBestCS = nullptr; delete[] m_pTempCS; m_pTempCS = nullptr; -#if JVET_O0050_LOCAL_DUAL_TREE delete[] m_pBestCS2; m_pBestCS2 = nullptr; delete[] m_pTempCS2; m_pTempCS2 = nullptr; -#endif #if REUSE_CU_RESULTS if (m_tmpStorageLCU) @@ -255,9 +239,7 @@ void EncCu::destroy() for (unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++) { m_acRealMergeBuffer[ui].destroy(); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP m_acMergeTmpBuffer[ui].destroy(); -#endif } for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) { @@ -306,17 +288,9 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) m_modeCtrl->init( m_pcEncCfg, m_pcRateCtrl, m_pcRdCost ); m_pcInterSearch->setModeCtrl( m_modeCtrl ); -#if JVET_O0592_ENC_ME_IMP m_modeCtrl->setInterSearch(m_pcInterSearch); -#endif m_pcIntraSearch->setModeCtrl( m_modeCtrl ); -#if !JVET_O1164_PS - if ( ( m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode() ) || m_pcEncCfg->getAllowDisFracMMVD() ) - { - m_ibcHashMap.init(m_pcEncCfg->getSourceWidth(), m_pcEncCfg->getSourceHeight()); - } -#endif } // ==================================================================================================================== @@ -326,13 +300,9 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsigned ctuRsAddr, const int prevQP[], const int currQP[] ) { m_modeCtrl->initCTUEncoding( *cs.slice ); -#if JVET_O0050_LOCAL_DUAL_TREE cs.treeType = TREE_D; -#endif -#if JVET_O0119_BASE_PALETTE_444 cs.slice->m_mapPltCost.clear(); -#endif #if ENABLE_SPLIT_PARALLELISM if( m_pcEncCfg->getNumSplitThreads() > 1 ) { @@ -406,9 +376,7 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign tempCS->prevQP[CH_L] = bestCS->prevQP[CH_L] = prevQP[CH_L]; xCompressCU(tempCS, bestCS, partitioner); -#if JVET_O0119_BASE_PALETTE_444 cs.slice->m_mapPltCost.clear(); -#endif // all signals were already copied during compression if the CTU was split - at this point only the structures are copied to the top level CS const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1; cs.useSubStructure(*bestCS, partitioner.chType, CS::getArea(*bestCS, area, partitioner.chType), copyUnsplitCTUSignals, @@ -597,11 +565,7 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS, // if tempCS is not a split-mode CodingUnit &cu = *tempCS->cus.front(); -#if !JVET_O0525_REMOVE_PCM - if( CU::isLosslessCoded( cu ) && !cu.ipcm ) -#else if( CU::isLosslessCoded( cu ) ) -#endif { xFillPCMBuffer( cu ); } @@ -621,15 +585,9 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS, } -#if JVET_O0502_ISP_CLEANUP void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Partitioner& partitioner, double maxCostAllowed ) -#else -void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner ) -#endif { -#if JVET_O0502_ISP_CLEANUP CHECK(maxCostAllowed < 0, "Wrong value of maxCostAllowed!"); -#endif if (m_shareState == NO_SHARE) { tempCS->sharedBndPos = tempCS->area.Y().lumaPos(); @@ -653,15 +611,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } #endif -#if JVET_O0119_BASE_PALETTE_444 uint32_t compBegin; uint32_t numComp; bool jointPLT = false; -#if JVET_O0050_LOCAL_DUAL_TREE if (partitioner.isSepTree( *tempCS )) -#else - if (CS::isDualITree(*bestCS)) -#endif { if (isLuma(partitioner.chType)) { @@ -692,7 +645,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par curLastPLTSize[comID] = tempCS->prevPLT.curPLTSize[comID]; memcpy(curLastPLT[i], tempCS->prevPLT.curPLT[i], tempCS->prevPLT.curPLTSize[comID] * sizeof(Pel)); } -#endif Slice& slice = *tempCS->slice; const PPS &pps = *tempCS->pps; @@ -700,11 +652,9 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par const uint32_t uiLPelX = tempCS->area.Y().lumaPos().x; const uint32_t uiTPelY = tempCS->area.Y().lumaPos().y; -#if JVET_O0050_LOCAL_DUAL_TREE const ModeType modeTypeParent = partitioner.modeType; const TreeType treeTypeParent = partitioner.treeType; const ChannelType chTypeParent = partitioner.chType; -#endif const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture ); m_modeCtrl->initCULevel( partitioner, *tempCS ); @@ -755,29 +705,19 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par int startShareThisLevel = 0; m_pcInterSearch->resetSavedAffineMotion(); -#if JVET_O0057_ALTHPELIF double bestIntPelCost = MAX_DOUBLE; -#endif do { -#if JVET_O0119_BASE_PALETTE_444 for (int i = compBegin; i < (compBegin + numComp); i++) { ComponentID comID = jointPLT ? (ComponentID)compBegin : ((i > 0) ? COMPONENT_Cb : COMPONENT_Y); tempCS->prevPLT.curPLTSize[comID] = curLastPLTSize[comID]; memcpy(tempCS->prevPLT.curPLT[i], curLastPLT[i], curLastPLTSize[comID] * sizeof(Pel)); } -#endif EncTestMode currTestMode = m_modeCtrl->currTestMode(); -#if JVET_O0502_ISP_CLEANUP currTestMode.maxCostAllowed = maxCostAllowed; -#endif -#if JVET_O0050_LOCAL_DUAL_TREE if (pps.getUseDQP() && partitioner.isSepTree(*tempCS) && isChroma( partitioner.chType )) -#else - if (pps.getUseDQP() && CS::isDualITree(*tempCS) && isChroma(partitioner.chType)) -#endif { const Position chromaCentral(tempCS->area.Cb().chromaPos().offset(tempCS->area.Cb().chromaSize().width >> 1, tempCS->area.Cb().chromaSize().height >> 1)); const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, tempCS->area.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, tempCS->area.chromaFormat)); @@ -820,21 +760,13 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { if( ( currTestMode.opts & ETO_IMV ) != 0 ) { -#if JVET_O0057_ALTHPELIF const bool skipAltHpelIF = ( int( ( currTestMode.opts & ETO_IMV ) >> ETO_IMV_SHIFT ) == 4 ) && ( bestIntPelCost > 1.25 * bestCS->cost ); if (!skipAltHpelIF) { -#endif tempCS->bestCS = bestCS; -#if JVET_O0057_ALTHPELIF xCheckRDCostInterIMV(tempCS, bestCS, partitioner, currTestMode, bestIntPelCost); -#else - xCheckRDCostInterIMV(tempCS, bestCS, partitioner, currTestMode); -#endif tempCS->bestCS = nullptr; -#if JVET_O0057_ALTHPELIF } -#endif } else { @@ -873,18 +805,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { xCheckRDCostIntra( tempCS, bestCS, partitioner, currTestMode ); } -#if !JVET_O0525_REMOVE_PCM - else if( currTestMode.type == ETM_IPCM ) - { - xCheckIntraPCM( tempCS, bestCS, partitioner, currTestMode ); - } -#endif -#if JVET_O0119_BASE_PALETTE_444 else if (currTestMode.type == ETM_PALETTE) { xCheckPLT( tempCS, bestCS, partitioner, currTestMode ); } -#endif else if (currTestMode.type == ETM_IBC) { xCheckRDCostIBCMode(tempCS, bestCS, partitioner, currTestMode); @@ -895,13 +819,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } else if( isModeSplit( currTestMode ) ) { -#if JVET_O0119_BASE_PALETTE_444 if (bestCS->cus.size() != 0) { splitmode = bestCS->cus[0]->splitSeries; } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE assert( partitioner.modeType == tempCS->modeType ); int signalModeConsVal = tempCS->signalModeCons( getPartSplit( currTestMode ), partitioner, modeTypeParent ); int numRoundRdo = signalModeConsVal == LDT_MODE_TYPE_SIGNAL ? 2 : 1; @@ -941,10 +862,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } xCheckModeSplit( tempCS, bestCS, partitioner, currTestMode, modeTypeParent, skipInterPass ); -#else - xCheckModeSplit( tempCS, bestCS, partitioner, currTestMode ); -#endif -#if JVET_O0050_LOCAL_DUAL_TREE //recover cons modes tempCS->modeType = partitioner.modeType = modeTypeParent; tempCS->treeType = partitioner.treeType = treeTypeParent; @@ -962,8 +879,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par break; } } -#endif -#if JVET_O0119_BASE_PALETTE_444 if (splitmode != bestCS->cus[0]->splitSeries) { splitmode = bestCS->cus[0]->splitSeries; @@ -976,7 +891,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par memcpy(bestLastPLT[i], bestCS->cus[0]->cs->prevPLT.curPLT[i], bestCS->cus[0]->cs->prevPLT.curPLTSize[comID] * sizeof(Pel)); } } -#endif } else { @@ -1016,7 +930,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par m_CABACEstimator->getCtx() = m_CurrCtx->best; // QP from last processed CU for further processing -#if JVET_O0050_LOCAL_DUAL_TREE //copy the qp of the last non-chroma CU int numCUInThisNode = (int)bestCS->cus.size(); if( numCUInThisNode > 1 && bestCS->cus.back()->chType == CHANNEL_TYPE_CHROMA && !CS::isDualITree( *bestCS ) ) @@ -1026,11 +939,8 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } else { -#endif bestCS->prevQP[partitioner.chType] = bestCS->cus.back()->qp; -#if JVET_O0050_LOCAL_DUAL_TREE } -#endif if ((!slice.isIntra() || slice.getSPS()->getIBCFlag()) && partitioner.chType == CHANNEL_TYPE_LUMA && bestCS->cus.size() == 1 && (bestCS->cus.back()->predMode == MODE_INTER || bestCS->cus.back()->predMode == MODE_IBC) @@ -1040,12 +950,8 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par const CodingUnit& cu = *bestCS->cus.front(); const PredictionUnit& pu = *cu.firstPU; -#if JVET_O0078_SINGLE_HMVPLUT bool isShare = ((CU::isIBC(cu) && m_shareState == 2) ? true : false); if (!cu.affine && !cu.triangle && !isShare) -#else - if (!cu.affine && !cu.triangle) -#endif { MotionInfo mi = pu.getMotionInfo(); mi.GBiIdx = (mi.interDir == 3) ? cu.GBiIdx : GBI_DEFAULT; @@ -1055,12 +961,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par bestCS->picture->getPredBuf(currCsArea).copyFrom(bestCS->getPredBuf(currCsArea)); bestCS->picture->getRecoBuf( currCsArea ).copyFrom( bestCS->getRecoBuf( currCsArea ) ); m_modeCtrl->finishCULevel( partitioner ); -#if JVET_O0050_LOCAL_DUAL_TREE if( m_pcIntraSearch->getSaveCuCostInSCIPU() && bestCS->cus.size() == 1 ) { m_pcIntraSearch->saveCuAreaCostInSCIPU( Area( partitioner.currArea().lumaPos(), partitioner.currArea().lumaSize() ), bestCS->cost ); } -#endif #if ENABLE_SPLIT_PARALLELISM if( tempCS->picture->scheduler.getSplitJobId() == 0 && m_pcEncCfg->getNumSplitThreads() != 1 ) @@ -1069,7 +973,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } #endif -#if JVET_O0119_BASE_PALETTE_444 if (bestCS->cus.size() == 1) // no partition { if (bestCS->cus[0]->predMode == MODE_PLT) @@ -1103,7 +1006,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } const CodingUnit& cu = *bestCS->cus.front(); cu.cs->prevPLT = bestCS->prevPLT; -#endif // Assert if Best prediction mode is NONE // Selected mode's RD-cost must be not MAX_DOUBLE. CHECK( bestCS->cus.empty() , "No possible encoding found" ); @@ -1326,11 +1228,7 @@ void EncCu::copyState( EncCu* other, Partitioner& partitioner, const UnitArea& c } #endif -#if JVET_O0050_LOCAL_DUAL_TREE void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode, const ModeType modeTypeParent, bool &skipInterPass ) -#else -void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) -#endif { const int qp = encTestMode.qp; const Slice &slice = *tempCS->slice; @@ -1341,14 +1239,10 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, const PPS &pps = *tempCS->pps; const uint32_t currDepth = partitioner.currDepth; #endif -#if JVET_O0119_BASE_PALETTE_444 const auto oldPLT = tempCS->prevPLT; -#endif const PartSplit split = getPartSplit( encTestMode ); -#if JVET_O0050_LOCAL_DUAL_TREE const ModeType modeTypeChild = partitioner.modeType; -#endif CHECK( split == CU_DONT_SPLIT, "No proper split provided!" ); @@ -1360,15 +1254,11 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, const TempCtx ctxStartQt( m_CtxCache, SubCtx( Ctx::SplitQtFlag, m_CABACEstimator->getCtx() ) ); const TempCtx ctxStartHv( m_CtxCache, SubCtx( Ctx::SplitHvFlag, m_CABACEstimator->getCtx() ) ); const TempCtx ctxStart12( m_CtxCache, SubCtx( Ctx::Split12Flag, m_CABACEstimator->getCtx() ) ); -#if JVET_O0050_LOCAL_DUAL_TREE const TempCtx ctxStartMC( m_CtxCache, SubCtx( Ctx::ModeConsFlag, m_CABACEstimator->getCtx() ) ); -#endif m_CABACEstimator->resetBits(); m_CABACEstimator->split_cu_mode( split, *tempCS, partitioner ); -#if JVET_O0050_LOCAL_DUAL_TREE m_CABACEstimator->mode_constraint( split, *tempCS, partitioner, modeTypeChild ); -#endif const double factor = ( tempCS->currQP[partitioner.chType] > 30 ? 1.1 : 1.075 ); tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); @@ -1380,9 +1270,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitQtFlag, ctxStartQt ); m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitHvFlag, ctxStartHv ); m_CABACEstimator->getCtx() = SubCtx( Ctx::Split12Flag, ctxStart12 ); -#if JVET_O0050_LOCAL_DUAL_TREE m_CABACEstimator->getCtx() = SubCtx( Ctx::ModeConsFlag, ctxStartMC ); -#endif if (cost > bestCS->cost + bestCS->costDbOffset #if ENABLE_QPA_SUB_CTU || (m_pcEncCfg->getUsePerceptQPA() && !m_pcEncCfg->getUseRateCtrl() && pps.getUseDQP() && (pps.getCuQpDeltaSubdiv() > 0) && (split == CU_HORZ_SPLIT || split == CU_VERT_SPLIT) && @@ -1394,7 +1282,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, return; } -#if JVET_O0050_LOCAL_DUAL_TREE const bool chromaNotSplit = modeTypeParent == MODE_TYPE_ALL && modeTypeChild == MODE_TYPE_INTRA ? true : false; if( partitioner.treeType != TREE_D ) { @@ -1412,7 +1299,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, tempCS->treeType = partitioner.treeType = TREE_D; } } -#endif int startShareThisLevel = 0; const uint32_t uiLPelX = tempCS->area.Y().lumaPos().x; @@ -1440,9 +1326,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, } if ( m_shareState == GEN_ON_SHARED_BOUND && slice.getSPS()->getIBCFlag() ) { -#if !JVET_O0078_SINGLE_HMVPLUT - tempCS->motionLut.lutShareIbc = tempCS->motionLut.lutIbc; -#endif m_shareBndPosX = uiLPelX; m_shareBndPosY = uiTPelY; m_shareBndSizeW = tempCS->area.lwidth(); @@ -1465,14 +1348,12 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, AffineMVInfo tmpMVInfo; bool isAffMVInfoSaved; m_pcInterSearch->savePrevAffMVInfo(0, tmpMVInfo, isAffMVInfoSaved); -#if JVET_O0592_ENC_ME_IMP BlkUniMvInfo tmpUniMvInfo; bool isUniMvInfoSaved = false; if (!tempCS->slice->isIntra()) { m_pcInterSearch->savePrevUniMvInfo(tempCS->area.Y(), tmpUniMvInfo, isUniMvInfoSaved); } -#endif do { @@ -1496,19 +1377,11 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, bestSubCS->sharedBndPos.y = (m_shareState == SHARING) ? m_shareBndPosY : tempSubCS->area.Y().lumaPos().y; bestSubCS->sharedBndSize.width = (m_shareState == SHARING) ? m_shareBndSizeW : tempSubCS->area.lwidth(); bestSubCS->sharedBndSize.height = (m_shareState == SHARING) ? m_shareBndSizeH : tempSubCS->area.lheight(); -#if JVET_O0070_PROF tempSubCS->bestParent = bestSubCS->bestParent = bestCS; -#endif -#if JVET_O0502_ISP_CLEANUP double newMaxCostAllowed = isLuma(partitioner.chType) ? std::min(encTestMode.maxCostAllowed, bestCS->cost - m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist)) : MAX_DOUBLE; newMaxCostAllowed = std::max(0.0, newMaxCostAllowed); xCompressCU(tempSubCS, bestSubCS, partitioner, newMaxCostAllowed); -#else - xCompressCU( tempSubCS, bestSubCS, partitioner ); -#endif -#if JVET_O0070_PROF tempSubCS->bestParent = bestSubCS->bestParent = nullptr; -#endif if( bestSubCS->cost == MAX_DOUBLE ) { @@ -1519,7 +1392,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_CurrCtx--; partitioner.exitCurrSplit(); xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); -#if JVET_O0050_LOCAL_DUAL_TREE //early terminate if( partitioner.chType == CHANNEL_TYPE_LUMA ) { tempCS->motionLut = oldMotionLut; @@ -1530,7 +1402,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_pcInterSearch->setShareState( m_shareState ); setShareStateDec( m_shareState ); } -#endif return; } @@ -1541,7 +1412,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, { tempCS->prevQP[partitioner.chType] = bestSubCS->prevQP[partitioner.chType]; } -#if JVET_O0050_LOCAL_DUAL_TREE if( partitioner.isConsInter() ) { for( int i = 0; i < bestSubCS->cus.size(); i++ ) @@ -1556,11 +1426,9 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, CHECK( bestSubCS->cus[i]->predMode == MODE_INTER, "all CUs must not be inter mode in an Intra coding region (SCIPU)" ); } } -#endif tempSubCS->releaseIntermediateData(); bestSubCS->releaseIntermediateData(); -#if JVET_O0050_LOCAL_DUAL_TREE //early terminate if( !tempCS->slice->isIntra() && partitioner.isConsIntra() ) { tempCS->cost = m_pcRdCost->calcRdCost( tempCS->fracBits, tempCS->dist ); @@ -1584,7 +1452,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, return; } } -#endif } } while( partitioner.nextPart( *tempCS ) ); @@ -1599,10 +1466,8 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_CurrCtx--; -#if JVET_O0050_LOCAL_DUAL_TREE if( chromaNotSplit ) { -#if JVET_O0050_LOCAL_DUAL_TREE //Note: In local dual tree region, the chroma CU refers to the central luma CU's QP. //If the luma CU QP shall be predQP (no residual in it and before it in the QG), it must be revised to predQP before encoding the chroma CU //Otherwise, the chroma CU uses predQP+deltaQP in encoding but is decoded as using predQP, thus causing encoder-decoded mismatch on chroma qp. @@ -1664,7 +1529,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, } } } -#endif assert( tempCS->treeType == TREE_L ); uint32_t numCuPuTu[6]; tempCS->picture->cs->getNumCuPuTuOffset( numCuPuTu ); @@ -1703,7 +1567,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, partitioner.treeType = TREE_D; partitioner.modeType = MODE_TYPE_ALL; } -#endif // Finally, generate split-signaling bits for RD-cost check const PartSplit implicitSplit = partitioner.getImplicitSplit( *tempCS ); @@ -1734,10 +1597,8 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_CABACEstimator->resetBits(); m_CABACEstimator->split_cu_mode( split, *tempCS, partitioner ); -#if JVET_O0050_LOCAL_DUAL_TREE partitioner.modeType = modeTypeParent; m_CABACEstimator->mode_constraint( split, *tempCS, partitioner, modeTypeChild ); -#endif tempCS->fracBits += m_CABACEstimator->getEstFracBits(); // split bits } } @@ -1772,7 +1633,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, bestCS->costDbOffset = 0; } tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); -#if JVET_O0050_LOCAL_DUAL_TREE if( tempCS->cus.size() > 0 && modeTypeParent == MODE_TYPE_ALL && modeTypeChild == MODE_TYPE_INTER ) { int areaSizeNoResiCu = 0; @@ -1785,25 +1645,20 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, skipInterPass = true; } } -#endif // RD check for sub partitioned coding structure. xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); if (isAffMVInfoSaved) m_pcInterSearch->addAffMVInfo(tmpMVInfo); -#if JVET_O0592_ENC_ME_IMP if (!tempCS->slice->isIntra() && isUniMvInfoSaved) { m_pcInterSearch->addUniMvInfo(tmpUniMvInfo); } -#endif tempCS->motionLut = oldMotionLut; -#if JVET_O0119_BASE_PALETTE_444 tempCS->prevPLT = oldPLT; -#endif tempCS->releaseIntermediateData(); @@ -1838,24 +1693,8 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC int bestMtsFlag = 0; int bestLfnstIdx = 0; -#if JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE -#if JVET_O0050_LOCAL_DUAL_TREE const int maxLfnstIdx = ( partitioner.isSepTree( *tempCS ) && partitioner.chType == CHANNEL_TYPE_CHROMA && ( partitioner.currArea().lwidth() < 8 || partitioner.currArea().lheight() < 8 ) ) -#else - const int maxLfnstIdx = ( CS::isDualITree( *tempCS ) && partitioner.chType == CHANNEL_TYPE_CHROMA && ( partitioner.currArea().lwidth() < 8 || partitioner.currArea().lheight() < 8 ) ) -#endif -#if JVET_O0545_MAX_TB_SIGNALLING || ( partitioner.currArea().lwidth() > sps.getMaxTbSize() || partitioner.currArea().lheight() > sps.getMaxTbSize() ) ? 0 : 2; -#else - || ( partitioner.currArea().lwidth() > MAX_TB_SIZEY || partitioner.currArea().lheight() > MAX_TB_SIZEY ) ? 0 : 2; -#endif -#else -#if JVET_O0050_LOCAL_DUAL_TREE - const int maxLfnstIdx = partitioner.isSepTree( *tempCS ) && partitioner.chType == CHANNEL_TYPE_CHROMA && ( partitioner.currArea().lwidth() < 8 || partitioner.currArea().lheight() < 8 ) ? 0 : 2; -#else - const int maxLfnstIdx = CS::isDualITree( *tempCS ) && partitioner.chType == CHANNEL_TYPE_CHROMA && ( partitioner.currArea().lwidth() < 8 || partitioner.currArea().lheight() < 8 ) ? 0 : 2; -#endif -#endif bool skipOtherLfnst = false; int startLfnstIdx = 0; int endLfnstIdx = sps.getUseLFNST() ? maxLfnstIdx : 0; @@ -1873,12 +1712,10 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC { for( uint8_t mtsFlag = startMtsFlag; mtsFlag <= endMtsFlag; mtsFlag++ ) { -#if JVET_O0368_LFNST_WITH_DCT2_ONLY if (mtsFlag > 0 && lfnstIdx > 0) { continue; } -#endif //3) if interHad is 0, only try further modes if some intra mode was already better than inter if( sps.getUseLFNST() && m_pcEncCfg->getUsePbIntraFast() && !tempCS->slice->isIntra() && bestCU && CU::isInter( *bestCS->getCU( partitioner.chType ) ) && interHad == 0 ) { @@ -1898,9 +1735,6 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; -#if !JVET_O0525_REMOVE_PCM - //cu.ipcm = false; -#endif cu.lfnstIdx = lfnstIdx; cu.mtsFlag = mtsFlag; cu.ispMode = NOT_INTRA_SUBPARTITIONS; @@ -1914,26 +1748,12 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC bool validCandRet = false; if( isLuma( partitioner.chType ) ) { -#if JVET_O0502_ISP_CLEANUP //ISP uses the value of the best cost so far (luma if it is the fast version) to avoid test non-necessary subpartitions -#if JVET_O0050_LOCAL_DUAL_TREE double bestCostSoFar = partitioner.isSepTree(*tempCS) ? m_modeCtrl->getBestCostWithoutSplitFlags() : bestCU && bestCU->predMode == MODE_INTRA ? bestCS->lumaCost : bestCS->cost; if (partitioner.isSepTree(*tempCS) && encTestMode.maxCostAllowed < bestCostSoFar) -#else - double bestCostSoFar = CS::isDualITree(*tempCS) ? m_modeCtrl->getBestCostWithoutSplitFlags() : bestCU && bestCU->predMode == MODE_INTRA ? bestCS->lumaCost : bestCS->cost; - if (CS::isDualITree(*tempCS) && encTestMode.maxCostAllowed < bestCostSoFar) -#endif { bestCostSoFar = encTestMode.maxCostAllowed; } -#else - //the Intra SubPartitions mode uses the value of the best cost so far (luma if it is the fast version) to avoid test non-necessary lines -#if JVET_O0050_LOCAL_DUAL_TREE - const double bestCostSoFar = partitioner.isSepTree( *tempCS ) ? m_modeCtrl->getBestCostWithoutSplitFlags() : bestCU && bestCU->predMode == MODE_INTRA ? bestCS->lumaCost : bestCS->cost; -#else - const double bestCostSoFar = CS::isDualITree( *tempCS ) ? m_modeCtrl->getBestCostWithoutSplitFlags() : bestCU && bestCU->predMode == MODE_INTRA ? bestCS->lumaCost : bestCS->cost; -#endif -#endif validCandRet = m_pcIntraSearch->estIntraPredLumaQT( cu, partitioner, bestCostSoFar, mtsFlag, startMTSIdx[ trGrpIdx ], endMTSIdx[ trGrpIdx ], ( trGrpIdx > 0 ) ); if( sps.getUseLFNST() && ( !validCandRet || ( cu.ispMode && cu.firstTU->cbf[ COMPONENT_Y ] == 0 ) ) ) { @@ -1941,11 +1761,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC } useIntraSubPartitions = cu.ispMode != NOT_INTRA_SUBPARTITIONS; -#if JVET_O0050_LOCAL_DUAL_TREE if( !partitioner.isSepTree( *tempCS ) ) -#else - if( !CS::isDualITree( *tempCS ) ) -#endif { tempCS->lumaCost = m_pcRdCost->calcRdCost( tempCS->fracBits, tempCS->dist ); if( useIntraSubPartitions ) @@ -1964,29 +1780,17 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC continue; } -#if JVET_O0050_LOCAL_DUAL_TREE if( !partitioner.isSepTree( *tempCS ) ) -#else - if( !CS::isDualITree( *tempCS ) ) -#endif { cu.cs->picture->getRecoBuf( cu.Y() ).copyFrom( cu.cs->getRecoBuf( COMPONENT_Y ) ); cu.cs->picture->getPredBuf(cu.Y()).copyFrom(cu.cs->getPredBuf(COMPONENT_Y)); } } -#if JVET_O0050_LOCAL_DUAL_TREE if( tempCS->area.chromaFormat != CHROMA_400 && ( partitioner.chType == CHANNEL_TYPE_CHROMA || !cu.isSepTree() ) ) -#else - if( tempCS->area.chromaFormat != CHROMA_400 && ( partitioner.chType == CHANNEL_TYPE_CHROMA || !CS::isDualITree( *tempCS ) ) ) -#endif { TUIntraSubPartitioner subTuPartitioner( partitioner ); -#if JVET_O0050_LOCAL_DUAL_TREE m_pcIntraSearch->estIntraPredChromaQT( cu, ( !useIntraSubPartitions || ( cu.isSepTree() && !isLuma( CHANNEL_TYPE_CHROMA ) ) ) ? partitioner : subTuPartitioner, maxCostAllowedForChroma ); -#else - m_pcIntraSearch->estIntraPredChromaQT( cu, ( !useIntraSubPartitions || ( CS::isDualITree( *cu.cs ) && !isLuma( CHANNEL_TYPE_CHROMA ) ) ) ? partitioner : subTuPartitioner, maxCostAllowedForChroma ); -#endif if( useIntraSubPartitions && !cu.ispMode ) { //At this point the temp cost is larger than the best cost. Therefore, we can already skip the remaining calculations @@ -2016,9 +1820,6 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC m_CABACEstimator->cu_skip_flag ( cu ); } m_CABACEstimator->pred_mode ( cu ); -#if !JVET_O0525_REMOVE_PCM - m_CABACEstimator->pcm_data ( cu, partitioner ); -#endif m_CABACEstimator->cu_pred_data ( cu ); m_CABACEstimator->bdpcm_mode ( cu, ComponentID(partitioner.chType) ); @@ -2031,11 +1832,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC tempCS->fracBits = m_CABACEstimator->getEstFracBits(); tempCS->cost = m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist); -#if JVET_O0050_LOCAL_DUAL_TREE double bestIspCost = cu.ispMode ? cu.isSepTree() ? tempCS->cost : tempCS->lumaCost : MAX_DOUBLE; -#else - double bestIspCost = cu.ispMode ? CS::isDualITree( *tempCS ) ? tempCS->cost : tempCS->lumaCost : MAX_DOUBLE; -#endif const double tmpCostWithoutSplitFlags = tempCS->cost; xEncodeDontSplit( *tempCS, partitioner ); @@ -2043,33 +1840,14 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC xCheckDQP( *tempCS, partitioner ); // Check if low frequency non-separable transform (LFNST) is too expensive -#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS if( lfnstIdx && !cuCtx.lfnstLastScanPos ) { -#if JVET_O0050_LOCAL_DUAL_TREE bool cbfAtZeroDepth = cu.isSepTree() ? cu.rootCbf : std::min( cu.firstTU->blocks[ 1 ].width, cu.firstTU->blocks[ 1 ].height ) < 4 ? TU::getCbfAtDepth( *cu.firstTU, COMPONENT_Y, 0 ) : cu.rootCbf; -#else - bool cbfAtZeroDepth = CS::isDualITree( *tempCS ) ? cu.rootCbf : std::min( cu.firstTU->blocks[ 1 ].width, cu.firstTU->blocks[ 1 ].height ) < 4 ? TU::getCbfAtDepth( *cu.firstTU, COMPONENT_Y, 0 ) : cu.rootCbf; -#endif if( cbfAtZeroDepth ) { tempCS->cost = MAX_DOUBLE; } } -#else -#if JVET_O0050_LOCAL_DUAL_TREE - const int nonZeroCoeffThr = cu.isSepTree() ? ( isLuma( partitioner.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA; -#else - const int nonZeroCoeffThr = CS::isDualITree( *tempCS ) ? ( isLuma( partitioner.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA; -#endif - if( lfnstIdx && cuCtx.numNonZeroCoeffNonTs <= nonZeroCoeffThr ) - { - if (cuCtx.numNonZeroCoeffNonTs > 0) - { - tempCS->cost = MAX_DOUBLE; - } - } -#endif if( mtsFlag == 0 && lfnstIdx == 0 ) { @@ -2122,22 +1900,12 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC } } -#if JVET_O0502_ISP_CLEANUP //we decide to skip the non-DCT-II transforms and LFNST according to the ISP results if ((endMtsFlag > 0 || endLfnstIdx > 0) && cu.ispMode && !mtsFlag && !lfnstIdx && tempCS->slice->isIntra() && m_pcEncCfg->getUseFastISP()) -#else - //we decide to skip the second emt pass or not according to the ISP results - if( considerMtsSecondPass && cu.ispMode && !mtsFlag && tempCS->slice->isIntra() ) -#endif { double bestCostDct2NoIsp = m_modeCtrl->getMtsFirstPassNoIspCost(); CHECKD( bestCostDct2NoIsp <= bestIspCost, "wrong cost!" ); -#if JVET_O0502_ISP_CLEANUP double threshold = 1.4; -#else - double nSamples = ( double ) ( cu.lwidth() << floorLog2( cu.lheight() ) ); - double threshold = 1 + 1.4 / sqrt( nSamples ); -#endif double lfnstThreshold = 1.01 * threshold; if( bestCostDct2NoIsp > bestIspCost*lfnstThreshold ) @@ -2188,70 +1956,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC } //trGrpIdx } -#if !JVET_O0525_REMOVE_PCM -void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) -{ - tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); - CodingUnit &cu = tempCS->addCU( CS::getArea( *tempCS, tempCS->area, partitioner.chType ), partitioner.chType ); - - partitioner.setCUData( cu ); - cu.slice = tempCS->slice; - cu.tileIdx = tempCS->picture->brickMap->getBrickIdxRsMap( tempCS->area.lumaPos() ); - cu.skip = false; - cu.mmvdSkip = false; - cu.predMode = MODE_INTRA; - cu.transQuantBypass = encTestMode.lossless; - cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; - cu.qp = encTestMode.qp; - cu.ipcm = true; - cu.bdpcmMode = 0; - - tempCS->addPU( CS::getArea( *tempCS, tempCS->area, partitioner.chType ), partitioner.chType ); - - tempCS->addTU( CS::getArea( *tempCS, tempCS->area, partitioner.chType ), partitioner.chType ); - - m_pcIntraSearch->IPCMSearch(*tempCS, partitioner); - - m_CABACEstimator->getCtx() = m_CurrCtx->start; - - m_CABACEstimator->resetBits(); - - if( tempCS->pps->getTransquantBypassEnabledFlag() ) - { - m_CABACEstimator->cu_transquant_bypass_flag( cu ); - } - - if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag()) - && cu.Y().valid() - ) - { - m_CABACEstimator->cu_skip_flag ( cu ); - } - m_CABACEstimator->pred_mode ( cu ); - m_CABACEstimator->pcm_data ( cu, partitioner ); - - - tempCS->fracBits = m_CABACEstimator->getEstFracBits(); - tempCS->cost = m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist); - - xEncodeDontSplit( *tempCS, partitioner ); - - xCheckDQP( *tempCS, partitioner ); - - xCalDebCost( *tempCS, partitioner ); - tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); - -#if WCG_EXT - DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); -#else - DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda() ); -#endif - xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); -} -#endif - -#if JVET_O0119_BASE_PALETTE_444 void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { tempCS->initStructData(encTestMode.qp, encTestMode.lossless); @@ -2266,20 +1971,13 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; -#if !JVET_O0525_REMOVE_PCM - cu.ipcm = false; -#endif cu.bdpcmMode = 0; tempCS->addPU(CS::getArea(*tempCS, tempCS->area, partitioner.chType), partitioner.chType); tempCS->addTU(CS::getArea(*tempCS, tempCS->area, partitioner.chType), partitioner.chType); // Search tempCS->dist = 0; -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.isSepTree()) -#else - if (CS::isDualITree(*tempCS)) -#endif { if (isLuma(partitioner.chType)) { @@ -2314,11 +2012,7 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit CUCtx cuCtx; cuCtx.isDQPCoded = true; cuCtx.isChromaQpAdjCoded = true; -#if JVET_O0050_LOCAL_DUAL_TREE if (cu.isSepTree()) -#else - if (CS::isDualITree(*tempCS)) -#endif { if (isLuma(partitioner.chType)) { @@ -2350,7 +2044,6 @@ void EncCu::xCheckPLT(CodingStructure *&tempCS, CodingStructure *&bestCS, Partit #endif xCheckBestMode(tempCS, bestCS, partitioner, encTestMode); } -#endif void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeepCtx ) { @@ -2362,11 +2055,7 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep return; } -#if JVET_O0050_LOCAL_DUAL_TREE if (partitioner.isSepTree(cs) && isChroma(partitioner.chType)) -#else - if (CS::isDualITree(cs) && isChroma(partitioner.chType)) -#endif { return; } @@ -2384,12 +2073,8 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep bool hasResidual = false; for( const auto &cu : cs.cus ) { -#if JVET_O0050_LOCAL_DUAL_TREE //not include the chroma CU because chroma CU is decided based on corresponding luma QP and deltaQP is not signaled at chroma CU if( cu->rootCbf && !isChroma( cu->chType )) -#else - if( cu->rootCbf ) -#endif { hasResidual = true; break; @@ -2415,12 +2100,8 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep // NOTE: reset QPs for CUs without residuals up to first coded CU for( const auto &cu : cs.cus ) { -#if JVET_O0050_LOCAL_DUAL_TREE //not include the chroma CU because chroma CU is decided based on corresponding luma QP and deltaQP is not signaled at chroma CU if( cu->rootCbf && !isChroma( cu->chType )) -#else - if( cu->rootCbf ) -#endif { break; } @@ -2558,9 +2239,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& bool bestIsSkip = false; bool bestIsMMVDSkip = true; PelUnitBuf acMergeBuffer[MRG_MAX_NUM_CANDS]; -#if JVET_O0108_DIS_DMVR_BDOF_CIIP PelUnitBuf acMergeTmpBuffer[MRG_MAX_NUM_CANDS]; -#endif PelUnitBuf acMergeRealBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelUnitBuf * acMergeTempBuffer[MMVD_MRG_MAX_RD_NUM]; PelUnitBuf * singleMergeTempBuffer; @@ -2682,12 +2361,8 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& PU::spanMotionInfo( pu, mergeCtx ); pu.mvRefine = true; distParam.cur = singleMergeTempBuffer->Y(); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP acMergeTmpBuffer[uiMergeCand] = m_acMergeTmpBuffer[uiMergeCand].getBuf(localUnitArea); m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer, REF_PIC_LIST_X, true, true, &(acMergeTmpBuffer[uiMergeCand])); -#else - m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer); -#endif acMergeBuffer[uiMergeCand] = m_acRealMergeBuffer[uiMergeCand].getBuf(localUnitArea); acMergeBuffer[uiMergeCand].copyFrom(*singleMergeTempBuffer); pu.mvRefine = false; @@ -2751,11 +2426,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& for (uint32_t mergeCnt = 0; mergeCnt < std::min(std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand), 4); mergeCnt++) { uint32_t mergeCand = MHIntraMergeCand[mergeCnt]; -#if JVET_O0108_DIS_DMVR_BDOF_CIIP acMergeTmpBuffer[mergeCand] = m_acMergeTmpBuffer[mergeCand].getBuf(localUnitArea); -#else - acMergeBuffer[mergeCand] = m_acRealMergeBuffer[mergeCand].getBuf(localUnitArea); -#endif // estimate merge bits mergeCtx.setMergeInfo(pu, mergeCand); @@ -2770,11 +2441,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcIntraSearch->predIntraAng(COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), pu); m_pcIntraSearch->switchBuffer(pu, COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); } -#if JVET_O0108_DIS_DMVR_BDOF_CIIP pu.cs->getPredBuf(pu).copyFrom(acMergeTmpBuffer[mergeCand]); -#else - pu.cs->getPredBuf(pu).copyFrom(acMergeBuffer[mergeCand]); -#endif if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) { pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); @@ -2793,9 +2460,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); } m_CABACEstimator->getCtx() = ctxStart; -#if JVET_O0249_MERGE_SYNTAX pu.regularMergeFlag = false; -#endif uint64_t fracBits = m_pcInterSearch->xCalcPuMeBits(pu); double cost = (double)sadValue + (double)fracBits * sqrtLambdaForFirstPassIntra; insertPos = -1; @@ -2814,9 +2479,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& if ( pu.cs->sps->getUseMMVD() ) { cu.mmvdSkip = true; -#if JVET_O0249_MERGE_SYNTAX pu.regularMergeFlag = true; -#endif const int tempNum = (mergeCtx.numValidMergeCand > 1) ? MMVD_ADD_NUM : MMVD_ADD_NUM >> 1; for (int mmvdMergeCand = 0; mmvdMergeCand < tempNum; mmvdMergeCand++) { @@ -2962,17 +2625,13 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& else if (RdModeList[uiMrgHADIdx].isMMVD) { cu.mmvdSkip = true; -#if JVET_O0249_MERGE_SYNTAX pu.regularMergeFlag = true; -#endif mergeCtx.setMmvdMergeCandiInfo(pu, uiMergeCand); } else { cu.mmvdSkip = false; -#if JVET_O0249_MERGE_SYNTAX pu.regularMergeFlag = true; -#endif mergeCtx.setMergeInfo(pu, uiMergeCand); } PU::spanMotionInfo( pu, mergeCtx ); @@ -3009,29 +2668,17 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& { uint32_t bufIdx = 0; PelBuf tmpBuf = tempCS->getPredBuf(pu).Y(); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Y()); -#else - tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Y()); -#endif if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) { tmpBuf.rspSignal(m_pcReshape->getFwdLUT()); } m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, bufIdx)); tmpBuf = tempCS->getPredBuf(pu).Cb(); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Cb()); -#else - tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cb()); -#endif m_pcIntraSearch->geneWeightedPred(COMPONENT_Cb, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cb, bufIdx)); tmpBuf = tempCS->getPredBuf(pu).Cr(); -#if JVET_O0108_DIS_DMVR_BDOF_CIIP tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Cr()); -#else - tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cr()); -#endif m_pcIntraSearch->geneWeightedPred(COMPONENT_Cr, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cr, bufIdx)); } else @@ -3127,16 +2774,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru trianglecandHasNoResidual[mergeCand] = false; } -#if JVET_O0379_SPEEDUP_TPM_ENCODER bool bestIsSkip = false; -#else - bool bestIsSkip; - CodingUnit* cuTemp = bestCS->getCU(partitioner.chType); - if (cuTemp) - bestIsSkip = m_pcEncCfg->getUseFastDecisionForMerge() ? bestCS->getCU(partitioner.chType)->rootCbf == 0 : false; - else - bestIsSkip = false; -#endif uint8_t numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; uint8_t triangleNumMrgSATDCand = TRIANGLE_MAX_NUM_SATD_CANDS; PelUnitBuf triangleBuffer[TRIANGLE_MAX_NUM_UNI_CANDS]; @@ -3145,12 +2783,6 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru static_vector<double, TRIANGLE_MAX_NUM_CANDS> tianglecandCostList; uint8_t numTriangleCandComb = slice.getMaxNumTriangleCand() * (slice.getMaxNumTriangleCand() - 1) * 2; -#if !JVET_O0379_SPEEDUP_TPM_ENCODER - if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) - { - bestIsSkip |= blkCache->isSkip( tempCS->area ); - } -#endif DistParam distParam; const bool useHadamard = !encTestMode.lossless && !tempCS->slice->getDisableSATDForRD(); @@ -3194,21 +2826,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru } } -#if JVET_O0379_SPEEDUP_TPM_ENCODER - triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, numTriangleCandComb); -#else - bool tempBufSet = bestIsSkip ? false : true; - triangleNumMrgSATDCand = bestIsSkip ? TRIANGLE_MAX_NUM_CANDS : TRIANGLE_MAX_NUM_SATD_CANDS; triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, numTriangleCandComb); - if( bestIsSkip ) - { - for( uint8_t i = 0; i < TRIANGLE_MAX_NUM_CANDS; i++ ) - { - triangleRdModeList.push_back(i); - } - } - else -#endif { CodingUnit &cu = tempCS->addCU( tempCS->area, partitioner.chType ); @@ -3352,21 +2970,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); return; } -#if JVET_O0379_SPEEDUP_TPM_ENCODER tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); -#else - if( tempBufSet ) - { - tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); - } - else - { - triangleBuffer[candIdx0] = m_acMergeBuffer[candIdx0].getBuf( localUnitArea ); - triangleBuffer[candIdx1] = m_acMergeBuffer[candIdx1].getBuf( localUnitArea ); - PelUnitBuf predBuf = tempCS->getPredBuf(); - m_pcInterSearch->weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); - } -#endif xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, ( noResidualPass == 0 ? &trianglecandHasNoResidual[mergeCand] : NULL ) ); if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip) @@ -3674,11 +3278,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { assert(partitioner.chType != CHANNEL_TYPE_CHROMA); // chroma IBC is derived -#if JVET_O1161_IBC_MAX_SIZE if (tempCS->area.lwidth() == 128 || tempCS->area.lheight() == 128) // disable IBC mode larger than 64x64 -#else - if (tempCS->area.lwidth() == 128 && tempCS->area.lheight() == 128) // disable 128x128 IBC mode -#endif { return; } @@ -3774,22 +3374,13 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct const int cuPelY = pu.Y().y; int roiWidth = pu.lwidth(); int roiHeight = pu.lheight(); -#if JVET_O1164_PS const int picWidth = pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); const int picHeight = pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); -#else - const int picWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); - const int picHeight = pu.cs->slice->getSPS()->getPicHeightInLumaSamples(); -#endif const unsigned int lcuWidth = pu.cs->slice->getSPS()->getMaxCUWidth(); int xPred = pu.bv.getHor(); int yPred = pu.bv.getVer(); -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!m_pcInterSearch->searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, xPred, yPred, lcuWidth)) // not valid bv derived -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, xPred, yPred, lcuWidth)) // not valid bv derived -#endif { numValidBv--; continue; @@ -3876,11 +3467,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct PU::spanMotionInfo(pu, mergeCtx); assert(mergeCtx.mrgTypeNeighbours[mergeCand] == MRG_TYPE_IBC); // should be IBC candidate at this round -#if JVET_O0050_LOCAL_DUAL_TREE const bool chroma = !pu.cu->isSepTree(); -#else - const bool chroma = !(CS::isDualITree(*tempCS)); -#endif // MC m_pcInterSearch->motionCompensation(pu,REF_PIC_LIST_0, true, chroma); @@ -3925,11 +3512,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { -#if JVET_O1161_IBC_MAX_SIZE if (tempCS->area.lwidth() == 128 || tempCS->area.lheight() == 128) // disable IBC mode larger than 64x64 -#else - if (tempCS->area.lwidth() == 128 && tempCS->area.lheight() == 128) // disable 128x128 IBC mode -#endif { return; } @@ -3967,20 +3550,12 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best pu.interDir = 1; // use list 0 for IBC mode pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF; // last idx in the list -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE - if (partitioner.chType == CHANNEL_TYPE_LUMA) - { -#endif bool bValid = m_pcInterSearch->predIBCSearch(cu, partitioner, m_ctuIbcSearchRangeX, m_ctuIbcSearchRangeY, m_ibcHashMap); if (bValid) { PU::spanMotionInfo(pu); -#if JVET_O0050_LOCAL_DUAL_TREE const bool chroma = !pu.cu->isSepTree(); -#else - const bool chroma = !(CS::isDualITree(*tempCS)); -#endif // MC m_pcInterSearch->motionCompensation(pu, REF_PIC_LIST_0, true, chroma); @@ -4019,75 +3594,6 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best tempCS->cost = MAX_DOUBLE; tempCS->costDbOffset = 0; } -#if !JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE - } - // chroma CU ibc comp - else - { - bool success = true; - // chroma tree, reuse luma bv at minimal block level - // enabled search only when each chroma sub-block has a BV from its luma sub-block - assert(tempCS->getIbcLumaCoverage(pu.Cb()) == IBC_LUMA_COVERAGE_FULL); - // check if each BV for the chroma sub-block is valid - //static const UInt unitArea = MIN_PU_SIZE * MIN_PU_SIZE; - const CompArea lumaArea = CompArea(COMPONENT_Y, pu.chromaFormat, pu.Cb().lumaPos(), recalcSize(pu.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, pu.Cb().size())); - PredictionUnit subPu; - subPu.cs = pu.cs; - subPu.cu = pu.cu; - const ComponentID compID = COMPONENT_Cb; // use Cb to represent both Cb and CR, as their structures are the same - int shiftHor = ::getComponentScaleX(compID, pu.chromaFormat); - int shiftVer = ::getComponentScaleY(compID, pu.chromaFormat); - //const ChromaFormat chFmt = pu.chromaFormat; - - for (int y = lumaArea.y; y < lumaArea.y + lumaArea.height; y += MIN_PU_SIZE) - { - for (int x = lumaArea.x; x < lumaArea.x + lumaArea.width; x += MIN_PU_SIZE) - { - const MotionInfo &curMi = pu.cs->picture->cs->getMotionInfo(Position{ x, y }); - - subPu.UnitArea::operator=(UnitArea(pu.chromaFormat, Area(x, y, MIN_PU_SIZE, MIN_PU_SIZE))); - Position offsetRef = subPu.blocks[compID].pos().offset((curMi.bv.getHor() >> shiftHor), (curMi.bv.getVer() >> shiftVer)); - Position refEndPos(offsetRef.x + subPu.blocks[compID].size().width - 1, offsetRef.y + subPu.blocks[compID].size().height - 1 ); - - if (!subPu.cs->isDecomp(refEndPos, toChannelType(compID)) || !subPu.cs->isDecomp(offsetRef, toChannelType(compID))) // ref block is not yet available for this chroma sub-block - { - success = false; - break; - } - } - if (!success) - break; - } - //////////////////////////////////////////////////////////////////////////// - - if (success) - { - //pu.mergeType = MRG_TYPE_IBC; - m_pcInterSearch->motionCompensation(pu, REF_PIC_LIST_0, false, true); // luma=0, chroma=1 - m_pcInterSearch->encodeResAndCalcRdInterCU(*tempCS, partitioner, false, false, true); - - xEncodeDontSplit(*tempCS, partitioner); - - xCheckDQP(*tempCS, partitioner); - tempCS->useDbCost = m_pcEncCfg->getUseEncDbOpt(); - if ( m_bestModeUpdated ) - { - xCalDebCost( *tempCS, partitioner ); - } - - DTRACE_MODE_COST(*tempCS, m_pcRdCost->getLambda()); - - xCheckBestMode(tempCS, bestCS, partitioner, encTestMode); - } - else - { - tempCS->dist = 0; - tempCS->fracBits = 0; - tempCS->cost = MAX_DOUBLE; - tempCS->costDbOffset = 0; - } - } -#endif } // check ibc mode in encoder RD ////////////////////////////////////////////////////////////////////////////////////////////// @@ -4219,22 +3725,13 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC -#if JVET_O0057_ALTHPELIF bool EncCu::xCheckRDCostInterIMV(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode, double &bestIntPelCost) -#else -bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) -#endif { int iIMV = int( ( encTestMode.opts & ETO_IMV ) >> ETO_IMV_SHIFT ); m_pcInterSearch->setAffineModeSelected(false); -#if JVET_O0057_ALTHPELIF // Only Half-Pel, int-Pel, 4-Pel and fast 4-Pel allowed CHECK(iIMV < 1 || iIMV > 4, "Unsupported IMV Mode"); const bool testAltHpelFilter = iIMV == 4; -#else - // Only int-Pel, 4-Pel and fast 4-Pel allowed - CHECK( iIMV != 1 && iIMV != 2 && iIMV != 3, "Unsupported IMV Mode" ); -#endif // Fast 4-Pel Mode m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; @@ -4305,7 +3802,6 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be CU::addPUs( cu ); -#if JVET_O0057_ALTHPELIF if (testAltHpelFilter) { cu.imv = IMV_HPEL; @@ -4314,17 +3810,10 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be { cu.imv = iIMV == 1 ? IMV_FPEL : IMV_4PEL; } -#else - cu.imv = iIMV > 1 ? 2 : 1; -#endif bool testGbi; uint8_t gbiIdx; -#if JVET_O0057_ALTHPELIF bool affineAmvrEanbledFlag = !testAltHpelFilter && cu.slice->getSPS()->getAffineAmvrEnabledFlag(); -#else - bool affineAmvrEanbledFlag = cu.slice->getSPS()->getAffineAmvrEnabledFlag(); -#endif cu.GBiIdx = g_GbiSearchOrder[gbiLoopIdx]; gbiIdx = cu.GBiIdx; @@ -4389,12 +3878,10 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be , &equGBiCost ); -#if JVET_O0057_ALTHPELIF if( cu.imv == IMV_FPEL && tempCS->cost < bestIntPelCost ) { bestIntPelCost = tempCS->cost; } -#endif tempCS->initStructData(encTestMode.qp, encTestMode.lossless); double skipTH = MAX_DOUBLE; @@ -4442,26 +3929,16 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal const ChromaFormat format = cs.area.chromaFormat; CodingUnit* cu = cs.getCU(partitioner.chType); const Position lumaPos = cu->Y().valid() ? cu->Y().pos() : recalcPosition( format, cu->chType, CHANNEL_TYPE_LUMA, cu->blocks[cu->chType].pos() ); -#if JVET_O0060_4x4_deblocking bool topEdgeAvai = lumaPos.y > 0 && ((lumaPos.y % 4) == 0); bool leftEdgeAvai = lumaPos.x > 0 && ((lumaPos.x % 4) == 0); -#else - bool topEdgeAvai = lumaPos.y > 0 && ( ( lumaPos.y % 8 ) == 0 ); - bool leftEdgeAvai = lumaPos.x > 0 && ( ( lumaPos.x % 8 ) == 0 ); -#endif bool anyEdgeAvai = topEdgeAvai || leftEdgeAvai; cs.costDbOffset = 0; if ( calDist ) { const UnitArea currCsArea = clipArea( CS::getArea( cs, cs.area, partitioner.chType ), *cs.picture ); -#if JVET_O0050_LOCAL_DUAL_TREE ComponentID compStr = ( cu->isSepTree() && !isLuma( partitioner.chType ) ) ? COMPONENT_Cb : COMPONENT_Y; ComponentID compEnd = ( cu->isSepTree() && isLuma( partitioner.chType ) ) ? COMPONENT_Y : COMPONENT_Cr; -#else - ComponentID compStr = ( CS::isDualITree( cs ) && !isLuma( partitioner.chType ) ) ? COMPONENT_Cb : COMPONENT_Y; - ComponentID compEnd = ( CS::isDualITree( cs ) && isLuma( partitioner.chType ) ) ? COMPONENT_Y : COMPONENT_Cr; -#endif Distortion finalDistortion = 0; for ( int comp = compStr; comp <= compEnd; comp++ ) { @@ -4476,13 +3953,8 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal if ( anyEdgeAvai && m_pcEncCfg->getUseEncDbOpt() ) { -#if JVET_O0050_LOCAL_DUAL_TREE ComponentID compStr = ( cu->isSepTree() && !isLuma( partitioner.chType ) ) ? COMPONENT_Cb : COMPONENT_Y; ComponentID compEnd = ( cu->isSepTree() && isLuma( partitioner.chType ) ) ? COMPONENT_Y : COMPONENT_Cr; -#else - ComponentID compStr = ( CS::isDualITree( cs ) && !isLuma( partitioner.chType ) ) ? COMPONENT_Cb : COMPONENT_Y; - ComponentID compEnd = ( CS::isDualITree( cs ) && isLuma( partitioner.chType ) ) ? COMPONENT_Y : COMPONENT_Cr; -#endif const UnitArea currCsArea = clipArea( CS::getArea( cs, cs.area, partitioner.chType ), *cs.picture ); @@ -4653,7 +4125,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS bool swapped = false; // avoid unwanted data copy bool reloadCU = false; -#if JVET_O0567_MVDRange_Constraint const PredictionUnit& pu = *cu->firstPU; // clang-format off @@ -4669,9 +4140,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS MV_PRECISION_INTERNAL - MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL - MV_PRECISION_INT, MV_PRECISION_INTERNAL - MV_PRECISION_4PEL, -#if JVET_O0057_ALTHPELIF MV_PRECISION_INTERNAL - MV_PRECISION_HALF, -#endif }; // clang-format on @@ -4700,35 +4169,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS } } } -#else - // Not allow very big |MVd| to avoid CABAC crash caused by too large MVd. Normally no impact on coding performance. - const int maxMvd = 1 << 15; - const PredictionUnit& pu = *cu->firstPU; - if (!cu->affine) - { - if ((pu.refIdx[0] >= 0 && (pu.mvd[0].getAbsHor() >= maxMvd || pu.mvd[0].getAbsVer() >= maxMvd)) - || (pu.refIdx[1] >= 0 && (pu.mvd[1].getAbsHor() >= maxMvd || pu.mvd[1].getAbsVer() >= maxMvd))) - { - return; - } - } - else - { - for (int refList = 0; refList < NUM_REF_PIC_LIST_01; refList++) - { - if (pu.refIdx[refList] >= 0) - { - for (int ctrlP = 1 + (cu->affineType == AFFINEMODEL_6PARAM); ctrlP >= 0; ctrlP--) - { - if (pu.mvdAffi[refList][ctrlP].getAbsHor() >= maxMvd || pu.mvdAffi[refList][ctrlP].getAbsVer() >= maxMvd) - { - return; - } - } - } - } - } -#endif // avoid MV exceeding 18-bit dynamic range const int maxMv = 1 << 17; if (!cu->affine && !pu.mergeFlag) @@ -4865,12 +4305,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS sbtOffRootCbf = cu->rootCbf; currBestSbt = CU::getSbtInfo( cu->firstTU->mtsIdx > MTS_SKIP ? SBT_OFF_MTS : SBT_OFF_DCT, 0 ); currBestTrs = cu->firstTU->mtsIdx; -#if !JVET_O0545_MAX_TB_SIGNALLING - if( cu->lwidth() <= MAX_TB_SIZEY && cu->lheight() <= MAX_TB_SIZEY ) - { - CHECK( tempCS->tus.size() != 1, "tu must be only one" ); - } -#endif #if WCG_EXT DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); @@ -5063,10 +4497,8 @@ void EncCu::xEncodeDontSplit( CodingStructure &cs, Partitioner &partitioner ) m_CABACEstimator->resetBits(); m_CABACEstimator->split_cu_mode( CU_DONT_SPLIT, cs, partitioner ); -#if JVET_O0050_LOCAL_DUAL_TREE if( partitioner.treeType == TREE_C ) CHECK( m_CABACEstimator->getEstFracBits() != 0, "must be 0 bit" ); -#endif cs.fracBits += m_CABACEstimator->getEstFracBits(); // split bits cs.cost = m_pcRdCost->calcRdCost( cs.fracBits, cs.dist ); @@ -5089,9 +4521,7 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best partitioner.setCUData( cu ); if( CU::isIntra( cu ) -#if JVET_O0119_BASE_PALETTE_444 || CU::isPLT(cu) -#endif ) { xReconIntraQT( cu ); @@ -5118,11 +4548,7 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best { const ComponentID compID = ComponentID( comp ); -#if JVET_O0050_LOCAL_DUAL_TREE if( partitioner.isSepTree( *tempCS ) && toChannelType( compID ) != partitioner.chType ) -#else - if( CS::isDualITree( *tempCS ) && toChannelType( compID ) != partitioner.chType ) -#endif { continue; } diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 274d98c152117b944f2638ee88598808e55e7f62..c812dad0cc5d4606838762d3e3317f658546c6bf 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -102,10 +102,8 @@ private: CodingStructure ***m_pTempCS; CodingStructure ***m_pBestCS; -#if JVET_O0050_LOCAL_DUAL_TREE CodingStructure ***m_pTempCS2; CodingStructure ***m_pBestCS2; -#endif // Access channel EncCfg* m_pcEncCfg; IntraSearch* m_pcIntraSearch; @@ -127,9 +125,7 @@ private: PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelStorage m_acRealMergeBuffer[MRG_MAX_NUM_CANDS]; -#if JVET_O0108_DIS_DMVR_BDOF_CIIP PelStorage m_acMergeTmpBuffer[MRG_MAX_NUM_CANDS]; -#endif PelStorage m_acTriangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; // to store weighted prediction pixles double m_mergeBestSATDCost; MotionInfo m_SubPuMiBuf [( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 )]; @@ -183,11 +179,7 @@ protected: void xCalDebCost ( CodingStructure &cs, Partitioner &partitioner, bool calDist = false ); Distortion getDistortionDb ( CodingStructure &cs, CPelBuf org, CPelBuf reco, ComponentID compID, const CompArea& compArea, bool afterDb ); -#if JVET_O0502_ISP_CLEANUP void xCompressCU ( CodingStructure*& tempCS, CodingStructure*& bestCS, Partitioner& pm, double maxCostAllowed = MAX_DOUBLE ); -#else - void xCompressCU ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm ); -#endif #if ENABLE_SPLIT_PARALLELISM void xCompressCUParallel ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm ); void copyState ( EncCu* other, Partitioner& pm, const UnitArea& currArea, const bool isDist ); @@ -196,16 +188,9 @@ protected: bool xCheckBestMode ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestmode ); -#if JVET_O0050_LOCAL_DUAL_TREE void xCheckModeSplit ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode, const ModeType modeTypeParent, bool &skipInterPass ); -#else - void xCheckModeSplit ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#endif void xCheckRDCostIntra ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if !JVET_O0525_REMOVE_PCM - void xCheckIntraPCM ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#endif void xCheckDQP ( CodingStructure& cs, Partitioner& partitioner, bool bKeepCtx = false); void xFillPCMBuffer ( CodingUnit &cu); @@ -214,11 +199,7 @@ protected: void xCheckRDCostAffineMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); void xCheckRDCostInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if JVET_O0057_ALTHPELIF bool xCheckRDCostInterIMV(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode, double &bestIntPelCost); -#else - bool xCheckRDCostInterIMV ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode); -#endif void xEncodeDontSplit ( CodingStructure &cs, Partitioner &partitioner); void xCheckRDCostMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); @@ -250,9 +231,7 @@ protected: void xCheckRDCostIBCMode ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); void xCheckRDCostIBCModeMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); -#if JVET_O0119_BASE_PALETTE_444 void xCheckPLT ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); -#endif }; //! \} diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index e3302654e7707f79e3dd1af817708d55f7c3bfbb..88fc69c47a25ad044b010df85ae48478da75af79 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -88,9 +88,7 @@ EncGOP::EncGOP() m_iNumPicCoded = 0; //Niko m_bFirst = true; m_iLastRecoveryPicPOC = 0; -#if JVET_N0494_DRAP m_latestDRAPPOC = MAX_INT; -#endif m_lastRasPoc = MAX_INT; m_pcCfg = NULL; @@ -104,12 +102,8 @@ EncGOP::EncGOP() m_numLongTermRefPicSPS = 0; ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); ::memset(m_ltRefPicUsedByCurrPicFlag, 0, sizeof(m_ltRefPicUsedByCurrPicFlag)); -#if !JVET_N0867_TEMP_SCAL_HRD - m_lastBPSEI = 0; -#else ::memset(m_lastBPSEI, 0, sizeof(m_lastBPSEI)); m_rapWithLeading = false; -#endif m_bufferingPeriodSEIPresentInAU = false; m_associatedIRAPType = NAL_UNIT_CODED_SLICE_IDR_N_LP; m_associatedIRAPPOC = 0; @@ -218,16 +212,9 @@ void EncGOP::init ( EncLib* pcEncLib ) m_pcSAO = pcEncLib->getSAO(); m_pcALF = pcEncLib->getALF(); m_pcRateCtrl = pcEncLib->getRateCtrl(); -#if !JVET_N0867_TEMP_SCAL_HRD - m_lastBPSEI = 0; - m_totalCoded = 0; -#else ::memset(m_lastBPSEI, 0, sizeof(m_lastBPSEI)); ::memset(m_totalCoded, 0, sizeof(m_totalCoded)); -#endif -#if JVET_N0353_INDEP_BUFF_TIME_SEI m_HRD = pcEncLib->getHRD(); -#endif m_AUWriterIf = pcEncLib->getAUWriterIf(); @@ -323,9 +310,7 @@ int EncGOP::xWriteVPS (AccessUnit &accessUnit, const VPS *vps) { OutputNALUnit nalu(NAL_UNIT_VPS); m_HLSWriter->setBitstream( &nalu.m_Bitstream ); -#if JVET_O0245_VPS_DPS_APS CHECK( nalu.m_temporalId, "The value of TemporalId of VPS NAL units shall be equal to 0" ); -#endif m_HLSWriter->codeVPS( vps ); accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; @@ -337,9 +322,7 @@ int EncGOP::xWriteDPS (AccessUnit &accessUnit, const DPS *dps) { OutputNALUnit nalu(NAL_UNIT_DPS); m_HLSWriter->setBitstream( &nalu.m_Bitstream ); -#if JVET_O0245_VPS_DPS_APS CHECK( nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0" ); -#endif m_HLSWriter->codeDPS( dps ); accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; @@ -355,53 +338,31 @@ int EncGOP::xWriteSPS (AccessUnit &accessUnit, const SPS *sps) { OutputNALUnit nalu(NAL_UNIT_SPS); m_HLSWriter->setBitstream( &nalu.m_Bitstream ); -#if JVET_O0245_VPS_DPS_APS CHECK( nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0" ); -#endif m_HLSWriter->codeSPS( sps ); accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#if JVET_O1136_TS_BDPCM_SIGNALLING -#if JVET_O0245_VPS_DPS_APS int EncGOP::xWritePPS( AccessUnit &accessUnit, const PPS *pps, const SPS *sps, const int layerId ) -#else -int EncGOP::xWritePPS (AccessUnit &accessUnit, const PPS *pps, const SPS *sps) -#endif -#else -int EncGOP::xWritePPS (AccessUnit &accessUnit, const PPS *pps) -#endif { OutputNALUnit nalu(NAL_UNIT_PPS); m_HLSWriter->setBitstream( &nalu.m_Bitstream ); -#if JVET_O0245_VPS_DPS_APS nalu.m_nuhLayerId = layerId; CHECK( nalu.m_temporalId < accessUnit.temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING m_HLSWriter->codePPS( pps, sps ); -#else - m_HLSWriter->codePPS( pps ); -#endif accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } -#if JVET_O0245_VPS_DPS_APS int EncGOP::xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId ) -#else -int EncGOP::xWriteAPS(AccessUnit &accessUnit, APS *aps) -#endif { OutputNALUnit nalu(NAL_UNIT_APS); m_HLSWriter->setBitstream(&nalu.m_Bitstream); -#if JVET_O0245_VPS_DPS_APS nalu.m_nuhLayerId = layerId; nalu.m_temporalId = aps->getTemporalId(); CHECK( nalu.m_temporalId < accessUnit.temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); -#endif m_HLSWriter->codeAPS(aps); accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; @@ -427,11 +388,7 @@ int EncGOP::xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const boo } if (m_pcEncLib->PPSNeedsWriting(slice->getPPS()->getPPSId())) // Note this assumes that all changes to the PPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). { -#if JVET_O1136_TS_BDPCM_SIGNALLING actualTotalBits += xWritePPS(accessUnit, slice->getPPS(), slice->getSPS()); -#else - actualTotalBits += xWritePPS(accessUnit, slice->getPPS()); -#endif } return actualTotalBits; @@ -441,10 +398,8 @@ void EncGOP::xWriteAccessUnitDelimiter (AccessUnit &accessUnit, Slice *slice) { AUDWriter audWriter; OutputNALUnit nalu(NAL_UNIT_ACCESS_UNIT_DELIMITER); -#if JVET_O0245_VPS_DPS_APS nalu.m_temporalId = slice->getTLayer(); CHECK( nalu.m_temporalId < accessUnit.temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); -#endif int picType = slice->isIntra() ? 0 : (slice->isInterP() ? 1 : 2); audWriter.codeAUD(nalu.m_Bitstream, picType); @@ -460,15 +415,7 @@ void EncGOP::xWriteSEI (NalUnitType naluType, SEIMessages& seiMessages, AccessUn return; } OutputNALUnit nalu(naluType, temporalId); -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if !JVET_N0867_TEMP_SCAL_HRD - m_seiWriter.writeSEImessages(nalu.m_Bitstream, seiMessages, sps, *m_HRD, false); -#else m_seiWriter.writeSEImessages(nalu.m_Bitstream, seiMessages, sps, *m_HRD, false, temporalId); -#endif -#else - m_seiWriter.writeSEImessages(nalu.m_Bitstream, seiMessages, sps, false); -#endif auPos = accessUnit.insert(auPos, new NALUnitEBSP(nalu)); auPos++; } @@ -485,15 +432,7 @@ void EncGOP::xWriteSEISeparately (NalUnitType naluType, SEIMessages& seiMessages SEIMessages tmpMessages; tmpMessages.push_back(*sei); OutputNALUnit nalu(naluType, temporalId); -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if !JVET_N0867_TEMP_SCAL_HRD - m_seiWriter.writeSEImessages(nalu.m_Bitstream, tmpMessages, sps, *m_HRD, false); -#else m_seiWriter.writeSEImessages(nalu.m_Bitstream, tmpMessages, sps, *m_HRD, false, temporalId); -#endif -#else - m_seiWriter.writeSEImessages(nalu.m_Bitstream, tmpMessages, sps, false); -#endif auPos = accessUnit.insert(auPos, new NALUnitEBSP(nalu)); auPos++; } @@ -616,11 +555,7 @@ void EncGOP::xWriteDuSEIMessages (SEIMessages& duInfoSeiMessages, AccessUnit &ac { const HRDParameters *hrd = sps->getHrdParameters(); -#if JVET_O0189_DU if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getDecodingUnitCpbParamsInPicTimingSeiFlag() ) -#else - if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) -#endif { int naluIdx = 0; AccessUnit::iterator nalu = accessUnit.begin(); @@ -747,38 +682,13 @@ void EncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const SPS void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, Slice *slice) { -#if JVET_OO152_BP_SEI_GDR -#if JVET_O0189_DU - if ((m_pcCfg->getBufferingPeriodSEIEnabled()) && (slice->isIRAP() || slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && - ( slice->getSPS()->getHrdParametersPresentFlag() ) ) -#else if ((m_pcCfg->getBufferingPeriodSEIEnabled()) && (slice->isIRAP() || slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) && - (slice->getSPS()->getVuiParametersPresentFlag()) && - ((slice->getSPS()->getHrdParameters()->getNalHrdParametersPresentFlag()) - || (slice->getSPS()->getHrdParameters()->getVclHrdParametersPresentFlag()))) -#endif -#else -#if JVET_O0189_DU - if( ( m_pcCfg->getBufferingPeriodSEIEnabled() ) && ( slice->getSliceType() == I_SLICE ) && ( slice->getSPS()->getHrdParametersPresentFlag() ) ) -#else - if( ( m_pcCfg->getBufferingPeriodSEIEnabled() ) && ( slice->getSliceType() == I_SLICE ) && - ( slice->getSPS()->getVuiParametersPresentFlag() ) && - ( ( slice->getSPS()->getHrdParameters()->getNalHrdParametersPresentFlag() ) - || ( slice->getSPS()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) ) -#endif -#endif { SEIBufferingPeriod *bufferingPeriodSEI = new SEIBufferingPeriod(); -#if !JVET_N0867_TEMP_SCAL_HRD - m_seiEncoder.initSEIBufferingPeriod(bufferingPeriodSEI); -#else bool noLeadingPictures = ( (slice->getNalUnitType()!= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (slice->getNalUnitType()!= NAL_UNIT_CODED_SLICE_CRA) )?(true):(false); m_seiEncoder.initSEIBufferingPeriod(bufferingPeriodSEI,noLeadingPictures); -#endif -#if JVET_N0353_INDEP_BUFF_TIME_SEI m_HRD->setBufferingPeriodSEI(bufferingPeriodSEI); -#endif seiMessages.push_back(bufferingPeriodSEI); m_bufferingPeriodSEIPresentInAU = true; @@ -792,14 +702,12 @@ void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessage #endif } -#if JVET_N0494_DRAP if (m_pcEncLib->getDependentRAPIndicationSEIEnabled() && slice->isDRAP()) { SEIDependentRAPIndication *dependentRAPIndicationSEI = new SEIDependentRAPIndication(); m_seiEncoder.initSEIDependentRAPIndication(dependentRAPIndicationSEI); seiMessages.push_back(dependentRAPIndicationSEI); } -#endif #if HEVC_SEI if (picInGOP ==0 && m_pcCfg->getSOPDescriptionSEIEnabled() ) // write SOP description SEI (if enabled) at the beginning of GOP @@ -872,7 +780,6 @@ void EncGOP::xCreateScalableNestingSEI (SEIMessages& seiMessages, SEIMessages& n } #endif -#if JVET_O0041_FRAME_FIELD_SEI void EncGOP::xCreateFrameFieldInfoSEI (SEIMessages& seiMessages, Slice *slice, bool isField) { if (m_pcCfg->getFrameFieldInfoSEIEnabled()) @@ -888,40 +795,27 @@ void EncGOP::xCreateFrameFieldInfoSEI (SEIMessages& seiMessages, Slice *slice, seiMessages.push_back(frameFieldInfoSEI); } } -#endif void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, SEIMessages& duInfoSeiMessages, Slice *slice, bool isField, std::deque<DUData> &duData) { -#if JVET_N0353_INDEP_BUFF_TIME_SEI // Picture timing depends on buffering period. When either of those is not disabled, // initialization would fail. Needs more cleanup after DU timing is integrated. if (!(m_pcCfg->getPictureTimingSEIEnabled() && m_pcCfg->getBufferingPeriodSEIEnabled())) { return; } -#endif const HRDParameters *hrd = slice->getSPS()->getHrdParameters(); // update decoding unit parameters -#if JVET_O0189_DU if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) ) -#else - if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && - ( slice->getSPS()->getVuiParametersPresentFlag() ) && - ( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) ) -#endif { int picSptDpbOutputDuDelay = 0; SEIPictureTiming *pictureTimingSEI = new SEIPictureTiming(); // DU parameters -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) -#else - if( hrd->getSubPicCpbParamsPresentFlag() ) -#endif { uint32_t numDU = (uint32_t) duData.size(); pictureTimingSEI->m_numDecodingUnitsMinus1 = ( numDU - 1 ); @@ -929,11 +823,7 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, pictureTimingSEI->m_numNalusInDuMinus1.resize( numDU ); pictureTimingSEI->m_duCpbRemovalDelayMinus1.resize( numDU ); } -#if JVET_N0353_INDEP_BUFF_TIME_SEI const uint32_t cpbRemovalDelayLegth = m_HRD->getBufferingPeriodSEI()->m_cpbRemovalDelayLength; -#if !JVET_N0867_TEMP_SCAL_HRD - pictureTimingSEI->m_auCpbRemovalDelay = std::min<int>(std::max<int>(1, m_totalCoded - m_lastBPSEI), static_cast<int>(pow(2, static_cast<double>(cpbRemovalDelayLegth)))); // Syntax element signalled as minus, hence the . -#else const uint32_t maxNumSubLayers = slice->getSPS()->getMaxTLayers(); pictureTimingSEI->m_ptMaxSubLayers = maxNumSubLayers; pictureTimingSEI->m_auCpbRemovalDelay[maxNumSubLayers-1] = std::min<int>(std::max<int>(1, m_totalCoded[maxNumSubLayers-1] - m_lastBPSEI[maxNumSubLayers-1]), static_cast<int>(pow(2, static_cast<double>(cpbRemovalDelayLegth)))); // Syntax element signalled as minus, hence the . @@ -1103,15 +993,7 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, CHECK( (scaledDistToBuffPeriod) > pow(2, static_cast<double>(cpbRemovalDelayLegth)), " cpbRemovalDelayLegth too small for m_auCpbRemovalDelay[i] at picture timing SEI " ); } } -#endif -#else - pictureTimingSEI->m_auCpbRemovalDelay = std::min<int>(std::max<int>(1, m_totalCoded - m_lastBPSEI), static_cast<int>(pow(2, static_cast<double>(hrd->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . -#endif -#if !JVET_N0867_TEMP_SCAL_HRD - pictureTimingSEI->m_picDpbOutputDelay = slice->getSPS()->getNumReorderPics(slice->getSPS()->getMaxTLayers()-1) + slice->getPOC() - m_totalCoded; -#else pictureTimingSEI->m_picDpbOutputDelay = slice->getSPS()->getNumReorderPics(slice->getSPS()->getMaxTLayers()-1) + slice->getPOC() - m_totalCoded[maxNumSubLayers-1]; -#endif if(m_pcCfg->getEfficientFieldIRAPEnabled() && IRAPGOPid > 0 && IRAPGOPid < m_iGopSize) { // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation @@ -1125,9 +1007,6 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, } if (m_bufferingPeriodSEIPresentInAU) { -#if !JVET_N0867_TEMP_SCAL_HRD - m_lastBPSEI = m_totalCoded; -#else for( int i = temporalId ; i < maxNumSubLayers ; i ++ ) { m_lastBPSEI[i] = m_totalCoded[i]; @@ -1136,15 +1015,11 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, { m_rapWithLeading = true; } -#endif } if( m_pcCfg->getPictureTimingSEIEnabled() ) { -#if !JVET_O0041_FRAME_FIELD_SEI - pictureTimingSEI->m_picStruct = (isField && slice->getPic()->topField)? 1 : isField? 2 : 0; -#endif seiMessages.push_back(pictureTimingSEI); #if HEVC_SEI @@ -1157,11 +1032,7 @@ void EncGOP::xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, #endif } -#if JVET_O0189_DU if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getDecodingUnitHrdParamsPresentFlag() ) -#else - if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) -#endif { for( int i = 0; i < ( pictureTimingSEI->m_numDecodingUnitsMinus1 + 1 ); i ++ ) { @@ -1226,11 +1097,7 @@ void EncGOP::xUpdateTimingSEI(SEIPictureTiming *pictureTimingSEI, std::deque<DUD return; } const HRDParameters *hrd = sps->getHrdParameters(); -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) -#else - if( hrd->getSubPicCpbParamsPresentFlag() ) -#endif { int i; uint64_t ui64Tmp; @@ -1321,13 +1188,8 @@ cabac_zero_word_padding(Slice *const pcSlice, Picture *const pcPic, const std::s const int log2subWidthCxsubHeightC = (::getComponentScaleX(COMPONENT_Cb, format)+::getComponentScaleY(COMPONENT_Cb, format)); const int minCuWidth = pcPic->cs->pcv->minCUWidth; const int minCuHeight = pcPic->cs->pcv->minCUHeight; -#if JVET_O1164_PS const int paddedWidth = ( ( pcSlice->getPPS()->getPicWidthInLumaSamples() + minCuWidth - 1 ) / minCuWidth ) * minCuWidth; const int paddedHeight = ( ( pcSlice->getPPS()->getPicHeightInLumaSamples() + minCuHeight - 1 ) / minCuHeight ) * minCuHeight; -#else - const int paddedWidth = ((sps.getPicWidthInLumaSamples() + minCuWidth - 1) / minCuWidth) * minCuWidth; - const int paddedHeight= ((sps.getPicHeightInLumaSamples() + minCuHeight - 1) / minCuHeight) * minCuHeight; -#endif const int rawBits = paddedWidth * paddedHeight * (sps.getBitDepth(CHANNEL_TYPE_LUMA) + ((2*sps.getBitDepth(CHANNEL_TYPE_CHROMA))>>log2subWidthCxsubHeightC)); const std::size_t threshold = (32/3)*numBytesInVclNalUnits + (rawBits/32); @@ -1487,71 +1349,6 @@ int EfficientFieldIRAPMapping::restoreGOPid(const int GOPid) return GOPid; } -#if !JVET_O1164_RPR -#if X0038_LAMBDA_FROM_QP_CAPABILITY -static uint32_t calculateCollocatedFromL0Flag(const Slice *pSlice) -{ - const int refIdx = 0; // Zero always assumed -#if JVET_O1164_RPR - const Picture *refPicL0 = pSlice->getRefPic( REF_PIC_LIST_0, refIdx )->unscaledPic; - const Picture *refPicL1 = pSlice->getRefPic( REF_PIC_LIST_1, refIdx )->unscaledPic; -#else - const Picture *refPicL0 = pSlice->getRefPic(REF_PIC_LIST_0, refIdx); - const Picture *refPicL1 = pSlice->getRefPic(REF_PIC_LIST_1, refIdx); -#endif - return refPicL0->slices[0]->getSliceQp() > refPicL1->slices[0]->getSliceQp(); -} -#else -static uint32_t calculateCollocatedFromL1Flag(EncCfg *pCfg, const int GOPid, const int gopSize) -{ - int iCloseLeft=1, iCloseRight=-1; - for(int i = 0; i<pCfg->getGOPEntry(GOPid).m_numRefPics; i++) - { - int iRef = pCfg->getGOPEntry(GOPid).m_referencePics[i]; - if(iRef>0&&(iRef<iCloseRight||iCloseRight==-1)) - { - iCloseRight=iRef; - } - else if(iRef<0&&(iRef>iCloseLeft||iCloseLeft==1)) - { - iCloseLeft=iRef; - } - } - if(iCloseRight>-1) - { - iCloseRight=iCloseRight+pCfg->getGOPEntry(GOPid).m_POC-1; - } - if(iCloseLeft<1) - { - iCloseLeft=iCloseLeft+pCfg->getGOPEntry(GOPid).m_POC-1; - while(iCloseLeft<0) - { - iCloseLeft+=gopSize; - } - } - int iLeftQP=0, iRightQP=0; - for(int i=0; i<gopSize; i++) - { - if(pCfg->getGOPEntry(i).m_POC==(iCloseLeft%gopSize)+1) - { - iLeftQP= pCfg->getGOPEntry(i).m_QPOffset; - } - if (pCfg->getGOPEntry(i).m_POC==(iCloseRight%gopSize)+1) - { - iRightQP=pCfg->getGOPEntry(i).m_QPOffset; - } - } - if(iCloseRight>-1&&iRightQP<iLeftQP) - { - return 0; - } - else - { - return 1; - } -} -#endif -#endif static void printHash(const HashType hashType, const std::string &digestStr) @@ -1756,11 +1553,7 @@ void trySkipOrDecodePicture( bool& decPic, bool& encPic, const EncCfg& cfg, Pict } } -#if JVET_O1164_PS void EncGOP::xPicInitHashME( Picture *pic, const PPS *pps, PicList &rcListPic ) -#else -void EncGOP::xPicInitHashME(Picture *pic, const SPS *sps, PicList &rcListPic) -#endif { if (! m_pcCfg->getUseHashME()) { @@ -1780,13 +1573,8 @@ void EncGOP::xPicInitHashME(Picture *pic, const SPS *sps, PicList &rcListPic) { Pel* picSrc = refPic->getOrigBuf().get(COMPONENT_Y).buf; int stridePic = refPic->getOrigBuf().get(COMPONENT_Y).stride; -#if JVET_O1164_PS int picWidth = pps->getPicWidthInLumaSamples(); int picHeight = pps->getPicHeightInLumaSamples(); -#else - int picWidth = sps->getPicWidthInLumaSamples(); - int picHeight = sps->getPicHeightInLumaSamples(); -#endif int blockSize = 4; int allNum = 0; int simpleNum = 0; @@ -1969,17 +1757,10 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) { m_pcReshaper->preAnalyzerHDR(pic, sliceType, m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree()); } -#if JVET_O0432_LMCS_ENCODER else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR || m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_HLG) { m_pcReshaper->preAnalyzerLMCS(pic, m_pcCfg->getReshapeSignalType(), sliceType, m_pcCfg->getReshapeCW()); } -#else - else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR) - { - m_pcReshaper->preAnalyzerSDR(pic, sliceType, m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree()); - } -#endif else { THROW("Reshaper for other signal currently not defined!"); @@ -1992,7 +1773,6 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) m_pcReshaper->initLUTfromdQPModel(); m_pcEncLib->getRdCost()->updateReshapeLumaLevelToWeightTableChromaMD(m_pcReshaper->getInvLUT()); } -#if JVET_O0432_LMCS_ENCODER else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR || m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_HLG) { if (m_pcReshaper->getReshapeFlag()) @@ -2001,16 +1781,6 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) m_pcEncLib->getRdCost()->updateReshapeLumaLevelToWeightTable(m_pcReshaper->getSliceReshaperInfo(), m_pcReshaper->getWeightTable(), m_pcReshaper->getCWeight()); } } -#else - else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR) - { - if (m_pcReshaper->getReshapeFlag()) - { - m_pcReshaper->constructReshaperSDR(); - m_pcEncLib->getRdCost()->updateReshapeLumaLevelToWeightTable(m_pcReshaper->getSliceReshaperInfo(), m_pcReshaper->getWeightTable(), m_pcReshaper->getCWeight()); - } - } -#endif else { THROW("Reshaper for other signal currently not defined!"); @@ -2041,7 +1811,6 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) { m_pcEncLib->getRdCost()->restoreReshapeLumaLevelToWeightTable(); } -#if JVET_O0432_LMCS_ENCODER else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR || m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_HLG) { int modIP = pic->getPOC() - pic->getPOC() / m_pcCfg->getReshapeCW().rspFpsToIp * m_pcCfg->getReshapeCW().rspFpsToIp; @@ -2052,18 +1821,6 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) m_pcEncLib->getRdCost()->updateReshapeLumaLevelToWeightTable(m_pcReshaper->getSliceReshaperInfo(), m_pcReshaper->getWeightTable(), m_pcReshaper->getCWeight()); } } -#else - else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR) - { - int modIP = pic->getPOC() - pic->getPOC() / m_pcCfg->getReshapeCW().rspFpsToIp * m_pcCfg->getReshapeCW().rspFpsToIp; - if (m_pcReshaper->getReshapeFlag() && m_pcCfg->getReshapeCW().rspIntraPeriod == -1 && modIP == 0) // for LDB, update reshaping curve every second - { - m_pcReshaper->getSliceReshaperInfo().setSliceReshapeModelPresentFlag(true); - m_pcReshaper->constructReshaperSDR(); - m_pcEncLib->getRdCost()->updateReshapeLumaLevelToWeightTable(m_pcReshaper->getSliceReshaperInfo(), m_pcReshaper->getWeightTable(), m_pcReshaper->getCWeight()); - } - } -#endif else { THROW("Reshaper for other signal currently not defined!"); @@ -2129,9 +1886,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, OutputBitstream *pcBitstreamRedirect; pcBitstreamRedirect = new OutputBitstream; AccessUnit::iterator itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted -#if JVET_O1164_RPR Picture* scaledRefPic[MAX_NUM_REF] = {}; -#endif xInitGOP(iPOCLast, iNumPicRcvd, isField , isEncodeLtRef @@ -2212,9 +1967,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // start a new access unit: create an entry in the list of output access units AccessUnit accessUnit; -#if JVET_O0245_VPS_DPS_APS accessUnit.temporalId = m_pcCfg->getGOPEntry( iGOPid ).m_temporalId; -#endif xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pocCurr, isField ); @@ -2233,7 +1986,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } #endif -#if JVET_O1164_PS // create objects based on the picture size const int picWidth = pcPic->cs->pps->getPicWidthInLumaSamples(); const int picHeight = pcPic->cs->pps->getPicHeightInLumaSamples(); @@ -2243,7 +1995,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, const int maxTotalCUDepth = pcPic->cs->sps->getMaxCodingDepth(); m_pcSliceEncoder->create( picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, maxTotalCUDepth ); -#endif #if ENABLE_SPLIT_PARALLELISM && ENABLE_WPP_PARALLELISM pcPic->scheduler.init( pcPic->cs->pcv->heightInCtus, pcPic->cs->pcv->widthInCtus, m_pcCfg->getNumWppThreads(), m_pcCfg->getNumWppExtraLines(), m_pcCfg->getNumSplitThreads() ); @@ -2339,7 +2090,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); } -#if JVET_N0494_DRAP pcSlice->setEnableDRAPSEI(m_pcEncLib->getDependentRAPIndicationSEIEnabled()); if (m_pcEncLib->getDependentRAPIndicationSEIEnabled()) { @@ -2380,9 +2130,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPL0(), 0, false) != 0 || pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPL1(), 1, false) != 0 || (m_pcEncLib->getDependentRAPIndicationSEIEnabled() && !pcSlice->isIRAP() && ( pcSlice->isDRAP() || !pcSlice->isPOCInRefPicList(pcSlice->getRPL0(), pcSlice->getAssociatedIRAPPOC())) )) -#else - if (pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPL0(), 0, false) != 0 || pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPL1(), 1, false) != 0) -#endif { pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1()); } @@ -2465,19 +2212,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } // Set reference list pcSlice->constructRefPicList(rcListPic); -#if JVET_O1164_RPR -#if JVET_O0299_APS_SCALINGLIST pcSlice->scaleRefPicList( scaledRefPic, m_pcEncLib->getApss(), pcSlice->getLmcsAPS(), pcSlice->getscalingListAPS(), false ); -#else - pcSlice->scaleRefPicList( scaledRefPic, m_pcEncLib->getApss(), pcSlice->getLmcsAPS(), false ); -#endif -#endif -#if JVET_O1164_PS xPicInitHashME( pcPic, pcSlice->getPPS(), rcListPic ); -#else - xPicInitHashME(pcPic, pcSlice->getSPS(), rcListPic); -#endif if( m_pcCfg->getUseAMaxBT() ) { @@ -2546,14 +2283,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcSlice->getSliceType() == B_SLICE) { -#if !JVET_O1164_RPR -#if X0038_LAMBDA_FROM_QP_CAPABILITY - const uint32_t uiColFromL0 = calculateCollocatedFromL0Flag(pcSlice); - pcSlice->setColFromL0Flag(uiColFromL0); -#else - pcSlice->setColFromL0Flag(1-uiColDir); -#endif -#endif bool bLowDelay = true; int iCurrPOC = pcSlice->getPOC(); @@ -2581,9 +2310,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setCheckLDC(true); } -#if !X0038_LAMBDA_FROM_QP_CAPABILITY && !JVET_O1164_RPR - uiColDir = 1-uiColDir; -#endif //------------------------------------------------------------- pcSlice->setRefPOCList(); @@ -2593,9 +2319,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (m_pcEncLib->getTMVPModeId() == 2) { -#if JVET_O0238_PPS_OR_SLICE assert (m_pcEncLib->getPPSTemporalMVPEnabledIdc() == 0); -#endif if (iGOPid == 0) // first picture in SOP (i.e. forward B) { pcSlice->setEnableTMVPFlag(0); @@ -2606,11 +2330,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setEnableTMVPFlag(1); } } -#if JVET_O0238_PPS_OR_SLICE else if (m_pcEncLib->getTMVPModeId() == 1 && m_pcEncLib->getPPSTemporalMVPEnabledIdc() != 1) -#else - else if (m_pcEncLib->getTMVPModeId() == 1) -#endif { pcSlice->setEnableTMVPFlag(1); } @@ -2625,7 +2345,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setEnableTMVPFlag(0); } -#if JVET_O1164_RPR if( pcSlice->getSliceType() != I_SLICE && pcSlice->getEnableTMVPFlag() ) { int colRefIdxL0 = -1, colRefIdxL1 = -1; @@ -2694,7 +2413,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setEnableTMVPFlag( 0 ); } } -#endif // set adaptive search range for non-intra-slices if (m_pcCfg->getUseASR() && !pcSlice->isIRAP()) @@ -2729,9 +2447,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } if ( pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false -#if JVET_O0284_CONDITION_SMVD_MVDL1ZEROFLAG && pcSlice->getMvdL1ZeroFlag() == false -#endif ) { int currPOC = pcSlice->getPOC(); @@ -2744,12 +2460,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_0 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_0, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_0, ref)->longTerm; if ( poc < currPOC && (poc > forwardPOC || refIdx0 == -1) && !isRefLongTerm ) -#else - if ( poc < currPOC && (poc > forwardPOC || refIdx0 == -1) ) -#endif { forwardPOC = poc; refIdx0 = ref; @@ -2760,12 +2472,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_1 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_1, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_1, ref)->longTerm; if ( poc > currPOC && (poc < backwardPOC || refIdx1 == -1) && !isRefLongTerm ) -#else - if ( poc > currPOC && (poc < backwardPOC || refIdx1 == -1) ) -#endif { backwardPOC = poc; refIdx1 = ref; @@ -2783,12 +2491,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_0 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_0, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_0, ref)->longTerm; if ( poc > currPOC && (poc < backwardPOC || refIdx0 == -1) && !isRefLongTerm ) -#else - if ( poc > currPOC && (poc < backwardPOC || refIdx0 == -1) ) -#endif { backwardPOC = poc; refIdx0 = ref; @@ -2799,12 +2503,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, for ( ref = 0; ref < pcSlice->getNumRefIdx( REF_PIC_LIST_1 ); ref++ ) { int poc = pcSlice->getRefPic( REF_PIC_LIST_1, ref )->getPOC(); -#if JVET_O0414_SMVD_LTRP const bool isRefLongTerm = pcSlice->getRefPic(REF_PIC_LIST_1, ref)->longTerm; if ( poc < currPOC && (poc > forwardPOC || refIdx1 == -1) && !isRefLongTerm ) -#else - if ( poc < currPOC && (poc > forwardPOC || refIdx1 == -1) ) -#endif { forwardPOC = poc; refIdx1 = ref; @@ -2854,11 +2554,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcSlice->getPPS()->getUseDQP() && pcSlice->getPPS()->getCuQpDeltaSubdiv() > 0) { const PreCalcValues &pcv = *pcPic->cs->pcv; -#if MAX_TB_SIZE_SIGNALLING const unsigned mtsLog2 = (unsigned)floorLog2(std::min (pcPic->cs->sps->getMaxTbSize(), pcv.maxCUWidth)); -#else - const unsigned mtsLog2 = (unsigned)floorLog2(std::min<uint32_t> (MAX_TB_SIZEY, pcv.maxCUWidth)); -#endif pcPic->m_subCtuQP.resize ((pcv.maxCUWidth >> mtsLog2) * (pcv.maxCUHeight >> mtsLog2)); } #endif @@ -2873,9 +2569,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if( pcSlice->getSPS()->getALFEnabledFlag() ) { pcPic->resizeAlfCtuEnableFlag( numberOfCtusInFrame ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB pcPic->resizeAlfCtuAlternative( numberOfCtusInFrame ); -#endif pcPic->resizeAlfCtbFilterIndex(numberOfCtusInFrame); } @@ -2894,20 +2588,15 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // overwrite chroma qp offset for dual tree pcSlice->setSliceChromaQpDelta(COMPONENT_Cb, m_pcCfg->getChromaCbQpOffsetDualTree()); pcSlice->setSliceChromaQpDelta(COMPONENT_Cr, m_pcCfg->getChromaCrQpOffsetDualTree()); -#if JVET_O0376_SPS_JOINTCBCR_FLAG if (pcSlice->getSPS()->getJointCbCrEnabledFlag()) { pcSlice->setSliceChromaQpDelta(JOINT_CbCr, m_pcCfg->getChromaCbCrQpOffsetDualTree()); } -#else - pcSlice->setSliceChromaQpDelta(JOINT_CbCr, m_pcCfg->getChromaCbCrQpOffsetDualTree()); -#endif m_pcSliceEncoder->setUpLambda(pcSlice, pcSlice->getLambdas()[0], pcSlice->getSliceQp()); } xPicInitLMCS(pcPic, pcSlice); -#if JVET_O0299_APS_SCALINGLIST if( pcSlice->getSPS()->getScalingListFlag() && m_pcCfg->getUseScalingListId() == SCALING_LIST_FILE_READ ) { pcSlice->setscalingListPresentFlag( true ); @@ -2919,7 +2608,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, assert( scalingListAPS != NULL ); pcSlice->setscalingListAPS( scalingListAPS ); } -#endif if( encPic ) // now compress (trial encode) the various slice segments (slices, and dependent slices) @@ -2998,7 +2686,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->getOrigBuf().copyFrom(pcPic->getTrueOrigBuf()); } -#if JVET_O1164_PS // create SAO object based on the picture size if( pcSlice->getSPS()->getSAOEnabledFlag() ) { @@ -3019,9 +2706,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { m_pcEncLib->getLoopFilter()->initEncPicYuvBuffer( chromaFormatIDC, picWidth, picHeight ); } -#endif -#if JVET_O0299_APS_SCALINGLIST if( pcSlice->getSPS()->getScalingListFlag() && m_pcCfg->getUseScalingListId() == SCALING_LIST_FILE_READ ) { pcSlice->setscalingListPresentFlag( true ); @@ -3036,7 +2721,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->slices[ s ]->setscalingListAPSId( pcSlice->getscalingListAPSId() ); } } -#endif // SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas if( pcSlice->getSPS()->getSAOEnabledFlag() && m_pcCfg->getSaoCtuBoundary() ) @@ -3087,10 +2771,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if( pcSlice->getSPS()->getALFEnabledFlag() ) { -#if JVET_O1164_PS m_pcALF->destroy(); m_pcALF->create( m_pcCfg, picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, maxTotalCUDepth, m_pcCfg->getBitDepth(), m_pcCfg->getInputBitDepth() ); -#endif for (int s = 0; s < uiNumSliceSegments; s++) { @@ -3148,9 +2830,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } -#if JVET_O1164_RPR pcSlice->freeScaledRefPicList( scaledRefPic ); -#endif if( m_pcCfg->getUseAMaxBT() ) { @@ -3208,7 +2888,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } -#if JVET_O0299_APS_SCALINGLIST // only 1 SCALING LIST data for 1 picture if( pcSlice->getSPS()->getScalingListFlag() && ( m_pcCfg->getUseScalingListId() == SCALING_LIST_FILE_READ ) ) { @@ -3223,15 +2902,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, CHECK( aps != pcSlice->getscalingListAPS(), "Wrong SCALING LIST APS pointer in compressGOP" ); } } -#endif if (pcSlice->getSPS()->getALFEnabledFlag() && pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y)) { -#if JVET_O_MAX_NUM_ALF_APS_8 for (int apsId = 0; apsId < ALF_CTB_MAX_NUM_APS; apsId++) -#else - for (int apsId = 0; apsId < MAX_NUM_APS; apsId++) //HD: shouldn't this be looping over slice_alf_aps_id_luma[ i ]? By looping over MAX_NUM_APS, it is possible unused ALF APS is written. Please check! -#endif { ParameterSetMap<APS> *apsMap = m_pcEncLib->getApsMap(); @@ -3286,32 +2960,18 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->getTLayer() ); m_HLSWriter->setBitstream( &nalu.m_Bitstream ); -#if JVET_N0865_NONSYNTAX pcSlice->setNoIncorrectPicOutputFlag(false); -#else - pcSlice->setNoRaslOutputFlag(false); -#endif if (pcSlice->isIRAP()) { if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) { -#if JVET_N0865_NONSYNTAX pcSlice->setNoIncorrectPicOutputFlag(true); -#else - pcSlice->setNoRaslOutputFlag(true); -#endif } //the inference for NoOutputPriorPicsFlag // KJS: This cannot happen at the encoder -#if JVET_N0865_NONSYNTAX if (!m_bFirst && (pcSlice->isIRAP() || pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_GDR) && pcSlice->getNoIncorrectPicOutputFlag()) { if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_GDR) -#else - if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag()) - { - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) -#endif { pcSlice->setNoOutputPriorPicsFlag(true); } @@ -3361,18 +3021,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, accessUnit.push_back(new NALUnitEBSP(nalu)); } -#if JVET_O0189_DU if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && ( ( pcSlice->getSPS()->getHrdParameters()->getNalHrdParametersPresentFlag() ) || ( pcSlice->getSPS()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) && ( pcSlice->getSPS()->getHrdParameters()->getDecodingUnitHrdParamsPresentFlag() ) ) -#else - if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && - ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && - ( ( pcSlice->getSPS()->getHrdParameters()->getNalHrdParametersPresentFlag() ) - || ( pcSlice->getSPS()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) && - ( pcSlice->getSPS()->getHrdParameters()->getSubPicCpbParamsPresentFlag() ) ) -#endif { uint32_t numNalus = 0; uint32_t numRBSPBytes = 0; @@ -3454,9 +3106,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } #endif } -#if JVET_O0041_FRAME_FIELD_SEI xCreateFrameFieldInfoSEI( leadingSeiMessages, pcSlice, isField ); -#endif xCreatePictureTimingSEI( m_pcCfg->getEfficientFieldIRAPEnabled() ? effFieldIRAPMap.GetIRAPGOPid() : 0, leadingSeiMessages, nestedSeiMessages, duInfoSeiMessages, pcSlice, isField, duData ); #if HEVC_SEI if( m_pcCfg->getScalableNestingSEIEnabled() ) @@ -3480,16 +3130,12 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, m_bFirst = false; m_iNumPicCoded++; if (!(m_pcCfg->getUseCompositeRef() && isEncodeLtRef)) -#if !JVET_N0867_TEMP_SCAL_HRD - m_totalCoded ++; -#else { for( int i = pcSlice->getTLayer() ; i < pcSlice->getSPS()->getMaxTLayers() ; i ++ ) { m_totalCoded[i]++; } } -#endif /* logging: insert a newline at end of picture period */ if (m_pcCfg->getEfficientFieldIRAPEnabled()) @@ -3508,11 +3154,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } -#if RPR_CTC_PRINT void EncGOP::printOutSummary( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const bool printRprPSNR, const BitDepths &bitDepths ) -#else -void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths) -#endif { #if ENABLE_QPA const bool useWPSNR = m_pcEncLib->getUseWPSNR(); @@ -3548,19 +3190,11 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool const bool calculateHdrMetrics = m_pcEncLib->getCalcluateHdrMetrics(); #endif #if ENABLE_QPA -#if RPR_CTC_PRINT m_gcAnalyzeAll.printOut( 'a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, printRprPSNR, bitDepths, useWPSNR #if JVET_O0756_CALCULATE_HDRMETRICS , calculateHdrMetrics #endif ); -#else - m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths, useWPSNR -#if JVET_O0756_CALCULATE_HDRMETRICS - , calculateHdrMetrics -#endif - ); -#endif #else m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths #if JVET_O0756_CALCULATE_HDRMETRICS @@ -3568,7 +3202,6 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool #endif ); #endif -#if RPR_CTC_PRINT msg( DETAILS, "\n\nI Slices--------------------------------------------------------\n" ); m_gcAnalyzeI.printOut( 'i', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, printRprPSNR, bitDepths ); @@ -3577,26 +3210,12 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool msg( DETAILS, "\n\nB Slices--------------------------------------------------------\n" ); m_gcAnalyzeB.printOut( 'b', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, printRprPSNR, bitDepths ); -#else - msg( DETAILS,"\n\nI Slices--------------------------------------------------------\n" ); - m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths); - - msg( DETAILS,"\n\nP Slices--------------------------------------------------------\n" ); - m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths); - - msg( DETAILS,"\n\nB Slices--------------------------------------------------------\n" ); - m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths); -#endif #if WCG_WPSNR if (useLumaWPSNR) { msg(DETAILS, "\nWPSNR SUMMARY --------------------------------------------------------\n"); -#if RPR_CTC_PRINT m_gcAnalyzeWPSNR.printOut( 'w', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, printRprPSNR, bitDepths, useLumaWPSNR ); -#else - m_gcAnalyzeWPSNR.printOut('w', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths, useLumaWPSNR); -#endif } #endif if (!m_pcCfg->getSummaryOutFilename().empty()) @@ -3626,11 +3245,7 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool msg( DETAILS,"\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); #if ENABLE_QPA -#if RPR_CTC_PRINT m_gcAnalyzeAll_in.printOut( 'a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, printRprPSNR, bitDepths, useWPSNR ); -#else - m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths, useWPSNR); -#endif #else m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths); #endif @@ -4040,9 +3655,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni double dPSNRWeighted[MAX_NUM_COMPONENT]; double MSEyuvframeWeighted[MAX_NUM_COMPONENT]; #endif -#if RPR_CTC_PRINT double upscaledPSNR[MAX_NUM_COMPONENT]; -#endif for(int i=0; i<MAX_NUM_COMPONENT; i++) { dPSNR[i]=0.0; @@ -4050,9 +3663,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni dPSNRWeighted[i]=0.0; MSEyuvframeWeighted[i] = 0.0; #endif -#if RPR_CTC_PRINT upscaledPSNR[i] = 0.0; -#endif } #if JVET_O0756_CALCULATE_HDRMETRICS double deltaE[hdrtoolslib::NB_REF_WHITE]; @@ -4082,22 +3693,16 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni const bool bPicIsField = pcPic->fieldPic; const Slice* pcSlice = pcPic->slices[0]; -#if RPR_CTC_PRINT PelStorage upscaledRec; if( m_pcEncLib->isRPREnabled() ) { const CPelBuf& upscaledOrg = sps.getUseReshaper() ? pcPic->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT).get( COMPONENT_Y ) : pcPic->M_BUFS( 0, PIC_ORIGINAL_INPUT).get( COMPONENT_Y ); upscaledRec.create( pic.chromaFormat, Area( Position(), upscaledOrg ) ); -#if RPR_CONF_WINDOW // the input source picture has a conformance window derived at encoder Window& conformanceWindow = m_pcEncLib->getConformanceWindow(); Picture::rescalePicture( picC, pcPic->cs->pps->getConformanceWindow(), upscaledRec, conformanceWindow, format, sps.getBitDepths(), false ); -#else - Picture::rescalePicture(picC, upscaledRec, format, sps.getBitDepths(), false); -#endif } -#endif for (int comp = 0; comp < ::getNumberValidComponents(formatD); comp++) { @@ -4134,7 +3739,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni } #endif -#if RPR_CTC_PRINT if( m_pcEncLib->isRPREnabled() ) { const CPelBuf& upscaledOrg = sps.getUseReshaper() ? pcPic->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).get( compID ) : pcPic->M_BUFS( 0, PIC_ORIGINAL_INPUT ).get( compID ); @@ -4147,7 +3751,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni upscaledPSNR[comp] = upscaledSSD ? 10.0 * log10( (double)maxval * maxval * upscaledOrg.width * upscaledOrg.height / (double)upscaledSSD ) : 999.99; } -#endif } #if EXTENSION_360_VIDEO @@ -4196,9 +3799,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni //===== add PSNR ===== m_gcAnalyzeAll.addResult(dPSNR, (double)uibits, MSEyuvframe -#if RPR_CTC_PRINT , upscaledPSNR -#endif , isEncodeLtRef ); #if EXTENSION_360_VIDEO @@ -4213,9 +3814,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni if (pcSlice->isIntra()) { m_gcAnalyzeI.addResult(dPSNR, (double)uibits, MSEyuvframe -#if RPR_CTC_PRINT , upscaledPSNR -#endif , isEncodeLtRef ); *PSNR_Y = dPSNR[COMPONENT_Y]; @@ -4232,9 +3831,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni if (pcSlice->isInterP()) { m_gcAnalyzeP.addResult(dPSNR, (double)uibits, MSEyuvframe -#if RPR_CTC_PRINT , upscaledPSNR -#endif , isEncodeLtRef ); *PSNR_Y = dPSNR[COMPONENT_Y]; @@ -4251,9 +3848,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni if (pcSlice->isInterB()) { m_gcAnalyzeB.addResult(dPSNR, (double)uibits, MSEyuvframe -#if RPR_CTC_PRINT , upscaledPSNR -#endif , isEncodeLtRef ); *PSNR_Y = dPSNR[COMPONENT_Y]; @@ -4270,11 +3865,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni #if WCG_WPSNR if (useLumaWPSNR) { -#if RPR_CTC_PRINT m_gcAnalyzeWPSNR.addResult( dPSNRWeighted, (double)uibits, MSEyuvframeWeighted, upscaledPSNR, isEncodeLtRef ); -#else - m_gcAnalyzeWPSNR.addResult(dPSNRWeighted, (double)uibits, MSEyuvframeWeighted, isEncodeLtRef); -#endif } #endif @@ -4283,9 +3874,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni { c += 32; } -#if JVET_N0494_DRAP if (m_pcCfg->getDependentRAPIndicationSEIEnabled() && pcSlice->isDRAP()) c = 'D'; -#endif if( g_verbosity >= NOTICE ) { @@ -4386,7 +3975,6 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni msg( NOTICE, " [L%d ", iRefList ); for( int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx( RefPicList( iRefList ) ); iRefIndex++ ) { -#if RPR_CTC_PRINT if( m_pcEncLib->isRPREnabled() ) { const std::pair<int, int>& scaleRatio = pcSlice->getScalingRatio( RefPicList( iRefList ), iRefIndex ); @@ -4401,17 +3989,14 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni } } else -#endif msg( NOTICE, "%d ", pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ) ); } msg( NOTICE, "]" ); } -#if RPR_CTC_PRINT if( m_pcEncLib->isRPREnabled() ) { msg( NOTICE, "\nPSNR2: [Y %6.4lf dB U %6.4lf dB V %6.4lf dB]", upscaledPSNR[COMPONENT_Y], upscaledPSNR[COMPONENT_Cb], upscaledPSNR[COMPONENT_Cr] ); } -#endif } else if( g_verbosity >= INFO ) { @@ -4585,9 +4170,7 @@ void EncGOP::xCalculateInterlacedAddPSNR( Picture* pcPicOrgFirstField, Picture* //===== add PSNR ===== m_gcAnalyzeAll_in.addResult (dPSNR, (double)uibits, MSEyuvframe -#if RPR_CTC_PRINT , MSEyuvframe -#endif , isEncodeLtRef ); @@ -4616,11 +4199,7 @@ NalUnitType EncGOP::getNalUnitType(int pocCurr, int lastIDR, bool isField) { if (pocCurr == 0) { -#if !JVET_N0867_TEMP_SCAL_HRD - return NAL_UNIT_CODED_SLICE_IDR_W_RADL; -#else return NAL_UNIT_CODED_SLICE_IDR_N_LP; -#endif } if (m_pcCfg->getEfficientFieldIRAPEnabled() && isField && pocCurr == (m_pcCfg->getUseCompositeRef() ? 2: 1)) @@ -4967,11 +4546,7 @@ void EncGOP::applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ) Pel* tempRec = Rec; const Slice* pcSlice = pcPic->slices[0]; -#if MAX_TB_SIZE_SIGNALLING const uint32_t log2maxTB = pcSlice->getSPS()->getLog2MaxTbSize(); -#else - const uint32_t log2maxTB = MAX_TB_LOG2_SIZEY; -#endif const uint32_t maxTBsize = (1<<log2maxTB); const uint32_t minBlockArtSize = 8; const uint32_t noCol = (picWidth>>log2maxTB); diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h index db1176dfef83c6b81436f4675596f541a2fe9eaf..e9667c5d0f0afacbd2dfcd95d8f3aa60a6d2610e 100644 --- a/source/Lib/EncoderLib/EncGOP.h +++ b/source/Lib/EncoderLib/EncGOP.h @@ -60,9 +60,7 @@ #include "Analyze.h" #include "RateCtrl.h" #include <vector> -#if JVET_N0353_INDEP_BUFF_TIME_SEI #include "EncHRD.h" -#endif #if JVET_O0756_CALCULATE_HDRMETRICS #include "HDRLib/inc/ConvertColorFormat.H" @@ -129,9 +127,7 @@ private: int m_iNumPicCoded; bool m_bFirst; int m_iLastRecoveryPicPOC; -#if JVET_N0494_DRAP int m_latestDRAPPOC; -#endif int m_lastRasPoc; // Access channel @@ -160,9 +156,7 @@ private: // indicate sequence first bool m_bSeqFirst; -#if JVET_N0353_INDEP_BUFF_TIME_SEI EncHRD* m_HRD; -#endif // clean decoding refresh bool m_bRefreshPending; @@ -171,14 +165,9 @@ private: int m_associatedIRAPPOC; std::vector<int> m_vRVM_RP; -#if !JVET_N0867_TEMP_SCAL_HRD - uint32_t m_lastBPSEI; - uint32_t m_totalCoded; -#else uint32_t m_lastBPSEI[MAX_TLAYER]; uint32_t m_totalCoded[MAX_TLAYER]; bool m_rapWithLeading; -#endif bool m_bufferingPeriodSEIPresentInAU; SEIEncoder m_seiEncoder; #if W0038_DB_OPT @@ -245,11 +234,7 @@ public: void setLastLTRefPoc(int iLastLTRefPoc) { m_lastLTRefPoc = iLastLTRefPoc; } int getLastLTRefPoc() const { return m_lastLTRefPoc; } -#if RPR_CTC_PRINT void printOutSummary( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const bool printRprPSNR, const BitDepths &bitDepths ); -#else - void printOutSummary ( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths ); -#endif #if W0038_DB_OPT uint64_t preLoopFilterPicAndCalcDist( Picture* pcPic ); #endif @@ -276,11 +261,7 @@ protected: void xInitGOP ( int iPOCLast, int iNumPicRcvd, bool isField , bool isEncodeLtRef ); -#if JVET_O1164_PS void xPicInitHashME( Picture *pic, const PPS *pps, PicList &rcListPic ); -#else - void xPicInitHashME (Picture *pic, const SPS *sps, PicList &rcListPic); -#endif void xPicInitRateControl(int &estimatedBits, int gopId, double &lambda, Picture *pic, Slice *slice); void xPicInitLMCS (Picture *pic, Slice *slice); @@ -320,9 +301,7 @@ protected: void xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const SPS *sps, const PPS *pps); void xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, Slice *slice); -#if JVET_O0041_FRAME_FIELD_SEI void xCreateFrameFieldInfoSEI (SEIMessages& seiMessages, Slice *slice, bool isField); -#endif void xCreatePictureTimingSEI (int IRAPGOPid, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, SEIMessages& duInfoSeiMessages, Slice *slice, bool isField, std::deque<DUData> &duData); void xUpdateDuData(AccessUnit &testAU, std::deque<DUData> &duData); void xUpdateTimingSEI(SEIPictureTiming *pictureTimingSEI, std::deque<DUData> &duData, const SPS *sps); @@ -342,20 +321,8 @@ protected: int xWriteVPS (AccessUnit &accessUnit, const VPS *vps); int xWriteDPS (AccessUnit &accessUnit, const DPS *dps); int xWriteSPS (AccessUnit &accessUnit, const SPS *sps); -#if JVET_O1136_TS_BDPCM_SIGNALLING -#if JVET_O0245_VPS_DPS_APS int xWritePPS( AccessUnit &accessUnit, const PPS *pps, const SPS *sps, const int layerId = 0 ); -#else - int xWritePPS (AccessUnit &accessUnit, const PPS *pps, const SPS *sps); -#endif -#else - int xWritePPS (AccessUnit &accessUnit, const PPS *pps); -#endif -#if JVET_O0245_VPS_DPS_APS int xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId = 0 ); -#else - int xWriteAPS(AccessUnit &accessUnit, APS *aps); -#endif int xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst); void applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ); diff --git a/source/Lib/EncoderLib/EncHRD.cpp b/source/Lib/EncoderLib/EncHRD.cpp index eec68ad31a13c180d07f4926000cef7e9f967d5d..82bae20c6bbe0f063d396352bc1ee619ecba0190 100644 --- a/source/Lib/EncoderLib/EncHRD.cpp +++ b/source/Lib/EncoderLib/EncHRD.cpp @@ -59,23 +59,12 @@ void EncHRD::initHRDParameters (EncCfg* encCfg) { bool useSubCpbParams = (encCfg->getSliceMode() > 0) || (encCfg->getSliceSegmentMode() > 0); int bitRate = encCfg->getTargetBitrate(); -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - bool isRandomAccess = encCfg->getIntraPeriod() > 0; -#endif # if U0132_TARGET_BITS_SATURATION int cpbSize = encCfg->getCpbSize(); CHECK(!(cpbSize!=0), "Unspecified error"); // CPB size may not be equal to zero. ToDo: have a better default and check for level constraints -#if FIX_HRD_O0189 if( !encCfg->getHrdParametersPresentFlag() && !encCfg->getCpbSaturationEnabled() ) #else - if( !encCfg->getVuiParametersPresentFlag() && !encCfg->getCpbSaturationEnabled() ) -#endif -#else -#if FIX_HRD_O0189 if( !encCfg->getHrdParametersPresentFlag() ) -#else - if( !encCfg.getVuiParametersPresentFlag() ) -#endif #endif { return; @@ -119,47 +108,17 @@ void EncHRD::initHRDParameters (EncCfg* encCfg) bool rateCnt = ( bitRate > 0 ); m_hrdParams.setNalHrdParametersPresentFlag( rateCnt ); m_hrdParams.setVclHrdParametersPresentFlag( rateCnt ); -#if JVET_O0189_DU useSubCpbParams &= ( m_hrdParams.getNalHrdParametersPresentFlag() || m_hrdParams.getVclHrdParametersPresentFlag() ); m_hrdParams.setDecodingUnitHrdParamsPresentFlag( useSubCpbParams ); -#else - m_hrdParams.setSubPicCpbParamsPresentFlag( useSubCpbParams ); -#endif -#if JVET_O0189_DU if( m_hrdParams.getDecodingUnitHrdParamsPresentFlag() ) -#else - if( m_hrdParams.getSubPicCpbParamsPresentFlag() ) -#endif { m_hrdParams.setTickDivisorMinus2( 100 - 2 ); // -#if !JVET_O0189_DU - m_hrdParams.setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - m_hrdParams.setSubPicCpbParamsInPicTimingSEIFlag( true ); -#else -#if JVET_O0189_DU m_hrdParams.setDecodingUnitCpbParamsInPicTimingSeiFlag( !encCfg->getDecodingUnitInfoSEIEnabled() ); -#else - m_hrdParams.setDecodingUnitHrdParamsPresentFlag( true ); -#endif -#endif -#if !JVET_O0189_DU - m_hrdParams.setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay -#endif } else { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - m_hrdParams.setSubPicCpbParamsInPicTimingSEIFlag( false ); -#else -#if JVET_O0189_DU m_hrdParams.setDecodingUnitCpbParamsInPicTimingSeiFlag( false ); -#else - m_hrdParams.setDecodingUnitHrdParamsPresentFlag( false ); -#endif -#endif } #if U0132_TARGET_BITS_SATURATION @@ -185,25 +144,8 @@ void EncHRD::initHRDParameters (EncCfg* encCfg) m_hrdParams.setCpbSizeScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit #endif -#if JVET_O0189_DU m_hrdParams.setCpbSizeDuScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit -#else - m_hrdParams.setDuCpbSizeScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - m_hrdParams.setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit - if( isRandomAccess ) - { - m_hrdParams.setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1) - m_hrdParams.setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6 - } - else - { - m_hrdParams.setCpbRemovalDelayLengthMinus1(9); // max. 2^10 - m_hrdParams.setDpbOutputDelayLengthMinus1 (9); // max. 2^10 - } -#endif // Note: parameters for all temporal layers are initialized with the same values int i, j; diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index c4a79394cd36522932bb30ffc964b4df8679f413..057a68dba2b72e33b7fcd7e33c551db9ba77a524 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -66,12 +66,8 @@ EncLib::EncLib() , m_cacheModel() #endif , m_lmcsAPS(nullptr) -#if JVET_O0299_APS_SCALINGLIST , m_scalinglistAPS( nullptr ) -#endif -#if JVET_O0119_BASE_PALETTE_444 , m_doPlt( true ) -#endif { m_iPOCLast = -1; m_iNumPicRcvd = 0; @@ -102,9 +98,6 @@ void EncLib::create () m_iPOCLast = m_compositeRefEnabled ? -2 : -1; // create processing unit classes m_cGOPEncoder. create( ); -#if !JVET_O1164_PS - m_cSliceEncoder. create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth ); -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM #if ENABLE_SPLIT_PARALLELISM m_numCuEncStacks = m_numSplitThreads == 1 ? 1 : NUM_RESERVERD_SPLIT_JOBS; @@ -134,29 +127,7 @@ void EncLib::create () m_cInterSearch.cacheAssign( &m_cacheModel ); #endif -#if JVET_O1164_PS - m_cLoopFilter.create( m_maxTotalCUDepth ); -#else - const uint32_t widthInCtus = (getSourceWidth() + m_maxCUWidth - 1) / m_maxCUWidth; - const uint32_t heightInCtus = (getSourceHeight() + m_maxCUHeight - 1) / m_maxCUHeight; - const uint32_t numCtuInFrame = widthInCtus * heightInCtus; - - if (m_bUseSAO) - { - m_cEncSAO.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA], m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); - m_cEncSAO.createEncData(getSaoCtuBoundary(), numCtuInFrame); - } - m_cLoopFilter.create( m_maxTotalCUDepth ); - if ( !m_bLoopFilterDisable ) - { - m_cLoopFilter.initEncPicYuvBuffer( m_chromaFormatIDC, getSourceWidth(), getSourceHeight() ); - } - if( m_alf ) - { - m_cEncALF.create( this, getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, m_bitDepth, m_inputBitDepth ); - } -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM m_cReshaper = new EncReshape[m_numCuEncStacks]; @@ -244,11 +215,9 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) SPS &sps0=*(m_spsMap.allocatePS(0)); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues. PPS &pps0=*(m_ppsMap.allocatePS(0)); -#if JVET_O0299_APS_SCALINGLIST APS &aps0 = *( m_apsMap.allocatePS( SCALING_LIST_APS ) ); aps0.setAPSId( 0 ); aps0.setAPSType( SCALING_LIST_APS ); -#endif // initialize SPS xInitSPS(sps0); @@ -266,11 +235,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) omp_set_nested( true ); #endif -#if JVET_N0494_DRAP if (getUseCompositeRef() || getDependentRAPIndicationSEIEnabled()) -#else - if (getUseCompositeRef()) -#endif { sps0.setLongTermRefsPresent(true); } @@ -291,34 +256,23 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #endif // initialize PPS -#if JVET_O1164_PS pps0.setPicWidthInLumaSamples( m_iSourceWidth ); pps0.setPicHeightInLumaSamples( m_iSourceHeight ); pps0.setConformanceWindow( m_conformanceWindow ); -#endif xInitPPS(pps0, sps0); // initialize APS xInitRPL(sps0, isFieldCoding); -#if JVET_O1164_RPR if( m_rprEnabled ) { PPS &pps = *( m_ppsMap.allocatePS( ENC_PPS_ID_RPR ) ); -#if RPR_CONF_WINDOW Window& inputConfWindow = pps0.getConformanceWindow(); int scaledWidth = int((pps0.getPicWidthInLumaSamples() - (inputConfWindow.getWindowLeftOffset() + inputConfWindow.getWindowRightOffset()) * SPS::getWinUnitX(sps0.getChromaFormatIdc())) / m_scalingRatioHor); -#else - int scaledWidth = int(pps0.getPicWidthInLumaSamples() / m_scalingRatioHor); -#endif int minSizeUnit = std::max(8, (int)(sps0.getMaxCUHeight() >> (sps0.getMaxCodingDepth() - 1))); int temp = scaledWidth / minSizeUnit; int width = ( scaledWidth - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; -#if RPR_CONF_WINDOW int scaledHeight = int((pps0.getPicHeightInLumaSamples() - (inputConfWindow.getWindowTopOffset() + inputConfWindow.getWindowBottomOffset()) * SPS::getWinUnitY(sps0.getChromaFormatIdc())) / m_scalingRatioVer); -#else - int scaledHeight = int(pps0.getPicHeightInLumaSamples() / m_scalingRatioVer); -#endif temp = scaledHeight / minSizeUnit; int height = ( scaledHeight - ( temp * minSizeUnit) > 0 ? temp + 1 : temp ) * minSizeUnit; @@ -333,7 +287,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) xInitPPS( pps, sps0 ); // will allocate memory for and initialize pps.pcv inside } -#endif #if ER_CHROMA_QP_WCG_PPS if (m_wcgChromaQpControl.isEnabled()) @@ -366,12 +319,8 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) // initialize transform & quantization class m_cTrQuant[jId].init( jId == 0 ? nullptr : m_cTrQuant[0].getQuant(), -#if MAX_TB_SIZE_SIGNALLING 1 << m_log2MaxTbSize, -#else - MAX_TB_SIZEY, -#endif m_useRDOQ, m_useRDOQTS, #if T0196_SELECTIVE_RDOQ @@ -407,11 +356,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) // initialize transform & quantization class m_cTrQuant.init( nullptr, -#if MAX_TB_SIZE_SIGNALLING 1 << m_log2MaxTbSize, -#else - MAX_TB_SIZEY, -#endif m_useRDOQ, m_useRDOQTS, #if T0196_SELECTIVE_RDOQ @@ -448,70 +393,39 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #if ER_CHROMA_QP_WCG_PPS if( m_wcgChromaQpControl.isEnabled() ) { -#if JVET_O0299_APS_SCALINGLIST xInitScalingLists( sps0, *m_apsMap.getPS( 1 ) ); xInitScalingLists( sps0, aps0 ); -#else - xInitScalingLists( sps0, *m_ppsMap.getPS(1) ); - xInitScalingLists( sps0, pps0 ); -#endif } else #endif { -#if JVET_O0299_APS_SCALINGLIST xInitScalingLists( sps0, aps0 ); -#else - xInitScalingLists( sps0, pps0 ); -#endif } -#if JVET_O1164_RPR if( m_rprEnabled ) { -#if JVET_O0299_APS_SCALINGLIST xInitScalingLists( sps0, *m_apsMap.getPS( ENC_PPS_ID_RPR ) ); -#else - xInitScalingLists( sps0, *m_ppsMap.getPS( ENC_PPS_ID_RPR ) ); -#endif } -#endif #if ENABLE_WPP_PARALLELISM m_entropyCodingSyncContextStateVec.resize( pps0.pcv->heightInCtus ); #endif if (getUseCompositeRef()) { Picture *picBg = new Picture; -#if JVET_O1164_PS picBg->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false ); -#else - picBg->create(sps0.getChromaFormatIdc(), Size(sps0.getPicWidthInLumaSamples(), sps0.getPicHeightInLumaSamples()), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false); -#endif picBg->getRecoBuf().fill(0); -#if JVET_O0299_APS_SCALINGLIST picBg->finalInit( sps0, pps0, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - picBg->finalInit(sps0, pps0, m_apss, m_lmcsAPS); -#endif pps0.setNumBricksInPic((int)picBg->brickMap->bricks.size()); picBg->allocateNewSlice(); picBg->createSpliceIdx(pps0.pcv->sizeInCtus); m_cGOPEncoder.setPicBg(picBg); Picture *picOrig = new Picture; -#if JVET_O1164_PS picOrig->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false ); -#else - picOrig->create(sps0.getChromaFormatIdc(), Size(sps0.getPicWidthInLumaSamples(), sps0.getPicHeightInLumaSamples()), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false); -#endif picOrig->getOrigBuf().fill(0); m_cGOPEncoder.setPicOrig(picOrig); } } -#if JVET_O0299_APS_SCALINGLIST void EncLib::xInitScalingLists( SPS &sps, APS &aps ) -#else -void EncLib::xInitScalingLists(SPS &sps, PPS &pps) -#endif { // Initialise scaling lists // The encoder will only use the SPS scaling lists. The PPS will never be marked present. @@ -533,24 +447,12 @@ void EncLib::xInitScalingLists(SPS &sps, PPS &pps) getTrQuant( jId )->getQuant()->setFlatScalingList( maxLog2TrDynamicRange, sps.getBitDepths() ); getTrQuant( jId )->getQuant()->setUseScalingList( false ); } -#endif -#if !JVET_O0299_APS_SCALINGLIST - sps.setScalingListPresentFlag(false); - pps.setScalingListPresentFlag(false); #endif } else if(getUseScalingListId() == SCALING_LIST_DEFAULT) { -#if JVET_O0299_APS_SCALINGLIST aps.getScalingList().setDefaultScalingList (); quant->setScalingList( &( aps.getScalingList() ), maxLog2TrDynamicRange, sps.getBitDepths() ); -#else - sps.getScalingList().setDefaultScalingList (); - sps.setScalingListPresentFlag(false); - pps.setScalingListPresentFlag(false); - - quant->setScalingList(&(sps.getScalingList()), maxLog2TrDynamicRange, sps.getBitDepths()); -#endif quant->setUseScalingList(true); #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM for( int jId = 1; jId < m_numCuEncStacks; jId++ ) @@ -561,7 +463,6 @@ void EncLib::xInitScalingLists(SPS &sps, PPS &pps) } else if(getUseScalingListId() == SCALING_LIST_FILE_READ) { -#if JVET_O0299_APS_SCALINGLIST aps.getScalingList().setDefaultScalingList(); CHECK( aps.getScalingList().xParseScalingList( getScalingListFileName() ), "Error Parsing Scaling List Input File" ); aps.getScalingList().checkDcOfMatrix(); @@ -570,18 +471,6 @@ void EncLib::xInitScalingLists(SPS &sps, PPS &pps) setUseScalingListId( SCALING_LIST_DEFAULT ); } quant->setScalingList( &( aps.getScalingList() ), maxLog2TrDynamicRange, sps.getBitDepths() ); -#else - sps.getScalingList().setDefaultScalingList (); - if(sps.getScalingList().xParseScalingList(getScalingListFileName())) - { - THROW( "parse scaling list"); - } - sps.getScalingList().checkDcOfMatrix(); - sps.setScalingListPresentFlag(sps.getScalingList().isNotDefaultScalingList()); - pps.setScalingListPresentFlag(false); - - quant->setScalingList(&(sps.getScalingList()), maxLog2TrDynamicRange, sps.getBitDepths()); -#endif quant->setUseScalingList(true); #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM for( int jId = 1; jId < m_numCuEncStacks; jId++ ) @@ -595,11 +484,7 @@ void EncLib::xInitScalingLists(SPS &sps, PPS &pps) THROW("error : ScalingList == " << getUseScalingListId() << " not supported\n"); } -#if JVET_O0299_APS_SCALINGLIST if( getUseScalingListId() == SCALING_LIST_FILE_READ ) -#else - if (getUseScalingListId() == SCALING_LIST_FILE_READ && sps.getScalingListPresentFlag()) -#endif { // Prepare delta's: for (uint32_t sizeId = SCALING_LIST_2x2; sizeId <= SCALING_LIST_64x64; sizeId++) @@ -611,11 +496,7 @@ void EncLib::xInitScalingLists(SPS &sps, PPS &pps) { continue; } -#if JVET_O0299_APS_SCALINGLIST aps.getScalingList().checkPredMode( sizeId, listId ); -#else - sps.getScalingList().checkPredMode( sizeId, listId ); -#endif } } } @@ -676,19 +557,14 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru xGetNewPicBuffer(rcListPicYuvRecOut, picCurr, 2); const PPS *pps = m_ppsMap.getPS(2); const SPS *sps = m_spsMap.getPS(pps->getSPSId()); -#if JVET_O1164_RPR + Window confWin = pps->getConformanceWindow( ); picCurr->setPicWidthInLumaSamples( pps->getPicWidthInLumaSamples() ); picCurr->setPicHeightInLumaSamples( pps->getPicHeightInLumaSamples() ); picCurr->setConformanceWindow( confWin ); -#endif picCurr->M_BUFS(0, PIC_ORIGINAL).copyFrom(m_cGOPEncoder.getPicBg()->getRecoBuf()); -#if JVET_O0299_APS_SCALINGLIST picCurr->finalInit( *sps, *pps, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - picCurr->finalInit(*sps, *pps, m_apss, m_lmcsAPS); -#endif picCurr->poc = m_iPOCLast - 1; m_iPOCLast -= 2; if (getUseAdaptiveQP()) @@ -728,7 +604,6 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru } #endif -#if JVET_O1164_RPR if( m_rprEnabled && m_uiIntraPeriod == -1 ) { const int poc = m_iPOCLast + ( m_compositeRefEnabled ? 2 : 1 ); @@ -742,7 +617,6 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru ppsID = 0; } } -#endif xGetNewPicBuffer( rcListPicYuvRecOut, pcPicCurr, ppsID ); @@ -750,14 +624,13 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru const PPS *pPPS=(ppsID<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsID); const SPS *pSPS=m_spsMap.getPS(pPPS->getSPSId()); -#if JVET_O1164_RPR Window confWin = pPPS->getConformanceWindow( ); pcPicCurr->setPicWidthInLumaSamples( pPPS->getPicWidthInLumaSamples() ); pcPicCurr->setPicHeightInLumaSamples( pPPS->getPicHeightInLumaSamples() ); pcPicCurr->setConformanceWindow( confWin ); + if( m_rprEnabled ) { -#if RPR_CTC_PRINT pcPicCurr->M_BUFS( 0, PIC_ORIGINAL_INPUT ).getBuf( COMPONENT_Y ).copyFrom( pcPicYuvOrg->getBuf( COMPONENT_Y ) ); pcPicCurr->M_BUFS( 0, PIC_ORIGINAL_INPUT ).getBuf( COMPONENT_Cb ).copyFrom( pcPicYuvOrg->getBuf( COMPONENT_Cb ) ); pcPicCurr->M_BUFS( 0, PIC_ORIGINAL_INPUT ).getBuf( COMPONENT_Cr ).copyFrom( pcPicYuvOrg->getBuf( COMPONENT_Cr ) ); @@ -765,34 +638,20 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).getBuf( COMPONENT_Y ).copyFrom( cPicYuvTrueOrg->getBuf( COMPONENT_Y ) ); pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).getBuf( COMPONENT_Cb ).copyFrom( cPicYuvTrueOrg->getBuf( COMPONENT_Cb ) ); pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).getBuf( COMPONENT_Cr ).copyFrom( cPicYuvTrueOrg->getBuf( COMPONENT_Cr ) ); -#endif const ChromaFormat chromaFormatIDC = pSPS->getChromaFormatIdc(); -#if RPR_CONF_WINDOW const PPS *refPPS = m_ppsMap.getPS(0); Picture::rescalePicture( *pcPicYuvOrg, refPPS->getConformanceWindow(), pcPicCurr->getOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); Picture::rescalePicture( *cPicYuvTrueOrg, refPPS->getConformanceWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); -#else - Picture::rescalePicture(*pcPicYuvOrg, pcPicCurr->getOrigBuf(), chromaFormatIDC, pSPS->getBitDepths(), true, true); - Picture::rescalePicture(*cPicYuvTrueOrg, pcPicCurr->getTrueOrigBuf(), chromaFormatIDC, pSPS->getBitDepths(), true, true); -#endif } else { pcPicCurr->M_BUFS( 0, PIC_ORIGINAL ).swap( *pcPicYuvOrg ); pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL ).swap( *cPicYuvTrueOrg ); } -#else - pcPicCurr->M_BUFS( 0, PIC_ORIGINAL ).swap( *pcPicYuvOrg ); - pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL ).swap(*cPicYuvTrueOrg ); -#endif -#if JVET_O0299_APS_SCALINGLIST pcPicCurr->finalInit( *pSPS, *pPPS, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - pcPicCurr->finalInit(*pSPS, *pPPS, m_apss, m_lmcsAPS); -#endif PPS *ptrPPS = (ppsID<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsID); ptrPPS->setNumBricksInPic((int)pcPicCurr->brickMap->bricks.size()); } @@ -891,17 +750,12 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTr int ppsID=-1; // Use default PPS ID const PPS *pPPS=(ppsID<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsID); const SPS *pSPS=m_spsMap.getPS(pPPS->getSPSId()); -#if JVET_O1164_RPR Window confWin = pPPS->getConformanceWindow( ); pcField->setPicWidthInLumaSamples( pPPS->getPicWidthInLumaSamples() ); pcField->setPicHeightInLumaSamples( pPPS->getPicHeightInLumaSamples() ); pcField->setConformanceWindow( confWin ); -#endif -#if JVET_O0299_APS_SCALINGLIST + pcField->finalInit( *pSPS, *pPPS, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - pcField->finalInit(*pSPS, *pPPS, m_apss, m_lmcsAPS); -#endif } pcField->poc = m_iPOCLast; @@ -995,29 +849,19 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict if (rpcPic==0) { rpcPic = new Picture; -#if JVET_O1164_PS rpcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, false ); -#if RPR_CTC_PRINT if( m_rprEnabled ) { rpcPic->M_BUFS( 0, PIC_ORIGINAL_INPUT ).create( sps.getChromaFormatIdc(), Area( Position(), Size( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples() ) ) ); rpcPic->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).create( sps.getChromaFormatIdc(), Area( Position(), Size( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples() ) ) ); } -#endif -#else - rpcPic->create( sps.getChromaFormatIdc(), Size( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples()), sps.getMaxCUWidth(), sps.getMaxCUWidth()+16, false ); -#endif if ( getUseAdaptiveQP() ) { const uint32_t iMaxDQPLayer = pps.getCuQpDeltaSubdiv()/2+1; rpcPic->aqlayer.resize( iMaxDQPLayer ); for (uint32_t d = 0; d < iMaxDQPLayer; d++) { -#if JVET_O1164_PS rpcPic->aqlayer[d] = new AQpLayer( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples(), sps.getMaxCUWidth() >> d, sps.getMaxCUHeight() >> d ); -#else - rpcPic->aqlayer[d] = new AQpLayer( sps.getPicWidthInLumaSamples(), sps.getPicHeightInLumaSamples(), sps.getMaxCUWidth()>>d, sps.getMaxCUHeight()>>d ); -#endif } } @@ -1070,9 +914,6 @@ void EncLib::xInitSPS(SPS &sps) cinfo->setNoPartitionConstraintsOverrideConstraintFlag(m_noPartitionConstraintsOverrideConstraintFlag); cinfo->setNoSaoConstraintFlag(m_bNoSaoConstraintFlag); cinfo->setNoAlfConstraintFlag(m_bNoAlfConstraintFlag); -#if !JVET_O0525_REMOVE_PCM - cinfo->setNoPcmConstraintFlag(m_bNoPcmConstraintFlag); -#endif cinfo->setNoRefWraparoundConstraintFlag(m_bNoRefWraparoundConstraintFlag); cinfo->setNoTemporalMvpConstraintFlag(m_bNoTemporalMvpConstraintFlag); cinfo->setNoSbtmvpConstraintFlag(m_bNoSbtmvpConstraintFlag); @@ -1090,12 +931,8 @@ void EncLib::xInitSPS(SPS &sps) cinfo->setNoTriangleConstraintFlag(m_bNoTriangleConstraintFlag); cinfo->setNoLadfConstraintFlag(m_bNoLadfConstraintFlag); cinfo->setNoTransformSkipConstraintFlag(m_noTransformSkipConstraintFlag); -#if JVET_O1136_TS_BDPCM_SIGNALLING cinfo->setNoBDPCMConstraintFlag(m_noBDPCMConstraintFlag); -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG cinfo->setNoJointCbCrConstraintFlag(m_noJointCbCrConstraintFlag); -#endif cinfo->setNoQpDeltaConstraintFlag(m_bNoQpDeltaConstraintFlag); cinfo->setNoDepQuantConstraintFlag(m_bNoDepQuantConstraintFlag); cinfo->setNoSignDataHidingConstraintFlag(m_bNoSignDataHidingConstraintFlag); @@ -1103,27 +940,17 @@ void EncLib::xInitSPS(SPS &sps) profileTierLevel->setLevelIdc (m_level); profileTierLevel->setTierFlag (m_levelTier); profileTierLevel->setProfileIdc (m_profile); -#if JVET_O0044_MULTI_SUB_PROFILE profileTierLevel->setNumSubProfile(m_numSubProfile); for (int k = 0; k < m_numSubProfile; k++) { profileTierLevel->setSubProfileIdc(k, m_subProfile[k]); } -#else - profileTierLevel->setSubProfileIdc(m_subProfile); -#endif /* XXX: should Main be marked as compatible with still picture? */ /* XXX: may be a good idea to refactor the above into a function * that chooses the actual compatibility based upon options */ -#if JVET_O1164_PS sps.setMaxPicWidthInLumaSamples( m_iSourceWidth ); sps.setMaxPicHeightInLumaSamples( m_iSourceHeight ); -#else - sps.setPicWidthInLumaSamples ( m_iSourceWidth ); - sps.setPicHeightInLumaSamples ( m_iSourceHeight ); - sps.setConformanceWindow ( m_conformanceWindow ); -#endif sps.setMaxCUWidth ( m_maxCUWidth ); sps.setMaxCUHeight ( m_maxCUHeight ); sps.setMaxCodingDepth ( m_maxTotalCUDepth ); @@ -1162,9 +989,7 @@ void EncLib::xInitSPS(SPS &sps) sps.setBDOFEnabledFlag ( m_BIO ); sps.setUseAffine ( m_Affine ); sps.setUseAffineType ( m_AffineType ); -#if JVET_O0070_PROF sps.setUsePROF ( m_PROF ); -#endif sps.setUseLMChroma ( m_LMChroma ? true : false ); sps.setCclmCollocatedChromaFlag( m_cclmCollocatedChromaFlag ); sps.setUseMTS ( m_IntraMTS || m_InterMTS || m_ImplicitMTS ); @@ -1173,11 +998,7 @@ void EncLib::xInitSPS(SPS &sps) sps.setUseSBT ( m_SBT ); if( sps.getUseSBT() ) { -#if JVET_O0545_MAX_TB_SIGNALLING sps.setMaxSbtSize ( std::min((int)(1 << m_log2MaxTbSize), m_iSourceWidth >= 1920 ? 64 : 32) ); -#else - sps.setMaxSbtSize ( m_iSourceWidth >= 1920 ? 64 : 32 ); -#endif } sps.setUseSMVD ( m_SMVD ); sps.setUseGBi ( m_GBi ); @@ -1199,14 +1020,10 @@ void EncLib::xInitSPS(SPS &sps) sps.setUseTriangle ( m_Triangle ); sps.setUseMMVD ( m_MMVD ); sps.setFpelMmvdEnabledFlag (( m_MMVD ) ? m_allowDisFracMMVD : false); -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG sps.setBdofDmvrSlicePresentFlag(m_DMVR || m_BIO); -#endif sps.setAffineAmvrEnabledFlag ( m_AffineAmvr ); sps.setUseDMVR ( m_DMVR ); -#if JVET_O0119_BASE_PALETTE_444 sps.setPLTMode ( m_PLTMode); -#endif sps.setIBCFlag ( m_IBCMode); sps.setWrapAroundEnabledFlag ( m_wrapAround ); sps.setWrapAroundOffset ( m_wrapAroundOffset ); @@ -1224,44 +1041,26 @@ void EncLib::xInitSPS(SPS &sps) sps.setLog2MinCodingBlockSize(log2MinCUSize); -#if !JVET_O0525_REMOVE_PCM - sps.setPCMLog2MinSize (m_uiPCMLog2MinSize); - sps.setPCMEnabledFlag ( m_usePCM ); - sps.setPCMLog2MaxSize( m_pcmLog2MaxSize ); -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING sps.setTransformSkipEnabledFlag(m_useTransformSkip); sps.setBDPCMEnabledFlag(m_useBDPCM); -#endif sps.setSPSTemporalMVPEnabledFlag((getTMVPModeId() == 2 || getTMVPModeId() == 1)); -#if MAX_TB_SIZE_SIGNALLING sps.setLog2MaxTbSize ( m_log2MaxTbSize ); -#endif for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { sps.setBitDepth (ChannelType(channelType), m_bitDepth[channelType] ); sps.setQpBDOffset (ChannelType(channelType), (6 * (m_bitDepth[channelType] - 8))); -#if JVET_O0919_TS_MIN_QP sps.setMinQpPrimeTsMinus4(ChannelType(channelType), (6 * (m_bitDepth[channelType] - m_inputBitDepth[channelType]))); -#endif -#if !JVET_O0525_REMOVE_PCM - sps.setPCMBitDepth (ChannelType(channelType), m_PCMBitDepth[channelType] ); -#endif } -#if JVET_O0244_DELTA_POC sps.setUseWP( m_useWeightedPred ); sps.setUseWPBiPred( m_useWeightedBiPred ); -#endif sps.setSAOEnabledFlag( m_bUseSAO ); -#if JVET_O0376_SPS_JOINTCBCR_FLAG sps.setJointCbCrEnabledFlag( m_JointCbCrMode ); -#endif sps.setMaxTLayers( m_maxTempLayer ); sps.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false ); @@ -1271,9 +1070,6 @@ void EncLib::xInitSPS(SPS &sps) sps.setNumReorderPics(m_numReorderPics[i], i); } -#if !JVET_O0525_REMOVE_PCM - sps.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag ); -#endif sps.setScalingListFlag ( (m_useScalingListId == SCALING_LIST_OFF) ? 0 : 1 ); sps.setALFEnabledFlag( m_alf ); sps.setVuiParametersPresentFlag(getVuiParametersPresentFlag()); @@ -1307,10 +1103,8 @@ void EncLib::xInitSPS(SPS &sps) sps.setLtRefPicPocLsbSps(k, 0); sps.setUsedByCurrPicLtSPSFlag(k, 0); } -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE sps.setChromaQpMappingTableFromParams(m_chromaQpMappingTableParams, sps.getQpBDOffset(CHANNEL_TYPE_CHROMA)); sps.derivedChromaQPMappingTables(); -#endif #if U0132_TARGET_BITS_SATURATION if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() || getCpbSaturationEnabled() ) @@ -1358,7 +1152,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) // pps ID already initialised. pps.setSPSId(sps.getSPSId()); - #if JVET_O0238_PPS_OR_SLICE pps.setConstantSliceHeaderParamsEnabledFlag(getConstantSliceHeaderParamsEnabledFlag()); pps.setPPSDepQuantEnabledIdc(getPPSDepQuantEnabledIdc()); pps.setPPSRefPicListSPSIdc0(getPPSRefPicListSPSIdc0()); @@ -1369,7 +1162,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setPPSSixMinusMaxNumMergeCandPlus1(getPPSSixMinusMaxNumMergeCandPlus1()); pps.setPPSFiveMinusMaxNumSubblockMergeCandPlus1(getPPSFiveMinusMaxNumSubblockMergeCandPlus1()); pps.setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1()); -#endif pps.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false; @@ -1419,11 +1211,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) { pps.setCuChromaQpOffsetSubdiv(m_cuChromaQpOffsetSubdiv); pps.clearChromaQpOffsetList(); -#if JVET_O1168_CU_CHROMA_QP_OFFSET pps.setChromaQpOffsetListEntry(1, 6, 6, 6); -#else - pps.setChromaQpOffsetListEntry(1, 6, 6); -#endif /* todo, insert table entries from command line (NB, 0 should not be touched) */ } else @@ -1572,12 +1360,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setNumRefIdxL0DefaultActive(bestPos); pps.setNumRefIdxL1DefaultActive(bestPos); pps.setTransquantBypassEnabledFlag(getTransquantBypassEnabledFlag()); -#if JVET_O1136_TS_BDPCM_SIGNALLING pps.setLog2MaxTransformSkipBlockSize(m_log2MaxTransformSkipBlockSize); -#else - pps.setUseTransformSkip( m_useTransformSkip ); - pps.getPpsRangeExtension().setLog2MaxTransformSkipBlockSize( m_log2MaxTransformSkipBlockSize ); -#endif xInitPPSforTiles(pps); @@ -1622,9 +1405,7 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding) rpl->setNumberOfShorttermPictures(ge.m_numRefPics); rpl->setNumberOfLongtermPictures(0); //Hardcoded as 0 for now. need to update this when implementing LTRP rpl->setNumberOfActivePictures(ge.m_numRefPicsActive); -#if JVET_N0100_PROPOSAL1 rpl->setLtrpInSliceHeaderFlag(ge.m_ltrp_in_slice_header_flag); -#endif for (int k = 0; k < ge.m_numRefPics; k++) { @@ -1806,20 +1587,17 @@ void EncLib::xInitPPSforTiles(PPS &pps) pps.setTileColumnWidth( m_tileColumnWidth ); pps.setTileRowHeight( m_tileRowHeight ); } -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA else { pps.setTileColsWidthMinus1(m_uniformTileColsWidthMinus1); pps.setTileRowsHeightMinus1(m_uniformTileRowHeightMinus1); } -#endif pps.setLoopFilterAcrossBricksEnabledFlag( m_loopFilterAcrossBricksEnabledFlag ); //pps.setRectSliceFlag( m_rectSliceFlag ); pps.setNumSlicesInPicMinus1( m_numSlicesInPicMinus1 ); pps.setTopLeftBrickIdx(m_topLeftBrickIdx); pps.setBottomRightBrickIdx(m_bottomRightBrickIdx); -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (m_numSlicesInPicMinus1 > 0) { std::vector<int> bottomrightdelta(m_numSlicesInPicMinus1 + 1); @@ -1829,7 +1607,6 @@ void EncLib::xInitPPSforTiles(PPS &pps) } pps.setBottomRightBrickIdxDelta(bottomrightdelta); } -#endif pps.setLoopFilterAcrossBricksEnabledFlag( m_loopFilterAcrossBricksEnabledFlag ); pps.setLoopFilterAcrossSlicesEnabledFlag( m_loopFilterAcrossSlicesEnabledFlag ); @@ -1841,9 +1618,7 @@ void EncLib::xInitPPSforTiles(PPS &pps) int numTiles= (m_iNumColumnsMinus1 + 1) * (m_iNumRowsMinus1 + 1); pps.setNumTilesInPic(numTiles); -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION std::vector<int> tileHeight(numTiles); -#endif if (m_brickSplitMap.empty()) { @@ -1856,11 +1631,7 @@ void EncLib::xInitPPSforTiles(PPS &pps) std::vector<bool> brickSplitFlag (numTiles, false); std::vector<bool> uniformBrickSpacingFlag (numTiles, false); std::vector<int> brickHeightMinus1 (numTiles, 0); -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 std::vector<int> numBrickRowsMinus2(numTiles, 0); -#else - std::vector<int> numBrickRowsMinus1 (numTiles, 0); -#endif std::vector<std::vector<int>> brickRowHeightMinus1 (numTiles); for (auto &brickSplit: m_brickSplitMap) @@ -1876,11 +1647,7 @@ void EncLib::xInitPPSforTiles(PPS &pps) } else { -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 numBrickRowsMinus2[tileIdx] = brickSplit.second.m_numSplits - 1; -#else - numBrickRowsMinus1[tileIdx]=brickSplit.second.m_numSplits; -#endif brickRowHeightMinus1[tileIdx].resize(brickSplit.second.m_numSplits); for (int i=0; i<brickSplit.second.m_numSplits; i++) { @@ -1891,11 +1658,7 @@ void EncLib::xInitPPSforTiles(PPS &pps) pps.setBrickSplitFlag(brickSplitFlag); pps.setUniformBrickSpacingFlag(uniformBrickSpacingFlag); pps.setBrickHeightMinus1(brickHeightMinus1); -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 pps.setNumBrickRowsMinus2(numBrickRowsMinus2); -#else - pps.setNumBrickRowsMinus1(numBrickRowsMinus1); -#endif pps.setBrickRowHeightMinus1(brickRowHeightMinus1); // check brick dimensions @@ -1924,7 +1687,6 @@ void EncLib::xInitPPSforTiles(PPS &pps) // check brick splits for each tile for (int tileIdx=0; tileIdx < numTiles; tileIdx++) { -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION const int tileY = tileIdx / (m_iNumColumnsMinus1 + 1); tileHeight[tileIdx] = tileRowHeight[tileY]; @@ -1933,51 +1695,29 @@ void EncLib::xInitPPSforTiles(PPS &pps) { CHECK(pps.getBrickSplitFlag(tileIdx) != 0, "The value of brick_split_flag[ i ] shall be 0 if tileHeight <= 1"); } -#endif if (pps.getBrickSplitFlag(tileIdx)) { -#if !JVET_O0452_PPS_BRICK_SIGNALING_CONDITION - const int tileY = tileIdx / (m_iNumColumnsMinus1+1); - - int tileHeight = tileRowHeight [tileY]; -#endif -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION if (tileHeight[tileIdx] <= 2) { CHECK(pps.getUniformBrickSpacingFlag(tileIdx) != 1, "The value of uniform_brick_spacing_flag[ i ] shall be 1 if tileHeight <= 2"); } -#endif if (pps.getUniformBrickSpacingFlag(tileIdx)) { -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION CHECK((pps.getBrickHeightMinus1(tileIdx) + 1) >= tileHeight[tileIdx], "Brick height larger than or equal to tile height"); -#else - CHECK((pps.getBrickHeightMinus1(tileIdx) + 1) >= tileHeight, "Brick height larger than or equal to tile height"); -#endif } else { int cumulativeHeight=0; -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 for (int i = 0; i <= pps.getNumBrickRowsMinus2(tileIdx); i++) -#else - for (int i = 0; i < pps.getNumBrickRowsMinus1(tileIdx); i++) -#endif { cumulativeHeight += pps.getBrickRowHeightMinus1(tileIdx, i) + 1; } -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION CHECK(cumulativeHeight >= tileHeight[tileIdx], "Cumulative brick height larger than or equal to tile height"); -#else - CHECK(cumulativeHeight >= tileHeight, "Cumulative brick height larger than or equal to tile height"); -#endif } } } } -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION pps.setTileHeight(tileHeight); -#endif } void EncCfg::xCheckGSParameters() @@ -1987,7 +1727,6 @@ void EncCfg::xCheckGSParameters() uint32_t uiCummulativeColumnWidth = 0; uint32_t uiCummulativeRowHeight = 0; -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA if (m_tileUniformSpacingFlag && m_uniformTileColsWidthMinus1 == -1) { EXIT("Uniform tiles specified with unspecified or invalid UniformTileColsWidthMinus1 value"); @@ -2004,7 +1743,6 @@ void EncCfg::xCheckGSParameters() { EXIT("UniformTileRowHeightMinus1 too large"); } -#endif //check the column relative parameters if( m_iNumColumnsMinus1 >= (1<<(LOG2_MAX_NUM_COLUMNS_MINUS1+1)) ) @@ -2081,7 +1819,6 @@ bool EncLib::SPSNeedsWriting(int spsId) return bChanged; } -#if JVET_O0119_BASE_PALETTE_444 void EncLib::checkPltStats( Picture* pic ) { int totalArea = 0; @@ -2112,7 +1849,6 @@ void EncLib::checkPltStats( Picture* pic ) m_doPlt = true; } } -#endif #if X0038_LAMBDA_FROM_QP_CAPABILITY int EncCfg::getQPForPicture(const uint32_t gopIndex, const Slice *pSlice) const diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index 4721510c11052b536b016d764cc3f4a27be442dd..5c3e2db0296f3f037e286242656372c642cbd2e5 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -138,31 +138,21 @@ private: CacheModel m_cacheModel; #endif -#if JVET_O_MAX_NUM_ALF_APS_8 APS* m_apss[ALF_CTB_MAX_NUM_APS]; -#else - APS* m_apss[MAX_NUM_APS]; -#endif APS* m_lmcsAPS; -#if JVET_O0299_APS_SCALINGLIST APS* m_scalinglistAPS; -#endif EncHRD m_encHRD; -#if JVET_O0119_BASE_PALETTE_444 bool m_doPlt; -#endif #if JVET_O0756_CALCULATE_HDRMETRICS std::chrono::duration<long long, ratio<1, 1000000000>> m_metricTime; #endif public: -#if JVET_O1164_RPR SPS* getSPS( int spsId ) { return m_spsMap.getPS( spsId ); }; APS** getApss() { return m_apss; } -#endif Ctx m_entropyCodingSyncContextState; ///< leave in addition to vector for compatibility #if ENABLE_WPP_PARALLELISM std::vector<Ctx> m_entropyCodingSyncContextStateVec; ///< context storage for state of contexts at the wavefront/WPP/entropy-coding-sync second CTU of tile-row @@ -175,11 +165,7 @@ protected: void xInitSPS (SPS &sps); ///< initialize SPS from encoder options void xInitPPS (PPS &pps, const SPS &sps); ///< initialize PPS from encoder options void xInitAPS (APS &aps); ///< initialize APS from encoder options -#if JVET_O0299_APS_SCALINGLIST void xInitScalingLists ( SPS &sps, APS &aps ); ///< initialize scaling lists -#else - void xInitScalingLists (SPS &sps, PPS &pps); ///< initialize scaling lists -#endif void xInitPPSforLT(PPS& pps); void xInitHrdParameters(SPS &sps); ///< initialize HRDParameters parameters @@ -217,9 +203,7 @@ public: EncAdaptiveLoopFilter* getALF () { return &m_cEncALF; } EncGOP* getGOPEncoder () { return &m_cGOPEncoder; } EncSlice* getSliceEncoder () { return &m_cSliceEncoder; } -#if JVET_N0353_INDEP_BUFF_TIME_SEI EncHRD* getHRD () { return &m_encHRD; } -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM EncCu* getCuEncoder ( int jId = 0 ) { return &m_cCuEncoder[jId]; } #else @@ -263,10 +247,8 @@ public: ParameterSetMap<APS>* getApsMap() { return &m_apsMap; } -#if JVET_O0119_BASE_PALETTE_444 bool getPltEnc() const { return m_doPlt; } void checkPltStats( Picture* pic ); -#endif #if JVET_O0756_CALCULATE_HDRMETRICS std::chrono::duration<long long, ratio<1, 1000000000>> getMetricTime() const { return m_metricTime; }; #endif @@ -289,11 +271,7 @@ public: int& iNumEncoded, bool isTff ); -#if RPR_CTC_PRINT void printSummary( bool isField ) { m_cGOPEncoder.printOutSummary( m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_printHexPsnr, m_rprEnabled, m_spsMap.getFirstPS()->getBitDepths() ); } -#else - void printSummary(bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_printHexPsnr, m_spsMap.getFirstPS()->getBitDepths()); } -#endif }; diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 977571e9da222dee7215579c6fd82e3f5a2490e7..30c30a1260a5dcecfa461cbe4301516158cbc454 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -729,7 +729,6 @@ void BestEncInfoCache::destroy() delete[] m_pCoeff; delete[] m_pPcmBuf; -#if JVET_O0119_BASE_PALETTE_444 if (m_runType != nullptr) { delete[] m_runType; @@ -740,7 +739,6 @@ void BestEncInfoCache::destroy() delete[] m_runLength; m_runLength = nullptr; } -#endif } @@ -782,25 +780,19 @@ void BestEncInfoCache::init( const Slice &slice ) #if REUSE_CU_RESULTS_WITH_MULTIPLE_TUS m_pCoeff = new TCoeff[numCoeff*MAX_NUM_TUS]; m_pPcmBuf = new Pel [numCoeff*MAX_NUM_TUS]; -#if JVET_O0119_BASE_PALETTE_444 m_runType = new bool[numCoeff*MAX_NUM_TUS]; m_runLength = new Pel [numCoeff*MAX_NUM_TUS]; -#endif #else m_pCoeff = new TCoeff[numCoeff]; m_pPcmBuf = new Pel [numCoeff]; -#if JVET_O0119_BASE_PALETTE_444 m_runType = new bool[numCoeff]; m_runLength = new Pel [numCoeff]; -#endif #endif TCoeff *coeffPtr = m_pCoeff; Pel *pcmPtr = m_pPcmBuf; -#if JVET_O0119_BASE_PALETTE_444 bool *runTypePtr = m_runType; Pel *runLengthPtr = m_runLength; -#endif m_dummyCS.pcv = m_slice_bencinf->getPPS()->pcv; @@ -816,10 +808,8 @@ void BestEncInfoCache::init( const Slice &slice ) { TCoeff *coeff[MAX_NUM_TBLOCKS] = { 0, }; Pel *pcmbf[MAX_NUM_TBLOCKS] = { 0, }; -#if JVET_O0119_BASE_PALETTE_444 bool *runType[MAX_NUM_TBLOCKS] = { 0, }; Pel *runLength[MAX_NUM_TBLOCKS] = { 0, }; -#endif #if REUSE_CU_RESULTS_WITH_MULTIPLE_TUS for( int i = 0; i < MAX_NUM_TUS; i++ ) @@ -831,18 +821,12 @@ void BestEncInfoCache::init( const Slice &slice ) { coeff[i] = coeffPtr; coeffPtr += area.blocks[i].area(); pcmbf[i] = pcmPtr; pcmPtr += area.blocks[i].area(); -#if JVET_O0119_BASE_PALETTE_444 runType[i] = runTypePtr; runTypePtr += area.blocks[i].area(); runLength[i] = runLengthPtr; runLengthPtr += area.blocks[i].area(); -#endif } tu.cs = &m_dummyCS; -#if JVET_O0119_BASE_PALETTE_444 tu.init(coeff, pcmbf, runLength, runType); -#else - tu.init(coeff, pcmbf); -#endif } #else const UnitArea &area = m_bestEncInfo[x][y][wIdx][hIdx]->tu; @@ -851,18 +835,12 @@ void BestEncInfoCache::init( const Slice &slice ) { coeff[i] = coeffPtr; coeffPtr += area.blocks[i].area(); pcmbf[i] = pcmPtr; pcmPtr += area.blocks[i].area(); -#if JVET_O0119_BASE_PALETTE_444 runType[i] = runTypePtr; runTypePtr += area.blocks[i].area(); runLength[i] = runLengthPtr; runLengthPtr += area.blocks[i].area(); -#endif } m_bestEncInfo[x][y][wIdx][hIdx]->tu.cs = &m_dummyCS; -#if JVET_O0119_BASE_PALETTE_444 m_bestEncInfo[x][y][wIdx][hIdx]->tu.init(coeff, pcmbf, runLength, runType); -#else - m_bestEncInfo[x][y][wIdx][hIdx]->tu.init( coeff, pcmbf ); -#endif #endif } } @@ -927,23 +905,19 @@ bool BestEncInfoCache::setFromCs( const CodingStructure& cs, const Partitioner& bool BestEncInfoCache::isValid( const CodingStructure& cs, const Partitioner& partitioner, int qp ) { -#if JVET_O0050_LOCAL_DUAL_TREE if( partitioner.treeType == TREE_C ) { return false; //if save & load is allowed for chroma CUs, we should check whether luma info (pred, recon, etc) is the same, which is quite complex } -#endif unsigned idx1, idx2, idx3, idx4; getAreaIdx( cs.area.Y(), *m_slice_bencinf->getPPS()->pcv, idx1, idx2, idx3, idx4 ); BestEncodingInfo& encInfo = *m_bestEncInfo[idx1][idx2][idx3][idx4]; -#if JVET_O0050_LOCAL_DUAL_TREE if( encInfo.cu.treeType != partitioner.treeType || encInfo.cu.modeType != partitioner.modeType ) { return false; } -#endif if( encInfo.cu.qp != qp ) return false; if( cs.picture->poc != encInfo.poc || CS::getArea( cs, cs.area, partitioner.chType ) != CS::getArea( cs, encInfo.cu, partitioner.chType ) || !isTheSameNbHood( encInfo.cu, cs, partitioner @@ -1197,11 +1171,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // QP int baseQP = cs.baseQP; -#if JVET_O0050_LOCAL_DUAL_TREE if (!partitioner.isSepTree(cs) || isLuma(partitioner.chType)) -#else - if (!CS::isDualITree (cs) || isLuma (partitioner.chType)) -#endif { if (m_pcEncCfg->getUseAdaptiveQP()) { @@ -1215,11 +1185,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru if ((partitioner.currArea().lwidth() < pcv.maxCUWidth) && (partitioner.currArea().lheight() < pcv.maxCUHeight) && cs.picture) { const Position &pos = partitioner.currQgPos; -#if MAX_TB_SIZE_SIGNALLING const unsigned mtsLog2 = (unsigned)floorLog2(std::min (cs.sps->getMaxTbSize(), pcv.maxCUWidth)); -#else - const unsigned mtsLog2 = (unsigned)floorLog2(std::min<uint32_t> (MAX_TB_SIZEY, pcv.maxCUWidth)); -#endif const unsigned stride = pcv.maxCUWidth >> mtsLog2; baseQP = cs.picture->m_subCtuQP[((pos.x & pcv.maxCUWidthMask) >> mtsLog2) + stride * ((pos.y & pcv.maxCUHeightMask) >> mtsLog2)]; @@ -1244,27 +1210,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru bool checkIbc = true; if (partitioner.chType == CHANNEL_TYPE_CHROMA) { -#if JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE checkIbc = false; -#else - IbcLumaCoverage ibcLumaCoverage = cs.getIbcLumaCoverage(cs.area.Cb()); - switch (ibcLumaCoverage) - { - case IBC_LUMA_COVERAGE_FULL: - // check IBC - break; - case IBC_LUMA_COVERAGE_PARTIAL: - // do not check IBC - checkIbc = false; - break; - case IBC_LUMA_COVERAGE_NONE: - // do not check IBC - checkIbc = false; - break; - default: - THROW("Unknown IBC luma coverage type"); - } -#endif } // Add coding modes here // NOTE: Working back to front, as a stack, which is more efficient with the container @@ -1357,7 +1303,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru ////////////////////////////////////////////////////////////////////////// // Add unit coding modes: Intra, InterME, InterMerge ... -#if JVET_O0050_LOCAL_DUAL_TREE bool tryIntraRdo = true; bool tryInterRdo = true; bool tryIBCRdo = true; @@ -1370,7 +1315,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru tryIntraRdo = tryIBCRdo = false; } checkIbc &= tryIBCRdo; -#endif for( int qpLoop = maxQP; qpLoop >= minQP; qpLoop-- ) { @@ -1385,29 +1329,18 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru } #endif // add intra modes -#if JVET_O0050_LOCAL_DUAL_TREE if( tryIntraRdo ) { -#endif -#if !JVET_O0525_REMOVE_PCM - m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, ETO_STANDARD, qp, lossless } ); -#endif -#if JVET_O0119_BASE_PALETTE_444 if (cs.slice->getSPS()->getPLTMode() && ( cs.slice->isIRAP() || (cs.area.lwidth() == 4 && cs.area.lheight() == 4) ) && getPltEnc() ) { m_ComprCUCtxList.back().testModes.push_back({ ETM_PALETTE, ETO_STANDARD, qp, lossless }); } -#endif m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp, lossless } ); -#if JVET_O0119_BASE_PALETTE_444 if (cs.slice->getSPS()->getPLTMode() && !cs.slice->isIRAP() && !(cs.area.lwidth() == 4 && cs.area.lheight() == 4) && getPltEnc() ) { m_ComprCUCtxList.back().testModes.push_back({ ETM_PALETTE, ETO_STANDARD, qp, lossless }); } -#endif -#if JVET_O0050_LOCAL_DUAL_TREE } -#endif // add ibc mode to intra path if (cs.sps->getIBCFlag() && checkIbc) { @@ -1420,22 +1353,16 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru } // add first pass modes -#if JVET_O0050_LOCAL_DUAL_TREE if ( !m_slice->isIRAP() && !( cs.area.lwidth() == 4 && cs.area.lheight() == 4 ) && tryInterRdo ) -#else - if ( !m_slice->isIRAP() && !( cs.area.lwidth() == 4 && cs.area.lheight() == 4 ) ) -#endif { for( int qpLoop = maxQP; qpLoop >= minQP; qpLoop-- ) { const int qp = std::max( qpLoop, lowestQP ); const bool lossless = useLossless && qpLoop == minQP; -#if JVET_O0057_ALTHPELIF if (m_pcEncCfg->getIMV()) { m_ComprCUCtxList.back().testModes.push_back({ ETM_INTER_ME, EncTestModeOpts( 4 << ETO_IMV_SHIFT ), qp, lossless }); } -#endif if( m_pcEncCfg->getIMV() || m_pcEncCfg->getUseAffineAmvr() ) { int imv = m_pcEncCfg->getIMV4PelFast() ? 3 : 2; @@ -1542,11 +1469,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt const SPS& sps = *slice.getSPS(); const uint32_t numComp = getNumberValidComponents( slice.getSPS()->getChromaFormatIdc() ); const uint32_t width = partitioner.currArea().lumaSize().width; -#if !JVET_O0525_REMOVE_PCM -#if FIX_PCM - const uint32_t height = partitioner.currArea().lumaSize().height; -#endif -#endif const CodingStructure *bestCS = cuECtx.bestCS; const CodingUnit *bestCU = cuECtx.bestCU; const EncTestMode bestMode = bestCS ? getCSEncMode( *bestCS ) : EncTestMode(); @@ -1598,12 +1520,10 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt // INTRA MODES if (cs.sps->getIBCFlag() && !cuECtx.bestTU) return true; -#if JVET_O0050_LOCAL_DUAL_TREE if( partitioner.isConsIntra() && !cuECtx.bestTU ) { return true; } -#endif if ( partitioner.currArea().lumaSize().width == 4 && partitioner.currArea().lumaSize().height == 4 && !slice.isIntra() && !cuECtx.bestTU ) { return true; @@ -1640,15 +1560,12 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } } } -#if JVET_O0119_BASE_PALETTE_444 if (bestMode.type == ETM_PALETTE && !slice.isIRAP() && !( partitioner.currArea().lumaSize().width == 4 && partitioner.currArea().lumaSize().height == 4) ) // inter slice { return false; } -#endif return true; } -#if JVET_O0119_BASE_PALETTE_444 else if (encTestmode.type == ETM_PALETTE) { if (partitioner.currArea().lumaSize().width > 64 || partitioner.currArea().lumaSize().height > 64) @@ -1670,38 +1587,10 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } return true; } -#endif -#if !JVET_O0525_REMOVE_PCM - else if( encTestmode.type == ETM_IPCM ) - { - if( getFastDeltaQp() ) - { - const SPS &sps = *cs.sps; - const uint32_t fastDeltaQPCuMaxPCMSize = Clip3( ( uint32_t ) 1 << sps.getPCMLog2MinSize(), ( uint32_t ) 1 << sps.getPCMLog2MaxSize(), 32u ); - - if( cs.area.lumaSize().width > fastDeltaQPCuMaxPCMSize ) - { - return false; // only check necessary PCM in fast deltaqp mode - } - } - - // PCM MODES -#if FIX_PCM - return sps.getPCMEnabledFlag() && width <= ( 1 << sps.getPCMLog2MaxSize() ) && width >= ( 1 << sps.getPCMLog2MinSize() ) - && height <= ( 1 << sps.getPCMLog2MaxSize() ) && height >= ( 1 << sps.getPCMLog2MinSize() ); -#else - return sps.getPCMEnabledFlag() && width <= ( 1 << sps.getPCMLog2MaxSize() ) && width >= ( 1 << sps.getPCMLog2MinSize() ); -#endif - } -#endif else if (encTestmode.type == ETM_IBC || encTestmode.type == ETM_IBC_MERGE) { // IBC MODES -#if JVET_O1161_IBC_MAX_SIZE return sps.getIBCFlag() && (partitioner.currArea().lumaSize().width < 128 && partitioner.currArea().lumaSize().height < 128); -#else - return sps.getIBCFlag() && (partitioner.currArea().lumaSize().width < 128 || partitioner.currArea().lumaSize().height < 128); -#endif } else if( isModeInter( encTestmode ) ) { @@ -1947,7 +1836,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { CHECK( encTestmode.type != ETM_POST_DONT_SPLIT, "Unknown mode" ); -#if JVET_O0592_ENC_ME_IMP if ((cuECtx.get<double>(BEST_NO_IMV_COST) == (MAX_DOUBLE * .5) || cuECtx.get<bool>(IS_REUSING_CU)) && !slice.isIntra()) { unsigned idx1, idx2, idx3, idx4; @@ -1957,7 +1845,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt m_pcInterSearch->insertUniMvCands(partitioner.currArea().Y(), g_reusedUniMVs[idx1][idx2][idx3][idx4]); } } -#endif if( !bestCS || ( bestCS && isModeSplit( bestMode ) ) ) { @@ -1969,12 +1856,10 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt setFromCs( *bestCS, partitioner ); #endif -#if JVET_O0050_LOCAL_DUAL_TREE if( partitioner.modeType == MODE_TYPE_INTRA && partitioner.chType == CHANNEL_TYPE_LUMA ) { return false; //not set best coding mode for intra coding pass } -#endif // assume the non-split modes are done and set the marks for the best found mode if( bestCS && bestCU ) { diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index b29cb082674f5b07c0eb1aae139ac413202547a5..95e8aee911e463bc46b0c35e91ab2706eac808bf 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -43,9 +43,7 @@ #include "CommonLib/CommonDef.h" #include "CommonLib/CodingStructure.h" -#if JVET_O0592_ENC_ME_IMP #include "InterSearch.h" -#endif #include <typeinfo> #include <vector> @@ -63,12 +61,7 @@ enum EncTestModeType ETM_AFFINE, ETM_MERGE_TRIANGLE, ETM_INTRA, -#if !JVET_O0525_REMOVE_PCM - ETM_IPCM, -#endif -#if JVET_O0119_BASE_PALETTE_444 ETM_PALETTE, -#endif ETM_SPLIT_QT, ETM_SPLIT_BT_H, ETM_SPLIT_BT_V, @@ -117,9 +110,7 @@ struct EncTestMode EncTestModeOpts opts; int qp; bool lossless; -#if JVET_O0502_ISP_CLEANUP double maxCostAllowed; -#endif }; @@ -269,13 +260,9 @@ protected: #if ENABLE_SPLIT_PARALLELISM int m_runNextInParallel; #endif -#if JVET_O0592_ENC_ME_IMP InterSearch* m_pcInterSearch; -#endif -#if JVET_O0119_BASE_PALETTE_444 bool m_doPlt; -#endif public: @@ -333,13 +320,9 @@ public: void setBestCostWithoutSplitFlags ( double cost ) { m_ComprCUCtxList.back().bestCostWithoutSplitFlags = cost; } double getMtsFirstPassNoIspCost () const { return m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp; } void setMtsFirstPassNoIspCost ( double cost ) { m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp = cost; } -#if JVET_O0592_ENC_ME_IMP void setInterSearch (InterSearch* pcInterSearch) { m_pcInterSearch = pcInterSearch; } -#endif -#if JVET_O0119_BASE_PALETTE_444 void setPltEnc ( bool b ) { m_doPlt = b; } bool getPltEnc() const { return m_doPlt; } -#endif protected: void xExtractFeatures ( const EncTestMode encTestmode, CodingStructure& cs ); @@ -481,10 +464,8 @@ private: BestEncodingInfo ***m_bestEncInfo[MAX_CU_SIZE >> MIN_CU_LOG2][MAX_CU_SIZE >> MIN_CU_LOG2]; TCoeff *m_pCoeff; Pel *m_pPcmBuf; -#if JVET_O0119_BASE_PALETTE_444 bool *m_runType; Pel *m_runLength; -#endif CodingStructure m_dummyCS; XUCache m_dummyCache; #if ENABLE_SPLIT_PARALLELISM diff --git a/source/Lib/EncoderLib/EncReshape.cpp b/source/Lib/EncoderLib/EncReshape.cpp index 703c3a4c3e646130cf2088c9fc047ae3518277b1..247c4cb3c650e438e81c6b9ae0f038791b0cfc52 100644 --- a/source/Lib/EncoderLib/EncReshape.cpp +++ b/source/Lib/EncoderLib/EncReshape.cpp @@ -78,14 +78,12 @@ void EncReshape::createEnc(int picWidth, int picHeight, uint32_t maxCUWidth, ui m_binImportance.resize(PIC_ANALYZE_CW_BINS); if (m_reshapePivot.empty()) m_reshapePivot.resize(PIC_CODE_CW_BINS + 1, 0); -#if JVET_O0428_LMCS_CLEANUP if (m_inputPivot.empty()) m_inputPivot.resize(PIC_CODE_CW_BINS + 1, 0); if (m_fwdScaleCoef.empty()) m_fwdScaleCoef.resize(PIC_CODE_CW_BINS, 1 << FP_PREC); if (m_invScaleCoef.empty()) m_invScaleCoef.resize(PIC_CODE_CW_BINS, 1 << FP_PREC); -#endif if (m_chromaAdjHelpLUT.empty()) m_chromaAdjHelpLUT.resize(PIC_CODE_CW_BINS, 1<<CSCALE_FP_PREC); @@ -103,11 +101,9 @@ void EncReshape::createEnc(int picWidth, int picHeight, uint32_t maxCUWidth, ui m_widthInCtus = (m_picWidth + m_maxCUWidth - 1) / m_maxCUWidth; m_heightInCtus = (m_picHeight + m_maxCUHeight - 1) / m_maxCUHeight; m_numCtuInFrame = m_widthInCtus * m_heightInCtus; -#if JVET_O0432_LMCS_ENCODER m_binNum = PIC_CODE_CW_BINS; initSeqStats(m_srcSeqStats); initSeqStats(m_rspSeqStats); -#endif } void EncReshape::destroy() @@ -126,10 +122,6 @@ void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const m_sliceReshapeInfo.sliceReshaperEnableFlag = true; if (sliceType == I_SLICE ) { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; } else { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = false; } -#if !JVET_O1109_UNFIY_CRS - if (sliceType == I_SLICE && isDualT) { m_sliceReshapeInfo.enableChromaAdj = 0; } - else -#endif { m_sliceReshapeInfo.enableChromaAdj = 1; } } else @@ -145,7 +137,6 @@ void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const \param sliceType describe the slice type \param reshapeCW describe some input info */ -#if JVET_O0432_LMCS_ENCODER void EncReshape::initSeqStats(SeqInfo &stats) { for (int i = 0; i < m_binNum; i++) @@ -562,355 +553,6 @@ void EncReshape::preAnalyzerLMCS(Picture *pcPic, const uint32_t signalType, cons } } } -#else -void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT) -{ - m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; - m_sliceReshapeInfo.sliceReshaperEnableFlag = true; - - int modIP = pcPic->getPOC() - pcPic->getPOC() / reshapeCW.rspFpsToIp * reshapeCW.rspFpsToIp; - if (sliceType == I_SLICE || (reshapeCW.rspIntraPeriod == -1 && modIP == 0)) - { - if (m_sliceReshapeInfo.sliceReshaperModelPresentFlag == true) - { - int stdMin = 16 <<(m_lumaBD-8); - int stdMax = 235 << (m_lumaBD - 8); - int binLen = m_reshapeLUTSize / PIC_ANALYZE_CW_BINS; - - m_reshapeCW = reshapeCW; - m_initCWAnalyze = binLen; - - for (int b = 0; b < PIC_ANALYZE_CW_BINS; b++) - { - m_binImportance[b] = 0; - m_binCW[b] = binLen; - } - - int startBinIdx = stdMin / binLen; - int endBinIdx = stdMax / binLen; - m_sliceReshapeInfo.reshaperModelMinBinIdx = startBinIdx; - m_sliceReshapeInfo.reshaperModelMaxBinIdx = endBinIdx; - - PelBuf picY = pcPic->getOrigBuf(COMPONENT_Y); - const int width = picY.width; - const int height = picY.height; - const int stride = picY.stride; - - double blockBinVarSum[PIC_ANALYZE_CW_BINS] = { 0.0 }; - uint32_t bockBinCnt[PIC_ANALYZE_CW_BINS] = { 0 }; - - const int PIC_ANALYZE_WIN_SIZE = 5; - const uint32_t winSize = PIC_ANALYZE_WIN_SIZE; - const uint32_t winLens = (winSize - 1) >> 1; - - int64_t tempSq = 0; - int64_t leftSum = 0, leftSumSq = 0; - int64_t *leftColSum = new int64_t[width]; - int64_t *leftColSumSq = new int64_t[width]; - memset(leftColSum, 0, width * sizeof(int64_t)); - memset(leftColSumSq, 0, width * sizeof(int64_t)); - int64_t topSum = 0, topSumSq = 0; - int64_t *topRowSum = new int64_t[height]; - int64_t *topRowSumSq = new int64_t[height]; - memset(topRowSum, 0, height * sizeof(int64_t)); - memset(topRowSumSq, 0, height * sizeof(int64_t)); - int64_t *topColSum = new int64_t[width]; - int64_t *topColSumSq = new int64_t[width]; - memset(topColSum, 0, width * sizeof(int64_t)); - memset(topColSumSq, 0, width * sizeof(int64_t)); - - for (uint32_t y = 0; y < height; y++) - { - for (uint32_t x = 0; x < width; x++) - { - const Pel pxlY = picY.buf[x]; - int64_t sum = 0; - int64_t sumSq = 0; - uint32_t numPixInPart = 0; - - uint32_t y1 = std::max((int)(y - winLens), 0); - uint32_t y2 = std::min((int)(y + winLens), (height - 1)); - uint32_t x1 = std::max((int)(x - winLens), 0); - uint32_t x2 = std::min((int)(x + winLens), (width - 1)); - - - uint32_t bx = 0, by = 0; - const Pel *pWinY = &picY.buf[0]; - numPixInPart = (x2 - x1 + 1) * (y2 - y1 + 1); - - if (x == 0 && y == 0) // for the 1st Pixel, calc all points - { - for (by = y1; by <= y2; by++) - { - for (bx = x1; bx <= x2; bx++) - { - tempSq = pWinY[bx] * pWinY[bx]; - leftSum += pWinY[bx]; - leftSumSq += tempSq; - leftColSum[bx] += pWinY[bx]; - leftColSumSq[bx] += tempSq; - topColSum[bx] += pWinY[bx]; - topColSumSq[bx] += tempSq; - topRowSum[by] += pWinY[bx]; - topRowSumSq[by] += tempSq; - } - pWinY += stride; - } - topSum = leftSum; - topSumSq = leftSumSq; - sum = leftSum; - sumSq = leftSumSq; - } - else if (x == 0 && y > 0) // for the 1st column, calc the bottom stripe - { - if (y < height - winLens) - { - pWinY += winLens*stride; - topRowSum[y + winLens] = 0; - topRowSumSq[y + winLens] = 0; - for (bx = x1; bx <= x2; bx++) - { - topRowSum[y + winLens] += pWinY[bx]; - topRowSumSq[y + winLens] += pWinY[bx] * pWinY[bx]; - } - topSum += topRowSum[y + winLens]; - topSumSq += topRowSumSq[y + winLens]; - } - if (y > winLens) - { - topSum -= topRowSum[y - 1 - winLens]; - topSumSq -= topRowSumSq[y - 1 - winLens]; - } - - memset(leftColSum, 0, width * sizeof(int64_t)); - memset(leftColSumSq, 0, width * sizeof(int64_t)); - pWinY = &picY.buf[0]; - pWinY -= (y <= winLens ? y : winLens)*stride; - for (by = y1; by <= y2; by++) - { - for (bx = x1; bx <= x2; bx++) - { - leftColSum[bx] += pWinY[bx]; - leftColSumSq[bx] += pWinY[bx] * pWinY[bx]; - } - pWinY += stride; - } - - leftSum = topSum; - leftSumSq = topSumSq; - sum = topSum; - sumSq = topSumSq; - } - - else if (x > 0) - { - if (x < width - winLens) - { - pWinY -= (y <= winLens ? y : winLens)*stride; - if (y == 0) // for the 1st row, calc the right stripe - { - leftColSum[x + winLens] = 0; - leftColSumSq[x + winLens] = 0; - for (by = y1; by <= y2; by++) - { - leftColSum[x + winLens] += pWinY[x + winLens]; - leftColSumSq[x + winLens] += pWinY[x + winLens] * pWinY[x + winLens]; - pWinY += stride; - } - } - else // for the main area, calc the B-R point - { - leftColSum[x + winLens] = topColSum[x + winLens]; - leftColSumSq[x + winLens] = topColSumSq[x + winLens]; - if (y < height - winLens) - { - pWinY = &picY.buf[0]; - pWinY += winLens * stride; - leftColSum[x + winLens] += pWinY[x + winLens]; - leftColSumSq[x + winLens] += pWinY[x + winLens] * pWinY[x + winLens]; - } - if (y > winLens) - { - pWinY = &picY.buf[0]; - pWinY -= (winLens + 1) * stride; - leftColSum[x + winLens] -= pWinY[x + winLens]; - leftColSumSq[x + winLens] -= pWinY[x + winLens] * pWinY[x + winLens]; - } - } - topColSum[x + winLens] = leftColSum[x + winLens]; - topColSumSq[x + winLens] = leftColSumSq[x + winLens]; - leftSum += leftColSum[x + winLens]; - leftSumSq += leftColSumSq[x + winLens]; - } - if (x > winLens) - { - leftSum -= leftColSum[x - 1 - winLens]; - leftSumSq -= leftColSumSq[x - 1 - winLens]; - } - sum = leftSum; - sumSq = leftSumSq; - } - - double average = double(sum) / numPixInPart; - double variance = double(sumSq) / numPixInPart - average * average; - uint32_t binNum = (uint32_t)(pxlY/PIC_ANALYZE_CW_BINS); - - if (m_lumaBD > 10) - { - average = average / (double)(1<<(m_lumaBD - 10)); - variance = variance / (double)(1 << (2*m_lumaBD - 20)); - binNum = (uint32_t)((pxlY>>(m_lumaBD - 10)) / PIC_ANALYZE_CW_BINS); - } - else if (m_lumaBD < 10) - { - average = average * (double)(1 << (10 - m_lumaBD)); - variance = variance * (double)(1 << (20-2*m_lumaBD)); - binNum = (uint32_t)((pxlY << (10 - m_lumaBD)) / PIC_ANALYZE_CW_BINS); - } - double varLog10 = log10(variance + 1.0); - blockBinVarSum[binNum] += varLog10; - bockBinCnt[binNum]++; - } - picY.buf += stride; - } - - delete[] topColSum; - delete[] topColSumSq; - delete[] topRowSum; - delete[] topRowSumSq; - delete[] leftColSum; - delete[] leftColSumSq; - - for (int b = 0; b < PIC_ANALYZE_CW_BINS; b++) - { - if (bockBinCnt[b] > 0) - blockBinVarSum[b] = blockBinVarSum[b] / bockBinCnt[b]; - } - - m_reshape = true; - m_exceedSTD = false; - m_useAdpCW = false; - m_chromaWeight = 1.0; - m_sliceReshapeInfo.enableChromaAdj = 1; - m_rateAdpMode = 0; - m_tcase = 0; - bool intraAdp = false; - bool interAdp = true; - double reshapeTH1 = 0.0; - double reshapeTH2 = 5.0; - deriveReshapeParametersSDRfromStats(bockBinCnt, blockBinVarSum, &reshapeTH1, &reshapeTH2, &intraAdp, &interAdp); - - if (m_rateAdpMode == 2 && reshapeCW.rspBaseQP <= 22) - { - intraAdp = false; - interAdp = false; - } - - m_sliceReshapeInfo.sliceReshaperEnableFlag = intraAdp; - - if (!intraAdp && !interAdp) - { - m_sliceReshapeInfo.sliceReshaperModelPresentFlag = false; - m_reshape = false; - return; - } - - if (m_exceedSTD) - { - startBinIdx = 2; - endBinIdx = 29; - for (int b = 0; b < PIC_ANALYZE_CW_BINS; b++) - { - if (bockBinCnt[b] > 0 && b < startBinIdx) - startBinIdx = b; - if (bockBinCnt[b] > 0 && b > endBinIdx) - endBinIdx = b; - } - m_sliceReshapeInfo.reshaperModelMinBinIdx = startBinIdx; - m_sliceReshapeInfo.reshaperModelMaxBinIdx = endBinIdx; - } - - m_initCWAnalyze = m_lumaBD > 10 ? (m_initCWAnalyze >> (m_lumaBD - 10)) : m_lumaBD < 10 ? (m_initCWAnalyze << (10 - m_lumaBD)) : m_initCWAnalyze; - if (reshapeCW.rspBaseQP <= 22 && m_rateAdpMode == 1) - { - for (int i = 0; i < PIC_ANALYZE_CW_BINS; i++) - { - if (i >= startBinIdx && i <= endBinIdx) - m_binCW[i] = m_initCWAnalyze + 1; - else - m_binCW[i] = 0; - } - } - else if (m_useAdpCW) - { - double Alpha = 1.0, Beta = 0.0; - deriveReshapeParameters(blockBinVarSum, startBinIdx, endBinIdx, m_reshapeCW, Alpha, Beta); - for (int i = 0; i < PIC_ANALYZE_CW_BINS; i++) - { - if (i >= startBinIdx && i <= endBinIdx) - m_binCW[i] = (uint32_t)round(Alpha*blockBinVarSum[i] + Beta); - else - m_binCW[i] = 0; - } - } - else - { - for (int b = startBinIdx; b <= endBinIdx; b++) - { - if (blockBinVarSum[b] < reshapeTH1) - m_binImportance[b] = 2; - else if (blockBinVarSum[b] > reshapeTH2) - m_binImportance[b] = 3; - else - m_binImportance[b] = 1; - } - - for (int i = 0; i < PIC_ANALYZE_CW_BINS; i++) - { - if (m_binImportance[i] == 0) - m_binCW[i] = 0; - else if (m_binImportance[i] == 1) - m_binCW[i] = m_initCWAnalyze + 1; - else if (m_binImportance[i] == 2) - m_binCW[i] = m_reshapeCW.binCW[0]; - else if (m_binImportance[i] == 3) - m_binCW[i] = m_reshapeCW.binCW[1]; - else - THROW("SDR Reshape Bin Importance not supported"); - } - } - if (m_reshapeCW.rspPicSize <= 1497600 && reshapeCW.rspIntraPeriod == -1 && modIP == 0 && sliceType != I_SLICE) - { - m_sliceReshapeInfo.sliceReshaperEnableFlag = false; - } - - } - m_chromaAdj = m_sliceReshapeInfo.enableChromaAdj; -#if !JVET_O1109_UNFIY_CRS - if (sliceType == I_SLICE && isDualT) - { - m_sliceReshapeInfo.enableChromaAdj = 0; - } -#endif - } - else // Inter slices - { - m_sliceReshapeInfo.sliceReshaperModelPresentFlag = false; - m_sliceReshapeInfo.enableChromaAdj = m_chromaAdj; - - if (!m_reshape) - { - m_sliceReshapeInfo.sliceReshaperEnableFlag = false; - } - else - { - const int cTid = m_reshapeCW.rspTid; - bool enableRsp = m_tcase == 5 ? false : (m_tcase < 5 ? (cTid < m_tcase + 1 ? false : true) : (cTid <= 10 - m_tcase ? true : false)); - m_sliceReshapeInfo.sliceReshaperEnableFlag = enableRsp; - } - } -} -#endif // Bubble Sort to descending order with index void EncReshape::bubbleSortDsd(double* array, int * idx, int n) @@ -934,7 +576,6 @@ void EncReshape::bubbleSortDsd(double* array, int * idx, int n) } } -#if JVET_O0432_LMCS_ENCODER void EncReshape::cwPerturbation(int startBinIdx, int endBinIdx, uint16_t maxCW) { for (int i = 0; i < m_binNum; i++) @@ -1234,576 +875,91 @@ void EncReshape::deriveReshapeParametersSDR(bool *intraAdp, bool *interAdp) if (m_useAdpCW && !isLowCase) { m_reshapeCW.binCW[1] = 66 - m_reshapeCW.binCW[0]; } } } -#else -void EncReshape::deriveReshapeParametersSDRfromStats(uint32_t * blockBinCnt, double *blockBinVarSum, double* reshapeTH1, double* reshapeTH2, bool *intraAdp, bool *interAdp) + +void EncReshape::deriveReshapeParameters(double *array, int start, int end, ReshapeCW respCW, double &alpha, double &beta) { - int binIdxSortDsd[PIC_ANALYZE_CW_BINS] = { 0 }; - double binVarSortDsd[PIC_ANALYZE_CW_BINS] = { 0.0 }; - double binHist[PIC_ANALYZE_CW_BINS] = { 0.0 }; - double binVarSortDsdCDF[PIC_ANALYZE_CW_BINS] = { 0.0 }; - double maxBinVar = 0.0, meanBinVar = 0.0, minBinVar = 5.0; - int nonZeroBinCt = 0; - int firstBinVarLessThanVal1 = 0; - int firstBinVarLessThanVal2 = 0; - int firstBinVarLessThanVal3 = 0; - int firstBinVarLessThanVal4 = 0; + double minVar = 10.0, maxVar = 0.0; + for (int b = start; b <= end; b++) + { + if (array[b] < minVar) minVar = array[b]; + if (array[b] > maxVar) maxVar = array[b]; + } + double maxCW = (double)respCW.binCW[0]; + double minCW = (double)respCW.binCW[1]; + alpha = (minCW - maxCW) / (maxVar - minVar); + beta = (maxCW*maxVar - minCW*minVar) / (maxVar - minVar); +} - for (int b = 0; b < PIC_ANALYZE_CW_BINS; b++) +/** +-Init reshaping LUT from dQP model +*/ +void EncReshape::initLUTfromdQPModel() +{ + int pwlFwdLUTsize = PIC_CODE_CW_BINS; + int pwlFwdBinLen = m_reshapeLUTSize / PIC_CODE_CW_BINS; + double lumaDQP = 0.0; + double * slopeLUT = new double[m_reshapeLUTSize](); + double * fwdLUTHighPrec = new double[m_reshapeLUTSize](); + for (int i = 0; i < m_reshapeLUTSize; i++) { - binHist[b] = (double) blockBinCnt[b] / (double)(m_reshapeCW.rspPicSize); - if (binHist[b] > 0.001) - { - nonZeroBinCt++; - meanBinVar += blockBinVarSum[b]; - if (blockBinVarSum[b] > maxBinVar) { maxBinVar = blockBinVarSum[b]; } - if (blockBinVarSum[b] < minBinVar) { minBinVar = blockBinVarSum[b]; } - } - binVarSortDsd[b] = blockBinVarSum[b]; - binIdxSortDsd[b] = b; + int inputY = m_lumaBD < 10 ? i << (10 - m_lumaBD) : m_lumaBD > 10 ? i >> (m_lumaBD - 10) : i; + lumaDQP = 0.015*(double)inputY - 7.5; + lumaDQP = lumaDQP<-3 ? -3 : (lumaDQP>6 ? 6 : lumaDQP); + slopeLUT[i] = pow(2.0, lumaDQP / 6.0); + } + for (int i = 0; i < (16 << (m_lumaBD - 8)); i++) { slopeLUT[i] = 0.0; } + for (int i = (235 << (m_lumaBD - 8)); i < m_reshapeLUTSize; i++) { slopeLUT[i] = 0.0; } + for (int i = 0; i < m_reshapeLUTSize - 1; i++) + fwdLUTHighPrec[i + 1] = fwdLUTHighPrec[i] + slopeLUT[i]; + if (slopeLUT != nullptr) { delete[] slopeLUT; slopeLUT = nullptr; } + + double maxY = fwdLUTHighPrec[m_reshapeLUTSize - 1]; + for (int i = 0; i < m_reshapeLUTSize; i++) + { + m_fwdLUT[i] = (int16_t)((fwdLUTHighPrec[i] / maxY * (double)(m_reshapeLUTSize - 1)) + 0.5); } - if ((binHist[0] + binHist[1] + binHist[PIC_ANALYZE_CW_BINS - 2] + binHist[PIC_ANALYZE_CW_BINS - 1]) > 0.01) { m_exceedSTD = true; } - if ((binHist[PIC_ANALYZE_CW_BINS - 2] + binHist[PIC_ANALYZE_CW_BINS - 1]) > 0.01) { *interAdp = false; return; } - else { *interAdp = true; } - meanBinVar = meanBinVar / (double)nonZeroBinCt; - bubbleSortDsd(binVarSortDsd, binIdxSortDsd, PIC_ANALYZE_CW_BINS); - binVarSortDsdCDF[0] = binHist[binIdxSortDsd[0]]; + if (fwdLUTHighPrec != nullptr) { delete[] fwdLUTHighPrec; fwdLUTHighPrec = nullptr; } + m_sliceReshapeInfo.reshaperModelMinBinIdx = 1; + m_sliceReshapeInfo.reshaperModelMaxBinIdx = PIC_CODE_CW_BINS-2; - for (int b = 1; b < PIC_ANALYZE_CW_BINS; b++) + for (int i = 0; i < pwlFwdLUTsize; i++) { - binVarSortDsdCDF[b] = binVarSortDsdCDF[b - 1] + binHist[binIdxSortDsd[b]]; + int16_t X1 = i * pwlFwdBinLen; + m_reshapePivot[i] = m_fwdLUT[X1]; } + m_reshapePivot[pwlFwdLUTsize] = ((1 << m_lumaBD) - 1); - for (int b = 0; b < PIC_ANALYZE_CW_BINS - 1; b++) + for (int i = 0; i < pwlFwdLUTsize; i++) + { + m_binCW[i] = m_reshapePivot[i + 1] - m_reshapePivot[i]; + } + for (int i = 0; i <= PIC_CODE_CW_BINS; i++) { - if (binVarSortDsd[b] > 3.5) { firstBinVarLessThanVal1 = b + 1; } - if (binVarSortDsd[b] > 3.0) { firstBinVarLessThanVal2 = b + 1; } - if (binVarSortDsd[b] > 2.5) { firstBinVarLessThanVal3 = b + 1; } - if (binVarSortDsd[b] > 2.0) { firstBinVarLessThanVal4 = b + 1; } + m_inputPivot[i] = m_initCW * i; } - m_reshapeCW.binCW[0] = 38; - m_reshapeCW.binCW[1] = 28; + adjustLmcsPivot(); - if (m_reshapeCW.rspIntraPeriod == -1) + int maxAbsDeltaCW = 0, absDeltaCW = 0, deltaCW = 0; + for (int i = m_sliceReshapeInfo.reshaperModelMinBinIdx; i <= m_sliceReshapeInfo.reshaperModelMaxBinIdx; i++) { - *intraAdp = true; - if (m_reshapeCW.rspPicSize > 1497600) - { - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 2.4; - *reshapeTH2 = 4.5; - m_rateAdpMode = 2; + deltaCW = (int)m_binCW[i] - (int)m_initCW; + m_sliceReshapeInfo.reshaperModelBinCWDelta[i] = deltaCW; + absDeltaCW = (deltaCW < 0) ? (-deltaCW) : deltaCW; + if (absDeltaCW > maxAbsDeltaCW) { maxAbsDeltaCW = absDeltaCW; } + } + m_sliceReshapeInfo.maxNbitsNeededDeltaCW = std::max(1, 1 + floorLog2(maxAbsDeltaCW)); - if (meanBinVar >= 2.52) - { - if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.5) - { - *reshapeTH1 = 2.5; - *reshapeTH2 = 3.0; - } - else if (binVarSortDsdCDF[firstBinVarLessThanVal2] < 0.1 && binVarSortDsdCDF[firstBinVarLessThanVal1] > 0.02) - { - *reshapeTH1 = 2.2; - } - else if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.25) - { - m_reshapeCW.binCW[1] = 30; - *reshapeTH1 = 2.0; - m_rateAdpMode = 0; - } - else - { - m_reshapeCW.binCW[1] = 30; - m_rateAdpMode = 1; - } - } - } - else if (m_reshapeCW.rspPicSize > 660480) + for (int i = 0; i < pwlFwdLUTsize; i++) + { + m_fwdScaleCoef[i] = ((int32_t)m_binCW[i] * (1 << FP_PREC) + (1 << (floorLog2(pwlFwdBinLen) - 1))) >> floorLog2(pwlFwdBinLen); + if (m_binCW[i] == 0) { - m_reshapeCW.binCW[0] = 34; - *reshapeTH1 = 3.4; - *reshapeTH2 = 4.0; - m_rateAdpMode = 2; - - if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.6) - { - if (maxBinVar < 3.5) - { - m_useAdpCW = true; - m_reshapeCW.binCW[0] = 38; - } - else - { - m_reshapeCW.binCW[0] = 40; - *reshapeTH1 = 2.2; - *reshapeTH2 = 4.5; - m_rateAdpMode = 0; - } - } - else - { - if (maxBinVar > 3.3) - { - m_reshapeCW.binCW[1] = 30; - } - else - { - m_reshapeCW.binCW[1] = 28; - } - } + m_invScaleCoef[i] = 0; + m_chromaAdjHelpLUT[i] = 1 << CSCALE_FP_PREC; } - else if (m_reshapeCW.rspPicSize > 249600) - { - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 2.5; - *reshapeTH2 = 4.5; - - if (m_exceedSTD) - { - m_reshapeCW.binCW[0] = 36; - m_reshapeCW.binCW[1] = 30; - } - if (minBinVar > 2.6) - { - *reshapeTH1 = 3.0; - } - else { - double diff1 = binVarSortDsdCDF[firstBinVarLessThanVal4] - binVarSortDsdCDF[firstBinVarLessThanVal3]; - double diff2 = binVarSortDsdCDF[firstBinVarLessThanVal2] - binVarSortDsdCDF[firstBinVarLessThanVal1]; - if (diff1 > 0.4 || binVarSortDsdCDF[firstBinVarLessThanVal1] > 0.1) - { - m_useAdpCW = true; - m_rateAdpMode = 1; - } - else if (diff2 <= 0.1 && binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.99 && binVarSortDsdCDF[firstBinVarLessThanVal3] > 0.642 && binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.03) - { - m_useAdpCW = true; - m_rateAdpMode = 1; - } - else - { - m_rateAdpMode = 2; - } - } - } - else - { - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 2.6; - *reshapeTH2 = 4.5; - - if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.5 && maxBinVar < 4.7) - { - *reshapeTH1 = 3.2; - m_rateAdpMode = 1; - } - } - } - else if (m_reshapeCW.rspIntraPeriod == 1) - { - *intraAdp = true; - if (m_reshapeCW.rspPicSize > 5184000) - { - *reshapeTH1 = 2.0; - *reshapeTH2 = 3.0; - m_rateAdpMode = 2; - - if (maxBinVar > 2.4) - { - if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.88) - { - if (maxBinVar < 2.695) - { - *reshapeTH2 = 2.2; - } - else - { - if (binVarSortDsdCDF[firstBinVarLessThanVal3] < 0.45) - { - *reshapeTH1 = 2.5; - *reshapeTH2 = 4.0; - m_reshapeCW.binCW[0] = 36; - m_sliceReshapeInfo.enableChromaAdj = 0; - m_rateAdpMode = 0; - } - else - { - m_useAdpCW = true; - m_reshapeCW.binCW[0] = 36; - m_reshapeCW.binCW[1] = 30; - } - } - } - else - { - if (maxBinVar > 2.8) - { - *reshapeTH1 = 2.2; - *reshapeTH2 = 4.0; - m_reshapeCW.binCW[0] = 36; - m_sliceReshapeInfo.enableChromaAdj = 0; - } - else - { - m_useAdpCW = true; - m_reshapeCW.binCW[0] = 38; - m_reshapeCW.binCW[1] = 28; - } - } - } - else - { - if (maxBinVar > 2.24) - { - m_useAdpCW = true; - m_reshapeCW.binCW[0] = 34; - m_reshapeCW.binCW[1] = 30; - } - } - } - else if (m_reshapeCW.rspPicSize > 1497600) - { - *reshapeTH1 = 2.0; - *reshapeTH2 = 4.5; - m_rateAdpMode = 2; - - if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.25) - { - int firstVarCDFLargerThanVal = 1; - for (int b = 0; b < PIC_ANALYZE_CW_BINS; b++) - { - if (binVarSortDsdCDF[b] > 0.7) - { - firstVarCDFLargerThanVal = b; - break; - } - } - if (meanBinVar < 2.52 || binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.5) - { - *reshapeTH1 = 2.2; - *reshapeTH2 = (binVarSortDsd[firstVarCDFLargerThanVal] + binVarSortDsd[firstVarCDFLargerThanVal - 1]) / 2.0; - } - else - { - m_reshapeCW.binCW[1] = 30; - *reshapeTH2 = 2.8; - } - } - else if (binVarSortDsdCDF[firstBinVarLessThanVal2] < 0.1 && binVarSortDsdCDF[firstBinVarLessThanVal1] > 0.02) - { - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 3.5; - m_rateAdpMode = 1; - } - } - else if (m_reshapeCW.rspPicSize > 660480) - { - *reshapeTH1 = 2.5; - *reshapeTH2 = 4.5; - m_rateAdpMode = 1; - - if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.6) - { - if (maxBinVar < 3.5) - { - *reshapeTH1 = 2.0; - } - } - else - { - if (maxBinVar > 3.3) - { - m_reshapeCW.binCW[0] = 35; - } - else - { - *reshapeTH1 = 2.8; - m_reshapeCW.binCW[0] = 35; - } - } - } - else if (m_reshapeCW.rspPicSize > 249600) - { - m_rateAdpMode = 1; - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 2.5; - *reshapeTH2 = 4.5; - } - else - { - if (binVarSortDsdCDF[firstBinVarLessThanVal2] < 0.33 && m_reshapeCW.rspFps>40) - { - *intraAdp = false; - *interAdp = false; - } - else - { - m_rateAdpMode = 1; - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 3.0; - *reshapeTH2 = 4.0; - } - } - } - else - { - if (m_reshapeCW.rspPicSize > 5184000) - { - m_reshapeCW.binCW[0] = 40; - *reshapeTH2 = 4.0; - m_rateAdpMode = 2; - - if (maxBinVar < 2.4) - { - *reshapeTH1 = 3.0; - if (m_reshapeCW.rspBaseQP <= 22) - m_tcase = 3; - } - else if (maxBinVar > 3.0) - { - if (minBinVar > 1) - { - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 2.8; - *reshapeTH2 = 3.5; - m_sliceReshapeInfo.enableChromaAdj = 0; - m_chromaWeight = 1.05; - m_rateAdpMode = 0; - } - else - { - m_reshapeCW.binCW[0] = 36; - *reshapeTH1 = 2.2; - *reshapeTH2 = 3.5; - m_sliceReshapeInfo.enableChromaAdj = 0; - m_chromaWeight = 0.95; - } - } - else - { - *reshapeTH1 = 1.5; - } - } - else if (m_reshapeCW.rspPicSize > 1497600) - { - *reshapeTH1 = 2.5; - *reshapeTH2 = 4.5; - m_rateAdpMode = 1; - - if (meanBinVar < 2.52) - { - *intraAdp = true; - m_rateAdpMode = 0; - m_tcase = 9; - } - else - { - if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.5) - { - *reshapeTH2 = 3.0; - *intraAdp = true; - } - else if (binVarSortDsdCDF[firstBinVarLessThanVal2] < 0.1 && binVarSortDsdCDF[firstBinVarLessThanVal1] > 0.02) - { - *reshapeTH1 = 3.0; - *intraAdp = true; - m_rateAdpMode = 0; - m_tcase = 9; - } - else if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.25) - { - *reshapeTH1 = 2.4; - m_reshapeCW.binCW[0] = 36; - } - else - { - *reshapeTH1 = 2.4; - m_reshapeCW.binCW[0] = 36; - } - } - } - else if (m_reshapeCW.rspPicSize > 660480) - { - *intraAdp = true; - m_rateAdpMode = 1; - - if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.6) - { - if (maxBinVar < 3.5) - { - *reshapeTH1 = 2.1; - *reshapeTH2 = 3.5; - } - else - { - *reshapeTH1 = 2.4; - *reshapeTH2 = 4.5; - m_reshapeCW.binCW[0] = 40; - m_rateAdpMode = 0; - } - } - else - { - if (maxBinVar > 3.3) - { - *reshapeTH1 = 3.5; - *reshapeTH2 = 3.8; - } - else - { - *reshapeTH1 = 3.0; - *reshapeTH2 = 4.0; - m_reshapeCW.binCW[1] = 30; - } - } - } - else if (m_reshapeCW.rspPicSize > 249600) - { - m_reshapeCW.binCW[1] = 30; - *reshapeTH1 = 2.5; - *reshapeTH2 = 4.5; - *intraAdp = true; - m_rateAdpMode = 1; - - if (minBinVar > 2.6) - { - *reshapeTH1 = 3.2; - m_rateAdpMode = 0; - m_tcase = 9; - } - else { - double diff1 = binVarSortDsdCDF[firstBinVarLessThanVal4] - binVarSortDsdCDF[firstBinVarLessThanVal3]; - double diff2 = binVarSortDsdCDF[firstBinVarLessThanVal2] - binVarSortDsdCDF[firstBinVarLessThanVal1]; - if (diff1 > 0.4 || binVarSortDsdCDF[firstBinVarLessThanVal1] > 0.1) - { - *reshapeTH1 = 2.9; - *intraAdp = false; - } - else - { - if (diff2 > 0.1) - { - *reshapeTH1 = 2.5; - } - else - { - *reshapeTH1 = 2.9; - if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.99 && binVarSortDsdCDF[firstBinVarLessThanVal3] > 0.642 && binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.03) - { - m_rateAdpMode = 0; - m_tcase = 9; - } - } - } - } - } - else - { - m_reshapeCW.binCW[0] = 36; - m_reshapeCW.binCW[1] = 30; - *reshapeTH1 = 2.6; - *reshapeTH2 = 4.5; - *intraAdp = true; - m_rateAdpMode = 1; - if (binVarSortDsdCDF[firstBinVarLessThanVal2] > 0.5 && maxBinVar < 4.7) - { - *reshapeTH1 = 3.4; - } - } - } -} -#endif - -void EncReshape::deriveReshapeParameters(double *array, int start, int end, ReshapeCW respCW, double &alpha, double &beta) -{ - double minVar = 10.0, maxVar = 0.0; - for (int b = start; b <= end; b++) - { - if (array[b] < minVar) minVar = array[b]; - if (array[b] > maxVar) maxVar = array[b]; - } - double maxCW = (double)respCW.binCW[0]; - double minCW = (double)respCW.binCW[1]; - alpha = (minCW - maxCW) / (maxVar - minVar); - beta = (maxCW*maxVar - minCW*minVar) / (maxVar - minVar); -} - -/** --Init reshaping LUT from dQP model -*/ -void EncReshape::initLUTfromdQPModel() -{ - int pwlFwdLUTsize = PIC_CODE_CW_BINS; - int pwlFwdBinLen = m_reshapeLUTSize / PIC_CODE_CW_BINS; - double lumaDQP = 0.0; - double * slopeLUT = new double[m_reshapeLUTSize](); - double * fwdLUTHighPrec = new double[m_reshapeLUTSize](); - for (int i = 0; i < m_reshapeLUTSize; i++) - { - int inputY = m_lumaBD < 10 ? i << (10 - m_lumaBD) : m_lumaBD > 10 ? i >> (m_lumaBD - 10) : i; - lumaDQP = 0.015*(double)inputY - 7.5; - lumaDQP = lumaDQP<-3 ? -3 : (lumaDQP>6 ? 6 : lumaDQP); - slopeLUT[i] = pow(2.0, lumaDQP / 6.0); - } - for (int i = 0; i < (16 << (m_lumaBD - 8)); i++) { slopeLUT[i] = 0.0; } - for (int i = (235 << (m_lumaBD - 8)); i < m_reshapeLUTSize; i++) { slopeLUT[i] = 0.0; } - for (int i = 0; i < m_reshapeLUTSize - 1; i++) - fwdLUTHighPrec[i + 1] = fwdLUTHighPrec[i] + slopeLUT[i]; - if (slopeLUT != nullptr) { delete[] slopeLUT; slopeLUT = nullptr; } - - double maxY = fwdLUTHighPrec[m_reshapeLUTSize - 1]; - for (int i = 0; i < m_reshapeLUTSize; i++) - { - m_fwdLUT[i] = (int16_t)((fwdLUTHighPrec[i] / maxY * (double)(m_reshapeLUTSize - 1)) + 0.5); - } - - if (fwdLUTHighPrec != nullptr) { delete[] fwdLUTHighPrec; fwdLUTHighPrec = nullptr; } - m_sliceReshapeInfo.reshaperModelMinBinIdx = 1; - m_sliceReshapeInfo.reshaperModelMaxBinIdx = PIC_CODE_CW_BINS-2; - - for (int i = 0; i < pwlFwdLUTsize; i++) - { - int16_t X1 = i * pwlFwdBinLen; - m_reshapePivot[i] = m_fwdLUT[X1]; - } - m_reshapePivot[pwlFwdLUTsize] = ((1 << m_lumaBD) - 1); - - for (int i = 0; i < pwlFwdLUTsize; i++) - { - m_binCW[i] = m_reshapePivot[i + 1] - m_reshapePivot[i]; - } -#if JVET_O0428_LMCS_CLEANUP - for (int i = 0; i <= PIC_CODE_CW_BINS; i++) - { - m_inputPivot[i] = m_initCW * i; - } -#endif - -#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING - adjustLmcsPivot(); -#endif - - int maxAbsDeltaCW = 0, absDeltaCW = 0, deltaCW = 0; - for (int i = m_sliceReshapeInfo.reshaperModelMinBinIdx; i <= m_sliceReshapeInfo.reshaperModelMaxBinIdx; i++) - { - deltaCW = (int)m_binCW[i] - (int)m_initCW; - m_sliceReshapeInfo.reshaperModelBinCWDelta[i] = deltaCW; - absDeltaCW = (deltaCW < 0) ? (-deltaCW) : deltaCW; - if (absDeltaCW > maxAbsDeltaCW) { maxAbsDeltaCW = absDeltaCW; } - } - m_sliceReshapeInfo.maxNbitsNeededDeltaCW = std::max(1, 1 + floorLog2(maxAbsDeltaCW)); - -#if JVET_O0428_LMCS_CLEANUP - for (int i = 0; i < pwlFwdLUTsize; i++) - { - m_fwdScaleCoef[i] = ((int32_t)m_binCW[i] * (1 << FP_PREC) + (1 << (floorLog2(pwlFwdBinLen) - 1))) >> floorLog2(pwlFwdBinLen); - if (m_binCW[i] == 0) - { - m_invScaleCoef[i] = 0; - m_chromaAdjHelpLUT[i] = 1 << CSCALE_FP_PREC; - } - else + else { m_invScaleCoef[i] = (int32_t)(m_initCW * (1 << FP_PREC) / m_binCW[i]); m_chromaAdjHelpLUT[i] = m_invScaleCoef[i]; @@ -1819,26 +975,8 @@ void EncReshape::initLUTfromdQPModel() int invSample = m_inputPivot[idxYInv] + ((m_invScaleCoef[idxYInv] * (lumaSample - m_reshapePivot[idxYInv]) + (1 << (FP_PREC - 1))) >> FP_PREC); m_invLUT[lumaSample] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)(invSample)); } -#else - for (int i = 0; i < pwlFwdLUTsize; i++) - { - int16_t Y1 = m_reshapePivot[i]; - int16_t Y2 = m_reshapePivot[i + 1]; - m_fwdLUT[i*pwlFwdBinLen] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)Y1); - int log2PwlFwdBinLen = floorLog2(pwlFwdBinLen); - int32_t scale = ((int32_t)(Y2 - Y1) * (1 << FP_PREC) + (1 << (log2PwlFwdBinLen - 1))) >> (log2PwlFwdBinLen); - for (int j = 1; j < pwlFwdBinLen; j++) - { - int tempVal = Y1 + (((int32_t)scale * (int32_t)j + (1 << (FP_PREC - 1))) >> FP_PREC); - m_fwdLUT[i*pwlFwdBinLen + j] = Clip3((Pel)0, (Pel)((1<<m_lumaBD) -1), (Pel)tempVal); - } - } - reverseLUT(m_fwdLUT, m_invLUT, m_reshapeLUTSize); - updateChromaScaleLUT(); -#endif } -#if JVET_O0432_LMCS_ENCODER void EncReshape::constructReshaperLMCS() { int bdShift = m_lumaBD - 10; @@ -1878,9 +1016,7 @@ void EncReshape::constructReshaperLMCS() } } -#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING adjustLmcsPivot(); -#endif if (bdShift != 0) { @@ -1938,267 +1074,7 @@ void EncReshape::constructReshaperLMCS() m_cwLumaWeight[i] = m_fwdLUT[end] - m_fwdLUT[start]; } } -#else -void EncReshape::constructReshaperSDR() -{ - int bdShift = m_lumaBD - 10; - int usedCW = 0; - int totCW = bdShift != 0 ? (bdShift > 0 ? m_reshapeLUTSize / (1<<bdShift) : m_reshapeLUTSize * (1 << (-bdShift))) : m_reshapeLUTSize; - int histBins = PIC_ANALYZE_CW_BINS; - int histLenth = totCW/histBins; - int log2HistLenth = floorLog2(histLenth); -#if !JVET_O0428_LMCS_CLEANUP - int16_t *tempFwdLUT = new int16_t[m_reshapeLUTSize + 1](); - int i, j; -#else - int i; -#endif - int cwScaleBins1, cwScaleBins2; - int maxAllowedCW = totCW-1; - - cwScaleBins1 = m_reshapeCW.binCW[0]; - cwScaleBins2 = m_reshapeCW.binCW[1]; - - for (i = 0; i < histBins; i++) - usedCW += m_binCW[i]; - - if (usedCW > maxAllowedCW) - { - int cnt0 = 0, cnt1 = 0, cnt2 = 0; - for (i = 0; i < histBins; i++) - { - if (m_binCW[i] == histLenth + 1) cnt0++; - else if (m_binCW[i] == cwScaleBins1) cnt1++; - else if (m_binCW[i] == cwScaleBins2) cnt2++; - } - - int resCW = usedCW - maxAllowedCW; - int cwReduce1 = (cwScaleBins1 - histLenth - 1) * cnt1; - int cwReduce2 = (histLenth + 1 - cwScaleBins2) * cnt0; - int divCW = 0, modCW = 0; - if (resCW <= cwReduce1) - { - assert(cnt1 > 0); - divCW = resCW / cnt1; - modCW = resCW - divCW * cnt1; - if (divCW > 0) - { - for (i = 0; i < histBins; i++) - { - if (m_binCW[i] == cwScaleBins1) - m_binCW[i] -= divCW; - } - } - for (i = 0; i < histBins; i++) - { - if (modCW == 0) break; - if (m_binCW[i] >(histLenth + 1)) - { - m_binCW[i]--; - modCW--; - } - } - } - else if (resCW > cwReduce1 && resCW <= (cwReduce1 + cwReduce2)) - { - assert(cnt0 > 0); - resCW -= cwReduce1; - divCW = resCW / cnt0; - modCW = resCW - divCW * cnt0; - if (divCW > 0) - { - for (i = 0; i < histBins; i++) - { - if (m_binCW[i] == (histLenth + 1)) - m_binCW[i] -= divCW; - } - } - for (i = 0; i < histBins; i++) - { - if (modCW == 0) break; - if (m_binCW[i] > cwScaleBins2 && m_binCW[i] < cwScaleBins1) - { - m_binCW[i]--; - modCW--; - } - } - for (i = 0; i < histBins; i++) - { - if (m_binCW[i] == cwScaleBins1) - m_binCW[i] = histLenth + 1; - } - } - else - { - for (i = 0; i < histBins; i++) - { - if (m_binCW[i] == histLenth + 1) - m_binCW[i] = cwScaleBins2; - if (m_binCW[i] == cwScaleBins1) - m_binCW[i] = histLenth + 1; - } - resCW -= (cwReduce1 + cwReduce2); - cnt2 += cnt0; - cnt0 += cnt1; - cnt1 = 0; - - divCW = resCW / cnt0; - modCW = resCW - divCW * cnt0; - if (divCW > 0) - { - for (i = 0; i < histBins; i++) - { - if (m_binCW[i] == (histLenth + 1)) - m_binCW[i] -= divCW; - } - } - for (i = 0; i < histBins; i++) - { - if (modCW == 0) break; - if (m_binCW[i] > cwScaleBins2) - { - m_binCW[i]--; - modCW--; - } - } - for (i = 0; i < histBins; i++) - { - if (modCW == 0) break; - if (m_binCW[i] > 0) - { - m_binCW[i]--; - modCW--; - } - } - } - } - - if (bdShift != 0) - { - for (int i = 0; i < PIC_ANALYZE_CW_BINS; i++) - { - m_binCW[i] = bdShift > 0 ? m_binCW[i] * (1 << bdShift) : m_binCW[i] / (1 << (-bdShift)); - } - } -#if JVET_O0428_LMCS_CLEANUP - for (int i = 0; i <= PIC_CODE_CW_BINS; i++) - { - m_inputPivot[i] = m_initCW * i; - } -#endif - - for (int i = 0; i < PIC_CODE_CW_BINS; i++) - { - m_binCW[i] = m_binCW[2 * i] + m_binCW[2 * i + 1]; - } - - m_sliceReshapeInfo.reshaperModelMinBinIdx = 0; - m_sliceReshapeInfo.reshaperModelMaxBinIdx = PIC_CODE_CW_BINS - 1; - for (int i = 0; i < PIC_CODE_CW_BINS; i++) - { - if (m_binCW[i] > 0) - { - m_sliceReshapeInfo.reshaperModelMinBinIdx = i; - break; - } - } - for (int i = PIC_CODE_CW_BINS - 1; i >= 0; i--) - { - if (m_binCW[i] > 0) - { - m_sliceReshapeInfo.reshaperModelMaxBinIdx = i; - break; - } - } - -#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING - adjustLmcsPivot(); -#endif - - int maxAbsDeltaCW = 0, absDeltaCW = 0, deltaCW = 0; - for (int i = m_sliceReshapeInfo.reshaperModelMinBinIdx; i <= m_sliceReshapeInfo.reshaperModelMaxBinIdx; i++) - { - deltaCW = (int)m_binCW[i] - (int)m_initCW; - m_sliceReshapeInfo.reshaperModelBinCWDelta[i] = deltaCW; - absDeltaCW = (deltaCW < 0) ? (-deltaCW) : deltaCW; - if (absDeltaCW > maxAbsDeltaCW) { maxAbsDeltaCW = absDeltaCW; } - } - m_sliceReshapeInfo.maxNbitsNeededDeltaCW = std::max(1, 1 + floorLog2(maxAbsDeltaCW)); - - histLenth = m_initCW; - log2HistLenth = floorLog2(histLenth); - - int sumBins = 0; - for (i = 0; i < PIC_CODE_CW_BINS; i++) { sumBins += m_binCW[i]; } - CHECK(sumBins >= m_reshapeLUTSize, "SDR CW assignment is wrong!!"); -#if JVET_O0428_LMCS_CLEANUP - for (int i = 0; i < PIC_CODE_CW_BINS; i++) - { - m_reshapePivot[i + 1] = m_reshapePivot[i] + m_binCW[i]; - m_fwdScaleCoef[i] = ((int32_t)m_binCW[i] * (1 << FP_PREC) + (1 << (log2HistLenth - 1))) >> log2HistLenth; - if (m_binCW[i] == 0) - { - m_invScaleCoef[i] = 0; - m_chromaAdjHelpLUT[i] = 1 << CSCALE_FP_PREC; - } - else - { - m_invScaleCoef[i] = (int32_t)(m_initCW * (1 << FP_PREC) / m_binCW[i]); - m_chromaAdjHelpLUT[i] = m_invScaleCoef[i]; - } - } - for (int lumaSample = 0; lumaSample < m_reshapeLUTSize; lumaSample++) - { - int idxY = lumaSample / m_initCW; - int tempVal = m_reshapePivot[idxY] + ((m_fwdScaleCoef[idxY] * (lumaSample - m_inputPivot[idxY]) + (1 << (FP_PREC - 1))) >> FP_PREC); - m_fwdLUT[lumaSample] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)(tempVal)); - - int idxYInv = getPWLIdxInv(lumaSample); - int invSample = m_inputPivot[idxYInv] + ((m_invScaleCoef[idxYInv] * (lumaSample - m_reshapePivot[idxYInv]) + (1 << (FP_PREC - 1))) >> FP_PREC); - m_invLUT[lumaSample] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)(invSample)); - } - for (i = 0; i < PIC_CODE_CW_BINS; i++) - { - int start = i*histLenth; - int end = (i + 1)*histLenth - 1; - m_cwLumaWeight[i] = m_fwdLUT[end] - m_fwdLUT[start]; - } -#else - memset(tempFwdLUT, 0, (m_reshapeLUTSize + 1) * sizeof(int16_t)); - tempFwdLUT[0] = 0; - - for (i = 0; i < PIC_CODE_CW_BINS; i++) - { - tempFwdLUT[(i + 1)*histLenth] = tempFwdLUT[i*histLenth] + m_binCW[i]; - int16_t Y1 = tempFwdLUT[i*histLenth]; - int16_t Y2 = tempFwdLUT[(i + 1)*histLenth]; - m_reshapePivot[i + 1] = Y2; - int32_t scale = ((int32_t)(Y2 - Y1) * (1 << FP_PREC) + (1 << (log2HistLenth - 1))) >> (log2HistLenth); - m_fwdLUT[i*histLenth] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)Y1); - for (j = 1; j < histLenth; j++) - { - tempFwdLUT[i*histLenth + j] = Y1 + (((int32_t)scale * (int32_t)j + (1 << (FP_PREC - 1))) >> FP_PREC); - m_fwdLUT[i*histLenth + j] = Clip3((Pel)0, (Pel)((1 << m_lumaBD) - 1), (Pel)tempFwdLUT[i*histLenth + j]); - } - } - - for (i = 0; i < PIC_CODE_CW_BINS; i++) - { - int start = i*histLenth; - int end = (i + 1)*histLenth - 1; - m_cwLumaWeight[i] = m_fwdLUT[end] - m_fwdLUT[start]; - } - - if (tempFwdLUT != nullptr) { delete[] tempFwdLUT; tempFwdLUT = nullptr; } - - reverseLUT(m_fwdLUT, m_invLUT, m_reshapeLUTSize); - updateChromaScaleLUT(); -#endif -} -#endif - -#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING void EncReshape::adjustLmcsPivot() { int bdShift = m_lumaBD - 10; @@ -2265,7 +1141,6 @@ void EncReshape::adjustLmcsPivot() } } } -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM void EncReshape::copyState(const EncReshape &other) @@ -2299,11 +1174,9 @@ void EncReshape::copyState(const EncReshape &other) m_initCW = other.m_initCW; m_reshape = other.m_reshape; m_reshapePivot = other.m_reshapePivot; -#if JVET_O0428_LMCS_CLEANUP m_inputPivot = other.m_inputPivot; m_fwdScaleCoef = other.m_fwdScaleCoef; m_invScaleCoef = other.m_invScaleCoef; -#endif m_lumaBD = other.m_lumaBD; m_reshapeLUTSize = other.m_reshapeLUTSize; } diff --git a/source/Lib/EncoderLib/EncReshape.h b/source/Lib/EncoderLib/EncReshape.h index df1df223e322b72fe5835f2a689d31240152d47e..6116f914ca0c586d8854107e42541829a04bc01f 100644 --- a/source/Lib/EncoderLib/EncReshape.h +++ b/source/Lib/EncoderLib/EncReshape.h @@ -49,7 +49,6 @@ // ==================================================================================================================== // Class definition // ==================================================================================================================== -#if JVET_O0432_LMCS_ENCODER struct SeqInfo { double binVar[PIC_ANALYZE_CW_BINS]; @@ -64,7 +63,6 @@ struct SeqInfo double ratioStdU; double ratioStdV; }; -#endif class EncReshape : public Reshape { @@ -87,11 +85,9 @@ private: Pel m_cwLumaWeight[PIC_CODE_CW_BINS]; double m_chromaWeight; int m_chromaAdj; -#if JVET_O0432_LMCS_ENCODER int m_binNum; SeqInfo m_srcSeqStats; SeqInfo m_rspSeqStats; -#endif public: EncReshape(); @@ -102,37 +98,23 @@ public: bool getSrcReshaped() { return m_srcReshaped; } void setSrcReshaped(bool b) { m_srcReshaped = b; } -#if JVET_O0432_LMCS_ENCODER void initSeqStats(SeqInfo &stats); void calcSeqStats(Picture *pcPic, SeqInfo &stats); void preAnalyzerLMCS(Picture *pcPic, const uint32_t signalType, const SliceType sliceType, const ReshapeCW& reshapeCW); -#else - void preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT); -#endif void preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT); void bubbleSortDsd(double *array, int * idx, int n); void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void swap(double *xp, double *yp) { double temp = *xp; *xp = *yp; *yp = temp; } -#if JVET_O0432_LMCS_ENCODER void cwPerturbation(int startBinIdx, int endBinIdx, uint16_t maxCW); void cwReduction(int startBinIdx, int endBinIdx); void deriveReshapeParametersSDR(bool *intraAdp, bool *interAdp); -#else - void deriveReshapeParametersSDRfromStats(uint32_t *, double*, double* reshapeTH1, double* reshapeTH2, bool *intraAdp, bool *interAdp); -#endif void deriveReshapeParameters(double *array, int start, int end, ReshapeCW respCW, double &alpha, double &beta); void initLUTfromdQPModel(); -#if JVET_O0432_LMCS_ENCODER void constructReshaperLMCS(); -#else - void constructReshaperSDR(); -#endif ReshapeCW * getReshapeCW() { return &m_reshapeCW; } Pel * getWeightTable() { return m_cwLumaWeight; } double getCWeight() { return m_chromaWeight; } -#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING void adjustLmcsPivot(); -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM void copyState(const EncReshape& other); diff --git a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp index f5c15cbc3f6e951b282b45523f566c613a058ae9..0574e3c5028c9adfccced9de221001239012c2be 100644 --- a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp +++ b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp @@ -80,9 +80,7 @@ EncSampleAdaptiveOffset::EncSampleAdaptiveOffset() { m_CABACEstimator = NULL; -#if JVET_O1164_PS ::memset( m_saoDisabledRate, 0, sizeof( m_saoDisabledRate ) ); -#endif } EncSampleAdaptiveOffset::~EncSampleAdaptiveOffset() @@ -117,9 +115,6 @@ void EncSampleAdaptiveOffset::createEncData(bool isPreDBFSamplesUsed, uint32_t n } -#if !JVET_O1164_PS - ::memset(m_saoDisabledRate, 0, sizeof(m_saoDisabledRate)); -#endif for(int typeIdc=0; typeIdc < NUM_SAO_NEW_TYPES; typeIdc++) { @@ -251,11 +246,7 @@ void EncSampleAdaptiveOffset::SAOProcess( CodingStructure& cs, bool* sliceEnable DTRACE ( g_trace_ctx, D_CRC, "SAO" ); DTRACE_CRC( g_trace_ctx, D_CRC, cs, cs.getRecoBuf() ); -#if !JVET_O0525_REMOVE_PCM - xPCMLFDisableProcess(cs); -#else xLosslessDisableProcess(cs); -#endif } diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index e4f82e6d2bb24b78d77607a9e408164eb114150c..b3a604e5c576c6023a3244a7f0bb8e95b74ccab7 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -117,11 +117,7 @@ EncSlice::setUpLambda( Slice* slice, const double dLambda, int iQP) { const ComponentID compID = ComponentID( compIdx ); int chromaQPOffset = slice->getPPS()->getQpOffset( compID ) + slice->getSliceChromaQpDelta( compID ); -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE int qpc = slice->getSPS()->getMappedChromaQpValue(compID, iQP) + chromaQPOffset; -#else - int qpc = ( iQP + chromaQPOffset < 0 ) ? iQP : getScaledChromaQP( iQP + chromaQPOffset, m_pcCfg->getChromaFormatIdc() ); -#endif double tmpWeight = pow( 2.0, ( iQP - qpc ) / 3.0 ); // takes into account of the chroma qp mapping and chroma qp Offset if( m_pcCfg->getDepQuantEnabledFlag() && !( m_pcCfg->getLFNST() ) ) { @@ -300,11 +296,7 @@ static int applyQPAdaptationChroma (Picture* const pcPic, Slice* const pcSlice, savedLumaQP = averageAdaptedLumaQP; } // savedLumaQP < 0 -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE const int lumaChromaMappingDQP = savedLumaQP - pcSlice->getSPS()->getMappedChromaQpValue(compID, savedLumaQP); -#else - const int lumaChromaMappingDQP = savedLumaQP - getScaledChromaQP (savedLumaQP, pcEncCfg->getChromaFormatIdc()); -#endif optSliceChromaQpOffset[comp-1] = std::min (3 + lumaChromaMappingDQP, adaptChromaQPOffset + lumaChromaMappingDQP); } @@ -337,9 +329,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr { double dQP; double dLambda; -#if JVET_O0119_BASE_PALETTE_444 pcPic->cs->resetPrevPLT(pcPic->cs->prevPLT); -#endif rpcSlice = pcPic->slices[0]; rpcSlice->setSliceBits(0); @@ -645,9 +635,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() ); rpcSlice->setMaxNumAffineMergeCand( m_pcCfg->getMaxNumAffineMergeCand() ); rpcSlice->setMaxNumTriangleCand ( m_pcCfg->getMaxNumTriangleCand() ); -#if JVET_O0455_IBC_MAX_MERGE_NUM rpcSlice->setMaxNumIBCMergeCand ( m_pcCfg->getMaxNumIBCMergeCand() ); -#endif rpcSlice->setSplitConsOverrideFlag(false); rpcSlice->setMinQTSize( rpcSlice->getSPS()->getMinQTSize(eSliceType)); rpcSlice->setMaxMTTHierarchyDepth( rpcSlice->isIntra() ? rpcSlice->getSPS()->getMaxMTTHierarchyDepthI() : rpcSlice->getSPS()->getMaxMTTHierarchyDepth() ); @@ -662,13 +650,11 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr } rpcSlice->setDisableSATDForRD(false); -#if JVET_O1164_PS if( ( m_pcCfg->getIBCHashSearch() && m_pcCfg->getIBCMode() ) || m_pcCfg->getAllowDisFracMMVD() ) { m_pcCuEncoder->getIbcHashMap().destroy(); m_pcCuEncoder->getIbcHashMap().init( pcPic->cs->pps->getPicWidthInLumaSamples(), pcPic->cs->pps->getPicHeightInLumaSamples() ); } -#endif } double EncSlice::initializeLambda(const Slice* slice, const int GOPid, const int refQP, const double dQP) @@ -1000,11 +986,7 @@ static int applyQPAdaptationSubCtu (CodingStructure &cs, const UnitArea ctuArea, #if SHARP_LUMA_DELTA_QP const int lumaCtuDQP = useSharpLumaDQP ? lumaDQPOffset ((uint32_t)pcPic->m_uEnerHpCtu[ctuAddr], bitDepth) : 0; #endif -#if MAX_TB_SIZE_SIGNALLING const unsigned mts = std::min (cs.sps->getMaxTbSize(), pcv.maxCUWidth); -#else - const unsigned mts = std::min<uint32_t> (MAX_TB_SIZEY, pcv.maxCUWidth); -#endif const unsigned mtsLog2 = (unsigned)floorLog2(mts); const unsigned stride = pcv.maxCUWidth >> mtsLog2; unsigned numAct = 0; // number of block activities @@ -1321,7 +1303,6 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c } #endif // ENABLE_QPA -#if JVET_O0119_BASE_PALETTE_444 bool checkPLTRatio = m_pcCfg->getIntraPeriod() != 1 && pcSlice->isIRAP(); if (checkPLTRatio) { @@ -1332,7 +1313,6 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c bool doPlt = m_pcLib->getPltEnc(); m_pcCuEncoder->getModeCtrl()->setPltEnc(doPlt); } -#endif #if ENABLE_WPP_PARALLELISM bool bUseThreads = m_pcCfg->getNumWppThreads() > 1; @@ -1364,13 +1344,9 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c writeBlockStatisticsHeader(sps); #endif m_pcInterSearch->resetAffineMVList(); -#if JVET_O0592_ENC_ME_IMP m_pcInterSearch->resetUniMvList(); -#endif encodeCtus( pcPic, bCompressEntireSlice, bFastDeltaQP, startCtuTsAddr, boundingCtuTsAddr, m_pcLib ); -#if JVET_O0119_BASE_PALETTE_444 if (checkPLTRatio) m_pcLib->checkPltStats( pcPic ); -#endif } void EncSlice::checkDisFracMmvd( Picture* pcPic, uint32_t startCtuTsAddr, uint32_t boundingCtuTsAddr ) @@ -1413,7 +1389,6 @@ void EncSlice::checkDisFracMmvd( Picture* pcPic, uint32_t startCtuTsAddr, uint32 } -#if JVET_O0105_ICT void setJointCbCrModes( CodingStructure& cs, const Position topLeftLuma, const Size sizeLuma ) { bool sgnFlag = true; @@ -1450,7 +1425,6 @@ void setJointCbCrModes( CodingStructure& cs, const Position topLeftLuma, const S cs.slice->setJointCbCrSignFlag( sgnFlag ); } -#endif void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, const bool bFastDeltaQP, uint32_t startCtuTsAddr, uint32_t boundingCtuTsAddr, EncLib* pEncLib ) @@ -1503,16 +1477,10 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons } checkDisFracMmvd( pcPic, startCtuTsAddr, boundingCtuTsAddr ); -#if JVET_O0105_ICT -#if JVET_O0376_SPS_JOINTCBCR_FLAG if (pcSlice->getSPS()->getJointCbCrEnabledFlag()) { setJointCbCrModes(cs, Position(0, 0), cs.area.lumaSize()); } -#else - setJointCbCrModes(cs, Position(0, 0), cs.area.lumaSize()); -#endif -#endif // for every CTU in the slice segment (may terminate sooner if there is a byte limit on the slice-segment) uint32_t startSliceRsRow = tileMap.getCtuBsToRsAddrMap(startCtuTsAddr) / widthInCtus; @@ -1542,9 +1510,6 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons { cs.motionLut.lut.resize(0); cs.motionLut.lutIbc.resize(0); -#if !JVET_O0078_SINGLE_HMVPLUT - cs.motionLut.lutShareIbc.resize(0); -#endif } #if ENABLE_WPP_PARALLELISM @@ -1554,18 +1519,14 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons if (ctuRsAddr == firstCtuRsAddrOfTile) { pCABACWriter->initCtxModels( *pcSlice ); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif prevQP[0] = prevQP[1] = pcSlice->getSliceQp(); } else if (ctuXPosInCtus == tileXPosInCtus && pEncLib->getEntropyCodingSyncEnabledFlag()) { // reset and then update contexts to the state at the end of the top CTU (if within current slice and tile). pCABACWriter->initCtxModels( *pcSlice ); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif if( cs.getCURestricted( pos.offset(0, -1), pos, pcSlice->getIndependentSliceIdx(), tileMap.getBrickIdxRsMap( pos ), CH_L ) ) { // Top is available, we use it. @@ -1850,9 +1811,7 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui if (ctuTsAddr != startCtuTsAddr) // if it is the first CTU, then the entropy coder has already been reset { m_CABACWriter->initCtxModels( *pcSlice ); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif } } else if (ctuXPosInCtus == tileXPosInCtus && wavefrontsEnabled) @@ -1861,9 +1820,7 @@ void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, ui if (ctuTsAddr != startCtuTsAddr) // if it is the first CTU, then the entropy coder has already been reset { m_CABACWriter->initCtxModels( *pcSlice ); -#if JVET_O0119_BASE_PALETTE_444 cs.resetPrevPLT(cs.prevPLT); -#endif } if( cs.getCURestricted( pos.offset( 0, -1 ), pos, pcSlice->getIndependentSliceIdx(), tileMap.getBrickIdxRsMap( pos ), CH_L ) ) { @@ -1928,9 +1885,7 @@ void EncSlice::calculateBoundingCtuTsAddrForSlice(uint32_t &startCtuTSAddrSlice, const uint32_t numberOfCtusInFrame = pcPic->cs->pcv->sizeInCtus; boundingCtuTSAddrSlice=0; haveReachedTileBoundary=false; -#if SUPPORT_FOR_RECT_SLICES_WITH_VARYING_NUMBER_OF_TILES int numSlicesInPic = pps.getNumSlicesInPicMinus1() + 1; -#endif switch (sliceMode) { @@ -1987,7 +1942,6 @@ void EncSlice::calculateBoundingCtuTsAddrForSlice(uint32_t &startCtuTSAddrSlice, } break; default: -#if SUPPORT_FOR_RECT_SLICES_WITH_VARYING_NUMBER_OF_TILES if(numSlicesInPic > 1) { const uint32_t startBrickIdx = tileMap.getBrickIdxBsMap(startCtuTSAddrSlice); @@ -2017,7 +1971,6 @@ void EncSlice::calculateBoundingCtuTsAddrForSlice(uint32_t &startCtuTSAddrSlice, boundingCtuTSAddrSlice++; break; } -#endif boundingCtuTSAddrSlice = numberOfCtusInFrame; break; } diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index e28a72ea11a513392c641a82bc3468cf602cf0b2..24514c030af1609b5d33b2b96a9ab6d344a8655c 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -112,11 +112,9 @@ InterSearch::InterSearch() m_affMVList = nullptr; m_affMVListSize = 0; m_affMVListIdx = 0; -#if JVET_O0592_ENC_ME_IMP m_uniMvList = nullptr; m_uniMvListSize = 0; m_uniMvListIdx = 0; -#endif m_histBestSbt = MAX_UCHAR; m_histBestMtsIdx = MAX_UCHAR; } @@ -161,7 +159,6 @@ void InterSearch::destroy() } m_affMVListIdx = 0; m_affMVListSize = 0; -#if JVET_O0592_ENC_ME_IMP if (m_uniMvList) { delete[] m_uniMvList; @@ -169,7 +166,6 @@ void InterSearch::destroy() } m_uniMvListIdx = 0; m_uniMvListSize = 0; -#endif m_isInitialized = false; } @@ -252,11 +248,7 @@ void InterSearch::init( EncCfg* pcEncCfg, } const ChromaFormat cform = pcEncCfg->getChromaFormatIdc(); -#if JVET_O1170_IBC_VIRTUAL_BUFFER InterPrediction::init( pcRdCost, cform, maxCUHeight ); -#else - InterPrediction::init( pcRdCost, cform ); -#endif for( uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++ ) { @@ -273,7 +265,6 @@ void InterSearch::init( EncCfg* pcEncCfg, m_affMVList = new AffineMVInfo[m_affMVListMaxSize]; m_affMVListIdx = 0; m_affMVListSize = 0; -#if JVET_O0592_ENC_ME_IMP m_uniMvListMaxSize = 15; if (!m_uniMvList) { @@ -281,7 +272,6 @@ void InterSearch::init( EncCfg* pcEncCfg, } m_uniMvListIdx = 0; m_uniMvListSize = 0; -#endif m_isInitialized = true; } @@ -830,13 +820,8 @@ int InterSearch::xIBCSearchMVChromaRefine(PredictionUnit& pu, int refStride, orgStride; int width, height; -#if JVET_O1164_PS int picWidth = pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); int picHeight = pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); -#else - int picWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); - int picHeight = pu.cs->slice->getSPS()->getPicHeightInLumaSamples(); -#endif UnitArea allCompBlocks(pu.chromaFormat, (Area)pu.block(COMPONENT_Y)); for (int cand = 0; cand < CHROMA_REFINEMENT_CANDIDATES; cand++) @@ -976,13 +961,8 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS m_cDistParam.useMR = false; m_pcRdCost->setDistParam(m_cDistParam, *cStruct.pcPatternKey, cStruct.piRefY, cStruct.iRefStride, m_lumaClpRng.bd, COMPONENT_Y, cStruct.subShiftMode); -#if JVET_O1164_PS const int picWidth = pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); const int picHeight = pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); -#else - const int picWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); - const int picHeight = pu.cs->slice->getSPS()->getPicHeightInLumaSamples(); -#endif { @@ -1008,11 +988,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS && !((yPred < srTop) || (yPred > srBottom)) && !((xPred < srLeft) || (xPred > srRight))) { -#if JVET_O1170_IBC_VIRTUAL_BUFFER bool validCand = searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, xPred, yPred, lcuWidth); -#else - bool validCand = PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, xPred, yPred, lcuWidth); -#endif if (validCand) { @@ -1033,11 +1009,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS const int boundY = (0 - roiHeight - puPelOffsetY); for (int y = std::max(srchRngVerTop, 0 - cuPelY); y <= boundY; ++y) { -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, y, lcuWidth)) -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, 0, y, lcuWidth)) -#endif { continue; } @@ -1062,11 +1034,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS const int boundX = std::max(srchRngHorLeft, -cuPelX); for (int x = 0 - roiWidth - puPelOffsetX; x >= boundX; --x) { -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, x, 0, lcuWidth)) -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, x, 0, lcuWidth)) -#endif { continue; } @@ -1117,11 +1085,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if ((x == 0) || ((int)(cuPelX + x + roiWidth) >= picWidth)) continue; -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, x, y, lcuWidth)) -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, x, y, lcuWidth)) -#endif { continue; } @@ -1161,11 +1125,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if ((x == 0) || ((int)(cuPelX + x + roiWidth) >= picWidth)) continue; -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, x, y, lcuWidth)) -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, x, y, lcuWidth)) -#endif { continue; } @@ -1222,11 +1182,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if ((x == 0) || ((int)(cuPelX + x + roiWidth) >= picWidth)) continue; -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, x, y, lcuWidth)) -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, x, y, lcuWidth)) -#endif { continue; } @@ -1290,13 +1246,8 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Distortion &ruiCost, const int localSearchRangeX, const int localSearchRangeY ) { -#if JVET_O1164_PS const int iPicWidth = pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); const int iPicHeight = pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); -#else - const int iPicWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); - const int iPicHeight = pu.cs->slice->getSPS()->getPicHeightInLumaSamples(); -#endif const unsigned int lcuWidth = pu.cs->slice->getSPS()->getMaxCUWidth(); const int cuPelX = pu.Y().x; const int cuPelY = pu.Y().y; @@ -1328,9 +1279,7 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, cStruct.pcPatternKey = pcPatternKey; cStruct.iRefStride = refBuf.stride; cStruct.piRefY = refBuf.buf; -#if JVET_O0057_ALTHPELIF CHECK(pu.cu->imv == IMV_HPEL, "IF_IBC"); -#endif cStruct.imvShift = pu.cu->imv << 1; cStruct.subShiftMode = 0; // used by intra pattern search function @@ -1354,11 +1303,7 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, int xBv = bv.hor; int yBv = bv.ver; -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (searchBv(pu, cuPelX, cuPelY, iRoiWidth, iRoiHeight, iPicWidth, iPicHeight, xBv, yBv, lcuWidth)) -#else - if (PU::isBlockVectorValid(pu, cuPelX, cuPelY, iRoiWidth, iRoiHeight, iPicWidth, iPicHeight, 0, 0, xBv, yBv, lcuWidth)) -#endif { buffered = true; Distortion sad = m_pcRdCost->getBvCostMultiplePreds(xBv, yBv, pu.cs->sps->getAMVREnabledFlag()); @@ -1393,11 +1338,7 @@ void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, int xPred = cMvPredEncOnly[cand].getHor(); int yPred = cMvPredEncOnly[cand].getVer(); -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (searchBv(pu, cuPelX, cuPelY, iRoiWidth, iRoiHeight, iPicWidth, iPicHeight, xPred, yPred, lcuWidth)) -#else - if (PU::isBlockVectorValid(pu, cuPelX, cuPelY, iRoiWidth, iRoiHeight, iPicWidth, iPicHeight, 0, 0, xPred, yPred, lcuWidth)) -#endif { Distortion sad = m_pcRdCost->getBvCostMultiplePreds(xPred, yPred, pu.cs->sps->getAMVREnabledFlag()); m_cDistParam.cur.buf = cStruct.piRefY + cStruct.iRefStride * yPred + xPred; @@ -1467,16 +1408,12 @@ void InterSearch::xSetIntraSearchRange(PredictionUnit& pu, int iRoiWidth, int iR xClipMv(rcMvSrchRngLT, pu.cu->lumaPos(), pu.cu->lumaSize(), sps -#if JVET_O1164_PS , *pu.cs->pps -#endif ); xClipMv(rcMvSrchRngRB, pu.cu->lumaPos(), pu.cu->lumaSize(), sps -#if JVET_O1164_PS , *pu.cs->pps -#endif ); rcMvSrchRngLT >>= 2; rcMvSrchRngRB >>= 2; @@ -1516,17 +1453,11 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const cMv.setZero(); Distortion cost = 0; -#if JVET_O0162_IBC_MVP_FLAG -#if JVET_O0455_IBC_MAX_MERGE_NUM if ( pu.cu->slice->getMaxNumIBCMergeCand() == 1 ) -#else - if ( pu.cu->slice->getMaxNumMergeCand() == 1 ) -#endif { iBvpNum = 1; cMvPred[1] = cMvPred[0]; } -#endif if (m_pcEncCfg->getIBCHashSearch()) { @@ -1633,13 +1564,8 @@ void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, const unsigned int lcuWidth = pu.cs->slice->getSPS()->getMaxCUWidth(); const int cuPelX = pu.Y().x; const int cuPelY = pu.Y().y; -#if JVET_O1164_PS const int picWidth = pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); const int picHeight = pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); -#else - const int picWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); - const int picHeight = pu.cs->slice->getSPS()->getPicHeightInLumaSamples(); -#endif int roiWidth = pu.lwidth(); int roiHeight = pu.lheight(); @@ -1652,11 +1578,7 @@ void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, Mv candMv; candMv.set(tmp.x, tmp.y); -#if JVET_O1170_IBC_VIRTUAL_BUFFER if (!searchBv(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, candMv.getHor(), candMv.getVer(), lcuWidth)) -#else - if (!PU::isBlockVectorValid(pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, 0, 0, candMv.getHor(), candMv.getVer(), lcuWidth)) -#endif { continue; } @@ -1853,13 +1775,8 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR int yPos = pu.cu->lumaPos().y; const int currStride = pu.cs->picture->getOrigBuf().get(COMPONENT_Y).stride; const Pel* curPel = pu.cs->picture->getOrigBuf().get(COMPONENT_Y).buf + yPos * currStride + xPos; -#if JVET_O1164_PS int picWidth = pu.cu->slice->getPPS()->getPicWidthInLumaSamples(); int picHeight = pu.cu->slice->getPPS()->getPicHeightInLumaSamples(); -#else - int picWidth = pu.cu->slice->getSPS()->getPicWidthInLumaSamples(); - int picHeight = pu.cu->slice->getSPS()->getPicHeightInLumaSamples(); -#endif int xBase = xPos; int yBase = yPos; @@ -1922,7 +1839,6 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR } m_numHashMVStoreds[eRefPicList][refIdx] = 0; -#if JVET_O1164_RPR const std::pair<int, int>& scaleRatio = pu.cu->slice->getScalingRatio( eRefPicList, refIdx ); if( scaleRatio != SCALE_1X ) { @@ -1930,7 +1846,6 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR } CHECK( pu.cu->slice->getRefPic( eRefPicList, refIdx )->getHashMap() == nullptr, "Hash table is not initialized" ); -#endif if (refList == 0 || pu.cu->slice->getList1IdxToList0Idx(refIdx) < 0) { @@ -2122,7 +2037,6 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi } m_numHashMVStoreds[eRefPicList][refIdx] = 0; -#if JVET_O1164_RPR const std::pair<int, int>& scaleRatio = pu.cu->slice->getScalingRatio( eRefPicList, refIdx ); if( scaleRatio != SCALE_1X ) { @@ -2130,7 +2044,6 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi } CHECK( pu.cu->slice->getRefPic( eRefPicList, refIdx )->getHashMap() == nullptr, "Hash table is not initialized" ); -#endif if (refList == 0 || pu.cu->slice->getList1IdxToList0Idx(refIdx) < 0) { @@ -2374,15 +2287,9 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) WPScalingParam *wp0; WPScalingParam *wp1; int tryBipred = 0; -#if JVET_O0057_ALTHPELIF bool checkAffine = (pu.cu->imv == 0 || pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag()) && pu.cu->imv != IMV_HPEL; bool checkNonAffine = pu.cu->imv == 0 || pu.cu->imv == IMV_HPEL || (pu.cu->slice->getSPS()->getAMVREnabledFlag() && pu.cu->imv <= (pu.cu->slice->getSPS()->getAMVREnabledFlag() ? IMV_4PEL : 0)); -#else - bool checkAffine = pu.cu->imv == 0 || pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag(); - bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getAMVREnabledFlag() && - pu.cu->imv <= (pu.cu->slice->getSPS()->getAMVREnabledFlag() ? IMV_4PEL : 0)); -#endif CodingUnit *bestCU = pu.cu->cs->bestCS != nullptr ? pu.cu->cs->bestCS->getCU( CHANNEL_TYPE_LUMA ) : nullptr; bool trySmvd = ( bestCU != nullptr && pu.cu->imv == 2 && checkAffine ) ? ( !bestCU->firstPU->mergeFlag && !bestCU->affine ) : true; if ( pu.cu->imv && bestCU != nullptr && checkAffine ) @@ -2396,13 +2303,11 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } { -#if JVET_O0070_PROF if (pu.cu->cs->bestParent != nullptr && pu.cu->cs->bestParent->getCU(CHANNEL_TYPE_LUMA) != nullptr && pu.cu->cs->bestParent->getCU(CHANNEL_TYPE_LUMA)->affine == false) { m_skipPROF = true; } m_encOnly = true; -#endif // motion estimation only evaluates luma component m_maxCompIDToPred = MAX_NUM_COMPONENT; // m_maxCompIDToPred = COMPONENT_Y; @@ -2444,11 +2349,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) m_pcRdCost->selectMotionLambda( cu.transQuantBypass ); -#if JVET_O0057_ALTHPELIF unsigned imvShift = pu.cu->imv == IMV_HPEL ? 1 : (pu.cu->imv << 1); -#else - unsigned imvShift = pu.cu->imv << 1; -#endif if ( checkNonAffine ) { // Uni-directional prediction @@ -2539,7 +2440,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } } -#if JVET_O0592_ENC_ME_IMP ::memcpy(cMvHevcTemp, cMvTemp, sizeof(cMvTemp)); if (cu.imv == 0 && (!cu.slice->getSPS()->getUseGBi() || gbiIdx == GBI_DEFAULT)) { @@ -2550,15 +2450,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) ::memcpy(&(g_reusedUniMVs[idx1][idx2][idx3][idx4][0][0]), cMvTemp, 2 * 33 * sizeof(Mv)); g_isReusedUniMVsFilled[idx1][idx2][idx3][idx4] = true; } -#else - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getUseAffine() - && checkAffine - && (gbiIdx == GBI_DEFAULT || m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) - ) - { - ::memcpy( cMvHevcTemp, cMvTemp, sizeof( cMvTemp ) ); - } -#endif // Bi-predictive Motion estimation if( ( cs.slice->isInterB() ) && ( PU::isBipredRestriction( pu ) == false ) && (cu.slice->getCheckLDC() || gbiIdx == GBI_DEFAULT || !m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) @@ -2801,7 +2692,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) costStart += m_pcRdCost->getCost(bits); std::vector<Mv> symmvdCands; -#if JVET_O0592_ENC_ME_IMP auto smmvdCandsGen = [&](Mv mvCand, bool mvPrecAdj) { if (mvPrecAdj && pu.cu->imv) @@ -2836,13 +2726,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) BlkUniMvInfo* curMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - i + m_uniMvListMaxSize) % (m_uniMvListMaxSize)); smmvdCandsGen(curMvInfo->uniMvs[curRefList][refIdxCur], true); } -#else - symmvdCands.push_back(cMvTemp[curRefList][refIdxCur]); - if (iRefIdxBi[curRefList] == refIdxCur && cMvBi[curRefList] != cMvTemp[curRefList][refIdxCur]) - { - symmvdCands.push_back(cMvBi[curRefList]); - } -#endif for (auto mvStart : symmvdCands) { @@ -2852,13 +2735,9 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) checked |= (mvStart == aacAMVPInfo[curRefList][refIdxCur].mvCand[i]); } if (checked) -#if JVET_O0592_ENC_ME_IMP { continue; } -#else - break; -#endif Distortion bestCost = costStart; symmvdCheckBestMvp(pu, origBuf, mvStart, (RefPicList)curRefList, aacAMVPInfo, gbiIdx, cMvPredSym, mvpIdxSym, costStart); @@ -3154,10 +3033,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) PU::spanMotionInfo( pu, mergeCtx ); } -#if JVET_O0070_PROF m_skipPROF = false; m_encOnly = false; -#endif // MC PelUnitBuf predBuf = pu.cs->getPredBuf(pu); if ( gbiIdx == GBI_DEFAULT || !m_affineMotion.affine4ParaAvail || !m_affineMotion.affine6ParaAvail ) @@ -3282,11 +3159,7 @@ void InterSearch::xCopyAMVPInfo (AMVPInfo* pSrc, AMVPInfo* pDst) void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, int& riMVPIdx, AMVPInfo& amvpInfo, uint32_t& ruiBits, Distortion& ruiCost, const uint8_t imv ) { -#if JVET_O0057_ALTHPELIF if ( imv > 0 && imv < 3 ) -#else - if( imv > 0 ) -#endif { return; } @@ -3358,11 +3231,7 @@ Distortion InterSearch::xGetTemplateCost( const PredictionUnit& pu, Distortion uiCost = std::numeric_limits<Distortion>::max(); const Picture* picRef = pu.cu->slice->getRefPic( eRefPicList, iRefIdx ); -#if JVET_O1164_PS clipMv( cMvCand, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( cMvCand, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif // prediction pattern const bool bi = pu.cu->slice->testWeightPred() && pu.cu->slice->getSliceType()==P_SLICE; @@ -3395,9 +3264,7 @@ Distortion InterSearch::xGetAffineTemplateCost( PredictionUnit& pu, PelUnitBuf& const bool bi = pu.cu->slice->testWeightPred() && pu.cu->slice->getSliceType()==P_SLICE; Mv mv[3]; memcpy(mv, acMvCand, sizeof(mv)); -#if JVET_O0070_PROF m_iRefListIdx = eRefPicList; -#endif xPredAffineBlk(COMPONENT_Y, pu, picRef, mv, predBuf, bi, pu.cu->slice->clpRng(COMPONENT_Y)); if( bi ) { @@ -3458,12 +3325,8 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref cStruct.pcPatternKey = pcPatternKey; cStruct.iRefStride = buf.stride; cStruct.piRefY = buf.buf; -#if JVET_O0057_ALTHPELIF cStruct.imvShift = pu.cu->imv == IMV_HPEL ? 1 : (pu.cu->imv << 1); cStruct.useAltHpelIf = pu.cu->imv == IMV_HPEL; -#else - cStruct.imvShift = pu.cu->imv << 1; -#endif cStruct.inCtuSearch = false; cStruct.zeroMV = false; { @@ -3503,17 +3366,12 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref // Do integer search if( ( m_motionEstimationSearchMethod == MESEARCH_FULL ) || bBi || bQTBTMV ) { -#if JVET_O0592_ENC_ME_IMP cStruct.subShiftMode = m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE3 ? 2 : 0; m_pcRdCost->setDistParam(m_cDistParam, *cStruct.pcPatternKey, cStruct.piRefY, cStruct.iRefStride, m_lumaClpRng.bd, COMPONENT_Y, cStruct.subShiftMode); Mv bestInitMv = (bBi ? rcMv : rcMvPred); Mv cTmpMv = bestInitMv; -#if JVET_O1164_PS clipMv( cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif cTmpMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); m_cDistParam.cur.buf = cStruct.piRefY + (cTmpMv.ver * cStruct.iRefStride) + cTmpMv.hor; Distortion uiBestSad = m_cDistParam.distFunc(m_cDistParam); @@ -3536,11 +3394,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref continue; cTmpMv = curMvInfo->uniMvs[eRefPicList][iRefIdxPred]; -#if JVET_O1164_PS clipMv( cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif cTmpMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); m_cDistParam.cur.buf = cStruct.piRefY + (cTmpMv.ver * cStruct.iRefStride) + cTmpMv.hor; @@ -3553,21 +3407,13 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref m_cDistParam.maximumDistortionForEarlyExit = uiSad; } } -#endif if( !bQTBTMV ) { -#if JVET_O0592_ENC_ME_IMP xSetSearchRange(pu, bestInitMv, iSrchRng, cStruct.searchRange -#else - xSetSearchRange(pu, (bBi ? rcMv : rcMvPred), iSrchRng, cStruct.searchRange -#endif , cStruct ); } -#if !JVET_O0592_ENC_ME_IMP - cStruct.subShiftMode = m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE3 ? 2 : 0; -#endif xPatternSearch( cStruct, rcMv, ruiCost); } else if( bQTBTMV2 ) @@ -3576,11 +3422,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref cStruct.subShiftMode = ( !m_pcEncCfg->getRestrictMESampling() && m_pcEncCfg->getMotionEstimationSearchMethod() == MESEARCH_SELECTIVE ) ? 1 : ( m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE3 ) ? 2 : 0; -#if JVET_O0592_ENC_ME_IMP xTZSearch(pu, eRefPicList, iRefIdxPred, cStruct, rcMv, ruiCost, NULL, false, true); -#else - xTZSearch( pu, cStruct, rcMv, ruiCost, NULL, false, true ); -#endif } else { @@ -3588,11 +3430,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref ( m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE3 ) ? 2 : 0; rcMv = rcMvPred; const Mv *pIntegerMv2Nx2NPred = 0; -#if JVET_O0592_ENC_ME_IMP xPatternSearchFast(pu, eRefPicList, iRefIdxPred, cStruct, rcMv, ruiCost, pIntegerMv2Nx2NPred); -#else - xPatternSearchFast( pu, cStruct, rcMv, ruiCost, pIntegerMv2Nx2NPred ); -#endif if( blkCache ) { blkCache->setMv( pu.cs->area, eRefPicList, iRefIdxPred, rcMv ); @@ -3605,11 +3443,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref DTRACE( g_trace_ctx, D_ME, "%d %d %d :MECostFPel<L%d,%d>: %d,%d,%dx%d, %d", DTRACE_GET_COUNTER( g_trace_ctx, D_ME ), pu.cu->slice->getPOC(), 0, ( int ) eRefPicList, ( int ) bBi, pu.Y().x, pu.Y().y, pu.Y().width, pu.Y().height, ruiCost ); // sub-pel refinement for sub-pel resolution -#if JVET_O0057_ALTHPELIF if ( pu.cu->imv == 0 || pu.cu->imv == IMV_HPEL ) -#else - if( pu.cu->imv == 0 ) -#endif { if( m_pcEncCfg->getMCTSEncConstraint() ) { @@ -3653,11 +3487,7 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu, { const int iMvShift = MV_FRACTIONAL_BITS_INTERNAL; Mv cFPMvPred = cMvPred; -#if JVET_O1164_PS clipMv( cFPMvPred, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( cFPMvPred, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif Mv mvTL(cFPMvPred.getHor() - (iSrchRng << iMvShift), cFPMvPred.getVer() - (iSrchRng << iMvShift)); Mv mvBR(cFPMvPred.getHor() + (iSrchRng << iMvShift), cFPMvPred.getVer() + (iSrchRng << iMvShift)); @@ -3672,16 +3502,12 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu, xClipMv( mvTL, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps -#if JVET_O1164_PS , *pu.cs->pps -#endif ); xClipMv( mvBR, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps -#if JVET_O1164_PS , *pu.cs->pps -#endif ); } @@ -3768,10 +3594,8 @@ void InterSearch::xPatternSearch( IntTZSearchStruct& cStruct, void InterSearch::xPatternSearchFast( const PredictionUnit& pu, -#if JVET_O0592_ENC_ME_IMP RefPicList eRefPicList, int iRefIdxPred, -#endif IntTZSearchStruct& cStruct, Mv& rcMv, Distortion& ruiSAD, @@ -3780,27 +3604,15 @@ void InterSearch::xPatternSearchFast( const PredictionUnit& pu, switch ( m_motionEstimationSearchMethod ) { case MESEARCH_DIAMOND: -#if JVET_O0592_ENC_ME_IMP xTZSearch ( pu, eRefPicList, iRefIdxPred, cStruct, rcMv, ruiSAD, pIntegerMv2Nx2NPred, false ); -#else - xTZSearch ( pu, cStruct, rcMv, ruiSAD, pIntegerMv2Nx2NPred, false ); -#endif break; case MESEARCH_SELECTIVE: -#if JVET_O0592_ENC_ME_IMP xTZSearchSelective( pu, eRefPicList, iRefIdxPred, cStruct, rcMv, ruiSAD, pIntegerMv2Nx2NPred ); -#else - xTZSearchSelective( pu, cStruct, rcMv, ruiSAD, pIntegerMv2Nx2NPred ); -#endif break; case MESEARCH_DIAMOND_ENHANCED: -#if JVET_O0592_ENC_ME_IMP xTZSearch ( pu, eRefPicList, iRefIdxPred, cStruct, rcMv, ruiSAD, pIntegerMv2Nx2NPred, true ); -#else - xTZSearch ( pu, cStruct, rcMv, ruiSAD, pIntegerMv2Nx2NPred, true ); -#endif break; case MESEARCH_FULL: // shouldn't get here. @@ -3811,10 +3623,8 @@ void InterSearch::xPatternSearchFast( const PredictionUnit& pu, void InterSearch::xTZSearch( const PredictionUnit& pu, -#if JVET_O0592_ENC_ME_IMP RefPicList eRefPicList, int iRefIdxPred, -#endif IntTZSearchStruct& cStruct, Mv& rcMv, Distortion& ruiSAD, @@ -3852,11 +3662,7 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, } else { -#if JVET_O1164_PS clipMv( rcMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( rcMv, pu.cu->lumaPos(), pu.cu->lumaSize(),*pu.cs->sps ); -#endif } rcMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); rcMv.divideByPowerOf2(2); @@ -3897,11 +3703,7 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, } else { -#if JVET_O1164_PS clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif } integerMv2Nx2NPred.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); integerMv2Nx2NPred.divideByPowerOf2(2); @@ -3914,7 +3716,6 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, } } -#if JVET_O0592_ENC_ME_IMP for (int i = 0; i < m_uniMvListSize; i++) { BlkUniMvInfo* curMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - i + m_uniMvListMaxSize) % (m_uniMvListMaxSize)); @@ -3932,11 +3733,7 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, continue; Mv cTmpMv = curMvInfo->uniMvs[eRefPicList][iRefIdxPred]; -#if JVET_O1164_PS clipMv( cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif cTmpMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); m_cDistParam.cur.buf = cStruct.piRefY + (cTmpMv.ver * cStruct.iRefStride) + cTmpMv.hor; @@ -3950,7 +3747,6 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, m_cDistParam.maximumDistortionForEarlyExit = uiSad; } } -#endif { // set search range @@ -4168,10 +3964,8 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, void InterSearch::xTZSearchSelective( const PredictionUnit& pu, -#if JVET_O0592_ENC_ME_IMP RefPicList eRefPicList, int iRefIdxPred, -#endif IntTZSearchStruct& cStruct, Mv &rcMv, Distortion &ruiSAD, @@ -4192,11 +3986,7 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, int iStartX = 0; int iStartY = 0; int iDist = 0; -#if JVET_O1164_PS clipMv( rcMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( rcMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif rcMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); rcMv.divideByPowerOf2(2); @@ -4224,11 +4014,7 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, { Mv integerMv2Nx2NPred = *pIntegerMv2Nx2NPred; integerMv2Nx2NPred.changePrecision(MV_PRECISION_INT, MV_PRECISION_INTERNAL); -#if JVET_O1164_PS clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( integerMv2Nx2NPred, pu.cu->lumaPos(), pu.cu->lumaSize(),*pu.cs->sps ); -#endif integerMv2Nx2NPred.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); integerMv2Nx2NPred.divideByPowerOf2(2); @@ -4236,7 +4022,6 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, } -#if JVET_O0592_ENC_ME_IMP for (int i = 0; i < m_uniMvListSize; i++) { BlkUniMvInfo* curMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - i + m_uniMvListMaxSize) % (m_uniMvListMaxSize)); @@ -4254,11 +4039,7 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, continue; Mv cTmpMv = curMvInfo->uniMvs[eRefPicList][iRefIdxPred]; -#if JVET_O1164_PS clipMv( cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(cTmpMv, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif cTmpMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); m_cDistParam.cur.buf = cStruct.piRefY + (cTmpMv.ver * cStruct.iRefStride) + cTmpMv.hor; @@ -4272,7 +4053,6 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, m_cDistParam.maximumDistortionForEarlyExit = uiSad; } } -#endif { // set search range @@ -4380,11 +4160,7 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& cStruct, Mv& rcMv, Mv& rcMvPred, int& riMVPIdx, uint32_t& ruiBits, Distortion& ruiCost, const AMVPInfo& amvpInfo, double fWeight) { -#if JVET_O0057_ALTHPELIF CHECK( pu.cu->imv == 0 || pu.cu->imv == IMV_HPEL , "xPatternSearchIntRefine(): Sub-pel MV used."); -#else - CHECK( pu.cu->imv == 0, "xPatternSearchIntRefine(): IMV not used."); -#endif CHECK( amvpInfo.mvCand[riMVPIdx] != rcMvPred, "xPatternSearchIntRefine(): MvPred issue."); const SPS &sps = *pu.cs->sps; @@ -4442,11 +4218,7 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& Mv cTempMV = cTestMv[iMVPIdx]; if( !m_pcEncCfg->getMCTSEncConstraint() ) { -#if JVET_O1164_PS clipMv( cTempMV, pu.cu->lumaPos(), pu.cu->lumaSize(), sps, *pu.cs->pps ); -#else - clipMv(cTempMV, pu.cu->lumaPos(), pu.cu->lumaSize(), sps); -#endif } m_cDistParam.cur.buf = cStruct.piRefY + cStruct.iRefStride * (cTempMV.getVer() >> MV_FRACTIONAL_BITS_INTERNAL) + (cTempMV.getHor() >> MV_FRACTIONAL_BITS_INTERNAL); uiDist = uiSATD = (Distortion) (m_cDistParam.distFunc( m_cDistParam ) * fWeight); @@ -4518,22 +4290,14 @@ void InterSearch::xPatternSearchFracDIF( Mv baseRefMv(0, 0); rcMvHalf.setZero(); m_pcRdCost->setCostScale(0); -#if JVET_O0057_ALTHPELIF xExtDIFUpSamplingH(&cPatternRoi, cStruct.useAltHpelIf); -#else - xExtDIFUpSamplingH(&cPatternRoi); -#endif rcMvQter = rcMvInt; rcMvQter <<= 2; // for mv-cost ruiCost = xPatternRefinement(cStruct.pcPatternKey, baseRefMv, 1, rcMvQter, !bIsLosslessCoded && !pu.cs->slice->getDisableSATDForRD()); return; } -#if JVET_O0057_ALTHPELIF if (cStruct.imvShift > IMV_FPEL || (m_useCompositeRef && cStruct.zeroMV)) -#else - if (cStruct.imvShift || (m_useCompositeRef && cStruct.zeroMV)) -#endif { m_pcRdCost->setDistParam(m_cDistParam, *cStruct.pcPatternKey, cStruct.piRefY + iOffset, cStruct.iRefStride, m_lumaClpRng.bd, COMPONENT_Y, 0, 1, m_pcEncCfg->getUseHADME() && !bIsLosslessCoded && !pu.cs->slice->getDisableSATDForRD()); ruiCost = m_cDistParam.distFunc( m_cDistParam ); @@ -4543,21 +4307,15 @@ void InterSearch::xPatternSearchFracDIF( // Half-pel refinement m_pcRdCost->setCostScale(1); -#if JVET_O0057_ALTHPELIF xExtDIFUpSamplingH(&cPatternRoi, cStruct.useAltHpelIf); -#else - xExtDIFUpSamplingH ( &cPatternRoi ); -#endif rcMvHalf = rcMvInt; rcMvHalf <<= 1; // for mv-cost Mv baseRefMv(0, 0); ruiCost = xPatternRefinement(cStruct.pcPatternKey, baseRefMv, 2, rcMvHalf, (!bIsLosslessCoded && !pu.cs->slice->getDisableSATDForRD())); // quarter-pel refinement -#if JVET_O0057_ALTHPELIF if (cStruct.imvShift == IMV_OFF) { -#endif m_pcRdCost->setCostScale( 0 ); xExtDIFUpSamplingQ ( &cPatternRoi, rcMvHalf ); baseRefMv = rcMvHalf; @@ -4566,9 +4324,7 @@ void InterSearch::xPatternSearchFracDIF( rcMvQter = rcMvInt; rcMvQter <<= 1; // for mv-cost rcMvQter += rcMvHalf; rcMvQter <<= 1; ruiCost = xPatternRefinement(cStruct.pcPatternKey, baseRefMv, 1, rcMvQter, (!bIsLosslessCoded && !pu.cs->slice->getDisableSATDForRD())); -#if JVET_O0057_ALTHPELIF } -#endif } Distortion InterSearch::xGetSymmetricCost( PredictionUnit& pu, PelUnitBuf& origBuf, RefPicList eCurRefPicList, const MvField& cCurMvField, MvField& cTarMvField, int gbiIdx ) @@ -4580,22 +4336,14 @@ Distortion InterSearch::xGetSymmetricCost( PredictionUnit& pu, PelUnitBuf& origB PelUnitBuf predBufA = m_tmpPredStorage[eCurRefPicList].getBuf( UnitAreaRelative( *pu.cu, pu ) ); const Picture* picRefA = pu.cu->slice->getRefPic( eCurRefPicList, cCurMvField.refIdx ); Mv mvA = cCurMvField.mv; -#if JVET_O1164_PS clipMv( mvA, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( mvA, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif xPredInterBlk( COMPONENT_Y, pu, picRefA, mvA, predBufA, true, pu.cu->slice->clpRng( COMPONENT_Y ), false, false ); // get prediction of eTarRefPicList PelUnitBuf predBufB = m_tmpPredStorage[eTarRefPicList].getBuf( UnitAreaRelative( *pu.cu, pu ) ); const Picture* picRefB = pu.cu->slice->getRefPic( eTarRefPicList, cTarMvField.refIdx ); Mv mvB = cTarMvField.mv; -#if JVET_O1164_PS clipMv( mvB, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( mvB, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif xPredInterBlk( COMPONENT_Y, pu, picRefB, mvB, predBufB, true, pu.cu->slice->clpRng( COMPONENT_Y ), false, false ); PelUnitBuf bufTmp = m_tmpStorageLCU.getBuf( UnitAreaRelative( *pu.cu, pu ) ); @@ -4731,11 +4479,7 @@ void InterSearch::xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& or int nDiamondRound = 8; int nCrossRound = 1; -#if JVET_O0057_ALTHPELIF nSearchStepShift += pu.cu->imv == IMV_HPEL ? 1 : (pu.cu->imv << 1); -#else - nSearchStepShift += (pu.cu->imv << 1); -#endif nDiamondRound >>= pu.cu->imv; ruiCost = xSymmeticRefineMvSearch( pu, origBuf, rcMvCurPred, rcMvTarPred, eRefPicList, rCurMvField, rTarMvField, ruiCost, 2, nSearchStepShift, nDiamondRound, gbiIdx ); @@ -4936,22 +4680,14 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, roundAffineMv(vx, vy, shift); mvTmp[0] = Mv(vx, vy); mvTmp[0].clipToStorageBitDepth(); -#if JVET_O1164_PS clipMv( mvTmp[0], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(mvTmp[0], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif mvTmp[0].roundAffinePrecInternal2Amvr(pu.cu->imv); vx = mvScaleHor + dMvHorX * (pu.Y().x + pu.Y().width - mvInfo->x) + dMvVerX * (pu.Y().y - mvInfo->y); vy = mvScaleVer + dMvHorY * (pu.Y().x + pu.Y().width - mvInfo->x) + dMvVerY * (pu.Y().y - mvInfo->y); roundAffineMv(vx, vy, shift); mvTmp[1] = Mv(vx, vy); mvTmp[1].clipToStorageBitDepth(); -#if JVET_O1164_PS clipMv( mvTmp[1], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(mvTmp[1], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif mvTmp[0].roundAffinePrecInternal2Amvr(pu.cu->imv); mvTmp[1].roundAffinePrecInternal2Amvr(pu.cu->imv); Distortion tmpCost = xGetAffineTemplateCost(pu, origBuf, predBuf, mvTmp, aaiMvpIdx[iRefList][iRefIdxTemp], AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdxTemp); @@ -5127,9 +4863,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { tryBipred = 1; pu.interDir = 3; -#if JVET_O0070_PROF m_isBi = true; -#endif // Set as best list0 and list1 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; @@ -5330,9 +5064,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } } // for loop-iter } -#if JVET_O0070_PROF m_isBi = false; -#endif } // if (B_SLICE) pu.mv [REF_PIC_LIST_0] = Mv(); @@ -5606,9 +5338,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, PelUnitBuf origBufTmp = m_tmpStorageLCU.getBuf( UnitAreaRelative( *pu.cu, pu ) ); enum DFunc distFunc = (pu.cu->transQuantBypass || pu.cs->slice->getDisableSATDForRD()) ? DF_SAD : DF_HAD; -#if JVET_O0070_PROF m_iRefListIdx = eRefPicList; -#endif // if Bi, set to ( 2 * Org - ListX ) if ( bBi ) @@ -5659,21 +5389,12 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, } else { -#if JVET_O1164_PS clipMv( acMvTemp[0], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); clipMv( acMvTemp[1], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); if( pu.cu->affineType == AFFINEMODEL_6PARAM ) { clipMv( acMvTemp[2], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); } -#else - clipMv( acMvTemp[0], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); - clipMv( acMvTemp[1], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); - if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) - { - clipMv( acMvTemp[2], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); - } -#endif } acMvTemp[0].roundAffinePrecInternal2Amvr(pu.cu->imv); acMvTemp[1].roundAffinePrecInternal2Amvr(pu.cu->imv); @@ -5841,11 +5562,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, } else { -#if JVET_O1164_PS clipMv( acMvTemp[i], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(acMvTemp[i], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif } } @@ -5924,58 +5641,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, const uint32_t mvShift = mvShiftTable[pu.cu->imv]; if (uiCostBest <= AFFINE_ME_LIST_MVP_TH*m_hevcCost) { -#if !JVET_O0592_ENC_ME_IMP - //search 8 nearest neighbors; integer distance - int testPos[8][2] = { { -1, 0 },{ 0, -1 },{ 0, 1 },{ 1, 0 },{ -1, -1 },{ -1, 1 },{ 1, 1 },{ 1, -1 } }; - const int maxSearchRound = 3; - - if ( m_pcEncCfg->getUseAffineAmvrEncOpt() && m_pcEncCfg->getIntraPeriod() != ( uint32_t ) -1 && pu.cu->imv ) - { - for ( int rnd = 0; rnd < ( pu.cu->slice->getTLayer() <= 2 ? maxSearchRound : maxSearchRound - 1 ); rnd++ ) - { - bool modelChange = false; - //search the model parameters with finear granularity; - for ( int j = 0; j < mvNum; j++ ) - { - for ( int iter = 0; iter < 2; iter++ ) - { - Mv centerMv[3]; - memcpy( centerMv, acMv, sizeof( Mv ) * 3 ); - memcpy( acMvTemp, acMv, sizeof( Mv ) * 3 ); - for ( int i = ( iter ? 0: 4 ); i < ( iter ? 4 : 8 ); i++ ) - { - acMvTemp[j].set( centerMv[j].getHor() + ( testPos[i][0] << mvShift ), centerMv[j].getVer() + ( testPos[i][1] << mvShift ) ); - -#if JVET_O1164_PS - clipMv( acMvTemp[j], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv( acMvTemp[j], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps ); -#endif - xPredAffineBlk( COMPONENT_Y, pu, refPic, acMvTemp, predBuf, false, pu.cu->slice->clpRng( COMPONENT_Y ) ); - - Distortion costTemp = m_pcRdCost->getDistPart(predBuf.Y(), pBuf->Y(), pu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y, distFunc); - uint32_t bitsTemp = ruiBits; - bitsTemp += xCalcAffineMVBits( pu, acMvTemp, acMvPred ); - costTemp = ( Distortion ) ( floor( fWeight * ( double ) costTemp ) + ( double ) m_pcRdCost->getCost( bitsTemp ) ); - - if ( costTemp < uiCostBest ) - { - uiCostBest = costTemp; - uiBitsBest = bitsTemp; - ::memcpy( acMv, acMvTemp, sizeof( Mv ) * 3 ); - modelChange = true; - } - } - } - } - - if ( !modelChange ) - { - break; - } - } - } -#endif Mv mvPredTmp[3] = { acMvPred[0], acMvPred[1], acMvPred[2] }; Mv mvME[3]; @@ -6020,7 +5685,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, checkCPMVRdCost(acMvTemp); } -#if JVET_O0592_ENC_ME_IMP // 8 nearest neighbor search int testPos[8][2] = { { -1, 0 },{ 0, -1 },{ 0, 1 },{ 1, 0 },{ -1, -1 },{ -1, 1 },{ 1, 1 },{ 1, -1 } }; const int maxSearchRound = (pu.cu->imv) ? 3 : ((m_pcEncCfg->getUseAffineAmvrEncOpt() && m_pcEncCfg->getIntraPeriod() == (uint32_t)-1) ? 2 : 3); @@ -6045,11 +5709,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, for (int i = ((iter == 0) ? 0 : 4); i < ((iter == 0) ? 4 : 8); i++) { acMvTemp[j].set(centerMv[j].getHor() + (testPos[i][0] << mvShift), centerMv[j].getVer() + (testPos[i][1] << mvShift)); -#if JVET_O1164_PS clipMv( acMvTemp[j], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(acMvTemp[j], pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif xPredAffineBlk(COMPONENT_Y, pu, refPic, acMvTemp, predBuf, false, pu.cu->slice->clpRng(COMPONENT_Y)); Distortion costTemp = m_pcRdCost->getDistPart(predBuf.Y(), pBuf->Y(), pu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y, distFunc); @@ -6074,24 +5734,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, break; } } -#else - { - const int threshold = 4 << (MV_PRECISION_INTERNAL - MV_PRECISION_SIXTEENTH); - dMv = acMv[1] - acMv[0]; - if (pu.cu->affineType == AFFINEMODEL_4PARAM && (dMv.getAbsHor() > threshold || dMv.getAbsVer() > threshold)) - { - int testPos[4][2] = { { -1, 0 },{ 0, -1 },{ 0, 1 },{ 1, 0 } }; - Mv centerMv[3]; - ::memcpy(centerMv, acMv, sizeof(Mv) * 3); - acMvTemp[0] = centerMv[0]; - for (int i = 0; i < 4; i++) - { - acMvTemp[1].set( centerMv[1].getHor() + ( testPos[i][0] << mvShift ), centerMv[1].getVer() + ( testPos[i][1] << mvShift ) ); - checkCPMVRdCost(acMvTemp); - } - } - } -#endif } acMvPred[0] = aamvpi.mvCandLT[mvpIdx]; acMvPred[1] = aamvpi.mvCandRT[mvpIdx]; @@ -6165,11 +5807,7 @@ void InterSearch::xCopyAffineAMVPInfo (AffineAMVPInfo& src, AffineAMVPInfo& dst) * \param pattern Reference picture ROI * \param biPred Flag indicating whether block is for biprediction */ -#if JVET_O0057_ALTHPELIF void InterSearch::xExtDIFUpSamplingH(CPelBuf* pattern, bool useAltHpelIf) -#else -void InterSearch::xExtDIFUpSamplingH( CPelBuf* pattern ) -#endif { const ClpRng& clpRng = m_lumaClpRng; int width = pattern->width; @@ -6186,27 +5824,15 @@ void InterSearch::xExtDIFUpSamplingH( CPelBuf* pattern ) const ChromaFormat chFmt = m_currChromaFormat; -#if JVET_O0057_ALTHPELIF m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[0][0], intStride, width + 1, height + filterSize, 0 << MV_FRACTIONAL_BITS_DIFF, false, chFmt, clpRng, 0, false, useAltHpelIf); -#else - m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[0][0], intStride, width + 1, height + filterSize, 0 << MV_FRACTIONAL_BITS_DIFF, false, chFmt, clpRng); -#endif if (!m_skipFracME) { -#if JVET_O0057_ALTHPELIF m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[2][0], intStride, width + 1, height + filterSize, 2 << MV_FRACTIONAL_BITS_DIFF, false, chFmt, clpRng, 0, false, useAltHpelIf); -#else - m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[2][0], intStride, width + 1, height + filterSize, 2 << MV_FRACTIONAL_BITS_DIFF, false, chFmt, clpRng); -#endif } intPtr = m_filteredBlockTmp[0][0] + halfFilterSize * intStride + 1; dstPtr = m_filteredBlock[0][0][0]; -#if JVET_O0057_ALTHPELIF m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng, 0, false, useAltHpelIf); -#else - m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng); -#endif if (m_skipFracME) { return; @@ -6214,27 +5840,15 @@ void InterSearch::xExtDIFUpSamplingH( CPelBuf* pattern ) intPtr = m_filteredBlockTmp[0][0] + (halfFilterSize - 1) * intStride + 1; dstPtr = m_filteredBlock[2][0][0]; -#if JVET_O0057_ALTHPELIF m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 1, 2 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng, 0, false, useAltHpelIf); -#else - m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 1, 2 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng); -#endif intPtr = m_filteredBlockTmp[2][0] + halfFilterSize * intStride; dstPtr = m_filteredBlock[0][2][0]; -#if JVET_O0057_ALTHPELIF m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 1, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng, 0, false, useAltHpelIf); -#else - m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 1, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng); -#endif intPtr = m_filteredBlockTmp[2][0] + (halfFilterSize - 1) * intStride; dstPtr = m_filteredBlock[2][2][0]; -#if JVET_O0057_ALTHPELIF m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 1, height + 1, 2 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng, 0, false, useAltHpelIf); -#else - m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 1, height + 1, 2 << MV_FRACTIONAL_BITS_DIFF, false, true, chFmt, clpRng); -#endif } @@ -6456,11 +6070,7 @@ void InterSearch::setWpScalingDistParam( int iRefIdx, RefPicList eRefPicListCur, void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &partitioner, const ComponentID &compID) { const UnitArea& currArea = partitioner.currArea(); -#if JVET_O0545_MAX_TB_SIGNALLING const TransformUnit &currTU = *cs.getTU(isLuma(partitioner.chType) ? currArea.lumaPos() : currArea.chromaPos(), partitioner.chType); -#else - const TransformUnit &currTU = *cs.getTU(currArea.lumaPos(), partitioner.chType); -#endif const CodingUnit &cu = *currTU.cu; const unsigned currDepth = partitioner.currTrDepth; @@ -6484,50 +6094,25 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti CHECK(CU::isIntra(cu), "Inter search provided with intra CU"); if( cu.chromaFormat != CHROMA_400 -#if JVET_O0545_MAX_TB_SIGNALLING -#if JVET_O0050_LOCAL_DUAL_TREE && (!cu.isSepTree() || isChroma(partitioner.chType)) -#else - && (!CS::isDualITree(cs) || isChroma(partitioner.chType)) -#endif -#endif ) { -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - const bool firstCbfOfCU = ( currDepth == 0 ); -#endif { -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - if( firstCbfOfCU || TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth - 1 ) ) -#endif { const bool chroma_cbf = TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ); -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC if (!(cu.sbtInfo && (currDepth == 0 || (currDepth == 1 && currTU.noResidual)))) -#else - if( !( cu.sbtInfo && currDepth == 1 ) ) -#endif m_CABACEstimator->cbf_comp( cs, chroma_cbf, currArea.blocks[COMPONENT_Cb], currDepth ); } -#if !JVET_O0596_CBF_SIG_ALIGN_TO_SPEC - if( firstCbfOfCU || TU::getCbfAtDepth( currTU, COMPONENT_Cr, currDepth - 1 ) ) -#endif { const bool chroma_cbf = TU::getCbfAtDepth( currTU, COMPONENT_Cr, currDepth ); -#if JVET_O0596_CBF_SIG_ALIGN_TO_SPEC if (!(cu.sbtInfo && (currDepth == 0 || (currDepth == 1 && currTU.noResidual)))) -#else - if( !( cu.sbtInfo && currDepth == 1 ) ) -#endif m_CABACEstimator->cbf_comp( cs, chroma_cbf, currArea.blocks[COMPONENT_Cr], currDepth, TU::getCbfAtDepth( currTU, COMPONENT_Cb, currDepth ) ); } } } if( !bSubdiv && !( cu.sbtInfo && currTU.noResidual ) -#if JVET_O0545_MAX_TB_SIGNALLING && !isChroma(partitioner.chType) -#endif ) { m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, COMPONENT_Y, currDepth ), currArea.Y(), currDepth ); @@ -6540,13 +6125,11 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti { if( currArea.blocks[compID].valid() ) { -#if JVET_O0105_ICT if( compID == COMPONENT_Cr ) { const int cbfMask = ( TU::getCbf( currTU, COMPONENT_Cb ) ? 2 : 0) + ( TU::getCbf( currTU, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->joint_cb_cr( currTU, cbfMask ); } -#endif if( TU::hasCrossCompPredInfo( currTU, compID ) ) { m_CABACEstimator->cross_comp_pred( currTU, compID ); @@ -6869,11 +6452,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par if (bCheckFull) { -#if JVET_O0545_MAX_TB_SIGNALLING || JVET_O0050_LOCAL_DUAL_TREE TransformUnit &tu = csFull->addTU(CS::getArea(cs, currArea, partitioner.chType), partitioner.chType); -#else - TransformUnit &tu = csFull->addTU(CS::isDualITree(cs) ? cu : currArea, partitioner.chType); -#endif tu.depth = currDepth; tu.mtsIdx = MTS_DCT2_DCT2; tu.checkTuNoResidual( partitioner.currPartIdx() ); @@ -6882,18 +6461,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par if (slice.getLmcsEnabledFlag() && slice.getLmcsChromaResidualScaleFlag() && !(CS::isDualITree(cs) && slice.isIntra() && tu.cu->predMode==MODE_IBC )) { const CompArea &areaY = tu.blocks[COMPONENT_Y]; -#if JVET_O1109_UNFIY_CRS int adj = m_pcReshape->calculateChromaAdjVpduNei(tu, areaY); -#else - PelBuf piPredY = cs.getPredBuf(areaY); - CompArea tmpArea(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size()); - PelBuf tmpPred = m_tmpStorageLCU.getBuf(tmpArea); - tmpPred.copyFrom(piPredY); - if (!cu.firstPU->mhIntraFlag && !CU::isIBC(cu)) - tmpPred.rspSignal(m_pcReshape->getFwdLUT()); - const Pel avgLuma = tmpPred.computeAvg(); - int adj = m_pcReshape->calculateChromaAdj(avgLuma); -#endif tu.setChromaAdj(adj); } @@ -6913,11 +6481,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par saveCS.picture = cs.picture; saveCS.area.repositionTo(currArea); saveCS.clearTUs(); -#if JVET_O0545_MAX_TB_SIGNALLING || JVET_O0050_LOCAL_DUAL_TREE TransformUnit & bestTU = saveCS.addTU(CS::getArea(cs, currArea, partitioner.chType), partitioner.chType); -#else - TransformUnit & bestTU = saveCS.addTU(CS::isDualITree(cs) ? cu : currArea, partitioner.chType); -#endif for( uint32_t c = 0; c < numTBlocks; c++ ) { @@ -7020,27 +6584,14 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #endif if (slice.getLmcsEnabledFlag() && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag()) { -#if JVET_O0429_CRS_LAMBDA_FIX double cRescale = (double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj()); -#else - double cRescale = round((double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj())); -#endif m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale)); } -#if JVET_O0105_ICT -#if JVET_O0376_SPS_JOINTCBCR_FLAG if ( sps.getJointCbCrEnabledFlag() && isChroma( compID ) && ( tu.cu->cs->slice->getSliceQp() > 18 ) ) { m_pcTrQuant->setLambda( 1.05 * m_pcTrQuant->getLambda() ); } -#else - if ( isChroma( compID ) && tu.cu->cs->slice->getSliceQp() > 18 ) - { - m_pcTrQuant->setLambda( 1.05 * m_pcTrQuant->getLambda() ); - } -#endif -#endif TCoeff currAbsSum = 0; uint64_t currCompFracBits = 0; Distortion currCompDist = 0; @@ -7126,13 +6677,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const bool prevCbf = ( compID == COMPONENT_Cr ? tu.cbf[COMPONENT_Cb] : false ); m_CABACEstimator->cbf_comp( *csFull, true, compArea, currDepth, prevCbf ); -#if JVET_O0105_ICT if( compID == COMPONENT_Cr ) { const int cbfMask = ( tu.cbf[COMPONENT_Cb] ? 2 : 0 ) + 1; m_CABACEstimator->joint_cb_cr( tu, cbfMask ); } -#endif if( isCrossCPredictionAvailable ) { @@ -7240,12 +6789,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { const CompArea& cbArea = tu.blocks[COMPONENT_Cb]; const CompArea& crArea = tu.blocks[COMPONENT_Cr]; -#if JVET_O0376_SPS_JOINTCBCR_FLAG bool checkJointCbCr = (sps.getJointCbCrEnabledFlag()) && (!tu.noResidual) && (TU::getCbf(tu, COMPONENT_Cb) || TU::getCbf(tu, COMPONENT_Cr)); -#else - bool checkJointCbCr = !tu.noResidual && (TU::getCbf(tu, COMPONENT_Cb) || TU::getCbf(tu, COMPONENT_Cr)); -#endif -#if JVET_O0105_ICT const int channelBitDepth = sps.getBitDepth(toChannelType(COMPONENT_Cb)); bool reshape = slice.getLmcsEnabledFlag() && slice.getLmcsChromaResidualScaleFlag() && tu.blocks[COMPONENT_Cb].width * tu.blocks[COMPONENT_Cb].height > 4; @@ -7269,28 +6813,15 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } for (int cbfMask: jointCbfMasksToTest) -#else - if ( checkJointCbCr ) -#endif { -#if !JVET_O0105_ICT - const int channelBitDepth = sps.getBitDepth(toChannelType(COMPONENT_Cb)); - double minCostCbCr = minCost[COMPONENT_Cb] + minCost[COMPONENT_Cr]; - bool isLastBest = false; -#endif TCoeff currAbsSum = 0; uint64_t currCompFracBits = 0; Distortion currCompDistCb = 0; Distortion currCompDistCr = 0; double currCompCost = 0; -#if JVET_O0105_ICT tu.jointCbCr = (uint8_t) cbfMask; tu.compAlpha[COMPONENT_Cb] = tu.compAlpha[COMPONENT_Cr] = 0; -#else - tu.jointCbCr = 1; - tu.getCoeffs(COMPONENT_Cr).fill(0); -#endif const QpParam cQP(tu, COMPONENT_Cb); // note: uses tu.transformSkip[compID] @@ -7298,61 +6829,28 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_pcTrQuant->selectLambda(COMPONENT_Cb); #endif // Lambda is loosened for the joint mode with respect to single modes as the same residual is used for both chroma blocks -#if JVET_O0105_ICT const int absIct = abs( TU::getICTMode(tu) ); const double lfact = ( absIct == 1 || absIct == 3 ? 0.8 : 0.5 ); m_pcTrQuant->setLambda( lfact * m_pcTrQuant->getLambda() ); -#if JVET_O0376_SPS_JOINTCBCR_FLAG if ( checkJointCbCr && (tu.cu->cs->slice->getSliceQp() > 18)) { m_pcTrQuant->setLambda( 1.05 * m_pcTrQuant->getLambda() ); } -#else - if ( tu.cu->cs->slice->getSliceQp() > 18 ) - { - m_pcTrQuant->setLambda( 1.05 * m_pcTrQuant->getLambda() ); - } -#endif -#else - m_pcTrQuant->setLambda( 0.60 * m_pcTrQuant->getLambda() ); -#endif m_CABACEstimator->getCtx() = ctxStart; m_CABACEstimator->resetBits(); -#if JVET_O0105_ICT PelBuf cbResi = csFull->getResiBuf(cbArea); PelBuf crResi = csFull->getResiBuf(crArea); cbResi.copyFrom(orgResiCb[cbfMask]); crResi.copyFrom(orgResiCr[cbfMask]); -#else - // Copy the original residual into the residual buffer - csFull->getResiBuf(cbArea).copyFrom(cs.getOrgResiBuf(cbArea)); - csFull->getResiBuf(crArea).copyFrom(cs.getOrgResiBuf(crArea)); - - // Create joint residual and store it for Cb component: jointResi = (cbResi - crResi)/2 - PelBuf cbResi = csFull->getResiBuf( cbArea ); - PelBuf crResi = csFull->getResiBuf( crArea ); - - cbResi.subtractAndHalve( crResi ); - bool reshape = slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && slice.getLmcsChromaResidualScaleFlag() && tu.blocks[COMPONENT_Cb].width*tu.blocks[COMPONENT_Cb].height > 4; -#endif if ( reshape ) { -#if JVET_O0429_CRS_LAMBDA_FIX double cRescale = (double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj()); -#else - double cRescale = round((double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj())); -#endif m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale)); -#if !JVET_O0105_ICT - - cbResi.scaleSignal(tu.getChromaAdj(), 1, tu.cu->cs->slice->clpRng(COMPONENT_Cb)); -#endif } -#if JVET_O0105_ICT int codedCbfMask = 0; ComponentID codeCompId = (tu.jointCbCr >> 1 ? COMPONENT_Cb : COMPONENT_Cr); ComponentID otherCompId = (codeCompId == COMPONENT_Cr ? COMPONENT_Cb : COMPONENT_Cr); @@ -7384,13 +6882,9 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par codedCbfMask = 0; } currAbsSum = codedCbfMask; -#else - m_pcTrQuant->transformNxN(tu, COMPONENT_Cb, cQP, currAbsSum, m_CABACEstimator->getCtx()); -#endif if (currAbsSum > 0) { -#if JVET_O0105_ICT m_CABACEstimator->cbf_comp(cs, codedCbfMask >> 1, cbArea, currDepth, false); m_CABACEstimator->cbf_comp(cs, codedCbfMask & 1, crArea, currDepth, codedCbfMask >> 1); m_CABACEstimator->joint_cb_cr(tu, codedCbfMask); @@ -7406,25 +6900,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par cbResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(COMPONENT_Cb)); crResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(COMPONENT_Cr)); } -#else - // Set cfb also for Cr - TU::setCbfAtDepth (tu, COMPONENT_Cr, tu.depth, true); - - m_CABACEstimator->cbf_comp( *csFull, true, cbArea, currDepth, false ); - m_CABACEstimator->cbf_comp( *csFull, true, crArea, currDepth, true ); - - m_CABACEstimator->residual_coding( tu, COMPONENT_Cb ); - m_CABACEstimator->joint_cb_cr ( tu ); // Could also call residual coding for Cr where this flag is sent - - currCompFracBits = m_CABACEstimator->getEstFracBits(); - - m_pcTrQuant->invTransformNxN(tu, COMPONENT_Cb, cbResi, cQP); - - if ( reshape ) - cbResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(COMPONENT_Cb));; - - crResi.copyAndNegate( cbResi ); -#endif currCompDistCb = m_pcRdCost->getDistPart(csFull->getOrgResiBuf(cbArea), cbResi, channelBitDepth, COMPONENT_Cb, DF_SSE); currCompDistCr = m_pcRdCost->getDistPart(csFull->getOrgResiBuf(crArea), crResi, channelBitDepth, COMPONENT_Cr, DF_SSE); @@ -7445,7 +6920,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par uiSingleDistComp[COMPONENT_Cb] = currCompDistCb; uiSingleDistComp[COMPONENT_Cr] = currCompDistCr; minCostCbCr = currCompCost; -#if JVET_O0105_ICT isLastBest = (cbfMask == jointCbfMasksToTest.back()); if (!isLastBest) { @@ -7454,9 +6928,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par saveCS.getResiBuf(cbArea).copyFrom(csFull->getResiBuf(cbArea)); saveCS.getResiBuf(crArea).copyFrom(csFull->getResiBuf(crArea)); } -#else - isLastBest = true; -#endif } if( !isLastBest ) @@ -7499,13 +6970,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par continue; if (tu.blocks[compID].valid()) { -#if JVET_O0105_ICT if( compID == COMPONENT_Cr ) { const int cbfMask = ( TU::getCbf( tu, COMPONENT_Cb ) ? 2 : 0 ) + ( TU::getCbf( tu, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->joint_cb_cr(tu, cbfMask); } -#endif if( cs.pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma(compID) && uiAbsSum[COMPONENT_Y] ) { m_CABACEstimator->cross_comp_pred( tu, compID ); @@ -7638,10 +7107,8 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa m_pcRdCost->setChromaFormat(cs.sps->getChromaFormatIdc()); CodingUnit &cu = *cs.getCU( partitioner.chType ); -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.predMode == MODE_INTER ) CHECK( cu.isSepTree(), "CU with Inter mode must be in single tree" ); -#endif const ChromaFormat format = cs.area.chromaFormat;; const int numValidComponents = getNumberValidComponents(format); @@ -7664,11 +7131,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa // add an empty TU -#if JVET_O0050_LOCAL_DUAL_TREE cs.addTU(CS::getArea(cs, cs.area, partitioner.chType), partitioner.chType); -#else - cs.addTU(CS::isDualITree(cs) ? cu : cs.area, partitioner.chType); -#endif Distortion distortion = 0; for (int comp = 0; comp < numValidComponents; comp++) @@ -7712,31 +7175,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa PredictionUnit &pu = *cs.getPU( partitioner.chType ); m_CABACEstimator->cu_skip_flag ( cu ); -#if JVET_O0249_MERGE_SYNTAX m_CABACEstimator->merge_data(pu); -#else - if (CU::isIBC(cu)) - { - m_CABACEstimator->merge_idx(pu); - } - else - { - if (pu.regularMergeFlag) - { - m_CABACEstimator->merge_idx(pu); - } - else - { - m_CABACEstimator->subblock_merge_flag( cu ); - if (cu.mmvdSkip) - { - m_CABACEstimator->mmvd_merge_idx(pu); - } - else - m_CABACEstimator->merge_idx ( pu ); - } - } -#endif cs.dist = distortion; cs.fracBits = m_CABACEstimator->getEstFracBits(); @@ -7939,7 +7378,6 @@ uint64_t InterSearch::xGetSymbolFracBitsInter(CodingStructure &cs, Partitioner & } m_CABACEstimator->cu_skip_flag ( cu ); -#if JVET_O0249_MERGE_SYNTAX if (cu.firstPU->mhIntraFlag) { // CIIP shouldn't be skip, the upper level function will deal with it, i.e. setting the overall cost to MAX_DOUBLE @@ -7948,22 +7386,6 @@ uint64_t InterSearch::xGetSymbolFracBitsInter(CodingStructure &cs, Partitioner & { m_CABACEstimator->merge_data(*cu.firstPU); } -#else - if (cu.firstPU->regularMergeFlag) - { - m_CABACEstimator->merge_idx(*cu.firstPU); - } - else - { - m_CABACEstimator->subblock_merge_flag( cu ); - if (cu.mmvdSkip) - { - m_CABACEstimator->mmvd_merge_idx(*cu.firstPU); - } - else - m_CABACEstimator->merge_idx ( *cu.firstPU ); - } -#endif fracBits += m_CABACEstimator->getEstFracBits(); } else @@ -8057,35 +7479,19 @@ void InterSearch::initWeightIdxBits() } } -#if JVET_O1164_PS void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& sps, const PPS& pps ) -#else -void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS& sps ) -#endif { int mvShift = MV_FRACTIONAL_BITS_INTERNAL; int offset = 8; -#if JVET_O1164_PS int horMax = ( pps.getPicWidthInLumaSamples() + offset - (int)pos.x - 1 ) << mvShift; -#else - int horMax = ( sps.getPicWidthInLumaSamples() + offset - ( int ) pos.x - 1 ) << mvShift; -#endif int horMin = ( -( int ) sps.getMaxCUWidth() - offset - ( int ) pos.x + 1 ) << mvShift; -#if JVET_O1164_PS int verMax = ( pps.getPicHeightInLumaSamples() + offset - (int)pos.y - 1 ) << mvShift; -#else - int verMax = ( sps.getPicHeightInLumaSamples() + offset - ( int ) pos.y - 1 ) << mvShift; -#endif int verMin = ( -( int ) sps.getMaxCUHeight() - offset - ( int ) pos.y + 1 ) << mvShift; if( sps.getWrapAroundEnabledFlag() ) { -#if JVET_O1164_PS int horMax = ( pps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + offset - (int)pos.x - 1 ) << mvShift; -#else - int horMax = ( sps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + offset - ( int ) pos.x - 1 ) << mvShift; -#endif int horMin = ( -( int ) sps.getMaxCUWidth() - offset - ( int ) pos.x + 1 ) << mvShift; rcMv.setHor( std::min( horMax, std::max( horMin, rcMv.getHor() ) ) ); rcMv.setVer( std::min( verMax, std::max( verMin, rcMv.getVer() ) ) ); @@ -8145,11 +7551,7 @@ void InterSearch::symmvdCheckBestMvp( PelUnitBuf predBufA = m_tmpPredStorage[curRefList].getBuf(UnitAreaRelative(*pu.cu, pu)); const Picture* picRefA = pu.cu->slice->getRefPic(curRefList, cCurMvField.refIdx); Mv mvA = cCurMvField.mv; -#if JVET_O1164_PS clipMv( mvA, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(mvA, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif xPredInterBlk(COMPONENT_Y, pu, picRefA, mvA, predBufA, true, pu.cu->slice->clpRng(COMPONENT_Y), false, false); int32_t skipMvpIdx[2]; @@ -8169,11 +7571,7 @@ void InterSearch::symmvdCheckBestMvp( PelUnitBuf predBufB = m_tmpPredStorage[tarRefList].getBuf(UnitAreaRelative(*pu.cu, pu)); const Picture* picRefB = pu.cu->slice->getRefPic(tarRefList, cTarMvField.refIdx); Mv mvB = cTarMvField.mv; -#if JVET_O1164_PS clipMv( mvB, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps, *pu.cs->pps ); -#else - clipMv(mvB, pu.cu->lumaPos(), pu.cu->lumaSize(), *pu.cs->sps); -#endif xPredInterBlk(COMPONENT_Y, pu, picRefB, mvB, predBufB, true, pu.cu->slice->clpRng(COMPONENT_Y), false, false); PelUnitBuf bufTmp = m_tmpStorageLCU.getBuf(UnitAreaRelative(*pu.cu, pu)); @@ -8215,42 +7613,11 @@ uint64_t InterSearch::xCalcPuMeBits(PredictionUnit& pu) m_CABACEstimator->merge_flag(pu); if (pu.mergeFlag) { -#if JVET_O0249_MERGE_SYNTAX m_CABACEstimator->merge_data(pu); -#else - if (CU::isIBC(*pu.cu)) - { - m_CABACEstimator->merge_idx(pu); - return m_CABACEstimator->getEstFracBits(); - } - if (pu.regularMergeFlag) - { - m_CABACEstimator->merge_idx(pu); - } - else - { - m_CABACEstimator->subblock_merge_flag(*pu.cu); - m_CABACEstimator->MHIntra_flag(pu); - if (!pu.mhIntraFlag) - { - if (!pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip) - { - CHECK(!pu.cu->triangle, "triangle_flag must be true"); - } - } - if (pu.mmvdMergeFlag) - { - m_CABACEstimator->mmvd_merge_idx(pu); - } - else - m_CABACEstimator->merge_idx(pu); - } -#endif } return m_CABACEstimator->getEstFracBits(); } -#if JVET_O1170_IBC_VIRTUAL_BUFFER bool InterSearch::searchBv(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xBv, int yBv, int ctuSize) { const int ctuSizeLog2 = floorLog2(ctuSize); @@ -8326,6 +7693,5 @@ bool InterSearch::searchBv(PredictionUnit& pu, int xPos, int yPos, int width, in return false; return true; } -#endif //! \} diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index 41e2b7b6bccd63f64547581b3547e4f4422ba848..bd0982b2e12e509ea661bb0d92a0fc9967f662e1 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -78,13 +78,11 @@ struct AffineMVInfo int x, y, w, h; }; -#if JVET_O0592_ENC_ME_IMP struct BlkUniMvInfo { Mv uniMvs[2][33]; int x, y, w, h; }; -#endif typedef struct { @@ -124,12 +122,10 @@ private: int m_affMVListIdx; int m_affMVListSize; int m_affMVListMaxSize; -#if JVET_O0592_ENC_ME_IMP BlkUniMvInfo* m_uniMvList; int m_uniMvListIdx; int m_uniMvListSize; int m_uniMvListMaxSize; -#endif Distortion m_hevcCost; EncAffineMotion m_affineMotion; PatentBvCand m_defaultCachedBvs; @@ -246,7 +242,6 @@ public: m_affMVListSize = std::min(m_affMVListSize + 1, m_affMVListMaxSize); } } -#if JVET_O0592_ENC_ME_IMP void resetUniMvList() { m_uniMvListIdx = 0; m_uniMvListSize = 0; } void insertUniMvCands(CompArea blkArea, Mv cMvTemp[2][33]) { @@ -319,12 +314,9 @@ public: m_uniMvListSize = std::min(m_uniMvListSize + 1, m_uniMvListMaxSize); } } -#endif void resetSavedAffineMotion(); void storeAffineMotion( Mv acAffineMv[2][3], int16_t affineRefIdx[2], EAffineModel affineType, int gbiIdx ); -#if JVET_O1170_IBC_VIRTUAL_BUFFER bool searchBv(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xBv, int yBv, int ctuSize); -#endif protected: /// sub-function for motion vector refinement used in fractional-pel accuracy @@ -352,9 +344,7 @@ protected: uint8_t ucPointNr; int subShiftMode; unsigned imvShift; -#if JVET_O0057_ALTHPELIF bool useAltHpelIf; -#endif bool inCtuSearch; bool zeroMV; } IntTZSearchStruct; @@ -458,10 +448,8 @@ protected: ); void xTZSearch ( const PredictionUnit& pu, -#if JVET_O0592_ENC_ME_IMP RefPicList eRefPicList, int iRefIdxPred, -#endif IntTZSearchStruct& cStruct, Mv& rcMv, Distortion& ruiSAD, @@ -471,10 +459,8 @@ protected: ); void xTZSearchSelective ( const PredictionUnit& pu, -#if JVET_O0592_ENC_ME_IMP RefPicList eRefPicList, int iRefIdxPred, -#endif IntTZSearchStruct& cStruct, Mv& rcMv, Distortion& ruiSAD, @@ -489,10 +475,8 @@ protected: ); void xPatternSearchFast ( const PredictionUnit& pu, -#if JVET_O0592_ENC_ME_IMP RefPicList eRefPicList, int iRefIdxPred, -#endif IntTZSearchStruct& cStruct, Mv& rcMv, Distortion& ruiSAD, @@ -578,11 +562,7 @@ protected: double xGetMEDistortionWeight ( uint8_t gbiIdx, RefPicList eRefPicList); bool xReadBufferedUniMv ( PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv& pcMvPred, Mv& rcMv, uint32_t& ruiBits, Distortion& ruiCost); -#if JVET_O1164_PS void xClipMv ( Mv& rcMv, const struct Position& pos, const struct Size& size, const class SPS& sps, const class PPS& pps ); -#else - void xClipMv ( Mv& rcMv, const struct Position& pos, const struct Size& size, const class SPS& sps ); -#endif public: void resetBufferedUniMotions () { m_uniMotions.reset(); } @@ -602,11 +582,7 @@ public: ); protected: -#if JVET_O0057_ALTHPELIF void xExtDIFUpSamplingH(CPelBuf* pcPattern, bool useAltHpelIf); -#else - void xExtDIFUpSamplingH ( CPelBuf* pcPattern); -#endif void xExtDIFUpSamplingQ ( CPelBuf* pcPatternKey, Mv halfPelRef ); uint32_t xDetermineBestMvp ( PredictionUnit& pu, Mv acMvTemp[3], int& mvpIdx, const AffineAMVPInfo& aamvpi ); // ------------------------------------------------------------------------------------------------------------------- diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index b9047f9748f06839e5b8793f9dabce4f8be3310e..3804b3817a3e42ba8b8bd535ea578a3140cb04a9 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -51,9 +51,7 @@ #include <limits> //! \ingroup EncoderLib //! \{ -#if JVET_O0119_BASE_PALETTE_444 #define PLTCtx(c) SubCtx( Ctx::Palette, c ) -#endif IntraSearch::IntraSearch() : m_pSplitCS (nullptr) , m_pFullCS (nullptr) @@ -266,7 +264,6 @@ void IntraSearch::init( EncCfg* pcEncCfg, ////////////////////////////////////////////////////////////////////////// // INTRA PREDICTION ////////////////////////////////////////////////////////////////////////// -#if JVET_O0050_LOCAL_DUAL_TREE static constexpr double COST_UNKNOWN = -65536.0; double IntraSearch::findInterCUCost( CodingUnit &cu ) @@ -284,7 +281,6 @@ double IntraSearch::findInterCUCost( CodingUnit &cu ) } return COST_UNKNOWN; } -#endif bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, const double bestCostSoFar, bool mtsCheckRangeFlag, int mtsFirstCheckId, int mtsLastCheckId, bool moreProbMTSIdxFirst ) { @@ -300,9 +296,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, const TempCtx ctxStart ( m_CtxCache, m_CABACEstimator->getCtx() ); const TempCtx ctxStartMipFlag ( m_CtxCache, SubCtx( Ctx::MipFlag, m_CABACEstimator->getCtx() ) ); -#if !JVET_O0925_MIP_SIMPLIFICATIONS - const TempCtx ctxStartMipMode ( m_CtxCache, SubCtx( Ctx::MipMode, m_CABACEstimator->getCtx() ) ); -#endif const TempCtx ctxStartIspMode ( m_CtxCache, SubCtx( Ctx::ISPMode, m_CABACEstimator->getCtx() ) ); const TempCtx ctxStartPlanarFlag ( m_CtxCache, SubCtx( Ctx::IntraLumaPlanarFlag, m_CABACEstimator->getCtx() ) ); const TempCtx ctxStartIntraMode(m_CtxCache, SubCtx(Ctx::IntraLumaMpmFlag, m_CABACEstimator->getCtx())); @@ -318,9 +311,7 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, LFNSTSaveFlag &= sps.getUseIntraMTS() ? cu.mtsFlag == 0 : true; const uint32_t lfnstIdx = cu.lfnstIdx; -#if JVET_O0050_LOCAL_DUAL_TREE double costInterCU = findInterCUCost( cu ); -#endif const int width = partitioner.currArea().lwidth(); @@ -343,23 +334,9 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } double bestCurrentCost = bestCostSoFar; -#if MAX_TB_SIZE_SIGNALLING bool testISP = sps.getUseISP() && cu.mtsFlag == 0 && cu.lfnstIdx == 0 && CU::canUseISP( width, height, cu.cs->sps->getMaxTbSize() ); -#else - bool testISP = sps.getUseISP() && cu.mtsFlag == 0 && cu.lfnstIdx == 0 && CU::canUseISP( width, height, MAX_TB_SIZEY ); -#endif -#if !JVET_O0502_ISP_CLEANUP - bool ispHorIsFirstTest = testISP ? CU::firstTestISPHorSplit( width, height, COMPONENT_Y, nullptr, nullptr ) : true; - int ispOptions[] = { NOT_INTRA_SUBPARTITIONS, HOR_INTRA_SUBPARTITIONS, VER_INTRA_SUBPARTITIONS }; - if ( !ispHorIsFirstTest ) - { - ispOptions[1] = VER_INTRA_SUBPARTITIONS; - ispOptions[2] = HOR_INTRA_SUBPARTITIONS; - } -#endif if( testISP ) { -#if JVET_O0502_ISP_CLEANUP //reset the variables used for the tests m_ispCandListHor.clear(); m_ispCandListVer.clear(); @@ -368,23 +345,9 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, //save the number of subpartitions m_ispTestedModes.numTotalParts[0] = (int)height >> floorLog2(CU::getISPSplitDim(width, height, TU_1D_HORZ_SPLIT)); m_ispTestedModes.numTotalParts[1] = (int)width >> floorLog2(CU::getISPSplitDim(width, height, TU_1D_VERT_SPLIT)); -#else - //variables for the full RD list without MRL modes - m_rdModeListWithoutMrl .clear(); - m_rdModeListWithoutMrlHor .clear(); - m_rdModeListWithoutMrlVer .clear(); - //variables with data from regular intra used to skip ISP splits - m_intraModeDiagRatio .clear(); - m_intraModeHorVerRatio .clear(); - m_intraModeTestedNormalIntra.clear(); -#endif } -#if JVET_O1136_TS_BDPCM_SIGNALLING const bool testBDPCM = sps.getBDPCMEnabledFlag() && CU::bdpcmAllowed( cu, ComponentID( partitioner.chType ) ) && cu.mtsFlag == 0 && cu.lfnstIdx == 0; -#else - const bool testBDPCM = m_pcEncCfg->getRDPCM() && CU::bdpcmAllowed( cu, ComponentID( partitioner.chType ) ) && cu.mtsFlag == 0 && cu.lfnstIdx == 0; -#endif static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> uiHadModeList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandCostList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandHadList; @@ -402,21 +365,8 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, //===== determine set of modes to be tested (using prediction signal only) ===== int numModesAvailable = NUM_LUMA_MODE; // total number of Intra modes const bool fastMip = sps.getUseMIP() && m_pcEncCfg->getUseFastMIP(); -#if JVET_O0925_MIP_SIMPLIFICATIONS -#if JVET_O0545_MAX_TB_SIGNALLING const bool mipAllowed = sps.getUseMIP() && isLuma(partitioner.chType) && pu.lwidth() <= cu.cs->sps->getMaxTbSize() && pu.lheight() <= cu.cs->sps->getMaxTbSize() && ((cu.lfnstIdx == 0) || allowLfnstWithMip(cu.firstPU->lumaSize())); -#else - const bool mipAllowed = sps.getUseMIP() && isLuma(partitioner.chType) && pu.lwidth() <= MIP_MAX_WIDTH && pu.lheight() <= MIP_MAX_HEIGHT && ((cu.lfnstIdx == 0) || allowLfnstWithMip(cu.firstPU->lumaSize())); -#endif const bool testMip = mipAllowed && mipModesAvailable(pu.Y()); -#else -#if JVET_O0545_MAX_TB_SIGNALLING - const bool mipAllowed = sps.getUseMIP() && ( cu.lfnstIdx == 0 ) && isLuma( partitioner.chType ) && pu.lwidth() <= cu.cs->sps->getMaxTbSize() && pu.lheight() <= cu.cs->sps->getMaxTbSize(); -#else - const bool mipAllowed = sps.getUseMIP() && ( cu.lfnstIdx == 0 ) && isLuma( partitioner.chType ) && pu.lwidth() <= MIP_MAX_WIDTH && pu.lheight() <= MIP_MAX_HEIGHT; -#endif - const bool testMip = mipAllowed && mipModesAvailable( pu.Y() ) && !(fastMip && (cu.lwidth() > 2 * cu.lheight() || cu.lheight() > 2 * cu.lwidth())); -#endif static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> uiRdModeList; @@ -431,10 +381,8 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, { // this should always be true CHECK( !pu.Y().valid(), "PU is not valid" ); -#if ENABLE_JVET_L0283_MRL bool isFirstLineOfCtu = (((pu.block(COMPONENT_Y).y)&((pu.cs->sps)->getMaxCUWidth() - 1)) == 0); int numOfPassesExtendRef = (isFirstLineOfCtu ? 1 : MRL_NUM_REF_LINES); -#endif pu.multiRefIdx = 0; if( numModesForFullRD != numModesAvailable ) @@ -468,11 +416,7 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, if( testMip) { -#if JVET_O0925_MIP_SIMPLIFICATIONS numModesForFullRD += fastMip? std::max(numModesForFullRD, floorLog2(std::min(pu.lwidth(), pu.lheight())) - 1) : numModesForFullRD; -#else - numModesForFullRD += fastMip? std::max(2, floorLog2(std::min(pu.lwidth(), pu.lheight())) - 1) : numModesForFullRD; -#endif } const int numHadCand = (testMip ? 2 : 1) * 3; @@ -530,11 +474,7 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, updateCandList( ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD ); updateCandList( ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, uiMode), (double)minSadHad, uiHadModeList, CandHadList, numHadCand ); } -#if JVET_O0925_MIP_SIMPLIFICATIONS if( !sps.getUseMIP() && LFNSTSaveFlag ) -#else - if( LFNSTSaveFlag ) -#endif { // save found best modes m_uiSavedNumRdModesLFNST = numModesForFullRD; @@ -546,11 +486,7 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, LFNSTSaveFlag = false; } } // NSSTFlag -#if JVET_O0925_MIP_SIMPLIFICATIONS if( !sps.getUseMIP() && LFNSTLoadFlag ) -#else - else -#endif { // restore saved modes numModesForFullRD = m_uiSavedNumRdModesLFNST; @@ -559,18 +495,10 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, // PBINTRA fast uiHadModeList = m_uiSavedHadModeListLFNST; CandHadList = m_dSavedHadListLFNST; -#if !JVET_O0925_MIP_SIMPLIFICATIONS - - LFNSTLoadFlag = false; -#endif } // !LFNSTFlag -#if JVET_O0925_MIP_SIMPLIFICATIONS if (!(sps.getUseMIP() && LFNSTLoadFlag)) { -#else - CHECK( uiRdModeList.size() != numModesForFullRD, "Error: RD mode list size" ); -#endif static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> parentCandList = uiRdModeList; // Second round of SATD for extended Angular modes @@ -623,15 +551,9 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } if ( testISP ) { -#if JVET_O0502_ISP_CLEANUP // we save the regular intra modes list m_ispCandListHor = uiRdModeList; -#else - //we save the list with no mrl modes to keep only the Hadamard selected modes (no mpms) - m_rdModeListWithoutMrl = uiRdModeList; -#endif } -#if ENABLE_JVET_L0283_MRL pu.multiRefIdx = 1; const int numMPMs = NUM_MOST_PROBABLE_MODES; unsigned multiRefMPM [numMPMs]; @@ -679,10 +601,8 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } } } -#endif CHECKD( uiRdModeList.size() != numModesForFullRD, "Error: RD mode list size" ); -#if JVET_O0925_MIP_SIMPLIFICATIONS if (LFNSTSaveFlag && testMip && !allowLfnstWithMip(cu.firstPU->lumaSize())) // save a different set for the next run { // save found best modes @@ -699,18 +619,15 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, m_dSavedHadListLFNST.resize(3); LFNSTSaveFlag = false; } -#endif //*** Derive MIP candidates using Hadamard if (testMip) { cu.mipFlag = true; pu.multiRefIdx = 0; -#if JVET_O0925_MIP_SIMPLIFICATIONS double mipHadCost[MAX_NUM_MIP_MODE] = { MAX_DOUBLE }; initIntraPatternChType(cu, pu.Y()); -#endif initIntraMip( pu ); for (uint32_t uiMode = 0; uiMode < getNumModesMip(pu.Y()); uiMode++) @@ -723,33 +640,20 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, Distortion minSadHad = std::min(distParamSad.distFunc(distParamSad)*2, distParamHad.distFunc(distParamHad)); m_CABACEstimator->getCtx() = SubCtx( Ctx::MipFlag, ctxStartMipFlag ); -#if !JVET_O0925_MIP_SIMPLIFICATIONS - m_CABACEstimator->getCtx() = SubCtx( Ctx::MipMode, ctxStartMipMode ); -#endif uint64_t fracModeBits = xFracModeBitsIntra(pu, uiMode, CHANNEL_TYPE_LUMA); double cost = double(minSadHad) + double(fracModeBits) * sqrtLambdaForFirstPass; -#if JVET_O0925_MIP_SIMPLIFICATIONS mipHadCost[uiMode] = cost; DTRACE(g_trace_ctx, D_INTRA_COST, "IntraMIP: %u, %llu, %f (%d)\n", minSadHad, fracModeBits, cost, uiMode); updateCandList(ModeInfo(true, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD + 1); updateCandList(ModeInfo(true, 0, NOT_INTRA_SUBPARTITIONS, uiMode), 0.8*double(minSadHad), uiHadModeList, CandHadList, numHadCand); -#else - updateCandList(ModeInfo(true, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD); - updateCandList(ModeInfo(true, 0, NOT_INTRA_SUBPARTITIONS, uiMode), double(minSadHad), uiHadModeList, CandHadList, numHadCand); -#endif } const double thresholdHadCost = 1.0 + 1.4 / sqrt((double)(pu.lwidth()*pu.lheight())); -#if JVET_O0925_MIP_SIMPLIFICATIONS reduceHadCandList(uiRdModeList, CandCostList, numModesForFullRD, thresholdHadCost, mipHadCost, pu, fastMip); -#else - reduceHadCandList(uiRdModeList, CandCostList, numModesForFullRD, thresholdHadCost, 0.0); -#endif } -#if JVET_O0925_MIP_SIMPLIFICATIONS if ( sps.getUseMIP() && LFNSTSaveFlag) { // save found best modes @@ -772,7 +676,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, uiHadModeList = m_uiSavedHadModeListLFNST; CandHadList = m_dSavedHadListLFNST; } -#endif if( m_pcEncCfg->getFastUDIUseMPMEnabled() ) { @@ -802,7 +705,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } if ( testISP ) { -#if JVET_O0502_ISP_CLEANUP // we add the MPMs to the list that contains only regular intra modes for (int j = 0; j < numCand; j++) { @@ -818,64 +720,8 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, m_ispCandListHor.push_back(mostProbableMode); } } -#else - //we add the ISP MPMs to the list without mrl modes - m_rdModeListWithoutMrlHor = m_rdModeListWithoutMrl; - m_rdModeListWithoutMrlVer = m_rdModeListWithoutMrl; - for (int k = 0; k < m_rdModeListWithoutMrl.size(); k++) - { - m_rdModeListWithoutMrlHor[k].ispMod = HOR_INTRA_SUBPARTITIONS; - m_rdModeListWithoutMrlVer[k].ispMod = VER_INTRA_SUBPARTITIONS; - } - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM>* listPointer; - for( int k = 1; k < NUM_INTRA_SUBPARTITIONS_MODES; k++ ) - { - cu.ispMode = ispOptions[k]; - listPointer = &( cu.ispMode == HOR_INTRA_SUBPARTITIONS ? m_rdModeListWithoutMrlHor : m_rdModeListWithoutMrlVer ); - const int numCandISP = PU::getIntraMPMs( pu, uiPreds ); - for( int j = 0; j < numCandISP; j++ ) - { - bool mostProbableModeIncluded = false; - ModeInfo mostProbableMode( false, 0, cu.ispMode, uiPreds[j] ); - - for( int i = 0; i < listPointer->size(); i++ ) - { - mostProbableModeIncluded |= ( mostProbableMode == listPointer->at( i ) ); - } - if( !mostProbableModeIncluded ) - { - listPointer->push_back( mostProbableMode ); - } - } - } - cu.ispMode = NOT_INTRA_SUBPARTITIONS; -#endif - } - } -#if !JVET_O0925_MIP_SIMPLIFICATIONS - //*** Add MPMs for MIP to candidate list - if (!fastMip && testMip && pu.lwidth() < 8 && pu.lheight() < 8) - { - unsigned mpm[NUM_MPM_MIP]; - int numCandMip = PU::getMipMPMs(pu, mpm); - - for( int j = 0; j < numCandMip; j++ ) - { - bool mostProbableModeIncluded = false; - ModeInfo mostProbableMode(true, 0, NOT_INTRA_SUBPARTITIONS, mpm[j]); - for( int i = 0; i < numModesForFullRD; i++ ) - { - mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); - } - if( !mostProbableModeIncluded ) - { - numModesForFullRD++; - uiRdModeList.push_back( mostProbableMode ); - CandCostList.push_back(0); - } } } -#endif } else { @@ -916,43 +762,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } } -#if !JVET_O0502_ISP_CLEANUP - if( testISP ) // we remove the non-MPMs from the ISP lists - { - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> uiRdModeListCopyHor = m_rdModeListWithoutMrlHor; - m_rdModeListWithoutMrlHor.clear(); - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> uiRdModeListCopyVer = m_rdModeListWithoutMrlVer; - m_rdModeListWithoutMrlVer.clear(); - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> *listPointerCopy, *listPointer; - for( int ispOptionIdx = 1; ispOptionIdx < NUM_INTRA_SUBPARTITIONS_MODES; ispOptionIdx++ ) - { - cu.ispMode = ispOptions[ispOptionIdx]; - //we get the mpm cand list - const int numMPMs = NUM_MOST_PROBABLE_MODES; - unsigned uiPreds[numMPMs]; - - pu.multiRefIdx = 0; - - PU::getIntraMPMs( pu, uiPreds ); - - //we copy only the ISP MPMs - listPointerCopy = &( cu.ispMode == HOR_INTRA_SUBPARTITIONS ? uiRdModeListCopyHor : uiRdModeListCopyVer ); - listPointer = &( cu.ispMode == HOR_INTRA_SUBPARTITIONS ? m_rdModeListWithoutMrlHor : m_rdModeListWithoutMrlVer ); - for( int k = 0; k < listPointerCopy->size(); k++ ) - { - for( int q = 0; q < numMPMs; q++ ) - { - if (listPointerCopy->at(k) == ModeInfo( false, 0, cu.ispMode, uiPreds[q] )) - { - listPointer->push_back( listPointerCopy->at( k ) ); - break; - } - } - } - } - cu.ispMode = NOT_INTRA_SUBPARTITIONS; - } -#endif CHECK( numModesForFullRD != uiRdModeList.size(), "Inconsistent state!" ); @@ -964,7 +773,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, { double pbintraRatio = (lfnstIdx > 0) ? 1.25 : PBINTRA_RATIO; int maxSize = -1; -#if JVET_O0925_MIP_SIMPLIFICATIONS ModeInfo bestMipMode; int bestMipIdx = -1; for( int idx = 0; idx < uiRdModeList.size(); idx++ ) @@ -977,9 +785,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } } const int numHadCand = 3; -#else - const int numHadCand = (testMip ? 2 : 1) * 3; -#endif for (int k = numHadCand - 1; k >= 0; k--) { if (CandHadList.size() < (k + 1) || CandHadList[k] > cs.interHad * pbintraRatio) { maxSize = k; } @@ -987,7 +792,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, if (maxSize > 0) { uiRdModeList.resize(std::min<size_t>(uiRdModeList.size(), maxSize)); -#if JVET_O0925_MIP_SIMPLIFICATIONS if( bestMipIdx >= 0 ) { if( uiRdModeList.size() <= bestMipIdx ) @@ -995,15 +799,9 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, uiRdModeList.push_back(bestMipMode); } } -#endif if ( testISP ) { -#if JVET_O0502_ISP_CLEANUP m_ispCandListHor.resize(std::min<size_t>(m_ispCandListHor.size(), maxSize)); -#else - m_rdModeListWithoutMrlHor.resize(std::min<size_t>(m_rdModeListWithoutMrlHor.size(), maxSize)); - m_rdModeListWithoutMrlVer.resize(std::min<size_t>(m_rdModeListWithoutMrlVer.size(), maxSize)); -#endif } } if (maxSize == 0) @@ -1013,9 +811,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, //===== reset context models ===== m_CABACEstimator->getCtx() = SubCtx(Ctx::MipFlag, ctxStartMipFlag); -#if !JVET_O0925_MIP_SIMPLIFICATIONS - m_CABACEstimator->getCtx() = SubCtx(Ctx::MipMode, ctxStartMipMode); -#endif m_CABACEstimator->getCtx() = SubCtx(Ctx::ISPMode, ctxStartIspMode); m_CABACEstimator->getCtx() = SubCtx(Ctx::IntraLumaPlanarFlag, ctxStartPlanarFlag); m_CABACEstimator->getCtx() = SubCtx(Ctx::IntraLumaMpmFlag, ctxStartIntraMode); @@ -1025,52 +820,14 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } } -#if JVET_O0502_ISP_CLEANUP int numNonISPModes = (int)uiRdModeList.size(); -#endif if ( testISP ) { -#if JVET_O0502_ISP_CLEANUP // we reserve positions for ISP in the common full RD list const int maxNumRDModesISP = 16; for (int i = 0; i < maxNumRDModesISP; i++) uiRdModeList.push_back(ModeInfo(false, 0, INTRA_SUBPARTITIONS_RESERVED, 0)); -#else - //we create a single full RD list that includes all intra modes using regular intra, MRL and ISP - auto* firstIspList = ispOptions[1] == HOR_INTRA_SUBPARTITIONS ? &m_rdModeListWithoutMrlHor : &m_rdModeListWithoutMrlVer; - auto* secondIspList = ispOptions[1] == HOR_INTRA_SUBPARTITIONS ? &m_rdModeListWithoutMrlVer : &m_rdModeListWithoutMrlHor; - - if( !sps.getUseLFNST() && m_pcEncCfg->getUseFastISP() ) - { - CHECKD( uiRdModeList.size() > CandCostList.size(), "Error: CandCostList size" ); - // find the first non-MRL, non-MIP mode - int indexFirstMode = int(uiRdModeList.size()) - 1; // default is last mode - for (int k = 0; k < int(uiRdModeList.size()); k++) - { - if (uiRdModeList[k].mRefId == 0 && uiRdModeList[k].mipFlg == false) - { - indexFirstMode = k; - break; - } - } - // move the mode indicated by indexFirstMode to the beginning - for (int idx = indexFirstMode - 1; idx >= 0; idx--) - { - std::swap(uiRdModeList[idx], uiRdModeList[idx + 1]); - std::swap(CandCostList[idx], CandCostList[idx + 1]); - } - //insert all ISP modes after the first non-mrl mode - uiRdModeList.insert(uiRdModeList.begin() + 1, secondIspList->begin(), secondIspList->end()); - uiRdModeList.insert(uiRdModeList.begin() + 1, firstIspList->begin(), firstIspList->end()); - } - else - { - //insert all ISP modes at the end of the current list - uiRdModeList.insert( uiRdModeList.end(), secondIspList->begin(), secondIspList->end() ); - uiRdModeList.insert( uiRdModeList.end(), firstIspList->begin() , firstIspList->end() ); - } -#endif } //===== check modes (using r-d costs) ===== @@ -1085,14 +842,9 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, csBest->slice = cs.slice; csTemp->initStructData(); csBest->initStructData(); -#if JVET_O0050_LOCAL_DUAL_TREE csTemp->picture = cs.picture; csBest->picture = cs.picture; -#endif -#if !JVET_O0925_MIP_SIMPLIFICATIONS - m_bestCostNonMip = MAX_DOUBLE; -#endif static_vector<int, FAST_UDI_MAX_RDMODE_NUM> rdModeIdxList; if (testMip) { @@ -1113,15 +865,12 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, rdModeIdxList.push_back( i ); } } -#if JVET_O0925_MIP_SIMPLIFICATIONS uiRdModeList.resize(rdModeListTemp.size()); -#endif for( int i = 0; i < uiRdModeList.size(); i++) { uiRdModeList[i] = rdModeListTemp[i]; } } -#if JVET_O0925_MIP_SIMPLIFICATIONS else { static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> rdModeListTemp; @@ -1138,22 +887,14 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, uiRdModeList[i] = rdModeListTemp[i]; } } -#endif // just to be sure numModesForFullRD = ( int ) uiRdModeList.size(); -#if !JVET_O0502_ISP_CLEANUP - PartSplit intraSubPartitionsProcOrder = TU_NO_ISP; - int bestNormalIntraModeIndex = -1; -#endif TUIntraSubPartitioner subTuPartitioner( partitioner ); if( !cu.ispMode && !cu.mtsFlag ) { m_modeCtrl->setMtsFirstPassNoIspCost( MAX_DOUBLE ); } -#if !JVET_O0502_ISP_CLEANUP - bool ispHorAllZeroCbfs = false, ispVerAllZeroCbfs = false; -#endif for (int mode = -2 * int(testBDPCM); mode < (int)uiRdModeList.size(); mode++) { @@ -1163,13 +904,7 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, { cu.bdpcmMode = -mode; -#if JVET_O0315_RDPCM_INTRAMODE_ALIGN uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, cu.bdpcmMode == 2 ? VER_IDX : HOR_IDX); -#else - unsigned mpm_pred[NUM_MOST_PROBABLE_MODES]; - PU::getIntraMPMs(pu, mpm_pred); - uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, mpm_pred[0]); -#endif cu.mipFlag = uiOrgMode.mipFlg; cu.ispMode = uiOrgMode.ispMod; pu.multiRefIdx = uiOrgMode.mRefId; @@ -1178,7 +913,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, else { cu.bdpcmMode = 0; -#if JVET_O0502_ISP_CLEANUP if (uiRdModeList[mode].ispMod == INTRA_SUBPARTITIONS_RESERVED) { if (mode == numNonISPModes) // the list needs to be sorted only once @@ -1189,7 +923,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, if (uiRdModeList[mode].ispMod == INTRA_SUBPARTITIONS_RESERVED) continue; } -#endif uiOrgMode = uiRdModeList[mode]; cu.mipFlag = uiOrgMode.mipFlg; cu.ispMode = uiOrgMode.ispMod; @@ -1200,25 +933,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, CHECK(pu.multiRefIdx && (pu.intraDir[0] == PLANAR_IDX), "Error: combination of MRL and Planar mode not supported"); CHECK(cu.ispMode && cu.mipFlag, "Error: combination of ISP and MIP not supported"); CHECK(cu.ispMode && pu.multiRefIdx, "Error: combination of ISP and MRL not supported"); -#if !JVET_O0502_ISP_CLEANUP - if( cu.ispMode ) - { - intraSubPartitionsProcOrder = CU::getISPType( cu, COMPONENT_Y ); - bool tuIsDividedInRows = CU::divideTuInRows( cu ); - if ( ( tuIsDividedInRows && ispHorAllZeroCbfs ) || ( !tuIsDividedInRows && ispVerAllZeroCbfs ) ) - { - continue; - } - if( m_intraModeDiagRatio.at( bestNormalIntraModeIndex ) > 1.25 ) - { - continue; - } - if( ( m_intraModeHorVerRatio.at( bestNormalIntraModeIndex ) > 1.25 && tuIsDividedInRows ) || ( m_intraModeHorVerRatio.at( bestNormalIntraModeIndex ) < 0.8 && !tuIsDividedInRows ) ) - { - continue; - } - } -#endif } // set context models @@ -1230,7 +944,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, bool tmpValidReturn = false; if( cu.ispMode ) { -#if JVET_O0502_ISP_CLEANUP tmpValidReturn = xIntraCodingLumaISP(*csTemp, subTuPartitioner, bestCurrentCost); if (csTemp->tus.size() == 0) { @@ -1243,45 +956,20 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, // we save the data for future tests m_ispTestedModes.setModeResults((ISPType)cu.ispMode, (int)uiOrgMode.modeId, (int)csTemp->tus.size(), csTemp->cus[0]->firstTU->cbf[COMPONENT_Y] ? csTemp->cost : MAX_DOUBLE, csBest->cost); } -#else - tmpValidReturn = xRecurIntraCodingLumaQT( *csTemp, subTuPartitioner, bestCurrentCost, 0, intraSubPartitionsProcOrder, false, - mtsCheckRangeFlag, mtsFirstCheckId, mtsLastCheckId, moreProbMTSIdxFirst ); -#endif } else { -#if !JVET_O0925_MIP_SIMPLIFICATIONS - if( ! fastMip ) - { - m_bestCostNonMip = MAX_DOUBLE; - } -#endif tmpValidReturn = xRecurIntraCodingLumaQT( *csTemp, partitioner, uiBestPUMode.ispMod ? bestCurrentCost : MAX_DOUBLE, -1, TU_NO_ISP, uiBestPUMode.ispMod, mtsCheckRangeFlag, mtsFirstCheckId, mtsLastCheckId, moreProbMTSIdxFirst ); } -#if JVET_O0502_ISP_CLEANUP if (!cu.ispMode && !cu.mtsFlag && !cu.lfnstIdx && !cu.bdpcmMode && !pu.multiRefIdx && !cu.mipFlag && testISP) { m_regIntraRDListWithCosts.push_back(ModeInfoWithCost(cu.mipFlag, pu.multiRefIdx, cu.ispMode, uiOrgMode.modeId, csTemp->cost)); } -#endif if( cu.ispMode && !csTemp->cus[0]->firstTU->cbf[COMPONENT_Y] ) { -#if !JVET_O0502_ISP_CLEANUP - if( !sps.getUseLFNST() ) - { - if ( cu.ispMode == HOR_INTRA_SUBPARTITIONS ) - { - ispHorAllZeroCbfs |= ( m_pcEncCfg->getUseFastISP() && csTemp->tus[0]->lheight() > 2 && csTemp->cost >= bestCurrentCost ); - } - else - { - ispVerAllZeroCbfs |= ( m_pcEncCfg->getUseFastISP() && csTemp->tus[0]->lwidth() > 2 && csTemp->cost >= bestCurrentCost ); - } - } -#endif csTemp->cost = MAX_DOUBLE; csTemp->costDbOffset = 0; tmpValidReturn = false; @@ -1293,13 +981,9 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, m_modeCostStore[ lfnstIdx ][ testMip ? rdModeIdxList[ mode ] : mode ] = tmpValidReturn ? csTemp->cost : ( MAX_DOUBLE / 2.0 ); //(MAX_DOUBLE / 2.0) ?? } -#if JVET_O0502_ISP_CLEANUP DTRACE(g_trace_ctx, D_INTRA_COST, "IntraCost T [x=%d,y=%d,w=%d,h=%d] %f (%d,%d,%d,%d,%d,%d) \n", cu.blocks[0].x, cu.blocks[0].y, (int)width, (int)height, csTemp->cost, uiOrgMode.modeId, uiOrgMode.ispMod, pu.multiRefIdx, cu.mipFlag, cu.lfnstIdx, cu.mtsFlag); -#else - DTRACE( g_trace_ctx, D_INTRA_COST, "IntraCost T %f (%d) \n", csTemp->cost, uiOrgMode.modeId ); -#endif if( tmpValidReturn ) @@ -1328,14 +1012,10 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, if( !cu.ispMode && !cu.bdpcmMode && csBest->cost < bestCostNonBDPCM ) { bestCostNonBDPCM = csBest->cost; -#if !JVET_O0502_ISP_CLEANUP - bestNormalIntraModeIndex = mode; -#endif } } csTemp->releaseIntermediateData(); -#if JVET_O0050_LOCAL_DUAL_TREE if( m_pcEncCfg->getFastLocalDualTreeMode() ) { if( cu.isConsIntra() && !cu.slice->isIntra() && csBest->cost != MAX_DOUBLE && costInterCU != COST_UNKNOWN && mode >= 0 ) @@ -1354,7 +1034,6 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, } } } -#endif } // Mode loop cu.ispMode = uiBestPUMode.ispMod; @@ -1389,11 +1068,7 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner cs.setDecomp( cs.area.Cb(), false ); double bestCostSoFar = maxCostAllowed; -#if JVET_O0050_LOCAL_DUAL_TREE bool lumaUsesISP = !cu.isSepTree() && cu.ispMode; -#else - bool lumaUsesISP = !CS::isDualITree( *cu.cs ) && cu.ispMode; -#endif PartSplit ispType = lumaUsesISP ? CU::getISPType( cu, COMPONENT_Y ) : TU_NO_ISP; CHECK( cu.ispMode && bestCostSoFar < 0, "bestCostSoFar must be positive!" ); @@ -1420,21 +1095,13 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner saveCS.area.repositionTo( cs.area ); saveCS.clearTUs(); -#if JVET_O0050_LOCAL_DUAL_TREE if( !cu.isSepTree() && cu.ispMode ) -#else - if( !CS::isDualITree( cs ) && cu.ispMode ) -#endif { saveCS.clearCUs(); saveCS.clearPUs(); } -#if JVET_O0050_LOCAL_DUAL_TREE if( cu.isSepTree() ) -#else - if( CS::isDualITree( cs ) ) -#endif { if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { @@ -1607,11 +1274,7 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner continue; } -#if JVET_O1136_TS_BDPCM_SIGNALLING if (cs.sps->getTransformSkipEnabledFlag()) -#else - if (cs.pps->getUseTransformSkip()) -#endif { m_CABACEstimator->getCtx() = ctxStart; } @@ -1685,70 +1348,7 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner } } -#if !JVET_O0525_REMOVE_PCM -void IntraSearch::IPCMSearch(CodingStructure &cs, Partitioner& partitioner) -{ -#if JVET_O0050_LOCAL_DUAL_TREE - ComponentID compStr = (partitioner.isSepTree(cs) && !isLuma( partitioner.chType)) ? COMPONENT_Cb : COMPONENT_Y; - ComponentID compEnd = (partitioner.isSepTree(cs) && isLuma( partitioner.chType)) ? COMPONENT_Y : COMPONENT_Cr; -#else - ComponentID compStr = (CS::isDualITree(cs) && !isLuma(partitioner.chType)) ? COMPONENT_Cb: COMPONENT_Y; - ComponentID compEnd = (CS::isDualITree(cs) && isLuma(partitioner.chType)) ? COMPONENT_Y : COMPONENT_Cr; -#endif - for( ComponentID compID = compStr; compID <= compEnd; compID = ComponentID(compID+1) ) - { - - xEncPCM(cs, partitioner, compID); - } - cs.getPredBuf().fill(0); - cs.getResiBuf().fill(0); - cs.getOrgResiBuf().fill(0); - - cs.dist = 0; - cs.fracBits = 0; - cs.cost = 0; - - cs.setDecomp(cs.area); - cs.picture->getPredBuf(cs.area).copyFrom(cs.getPredBuf()); -} - -void IntraSearch::xEncPCM(CodingStructure &cs, Partitioner& partitioner, const ComponentID &compID) -{ - TransformUnit &tu = *cs.getTU( partitioner.chType ); - - const int channelBitDepth = cs.sps->getBitDepth(toChannelType(compID)); - const uint32_t uiPCMBitDepth = cs.sps->getPCMBitDepth(toChannelType(compID)); - - const int pcmShiftRight = (channelBitDepth - int(uiPCMBitDepth)); - - CompArea area = tu.blocks[compID]; - PelBuf pcmBuf = tu.getPcmbuf (compID); - PelBuf recBuf = cs.getRecoBuf ( area ); - CPelBuf orgBuf = cs.getOrgBuf ( area ); - - CHECK(pcmShiftRight < 0, "Negative shift"); - CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); - PelBuf tempOrgBuf = m_tmpStorageLCU.getBuf(tmpArea); - tempOrgBuf.copyFrom(orgBuf); - if (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) - { - tempOrgBuf.rspSignal(m_pcReshape->getFwdLUT()); - } - for (uint32_t uiY = 0; uiY < pcmBuf.height; uiY++) - { - for (uint32_t uiX = 0; uiX < pcmBuf.width; uiX++) - { - // Encode - pcmBuf.at(uiX, uiY) = tempOrgBuf.at(uiX, uiY) >> pcmShiftRight; - // Reconstruction - recBuf.at(uiX, uiY) = pcmBuf.at(uiX, uiY) << pcmShiftRight; - } - } -} -#endif - -#if JVET_O0050_LOCAL_DUAL_TREE void IntraSearch::saveCuAreaCostInSCIPU( Area area, double cost ) { if( m_numCuInSCIPU < NUM_INTER_CU_INFO_SAVE ) @@ -1768,8 +1368,6 @@ void IntraSearch::initCuAreaCostInSCIPU() } m_numCuInSCIPU = 0; } -#endif -#if JVET_O0119_BASE_PALETTE_444 void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp) { CodingUnit &cu = *cs.getCU(partitioner.chType); @@ -2102,11 +1700,7 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u for (uint32_t ch = compBegin; ch < (compBegin + numComp); ch++) { QpParam cQP(tu, ComponentID(ch)); -#if JVET_O0919_TS_MIN_QP qp[ch] = cQP.Qp(false); -#else - qp[ch] = cQP.Qp; -#endif qpRem[ch] = qp[ch] % 6; qpPer[ch] = qp[ch] / 6; quantiserScale[ch] = g_quantScales[0][qpRem[ch]]; @@ -2337,7 +1931,6 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner, delete[] pelList; delete[] pelListSort; } -#endif // ------------------------------------------------------------------------------------------------------------------- // Intra search // ------------------------------------------------------------------------------------------------------------------- @@ -2353,15 +1946,9 @@ void IntraSearch::xEncIntraHeader( CodingStructure &cs, Partitioner &partitioner // CU header if( isFirst ) { -#if JVET_O0119_BASE_PALETTE_444 if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag() || cs.slice->getSPS()->getPLTMode()) && cu.Y().valid() ) -#else - if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) - && cu.Y().valid() - ) -#endif { if( cs.pps->getTransquantBypassEnabledFlag() ) { @@ -2370,23 +1957,11 @@ void IntraSearch::xEncIntraHeader( CodingStructure &cs, Partitioner &partitioner m_CABACEstimator->cu_skip_flag( cu ); m_CABACEstimator->pred_mode ( cu ); } -#if JVET_O0119_BASE_PALETTE_444 if (CU::isPLT(cu)) { return; } -#endif m_CABACEstimator->bdpcm_mode ( cu, ComponentID(partitioner.chType) ); -#if !JVET_O0525_REMOVE_PCM - if( CU::isIntra(cu) ) - { - m_CABACEstimator->pcm_data( cu, partitioner ); - if( cu.ipcm ) - { - return; - } - } -#endif } PredictionUnit &pu = *cs.getPU(partitioner.currArea().lumaPos(), partitioner.chType); @@ -2545,13 +2120,11 @@ void IntraSearch::xEncCoeffQT( CodingStructure &cs, Partitioner &partitioner, co if( currArea.blocks[compID].valid() ) { -#if JVET_O0105_ICT if( compID == COMPONENT_Cr ) { const int cbfMask = ( TU::getCbf( currTU, COMPONENT_Cb ) ? 2 : 0 ) + ( TU::getCbf( currTU, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->joint_cb_cr( currTU, cbfMask ); } -#endif if( TU::hasCrossCompPredInfo( currTU, compID ) ) { m_CABACEstimator->cross_comp_pred( currTU, compID ); @@ -2602,12 +2175,8 @@ uint64_t IntraSearch::xGetIntraFracBitsQTSingleChromaComponent( CodingStructure TransformUnit &currTU = *cs.getTU( currArea.blocks[partitioner.chType], partitioner.chType ); //cbf coding -#if JVET_O0105_ICT const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbfAtDepth( currTU, COMPONENT_Cb, partitioner.currTrDepth ) : false ); m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, partitioner.currTrDepth ), currArea.blocks[compID], partitioner.currTrDepth - 1, prevCbf ); -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbfAtDepth( currTU, compID, partitioner.currTrDepth ), currArea.blocks[compID], partitioner.currTrDepth - 1 ); -#endif //coeffs coding and cross comp coding if( TU::hasCrossCompPredInfo( currTU, compID ) ) { @@ -2636,7 +2205,6 @@ uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const Com if ( currTU.jointCbCr ) { -#if JVET_O0105_ICT const int cbfMask = ( TU::getCbf( currTU, COMPONENT_Cb ) ? 2 : 0 ) + ( TU::getCbf( currTU, COMPONENT_Cr ) ? 1 : 0 ); m_CABACEstimator->cbf_comp( cs, cbfMask>>1, currTU.blocks[ COMPONENT_Cb ], currTU.depth, false ); m_CABACEstimator->cbf_comp( cs, cbfMask &1, currTU.blocks[ COMPONENT_Cr ], currTU.depth, cbfMask>>1 ); @@ -2646,26 +2214,12 @@ uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const Com m_CABACEstimator->residual_coding( currTU, COMPONENT_Cb ); if( cbfMask & 1 ) m_CABACEstimator->residual_coding( currTU, COMPONENT_Cr ); -#else - if ( TU::getCbf( currTU, COMPONENT_Cb ) ) - { - m_CABACEstimator->cbf_comp( cs, true, currTU.blocks[ COMPONENT_Cb ], currTU.depth, false ); - m_CABACEstimator->cbf_comp( cs, true, currTU.blocks[ COMPONENT_Cr ], currTU.depth, true ); - m_CABACEstimator->joint_cb_cr( currTU ); - } - else - { - m_CABACEstimator->cbf_comp( cs, false, currTU.blocks[ COMPONENT_Cb ], currTU.depth, false ); - m_CABACEstimator->cbf_comp( cs, false, currTU.blocks[ COMPONENT_Cr ], currTU.depth, false ); - } -#endif } else { if ( compID == COMPONENT_Cb ) m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, compID ), currTU.blocks[ compID ], currTU.depth, false ); else -#if JVET_O0105_ICT { const bool cbCbf = TU::getCbf( currTU, COMPONENT_Cb ); const bool crCbf = TU::getCbf( currTU, compID ); @@ -2673,16 +2227,9 @@ uint64_t IntraSearch::xGetIntraFracBitsQTChroma(TransformUnit& currTU, const Com m_CABACEstimator->cbf_comp( cs, crCbf, currTU.blocks[ compID ], currTU.depth, cbCbf ); m_CABACEstimator->joint_cb_cr( currTU, cbfMask ); } -#else - m_CABACEstimator->cbf_comp( cs, TU::getCbf( currTU, compID ), currTU.blocks[ compID ], currTU.depth, TU::getCbf( currTU, COMPONENT_Cb ) ); -#endif } -#if JVET_O0105_ICT if( !currTU.jointCbCr && TU::getCbf( currTU, compID ) ) -#else - if( TU::getCbf( currTU, compID ) ) -#endif { m_CABACEstimator->residual_coding( currTU, compID ); } @@ -2719,15 +2266,10 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp const bool bUseCrossCPrediction = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma( compID ) && PU::isChromaIntraModeCrossCheckMode( pu ) && checkCrossCPrediction; const bool ccUseRecoResi = m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate(); -#if !JVET_O0502_ISP_CLEANUP - const bool ispSplitIsAllowed = sps.getUseISP() && CU::canUseISP( *tu.cu, compID ); -#endif //===== init availability pattern ===== -#if JVET_O0105_ICT CHECK( tu.jointCbCr && compID == COMPONENT_Cr, "wrong combination of compID and jointCbCr" ); -#endif bool jointCbCr = tu.jointCbCr && compID == COMPONENT_Cb; if ( compID == COMPONENT_Y ) @@ -2735,15 +2277,11 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp PelBuf sharedPredTS( m_pSharedPredTransformSkip[compID], area ); if( default0Save1Load2 != 2 ) { -#if JVET_O0502_ISP_CLEANUP -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN bool predRegDiffFromTB = CU::isPredRegDiffFromTB(*tu.cu, compID); bool firstTBInPredReg = CU::isFirstTBInPredReg(*tu.cu, compID, area); CompArea areaPredReg(COMPONENT_Y, tu.chromaFormat, area); -#endif if (tu.cu->ispMode && isLuma(compID)) { -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN if (predRegDiffFromTB) { if (firstTBInPredReg) @@ -2753,30 +2291,12 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } } else -#endif initIntraPatternChTypeISP(*tu.cu, area, piReco); } else { initIntraPatternChType(*tu.cu, area); } -#else -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN - bool predRegDiffFromTB = CU::isPredRegDiffFromTB(*tu.cu, compID); - bool firstTBInPredReg = CU::isFirstTBInPredReg(*tu.cu, compID, area); - CompArea areaPredReg(COMPONENT_Y, tu.chromaFormat, area); - if (predRegDiffFromTB) - { - if (firstTBInPredReg) - { - CU::adjustPredArea(areaPredReg); - initIntraPatternChType(*tu.cu, areaPredReg); - } - } - else -#endif - initIntraPatternChType(*tu.cu, area); -#endif //===== get prediction signal ===== if( compID != COMPONENT_Y && PU::isLMCMode( uiChFinalMode ) ) @@ -2794,7 +2314,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } else { -#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN if (predRegDiffFromTB) { if (firstTBInPredReg) @@ -2804,7 +2323,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } } else -#endif predIntraAng(compID, piPred, pu); } } @@ -2829,25 +2347,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp const Slice &slice = *cs.slice; bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); -#if JVET_O0105_ICT if (isLuma(compID)) { -#else - if (flag && slice.getLmcsChromaResidualScaleFlag() && isChroma(compID)) - { - const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size())); - const CompArea &areaY = CompArea(COMPONENT_Y, tu.chromaFormat, area ); -#if JVET_O1109_UNFIY_CRS - int adj = m_pcReshape->calculateChromaAdjVpduNei(tu, areaY); -#else - PelBuf piPredY; - piPredY = cs.picture->getPredBuf(areaY); - const Pel avgLuma = piPredY.computeAvg(); - int adj = m_pcReshape->calculateChromaAdj(avgLuma); -#endif - tu.setChromaAdj(adj); - } -#endif //===== get residual signal ===== piResi.copyFrom( piOrg ); if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) @@ -2874,9 +2375,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } CrossComponentPrediction::crossComponentPrediction(tu, compID, cs.getResiBuf(tu.Y()), piResi, piResi, false); } -#if JVET_O0105_ICT } -#endif //===== transform and quantization ===== //--- init rate estimation arrays for RDOQ --- @@ -2893,16 +2392,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp if (flag && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag() ) { int cResScaleInv = tu.getChromaAdj(); -#if JVET_O0429_CRS_LAMBDA_FIX double cResScale = (double)(1 << CSCALE_FP_PREC) / (double)cResScaleInv; -#else - double cResScale = round((double)(1 << CSCALE_FP_PREC) / (double)cResScaleInv); -#endif m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cResScale*cResScale)); -#if !JVET_O0105_ICT - if ( !jointCbCr ) // Joint CbCr signal is to be scaled in the case of joint chroma - piResi.scaleSignal(cResScaleInv, 1, tu.cu->cs->slice->clpRng(compID)); -#endif } const CompArea &crArea = tu.blocks [ COMPONENT_Cr ]; @@ -2913,87 +2404,34 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp if ( jointCbCr ) { -#if !JVET_O0105_ICT - // Get Cr prediction and residual - crResi.copyFrom( crOrg ); - crResi.subtract( crPred ); - - // Create joint residual and store it for Cb component: jointResi = (cbResi - crResi)/2 - piResi.subtractAndHalve( crResi ); - - // Scale the joint signal - if ( flag && slice.getLmcsChromaResidualScaleFlag() ) - piResi.scaleSignal(tu.getChromaAdj(), 1, tu.cu->cs->slice->clpRng(compID)); -#endif // Lambda is loosened for the joint mode with respect to single modes as the same residual is used for both chroma blocks -#if JVET_O0105_ICT const int absIct = abs( TU::getICTMode(tu) ); const double lfact = ( absIct == 1 || absIct == 3 ? 0.8 : 0.5 ); m_pcTrQuant->setLambda( lfact * m_pcTrQuant->getLambda() ); -#else - m_pcTrQuant->setLambda( 0.60 * m_pcTrQuant->getLambda() ); -#endif } -#if JVET_O0105_ICT -#if JVET_O0376_SPS_JOINTCBCR_FLAG if ( sps.getJointCbCrEnabledFlag() && isChroma(compID) && (tu.cu->cs->slice->getSliceQp() > 18) ) { m_pcTrQuant->setLambda( 1.3 * m_pcTrQuant->getLambda() ); } -#else - if( isChroma(compID) && tu.cu->cs->slice->getSliceQp() > 18 ) - { - m_pcTrQuant->setLambda( 1.3 * m_pcTrQuant->getLambda() ); - } -#endif -#else -#if JVET_O0376_SPS_JOINTCBCR_FLAG - else if ( sps.getJointCbCrEnabledFlag() && isChroma(compID) && (tu.cu->cs->slice->getSliceQp() > 18) ) -#else - else if ( isChroma(compID) && tu.cu->cs->slice->getSliceQp() > 18 ) -#endif - m_pcTrQuant->setLambda( 1.10 * m_pcTrQuant->getLambda() ); -#endif -#if JVET_O0105_ICT if( isLuma(compID) ) { -#endif -#if JVET_O0502_ISP_CLEANUP if (trModes) { m_pcTrQuant->transformNxN(tu, compID, cQP, trModes, CU::isIntra(*tu.cu) ? m_pcEncCfg->getIntraMTSMaxCand() : m_pcEncCfg->getInterMTSMaxCand()); tu.mtsIdx = trModes->at(0).first; } m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); -#else - double diagRatio = 0, horVerRatio = 0; - - if( trModes ) - { - m_pcTrQuant->transformNxN( tu, compID, cQP, trModes, CU::isIntra( *tu.cu ) ? m_pcEncCfg->getIntraMTSMaxCand() : m_pcEncCfg->getInterMTSMaxCand(), ispSplitIsAllowed ? &diagRatio : nullptr, ispSplitIsAllowed ? &horVerRatio : nullptr ); - tu.mtsIdx = trModes->at(0).first; - } - m_pcTrQuant->transformNxN( tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr, &diagRatio, &horVerRatio ); - if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == MTS_DCT2_DCT2 && ispSplitIsAllowed ) - { - m_intraModeDiagRatio .push_back(diagRatio); - m_intraModeHorVerRatio .push_back(horVerRatio); - m_intraModeTestedNormalIntra.push_back((int)uiChFinalMode); - } -#endif DTRACE( g_trace_ctx, D_TU_ABS_SUM, "%d: comp=%d, abssum=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_TU_ABS_SUM ), compID, uiAbsSum ); -#if JVET_O0502_ISP_CLEANUP if (tu.cu->ispMode && isLuma(compID) && CU::isISPLast(*tu.cu, area, area.compID) && CU::allLumaCBFsAreZero(*tu.cu)) { // ISP has to have at least one non-zero CBF ruiDist = MAX_INT; return; } -#endif //--- inverse transform --- @@ -3005,7 +2443,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp { piResi.fill(0); } -#if JVET_O0105_ICT } else // chroma { @@ -3049,28 +2486,23 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp uiAbsSum = codedCbfMask; } } -#endif //===== reconstruction ===== if ( flag && uiAbsSum > 0 && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag() ) { piResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID)); -#if JVET_O0105_ICT if( jointCbCr ) { crResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(COMPONENT_Cr)); } -#endif } if (bUseCrossCPrediction) { CrossComponentPrediction::crossComponentPrediction(tu, compID, cs.getResiBuf(tu.Y()), piResi, piResi, true); -#if JVET_O0105_ICT if( jointCbCr ) { CrossComponentPrediction::crossComponentPrediction(tu, COMPONENT_Cr, cs.getResiBuf(tu.Y()), crResi, crResi, true); } -#endif } if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && compID == COMPONENT_Y) @@ -3081,7 +2513,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp piReco.reconstruct(tmpPred, piResi, cs.slice->clpRng(compID)); } else -#if JVET_O0105_ICT { piReco.reconstruct(piPred, piResi, cs.slice->clpRng( compID )); if( jointCbCr ) @@ -3089,43 +2520,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp crReco.reconstruct(crPred, crResi, cs.slice->clpRng( COMPONENT_Cr )); } } -#else - piReco.reconstruct(piPred, piResi, cs.slice->clpRng( compID )); -#endif -#if !JVET_O0105_ICT - if ( jointCbCr ) - { - // Cr uses negative of the signalled Cb residual - if (uiAbsSum > 0) - crResi.copyAndNegate( piResi ); - else - crResi.fill(0); - - tu.getCoeffs(COMPONENT_Cr).fill(0); - - // Set cbf also for Cr - TU::setCbfAtDepth (tu, COMPONENT_Cr, tu.depth, uiAbsSum > 0 ? true : false); - - // Cr reconstruction and its contribution to the total error - crReco.reconstruct(crPred, crResi, cs.slice->clpRng( COMPONENT_Cr )); - -#if WCG_EXT - if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || - (m_pcEncCfg->getReshaper() - && slice.getLmcsEnabledFlag() - && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) - { - const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] ); - ruiDist += m_pcRdCost->getDistPart( crOrg, crReco, bitDepth, COMPONENT_Cr, DF_SSE_WTD, &orgLuma ); - } - else -#endif - { - ruiDist += m_pcRdCost->getDistPart( crOrg, crReco, bitDepth, COMPONENT_Cr, DF_SSE ); - } - } -#endif //===== update distortion ===== #if WCG_EXT @@ -3142,7 +2537,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp ruiDist += m_pcRdCost->getDistPart(piOrg, tmpRecLuma, sps.getBitDepth(toChannelType(compID)), compID, DF_SSE_WTD, &orgLuma); } else -#if JVET_O0105_ICT { ruiDist += m_pcRdCost->getDistPart(piOrg, piReco, bitDepth, compID, DF_SSE_WTD, &orgLuma); if( jointCbCr ) @@ -3150,24 +2544,18 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp ruiDist += m_pcRdCost->getDistPart(crOrg, crReco, bitDepth, COMPONENT_Cr, DF_SSE_WTD, &orgLuma); } } -#else - ruiDist += m_pcRdCost->getDistPart(piOrg, piReco, bitDepth, compID, DF_SSE_WTD, &orgLuma); -#endif } else #endif { ruiDist += m_pcRdCost->getDistPart( piOrg, piReco, bitDepth, compID, DF_SSE ); -#if JVET_O0105_ICT if( jointCbCr ) { ruiDist += m_pcRdCost->getDistPart( crOrg, crReco, bitDepth, COMPONENT_Cr, DF_SSE ); } -#endif } } -#if JVET_O0502_ISP_CLEANUP bool IntraSearch::xIntraCodingLumaISP(CodingStructure& cs, Partitioner& partitioner, const double bestCostSoFar) { int subTuCounter = 0; @@ -3276,7 +2664,6 @@ bool IntraSearch::xIntraCodingLumaISP(CodingStructure& cs, Partitioner& partitio } return !earlySkipISP; } -#endif bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &partitioner, const double bestCostSoFar, const int subTuIdx, const PartSplit ispType, const bool ispIsCurrentWinner, bool mtsCheckRangeFlag, int mtsFirstCheckId, int mtsLastCheckId, bool moreProbMTSIdxFirst ) @@ -3304,11 +2691,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par double dSingleCost = MAX_DOUBLE; Distortion uiSingleDistLuma = 0; uint64_t singleFracBits = 0; -#if JVET_O1136_TS_BDPCM_SIGNALLING bool checkTransformSkip = sps.getTransformSkipEnabledFlag(); -#else - bool checkTransformSkip = pps.getUseTransformSkip(); -#endif int bestModeId[ MAX_NUM_COMPONENT ] = { 0, 0, 0 }; uint8_t nNumTransformCands = cu.mtsFlag ? 4 : 1; uint8_t numTransformIndexCands = nNumTransformCands; @@ -3435,14 +2818,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par tu.mtsIdx = trModes[ modeId ].first; } -#if !JVET_O0925_MIP_SIMPLIFICATIONS - //we compare the best cost for non lwip - const double thresholdSkipMode = 1.0 + (1.4 / sqrt((double)(cu.lwidth() * cu.lheight()))); - if ( cu.mipFlag && tu.mtsIdx && m_bestCostNonMip != MAX_DOUBLE && m_bestCostNonMip * thresholdSkipMode < bestDCT2cost ) - { - continue; - } -#endif if ((modeId != firstCheckId) && isNotOnlyOneMode) { @@ -3569,12 +2944,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { bestDCT2cost = singleCostTmp; } -#if !JVET_O0925_MIP_SIMPLIFICATIONS - if (!cu.ispMode && !cu.mipFlag && tu.mtsIdx == MTS_DCT2_DCT2 ) - { - m_bestCostNonMip = std::min(m_bestCostNonMip, singleCostTmp); - } -#endif if (singleCostTmp < dSingleCost) { @@ -3786,15 +3155,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio TransformUnit &currTU = *cs.getTU( currArea.chromaPos(), CHANNEL_TYPE_CHROMA ); const PredictionUnit &pu = *cs.getPU( currArea.chromaPos(), CHANNEL_TYPE_CHROMA ); -#if JVET_O0105_ICT bool lumaUsesISP = false; -#else -#if JVET_O0050_LOCAL_DUAL_TREE - bool lumaUsesISP = !currTU.cu->isSepTree() && currTU.cu->ispMode; -#else - bool lumaUsesISP = !CS::isDualITree( cs ) && currTU.cu->ispMode; -#endif -#endif uint32_t currDepth = partitioner.currTrDepth; const PPS &pps = *cs.pps; ChromaCbfs cbfs ( false ); @@ -3813,11 +3174,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio saveCS.area.repositionTo( cs.area ); saveCS.initStructData( MAX_INT, false, true ); -#if JVET_O0050_LOCAL_DUAL_TREE if( !currTU.cu->isSepTree() && currTU.cu->ispMode ) -#else - if( !CS::isDualITree( cs ) && currTU.cu->ispMode ) -#endif { saveCS.clearCUs(); CodingUnit& auxCU = saveCS.addCU( *currTU.cu, partitioner.chType ); @@ -3871,7 +3228,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio predIntraAng( COMPONENT_Cr, piPredCr, pu); } -#if JVET_O0105_ICT // determination of chroma residuals including reshaping and cross-component prediction //----- get chroma residuals ----- PelBuf resiCb = cs.getResiBuf(cbArea); @@ -3888,14 +3244,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { const Area area = currTU.Y().valid() ? currTU.Y() : Area(recalcPosition(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].pos()), recalcSize(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].size())); const CompArea &areaY = CompArea(COMPONENT_Y, currTU.chromaFormat, area); -#if JVET_O1109_UNFIY_CRS int adj = m_pcReshape->calculateChromaAdjVpduNei(currTU, areaY); -#else - PelBuf piPredY; - piPredY = cs.picture->getPredBuf(areaY); - const Pel avgLuma = piPredY.computeAvg(); - int adj = m_pcReshape->calculateChromaAdj(avgLuma); -#endif currTU.setChromaAdj(adj); } @@ -3932,7 +3281,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio orgResiCr[k].scaleSignal( cResScaleInv, 1, currTU.cu->cs->slice->clpRng(COMPONENT_Cr) ); } } -#endif for( uint32_t c = COMPONENT_Cb; c < numTBlocks; c++) { @@ -3944,9 +3292,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio Distortion singleDistCTmp = 0; double singleCostTmp = 0; -#if !JVET_O0105_ICT - const bool checkCrossComponentPrediction = PU::isChromaIntraModeCrossCheckMode( pu ) && pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && TU::getCbf( currTU, COMPONENT_Y ); -#endif const int crossCPredictionModesToTest = checkCrossComponentPrediction ? 2 : 1; const int totalModesToTest = crossCPredictionModesToTest; const bool isOneMode = false; @@ -3964,14 +3309,10 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { for (int crossCPredictionModeId = 0; crossCPredictionModeId < crossCPredictionModesToTest; crossCPredictionModeId++) { -#if JVET_O0105_ICT resiCb.copyFrom( orgResiCb[4*crossCPredictionModeId] ); resiCr.copyFrom( orgResiCr[4*crossCPredictionModeId] ); currTU.compAlpha [compID] = ( crossCPredictionModeId ? compAlpha[compID] : 0 ); -#else - currTU.compAlpha [compID] = 0; -#endif currModeId++; @@ -4068,40 +3409,22 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio double bestCostCbCr = bestCostCb + bestCostCr; Distortion bestDistCbCr = bestDistCb + bestDistCr; int bestJointCbCr = 0; -#if JVET_O0105_ICT bool lastIsBest = false; std::vector<int> jointCbfMasksToTest; -#if JVET_O0376_SPS_JOINTCBCR_FLAG if ( cs.sps->getJointCbCrEnabledFlag() && (TU::getCbf(tmpTU, COMPONENT_Cb) || TU::getCbf(tmpTU, COMPONENT_Cr))) { jointCbfMasksToTest = m_pcTrQuant->selectICTCandidates(currTU, orgResiCb, orgResiCr); } -#else - if (TU::getCbf(tmpTU, COMPONENT_Cb) || TU::getCbf(tmpTU, COMPONENT_Cr)) - { - jointCbfMasksToTest = m_pcTrQuant->selectICTCandidates(currTU, orgResiCb, orgResiCr); - } -#endif for( int cbfMask : jointCbfMasksToTest ) -#else - bool checkJointCbCr = TU::getCbf(tmpTU, COMPONENT_Cb) || TU::getCbf(tmpTU, COMPONENT_Cr); - - if ( checkJointCbCr ) -#endif { Distortion distTmp = 0; -#if JVET_O0105_ICT currTU.jointCbCr = (uint8_t)cbfMask; -#else - currTU.jointCbCr = 1; -#endif currTU.compAlpha[COMPONENT_Cb] = 0; currTU.compAlpha[COMPONENT_Cr] = 0; m_CABACEstimator->getCtx() = ctxStartTU; -#if JVET_O0105_ICT resiCb.copyFrom( orgResiCb[cbfMask] ); resiCr.copyFrom( orgResiCr[cbfMask] ); xIntraCodingTUBlock( currTU, COMPONENT_Cb, false, distTmp, 0 ); @@ -4112,18 +3435,11 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio uint64_t bits = xGetIntraFracBitsQTChroma( currTU, COMPONENT_Cb ); costTmp = m_pcRdCost->calcRdCost( bits, distTmp ); } -#else - xIntraCodingTUBlock( currTU, COMPONENT_Cb, false, distTmp, 0 ); - - uint64_t bits = xGetIntraFracBitsQTChroma( currTU, COMPONENT_Cb ); - double costTmp = m_pcRdCost->calcRdCost( bits, distTmp ); -#endif if( costTmp < bestCostCbCr ) { bestCostCbCr = costTmp; bestDistCbCr = distTmp; -#if JVET_O0105_ICT bestJointCbCr = currTU.jointCbCr; // store data @@ -4152,18 +3468,11 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { lastIsBest = true; } -#else - bestJointCbCr = 1; -#endif } } // Retrieve the best CU data (unless it was the very last one tested) -#if JVET_O0105_ICT if ( !( maxModesTested == 1 && jointCbfMasksToTest.empty() ) && !lastIsBest ) -#else - if ( !(maxModesTested == 1 && !checkJointCbCr) && bestJointCbCr == 0 ) -#endif { #if KEEP_PRED_AND_RESI_SIGNALS cs.getPredBuf (cbArea).copyFrom(saveCS.getPredBuf (cbArea)); @@ -4197,11 +3506,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio cbfs.cbf(COMPONENT_Cb) = TU::getCbf(currTU, COMPONENT_Cb); cbfs.cbf(COMPONENT_Cr) = TU::getCbf(currTU, COMPONENT_Cr); -#if JVET_O0105_ICT currTU.jointCbCr = ( (cbfs.cbf(COMPONENT_Cb) + cbfs.cbf(COMPONENT_Cr)) ? bestJointCbCr : 0 ); -#else - currTU.jointCbCr = cbfs.cbf(COMPONENT_Cb) ? bestJointCbCr : 0; -#endif cs.dist += bestDistCbCr; } } @@ -4293,11 +3598,7 @@ void IntraSearch::encPredIntraDPCM( const ComponentID &compID, PelBuf &pOrg, Pel { CHECK( pOrg.buf == 0, "Encoder DPCM called without original buffer" ); -#if FLATTEN_BUFFERS const int srcStride = m_refBufferStride[compID]; -#else - const int srcStride = m_topRefLength + 1; -#endif CPelBuf pSrc = CPelBuf(getPredictorPtr(compID), srcStride, m_leftRefLength + 1); // Sample Adaptive intra-Prediction (SAP) @@ -4306,11 +3607,7 @@ void IntraSearch::encPredIntraDPCM( const ComponentID &compID, PelBuf &pOrg, Pel // left column filled with reference samples, remaining columns filled with pOrg data for( int y = 0; y < pDst.height; y++ ) { -#if FLATTEN_BUFFERS pDst.at(0, y) = pSrc.at(1 + y, 1); -#else - pDst.at( 0, y ) = pSrc.at( 0, 1 + y ); -#endif } CPelBuf orgRest = pOrg.subBuf( 0, 0, pOrg.width - 1, pOrg.height ); PelBuf predRest = pDst.subBuf( 1, 0, pDst.width - 1, pDst.height ); @@ -4336,7 +3633,6 @@ bool IntraSearch::useDPCMForFirstPassIntraEstimation( const PredictionUnit &pu, return CU::isRDPCMEnabled( *pu.cu ) && pu.cu->transQuantBypass && (uiDirMode == HOR_IDX || uiDirMode == VER_IDX); } -#if JVET_O0925_MIP_SIMPLIFICATIONS template<typename T, size_t N> void IntraSearch::reduceHadCandList(static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, int& numModesForFullRD, const double thresholdHadCost, const double* mipHadCost, const PredictionUnit &pu, const bool fastMip) { @@ -4411,66 +3707,7 @@ void IntraSearch::reduceHadCandList(static_vector<T, N>& candModeList, static_ve candCostList = tempCandCostList; numModesForFullRD = int(candModeList.size()); } -#else -template<typename T, size_t N> -void IntraSearch::reduceHadCandList(static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, int& numModesForFullRD, const double thresholdHadCost, const double thresholdHadCostConv) -{ - CHECKD(candModeList.size() != numModesForFullRD, "Error: list size"); - CHECKD(candCostList.size() != numModesForFullRD, "Error: list size"); - const int maxCandPerType = numModesForFullRD >> 1; - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> tempRdModeList; - static_vector<double, FAST_UDI_MAX_RDMODE_NUM> tempCandCostList; - const double minCost = candCostList[0]; - - int numConv = 0; - for (int idx = 0; idx < candModeList.size(); idx++) - { - ModeInfo uiOrgMode = candModeList[idx]; - if (!uiOrgMode.mipFlg) { numConv++; } - - if (uiOrgMode.mipFlg || (numConv <= maxCandPerType)) - { - tempRdModeList.push_back(uiOrgMode); - tempCandCostList.push_back(candCostList[idx]); - } - else if (candCostList[idx] < thresholdHadCostConv * minCost) - { - tempRdModeList.push_back(uiOrgMode); - tempCandCostList.push_back(candCostList[idx]); - } - } - candModeList = tempRdModeList; - candCostList = tempCandCostList; - - int numMip = 0; - tempRdModeList.clear(); - tempCandCostList.clear(); - for (int idx = 0; idx < candModeList.size(); idx++) - { - ModeInfo uiOrgMode = candModeList[idx]; - if (uiOrgMode.mipFlg) - { - numMip++; - } - if (!uiOrgMode.mipFlg || (numMip <= maxCandPerType)) - { - tempRdModeList.push_back(uiOrgMode); - tempCandCostList.push_back(candCostList[idx]); - } - else if (candCostList[idx] < thresholdHadCost * minCost) - { - tempRdModeList.push_back(uiOrgMode); - tempCandCostList.push_back(candCostList[idx]); - } - } - candModeList = tempRdModeList; - candCostList = tempCandCostList; - numModesForFullRD = int(candModeList.size()); -} -#endif - -#if JVET_O0502_ISP_CLEANUP // It decides which modes from the ISP lists can be full RD tested void IntraSearch::xGetNextISPMode(ModeInfo& modeInfo, const ModeInfo* lastMode, const Size cuSize) { @@ -4728,4 +3965,3 @@ void IntraSearch::xSortISPCandList(double bestCostSoFar, double bestNonISPCost) } } -#endif diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index a621ba2a4d5525593b5d9e1583f4b138ea794810..664d0b39229c5737737b91b8db9b9043131f00fb 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -58,7 +58,6 @@ // ==================================================================================================================== class EncModeCtrl; -#if JVET_O0119_BASE_PALETTE_444 enum PLTScanMode { PLT_SCAN_HORTRAV = 0, @@ -162,7 +161,6 @@ private: uint32_t cnt; int shift, lastCnt, data[3], sumData[3]; }; -#endif /// encoder search class class IntraSearch : public IntraPrediction, CrossComponentPrediction { @@ -180,12 +178,10 @@ private: CodingStructure **m_pSaveCS; -#if JVET_O0050_LOCAL_DUAL_TREE bool m_saveCuCostInSCIPU; uint8_t m_numCuInSCIPU; Area m_cuAreaInSCIPU[NUM_INTER_CU_INFO_SAVE]; double m_cuCostInSCIPU[NUM_INTER_CU_INFO_SAVE]; -#endif struct ModeInfo { @@ -198,7 +194,6 @@ private: ModeInfo(const bool mipf, const int mrid, const uint8_t ispm, const uint32_t mode) : mipFlg(mipf), mRefId(mrid), ispMod(ispm), modeId(mode) {} bool operator==(const ModeInfo cmp) const { return (mipFlg == cmp.mipFlg && mRefId == cmp.mRefId && ispMod == cmp.ispMod && modeId == cmp.modeId); } }; -#if JVET_O0502_ISP_CLEANUP struct ModeInfoWithCost : public ModeInfo { double rdCost; @@ -318,11 +313,6 @@ private: static_vector<ModeInfoWithCost, FAST_UDI_MAX_RDMODE_NUM> m_regIntraRDListWithCosts; ISPTestedModesInfo m_ispTestedModes; -#else - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> m_rdModeListWithoutMrl; - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> m_rdModeListWithoutMrlHor; - static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> m_rdModeListWithoutMrlVer; -#endif //cost variables for the EMT algorithm and new modes list double m_bestModeCostStore[ NUM_LFNST_NUM_PER_SET ]; // RD cost of the best mode for each PU using DCT2 @@ -331,11 +321,6 @@ private: ModeInfo m_savedRdModeList[ NUM_LFNST_NUM_PER_SET ][ NUM_LUMA_MODE ]; int32_t m_savedNumRdModes[ NUM_LFNST_NUM_PER_SET ]; -#if !JVET_O0502_ISP_CLEANUP - static_vector<double, FAST_UDI_MAX_RDMODE_NUM> m_intraModeDiagRatio; - static_vector<double, FAST_UDI_MAX_RDMODE_NUM> m_intraModeHorVerRatio; - static_vector<int, FAST_UDI_MAX_RDMODE_NUM> m_intraModeTestedNormalIntra; -#endif static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> m_uiSavedRdModeListLFNST; static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> m_uiSavedHadModeListLFNST; @@ -383,26 +368,19 @@ public: void setModeCtrl ( EncModeCtrl *modeCtrl ) { m_modeCtrl = modeCtrl; } -#if JVET_O0050_LOCAL_DUAL_TREE bool getSaveCuCostInSCIPU () { return m_saveCuCostInSCIPU; } void setSaveCuCostInSCIPU ( bool b ) { m_saveCuCostInSCIPU = b; } void setNumCuInSCIPU ( uint8_t i ) { m_numCuInSCIPU = i; } void saveCuAreaCostInSCIPU ( Area area, double cost ); void initCuAreaCostInSCIPU (); double findInterCUCost ( CodingUnit &cu ); -#endif public: bool estIntraPredLumaQT ( CodingUnit &cu, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, bool mtsCheckRangeFlag = false, int mtsFirstCheckId = 0, int mtsLastCheckId = 0, bool moreProbMTSIdxFirst = false ); void estIntraPredChromaQT ( CodingUnit &cu, Partitioner& pm, const double maxCostAllowed = MAX_DOUBLE ); -#if !JVET_O0525_REMOVE_PCM - void IPCMSearch (CodingStructure &cs, Partitioner& partitioner); -#endif -#if JVET_O0119_BASE_PALETTE_444 void PLTSearch ( CodingStructure &cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); void deriveRunAndCalcBits ( CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, uint64_t& bits); -#endif uint64_t xFracModeBitsIntra (PredictionUnit &pu, const uint32_t &uiMode, const ChannelType &compID); void invalidateBestModeCost () { for( int i = 0; i < NUM_LFNST_NUM_PER_SET; i++ ) m_bestModeCostValid[ i ] = false; }; @@ -412,9 +390,6 @@ protected: // T & Q & Q-1 & T-1 // ------------------------------------------------------------------------------------------------------------------- -#if !JVET_O0525_REMOVE_PCM - void xEncPCM (CodingStructure &cs, Partitioner& partitioner, const ComponentID &compID); -#endif // ------------------------------------------------------------------------------------------------------------------- // Intra search @@ -433,33 +408,21 @@ protected: ChromaCbfs xRecurIntraChromaCodingQT( CodingStructure &cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, const PartSplit ispType = TU_NO_ISP ); bool xRecurIntraCodingLumaQT ( CodingStructure &cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, const int subTuIdx = -1, const PartSplit ispType = TU_NO_ISP, const bool ispIsCurrentWinner = false, bool mtsCheckRangeFlag = false, int mtsFirstCheckId = 0, int mtsLastCheckId = 0, bool moreProbMTSIdxFirst = false ); -#if JVET_O0502_ISP_CLEANUP bool xIntraCodingLumaISP ( CodingStructure& cs, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE ); -#endif void encPredIntraDPCM( const ComponentID &compID, PelBuf &pOrg, PelBuf &pDst, const uint32_t &uiDirMode ); static bool useDPCMForFirstPassIntraEstimation( const PredictionUnit &pu, const uint32_t &uiDirMode ); template<typename T, size_t N> -#if JVET_O0925_MIP_SIMPLIFICATIONS void reduceHadCandList(static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, int& numModesForFullRD, const double thresholdHadCost, const double* mipHadCost, const PredictionUnit &pu, const bool fastMip); -#else - void reduceHadCandList(static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, int& numModesForFullRD, const double thresholdHadCost, const double thresholdHadCostConv); - - double m_bestCostNonMip; -#endif -#if JVET_O0119_BASE_PALETTE_444 void deriveRun ( CodingStructure &cs, Partitioner& partitioner, ComponentID compBegin); double getRunBits (const CodingUnit& cu, uint32_t run, uint32_t strPos, PLTRunMode paletteRunMode, uint64_t* indexBits, uint64_t* runBits, ComponentID compBegin); void derivePLTLossy ( CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); void calcPixelPred ( CodingStructure& cs, Partitioner& partitioner, uint32_t yPos, uint32_t xPos, ComponentID compBegin, uint32_t numComp); void preCalcPLTIndex ( CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); -#endif -#if JVET_O0502_ISP_CLEANUP void xGetNextISPMode ( ModeInfo& modeInfo, const ModeInfo* lastMode, const Size cuSize ); void xFindAlreadyTestedNearbyIntraModes ( int currentIntraMode, int* leftIntraMode, int* rightIntraMode, ISPType ispOption, int windowSize ); void xSortISPCandList ( double bestCostSoFar, double bestNonISPCost ); -#endif };// END CLASS DEFINITION EncSearch //! \} diff --git a/source/Lib/EncoderLib/NALwrite.cpp b/source/Lib/EncoderLib/NALwrite.cpp index d317a45f2b33eae56516d6467c2fea2a4c95e249..54c8d15410c609861177636251d481f8f551f87c 100644 --- a/source/Lib/EncoderLib/NALwrite.cpp +++ b/source/Lib/EncoderLib/NALwrite.cpp @@ -49,7 +49,6 @@ static const uint8_t emulation_prevention_three_byte = 3; void writeNalUnitHeader(ostream& out, OutputNALUnit& nalu) // nal_unit_header() { OutputBitstream bsNALUHeader; -#if JVET_O0179 int forbiddenZero = 0; bsNALUHeader.write(forbiddenZero, 1); // forbidden_zero_bit int nuhReservedZeroBit = 0; @@ -58,18 +57,6 @@ OutputBitstream bsNALUHeader; bsNALUHeader.write(nalu.m_nuhLayerId, 6); // nuh_layer_id bsNALUHeader.write(nalu.m_nalUnitType, 5); // nal_unit_type bsNALUHeader.write(nalu.m_temporalId + 1, 3); // nuh_temporal_id_plus1 -#else - bool zeroTidRequiredFlag = 0; - if((nalu.m_nalUnitType >= 16) && (nalu.m_nalUnitType <= 31)) { - zeroTidRequiredFlag = 1; - } - bsNALUHeader.write(zeroTidRequiredFlag, 1); // zero_tid_required_flag - bsNALUHeader.write(nalu.m_temporalId+1, 3); // nuh_temporal_id_plus1 - uint32_t nalUnitTypeLsb = (nalu.m_nalUnitType) - (zeroTidRequiredFlag << 4); - bsNALUHeader.write(nalUnitTypeLsb, 4); // nal_unit_type_lsb - bsNALUHeader.write(nalu.m_nuhLayerId + 1, 7); // nuh_layer_id - bsNALUHeader.write(0, 1); // nuh_reserved_zero_bit -#endif out.write(reinterpret_cast<const char*>(bsNALUHeader.getByteStream()), bsNALUHeader.getByteStreamLength()); } diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index ef9f54a9aa252ae722d3407ad87e13259d506567..789be24478f5d5798cedde2fe8a7669d8f239778 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -199,44 +199,14 @@ void SEIEncoder::initSEISOPDescription(SEISOPDescription *sopDescriptionSEI, Sli { } #endif -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI) -#else void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI, bool noLeadingPictures) -#endif { CHECK(!(m_isInitialized), "bufferingPeriodSEI already initialized"); CHECK(!(bufferingPeriodSEI != nullptr), "Need a bufferingPeriodSEI for initialization (got nullptr)"); uint32_t uiInitialCpbRemovalDelay = (90000/2); // 0.5 sec -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - bufferingPeriodSEI->m_initialCpbRemovalDelay [0][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialCpbRemovalDelayOffset[0][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialCpbRemovalDelay [0][1] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialCpbRemovalDelayOffset[0][1] = uiInitialCpbRemovalDelay; - - bufferingPeriodSEI->m_initialAltCpbRemovalDelay [0][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialAltCpbRemovalDelayOffset[0][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialAltCpbRemovalDelay [0][1] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialAltCpbRemovalDelayOffset[0][1] = uiInitialCpbRemovalDelay; - - bufferingPeriodSEI->m_rapCpbParamsPresentFlag = 0; -#else -#if !JVET_N0867_TEMP_SCAL_HRD - bufferingPeriodSEI->m_initialCpbRemovalDelay [0].resize(1); - bufferingPeriodSEI->m_initialCpbRemovalOffset [0].resize(1); - bufferingPeriodSEI->m_initialCpbRemovalDelay [1].resize(1); - bufferingPeriodSEI->m_initialCpbRemovalOffset [1].resize(1); - bufferingPeriodSEI->m_initialCpbRemovalDelay [0][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialCpbRemovalOffset[0][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialCpbRemovalDelay [1][0] = uiInitialCpbRemovalDelay; - bufferingPeriodSEI->m_initialCpbRemovalOffset[1][0] = uiInitialCpbRemovalDelay; -#endif bufferingPeriodSEI->m_bpNalCpbParamsPresentFlag = true; bufferingPeriodSEI->m_bpVclCpbParamsPresentFlag = true; -#if !JVET_N0867_TEMP_SCAL_HRD - bufferingPeriodSEI->m_bpCpbCnt = 1; -#else bufferingPeriodSEI->m_bpMaxSubLayers = m_pcCfg->getMaxTempLayer() ; for(int i=0; i < bufferingPeriodSEI->m_bpMaxSubLayers; i++) { @@ -249,7 +219,6 @@ void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI, bufferingPeriodSEI->m_initialCpbRemovalOffset[j][i][1] = uiInitialCpbRemovalDelay; } } -#endif bufferingPeriodSEI->m_initialCpbRemovalDelayLength = 16; // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit // Note: The following parameters require some knowledge about the GOP structure. @@ -267,20 +236,12 @@ void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI, bufferingPeriodSEI->m_cpbRemovalDelayLength = 9; // max. 2^10 bufferingPeriodSEI->m_dpbOutputDelayLength = 9; // max. 2^10 } -#if JVET_O0189_DU bufferingPeriodSEI->m_duCpbRemovalDelayIncrementLength = 7; // ceil( log2( tick_divisor_minus2 + 2 ) ) bufferingPeriodSEI->m_dpbOutputDelayDuLength = bufferingPeriodSEI->m_dpbOutputDelayLength + bufferingPeriodSEI->m_duCpbRemovalDelayIncrementLength; -#endif -#endif //for the concatenation, it can be set to one during splicing. bufferingPeriodSEI->m_concatenationFlag = 0; //since the temporal layer HRDParameters is not ready, we assumed it is fixed bufferingPeriodSEI->m_auCpbRemovalDelayDelta = 1; -#if !FIX_SEI_O0189 - bufferingPeriodSEI->m_cpbDelayOffset = 0; - bufferingPeriodSEI->m_dpbDelayOffset = 0; -#endif -#if JVET_N0867_TEMP_SCAL_HRD bufferingPeriodSEI->m_cpbRemovalDelayDeltasPresentFlag = m_pcCfg->getBpDeltasGOPStructure() ; if (bufferingPeriodSEI->m_cpbRemovalDelayDeltasPresentFlag) { @@ -339,7 +300,6 @@ void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI, break; } } -#endif } #if HEVC_SEI @@ -409,13 +369,11 @@ void SEIEncoder::initDecodedPictureHashSEI(SEIDecodedPictureHash *decodedPicture } } -#if JVET_N0494_DRAP void SEIEncoder::initSEIDependentRAPIndication(SEIDependentRAPIndication *seiDependentRAPIndication) { CHECK(!(m_isInitialized), "Unspecified error"); CHECK(!(seiDependentRAPIndication!=NULL), "Unspecified error"); } -#endif #if HEVC_SEI void SEIEncoder::initTemporalLevel0IndexSEI(SEITemporalLevel0Index *temporalLevel0IndexSEI, Slice *slice) diff --git a/source/Lib/EncoderLib/SEIEncoder.h b/source/Lib/EncoderLib/SEIEncoder.h index 1e1e8b88cb31346a868810be9bf49073fe8431a7..e2ef5b277bb126ad88f776e7b9ece4e931564358 100644 --- a/source/Lib/EncoderLib/SEIEncoder.h +++ b/source/Lib/EncoderLib/SEIEncoder.h @@ -76,14 +76,8 @@ public: void initSEIToneMappingInfo(SEIToneMappingInfo *sei); void initSEISOPDescription(SEISOPDescription *sei, Slice *slice, int picInGOP, int lastIdr, int currGOPSize); #endif -#if JVET_N0494_DRAP void initSEIDependentRAPIndication(SEIDependentRAPIndication *sei); -#endif -#if !JVET_N0867_TEMP_SCAL_HRD - void initSEIBufferingPeriod(SEIBufferingPeriod *sei); -#else void initSEIBufferingPeriod(SEIBufferingPeriod *sei, bool noLeadingPictures); -#endif #if HEVC_SEI void initSEIScalableNesting(SEIScalableNesting *sei, SEIMessages &nestedSEIs); void initSEIRecoveryPoint(SEIRecoveryPoint *sei, Slice *slice); diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 1a704a4b0daf26aa877f8676f06f695c46e1ffa0..3b7969f8f383b12ed4bc5c9f00c544d5e556a405 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -41,15 +41,7 @@ //! \ingroup EncoderLib //! \{ -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void SEIWriter::xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const SPS *sps) -#else -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIWriter::xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const SPS *sps, HRD &hrd) -#else void SEIWriter::xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const SPS *sps, HRD &hrd, const uint32_t temporalId) -#endif -#endif { switch (sei.payloadType()) { @@ -61,59 +53,29 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei)); break; #endif -#if JVET_O0189_DU case SEI::DECODING_UNIT_INFO: xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps, hrd); -#else - case SEI::DECODING_UNIT_INFO: - xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps); -#endif break; case SEI::DECODED_PICTURE_HASH: xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); break; case SEI::BUFFERING_PERIOD: -#if !JVET_N0353_INDEP_BUFF_TIME_SEI xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps); -#else -#if JVET_O0189_DU - xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps); - hrd.setBufferingPeriodSEI(static_cast<const SEIBufferingPeriod*>(&sei)); -#else - xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei)); hrd.setBufferingPeriodSEI(static_cast<const SEIBufferingPeriod*>(&sei)); -#endif -#endif break; case SEI::PICTURE_TIMING: -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps); -#else { const SEIBufferingPeriod *bp = hrd.getBufferingPeriodSEI(); CHECK (bp == nullptr, "Buffering Period need to be initialized in HRD to allow writing of Picture Timing SEI"); -#if JVET_O0189_DU -#if !JVET_N0867_TEMP_SCAL_HRD - xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps, *bp); -#else xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps, *bp, temporalId); -#endif -#else - xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), *bp); -#endif } -#endif break; -#if JVET_O0041_FRAME_FIELD_SEI case SEI::FRAME_FIELD_INFO: xWriteSEIFrameFieldInfo(*static_cast<const SEIFrameFieldInfo*>(&sei)); break; -#endif -#if JVET_N0494_DRAP case SEI::DEPENDENT_RAP_INDICATION: xWriteSEIDependentRAPIndication(*static_cast<const SEIDependentRAPIndication*>(&sei)); break; -#endif #if HEVC_SEI case SEI::RECOVERY_POINT: xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei)); @@ -182,15 +144,7 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const /** * marshal all SEI messages in provided list into one bitstream bs */ -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIWriter::writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, const SPS *sps, HRD &hrd, bool isNested) -#else void SEIWriter::writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, const SPS *sps, HRD &hrd, bool isNested, const uint32_t temporalId) -#endif -#else -void SEIWriter::writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, const SPS *sps, bool isNested) -#endif { #if ENABLE_TRACING if (g_HLSTraceEnable) @@ -210,15 +164,7 @@ void SEIWriter::writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList bool traceEnable = g_HLSTraceEnable; g_HLSTraceEnable = false; #endif -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if !JVET_N0867_TEMP_SCAL_HRD - xWriteSEIpayloadData(bs_count, **sei, sps, hrd); -#else xWriteSEIpayloadData(bs_count, **sei, sps, hrd, temporalId); -#endif -#else - xWriteSEIpayloadData(bs_count, **sei, sps); -#endif #if ENABLE_TRACING g_HLSTraceEnable = traceEnable; #endif @@ -246,15 +192,7 @@ void SEIWriter::writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList xTraceSEIMessageType((*sei)->payloadType()); #endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - xWriteSEIpayloadData(bs, **sei, sps); -#else -#if !JVET_N0867_TEMP_SCAL_HRD - xWriteSEIpayloadData(bs_count, **sei, sps, hrd); -#else xWriteSEIpayloadData(bs_count, **sei, sps, hrd, temporalId); -#endif -#endif } if (!isNested) { @@ -322,80 +260,22 @@ void SEIWriter::xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei) } #endif -#if JVET_O0189_DU void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const SPS *sps, HRD &hrd) -#else -void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const SPS *sps) -#endif { WRITE_UVLC(sei.m_decodingUnitIdx, "decoding_unit_idx"); -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if(sps->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) -#else if(sps->getHrdParameters()->getDecodingUnitHrdParamsPresentFlag()) -#endif { -#if JVET_O0189_DU WRITE_CODE( sei.m_duSptCpbRemovalDelay, hrd.getBufferingPeriodSEI()->getDuCpbRemovalDelayIncrementLength(), "du_spt_cpb_removal_delay_increment"); -#else - WRITE_CODE( sei.m_duSptCpbRemovalDelay, (sps->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay_increment"); -#endif } WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); if(sei.m_dpbOutputDuDelayPresentFlag) { -#if JVET_O0189_DU WRITE_CODE(sei.m_picSptDpbOutputDuDelay, hrd.getBufferingPeriodSEI()->getDpbOutputDelayDuLength(), "pic_spt_dpb_output_du_delay"); -#else - WRITE_CODE(sei.m_picSptDpbOutputDuDelay, sps->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); -#endif } } -#if !JVET_N0353_INDEP_BUFF_TIME_SEI void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const SPS *sps) -#else -#if JVET_O0189_DU -void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const SPS *sps) -#else -void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) -#endif -#endif { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - int i, nalOrVcl; - const HRDParameters *hrd = sps->getHrdParameters(); - - WRITE_UVLC( sei.m_bpSeqParameterSetId, "bp_seq_parameter_set_id" ); - if( !hrd->getSubPicCpbParamsPresentFlag() ) - { - WRITE_FLAG( sei.m_rapCpbParamsPresentFlag, "irap_cpb_params_present_flag" ); - } - if( sei.m_rapCpbParamsPresentFlag ) - { - WRITE_CODE( sei.m_cpbDelayOffset, hrd->getCpbRemovalDelayLengthMinus1() + 1, "cpb_delay_offset" ); - WRITE_CODE( sei.m_dpbDelayOffset, hrd->getDpbOutputDelayLengthMinus1() + 1, "dpb_delay_offset" ); - } - WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag"); - WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_delta_minus1" ); - for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) - { - if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) - { - for( i = 0; i < ( hrd->getCpbCntMinus1( 0 ) + 1 ); i ++ ) - { - WRITE_CODE( sei.m_initialCpbRemovalDelay[i][nalOrVcl],( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , "initial_cpb_removal_delay" ); - WRITE_CODE( sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl],( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ), "initial_cpb_removal_delay_offset" ); - if( hrd->getSubPicCpbParamsPresentFlag() || sei.m_rapCpbParamsPresentFlag ) - { - WRITE_CODE( sei.m_initialAltCpbRemovalDelay[i][nalOrVcl], ( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , "initial_alt_cpb_removal_delay" ); - WRITE_CODE( sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl], ( hrd->getInitialCpbRemovalDelayLengthMinus1() + 1 ),"initial_alt_cpb_removal_delay_offset" ); - } - } - } - } -#else WRITE_FLAG( sei.m_bpNalCpbParamsPresentFlag, "bp_nal_hrd_parameters_present_flag"); WRITE_FLAG( sei.m_bpVclCpbParamsPresentFlag, "bp_vcl_hrd_parameters_present_flag"); @@ -407,7 +287,6 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) WRITE_CODE( sei.m_cpbRemovalDelayLength - 1, 5, "cpb_removal_delay_length_minus1" ); CHECK (sei.m_dpbOutputDelayLength < 1, "sei.m_dpbOutputDelayLength must be > 0"); WRITE_CODE( sei.m_dpbOutputDelayLength - 1, 5, "dpb_output_delay_length_minus1" ); -#if JVET_O0189_DU if( sps->getHrdParameters()->getDecodingUnitHrdParamsPresentFlag() ) { CHECK (sei.m_duCpbRemovalDelayIncrementLength < 1, "sei.m_duCpbRemovalDelayIncrementLength must be > 0"); @@ -415,7 +294,6 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) CHECK (sei.m_dpbOutputDelayDuLength < 1, "sei.m_dpbOutputDelayDuLength must be > 0"); WRITE_CODE( sei.m_dpbOutputDelayDuLength - 1, 5, "dpb_output_delay_du_length_minus1" ); } -#endif } WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag"); @@ -423,10 +301,6 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) CHECK (sei.m_auCpbRemovalDelayDelta < 1, "sei.m_auCpbRemovalDelayDelta must be > 0"); WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, sei.m_cpbRemovalDelayLength, "au_cpb_removal_delay_delta_minus1" ); -#if !JVET_N0867_TEMP_SCAL_HRD - CHECK (sei.m_bpCpbCnt < 1, "sei.m_bpCpbCnt must be > 0"); - WRITE_UVLC( sei.m_bpCpbCnt - 1, "bp_cpb_cnt_minus1"); -#else WRITE_FLAG( sei.m_cpbRemovalDelayDeltasPresentFlag, "cpb_removal_delay_deltas_present_flag"); if (sei.m_cpbRemovalDelayDeltasPresentFlag) { @@ -439,23 +313,6 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) CHECK (sei.m_bpMaxSubLayers < 1, "bp_max_sub_layers_minus1 must be > 0"); WRITE_CODE( sei.m_bpMaxSubLayers - 1, 3, "bp_max_sub_layers_minus1" ); } -#endif -#if !JVET_N0867_TEMP_SCAL_HRD - for( int nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) - { - if( ( ( nalOrVcl == 0 ) && ( sei.m_bpNalCpbParamsPresentFlag ) ) || - ( ( nalOrVcl == 1 ) && ( sei.m_bpVclCpbParamsPresentFlag ) ) ) - { - CHECK (sei.m_initialCpbRemovalDelay[nalOrVcl].size() != sei.m_bpCpbCnt, "wrong number of values in m_initialCpbRemovalDelay"); - CHECK (sei.m_initialCpbRemovalOffset[nalOrVcl].size() != sei.m_bpCpbCnt, "wrong number of values in m_initialCpbRemovalOffset"); - for( int i = 0; i < sei.m_bpCpbCnt; i ++ ) - { - WRITE_CODE( sei.m_initialCpbRemovalDelay[nalOrVcl][i], sei.m_initialCpbRemovalDelayLength, nalOrVcl ? "vcl_initial_cpb_removal_delay" : "nal_initial_cpb_removal_delay" ); - WRITE_CODE( sei.m_initialCpbRemovalOffset[nalOrVcl][i], sei.m_initialCpbRemovalDelayLength, nalOrVcl ? "vcl_initial_cpb_removal_offset" : "nal_initial_cpb_removal_offset" ); - } - } - } -#else for( int i = 0; i < sei.m_bpMaxSubLayers; i ++ ) { CHECK (sei.m_bpCpbCnt[i] < 1, "sei.m_bpCpbCnt[i] must be > 0"); @@ -473,66 +330,10 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei) } } } -#endif -#endif } -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *sps) -#else -#if JVET_O0189_DU -#if !JVET_N0867_TEMP_SCAL_HRD -void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *sps, const SEIBufferingPeriod &bp) -#else void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *sps, const SEIBufferingPeriod &bp, const uint32_t temporalId) -#endif -#else -void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBufferingPeriod &bp) -#endif -#endif { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - int i; - const HRDParameters *hrd = sps->getHrdParameters(); -#endif -#if !JVET_O0041_FRAME_FIELD_SEI - { - WRITE_CODE( sei.m_picStruct, 4, "pic_struct" ); - WRITE_CODE( sei.m_sourceScanType, 2, "source_scan_type" ); - WRITE_FLAG( sei.m_duplicateFlag ? 1 : 0, "duplicate_flag" ); - } -#endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if( hrd->getCpbDpbDelaysPresentFlag() ) - { - WRITE_CODE( sei.m_auCpbRemovalDelay - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_minus1" ); - WRITE_CODE( sei.m_picDpbOutputDelay, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), "pic_dpb_output_delay" ); - if(hrd->getSubPicCpbParamsPresentFlag()) - { - WRITE_CODE(sei.m_picDpbOutputDuDelay, hrd->getDpbOutputDelayDuLengthMinus1()+1, "pic_dpb_output_du_delay" ); - } - if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) - { - WRITE_UVLC( sei.m_numDecodingUnitsMinus1, "num_decoding_units_minus1" ); - WRITE_FLAG( sei.m_duCommonCpbRemovalDelayFlag, "du_common_cpb_removal_delay_flag" ); - if( sei.m_duCommonCpbRemovalDelayFlag ) - { - WRITE_CODE( sei.m_duCommonCpbRemovalDelayMinus1, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), "du_common_cpb_removal_delay_minus1" ); - } - for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ ) - { - WRITE_UVLC( sei.m_numNalusInDuMinus1[ i ], "num_nalus_in_du_minus1"); - if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) ) - { - WRITE_CODE( sei.m_duCpbRemovalDelayMinus1[ i ], ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), "du_cpb_removal_delay_minus1" ); - } - } - } - } -#else -#if !JVET_N0867_TEMP_SCAL_HRD - WRITE_CODE( sei.m_auCpbRemovalDelay - 1, bp.m_cpbRemovalDelayLength, "cpb_removal_delay_minus1" ); -#else CHECK (sei.m_ptMaxSubLayers < 1, "pt_max_sub_layers_minus1 must be > 0"); WRITE_CODE( sei.m_ptMaxSubLayers - 1, 3, "pt_max_sub_layers_minus1" ); WRITE_CODE( sei.m_auCpbRemovalDelay[sei.m_ptMaxSubLayers - 1] - 1, bp.m_cpbRemovalDelayLength, "cpb_removal_delay_minus1[pt_max_sub_layers_minus1]" ); @@ -552,10 +353,7 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf } } } -#endif WRITE_CODE( sei.m_picDpbOutputDelay, bp.m_dpbOutputDelayLength, "dpb_output_delay" ); -#endif -#if JVET_O0189_DU if( sps->getHrdParameters()->getDecodingUnitHrdParamsPresentFlag() ) { WRITE_CODE( sei.m_picDpbOutputDuDelay, bp.m_dpbOutputDelayDuLength, "pic_dpb_output_du_delay" ); @@ -577,10 +375,8 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBuf } } } -#endif } -#if JVET_O0041_FRAME_FIELD_SEI void SEIWriter::xWriteSEIFrameFieldInfo(const SEIFrameFieldInfo& sei) { WRITE_FLAG( sei.m_fieldPicFlag ? 1 : 0, "field_pic_flag" ); @@ -605,14 +401,11 @@ void SEIWriter::xWriteSEIFrameFieldInfo(const SEIFrameFieldInfo& sei) WRITE_CODE( sei.m_sourceScanType, 2, "source_scan_type" ); WRITE_FLAG( sei.m_duplicateFlag ? 1 : 0, "duplicate_flag" ); } -#endif -#if JVET_N0494_DRAP void SEIWriter::xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& /*sei*/) { // intentionally empty } -#endif #if HEVC_SEI void SEIWriter::xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei) @@ -821,12 +614,8 @@ void SEIWriter::xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableN } // write nested SEI messages -#if JVET_N0353_INDEP_BUFF_TIME_SEI HRD hrd; writeSEImessages(bs, sei.m_nestedSEIs, sps, hrd, true); -#else - writeSEImessages(bs, sei.m_nestedSEIs, sps, true); -#endif } void SEIWriter::xWriteSEITempMotionConstrainedTileSets(const SEITempMotionConstrainedTileSets& sei) diff --git a/source/Lib/EncoderLib/SEIwrite.h b/source/Lib/EncoderLib/SEIwrite.h index 6f5ea13b479fb2a03b99a7007b88a95a0e0209d1..8c481f5c334e6c568753ce67c34c0602922ee76c 100644 --- a/source/Lib/EncoderLib/SEIwrite.h +++ b/source/Lib/EncoderLib/SEIwrite.h @@ -49,52 +49,19 @@ public: SEIWriter() {}; virtual ~SEIWriter() {}; -#if JVET_N0353_INDEP_BUFF_TIME_SEI -#if !JVET_N0867_TEMP_SCAL_HRD - void writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, const SPS *sps, HRD &hrd, bool isNested); -#else void writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, const SPS *sps, HRD &hrd, bool isNested, const uint32_t temporalId); -#endif -#else - void writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, const SPS *sps, bool isNested); -#endif protected: #if HEVC_SEI void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); #endif -#if JVET_O0189_DU void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const SPS *sps, HRD &hrd); -#else - void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const SPS *sps); -#endif void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei); -#if !JVET_N0353_INDEP_BUFF_TIME_SEI void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const SPS *sps); - void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *sps); -#else -#if JVET_O0189_DU - void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const SPS *sps); -#else - void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei); -#endif -#if JVET_O0189_DU -#if !JVET_N0867_TEMP_SCAL_HRD - void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *sps, const SEIBufferingPeriod& bp); -#else void xWriteSEIPictureTiming(const SEIPictureTiming& sei,const SPS *sps, const SEIBufferingPeriod& bp, const uint32_t temporalId); -#endif -#else - void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBufferingPeriod& bp); -#endif -#endif -#if JVET_O0041_FRAME_FIELD_SEI void xWriteSEIFrameFieldInfo(const SEIFrameFieldInfo& sei); -#endif -#if JVET_N0494_DRAP void xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& sei); -#endif #if HEVC_SEI void xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei); void xWriteSEIFramePacking(const SEIFramePacking& sei); @@ -118,15 +85,7 @@ protected: void xWriteSEIGreenMetadataInfo(const SEIGreenMetadataInfo &sei); #endif -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const SPS *sps); -#else -#if !JVET_N0867_TEMP_SCAL_HRD - void xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const SPS *sps, HRD &hrd); -#else void xWriteSEIpayloadData(OutputBitstream& bs, const SEI& sei, const SPS *sps, HRD &hrd, const uint32_t temporalId); -#endif -#endif void xWriteByteAlign(); }; diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index c820fea1b95caea280ce72e8d8074f5e964579c7..d0346b12ef593a2ba61664681780e4b7407a98aa 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -157,30 +157,20 @@ void AUDWriter::codeAUD(OutputBitstream& bs, const int pictureType) xWriteRbspTrailingBits(); } -#if JVET_O0244_DELTA_POC void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc ) -#else -void HLSWriter::xCodeRefPicList(const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount) -#endif { WRITE_UVLC(rpl->getNumberOfShorttermPictures() + rpl->getNumberOfLongtermPictures(), "num_ref_entries[ listIdx ][ rplsIdx ]"); uint32_t numRefPic = rpl->getNumberOfShorttermPictures() + rpl->getNumberOfLongtermPictures(); -#if JVET_N0100_PROPOSAL1 if (isLongTermPresent) { WRITE_FLAG(rpl->getLtrpInSliceHeaderFlag(), "ltrp_in_slice_header_flag[ listIdx ][ rplsIdx ]"); } -#endif int prevDelta = MAX_INT; int deltaValue = 0; bool firstSTRP = true; for (int ii = 0; ii < numRefPic; ii++) { -#if JVET_N0494_DRAP if (isLongTermPresent) -#else - if (rpl->getNumberOfLongtermPictures() > 0) -#endif WRITE_FLAG(!rpl->isRefPicLongterm(ii), "st_ref_pic_flag[ listIdx ][ rplsIdx ][ i ]"); if (!rpl->isRefPicLongterm(ii)) { @@ -195,34 +185,24 @@ void HLSWriter::xCodeRefPicList(const ReferencePictureList* rpl, bool isLongTerm prevDelta = rpl->getRefPicIdentifier(ii); } unsigned int absDeltaValue = (deltaValue < 0) ? 0 - deltaValue : deltaValue; -#if JVET_O0244_DELTA_POC if( isForbiddenZeroDeltaPoc ) { CHECK( !absDeltaValue, "Zero delta POC is not used without WP" ); WRITE_UVLC( absDeltaValue - 1, "abs_delta_poc_st[ listIdx ][ rplsIdx ][ i ]" ); } else -#endif WRITE_UVLC(absDeltaValue, "abs_delta_poc_st[ listIdx ][ rplsIdx ][ i ]"); if (absDeltaValue > 0) WRITE_FLAG((deltaValue < 0) ? 0 : 1, "strp_entry_sign_flag[ listIdx ][ rplsIdx ][ i ]"); //0 means negative delta POC : 1 means positive } -#if JVET_N0100_PROPOSAL1 else if (!rpl->getLtrpInSliceHeaderFlag()) -#else - else -#endif { WRITE_CODE(rpl->getRefPicIdentifier(ii), ltLsbBitsCount, "poc_lsb_lt[listIdx][rplsIdx][i]"); } } } -#if JVET_O1136_TS_BDPCM_SIGNALLING void HLSWriter::codePPS( const PPS* pcPPS, const SPS* pcSPS ) -#else -void HLSWriter::codePPS( const PPS* pcPPS ) -#endif { #if ENABLE_TRACING xTracePPSHeader (); @@ -231,7 +211,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC( pcPPS->getPPSId(), "pps_pic_parameter_set_id" ); WRITE_UVLC( pcPPS->getSPSId(), "pps_seq_parameter_set_id" ); -#if JVET_O1164_PS WRITE_UVLC( pcPPS->getPicWidthInLumaSamples(), "pic_width_in_luma_samples" ); WRITE_UVLC( pcPPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); Window conf = pcPPS->getConformanceWindow(); @@ -244,7 +223,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); } -#endif WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits"); @@ -253,7 +231,6 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); WRITE_FLAG(pcPPS->getRpl1IdxPresentFlag() ? 1 : 0, "rpl1IdxPresentFlag"); - #if JVET_O0238_PPS_OR_SLICE WRITE_FLAG( pcPPS->getConstantSliceHeaderParamsEnabledFlag(), "constant_slice_header_params_enabled_flag"); if ( pcPPS->getConstantSliceHeaderParamsEnabledFlag() ) { WRITE_CODE( pcPPS->getPPSDepQuantEnabledIdc(), 2, "pps_dep_quant_enabled_idc"); @@ -266,18 +243,13 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC( pcPPS->getPPSFiveMinusMaxNumSubblockMergeCandPlus1(), "pps_five_minus_max_num_subblock_merge_cand_plus1"); WRITE_UVLC( pcPPS->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1(), "pps_max_num_merge_cand_minus_max_num_triangle_cand_plus1"); } -#endif WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag" ); -#if JVET_O1136_TS_BDPCM_SIGNALLING if (pcSPS->getTransformSkipEnabledFlag()) { WRITE_UVLC(pcPPS->getLog2MaxTransformSkipBlockSize() - 2, "log2_max_transform_skip_block_size_minus2"); } -#else - WRITE_FLAG( pcPPS->getUseTransformSkip() ? 1 : 0, "transform_skip_enabled_flag" ); -#endif WRITE_FLAG( pcPPS->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag" ); if ( pcPPS->getUseDQP() ) { @@ -300,9 +272,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) { WRITE_SVLC(pcPPS->getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CbOffset, "cb_qp_offset_list[i]"); WRITE_SVLC(pcPPS->getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CrOffset, "cr_qp_offset_list[i]"); -#if JVET_O1168_CU_CHROMA_QP_OFFSET WRITE_SVLC(pcPPS->getChromaQpOffsetListEntry(cuChromaQpOffsetIdx + 1).u.comp.JointCbCrOffset, "joint_cbcr_qp_offset_list[i]"); -#endif } } @@ -336,58 +306,36 @@ void HLSWriter::codePPS( const PPS* pcPPS ) } } WRITE_FLAG( pcPPS->getBrickSplittingPresentFlag() ? 1 : 0, "brick_splitting_present_flag" ); -#if JVET_O0176_PROPOSAL3 if (pcPPS->getBrickSplittingPresentFlag()) { CHECK(pcPPS->getRectSliceFlag() != true, "rect_slice_flag must be equal to 1 for brick_splitting_present_flag equal to 1"); } -#endif -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int numTilesInPic = (pcPPS->getNumTileColumnsMinus1() + 1) * (pcPPS->getNumTileRowsMinus1() + 1); -#else - int numTilesInPic = pcPPS->getUniformTileSpacingFlag() ? 0 : (pcPPS->getNumTileColumnsMinus1() + 1) * (pcPPS->getNumTileRowsMinus1() + 1); -#endif -#if JVET_O0236_PPS_PARSING_DEPENDENCY if (pcPPS->getUniformTileSpacingFlag() && pcPPS->getBrickSplittingPresentFlag()) { WRITE_UVLC(numTilesInPic - 1, "num_tiles_in_pic_minus1"); } -#endif for( int i = 0; pcPPS->getBrickSplittingPresentFlag() && i < numTilesInPic; i++ ) { -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION if (pcPPS->getTileHeight(i) > 1) { -#endif WRITE_FLAG(pcPPS->getBrickSplitFlag(i) ? 1 : 0, "brick_split_flag [i]"); -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION } -#endif if( pcPPS->getBrickSplitFlag(i) ) { -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION if (pcPPS->getTileHeight(i) > 2) { -#endif WRITE_FLAG(pcPPS->getUniformBrickSpacingFlag(i) ? 1 : 0, "uniform_brick_spacing_flag [i]"); -#if JVET_O0452_PPS_BRICK_SIGNALING_CONDITION } -#endif if( pcPPS->getUniformBrickSpacingFlag(i) ) WRITE_UVLC( pcPPS->getBrickHeightMinus1(i), "brick_height_minus1" ); else { -#if JVET_O0173_O0176_O0338_NUMBRICK_M2 WRITE_UVLC(pcPPS->getNumBrickRowsMinus2(i), "num_brick_rows_minus2 [i]"); for (int j = 0; j <= pcPPS->getNumBrickRowsMinus2(i); j++) WRITE_UVLC(pcPPS->getBrickRowHeightMinus1(i, j), "brick_row_height_minus1 [i][j]"); -#else - WRITE_UVLC( pcPPS->getNumBrickRowsMinus1(i), "num_brick_rows_minus1 [i]" ); - for(int j = 0; j < pcPPS->getNumBrickRowsMinus1(i); j++ ) - WRITE_UVLC( pcPPS->getBrickRowHeightMinus1(i,j), "brick_row_height_minus1 [i][j]" ); -#endif } } } @@ -407,30 +355,14 @@ void HLSWriter::codePPS( const PPS* pcPPS ) { WRITE_UVLC( pcPPS->getNumSlicesInPicMinus1(), "num_slices_in_pic_minus1" ); int numSlicesInPic = pcPPS->getNumSlicesInPicMinus1() + 1; -#if !JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA - int numTilesInPic = (pcPPS->getNumTileColumnsMinus1() + 1) * (pcPPS->getNumTileRowsMinus1() + 1); -#endif int codeLength = ceilLog2(numTilesInPic); -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA WRITE_UVLC(codeLength, "bottom_right_brick_idx_length_minus1 "); -#else - int codeLength2 = codeLength; -#endif for (int i = 0; i < numSlicesInPic; ++i) { -#if JVET_O0143_BOTTOM_RIGHT_BRICK_IDX_DELTA int delta = (i == 0) ? pcPPS->getBottomRightBrickIdx(i) : pcPPS->getBottomRightBrickIdx(i) - pcPPS->getBottomRightBrickIdx(i - 1); int sign = (delta > 0) ? 1 : 0; WRITE_CODE(delta, codeLength, "bottom_right_brick_idx_delta"); WRITE_FLAG(sign, "brick_idx_delta_sign_flag"); -#else - if (i > 0) - { - WRITE_CODE(pcPPS->getTopLeftBrickIdx(i), codeLength, "top_left_brick_idx "); - codeLength2 = ceilLog2((numTilesInPic - pcPPS->getTopLeftBrickIdx(i) < 2) ? 2 : numTilesInPic - pcPPS->getTopLeftBrickIdx(i)); - } - WRITE_CODE(pcPPS->getBottomRightBrickIdx(i) - pcPPS->getTopLeftBrickIdx(i), codeLength2, "bottom_right_brick_idx_delta"); -#endif } } @@ -493,29 +425,12 @@ void HLSWriter::codePPS( const PPS* pcPPS ) } } -#if !JVET_O0299_APS_SCALINGLIST - WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag" ); - if( pcPPS->getScalingListPresentFlag() ) - { - codeScalingList( pcPPS->getScalingList() ); - } -#endif WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); bool pps_extension_present_flag=false; bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS]={false}; -#if !JVET_O1136_TS_BDPCM_SIGNALLING - pps_extension_flags[PPS_EXT__REXT] = pcPPS->getPpsRangeExtension().settingsDifferFromDefaults(pcPPS->getUseTransformSkip()); - - // Other PPS extension flags checked here. - - for(int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) - { - pps_extension_present_flag|=pps_extension_flags[i]; - } -#endif WRITE_FLAG( (pps_extension_present_flag?1:0), "pps_extension_present_flag" ); if (pps_extension_present_flag) @@ -569,11 +484,7 @@ void HLSWriter::codeAPS( APS* pcAPS ) #endif WRITE_CODE(pcAPS->getAPSId(), 5, "adaptation_parameter_set_id"); -#if JVET_O0245_VPS_DPS_APS WRITE_CODE( (int)pcAPS->getAPSType(), 3, "aps_params_type" ); -#else - WRITE_CODE(pcAPS->getAPSType(), 3, "aps_params_type"); -#endif if (pcAPS->getAPSType() == ALF_APS) { @@ -583,12 +494,10 @@ void HLSWriter::codeAPS( APS* pcAPS ) { codeLmcsAps (pcAPS); } -#if JVET_O0299_APS_SCALINGLIST else if( pcAPS->getAPSType() == SCALING_LIST_APS ) { codeScalingListAps( pcAPS ); } -#endif WRITE_FLAG(0, "aps_extension_flag"); //Implementation when this flag is equal to 1 should be added when it is needed. Currently in the spec we don't have case when this flag is equal to 1 xWriteRbspTrailingBits(); } @@ -602,60 +511,22 @@ void HLSWriter::codeAlfAps( APS* pcAPS ) if (param.newFilterFlag[CHANNEL_TYPE_LUMA]) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_LUMA][0], "alf_luma_clip" ); -#else - WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_LUMA], "alf_luma_clip" ); -#endif -#if JVET_O0491_HLS_CLEANUP WRITE_UVLC(param.numLumaFilters - 1, "alf_luma_num_filters_signalled_minus1"); -#else - xWriteTruncBinCode(param.numLumaFilters - 1, MAX_NUM_ALF_CLASSES); //number_of_filters_minus1 -#endif if (param.numLumaFilters > 1) { -#if JVET_O0491_HLS_CLEANUP const int length = ceilLog2( param.numLumaFilters); -#endif for (int i = 0; i < MAX_NUM_ALF_CLASSES; i++) { -#if JVET_O0491_HLS_CLEANUP WRITE_CODE(param.filterCoeffDeltaIdx[i], length, "alf_luma_coeff_delta_idx" ); -#else - xWriteTruncBinCode((uint32_t)param.filterCoeffDeltaIdx[i], param.numLumaFilters); //filter_coeff_delta[i] -#endif } } -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - WRITE_FLAG(param.fixedFilterSetIndex > 0 ? 1 : 0, "fixed_filter_set_flag"); - if (param.fixedFilterSetIndex > 0) - { - xWriteTruncBinCode(param.fixedFilterSetIndex - 1, NUM_FIXED_FILTER_SETS); - WRITE_FLAG(param.fixedFilterPattern, "fixed_filter_flag_pattern"); - for (int classIdx = 0; classIdx < MAX_NUM_ALF_CLASSES; classIdx++) - { - if (param.fixedFilterPattern > 0) - { - WRITE_FLAG(param.fixedFilterIdx[classIdx], "fixed_filter_flag"); - } - else - { - CHECK(param.fixedFilterIdx[classIdx] != 1, "Disabled fixed filter"); - } - } - } -#endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB alfFilter(param, false, 0); -#else - alfFilter(param, false); -#endif } if (param.newFilterFlag[CHANNEL_TYPE_CHROMA]) { -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( MAX_NUM_ALF_ALTERNATIVES_CHROMA > 1 ) WRITE_UVLC( param.numAlternativesChroma - 1, "alf_chroma_num_alts_minus1" ); for( int altIdx=0; altIdx < param.numAlternativesChroma; ++altIdx ) @@ -663,10 +534,6 @@ void HLSWriter::codeAlfAps( APS* pcAPS ) WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx], "alf_nonlinear_enable_flag_chroma" ); alfFilter(param, true, altIdx); } -#else - WRITE_FLAG(param.nonLinearFlag[CHANNEL_TYPE_CHROMA], "alf_chroma_clip"); - alfFilter(param, true); -#endif } } @@ -691,13 +558,11 @@ void HLSWriter::codeLmcsAps( APS* pcAPS ) } } -#if JVET_O0299_APS_SCALINGLIST void HLSWriter::codeScalingListAps( APS* pcAPS ) { ScalingList param = pcAPS->getScalingList(); codeScalingList( param ); } -#endif void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS ) { @@ -750,112 +615,25 @@ void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS ) } -#if !JVET_N0353_INDEP_BUFF_TIME_SEI -void HLSWriter::codeHrdParameters( const HRDParameters *hrd, bool commonInfPresentFlag, uint32_t maxNumSubLayersMinus1 ) -#else void HLSWriter::codeHrdParameters( const HRDParameters *hrd, const uint32_t firstSubLayer, const uint32_t maxNumSubLayersMinus1) -#endif { -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - if( commonInfPresentFlag ) - { - WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "nal_hrd_parameters_present_flag" ); - WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "vcl_hrd_parameters_present_flag" ); - if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) - { - WRITE_FLAG( hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0, "sub_pic_hrd_params_present_flag" ); - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - WRITE_CODE( hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2" ); - WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_increment_length_minus1" ); - WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); - WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1" ); - } - WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); - WRITE_CODE( hrd->getCpbSizeScale(), 4, "cpb_size_scale" ); - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - WRITE_CODE( hrd->getDuCpbSizeScale(), 4, "du_cpb_size_scale" ); - } - WRITE_CODE( hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1" ); - WRITE_CODE( hrd->getCpbRemovalDelayLengthMinus1(), 5, "au_cpb_removal_delay_length_minus1" ); - WRITE_CODE( hrd->getDpbOutputDelayLengthMinus1(), 5, "dpb_output_delay_length_minus1" ); - } - } - int i, j, nalOrVcl; - for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) - { - WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0, "fixed_pic_rate_general_flag"); - bool fixedPixRateWithinCvsFlag = true; - if( !hrd->getFixedPicRateFlag( i ) ) - { - fixedPixRateWithinCvsFlag = hrd->getFixedPicRateWithinCvsFlag( i ); - WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag"); - } - if( fixedPixRateWithinCvsFlag ) - { - WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); - } - else - { - WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag"); - } - if (!hrd->getLowDelayHrdFlag( i )) - { - WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); - } - - for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) - { - if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || - ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) - { - for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) - { - WRITE_UVLC( hrd->getBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_value_minus1"); - WRITE_UVLC( hrd->getCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_value_minus1"); - if( hrd->getSubPicCpbParamsPresentFlag() ) - { - WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); - WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1"); - } - WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); - } - } - } - } -#else WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "general_nal_hrd_parameters_present_flag" ); WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "general_vcl_hrd_parameters_present_flag" ); if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) { -#if JVET_O0189_DU WRITE_FLAG( hrd->getDecodingUnitHrdParamsPresentFlag() ? 1 : 0, "decoding_unit_hrd_params_present_flag" ); -#else - WRITE_FLAG( hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0, "decoding_unit_hrd_params_present_flag" ); -#endif -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) { WRITE_CODE( hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2" ); WRITE_FLAG( hrd->getDecodingUnitCpbParamsInPicTimingSeiFlag() ? 1 : 0, "decoding_unit_cpb_params_in_pic_timing_sei_flag" ); } -#endif -#if FIX_HRD_O0189 WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); WRITE_CODE( hrd->getCpbSizeScale(), 4, "cpb_size_scale" ); -#endif -#if JVET_O0189_DU if( hrd->getDecodingUnitHrdParamsPresentFlag() ) { WRITE_CODE( hrd->getCpbSizeDuScale(), 4, "cpb_size_du_scale" ); } -#endif } -#if !FIX_HRD_O0189 - WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); - WRITE_CODE( hrd->getCpbSizeScale(), 4, "cpb_size_scale" ); -#endif for( int i = firstSubLayer; i <= maxNumSubLayersMinus1; i ++ ) { @@ -893,7 +671,6 @@ void HLSWriter::codeHrdParameters( const HRDParameters *hrd, const uint32_t firs } } } -#endif } @@ -909,9 +686,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_CODE(0, 5, "sps_reserved_zero_5bits"); codeProfileTierLevel( pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1 ); -#if JVET_N0865_SYNTAX WRITE_FLAG(pcSPS->getGDREnabledFlag(), "gdr_enabled_flag"); -#endif WRITE_UVLC(pcSPS->getSPSId (), "sps_seq_parameter_set_id"); @@ -923,46 +698,24 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( 0, "separate_colour_plane_flag"); } -#if JVET_O1164_PS WRITE_UVLC( pcSPS->getMaxPicWidthInLumaSamples(), "pic_width_max_in_luma_samples" ); WRITE_UVLC( pcSPS->getMaxPicHeightInLumaSamples(), "pic_height_max_in_luma_samples" ); -#else - WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (), "pic_width_in_luma_samples" ); - WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); - Window conf = pcSPS->getConformanceWindow(); - - // KJS: not removing yet - WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_flag" ); - if (conf.getWindowEnabledFlag()) - { - WRITE_UVLC( conf.getWindowLeftOffset() / SPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_left_offset" ); - WRITE_UVLC( conf.getWindowRightOffset() / SPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_right_offset" ); - WRITE_UVLC( conf.getWindowTopOffset() / SPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_top_offset" ); - WRITE_UVLC( conf.getWindowBottomOffset() / SPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" ); - } -#endif WRITE_UVLC( pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) - 8, "bit_depth_luma_minus8" ); const bool chromaEnabled = isChromaEnabled(format); WRITE_UVLC( chromaEnabled ? (pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA) - 8):0, "bit_depth_chroma_minus8" ); -#if JVET_O0919_TS_MIN_QP WRITE_UVLC( pcSPS->getMinQpPrimeTsMinus4(CHANNEL_TYPE_LUMA), "min_qp_prime_ts_minus4" ); -#endif WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); WRITE_FLAG( pcSPS->getIDRRefParamListPresent(), "sps_idr_rpl_present_flag" ); // KJS: Marakech decision: sub-layers added back const bool subLayerOrderingInfoPresentFlag = 1; -#if JVET_O0178 if (pcSPS->getMaxTLayers() > 1) { WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); } -#else - WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); -#endif for(uint32_t i=0; i <= pcSPS->getMaxTLayers()-1; i++) { WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); @@ -986,11 +739,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) for (int ii = 0; ii < numberOfRPL; ii++) { const ReferencePictureList* rpl = rplList0->getReferencePictureList(ii); -#if JVET_O0244_DELTA_POC xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred() ); -#else - xCodeRefPicList(rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC()); -#endif } //Write candidate for List1 @@ -1001,19 +750,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) for (int ii = 0; ii < numberOfRPL; ii++) { const ReferencePictureList* rpl = rplList1->getReferencePictureList(ii); -#if JVET_O0244_DELTA_POC xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred() ); -#else - xCodeRefPicList(rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC()); -#endif } } WRITE_FLAG(pcSPS->getUseDualITree(), "qtbtt_dual_tree_intra_flag"); -#if JVET_O0526_MIN_CTU_SIZE WRITE_CODE(floorLog2(pcSPS->getCTUSize()) - 5, 2, "log2_ctu_size_minus5"); -#else - WRITE_UVLC(floorLog2(pcSPS->getCTUSize()) - MIN_CU_LOG2, "log2_ctu_size_minus2"); -#endif WRITE_UVLC(pcSPS->getLog2MinCodingBlockSize() - 2, "log2_min_luma_coding_block_size_minus2"); WRITE_FLAG(pcSPS->getSplitConsOverrideEnabledFlag(), "partition_constraints_override_enabled_flag"); WRITE_UVLC(floorLog2(pcSPS->getMinQTSize(I_SLICE)) - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice_luma"); @@ -1041,16 +782,8 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } -#if MAX_TB_SIZE_SIGNALLING -#if JVET_O0545_MAX_TB_SIGNALLING WRITE_FLAG( (pcSPS->getLog2MaxTbSize() - 5) ? 1 : 0, "sps_max_luma_transform_size_64_flag" ); -#else - // KJS: Not in syntax - WRITE_UVLC( pcSPS->getLog2MaxTbSize() - 2, "log2_max_luma_transform_block_size_minus2" ); -#endif -#endif -#if JVET_O0650_SIGNAL_CHROMAQP_MAPPING_TABLE if (pcSPS->getChromaFormatIdc() != CHROMA_400) { const ChromaQpMappingTable& chromaQpMappingTable = pcSPS->getChromaQpMappingTable(); @@ -1066,29 +799,14 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } } -#endif -#if JVET_O0244_DELTA_POC WRITE_FLAG( pcSPS->getUseWP() ? 1 : 0, "sps_weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) WRITE_FLAG( pcSPS->getUseWPBiPred() ? 1 : 0, "sps_weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) -#endif WRITE_FLAG( pcSPS->getSAOEnabledFlag(), "sps_sao_enabled_flag"); WRITE_FLAG( pcSPS->getALFEnabledFlag(), "sps_alf_enabled_flag" ); -#if !JVET_O0525_REMOVE_PCM - WRITE_FLAG( pcSPS->getPCMEnabledFlag() ? 1 : 0, "sps_pcm_enabled_flag"); - if( pcSPS->getPCMEnabledFlag() ) - { - WRITE_CODE( pcSPS->getPCMBitDepth(CHANNEL_TYPE_LUMA) - 1, 4, "pcm_sample_bit_depth_luma_minus1" ); - WRITE_CODE( chromaEnabled ? (pcSPS->getPCMBitDepth(CHANNEL_TYPE_CHROMA) - 1) : 0, 4, "pcm_sample_bit_depth_chroma_minus1" ); - WRITE_UVLC( pcSPS->getPCMLog2MinSize() - 3, "log2_min_pcm_luma_coding_block_size_minus3" ); - WRITE_UVLC( pcSPS->getPCMLog2MaxSize() - pcSPS->getPCMLog2MinSize(), "log2_diff_max_min_pcm_luma_coding_block_size" ); - WRITE_FLAG( pcSPS->getPCMFilterDisableFlag()?1 : 0, "pcm_loop_filter_disable_flag"); - } -#endif -#if JVET_O1136_TS_BDPCM_SIGNALLING WRITE_FLAG(pcSPS->getTransformSkipEnabledFlag() ? 1 : 0, "sps_transform_skip_enabled_flag"); if (pcSPS->getTransformSkipEnabledFlag()) { @@ -1098,23 +816,13 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) { CHECK(pcSPS->getBDPCMEnabledFlag(), "BDPCM cannot be used when transform skip is disabled"); } -#endif -#if JVET_O0376_SPS_JOINTCBCR_FLAG WRITE_FLAG( pcSPS->getJointCbCrEnabledFlag(), "sps_joint_cbcr_enabled_flag"); -#endif -#if !JVET_O1164_PS - if( pcSPS->getCTUSize() + 2*(1 << pcSPS->getLog2MinCodingBlockSize()) <= pcSPS->getPicWidthInLumaSamples() ) - { -#endif WRITE_FLAG( pcSPS->getWrapAroundEnabledFlag() ? 1 : 0, "sps_ref_wraparound_enabled_flag" ); if( pcSPS->getWrapAroundEnabledFlag() ) { WRITE_UVLC( (pcSPS->getWrapAroundOffset()/(1 << pcSPS->getLog2MinCodingBlockSize()))-1, "sps_ref_wraparound_offset_minus1" ); } -#if !JVET_O1164_PS - } -#endif WRITE_FLAG( pcSPS->getSPSTemporalMVPEnabledFlag() ? 1 : 0, "sps_temporal_mvp_enabled_flag" ); @@ -1126,9 +834,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getAMVREnabledFlag() ? 1 : 0, "sps_amvr_enabled_flag" ); WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" ); -#if !JVET_O0438_SPS_AFFINE_AMVR_FLAG - WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" ); -#endif WRITE_FLAG( pcSPS->getUseDMVR() ? 1 : 0, "sps_dmvr_enable_flag" ); WRITE_FLAG(pcSPS->getUseMMVD() ? 1 : 0, "sps_mmvd_enable_flag"); // KJS: sps_cclm_enabled_flag @@ -1151,20 +856,14 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) if ( pcSPS->getUseAffine() ) { WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0, "affine_type_flag" ); -#if JVET_O0070_PROF WRITE_FLAG( pcSPS->getUsePROF() ? 1 : 0, "sps_prof_enabled_flag" ); -#endif -#if JVET_O0438_SPS_AFFINE_AMVR_FLAG WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" ); -#endif } WRITE_FLAG( pcSPS->getUseGBi() ? 1 : 0, "gbi_flag" ); -#if JVET_O0119_BASE_PALETTE_444 if (pcSPS->getChromaFormatIdc() == CHROMA_444) { WRITE_FLAG(pcSPS->getPLTMode() ? 1 : 0, "plt_flag" ); } -#endif WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "ibc_flag"); // KJS: sps_ciip_enabled_flag @@ -1174,12 +873,10 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) { WRITE_FLAG( pcSPS->getFpelMmvdEnabledFlag() ? 1 : 0, "sps_fpel_mmvd_enabled_flag" ); } -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if(pcSPS->getBDOFEnabledFlag() || pcSPS->getUseDMVR()) { WRITE_FLAG(pcSPS->getBdofDmvrSlicePresentFlag() ? 1 : 0, "sps_bdof_dmvr_slice_level_present_flag"); } -#endif WRITE_FLAG( pcSPS->getUseTriangle() ? 1: 0, "triangle_flag" ); WRITE_FLAG( pcSPS->getUseMIP() ? 1: 0, "sps_mip_flag" ); @@ -1212,32 +909,13 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) // KJS: remove scaling lists? WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag" ); -#if !JVET_O0299_APS_SCALINGLIST - if(pcSPS->getScalingListFlag()) - { - WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag" ); - if(pcSPS->getScalingListPresentFlag()) - { - codeScalingList( pcSPS->getScalingList() ); - } - } -#endif const TimingInfo *timingInfo = pcSPS->getTimingInfo(); -#if JVET_O0189_DU WRITE_FLAG(pcSPS->getHrdParametersPresentFlag(), "general_hrd_parameters_present_flag"); if( pcSPS->getHrdParametersPresentFlag() ) -#else - WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "timing_info_present_flag"); - if(timingInfo->getTimingInfoPresentFlag()) -#endif { WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "num_units_in_tick"); WRITE_CODE(timingInfo->getTimeScale(), 32, "time_scale"); -#if !JVET_O0189_DU - WRITE_FLAG(pcSPS->getHrdParametersPresentFlag(), "hrd_parameters_present_flag"); -#endif -#if JVET_O0177_PROPOSAL1 WRITE_FLAG(pcSPS->getSubLayerParametersPresentFlag(), "sub_layer_cpb_parameters_present_flag"); if (pcSPS->getSubLayerParametersPresentFlag()) { @@ -1247,12 +925,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) { codeHrdParameters(pcSPS->getHrdParameters(), pcSPS->getMaxTLayers() - 1, pcSPS->getMaxTLayers() - 1); } -#else - if( pcSPS->getHrdParametersPresentFlag() ) - { - codeHrdParameters(pcSPS->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); - } -#endif } WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(), "vui_parameters_present_flag" ); @@ -1370,12 +1042,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) const uint32_t numberValidComponents = getNumberValidComponents(format); const bool chromaEnabled = isChromaEnabled(format); -#if !JVET_N0865_SYNTAX - if (pcSlice->getRapPicFlag()) - { - WRITE_FLAG(pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag"); - } -#endif WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" ); int bitsSliceAddress = 1; if (!pcSlice->getPPS()->getRectSliceFlag()) @@ -1415,9 +1081,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_UVLC(pcSlice->getSliceNumBricks() - 1, "num_bricks_in_slice_minus1"); } -#if JVET_O0181 WRITE_FLAG(pcSlice->getNonRefPictFlag() ? 1 : 0, "non_reference_picture_flag"); -#endif for( int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++ ) { @@ -1426,32 +1090,17 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_UVLC( pcSlice->getSliceType(), "slice_type" ); -#if !JVET_N0865_SYNTAX - if (pcSlice->getPPS()->getOutputFlagPresentFlag()) - { - WRITE_FLAG(pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag"); - } -#endif int pocBits = pcSlice->getSPS()->getBitsForPOC(); int pocMask = (1 << pocBits) - 1; WRITE_CODE(pcSlice->getPOC() & pocMask, pocBits, "slice_pic_order_cnt_lsb"); -#if JVET_N0865_SYNTAX -#if JVET_N0865_GRA2GDR if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) -#else - if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA) -#endif { int maxPicOrderCntLsb = (int) pow(2, pcSlice->getSPS()->getBitsForPOC()); CHECK((pcSlice->getRecoveryPocCnt() < maxPicOrderCntLsb), "The value of recovery_poc_cnt exceeds (POC LSB cycle - 1)"); WRITE_UVLC(pcSlice->getRecoveryPocCnt(), "recovery_poc_cnt"); } -#if JVET_N0865_GRA2GDR if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR)) -#else - if (pcSlice->getRapPicFlag() || (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GRA)) -#endif { WRITE_FLAG(pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag"); } @@ -1459,20 +1108,15 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { WRITE_FLAG(pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag"); } -#endif if( !pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent()) { //Write L0 related syntax elements if (pcSlice->getSPS()->getNumRPL0() > 0) { -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSRefPicListSPSIdc0()) { WRITE_FLAG(pcSlice->getRPL0idx() != -1 ? 1 : 0, "ref_pic_list_sps_flag[0]"); } -#else - WRITE_FLAG(pcSlice->getRPL0idx() != -1 ? 1 : 0, "ref_pic_list_sps_flag[0]"); -#endif } if (pcSlice->getRPL0idx() != -1) { @@ -1488,11 +1132,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } else { //write local RPL0 -#if JVET_O0244_DELTA_POC xCodeRefPicList( pcSlice->getRPL0(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred() ); -#else - xCodeRefPicList(pcSlice->getRPL0(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC()); -#endif } //Deal POC Msb cycle signalling for LTRP if (pcSlice->getRPL0()->getNumberOfLongtermPictures()) @@ -1501,13 +1141,11 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { if (pcSlice->getRPL0()->isRefPicLongterm(i)) { -#if JVET_N0100_PROPOSAL1 if (pcSlice->getRPL0()->getLtrpInSliceHeaderFlag()) { WRITE_CODE(pcSlice->getRPL0()->getRefPicIdentifier(i), pcSlice->getSPS()->getBitsForPOC(), "slice_poc_lsb_lt[listIdx][rplsIdx][j]"); } -#endif WRITE_FLAG(pcSlice->getLocalRPL0()->getDeltaPocMSBPresentFlag(i) ? 1 : 0, "delta_poc_msb_present_flag[i][j]"); if (pcSlice->getLocalRPL0()->getDeltaPocMSBPresentFlag(i)) { @@ -1523,25 +1161,17 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) CHECK(pcSlice->getRPL1idx() != pcSlice->getRPL0idx(), "RPL1Idx is not signalled but it is not the same as RPL0Idx"); if (pcSlice->getRPL1idx() == -1) { //write local RPL1 -#if JVET_O0244_DELTA_POC xCodeRefPicList( pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred() ); -#else - xCodeRefPicList(pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC()); -#endif } } else { if (pcSlice->getSPS()->getNumRPL1() > 0) { -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSRefPicListSPSIdc1()) { WRITE_FLAG(pcSlice->getRPL1idx() != -1 ? 1 : 0, "ref_pic_list_sps_flag[1]"); } -#else - WRITE_FLAG(pcSlice->getRPL1idx() != -1 ? 1 : 0, "ref_pic_list_sps_flag[1]"); -#endif } if (pcSlice->getRPL1idx() != -1) { @@ -1557,11 +1187,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } else { //write local RPL1 -#if JVET_O0244_DELTA_POC xCodeRefPicList( pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred() ); -#else - xCodeRefPicList(pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC()); -#endif } } //Deal POC Msb cycle signalling for LTRP @@ -1571,13 +1197,11 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { if (pcSlice->getRPL1()->isRefPicLongterm(i)) { -#if JVET_N0100_PROPOSAL1 if (pcSlice->getRPL1()->getLtrpInSliceHeaderFlag()) { WRITE_CODE(pcSlice->getRPL1()->getRefPicIdentifier(i), pcSlice->getSPS()->getBitsForPOC(), "slice_poc_lsb_lt[listIdx][rplsIdx][j]"); } -#endif WRITE_FLAG(pcSlice->getLocalRPL1()->getDeltaPocMSBPresentFlag(i) ? 1 : 0, "delta_poc_msb_present_flag[i][j]"); if (pcSlice->getLocalRPL1()->getDeltaPocMSBPresentFlag(i)) { @@ -1664,29 +1288,18 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) if(!pcSlice->isIntra()) { -#if JVET_O0238_PPS_OR_SLICE if( pcSlice->getSPS()->getSPSTemporalMVPEnabledFlag() && !pcSlice->getPPS()->getPPSTemporalMVPEnabledIdc() ) { WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enabled_flag" ); } -#else - if( pcSlice->getSPS()->getSPSTemporalMVPEnabledFlag() ) - { - WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enabled_flag" ); - } -#endif } if( pcSlice->isInterB() ) { -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSMvdL1ZeroIdc()) { WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0, "mvd_l1_zero_flag" ); } -#else - WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0, "mvd_l1_zero_flag" ); -#endif } if( !pcSlice->isIntra() ) @@ -1705,14 +1318,10 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { if( pcSlice->getSliceType() == B_SLICE ) { -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSCollocatedFromL0Idc()) { WRITE_FLAG( pcSlice->getColFromL0Flag(), "collocated_from_l0_flag" ); } -#else - WRITE_FLAG( pcSlice->getColFromL0Flag(), "collocated_from_l0_flag" ); -#endif } if( pcSlice->getSliceType() != I_SLICE && @@ -1722,38 +1331,22 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_UVLC( pcSlice->getColRefIdx(), "collocated_ref_idx" ); } } -#if JVET_O0455_IBC_MAX_MERGE_NUM if (!cs.slice->isIntra()) -#else - if (!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) -#endif { CHECK(pcSlice->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported"); -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSSixMinusMaxNumMergeCandPlus1()) { WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand"); } -#else - WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand"); -#endif } if( !pcSlice->isIntra() ) { -#if JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP if (pcSlice->getSPS()->getSBTMVPEnabledFlag() && pcSlice->getEnableTMVPFlag() && !pcSlice->getSPS()->getUseAffine())// ATMVP only -#else - if ( pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getUseAffine() ) // ATMVP only -#endif { CHECK( pcSlice->getMaxNumAffineMergeCand() != 1, "Sub-block merge can number should be 1" ); } else -#if JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP if (!(pcSlice->getSPS()->getSBTMVPEnabledFlag() && pcSlice->getEnableTMVPFlag()) && !pcSlice->getSPS()->getUseAffine()) // both off -#else - if ( !pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getUseAffine() ) // both off -#endif { CHECK( pcSlice->getMaxNumAffineMergeCand() != 0, "Sub-block merge can number should be 0" ); } @@ -1761,62 +1354,41 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) if ( pcSlice->getSPS()->getUseAffine() ) { CHECK( pcSlice->getMaxNumAffineMergeCand() > AFFINE_MRG_MAX_NUM_CANDS, "More affine merge candidates signalled than supported" ); -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSFiveMinusMaxNumSubblockMergeCandPlus1()) { WRITE_UVLC( AFFINE_MRG_MAX_NUM_CANDS - pcSlice->getMaxNumAffineMergeCand(), "five_minus_max_num_subblock_merge_cand" ); } -#else - WRITE_UVLC( AFFINE_MRG_MAX_NUM_CANDS - pcSlice->getMaxNumAffineMergeCand(), "five_minus_max_num_subblock_merge_cand" ); -#endif } if ( pcSlice->getSPS()->getFpelMmvdEnabledFlag() ) { WRITE_FLAG( pcSlice->getDisFracMMVD(), "slice_fpel_mmvd_enabled_flag" ); } -#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG if (pcSlice->getSPS()->getBdofDmvrSlicePresentFlag()) { WRITE_FLAG(pcSlice->getDisBdofDmvrFlag(), "slice_disable_bdof_dmvr_flag"); } -#endif if (pcSlice->getSPS()->getUseTriangle() && pcSlice->getMaxNumMergeCand() >= 2) { CHECK(pcSlice->getMaxNumMergeCand() < pcSlice->getMaxNumTriangleCand(), "Incorrrect max number of triangle candidates!"); -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1()) { WRITE_UVLC(pcSlice->getMaxNumMergeCand() - pcSlice->getMaxNumTriangleCand(), "max_num_merge_cand_minus_max_num_triangle_cand"); } -#else - WRITE_UVLC(pcSlice->getMaxNumMergeCand() - pcSlice->getMaxNumTriangleCand(), "max_num_merge_cand_minus_max_num_triangle_cand"); -#endif } else { pcSlice->setMaxNumTriangleCand(0); } } -#if JVET_O0455_IBC_MAX_MERGE_NUM if ( pcSlice->getSPS()->getIBCFlag() ) { CHECK( pcSlice->getMaxNumIBCMergeCand() > IBC_MRG_MAX_NUM_CANDS, "More IBC merge candidates signalled than supported" ); WRITE_UVLC( IBC_MRG_MAX_NUM_CANDS - pcSlice->getMaxNumIBCMergeCand(), "slice_six_minus_max_num_ibc_merge_cand" ); } -#endif -#if JVET_O0105_ICT -#if JVET_O0376_SPS_JOINTCBCR_FLAG if (pcSlice->getSPS()->getJointCbCrEnabledFlag()) { WRITE_FLAG( pcSlice->getJointCbCrSignFlag() ? 1 : 0, "slice_joint_cbcr_sign_flag"); } -#else - if (chromaEnabled) - { - WRITE_FLAG( pcSlice->getJointCbCrSignFlag() ? 1 : 0, "slice_joint_cbcr_sign_flag"); - } -#endif -#endif int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); WRITE_SVLC( iCode, "slice_qp_delta" ); @@ -1829,14 +1401,10 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) if (numberValidComponents > COMPONENT_Cr) { WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr), "slice_cr_qp_offset" ); -#if JVET_O0376_SPS_JOINTCBCR_FLAG if (pcSlice->getSPS()->getJointCbCrEnabledFlag()) { WRITE_SVLC( pcSlice->getSliceChromaQpDelta(JOINT_CbCr), "slice_joint_cbcr_qp_offset"); } -#else - WRITE_SVLC( pcSlice->getSliceChromaQpDelta(JOINT_CbCr), "slice_joint_cbcr_qp_offset"); -#endif } CHECK(numberValidComponents < COMPONENT_Cr+1, "Too many valid components"); } @@ -1866,83 +1434,29 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) if (alfEnabled) { -#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL -#if JVET_O_MAX_NUM_ALF_APS_8 WRITE_CODE(pcSlice->getTileGroupNumAps(), 3, "slice_num_alf_aps_ids_luma"); -#else - xWriteTruncBinCode(pcSlice->getTileGroupNumAps(), ALF_CTB_MAX_NUM_APS + 1); -#endif -#else - if (pcSlice->isIntra()) - { - WRITE_FLAG(pcSlice->getTileGroupNumAps(), "slice_num_alf_aps_ids_luma"); - } - else - { -#if JVET_O_MAX_NUM_ALF_APS_8 - WRITE_CODE(pcSlice->getTileGroupNumAps(), 3, "slice_num_alf_aps_ids_luma"); -#else - xWriteTruncBinCode(pcSlice->getTileGroupNumAps(), ALF_CTB_MAX_NUM_APS + 1); -#endif - } -#endif const std::vector<int>& apsId = pcSlice->getTileGroupApsIdLuma(); for (int i = 0; i < pcSlice->getTileGroupNumAps(); i++) { -#if JVET_O_MAX_NUM_ALF_APS_8 WRITE_CODE(apsId[i], 3, "slice_alf_aps_id_luma"); -#else - WRITE_CODE(apsId[i], 5, "slice_alf_aps_id_luma"); -#endif } const int alfChromaIdc = pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) + pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cr) * 2 ; -#if JVET_O0616_400_CHROMA_SUPPORT if (chromaEnabled) { -#endif -#if JVET_O0491_HLS_CLEANUP WRITE_CODE(alfChromaIdc, 2, "slice_alf_chroma_idc"); -#else - truncatedUnaryEqProb(alfChromaIdc, 3); // alf_chroma_idc -#endif -#if JVET_O0616_400_CHROMA_SUPPORT } -#endif if (alfChromaIdc) { -#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL -#if JVET_O_MAX_NUM_ALF_APS_8 WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 3, "slice_alf_aps_id_chroma"); -#else - WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 5, "slice_alf_aps_id_chroma"); -#endif -#else - if (pcSlice->isIntra()&& pcSlice->getTileGroupNumAps() == 1) - { - CHECK(pcSlice->getTileGroupApsIdChroma() != apsId[0], "wrong tile group chroma aps id"); - } - else - { -#if JVET_O_MAX_NUM_ALF_APS_8 - WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 3, "slice_alf_aps_id_chroma"); -#else - WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 5, "slice_alf_aps_id_chroma"); -#endif - } -#endif } } } -#if JVET_O0238_PPS_OR_SLICE if (!pcSlice->getPPS()->getPPSDepQuantEnabledIdc()) { WRITE_FLAG( pcSlice->getDepQuantEnabledFlag() ? 1 : 0, "dep_quant_enabled_flag" ); } -#else - WRITE_FLAG( pcSlice->getDepQuantEnabledFlag() ? 1 : 0, "dep_quant_enabled_flag" ); -#endif if( !pcSlice->getDepQuantEnabledFlag() ) { WRITE_FLAG( pcSlice->getSignDataHidingEnabledFlag() ? 1 : 0, "sign_data_hiding_enabled_flag" ); @@ -1981,26 +1495,14 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG( pcSlice->getLmcsEnabledFlag()? 1 : 0, "slice_lmcs_enabled_flag"); if (pcSlice->getLmcsEnabledFlag()) { -#if JVET_O0428_LMCS_CLEANUP WRITE_CODE(pcSlice->getLmcsAPSId(), 2, "slice_lmcs_aps_id"); -#else - WRITE_CODE(pcSlice->getLmcsAPSId(), 5, "slice_lmcs_aps_id"); -#endif -#if !JVET_O1109_UNFIY_CRS - if (!(pcSlice->getSPS()->getUseDualITree() && pcSlice->isIntra())) -#endif -#if JVET_O0616_400_CHROMA_SUPPORT if (chromaEnabled) { -#endif WRITE_FLAG(pcSlice->getLmcsChromaResidualScaleFlag(), "slice_chroma_residual_scale_flag"); -#if JVET_O0616_400_CHROMA_SUPPORT } -#endif } } -#if JVET_O0299_APS_SCALINGLIST if( pcSlice->getSPS()->getScalingListFlag() ) { WRITE_FLAG( pcSlice->getscalingListPresentFlag() ? 1 : 0, "slice_scaling_list_present_flag" ); @@ -2009,7 +1511,6 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_CODE( pcSlice->getscalingListAPSId(), 3, "slice_scaling_list_aps_id" ); } } -#endif if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) { WRITE_UVLC(0,"slice_segment_header_extension_length"); @@ -2032,12 +1533,7 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoPartitionConstraintsOverrideConstraintFlag() ? 1 : 0, "no_partition_constraints_override_constraint_flag"); WRITE_FLAG(cinfo->getNoSaoConstraintFlag() ? 1 : 0, "no_sao_constraint_flag"); WRITE_FLAG(cinfo->getNoAlfConstraintFlag() ? 1 : 0, "no_alf_constraint_flag"); -#if JVET_O0376_SPS_JOINTCBCR_FLAG WRITE_FLAG(cinfo->getNoJointCbCrConstraintFlag() ? 1 : 0, "no_joint_cbcr_constraint_flag"); -#endif -#if !JVET_O0525_REMOVE_PCM - WRITE_FLAG(cinfo->getNoPcmConstraintFlag() ? 1 : 0, "no_pcm_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoRefWraparoundConstraintFlag() ? 1 : 0, "no_ref_wraparound_constraint_flag"); WRITE_FLAG(cinfo->getNoTemporalMvpConstraintFlag() ? 1 : 0, "no_temporal_mvp_constraint_flag"); WRITE_FLAG(cinfo->getNoSbtmvpConstraintFlag() ? 1 : 0, "no_sbtmvp_constraint_flag"); @@ -2055,9 +1551,7 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoTriangleConstraintFlag() ? 1 : 0, "no_triangle_constraint_flag"); WRITE_FLAG(cinfo->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); WRITE_FLAG(cinfo->getNoTransformSkipConstraintFlag() ? 1 : 0, "no_transform_skip_constraint_flag"); -#if JVET_O1136_TS_BDPCM_SIGNALLING WRITE_FLAG(cinfo->getNoBDPCMConstraintFlag() ? 1 : 0, "no_bdpcm_constraint_flag"); -#endif WRITE_FLAG(cinfo->getNoQpDeltaConstraintFlag() ? 1 : 0, "no_qp_delta_constraint_flag"); WRITE_FLAG(cinfo->getNoDepQuantConstraintFlag() ? 1 : 0, "no_dep_quant_constraint_flag"); WRITE_FLAG(cinfo->getNoSignDataHidingConstraintFlag() ? 1 : 0, "no_sign_data_hiding_constraint_flag"); @@ -2069,15 +1563,11 @@ void HLSWriter::codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxN WRITE_CODE( int(ptl->getProfileIdc()), 7 , "general_profile_idc" ); WRITE_FLAG( ptl->getTierFlag()==Level::HIGH, "general_tier_flag" ); -#if JVET_O0044_MULTI_SUB_PROFILE WRITE_CODE(ptl->getNumSubProfile(), 8, "num_sub_profiles"); for (int i = 0; i < ptl->getNumSubProfile(); i++) { WRITE_CODE(ptl->getSubProfileIdc(i) , 32, "general_sub_profile_idc[i]"); } -#else - WRITE_CODE(ptl->getSubProfileIdc(), 24, "general_sub_profile_idc"); -#endif codeConstraintInfo(ptl->getConstraintInfo()); @@ -2344,74 +1834,21 @@ void HLSWriter::alfGolombEncode( int coeff, int k, const bool signed_coeff ) } } -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma, const int altIdx ) -#else -void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma ) -#endif { +#if !JVET_P0164_ALF_SYNTAX_SIMP if( !isChroma ) { WRITE_FLAG( alfParam.alfLumaCoeffDeltaFlag, "alf_luma_coeff_delta_flag" ); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if( !alfParam.alfLumaCoeffDeltaFlag ) - { - if( alfParam.numLumaFilters > 1 ) - { - WRITE_FLAG( alfParam.alfLumaCoeffDeltaPredictionFlag, "alf_luma_coeff_delta_prediction_flag" ); - } - } -#endif } - AlfFilterShape alfShape(isChroma ? 5 : 7); -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - static int bitsCoeffScan[EncAdaptiveLoopFilter::m_MAX_SCAN_VAL][EncAdaptiveLoopFilter::m_MAX_EXP_GOLOMB]; - memset( bitsCoeffScan, 0, sizeof( bitsCoeffScan ) ); - const int maxGolombIdx = AdaptiveLoopFilter::getMaxGolombIdx( alfShape.filterType ); #endif -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB + AlfFilterShape alfShape(isChroma ? 5 : 7); const short* coeff = isChroma ? alfParam.chromaCoeff[altIdx] : alfParam.lumaCoeff; const short* clipp = isChroma ? alfParam.chromaClipp[altIdx] : alfParam.lumaClipp; -#else - const short* coeff = isChroma ? alfParam.chromaCoeff : alfParam.lumaCoeff; - const short* clipp = isChroma ? alfParam.chromaClipp : alfParam.lumaClipp; -#endif const int numFilters = isChroma ? 1 : alfParam.numLumaFilters; // vlc for all -#if !JVET_O0216_ALF_COEFF_EG3 - for( int ind = 0; ind < numFilters; ++ind ) - { - if( isChroma || !alfParam.alfLumaCoeffDeltaFlag || alfParam.alfLumaCoeffFlag[ind] ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - int coeffVal = abs( coeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] ); - - for( int k = 1; k < 15; k++ ) - { - bitsCoeffScan[alfShape.golombIdx[i]][k] += EncAdaptiveLoopFilter::lengthGolomb( coeffVal, k ); - } - } - } - } -#endif -#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING - static int kMinTab[MAX_NUM_ALF_COEFF]; -#endif -#if !JVET_O0216_ALF_COEFF_EG3 - int kMin = EncAdaptiveLoopFilter::getGolombKMin( alfShape, numFilters, kMinTab, bitsCoeffScan ); - // Golomb parameters - WRITE_UVLC( kMin - 1, isChroma ? "alf_chroma_min_eg_order_minus1" : "alf_luma_min_eg_order_minus1" ); - - for( int idx = 0; idx < maxGolombIdx; idx++ ) - { - bool golombOrderIncreaseFlag = ( kMinTab[idx] != kMin ) ? true : false; - CHECK( !( kMinTab[idx] <= kMin + 1 ), "ALF Golomb parameter not consistent" ); - WRITE_FLAG( golombOrderIncreaseFlag, isChroma ? "alf_chroma_eg_order_increase_flag" : "alf_luma_eg_order_increase_flag" ); - kMin = kMinTab[idx]; - } -#endif +#if !JVET_P0164_ALF_SYNTAX_SIMP if( !isChroma ) { if( alfParam.alfLumaCoeffDeltaFlag ) @@ -2422,33 +1859,27 @@ void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma ) } } } +#endif // Filter coefficients for( int ind = 0; ind < numFilters; ++ind ) { +#if !JVET_P0164_ALF_SYNTAX_SIMP if( !isChroma && !alfParam.alfLumaCoeffFlag[ind] && alfParam.alfLumaCoeffDeltaFlag ) { continue; } +#endif for( int i = 0; i < alfShape.numCoeff - 1; i++ ) { -#if JVET_O0216_ALF_COEFF_EG3 alfGolombEncode( coeff[ind* MAX_NUM_ALF_LUMA_COEFF + i], 3 ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#else - alfGolombEncode( coeff[ind* MAX_NUM_ALF_LUMA_COEFF + i], kMinTab[alfShape.golombIdx[i]] ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] -#endif } } // Clipping values coding -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB if( alfParam.nonLinearFlag[isChroma][altIdx] ) -#else - if( alfParam.nonLinearFlag[isChroma] ) -#endif { -#if JVET_O0064_SIMP_ALF_CLIP_CODING for (int ind = 0; ind < numFilters; ++ind) { for (int i = 0; i < alfShape.numCoeff - 1; i++) @@ -2456,148 +1887,8 @@ void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma ) WRITE_CODE(clipp[ind* MAX_NUM_ALF_LUMA_COEFF + i], 2, "alf_clipping_index"); } } -#else - memset( bitsCoeffScan, 0, sizeof( bitsCoeffScan ) ); - - short recCoeff[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; - if( isChroma ) - { - memcpy( recCoeff, coeff, sizeof(short) * MAX_NUM_ALF_CHROMA_COEFF ); - } - else - { - memcpy( recCoeff, coeff, sizeof(short) * numFilters * MAX_NUM_ALF_LUMA_COEFF ); -#if !JVET_O0669_REMOVE_ALF_COEFF_PRED - if( alfParam.alfLumaCoeffDeltaPredictionFlag ) - { - for( int i = 1; i < numFilters; i++ ) - { - for( int j = 0; j < alfShape.numCoeff - 1; j++ ) - { - recCoeff[i * MAX_NUM_ALF_LUMA_COEFF + j] += recCoeff[( i - 1 ) * MAX_NUM_ALF_LUMA_COEFF + j]; - } - } - } -#endif - } - // vlc for all - for( int ind = 0; ind < numFilters; ++ind ) - { - if( isChroma || !alfParam.alfLumaCoeffDeltaFlag || alfParam.alfLumaCoeffFlag[ind] ) - { - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( recCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] ) ) - continue; - int coeffVal = abs( clipp[ind * MAX_NUM_ALF_LUMA_COEFF + i] ); - - for( int k = 1; k < 15; k++ ) - { - bitsCoeffScan[alfShape.golombIdx[i]][k] += EncAdaptiveLoopFilter::lengthGolomb( coeffVal, k, false ); - } - } - } - } -#if JVET_O0216_ALF_COEFF_EG3 - int kMin = EncAdaptiveLoopFilter::getGolombKMin(alfShape, numFilters, kMinTab, bitsCoeffScan); -#else - kMin = EncAdaptiveLoopFilter::getGolombKMin( alfShape, numFilters, kMinTab, bitsCoeffScan ); -#endif - - // Golomb parameters - WRITE_UVLC( kMin - 1, "clip_min_golomb_order" ); - - for( int idx = 0; idx < maxGolombIdx; idx++ ) - { - bool golombOrderIncreaseFlag = ( kMinTab[idx] != kMin ) ? true : false; - CHECK( !( kMinTab[idx] <= kMin + 1 ), "ALF Golomb parameter not consistent" ); - WRITE_FLAG( golombOrderIncreaseFlag, "clip_golomb_order_increase_flag" ); - kMin = kMinTab[idx]; - } - - // Filter coefficients - for( int ind = 0; ind < numFilters; ++ind ) - { - if( !isChroma && !alfParam.alfLumaCoeffFlag[ind] && alfParam.alfLumaCoeffDeltaFlag ) - { - continue; - } - - for( int i = 0; i < alfShape.numCoeff - 1; i++ ) - { - if( !abs( recCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] ) ) - continue; - alfGolombEncode( clipp[ind* MAX_NUM_ALF_LUMA_COEFF + i], kMinTab[alfShape.golombIdx[i]], false ); // alf_coeff_chroma[i], alf_coeff_luma_delta[i][j] - } - } -#endif - } -} - -#if !JVET_O0491_HLS_CLEANUP -void HLSWriter::xWriteTruncBinCode( uint32_t uiSymbol, const int uiMaxSymbol ) -{ - int uiThresh; - if( uiMaxSymbol > 256 ) - { - int uiThreshVal = 1 << 8; - uiThresh = 8; - while( uiThreshVal <= uiMaxSymbol ) - { - uiThresh++; - uiThreshVal <<= 1; - } - uiThresh--; - } - else - { - uiThresh = g_tbMax[uiMaxSymbol]; - } - - int uiVal = 1 << uiThresh; - assert( uiVal <= uiMaxSymbol ); - assert( ( uiVal << 1 ) > uiMaxSymbol ); - assert( uiSymbol < uiMaxSymbol ); - int b = uiMaxSymbol - uiVal; - assert( b < uiVal ); - if( uiSymbol < uiVal - b ) - { - xWriteCode( uiSymbol, uiThresh ); - } - else - { - uiSymbol += uiVal - b; - assert( uiSymbol < ( uiVal << 1 ) ); - assert( ( uiSymbol >> 1 ) >= uiVal - b ); - xWriteCode( uiSymbol, uiThresh + 1 ); } } -void HLSWriter::truncatedUnaryEqProb( int symbol, const int maxSymbol ) -{ - if( maxSymbol == 0 ) - { - return; - } - - bool codeLast = ( maxSymbol > symbol ); - int bins = 0; - int numBins = 0; - - while( symbol-- ) - { - bins <<= 1; - bins++; - numBins++; - } - if( codeLast ) - { - bins <<= 1; - numBins++; - } - CHECK( !( numBins <= 32 ), "Unspecified error" ); - xWriteCode( bins, numBins ); -} -#endif //! \} diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index 867dbcfc3c5c0470e14950fd6f4e6e8e56bfa953..efc78e67db393ea0410ff56b91c49cf1397678ad 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -111,11 +111,7 @@ public: virtual ~HLSWriter() {} private: -#if JVET_O0244_DELTA_POC void xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc ); -#else - void xCodeRefPicList(const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount); -#endif bool xFindMatchingLTRP ( Slice* pcSlice, uint32_t *ltrpsIndex, int ltrpPOC, bool usedFlag ); void xCodePredWeightTable ( Slice* pcSlice ); void xCodeScalingList ( const ScalingList* scalingList, uint32_t sizeId, uint32_t listId); @@ -124,43 +120,25 @@ public: uint32_t getNumberOfWrittenBits () { return m_pcBitIf->getNumberOfWrittenBits(); } void codeVUI ( const VUI *pcVUI, const SPS* pcSPS ); void codeSPS ( const SPS* pcSPS ); -#if JVET_O1136_TS_BDPCM_SIGNALLING void codePPS ( const PPS* pcPPS, const SPS* pcSPS ); -#else - void codePPS ( const PPS* pcPPS ); -#endif void codeAPS ( APS* pcAPS ); void codeAlfAps ( APS* pcAPS ); void codeLmcsAps ( APS* pcAPS ); -#if JVET_O0299_APS_SCALINGLIST void codeScalingListAps ( APS* pcAPS ); -#endif void codeVPS ( const VPS* pcVPS ); void codeDPS ( const DPS* dps ); void codeSliceHeader ( Slice* pcSlice ); void codeConstraintInfo ( const ConstraintInfo* cinfo ); void codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxNumSubLayersMinus1 ); -#if !JVET_N0353_INDEP_BUFF_TIME_SEI - void codeHrdParameters ( const HRDParameters *hrd, bool commonInfPresentFlag, uint32_t maxNumSubLayersMinus1 ); -#else void codeHrdParameters ( const HRDParameters *hrd, const uint32_t firstSubLayer, const uint32_t maxNumSubLayersMinus1); -#endif void codeTilesWPPEntryPoint ( Slice* pSlice ); void codeScalingList ( const ScalingList &scalingList ); -#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB void alfFilter( const AlfParam& alfParam, const bool isChroma, const int altIdx ); -#else - void alfFilter( const AlfParam& alfParam, const bool isChroma ); -#endif private: void alfGolombEncode( const int coeff, const int k, const bool signed_coeff=true ); -#if !JVET_O0491_HLS_CLEANUP - void xWriteTruncBinCode( uint32_t uiSymbol, const int uiMaxSymbol ); - void truncatedUnaryEqProb( int symbol, int maxSymbol ); -#endif }; //! \} diff --git a/source/Lib/Utilities/VideoIOYuv.cpp b/source/Lib/Utilities/VideoIOYuv.cpp index 91ca6bc05f033dee5fba7715adeaf002710dfd6a..a320adf05ab11cfbb3ad22c3902866ee2eb04a07 100644 --- a/source/Lib/Utilities/VideoIOYuv.cpp +++ b/source/Lib/Utilities/VideoIOYuv.cpp @@ -453,11 +453,7 @@ static bool verifyPlane(Pel* dst, * @param fileBitDepth component bit depth in file * @return true for success, false in case of error */ -#if JVET_O1164_RPR static bool writePlane( uint32_t orgWidth, uint32_t orgHeight, ostream& fd, const Pel* src, -#else -static bool writePlane(ostream& fd, const Pel* src, -#endif const bool is16bit, const uint32_t stride_src, uint32_t width444, uint32_t height444, @@ -476,13 +472,9 @@ static bool writePlane(ostream& fd, const Pel* src, const uint32_t height_file = height444 >> csy_file; const bool writePYUV = (packedYUVOutputMode > 0) && (fileBitDepth == 10 || fileBitDepth == 12) && ((width_file & (1 + (fileBitDepth & 3))) == 0); -#if JVET_O1164_RPR CHECK( writePYUV, "Not supported" ); CHECK( csx_file != csx_src, "Not supported" ); const uint32_t stride_file = writePYUV ? ( orgWidth * fileBitDepth ) >> ( csx_file + 3 ) : ( orgWidth * ( is16bit ? 2 : 1 ) ) >> csx_file; -#else - const uint32_t stride_file = writePYUV ? (width444 * fileBitDepth) >> (csx_file + 3) : (width444 * (is16bit ? 2 : 1)) >> csx_file; -#endif std::vector<uint8_t> bufVec(stride_file); uint8_t *buf=&(bufVec[0]); @@ -681,7 +673,6 @@ static bool writePlane(ostream& fd, const Pel* src, } } -#if JVET_O1164_RPR // here height444 and orgHeight are luma heights for( uint32_t y444 = height444; y444 < orgHeight; y444++ ) { @@ -715,7 +706,6 @@ static bool writePlane(ostream& fd, const Pel* src, pSrcBuf += srcbuf_stride; } } -#endif } return true; @@ -970,12 +960,8 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp * @param format chroma format * @return true for success, false in case of error */ -#if JVET_O1164_RPR // here orgWidth and orgHeight are for luma bool VideoIOYuv::write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf& pic, -#else -bool VideoIOYuv::write( const CPelUnitBuf& pic, -#endif const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int confLeft, int confRight, int confTop, int confBottom, ChromaFormat format, const bool bClipToRec709 ) @@ -1049,11 +1035,7 @@ bool VideoIOYuv::write( const CPelUnitBuf& pic, const uint32_t csy = ::getComponentScaleY(compID, format); const CPelBuf area = picO.get(compID); const int planeOffset = (confLeft >> csx) + (confTop >> csy) * area.stride; -#if JVET_O1164_RPR if( !writePlane( orgWidth, orgHeight, m_cHandle, area.bufAt( 0, 0 ) + planeOffset, is16bit, area.stride, -#else - if (!writePlane (m_cHandle, area.bufAt (0, 0) + planeOffset, is16bit, area.stride, -#endif width444, height444, compID, picO.chromaFormat, format, m_fileBitdepth[ch], bPackedYUVOutputMode ? 1 : 0)) { @@ -1237,7 +1219,6 @@ void VideoIOYuv::ColourSpaceConvert(const CPelUnitBuf &src, PelUnitBuf &dest, co } } -#if JVET_O1164_RPR bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice, ChromaFormat format, const bool bClipToRec709 ) { ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); @@ -1250,11 +1231,7 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe PelStorage upscaledPic; upscaledPic.create( chromaFormatIDC, Area( Position(), Size( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples() ) ) ); const Window conf; -#if RPR_CONF_WINDOW Picture::rescalePicture( pic, pps.getConformanceWindow(), upscaledPic, conf, chromaFormatIDC, sps.getBitDepths(), false ); -#else - Picture::rescalePicture(pic, upscaledPic, chromaFormatIDC, sps.getBitDepths(), false); -#endif ret = write( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples(), upscaledPic, ipCSC, @@ -1295,4 +1272,3 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe return ret; } -#endif diff --git a/source/Lib/Utilities/VideoIOYuv.h b/source/Lib/Utilities/VideoIOYuv.h index 37f086f5ec246b145f83db703d47d2734308f4a9..de5665eda98bc8bff501a2e7451328d2215e6936 100644 --- a/source/Lib/Utilities/VideoIOYuv.h +++ b/source/Lib/Utilities/VideoIOYuv.h @@ -50,10 +50,8 @@ using namespace std; // Class definition // ==================================================================================================================== -#if JVET_O1164_RPR #include "CommonLib/Slice.h" #include "CommonLib/Picture.h" -#endif /// YUV file I/O class class VideoIOYuv @@ -82,11 +80,7 @@ public: bool read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSpaceConversion ipcsc, int aiPad[2], ChromaFormat fileFormat=NUM_CHROMA_FORMAT, const bool bClipToRec709=false ); ///< read one frame with padding parameter // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuv -#if JVET_O1164_RPR bool write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf& pic, -#else - bool write( const CPelUnitBuf& pic, -#endif const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false ); ///< write one YUV frame with padding parameter @@ -102,10 +96,8 @@ public: bool isEof (); ///< check for end-of-file bool isFail(); ///< check for failure -#if JVET_O1164_RPR bool writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false ); ///< write one upsaled YUV frame -#endif };