MCPcopy Create free account
hub / github.com/cisco/openh264 / PreprocessSliceCoding

Function PreprocessSliceCoding

codec/encoder/core/src/encoder_ext.cpp:2658–2784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2656
2657
2658void PreprocessSliceCoding (sWelsEncCtx* pCtx) {
2659 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
2660 //const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag;
2661 bool bFastMode = (pCtx->pSvcParam->iComplexityMode == LOW_COMPLEXITY);
2662 SWelsFuncPtrList* pFuncList = pCtx->pFuncList;
2663 SLogContext* pLogCtx = & (pCtx->sLogCtx);
2664 /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */
2665 if ((pCtx->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME && bFastMode) ||
2666 (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME && P_SLICE == pCtx->eSliceType
2667 && bFastMode) //TODO: here is for sync with the origin code, consider the design again with more tests
2668 ) {
2669 SetFastCodingFunc (pFuncList);
2670 } else {
2671 SetNormalCodingFunc (pFuncList);
2672 }
2673
2674 if (P_SLICE == pCtx->eSliceType) {
2675 for (int i = 0; i < BLOCK_STATIC_IDC_ALL; i++) {
2676 pFuncList->pfMotionSearch[i] = WelsMotionEstimateSearch;
2677 }
2678 pFuncList->pfSearchMethod[BLOCK_16x16] =
2679 pFuncList->pfSearchMethod[BLOCK_16x8] =
2680 pFuncList->pfSearchMethod[BLOCK_8x16] =
2681 pFuncList->pfSearchMethod[BLOCK_8x8] =
2682 pFuncList->pfSearchMethod[BLOCK_4x4] =
2683 pFuncList->pfSearchMethod[BLOCK_8x4] =
2684 pFuncList->pfSearchMethod[BLOCK_4x8] = WelsDiamondSearch;
2685 pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;
2686 pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;
2687 pFuncList->pfSetScrollingMv = SetScrollingMvToMdNull;
2688
2689 if (bFastMode) {
2690 pFuncList->pfCalculateSatd = NotCalculateSatdCost;
2691 pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa;
2692 } else {
2693 pFuncList->pfCalculateSatd = CalculateSatdCost;
2694 pFuncList->pfInterFineMd = WelsMdInterFinePartition;
2695 }
2696 } else {
2697 pFuncList->sSampleDealingFuncs.pfMeCost = NULL;
2698 }
2699
2700 //to init at each frame will be needed when dealing with hybrid content (camera+screen)
2701 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
2702 if (P_SLICE == pCtx->eSliceType) {
2703 //MD related func pointers
2704 pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen;
2705
2706 //ME related func pointers
2707 SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa);
2708 if (pVaaExt->sScrollDetectInfo.bScrollDetectFlag
2709 && (pVaaExt->sScrollDetectInfo.iScrollMvX | pVaaExt->sScrollDetectInfo.iScrollMvY)) {
2710 pFuncList->pfSetScrollingMv = SetScrollingMvToMd;
2711 } else {
2712 pFuncList->pfSetScrollingMv = SetScrollingMvToMdNull;
2713 }
2714
2715 pFuncList->pfMotionSearch[NO_STATIC] = WelsMotionEstimateSearch;

Callers 1

WelsEncoderEncodeExtFunction · 0.85

Calls 5

SetFastCodingFuncFunction · 0.85
SetNormalCodingFuncFunction · 0.85
SetMeMethodFunction · 0.85
WelsLogFunction · 0.85
CalcFMESwitchFlagFunction · 0.85

Tested by

no test coverage detected