HM中统计LCU的个数

在使用HEVC的过程中,我们使用的视频的尺寸经常不是LCU的整数倍,HM中对LCU的数目又是怎么统计的呢?这个涉及到TComPicSym类下的成员函数create函数,具体贴代码如下:

Void TComPicSym::create  ( Int iPicWidth, Int iPicHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth )
{
  UInt i;

  m_uhTotalDepth      = uiMaxDepth;//最大深度
  m_uiNumPartitions   = 1<<(m_uhTotalDepth<<1);//划分小CU的数目,小CU为4x4
  
  m_uiMaxCUWidth      = uiMaxWidth;//最大CU宽度
  m_uiMaxCUHeight     = uiMaxHeight;//最大CU高度
  
  m_uiMinCUWidth      = uiMaxWidth  >> m_uhTotalDepth;//最小CU宽度
  m_uiMinCUHeight     = uiMaxHeight >> m_uhTotalDepth;//最小CU高度
  
  m_uiNumPartInWidth  = m_uiMaxCUWidth  / m_uiMinCUWidth;//
  m_uiNumPartInHeight = m_uiMaxCUHeight / m_uiMinCUHeight;//
  
  //图像宽度模运算最大CU宽度,根据结果,得到在宽度上CU的个数统计(1)
  m_uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
  //图像高度模运算最大CU高度,根据结果,得到在高度上CU的个数统计(2)
  m_uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
  
  m_uiNumCUsInFrame   = m_uiWidthInCU * m_uiHeightInCU;//(1)和(2)结果相乘就是LCU的个数统计
  m_apcTComDataCU     = new TComDataCU*[m_uiNumCUsInFrame];
  
  if (m_uiNumAllocatedSlice>0)
  {
    for ( i=0; i<m_uiNumAllocatedSlice ; i++ )
    {
      delete m_apcTComSlice[i];
    }
    delete [] m_apcTComSlice;
  }
  m_apcTComSlice      = new TComSlice*[m_uiNumCUsInFrame*m_uiNumPartitions];
  m_apcTComSlice[0]   = new TComSlice;
  m_uiNumAllocatedSlice = 1;
  for ( i=0; i<m_uiNumCUsInFrame ; i++ )//
  {
    m_apcTComDataCU[i] = new TComDataCU;
    m_apcTComDataCU[i]->create( m_uiNumPartitions, m_uiMaxCUWidth, m_uiMaxCUHeight, false, m_uiMaxCUWidth >> m_uhTotalDepth
#if ADAPTIVE_QP_SELECTION
      , true
#endif     
      );
  }

  m_puiCUOrderMap = new UInt[m_uiNumCUsInFrame+1];
  m_puiTileIdxMap = new UInt[m_uiNumCUsInFrame];
  m_puiInverseCUOrderMap = new UInt[m_uiNumCUsInFrame+1];

  for( i=0; i<m_uiNumCUsInFrame; i++ )
  {
    m_puiCUOrderMap[i] = i;
    m_puiInverseCUOrderMap[i] = i;
  }
  m_saoParam = NULL;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值