Commit a6f08569 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'JVET-L0428' into 'master'

JVET-L0428: Delta QP and Chroma QP Offset for Separate Tree

See merge request jvet/VVCSoftware_VTM!134
parents ed0a0a87 b2aa56bf
Pipeline #485 passed with stage
......@@ -187,6 +187,7 @@
#define JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK 1 // Fix sub-block size to 8x8 in ATMVP as proposed in L0198, L0468 and L0104
#define JVET_L0198_ATMVP_SCAN_SIMP 1 // Simplification for scan process in ATMVP cTMv derivation
#define JVET_L0696_CONSTRAINT_SYNTAX 1 // Starting point for interoperability point syntax
#define JVET_L0428_DQP_SEP_TREE 1 // Delta QP for Separate Tree
// ====================================================================================================================
// NEXT software switches
// ====================================================================================================================
......
......@@ -579,7 +579,18 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU
cuCtx.qp = CU::predictQP( cu, cuCtx.qp );
}
cu.qp = cuCtx.qp; //NOTE: CU QP can be changed by deltaQP signaling at TU level
#if JVET_L0428_DQP_SEP_TREE
const Position chromaCentral(cu.chromaPos().offset(cu.chromaSize().width >> 1, cu.chromaSize().height >> 1));
const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, cu.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, cu.chromaFormat));
const CodingUnit* colLumaCu = cs.getCU(lumaRefPos, CHANNEL_TYPE_LUMA);
if (cu.cs->pps->getUseDQP() && CS::isDualITree(cs) && isChroma(cu.chType))
{
cuCtx.qp = colLumaCu->qp;
}
#endif
cu.qp = cuCtx.qp; //NOTE: CU QP can be changed by deltaQP signaling at TU level
cu.chromaQpAdj = cs.chromaQpAdj; //NOTE: CU chroma QP adjustment can be changed by adjustment signaling at TU level
// coding unit
......@@ -2127,15 +2138,18 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c
bool cbfLuma = ( tu.cbf[ COMPONENT_Y ] != 0 );
bool cbfChroma = ( cu.chromaFormat == CHROMA_400 ? false : ( chromaCbfs.Cb || chromaCbfs.Cr ) );
if( cbfLuma || cbfChroma )
{
if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded )
{
cu_qp_delta( cu, cuCtx.qp, cu.qp );
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
#if JVET_L0428_DQP_SEP_TREE
if (!CS::isDualITree(*tu.cs) || isLuma(tu.chType))
#endif
{
cu_qp_delta(cu, cuCtx.qp, cu.qp);
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
}
}
if( cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded )
{
......
......@@ -2049,7 +2049,6 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
bool cbfLuma = ( cbf[ COMPONENT_Y ] != 0 );
bool cbfChroma = false;
if( cu.chromaFormat != CHROMA_400 )
{
if( tu.blocks[COMPONENT_Cb].valid() )
......@@ -2063,9 +2062,14 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
{
if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded )
{
cu_qp_delta( cu, cuCtx.qp, cu.qp );
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
#if JVET_L0428_DQP_SEP_TREE
if ((!CS::isDualITree(*tu.cs) || isLuma(tu.chType)))
#endif
{
cu_qp_delta(cu, cuCtx.qp, cu.qp);
cuCtx.qp = cu.qp;
cuCtx.isDQPCoded = true;
}
}
if( cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded )
{
......
......@@ -401,7 +401,6 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign
#endif
);
// all signals were already copied during compression if the CTU was split - at this point only the structures are copied to the top level CS
const bool copyUnsplitCTUSignals = bestCS->cus.size() == 1 && KEEP_PRED_AND_RESI_SIGNALS;
cs.useSubStructure( *bestCS, partitioner->chType, CS::getArea( *bestCS, area, partitioner->chType ), copyUnsplitCTUSignals, false, false, copyUnsplitCTUSignals );
......@@ -703,7 +702,24 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
do
{
const EncTestMode currTestMode = m_modeCtrl->currTestMode();
EncTestMode currTestMode = m_modeCtrl->currTestMode();
#if JVET_L0428_DQP_SEP_TREE
if (tempCS->pps->getUseDQP() && partitioner.chType == CHANNEL_TYPE_CHROMA)
{
const Position chromaCentral(tempCS->area.Cb().chromaPos().offset(tempCS->area.Cb().chromaSize().width >> 1, tempCS->area.Cb().chromaSize().height >> 1));
const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, tempCS->area.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, tempCS->area.chromaFormat));
const CodingStructure* baseCS = bestCS->picture->cs;
const CodingUnit* colLumaCu = baseCS->getCU(lumaRefPos, CHANNEL_TYPE_LUMA);
const TransformUnit* tu = baseCS->getTU(lumaRefPos, CHANNEL_TYPE_LUMA);
if (tu)
{
currTestMode.qp = colLumaCu->qp;
}
}
#endif
#if SHARP_LUMA_DELTA_QP
if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() && partitioner.currDepth <= pps.getMaxCuDQPDepth() )
......@@ -1586,6 +1602,13 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep
return;
}
#if JVET_L0428_DQP_SEP_TREE
if (partitioner.chType == CHANNEL_TYPE_CHROMA)
{
return;
}
#endif
if( bKeepCtx && partitioner.currDepth != cs.pps->getMaxCuDQPDepth() )
{
return;
......
......@@ -948,8 +948,14 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
int baseQP = cs.baseQP;
if( m_pcEncCfg->getUseAdaptiveQP() )
{
baseQP = Clip3( -cs.sps->getQpBDOffset( CHANNEL_TYPE_LUMA ), MAX_QP, baseQP + xComputeDQP( cs, partitioner ) );
#if JVET_L0428_DQP_SEP_TREE
if (partitioner.chType == CHANNEL_TYPE_LUMA || !cs.slice->isIRAP())
{
baseQP = Clip3(-cs.sps->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, baseQP + xComputeDQP(cs, partitioner));
  • There is no #else path here, so doesn't this break the code if JVET_L0428_DQP_SEP_TREE is undefined?

Please register or sign in to reply
}
#endif
}
int minQP = baseQP;
int maxQP = baseQP;
......
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