Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 54 files). Show all
Unified · Split
| @@ -131,7 +131,7 @@ void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSlice · 130 unmodified lines | ||
| 131 | 131 | WelsEmms(); |
| 132 | 132 | |
| 133 | 133 | while (iSliceIdx < kiSliceCount) { |
| 134 | − iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * pCountMbInSlice[iSliceIdx], pSliceTime[iSliceIdx]); | |
| 134 | + iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * pCountMbInSlice[iSliceIdx], pSliceTime[iSliceIdx]); | |
| 135 | 135 | MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), pSliceConsumeTime[%d]= %d us, slice_run= %d", |
| 136 | 136 | iSliceIdx, |
| 137 | 137 | pSliceTime[iSliceIdx], pCountMbInSlice[iSliceIdx]); |
| @@ -183,7 +183,7 @@ int32_t NeedDynamicAdjust (void* pConsumeTime, const int32_t iSliceNum) { · 45 unmodified lines | ||
| 183 | 183 | } else |
| 184 | 184 | fThr = 1.0f; |
| 185 | 185 | if (fRmse > fThr) |
| 186 | − iNeedAdj = true; | |
| 186 | + iNeedAdj = true; | |
| 187 | 187 | MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, |
| 188 | 188 | "[MT] NeedDynamicAdjust(), herein adjustment decision is made (iNeedAdj= %d) by: fRmse of pSlice complexity ratios %.6f, the corresponding threshold %.6f, iCountSliceNum %d", |
| 189 | 189 | iNeedAdj, fRmse, fThr, iSliceNum); |
| @@ -222,19 +222,19 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 32 unmodified lines | ||
| 222 | 222 | if (iNumMbInEachGom * kiCountSliceNum >= kiCountNumMb) { |
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | − iMinimalMbNum = iNumMbInEachGom; | |
| 225 | + iMinimalMbNum = iNumMbInEachGom; | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if (kiCountSliceNum < 2 || (kiCountSliceNum & 0x01)) // we need suppose uiSliceNum is even for multiple threading |
| 229 | 229 | return; |
| 230 | 230 | |
| 231 | − iMaximalMbNum = kiCountNumMb - (kiCountSliceNum - 1) * iMinimalMbNum; | |
| 231 | + iMaximalMbNum = kiCountNumMb - (kiCountSliceNum - 1) * iMinimalMbNum; | |
| 232 | 232 | |
| 233 | 233 | WelsEmms(); |
| 234 | 234 | |
| 235 | 235 | MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, "[MT] DynamicAdjustSlicing(), iDid= %d, iCountNumMb= %d", iCurDid, kiCountNumMb); |
| 236 | 236 | |
| 237 | − iSliceIdx = 0; | |
| 237 | + iSliceIdx = 0; | |
| 238 | 238 | while (iSliceIdx + 1 < kiCountSliceNum) { |
| 239 | 239 | int32_t iNumMbAssigning = WELS_DIV_ROUND (kiCountNumMb * pSliceComplexRatio[iSliceIdx], INT_MULTIPLY); |
| 240 | 240 | |
| @@ -245,9 +245,9 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 4 unmodified lines | ||
| 245 | 245 | |
| 246 | 246 | // make sure one GOM at least in each pSlice for safe |
| 247 | 247 | if (iNumMbAssigning < iMinimalMbNum) |
| 248 | − iNumMbAssigning = iMinimalMbNum; | |
| 248 | + iNumMbAssigning = iMinimalMbNum; | |
| 249 | 249 | else if (iNumMbAssigning > iMaximalMbNum) |
| 250 | − iNumMbAssigning = iMaximalMbNum; | |
| 250 | + iNumMbAssigning = iMaximalMbNum; | |
| 251 | 251 | |
| 252 | 252 | assert (iNumMbAssigning > 0); |
| 253 | 253 | |
| @@ -256,13 +256,13 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 2 unmodified lines | ||
| 256 | 256 | assert (0); |
| 257 | 257 | return; |
| 258 | 258 | } |
| 259 | − iRunLen[iSliceIdx] = iNumMbAssigning; | |
| 259 | + iRunLen[iSliceIdx] = iNumMbAssigning; | |
| 260 | 260 | MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, |
| 261 | 261 | "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 262 | 262 | iSliceIdx, pSliceComplexRatio[iSliceIdx] * 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx], |
| 263 | 263 | iNumMbAssigning); |
| 264 | 264 | ++ iSliceIdx; |
| 265 | − iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts | |
| 265 | + iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts | |
| 266 | 266 | } |
| 267 | 267 | iRunLen[iSliceIdx] = iMbNumLeft; |
| 268 | 268 | MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, |
| @@ -301,16 +301,16 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 32 unmodified lines | ||
| 301 | 301 | if (NULL == ppCtx || NULL == pCodingParam || NULL == *ppCtx || iCountBsLen <= 0) |
| 302 | 302 | return 1; |
| 303 | 303 | |
| 304 | − pMa = (*ppCtx)->pMemAlign; | |
| 304 | + pMa = (*ppCtx)->pMemAlign; | |
| 305 | 305 | pPara = pCodingParam; |
| 306 | − iNumSpatialLayers = pPara->iSpatialLayerNum; | |
| 307 | − iThreadNum = pPara->iCountThreadsNum; | |
| 306 | + iNumSpatialLayers = pPara->iSpatialLayerNum; | |
| 307 | + iThreadNum = pPara->iCountThreadsNum; | |
| 308 | 308 | iMaxSliceNum = (*ppCtx)->iMaxSliceCount; |
| 309 | 309 | |
| 310 | − pSmt = (SSliceThreading*)pMa->WelsMalloc (sizeof (SSliceThreading), "SSliceThreading"); | |
| 310 | + pSmt = (SSliceThreading*)pMa->WelsMalloc (sizeof (SSliceThreading), "SSliceThreading"); | |
| 311 | 311 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt), FreeMemorySvc (ppCtx)) |
| 312 | − (*ppCtx)->pSliceThreading = pSmt; | |
| 313 | − pSmt->pThreadPEncCtx = (SSliceThreadPrivateData*)pMa->WelsMalloc (sizeof (SSliceThreadPrivateData) * iThreadNum, | |
| 312 | + (*ppCtx)->pSliceThreading = pSmt; | |
| 313 | + pSmt->pThreadPEncCtx = (SSliceThreadPrivateData*)pMa->WelsMalloc (sizeof (SSliceThreadPrivateData) * iThreadNum, | |
| 314 | 314 | "pThreadPEncCtx"); |
| 315 | 315 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadPEncCtx), FreeMemorySvc (ppCtx)) |
| 316 | 316 | |
| @@ -323,14 +323,14 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 6 unmodified lines | ||
| 323 | 323 | |
| 324 | 324 | iIdx = 0; |
| 325 | 325 | while (iIdx < iNumSpatialLayers) { |
| 326 | − SSliceConfig* pMso = &pPara->sSpatialLayers[iIdx].sSliceCfg; | |
| 326 | + SSliceConfig* pMso = &pPara->sSpatialLayers[iIdx].sSliceCfg; | |
| 327 | 327 | const int32_t kiSliceNum = pMso->sSliceArgument.uiSliceNum; |
| 328 | 328 | if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE)) |
| 329 | 329 | && pPara->iMultipleThreadIdc > 1 |
| 330 | 330 | && pPara->iMultipleThreadIdc >= kiSliceNum) { |
| 331 | − pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]"); | |
| 331 | + pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]"); | |
| 332 | 332 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceConsumeTime[iIdx]), FreeMemorySvc (ppCtx)) |
| 333 | − pSmt->pSliceComplexRatio[iIdx] = (int32_t*)pMa->WelsMalloc (kiSliceNum * sizeof (int32_t), "pSliceComplexRatio[]"); | |
| 333 | + pSmt->pSliceComplexRatio[iIdx] = (int32_t*)pMa->WelsMalloc (kiSliceNum * sizeof (int32_t), "pSliceComplexRatio[]"); | |
| 334 | 334 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceComplexRatio[iIdx]), FreeMemorySvc (ppCtx)) |
| 335 | 335 | } else { |
| 336 | 336 | pSmt->pSliceConsumeTime[iIdx] = NULL; |
| @@ -348,7 +348,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 11 unmodified lines | ||
| 348 | 348 | fclose (pSmt->pFSliceDiff); |
| 349 | 349 | pSmt->pFSliceDiff = NULL; |
| 350 | 350 | } |
| 351 | − pSmt->pFSliceDiff = fopen ("slice_time.txt", "wt+"); | |
| 351 | + pSmt->pFSliceDiff = fopen ("slice_time.txt", "wt+"); | |
| 352 | 352 | #endif//MT_DEBUG |
| 353 | 353 | |
| 354 | 354 | MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "encpEncCtx= 0x%p", (void*) *ppCtx); |
| @@ -392,7 +392,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 37 unmodified lines | ||
| 392 | 392 | err = WelsEventOpen (&pSmt->pSliceCodedMasterEvent, name); |
| 393 | 393 | MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedMasterEvent named(%s) ret%d err%d", name, err, errno); |
| 394 | 394 | |
| 395 | − (*ppCtx)->pSliceBs = (SWelsSliceBs*)pMa->WelsMalloc (sizeof (SWelsSliceBs) * iMaxSliceNum, "pSliceBs"); | |
| 395 | + (*ppCtx)->pSliceBs = (SWelsSliceBs*)pMa->WelsMalloc (sizeof (SWelsSliceBs) * iMaxSliceNum, "pSliceBs"); | |
| 396 | 396 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSliceBs), FreeMemorySvc (ppCtx)) |
| 397 | 397 | |
| 398 | 398 | pBsBase = (*ppCtx)->pFrameBs + iCountBsLen; |
| @@ -403,7 +403,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 4 unmodified lines | ||
| 403 | 403 | pSliceB->pBsBuffer = (uint8_t*)pMa->WelsMalloc (iSliceBsBufferSize, "pSliceB->pBsBuffer"); |
| 404 | 404 | |
| 405 | 405 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSliceB->pBsBuffer), FreeMemorySvc (ppCtx)) |
| 406 | − pSliceB->uiSize = iSliceBsBufferSize; | |
| 406 | + pSliceB->uiSize = iSliceBsBufferSize; | |
| 407 | 407 | |
| 408 | 408 | if (iIdx > 0) { |
| 409 | 409 | pSliceB->pBs = pBsBase; |
| @@ -537,7 +537,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 127 unmodified lines | ||
| 537 | 537 | ++ pSliceBs; |
| 538 | 538 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { |
| 539 | 539 | int32_t iNalIdx = 0; |
| 540 | − const int32_t iCountNal = pSliceBs->iNalIndex; | |
| 540 | + const int32_t iCountNal = pSliceBs->iNalIndex; | |
| 541 | 541 | |
| 542 | 542 | #if MT_DEBUG_BS_WR |
| 543 | 543 | assert (pSliceBs->bSliceCodedFlag); |
| @@ -549,7 +549,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 5 unmodified lines | ||
| 549 | 549 | iLayerSize += pSliceBs->uiBsPos; |
| 550 | 550 | |
| 551 | 551 | while (iNalIdx < iCountNal) { |
| 552 | − pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx]; | |
| 552 | + pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx]; | |
| 553 | 553 | ++ iNalIdx; |
| 554 | 554 | } |
| 555 | 555 | pLbi->iNalCount += iCountNal; |
| @@ -567,13 +567,13 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 11 unmodified lines | ||
| 567 | 567 | const int32_t kiCountSlicesCoded = pCtx->pCurDqLayer->pNumSliceCodedOfPartition[iPartitionIdx]; |
| 568 | 568 | int32_t iIdx = 0; |
| 569 | 569 | |
| 570 | − iSliceIdx = iPartitionIdx; | |
| 570 | + iSliceIdx = iPartitionIdx; | |
| 571 | 571 | while (iIdx < kiCountSlicesCoded) { |
| 572 | − pSliceBs = &pCtx->pSliceBs[iSliceIdx]; | |
| 572 | + pSliceBs = &pCtx->pSliceBs[iSliceIdx]; | |
| 573 | 573 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { |
| 574 | 574 | if (iPartitionIdx > 0) { |
| 575 | 575 | int32_t iNalIdx = 0; |
| 576 | − const int32_t iCountNal = pSliceBs->iNalIndex; | |
| 576 | + const int32_t iCountNal = pSliceBs->iNalIndex; | |
| 577 | 577 | |
| 578 | 578 | memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage |
| 579 | 579 | pCtx->iPosBsBuffer += pSliceBs->uiBsPos; |
| @@ -581,13 +581,13 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 1 unmodified line | ||
| 581 | 581 | iLayerSize += pSliceBs->uiBsPos; |
| 582 | 582 | |
| 583 | 583 | while (iNalIdx < iCountNal) { |
| 584 | − pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx]; | |
| 584 | + pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx]; | |
| 585 | 585 | ++ iNalIdx; |
| 586 | 586 | } |
| 587 | 587 | pLbi->iNalCount += iCountNal; |
| 588 | 588 | iNalIdxBase += iCountNal; |
| 589 | 589 | } else { |
| 590 | − iLayerSize += pSliceBs->uiBsPos; | |
| 590 | + iLayerSize += pSliceBs->uiBsPos; | |
| 591 | 591 | } |
| 592 | 592 | } |
| 593 | 593 | |
| @@ -622,12 +622,12 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr · 28 unmodified lines | ||
| 622 | 622 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 623 | 623 | iSliceSize += iNalSize; |
| 624 | 624 | pDst += iNalSize; |
| 625 | − pLbi->pNalLengthInByte[iNalBase + iNalIdx] = iNalSize; | |
| 625 | + pLbi->pNalLengthInByte[iNalBase + iNalIdx] = iNalSize; | |
| 626 | 626 | |
| 627 | 627 | ++ iNalIdx; |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | − pSliceBs->uiBsPos = iSliceSize; | |
| 630 | + pSliceBs->uiBsPos = iSliceSize; | |
| 631 | 631 | if (iFirstSlice) { |
| 632 | 632 | // pBsBuffer has been updated at coding_slice_0_in_encoder_mother_thread() |
| 633 | 633 | pLbi->uiLayerType = VIDEO_CODING_LAYER; |
| @@ -653,7 +653,7 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl · 19 unmodified lines | ||
| 653 | 653 | int32_t iReturn = ENC_RETURN_SUCCESS; |
| 654 | 654 | const int32_t kiWrittenLength = (int32_t) (pSliceBs->sBsWrite.pCurBuf - pSliceBs->sBsWrite.pStartBuf); |
| 655 | 655 | |
| 656 | − iSliceSize = 0; | |
| 656 | + iSliceSize = 0; | |
| 657 | 657 | assert (kiNalCnt <= 2); |
| 658 | 658 | if (kiNalCnt > 2) |
| 659 | 659 | return 0; |
| @@ -668,7 +668,7 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl · 8 unmodified lines | ||
| 668 | 668 | pDst += iNalSize; |
| 669 | 669 | ++ iNalIdx; |
| 670 | 670 | } |
| 671 | − pSliceBs->uiBsPos = iSliceSize; | |
| 671 | + pSliceBs->uiBsPos = iSliceSize; | |
| 672 | 672 | |
| 673 | 673 | return iReturn; |
| 674 | 674 | } |
| @@ -727,7 +727,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 52 unmodified lines | ||
| 727 | 727 | bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag; |
| 728 | 728 | |
| 729 | 729 | if (pParamD->sSliceCfg.uiSliceMode != SM_DYN_SLICE) { |
| 730 | − int64_t iSliceStart = 0; | |
| 730 | + int64_t iSliceStart = 0; | |
| 731 | 731 | bool bDsaFlag = false; |
| 732 | 732 | iSliceIdx = pPrivateData->iSliceIndex; |
| 733 | 733 | pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx]; |
| @@ -746,7 +746,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 12 unmodified lines | ||
| 746 | 746 | InitBits (&pSliceBs->sBsWrite, pSliceBs->pBsBuffer, pSliceBs->uiSize); |
| 747 | 747 | |
| 748 | 748 | #if MT_DEBUG_BS_WR |
| 749 | − pSliceBs->bSliceCodedFlag = false; | |
| 749 | + pSliceBs->bSliceCodedFlag = false; | |
| 750 | 750 | #endif//MT_DEBUG_BS_WR |
| 751 | 751 | |
| 752 | 752 | if (bNeedPrefix) { |
| @@ -772,7 +772,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 19 unmodified lines | ||
| 772 | 772 | WelsUnloadNalForSlice (pSliceBs); |
| 773 | 773 | |
| 774 | 774 | if (0 == iSliceIdx) { |
| 775 | − pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer; | |
| 775 | + pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer; | |
| 776 | 776 | iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pLbi->pBsBuf, iSliceIdx, iSliceSize); |
| 777 | 777 | if (ENC_RETURN_SUCCESS != iReturn) { |
| 778 | 778 | uiThrdRet = iReturn; |
| @@ -818,7 +818,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 39 unmodified lines | ||
| 818 | 818 | #endif//SLICE_INFO_OUTPUT |
| 819 | 819 | |
| 820 | 820 | #if MT_DEBUG_BS_WR |
| 821 | − pSliceBs->bSliceCodedFlag = true; | |
| 821 | + pSliceBs->bSliceCodedFlag = true; | |
| 822 | 822 | #endif//MT_DEBUG_BS_WR |
| 823 | 823 | |
| 824 | 824 | WelsEventSignal ( |
| @@ -833,7 +833,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 8 unmodified lines | ||
| 833 | 833 | const int32_t kiEndMbInPartition = pPrivateData->iEndMbIndex; // exclusive |
| 834 | 834 | int32_t iAnyMbLeftInPartition = kiEndMbInPartition - kiFirstMbInPartition; |
| 835 | 835 | |
| 836 | − iSliceIdx = pPrivateData->iSliceIndex; | |
| 836 | + iSliceIdx = pPrivateData->iSliceIndex; | |
| 837 | 837 | |
| 838 | 838 | pSliceCtx->pFirstMbInSlice[iSliceIdx] = kiFirstMbInPartition; |
| 839 | 839 | pCurDq->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one pSlice per partition intialized, dynamic slicing inside |
| @@ -845,7 +845,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 5 unmodified lines | ||
| 845 | 845 | if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) { |
| 846 | 846 | // TODO: need exception handler for not large enough of MAX_SLICES_NUM related memory usage |
| 847 | 847 | // No idea about its solution due MAX_SLICES_NUM is fixed lenght in relevent pData structure |
| 848 | − uiThrdRet = 1; | |
| 848 | + uiThrdRet = 1; | |
| 849 | 849 | break; |
| 850 | 850 | } |
| 851 | 851 | |
| @@ -880,7 +880,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 28 unmodified lines | ||
| 880 | 880 | |
| 881 | 881 | if (0 == kiPartitionId) { |
| 882 | 882 | if (0 == iSliceIdx) |
| 883 | − pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer; | |
| 883 | + pLbi->pBsBuf = pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer; | |
| 884 | 884 | iReturn = WriteSliceToFrameBs (pEncPEncCtx, pLbi, pEncPEncCtx->pFrameBs + pEncPEncCtx->iPosBsBuffer, iSliceIdx, |
| 885 | 885 | iSliceSize); |
| 886 | 886 | if (ENC_RETURN_SUCCESS != iReturn) { |
| @@ -931,13 +931,13 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 44 unmodified lines | ||
| 931 | 931 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice |
| 932 | 932 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent); |
| 933 | 933 | } |
| 934 | − } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal | |
| 935 | − uiThrdRet = 0; | |
| 934 | + } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal | |
| 935 | + uiThrdRet = 0; | |
| 936 | 936 | break; |
| 937 | − } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 2 == iWaitRet) { // update pMb list singal | |
| 938 | − iSliceIdx = | |
| 939 | − iEventIdx; // pPrivateData->iSliceIndex; old threads can not be terminated, pPrivateData is not correct for applicable | |
| 940 | − pCurDq = pEncPEncCtx->pCurDqLayer; | |
| 937 | + } else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 2 == iWaitRet) { // update pMb list singal | |
| 938 | + iSliceIdx = | |
| 939 | + iEventIdx; // pPrivateData->iSliceIndex; old threads can not be terminated, pPrivateData is not correct for applicable | |
| 940 | + pCurDq = pEncPEncCtx->pCurDqLayer; | |
| 941 | 941 | UpdateMbListNeighborParallel (pCurDq->pSliceEncCtx, pCurDq->sMbDataP, iSliceIdx); |
| 942 | 942 | WelsEventSignal ( |
| 943 | 943 | &pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice |
| @@ -945,7 +945,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 1 unmodified line | ||
| 945 | 945 | WelsLog (& (pEncPEncCtx->sLogCtx), WELS_LOG_WARNING, |
| 946 | 946 | "[MT] CodingSliceThreadProc(), waiting pReadySliceCodingEvent[%d] failed(%d) and thread%d terminated!", iEventIdx, |
| 947 | 947 | iWaitRet, iThreadIdx); |
| 948 | − uiThrdRet = 1; | |
| 948 | + uiThrdRet = 1; | |
| 949 | 949 | break; |
| 950 | 950 | } |
| 951 | 951 | } while (1); |
| @@ -991,7 +991,7 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 39 unmodified lines | ||
| 991 | 991 | |
| 992 | 992 | //////////////////////////////////////// |
| 993 | 993 | if (bIsDynamicSlicingMode) { |
| 994 | − iEndMbIdx = pSliceCtx->iMbNumInFrame; | |
| 994 | + iEndMbIdx = pSliceCtx->iMbNumInFrame; | |
| 995 | 995 | for (iIdx = kiEventCnt - 1; iIdx >= 0; --iIdx) { |
| 996 | 996 | const int32_t iFirstMbIdx = pSliceCtx->pFirstMbInSlice[iIdx]; |
| 997 | 997 | pPriData[iIdx].iStartMbIndex = iFirstMbIdx; |
| @@ -1003,7 +1003,7 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 5 unmodified lines | ||
| 1003 | 1003 | iIdx = 0; |
| 1004 | 1004 | while (iIdx < kiEventCnt) { |
| 1005 | 1005 | pPriData[iIdx].pLayerBs = pLbi; |
| 1006 | − pPriData[iIdx].iSliceIndex = iIdx; | |
| 1006 | + pPriData[iIdx].iSliceIndex = iIdx; | |
| 1007 | 1007 | if (pEventsList[iIdx]) |
| 1008 | 1008 | WelsEventSignal (&pEventsList[iIdx]); |
| 1009 | 1009 | if (pMasterEventsList[iIdx]) |
| @@ -1027,10 +1027,10 @@ int32_t AdjustBaseLayer (sWelsEncCtx* pCtx) { · 17 unmodified lines | ||
| 1027 | 1027 | int64_t iT0 = WelsTime(); |
| 1028 | 1028 | #endif//MT_DEBUG |
| 1029 | 1029 | |
| 1030 | − pCtx->pCurDqLayer = pCurDq; | |
| 1030 | + pCtx->pCurDqLayer = pCurDq; | |
| 1031 | 1031 | |
| 1032 | 1032 | // do not need adjust due to not different at both slices of consumed time |
| 1033 | − iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[0], pCurDq->pSliceEncCtx->iSliceNumInFrame); | |
| 1033 | + iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[0], pCurDq->pSliceEncCtx->iSliceNumInFrame); | |
| 1034 | 1034 | if (iNeedAdj) |
| 1035 | 1035 | DynamicAdjustSlicing (pCtx, |
| 1036 | 1036 | pCurDq, |
| @@ -1056,7 +1056,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 19 unmodified lines | ||
| 1056 | 1056 | // uiSliceMode of referencing spatial should be SM_FIXEDSLCNUM_SLICE |
| 1057 | 1057 | // if using spatial base layer for complexity estimation |
| 1058 | 1058 | |
| 1059 | − const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0) | |
| 1059 | + const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0) | |
| 1060 | 1060 | && (pCtx->pSvcParam->sSpatialLayers[iCurDid - 1].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE |
| 1061 | 1061 | && pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sSpatialLayers[iCurDid - |
| 1062 | 1062 | 1].sSliceCfg.sSliceArgument.uiSliceNum); |
| @@ -1119,7 +1119,7 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 56 unmodified lines | ||
| 1119 | 1119 | if (iSpatialNum > MAX_DEPENDENCY_LAYER) |
| 1120 | 1120 | return; |
| 1121 | 1121 | |
| 1122 | − pPara = pCtx->pSvcParam; | |
| 1122 | + pPara = pCtx->pSvcParam; | |
| 1123 | 1123 | while (iSpatialIdx < iSpatialNum) { |
| 1124 | 1124 | const int32_t kiDid = pDidList[iSpatialIdx]; |
| 1125 | 1125 | SSpatialLayerInternal* pDlp = &pPara->sDependencyLayers[kiDid]; |