Change the output of diamond search from qpel to interpel

This commit is contained in:
sijchen 2014-03-25 11:03:37 +08:00
parent 74a92522e5
commit fcae0c7c48
3 changed files with 11 additions and 8 deletions

View File

@ -2523,6 +2523,8 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
pFuncList->pfCalculateSatd = CalculateSatdCost;
pFuncList->pfInterFineMd = WelsMdInterFinePartition;
}
}
}

View File

@ -44,18 +44,18 @@
namespace WelsSVCEnc {
inline void UpdateMeResults( const SMVUnitXY ksBestMv, const uint32_t kiBestSadCost, uint8_t* pRef, SWelsME * pMe )
static inline void UpdateMeResults( const SMVUnitXY ksBestMv, const uint32_t kiBestSadCost, uint8_t* pRef, SWelsME * pMe )
{
pMe->sMv = ksBestMv;
pMe->pRefMb = pRef;
pMe->uiSadCost = kiBestSadCost;
}
inline void SvcMeEndSearch( SWelsME * pMe, const uint32_t kuiBestSadCost )
static inline void MeEndIntepelSearch( SWelsME * pMe )
{
/* -> qpel mv */
pMe->sMv.iMvX <<= 2;
pMe->sMv.iMvY <<= 2;
pMe->uiSatdCost = kuiBestSadCost;
pMe->uiSatdCost = pMe->uiSadCost;
}
@ -78,6 +78,7 @@ void WelsMotionEstimateSearch (SWelsFuncPtrList* pFuncList, void* pLplayer, void
// Step 1: Initial point prediction
if ( !WelsMotionEstimateInitialPoint (pFuncList, pMe, pSlice, iStrideEnc, iStrideRef) ) {
WelsMotionEstimateIterativeSearch (pFuncList, pMe, iStrideEnc, iStrideRef, pMe->pRefMb);
MeEndIntepelSearch(pMe);
}
pFuncList->pfCalculateSatd( pFuncList->sSampleDealingFuncs.pfSampleSatd[pMe->uiPixel], pMe, iStrideEnc, iStrideRef );
@ -151,7 +152,7 @@ bool WelsMotionEstimateInitialPoint (SWelsFuncPtrList* pFuncList, SWelsME* pMe,
UpdateMeResults( sMv, iBestSadCost, pRefMb, pMe );
if ( iBestSadCost < static_cast<int32_t>(pMe->uSadPredISatd.uiSadPred) ) {
//Initial point early Stop
SvcMeEndSearch(pMe, iBestSadCost);
MeEndIntepelSearch(pMe);
return true;
}
return false;
@ -226,9 +227,9 @@ void WelsMotionEstimateIterativeSearch (SWelsFuncPtrList* pFuncList, SWelsME* pM
}
/* -> qpel mv */
pMe->sMv.iMvX = (iMvDx + pMe->sMvp.iMvX) & 0xFFFC;
pMe->sMv.iMvY = (iMvDy + pMe->sMvp.iMvY) & 0xFFFC;
/* integer-pel mv */
pMe->sMv.iMvX = (iMvDx + pMe->sMvp.iMvX) >>2;
pMe->sMv.iMvY = (iMvDy + pMe->sMvp.iMvY) >>2;
pMe->uiSatdCost = pMe->uiSadCost = (iBestCost);
pMe->pRefMb = pRefMb;
}

View File

@ -114,7 +114,7 @@ TEST_F(MotionEstimateTest, TestDiamondSearch)
//the last selection may be affected by MVDcost, that is when (0,0) will be better
//when comparing (1,1) and (1,0), due to the difference between MVD cost, it is possible that (1,0) is selected while the best match is (1,1)
bFoundMatch = ((sMe.sMv.iMvX==(sTargetMv.iMvX*4))||(sMe.sMv.iMvX==0)) && ((sMe.sMv.iMvY==(sTargetMv.iMvY*4))||(sMe.sMv.iMvY==0));
bFoundMatch = ((sMe.sMv.iMvX==(sTargetMv.iMvX))||(sMe.sMv.iMvX==0)) && ((sMe.sMv.iMvY==(sTargetMv.iMvY))||(sMe.sMv.iMvY==0));
}
if (bDataGeneratorSucceed) {
//if DataGenerator never succeed, there is no meaning to check iTryTimes