VTM3.0代码阅读:xCheckModeSplit函数

xCheckModeSplit函数在xCompressCU中被调用,用于进行QT,BT,TT的划分模式处理,encTestMode可以获取具体需要test的划分模式。
xCheckModeSplit在依据划分模式,将当前tempCS区域划分为相应的多个子cu区域之后,对每个子cu分别调用xCompressCU函数进行处理;
获取各个子cu的最优划分和最优模式,递归返回之后将bestSubCS的最优数据copy给tempCS,然后进行下一个子cu的递归处理,获取最优模式;
再将bestSubCS的最优数据copy给tempCS,直至xCompressCU处理完所有子cu之后,tempCS就包含encTestMode划分模式的最优数据;
最后xCheckBestMode比较tempCS和bestCS的cost,最优模式存入bestCS。

void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode
#if JVET_L0266_HMVP
  , LutMotionCand* &tempMotCandLUTs
  , LutMotionCand* &bestMotCandLUTs
  , UnitArea  parArea
#endif
)
{
   
  const int qp                = encTestMode.qp;
  const PPS &pps              = *tempCS->pps;
  const Slice &slice          = *tempCS->slice;
  const bool bIsLosslessMode  = false; // False at this level. Next level down may set it to true.
  const int oldPrevQp         = tempCS->prevQP[partitioner.chType];
  const uint32_t currDepth        = partitioner.currDepth;

#if JVET_L0266_HMVP
  const unsigned wParIdx = gp_sizeIdxInfo->idxFrom(parArea.lwidth());
  const unsigned hParIdx = gp_sizeIdxInfo->idxFrom(parArea.lheight());
#if JVET_L0293_CPR
  if (tempCS->chType == CHANNEL_TYPE_LUMA)
#endif		//将tempLUT首先转存入splitTempLUT,函数最后又存回tempLUT。这样可以使tempCS的这些数据始终不发生变化,而只让bestCS(bestLUT)的数据产生变化,存储最优数据
  tempCS->slice->copyMotionLUTs(tempMotCandLUTs, m_pSplitTempMotLUTs[wParIdx][hParIdx]);
#endif

  const PartSplit split = getPartSplit( encTestMode );		//获取划分模式

  CHECK( split == CU_DONT_SPLIT, "No proper split provided!" );

  tempCS->initStructData( qp, bIsLosslessMode );		//tempCS中的数据进行清空初始化

  m_CABACEstimator->getCtx() = m_CurrCtx->start;

  if( tempCS->sps->getSpsNext().getUseQTBT() )		//QTBT时,提前判断能否划分
  {
   
    const TempCtx ctxStartSP( m_CtxCache, SubCtx( Ctx::SplitFlag,   m_CABACEstimator->getCtx() ) );
    const TempCtx ctxStartBT( m_CtxCache, SubCtx( Ctx::BTSplitFlag, m_CABACEstimator->getCtx() ) );

    m_CABACEstimator->resetBits();

    if( partitioner.getImplicitSplit( *tempCS ) != CU_QUAD_SPLIT )
    {
   
      if( partitioner.canSplit( CU_QUAD_SPLIT, *tempCS ) )
      
  • 6
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值