Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 5 files). Show all
Unified · Split
| @@ -3670,7 +3670,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3669 unmodified lines | |||
| 3670 | if (SM_SINGLE_SLICE == pParam->sSliceArgument.uiSliceMode) { // only one slice within a sQualityStat layer | 3670 | if (SM_SINGLE_SLICE == pParam->sSliceArgument.uiSliceMode) { // only one slice within a sQualityStat layer |
| 3671 | int32_t iSliceSize = 0; | 3671 | int32_t iSliceSize = 0; |
| 3672 | int32_t iPayloadSize = 0; | 3672 | int32_t iPayloadSize = 0; |
| 3673 | SSlice* pCurSlice = pCtx->pCurDqLayer->ppSliceInLayer[0]; | 3673 | uint32_t uiTheadIdx = 0; |
| 3674 | SSlice* pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][0]; | ||
| 3674 | 3675 | ||
| 3675 | if (pCtx->bNeedPrefixNalFlag) { | 3676 | if (pCtx->bNeedPrefixNalFlag) { |
| 3676 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, | 3677 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, |
| @@ -3808,13 +3809,16 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 131 unmodified lines | |||
| 3808 | iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, kiPartitionCnt); | 3809 | iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, kiPartitionCnt); |
| 3809 | } else { // for non-dynamic-slicing mode single threading branch.. | 3810 | } else { // for non-dynamic-slicing mode single threading branch.. |
| 3810 | const bool bNeedPrefix = pCtx->bNeedPrefixNalFlag; | 3811 | const bool bNeedPrefix = pCtx->bNeedPrefixNalFlag; |
| 3811 | int32_t iSliceIdx = 0; | 3812 | |
| 3812 | SSlice* pCurSlice = NULL; | 3813 | int32_t iSliceIdx = 0; |
| 3814 | uint32_t uiTheadIdx = 0; | ||
| 3815 | SSlice* pCurSlice = NULL; | ||
| 3813 | 3816 | ||
| 3814 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer); | 3817 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer); |
| 3815 | while (iSliceIdx < iSliceCount) { | 3818 | while (iSliceIdx < iSliceCount) { |
| 3816 | int32_t iSliceSize = 0; | 3819 | int32_t iSliceSize = 0; |
| 3817 | int32_t iPayloadSize = 0; | 3820 | int32_t iPayloadSize = 0; |
| 3821 | |||
| 3818 | if (bNeedPrefix) { | 3822 | if (bNeedPrefix) { |
| 3819 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, | 3823 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, |
| 3820 | eNalRefIdc, | 3824 | eNalRefIdc, |
| @@ -3824,7 +3828,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines | |||
| 3824 | } | 3828 | } |
| 3825 | 3829 | ||
| 3826 | WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc); | 3830 | WelsLoadNal (pCtx->pOut, eNalType, eNalRefIdc); |
| 3827 | pCurSlice = pCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]; | 3831 | |
| 3832 | pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx]; | ||
| 3828 | assert (iSliceIdx == (int) pCurSlice->uiSliceIdx); | 3833 | assert (iSliceIdx == (int) pCurSlice->uiSliceIdx); |
| 3829 | pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, iSliceIdx); | 3834 | pCtx->iEncoderError = SetSliceBoundaryInfo(pCtx->pCurDqLayer, pCurSlice, iSliceIdx); |
| 3830 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3835 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| @@ -4516,7 +4521,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 685 unmodified lines | |||
| 4516 | ) { | 4521 | ) { |
| 4517 | 4522 | ||
| 4518 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; | 4523 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 4519 | SSlice* pStartSlice = pCurLayer->ppSliceInLayer[iStartSliceIdx]; | 4524 | uint32_t uiTheadIdx = 0; |
| 4525 | SSlice* pStartSlice = &pCurLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iStartSliceIdx]; | ||
| 4520 | int32_t iNalIdxInLayer = *pNalIdxInLayer; | 4526 | int32_t iNalIdxInLayer = *pNalIdxInLayer; |
| 4521 | int32_t iSliceIdx = iStartSliceIdx; | 4527 | int32_t iSliceIdx = iStartSliceIdx; |
| 4522 | const int32_t kiSliceStep = pCtx->iActiveThreadsNum; | 4528 | const int32_t kiSliceStep = pCtx->iActiveThreadsNum; |
| @@ -4529,6 +4535,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 6 unmodified lines | |||
| 4529 | const int32_t kiSliceIdxStep = pCtx->iActiveThreadsNum; | 4535 | const int32_t kiSliceIdxStep = pCtx->iActiveThreadsNum; |
| 4530 | int32_t iReturn = ENC_RETURN_SUCCESS; | 4536 | int32_t iReturn = ENC_RETURN_SUCCESS; |
| 4531 | 4537 | ||
| 4538 | |||
| 4532 | //init | 4539 | //init |
| 4533 | { | 4540 | { |
| 4534 | pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = iFirstMbIdxInPartition; | 4541 | pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = iFirstMbIdxInPartition; |
| @@ -4565,8 +4572,10 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 30 unmodified lines | |||
| 4565 | } | 4572 | } |
| 4566 | 4573 | ||
| 4567 | WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc); | 4574 | WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc); |
| 4568 | pCurSlice = pCtx->pCurDqLayer->ppSliceInLayer[iSliceIdx]; | 4575 | |
| 4576 | pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx]; | ||
| 4569 | assert (iSliceIdx == (int) pCurSlice->uiSliceIdx); | 4577 | assert (iSliceIdx == (int) pCurSlice->uiSliceIdx); |
| 4578 | |||
| 4570 | iReturn = WelsCodeOneSlice (pCtx, pCurSlice, keNalType); | 4579 | iReturn = WelsCodeOneSlice (pCtx, pCurSlice, keNalType); |
| 4571 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) | 4580 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 4572 | WelsUnloadNal (pCtx->pOut); | 4581 | WelsUnloadNal (pCtx->pOut); |