Commit 911daa7f authored by Frank Bossen's avatar Frank Bossen

Merge branch 'M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX' into 'master'

JVET-M0381 Test CE2.2.2.a: one context for Merge_subblock_idx (AffMergeIdx in VTM software)

See merge request jvet/VVCSoftware_VTM!175
parents bbb23a37 fc1075e7
Pipeline #576 passed with stage
......@@ -666,15 +666,28 @@ const CtxSet ContextSetCfg::AffineType = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::AffMergeIdx = ContextSetCfg::addCtxSet
( {
#if JVET_M0453_CABAC_ENGINE
#if JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
{ 109,},
{ 95,},
{ CNU,},
{ 0,},
#else
{ 109, 168, 168, 153, CNU,},
{ 95, 154, 139, 153, CNU,},
{ CNU, CNU, CNU, CNU, CNU,},
{ 0, 5, 9, 8, DWS,},
#endif
#else
#if JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
{ 123, },
{ 109, },
{ CNU, },
#else
{ 123, 154, 154, 168, CNU, },
{ 109, 154, 139, 168, CNU, },
{ CNU, CNU, CNU, CNU, CNU, },
#endif
#endif
} );
const CtxSet ContextSetCfg::GBiIdx = ContextSetCfg::addCtxSet
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX 1 // CE2.2.2 a: one context for subblock Merge index
#define JVET_M0118_M0185_TRIANGLE_FLAG_FIX 1 // Avoid signaling triangle flag if a CU uses MMVD or CIIP
#define JVET_M0487_INT_EXTEND 1 // CE9.1.1 b: integer reference samples as 1 extended samples
......
......@@ -1600,10 +1600,13 @@ void CABACReader::merge_idx( PredictionUnit& pu )
{
if ( m_BinDecoder.decodeBin( Ctx::AffMergeIdx() ) )
{
#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
bool useExtCtx = pu.cs->sps->getSBTMVPEnabledFlag();
#endif
pu.mergeIdx++;
for ( ; pu.mergeIdx < numCandminus1; pu.mergeIdx++ )
{
#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
if ( useExtCtx )
{
if ( !m_BinDecoder.decodeBin( Ctx::AffMergeIdx( std::min<int>( pu.mergeIdx, NUM_MERGE_IDX_EXT_CTX - 1 ) ) ) )
......@@ -1613,11 +1616,14 @@ void CABACReader::merge_idx( PredictionUnit& pu )
}
else
{
#endif
if ( !m_BinDecoder.decodeBinEP() )
{
break;
}
#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
}
#endif
}
}
}
......
......@@ -1488,18 +1488,24 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
}
else
{
#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
bool useExtCtx = pu.cs->sps->getSBTMVPEnabledFlag();
#endif
m_BinEncoder.encodeBin( 1, Ctx::AffMergeIdx() );
for ( unsigned idx = 1; idx < numCandminus1; idx++ )
{
#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
if ( useExtCtx )
{
m_BinEncoder.encodeBin( pu.mergeIdx == idx ? 0 : 1, Ctx::AffMergeIdx( std::min<int>( idx, NUM_MERGE_IDX_EXT_CTX - 1 ) ) );
}
else
{
#endif
m_BinEncoder.encodeBinEP( pu.mergeIdx == idx ? 0 : 1 );
#if !JVET_M0381_ONE_CTX_FOR_SUBBLOCK_MRG_IDX
}
#endif
if ( pu.mergeIdx == idx )
{
break;
......
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