ref: 406f89ec54916bea55eece61f9a0a63d00c5e2f5
parent: 2620f4bcfd9bdc382918679bdb2077fd05501156
parent: e8536c6b731a4daae2df206fa7b2825ebc5b3c1c
author: sijchen <sijchen@cisco.com>
date: Mon Dec 14 04:44:13 EST 2015
Merge pull request #2309 from shihuade/MultiThread_V4.4_ThreadSliceNum_V3_Pull remove iCountThreadsNum and unitfy with iMultipleThreadIdc
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -111,8 +111,6 @@
bool bDeblockingParallelFlag; // deblocking filter parallelization control flag
int32_t iBitsVaryPercentage;
- short
- iCountThreadsNum; // # derived from disable_multiple_slice_idc (=0 or >1) means;
int8_t iDecompStages; // GOP size dependency
int32_t iMaxNumRefFrame;
@@ -201,8 +199,6 @@
pCurPath = NULL; // record current lib path such as:/pData/pData/com.wels.enc/lib/
bDeblockingParallelFlag = false;// deblocking filter parallelization control flag
-
- iCountThreadsNum = 1; // # derived from disable_multiple_slice_idc (=0 or >1) means;
iDecompStages = 0; // GOP size dependency, unknown here and be revised later
iBitsVaryPercentage = 0;
--- a/codec/encoder/core/src/deblocking.cpp
+++ b/codec/encoder/core/src/deblocking.cpp
@@ -760,7 +760,7 @@
++ iSliceIdx;
} while (iSliceIdx < iSliceCount);
} else { // for dynamic slicing mode
- const int32_t kiNumPicPartition = pEnc->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
+ const int32_t kiNumPicPartition = pEnc->iActiveThreadsNum;
int32_t iPartitionIdx = 0;
while (iPartitionIdx < kiNumPicPartition) {
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -1186,7 +1186,7 @@
// for dynamic slicing mode
if (SM_SIZELIMITED_SLICE == pDlayer->sSliceArgument.uiSliceMode) {
- const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t);
+ const int32_t iSize = pParam->iMultipleThreadIdc * sizeof (int32_t);
pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition");
pDqLayer->pLastCodedMbIdxOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pLastCodedMbIdxOfPartition");
@@ -2291,8 +2291,7 @@
++ iSpatialIdx;
} while (iSpatialIdx < iSpatialNum);
- pCodingParam->iCountThreadsNum = WELS_MIN (kiCpuCores, iMaxSliceCount);
- pCodingParam->iMultipleThreadIdc = pCodingParam->iCountThreadsNum;
+ pCodingParam->iMultipleThreadIdc = WELS_MIN (kiCpuCores, iMaxSliceCount);
if (pCodingParam->iLoopFilterDisableIdc == 0
&& pCodingParam->iMultipleThreadIdc != 1) // Loop filter requested to be enabled, with threading enabled
pCodingParam->iLoopFilterDisableIdc =
@@ -2454,7 +2453,7 @@
}
InitFunctionPointers (pCtx, pCtx->pSvcParam, uiCpuFeatureFlags);
- pCtx->iActiveThreadsNum = pCodingParam->iCountThreadsNum;
+ pCtx->iActiveThreadsNum = pCodingParam->iMultipleThreadIdc;
pCtx->iMaxSliceCount = iSliceNum;
iRet = RequestMemorySvc (&pCtx, pExistingParasetList);
if (iRet != 0) {
@@ -2593,8 +2592,8 @@
return;
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO,
- "WelsUninitEncoderExt(), pCtx= %p, iThreadCount= %d, iMultipleThreadIdc= %d.",
- (void*) (*ppCtx), (*ppCtx)->pSvcParam->iCountThreadsNum, (*ppCtx)->pSvcParam->iMultipleThreadIdc);
+ "WelsUninitEncoderExt(), pCtx= %p, iMultipleThreadIdc= %d.",
+ (void*) (*ppCtx), (*ppCtx)->pSvcParam->iMultipleThreadIdc);
#if defined(STAT_OUTPUT)
StatOverallEncodingExt (*ppCtx);
@@ -2601,7 +2600,7 @@
#endif
if ((*ppCtx)->pSvcParam->iMultipleThreadIdc > 1 && (*ppCtx)->pSliceThreading != NULL) {
- const int32_t iThreadCount = (*ppCtx)->pSvcParam->iCountThreadsNum;
+ const int32_t iThreadCount = (*ppCtx)->pSvcParam->iMultipleThreadIdc;
int32_t iThreadIdx = 0;
while (iThreadIdx < iThreadCount) {
@@ -2656,7 +2655,7 @@
int32_t PicPartitionNumDecision (sWelsEncCtx* pCtx) {
int32_t iPartitionNum = 1;
if (pCtx->pSvcParam->iMultipleThreadIdc > 1) {
- iPartitionNum = pCtx->pSvcParam->iCountThreadsNum;
+ iPartitionNum = pCtx->pSvcParam->iMultipleThreadIdc;
}
return iPartitionNum;
}
@@ -3964,7 +3963,7 @@
}
// THREAD_FULLY_FIRE_MODE && SM_SIZELIMITED_SLICE
else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
- const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
+ const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum;
#if 0 //TODO: temporarily use this to keep old codes for a while, will remove old codes later
int32_t iRet = 0;
@@ -3975,8 +3974,8 @@
pFbi, kiPartitionCnt, &pCtx->pCurDqLayer->sSliceEncCtx, true);
if (iRet) {
WelsLog (pLogCtx, WELS_LOG_ERROR,
- "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
- iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceArgument.uiSliceMode, pSvcParam->iMultipleThreadIdc);
+ "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
+ iRet, iSliceCount, pParam->sSliceArgument.uiSliceMode, pSvcParam->iMultipleThreadIdc);
return ENC_RETURN_UNEXPECTED;
}
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -299,7 +299,7 @@
pMa = (*ppCtx)->pMemAlign;
pPara = pCodingParam;
iNumSpatialLayers = pPara->iSpatialLayerNum;
- iThreadNum = pPara->iCountThreadsNum;
+ iThreadNum = pPara->iMultipleThreadIdc;
iMaxSliceNum = (*ppCtx)->iMaxSliceCount;
pSmt = (SSliceThreading*)pMa->WelsMalloc (sizeof (SSliceThreading), "SSliceThreading");
@@ -406,8 +406,8 @@
iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError);
WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
- MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iCountSliceNum= %d",
- pPara->iCountThreadsNum,
+ MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iMultipleThreadIdc= %d",
+ pPara->iMultipleThreadIdc,
iMaxSliceNum);
return 0;
@@ -426,7 +426,7 @@
pMa = (*ppCtx)->pMemAlign;
uiSliceNum = (*ppCtx)->iMaxSliceCount;
- iThreadNum = (*ppCtx)->pSvcParam->iCountThreadsNum;
+ iThreadNum = (*ppCtx)->pSvcParam->iMultipleThreadIdc;
pSmt = (*ppCtx)->pSliceThreading;
if (NULL == pSmt)
@@ -880,7 +880,7 @@
}
int32_t CreateSliceThreads (sWelsEncCtx* pCtx) {
- const int32_t kiThreadCount = pCtx->pSvcParam->iCountThreadsNum;
+ const int32_t kiThreadCount = pCtx->pSvcParam->iMultipleThreadIdc;
int32_t iIdx = 0;
while (iIdx < kiThreadCount) {