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<iHeight; y++)
{
piPred[y*uiStride+0] = ptrSrc[(y+1)*sw];
}
if (piOrg!=0)
{
piPred+=1; // miss off first column
for(Int y=0; y<iHeight; y++, piPred+=uiStride, piOrg+=uiOrgStride)
{
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<iWidth; x++)
{
piPred[x] = ptrSrc[x+1];
}
if (piOrg!=0)
{
piPred+=uiStride; // miss off the first row
for(Int y=1; y<iHeight; y++, piPred+=uiStride, piOrg+=uiOrgStride)
{
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 );
}
}
}
}