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