Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 26 files). Show all
Unified · Split
| @@ -360,11 +360,12 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 359 unmodified lines | ||
| 360 | 360 | |
| 361 | 361 | iIdx = 0; |
| 362 | 362 | while (iIdx < iNumSpatialLayers) { |
| 363 | − SSliceConfig* pMso = &pPara->sSpatialLayers[iIdx].sSliceCfg; | |
| 364 | − const int32_t kiSliceNum = pMso->sSliceArgument.uiSliceNum; | |
| 365 | − if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE)) | |
| 366 | − && pPara->iMultipleThreadIdc > 1 | |
| 367 | − && pPara->iMultipleThreadIdc >= kiSliceNum) { | |
| 363 | + SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[iIdx].sSliceArgument; | |
| 364 | + const int32_t kiSliceNum = pSliceArgument->uiSliceNum; | |
| 365 | + if ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) | |
| 366 | + && (pPara->bUseLoadBalancing) | |
| 367 | + && (pPara->iMultipleThreadIdc > 1) | |
| 368 | + && (pPara->iMultipleThreadIdc >= kiSliceNum)) { | |
| 368 | 369 | pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]"); |
| 369 | 370 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceConsumeTime[iIdx]), FreeMemorySvc (ppCtx)) |
| 370 | 371 | pSmt->pSliceComplexRatio[iIdx] = (int32_t*)pMa->WelsMalloc (kiSliceNum * sizeof (int32_t), "pSliceComplexRatio[]"); |
| @@ -374,8 +375,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 3 unmodified lines | ||
| 374 | 375 | pSmt->pSliceComplexRatio[iIdx] = NULL; |
| 375 | 376 | } |
| 376 | 377 | |
| 377 | − if ( pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE || pMso->uiSliceMode == SM_RASTER_SLICE | |
| 378 | − || pMso->uiSliceMode == SM_ROWMB_SLICE || pMso->uiSliceMode == SM_AUTO_SLICE) { | |
| 378 | + if ( pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE || pSliceArgument->uiSliceMode == SM_RASTER_SLICE) { | |
| 379 | 379 | bWillUseTaskManage = true; |
| 380 | 380 | } |
| 381 | 381 | ++ iIdx; |
| @@ -576,7 +576,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 194 unmodified lines | ||
| 576 | 576 | SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam; |
| 577 | 577 | SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[pCtx->uiDependencyId]; |
| 578 | 578 | SWelsSliceBs* pSliceBs = NULL; |
| 579 | − const bool kbIsDynamicSlicingMode = (pDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE); | |
| 579 | + const bool kbIsDynamicSlicingMode = (pDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE); | |
| 580 | 580 | |
| 581 | 581 | int32_t iLayerSize = 0; |
| 582 | 582 | int32_t iNalIdxBase = pLbi->iNalCount; |
| @@ -613,7 +613,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 30 unmodified lines | ||
| 613 | 613 | ++ iSliceIdx; |
| 614 | 614 | ++ pSliceBs; |
| 615 | 615 | } |
| 616 | − } else { // for SM_DYN_SLICE | |
| 616 | + } else { // for SM_SIZELIMITED_SLICE | |
| 617 | 617 | const int32_t kiPartitionCnt = iSliceCount; |
| 618 | 618 | int32_t iPartitionIdx = 0; |
| 619 | 619 | |
| @@ -744,17 +744,16 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 124 unmodified lines | ||
| 744 | 744 | eNalRefIdc = pEncPEncCtx->eNalPriority; |
| 745 | 745 | bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag; |
| 746 | 746 | |
| 747 | − if (pParamD->sSliceCfg.uiSliceMode != SM_DYN_SLICE) { | |
| 747 | + if (pParamD->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE) { | |
| 748 | 748 | int64_t iSliceStart = 0; |
| 749 | 749 | bool bDsaFlag = false; |
| 750 | 750 | iSliceIdx = pPrivateData->iSliceIndex; |
| 751 | 751 | pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx]; |
| 752 | 752 | pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx]; |
| 753 | 753 | |
| 754 | − bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) | |
| 755 | − || (pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) && | |
| 754 | + bDsaFlag = ((pParamD->sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE) && | |
| 756 | 755 | pCodingParam->iMultipleThreadIdc > 1 && |
| 757 | − pCodingParam->iMultipleThreadIdc >= pParamD->sSliceCfg.sSliceArgument.uiSliceNum); | |
| 756 | + pCodingParam->iMultipleThreadIdc >= pParamD->sSliceArgument.uiSliceNum); | |
| 758 | 757 | if (bDsaFlag) |
| 759 | 758 | iSliceStart = WelsTime(); |
| 760 | 759 | |
| @@ -838,7 +837,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 77 unmodified lines | ||
| 838 | 837 | &pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice |
| 839 | 838 | WelsEventSignal ( |
| 840 | 839 | &pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent); |
| 841 | − } else { // for SM_DYN_SLICE parallelization | |
| 840 | + } else { // for SM_SIZELIMITED_SLICE parallelization | |
| 842 | 841 | SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx; |
| 843 | 842 | const int32_t kiPartitionId = iThreadIdx; |
| 844 | 843 | const int32_t kiSliceIdxStep = pEncPEncCtx->iActiveThreadsNum; |
| @@ -1090,9 +1089,9 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 245 unmodified lines | ||
| 1090 | 1089 | // if using spatial base layer for complexity estimation |
| 1091 | 1090 | |
| 1092 | 1091 | const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0) |
| 1093 | − && (pCtx->pSvcParam->sSpatialLayers[iCurDid - 1].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE | |
| 1092 | + && (pCtx->pSvcParam->sSpatialLayers[iCurDid - 1].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE | |
| 1094 | 1093 | && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sSpatialLayers[iCurDid - |
| 1095 | − 1].sSliceCfg.sSliceArgument.uiSliceNum); | |
| 1094 | + 1].sSliceArgument.uiSliceNum); | |
| 1096 | 1095 | |
| 1097 | 1096 | if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation |
| 1098 | 1097 | // do not need adjust due to not different at both slices of consumed time |
| @@ -1156,13 +1155,13 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 57 unmodified lines | ||
| 1156 | 1155 | while (iSpatialIdx < iSpatialNum) { |
| 1157 | 1156 | const int32_t kiDid = pDidList[iSpatialIdx]; |
| 1158 | 1157 | SSpatialLayerInternal* pDlp = &pPara->sDependencyLayers[kiDid]; |
| 1159 | − SSliceConfig* pMso = &pDlp->sSliceCfg; | |
| 1158 | + SSliceConfig* pSliceArgument = &pDlp->sSliceArgument; | |
| 1160 | 1159 | SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid]; |
| 1161 | 1160 | SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx; |
| 1162 | 1161 | const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame; |
| 1163 | 1162 | if (pCtx->pSliceThreading) { |
| 1164 | 1163 | if (pCtx->pSliceThreading->pFSliceDiff |
| 1165 | − && ((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE)) | |
| 1164 | + && ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pSliceArgument->uiSliceMode == SM_AUTO_SLICE)) | |
| 1166 | 1165 | && pPara->iMultipleThreadIdc > 1 |
| 1167 | 1166 | && pPara->iMultipleThreadIdc >= kuiCountSliceNum) { |
| 1168 | 1167 | uint32_t i = 0; |