帧内预测:predIntraLumaAng函数+getPreditorPtr函数+xDCPredFiltering函数
来源:互联网 发布:gmp系统网络的搭建 编辑:程序博客网 时间:2024/06/06 03:01
帧内预测:predIntraLumaAng函数
调用了getPredictorPtr获得指向参考样点首地址的指针,再根据帧内预测的模式调用xPredIntraPlanar进行Intra_Planar模式预测和调用xPredIntraAng进行Intra_DC、Intra_Angular模式预测,最后调用xDCPredFiltering对Intra_DC模式的边界进行平滑滤波处理。
Void TComPrediction::predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, TComDataCU* pcCU, Bool bAbove, Bool bLeft ) { Pel *pDst = piPred; Int *ptrSrc; assert( g_aucConvertToBit[ iWidth ] >= 0 ); // 4x 4 assert( g_aucConvertToBit[ iWidth ] <= 5 ); // 128x128 assert( iWidth == iHeight ); //! 获取指向用于帧内预测的参考样点的指针,很有可能指向的是经过滤波的参考样点首地址 ptrSrc = pcTComPattern->getPredictorPtr( uiDirMode, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt ); // get starting pixel in block Int sw = 2 * iWidth + 1; //!< ptrSrc指向的是当前PU的左上邻点,故加上2*iWidth指向下一行即当前PU的左邻点,加1指向当前PU的首地址 // Create the prediction if ( uiDirMode == PLANAR_IDX ) { xPredIntraPlanar( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight ); } else { xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, true ); if( (uiDirMode == DC_IDX ) && bAbove && bLeft ) {// draft 8.4.4.2.5 xDCPredFiltering( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight); } } }先看看getPreditorPtr函数的实现:
在函数的开始前,注释了一个数组m_aucIntraFilter,这里面存放了不同PU尺寸下滤波的阈值,可参照draft8.4.4.2.3进行了解,具体的判断规则在draft里也详细介绍了,有兴趣的朋友可以到官网上去下,或者可以到我的博客资源里下载。这里需要指出的是,在函数的最后,当满足滤波条件是,piSrc向后移动了(2*width +1)*(2*height+1),可能刚开始看这句话时会有所疑惑,关于这个的解释可以查看我前面的博客“HEVC学习(五) —— 帧内预测系列之三”中对几个buffer的解释,看完后大家应该就能清楚了。至此,这个函数的解释就结束了。
[cpp] view plain copy<span style="font-size:12px;">/* const UChar TComPattern::m_aucIntraFilter[5] = { 10, //4x4 7, //8x8 1, //16x16 0, //32x32 10, //64x64 }; */ Int* TComPattern::getPredictorPtr( UInt uiDirMode, UInt log2BlkSize, Int* piAdiBuf ) {//! 这边根据帧内预测模式来决定是否要将指针指向经过滤波后的样点值,判断规则可参见draft 8.4.4.2.3 Int* piSrc; assert(log2BlkSize >= 2 && log2BlkSize < 7); Int diff = min<Int>(abs((Int) uiDirMode - HOR_IDX), abs((Int)uiDirMode - VER_IDX)); UChar ucFiltIdx = diff > m_aucIntraFilter[log2BlkSize - 2] ? 1 : 0; #if REMOVE_LMCHROMA if (uiDirMode == DC_IDX) #else if (uiDirMode == DC_IDX || uiDirMode == LM_CHROMA_IDX) #endif { ucFiltIdx = 0; //no smoothing for DC or LM chroma } assert( ucFiltIdx <= 1 ); Int width = 1 << log2BlkSize; Int height = 1 << log2BlkSize; piSrc = getAdiOrgBuf( width, height, piAdiBuf ); if ( ucFiltIdx ) //!< 帧内预测模式满足滤波的条件 { piSrc += (2 * width + 1) * (2 * height + 1); //!< 指针指向滤波后的样点值 } return piSrc; } </span>介绍xDCPredFiltering函数:
/** Function for filtering intra DC predictor. * \param pSrc pointer to reconstructed sample array * \param iSrcStride the stride of the reconstructed sample array * \param rpDst reference to pointer for the prediction sample array * \param iDstStride the stride of the prediction sample array * \param iWidth the width of the block * \param iHeight the height of the block * * This function performs filtering left and top edges of the prediction samples for DC mode (intra coding). */ Void TComPrediction::xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ) { Pel* pDst = rpDst; //!< 实际上就是dcVal Int x, y, iDstStride2, iSrcStride2; // boundary pixels processing pDst[0] = (Pel)((pSrc[-iSrcStride] + pSrc[-1] + 2 * pDst[0] + 2) >> 2); //!< 式子(8-35),左上角的点,利用其上邻点和左邻点与其加权平均 //! predSamples[0][0] = ( p[0][-1] + p[-1][0] + 2 * dcVal + 2 ) >> 2); for ( x = 1; x < iWidth; x++ ) //!< 上边界 { pDst[x] = (Pel)((pSrc[x - iSrcStride] + 3 * pDst[x] + 2) >> 2); //!< 式子(8-36),第一行的点,利用对应上邻点与其加权平均 // predSamples[x][0] = ( p[x][-1] + 3 * dcVal + 2 ) >> 2); } //! 左边界 for ( y = 1, iDstStride2 = iDstStride, iSrcStride2 = iSrcStride-1; y < iHeight; y++, iDstStride2+=iDstStride, iSrcStride2+=iSrcStride ) { pDst[iDstStride2] = (Pel)((pSrc[iSrcStride2] + 3 * pDst[iDstStride2] + 2) >> 2); //!< 式子(8-37),第一列的点,利用对应左邻点与其加权平均 // predSamples[0][y] = ( p[-1][y] + 3 * dcVal + 2 ) >> 2); } return; }最后还剩下两个实际进行帧内模式预测的函数
阅读全文
0 0
- 帧内预测:predIntraLumaAng函数+getPreditorPtr函数+xDCPredFiltering函数
- (HEVC)帧内预测:predIntraLumaAng; getPreditorPtr; xDCPredFiltering
- 帧内预测-函数initAdiPattern
- 帧内预测:xPredIntraPlanar函数
- HEVC-帧内预测2: initAdiPattern 函数
- HEVC帧内DC预测函数predIntraGetPredValDC()
- HEVC帧内DC预测函数predIntraGetPredValDC()
- 帧内预测之 fillReferenceSamples函数记录
- 帧内预测-第一步:fillReferenceSamples函数:
- JM8.6 色度帧内预测函数剖析(IntraChromaPrediction8x8)
- x264中16x16帧内预测模式函数分析
- 亮度分量帧内预测的主函数
- (HEVC)帧内预测:fillReferenceSamples函数讲解
- 帧内预测之函数Intra16x16_Mode_Decision的分析与理解
- 帧内预测的主函数框架分析
- 约会网站预测函数
- lstm预测sin函数
- x264代码剖析(十二):核心算法之帧内预测函数x264_mb_analyse_intra()
- Ajax同步与异步
- pytorch学习笔记(十六):pytorch 写代码时应该注意
- Qt:读写SVG
- BZOJ1834: [ZJOI2010]network 网络扩容
- BottomTabBar实现底部导航栏
- 帧内预测:predIntraLumaAng函数+getPreditorPtr函数+xDCPredFiltering函数
- PHP微信公众平台接口(一)——设置URL
- android之Blurry,图片模糊
- Javaweb-xml编程-XPath
- Java实现当前目录下的所有子目录和文件,并按层级打印
- 【Linux】SCP命令教程
- Maven3.5.0安装与配置+Eclipse应用
- C语言操作符
- Web.xml如果要是多个servlet写法?