Merge pull request #897 from lyao2/blockidc

add blockstaticidc pointer for MD
This commit is contained in:
ruil2 2014-05-27 10:05:18 +08:00
commit 3c3d4ef64b
4 changed files with 41 additions and 10 deletions

View File

@ -57,6 +57,7 @@ void WelsMdInterMbEnhancelayer (void* pEnc, void* pMd, SSlice* pSlice, SMB* pCur
SMB* GetRefMb (SDqLayer* pCurLayer, SMB* pCurMb);
void SetMvBaseEnhancelayer (SWelsMD* pMd, SMB* pCurMb, const SMB* kpRefMb);
void SetBlockStaticIdcToMd (void* pVaa, void* pMd, SMB* pCurMb, void* pDqLay);
}
#endif //SVC_MODE_DECISION_H

View File

@ -74,6 +74,7 @@ typedef struct {
SPicture* pRefPicture;
int32_t iSrcListIdx; //idx in h->spatial_pic[base_did];
bool bSceneLtrFlag;
unsigned char* pBestBlockStaticIdc;
} SRefInfoParam;
typedef struct {

View File

@ -153,24 +153,55 @@ void SetMvBaseEnhancelayer (SWelsMD* pMd, SMB* pCurMb, const SMB* kpRefMb) {
}
}
void SetBlockStaticIdcToMd (void* pVaa, void* pMd, SMB* pCurMb, void* pDqLay) { //TODO: OPT?
SVAAFrameInfoExt_t* pVaaExt = static_cast<SVAAFrameInfoExt_t*> (pVaa);
SWelsMD* pWelsMd = static_cast<SWelsMD*> (pMd);
SDqLayer* pDqLayer = static_cast<SDqLayer*> (pDqLay);
const int32_t kiMbX = pCurMb->iMbX;
const int32_t kiMbY = pCurMb->iMbY;
const int32_t kiMbWidth = pDqLayer->iMbWidth;
const int32_t kiWidth = kiMbWidth << 1;
const int32_t kiBlockIndexUp = (kiMbY << 1) * kiWidth + (kiMbX << 1);
const int32_t kiBlockIndexLow = ((kiMbY << 1) + 1) * kiWidth + (kiMbX << 1);
//fill_blockstaticidc with pVaaExt->pVaaBestBlockStaticIdc
pWelsMd->iBlock8x8StaticIdc[0] = pVaaExt->pVaaBestBlockStaticIdc[kiBlockIndexUp];
pWelsMd->iBlock8x8StaticIdc[1] = pVaaExt->pVaaBestBlockStaticIdc[kiBlockIndexUp + 1];
pWelsMd->iBlock8x8StaticIdc[2] = pVaaExt->pVaaBestBlockStaticIdc[kiBlockIndexLow];
pWelsMd->iBlock8x8StaticIdc[3] = pVaaExt->pVaaBestBlockStaticIdc[kiBlockIndexLow + 1];
}
///////////////////////
// Scrolling PSkip Decision for screen content
// Scene Change Detection (SCD) PSkip Decision for screen content
////////////////////////
bool WelsMdInterJudgeScrollingPskip (void* pEncCtx, void* pWelsMd, SSlice* slice, SMB* pCurMb, SMbCache* pMbCache) {
bool WelsMdInterJudgeSCDPskip (void* pEncCtx, void* pWelsMd, SSlice* slice, SMB* pCurMb, SMbCache* pMbCache) {
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
SWelsMD* pMd = (SWelsMD*)pWelsMd;
SDqLayer* pCurDqLayer = pCtx->pCurDqLayer;
SetBlockStaticIdcToMd (pCtx->pVaa, pMd, pCurMb, pCurDqLayer);
//try static Pskip;
//try scrolled Pskip
//TBD
return false;
}
bool WelsMdInterJudgeScrollingPskipFalse (void* pEncCtx, void* pWelsMd, SSlice* slice, SMB* pCurMb,
SMbCache* pMbCache) {
bool WelsMdInterJudgeSCDPskipFalse (void* pEncCtx, void* pWelsMd, SSlice* slice, SMB* pCurMb,
SMbCache* pMbCache) {
return false;
}
void WelsInitScrollingSkipFunc (SWelsFuncPtrList* pFuncList, const bool bScrollingDetection) {
if (bScrollingDetection) {
pFuncList->pfScrollingPSkipDecision = WelsMdInterJudgeScrollingPskip;
pFuncList->pfScrollingPSkipDecision = WelsMdInterJudgeSCDPskip;
} else {
pFuncList->pfScrollingPSkipDecision = WelsMdInterJudgeScrollingPskipFalse;
pFuncList->pfScrollingPSkipDecision = WelsMdInterJudgeSCDPskipFalse;
}
}

View File

@ -927,6 +927,7 @@ void CWelsPreProcess::SaveBestRefToLocal (SRefInfoParam* pRefPicInfo, const SSce
SRefInfoParam* pRefSaved) {
pRefSaved->iSrcListIdx = pRefPicInfo->iSrcListIdx;
pRefSaved->bSceneLtrFlag = pRefPicInfo->bSceneLtrFlag;
pRefSaved->pBestBlockStaticIdc = sSceneChangeResult.pStaticBlockIdc;
}
void CWelsPreProcess::SaveBestRefToVaa (SRefInfoParam& sRefSaved, SRefInfoParam* pVaaBestRef) {
@ -974,8 +975,6 @@ ESceneChangeIdc CWelsPreProcess::DetectSceneChangeScreen (sWelsEncCtx* pCtx, SPi
SPicture* pRefPic = NULL;
SRefInfoParam* pRefPicInfo = NULL;
uint8_t* pCurBlockStaticPointer = NULL;
uint8_t* pBestStrBlockStaticPointer = NULL;
uint8_t* pBestLtrBlockStaticPointer = NULL;
const int32_t iNegligibleMotionBlocks = (static_cast<int32_t> ((pCurPicture->iWidthInPixel >> 3) *
(pCurPicture->iHeightInPixel >> 3) * STATIC_SCENE_MOTION_RATIO));
@ -1046,12 +1045,10 @@ ESceneChangeIdc CWelsPreProcess::DetectSceneChangeScreen (sWelsEncCtx* pCtx, SPi
SaveBestRefToJudgement (iRefPicAvQP, iFrameComplexity, &sLtrJudgement);
SaveBestRefToLocal (pRefPicInfo, sSceneChangeResult, &sLtrSaved);
bBestRefIsLtr = bCurRefIsLtr;
pBestStrBlockStaticPointer = sSceneChangeResult.pStaticBlockIdc;
}
if (bCurRefIsLtr && JudgeBestRef (pRefPic, sSceneLtrJudgement, iFrameComplexity, bIsClosestLtrFrame)) {
SaveBestRefToJudgement (iRefPicAvQP, iFrameComplexity, &sSceneLtrJudgement);
SaveBestRefToLocal (pRefPicInfo, sSceneChangeResult, &sSceneLtrSaved);
pBestLtrBlockStaticPointer = sSceneChangeResult.pStaticBlockIdc;
}
if (iMotionBlockNum <= iNegligibleMotionBlocks) {
@ -1072,6 +1069,7 @@ ESceneChangeIdc CWelsPreProcess::DetectSceneChangeScreen (sWelsEncCtx* pCtx, SPi
pCtx->iCodingIndex);
SaveBestRefToVaa (sLtrSaved, & (pVaaExt->sVaaStrBestRefCandidate[0]));
pVaaExt->pVaaBestBlockStaticIdc = sLtrSaved.pBestBlockStaticIdc;
if (0 == iAvailableSceneRefNum) {
SaveBestRefToVaa (sSceneLtrSaved, & (pVaaExt->sVaaStrBestRefCandidate[1]));