ref: b8ba418ba80e23d70286ad046a7c736894de36b5
parent: 095f0b663ecc2aea22fdf4b1b66f1f7f57bcdc45
author: huade <huashi@cisco.com>
date: Sun Jan 8 18:02:19 EST 2017
Multi-thread-fixed:RBC#1752:change sSliceThreadInfo structure
--- a/codec/encoder/core/inc/svc_enc_frame.h
+++ b/codec/encoder/core/inc/svc_enc_frame.h
@@ -69,11 +69,10 @@
} SFeatureSearchPreparation; //maintain only one
typedef struct TagSliceThreadInfo {
-SSlice* pSliceInThread[MAX_THREADS_NUM];// slice buffer for multi thread,
- // pSliceInThread[0] for single thread
- // will not alloated when multi thread is off
-int32_t iMaxSliceNumInThread[MAX_THREADS_NUM];
-int32_t iEncodedSliceNumInThread[MAX_THREADS_NUM];
+SSlice* pSliceInThread;// slice buffer for multi thread,
+ // pSliceInThread[0] for single thread
+int32_t iMaxSliceNum;
+int32_t iCodedSliceNum;
}SSliceThreadInfo;
typedef struct TagLayerInfo {
@@ -85,7 +84,7 @@
/* Layer Representation */
struct TagDqLayer {
SLayerInfo sLayerInfo;
-SSliceThreadInfo sSliceThreadInfo;
+SSliceThreadInfo sSliceThreadInfo[MAX_THREADS_NUM];
SSlice** ppSliceInLayer;
SSliceCtx sSliceEncCtx; // current slice context
uint8_t* pCsData[3]; // pointer to reconstructed picture pData
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -925,8 +925,8 @@
void FreeSliceInLayer (SDqLayer* pDq, CMemoryAlign* pMa) {
int32_t iIdx = 0;
for (; iIdx < MAX_THREADS_NUM; iIdx ++) {
- FreeSliceBuffer (pDq->sSliceThreadInfo.pSliceInThread[iIdx],
- pDq->sSliceThreadInfo.iMaxSliceNumInThread[iIdx],
+ FreeSliceBuffer (pDq->sSliceThreadInfo[iIdx].pSliceInThread,
+ pDq->sSliceThreadInfo[iIdx].iMaxSliceNum,
pMa, "pSliceInThread");
}
}
@@ -3646,8 +3646,7 @@
if (SM_SINGLE_SLICE == pParam->sSliceArgument.uiSliceMode) { // only one slice within a sQualityStat layer
int32_t iSliceSize = 0;
int32_t iPayloadSize = 0;
- uint32_t uiTheadIdx = 0;
- SSlice* pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][0];
+ SSlice* pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo[0].pSliceInThread[0];
if (pCtx->bNeedPrefixNalFlag) {
pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType,
@@ -3833,7 +3832,7 @@
WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc);
- pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx];
+ pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo[uiTheadIdx].pSliceInThread[iSliceIdx];
assert (iSliceIdx == pCurSlice->iSliceIdx);
pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, iSliceIdx);
@@ -4481,7 +4480,7 @@
SDqLayer* pCurLayer = pCtx->pCurDqLayer;
uint32_t uiTheadIdx = 0;
- SSlice* pStartSlice = &pCurLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iStartSliceIdx];
+ SSlice* pStartSlice = &pCurLayer->sSliceThreadInfo[uiTheadIdx].pSliceInThread[iStartSliceIdx];
int32_t iNalIdxInLayer = *pNalIdxInLayer;
int32_t iSliceIdx = iStartSliceIdx;
const int32_t kiSliceStep = pCtx->iActiveThreadsNum;
@@ -4501,7 +4500,7 @@
int32_t iPayloadSize = 0;
SSlice* pCurSlice = NULL;
- if (iSliceIdx >= (pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[uiTheadIdx] - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
+ if (iSliceIdx >= (pCurLayer->sSliceThreadInfo[uiTheadIdx].iMaxSliceNum - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
if (pCtx->iActiveThreadsNum == 1) {
//only single thread support re-alloc now
if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {
@@ -4525,7 +4524,7 @@
}
WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc);
- pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx];
+ pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo[uiTheadIdx].pSliceInThread[iSliceIdx];
pCurSlice->iSliceIdx = iSliceIdx;
iReturn = WelsCodeOneSlice (pCtx, pCurSlice, keNalType);
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -563,6 +563,7 @@
pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, pTOverRc->iMinBitsTl, pTOverRc->iMaxBitsTl);
}
pWelsSvcRc->iRemainingWeights -= pTOverRc->iTlayerWeight;
+
}
void RcDecideTargetBitsTimestamp (sWelsEncCtx* pEncCtx) {
@@ -571,8 +572,8 @@
SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId];
int32_t iTl = pEncCtx->uiTemporalId;
SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl];
-
pWelsSvcRc->iCurrentBitsLevel = BITS_NORMAL;
+
if (pEncCtx->eSliceType == I_SLICE) {
int32_t iBufferTh = static_cast<int32_t> (pWelsSvcRc->iBufferSizeSkip - pWelsSvcRc->iBufferFullnessSkip);
if (iBufferTh <= 0) {
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -569,7 +569,7 @@
int64_t iSliceStart = 0;
bool bDsaFlag = false;
iSliceIdx = pPrivateData->iSliceIndex;
- pSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[iThreadIdx][iSliceIdx];
+ pSlice = &pCurDq->sSliceThreadInfo[iThreadIdx].pSliceInThread[iSliceIdx];
pSliceBs = &pSlice->sSliceBs;
bDsaFlag = ((pParamD->sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE) &&
@@ -675,7 +675,7 @@
int32_t iAnyMbLeftInPartition = kiEndMbIdxInPartition - kiFirstMbInPartition + 1;
SSpatialLayerInternal *pParamInternal = &pCodingParam->sDependencyLayers[kiCurDid];
iSliceIdx = pPrivateData->iSliceIndex;
- SSlice* pStartSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[iThreadIdx][iSliceIdx];
+ SSlice* pStartSlice = &pCurDq->sSliceThreadInfo[iThreadIdx].pSliceInThread[iSliceIdx];
pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = kiFirstMbInPartition;
while (iAnyMbLeftInPartition > 0) {
if (iSliceIdx >= pCurDq->iMaxSliceNum) {
@@ -690,7 +690,7 @@
pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent,
iEventIdx);
}
- pSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[iThreadIdx][iSliceIdx];
+ pSlice = &pCurDq->sSliceThreadInfo[iThreadIdx].pSliceInThread[iSliceIdx];
pSliceBs = &pSlice->sSliceBs;
pSliceBs->uiBsPos = 0;
pSliceBs->iNalIndex = 0;
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -994,7 +994,7 @@
}
for( ; iTheadIdx < pCtx->iActiveThreadsNum; iTheadIdx++ ) {
- pCurDqLayer->sSliceThreadInfo.iEncodedSliceNumInThread[iTheadIdx] = 0;
+ pCurDqLayer->sSliceThreadInfo[iTheadIdx].iCodedSliceNum = 0;
}
return ENC_RETURN_SUCCESS;
@@ -1006,11 +1006,11 @@
const int32_t kiDlayerIdx,
const int32_t kiSliceIdx) {
SDqLayer* pDqLayer = pCtx->pCurDqLayer;
- const int32_t kiCodedNumInThread = pDqLayer->sSliceThreadInfo.iEncodedSliceNumInThread[kiThreadIdx];
+ const int32_t kiCodedNumInThread = pDqLayer->sSliceThreadInfo[kiThreadIdx].iCodedSliceNum;
- assert(kiCodedNumInThread < pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[kiThreadIdx] -1 );
+ assert(kiCodedNumInThread < pDqLayer->sSliceThreadInfo[kiThreadIdx].iMaxSliceNum -1 );
- pSlice = &pDqLayer->sSliceThreadInfo.pSliceInThread [kiThreadIdx][kiCodedNumInThread];
+ pSlice = &pDqLayer->sSliceThreadInfo [kiThreadIdx].pSliceInThread[kiCodedNumInThread];
pSlice->iSliceIdx = kiSliceIdx;
pSlice->uiThreadIdx = kiThreadIdx;
@@ -1026,8 +1026,6 @@
SDqLayer* pDqLayer,
const int32_t kiDlayerIndex,
CMemoryAlign* pMa) {
-
- SSliceThreadInfo* pSliceThreadInfo = &pDqLayer->sSliceThreadInfo;
int32_t iThreadNum = pCtx->pSvcParam->iMultipleThreadIdc;
int32_t iMaxSliceNumInThread = 0;
int32_t iIdx = 0;
@@ -1036,10 +1034,10 @@
assert (iThreadNum > 0);
iMaxSliceNumInThread = pDqLayer->iMaxSliceNum;
while (iIdx < iThreadNum) {
- pSliceThreadInfo->iMaxSliceNumInThread[iIdx] = iMaxSliceNumInThread;
- pSliceThreadInfo->iEncodedSliceNumInThread[iIdx] = 0;
- pSliceThreadInfo->pSliceInThread[iIdx] = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNumInThread, "pSliceInThread");
- if (NULL == pSliceThreadInfo->pSliceInThread[iIdx]) {
+ pDqLayer->sSliceThreadInfo[iIdx].iMaxSliceNum = iMaxSliceNumInThread;
+ pDqLayer->sSliceThreadInfo[iIdx].iCodedSliceNum = 0;
+ pDqLayer->sSliceThreadInfo[iIdx].pSliceInThread = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNumInThread, "pSliceInThread");
+ if (NULL == pDqLayer->sSliceThreadInfo[iIdx].pSliceInThread) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
"CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceInThread[iIdx] is NULL");
return ENC_RETURN_MEMALLOCERR;
@@ -1046,7 +1044,7 @@
}
iRet = InitSliceList (pCtx,
pDqLayer,
- pSliceThreadInfo->pSliceInThread[iIdx],
+ pDqLayer->sSliceThreadInfo[iIdx].pSliceInThread,
iMaxSliceNumInThread,
kiDlayerIndex,
pMa);
@@ -1057,9 +1055,9 @@
}
for (; iIdx < MAX_THREADS_NUM; iIdx++) {
- pSliceThreadInfo->iMaxSliceNumInThread[iIdx] = 0;
- pSliceThreadInfo->iEncodedSliceNumInThread[iIdx] = 0;
- pSliceThreadInfo->pSliceInThread[iIdx] = NULL;
+ pDqLayer->sSliceThreadInfo[iIdx].iMaxSliceNum = 0;
+ pDqLayer->sSliceThreadInfo[iIdx].iCodedSliceNum = 0;
+ pDqLayer->sSliceThreadInfo[iIdx].pSliceInThread = NULL;
}
return ENC_RETURN_SUCCESS;
}
@@ -1084,7 +1082,7 @@
pDqLayer->iMaxSliceNum = 0;
for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
- pDqLayer->iMaxSliceNum += pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
+ pDqLayer->iMaxSliceNum += pDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
}
pDqLayer->ppSliceInLayer = (SSlice**)pMa->WelsMallocz (sizeof (SSlice*) * pDqLayer->iMaxSliceNum, "ppSliceInLayer");
@@ -1112,11 +1110,11 @@
iStartIdx = 0;
for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
- for (iSliceIdx = 0; iSliceIdx < pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx]; iSliceIdx++) {
- pDqLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pDqLayer->sSliceThreadInfo.pSliceInThread[iThreadIdx] + iSliceIdx;
+ for (iSliceIdx = 0; iSliceIdx < pDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum; iSliceIdx++ ) {
+ pDqLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pDqLayer->sSliceThreadInfo[iThreadIdx].pSliceInThread+ iSliceIdx;
}
- iStartIdx += pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
+ iStartIdx += pDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
}
return ENC_RETURN_SUCCESS;
@@ -1257,7 +1255,6 @@
pSliceList = pNewSliceList;
return ENC_RETURN_SUCCESS;
-
}
int32_t CalculateNewSliceNum (SDqLayer* pDqLayer,
@@ -1286,10 +1283,10 @@
const int32_t kiDlayerIdx,
const int32_t kiThreadIndex) {
- int32_t iMaxSliceNumInThread = pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[kiThreadIndex];
+ int32_t iMaxSliceNumInThread = pDqLayer->sSliceThreadInfo[kiThreadIndex].iMaxSliceNum;
int32_t iMaxSliceNumUpdate = 0;
int32_t iRet = 0;
- SSlice* pLastCodedSlice = pDqLayer->sSliceThreadInfo.pSliceInThread[kiThreadIndex] + (iMaxSliceNumInThread - 1);
+ SSlice* pLastCodedSlice = pDqLayer->sSliceThreadInfo[kiThreadIndex].pSliceInThread + (iMaxSliceNumInThread - 1);
SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIdx].sSliceArgument;
iRet = CalculateNewSliceNum (pDqLayer,
@@ -1303,7 +1300,7 @@
iRet = ReallocateSliceList (pCtx,
pSliceArgument,
- pDqLayer->sSliceThreadInfo.pSliceInThread[kiThreadIndex],
+ pDqLayer->sSliceThreadInfo[kiThreadIndex].pSliceInThread,
iMaxSliceNumInThread,
iMaxSliceNumUpdate);
if (ENC_RETURN_SUCCESS != iRet) {
@@ -1310,7 +1307,7 @@
return iRet;
}
- pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[kiThreadIndex] = iMaxSliceNumUpdate;
+ pDqLayer->sSliceThreadInfo[kiThreadIndex].iMaxSliceNum = iMaxSliceNumUpdate;
return ENC_RETURN_SUCCESS;
}
@@ -1361,7 +1358,7 @@
int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) {
SDqLayer* pCurLayer = pCtx->pCurDqLayer;
- int32_t iMaxSliceNumOld = pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0];
+ int32_t iMaxSliceNumOld = pCurLayer->sSliceThreadInfo[0].iMaxSliceNum;
int32_t iMaxSliceNumNew = 0;
int32_t iRet = 0;
int32_t iSliceIdx = 0;
@@ -1368,7 +1365,7 @@
int32_t iThreadIdx = 0;
int32_t iStartIdx = 0;
const int32_t kiCurDid = pCtx->uiDependencyId;
- SSlice* pLastCodedSlice = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + (iMaxSliceNumOld - 1);
+ SSlice* pLastCodedSlice = pCurLayer->sSliceThreadInfo[0].pSliceInThread + (iMaxSliceNumOld - 1);
SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument;
iRet = CalculateNewSliceNum (pCurLayer,
pLastCodedSlice,
@@ -1381,7 +1378,7 @@
iRet = ReallocateSliceList (pCtx,
pSliceArgument,
- pCurLayer->sSliceThreadInfo.pSliceInThread[0],
+ pCurLayer->sSliceThreadInfo[0].pSliceInThread,
iMaxSliceNumOld,
iMaxSliceNumNew);
if (ENC_RETURN_SUCCESS != iRet) {
@@ -1388,11 +1385,11 @@
return iRet;
}
- pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew;
+ pCurLayer->sSliceThreadInfo[0].iMaxSliceNum = iMaxSliceNumNew;
iMaxSliceNumNew = 0;
for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
- iMaxSliceNumNew += pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
+ iMaxSliceNumNew += pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
}
iRet = ExtendLayerBuffer(pCtx, pCurLayer->iMaxSliceNum, iMaxSliceNumNew);
@@ -1401,10 +1398,10 @@
}
for(iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++ ) {
- for (iSliceIdx = 0; iSliceIdx < pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx]; iSliceIdx++) {
- pCurLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pCurLayer->sSliceThreadInfo.pSliceInThread[iThreadIdx] + iSliceIdx;
+ for (iSliceIdx = 0; iSliceIdx < pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum; iSliceIdx++) {
+ pCurLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pCurLayer->sSliceThreadInfo[iThreadIdx].pSliceInThread + iSliceIdx;
}
- iStartIdx += pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
+ iStartIdx += pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
}
pCurLayer->iMaxSliceNum = iMaxSliceNumNew;
@@ -1463,10 +1460,10 @@
//before encode all slices in layer, slices' index are init with -1
//pSliceInThread->iSliceIdx will be set to actual slice index when encode one slice
for (iThreadIdx = 0; iThreadIdx < kiThreadNum; iThreadIdx++) {
- iSliceNumInThread = pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
+ iSliceNumInThread = pCurLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
for(iSliceIdx =0; iSliceIdx < iSliceNumInThread; iSliceIdx++) {
- pSliceInThread = pCurLayer->sSliceThreadInfo.pSliceInThread[iThreadIdx] + iSliceIdx;
+ pSliceInThread = pCurLayer->sSliceThreadInfo[iThreadIdx].pSliceInThread + iSliceIdx;
if (NULL == pSliceInThread) {
return ENC_RETURN_UNEXPECTED;
}
@@ -1568,7 +1565,7 @@
int32_t iRet = 0;
for ( int32_t iThreadIdx = 0; iThreadIdx < pCtx->iActiveThreadsNum; iThreadIdx++) {
- iMaxSliceNum += pCtx->pCurDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
+ iMaxSliceNum += pCtx->pCurDqLayer->sSliceThreadInfo[iThreadIdx].iMaxSliceNum;
}
//reallocate ppSliceInLayer if total encoded slice num exceed max slice num
@@ -1661,8 +1658,8 @@
void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
int32_t iFirstMbIdxOfNextSlice, const int32_t kiLastMbIdxInPartition) {
SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
- SSlice* pSliceInThread = pCurLayer->sSliceThreadInfo.pSliceInThread[pCurSlice->uiThreadIdx];
- int32_t iCodedSliceNum = pCurLayer->sSliceThreadInfo.iEncodedSliceNumInThread[pCurSlice->uiThreadIdx];
+ SSlice* pSliceInThread = pCurLayer->sSliceThreadInfo[pCurSlice->uiThreadIdx].pSliceInThread;
+ int32_t iCodedSliceNum = pCurLayer->sSliceThreadInfo[pCurSlice->uiThreadIdx].iCodedSliceNum;
int32_t iCurMbIdx = pCurMb->iMbXY;
uint16_t iCurSliceIdc = pSliceCtx->pOverallMbMap[ iCurMbIdx ];
const int32_t kiSliceIdxStep = pEncCtx->iActiveThreadsNum;
@@ -1708,7 +1705,7 @@
const int32_t kiActiveThreadsNum = pEncCtx->iActiveThreadsNum;
const int32_t kiPartitaionId = pCurSlice->iSliceIdx % kiActiveThreadsNum;
const int32_t kiEndMbIdxOfPartition = pEncCtx->pCurDqLayer->EndMbIdxOfPartition[kiPartitaionId];
- const int32_t kiMaxSliceNum = pEncCtx->pCurDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[pCurSlice->uiThreadIdx];
+ const int32_t kiMaxSliceNum = pEncCtx->pCurDqLayer->sSliceThreadInfo[pCurSlice->uiThreadIdx].iMaxSliceNum;
const bool kbCurMbNotFirstMbOfCurSlice = ((iCurMbIdx > 0) && (pSliceCtx->pOverallMbMap[iCurMbIdx] ==
pSliceCtx->pOverallMbMap[iCurMbIdx - 1]));
const bool kbCurMbNotLastMbOfCurPartition = iCurMbIdx < kiEndMbIdxOfPartition;
--- a/codec/encoder/core/src/wels_task_encoder.cpp
+++ b/codec/encoder/core/src/wels_task_encoder.cpp
@@ -195,7 +195,7 @@
#if MT_DEBUG_BS_WR
m_pSliceBs->bSliceCodedFlag = true;
#endif//MT_DEBUG_BS_WR
- m_pCtx->pCurDqLayer->sSliceThreadInfo.iEncodedSliceNumInThread[m_iThreadIdx] ++;
+ m_pCtx->pCurDqLayer->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum ++;
return ENC_RETURN_SUCCESS;
}
@@ -240,8 +240,8 @@
const int32_t kiPartitionId = m_iSliceIdx % kiSliceIdxStep;
const int32_t kiFirstMbInPartition = pCurDq->FirstMbIdxOfPartition[kiPartitionId];
const int32_t kiEndMbIdxInPartition = pCurDq->EndMbIdxOfPartition[kiPartitionId];
- const int32_t kiCodedSliceNumByThread = pCurDq->sSliceThreadInfo.iEncodedSliceNumInThread[m_iThreadIdx];
- m_pSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[m_iThreadIdx][kiCodedSliceNumByThread];
+ const int32_t kiCodedSliceNumByThread = pCurDq->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum;
+ m_pSlice = &pCurDq->sSliceThreadInfo[m_iThreadIdx].pSliceInThread[kiCodedSliceNumByThread];
m_pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = kiFirstMbInPartition;
int32_t iReturn = 0;
bool bNeedReallocate = false;
@@ -256,8 +256,8 @@
int32_t iAnyMbLeftInPartition = iDiffMbIdx + 1;
int32_t iLocalSliceIdx = m_iSliceIdx;
while (iAnyMbLeftInPartition > 0) {
- bNeedReallocate = (pCurDq->sSliceThreadInfo.iEncodedSliceNumInThread[m_iThreadIdx]
- >= pCurDq->sSliceThreadInfo.iMaxSliceNumInThread[m_iThreadIdx] -1) ? true : false;
+ bNeedReallocate = (pCurDq->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum
+ >= pCurDq->sSliceThreadInfo[m_iThreadIdx].iMaxSliceNum -1) ? true : false;
if (bNeedReallocate) {
WelsMutexLock (&m_pCtx->pSliceThreading->mutexThreadSlcBuffReallocate);
//for memory statistic variable
@@ -302,7 +302,6 @@
iLocalSliceIdx, m_pSliceBs->uiSize, m_iSliceSize, m_pSliceBs->sNalList[0].iPayloadSize);
return iReturn;
}
-
m_pCtx->pFuncList->pfDeblocking.pfDeblockingFilterSlice (pCurDq, m_pCtx->pFuncList, m_pSlice);
WelsLog (&m_pCtx->sLogCtx, WELS_LOG_DETAIL,
@@ -320,8 +319,7 @@
iAnyMbLeftInPartition = kiEndMbIdxInPartition - pCurDq->LastCodedMbIdxOfPartition[kiPartitionId];
iLocalSliceIdx += kiSliceIdxStep;
- m_pCtx->pCurDqLayer->sSliceThreadInfo.iEncodedSliceNumInThread[m_iThreadIdx] ++;
-
+ m_pCtx->pCurDqLayer->sSliceThreadInfo[m_iThreadIdx].iCodedSliceNum ++;
}
return ENC_RETURN_SUCCESS;