Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2899,21 +2899,20 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { · 2898 unmodified lines | |||
| 2899 | return ENC_RETURN_SUCCESS; | 2899 | return ENC_RETURN_SUCCESS; |
| 2900 | } | 2900 | } |
| 2901 | 2901 | ||
| 2902 | int32_t GetSubSequenceId(sWelsEncCtx* pCtx,EVideoFrameType eFrameType){ | 2902 | int32_t GetSubSequenceId (sWelsEncCtx* pCtx, EVideoFrameType eFrameType) { |
| 2903 | int32_t iSubSeqId = 0; | 2903 | int32_t iSubSeqId = 0; |
| 2904 | if(eFrameType == videoFrameTypeIDR ) | 2904 | if (eFrameType == videoFrameTypeIDR) |
| 2905 | iSubSeqId = 0; | 2905 | iSubSeqId = 0; |
| 2906 | else if(eFrameType == videoFrameTypeI) | 2906 | else if (eFrameType == videoFrameTypeI) |
| 2907 | iSubSeqId = 1; | 2907 | iSubSeqId = 1; |
| 2908 | else if (eFrameType == videoFrameTypeP){ | 2908 | else if (eFrameType == videoFrameTypeP) { |
| 2909 | if(pCtx->bCurFrameMarkedAsSceneLtr) | 2909 | if (pCtx->bCurFrameMarkedAsSceneLtr) |
| 2910 | iSubSeqId = 2; | 2910 | iSubSeqId = 2; |
| 2911 | else | 2911 | else |
| 2912 | iSubSeqId = 3 + pCtx->uiTemporalId; //T0:3 T1:4 T2:5 T3:6 | 2912 | iSubSeqId = 3 + pCtx->uiTemporalId; //T0:3 T1:4 T2:5 T3:6 |
| 2913 | } | 2913 | } else |
| 2914 | else | ||
| 2915 | iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM; | 2914 | iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM; |
| 2916 | return iSubSeqId; | 2915 | return iSubSeqId; |
| 2917 | } | 2916 | } |
| 2918 | /*! | 2917 | /*! |
| 2919 | * \brief core svc encoding process | 2918 | * \brief core svc encoding process |
| @@ -3556,7 +3555,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 636 unmodified lines | |||
| 3556 | ++ pCtx->iCodingIndex; | 3555 | ++ pCtx->iCodingIndex; |
| 3557 | pCtx->eLastNalPriority = eNalRefIdc; | 3556 | pCtx->eLastNalPriority = eNalRefIdc; |
| 3558 | pFbi->iLayerNum = iLayerNum; | 3557 | pFbi->iLayerNum = iLayerNum; |
| 3559 | pFbi->iSubSeqId = GetSubSequenceId(pCtx,eFrameType); | 3558 | pFbi->iSubSeqId = GetSubSequenceId (pCtx, eFrameType); |
| 3560 | WelsEmms(); | 3559 | WelsEmms(); |
| 3561 | 3560 | ||
| 3562 | pFbi->eFrameType = eFrameType; | 3561 | pFbi->eFrameType = eFrameType; |
| @@ -3817,12 +3816,13 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 254 unmodified lines | |||
| 3817 | int16_t* pFirstMbInSlice = (int16_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int16_t), "pSliceSeg->pFirstMbInSlice"); | 3816 | int16_t* pFirstMbInSlice = (int16_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int16_t), "pSliceSeg->pFirstMbInSlice"); |
| 3818 | if (NULL == pFirstMbInSlice) | 3817 | if (NULL == pFirstMbInSlice) |
| 3819 | return ENC_RETURN_MEMALLOCERR; | 3818 | return ENC_RETURN_MEMALLOCERR; |
| 3820 | memset(pFirstMbInSlice, 0, sizeof(int16_t) * iMaxSliceNum); | 3819 | memset (pFirstMbInSlice, 0, sizeof (int16_t) * iMaxSliceNum); |
| 3821 | memcpy (pFirstMbInSlice, pCurLayer->pSliceEncCtx->pFirstMbInSlice, sizeof (int16_t) * iMaxSliceNumOld); | 3820 | memcpy (pFirstMbInSlice, pCurLayer->pSliceEncCtx->pFirstMbInSlice, sizeof (int16_t) * iMaxSliceNumOld); |
| 3822 | pMA->WelsFree (pCurLayer->pSliceEncCtx->pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice"); | 3821 | pMA->WelsFree (pCurLayer->pSliceEncCtx->pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice"); |
| 3823 | pCurLayer->pSliceEncCtx->pFirstMbInSlice = pFirstMbInSlice; | 3822 | pCurLayer->pSliceEncCtx->pFirstMbInSlice = pFirstMbInSlice; |
| 3824 | 3823 | ||
| 3825 | int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),"pSliceSeg->pCountMbNumInSlice"); | 3824 | int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t), |
| 3825 | "pSliceSeg->pCountMbNumInSlice"); | ||
| 3826 | if (NULL == pCountMbNumInSlice) | 3826 | if (NULL == pCountMbNumInSlice) |
| 3827 | return ENC_RETURN_MEMALLOCERR; | 3827 | return ENC_RETURN_MEMALLOCERR; |
| 3828 | memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld); | 3828 | memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld); |
| @@ -3840,13 +3840,15 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 11 unmodified lines | |||
| 3840 | memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld); | 3840 | memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld); |
| 3841 | uiSliceIdx = iMaxSliceNumOld; | 3841 | uiSliceIdx = iMaxSliceNumOld; |
| 3842 | SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx]; | 3842 | SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx]; |
| 3843 | const int32_t kiBitsPerMb = WELS_DIV_ROUND(pCtx->pWelsSvcRc->iTargetBits * INT_MULTIPLY, pCtx->pWelsSvcRc->iNumberMbFrame); | 3843 | const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc->iTargetBits * INT_MULTIPLY, |
| 3844 | pCtx->pWelsSvcRc->iNumberMbFrame); | ||
| 3844 | while (uiSliceIdx < iMaxSliceNum) { | 3845 | while (uiSliceIdx < iMaxSliceNum) { |
| 3845 | pSORC->iComplexityIndexSlice = 0; | 3846 | pSORC->iComplexityIndexSlice = 0; |
| 3846 | pSORC->iCalculatedQpSlice = pCtx->iGlobalQp; | 3847 | pSORC->iCalculatedQpSlice = pCtx->iGlobalQp; |
| 3847 | pSORC->iTotalQpSlice = 0; | 3848 | pSORC->iTotalQpSlice = 0; |
| 3848 | pSORC->iTotalMbSlice = 0; | 3849 | pSORC->iTotalMbSlice = 0; |
| 3849 | pSORC->iTargetBitsSlice = WELS_DIV_ROUND(kiBitsPerMb * pCurLayer->pSliceEncCtx->pCountMbNumInSlice[uiSliceIdx], INT_MULTIPLY); | 3850 | pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->pSliceEncCtx->pCountMbNumInSlice[uiSliceIdx], |
| 3851 | INT_MULTIPLY); | ||
| 3850 | pSORC->iFrameBitsSlice = 0; | 3852 | pSORC->iFrameBitsSlice = 0; |
| 3851 | pSORC->iGomBitsSlice = 0; | 3853 | pSORC->iGomBitsSlice = 0; |
| 3852 | pSORC ++; | 3854 | pSORC ++; |