这个可以算是帧内预测中最为核心的一个部分了,不过相信有了前面那些基础积淀,这个部分看起来反而没有原来那么难了。下面直接给出代码及其相关注释:
// Function for deriving the angular Intra predictions
/** Function for deriving the simplified angular intra predictions.
* \param pSrc pointer to reconstructed sample array
* \param srcStride the stride of the reconstructed sample array
* \param rpDst reference to pointer for the prediction sample array
* \param dstStride the stride of the prediction sample array
* \param width the width of the block
* \param height the height of the block
* \param dirMode the intra prediction mode index
* \param blkAboveAvailable boolean indication if the block above is available
* \param blkLeftAvailable boolean indication if the block to the left is available
*
* This function derives the prediction samples for the angular mode based on the prediction direction indicated by
* the prediction mode index. The prediction direction is given by the displacement of the bottom row of the block and
* the reference row above the block in the case of vertical prediction or displacement of the rightmost column
* of the block and reference column left from the block in the case of the horizontal prediction. The displacement
* is signalled at 1/32 pixel accuracy. When projection of the predicted pixel falls inbetween reference samples,
* the predicted value for the pixel is linearly interpolated from the reference samples. All reference samples are taken
* from the extended main reference.
*/
Void TComPrediction::xPredIntraAng( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt di