diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index e3df7ce9ac2b525824aeda2bc51a7f9f3b38e544..7fd97af5e4d1343568f509566a83cbbfe57a61bb 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -120,7 +120,7 @@ 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, @@ -131,13 +131,21 @@ const uint16_t ProbModelTables::m_inistateToCount[128] = { 29676, 29833, 29982, 30124, 30258, 30385, 30506, 30621, 30730, 30834, 30932, 31025, 31114, 31198, 31277, 31353, 31425, 31493, 31558, 31619, 31678, 31733, 31785, 31835, 31883, 31928, 31970, 32011, 32049, 32086, 32120, 32153 }; - +#endif void BinProbModel_Std::init( int qp, int initId ) { +#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; } @@ -192,8 +200,11 @@ 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 diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index db3d89db53fe4d7de8a989098a41bb03307e4655..e68c790960a6acdf12ce2c4a912f222da571180f 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -67,7 +67,9 @@ 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 }; diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index aefe92a7e65b202245c6503c2a27d2e037a42620..6b8f41dd6578afc3a285b1fd11fcfa1449a4a8a3 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -495,7 +495,11 @@ 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) { @@ -1341,7 +1345,11 @@ 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) diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 2a6e3c7ec7b7fbbc348298808bfdd757e0f5e321..7df07132187c79166a38bd30bc5531b1e0663a31 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -83,6 +83,9 @@ Slice::Slice() , m_maxNumAffineMergeCand ( 0 ) , m_maxNumTriangleCand ( 0 ) , 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 ) @@ -193,6 +196,9 @@ void Slice::initSlice() 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 @@ -695,6 +701,9 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll) m_maxNumAffineMergeCand = pSrc->m_maxNumAffineMergeCand; m_maxNumTriangleCand = pSrc->m_maxNumTriangleCand; 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; @@ -1401,6 +1410,9 @@ SPS::SPS() , 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 diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 690419edeae26a78986cc3dd2b269638f3287da8..10df41576dbf1ca483545d83f0805c08708d5ffd 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -713,6 +713,9 @@ private: 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]; @@ -911,6 +914,10 @@ 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; } @@ -1438,6 +1445,9 @@ private: uint32_t m_maxNumAffineMergeCand; uint32_t m_maxNumTriangleCand; 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]; @@ -1685,6 +1695,10 @@ public: uint32_t getMaxNumTriangleCand() const { return m_maxNumTriangleCand;} 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; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index b54e3e303622fbe7e0f23b72702ae32b48850e19..4d8be2bbea891db7dcda4a62449976f64b2cdbb9 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -52,16 +52,21 @@ #define JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN 1 // JVET-O0106: use 4xN prediction regions for 1xN and 2xN subblocks +#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_O0438_SPS_AFFINE_AMVR_FLAG 1 // JVET-O0438: affine AMVR control flag conditioned on affine control flag in SPS +#define JVET_O0065_CABAC_INIT 0 // 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_O0216_ALF_COEFF_EG3 1 // JVET-O0216/O0302/O0648: using EG3 for ALF coefficients coding @@ -114,7 +119,7 @@ #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-O0078:Single HMVP table for all CUs inside the shared merge list region for IBC +#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 @@ -122,6 +127,9 @@ #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 FIX_DB_MAX_TRANSFORM_SIZE 1 #define MRG_SHARELIST_SHARSIZE 32 diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 8e77c679b839ab19a21e88ec8e8f91e816bc91d5..74a3cc0ec6952f1ad9fffc7a7190dcd94d78d326 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -349,19 +349,28 @@ const bool CodingUnit::checkCCLMAllowed() const //allow CCLM if 64x64 chroma tree node uses QT split or HBT+VBT split combination if( cuSplitTypeDepth1 == CU_QUAD_SPLIT || (cuSplitTypeDepth1 == CU_HORZ_SPLIT && cuSplitTypeDepth2 == CU_VERT_SPLIT) ) { - CHECK( !(blocks[COMPONENT_Cb].width <= 16 && blocks[COMPONENT_Cb].height <= 16), "chroma cu size shall be <= 16x16" ); + if( chromaFormat == CHROMA_420 ) + { + CHECK( !(blocks[COMPONENT_Cb].width <= 16 && blocks[COMPONENT_Cb].height <= 16), "chroma cu size shall be <= 16x16 for YUV420 format" ); + } allowCCLM = true; } //allow CCLM if 64x64 chroma tree node uses NS (No Split) and becomes a chroma CU containing 32x32 chroma blocks else if( cuSplitTypeDepth1 == CU_DONT_SPLIT ) { - CHECK( !(blocks[COMPONENT_Cb].width == 32 && blocks[COMPONENT_Cb].height == 32), "chroma cu size shall be 32x32" ); + if( chromaFormat == CHROMA_420 ) + { + CHECK( !(blocks[COMPONENT_Cb].width == 32 && blocks[COMPONENT_Cb].height == 32), "chroma cu size shall be 32x32 for YUV420 format" ); + } allowCCLM = true; } //allow CCLM if 64x32 chroma tree node uses NS and becomes a chroma CU containing 32x16 chroma blocks else if( cuSplitTypeDepth1 == CU_HORZ_SPLIT && cuSplitTypeDepth2 == CU_DONT_SPLIT ) { - CHECK( !(blocks[COMPONENT_Cb].width == 32 && blocks[COMPONENT_Cb].height == 16), "chroma cu size shall be 32x16" ); + if( chromaFormat == CHROMA_420 ) + { + CHECK( !(blocks[COMPONENT_Cb].width == 32 && blocks[COMPONENT_Cb].height == 16), "chroma cu size shall be 32x16 for YUV420 format" ); + } allowCCLM = true; } diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 07e039636e397bf55d9b94ac2726fcb305dd1813..f8a40eedd257b49e34f2dbca04928149008b1073 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -1597,13 +1597,17 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, } bool PU::checkDMVRCondition(const PredictionUnit& pu) { - WPScalingParam *wp0; - WPScalingParam *wp1; - int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; - 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); + WPScalingParam *wp0; + WPScalingParam *wp1; + int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; + 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 diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 65982f78627e3ea612dce3302a98776a8222745b..49f9a923c7e650c4aff0ad2310018eed5d13c351 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -769,7 +769,11 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) 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)); @@ -795,7 +799,11 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) if (skip && cu.cs->slice->getSPS()->getIBCFlag()) { +#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 { if ( cu.lwidth() == 4 && cu.lheight() == 4 ) { @@ -953,7 +961,11 @@ void CABACReader::pred_mode( CodingUnit& cu ) if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) ) { 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))) @@ -971,7 +983,11 @@ void CABACReader::pred_mode( CodingUnit& cu ) 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))) diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index be091648c13186904746250c9d2fd915499aba50..0ca063edabfa8e97fe8236841dfdd226f32223a3 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -435,7 +435,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana const int tileColumnsMinus1 = pcPPS->getNumTileColumnsMinus1(); const int tileRowsMinus1 = pcPPS->getNumTileRowsMinus1(); - CHECK( ((tileColumnsMinus1 + 1) * (tileColumnsMinus1 + 1)) < 2, "tile colums * rows must be > 1 when explicitly signalled."); + CHECK( ((tileColumnsMinus1 + 1) * (tileRowsMinus1 + 1)) < 2, "tile colums * rows must be > 1 when explicitly signalled."); if (tileColumnsMinus1 > 0) { @@ -1254,7 +1254,12 @@ 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 ); @@ -1515,6 +1520,12 @@ 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 pcSlice->setSliceCurStartCtuTsAddr(pcSlice->getSliceCurStartBrickIdx()); for (int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) @@ -1985,6 +1996,13 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para READ_FLAG( uiCode, "tile_group_fracmmvd_disabled_flag" ); pcSlice->setDisFracMMVD( uiCode ? true : false ); } +#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG + if (sps->getBdofDmvrSlicePresentFlag()) + { + READ_FLAG(uiCode, "tile_group_bdof_dmvr_disabled_flag"); + pcSlice->setDisBdofDmvrFlag(uiCode ? true : false); + } +#endif if (sps->getUseTriangle() && pcSlice->getMaxNumMergeCand() >= 2) { READ_UVLC(uiCode, "max_num_merge_cand_minus_max_num_triangle_cand"); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index fd8f25da2952b8435c64aae64ae21ed343e14189..cec957cef87b80826957251f0efede241430e23d 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -640,7 +640,11 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag()) { +#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); @@ -656,7 +660,11 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) 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 (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 { if ( cu.lwidth() == 4 && cu.lheight() == 4 ) { @@ -726,7 +734,11 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) { if ( cu.cs->slice->isIntra() || ( cu.lwidth() == 4 && cu.lheight() == 4 ) ) { +#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)); @@ -737,7 +749,11 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))); if (!CU::isIntra(cu)) { +#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)); diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 32e624a85187a894b6e8d1fa3c14547d32ea43ca..f71b0ca6a3443dc13034d6d2e362cb78fa397ff7 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -2978,8 +2978,11 @@ 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; } @@ -3213,7 +3216,11 @@ 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; } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 50f70702159d494250c83a9aa3cb8fe876874b7e..5f32fb1a845d2eba48323e70d5dc6322e3c383f4 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -931,6 +931,9 @@ 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 ); diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index e91d167377bc6765ffccde35870f070d7d810801..035242ea07184c7dc4d0b630c052e99f542afe69 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1549,7 +1549,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt 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 ) ) { diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 968e8c800e2f6728aa649402b2650e3cc3cdb9a5..d84db1de74503d98bd2fabfce392ffd4e5d21571 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -847,7 +847,12 @@ 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" ); @@ -1367,6 +1372,12 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) { WRITE_FLAG( pcSlice->getDisFracMMVD(), "tile_group_fracmmvd_disabled_flag" ); } +#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG + if (pcSlice->getSPS()->getBdofDmvrSlicePresentFlag()) + { + WRITE_FLAG(pcSlice->getDisBdofDmvrFlag(), "tile_group_bdof_dmvr_disabled_flag"); + } +#endif if (pcSlice->getSPS()->getUseTriangle() && pcSlice->getMaxNumMergeCand() >= 2) { CHECK(pcSlice->getMaxNumMergeCand() < pcSlice->getMaxNumTriangleCand(), "Incorrrect max number of triangle candidates!");