hevc角度预测_HEVC之帧内预测的predIntraAng讲解

Void TComPrediction::predIntraAng( const ComponentID compID, UInt uiDirMode, Pel* piOrg /* Will be null for decoding */, UInt uiOrgStride, Pel* piPred, UInt uiStride, TComTU &rTu, Bool bAbove, Bool bLeft, const Bool bUseFilteredPredSamples, const Bool bUseLosslessDPCM )

{

const ChromaFormat   format      = rTu.GetChromaFormat();//获得图片格式,一般为YUV420

const ChannelType    channelType = toChannelType(compID);//CHANNEL_TYPE_LUMA    = 0,CHANNEL_TYPE_CHROMA  = 1,MAX_NUM_CHANNEL_TYPE = 2

const TComRectangle &rect        = rTu.getRect(isLuma(compID) ? COMPONENT_Y : COMPONENT_Cb);

const Int            iWidth      = rect.width;//Tu的宽

const Int            iHeight     = rect.height;//Tu的高

assert( g_aucConvertToBit[ iWidth ] >= 0 ); //   4x  4

assert( g_aucConvertToBit[ iWidth ] <= 5 ); // 128x128

//assert( iWidth == iHeight  );

Pel *pDst = piPred;//预测值的首地址

// get starting pixel in block

const Int sw = (2 * iWidth + 1);//

if ( bUseLosslessDPCM )//如果预测方式为垂直或水平,则bUseLosslessDPCM =1

{

const Pel *ptrSrc = getPredictorPtr( compID, false );//得到参考块的左上方地址(不在参考块内)

// Sample Adaptive intra-Prediction (SAP)

//用水平方式进行预测,预测值的列被覆盖为参考块的左列,如果参考块内其他值可以得到的话则将参考块其他值给预测值     if (uiDirMode==HOR_IDX)

{

// left column filled with reference samples

// remaining columns filled with piOrg data (if available).

for(Int y=0; y

{

piPred[y*uiStride+0] = ptrSrc[(y+1)*sw];

}

if (piOrg!=0)

{

piPred+=1; // miss off first column

for(Int y=0; y

{

memcpy(piPred, piOrg, (iWidth-1)*sizeof(Pel));

}

}

}

//垂直模式预测与水平类似     else // VER_IDX

{

// top row filled with reference samples

// remaining rows filled with piOrd data (if available)

for(Int x=0; x

{

piPred[x] = ptrSrc[x+1];

}

if (piOrg!=0)

{

piPred+=uiStride; // miss off the first row

for(Int y=1; y

{

memcpy(piPred, piOrg, iWidth*sizeof(Pel));

}

}

}

}

//角度预测与平面预测   else   {     const Pel *ptrSrc = getPredictorPtr( compID, bUseFilteredPredSamples );     if ( uiDirMode == PLANAR_IDX )     {       xPredIntraPlanar( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format );     }     else     {       // Create the prediction             TComDataCU *const pcCU              = rTu.getCU();       const UInt              uiAbsPartIdx      = rTu.GetAbsPartIdxTU();       const Bool              enableEdgeFilters = !(pcCU->isRDPCMEnabled(uiAbsPartIdx) && pcCU->getCUTransquantBypass(uiAbsPartIdx)); #if RExt__O0043_BEST_EFFORT_DECODING       xPredIntraAng( g_bitDepthInStream[channelType], ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters ); #else       xPredIntraAng( g_bitDepth[channelType], ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters ); #endif       if(( uiDirMode == DC_IDX ) && bAbove && bLeft )       {         xDCPredFiltering( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType );       }     }   } }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值