Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 5 files). Show all
Unified · Split
| @@ -603,9 +603,9 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 602 unmodified lines | ||
| 603 | 603 | if (pParamD->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE) { |
| 604 | 604 | int64_t iSliceStart = 0; |
| 605 | 605 | bool bDsaFlag = false; |
| 606 | − iSliceIdx = pPrivateData->iSliceIndex; | |
| 607 | − pSlice = pCurDq->ppSliceInLayer[iSliceIdx]; | |
| 608 | − pSliceBs = &pSlice->sSliceBs; | |
| 606 | + iSliceIdx = pPrivateData->iSliceIndex; | |
| 607 | + pSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[iThreadIdx][iSliceIdx]; | |
| 608 | + pSliceBs = &pSlice->sSliceBs; | |
| 609 | 609 | |
| 610 | 610 | bDsaFlag = ((pParamD->sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE) && |
| 611 | 611 | pCodingParam->iMultipleThreadIdc > 1 && |
| @@ -645,7 +645,16 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 33 unmodified lines | ||
| 645 | 645 | iEventIdx); |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | − iReturn = WelsCodeOneSlice (pEncPEncCtx, pCurSlice, eNalType); | |
| 648 | + iReturn = SetSliceBoundaryInfo(pEncPEncCtx->pCurDqLayer, pSlice, iSliceIdx); | |
| 649 | + if (ENC_RETURN_SUCCESS != iReturn) { | |
| 650 | + uiThrdRet = iReturn; | |
| 651 | + WELS_THREAD_SIGNAL_AND_BREAK (pEncPEncCtx->pSliceThreading->pSliceCodedEvent, | |
| 652 | + pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent, | |
| 653 | + iEventIdx); | |
| 654 | + } | |
| 655 | + | |
| 656 | + assert (iSliceIdx == (int) pSlice->uiSliceIdx); | |
| 657 | + iReturn = WelsCodeOneSlice (pEncPEncCtx, pSlice, eNalType); | |
| 649 | 658 | if (ENC_RETURN_SUCCESS != iReturn) { |
| 650 | 659 | uiThrdRet = iReturn; |
| 651 | 660 | WELS_THREAD_SIGNAL_AND_BREAK (pEncPEncCtx->pSliceThreading->pSliceCodedEvent, |
| @@ -666,14 +675,13 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 14 unmodified lines | ||
| 666 | 675 | pEncPEncCtx->pFuncList->pfDeblocking.pfDeblockingFilterSlice (pCurDq, pEncPEncCtx->pFuncList, iSliceIdx); |
| 667 | 676 | |
| 668 | 677 | if (bDsaFlag) { |
| 669 | − pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime = (uint32_t) ( | |
| 670 | − WelsTime() - iSliceStart); | |
| 678 | + pSlice->uiSliceConsumeTime = (uint32_t) (WelsTime() - iSliceStart); | |
| 671 | 679 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, |
| 672 | 680 | "[MT] CodingSliceThreadProc(), coding_idx %d, uiSliceIdx %d, uiSliceConsumeTime %d, iSliceSize %d, iFirstMbInSlice %d, count_num_mb_in_slice %d", |
| 673 | 681 | pEncPEncCtx->iCodingIndex, iSliceIdx, |
| 674 | − pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]->uiSliceConsumeTime, iSliceSize, | |
| 675 | − pCurDq->ppSliceInLayer[iSliceIdx]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, | |
| 676 | − pCurDq->ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice); | |
| 682 | + pSlice->uiSliceConsumeTime, iSliceSize, | |
| 683 | + pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice, | |
| 684 | + pSlice->iCountMbNumInSlice); | |
| 677 | 685 | } |
| 678 | 686 | |
| 679 | 687 | #if defined(SLICE_INFO_OUTPUT) |
| @@ -701,11 +709,11 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 21 unmodified lines | ||
| 701 | 709 | const int32_t kiEndMbIdxInPartition = pCurDq->pEndMbIdxOfPartition[kiPartitionId]; |
| 702 | 710 | int32_t iAnyMbLeftInPartition = kiEndMbIdxInPartition - kiFirstMbInPartition + 1; |
| 703 | 711 | SSpatialLayerInternal *pParamInternal = &pCodingParam->sDependencyLayers[kiCurDid]; |
| 704 | − iSliceIdx = pPrivateData->iSliceIndex; | |
| 705 | − SSliceHeaderExt* pStartSliceHeaderExt = &pCurDq->ppSliceInLayer[iSliceIdx]->sSliceHeaderExt; | |
| 706 | − pStartSliceHeaderExt->sSliceHeader.iFirstMbInSlice = kiFirstMbInPartition; | |
| 707 | − pCurDq->pNumSliceCodedOfPartition[kiPartitionId] = 1; | |
| 708 | − pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId] = 0; | |
| 712 | + iSliceIdx = pPrivateData->iSliceIndex; | |
| 713 | + SSlice* pStartSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[iThreadIdx][iSliceIdx]; | |
| 714 | + pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = kiFirstMbInPartition; | |
| 715 | + pCurDq->pNumSliceCodedOfPartition[kiPartitionId] = 1; | |
| 716 | + pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId] = 0; | |
| 709 | 717 | |
| 710 | 718 | while (iAnyMbLeftInPartition > 0) { |
| 711 | 719 | if (iSliceIdx >= pCurDq->iMaxSliceNum) { |
| @@ -720,8 +728,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 8 unmodified lines | ||
| 720 | 728 | pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent, |
| 721 | 729 | iEventIdx); |
| 722 | 730 | } |
| 723 | − | |
| 724 | − pSlice = pCurDq->ppSliceInLayer[iSliceIdx]; | |
| 731 | + pSlice = &pCurDq->sSliceThreadInfo.pSliceInThread[iThreadIdx][iSliceIdx]; | |
| 725 | 732 | pSliceBs = &pSlice->sSliceBs; |
| 726 | 733 | pSliceBs->uiBsPos = 0; |
| 727 | 734 | pSliceBs->iNalIndex = 0; |
| @@ -741,11 +748,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 13 unmodified lines | ||
| 741 | 748 | } |
| 742 | 749 | } |
| 743 | 750 | |
| 744 | − | |
| 745 | 751 | WelsLoadNalForSlice (pSliceBs, eNalType, eNalRefIdc); |
| 746 | − pCurSlice = pEncPEncCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]; | |
| 747 | − assert (iSliceIdx == (int) pCurSlice->uiSliceIdx); | |
| 748 | − iReturn = WelsCodeOneSlice (pEncPEncCtx, pCurSlice, eNalType); | |
| 752 | + | |
| 753 | + assert (iSliceIdx == (int) pSlice->uiSliceIdx); | |
| 754 | + iReturn = WelsCodeOneSlice (pEncPEncCtx, pSlice, eNalType); | |
| 749 | 755 | if (ENC_RETURN_SUCCESS != iReturn) { |
| 750 | 756 | uiThrdRet = iReturn; |
| 751 | 757 | WELS_THREAD_SIGNAL_AND_BREAK (pEncPEncCtx->pSliceThreading->pSliceCodedEvent, |
| @@ -783,7 +789,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 31 unmodified lines | ||
| 783 | 789 | MT_TRACE_LOG (& (pEncPEncCtx->sLogCtx), WELS_LOG_INFO, |
| 784 | 790 | "[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, uiSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n", |
| 785 | 791 | pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize, |
| 786 | − pCurDq->ppSliceInLayer[iSliceIdx]->iCountMbNumInSlice, | |
| 792 | + pSlice->iCountMbNumInSlice, | |
| 787 | 793 | kiEndMbIdxInPartition, kiPartitionId, pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]); |
| 788 | 794 | |
| 789 | 795 | iAnyMbLeftInPartition = kiEndMbIdxInPartition - pCurDq->pLastCodedMbIdxOfPartition[kiPartitionId]; |