HTM-16.2代码(10)——xPatternSearch和xPatternSearchFast
来源:互联网 发布:娇女轻抚琴,绕梁知其音 编辑:程序博客网 时间:2024/05/16 01:44
xPatternSearch进行整像素搜索
Void TEncSearch::xPatternSearch( const TComPattern* const pcPatternKey, const Pel* piRefY, const Int iRefStride, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, TComMv& rcMv, Distortion& ruiSAD ){//在pcMvSrchRngLT和pcMvSrchRngRB的范围内进行整像素搜索,其中最优的mv存入rcMv中,失真存入ruiSAD Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); Distortion uiSad; Distortion uiSadBest = std::numeric_limits<Distortion>::max(); Int iBestX = 0; Int iBestY = 0; //-- jclee for using the SAD function pointer m_pcRdCost->setDistParam( pcPatternKey, piRefY, iRefStride, m_cDistParam ); // fast encoder decision: use subsampled SAD for integer ME if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE3 ) { if ( m_cDistParam.iRows > 8 ) { m_cDistParam.iSubShift = 1; } } piRefY += (iSrchRngVerTop * iRefStride); for ( Int y = iSrchRngVerTop; y <= iSrchRngVerBottom; y++ ) { for ( Int x = iSrchRngHorLeft; x <= iSrchRngHorRight; x++ ) { // find min. distortion position m_cDistParam.pCur = piRefY + x; setDistParamComp(COMPONENT_Y); m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();#if NH_3D_IC m_cDistParam.bUseIC = pcPatternKey->getICFlag();#endif#if NH_3D_SDC_INTER m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();#endif uiSad = m_cDistParam.DistFunc( &m_cDistParam ); // motion cost uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y ); if ( uiSad < uiSadBest ) { uiSadBest = uiSad; iBestX = x; iBestY = y; m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; } } piRefY += iRefStride; } rcMv.set( iBestX, iBestY ); ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY ); return;}
xPatternSearchFast的主要部分见xTZSearch
Void TEncSearch::xPatternSearchFast( const TComDataCU* const pcCU, const TComPattern* const pcPatternKey, const Pel* const piRefY, const Int iRefStride, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, TComMv &rcMv, Distortion &ruiSAD, const TComMv* const pIntegerMv2Nx2NPred ){ assert (MD_LEFT < NUM_MV_PREDICTORS); pcCU->getMvPredLeft ( m_acMvPredictors[MD_LEFT] ); assert (MD_ABOVE < NUM_MV_PREDICTORS); pcCU->getMvPredAbove ( m_acMvPredictors[MD_ABOVE] ); assert (MD_ABOVE_RIGHT < NUM_MV_PREDICTORS); pcCU->getMvPredAboveRight ( m_acMvPredictors[MD_ABOVE_RIGHT] ); switch ( m_motionEstimationSearchMethod ) { case MESEARCH_DIAMOND: xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred, false ); break; case MESEARCH_SELECTIVE: xTZSearchSelective( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred ); break; case MESEARCH_DIAMOND_ENHANCED: xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred, true ); break; case MESEARCH_FULL: // shouldn't get here. default: break; }}
0 0
- HTM-16.2代码(10)——xPatternSearch和xPatternSearchFast
- HEVC代码追踪(十一。四):运动估计/补偿之xPatternSearch和xPatternSearchFast
- HTM-16.2代码(12)——xTZ8PointDiamondSearch和xTZ2PointSearch
- HTM-16.2代码(11)——xTZSearch
- HTM-16.2代码(6)——xMotionEstimation
- HTM-16.2代码(5)——predInterSearch
- HTM-16.2代码(9)——fillMvpCand
- HTM-16.2代码(8)——xEstimateMvPredAMVP
- HTM-16.2代码(7)——motionCompensation
- HTM-16.2代码(13)——getInterMergeCandidates
- HTM-16.2代码(3)——xCompressCU
- HTM-16.2代码(4)——xCheckRDCostInter
- HTM-16.2代码(2)——帧间预测(理论)
- HTM-16.2代码(1)——编码端一些函数的说明
- HEVC代码学习20:xPatternSearchFast函数
- 静态网页和动态网页—HTML(htm)文件和aspx(asp)文件
- MySQL的10件事—它们也许和你预想的不一样(转自:http://database.51cto.com/art/201011/233250.htm)
- HTM代码疑问
- Hadoop、Hive、Spark 之间是什么关系?
- SpringMVC入门(三) 注解的使用
- php接收curl传递不同参数类型的情况分析
- 动态设置View的宽高、宽高比例(设置ViewPager的高度,宽高比例为2:1)
- css规范
- HTM-16.2代码(10)——xPatternSearch和xPatternSearchFast
- 初识CPU卡、SAM卡/CPU卡简介、SAM卡简介
- Java 进行 RSA 加解密时不得不考虑到的那些事儿
- 生活----随笔
- text-overflow的用法
- 以两军问题为背景来演绎Basic Paxos 举例解释算法过程
- JavaScript 获取属性的值
- Leetcode151. Reverse Words in a String
- iOS Xcode 8 快捷键 (注释 失效 处理)