Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 7 files). Show all
Unified · Split
| @@ -237,8 +237,8 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 236 unmodified lines | |||
| 237 | return; | 237 | return; |
| 238 | } | 238 | } |
| 239 | iRunLen[iSliceIdx] = iNumMbAssigning; | 239 | iRunLen[iSliceIdx] = iNumMbAssigning; |
| 240 | MT_TRACE_LOG (& (pCtx->sLogCtx), WELS_LOG_DEBUG, | 240 | MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 241 | "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", | 241 | "[MT] DynamicAdjustSlicing(), iSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 242 | iSliceIdx, ppSliceInLayer[iSliceIdx]->iSliceComplexRatio * 1.0f / INT_MULTIPLY, | 242 | iSliceIdx, ppSliceInLayer[iSliceIdx]->iSliceComplexRatio * 1.0f / INT_MULTIPLY, |
| 243 | ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, | 243 | ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, |
| 244 | iNumMbAssigning); | 244 | iNumMbAssigning); |
| @@ -262,7 +262,6 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 17 unmodified lines | |||
| 262 | int32_t iThreadNum = 0; | 262 | int32_t iThreadNum = 0; |
| 263 | int32_t iIdx = 0; | 263 | int32_t iIdx = 0; |
| 264 | int32_t iReturn = ENC_RETURN_SUCCESS; | 264 | int32_t iReturn = ENC_RETURN_SUCCESS; |
| 265 | int32_t iMaxSliceNumInThread = 0; | ||
| 266 | 265 | ||
| 267 | if (NULL == ppCtx || NULL == pCodingParam || NULL == *ppCtx || iCountBsLen <= 0) | 266 | if (NULL == ppCtx || NULL == pCodingParam || NULL == *ppCtx || iCountBsLen <= 0) |
| 268 | return 1; | 267 | return 1; |
| @@ -275,8 +274,6 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 6 unmodified lines | |||
| 275 | iThreadNum = pPara->iMultipleThreadIdc; | 274 | iThreadNum = pPara->iMultipleThreadIdc; |
| 276 | 275 | ||
| 277 | assert (iThreadNum > 0); | 276 | assert (iThreadNum > 0); |
| 278 | iMaxSliceNumInThread = ((*ppCtx)->iMaxSliceCount / iThreadNum + 1) * 2; | ||
| 279 | iMaxSliceNumInThread = WELS_MIN ((*ppCtx)->iMaxSliceCount, (int) iMaxSliceNumInThread); | ||
| 280 | 277 | ||
| 281 | pSmt = (SSliceThreading*)pMa->WelsMalloc (sizeof (SSliceThreading), "SSliceThreading"); | 278 | pSmt = (SSliceThreading*)pMa->WelsMalloc (sizeof (SSliceThreading), "SSliceThreading"); |
| 282 | WELS_VERIFY_RETURN_IF (1, (NULL == pSmt)) | 279 | WELS_VERIFY_RETURN_IF (1, (NULL == pSmt)) |
| @@ -636,7 +633,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 353 unmodified lines | |||
| 636 | 633 | ||
| 637 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); | 634 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); |
| 638 | pCurSlice = pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]; | 635 | pCurSlice = pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]; |
| 639 | assert (iSliceIdx == (int) pCurSlice->uiSliceIdx); | 636 | assert (iSliceIdx == (int) pCurSlice->iSliceIdx); |
| 640 | iReturn = SetSliceBoundaryInfo(pEncPEncCtx->pCurDqLayer, pCurSlice, iSliceIdx); | 637 | iReturn = SetSliceBoundaryInfo(pEncPEncCtx->pCurDqLayer, pCurSlice, iSliceIdx); |
| 641 | if (ENC_RETURN_SUCCESS != iReturn) { | 638 | if (ENC_RETURN_SUCCESS != iReturn) { |
| 642 | uiThrdRet = iReturn; | 639 | uiThrdRet = iReturn; |
| @@ -653,7 +650,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 10 unmodified lines | |||
| 653 | iEventIdx); | 650 | iEventIdx); |
| 654 | } | 651 | } |
| 655 | 652 | ||
| 656 | assert (iSliceIdx == (int) pSlice->uiSliceIdx); | 653 | assert (iSliceIdx == pSlice->iSliceIdx); |
| 657 | iReturn = WelsCodeOneSlice (pEncPEncCtx, pSlice, eNalType); | 654 | iReturn = WelsCodeOneSlice (pEncPEncCtx, pSlice, eNalType); |
| 658 | if (ENC_RETURN_SUCCESS != iReturn) { | 655 | if (ENC_RETURN_SUCCESS != iReturn) { |
| 659 | uiThrdRet = iReturn; | 656 | uiThrdRet = iReturn; |
| @@ -677,7 +674,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 17 unmodified lines | |||
| 677 | if (bDsaFlag) { | 674 | if (bDsaFlag) { |
| 678 | pSlice->uiSliceConsumeTime = (uint32_t) (WelsTime() - iSliceStart); | 675 | pSlice->uiSliceConsumeTime = (uint32_t) (WelsTime() - iSliceStart); |
| 679 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, | 676 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, |
| 680 | "[MT] CodingSliceThreadProc(), coding_idx %d, uiSliceIdx %d, uiSliceConsumeTime %d, iSliceSize %d, iFirstMbInSlice %d, count_num_mb_in_slice %d", | 677 | "[MT] CodingSliceThreadProc(), coding_idx %d, iSliceIdx %d, uiSliceConsumeTime %d, iSliceSize %d, iFirstMbInSlice %d, count_num_mb_in_slice %d", |
| 681 | pEncPEncCtx->iCodingIndex, iSliceIdx, | 678 | pEncPEncCtx->iCodingIndex, iSliceIdx, |
| 682 | pSlice->uiSliceConsumeTime, iSliceSize, | 679 | pSlice->uiSliceConsumeTime, iSliceSize, |
| 683 | pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, | 680 | pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, |
| @@ -750,7 +747,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 66 unmodified lines | |||
| 750 | 747 | ||
| 751 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); | 748 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); |
| 752 | 749 | ||
| 753 | assert (iSliceIdx == (int) pSlice->uiSliceIdx); | 750 | assert (iSliceIdx == pSlice->iSliceIdx); |
| 754 | iReturn = WelsCodeOneSlice (pEncPEncCtx, pSlice, eNalType); | 751 | iReturn = WelsCodeOneSlice (pEncPEncCtx, pSlice, eNalType); |
| 755 | if (ENC_RETURN_SUCCESS != iReturn) { | 752 | if (ENC_RETURN_SUCCESS != iReturn) { |
| 756 | uiThrdRet = iReturn; | 753 | uiThrdRet = iReturn; |
| @@ -786,8 +783,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 29 unmodified lines | |||
| 786 | ); | 783 | ); |
| 787 | #endif//SLICE_INFO_OUTPUT | 784 | #endif//SLICE_INFO_OUTPUT |
| 788 | 785 | ||
| 789 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, | 786 | MT_TRACE_LOG (&(pEncPEncCtx->sLogCtx), WELS_LOG_INFO, |
| 790 | "[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, uiSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n", | 787 | "[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, iSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n", |
| 791 | pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize, | 788 | pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize, |
| 792 | pSlice->iCountMbNumInSlice, | 789 | pSlice->iCountMbNumInSlice, |
| 793 | kiEndMbIdxInPartition, kiPartitionId, pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); | 790 | kiEndMbIdxInPartition, kiPartitionId, pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); |