Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 15 files). Show all
Unified · Split
| @@ -93,7 +93,7 @@ void CalcSliceComplexRatio (SDqLayer* pCurDq) { · 92 unmodified lines | |||
| 93 | int32_t iSliceIdx = 0; | 93 | int32_t iSliceIdx = 0; |
| 94 | int32_t iAvI[MAX_SLICES_NUM]; | 94 | int32_t iAvI[MAX_SLICES_NUM]; |
| 95 | 95 | ||
| 96 | assert(kiSliceCount <= MAX_SLICES_NUM); | 96 | assert (kiSliceCount <= MAX_SLICES_NUM); |
| 97 | WelsEmms(); | 97 | WelsEmms(); |
| 98 | 98 | ||
| 99 | while (iSliceIdx < kiSliceCount) { | 99 | while (iSliceIdx < kiSliceCount) { |
| @@ -112,7 +112,7 @@ void CalcSliceComplexRatio (SDqLayer* pCurDq) { · 12 unmodified lines | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | int32_t NeedDynamicAdjust (SSlice** ppSliceInLayer, const int32_t iSliceNum) { | 114 | int32_t NeedDynamicAdjust (SSlice** ppSliceInLayer, const int32_t iSliceNum) { |
| 115 | if ( NULL == ppSliceInLayer ) { | 115 | if (NULL == ppSliceInLayer) { |
| 116 | return false; | 116 | return false; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| @@ -123,7 +123,7 @@ int32_t NeedDynamicAdjust (SSlice** ppSliceInLayer, const int32_t iSliceNum) { · 4 unmodified lines | |||
| 123 | WelsEmms(); | 123 | WelsEmms(); |
| 124 | 124 | ||
| 125 | while (iSliceIdx < iSliceNum) { | 125 | while (iSliceIdx < iSliceNum) { |
| 126 | if ( NULL == ppSliceInLayer[iSliceIdx] ) { | 126 | if (NULL == ppSliceInLayer[iSliceIdx]) { |
| 127 | return false; | 127 | return false; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| @@ -232,7 +232,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 102 unmodified lines | |||
| 232 | return; | 232 | return; |
| 233 | } | 233 | } |
| 234 | iRunLen[iSliceIdx] = iNumMbAssigning; | 234 | iRunLen[iSliceIdx] = iNumMbAssigning; |
| 235 | MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG, | 235 | MT_TRACE_LOG (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 236 | "[MT] DynamicAdjustSlicing(), iSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", | 236 | "[MT] DynamicAdjustSlicing(), iSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 237 | iSliceIdx, ppSliceInLayer[iSliceIdx]->iSliceComplexRatio * 1.0f / INT_MULTIPLY, | 237 | iSliceIdx, ppSliceInLayer[iSliceIdx]->iSliceComplexRatio * 1.0f / INT_MULTIPLY, |
| 238 | ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, | 238 | ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, |
| @@ -437,24 +437,24 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 198 unmodified lines | |||
| 437 | while (iSliceIdx < iSliceCount) { | 437 | while (iSliceIdx < iSliceCount) { |
| 438 | pSliceBs = &ppSliceInlayer[iSliceIdx]->sSliceBs; | 438 | pSliceBs = &ppSliceInlayer[iSliceIdx]->sSliceBs; |
| 439 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { | 439 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { |
| 440 | int32_t iNalIdx = 0; | 440 | int32_t iNalIdx = 0; |
| 441 | const int32_t iCountNal = pSliceBs->iNalIndex; | 441 | const int32_t iCountNal = pSliceBs->iNalIndex; |
| 442 | 442 | ||
| 443 | #if MT_DEBUG_BS_WR | 443 | #if MT_DEBUG_BS_WR |
| 444 | assert (pSliceBs->bSliceCodedFlag); | 444 | assert (pSliceBs->bSliceCodedFlag); |
| 445 | #endif//MT_DEBUG_BS_WR | 445 | #endif//MT_DEBUG_BS_WR |
| 446 | 446 | ||
| 447 | memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage | 447 | memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage |
| 448 | pCtx->iPosBsBuffer += pSliceBs->uiBsPos; | 448 | pCtx->iPosBsBuffer += pSliceBs->uiBsPos; |
| 449 | 449 | ||
| 450 | iLayerSize += pSliceBs->uiBsPos; | 450 | iLayerSize += pSliceBs->uiBsPos; |
| 451 | 451 | ||
| 452 | while (iNalIdx < iCountNal) { | 452 | while (iNalIdx < iCountNal) { |
| 453 | pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx]; | 453 | pLbi->pNalLengthInByte[iNalIdxBase + iNalIdx] = pSliceBs->iNalLen[iNalIdx]; |
| 454 | ++ iNalIdx; | 454 | ++ iNalIdx; |
| 455 | } | 455 | } |
| 456 | pLbi->iNalCount += iCountNal; | 456 | pLbi->iNalCount += iCountNal; |
| 457 | iNalIdxBase += iCountNal; | 457 | iNalIdxBase += iCountNal; |
| 458 | } | 458 | } |
| 459 | ++ iSliceIdx; | 459 | ++ iSliceIdx; |
| 460 | } | 460 | } |
| @@ -615,7 +615,7 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 154 unmodified lines | |||
| 615 | int32_t iMaxI = 0; | 615 | int32_t iMaxI = 0; |
| 616 | while (i < kuiCountSliceNum) { | 616 | while (i < kuiCountSliceNum) { |
| 617 | fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n", | 617 | fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n", |
| 618 | ppSliceInLayer[i]->uiSliceConsumeTime, pCtx->iCodingIndex, kiDid, i /*/ 1000*/); | 618 | ppSliceInLayer[i]->uiSliceConsumeTime, pCtx->iCodingIndex, kiDid, i /*/ 1000*/); |
| 619 | if (ppSliceInLayer[i]->uiSliceConsumeTime > uiMaxT) { | 619 | if (ppSliceInLayer[i]->uiSliceConsumeTime > uiMaxT) { |
| 620 | uiMaxT = ppSliceInLayer[i]->uiSliceConsumeTime; | 620 | uiMaxT = ppSliceInLayer[i]->uiSliceConsumeTime; |
| 621 | iMaxI = i; | 621 | iMaxI = i; |