// Function for calculating DC value of the reference samples used in Intra prediction
Pel TComPrediction::predIntraGetPredValDC( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft )
{
Int iInd, iSum = 0;
Pel pDcVal;
if (bAbove)
{
//=====上面iWidth个pel的值
for (iInd = 0;iInd < iWidth;iInd++)
{
iSum += pSrc[iInd-iSrcStride];
}
}
if (bLeft)
{
//=====左边iHeight个pel的值
for (iInd = 0;iInd < iHeight;iInd++)
{
iSum += pSrc[iInd*iSrcStride-1];
}
}
if (bAbove && bLeft)
{
//=====(所有可用点pel的和+宽)/(所有可用点数)
pDcVal = (iSum + iWidth) / (iWidth + iHeight);
}
else if (bAbove)
{
//=====(所有可用点pel的和+宽/2)/(所有可用点数)
pDcVal = (iSum + iWidth/2) / iWidth;
}
else if (bLeft)
{
//=====(所有可用点pel的和+高/2)/(所有可用点数)
pDcVal = (iSum + iHeight/2) / iHeight;
}
else
{
//=====缺省值
pDcVal = pSrc[-1]; // Default DC value already calculated and placed in the prediction array if no neighbors are available
}
return pDcVal;
}
//=====Jyno 2013/09/09