Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 120 files). Show all
Unified · Split
| @@ -132,8 +132,9 @@ void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSlice · 131 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | while (iSliceIdx < kiSliceCount) { |
| 134 | 134 | fAvI[iSliceIdx] = 1.0f * pCountMbInSlice[iSliceIdx] / pSliceTime[iSliceIdx]; |
| 135 | − MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), pSliceConsumeTime[%d]= %d us, slice_run= %d\n", iSliceIdx, | |
| 136 | − pSliceTime[iSliceIdx], pCountMbInSlice[iSliceIdx]); | |
| 135 | + MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), pSliceConsumeTime[%d]= %d us, slice_run= %d\n", | |
| 136 | + iSliceIdx, | |
| 137 | + pSliceTime[iSliceIdx], pCountMbInSlice[iSliceIdx]); | |
| 137 | 138 | fSumAv += fAvI[iSliceIdx]; |
| 138 | 139 | |
| 139 | 140 | ++ iSliceIdx; |
| @@ -156,8 +157,9 @@ int32_t NeedDynamicAdjust (void* pConsumeTime, const int32_t iSliceNum) { · 16 unmodified lines | ||
| 156 | 157 | iSliceIdx += 2; |
| 157 | 158 | } |
| 158 | 159 | if (uiTotalConsume == 0) { |
| 159 | − MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] NeedDynamicAdjust(), herein do no adjust due first picture, iCountSliceNum= %d\n", | |
| 160 | − iSliceNum); | |
| 160 | + MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, | |
| 161 | + "[MT] NeedDynamicAdjust(), herein do no adjust due first picture, iCountSliceNum= %d\n", | |
| 162 | + iSliceNum); | |
| 161 | 163 | return false; |
| 162 | 164 | } |
| 163 | 165 | |
| @@ -183,8 +185,8 @@ int32_t NeedDynamicAdjust (void* pConsumeTime, const int32_t iSliceNum) { · 19 unmodified lines | ||
| 183 | 185 | if (fRmse > fThr) |
| 184 | 186 | iNeedAdj = true; |
| 185 | 187 | MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, |
| 186 | − "[MT] NeedDynamicAdjust(), herein adjustment decision is made (iNeedAdj= %d) by: fRmse of pSlice complexity ratios %.6f, the corresponding threshold %.6f, iCountSliceNum %d\n", | |
| 187 | − iNeedAdj, fRmse, fThr, iSliceNum); | |
| 188 | + "[MT] NeedDynamicAdjust(), herein adjustment decision is made (iNeedAdj= %d) by: fRmse of pSlice complexity ratios %.6f, the corresponding threshold %.6f, iCountSliceNum %d\n", | |
| 189 | + iNeedAdj, fRmse, fThr, iSliceNum); | |
| 188 | 190 | |
| 189 | 191 | return iNeedAdj; |
| 190 | 192 | } |
| @@ -256,8 +258,8 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 65 unmodified lines | ||
| 256 | 258 | } |
| 257 | 259 | iRunLen[iSliceIdx] = iNumMbAssigning; |
| 258 | 260 | MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, |
| 259 | − "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d\n", | |
| 260 | − iSliceIdx, pSliceComplexRatio[iSliceIdx], pSliceCtx->pCountMbNumInSlice[iSliceIdx], iNumMbAssigning); | |
| 261 | + "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d\n", | |
| 262 | + iSliceIdx, pSliceComplexRatio[iSliceIdx], pSliceCtx->pCountMbNumInSlice[iSliceIdx], iNumMbAssigning); | |
| 261 | 263 | ++ iSliceIdx; |
| 262 | 264 | iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts |
| 263 | 265 | } |
| @@ -313,16 +315,17 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 49 unmodified lines | ||
| 313 | 315 | |
| 314 | 316 | #ifdef _WIN32 |
| 315 | 317 | // Dummy event namespace, the windows events don't actually use this |
| 316 | − WelsSnprintf (pSmt->eventNamespace, sizeof(pSmt->eventNamespace), "%p", (void*) *ppCtx); | |
| 318 | + WelsSnprintf (pSmt->eventNamespace, sizeof (pSmt->eventNamespace), "%p", (void*) *ppCtx); | |
| 317 | 319 | #else |
| 318 | − WelsSnprintf (pSmt->eventNamespace, sizeof(pSmt->eventNamespace), "%p%x", (void*) *ppCtx, getpid()); | |
| 320 | + WelsSnprintf (pSmt->eventNamespace, sizeof (pSmt->eventNamespace), "%p%x", (void*) *ppCtx, getpid()); | |
| 319 | 321 | #endif//!_WIN32 |
| 320 | 322 | |
| 321 | 323 | iIdx = 0; |
| 322 | 324 | while (iIdx < iNumSpatialLayers) { |
| 323 | 325 | SSliceConfig* pMso = &pPara->sDependencyLayers[iIdx].sSliceCfg; |
| 324 | 326 | const int32_t kiSliceNum = pMso->sSliceArgument.uiSliceNum; |
| 325 | − if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pMso->uiSliceMode == SM_AUTO_SLICE)) && pPara->iMultipleThreadIdc > 1 | |
| 327 | + if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE)) | |
| 328 | + && pPara->iMultipleThreadIdc > 1 | |
| 326 | 329 | && pPara->iMultipleThreadIdc >= kiSliceNum) { |
| 327 | 330 | pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]"); |
| 328 | 331 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceConsumeTime[iIdx]), FreeMemorySvc (ppCtx)) |
| @@ -371,7 +374,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 42 unmodified lines | ||
| 371 | 374 | MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); |
| 372 | 375 | WelsSnprintf (name, SEM_NAME_MAX, "fu%d%s", iIdx, pSmt->eventNamespace); |
| 373 | 376 | err = WelsEventOpen (&pSmt->pFinUpdateMbListEvent[iIdx], name); |
| 374 | − MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); | |
| 377 | + MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, | |
| 378 | + errno); | |
| 375 | 379 | WelsSnprintf (name, SEM_NAME_MAX, "sc%d%s", iIdx, pSmt->eventNamespace); |
| 376 | 380 | err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name); |
| 377 | 381 | MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); |
| @@ -415,10 +419,11 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 37 unmodified lines | ||
| 415 | 419 | iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate); |
| 416 | 420 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) |
| 417 | 421 | |
| 418 | − iReturn = WelsMutexInit (&(*ppCtx)->mutexEncoderError); | |
| 422 | + iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError); | |
| 419 | 423 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) |
| 420 | 424 | |
| 421 | − MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iCountSliceNum= %d\n", pPara->iCountThreadsNum, | |
| 425 | + MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iCountSliceNum= %d\n", | |
| 426 | + pPara->iCountThreadsNum, | |
| 422 | 427 | iMaxSliceNum); |
| 423 | 428 | |
| 424 | 429 | return 0; |
| @@ -467,7 +472,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 42 unmodified lines | ||
| 467 | 472 | WelsEventClose (&pSmt->pSliceCodedMasterEvent, ename); |
| 468 | 473 | |
| 469 | 474 | WelsMutexDestroy (&pSmt->mutexSliceNumUpdate); |
| 470 | − WelsMutexDestroy (&((*ppCtx)->mutexEncoderError)); | |
| 475 | + WelsMutexDestroy (& ((*ppCtx)->mutexEncoderError)); | |
| 471 | 476 | |
| 472 | 477 | if (pSmt->pThreadPEncCtx != NULL) { |
| 473 | 478 | pMa->WelsFree (pSmt->pThreadPEncCtx, "pThreadPEncCtx"); |
| @@ -595,7 +600,8 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 121 unmodified lines | ||
| 595 | 600 | return iLayerSize; |
| 596 | 601 | } |
| 597 | 602 | |
| 598 | −int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx, int32_t& iSliceSize) { | |
| 603 | +int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFrameBsBuffer, const int32_t iSliceIdx, | |
| 604 | + int32_t& iSliceSize) { | |
| 599 | 605 | SWelsSliceBs* pSliceBs = &pCtx->pSliceBs[iSliceIdx]; |
| 600 | 606 | SNalUnitHeaderExt* pNalHdrExt = &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt; |
| 601 | 607 | uint8_t* pDst = pFrameBsBuffer; |
| @@ -610,8 +616,9 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr · 8 unmodified lines | ||
| 610 | 616 | |
| 611 | 617 | while (iNalIdx < kiNalCnt) { |
| 612 | 618 | iNalSize = 0; |
| 613 | − iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pCtx->iFrameBsSize-kiWrittenLength-iSliceSize, pDst, &iNalSize); | |
| 614 | − WELS_VERIFY_RETURN_IFNEQ(iReturn, ENC_RETURN_SUCCESS) | |
| 619 | + iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pCtx->iFrameBsSize - kiWrittenLength - iSliceSize, | |
| 620 | + pDst, &iNalSize); | |
| 621 | + WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) | |
| 615 | 622 | iSliceSize += iNalSize; |
| 616 | 623 | pDst += iNalSize; |
| 617 | 624 | pLbi->iNalLengthInByte[iNalBase + iNalIdx] = iNalSize; |
| @@ -653,8 +660,9 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl · 35 unmodified lines | ||
| 653 | 660 | |
| 654 | 661 | while (iNalIdx < kiNalCnt) { |
| 655 | 662 | iNalSize = 0; |
| 656 | − iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pSliceBs->uiSize-kiWrittenLength-iSliceSize, pDst, &iNalSize); | |
| 657 | − WELS_VERIFY_RETURN_IFNEQ(iReturn, ENC_RETURN_SUCCESS) | |
| 663 | + iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pSliceBs->uiSize - kiWrittenLength - iSliceSize, | |
| 664 | + pDst, &iNalSize); | |
| 665 | + WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) | |
| 658 | 666 | pNalLen[iNalIdx] = iNalSize; |
| 659 | 667 | iSliceSize += iNalSize; |
| 660 | 668 | pDst += iNalSize; |
| @@ -702,7 +710,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 41 unmodified lines | ||
| 702 | 710 | "[MT] CodingSliceThreadProc(), try to call WelsMultipleEventsWaitSingleBlocking(pEventsList= %p %p %p), pEncPEncCtx= %p!\n", |
| 703 | 711 | pEventsList[0], pEventsList[1], pEventsList[1], (void*)pEncPEncCtx); |
| 704 | 712 | iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount, |
| 705 | − &pEventsList[0], &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled | |
| 713 | + &pEventsList[0], | |
| 714 | + &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled | |
| 706 | 715 | if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited |
| 707 | 716 | SLayerBSInfo* pLbi = pPrivateData->pLayerBs; |
| 708 | 717 | const int32_t kiCurDid = pEncPEncCtx->uiDependencyId; |
| @@ -722,7 +731,8 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 13 unmodified lines | ||
| 722 | 731 | pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx]; |
| 723 | 732 | pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx]; |
| 724 | 733 | |
| 725 | − bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) && | |
| 734 | + bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) | |
| 735 | + || (pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) && | |
| 726 | 736 | pCodingParam->iMultipleThreadIdc > 1 && |
| 727 | 737 | pCodingParam->iMultipleThreadIdc >= pParamD->sSliceCfg.sSliceArgument.uiSliceNum); |
| 728 | 738 | if (bDsaFlag) |
| @@ -752,7 +762,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 23 unmodified lines | ||
| 752 | 762 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); |
| 753 | 763 | |
| 754 | 764 | iReturn = WelsCodeOneSlice (pEncPEncCtx, iSliceIdx, eNalType); |
| 755 | − if (ENC_RETURN_SUCCESS!=iReturn) { | |
| 765 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 756 | 766 | uiThrdRet = iReturn; |
| 757 | 767 | break; |
| 758 | 768 | } |
| @@ -762,15 +772,14 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 3 unmodified lines | ||
| 762 | 772 | if (0 == iSliceIdx) { |
| 763 | 773 | pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer; |
| 764 | 774 | iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pLbi->pBsBuf, iSliceIdx, iSliceSize); |
| 765 | − if (ENC_RETURN_SUCCESS!=iReturn) { | |
| 775 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 766 | 776 | uiThrdRet = iReturn; |
| 767 | 777 | break; |
| 768 | 778 | } |
| 769 | 779 | pEncPEncCtx->iPosBsBuffer += iSliceSize; |
| 770 | − } else | |
| 771 | − { | |
| 780 | + } else { | |
| 772 | 781 | iReturn = WriteSliceBs (pEncPEncCtx, pSliceBs->pBs, iSliceIdx, iSliceSize); |
| 773 | − if (ENC_RETURN_SUCCESS!=iReturn) { | |
| 782 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 774 | 783 | uiThrdRet = iReturn; |
| 775 | 784 | break; |
| 776 | 785 | } |
| @@ -859,7 +868,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 82 unmodified lines | ||
| 859 | 868 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); |
| 860 | 869 | |
| 861 | 870 | iReturn = WelsCodeOneSlice (pEncPEncCtx, iSliceIdx, eNalType); |
| 862 | − if (ENC_RETURN_SUCCESS!=iReturn) { | |
| 871 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 863 | 872 | uiThrdRet = iReturn; |
| 864 | 873 | break; |
| 865 | 874 | } |
| @@ -869,16 +878,16 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 3 unmodified lines | ||
| 869 | 878 | if (0 == kiPartitionId) { |
| 870 | 879 | if (0 == iSliceIdx) |
| 871 | 880 | pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer; |
| 872 | − iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer, iSliceIdx, iSliceSize); | |
| 873 | − if (ENC_RETURN_SUCCESS!=iReturn) { | |
| 881 | + iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer, iSliceIdx, | |
| 882 | + iSliceSize); | |
| 883 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 874 | 884 | uiThrdRet = iReturn; |
| 875 | 885 | break; |
| 876 | 886 | } |
| 877 | 887 | pEncPEncCtx->iPosBsBuffer += iSliceSize; |
| 878 | − } else | |
| 879 | − { | |
| 888 | + } else { | |
| 880 | 889 | iSliceSize = WriteSliceBs (pEncPEncCtx, pSliceBs->pBs, iSliceIdx, iSliceSize); |
| 881 | − if (ENC_RETURN_SUCCESS!=iReturn) { | |
| 890 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 882 | 891 | uiThrdRet = iReturn; |
| 883 | 892 | break; |
| 884 | 893 | } |
| @@ -918,20 +927,17 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 33 unmodified lines | ||
| 918 | 927 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice |
| 919 | 928 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent); |
| 920 | 929 | } |
| 921 | − } | |
| 922 | − else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal | |
| 930 | + } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal | |
| 923 | 931 | uiThrdRet = 0; |
| 924 | 932 | break; |
| 925 | − } | |
| 926 | − else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 2 == iWaitRet) { // update pMb list singal | |
| 933 | + } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 2 == iWaitRet) { // update pMb list singal | |
| 927 | 934 | iSliceIdx = |
| 928 | 935 | iEventIdx; // pPrivateData->iSliceIndex; old threads can not be terminated, pPrivateData is not correct for applicable |
| 929 | 936 | pCurDq = pEncPEncCtx->pCurDqLayer; |
| 930 | 937 | UpdateMbListNeighborParallel (pCurDq->pSliceEncCtx, pCurDq->sMbDataP, iSliceIdx); |
| 931 | 938 | WelsEventSignal ( |
| 932 | 939 | &pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice |
| 933 | − } | |
| 934 | − else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED | |
| 940 | + } else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED | |
| 935 | 941 | WelsLog (pEncPEncCtx, WELS_LOG_WARNING, |
| 936 | 942 | "[MT] CodingSliceThreadProc(), waiting pReadySliceCodingEvent[%d] failed(%d) and thread%d terminated!\n", iEventIdx, |
| 937 | 943 | iWaitRet, iThreadIdx); |
| @@ -962,9 +968,9 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 24 unmodified lines | ||
| 962 | 968 | return 0; |
| 963 | 969 | } |
| 964 | 970 | |
| 965 | −int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLbi, | |
| 966 | − const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) | |
| 967 | −{ | |
| 971 | +int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, WELS_EVENT* pMasterEventsList, | |
| 972 | + SLayerBSInfo* pLbi, | |
| 973 | + const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) { | |
| 968 | 974 | int32_t iEndMbIdx = 0; |
| 969 | 975 | int32_t iIdx = 0; |
| 970 | 976 | const int32_t kiEventCnt = uiNumThreads; |
| @@ -1044,9 +1050,9 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 73 unmodified lines | ||
| 1044 | 1050 | // if using spatial base layer for complexity estimation |
| 1045 | 1051 | |
| 1046 | 1052 | const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0) |
| 1047 | − && (pCtx->pSvcParam->sDependencyLayers[iCurDid - 1].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE | |
| 1048 | − && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sDependencyLayers[iCurDid - | |
| 1049 | − 1].sSliceCfg.sSliceArgument.uiSliceNum); | |
| 1053 | + && (pCtx->pSvcParam->sDependencyLayers[iCurDid - 1].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE | |
| 1054 | + && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sDependencyLayers[iCurDid - | |
| 1055 | + 1].sSliceCfg.sSliceArgument.uiSliceNum); | |
| 1050 | 1056 | |
| 1051 | 1057 | if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation |
| 1052 | 1058 | // do not need adjust due to not different at both slices of consumed time |
| @@ -1116,7 +1122,7 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 63 unmodified lines | ||
| 1116 | 1122 | const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame; |
| 1117 | 1123 | if (pCtx->pSliceThreading) { |
| 1118 | 1124 | if (pCtx->pSliceThreading->pFSliceDiff |
| 1119 | − && ((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pMso->uiSliceMode == SM_AUTO_SLICE)) | |
| 1125 | + && ((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE)) | |
| 1120 | 1126 | && pPara->iMultipleThreadIdc > 1 |
| 1121 | 1127 | && pPara->iMultipleThreadIdc >= kuiCountSliceNum) { |
| 1122 | 1128 | uint32_t i = 0; |