Commit e7354ee5 authored by Xiang Li's avatar Xiang Li

Merge branch 'Shelly/VVCSoftware_VTM-JVET_O0294_TransformCleanup'

parents c0db77c3 4d0ce7cc
Pipeline #1915 passed with stage
......@@ -87,6 +87,8 @@
#define JVET_O0364_PDPC_DC 1 // JVET-O0364 Part 4: align PDPC process for DC with the one for Planar
#define JVET_O0364_PDPC_ANGULAR 1 // JVET-O0364 Part 5: simplify PDPC process for angular modes
#define JVET_O0294_TRANSFORM_CLEANUP 1 // JVET-O0294: Context modelling for MTS index
#define JVET_O1124_ALLOW_CCLM_COND 1 // JVET-O1124/JVET-O0196: CCLM restriction to reduce luma-chroma latency for chroma separate tree
#define FIX_DB_MAX_TRANSFORM_SIZE 1
......
......@@ -2485,7 +2485,9 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID )
void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
{
#if !JVET_O0294_TRANSFORM_CLEANUP
const CodingUnit &cu = *tu.cu;
#endif
const bool tsAllowed = TU::isTSAllowed ( tu, compID );
const bool mtsAllowed = TU::isMTSAllowed( tu, compID );
......@@ -2501,14 +2503,22 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
{
ctxIdx = 6;
symbol = m_BinDecoder.decodeBin( Ctx::MTSIndex( ctxIdx ) );
#if JVET_O0294_TRANSFORM_CLEANUP
tu.mtsIdx = symbol ? MTS_SKIP : MTS_DCT2_DCT2;
#else
tu.mtsIdx = symbol ? MTS_DCT2_DCT2 : MTS_SKIP;
#endif
}
if( tu.mtsIdx != MTS_SKIP )
{
if( mtsAllowed )
{
#if JVET_O0294_TRANSFORM_CLEANUP
ctxIdx = 0;
#else
ctxIdx = std::min( (int)cu.qtDepth, 5 );
#endif
symbol = m_BinDecoder.decodeBin( Ctx::MTSIndex( ctxIdx ) );
if( symbol )
......@@ -2528,7 +2538,11 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
}
}
}
#if JVET_O0294_TRANSFORM_CLEANUP
DTRACE(g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tu.mtsIdx);
#else
DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), tu.mtsIdx );
#endif
}
void CABACReader::isp_mode( CodingUnit& cu )
......
......@@ -2382,7 +2382,9 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID )
void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
{
#if !JVET_O0294_TRANSFORM_CLEANUP
const CodingUnit &cu = *tu.cu;
#endif
const bool tsAllowed = TU::isTSAllowed ( tu, compID );
const bool mtsAllowed = TU::isMTSAllowed( tu, compID );
......@@ -2393,7 +2395,11 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
if( tsAllowed )
{
#if JVET_O0294_TRANSFORM_CLEANUP
symbol = (tu.mtsIdx == MTS_SKIP) ? 1 : 0;
#else
symbol = (tu.mtsIdx == MTS_SKIP) ? 0 : 1;
#endif
ctxIdx = 6;
m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) );
}
......@@ -2403,7 +2409,11 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
if( mtsAllowed )
{
symbol = tu.mtsIdx != MTS_DCT2_DCT2 ? 1 : 0;
#if JVET_O0294_TRANSFORM_CLEANUP
ctxIdx = 0;
#else
ctxIdx = std::min( (int)cu.qtDepth, 5 );
#endif
m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) );
if( symbol )
......@@ -2422,8 +2432,11 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
}
}
}
#if JVET_O0294_TRANSFORM_CLEANUP
DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tu.mtsIdx);
#else
DTRACE( g_trace_ctx, D_SYNTAX, "mts_coding() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), tu.mtsIdx );
#endif
}
void CABACWriter::isp_mode( const CodingUnit& cu )
......
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