[Encoder] fix the lack of eSpsPpsIdStrategy==INCREASING_ID under simulcast avc on
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 2 files). Show all
Unified · Split
| @@ -3205,6 +3205,21 @@ void UpdatePpsList (sWelsEncCtx* pCtx) { · 3204 unmodified lines | ||
| 3205 | 3205 | |
| 3206 | 3206 | } |
| 3207 | 3207 | |
| 3208 | +void UpdateSpsPpsIdStrategyWithIncreasingId (SParaSetOffset* pPSOVector, const uint32_t kuiId, const int iParasetType) { | |
| 3209 | +#if _DEBUG | |
| 3210 | + pPSOVector->eSpsPpsIdStrategy = INCREASING_ID; | |
| 3211 | + assert (iIdx < MAX_DQ_LAYER_NUM); | |
| 3212 | +#endif | |
| 3213 | + | |
| 3214 | + ParasetIdAdditionIdAdjust (& (pPSOVector->sParaSetOffsetVariable[iParasetType]), | |
| 3215 | + kuiId, | |
| 3216 | + (iParasetType != PARA_SET_TYPE_PPS) ? MAX_SPS_COUNT : MAX_PPS_COUNT); | |
| 3217 | +} | |
| 3218 | + | |
| 3219 | +void UpdateSpsPpsIdStrategyWithConstantId (SParaSetOffset* pPSOVector, const uint32_t kuiId, const int iParasetType) { | |
| 3220 | + memset (pPSOVector, 0, sizeof (SParaSetOffset)); | |
| 3221 | +} | |
| 3222 | + | |
| 3208 | 3223 | /*! |
| 3209 | 3224 | * \brief write all parameter sets introduced in SVC extension |
| 3210 | 3225 | * \return writing results, success or error |
| @@ -3227,16 +3242,9 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 16 unmodified lines | ||
| 3227 | 3242 | while (iIdx < pCtx->iSpsNum) { |
| 3228 | 3243 | // TODO (Sijia) wrap different operation of eSpsPpsIdStrategy to classes to hide the details |
| 3229 | 3244 | if (INCREASING_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { |
| 3230 | −#if _DEBUG | |
| 3231 | − pCtx->sPSOVector.eSpsPpsIdStrategy = INCREASING_ID; | |
| 3232 | − assert (iIdx < MAX_DQ_LAYER_NUM); | |
| 3233 | −#endif | |
| 3234 | − | |
| 3235 | − ParasetIdAdditionIdAdjust (& (pCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_AVCSPS]), | |
| 3236 | − pCtx->pSpsArray[0].uiSpsId, | |
| 3237 | − MAX_SPS_COUNT); | |
| 3245 | + UpdateSpsPpsIdStrategyWithIncreasingId (& (pCtx->sPSOVector), pCtx->pSpsArray[0].uiSpsId, PARA_SET_TYPE_AVCSPS); | |
| 3238 | 3246 | } else if (CONSTANT_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { |
| 3239 | − memset (& (pCtx->sPSOVector), 0, sizeof (pCtx->sPSOVector)); | |
| 3247 | + UpdateSpsPpsIdStrategyWithConstantId (& (pCtx->sPSOVector), pCtx->pSpsArray[0].uiSpsId, PARA_SET_TYPE_AVCSPS); | |
| 3240 | 3248 | } |
| 3241 | 3249 | |
| 3242 | 3250 | /* generate sequence parameters set */ |
| @@ -3257,16 +3265,10 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 14 unmodified lines | ||
| 3257 | 3265 | iNal = pCtx->pOut->iNalIndex; |
| 3258 | 3266 | |
| 3259 | 3267 | if (INCREASING_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { |
| 3260 | −#if _DEBUG | |
| 3261 | − pCtx->sPSOVector.eSpsPpsIdStrategy = INCREASING_ID; | |
| 3262 | − assert (iIdx < MAX_DQ_LAYER_NUM); | |
| 3263 | −#endif | |
| 3264 | − | |
| 3265 | − ParasetIdAdditionIdAdjust (& (pCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_SUBSETSPS]), | |
| 3266 | − pCtx->pSubsetArray[iIdx].pSps.uiSpsId, | |
| 3267 | − MAX_SPS_COUNT); | |
| 3268 | + UpdateSpsPpsIdStrategyWithIncreasingId (& (pCtx->sPSOVector), pCtx->pSubsetArray[iIdx].pSps.uiSpsId, PARA_SET_TYPE_SUBSETSPS); | |
| 3268 | 3269 | } |
| 3269 | 3270 | |
| 3271 | + | |
| 3270 | 3272 | iId = iIdx; |
| 3271 | 3273 | |
| 3272 | 3274 | /* generate Subset SPS */ |
| @@ -3298,9 +3300,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 25 unmodified lines | ||
| 3298 | 3300 | iIdx = 0; |
| 3299 | 3301 | while (iIdx < pCtx->iPpsNum) { |
| 3300 | 3302 | if ((INCREASING_ID & pCtx->pSvcParam->eSpsPpsIdStrategy)) { |
| 3301 | − //para_set_type = 2: PPS, use MAX_PPS_COUNT | |
| 3302 | − ParasetIdAdditionIdAdjust (&pCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_PPS], pCtx->pPPSArray[iIdx].iPpsId, | |
| 3303 | − MAX_PPS_COUNT); | |
| 3303 | + UpdateSpsPpsIdStrategyWithIncreasingId (& (pCtx->sPSOVector), pCtx->pPPSArray[iIdx].iPpsId, PARA_SET_TYPE_PPS); | |
| 3304 | 3304 | } |
| 3305 | 3305 | |
| 3306 | 3306 | WelsWriteOnePPS (pCtx, iIdx, iNalLength); |
| @@ -3515,6 +3515,12 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t iIdx, · 208 unmodified lines | ||
| 3515 | 3515 | int32_t iNalSize = 0; |
| 3516 | 3516 | iCountNal = 0; |
| 3517 | 3517 | |
| 3518 | + if (INCREASING_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { | |
| 3519 | + UpdateSpsPpsIdStrategyWithIncreasingId (& (pCtx->sPSOVector), pCtx->pSpsArray[iIdx].uiSpsId, PARA_SET_TYPE_AVCSPS); | |
| 3520 | + } else if (CONSTANT_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { | |
| 3521 | + UpdateSpsPpsIdStrategyWithConstantId (& (pCtx->sPSOVector), pCtx->pSpsArray[iIdx].uiSpsId, PARA_SET_TYPE_AVCSPS); | |
| 3522 | + } | |
| 3523 | + | |
| 3518 | 3524 | iReturn = WelsWriteOneSPS (pCtx, iIdx, iNalSize); |
| 3519 | 3525 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 3520 | 3526 | |
| @@ -3546,6 +3552,12 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t iIdx, · 25 unmodified lines | ||
| 3546 | 3552 | iNalSize = 0; |
| 3547 | 3553 | iCountNal = 0; |
| 3548 | 3554 | |
| 3555 | + if (INCREASING_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { | |
| 3556 | + UpdateSpsPpsIdStrategyWithIncreasingId (& (pCtx->sPSOVector), pCtx->pPPSArray[iIdx].iPpsId, PARA_SET_TYPE_PPS); | |
| 3557 | + } else if (CONSTANT_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) { | |
| 3558 | + UpdateSpsPpsIdStrategyWithConstantId (& (pCtx->sPSOVector), pCtx->pPPSArray[iIdx].iPpsId, PARA_SET_TYPE_PPS); | |
| 3559 | + } | |
| 3560 | + | |
| 3549 | 3561 | iReturn = WelsWriteOnePPS (pCtx, iIdx, iNalSize); |
| 3550 | 3562 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 3551 | 3563 | |