From bc46fcfbe1ece7ba5dcb021f9c4d7d980405dce7 Mon Sep 17 00:00:00 2001 From: luofl Date: Wed, 29 Nov 2023 22:56:12 +0800 Subject: [PATCH] Fix slice chroma QP adjust MinCuSize error. Signed-off-by: Falei LUO --- source/Lib/EncoderLib/EncCu.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 3d0349461..12ccbc17c 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -666,15 +666,13 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par m_cuChromaQpOffsetIdxPlus1 = 0; - if( slice.chromaQpAdjEnabled ) + if( slice.chromaQpAdjEnabled && partitioner.currQgChromaEnable() ) { // TODO M0133 : double check encoder decisions with respect to chroma QG detection and actual encode + int cuChromaQpOffsetSubdiv = slice.isIntra() ? slice.picHeader->cuChromaQpOffsetSubdivIntra : slice.picHeader->cuChromaQpOffsetSubdivInter; int lgMinCuSize = sps.log2MinCodingBlockSize + - std::max(0, floorLog2(sps.CTUSize - sps.log2MinCodingBlockSize - int((slice.isIntra() ? slice.picHeader->cuChromaQpOffsetSubdivIntra : slice.picHeader->cuChromaQpOffsetSubdivInter) / 2))); - if( partitioner.currQgChromaEnable() ) - { - m_cuChromaQpOffsetIdxPlus1 = ( ( uiLPelX >> lgMinCuSize ) + ( uiTPelY >> lgMinCuSize ) ) % ( pps.chromaQpOffsetListLen + 1 ); - } + std::max(0, floorLog2(sps.CTUSize) - sps.log2MinCodingBlockSize - int((cuChromaQpOffsetSubdiv + 1) / 2)); + m_cuChromaQpOffsetIdxPlus1 = ( ( uiLPelX >> lgMinCuSize ) + ( uiTPelY >> lgMinCuSize ) ) % ( pps.chromaQpOffsetListLen + 1 ); } DTRACE_UPDATE( g_trace_ctx, std::make_pair( "cux", uiLPelX ) );