VTM4.0 DC模式

我又回來了,好久沒更博客了吧,沒事來寫下前段時間看的東西吧。

DC模式很簡單,理論很簡單,就是用鄰近像素塊的均值填充當前預測塊,具體不做介紹了。這裏介紹下VTM中DC的改進歷程。

這裏只介紹主要種子提案,下面給出DC相關提案號。
JVET-J0020 Description of SDR video coding technology proposal by Panasonic (Panasonic)
JVET-K0122 CE3-related: Alternative techniques for DC mode without division [A. Filippov, V. Rufitskiy, J. Chen (Huawei)]
JVET-K0211 CE3: DC mode without divisions and modifications to intra filtering (Tests 1.2.1, 2.2.2 and 2.5.1) [V. Drugeon (Panasonic)]
JVET-K0400 CE3-related: DC mode with only shift operators based on sub-sampling [D. Kim, G. Ko, J. Son, J. Kwak (WILUS), J. Seok, Y. Lee (Humax)]

VTM1.0

對所有塊,計算左方和上方參考像素累加和,然後利用除法操作計算DC係數。
DCval=(Sum(Ref.samplesofWidthandHeight)+((Width+Height)>>1))/(Width+Height)DCval = (Sum(Ref. samples of Width and Height) + ((Width+Height)>>1)) / (Width+Height)

對於長寬相等的塊,因爲Width+Height=2xWidth+Height=2^x,上式可以用移位的形式計算除法。而長寬不等的塊,不行。除法複雜度是很高的。

JVET J次會議

JVET-J0020 Description of SDR video coding technology proposal by Panasonic (Panasonic)
提出使用上方參考像素計算DCup,左方參考像素計算DCleft,通過(DCup + DCleft) >> 1計算最終DCvalue,從而實現使用移位操作來替代除法運算。

於是J次會議建立CE3.1.2.1 DC mode with only shift operators (related CE3.2 Tool 5),研究移位替代除法的DC模式。

JVET K次會議

JVET-K0122 CE3-related: Alternative techniques for DC mode without division [A. Filippov, V. Rufitskiy, J. Chen (Huawei)]
提出矩形塊使用長邊參考像素計算DC係數,這樣可以實現移位替代除法操作,而且性能還變好了。
AI -0.02% -0.03% -0.03% Time 101% 102%
RA -0.01% 0.04% -0.04% Time 101% 102%
在這裏插入圖片描述
JVET採納了該技術,VTM2.0中正式使用。

VTM4.0 DC代碼

目前VTM中DC預測使用的就是K0122華爲的方法,代碼如下,十分容易,不具體註釋了。

// Function for calculating DC value of the reference samples used in Intra prediction
//NOTE: Bit-Limit - 25-bit source
Pel IntraPrediction::xGetPredValDc( const CPelBuf &pSrc, const Size &dstSize )
{
  CHECK( dstSize.width == 0 || dstSize.height == 0, "Empty area provided" );

  int idx, sum = 0;
  Pel dcVal;
  const int width  = dstSize.width;
  const int height = dstSize.height;
  const auto denom     = (width == height) ? (width << 1) : std::max(width,height);
  const auto divShift  = g_aucLog2[denom];
  const auto divOffset = (denom >> 1);

  if ( width >= height )
  {
    for( idx = 0; idx < width; idx++ )
    {
      sum += pSrc.at( 1 + idx, 0 );
    }
  }
  if ( width <= height )
  {
    for( idx = 0; idx < height; idx++ )
    {
      sum += pSrc.at( 0, 1 + idx );
    }
  }

  dcVal = (sum + divOffset) >> divShift;
  return dcVal;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章