Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 4 files). Show all
Unified · Split
| @@ -2428,6 +2428,36 @@ static inline void SetNormalCodingFunc (SWelsFuncPtrList* pFuncList) { · 2427 unmodified lines | |||
| 2428 | pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 = | 2428 | pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 = |
| 2429 | pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd; | 2429 | pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd; |
| 2430 | } | 2430 | } |
| 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 | |||
| 2431 | 2461 | ||
| 2432 | 2462 | ||
| 2433 | void PreprocessSliceCoding (sWelsEncCtx* pCtx) { | 2463 | void PreprocessSliceCoding (sWelsEncCtx* pCtx) { |
| @@ -2465,13 +2495,19 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 31 unmodified lines | |||
| 2465 | return; | 2495 | return; |
| 2466 | //to init at each frame will be needed when dealing with hybrid content (camera+screen) | 2496 | //to init at each frame will be needed when dealing with hybrid content (camera+screen) |
| 2467 | if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) { | 2497 | if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| 2468 | SFeatureSearchPreparation* pFeatureSearchPreparation = pCurLayer->pFeatureSearchPreparation; | 2498 | if (P_SLICE == pCtx->eSliceType) { |
| 2469 | if (pFeatureSearchPreparation) { | 2499 | //MD related func pointers |
| 2470 | pFeatureSearchPreparation->iHighFreMbCount = 0; | 2500 | pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen; |
| 2471 | 2501 | ||
| 2472 | if (P_SLICE == pCtx->eSliceType) { | 2502 | //ME related func pointers |
| 2473 | //MD related func pointers | 2503 | //ME16x16 |
| 2474 | pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen; | 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; | ||
| 2475 | 2511 | ||
| 2476 | //calculate bFMESwitchFlag | 2512 | //calculate bFMESwitchFlag |
| 2477 | SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa); | 2513 | SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa); |
| @@ -2491,8 +2527,11 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 13 unmodified lines | |||
| 2491 | } | 2527 | } |
| 2492 | 2528 | ||
| 2493 | //assign ME pointer | 2529 | //assign ME pointer |
| 2494 | if (pScreenBlockFeatureStorage->bRefBlockFeatureCalculated) { | 2530 | if (pFeatureSearchPreparation->bFMESwitchFlag && pScreenBlockFeatureStorage->bRefBlockFeatureCalculated |
| 2495 | //TBC int32_t iIs16x16 = pScreenBlockFeatureStorage->iIs16x16; | 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 | } | ||
| 2496 | } | 2535 | } |
| 2497 | 2536 | ||
| 2498 | //assign UpdateFMESwitch pointer | 2537 | //assign UpdateFMESwitch pointer |
| @@ -2501,11 +2540,11 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 2 unmodified lines | |||
| 2501 | } else { | 2540 | } else { |
| 2502 | pFuncList->pfUpdateFMESwitch = UpdateFMESwitchNull; | 2541 | pFuncList->pfUpdateFMESwitch = UpdateFMESwitchNull; |
| 2503 | } | 2542 | } |
| 2504 | } else { | 2543 | }//if (pFeatureSearchPreparation) |
| 2505 | //reset some status when at I_SLICE | 2544 | } else { |
| 2506 | pFeatureSearchPreparation->bFMESwitchFlag = true; | 2545 | //reset some status when at I_SLICE |
| 2507 | pFeatureSearchPreparation->uiFMEGoodFrameCount = FMESWITCH_DEFAULT_GOODFRAME_NUM; | 2546 | pCurLayer->pFeatureSearchPreparation->bFMESwitchFlag = true; |
| 2508 | } | 2547 | pCurLayer->pFeatureSearchPreparation->uiFMEGoodFrameCount = FMESWITCH_DEFAULT_GOODFRAME_NUM; |
| 2509 | } | 2548 | } |
| 2510 | } | 2549 | } |
| 2511 | } | 2550 | } |