Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 8 files). Show all
Unified · Split
| @@ -85,7 +85,7 @@ void UpdateMbListNeighborParallel (SDqLayer* pCurDq, · 84 unmodified lines | ||
| 85 | 85 | const uint16_t* kpMbMap = pSliceCtx->pOverallMbMap; |
| 86 | 86 | const int32_t kiMbWidth = pSliceCtx->iMbWidth; |
| 87 | 87 | int32_t iIdx = pUpdateSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; |
| 88 | − const int32_t kiEndMbInSlice = iIdx + pSliceCtx->pCountMbNumInSlice[uiSliceIdc] - 1; | |
| 88 | + const int32_t kiEndMbInSlice = iIdx + pUpdateSlice->iCountMbNumInSlice - 1; | |
| 89 | 89 | |
| 90 | 90 | do { |
| 91 | 91 | SMB* pMb = &pMbList[iIdx]; |
| @@ -132,7 +132,6 @@ void CalcSliceComplexRatio (SDqLayer* pCurDq) { · 40 unmodified lines | ||
| 132 | 132 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 133 | 133 | SSlice* pSliceInLayer = pCurDq->sLayerInfo.pSliceInLayer; |
| 134 | 134 | int32_t iSumAv = 0; |
| 135 | − int32_t* pCountMbInSlice = (int32_t*)pSliceCtx->pCountMbNumInSlice; | |
| 136 | 135 | const int32_t kiSliceCount = pSliceCtx->iSliceNumInFrame; |
| 137 | 136 | int32_t iSliceIdx = 0; |
| 138 | 137 | int32_t iAvI[MAX_SLICES_NUM]; |
| @@ -140,10 +139,11 @@ void CalcSliceComplexRatio (SDqLayer* pCurDq) { · 1 unmodified line | ||
| 140 | 139 | WelsEmms(); |
| 141 | 140 | |
| 142 | 141 | while (iSliceIdx < kiSliceCount) { |
| 143 | − iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * pCountMbInSlice[iSliceIdx], pSliceInLayer[iSliceIdx].uiSliceConsumeTime); | |
| 142 | + iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * pSliceInLayer[iSliceIdx].iCountMbNumInSlice, | |
| 143 | + pSliceInLayer[iSliceIdx].uiSliceConsumeTime); | |
| 144 | 144 | MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), uiSliceConsumeTime[%d]= %d us, slice_run= %d", |
| 145 | 145 | iSliceIdx, |
| 146 | − pSliceInLayer[iSliceIdx].uiSliceConsumeTime, pCountMbInSlice[iSliceIdx]); | |
| 146 | + pSliceInLayer[iSliceIdx].uiSliceConsumeTime, pSliceInLayer[iSliceIdx].iCountMbNumInSlice); | |
| 147 | 147 | iSumAv += iAvI[iSliceIdx]; |
| 148 | 148 | |
| 149 | 149 | ++ iSliceIdx; |
| @@ -271,7 +271,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 121 unmodified lines | ||
| 271 | 271 | MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, |
| 272 | 272 | "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 273 | 273 | iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY, |
| 274 | − pSliceCtx->pCountMbNumInSlice[iSliceIdx], | |
| 274 | + pSliceInLayer[iSliceIdx].iCountMbNumInSlice, | |
| 275 | 275 | iNumMbAssigning); |
| 276 | 276 | ++ iSliceIdx; |
| 277 | 277 | iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts |
| @@ -280,8 +280,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 2 unmodified lines | ||
| 280 | 280 | MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, |
| 281 | 281 | "[MT] DynamicAdjustSlicing(), iSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 282 | 282 | iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY, |
| 283 | − pSliceCtx->pCountMbNumInSlice[iSliceIdx], iMbNumLeft); | |
| 284 | − | |
| 283 | + pSliceInLayer[iSliceIdx].iCountMbNumInSlice, iMbNumLeft); | |
| 285 | 284 | |
| 286 | 285 | if (DynamicAdjustSlicePEncCtxAll (pCurDqLayer, iRunLen) == 0) { |
| 287 | 286 | const int32_t kiThreadNum = pCtx->pSvcParam->iCountThreadsNum; |
| @@ -367,7 +366,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 79 unmodified lines | ||
| 367 | 366 | iIdx = 0; |
| 368 | 367 | while (iIdx < iNumSpatialLayers) { |
| 369 | 368 | SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[iIdx].sSliceArgument; |
| 370 | − if (pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE || pSliceArgument->uiSliceMode == SM_RASTER_SLICE) { | |
| 369 | + if (pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE || pSliceArgument->uiSliceMode == SM_RASTER_SLICE) { | |
| 371 | 370 | bWillUseTaskManage = true; |
| 372 | 371 | } |
| 373 | 372 | ++ iIdx; |
| @@ -789,7 +788,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 415 unmodified lines | ||
| 789 | 788 | pEncPEncCtx->iCodingIndex, iSliceIdx, |
| 790 | 789 | pEncPEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].uiSliceConsumeTime, iSliceSize, |
| 791 | 790 | pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, |
| 792 | − pCurDq->sSliceEncCtx.pCountMbNumInSlice[iSliceIdx]); | |
| 791 | + pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].iCountMbNumInSlice); | |
| 793 | 792 | } |
| 794 | 793 | |
| 795 | 794 | #if defined(SLICE_INFO_OUTPUT) |
| @@ -898,7 +897,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 102 unmodified lines | ||
| 898 | 897 | |
| 899 | 898 | MT_TRACE_LOG (pEncPEncCtx, WELS_LOG_INFO, |
| 900 | 899 | "[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, uiSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n", |
| 901 | − pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize, pCurDq->sSliceEncCtx.pCountMbNumInSlice[iSliceIdx], | |
| 900 | + pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize, | |
| 901 | + pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].iCountMbNumInSlice, | |
| 902 | 902 | kiEndMbInPartition, kiPartitionId, pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); |
| 903 | 903 | |
| 904 | 904 | iAnyMbLeftInPartition = kiEndMbInPartition - (1 + pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); |