Commit 729e766b authored by Guillaume Laroche's avatar Guillaume Laroche

JVET-L0194: One context for full-block Merge index

parent ebe60316
......@@ -290,9 +290,15 @@ const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
({
#if JVET_L0194_ONE_CTX_FOR_MRG_IDX
{ 137,},
{ 122,},
{ CNU,},
#else
{ 137, CNU, CNU, CNU, CNU,},
{ 122, CNU, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU, CNU,},
#endif
});
const CtxSet ContextSetCfg::PartSize = ContextSetCfg::addCtxSet
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_L0194_ONE_CTX_FOR_MRG_IDX 1 // one context for full-block Merge index
#define REUSE_CU_RESULTS 1
#define REMOVE_MV_ADAPT_PREC 1 // remove the high precision flag in the MV class
......
......@@ -1227,10 +1227,13 @@ void CABACReader::merge_idx( PredictionUnit& pu )
{
if( m_BinDecoder.decodeBin( Ctx::MergeIdx() ) )
{
#if !JVET_L0194_ONE_CTX_FOR_MRG_IDX
bool useExtCtx = pu.cs->sps->getSpsNext().getUseSubPuMvp();
#endif
pu.mergeIdx++;
for( ; pu.mergeIdx < numCandminus1; pu.mergeIdx++ )
{
#if !JVET_L0194_ONE_CTX_FOR_MRG_IDX
if( useExtCtx )
{
if( !m_BinDecoder.decodeBin( Ctx::MergeIdx( std::min<int>( pu.mergeIdx, NUM_MERGE_IDX_EXT_CTX - 1 ) ) ) )
......@@ -1240,11 +1243,14 @@ void CABACReader::merge_idx( PredictionUnit& pu )
}
else
{
#endif
if( !m_BinDecoder.decodeBinEP() )
{
break;
}
#if !JVET_L0194_ONE_CTX_FOR_MRG_IDX
}
#endif
}
}
}
......
......@@ -1196,18 +1196,24 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
}
else
{
#if !JVET_L0194_ONE_CTX_FOR_MRG_IDX
bool useExtCtx = pu.cs->sps->getSpsNext().getUseSubPuMvp();
#endif
m_BinEncoder.encodeBin( 1, Ctx::MergeIdx() );
for( unsigned idx = 1; idx < numCandminus1; idx++ )
{
#if !JVET_L0194_ONE_CTX_FOR_MRG_IDX
if( useExtCtx )
{
m_BinEncoder.encodeBin( pu.mergeIdx == idx ? 0 : 1, Ctx::MergeIdx( std::min<int>( idx, NUM_MERGE_IDX_EXT_CTX - 1 ) ) );
}
else
{
#endif
m_BinEncoder.encodeBinEP( pu.mergeIdx == idx ? 0 : 1 );
#if !JVET_L0194_ONE_CTX_FOR_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