Commit ca4ccf93 authored by Xiang Li's avatar Xiang Li

Merge branch 'rmctx1' into 'master'

Remove unused CABAC contexts

See merge request jvet/VVCSoftware_VTM!632
parents e9e62007 ed73342e
Pipeline #1791 passed with stage
......@@ -297,7 +297,7 @@ unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth,
}
if( isChroma( compID ) )
{
return trDepth;
return ( trDepth == 0 ? 0 : 1 );
}
else
{
......
......@@ -297,10 +297,10 @@ const CtxSet ContextSetCfg::PredMode = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::MultiRefLineIdx = ContextSetCfg::addCtxSet
({
{ 90, 212, CNU, },
{ 118, 212, CNU, },
{ 134, 169, CNU, },
{ 8, 8, DWS, },
{ 90, 212, },
{ 118, 212, },
{ 134, 169, },
{ 8, 8, },
});
const CtxSet ContextSetCfg::IntraLumaMpmFlag = ContextSetCfg::addCtxSet
......@@ -349,10 +349,10 @@ const CtxSet ContextSetCfg::MipMode = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet
({
{ CNU, CNU, CNU, },
{ CNU, CNU, CNU, },
{ CNU, CNU, CNU, },
{ DWS, DWS, DWS, },
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
});
const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet
......@@ -458,10 +458,10 @@ const CtxSet ContextSetCfg::QtCbf[] =
#endif
ContextSetCfg::addCtxSet
({
{ 163, 135, CNU, CNU, CNU, },
{ 150, 121, CNU, CNU, CNU, },
{ 124, CNU, CNU, CNU, CNU, },
{ 5, 0, DWS, DWS, DWS, },
{ 163, 135, },
{ 150, 121, },
{ 124, CNU, },
{ 5, 0, },
}),
ContextSetCfg::addCtxSet
({
......@@ -488,20 +488,6 @@ const CtxSet ContextSetCfg::SigCoeffGroup[] =
{ 90, 126, },
{ 5, 8, },
}),
ContextSetCfg::addCtxSet
({
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
}),
ContextSetCfg::addCtxSet
({
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
})
};
const CtxSet ContextSetCfg::SigFlag[] =
......@@ -604,17 +590,17 @@ 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, CNU, CNU, CNU, CNU, CNU, },
{ 125, 110, 109, 125, 125, 123, 111, 111, 95, 123, 140, 111, 110, 95, 169, 125, 140, 139, 139, 138, CNU, CNU, CNU, CNU, CNU, },
{ 125, 110, 109, 140, 111, 109, 111, 111, 140, 123, 111, 126, 111, 140, 79, 155, 142, 141, 140, 198, CNU, CNU, CNU, CNU, CNU, },
{ 8, 5, 4, 5, 4, 4, 5, 4, 1, 0, 5, 1, 0, 0, 0, 1, 1, 0, 0, 0, DWS, DWS, DWS, DWS, DWS, },
{ 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, CNU, },
{ 138, 123, 92, CNU, },
{ 109, 108, 77, CNU, },
{ 2, 1, 1, DWS, },
{ 137, 95, 63, },
{ 138, 123, 92, },
{ 109, 108, 77, },
{ 2, 1, 1, },
})
};
......@@ -622,17 +608,17 @@ 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, CNU, CNU, CNU, CNU, CNU, },
{ 95, 95, 109, 110, 110, 123, 125, 111, 124, 123, 140, 111, 110, 124, 154, 125, 126, 110, 124, 153, CNU, CNU, CNU, CNU, CNU, },
{ 110, 95, 94, 125, 125, 108, 111, 111, 95, 108, 111, 141, 111, 95, 78, 140, 186, 156, 125, 138, CNU, CNU, CNU, CNU, CNU, },
{ 8, 5, 8, 5, 5, 4, 5, 5, 4, 0, 5, 5, 1, 0, 0, 1, 4, 1, 0, 0, DWS, DWS, DWS, DWS, DWS, },
{ 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, CNU, },
{ 108, 123, 92, CNU, },
{ 109, 94, 92, CNU, },
{ 3, 2, 2, DWS, },
{ 108, 124, 138, },
{ 108, 123, 92, },
{ 109, 94, 92, },
{ 3, 2, 2, },
})
};
......@@ -840,6 +826,7 @@ const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet
});
#endif
#if !JVET_N0324_REGULAR_MRG_FLAG
const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet
({
#if JVET_N600_AMVR_TPM_CTX_REDUCTION
......@@ -854,14 +841,7 @@ const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet
{ 8, 12, 9, },
#endif
});
const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet
({
{ CNU, },
{ CNU, },
{ CNU, },
{ DWS, },
});
#endif
const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet
({
......@@ -908,10 +888,10 @@ const CtxSet ContextSetCfg::TsParFlag = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::TsGtxFlag = ContextSetCfg::addCtxSet
({
{ 124, 63, 79, 79, 95, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ 138, 47, 63, 63, 63, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ 124, 63, 63, 63, 63, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ 4, 1, 1, 1, 1, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, },
{ 124, 63, 79, 79, 95, },
{ 138, 47, 63, 63, 63, },
{ 124, 63, 63, 63, 63, },
{ 4, 1, 1, 1, 1, },
});
const CtxSet ContextSetCfg::TsResidualSign =
......
......@@ -231,7 +231,7 @@ public:
#endif
static const CtxSet QtRootCbf;
static const CtxSet QtCbf [3]; // [ channel ]
static const CtxSet SigCoeffGroup [4]; // [ ChannelType ]
static const CtxSet SigCoeffGroup [2]; // [ ChannelType ]
static const CtxSet LastX [2]; // [ ChannelType ]
static const CtxSet LastY [2]; // [ ChannelType ]
static const CtxSet SigFlag [6]; // [ ChannelType + State ]
......@@ -273,8 +273,9 @@ public:
#if !JVET_N0302_SIMPLFIED_CIIP
static const CtxSet MHIntraPredMode;
#endif
#if !JVET_N0324_REGULAR_MRG_FLAG
static const CtxSet TriangleFlag;
static const CtxSet TriangleIdx;
#endif
static const CtxSet SmvdFlag;
static const CtxSet IBCFlag;
static const CtxSet ISPMode;
......
......@@ -491,7 +491,9 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::Luma_IntraMode), pu.intraDir[COMPONENT_Y]);
}
#if !JVET_N0324_REGULAR_MRG_FLAG
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::TriangleFlag), pu.cu->triangle);
#endif
}
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine);
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::AffineType), pu.cu->affineType);
......@@ -902,11 +904,13 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
}
}
}
#if !JVET_N0324_REGULAR_MRG_FLAG
if (cu.cs->slice->getSPS()->getUseTriangle() && cu.cs->slice->isInterB() && cu.lwidth() * cu.lheight() >= TRIANGLE_MIN_SIZE && !cu.affine)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TriangleFlag), cu.triangle);
}
#endif
}
else
{
......
......@@ -126,7 +126,9 @@ enum class BlockStatistic {
MMVDMergeIdx,
MHIntraFlag,
SMVDFlag,
#if !JVET_N0324_REGULAR_MRG_FLAG
TriangleFlag,
#endif
TrianglePartitioning,
TriangleMVL0, //<< currently only uni-prediction enabled
TriangleMVL1, //<< currently only uni-prediction enabled
......@@ -231,7 +233,9 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
{ BlockStatistic::MMVDMergeIdx, std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeIdx", BlockStatisticType::Integer, "[0, 1]"}},
{ BlockStatistic::MHIntraFlag, std::tuple<std::string, BlockStatisticType, std::string>{"MHIntraFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::SMVDFlag, std::tuple<std::string, BlockStatisticType, std::string>{"SMVDFlag", BlockStatisticType::Flag, ""}},
#if !JVET_N0324_REGULAR_MRG_FLAG
{ BlockStatistic::TriangleFlag, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleFlag", BlockStatisticType::Flag, ""}},
#endif
{ BlockStatistic::TrianglePartitioning, std::tuple<std::string, BlockStatisticType, std::string>{"TrianglePartitioning", BlockStatisticType::Line, ""}},
{ BlockStatistic::TriangleMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"}},
{ BlockStatistic::TriangleMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"}},
......
......@@ -1299,10 +1299,6 @@ void CABACReader::extend_ref_line(CodingUnit& cu)
if (MRL_NUM_REF_LINES > 2 && multiRefIdx != MULTI_REF_LINE_IDX[0])
{
multiRefIdx = m_BinDecoder.decodeBin(Ctx::MultiRefLineIdx(1)) == 1 ? MULTI_REF_LINE_IDX[2] : MULTI_REF_LINE_IDX[1];
if (MRL_NUM_REF_LINES > 3 && multiRefIdx != MULTI_REF_LINE_IDX[1])
{
multiRefIdx = m_BinDecoder.decodeBin(Ctx::MultiRefLineIdx(2)) == 1 ? MULTI_REF_LINE_IDX[3] : MULTI_REF_LINE_IDX[2];
}
}
}
......@@ -2291,6 +2287,7 @@ void CABACReader::MHIntra_luma_pred_modes(CodingUnit &cu)
}
#endif
#if !JVET_N0324_REGULAR_MRG_FLAG
void CABACReader::triangle_mode( CodingUnit& cu )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__TRIANGLE_FLAG );
......@@ -2327,6 +2324,7 @@ void CABACReader::triangle_mode( CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "triangle_mode() triangle_mode=%d pos=(%d,%d) size: %dx%d\n", cu.triangle, cu.Y().x, cu.Y().y, cu.lumaSize().width, cu.lumaSize().height );
}
#endif
//================================================================================
// clause 7.3.8.7
......
......@@ -117,7 +117,9 @@ public:
void mvp_flag ( PredictionUnit& pu, RefPicList eRefList );
void MHIntra_flag ( PredictionUnit& pu );
void MHIntra_luma_pred_modes ( CodingUnit& cu );
#if !JVET_N0324_REGULAR_MRG_FLAG
void triangle_mode ( CodingUnit& cu );
#endif
void smvd_mode ( PredictionUnit& pu );
// pcm samples (clause 7.3.8.7)
......
......@@ -1015,10 +1015,6 @@ void CABACWriter::extend_ref_line(const PredictionUnit& pu)
if (MRL_NUM_REF_LINES > 2 && multiRefIdx != MULTI_REF_LINE_IDX[0])
{
m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[1], Ctx::MultiRefLineIdx(1));
if (MRL_NUM_REF_LINES > 3 && multiRefIdx != MULTI_REF_LINE_IDX[1])
{
m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[2], Ctx::MultiRefLineIdx(2));
}
}
}
}
......@@ -1055,10 +1051,6 @@ void CABACWriter::extend_ref_line(const CodingUnit& cu)
if (MRL_NUM_REF_LINES > 2 && multiRefIdx != MULTI_REF_LINE_IDX[0])
{
m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[1], Ctx::MultiRefLineIdx(1));
if (MRL_NUM_REF_LINES > 3 && multiRefIdx != MULTI_REF_LINE_IDX[1])
{
m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[2], Ctx::MultiRefLineIdx(2));
}
}
}
......@@ -2175,6 +2167,7 @@ void CABACWriter::MHIntra_luma_pred_modes(const CodingUnit& cu)
}
#endif
#if !JVET_N0324_REGULAR_MRG_FLAG
void CABACWriter::triangle_mode( const CodingUnit& cu )
{
if( !cu.cs->slice->getSPS()->getUseTriangle() || !cu.cs->slice->isInterB() || cu.lwidth() * cu.lheight() < TRIANGLE_MIN_SIZE || cu.affine )
......@@ -2209,6 +2202,7 @@ void CABACWriter::triangle_mode( const CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "triangle_mode() triangle_mode=%d pos=(%d,%d) size: %dx%d\n", cu.triangle, cu.Y().x, cu.Y().y, cu.lumaSize().width, cu.lumaSize().height );
}
#endif
//================================================================================
// clause 7.3.8.7
......
......@@ -128,7 +128,9 @@ public:
void MHIntra_flag ( const PredictionUnit& pu );
void MHIntra_luma_pred_modes ( const CodingUnit& cu );
#if !JVET_N0324_REGULAR_MRG_FLAG
void triangle_mode ( const CodingUnit& cu );
#endif
void smvd_mode ( const PredictionUnit& pu );
// pcm samples (clause 7.3.8.7)
......
Markdown is supported
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