Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 3 files). Show all
Unified · Split
| @@ -761,6 +761,35 @@ void FreeMbCache (SMbCache* pMbCache, CMemoryAlign* pMa) { · 760 unmodified lines | ||
| 761 | 761 | } |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | +int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex, | |
| 765 | + const int32_t iDlayerCount, const int32_t kiSpsId, | |
| 766 | + SWelsSPS*& pSps, SSubsetSps*& pSubsetSps) { | |
| 767 | + int32_t iRet = 0; | |
| 768 | + | |
| 769 | + if (!kbUseSubsetSps) { | |
| 770 | + pSps = & (pCtx->pSpsArray[kiSpsId]); | |
| 771 | + } else { | |
| 772 | + pSubsetSps = & (pCtx->pSubsetArray[kiSpsId]); | |
| 773 | + pSps = &pSubsetSps->pSps; | |
| 774 | + } | |
| 775 | + | |
| 776 | + SWelsSvcCodingParam* pParam = pCtx->pSvcParam; | |
| 777 | + SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; | |
| 778 | + // Need port pSps/pPps initialization due to spatial scalability changed | |
| 779 | + if (!kbUseSubsetSps) { | |
| 780 | + iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | |
| 781 | + pParam->iMaxNumRefFrame, | |
| 782 | + kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount); | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + } else { | |
| 787 | + iRet = WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | |
| 788 | + pParam->iMaxNumRefFrame, | |
| 789 | + kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | |
| 790 | + } | |
| 791 | + return iRet; | |
| 792 | +} | |
| 764 | 793 | |
| 765 | 794 | /*! |
| 766 | 795 | * \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available |
| @@ -950,35 +979,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 183 unmodified lines | ||
| 950 | 979 | SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; |
| 951 | 980 | |
| 952 | 981 | pDqIdc->uiSpatialId = iDlayerIndex; |
| 953 | − pPps = & (*ppCtx)->pPPSArray[iPpsId]; | |
| 954 | − if (!bUseSubsetSps) { | |
| 955 | − pSps = & (*ppCtx)->pSpsArray[iSpsId]; | |
| 956 | − } else { | |
| 957 | − pSubsetSps = & (*ppCtx)->pSubsetArray[iSpsId]; | |
| 958 | − pSps = &pSubsetSps->pSps; | |
| 959 | − } | |
| 960 | 982 | |
| 961 | − // Need port pSps/pPps initialization due to spatial scalability changed | |
| 962 | − if (!bUseSubsetSps) { | |
| 963 | − WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | |
| 964 | − pParam->iMaxNumRefFrame, | |
| 965 | − iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | |
| 966 | − | |
| 967 | − if (pDlayerParam->uiProfileIdc == PRO_BASELINE) { | |
| 968 | − pSps->bConstraintSet0Flag = true; | |
| 969 | − } | |
| 970 | − if (pDlayerParam->uiProfileIdc <= PRO_MAIN) { | |
| 971 | − pSps->bConstraintSet1Flag = true; | |
| 972 | − } | |
| 973 | − if (iDlayerCount > 1) { | |
| 974 | − pSps->bConstraintSet2Flag = true; | |
| 975 | − } | |
| 976 | − } else { | |
| 977 | − WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | |
| 978 | − pParam->iMaxNumRefFrame, | |
| 979 | − iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | |
| 980 | − } | |
| 983 | + WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex, | |
| 984 | + iDlayerCount, iSpsId, pSps, pSubsetSps); | |
| 981 | 985 | |
| 986 | + pPps = & (*ppCtx)->pPPSArray[iPpsId]; | |
| 982 | 987 | // initialize pPps |
| 983 | 988 | WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps, pParam->iEntropyCodingModeFlag != 0); |
| 984 | 989 | |