diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 3ff28063f85ce0f3780445df7816d0e8481b3b7f..a70b6c8ffb3516d489517b9e297886994ec58511 100755 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -346,6 +346,15 @@ const CtxSet ContextSetCfg::DeltaQP = ContextSetCfg::addCtxSet { DWS, DWS, }, }); +#if JVET_P0042_FIX_INTER_DIR_CTX +const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet +({ + { 6, 13, 5, 4, 25, 48, }, + { 7, 6, 5, 4, 33, 34, }, + { CNU, CNU, CNU, CNU, CNU, CNU, }, + { 0, 0, 1, 4, 0, 0, }, +}); +#else const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet ({ { 6, 13, 5, 4, 25, }, @@ -353,6 +362,7 @@ const CtxSet ContextSetCfg::InterDir = ContextSetCfg::addCtxSet { CNU, CNU, CNU, CNU, CNU, }, { 0, 0, 1, 4, 0, }, }); +#endif const CtxSet ContextSetCfg::RefPic = ContextSetCfg::addCtxSet ({ diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 70e1ebf5be7e6630feb95ead2aa57712d4b3dbf6..5e6541df40716e7c694eefc6c98e729cedd70fd4 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include <assert.h> #include <cassert> +#define JVET_P0042_FIX_INTER_DIR_CTX 1 // JVET-P0042: Fix overlap in context between the bi-pred flag for 8x8 CUs and the L0/L1 flag for all size CUs + #define JVET_P0111_CHROMA_422_FIX 1 // JVET-P0422: Bug fix of chroma 422 intra mode mapping #define JVET_P0516_PLT_BINARIZATION 1 // JVET-P0516: PLT is always signaled when pred mode is euqal to 1 (intra mode) diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index c6d8fab2a9320216c73e183674dcb702bed4e59f..f130de9d49a126ceb5eced519bbec1a5fa478fc8 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -2395,13 +2395,25 @@ void CABACReader::inter_pred_idc( PredictionUnit& pu ) return; } } +#if JVET_P0042_FIX_INTER_DIR_CTX + if( m_BinDecoder.decodeBin( Ctx::InterDir(5) ) ) +#else if( m_BinDecoder.decodeBin( Ctx::InterDir(4) ) ) +#endif { +#if JVET_P0042_FIX_INTER_DIR_CTX + DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", 2, pu.lumaPos().x, pu.lumaPos().y ); +#else DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=4 value=%d pos=(%d,%d)\n", 2, pu.lumaPos().x, pu.lumaPos().y ); +#endif pu.interDir = 2; return; } +#if JVET_P0042_FIX_INTER_DIR_CTX + DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", 1, pu.lumaPos().x, pu.lumaPos().y ); +#else DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=4 value=%d pos=(%d,%d)\n", 1, pu.lumaPos().x, pu.lumaPos().y ); +#endif pu.interDir = 1; return; } diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 88bb014609feebf28f14a2b7eef7d7811af73740..afa561e6ac5c0e7b1b0b1b58e086982d336c794a 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -2200,8 +2200,13 @@ void CABACWriter::inter_pred_idc( const PredictionUnit& pu ) m_BinEncoder.encodeBin( 0, Ctx::InterDir(ctxId) ); } } +#if JVET_P0042_FIX_INTER_DIR_CTX + m_BinEncoder.encodeBin( ( pu.interDir == 2 ), Ctx::InterDir( 5 ) ); + DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", pu.interDir, pu.lumaPos().x, pu.lumaPos().y ); +#else m_BinEncoder.encodeBin( ( pu.interDir == 2 ), Ctx::InterDir( 4 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=4 value=%d pos=(%d,%d)\n", pu.interDir, pu.lumaPos().x, pu.lumaPos().y ); +#endif }