HM16.9代码阅读-帧内预测()

这篇博客讲HM代码中xPredIntraPlanar、xPredIntraAng、xDCPredFiltering三个函数,有关帧内预测的理论知识看 https://blog.csdn.net/shayashi/article/details/82877875
xPredIntraPlanar函数是对Planar模式预测的函数,Planar模式对应0,该模式的预测采用同双线性差值方式,代码如下:

Void TComPrediction::xPredIntraPlanar( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height )
{
  assert(width <= height);

  Int leftColumn[MAX_CU_SIZE+1], topRow[MAX_CU_SIZE+1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];//参考像素
  UInt shift1Dhor = g_aucConvertToBit[ width ] + 2;//水平移动位数
  UInt shift1Dver = g_aucConvertToBit[ height ] + 2;//竖直移动位数
  //g_aucConvertToBit是对应的bit数 [4]==0 [8]==1 [16]==2 [32]==3 [64]==4 other -1
  // Get left and above reference column and row获取参考像素
  for(Int k=0;k<width+1;k++)
  {
    topRow[k] = pSrc[k-srcStride];//srcStride == 2 * width + 1
  }

  for (Int k=0; k < height+1; k++)
  {
    leftColumn[k] = pSrc[k*srcStride-1];
  }

  // Prepare intermediate variables used in interpolation
  Int bottomLeft = leftColumn[height];
  Int topRight   = topRow[width];
//bottomRow[k]= leftColumn[height]-topRow[k],且将topRow的数值乘height
  for(Int k=0;k<width;k++)
  {
    bottomRow[k]  = bottomLeft - topRow[k];
    topRow[k]     <<= shift1Dver;
  }
//rightColumn[k]=topRow[width]-leftColumn[k],将leftColumn的数值乘width
  for(Int k=0;k<height;k++)
  {
    rightColumn[k]  = topRight - leftColumn[k];
    leftColumn[k]   <<= shift1Dhor;
  }

  const UInt topRowShift = 0;

  // 生成预测信号
  //双线性插值就是像素对应的上、下和左、右参考像素成比例的和。
  //horPred(x,y) = (width - x) * leftColumn[y] + x * topRight
  //vertPred(x,y) = (width - y) * topRight[y] + y * bottomLeft
  //rpDst(x,y) = (horP
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值