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系数。
对于长宽相等的块,因为,上式可以用移位的形式计算除法。而长宽不等的块,不行。除法复杂度是很高的。
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;
}