Merge pull request #1832 from sijchen/imp_mc
[Encoder] replace conditional judgements with faster operations
This commit is contained in:
commit
3022d4f655
@ -122,6 +122,7 @@ uint8_t* pHalfPixHV;
|
||||
uint8_t* pQuarPixBest;
|
||||
uint8_t* pQuarPixTmp;
|
||||
|
||||
PCopyFunc pfCopyBlockByMode;
|
||||
} SMeRefinePointer;
|
||||
|
||||
void FillNeighborCacheIntra (SMbCache* pMbCache, SMB* pCurMb, int32_t iMbWidth/*, bool constrained_intra_pred_flag*/);
|
||||
|
@ -93,6 +93,8 @@ int16_t iMbWidth; // MB width of this picture, equal to pSps.iMbWidth
|
||||
int16_t iMbHeight; // MB height of this picture, equal to pSps.iMbHeight;
|
||||
|
||||
bool bBaseLayerAvailableFlag; // whether base layer is available for prediction?
|
||||
bool bSatdInMdFlag; // whether SATD is calculated in ME and integer-pel MD
|
||||
|
||||
uint8_t iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
|
||||
int8_t iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 0
|
||||
int8_t iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
|
||||
|
@ -3046,6 +3046,10 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
|
||||
pCurLayer->pFeatureSearchPreparation->uiFMEGoodFrameCount = FMESWITCH_DEFAULT_GOODFRAME_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
// update some layer dependent variable to save judgements in mb-level
|
||||
pCurLayer->bSatdInMdFlag = ((pFuncList->sSampleDealingFuncs.pfMeCost == pFuncList->sSampleDealingFuncs.pfSampleSatd)
|
||||
&& (pFuncList->sSampleDealingFuncs.pfMdCost == pFuncList->sSampleDealingFuncs.pfSampleSatd));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -598,8 +598,7 @@ void MeRefineFracPixel (sWelsEncCtx* pEncCtx, uint8_t* pMemPredInterMb, SWelsME*
|
||||
int32_t iCurCost;
|
||||
int32_t iBestHalfPix;
|
||||
|
||||
if ((pFunc->sSampleDealingFuncs.pfMeCost == pFunc->sSampleDealingFuncs.pfSampleSatd)
|
||||
&& (pFunc->sSampleDealingFuncs.pfMdCost == pFunc->sSampleDealingFuncs.pfSampleSatd)) {
|
||||
if (pEncCtx->pCurDqLayer->bSatdInMdFlag) {
|
||||
iBestCost = pMe->uSadPredISatd.uiSatd + COST_MVD (pMe->pMvdCost, iMvx - pMe->sMvp.iMvX, iMvy - pMe->sMvp.iMvY);
|
||||
} else {
|
||||
iBestCost = pFunc->sSampleDealingFuncs.pfMeCost[pMe->uiBlockSize] (pEncData, kiStrideEnc, pRef, kiStrideRef) +
|
||||
@ -765,17 +764,8 @@ void MeRefineFracPixel (sWelsEncCtx* pEncCtx, uint8_t* pMemPredInterMb, SWelsME*
|
||||
pBestPredInter = pRef;
|
||||
iInterBlk4Stride = kiStrideRef;
|
||||
}
|
||||
if (MB_WIDTH_LUMA == iWidth && MB_HEIGHT_LUMA == iHeight) { //P16x16
|
||||
pFunc->pfCopy16x16NotAligned (pMemPredInterMb, MB_WIDTH_LUMA, pBestPredInter,
|
||||
iInterBlk4Stride); // dst can be align with 16 bytes, but not sure at pSrc, 12/29/2011
|
||||
} else if (MB_WIDTH_LUMA == iWidth && MB_HEIGHT_CHROMA == iHeight) { //P16x8
|
||||
pFunc->pfCopy16x8NotAligned (pMemPredInterMb, MB_WIDTH_LUMA, pBestPredInter,
|
||||
iInterBlk4Stride); // dst can be align with 16 bytes, but not sure at pSrc, 12/29/2011
|
||||
} else if (MB_WIDTH_CHROMA == iWidth && MB_HEIGHT_LUMA == iHeight) { //P8x16
|
||||
pFunc->pfCopy8x16Aligned (pMemPredInterMb, MB_WIDTH_LUMA, pBestPredInter, iInterBlk4Stride);
|
||||
} else { //P8x8
|
||||
pFunc->pfCopy8x8Aligned (pMemPredInterMb, MB_WIDTH_LUMA, pBestPredInter, iInterBlk4Stride);
|
||||
}
|
||||
pMeRefine->pfCopyBlockByMode (pMemPredInterMb, MB_WIDTH_LUMA, pBestPredInter,
|
||||
iInterBlk4Stride);
|
||||
}
|
||||
|
||||
void InitBlkStrideWithRef (int32_t* pBlkStride, const int32_t kiStrideRef) {
|
||||
|
@ -1148,7 +1148,8 @@ void WelsMdInterFinePartition (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SSlice* p
|
||||
}
|
||||
}
|
||||
|
||||
void WelsMdInterFinePartitionVaa (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SSlice* pSlice, SMB* pCurMb, int32_t iBestCost) {
|
||||
void WelsMdInterFinePartitionVaa (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SSlice* pSlice, SMB* pCurMb,
|
||||
int32_t iBestCost) {
|
||||
SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
|
||||
// SMbCache *pMbCache = &pSlice->sMbCacheInfo;
|
||||
int32_t iCostP8x16, iCostP16x8, iCostP8x8;
|
||||
@ -1428,6 +1429,7 @@ const int32_t g_kiPixStrideIdx8x8[4] = { 0,
|
||||
|
||||
void WelsMdInterMbRefinement (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache) {
|
||||
SDqLayer* pCurDqLayer = pEncCtx->pCurDqLayer;
|
||||
SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
|
||||
uint8_t* pTmpRefCb, *pTmpRefCr, *pTmpDstCb, *pTmpDstCr;
|
||||
int32_t iMvStride, iRefBlk4Stride, iDstBlk4Stride;
|
||||
SMVUnitXY* pMv;
|
||||
@ -1448,6 +1450,8 @@ void WelsMdInterMbRefinement (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurM
|
||||
case MB_TYPE_16x16:
|
||||
//luma
|
||||
InitMeRefinePointer (&sMeRefine, pMbCache, 0);
|
||||
sMeRefine.pfCopyBlockByMode =
|
||||
pFunc->pfCopy16x16NotAligned; // dst can be align with 16 bytes, but not sure at pSrc, 12/29/2011
|
||||
MeRefineFracPixel (pEncCtx, pDstLuma, &pWelsMd->sMe.sMe16x16, &sMeRefine, 16, 16);
|
||||
UpdateP16x16MotionInfo (pMbCache, pCurMb, pWelsMd->uiRef, &pWelsMd->sMe.sMe16x16.sMv);
|
||||
|
||||
@ -1474,6 +1478,8 @@ void WelsMdInterMbRefinement (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurM
|
||||
|
||||
case MB_TYPE_16x8:
|
||||
iPixStride = 0;
|
||||
sMeRefine.pfCopyBlockByMode =
|
||||
pFunc->pfCopy16x8NotAligned; // dst can be align with 16 bytes, but not sure at pSrc, 12/29/2011
|
||||
for (i = 0; i < 2; i++) {
|
||||
//luma
|
||||
iIdx = i << 3;
|
||||
@ -1503,6 +1509,7 @@ void WelsMdInterMbRefinement (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurM
|
||||
|
||||
case MB_TYPE_8x16:
|
||||
iPixStride = 0;
|
||||
sMeRefine.pfCopyBlockByMode = pFunc->pfCopy8x16Aligned;
|
||||
for (i = 0; i < 2; i++) {
|
||||
//luma
|
||||
iIdx = i << 2;
|
||||
@ -1528,8 +1535,8 @@ void WelsMdInterMbRefinement (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurM
|
||||
pEncCtx->pFuncList->sMcFuncs.pMcChromaFunc (pTmpRefCr, iLineSizeRefUV, pTmpDstCr, 8, pMv->iMvX, pMv->iMvY, 4, 8); //Cr
|
||||
}
|
||||
break;
|
||||
|
||||
case MB_TYPE_8x8:
|
||||
sMeRefine.pfCopyBlockByMode = pFunc->pfCopy8x8Aligned;
|
||||
for (i = 0; i < 4; i++) {
|
||||
int32_t iBlk8Idx = i << 2; //0, 4, 8, 12
|
||||
int32_t iBlk4X, iBlk4Y;
|
||||
@ -1558,8 +1565,10 @@ void WelsMdInterMbRefinement (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurM
|
||||
pTmpDstCb = pDstCb + iDstBlk4Stride;
|
||||
pTmpRefCr = pRefCr + iRefBlk4Stride;
|
||||
pTmpDstCr = pDstCr + iDstBlk4Stride;
|
||||
pEncCtx->pFuncList->sMcFuncs.pMcChromaFunc (pTmpRefCb + iMvStride, iLineSizeRefUV, pTmpDstCb, 8, pMv->iMvX, pMv->iMvY, 4, 4); //Cb
|
||||
pEncCtx->pFuncList->sMcFuncs.pMcChromaFunc (pTmpRefCr + iMvStride, iLineSizeRefUV, pTmpDstCr, 8, pMv->iMvX, pMv->iMvY, 4, 4); //Cr
|
||||
pEncCtx->pFuncList->sMcFuncs.pMcChromaFunc (pTmpRefCb + iMvStride, iLineSizeRefUV, pTmpDstCb, 8, pMv->iMvX, pMv->iMvY,
|
||||
4, 4); //Cb
|
||||
pEncCtx->pFuncList->sMcFuncs.pMcChromaFunc (pTmpRefCr + iMvStride, iLineSizeRefUV, pTmpDstCr, 8, pMv->iMvX, pMv->iMvY,
|
||||
4, 4); //Cr
|
||||
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user