Ticket #991: 0001-Fix-for-JVET_Q0471_CHROMA_QT_SPLIT.patch

File 0001-Fix-for-JVET_Q0471_CHROMA_QT_SPLIT.patch, 6.1 KB (added by hanhuang, 4 years ago)
  • source/Lib/CommonLib/UnitPartitioner.cpp

    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 ) 
    166166void AdaptiveDepthPartitioner::setMaxMinDepth( unsigned& minDepth, unsigned& maxDepth, const CodingStructure& cs ) const
    167167{
    168168  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
    169173  unsigned          stdMaxDepth = ( floorLog2(cs.sps->getCTUSize()) - floorLog2(cs.sps->getMinQTSize( cs.slice->getSliceType(), chType )));
     174#endif
    170175  const Position    pos         = currArea().blocks[chType].pos();
    171176  const unsigned    curSliceIdx = cs.slice->getIndependentSliceIdx();
    172177  const unsigned    curTileIdx  = cs.pps->getTileIdx( currArea().lumaPos() );
    void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca 
    392397  if( lastSplit != CTU_LEVEL && lastSplit != CU_QUAD_SPLIT ) canQt = false;
    393398#if JVET_Q0471_CHROMA_QT_SPLIT
    394399  // 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)));
    396401  if( area.width <= minQTThreshold )                         canQt = false;
    397402#else
    398403  if( area.width <= minQtSize )                              canQt = false;
    PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) 
    572577    const unsigned minQtSize  = cs.pcv->getMinQtSize( *cs.slice, chType );
    573578#if JVET_Q0471_CHROMA_QT_SPLIT
    574579    // 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)));
    576581    const bool isQtAllowed    = area.width > minQTThreshold && currBtDepth == 0;
    577582#else
    578583    const bool isQtAllowed    = area.width >  minQtSize && area.height >  minQtSize && currBtDepth == 0;
  • source/Lib/EncoderLib/EncCu.cpp

    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, 
    15971597    if( m_pcEncCfg->getUseFastLCTU() )
    15981598    {
    15991599      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
    16001604      unsigned maxDepth = floorLog2(tempCS->sps->getCTUSize()) - floorLog2(tempCS->sps->getMinQTSize(slice.getSliceType(), partitioner.chType));
     1605#endif
    16011606
    16021607      if( auto ad = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ) )
    16031608      {
  • source/Lib/EncoderLib/EncModeCtrl.cpp

    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 
    11241124{
    11251125  // Min/max depth
    11261126  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
    11271131  unsigned maxDepth = floorLog2(cs.sps->getCTUSize()) - floorLog2(cs.sps->getMinQTSize( m_slice->getSliceType(), partitioner.chType ));
     1132#endif
    11281133  if( m_pcEncCfg->getUseFastLCTU() )
    11291134  {
    11301135    if( auto adPartitioner = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ) )
    void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru 
    11561161                         || (  cuLeft  && !cuAbove  && cuLeft ->qtDepth > partitioner.currQtDepth )
    11571162                         || ( !cuLeft  &&  cuAbove  && cuAbove->qtDepth > partitioner.currQtDepth )
    11581163                         || ( !cuAbove && !cuLeft   && cs.area.lwidth() >= ( 32 << cs.slice->getDepth() ) ) )
     1164#if JVET_Q0471_CHROMA_QT_SPLIT
     1165                         && ( cs.area.lwidth() > (minQTSize << 1 ) );
     1166#else
    11591167                         && ( cs.area.lwidth() > ( cs.pcv->getMinQtSize( *cs.slice, partitioner.chType ) << 1 ) );
     1168#endif
    11601169
    11611170  // set features
    11621171  ComprCUCtx &cuECtx  = m_ComprCUCtxList.back();