From fc1075e79f5a92e6eb3366e3ff249a97e4fc41cd Mon Sep 17 00:00:00 2001 From: Laroche Guillaume <guillaume.laroche@crf.canon.fr> Date: Mon, 28 Jan 2019 17:56:32 +0100 Subject: [PATCH] JVET-M0381 Test CE2.2.2.a: one context for Merge_subblock_idx (AffMergeIdx in VTM software) --- source/Lib/CommonLib/Contexts.cpp | 13 +++++++++++++ source/Lib/CommonLib/TypeDef.h | 2 ++ source/Lib/DecoderLib/CABACReader.cpp | 6 ++++++ source/Lib/EncoderLib/CABACWriter.cpp | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index cbc516d35..5dd621fe0 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -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 diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 01ed35799..da702eae6 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -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 diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 6015b1921..7f57b25d5 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -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 } } } diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index a9795b6db..862ed9835 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -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; -- GitLab