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

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[] =
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -91,11 +91,9 @@ private:
const BinFracBits& fracBitsPar,
const BinFracBits& fracBitsGt1,
const BinFracBits& fracBitsGt2,
#if JVET_L0274
const int remGt2Bins,
const int remRegBins,
unsigned goRiceZero,
#endif
uint16_t ui16AbsGoRice,
int iQBits,
double errorScale,
......@@ -106,11 +104,9 @@ private:
const BinFracBits& fracBitsPar,
const BinFracBits& fracBitsGt1,
const BinFracBits& fracBitsGt2,
#if JVET_L0274
const int remGt2Bins,
const int remRegBins,
unsigned goRiceZero,
#endif
const uint16_t ui16AbsGoRice,
const bool useLimitedPrefixLength,
const int maxLog2TrDynamicRange ) const;
......
......@@ -672,7 +672,6 @@ const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,2
const uint32_t g_uiGroupIdx[MAX_TU_SIZE] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11
,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12
,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13 };
#if JVET_L0274
const uint32_t g_auiGoRiceParsCoeff[32] =
{
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3
......@@ -683,15 +682,6 @@ const uint32_t g_auiGoRicePosCoeff0[3][32] =
{1, 1, 1, 1, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16},
{1, 1, 2, 2, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16}
};
#else
const uint32_t g_auiGoRicePars[ 32 ] =
{
0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 2, 2
};
#endif
const uint32_t g_auiGoRiceRange[MAX_GR_ORDER_RESIDUAL] =
{
6, 5, 6, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION
......
......@@ -90,12 +90,8 @@ extern const uint32_t ctxIndMap4x4[4*4];
extern const uint32_t g_uiGroupIdx[ MAX_TU_SIZE ];
extern const uint32_t g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ];
#if JVET_L0274
extern const uint32_t g_auiGoRiceParsCoeff [ 32 ];
extern const uint32_t g_auiGoRicePosCoeff0[ 3 ][ 32 ];
#else
extern const uint32_t g_auiGoRicePars [ 32 ];
#endif
extern const uint32_t g_auiGoRiceRange[ MAX_GR_ORDER_RESIDUAL ]; //!< maximum value coded with Rice codes
// ====================================================================================================================
......
......@@ -74,7 +74,6 @@
#define JVET_L0274 1
#define JVET_L0274_ENCODER_SPEED_UP ( 1 && JVET_L0274 ) // encoder speed-up by pre-calculating position dependent parameters
#define L0074_SUBBLOCK_DEBLOCKING 1
......
......@@ -2416,10 +2416,6 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
}
uint8_t ctxOffset[16];
#if JVET_L0274
#else
unsigned nextPass = 0;
#endif
//===== decode absolute values =====
const int inferSigPos = nextSigPos != cctx.scanPosLast() ? ( cctx.isNotFirst() ? minSubPos : -1 ) : nextSigPos;
......@@ -2428,20 +2424,14 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
int lastNZPos = -1;
#endif
int numNonZero = 0;
#if JVET_L0274
bool is2x2subblock = ( cctx.log2CGSize() == 2 );
int remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK );
int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ) - remGt2Bins;
int firstPosMode2 = minSubPos - 1;
int firstPosMode1 = minSubPos - 1;
#endif
int sigBlkPos[ 1 << MLS_CG_SIZE ];
#if JVET_L0274
for( ; nextSigPos >= minSubPos && remRegBins >= 3; nextSigPos-- )
#else
for( ; nextSigPos >= minSubPos; nextSigPos-- )
#endif
{
int blkPos = cctx.blockPos( nextSigPos );
unsigned sigFlag = ( !numNonZero && nextSigPos == inferSigPos );
......@@ -2451,9 +2441,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
const unsigned sigCtxId = cctx.sigCtxIdAbs( nextSigPos, coeff, state );
sigFlag = m_BinDecoder.decodeBin( sigCtxId );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "sig_bin() bin=%d ctx=%d\n", sigFlag, sigCtxId );
#if JVET_L0274
remRegBins--;
#endif
}
if( sigFlag )
......@@ -2466,7 +2454,6 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
lastNZPos = std::max<int>( lastNZPos, nextSigPos );
#endif
#if JVET_L0274
RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 );
unsigned gt1Flag = m_BinDecoder.decodeBin( cctx.greater1CtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt1_flag() bin=%d ctx=%d\n", gt1Flag, cctx.greater1CtxIdAbs(ctxOff) );
......@@ -2486,27 +2473,13 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
}
}
coeff[ blkPos ] += 1 + parFlag + gt1Flag;
#else
RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_par );
unsigned parFlag = m_BinDecoder.decodeBin( cctx.parityCtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "par_flag() bin=%d ctx=%d\n", parFlag, cctx.parityCtxIdAbs(ctxOff) );
RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 );
unsigned gt1Flag = m_BinDecoder.decodeBin( cctx.greater1CtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt1_flag() bin=%d ctx=%d\n", gt1Flag, cctx.greater1CtxIdAbs(ctxOff) );
coeff[blkPos] += 1+parFlag+(gt1Flag<<1);
nextPass |= gt1Flag;
#endif
}
state = ( stateTransTable >> ((state<<2)+((coeff[blkPos]&1)<<1)) ) & 3;
}
#if JVET_L0274
firstPosMode2 = nextSigPos;
firstPosMode1 = ( firstPosMode1 > firstPosMode2 ? firstPosMode1 : firstPosMode2 );
#endif
#if JVET_L0274
//===== 2nd PASS: gt2 =====
for( int scanPos = firstSigPos; scanPos > firstPosMode1; scanPos-- )
{
......@@ -2574,43 +2547,6 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
coeff[blkPos] = tcoeff;
}
}
#else
//===== 2nd PASS: gt2 =====
if( nextPass )
{
nextPass = 0;
for( int scanPos = firstSigPos; scanPos >= minSubPos; scanPos-- )
{
TCoeff& tcoeff = coeff[ cctx.blockPos( scanPos ) ];
if( tcoeff > 2 )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt2 );
uint8_t& ctxOff = ctxOffset[ scanPos - minSubPos ];
unsigned gt2Flag = m_BinDecoder.decodeBin( cctx.greater2CtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2Flag, cctx.greater2CtxIdAbs(ctxOff) );
tcoeff += (gt2Flag<<1);
nextPass |= gt2Flag;
}
}
}
//===== 3rd PASS: Go-rice codes =====
if( nextPass )
{
for( int scanPos = firstSigPos; scanPos >= minSubPos; scanPos-- )
{
TCoeff& tcoeff = coeff[ cctx.blockPos( scanPos ) ];
if( tcoeff > 4 )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_escs );
unsigned ricePar = cctx.GoRiceParAbs( scanPos, coeff );
int remAbsLevel = m_BinDecoder.decodeRemAbsEP( ricePar, cctx.extPrec(), cctx.maxLog2TrDRange() );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", remAbsLevel, ricePar );
tcoeff += (remAbsLevel<<1);
}
}
}
#endif
//===== decode sign's =====
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__SIGN_BIT, Size( cctx.width(), cctx.height() ), cctx.compID() );
......
......@@ -2305,10 +2305,6 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
}
uint8_t ctxOffset[16];
#if JVET_L0274
#else
unsigned nextPass = 0;
#endif
//===== encode absolute values =====
const int inferSigPos = nextSigPos != cctx.scanPosLast() ? ( cctx.isNotFirst() ? minSubPos : -1 ) : nextSigPos;
......@@ -2319,19 +2315,13 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
int remAbsLevel = -1;
int numNonZero = 0;
unsigned signPattern = 0;
#if JVET_L0274
bool is2x2subblock = ( cctx.log2CGSize() == 2 );
int remGt2Bins = ( is2x2subblock ? MAX_NUM_GT2_BINS_2x2SUBBLOCK : MAX_NUM_GT2_BINS_4x4SUBBLOCK );
int remRegBins = ( is2x2subblock ? MAX_NUM_REG_BINS_2x2SUBBLOCK : MAX_NUM_REG_BINS_4x4SUBBLOCK ) - remGt2Bins;
int firstPosMode2 = minSubPos - 1;
int firstPosMode1 = minSubPos - 1;
#endif
#if JVET_L0274
for( ; nextSigPos >= minSubPos && remRegBins >= 3; nextSigPos-- )
#else
for( ; nextSigPos >= minSubPos; nextSigPos-- )
#endif
{
TCoeff Coeff = coeff[ cctx.blockPos( nextSigPos ) ];
unsigned sigFlag = ( Coeff != 0 );
......@@ -2340,9 +2330,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
const unsigned sigCtxId = cctx.sigCtxIdAbs( nextSigPos, coeff, state );
m_BinEncoder.encodeBin( sigFlag, sigCtxId );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "sig_bin() bin=%d ctx=%d\n", sigFlag, sigCtxId );
#if JVET_L0274
remRegBins--;
#endif
}
if( sigFlag )
......@@ -2359,7 +2347,6 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
if( nextSigPos != cctx.scanPosLast() ) signPattern <<= 1;
if( Coeff < 0 ) signPattern++;
#if JVET_L0274
unsigned gt1 = !!remAbsLevel;
m_BinEncoder.encodeBin( gt1, cctx.greater1CtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt1_flag() bin=%d ctx=%d\n", gt1, cctx.greater1CtxIdAbs(ctxOff) );
......@@ -2378,27 +2365,14 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
firstPosMode1 = nextSigPos - 1;
}
}
#else
m_BinEncoder.encodeBin( remAbsLevel&1, cctx.parityCtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "par_flag() bin=%d ctx=%d\n", remAbsLevel&1, cctx.parityCtxIdAbs(ctxOff) );
remAbsLevel >>= 1;
unsigned gt1 = !!remAbsLevel;
m_BinEncoder.encodeBin( gt1, cctx.greater1CtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt1_flag() bin=%d ctx=%d\n", gt1, cctx.greater1CtxIdAbs(ctxOff) );
nextPass |= gt1;
#endif
}
state = ( stateTransTable >> ((state<<2)+((Coeff&1)<<1)) ) & 3;
}
#if JVET_L0274
firstPosMode2 = nextSigPos;
firstPosMode1 = ( firstPosMode1 > firstPosMode2 ? firstPosMode1 : firstPosMode2 );
#endif
#if JVET_L0274
//===== 2nd PASS: gt2 =====
for( int scanPos = firstSigPos; scanPos > firstPosMode1; scanPos-- )
{
......@@ -2465,41 +2439,6 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
if( Coeff < 0 ) signPattern++;
}
}
#else
//===== 2nd PASS: gt2 =====
if( nextPass )
{
nextPass = 0;
for( int scanPos = firstSigPos; scanPos >= minSubPos; scanPos-- )
{
unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] );
if( absLevel > 2 )
{
uint8_t& ctxOff = ctxOffset[ scanPos - minSubPos ];
unsigned gt2 = ( absLevel > 4 );
m_BinEncoder.encodeBin( gt2, cctx.greater2CtxIdAbs(ctxOff) );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2, cctx.greater2CtxIdAbs(ctxOff) );
nextPass |= gt2;
}
}
}
//===== 3rd PASS: Go-rice codes =====
if( nextPass )
{
for( int scanPos = firstSigPos; scanPos >= minSubPos; scanPos-- )
{
unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] );
if( absLevel > 4 )
{
unsigned rem = ( absLevel - 5 ) >> 1;
unsigned ricePar = cctx.GoRiceParAbs( scanPos, coeff );
m_BinEncoder.encodeRemAbsEP( rem, ricePar, cctx.extPrec(), cctx.maxLog2TrDRange() );
DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, ricePar );
}
}
}
#endif
//===== encode sign's =====
#if HEVC_USE_SIGN_HIDING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment