Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 20 files). Show all
Unified · Split
| @@ -353,7 +353,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 352 unmodified lines | |||
| 353 | 353 | ||
| 354 | pMa = (*ppCtx)->pMemAlign; | 354 | pMa = (*ppCtx)->pMemAlign; |
| 355 | pPara = pCodingParam; | 355 | pPara = pCodingParam; |
| 356 | iNumSpatialLayers = pPara->iNumDependencyLayer; | 356 | iNumSpatialLayers = pPara->iSpatialLayerNum; |
| 357 | iThreadNum = pPara->iCountThreadsNum; | 357 | iThreadNum = pPara->iCountThreadsNum; |
| 358 | iMaxSliceNum = (*ppCtx)->iMaxSliceCount; | 358 | iMaxSliceNum = (*ppCtx)->iMaxSliceCount; |
| 359 | 359 | ||
| @@ -399,8 +399,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 39 unmodified lines | |||
| 399 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) | 399 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) |
| 400 | iIdx = 0; | 400 | iIdx = 0; |
| 401 | while (iIdx < iNumSpatialLayers) { | 401 | while (iIdx < iNumSpatialLayers) { |
| 402 | SMulSliceOption* pMso = &pPara->sDependencyLayers[iIdx].sMso; | 402 | SSliceConfig* pMso = &pPara->sDependencyLayers[iIdx].sSliceCfg; |
| 403 | const int32_t kiSliceNum = pMso->sSliceArgument.iSliceNum; | 403 | const int32_t kiSliceNum = pMso->sSliceArgument.uiSliceNum; |
| 404 | if (pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE && pPara->iMultipleThreadIdc > 1 | 404 | if (pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE && pPara->iMultipleThreadIdc > 1 |
| 405 | && pPara->iMultipleThreadIdc >= kiSliceNum) { | 405 | && pPara->iMultipleThreadIdc >= kiSliceNum) { |
| 406 | pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]"); | 406 | pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]"); |
| @@ -638,7 +638,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 231 unmodified lines | |||
| 638 | } | 638 | } |
| 639 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) | 639 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) |
| 640 | iIdx = 0; | 640 | iIdx = 0; |
| 641 | while (iIdx < pCodingParam->iNumDependencyLayer) { | 641 | while (iIdx < pCodingParam->iSpatialLayerNum) { |
| 642 | if (pSmt->pSliceConsumeTime[iIdx]) { | 642 | if (pSmt->pSliceConsumeTime[iIdx]) { |
| 643 | pMa->WelsFree (pSmt->pSliceConsumeTime[iIdx], "pSliceConsumeTime[]"); | 643 | pMa->WelsFree (pSmt->pSliceConsumeTime[iIdx], "pSliceConsumeTime[]"); |
| 644 | pSmt->pSliceConsumeTime[iIdx] = NULL; | 644 | pSmt->pSliceConsumeTime[iIdx] = NULL; |
| @@ -688,7 +688,8 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 43 unmodified lines | |||
| 688 | SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam; | 688 | SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam; |
| 689 | SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[pCtx->uiDependencyId]; | 689 | SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[pCtx->uiDependencyId]; |
| 690 | SWelsSliceBs* pSliceBs = NULL; | 690 | SWelsSliceBs* pSliceBs = NULL; |
| 691 | const bool kbIsDynamicSlicingMode = (pDlp->sMso.uiSliceMode == SM_DYN_SLICE); | 691 | const bool kbIsDynamicSlicingMode = (pDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE); |
| 692 | |||
| 692 | int32_t iLayerSize = 0; | 693 | int32_t iLayerSize = 0; |
| 693 | int32_t iNalIdxBase = pLbi->iNalCount; | 694 | int32_t iNalIdxBase = pLbi->iNalCount; |
| 694 | int32_t iSliceIdx = 0; | 695 | int32_t iSliceIdx = 0; |
| @@ -944,7 +945,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 249 unmodified lines | |||
| 944 | eNalRefIdc = pEncPEncCtx->eNalPriority; | 945 | eNalRefIdc = pEncPEncCtx->eNalPriority; |
| 945 | bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag; | 946 | bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag; |
| 946 | 947 | ||
| 947 | if (pParamD->sMso.uiSliceMode != SM_DYN_SLICE) { | 948 | if (pParamD->sSliceCfg.uiSliceMode != SM_DYN_SLICE) { |
| 948 | int64_t iSliceStart = 0; | 949 | int64_t iSliceStart = 0; |
| 949 | bool bDsaFlag = false; | 950 | bool bDsaFlag = false; |
| 950 | iSliceIdx = pPrivateData->iSliceIndex; | 951 | iSliceIdx = pPrivateData->iSliceIndex; |
| @@ -952,9 +953,9 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 1 unmodified line | |||
| 952 | pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx]; | 953 | pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx]; |
| 953 | 954 | ||
| 954 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) | 955 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) |
| 955 | bDsaFlag = (pParamD->sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE && | 956 | bDsaFlag = (pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE && |
| 956 | pCodingParam->iMultipleThreadIdc > 1 && | 957 | pCodingParam->iMultipleThreadIdc > 1 && |
| 957 | pCodingParam->iMultipleThreadIdc >= pParamD->sMso.sSliceArgument.iSliceNum); | 958 | pCodingParam->iMultipleThreadIdc >= pParamD->sSliceCfg.sSliceArgument.uiSliceNum); |
| 958 | if (bDsaFlag) | 959 | if (bDsaFlag) |
| 959 | iSliceStart = WelsTime(); | 960 | iSliceStart = WelsTime(); |
| 960 | #endif//DYNAMIC_SLICE_ASSIGN || MT_DEBUG | 961 | #endif//DYNAMIC_SLICE_ASSIGN || MT_DEBUG |
| @@ -1376,10 +1377,11 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 415 unmodified lines | |||
| 1376 | int32_t iNeedAdj = 1; | 1377 | int32_t iNeedAdj = 1; |
| 1377 | // uiSliceMode of referencing spatial should be SM_FIXEDSLCNUM_SLICE | 1378 | // uiSliceMode of referencing spatial should be SM_FIXEDSLCNUM_SLICE |
| 1378 | // if using spatial base layer for complexity estimation | 1379 | // if using spatial base layer for complexity estimation |
| 1380 | |||
| 1379 | const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0) | 1381 | const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0) |
| 1380 | && (pCtx->pSvcParam->sDependencyLayers[iCurDid - 1].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE | 1382 | && (pCtx->pSvcParam->sDependencyLayers[iCurDid - 1].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE |
| 1381 | && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sDependencyLayers[iCurDid - | 1383 | && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sDependencyLayers[iCurDid - |
| 1382 | 1].sMso.sSliceArgument.iSliceNum); | 1384 | 1].sSliceCfg.sSliceArgument.uiSliceNum); |
| 1383 | 1385 | ||
| 1384 | if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation | 1386 | if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation |
| 1385 | #ifdef TRY_SLICING_BALANCE | 1387 | #ifdef TRY_SLICING_BALANCE |
| @@ -1457,7 +1459,7 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 71 unmodified lines | |||
| 1457 | while (iSpatialIdx < iSpatialNum) { | 1459 | while (iSpatialIdx < iSpatialNum) { |
| 1458 | const int32_t kiDid = pDidList[iSpatialIdx]; | 1460 | const int32_t kiDid = pDidList[iSpatialIdx]; |
| 1459 | SDLayerParam* pDlp = &pPara->sDependencyLayers[kiDid]; | 1461 | SDLayerParam* pDlp = &pPara->sDependencyLayers[kiDid]; |
| 1460 | SMulSliceOption* pMso = &pDlp->sMso; | 1462 | SMulSliceOption* pMso = &pDlp->sSliceCfg; |
| 1461 | SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid]; | 1463 | SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid]; |
| 1462 | SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx; | 1464 | SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx; |
| 1463 | const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame; | 1465 | const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame; |