Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 7 files). Show all
Unified · Split
| @@ -898,7 +898,7 @@ void FreeMbCache (SMbCache* pMbCache, CMemoryAlign* pMa) { · 897 unmodified lines | |||
| 898 | 898 | ||
| 899 | static int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex, | 899 | static int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex, |
| 900 | const int32_t iDlayerCount, const int32_t kiSpsId, | 900 | const int32_t iDlayerCount, const int32_t kiSpsId, |
| 901 | SWelsSPS*& pSps, SSubsetSps*& pSubsetSps) { | 901 | SWelsSPS*& pSps, SSubsetSps*& pSubsetSps, bool bSVCBaselayer) { |
| 902 | int32_t iRet = 0; | 902 | int32_t iRet = 0; |
| 903 | 903 | ||
| 904 | if (!kbUseSubsetSps) { | 904 | if (!kbUseSubsetSps) { |
| @@ -914,11 +914,12 @@ static int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, · 9 unmodified lines | |||
| 914 | if (!kbUseSubsetSps) { | 914 | if (!kbUseSubsetSps) { |
| 915 | iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | 915 | iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, |
| 916 | pParam->iMaxNumRefFrame, | 916 | pParam->iMaxNumRefFrame, |
| 917 | kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount); | 917 | kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount, |
| 918 | bSVCBaselayer); | ||
| 918 | } else { | 919 | } else { |
| 919 | iRet = WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | 920 | iRet = WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, |
| 920 | pParam->iMaxNumRefFrame, | 921 | pParam->iMaxNumRefFrame, |
| 921 | kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | 922 | kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount); |
| 922 | } | 923 | } |
| 923 | return iRet; | 924 | return iRet; |
| 924 | } | 925 | } |
| @@ -978,7 +979,7 @@ static bool CheckMatchedSubsetSps (SSubsetSps* const pSubsetSps1, SSubsetSps* co · 53 unmodified lines | |||
| 978 | int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, const int32_t iDlayerIndex, | 979 | int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, const int32_t iDlayerIndex, |
| 979 | const int32_t iDlayerCount, const int32_t iSpsNumInUse, | 980 | const int32_t iDlayerCount, const int32_t iSpsNumInUse, |
| 980 | SWelsSPS* pSpsArray, | 981 | SWelsSPS* pSpsArray, |
| 981 | SSubsetSps* pSubsetArray) { | 982 | SSubsetSps* pSubsetArray, bool bSVCBaseLayer) { |
| 982 | SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; | 983 | SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; |
| 983 | 984 | ||
| 984 | assert (iSpsNumInUse <= MAX_SPS_COUNT); | 985 | assert (iSpsNumInUse <= MAX_SPS_COUNT); |
| @@ -986,7 +987,8 @@ int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, · 1 unmodified line | |||
| 986 | SWelsSPS sTmpSps; | 987 | SWelsSPS sTmpSps; |
| 987 | WelsInitSps (&sTmpSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | 988 | WelsInitSps (&sTmpSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, |
| 988 | pParam->iMaxNumRefFrame, | 989 | pParam->iMaxNumRefFrame, |
| 989 | 0, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount); | 990 | 0, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount, |
| 991 | bSVCBaseLayer); | ||
| 990 | for (int32_t iId = 0; iId < iSpsNumInUse; iId++) { | 992 | for (int32_t iId = 0; iId < iSpsNumInUse; iId++) { |
| 991 | if (CheckMatchedSps (&sTmpSps, &pSpsArray[iId])) { | 993 | if (CheckMatchedSps (&sTmpSps, &pSpsArray[iId])) { |
| 992 | return iId; | 994 | return iId; |
| @@ -996,7 +998,7 @@ int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, · 3 unmodified lines | |||
| 996 | SSubsetSps sTmpSubsetSps; | 998 | SSubsetSps sTmpSubsetSps; |
| 997 | WelsInitSubsetSps (&sTmpSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, | 999 | WelsInitSubsetSps (&sTmpSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, |
| 998 | pParam->iMaxNumRefFrame, | 1000 | pParam->iMaxNumRefFrame, |
| 999 | 0, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE); | 1001 | 0, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount); |
| 1000 | 1002 | ||
| 1001 | for (int32_t iId = 0; iId < iSpsNumInUse; iId++) { | 1003 | for (int32_t iId = 0; iId < iSpsNumInUse; iId++) { |
| 1002 | if (CheckMatchedSubsetSps (&sTmpSubsetSps, &pSubsetArray[iId])) { | 1004 | if (CheckMatchedSubsetSps (&sTmpSubsetSps, &pSubsetArray[iId])) { |
| @@ -1258,19 +1260,20 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 255 unmodified lines | |||
| 1258 | SDqIdc* pDqIdc = & (*ppCtx)->pDqIdcMap[iDlayerIndex]; | 1260 | SDqIdc* pDqIdc = & (*ppCtx)->pDqIdcMap[iDlayerIndex]; |
| 1259 | const bool bUseSubsetSps = (!pParam->bSimulcastAVC) && (iDlayerIndex > BASE_DEPENDENCY_ID); | 1261 | const bool bUseSubsetSps = (!pParam->bSimulcastAVC) && (iDlayerIndex > BASE_DEPENDENCY_ID); |
| 1260 | SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; | 1262 | SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex]; |
| 1261 | 1263 | bool bSvcBaselayer = (!pParam->bSimulcastAVC) && (iDlayerCount > BASE_DEPENDENCY_ID) | |
| 1264 | && (iDlayerIndex == BASE_DEPENDENCY_ID); | ||
| 1262 | pDqIdc->uiSpatialId = iDlayerIndex; | 1265 | pDqIdc->uiSpatialId = iDlayerIndex; |
| 1263 | 1266 | ||
| 1264 | if (! (SPS_LISTING & pParam->eSpsPpsIdStrategy)) { | 1267 | if (! (SPS_LISTING & pParam->eSpsPpsIdStrategy)) { |
| 1265 | WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex, | 1268 | WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex, |
| 1266 | iDlayerCount, iSpsId, pSps, pSubsetSps); | 1269 | iDlayerCount, iSpsId, pSps, pSubsetSps, bSvcBaselayer); |
| 1267 | } else { | 1270 | } else { |
| 1268 | //SPS_LISTING_AND_PPS_INCREASING == pParam->eSpsPpsIdStrategy | 1271 | //SPS_LISTING_AND_PPS_INCREASING == pParam->eSpsPpsIdStrategy |
| 1269 | //check if the current param can fit in an existing SPS | 1272 | //check if the current param can fit in an existing SPS |
| 1270 | const int32_t kiFoundSpsId = FindExistingSps ((*ppCtx)->pSvcParam, bUseSubsetSps, iDlayerIndex, iDlayerCount, | 1273 | const int32_t kiFoundSpsId = FindExistingSps ((*ppCtx)->pSvcParam, bUseSubsetSps, iDlayerIndex, iDlayerCount, |
| 1271 | bUseSubsetSps ? ((*ppCtx)->sPSOVector.uiInUseSubsetSpsNum) : ((*ppCtx)->sPSOVector.uiInUseSpsNum), | 1274 | bUseSubsetSps ? ((*ppCtx)->sPSOVector.uiInUseSubsetSpsNum) : ((*ppCtx)->sPSOVector.uiInUseSpsNum), |
| 1272 | (*ppCtx)->pSpsArray, | 1275 | (*ppCtx)->pSpsArray, |
| 1273 | (*ppCtx)->pSubsetArray); | 1276 | (*ppCtx)->pSubsetArray, bSvcBaselayer); |
| 1274 | 1277 | ||
| 1275 | 1278 | ||
| 1276 | if (INVALID_ID != kiFoundSpsId) { | 1279 | if (INVALID_ID != kiFoundSpsId) { |
| @@ -1309,7 +1312,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 32 unmodified lines | |||
| 1309 | } | 1312 | } |
| 1310 | 1313 | ||
| 1311 | WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex, | 1314 | WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex, |
| 1312 | iDlayerCount, iSpsId, pSps, pSubsetSps); | 1315 | iDlayerCount, iSpsId, pSps, pSubsetSps, bSvcBaselayer); |
| 1313 | } | 1316 | } |
| 1314 | } | 1317 | } |
| 1315 | 1318 | ||