From 0cfde04c048d2d0ba9b5eda1705a79aef143c23e Mon Sep 17 00:00:00 2001 From: Remy Foray <remy.foray@allegrodvt.com> Date: Thu, 8 Aug 2019 07:02:53 +0200 Subject: [PATCH] Align transform unit coding with specification - only cu_qp_delta is conditioned by (CbWidth > 64 || CbHeight > 64) - move parsing of tu_joint_cbcr_residual_flag[] between cu_chroma_qp_offset_idx and transform_skip_flag instead of before cu_qp_delta --- source/Lib/DecoderLib/CABACReader.cpp | 31 +++++++++++++-------------- source/Lib/EncoderLib/CABACWriter.cpp | 31 +++++++++++++-------------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 27a893fccf..8d23cf0b09 100755 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -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 - } } } } diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index d2c6c57f89..4967caafeb 100755 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -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 - } } } } -- GitLab