Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 11 files). Show all
Unified · Split
| @@ -81,7 +81,7 @@ void UpdateMbListNeighborParallel (SDqLayer* pCurDq, · 80 unmodified lines | ||
| 81 | 81 | SMB* pMbList, |
| 82 | 82 | const int32_t uiSliceIdc) { |
| 83 | 83 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 84 | − SSlice* pUpdateSlice = &pCurDq->sLayerInfo.pSliceInLayer[uiSliceIdc]; | |
| 84 | + SSlice* pUpdateSlice = pCurDq->ppSliceInLayer[uiSliceIdc]; | |
| 85 | 85 | const int32_t kiMbWidth = pSliceCtx->iMbWidth; |
| 86 | 86 | int32_t iIdx = pUpdateSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; |
| 87 | 87 | const int32_t kiEndMbInSlice = iIdx + pUpdateSlice->iCountMbNumInSlice - 1; |
| @@ -94,7 +94,7 @@ void UpdateMbListNeighborParallel (SDqLayer* pCurDq, · 6 unmodified lines | ||
| 94 | 94 | |
| 95 | 95 | void CalcSliceComplexRatio (SDqLayer* pCurDq) { |
| 96 | 96 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 97 | − SSlice* pSliceInLayer = pCurDq->sLayerInfo.pSliceInLayer; | |
| 97 | + SSlice** ppSliceInLayer = pCurDq->ppSliceInLayer; | |
| 98 | 98 | int32_t iSumAv = 0; |
| 99 | 99 | const int32_t kiSliceCount = pSliceCtx->iSliceNumInFrame; |
| 100 | 100 | int32_t iSliceIdx = 0; |
| @@ -103,23 +103,24 @@ void CalcSliceComplexRatio (SDqLayer* pCurDq) { · 2 unmodified lines | ||
| 103 | 103 | WelsEmms(); |
| 104 | 104 | |
| 105 | 105 | while (iSliceIdx < kiSliceCount) { |
| 106 | − iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * pSliceInLayer[iSliceIdx].iCountMbNumInSlice, | |
| 107 | − pSliceInLayer[iSliceIdx].uiSliceConsumeTime); | |
| 106 | + iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, | |
| 107 | + ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime); | |
| 108 | 108 | MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), uiSliceConsumeTime[%d]= %d us, slice_run= %d", |
| 109 | 109 | iSliceIdx, |
| 110 | − pSliceInLayer[iSliceIdx].uiSliceConsumeTime, pSliceInLayer[iSliceIdx].iCountMbNumInSlice); | |
| 110 | + ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime, ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice); | |
| 111 | 111 | iSumAv += iAvI[iSliceIdx]; |
| 112 | 112 | |
| 113 | 113 | ++ iSliceIdx; |
| 114 | 114 | } |
| 115 | 115 | while (-- iSliceIdx >= 0) { |
| 116 | − pSliceInLayer[iSliceIdx].iSliceComplexRatio = WELS_DIV_ROUND (INT_MULTIPLY * iAvI[iSliceIdx], iSumAv); | |
| 116 | + ppSliceInLayer[iSliceIdx]->iSliceComplexRatio = WELS_DIV_ROUND (INT_MULTIPLY * iAvI[iSliceIdx], iSumAv); | |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | −int32_t NeedDynamicAdjust (SSlice* pSliceInLayer, const int32_t iSliceNum) { | |
| 121 | − if (NULL == pSliceInLayer) | |
| 120 | +int32_t NeedDynamicAdjust (SSlice** ppSliceInLayer, const int32_t iSliceNum) { | |
| 121 | + if ( NULL == ppSliceInLayer ) { | |
| 122 | 122 | return false; |
| 123 | + } | |
| 123 | 124 | |
| 124 | 125 | uint32_t uiTotalConsume = 0; |
| 125 | 126 | int32_t iSliceIdx = 0; |
| @@ -128,7 +129,10 @@ int32_t NeedDynamicAdjust (SSlice* pSliceInLayer, const int32_t iSliceNum) { · 2 unmodified lines | ||
| 128 | 129 | WelsEmms(); |
| 129 | 130 | |
| 130 | 131 | while (iSliceIdx < iSliceNum) { |
| 131 | − uiTotalConsume += pSliceInLayer[iSliceIdx].uiSliceConsumeTime; | |
| 132 | + if ( NULL == ppSliceInLayer[iSliceIdx] ) { | |
| 133 | + return false; | |
| 134 | + } | |
| 135 | + uiTotalConsume += ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime; | |
| 132 | 136 | iSliceIdx ++; |
| 133 | 137 | } |
| 134 | 138 | if (uiTotalConsume == 0) { |
| @@ -143,7 +147,7 @@ int32_t NeedDynamicAdjust (SSlice* pSliceInLayer, const int32_t iSliceNum) { · 8 unmodified lines | ||
| 143 | 147 | float fRmse = .0f; // root mean square error of pSlice consume ratios |
| 144 | 148 | const float kfMeanRatio = 1.0f / iSliceNum; |
| 145 | 149 | do { |
| 146 | − const float fRatio = 1.0f * pSliceInLayer[iSliceIdx].uiSliceConsumeTime / uiTotalConsume; | |
| 150 | + const float fRatio = 1.0f * ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime / uiTotalConsume; | |
| 147 | 151 | const float fDiffRatio = fRatio - kfMeanRatio; |
| 148 | 152 | fRmse += (fDiffRatio * fDiffRatio); |
| 149 | 153 | ++ iSliceIdx; |
| @@ -170,7 +174,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 20 unmodified lines | ||
| 170 | 174 | SDqLayer* pCurDqLayer, |
| 171 | 175 | int32_t iCurDid) { |
| 172 | 176 | SSliceCtx* pSliceCtx = &pCurDqLayer->sSliceEncCtx; |
| 173 | − SSlice* pSliceInLayer = pCurDqLayer->sLayerInfo.pSliceInLayer; | |
| 177 | + SSlice** ppSliceInLayer = pCurDqLayer->ppSliceInLayer; | |
| 174 | 178 | const int32_t kiCountSliceNum = pSliceCtx->iSliceNumInFrame; |
| 175 | 179 | const int32_t kiCountNumMb = pSliceCtx->iMbNumInFrame; |
| 176 | 180 | int32_t iMinimalMbNum = |
| @@ -212,7 +216,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 35 unmodified lines | ||
| 212 | 216 | |
| 213 | 217 | iSliceIdx = 0; |
| 214 | 218 | while (iSliceIdx + 1 < kiCountSliceNum) { |
| 215 | − int32_t iNumMbAssigning = WELS_DIV_ROUND (kiCountNumMb * pSliceInLayer[iSliceIdx].iSliceComplexRatio, INT_MULTIPLY); | |
| 219 | + int32_t iNumMbAssigning = WELS_DIV_ROUND (kiCountNumMb * ppSliceInLayer[iSliceIdx]->iSliceComplexRatio, INT_MULTIPLY); | |
| 216 | 220 | |
| 217 | 221 | // GOM boundary aligned |
| 218 | 222 | if (pCtx->pSvcParam->iRCMode != RC_OFF_MODE) { |
| @@ -235,8 +239,8 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 16 unmodified lines | ||
| 235 | 239 | iRunLen[iSliceIdx] = iNumMbAssigning; |
| 236 | 240 | MT_TRACE_LOG (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 237 | 241 | "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 238 | − iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY, | |
| 239 | − pSliceInLayer[iSliceIdx].iCountMbNumInSlice, | |
| 242 | + iSliceIdx, ppSliceInLayer[iSliceIdx]->iSliceComplexRatio * 1.0f / INT_MULTIPLY, | |
| 243 | + ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, | |
| 240 | 244 | iNumMbAssigning); |
| 241 | 245 | ++ iSliceIdx; |
| 242 | 246 | iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts |
| @@ -244,9 +248,8 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 1 unmodified line | ||
| 244 | 248 | iRunLen[iSliceIdx] = iMbNumLeft; |
| 245 | 249 | MT_TRACE_LOG (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 246 | 250 | "[MT] DynamicAdjustSlicing(), iSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d", |
| 247 | − iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY, | |
| 248 | − pSliceInLayer[iSliceIdx].iCountMbNumInSlice, iMbNumLeft); | |
| 249 | − | |
| 251 | + iSliceIdx, ppSliceInLayer[iSliceIdx]->iSliceComplexRatio * 1.0f / INT_MULTIPLY, | |
| 252 | + ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, iMbNumLeft); | |
| 250 | 253 | pCurDqLayer->bNeedAdjustingSlicing = !DynamicAdjustSlicePEncCtxAll (pCurDqLayer, iRunLen); |
| 251 | 254 | } |
| 252 | 255 | |
| @@ -438,7 +441,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 185 unmodified lines | ||
| 438 | 441 | int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32_t iSliceCount) { |
| 439 | 442 | SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam; |
| 440 | 443 | SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[pCtx->uiDependencyId]; |
| 441 | − SSlice* pSliceInlayer = pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer; | |
| 444 | + SSlice** ppSliceInlayer = pCtx->pCurDqLayer->ppSliceInLayer; | |
| 442 | 445 | SWelsSliceBs* pSliceBs = NULL; |
| 443 | 446 | const bool kbIsDynamicSlicingMode = (pDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE); |
| 444 | 447 | |
| @@ -449,7 +452,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 4 unmodified lines | ||
| 449 | 452 | if (!kbIsDynamicSlicingMode) { |
| 450 | 453 | iNalIdxBase = pLbi->iNalCount = 0; |
| 451 | 454 | while (iSliceIdx < iSliceCount) { |
| 452 | − pSliceBs = &pSliceInlayer[iSliceIdx].sSliceBs; | |
| 455 | + pSliceBs = &ppSliceInlayer[iSliceIdx]->sSliceBs; | |
| 453 | 456 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { |
| 454 | 457 | int32_t iNalIdx = 0; |
| 455 | 458 | const int32_t iCountNal = pSliceBs->iNalIndex; |
| @@ -484,7 +487,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 28 unmodified lines | ||
| 484 | 487 | |
| 485 | 488 | iSliceIdx = iPartitionIdx; |
| 486 | 489 | while (iIdx < kiCountSlicesCoded) { |
| 487 | − pSliceBs = &pSliceInlayer[iSliceIdx].sSliceBs; | |
| 490 | + pSliceBs = &ppSliceInlayer[iSliceIdx]->sSliceBs; | |
| 488 | 491 | if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) { |
| 489 | 492 | memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage |
| 490 | 493 | pCtx->iPosBsBuffer += pSliceBs->uiBsPos; |
| @@ -600,7 +603,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 109 unmodified lines | ||
| 600 | 603 | int64_t iSliceStart = 0; |
| 601 | 604 | bool bDsaFlag = false; |
| 602 | 605 | iSliceIdx = pPrivateData->iSliceIndex; |
| 603 | − pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx]; | |
| 606 | + pSlice = pCurDq->ppSliceInLayer[iSliceIdx]; | |
| 604 | 607 | pSliceBs = &pSlice->sSliceBs; |
| 605 | 608 | |
| 606 | 609 | bDsaFlag = ((pParamD->sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE) && |
| @@ -653,14 +656,14 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 46 unmodified lines | ||
| 653 | 656 | pEncPEncCtx->pFuncList->pfDeblocking.pfDeblockingFilterSlice (pCurDq, pEncPEncCtx->pFuncList, iSliceIdx); |
| 654 | 657 | |
| 655 | 658 | if (bDsaFlag) { |
| 656 | − pEncPEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].uiSliceConsumeTime = (uint32_t) ( | |
| 659 | + pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime = (uint32_t) ( | |
| 657 | 660 | WelsTime() - iSliceStart); |
| 658 | 661 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, |
| 659 | 662 | "[MT] CodingSliceThreadProc(), coding_idx %d, uiSliceIdx %d, uiSliceConsumeTime %d, iSliceSize %d, iFirstMbInSlice %d, count_num_mb_in_slice %d", |
| 660 | 663 | pEncPEncCtx->iCodingIndex, iSliceIdx, |
| 661 | − pEncPEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].uiSliceConsumeTime, iSliceSize, | |
| 662 | − pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, | |
| 663 | − pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].iCountMbNumInSlice); | |
| 664 | + pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime, iSliceSize, | |
| 665 | + pCurDq->ppSliceInLayer[iSliceIdx]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, | |
| 666 | + pCurDq->ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice); | |
| 664 | 667 | } |
| 665 | 668 | |
| 666 | 669 | #if defined(SLICE_INFO_OUTPUT) |
| @@ -690,7 +693,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 23 unmodified lines | ||
| 690 | 693 | int32_t iAnyMbLeftInPartition = kiEndMbInPartition - kiFirstMbInPartition; |
| 691 | 694 | SSpatialLayerInternal* pParamInternal = &pCodingParam->sDependencyLayers[kiCurDid]; |
| 692 | 695 | iSliceIdx = pPrivateData->iSliceIndex; |
| 693 | − SSliceHeaderExt* pStartSliceHeaderExt = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceHeaderExt; | |
| 696 | + SSliceHeaderExt* pStartSliceHeaderExt = &pCurDq->ppSliceInLayer[iSliceIdx]->sSliceHeaderExt; | |
| 694 | 697 | pStartSliceHeaderExt->sSliceHeader.iFirstMbInSlice = kiFirstMbInPartition; |
| 695 | 698 | pCurDq->pNumSliceCodedOfPartition[kiPartitionId] = |
| 696 | 699 | 1; // one pSlice per partition intialized, dynamic slicing inside |
| @@ -712,7 +715,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 15 unmodified lines | ||
| 712 | 715 | } |
| 713 | 716 | |
| 714 | 717 | SetOneSliceBsBufferUnderMultithread (pEncPEncCtx, kiPartitionId, iSliceIdx); |
| 715 | − pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx]; | |
| 718 | + pSlice = pCurDq->ppSliceInLayer[iSliceIdx]; | |
| 716 | 719 | pSliceBs = &pSlice->sSliceBs; |
| 717 | 720 | |
| 718 | 721 | pSliceBs->uiBsPos = 0; |
| @@ -772,7 +775,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 53 unmodified lines | ||
| 772 | 775 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, |
| 773 | 776 | "[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, uiSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n", |
| 774 | 777 | pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize, |
| 775 | − pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].iCountMbNumInSlice, | |
| 778 | + pCurDq->ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, | |
| 776 | 779 | kiEndMbInPartition, kiPartitionId, pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); |
| 777 | 780 | |
| 778 | 781 | iAnyMbLeftInPartition = kiEndMbInPartition - (1 + pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); |
| @@ -840,7 +843,7 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 61 unmodified lines | ||
| 840 | 843 | const int32_t kiEventCnt = uiNumThreads; |
| 841 | 844 | int32_t iLayerBsIdx = pCtx->pOut->iLayerBsIndex; |
| 842 | 845 | SLayerBSInfo* pLbi = &pFrameBsInfo->sLayerInfo[iLayerBsIdx]; |
| 843 | − SSlice* pSliceInLayer = pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer; | |
| 846 | + SSlice** ppSliceInLayer = pCtx->pCurDqLayer->ppSliceInLayer; | |
| 844 | 847 | |
| 845 | 848 | |
| 846 | 849 | if (pPriData == NULL || pFrameBsInfo == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) { |
| @@ -854,7 +857,7 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 7 unmodified lines | ||
| 854 | 857 | if (bIsDynamicSlicingMode) { |
| 855 | 858 | iEndMbIdx = pSliceCtx->iMbNumInFrame; |
| 856 | 859 | for (iIdx = kiEventCnt - 1; iIdx >= 0; --iIdx) { |
| 857 | − const int32_t iFirstMbIdx = pSliceInLayer[iIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; | |
| 860 | + const int32_t iFirstMbIdx = ppSliceInLayer[iIdx]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; | |
| 858 | 861 | pPriData[iIdx].iStartMbIndex = iFirstMbIdx; |
| 859 | 862 | pPriData[iIdx].iEndMbIndex = iEndMbIdx; |
| 860 | 863 | iEndMbIdx = iFirstMbIdx; |
| @@ -897,7 +900,8 @@ int32_t AdjustBaseLayer (sWelsEncCtx* pCtx) { · 36 unmodified lines | ||
| 897 | 900 | pCtx->pCurDqLayer = pCurDq; |
| 898 | 901 | |
| 899 | 902 | // do not need adjust due to not different at both slices of consumed time |
| 900 | − iNeedAdj = NeedDynamicAdjust (pCtx->ppDqLayerList[0]->sLayerInfo.pSliceInLayer, pCurDq->sSliceEncCtx.iSliceNumInFrame); | |
| 903 | + iNeedAdj = NeedDynamicAdjust (pCtx->ppDqLayerList[0]->ppSliceInLayer | |
| 904 | + , pCurDq->sSliceEncCtx.iSliceNumInFrame); | |
| 901 | 905 | if (iNeedAdj) |
| 902 | 906 | DynamicAdjustSlicing (pCtx, |
| 903 | 907 | pCurDq, |
| @@ -929,7 +933,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 25 unmodified lines | ||
| 929 | 933 | |
| 930 | 934 | if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation |
| 931 | 935 | // do not need adjust due to not different at both slices of consumed time |
| 932 | − iNeedAdj = NeedDynamicAdjust (pCtx->ppDqLayerList[iCurDid - 1]->sLayerInfo.pSliceInLayer, | |
| 936 | + iNeedAdj = NeedDynamicAdjust (pCtx->ppDqLayerList[iCurDid - 1]->ppSliceInLayer, | |
| 933 | 937 | pCtx->pCurDqLayer->sSliceEncCtx.iSliceNumInFrame); |
| 934 | 938 | if (iNeedAdj) |
| 935 | 939 | DynamicAdjustSlicing (pCtx, |
| @@ -938,7 +942,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 2 unmodified lines | ||
| 938 | 942 | ); |
| 939 | 943 | } else { // use temporal layer for complexity estimation |
| 940 | 944 | // do not need adjust due to not different at both slices of consumed time |
| 941 | − iNeedAdj = NeedDynamicAdjust (pCtx->ppDqLayerList[iCurDid]->sLayerInfo.pSliceInLayer, | |
| 945 | + iNeedAdj = NeedDynamicAdjust (pCtx->ppDqLayerList[iCurDid]->ppSliceInLayer, | |
| 942 | 946 | pCtx->pCurDqLayer->sSliceEncCtx.iSliceNumInFrame); |
| 943 | 947 | if (iNeedAdj) |
| 944 | 948 | DynamicAdjustSlicing (pCtx, |
| @@ -964,12 +968,12 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 19 unmodified lines | ||
| 964 | 968 | #if defined(MT_DEBUG) |
| 965 | 969 | void TrackSliceComplexities (sWelsEncCtx* pCtx, const int32_t iCurDid) { |
| 966 | 970 | const int32_t kiCountSliceNum = pCtx->pCurDqLayer->sSliceEncCtx.iSliceNumInFrame; |
| 967 | − SSlice* pSliceInLayer = pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer; | |
| 971 | + SSlice** ppSliceInLayer = pCtx->pCurDqLayer->ppSliceInLayer; | |
| 968 | 972 | if (kiCountSliceNum > 0) { |
| 969 | 973 | int32_t iSliceIdx = 0; |
| 970 | 974 | do { |
| 971 | 975 | fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6.3f complexity pRatio at iDid %d pSlice %d\n", |
| 972 | − pSliceInLayer[iSliceIdx].iSliceComplexRatio, iCurDid, iSliceIdx); | |
| 976 | + ppSliceInLayer[iSliceIdx]->iSliceComplexRatio, iCurDid, iSliceIdx); | |
| 973 | 977 | ++ iSliceIdx; |
| 974 | 978 | } while (iSliceIdx < kiCountSliceNum); |
| 975 | 979 | } |
| @@ -987,9 +991,9 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 11 unmodified lines | ||
| 987 | 991 | pPara = pCtx->pSvcParam; |
| 988 | 992 | while (iSpatialIdx < iSpatialNum) { |
| 989 | 993 | const int32_t kiDid = pDidList[iSpatialIdx]; |
| 990 | − SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[kiDid].sSliceArgument; | |
| 994 | + SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[kiDid].sSliceArgument; | |
| 991 | 995 | SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid]; |
| 992 | − SSlice* pSliceInLayer = pCurDq->sLayerInfo.pSliceInLayer; | |
| 996 | + SSlice** ppSliceInLayer = pCurDq->ppSliceInLayer; | |
| 993 | 997 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 994 | 998 | const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame; |
| 995 | 999 | if (pCtx->pSliceThreading) { |
| @@ -1002,9 +1006,9 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 6 unmodified lines | ||
| 1002 | 1006 | int32_t iMaxI = 0; |
| 1003 | 1007 | while (i < kuiCountSliceNum) { |
| 1004 | 1008 | fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n", |
| 1005 | − pSliceInLayer[i].uiSliceConsumeTime, pCtx->iCodingIndex, kiDid, i /*/ 1000*/); | |
| 1006 | − if (pSliceInLayer[i].uiSliceConsumeTime > uiMaxT) { | |
| 1007 | − uiMaxT = pSliceInLayer[i].uiSliceConsumeTime; | |
| 1009 | + ppSliceInLayer[i]->uiSliceConsumeTime, pCtx->iCodingIndex, kiDid, i /*/ 1000*/); | |
| 1010 | + if (ppSliceInLayer[i]->uiSliceConsumeTime > uiMaxT) { | |
| 1011 | + uiMaxT = ppSliceInLayer[i]->uiSliceConsumeTime; | |
| 1008 | 1012 | iMaxI = i; |
| 1009 | 1013 | } |
| 1010 | 1014 | ++ i; |
| @@ -1019,7 +1023,7 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 8 unmodified lines | ||
| 1019 | 1023 | #endif//#if defined(MT_DEBUG) |
| 1020 | 1024 | |
| 1021 | 1025 | void SetOneSliceBsBufferUnderMultithread (sWelsEncCtx* pCtx, const int32_t kiThreadIdx, const int32_t iSliceIdx) { |
| 1022 | − SWelsSliceBs* pSliceBs = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx].sSliceBs; | |
| 1026 | + SWelsSliceBs* pSliceBs = &pCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]->sSliceBs; | |
| 1023 | 1027 | pSliceBs->pBsBuffer = pCtx->pSliceThreading->pThreadBsBuffer[kiThreadIdx]; |
| 1024 | 1028 | pSliceBs->uiBsPos = 0; |
| 1025 | 1029 | } |