From ea32bf6fc63babec3a7736a6ce9debd5a2e1669d Mon Sep 17 00:00:00 2001
From: hanhuang <hanhuang@qti.qualcomm.com>
Date: Fri, 13 Mar 2020 14:06:09 -0700
Subject: [PATCH] Fix for JVET_Q0471_CHROMA_QT_SPLIT
---
source/Lib/CommonLib/UnitPartitioner.cpp | 9 +++++++--
source/Lib/EncoderLib/EncCu.cpp | 5 +++++
source/Lib/EncoderLib/EncModeCtrl.cpp | 9 +++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp
index 81b0469a..6dc3e785 100644
a
|
b
|
void Partitioner::copyState( const Partitioner& other ) |
166 | 166 | void AdaptiveDepthPartitioner::setMaxMinDepth( unsigned& minDepth, unsigned& maxDepth, const CodingStructure& cs ) const |
167 | 167 | { |
168 | 168 | unsigned stdMinDepth = 0; |
| 169 | #if JVET_Q0471_CHROMA_QT_SPLIT |
| 170 | const unsigned minQTSize = cs.sps->getMinQTSize(cs.slice->getSliceType(), chType) >> ((currArea().Y().chromaFormat == CHROMA_400) ? 0 : ((int)getChannelTypeScaleX(chType, currArea().Y().chromaFormat) - (int)getChannelTypeScaleY(chType, currArea().Y().chromaFormat))); |
| 171 | unsigned stdMaxDepth = (floorLog2(cs.sps->getCTUSize()) - floorLog2(minQTSize)); |
| 172 | #else |
169 | 173 | unsigned stdMaxDepth = ( floorLog2(cs.sps->getCTUSize()) - floorLog2(cs.sps->getMinQTSize( cs.slice->getSliceType(), chType ))); |
| 174 | #endif |
170 | 175 | const Position pos = currArea().blocks[chType].pos(); |
171 | 176 | const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx(); |
172 | 177 | const unsigned curTileIdx = cs.pps->getTileIdx( currArea().lumaPos() ); |
… |
… |
void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca |
392 | 397 | if( lastSplit != CTU_LEVEL && lastSplit != CU_QUAD_SPLIT ) canQt = false; |
393 | 398 | #if JVET_Q0471_CHROMA_QT_SPLIT |
394 | 399 | // minQtSize is in luma samples unit |
395 | | const unsigned minQTThreshold = minQtSize >> ((area.chromaFormat == CHROMA_400) ? 0 : ((int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, area.chromaFormat) - (int) getChannelTypeScaleY(CHANNEL_TYPE_CHROMA, area.chromaFormat))); |
| 400 | const unsigned minQTThreshold = minQtSize >> ((area.chromaFormat == CHROMA_400) ? 0 : ((int)getChannelTypeScaleX(chType, area.chromaFormat) - (int)getChannelTypeScaleY(chType, area.chromaFormat))); |
396 | 401 | if( area.width <= minQTThreshold ) canQt = false; |
397 | 402 | #else |
398 | 403 | if( area.width <= minQtSize ) canQt = false; |
… |
… |
PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) |
572 | 577 | const unsigned minQtSize = cs.pcv->getMinQtSize( *cs.slice, chType ); |
573 | 578 | #if JVET_Q0471_CHROMA_QT_SPLIT |
574 | 579 | // minQtSize is in luma samples unit |
575 | | const unsigned minQTThreshold = minQtSize >> ((area.chromaFormat == CHROMA_400) ? 0 : ((int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, area.chromaFormat) - (int) getChannelTypeScaleY(CHANNEL_TYPE_CHROMA, area.chromaFormat))); |
| 580 | const unsigned minQTThreshold = minQtSize >> ((area.chromaFormat == CHROMA_400) ? 0 : ((int)getChannelTypeScaleX(chType, area.chromaFormat) - (int)getChannelTypeScaleY(chType, area.chromaFormat))); |
576 | 581 | const bool isQtAllowed = area.width > minQTThreshold && currBtDepth == 0; |
577 | 582 | #else |
578 | 583 | const bool isQtAllowed = area.width > minQtSize && area.height > minQtSize && currBtDepth == 0; |
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index c5cce5f9..b9c02067 100644
a
|
b
|
void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, |
1597 | 1597 | if( m_pcEncCfg->getUseFastLCTU() ) |
1598 | 1598 | { |
1599 | 1599 | unsigned minDepth = 0; |
| 1600 | #if JVET_Q0471_CHROMA_QT_SPLIT |
| 1601 | const unsigned minQTSize = tempCS->sps->getMinQTSize(slice.getSliceType(), partitioner.chType) >> ((tempCS->area.Y().chromaFormat == CHROMA_400) ? 0 : ((int)getChannelTypeScaleX(partitioner.chType, tempCS->area.Y().chromaFormat) - (int)getChannelTypeScaleY(partitioner.chType, tempCS->area.Y().chromaFormat))); |
| 1602 | unsigned maxDepth = floorLog2(tempCS->sps->getCTUSize()) - floorLog2(minQTSize); |
| 1603 | #else |
1600 | 1604 | unsigned maxDepth = floorLog2(tempCS->sps->getCTUSize()) - floorLog2(tempCS->sps->getMinQTSize(slice.getSliceType(), partitioner.chType)); |
| 1605 | #endif |
1601 | 1606 | |
1602 | 1607 | if( auto ad = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ) ) |
1603 | 1608 | { |
diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp
index da6b06b2..36a2da88 100644
a
|
b
|
void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru |
1124 | 1124 | { |
1125 | 1125 | // Min/max depth |
1126 | 1126 | unsigned minDepth = 0; |
| 1127 | #if JVET_Q0471_CHROMA_QT_SPLIT |
| 1128 | const unsigned minQTSize = cs.sps->getMinQTSize(cs.slice->getSliceType(), partitioner.chType) >> ((cs.area.Y().chromaFormat == CHROMA_400) ? 0 : ((int)getChannelTypeScaleX(partitioner.chType, cs.area.Y().chromaFormat) - (int)getChannelTypeScaleY(partitioner.chType, cs.area.Y().chromaFormat))); |
| 1129 | unsigned maxDepth = floorLog2(cs.sps->getCTUSize()) - floorLog2(minQTSize); |
| 1130 | #else |
1127 | 1131 | unsigned maxDepth = floorLog2(cs.sps->getCTUSize()) - floorLog2(cs.sps->getMinQTSize( m_slice->getSliceType(), partitioner.chType )); |
| 1132 | #endif |
1128 | 1133 | if( m_pcEncCfg->getUseFastLCTU() ) |
1129 | 1134 | { |
1130 | 1135 | if( auto adPartitioner = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ) ) |
… |
… |
void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru |
1156 | 1161 | || ( cuLeft && !cuAbove && cuLeft ->qtDepth > partitioner.currQtDepth ) |
1157 | 1162 | || ( !cuLeft && cuAbove && cuAbove->qtDepth > partitioner.currQtDepth ) |
1158 | 1163 | || ( !cuAbove && !cuLeft && cs.area.lwidth() >= ( 32 << cs.slice->getDepth() ) ) ) |
| 1164 | #if JVET_Q0471_CHROMA_QT_SPLIT |
| 1165 | && ( cs.area.lwidth() > (minQTSize << 1 ) ); |
| 1166 | #else |
1159 | 1167 | && ( cs.area.lwidth() > ( cs.pcv->getMinQtSize( *cs.slice, partitioner.chType ) << 1 ) ); |
| 1168 | #endif |
1160 | 1169 | |
1161 | 1170 | // set features |
1162 | 1171 | ComprCUCtx &cuECtx = m_ComprCUCtxList.back(); |