History

add me function pointers for screen contents

sijchen committed 12 years ago

Commit 80ae4cb1 parent cc7535e4 files · +102 −36Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 4 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+53−14
@@ -2428,6 +2428,36 @@ static inline void SetNormalCodingFunc (SWelsFuncPtrList* pFuncList) { · 2427 unmodified lines
24282428 pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 =
24292429 pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd;
24302430 }
2431+bool SetMeMethod (const uint8_t uiMethod, PSearchMethodFunc& pSearchMethodFunc) {
2432+ switch (uiMethod) {
2433+ case ME_DIA:
2434+ pSearchMethodFunc = WelsDiamondSearch;
2435+ break;
2436+ case ME_CROSS:
2437+ pSearchMethodFunc = WelsMotionCrossSearch;
2438+ break;
2439+ case ME_DIA_CROSS:
2440+ pSearchMethodFunc = WelsDiamondCrossSearch;
2441+ break;
2442+ case ME_DIA_CROSS_FME:
2443+ pSearchMethodFunc = WelsDiamondCrossFeatureSearch;
2444+ break;
2445+ case ME_FULL:
2446+#ifdef HAVE_MMX
2447+ // make sure your cpu can support x86 sse4.1 instruction set if try it
2448+ //pSearchMethodFunc = WelsFullSearch;
2449+#else
2450+ pSearchMethodFunc = WelsDiamondSearch;
2451+ return false;
2452+#endif//HAVE_MMX
2453+ break;
2454+ default:
2455+ pSearchMethodFunc = WelsDiamondSearch;
2456+ return false;
2457+ }
2458+ return true;
2459+}
2460+
24312461
24322462
24332463 void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
@@ -2465,13 +2495,19 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 31 unmodified lines
24652495 return;
24662496 //to init at each frame will be needed when dealing with hybrid content (camera+screen)
24672497 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
2468− SFeatureSearchPreparation* pFeatureSearchPreparation = pCurLayer->pFeatureSearchPreparation;
2469− if (pFeatureSearchPreparation) {
2470− pFeatureSearchPreparation->iHighFreMbCount = 0;
2471−
2472− if (P_SLICE == pCtx->eSliceType) {
2473− //MD related func pointers
2474− pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen;
2498+ if (P_SLICE == pCtx->eSliceType) {
2499+ //MD related func pointers
2500+ pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen;
2501+
2502+ //ME related func pointers
2503+ //ME16x16
2504+ if (!SetMeMethod (ME_DIA_CROSS, pFuncList->pfSearchMethod[BLOCK_16x16])) {
2505+ WelsLog (pCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_16x16) ME_DIA_CROSS unsuccessful, switched to default search\n");
2506+ }
2507+ //ME8x8
2508+ SFeatureSearchPreparation* pFeatureSearchPreparation = pCurLayer->pFeatureSearchPreparation;
2509+ if (pFeatureSearchPreparation) {
2510+ pFeatureSearchPreparation->iHighFreMbCount = 0;
24752511
24762512 //calculate bFMESwitchFlag
24772513 SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa);
@@ -2491,8 +2527,11 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 13 unmodified lines
24912527 }
24922528
24932529 //assign ME pointer
2494− if (pScreenBlockFeatureStorage->bRefBlockFeatureCalculated) {
2495− //TBC int32_t iIs16x16 = pScreenBlockFeatureStorage->iIs16x16;
2530+ if (pFeatureSearchPreparation->bFMESwitchFlag && pScreenBlockFeatureStorage->bRefBlockFeatureCalculated
2531+ && (!pScreenBlockFeatureStorage->iIs16x16)) {
2532+ if (!SetMeMethod (ME_DIA_CROSS_FME, pFuncList->pfSearchMethod[BLOCK_8x8])) {
2533+ WelsLog (pCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_8x8) ME_DIA_CROSS_FME unsuccessful, switched to default search\n");
2534+ }
24962535 }
24972536
24982537 //assign UpdateFMESwitch pointer
@@ -2501,11 +2540,11 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 2 unmodified lines
25012540 } else {
25022541 pFuncList->pfUpdateFMESwitch = UpdateFMESwitchNull;
25032542 }
2504− } else {
2505− //reset some status when at I_SLICE
2506− pFeatureSearchPreparation->bFMESwitchFlag = true;
2507− pFeatureSearchPreparation->uiFMEGoodFrameCount = FMESWITCH_DEFAULT_GOODFRAME_NUM;
2508− }
2543+ }//if (pFeatureSearchPreparation)
2544+ } else {
2545+ //reset some status when at I_SLICE
2546+ pCurLayer->pFeatureSearchPreparation->bFMESwitchFlag = true;
2547+ pCurLayer->pFeatureSearchPreparation->uiFMEGoodFrameCount = FMESWITCH_DEFAULT_GOODFRAME_NUM;
25092548 }
25102549 }
25112550 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t