Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2445,77 +2445,50 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 2444 unmodified lines | |||
| 2445 | } | 2445 | } |
| 2446 | } | 2446 | } |
| 2447 | 2447 | ||
| 2448 | inline void SetFastCodingFunc(SWelsFuncPtrList* pFuncList) | ||
| 2449 | { | ||
| 2450 | pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; | ||
| 2451 | pFuncList->sSampleDealingFuncs.pfMdCost = pFuncList->sSampleDealingFuncs.pfSampleSad; | ||
| 2452 | pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad; | ||
| 2453 | pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Sad; | ||
| 2454 | } | ||
| 2455 | inline void SetNormalCodingFunc(SWelsFuncPtrList* pFuncList) | ||
| 2456 | { | ||
| 2457 | pFuncList->pfIntraFineMd = WelsMdIntraFinePartition; | ||
| 2458 | pFuncList->sSampleDealingFuncs.pfMdCost = pFuncList->sSampleDealingFuncs.pfSampleSatd; | ||
| 2459 | pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | ||
| 2460 | pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Satd; | ||
| 2461 | pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = | ||
| 2462 | pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Satd; | ||
| 2463 | pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 = | ||
| 2464 | pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd; | ||
| 2465 | } | ||
| 2466 | |||
| 2467 | |||
| 2448 | void PreprocessSliceCoding (sWelsEncCtx* pCtx) { | 2468 | void PreprocessSliceCoding (sWelsEncCtx* pCtx) { |
| 2449 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; | 2469 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 2450 | const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag; | 2470 | const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag; |
| 2471 | const bool kbHighestSpatialLayer = | ||
| 2472 | (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)); | ||
| 2473 | SWelsFuncPtrList* pFuncList = pCtx->pFuncList; | ||
| 2451 | 2474 | ||
| 2452 | /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */ | 2475 | /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */ |
| 2476 | if (kbHighestSpatialLayer) { | ||
| 2477 | SetFastCodingFunc(pFuncList); | ||
| 2478 | } else { | ||
| 2479 | SetNormalCodingFunc(pFuncList); | ||
| 2480 | } | ||
| 2453 | 2481 | ||
| 2454 | if (P_SLICE == pCtx->eSliceType) { | 2482 | if (P_SLICE == pCtx->eSliceType) { |
| 2455 | if (kbBaseAvail) { | 2483 | pFuncList->pfMotionSearch = WelsMotionEstimateSearch; |
| 2456 | if (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)) { // | 2484 | pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; |
| 2457 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearch; | 2485 | pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; |
| 2458 | pCtx->pFuncList->pfCalculateSatd = NotCalculateSatdCost; | 2486 | if (kbHighestSpatialLayer) { |
| 2459 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; | 2487 | pFuncList->pfCalculateSatd = NotCalculateSatdCost; |
| 2460 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; | 2488 | pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa; |
| 2461 | pCtx->pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa; | ||
| 2462 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Sad; | ||
| 2463 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | ||
| 2464 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad; | ||
| 2465 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad; | ||
| 2466 | } else { | ||
| 2467 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearch; | ||
| 2468 | pCtx->pFuncList->pfCalculateSatd = CalculateSatdCost; | ||
| 2469 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; | ||
| 2470 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartition; | ||
| 2471 | pCtx->pFuncList->pfInterFineMd = WelsMdInterFinePartition; | ||
| 2472 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | ||
| 2473 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | ||
| 2474 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Satd; | ||
| 2475 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Satd; | ||
| 2476 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd; | ||
| 2477 | } | ||
| 2478 | pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | ||
| 2479 | } else { | ||
| 2480 | //case 3: pBase layer MD + encoding | ||
| 2481 | if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iSpatialLayerNum) { | ||
| 2482 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearch; | ||
| 2483 | pCtx->pFuncList->pfCalculateSatd = NotCalculateSatdCost; | ||
| 2484 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; | ||
| 2485 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; | ||
| 2486 | pCtx->pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa; | ||
| 2487 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad; | ||
| 2488 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | ||
| 2489 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad; | ||
| 2490 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Sad; | ||
| 2491 | } else { | ||
| 2492 | pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearch; | ||
| 2493 | pCtx->pFuncList->pfCalculateSatd = CalculateSatdCost; | ||
| 2494 | pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; | ||
| 2495 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartition; | ||
| 2496 | pCtx->pFuncList->pfInterFineMd = WelsMdInterFinePartition; | ||
| 2497 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | ||
| 2498 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | ||
| 2499 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Satd; | ||
| 2500 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Satd; | ||
| 2501 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd; | ||
| 2502 | } | ||
| 2503 | pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | ||
| 2504 | } | ||
| 2505 | } else if (I_SLICE == pCtx->eSliceType) { | ||
| 2506 | if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iSpatialLayerNum) { | ||
| 2507 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad; | ||
| 2508 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | ||
| 2509 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad; | ||
| 2510 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Sad; | ||
| 2511 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa; | ||
| 2512 | } else { | 2489 | } else { |
| 2513 | pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; | 2490 | pFuncList->pfCalculateSatd = CalculateSatdCost; |
| 2514 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 = | 2491 | pFuncList->pfInterFineMd = WelsMdInterFinePartition; |
| 2515 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Satd; | ||
| 2516 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra8x8Combined3Satd; | ||
| 2517 | pCtx->pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3 = pCtx->pFuncList->sSampleDealingFuncs.pfIntra4x4Combined3Satd; | ||
| 2518 | pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartition; | ||
| 2519 | } | 2492 | } |
| 2520 | } | 2493 | } |
| 2521 | } | 2494 | } |