Commit c941d1d2 authored by Mohammed Golam Sarwer's avatar Mohammed Golam Sarwer
Browse files

JVET-O0619/O0623 : Single pass coding of abs_level_gtx_flag[x] for TS residual coding

parent 829fd694
This diff is collapsed.
......@@ -3251,6 +3251,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++ )
......@@ -3276,7 +3304,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
}
cutoffVal += 2;
}
#endif
//===== 3rd PASS: Go-rice codes =====
for( int scanPos = firstSigPos; scanPos <= minSubPos; scanPos++ )
{
......
......@@ -3088,6 +3088,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++ )
......@@ -3110,6 +3135,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