Commit 44ee6a4b authored by Karsten Suehring's avatar Karsten Suehring
Browse files

remove macro JVET_L0274

parent b0e8dec1
......@@ -305,12 +305,10 @@ static const int MMVD_ADD_NUM = (MMVD_MAX_RE
static const int MMVD_MRG_MAX_RD_NUM = MRG_MAX_NUM_CANDS;
static const int MMVD_MRG_MAX_RD_BUF_NUM = (MMVD_MRG_MAX_RD_NUM + 1);///< increase buffer size by 1
#if JVET_L0274
static const int MAX_NUM_REG_BINS_4x4SUBBLOCK = 32; ///< max number of context-coded bins (incl. gt2 bins) per 4x4 subblock
static const int MAX_NUM_GT2_BINS_4x4SUBBLOCK = 4; ///< max number of gt2 bins per 4x4 subblock
static const int MAX_NUM_REG_BINS_2x2SUBBLOCK = 8; ///< max number of context-coded bins (incl. gt2 bins) per 2x2 subblock (chroma)
static const int MAX_NUM_GT2_BINS_2x2SUBBLOCK = 2; ///< max number of gt2 bins per 2x2 subblock (chroma)
#endif
#if JVET_L0256_BIO
static const int BIO_EXTEND_SIZE = 1;
......
......@@ -107,11 +107,7 @@ public:
const int diag = posX + posY;
int numPos = 0;
int sumAbs = 0;
#if JVET_L0274
#define UPDATE(x) {int a=abs(x);sumAbs+=std::min(2+(a&1),a);numPos+=!!a;}
#else
#define UPDATE(x) {int a=abs(x);sumAbs+=std::min(4-(a&1),a);numPos+=!!a;}
#endif
if( posX < m_width-1 )
{
UPDATE( pData[1] );
......@@ -158,7 +154,6 @@ public:
unsigned greater1CtxIdAbs ( uint8_t offset ) const { return m_gtxFlagCtxSet[1]( offset ); }
unsigned greater2CtxIdAbs ( uint8_t offset ) const { return m_gtxFlagCtxSet[0]( offset ); }
#if JVET_L0274
unsigned templateAbsSum( int scanPos, const TCoeff* coeff )
{
const uint32_t posY = m_scanPosY[scanPos];
......@@ -187,39 +182,6 @@ public:
}
return std::min(sum, 31);
}
#else
unsigned GoRiceParAbs( int scanPos, const TCoeff* coeff ) const
{
#define UPDATE(x) sum+=abs(x)-!!x
const uint32_t posY = m_scanPosY[ scanPos ];
const uint32_t 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;
}
#endif
unsigned emtNumSigCoeff() const { return m_emtNumSigCoeff; }
void setEmtNumSigCoeff( unsigned val ) { m_emtNumSigCoeff = val; }
......
......@@ -638,7 +638,6 @@ const CtxSet ContextSetCfg::SigCoeffGroup[] =
const CtxSet ContextSetCfg::SigFlag[] =
{
#if JVET_L0274
ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
......@@ -711,48 +710,9 @@ const CtxSet ContextSetCfg::SigFlag[] =
{ 166, 159, 158, 232, 158, 174, 183, 238, 223, 223, 223, 223, },
#endif
}),
#else
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, },
}),
#endif
};
#if JVET_L0274
const CtxSet ContextSetCfg::ParFlag[] =
{
ContextSetCfg::addCtxSet
......@@ -832,51 +792,6 @@ const CtxSet ContextSetCfg::GtxFlag[] =
#endif
}),
};
#else
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[] =
{
ContextSetCfg::addCtxSet
({
{ 59, 57, 59, 133, 164, 165, 117, 147, 134, 150, 137, 133, 163, 121, 166, 167, 163, 135, 136, 181, 139, },
{ 45, 57, 58, 44, 149, 91, 73, 89, 105, 91, 122, 74, 105, 121, 122, 138, 119, 106, 107, 152, 139, },
{ 135, 43, 119, 90, 76, 107, 74, 75, 106, 77, 93, 105, 91, 122, 93, 94, 150, 136, 123, 153, 125, },
}),
ContextSetCfg::addCtxSet
({
{ 133, 3, 14, 120, 135, 91, 179, 103, 194, 94, 111, },
{ 118, 102, 134, 135, 122, 123, 163, 120, 122, 153, 169, },
{ 195, 88, 74, 105, 152, 138, 120, 90, 107, 139, 184, },
}),
ContextSetCfg::addCtxSet
({
{ 3, 3, 103, 119, 91, 151, 3, 148, 194, 152, 138, 147, 164, 166, 167, 168, 133, 180, 196, 139, 169, },
{ 3, 3, 118, 120, 106, 152, 3, 119, 121, 122, 153, 118, 135, 166, 138, 139, 148, 151, 182, 168, 184, },
{ 132, 102, 104, 121, 92, 93, 104, 106, 122, 123, 94, 105, 137, 153, 139, 95, 121, 123, 139, 154, 126, },
}),
ContextSetCfg::addCtxSet
({
{ 3, 3, 176, 193, 137, 181, 161, 137, 183, 155, 111, },
{ 3, 3, 134, 137, 123, 124, 147, 167, 169, 199, 156, },
{ 147, 73, 164, 151, 107, 109, 120, 152, 140, 185, 111, },
}),
};
#endif
const CtxSet ContextSetCfg::LastX[] =
{
......
......@@ -64,11 +64,7 @@ namespace DQIntern
};
struct CoeffFracBits
{
#if JVET_L0274
int32_t bits[6];
#else
int32_t bits[7];
#endif
};
......@@ -948,20 +944,11 @@ namespace DQIntern
int32_t par0 = (1<<SCALE_BITS) + int32_t(fbPar.intBits[0]);
int32_t par1 = (1<<SCALE_BITS) + int32_t(fbPar.intBits[1]);
cb.bits[0] = 0;
#if JVET_L0274
cb.bits[1] = fbGt1.intBits[0] + (1 << SCALE_BITS);
cb.bits[2] = fbGt1.intBits[1] + par0 + fbGt2.intBits[0];
cb.bits[3] = fbGt1.intBits[1] + par1 + fbGt2.intBits[0];
cb.bits[4] = fbGt1.intBits[1] + par0 + fbGt2.intBits[1];
cb.bits[5] = fbGt1.intBits[1] + par1 + fbGt2.intBits[1];
#else
cb.bits[1] = par0 + fbGt1.intBits[0];
cb.bits[2] = par1 + fbGt1.intBits[0];
cb.bits[3] = par0 + fbGt1.intBits[1] + fbGt2.intBits[0];
cb.bits[4] = par1 + fbGt1.intBits[1] + fbGt2.intBits[0];
cb.bits[5] = par0 + fbGt1.intBits[1] + fbGt2.intBits[1];
cb.bits[6] = par1 + fbGt1.intBits[1] + fbGt2.intBits[1];
#endif
}
}
#endif
......@@ -991,15 +978,8 @@ namespace DQIntern
int insidePos;
int nextInsidePos;
NbInfoSbb nextNbInfoSbb;
#if JVET_L0274
bool eosbb;
ScanPosType spt;
#else
bool sosbb;
bool eosbb;
bool socsbb;
bool eocsbb;
#endif
int sbbPos;
int nextSbbRight;
int nextSbbBelow;
......@@ -1036,19 +1016,12 @@ namespace DQIntern
sbbPos = m_rateEst.sbbPos ( scanIdx );
lastOffset = m_rateEst.lastOffset ( scanIdx );
insidePos = scanIdx & m_sbbMask;
#if JVET_L0274
eosbb = ( insidePos == 0 );
spt = SCAN_ISCSBB;
if( insidePos == m_sbbMask && scanIdx > sbbSize && scanIdx < m_numCoeffMinus1 )
spt = SCAN_SOCSBB;
else if( eosbb && scanIdx > 0 && scanIdx < m_numCoeffMinusSbb )
spt = SCAN_EOCSBB;
#else
sosbb = ( insidePos == m_sbbMask );
eosbb = ( insidePos == 0 );
socsbb = ( sosbb && scanIdx > sbbSize && scanIdx < m_numCoeffMinus1 );
eocsbb = ( eosbb && scanIdx > 0 && scanIdx < m_numCoeffMinusSbb );
#endif
if( scanIdx )
{
const int nextScanIdx = scanIdx - 1;
......@@ -1373,7 +1346,6 @@ namespace DQIntern
uint8_t m_memory[ 8 * ( MAX_TU_SIZE * MAX_TU_SIZE + MLS_GRP_NUM ) ];
};
#if JVET_L0274
#define RICEMAX 32
const int32_t g_goRiceBits[4][RICEMAX] =
{
......@@ -1382,7 +1354,6 @@ namespace DQIntern
{ 98304, 98304, 98304, 98304, 131072, 131072, 131072, 131072, 163840, 163840, 163840, 163840, 196608, 196608, 196608, 196608, 229376, 229376, 229376, 229376, 262144, 262144, 262144, 262144, 294912, 294912, 294912, 294912, 360448, 360448, 360448, 360448 },
{ 131072, 131072, 131072, 131072, 131072, 131072, 131072, 131072, 163840, 163840, 163840, 163840, 163840, 163840, 163840, 163840, 196608, 196608, 196608, 196608, 196608, 196608, 196608, 196608, 229376, 229376, 229376, 229376, 229376, 229376, 229376, 229376 }
};
#endif
class State
{
......@@ -1399,19 +1370,14 @@ namespace DQIntern
{
m_rdCost = std::numeric_limits<int64_t>::max()>>1;
m_numSigSbb = 0;
#if JVET_L0274
m_remRegBins = 3; // just large enough for last scan pos
#endif
m_refSbbCtxId = -1;
m_sigFracBits = m_sigFracBitsArray[ 0 ];
m_coeffFracBits = m_gtxFracBitsArray[ 0 ];
m_goRicePar = 0;
#if JVET_L0274
m_goRiceZero = 0;
#endif
}
#if JVET_L0274
void checkRdCosts( const ScanPosType spt, const PQData& pqDataA, const PQData& pqDataB, Decision& decisionA, Decision& decisionB) const
{
const int32_t* goRiceTab = g_goRiceBits[m_goRicePar];
......@@ -1482,85 +1448,9 @@ namespace DQIntern
decisionB.prevId = m_stateId;
}
}
#else
template<ScanPosType spt> inline void checkRdCostZero(Decision &decision) const
{
int64_t rdCost = m_rdCost;
if( spt == SCAN_ISCSBB )
{
rdCost += m_sigFracBits.intBits[0];
}
else if( spt == SCAN_SOCSBB )
{
rdCost += m_sbbFracBits.intBits[1] + m_sigFracBits.intBits[0];
}
else if( m_numSigSbb )
{
rdCost += m_sigFracBits.intBits[0];
}
else
{
return;
}
if( rdCost < decision.rdCost )
{
decision.rdCost = rdCost;
decision.absLevel = 0;
decision.prevId = m_stateId;
}
}
inline int32_t getLevelBits(const unsigned level) const
{
if( level < 5 )
{
return m_coeffFracBits.bits[level];
}
unsigned value = ( level - 5 ) >> 1;
int32_t bits = m_coeffFracBits.bits[ level - (value << 1) ];
unsigned thres = g_auiGoRiceRange[ m_goRicePar ] << m_goRicePar;
if( value < thres )
{
return bits + ( ( ( value >> m_goRicePar ) + 1 + m_goRicePar ) << SCALE_BITS );
}
unsigned length = m_goRicePar;
unsigned delta = 1 << length;
unsigned valLeft = value - thres;
while( valLeft >= delta )
{
valLeft -= delta;
delta = 1 << (++length);
}
return bits + ( ( g_auiGoRiceRange[ m_goRicePar ] + 1 + ( length << 1 ) - m_goRicePar ) << SCALE_BITS );
}
template<ScanPosType spt> inline void checkRdCostNonZero(const PQData &pqData, Decision &decision) const
{
int64_t rdCost = m_rdCost + pqData.deltaDist + getLevelBits( pqData.absLevel );
if( spt == SCAN_ISCSBB )
{
rdCost += m_sigFracBits.intBits[1];
}
else if( spt == SCAN_SOCSBB )
{
rdCost += m_sbbFracBits.intBits[1] + m_sigFracBits.intBits[1];
}
else if( m_numSigSbb )
{
rdCost += m_sigFracBits.intBits[1];
}
if( rdCost < decision.rdCost )
{
decision.rdCost = rdCost;
decision.absLevel = pqData.absLevel;
decision.prevId = m_stateId;
}
}
#endif
inline void checkRdCostStart(int32_t lastOffset, const PQData &pqData, Decision &decision) const
{
#if JVET_L0274
int64_t rdCost = pqData.deltaDist + lastOffset;
if (pqData.absLevel < 4)
{
......@@ -1571,9 +1461,6 @@ namespace DQIntern
const unsigned value = (pqData.absLevel - 4) >> 1;
rdCost += m_coeffFracBits.bits[pqData.absLevel - (value << 1)] + g_goRiceBits[m_goRicePar][value < RICEMAX ? value : RICEMAX-1];
}
#else
int64_t rdCost = pqData.deltaDist + lastOffset + getLevelBits( pqData.absLevel );
#endif
if( rdCost < decision.rdCost )
{
decision.rdCost = rdCost;
......@@ -1596,30 +1483,18 @@ namespace DQIntern
private:
int64_t m_rdCost;
uint16_t m_absLevelsAndCtxInit[24]; // 16x8bit for abs levels + 16x16bit for ctx init id
#if JVET_L0274
int8_t m_numSigSbb;
int8_t m_remRegBins;
int8_t m_refSbbCtxId;
#else
int32_t m_numSigSbb;
int32_t m_refSbbCtxId;
#endif
BinFracBits m_sbbFracBits;
BinFracBits m_sigFracBits;
CoeffFracBits m_coeffFracBits;
#if JVET_L0274
int8_t m_goRicePar;
int8_t m_goRiceZero;
const int8_t m_stateId;
#else
int m_goRicePar;
const int m_stateId;
#endif
const BinFracBits*const m_sigFracBitsArray;
const CoeffFracBits*const m_gtxFracBitsArray;
#if JVET_L0274
const uint32_t*const m_goRiceZeroArray;
#endif
CommonCtx& m_commonCtx;
};
......@@ -1629,9 +1504,7 @@ namespace DQIntern
, m_stateId ( stateId )
, m_sigFracBitsArray( rateEst.sigFlagBits(stateId) )
, m_gtxFracBitsArray( rateEst.gtxFracBits(stateId) )
#if JVET_L0274
, m_goRiceZeroArray ( g_auiGoRicePosCoeff0[std::max(0,stateId-1)] )
#endif
, m_commonCtx ( commonCtx )
{
}
......@@ -1648,7 +1521,6 @@ namespace DQIntern
m_numSigSbb = prvState->m_numSigSbb + !!decision.absLevel;
m_refSbbCtxId = prvState->m_refSbbCtxId;
m_sbbFracBits = prvState->m_sbbFracBits;
#if JVET_L0274
m_remRegBins = prvState->m_remRegBins - 1;
m_goRicePar = prvState->m_goRicePar;
if( m_remRegBins >= 3 )
......@@ -1660,14 +1532,12 @@ namespace DQIntern
}
m_remRegBins -= std::min<TCoeff>( decision.absLevel, 2 );
}
#endif
::memcpy( m_absLevelsAndCtxInit, prvState->m_absLevelsAndCtxInit, 48*sizeof(uint8_t) );
}
else
{
m_numSigSbb = 1;
m_refSbbCtxId = -1;
#if JVET_L0274
if ( scanInfo.sbbSize == 4 )
{
m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK - MAX_NUM_GT2_BINS_2x2SUBBLOCK - std::min<TCoeff>( decision.absLevel, 2 );
......@@ -1677,14 +1547,12 @@ namespace DQIntern
m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - MAX_NUM_GT2_BINS_4x4SUBBLOCK - std::min<TCoeff>( decision.absLevel, 2 );
}
m_goRicePar = ( ((decision.absLevel - 4) >> 1) > (3<<0)-1 ? 1 : 0 );
#endif
::memset( m_absLevelsAndCtxInit, 0, 48*sizeof(uint8_t) );
}
uint8_t* levels = reinterpret_cast<uint8_t*>(m_absLevelsAndCtxInit);
levels[ scanInfo.insidePos ] = (uint8_t)std::min<TCoeff>( 255, decision.absLevel );
#if JVET_L0274
if (m_remRegBins >= 3)
{
TCoeff tinit = m_absLevelsAndCtxInit[8 + scanInfo.nextInsidePos];
......@@ -1765,49 +1633,6 @@ namespace DQIntern
m_goRicePar = g_auiGoRiceParsCoeff[sumAbs];
m_goRiceZero = m_goRiceZeroArray[sumAbs];
}
#else
TCoeff tinit = m_absLevelsAndCtxInit[ 8 + scanInfo.nextInsidePos ];
TCoeff sumAbs = tinit >> 8;
TCoeff sumAbs1 = ( tinit >> 3 ) & 31;
TCoeff sumNum = tinit & 7;
#define UPDATE(k) {TCoeff t=levels[scanInfo.nextNbInfoSbb.inPos[k]]; sumAbs+=t; sumAbs1+=std::min<TCoeff>(4-(t&1),t); sumNum+=!!t; }
if( numIPos == 1 )
{
UPDATE(0);
}
else if( numIPos == 2 )
{
UPDATE(0);
UPDATE(1);
}
else if( numIPos == 3 )
{
UPDATE(0);
UPDATE(1);
UPDATE(2);
}
else if( numIPos == 4 )
{
UPDATE(0);
UPDATE(1);
UPDATE(2);
UPDATE(3);
}
else if( numIPos == 5 )
{
UPDATE(0);
UPDATE(1);
UPDATE(2);
UPDATE(3);
UPDATE(4);
}
#undef UPDATE
TCoeff sumGt1 = sumAbs1 - sumNum;
sumAbs -= sumNum;
m_sigFracBits = m_sigFracBitsArray[ scanInfo.sigCtxOffsetNext + ( sumAbs1 < 5 ? sumAbs1 : 5 ) ];
m_coeffFracBits = m_gtxFracBitsArray[ scanInfo.gtxCtxOffsetNext + ( sumGt1 < 4 ? sumGt1 : 4 ) ];
m_goRicePar = g_auiGoRicePars [ sumAbs < 31 ? sumAbs : 31 ];
#endif
}
}
......@@ -1836,17 +1661,9 @@ namespace DQIntern
TCoeff tinit = m_absLevelsAndCtxInit[ 8 + scanInfo.nextInsidePos ];
TCoeff sumNum = tinit & 7;
TCoeff sumAbs1 = ( tinit >> 3 ) & 31;
#if JVET_L0274
#else
TCoeff sumAbs = ( tinit >> 8 ) - sumNum;
#endif
TCoeff sumGt1 = sumAbs1 - sumNum;
m_sigFracBits = m_sigFracBitsArray[ scanInfo.sigCtxOffsetNext + ( sumAbs1 < 5 ? sumAbs1 : 5 ) ];
m_coeffFracBits = m_gtxFracBitsArray[ scanInfo.gtxCtxOffsetNext + ( sumGt1 < 4 ? sumGt1 : 4 ) ];
#if JVET_L0274
#else
m_goRicePar = g_auiGoRicePars [ sumAbs < 31 ? sumAbs : 31 ];
#endif
}
}
......@@ -1870,7 +1687,6 @@ namespace DQIntern
const int sigNSbb = ( ( scanInfo.nextSbbRight ? sbbFlags[ scanInfo.nextSbbRight ] : false ) || ( scanInfo.nextSbbBelow ? sbbFlags[ scanInfo.nextSbbBelow ] : false ) ? 1 : 0 );
currState.m_numSigSbb = 0;
#if JVET_L0274
if (scanInfo.sbbSize == 4)
{
currState.m_remRegBins = MAX_NUM_REG_BINS_2x2SUBBLOCK - MAX_NUM_GT2_BINS_2x2SUBBLOCK;
......@@ -1879,7 +1695,6 @@ namespace DQIntern
{
currState.m_remRegBins = MAX_NUM_REG_BINS_4x4SUBBLOCK - MAX_NUM_GT2_BINS_4x4SUBBLOCK;
}
#endif
currState.m_goRicePar = 0;
currState.m_refSbbCtxId = currState.m_stateId;
currState.m_sbbFracBits = m_sbbFlagBits[ sigNSbb ];
......@@ -1893,11 +1708,7 @@ namespace DQIntern
if( nbOut->num )
{
TCoeff sumAbs = 0, sumAbs1 = 0, sumNum = 0;
#if JVET_L0274
#define UPDATE(k) {TCoeff t=absLevels[nbOut->outPos[k]]; sumAbs+=t; sumAbs1+=std::min<TCoeff>(2+(t&1),t); sumNum+=!!t; }
#else
#define UPDATE(k) {TCoeff t=absLevels[nbOut->outPos[k]]; sumAbs+=t; sumAbs1+=std::min<TCoeff>(4-(t&1),t); sumNum+=!!t; }
#endif
UPDATE(0);
if( nbOut->num > 1 )
{
......@@ -1944,12 +1755,7 @@ namespace DQIntern
private:
void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo );
#if JVET_L0274
void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions );
#else
template<ScanPosType spt>
void xDecide ( const TCoeff absCoeff, int32_t lastOffset, Decision* decisions );
#endif
private:
CommonCtx m_commonCtx;
......@@ -1987,36 +1793,16 @@ namespace DQIntern
#undef DINIT
#if JVET_L0274
void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions)
#else
template<ScanPosType spt>
void DepQuant::xDecide( const TCoeff absCoeff, int32_t lastOffset, Decision* decisions )
#endif
{
::memcpy( decisions, startDec, 8*sizeof(Decision) );
PQData pqData[4];
m_quant.preQuantCoeff( absCoeff, pqData );
#if JVET_L0274
m_prevStates[0].checkRdCosts( spt, pqData[0], pqData[2], decisions[0], decisions[2]);
m_prevStates[1].checkRdCosts( spt, pqData[0], pqData[2], decisions[2], decisions[0]);
m_prevStates[2].checkRdCosts( spt, pqData[3], pqData[1], decisions[1], decisions[3]);
m_prevStates[3].checkRdCosts( spt, pqData[3], pqData[1], decisions[3], decisions[1]);
#else
m_prevStates[0].checkRdCostNonZero<spt> ( pqData[0], decisions[0] );
m_prevStates[0].checkRdCostNonZero<spt> ( pqData[2], decisions[2] );
m_prevStates[0].checkRdCostZero<spt> ( decisions[0] );
m_prevStates[1].checkRdCostNonZero<spt> ( pqData[2], decisions[0] );
m_prevStates[1].checkRdCostNonZero<spt> ( pqData[0], decisions[2] );