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

本文深入探讨了HM16.9编码器中的帧内预测技术,重点解析了xPredIntraPlanar(Planar模式)、xPredIntraAng(DC和角度模式)以及xDCPredFiltering(DC模式边缘滤波)函数的实现细节。通过理解这些函数,可以更好地了解HEVC帧内预测的原理和操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这篇博客讲HM代码中xPredIntraPlanar、xPredIntraAng、xDCPredFiltering三个函数,有关帧内预测的理论知识看 https://blog.youkuaiyun.com/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) = (horPred(x,y) + vertPred(x,y)) >> (
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值