VVC帧内预测(三)PDPC

位置决定的帧内预测组合(Position dependent intra prediction combination,PDPC)是在帧内预测时使用未滤波和已滤波的参考像素的加权值作为预测值。

PDPC在VTM5中有了很大改进,它可以应用于planar模式(模式0),DC模式(模式1),垂直模式(模式50),水平模式(模式18),左下角对角线模式和与其相邻的8个模式(模式2~10),右上角对角线模式和与其相邻的8个模式(模式58~66)。

预测值是由参考像素值与预测值再次加权求得,如下式:

如果PDPC用于planar、DC、水平、垂直模式则不需要额外的边界滤波。

对于模式3~10和模式58~65其参考像素可能落到非整数像素位置,这时取其最近的整数像素位置的值作为参考值。

下表是PDPC的权值计算方法:

预测模式 wT wL wTL
右上对角线 16 >> ( ( y’<<1 ) >> shift) 16 >> ( ( x’<<1 ) >> shift) 0
左下对角线 16 >> ( ( y’<<1 ) >> shift ) 16 >> ( ( x’<<1 ) >> shift ) 0
右上对角线相邻模式 32 >> ( ( y’<<1 ) >> shift ) 0 0
左下对角线相邻模式 0 32 >> ( ( x’<<1 ) >> shift ) 0

以下代码是VTM5内求PDPC的相关代码:

     if (m_ipaParam.applyPDPC)
      { //!<模式2或模式66
        if (m_ipaParam.intraPredAngle == 32) // intra prediction modes: 2 and VDIA 
        {
          int wT = 16 >> std::min(31, ((y << 1) >> scale));
​
          for (int x = 0; x < width; x++)
          { //权值
            int wL = 16 >> std::min(31, ((x << 1) >> scale));
            if (wT + wL == 0) break;
​
            int c = x + y + 1;
            if (c >= 2 * height) { wL = 0; }
            if (c >= 2 * width)  { wT = 0; }
            const Pel left = (wL != 0) ? refSide[c + 1] : 0;
            const Pel top  = (wT != 0) ? refMain[c + 1] : 0;
            //!<加权
            pDsty[x] = ClipPel((wL * left + wT * top + (64 - wL - wT) * pDsty[x] + 32) >> 6, clpRng);
          }
        }
        else
        {
          int invAngleSum0 = 2;
          for (int x = 0; x < width; x++)
          {
            invAngleSum0 += invAngle;
            int deltaPos0 = invAngleSum0 >> 2;
            int deltaFrac0 = deltaPos0 & 63;
            int deltaInt0 = deltaPos0 >> 6;
​
            int deltay = y + deltaInt0 + 1;
            if (deltay >(bIsModeVer ? m_leftRefLength : m_topRefLength) - 1) break;
​
            int wL = 32 >> std::min(31, ((x << 1) >> scale));
            if (wL == 0) break;
            Pel *p = refSide + deltay;
​
            Pel left = p[deltaFrac0 >> 5];
            pDsty[x] = ClipPel((wL * left + (64 - wL) * pDsty[x] + 32) >> 6, clpRng);
          }
        }
      }

感兴趣的请关注微信公众号Video Coding

发布了87 篇原创文章 · 获赞 108 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/Dillon2015/article/details/103426619
今日推荐