Commit 9f49a285 authored by Karsten Suehring's avatar Karsten Suehring

JVET-K0072 (dependent quantization and coefficient coding)

Patch originally by: Heiko Schwarz <Heiko.Schwarz@hhi.fraunhofer.de>
parent 91de7d96
......@@ -114,7 +114,7 @@ MaxNumMergeCand : 6
LMChroma : 4
DMVR : 1
IMV : 2
AltResiComp : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -101,6 +101,7 @@ MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -130,7 +130,7 @@ MaxNumMergeCand : 6
LMChroma : 4
DMVR : 1
IMV : 2
AltResiComp : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -117,6 +117,7 @@ MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -130,7 +130,7 @@ MaxNumMergeCand : 6
LMChroma : 4
DMVR : 1
IMV : 2
AltResiComp : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -117,6 +117,7 @@ MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -144,7 +144,7 @@ MaxNumMergeCand : 6
LMChroma : 4
DMVR : 1
IMV : 2
AltResiComp : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -131,6 +131,7 @@ MaxBTDepth : 3
MaxBTDepthISliceL : 3
MaxBTDepthISliceC : 3
MTT : 1
DepQuant : 1
# Fast tools
PBIntraFast : 1
......
......@@ -228,8 +228,11 @@ Void EncApp::xInitLibCfg()
#endif
#if JEM_TOOLS
m_cEncLib.setCABACEngineMode ( m_CABACEngineMode );
#if JVET_K0072
#else
m_cEncLib.setAltResiCompId ( m_altResiCompId );
#endif
#endif
#if JEM_TOOLS
m_cEncLib.setHighPrecisionMv ( m_highPrecisionMv );
m_cEncLib.setAffine ( m_Affine );
......@@ -468,8 +471,11 @@ Void EncApp::xInitLibCfg()
m_cEncLib.setUseScalingListId ( m_useScalingListId );
m_cEncLib.setScalingListFileName ( m_scalingListFileName );
#endif
#if JVET_K0072
m_cEncLib.setDepQuantEnabledFlag ( m_depQuantEnabledFlag);
#if HEVC_USE_SIGN_HIDING
m_cEncLib.setSignDataHidingEnabledFlag ( m_signDataHidingEnabledFlag);
#endif
#endif
m_cEncLib.setUseRateCtrl ( m_RCEnableRateControl );
m_cEncLib.setTargetBitrate ( m_RCTargetBitrate );
......
......@@ -814,7 +814,10 @@ Bool EncAppCfg::parseCfg( Int argc, TChar* argv[] )
#endif
("SubPuMvpLog2Size", m_SubPuMvpLog2Size, 2u, "Sub-PU TMVP size index: 2^n")
("CABACEngine", m_CABACEngineMode, 0u, "CABAC engine mode (0:standard, 1:multi-parameter, 2:adaptive window, 3:multi-par. + adap. window) [default: 0]")
#if JVET_K0072
#else
("AltResiComp", m_altResiCompId, 0u, "Alternative residual compression mode (0:off, 1:JEM) [default: off]")
#endif
#else
#endif
#if JEM_TOOLS
......@@ -1072,8 +1075,15 @@ Bool EncAppCfg::parseCfg( Int argc, TChar* argv[] )
("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.")
#endif
#if JVET_K0072
("DepQuant", m_depQuantEnabledFlag, true )
#if HEVC_USE_SIGN_HIDING
("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, false )
#endif
#else
#if HEVC_USE_SIGN_HIDING
("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, true)
#endif
#endif
("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates")
/* Misc. */
......@@ -1902,8 +1912,12 @@ Bool EncAppCfg::xCheckParameter()
#endif
#if JEM_TOOLS
xConfirmPara( m_CABACEngineMode > 0, "CABAC engine mode > 0 is only allowed with NEXT profile" );
#if JVET_K0072
xConfirmPara( m_depQuantEnabledFlag, "Dependent quantization can only be used with NEXT profile" );
#else
xConfirmPara( m_altResiCompId > 0, "Alternative residual compression can only be used with NEXT profile" );
#endif
#endif
#if JEM_TOOLS
xConfirmPara( m_highPrecisionMv, "High precision MV for temporal merging can only be used with NEXT profile" );
xConfirmPara( m_Affine, "Affine is only allowed with NEXT profile" );
......@@ -1954,6 +1968,15 @@ Bool EncAppCfg::xCheckParameter()
#if JEM_TOOLS
xConfirmPara( m_CABACEngineMode > 3, "CABAC engine mode must be less than or equal to 3." );
#endif
#if JVET_K0072
if( m_depQuantEnabledFlag )
{
xConfirmPara( !m_useRDOQ || !m_useRDOQTS, "RDOQ and RDOQTS must be equal to 1 if dependent quantization is enabled" );
#if HEVC_USE_SIGN_HIDING
xConfirmPara( m_signDataHidingEnabledFlag, "SignHideFlag must be equal to 0 if dependent quantization is enabled" );
#endif
}
#endif
#if JEM_TOOLS
xConfirmPara( m_LICMode > 2, "LICMode > 2 is not supported." );
#endif
......@@ -2030,9 +2053,12 @@ Bool EncAppCfg::xCheckParameter()
}
#endif
#if JEM_TOOLS
#if JVET_K0072
#else
#if JEM_TOOLS
xConfirmPara( m_altResiCompId > 1, "Alternative residual compression Id out of range (0:off, 1:JEM)" );
#endif
#endif
xConfirmPara( m_useAMaxBT && !m_QTBT, "AMaxBT can only be used with QTBT!" );
......@@ -3141,6 +3167,9 @@ Void EncAppCfg::xPrintParameter()
#endif
msg( VERBOSE, "TMVPMode:%d ", m_TMVPModeId );
#if JVET_K0072
msg( VERBOSE, " DQ:%d ", m_depQuantEnabledFlag);
#endif
#if HEVC_USE_SIGN_HIDING
msg( VERBOSE, " SignBitHidingFlag:%d ", m_signDataHidingEnabledFlag);
#endif
......@@ -3171,9 +3200,12 @@ Void EncAppCfg::xPrintParameter()
msg( VERBOSE, "IMV:%d ", m_ImvMode );
if( !m_QTBT ) msg( VERBOSE, "IMVMaxCand:%d ", m_ImvMaxCand );
#endif
#if JVET_K0072
#else
#if JEM_TOOLS
msg( VERBOSE, "AltResiComp:%d ", m_altResiCompId );
#endif
#endif
#if JEM_TOOLS
msg( VERBOSE, "HighPrecMv:%d ", m_highPrecisionMv );
msg( VERBOSE, "BIO:%d ", m_BIO );
......
......@@ -207,8 +207,11 @@ protected:
#endif
#if JEM_TOOLS
unsigned m_CABACEngineMode;
#if JVET_K0072
#else
unsigned m_altResiCompId;
#endif
#endif
#if JEM_TOOLS
bool m_highPrecisionMv;
bool m_Affine;
......@@ -443,8 +446,11 @@ protected:
UInt m_maxNumMergeCand; ///< Max number of merge candidates
Int m_TMVPModeId;
#if JVET_K0072
Bool m_depQuantEnabledFlag;
#if HEVC_USE_SIGN_HIDING
Bool m_signDataHidingEnabledFlag;
#endif
#endif
Bool m_RCEnableRateControl; ///< enable rate control or not
Int m_RCTargetBitrate; ///< target bitrate when rate control is enabled
......
......@@ -82,6 +82,9 @@ enum CodingStatisticsType
STATS__CABAC_BITS__LAST_SIG_X_Y,
STATS__CABAC_BITS__SIG_COEFF_GROUP_FLAG,
STATS__CABAC_BITS__SIG_COEFF_MAP_FLAG,
#if JVET_K0072
STATS__CABAC_BITS__PAR_FLAG,
#endif
STATS__CABAC_BITS__GT1_FLAG,
STATS__CABAC_BITS__GT2_FLAG,
STATS__CABAC_BITS__SIGN_BIT,
......@@ -151,6 +154,9 @@ static inline const TChar* getName(CodingStatisticsType name)
"CABAC_BITS__LAST_SIG_X_Y",
"CABAC_BITS__SIG_COEFF_GROUP_FLAG",
"CABAC_BITS__SIG_COEFF_MAP_FLAG",
#if JVET_K0072
"CABAC_BITS__PAR_FLAG",
#endif
"CABAC_BITS__GT1_FLAG",
"CABAC_BITS__GT2_FLAG",
"CABAC_BITS__SIGN_BIT",
......
......@@ -40,6 +40,8 @@
#include "CodingStructure.h"
#include "Picture.h"
#if JVET_K0072
#else
#if !HM_QTBT_AS_IN_JEM_CONTEXT
static const uint8_t spat_bypass_luma_all [] = { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27 };
static const uint8_t spat_bypass_chroma_all [] = { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 };
......@@ -209,6 +211,7 @@ static const uint8_t** spat_sig_ctx[2][5][3] =
}
};
#endif
#endif
#if HEVC_USE_SIGN_HIDING
CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID component, bool signHide)
......@@ -232,11 +235,17 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
#endif
, m_log2BlockSize ((m_log2BlockWidth + m_log2BlockHeight)>>1)
, m_maxNumCoeff (m_width * m_height)
#if JVET_K0072
#else
, m_AlignFlag (tu.cs->sps->getSpsRangeExtension().getCabacBypassAlignmentEnabledFlag())
#endif
#if HEVC_USE_SIGN_HIDING
, m_signHiding (signHide)
#endif
#if JVET_K0072
#else
, m_useGoRiceParAdapt (tu.cs->sps->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag())
#endif
, m_extendedPrecision (tu.cs->sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag())
, m_maxLog2TrDynamicRange (tu.cs->sps->getMaxLog2TrDynamicRange(m_chType))
#if HEVC_USE_MDCS
......@@ -257,11 +266,14 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_lastShiftX (0)
, m_lastShiftY (0)
, m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.transformSkip[m_compID]))
#if JVET_K0072
#else
, m_SigBlockType (m_TrafoBypass ? 0 : m_width == 4 && m_height == 4 ? 1 : m_width == 8 && m_height == 8 ? 2 : m_log2CGSize==2 ? 4 : 3 )
#if !HM_QTBT_AS_IN_JEM_CONTEXT
, m_SigScanPatternBase (spat_sig_ctx[m_chType][m_SigBlockType][m_scanType])
#endif
, m_sigCtxSet (Ctx::SigFlag[m_chType])
#endif
, m_scanPosLast (-1)
, m_subSetId (-1)
, m_subSetPos (-1)
......@@ -270,6 +282,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_minSubPos (-1)
, m_maxSubPos (-1)
, m_sigGroupCtxId (-1)
#if JVET_K0072
, m_tmplCpSum1 (-1)
, m_tmplCpDiag (-1)
, m_sigFlagCtxSet { Ctx::SigFlag[m_chType], Ctx::SigFlag[m_chType+2], Ctx::SigFlag[m_chType+4] }
, m_parFlagCtxSet ( Ctx::ParFlag[m_chType] )
, m_gtxFlagCtxSet { Ctx::GtxFlag[m_chType], Ctx::GtxFlag[m_chType+2] }
#else
#if !HM_QTBT_AS_IN_JEM_CONTEXT
, m_sigScanCtxId (0)
#endif
......@@ -277,10 +296,14 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_gt2FlagCtxId (-1)
, m_currentGolombRiceStatistic(-1)
, m_prevGt2 (false)
#endif
, m_sigCoeffGroupFlag ()
#if JVET_K0072
#else
#if JEM_TOOLS
, m_altResiCompId ( tu.cs->sps->getSpsNext().getAltResiCompId() )
#endif
#endif
#if JEM_TOOLS
, m_emtNumSigCoeff (0)
#endif
......@@ -329,6 +352,8 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
const_cast<int&>(m_lastShiftX) = (log2sizeX + 1) >> 2;
const_cast<int&>(m_lastShiftY) = (log2sizeY + 1) >> 2;
}
#if JVET_K0072
#else
#if JEM_TOOLS && HEVC_USE_MDCS
if( m_altResiCompId == 1 )
{
......@@ -346,6 +371,7 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
#endif
}
#endif
#endif
}
void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag )
......@@ -360,6 +386,13 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag )
{
m_sigCoeffGroupFlag.set ( m_subSetPos );
}
#if JVET_K0072
unsigned CGPosY = m_subSetPosY;
unsigned CGPosX = m_subSetPosX;
unsigned sigRight = unsigned( ( CGPosX + 1 ) < m_widthInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + 1 ] : false );
unsigned sigLower = unsigned( ( CGPosY + 1 ) < m_heightInGroups ? m_sigCoeffGroupFlag[ m_subSetPos + m_widthInGroups ] : false );
m_sigGroupCtxId = Ctx::SigCoeffGroup[m_chType]( sigRight | sigLower );
#else
unsigned CGPosY = 0;
unsigned CGPosX = 0;
unsigned sigRight = 0;
......@@ -430,9 +463,12 @@ void CoeffCodingContext::initSubblock( int SubsetId, bool sigGroupFlag )
m_sigGroupCtxId = Ctx::SigCoeffGroup [ m_chType + 2 ]( sigRight | sigLower );
}
#endif
#endif
}
#if JVET_K0072
#else
#if HM_QTBT_AS_IN_JEM_CONTEXT // ctx modeling for subblocks != 4x4
unsigned CoeffCodingContext::sigCtxId( int scanPos ) const
{
......@@ -498,6 +534,7 @@ unsigned CoeffCodingContext::sigCtxId( int scanPos ) const
return m_sigCtxSet( offset );
}
#endif
#endif
unsigned DeriveCtx::CtxCUsplit( const CodingStructure& cs, Partitioner& partitioner )
......@@ -552,11 +589,25 @@ unsigned DeriveCtx::CtxCUsplit( const CodingStructure& cs, Partitioner& partitio
}
#if ENABLE_BMS
#if JVET_K0072
unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf )
#else
unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth )
#endif
#else
#if JVET_K0072
unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const bool prevCbCbf )
#else
unsigned DeriveCtx::CtxQtCbf( const ComponentID compID )
#endif
#endif
{
#if JVET_K0072
if( compID == COMPONENT_Cr )
{
return ( prevCbCbf ? 1 : 0 );
}
#endif
#if ENABLE_BMS
if( isChroma( compID ) )
{
......
......@@ -57,15 +57,18 @@ public:
CoeffCodingContext( const TransformUnit& tu, ComponentID component );
#endif
public:
void initSubblock ( int SubsetId, bool sigGroupFlag = false );
void initSubblock ( int SubsetId, bool sigGroupFlag = false );
public:
void resetSigGroup () { m_sigCoeffGroupFlag.reset( m_subSetPos ); }
void setSigGroup () { m_sigCoeffGroupFlag.set( m_subSetPos ); }
void setScanPosLast ( int posLast ) { m_scanPosLast = posLast; }
#if JVET_K0072
#else
void setGt2Flag ( bool gt2Flag ) { m_prevGt2 = gt2Flag; }
void setGoRiceStats ( unsigned GRStats ) { m_currentGolombRiceStatistic = GRStats; }
void incGoRiceStats () { m_currentGolombRiceStatistic++; }
void decGoRiceStats () { m_currentGolombRiceStatistic--; }
#endif
public:
ComponentID compID () const { return m_compID; }
int subSetId () const { return m_subSetId; }
......@@ -78,12 +81,18 @@ public:
unsigned log2BlockWidth () const { return m_log2BlockWidth; }
unsigned log2BlockHeight () const { return m_log2BlockHeight; }
unsigned log2BlockSize () const { return m_log2BlockSize; }
#if JVET_K0072
#else
bool updGoRiceStats () const { return m_useGoRiceParAdapt; }
#endif
bool extPrec () const { return m_extendedPrecision; }
int maxLog2TrDRange () const { return m_maxLog2TrDynamicRange; }
unsigned maxNumCoeff () const { return m_maxNumCoeff; }
#if JVET_K0072
#else
unsigned currGoRiceStats () const { return m_currentGolombRiceStatistic; }
bool alignFlag () const { return m_AlignFlag; }
#endif
int scanPosLast () const { return m_scanPosLast; }
int minSubPos () const { return m_minSubPos; }
int maxSubPos () const { return m_maxSubPos; }
......@@ -105,6 +114,8 @@ public:
unsigned lastXCtxId ( unsigned posLastX ) const { return m_CtxSetLastX( m_lastOffsetX + ( posLastX >> m_lastShiftX ) ); }
unsigned lastYCtxId ( unsigned posLastY ) const { return m_CtxSetLastY( m_lastOffsetY + ( posLastY >> m_lastShiftY ) ); }
unsigned sigGroupCtxId () const { return m_sigGroupCtxId; }
#if JVET_K0072
#else
#if HM_QTBT_AS_IN_JEM_CONTEXT // ctx modeling for subblocks != 4x4
unsigned sigCtxId ( int scanPos ) const;
#else
......@@ -121,6 +132,97 @@ public:
{
return Ctx::SigCoeffGroup[ m_chType + 2 ]( 0 );
}
#endif
#if JVET_K0072
unsigned sigCtxIdAbs( int scanPos, const TCoeff* coeff, const int state )
{
const UInt posY = m_scanPosY[ scanPos ];
const UInt posX = m_scanPosX[ scanPos ];
const TCoeff* pData = coeff + posX + posY * m_width;
const Int diag = posX + posY;
Int numPos = 0;
Int sumAbs = 0;
#define UPDATE(x) {int a=abs(x);sumAbs+=std::min(4-(a&1),a);numPos+=!!a;}
if( posX < m_width-1 )
{
UPDATE( pData[1] );
if( posX < m_width-2 )
{
UPDATE( pData[2] );
}
if( posY < m_height-1 )
{
UPDATE( pData[m_width+1] );
}
}
if( posY < m_height-1 )
{
UPDATE( pData[m_width] );
if( posY < m_height-2 )
{
UPDATE( pData[m_width<<1] );
}
}
#undef UPDATE
int ctxOfs = std::min( sumAbs, 5 ) + ( diag < 2 ? 6 : 0 );
if( m_chType == CHANNEL_TYPE_LUMA )
{
ctxOfs += diag < 5 ? 6 : 0;
}
m_tmplCpDiag = diag;
m_tmplCpSum1 = sumAbs - numPos;
return m_sigFlagCtxSet[std::max( 0, state-1 )]( ctxOfs );
}
uint8_t ctxOffsetAbs()
{
int offset = 0;
if( m_tmplCpDiag != -1 )
{
offset = std::min( m_tmplCpSum1, 4 ) + 1;
offset += ( !m_tmplCpDiag ? ( m_chType == CHANNEL_TYPE_LUMA ? 15 : 5 ) : m_chType == CHANNEL_TYPE_LUMA ? m_tmplCpDiag < 3 ? 10 : ( m_tmplCpDiag < 10 ? 5 : 0 ) : 0 );
}
return uint8_t(offset);
}
unsigned parityCtxIdAbs ( uint8_t offset ) const { return m_parFlagCtxSet ( offset ); }
unsigned greater1CtxIdAbs ( uint8_t offset ) const { return m_gtxFlagCtxSet[1]( offset ); }
unsigned greater2CtxIdAbs ( uint8_t offset ) const { return m_gtxFlagCtxSet[0]( offset ); }
unsigned GoRiceParAbs( int scanPos, const TCoeff* coeff ) const
{
#define UPDATE(x) sum+=abs(x)-!!x
const UInt posY = m_scanPosY[ scanPos ];
const UInt posX = m_scanPosX[ scanPos ];
const TCoeff* pData = coeff + posX + posY * m_width;
Int sum = 0;
if( posX < m_width-1 )
{
UPDATE( pData[1] );
if( posX < m_width-2 )
{
UPDATE( pData[2] );
}
if( posY < m_height-1 )
{
UPDATE( pData[m_width+1] );
}
}
if( posY < m_height-1 )
{
UPDATE( pData[m_width] );
if( posY < m_height-2 )
{
UPDATE( pData[m_width<<1] );
}
}
#undef UPDATE
int r = g_auiGoRicePars[ std::min( sum, 31 ) ];
return r;
}
#else
unsigned sigCtxId ( int scanPos,
const TCoeff* coeff,
int strd = 0 )
......@@ -330,6 +432,7 @@ public:
}
return ( order == MAX_GR_ORDER_RESIDUAL ? ( MAX_GR_ORDER_RESIDUAL - 1 ) : order );
}
#endif
#if JEM_TOOLS
unsigned emtNumSigCoeff() const { return m_emtNumSigCoeff; }
......@@ -355,11 +458,17 @@ private:
#endif
const unsigned m_log2BlockSize;
const unsigned m_maxNumCoeff;
#if JVET_K0072
#else
const bool m_AlignFlag;
#endif
#if HEVC_USE_SIGN_HIDING
const bool m_signHiding;
#endif
#if JVET_K0072
#else
const bool m_useGoRiceParAdapt;
#endif
const bool m_extendedPrecision;
const int m_maxLog2TrDynamicRange;
CoeffScanType m_scanType;
......@@ -376,11 +485,14 @@ private:
const int m_lastShiftX;
const int m_lastShiftY;
const bool m_TrafoBypass;
#if JVET_K0072
#else
const int m_SigBlockType;
#if !HM_QTBT_AS_IN_JEM_CONTEXT
const uint8_t** m_SigScanPatternBase;
#endif
CtxSet m_sigCtxSet;
#endif
// modified
int m_scanPosLast;
int m_subSetId;
......@@ -390,6 +502,13 @@ private:
int m_minSubPos;
int m_maxSubPos;
unsigned m_sigGroupCtxId;
#if JVET_K0072
int m_tmplCpSum1;
int m_tmplCpDiag;
CtxSet m_sigFlagCtxSet[3];
CtxSet m_parFlagCtxSet;
CtxSet m_gtxFlagCtxSet[2];
#else
#if HM_QTBT_AS_IN_JEM_CONTEXT
int m_sigCGPattern;
#else
......@@ -399,10 +518,14 @@ private:
unsigned m_gt2FlagCtxId;
unsigned m_currentGolombRiceStatistic;
bool m_prevGt2;
#endif
std::bitset<MLS_GRP_NUM> m_sigCoeffGroupFlag;
#if JVET_K0072
#else
#if JEM_TOOLS
unsigned m_altResiCompId;
#endif
#endif
#if JEM_TOOLS
unsigned m_emtNumSigCoeff;
#endif
......@@ -453,10 +576,18 @@ namespace DeriveCtx
unsigned CtxCUsplit ( const CodingStructure& cs, Partitioner& partitioner );
unsigned CtxBTsplit ( const CodingStructure& cs, Partitioner& partitioner );
#if ENABLE_BMS
#if JVET_K0072
unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth, const bool prevCbCbf );
#else
unsigned CtxQtCbf ( const ComponentID compID, const unsigned trDepth );
#endif
#else
#if JVET_K0072
unsigned CtxQtCbf ( const ComponentID compID, const bool prevCbCbf );
#else
unsigned CtxQtCbf ( const ComponentID compID );
#endif
#endif
unsigned CtxInterDir ( const PredictionUnit& pu );
unsigned CtxSkipFlag ( const CodingUnit& cu );
#if JEM_TOOLS
......
......@@ -1038,6 +1038,14 @@ const CtxSet ContextSetCfg::QtCbf[] =
{ 149, 107, 167, 154, 154, },
{ 94, 138, 182, 154, 154, },
}),
#if JVET_K0072
ContextSetCfg::addCtxSet
({
{ 149, 149, },
{ 149, 149, },
{ 94, 94, },
}),
#endif
};
const CtxSet ContextSetCfg::SigCoeffGroup[] =
......@@ -1070,6 +1078,44 @@ const CtxSet ContextSetCfg::SigCoeffGroup[] =
const CtxSet ContextSetCfg::SigFlag[] =
{
#if JVET_K0072
ContextSetCfg::addCtxSet
({
{ 106, 167, 182, 124, 139, 169, 134, 167, 197, 183, 183, 184, 209, 198, 168, 168, 183, 170, CNU, CNU, },
{ 135, 152, 167, 153, 168, 140, 149, 182, 153, 183, 154, 155, 180, 198, 197, 183, 169, 170, CNU, CNU, },
{ 121, 138, 124, 139, 125, 111, 135, 139, 154, 140, 155, 127, 107, 185, 169, 170, 156, 143, CNU, CNU, },
}),
ContextSetCfg::addCtxSet
({
{ 177, 196, 153, 124, 198, 183, 166, 213, 226, 198, 198, 156, },
{ 134, 168, 168, 154, 169, 199, 166, 214, 227, 229, 185, 142, },
{ 149, 168, 153, 111, 140, 126, 182, 200, 111, 143, 142, 158, },
}),
ContextSetCfg::addCtxSet
({
{ 181, 127, 173, 201, 187, 173, 226, 173, 188, 202, 173, 188, 196, 223, 237, 223, 221, 223, CNU, CNU, },
{ 123, 142, 202, 157, 157, 188, 138, 158, 203, 173, 158, 174, 182, 223, 223, 223, 206, 237, CNU, CNU, },
{ 108, 157, 173, 158, 218, 189, 123, 159, 159, 174, 189, 204, 79, 223, 223, 207, 253, 191, CNU, CNU, },
}),
ContextSetCfg::addCtxSet
({
{ 210, 170, 143, 143, 201, 244, 182, 223, 223, 223, 159, 223, },
{ 167, 155, 158, 186, 127, 158, 197, 223, 223, 223, 206, 237, },
{ 137, 158, 157, 187, 204, 159, 185, 223, 238, 220, 253, 237, },
}),
ContextSetCfg::addCtxSet
({
{ 137, 142, 159, 158, 187, 159, 241, 174, 174, 159, 159, 203, 210, 223, 223, 223, 223, 223, CNU, CNU, },
{ 123, 157, 174, 143, 143, 203, 138, 159, 189, 159, 173, 174, 196, 223, 223, 223, 223, 223, CNU, CNU, },
{ 107, 143, 218, 173, 218, 189, 63, 219, 189, 175, 189, 204, 63, 223, 223, 223, 253, 191, CNU, CNU, },
}),
ContextSetCfg::addCtxSet
({
{ 196, 199, 143, 172, 158, 203, 196, 223, 223, 223, 223, 223, },
{ 167, 155, 159, 157, 157, 158, 182, 223, 223, 223, 223, 223, },
{ 181, 159, 143, 232, 143, 173, 169, 237, 223, 223, 238, 253, },
}),
#else
ContextSetCfg::addCtxSet
({
{ 170, 154, 139, 153, 139, 123, 123, 63, 124, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 140, },
......@@ -1094,7 +1140,55 @@ const CtxSet ContextSetCfg::SigFlag[] =
{ 136, 153, 139, 154, 125, 140, 122, 154, 184, 185, 171, 157, },
{ 167, 154, 169, 140, 155, 141, 153, 171, 185, 156, 171, 172, },
}),
#endif
};
#if JVET_K0072
const CtxSet ContextSetCfg::ParFlag[] =
{
ContextSetCfg::addCtxSet
({
{ 162, 134, 136, 167, 153, 138, 135, 167, 182, 168, 168, 150, 182, 153, 168, 110, 180, 168, 139, 168, 154, },
{ 133, 163, 151, 167, 138, 168, 149, 152, 153, 153, 124, 150, 153, 153, 168, 139, 166, 168, 168, 139, 139, },
{ 134, 120, 152, 123, 153, 153, 136, 123, 153, 168, 154, 152, 153, 153, 124, 139, 123, 168, 139, 154, 139, },
}),
ContextSetCfg::addCtxSet
({
{ 57, 192, 194, 225, 153, 139, 209, 168, 213, 123, 95, },
{ 147, 164, 137, 153, 124, 153, 210, 183, 183, 154, 139, },
{ 134, 121, 182, 183, 138, 183, 198, 154, 154, 124, 154, },
}),
};
const CtxSet ContextSetCfg::GtxFlag[] =
{