Commit f3b12f43 authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'm.sarwer/VVCSoftware_VTM-O0619_Gtx_Single_Pass_TS'

parents 771ed2d2 ea809c82
......@@ -88,6 +88,8 @@
#define JVET_O0256_ADJUST_THD_DEPQUANT 1 // JVET-O0256: Fast encoder with adjusted threshold in dependent quantization
#define JVET_O0619_GTX_SINGLE_PASS_TS_RESIDUAL_CODING 1 // JVET-O0619/O0623 : Single pass coding of abs_level_gtx_flag[x] for TS residual coding
#define JVET_O0272_LMCS_SIMP_INVERSE_MAPPING 1 // JVET-O0272: LMCS simplified inverse mapping
#define JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL 1 // JVET-O0247: not signal APS index when number APS is 2
......
......@@ -3271,6 +3271,34 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
int numGtBins = 4;
//===== 2nd PASS: gt2 =====
#if JVET_O0619_GTX_SINGLE_PASS_TS_RESIDUAL_CODING
for (int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++)
{
TCoeff& tcoeff = coeff[cctx.blockPos(scanPos)];
cutoffVal = 2;
for (int i = 0; i < numGtBins; i++)
{
if (tcoeff >= cutoffVal)
{
RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_gt2);
unsigned gt2Flag;
if (cctx.isContextCoded())
{
gt2Flag = m_BinDecoder.decodeBin(cctx.greaterXCtxIdAbsTS(cutoffVal >> 1));
tcoeff += (gt2Flag << 1);
DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2Flag, cctx.greaterXCtxIdAbsTS(cutoffVal >> 1), scanPos, tcoeff);
}
else
{
gt2Flag = m_BinDecoder.decodeBinEP();
tcoeff += (gt2Flag << 1);
DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() EPbin=%d sp=%d coeff=%d\n", i, gt2Flag, scanPos, tcoeff);
}
}
cutoffVal += 2;
}
}
#else
for( int i = 0; i < numGtBins; i++ )
{
for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ )
......@@ -3296,7 +3324,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
}
cutoffVal += 2;
}
#endif
//===== 3rd PASS: Go-rice codes =====
for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ )
{
......
......@@ -3108,6 +3108,31 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
int cutoffVal = 2;
int numGtBins = 4;
#if JVET_O0619_GTX_SINGLE_PASS_TS_RESIDUAL_CODING
for (int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++)
{
unsigned absLevel = abs(coeff[cctx.blockPos(scanPos)]);
cutoffVal = 2;
for (int i = 0; i < numGtBins; i++)
{
if (absLevel >= cutoffVal)
{
unsigned gt2 = (absLevel >= (cutoffVal + 2));
if (cctx.isContextCoded())
{
m_BinEncoder.encodeBin(gt2, cctx.greaterXCtxIdAbsTS(cutoffVal >> 1));
DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2, cctx.greaterXCtxIdAbsTS(cutoffVal >> 1), scanPos, min<int>(absLevel, cutoffVal + 2));
}
else
{
m_BinEncoder.encodeBinEP(gt2);
DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() EPbin=%d sp=%d coeff=%d\n", i, gt2, scanPos, min<int>(absLevel, cutoffVal + 2));
}
}
cutoffVal += 2;
}
}
#else
for( int i = 0; i < numGtBins; i++ )
{
for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ )
......@@ -3130,6 +3155,7 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
}
cutoffVal += 2;
}
#endif
//===== coeff bypass ====
for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ )
......
Supports Markdown
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