HEVC學習(三十) —— 去方塊濾波之一

     去方塊濾波的詳細過程可參看draft 8.7.1 to 8.7.2 。

     在compressGOP中可以找到下面一段代碼,這裏就是調用去方塊濾波的地方

    //-- Loop filter
    Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 

    m_pcLoopFilter->setCfg(bLFCrossTileBoundary); //!< 設置濾波時是否跨越tiles邊界
    m_pcLoopFilter->loopFilterPic( pcPic ); //!< 執行去方塊濾波

        看loopFilterPic的具體實現:

/**
 - call deblocking function for every CU
 .
 \param  pcPic   picture class (TComPic) pointer
 */
Void TComLoopFilter::loopFilterPic( TComPic* pcPic )
{
  // Horizontal filtering
  for ( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame(); uiCUAddr++ ) //!< 遍歷所有CU
  {
    TComDataCU* pcCU = pcPic->getCU( uiCUAddr );

    ::memset( m_aapucBS       [EDGE_VER], 0, sizeof( UChar ) * m_uiNumPartitions ); //!< 初始化boundary strength
    for( Int iPlane = 0; iPlane < 3; iPlane++ ) //!< Y, U, V
    {
      ::memset( m_aapbEdgeFilter[EDGE_VER][iPlane], 0, sizeof( Bool  ) * m_uiNumPartitions );
    }

    // CU-based deblocking
    xDeblockCU( pcCU, 0, 0, EDGE_VER ); //!< 垂直邊界濾波
  }

  // Vertical filtering
  for ( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame(); uiCUAddr++ ) //!< 遍歷所有CU
  {
    TComDataCU* pcCU = pcPic->getCU( uiCUAddr );

    ::memset( m_aapucBS       [EDGE_HOR], 0, sizeof( UChar ) * m_uiNumPartitions ); //!< 初始化boundary strength
    
    for( Int iPlane = 0; iPlane < 3; iPlane++ ) //!< Y, U, V
    {
      ::memset( m_aapbEdgeFilter[EDGE_HOR][iPlane], 0, sizeof( Bool  ) * m_uiNumPartitions );
    }

    // CU-based deblocking
    xDeblockCU( pcCU, 0, 0, EDGE_HOR ); //!< 水平邊界濾波
  }
}

      由上可以知道xDeblockCU將是實際進行去方塊濾波的核心函數。接下來將重點圍繞該函數進行詳細研究。

 

(注:HEVC標準的Deblocking filter與H.264/AVC標準的基本上屬於繼承關係,當然了,還是有不同的地方的,比如濾波以8x8爲單元,而H.264中是以4x4爲單元,再比如,HEVC只定義了0到2的三個濾波強度,而H.264定義了5個濾波強度,等等。此外,HEVC對於Deblocking filter的處理過程爲先進行垂直邊界濾波,再進行水平邊界濾波,這樣有利於並行的實現。)

發佈了97 篇原創文章 · 獲贊 855 · 訪問量 106萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章