Changeset 1403 in SHVCSoftware for branches/SHM-dev
- Timestamp:
- 4 Aug 2015, 04:03:16 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibEncoder
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1402 r1403 324 324 } 325 325 326 #define TZ_SEARCH_CONFIGURATION \ 327 const Int iRaster = 5; /* TZ soll von aussen ?ergeben werden */ \ 328 const Bool bTestOtherPredictedMV = 0; \ 329 const Bool bTestZeroVector = 1; \ 330 const Bool bTestZeroVectorStart = 0; \ 331 const Bool bTestZeroVectorStop = 0; \ 332 const Bool bFirstSearchDiamond = 1; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 333 const Bool bFirstSearchStop = m_pcEncCfg->getFastMEAssumingSmootherMVEnabled(); \ 334 const UInt uiFirstSearchRounds = 3; /* first search stop X rounds after best match (must be >=1) */ \ 335 const Bool bEnableRasterSearch = 1; \ 336 const Bool bAlwaysRasterSearch = 0; /* ===== 1: BETTER but factor 2 slower ===== */ \ 337 const Bool bRasterRefinementEnable = 0; /* enable either raster refinement or star refinement */ \ 338 const Bool bRasterRefinementDiamond = 0; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 339 const Bool bStarRefinementEnable = 1; /* enable either star refinement or raster refinement */ \ 340 const Bool bStarRefinementDiamond = 1; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 341 const Bool bStarRefinementStop = 0; \ 342 const UInt uiStarRefinementRounds = 2; /* star refinement stop X rounds after best match (must be >=1) */ \ 343 344 345 #define SEL_SEARCH_CONFIGURATION \ 346 const Bool bTestOtherPredictedMV = 1; \ 347 const Bool bTestZeroVector = 1; \ 348 const Bool bEnableRasterSearch = 1; \ 349 const Bool bAlwaysRasterSearch = 0; /* ===== 1: BETTER but factor 15x slower ===== */ \ 350 const Bool bStarRefinementEnable = 1; /* enable either star refinement or raster refinement */ \ 351 const Bool bStarRefinementDiamond = 1; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 352 const Bool bStarRefinementStop = 0; \ 353 const UInt uiStarRefinementRounds = 2; /* star refinement stop X rounds after best match (must be >=1) */ \ 354 const UInt uiSearchRange = m_iSearchRange; \ 355 const Int uiSearchRangeInitial = m_iSearchRange >> 2; \ 356 const Int uiSearchStep = 4; \ 357 const Int iMVDistThresh = 8; \ 358 359 360 361 __inline Void TEncSearch::xTZSearchHelp( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ) 326 327 __inline Void TEncSearch::xTZSearchHelp( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ) 362 328 { 363 329 Distortion uiSad = 0; 364 330 365 Pel* piRefSrch; 366 367 piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 331 const Pel* const piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 368 332 369 333 //-- jclee for using the SAD function pointer … … 463 427 } 464 428 465 466 467 468 __inline Void TEncSearch::xTZ2PointSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB ) 429 __inline Void TEncSearch::xTZ2PointSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB ) 469 430 { 470 431 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); … … 599 560 600 561 601 __inline Void TEncSearch::xTZ8PointSquareSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist )562 __inline Void TEncSearch::xTZ8PointSquareSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ) 602 563 { 603 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor();604 Int iSrchRngHorRight = pcMvSrchRngRB->getHor();605 Int iSrchRngVerTop = pcMvSrchRngLT->getVer();606 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer();564 const Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 565 const Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 566 const Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 567 const Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 607 568 608 569 // 8 point search, // 1 2 3 … … 657 618 658 619 659 __inline Void TEncSearch::xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ) 620 __inline Void TEncSearch::xTZ8PointDiamondSearch( const TComPattern*const pcPatternKey, 621 IntTZSearchStruct& rcStruct, 622 const TComMv*const pcMvSrchRngLT, 623 const TComMv*const pcMvSrchRngRB, 624 const Int iStartX, 625 const Int iStartY, 626 const Int iDist) 660 627 { 661 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor();662 Int iSrchRngHorRight = pcMvSrchRngRB->getHor();663 Int iSrchRngVerTop = pcMvSrchRngLT->getVer();664 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer();628 const Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 629 const Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 630 const Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 631 const Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 665 632 666 633 // 8 point search, // 1 2 3 … … 674 641 rcStruct.uiBestRound += 1; 675 642 676 if ( iDist == 1 ) // iDist == 1643 if ( iDist == 1 ) 677 644 { 678 645 if ( iTop >= iSrchRngVerTop ) // check top … … 693 660 } 694 661 } 695 else // if (iDist != 1)662 else 696 663 { 697 664 if ( iDist <= 8 ) … … 767 734 for ( Int index = 1; index < 4; index++ ) 768 735 { 769 Int iPosYT = iTop + ((iDist>>2) * index);770 Int iPosYB = iBottom - ((iDist>>2) * index);771 Int iPosXL = iStartX - ((iDist>>2) * index);772 Int iPosXR = iStartX + ((iDist>>2) * index);736 const Int iPosYT = iTop + ((iDist>>2) * index); 737 const Int iPosYB = iBottom - ((iDist>>2) * index); 738 const Int iPosXL = iStartX - ((iDist>>2) * index); 739 const Int iPosXR = iStartX + ((iDist>>2) * index); 773 740 xTZSearchHelp( pcPatternKey, rcStruct, iPosXL, iPosYT, 0, iDist ); 774 741 xTZSearchHelp( pcPatternKey, rcStruct, iPosXR, iPosYT, 0, iDist ); … … 797 764 for ( Int index = 1; index < 4; index++ ) 798 765 { 799 Int iPosYT = iTop + ((iDist>>2) * index);800 Int iPosYB = iBottom - ((iDist>>2) * index);801 Int iPosXL = iStartX - ((iDist>>2) * index);802 Int iPosXR = iStartX + ((iDist>>2) * index);766 const Int iPosYT = iTop + ((iDist>>2) * index); 767 const Int iPosYB = iBottom - ((iDist>>2) * index); 768 const Int iPosXL = iStartX - ((iDist>>2) * index); 769 const Int iPosXR = iStartX + ((iDist>>2) * index); 803 770 804 771 if ( iPosYT >= iSrchRngVerTop ) // check top … … 830 797 } 831 798 832 833 834 835 836 //<--837 838 799 Distortion TEncSearch::xPatternRefinement( TComPattern* pcPatternKey, 839 800 TComMv baseRefMv, … … 3993 3954 3994 3955 3995 Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB ) 3956 Void TEncSearch::xSetSearchRange ( const TComDataCU* const pcCU, const TComMv& cMvPred, const Int iSrchRng, 3957 TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB ) 3996 3958 { 3997 3959 Int iMvShift = 2; … … 4016 3978 } 4017 3979 4018 4019 4020 4021 Void TEncSearch::xPatternSearch( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, TComMv& rcMv, Distortion& ruiSAD ) 3980 Void TEncSearch::xPatternSearch( const TComPattern* const pcPatternKey, 3981 const Pel* piRefY, 3982 const Int iRefStride, 3983 const TComMv* const pcMvSrchRngLT, 3984 const TComMv* const pcMvSrchRngRB, 3985 TComMv& rcMv, 3986 Distortion& ruiSAD ) 4022 3987 { 4023 3988 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); … … 4031 3996 Int iBestY = 0; 4032 3997 4033 Pel* piRefSrch;4034 4035 3998 //-- jclee for using the SAD function pointer 4036 3999 m_pcRdCost->setDistParam( pcPatternKey, piRefY, iRefStride, m_cDistParam ); … … 4051 4014 { 4052 4015 // find min. distortion position 4053 piRefSrch = piRefY + x; 4054 m_cDistParam.pCur = piRefSrch; 4016 m_cDistParam.pCur = piRefY + x; 4055 4017 4056 4018 setDistParamComp(COMPONENT_Y); … … 4081 4043 4082 4044 4083 Void TEncSearch::xPatternSearchFast( TComDataCU*pcCU,4084 TComPattern*pcPatternKey,4085 Pel*piRefY,4086 IntiRefStride,4087 TComMv*pcMvSrchRngLT,4088 TComMv*pcMvSrchRngRB,4089 TComMv &rcMv,4090 Distortion &ruiSAD,4091 const TComMv* pIntegerMv2Nx2NPred )4045 Void TEncSearch::xPatternSearchFast( const TComDataCU* const pcCU, 4046 const TComPattern* const pcPatternKey, 4047 const Pel* const piRefY, 4048 const Int iRefStride, 4049 const TComMv* const pcMvSrchRngLT, 4050 const TComMv* const pcMvSrchRngRB, 4051 TComMv& rcMv, 4052 Distortion& ruiSAD, 4053 const TComMv* const pIntegerMv2Nx2NPred ) 4092 4054 { 4093 4055 assert (MD_LEFT < NUM_MV_PREDICTORS); … … 4115 4077 4116 4078 4117 Void TEncSearch::xTZSearch( TComDataCU*pcCU,4118 TComPattern*pcPatternKey,4119 Pel*piRefY,4120 IntiRefStride,4121 TComMv*pcMvSrchRngLT,4122 TComMv*pcMvSrchRngRB,4123 TComMv &rcMv,4124 Distortion &ruiSAD,4125 const TComMv* pIntegerMv2Nx2NPred )4079 Void TEncSearch::xTZSearch( const TComDataCU* const pcCU, 4080 const TComPattern* const pcPatternKey, 4081 const Pel* const piRefY, 4082 const Int iRefStride, 4083 const TComMv* const pcMvSrchRngLT, 4084 const TComMv* const pcMvSrchRngRB, 4085 TComMv& rcMv, 4086 Distortion& ruiSAD, 4087 const TComMv* const pIntegerMv2Nx2NPred ) 4126 4088 { 4127 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 4128 Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 4129 Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 4130 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 4131 4132 TZ_SEARCH_CONFIGURATION 4089 const Int iRaster = 5; 4090 const Bool bTestOtherPredictedMV = false; 4091 const Bool bTestZeroVector = true; 4092 const Bool bTestZeroVectorStart = false; 4093 const Bool bTestZeroVectorStop = false; 4094 const Bool bFirstSearchDiamond = true; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 4095 const Bool bFirstSearchStop = m_pcEncCfg->getFastMEAssumingSmootherMVEnabled(); 4096 const UInt uiFirstSearchRounds = 3; // first search stop X rounds after best match (must be >=1) 4097 const Bool bEnableRasterSearch = true; 4098 const Bool bAlwaysRasterSearch = 0; // ===== 1: BETTER but factor 2 slower ===== 4099 const Bool bRasterRefinementEnable = false; // enable either raster refinement or star refinement 4100 const Bool bRasterRefinementDiamond = false; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 4101 const Bool bStarRefinementEnable = true; // enable either star refinement or raster refinement 4102 const Bool bStarRefinementDiamond = true; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 4103 const Bool bStarRefinementStop = false; 4104 const UInt uiStarRefinementRounds = 2; // star refinement stop X rounds after best match (must be >=1) 4133 4105 4134 4106 UInt uiSearchRange = m_iSearchRange; … … 4169 4141 xTZSearchHelp( pcPatternKey, cStruct, 0, 0, 0, 0 ); 4170 4142 } 4143 4144 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 4145 Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 4146 Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 4147 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 4171 4148 4172 4149 if (pIntegerMv2Nx2NPred != 0) … … 4331 4308 4332 4309 4333 Void TEncSearch::xTZSearchSelective( TComDataCU*pcCU,4334 TComPattern*pcPatternKey,4335 Pel*piRefY,4336 IntiRefStride,4337 TComMv*pcMvSrchRngLT,4338 TComMv*pcMvSrchRngRB,4339 TComMv &rcMv,4340 Distortion &ruiSAD,4341 const TComMv* pIntegerMv2Nx2NPred )4310 Void TEncSearch::xTZSearchSelective( const TComDataCU* const pcCU, 4311 const TComPattern* const pcPatternKey, 4312 const Pel* const piRefY, 4313 const Int iRefStride, 4314 const TComMv* const pcMvSrchRngLT, 4315 const TComMv* const pcMvSrchRngRB, 4316 TComMv &rcMv, 4317 Distortion &ruiSAD, 4318 const TComMv* const pIntegerMv2Nx2NPred ) 4342 4319 { 4343 SEL_SEARCH_CONFIGURATION 4320 const Bool bTestOtherPredictedMV = true; 4321 const Bool bTestZeroVector = true; 4322 const Bool bEnableRasterSearch = true; 4323 const Bool bAlwaysRasterSearch = false; // 1: BETTER but factor 15x slower 4324 const Bool bStarRefinementEnable = true; // enable either star refinement or raster refinement 4325 const Bool bStarRefinementDiamond = true; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 4326 const Bool bStarRefinementStop = false; 4327 const UInt uiStarRefinementRounds = 2; // star refinement stop X rounds after best match (must be >=1) 4328 const UInt uiSearchRange = m_iSearchRange; 4329 const Int uiSearchRangeInitial = m_iSearchRange >> 2; 4330 const Int uiSearchStep = 4; 4331 const Int iMVDistThresh = 8; 4344 4332 4345 4333 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h
r1372 r1403 160 160 typedef struct 161 161 { 162 Pel*piRefY;162 const Pel* piRefY; 163 163 Int iYStride; 164 164 Int iBestX; … … 171 171 172 172 // sub-functions for ME 173 __inline Void xTZSearchHelp ( TComPattern*pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance );174 __inline Void xTZ2PointSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB );175 __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );176 __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );173 __inline Void xTZSearchHelp ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ); 174 __inline Void xTZ2PointSearch ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB ); 175 __inline Void xTZ8PointSquareSearch ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); 176 __inline Void xTZ8PointDiamondSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); 177 177 178 178 Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, Distortion& ruiSAD, Bool Hadamard ); … … 396 396 Bool bBi = false ); 397 397 398 Void xTZSearch ( TComDataCU*pcCU,399 TComPattern*pcPatternKey,400 Pel*piRefY,401 IntiRefStride,402 TComMv*pcMvSrchRngLT,403 TComMv*pcMvSrchRngRB,404 TComMv& rcMv,405 Distortion& ruiSAD,406 const TComMv *pIntegerMv2Nx2NPred398 Void xTZSearch ( const TComDataCU* const pcCU, 399 const TComPattern* const pcPatternKey, 400 const Pel* const piRefY, 401 const Int iRefStride, 402 const TComMv* const pcMvSrchRngLT, 403 const TComMv* const pcMvSrchRngRB, 404 TComMv& rcMv, 405 Distortion& ruiSAD, 406 const TComMv* const pIntegerMv2Nx2NPred 407 407 ); 408 408 409 Void xTZSearchSelective ( TComDataCU*pcCU,410 TComPattern*pcPatternKey,411 Pel*piRefY,412 IntiRefStride,413 TComMv*pcMvSrchRngLT,414 TComMv*pcMvSrchRngRB,415 TComMv& rcMv,416 Distortion& ruiSAD,417 const TComMv *pIntegerMv2Nx2NPred409 Void xTZSearchSelective ( const TComDataCU* const pcCU, 410 const TComPattern* const pcPatternKey, 411 const Pel* const piRefY, 412 const Int iRefStride, 413 const TComMv* const pcMvSrchRngLT, 414 const TComMv* const pcMvSrchRngRB, 415 TComMv& rcMv, 416 Distortion& ruiSAD, 417 const TComMv* const pIntegerMv2Nx2NPred 418 418 ); 419 419 420 Void xSetSearchRange ( TComDataCU*pcCU,421 TComMv& cMvPred,422 Int iSrchRng,420 Void xSetSearchRange ( const TComDataCU* const pcCU, 421 const TComMv& cMvPred, 422 const Int iSrchRng, 423 423 TComMv& rcMvSrchRngLT, 424 424 TComMv& rcMvSrchRngRB ); 425 425 426 Void xPatternSearchFast ( TComDataCU*pcCU,427 TComPattern*pcPatternKey,428 Pel*piRefY,429 IntiRefStride,430 TComMv*pcMvSrchRngLT,431 TComMv*pcMvSrchRngRB,432 TComMv& rcMv,433 Distortion& ruiSAD,434 const TComMv* pIntegerMv2Nx2NPred426 Void xPatternSearchFast ( const TComDataCU* const pcCU, 427 const TComPattern* const pcPatternKey, 428 const Pel* const piRefY, 429 const Int iRefStride, 430 const TComMv* const pcMvSrchRngLT, 431 const TComMv* const pcMvSrchRngRB, 432 TComMv& rcMv, 433 Distortion& ruiSAD, 434 const TComMv* const pIntegerMv2Nx2NPred 435 435 ); 436 436 437 Void xPatternSearch ( TComPattern*pcPatternKey,438 Pel*piRefY,439 IntiRefStride,440 TComMv*pcMvSrchRngLT,441 TComMv*pcMvSrchRngRB,437 Void xPatternSearch ( const TComPattern* const pcPatternKey, 438 const Pel* piRefY, 439 const Int iRefStride, 440 const TComMv* const pcMvSrchRngLT, 441 const TComMv* const pcMvSrchRngRB, 442 442 TComMv& rcMv, 443 443 Distortion& ruiSAD );
Note: See TracChangeset for help on using the changeset viewer.