Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 7 files). Show all
Unified · Split
| @@ -602,7 +602,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 601 unmodified lines | ||
| 602 | 602 | while (iIdx < kiCountSlicesCoded) { |
| 603 | 603 | pSliceBs = &pCtx->pSliceBs[iSliceIdx]; |
| 604 | 604 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { |
| 605 | − if (iPartitionIdx > 0) { | |
| 605 | + if (iSliceIdx > 0) { | |
| 606 | 606 | int32_t iNalIdx = 0; |
| 607 | 607 | const int32_t iCountNal = pSliceBs->iNalIndex; |
| 608 | 608 | |
| @@ -706,7 +706,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 97 unmodified lines | ||
| 706 | 706 | &pEventsList[0], |
| 707 | 707 | &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled |
| 708 | 708 | if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited |
| 709 | − SLayerBSInfo* pLbi = pPrivateData->pLayerBs; | |
| 709 | + int iLayerIndex = pEncPEncCtx->pOut->iLayerBsIndex; | |
| 710 | + SFrameBSInfo* pFrameBsInfo = pPrivateData->pFrameBsInfo; | |
| 711 | + SLayerBSInfo* pLbi = &pFrameBsInfo->sLayerInfo [iLayerIndex]; | |
| 712 | + | |
| 710 | 713 | const int32_t kiCurDid = pEncPEncCtx->uiDependencyId; |
| 711 | 714 | SWelsSvcCodingParam* pCodingParam = pEncPEncCtx->pSvcParam; |
| 712 | 715 | SSpatialLayerConfig* pParamD = &pCodingParam->sSpatialLayers[kiCurDid]; |
| @@ -868,7 +871,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 155 unmodified lines | ||
| 868 | 871 | |
| 869 | 872 | WelsUnloadNalForSlice (pSliceBs); |
| 870 | 873 | |
| 871 | − if (0 == kiPartitionId) { | |
| 874 | + if (0 == iSliceIdx) { | |
| 872 | 875 | iReturn = WriteSliceBs (pEncPEncCtx, pLbi->pBsBuf, |
| 873 | 876 | &pLbi->pNalLengthInByte[pLbi->iNalCount], |
| 874 | 877 | pEncPEncCtx->iFrameBsSize - pEncPEncCtx->iPosBsBuffer, |
| @@ -969,16 +972,18 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 94 unmodified lines | ||
| 969 | 972 | } |
| 970 | 973 | |
| 971 | 974 | int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, |
| 972 | − WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLbi, | |
| 975 | + WELS_EVENT* pMasterEventsList, SFrameBSInfo* pFrameBsInfo, | |
| 973 | 976 | const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) { |
| 974 | − int32_t iEndMbIdx = 0; | |
| 975 | − int32_t iIdx = 0; | |
| 976 | − const int32_t kiEventCnt = uiNumThreads; | |
| 977 | + int32_t iEndMbIdx = 0; | |
| 978 | + int32_t iIdx = 0; | |
| 979 | + const int32_t kiEventCnt = uiNumThreads; | |
| 980 | + int32_t iLayerBsIdx = pCtx->pOut->iLayerBsIndex; | |
| 981 | + SLayerBSInfo* pLbi = &pFrameBsInfo->sLayerInfo[iLayerBsIdx]; | |
| 977 | 982 | |
| 978 | − if (pPriData == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) { | |
| 983 | + if (pPriData == NULL || pFrameBsInfo == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) { | |
| 979 | 984 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 980 | − "FiredSliceThreads(), fail due pPriData == %p || pLbi == %p || iEventCnt(%d) <= 0 || pEventsList == %p!!", | |
| 981 | − (void*)pPriData, (void*)pLbi, uiNumThreads, (void*)pEventsList); | |
| 985 | + "FiredSliceThreads(), fail due pPriData == %p ||pFrameBsInfo == %p || pLbi == %p || iEventCnt(%d) <= 0 || pEventsList == %p!!", | |
| 986 | + (void*)pPriData, (void*)pFrameBsInfo, (void*)pLbi, uiNumThreads, (void*)pEventsList); | |
| 982 | 987 | return 1; |
| 983 | 988 | } |
| 984 | 989 | |
| @@ -1003,8 +1008,8 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 18 unmodified lines | ||
| 1003 | 1008 | |
| 1004 | 1009 | iIdx = 0; |
| 1005 | 1010 | while (iIdx < kiEventCnt) { |
| 1006 | − pPriData[iIdx].pLayerBs = pLbi; | |
| 1007 | − pPriData[iIdx].iSliceIndex = iIdx; | |
| 1011 | + pPriData[iIdx].pFrameBsInfo = pFrameBsInfo; | |
| 1012 | + pPriData[iIdx].iSliceIndex = iIdx; | |
| 1008 | 1013 | SetOneSliceBsBufferUnderMultithread (pCtx, iIdx, iIdx); |
| 1009 | 1014 | if (pEventsList[iIdx]) |
| 1010 | 1015 | WelsEventSignal (&pEventsList[iIdx]); |