Commit 9fc63d26 authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'align_tu_coding' into 'master'

Align transform unit coding with specification

See merge request jvet/VVCSoftware_VTM!793
parents 2cf8fa6e 0cfde04c
......@@ -3186,28 +3186,20 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c
bool cbfLuma = ( tu.cbf[ COMPONENT_Y ] != 0 );
bool cbfChroma = ( lumaOnly ? false : ( chromaCbfs.Cb || chromaCbfs.Cr ) );
#if JVET_O0105_ICT
if( !lumaOnly )
{
joint_cb_cr( tu, ( tu.cbf[COMPONENT_Cb] ? 2 : 0 ) + ( tu.cbf[COMPONENT_Cr] ? 1 : 0 ) );
}
#endif
#if JVET_O0046_DQ_SIGNALLING
if( cu.lwidth() > 64 || cu.lheight() > 64 || cbfLuma || cbfChroma )
if( ( cu.lwidth() > 64 || cu.lheight() > 64 || cbfLuma || cbfChroma ) &&
#else
if( cbfLuma || cbfChroma )
if( ( cbfLuma || cbfChroma ) &&
#endif
(!CS::isDualITree(*tu.cs) || isLuma(tu.chType)) )
{
if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded )
{
if (!CS::isDualITree(*tu.cs) || isLuma(tu.chType))
{
cu_qp_delta(cu, cuCtx.qp, cu.qp);
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
}
cu_qp_delta(cu, cuCtx.qp, cu.qp);
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
}
}
#if JVET_O1168_CU_CHROMA_QP_OFFSET
if (cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cuCtx.isChromaQpAdjCoded)
#else
......@@ -3217,6 +3209,14 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c
cu_chroma_qp_offset( cu );
cuCtx.isChromaQpAdjCoded = true;
}
#if JVET_O0105_ICT
if( !lumaOnly )
{
joint_cb_cr( tu, ( tu.cbf[COMPONENT_Cb] ? 2 : 0 ) + ( tu.cbf[COMPONENT_Cr] ? 1 : 0 ) );
}
#endif
if( cbfLuma )
{
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
......@@ -3240,7 +3240,6 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c
#else
residual_coding( tu, compID );
#endif
}
}
}
}
......
......@@ -3012,28 +3012,20 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
cbfChroma = ( cbf[ COMPONENT_Cb ] || cbf[ COMPONENT_Cr ] );
}
#if JVET_O0105_ICT
if( !lumaOnly )
{
joint_cb_cr( tu, ( cbf[COMPONENT_Cb] ? 2 : 0 ) + ( cbf[COMPONENT_Cr] ? 1 : 0 ) );
}
#endif
#if JVET_O0046_DQ_SIGNALLING
if( cu.lwidth() > 64 || cu.lheight() > 64 || cbfLuma || cbfChroma )
if( ( cu.lwidth() > 64 || cu.lheight() > 64 || cbfLuma || cbfChroma ) &&
#else
if( cbfLuma || cbfChroma )
if( ( cbfLuma || cbfChroma ) &&
#endif
(!CS::isDualITree(*tu.cs) || isLuma(tu.chType)) )
{
if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded )
{
if (!CS::isDualITree(*tu.cs) || isLuma(tu.chType))
{
cu_qp_delta(cu, cuCtx.qp, cu.qp);
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
}
cu_qp_delta(cu, cuCtx.qp, cu.qp);
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
}
}
#if JVET_O1168_CU_CHROMA_QP_OFFSET
if (cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cuCtx.isChromaQpAdjCoded)
#else
......@@ -3043,6 +3035,14 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
cu_chroma_qp_offset( cu );
cuCtx.isChromaQpAdjCoded = true;
}
#if JVET_O0105_ICT
if( !lumaOnly )
{
joint_cb_cr( tu, ( cbf[COMPONENT_Cb] ? 2 : 0 ) + ( cbf[COMPONENT_Cr] ? 1 : 0 ) );
}
#endif
if( cbfLuma )
{
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
......@@ -3066,7 +3066,6 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
#else
residual_coding( tu, compID );
#endif
}
}
}
}
......
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