diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index b8a593afdc0659e1d7c983f608ddea9004dec4d5..02dabecb9ce7dff5282060e11a44a3c2591260a3 100755 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -671,10 +671,17 @@ const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::LFNSTIdx = ContextSetCfg::addCtxSet ({ +#if JVET_P0350_LFNST_IDX_CTX + { 45, 37, 32, }, + { 38, 45, 32, }, + { CNU, 45, 32, }, + { 8, 8, 1, }, +#else { 45, 37, }, { 38, 45, }, { CNU, 45, }, { 8, 8, }, +#endif }); const CtxSet ContextSetCfg::PLTFlag = ContextSetCfg::addCtxSet diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index f47bc9d5ac1ed81b56f4ab2635b8522e40ef6056..c7f4251f70ed2cd70f439b930d33b48cee702459 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -53,6 +53,8 @@ #define JVET_P0803_COMBINED_MIP_CLEANUP 1 // JVET-P0803: Several MIP cleanups +#define JVET_P0350_LFNST_IDX_CTX 1 // JVET-P0350: Add one context for LFNST idx coding + #define JVET_P0641_REMOVE_2xN_CHROMA_INTRA 1 // JVET-P0641: removing 2xN chroma intra blocks #define JVET_P0206_TMVP_flags 1 // JVET-P0206: Signalling TMVP usage (remove pps TMVP idc and constraint when RPR is used) diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 7fc535971f61de81ed390caca58d4f4937eb8b0a..0790b010ac399f942b7c4fb76ecd8103ca3fbae7 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -3269,7 +3269,11 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( cctx ) ); if( idxLFNST ) { +#if JVET_P0350_LFNST_IDX_CTX + idxLFNST += m_BinDecoder.decodeBin(Ctx::LFNSTIdx(2)); +#else idxLFNST += m_BinDecoder.decodeBinEP(); +#endif } cu.lfnstIdx = idxLFNST; diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index e96a72b0e7378ed0dc7e81d2f9f6f0ebfa31eb55..a277b15fc8db83fc0965be8c639a9bb60d151e43 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -3030,7 +3030,11 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) if( idxLFNST ) { +#if JVET_P0350_LFNST_IDX_CTX + m_BinEncoder.encodeBin( (idxLFNST - 1) ? 1 : 0, Ctx::LFNSTIdx(2)); +#else m_BinEncoder.encodeBinEP( ( idxLFNST - 1 ) ? 1 : 0 ); +#endif } DTRACE( g_trace_ctx, D_SYNTAX, "residual_lfnst_mode() etype=%d pos=(%d,%d) mode=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), ( int ) cu.lfnstIdx );