Ticket #188: Fix188.HM40.patch

File Fix188.HM40.patch, 2.6 KB (added by hao, 13 years ago)
  • source/Lib/TLibCommon/TypeDef.h

     
    321321
    322322#define CBF_FAST_MODE                      1 //JCTVC-F045
    323323
     324#define FIX_TICKET188 1
     325
    324326// ====================================================================================================================
    325327// Basic type redefinition
    326328// ====================================================================================================================
  • source/Lib/TLibEncoder/TEncSlice.cpp

     
    715715    m_dPicRdCost     += pcCU->getTotalCost();
    716716    m_uiPicDist      += pcCU->getTotalDistortion();
    717717  }
     718
     719#if FINE_GRANULARITY_SLICES && FIX_TICKET188
     720  if ( pcSlice->isNextSlice() )
     721  {
     722    TComDataCU* pcCU = rpcPic->getCU( uiCUAddr );
     723    UInt uiAbsEndPartIdx = pcSlice->getSliceCurEndCUAddr() % rpcPic->getNumPartInCU();
     724    UInt uiDepth = pcCU->getDepth( uiAbsEndPartIdx-1 );
     725    if ( pcSlice->getSPS()->getUseDQP() && (g_uiMaxCUWidth>>uiDepth) < pcSlice->getPPS()->getMinCuDQPSize() )
     726    {
     727      UInt uiZorderMask = ~((1<<(8-(pcSlice->getPPS()->getMaxCuDQPDepth()<<1)))-1);
     728      UInt uiAbsZorderQpMinCUIdx = uiAbsEndPartIdx & uiZorderMask;
     729      Bool bHasRedisual = false;
     730      for ( UInt uiIdx = uiAbsZorderQpMinCUIdx; uiIdx < uiAbsEndPartIdx; uiIdx++ )
     731      {
     732        if ( pcCU->getSliceStartCU(uiIdx) == pcSlice->getSliceCurStartCUAddr() &&
     733             ( pcCU->getCbf( uiIdx, TEXT_LUMA ) || pcCU->getCbf( uiIdx, TEXT_CHROMA_U ) || pcCU->getCbf( uiIdx, TEXT_CHROMA_V ) ) )
     734        {
     735          bHasRedisual = true;
     736          break;
     737        }
     738      }
     739
     740      UInt uiTargetPartIdx;
     741      if ( pcCU->getSliceStartCU( uiAbsZorderQpMinCUIdx ) != pcSlice->getSliceCurStartCUAddr() )
     742      {
     743        uiTargetPartIdx = pcSlice->getSliceCurStartCUAddr() % rpcPic->getNumPartInCU();
     744      }
     745      else
     746      {
     747        uiTargetPartIdx = uiAbsZorderQpMinCUIdx;
     748      }
     749      if ( !bHasRedisual )
     750      {
     751        pcCU->setQPSubParts( pcCU->getRefQP( uiTargetPartIdx ), uiTargetPartIdx, uiDepth ); // set QP to default QP
     752      }
     753    }
     754  }
     755#endif
     756
    718757#if !FINE_GRANULARITY_SLICES
    719758  pcSlice->setSliceCurEndCUAddr( uiCUAddr );
    720759  pcSlice->setEntropySliceCurEndCUAddr( uiCUAddr );