Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 4 files). Show all
Unified · Split
| @@ -1186,7 +1186,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 1185 unmodified lines | ||
| 1186 | 1186 | |
| 1187 | 1187 | // for dynamic slicing mode |
| 1188 | 1188 | if (SM_SIZELIMITED_SLICE == pDlayer->sSliceArgument.uiSliceMode) { |
| 1189 | − const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t); | |
| 1189 | + const int32_t iSize = pParam->iMultipleThreadIdc * sizeof (int32_t); | |
| 1190 | 1190 | |
| 1191 | 1191 | pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition"); |
| 1192 | 1192 | pDqLayer->pLastCodedMbIdxOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pLastCodedMbIdxOfPartition"); |
| @@ -2291,8 +2291,7 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar · 1098 unmodified lines | ||
| 2291 | 2291 | ++ iSpatialIdx; |
| 2292 | 2292 | } while (iSpatialIdx < iSpatialNum); |
| 2293 | 2293 | |
| 2294 | − pCodingParam->iCountThreadsNum = WELS_MIN (kiCpuCores, iMaxSliceCount); | |
| 2295 | − pCodingParam->iMultipleThreadIdc = pCodingParam->iCountThreadsNum; | |
| 2294 | + pCodingParam->iMultipleThreadIdc = WELS_MIN (kiCpuCores, iMaxSliceCount); | |
| 2296 | 2295 | if (pCodingParam->iLoopFilterDisableIdc == 0 |
| 2297 | 2296 | && pCodingParam->iMultipleThreadIdc != 1) // Loop filter requested to be enabled, with threading enabled |
| 2298 | 2297 | pCodingParam->iLoopFilterDisableIdc = |
| @@ -2454,7 +2453,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 155 unmodified lines | ||
| 2454 | 2453 | } |
| 2455 | 2454 | InitFunctionPointers (pCtx, pCtx->pSvcParam, uiCpuFeatureFlags); |
| 2456 | 2455 | |
| 2457 | − pCtx->iActiveThreadsNum = pCodingParam->iCountThreadsNum; | |
| 2456 | + pCtx->iActiveThreadsNum = pCodingParam->iMultipleThreadIdc; | |
| 2458 | 2457 | pCtx->iMaxSliceCount = iSliceNum; |
| 2459 | 2458 | iRet = RequestMemorySvc (&pCtx, pExistingParasetList); |
| 2460 | 2459 | if (iRet != 0) { |
| @@ -2593,15 +2592,15 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 132 unmodified lines | ||
| 2593 | 2592 | return; |
| 2594 | 2593 | |
| 2595 | 2594 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, |
| 2596 | − "WelsUninitEncoderExt(), pCtx= %p, iThreadCount= %d, iMultipleThreadIdc= %d.", | |
| 2597 | − (void*) (*ppCtx), (*ppCtx)->pSvcParam->iCountThreadsNum, (*ppCtx)->pSvcParam->iMultipleThreadIdc); | |
| 2595 | + "WelsUninitEncoderExt(), pCtx= %p, iMultipleThreadIdc= %d.", | |
| 2596 | + (void*) (*ppCtx), (*ppCtx)->pSvcParam->iMultipleThreadIdc); | |
| 2598 | 2597 | |
| 2599 | 2598 | #if defined(STAT_OUTPUT) |
| 2600 | 2599 | StatOverallEncodingExt (*ppCtx); |
| 2601 | 2600 | #endif |
| 2602 | 2601 | |
| 2603 | 2602 | if ((*ppCtx)->pSvcParam->iMultipleThreadIdc > 1 && (*ppCtx)->pSliceThreading != NULL) { |
| 2604 | − const int32_t iThreadCount = (*ppCtx)->pSvcParam->iCountThreadsNum; | |
| 2603 | + const int32_t iThreadCount = (*ppCtx)->pSvcParam->iMultipleThreadIdc; | |
| 2605 | 2604 | int32_t iThreadIdx = 0; |
| 2606 | 2605 | |
| 2607 | 2606 | while (iThreadIdx < iThreadCount) { |
| @@ -2656,7 +2655,7 @@ void DynslcUpdateMbNeighbourInfoListForAllSlices (SDqLayer* pCurDq, SMB* pMbList · 48 unmodified lines | ||
| 2656 | 2655 | int32_t PicPartitionNumDecision (sWelsEncCtx* pCtx) { |
| 2657 | 2656 | int32_t iPartitionNum = 1; |
| 2658 | 2657 | if (pCtx->pSvcParam->iMultipleThreadIdc > 1) { |
| 2659 | − iPartitionNum = pCtx->pSvcParam->iCountThreadsNum; | |
| 2658 | + iPartitionNum = pCtx->pSvcParam->iMultipleThreadIdc; | |
| 2660 | 2659 | } |
| 2661 | 2660 | return iPartitionNum; |
| 2662 | 2661 | } |
| @@ -3964,7 +3963,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1301 unmodified lines | ||
| 3964 | 3963 | } |
| 3965 | 3964 | // THREAD_FULLY_FIRE_MODE && SM_SIZELIMITED_SLICE |
| 3966 | 3965 | else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |
| 3967 | − const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum; | |
| 3966 | + const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; | |
| 3968 | 3967 | |
| 3969 | 3968 | #if 0 //TODO: temporarily use this to keep old codes for a while, will remove old codes later |
| 3970 | 3969 | int32_t iRet = 0; |
| @@ -3975,8 +3974,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 4 unmodified lines | ||
| 3975 | 3974 | pFbi, kiPartitionCnt, &pCtx->pCurDqLayer->sSliceEncCtx, true); |
| 3976 | 3975 | if (iRet) { |
| 3977 | 3976 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| 3978 | − "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!", | |
| 3979 | − iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceArgument.uiSliceMode, pSvcParam->iMultipleThreadIdc); | |
| 3977 | + "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!", | |
| 3978 | + iRet, iSliceCount, pParam->sSliceArgument.uiSliceMode, pSvcParam->iMultipleThreadIdc); | |
| 3980 | 3979 | return ENC_RETURN_UNEXPECTED; |
| 3981 | 3980 | } |
| 3982 | 3981 | |