Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 57 files). Show all
Unified · Split
| @@ -56,7 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | #include "svc_encode_slice.h" |
| 57 | 57 | #include "deblocking.h" |
| 58 | 58 | #include "svc_enc_golomb.h" |
| 59 | −#include "crt_util_safe_x.h" // for safe crt like calls | |
| 59 | +#include "crt_util_safe_x.h" // for safe crt like calls | |
| 60 | 60 | #include "rc.h" |
| 61 | 61 | |
| 62 | 62 | #include "cpu.h" |
| @@ -225,7 +225,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 162 unmodified lines | ||
| 225 | 225 | iMinimalMbNum = iNumMbInEachGom; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | − if (kiCountSliceNum < 2 || (kiCountSliceNum & 0x01)) // we need suppose uiSliceNum is even for multiple threading | |
| 228 | + if (kiCountSliceNum < 2 || (kiCountSliceNum & 0x01)) // we need suppose uiSliceNum is even for multiple threading | |
| 229 | 229 | return; |
| 230 | 230 | |
| 231 | 231 | iMaximalMbNum = kiCountNumMb - (kiCountSliceNum - 1) * iMinimalMbNum; |
| @@ -252,7 +252,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 20 unmodified lines | ||
| 252 | 252 | assert (iNumMbAssigning > 0); |
| 253 | 253 | |
| 254 | 254 | iMbNumLeft -= iNumMbAssigning; |
| 255 | − if (iMbNumLeft <= 0) { // error due to we can not support slice_skip now yet, do not adjust this time | |
| 255 | + if (iMbNumLeft <= 0) { // error due to we can not support slice_skip now yet, do not adjust this time | |
| 256 | 256 | assert (0); |
| 257 | 257 | return; |
| 258 | 258 | } |
| @@ -543,7 +543,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 284 unmodified lines | ||
| 543 | 543 | assert (pSliceBs->bSliceCodedFlag); |
| 544 | 544 | #endif//MT_DEBUG_BS_WR |
| 545 | 545 | |
| 546 | − memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage | |
| 546 | + memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage | |
| 547 | 547 | pCtx->iPosBsBuffer += pSliceBs->uiBsPos; |
| 548 | 548 | |
| 549 | 549 | iLayerSize += pSliceBs->uiBsPos; |
| @@ -575,7 +575,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 25 unmodified lines | ||
| 575 | 575 | int32_t iNalIdx = 0; |
| 576 | 576 | const int32_t iCountNal = pSliceBs->iNalIndex; |
| 577 | 577 | |
| 578 | − memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage | |
| 578 | + memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage | |
| 579 | 579 | pCtx->iPosBsBuffer += pSliceBs->uiBsPos; |
| 580 | 580 | |
| 581 | 581 | iLayerSize += pSliceBs->uiBsPos; |
| @@ -714,7 +714,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 132 unmodified lines | ||
| 714 | 714 | iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount, |
| 715 | 715 | &pEventsList[0], |
| 716 | 716 | &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled |
| 717 | − if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited | |
| 717 | + if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited | |
| 718 | 718 | SLayerBSInfo* pLbi = pPrivateData->pLayerBs; |
| 719 | 719 | const int32_t kiCurDid = pEncPEncCtx->uiDependencyId; |
| 720 | 720 | const int32_t kiCurTid = pEncPEncCtx->uiTemporalId; |
| @@ -822,7 +822,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 101 unmodified lines | ||
| 822 | 822 | #endif//MT_DEBUG_BS_WR |
| 823 | 823 | |
| 824 | 824 | WelsEventSignal ( |
| 825 | − &pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | |
| 825 | + &pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | |
| 826 | 826 | WelsEventSignal ( |
| 827 | 827 | &pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent); |
| 828 | 828 | } else { // for SM_DYN_SLICE parallelization |
| @@ -925,10 +925,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 96 unmodified lines | ||
| 925 | 925 | iSliceIdx += kiSliceIdxStep; |
| 926 | 926 | } |
| 927 | 927 | |
| 928 | − if (uiThrdRet) // any exception?? | |
| 928 | + if (uiThrdRet) // any exception?? | |
| 929 | 929 | break; |
| 930 | 930 | |
| 931 | − WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | |
| 931 | + WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | |
| 932 | 932 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent); |
| 933 | 933 | } |
| 934 | 934 | } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal |
| @@ -940,7 +940,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 5 unmodified lines | ||
| 940 | 940 | pCurDq = pEncPEncCtx->pCurDqLayer; |
| 941 | 941 | UpdateMbListNeighborParallel (pCurDq->pSliceEncCtx, pCurDq->sMbDataP, iSliceIdx); |
| 942 | 942 | WelsEventSignal ( |
| 943 | − &pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice | |
| 943 | + &pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice | |
| 944 | 944 | } else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED |
| 945 | 945 | WelsLog (& (pEncPEncCtx->sLogCtx), WELS_LOG_WARNING, |
| 946 | 946 | "[MT] CodingSliceThreadProc(), waiting pReadySliceCodingEvent[%d] failed(%d) and thread%d terminated!", iEventIdx, |
| @@ -1061,7 +1061,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 114 unmodified lines | ||
| 1061 | 1061 | && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sSpatialLayers[iCurDid - |
| 1062 | 1062 | 1].sSliceCfg.sSliceArgument.uiSliceNum); |
| 1063 | 1063 | |
| 1064 | − if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation | |
| 1064 | + if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation | |
| 1065 | 1065 | // do not need adjust due to not different at both slices of consumed time |
| 1066 | 1066 | iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[iCurDid - 1], |
| 1067 | 1067 | pCtx->pCurDqLayer->pSliceEncCtx->iSliceNumInFrame); |
| @@ -1071,7 +1071,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 3 unmodified lines | ||
| 1071 | 1071 | pCtx->pSliceThreading->pSliceComplexRatio[iCurDid - 1], |
| 1072 | 1072 | iCurDid |
| 1073 | 1073 | ); |
| 1074 | − } else { // use temporal layer for complexity estimation | |
| 1074 | + } else { // use temporal layer for complexity estimation | |
| 1075 | 1075 | // do not need adjust due to not different at both slices of consumed time |
| 1076 | 1076 | iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[iCurDid], |
| 1077 | 1077 | pCtx->pCurDqLayer->pSliceEncCtx->iSliceNumInFrame); |