Commit 8865ae25 authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'N0318-N0467-IBC-SIZE-rebase0' into 'master'

JVET_N0318_N0467_IBC_SIZE

See merge request jvet/VVCSoftware_VTM!431
parents 23bc64c2 7339bc10
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_N0318_N0467_IBC_SIZE 1 // IBC flag dependent on CU size and disabling 128x128 IBC mode
#define JVET_N0462_FIX_CTX_MODELING 1 // Fix context modeling of inter_pred_idc
#define JVET_N0286_SIMPLIFIED_GBI_IDX 1 // Simplified coding of the GBi index
......
......@@ -727,6 +727,10 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
cu.rootCbf = false;
cu.predMode = MODE_INTRA;
cu.mmvdSkip = false;
#if JVET_N0318_N0467_IBC_SIZE
if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode
{
#endif
unsigned ctxId = DeriveCtx::CtxSkipFlag(cu);
unsigned skip = m_BinDecoder.decodeBin(Ctx::SkipFlag(ctxId));
DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0 );
......@@ -737,7 +741,9 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
cu.predMode = MODE_IBC;
cu.mmvdSkip = false;
}
#if JVET_N0318_N0467_IBC_SIZE
}
#endif
return;
}
......@@ -748,6 +754,10 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
if (skip && cu.cs->slice->getSPS()->getIBCFlag())
{
#if JVET_N0318_N0467_IBC_SIZE
if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode
{
#endif
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
......@@ -761,6 +771,13 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
cu.predMode = MODE_INTER;
}
DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode);
#if JVET_N0318_N0467_IBC_SIZE
}
else
{
cu.predMode = MODE_INTER;
}
#endif
}
if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getIBCFlag()) ||
(skip && !cu.cs->slice->getSPS()->getIBCFlag()))
......@@ -881,11 +898,18 @@ void CABACReader::pred_mode( CodingUnit& cu )
if (cu.cs->slice->isIntra())
{
cu.predMode = MODE_INTRA;
#if JVET_N0318_N0467_IBC_SIZE
if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode
{
#endif
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
cu.predMode = MODE_IBC;
}
#if JVET_N0318_N0467_IBC_SIZE
}
#endif
}
else
{
......@@ -896,11 +920,18 @@ void CABACReader::pred_mode( CodingUnit& cu )
else
{
cu.predMode = MODE_INTER;
#if JVET_N0318_N0467_IBC_SIZE
if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode
{
#endif
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
cu.predMode = MODE_IBC;
}
#if JVET_N0318_N0467_IBC_SIZE
}
#endif
}
}
}
......
......@@ -636,8 +636,15 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag())
{
#if JVET_N0318_N0467_IBC_SIZE
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);
#if JVET_N0318_N0467_IBC_SIZE
}
#endif
return;
}
......@@ -646,9 +653,16 @@ 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_N0318_N0467_IBC_SIZE
if (cu.lwidth() < 128 || cu.lheight() < 128) // disable 128x128 IBC mode
{
#endif
unsigned ctxidx = DeriveCtx::CtxIBCFlag(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_N0318_N0467_IBC_SIZE
}
#endif
#if !JVET_MMVD_OFF_MACRO
if (CU::isInter(cu))
{
......@@ -673,16 +687,30 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
{
if (cu.cs->slice->isIntra())
{
#if JVET_N0318_N0467_IBC_SIZE
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_N0318_N0467_IBC_SIZE
}
#endif
}
else
{
m_BinEncoder.encodeBin((CU::isIntra(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)));
if (!CU::isIntra(cu))
{
#if JVET_N0318_N0467_IBC_SIZE
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_N0318_N0467_IBC_SIZE
}
#endif
}
}
}
......
......@@ -2832,10 +2832,17 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct
{
assert(tempCS->chType != CHANNEL_TYPE_CHROMA); // chroma IBC is derived
#if JVET_N0318_N0467_IBC_SIZE
if (tempCS->area.lwidth() == 128 && tempCS->area.lheight() == 128) // disable 128x128 IBC mode
{
return;
}
#else
if (tempCS->area.lwidth() > IBC_MAX_CAND_SIZE || tempCS->area.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip
{
return;
}
#endif
const SPS &sps = *tempCS->sps;
tempCS->initStructData(encTestMode.qp, encTestMode.lossless);
......@@ -3069,10 +3076,17 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct
void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode)
{
#if JVET_N0318_N0467_IBC_SIZE
if (tempCS->area.lwidth() == 128 && tempCS->area.lheight() == 128) // disable 128x128 IBC mode
{
return;
}
#else
if (tempCS->area.lwidth() > IBC_MAX_CAND_SIZE || tempCS->area.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip
{
return;
}
#endif
tempCS->initStructData(encTestMode.qp, encTestMode.lossless);
......
......@@ -1576,7 +1576,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
else if (encTestmode.type == ETM_IBC || encTestmode.type == ETM_IBC_MERGE)
{
// IBC MODES
#if JVET_N0318_N0467_IBC_SIZE
return sps.getIBCFlag() && (partitioner.currArea().lumaSize().width < 128 || partitioner.currArea().lumaSize().height < 128);
#else
return sps.getIBCFlag() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE;
#endif
}
else if( isModeInter( encTestmode ) )
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment