History

Merge pull request #2420 from sijchen/fix_sps

[Encoder] fix the lack of eSpsPpsIdStrategy==INCREASING_ID under simulcast avc on

sijchen committed 10 years ago

Commit 33bb96f2 parents 8103988 90deb802 files · +145 −20Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 2 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+32−20
@@ -3205,6 +3205,21 @@ void UpdatePpsList (sWelsEncCtx* pCtx) { · 3204 unmodified lines
32053205
32063206 }
32073207
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+
32083223 /*!
32093224 * \brief write all parameter sets introduced in SVC extension
32103225 * \return writing results, success or error
@@ -3227,16 +3242,9 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 16 unmodified lines
32273242 while (iIdx < pCtx->iSpsNum) {
32283243 // TODO (Sijia) wrap different operation of eSpsPpsIdStrategy to classes to hide the details
32293244 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);
32383246 } 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);
32403248 }
32413249
32423250 /* generate sequence parameters set */
@@ -3257,16 +3265,10 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 14 unmodified lines
32573265 iNal = pCtx->pOut->iNalIndex;
32583266
32593267 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);
32683269 }
32693270
3271+
32703272 iId = iIdx;
32713273
32723274 /* generate Subset SPS */
@@ -3298,9 +3300,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 25 unmodified lines
32983300 iIdx = 0;
32993301 while (iIdx < pCtx->iPpsNum) {
33003302 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);
33043304 }
33053305
33063306 WelsWriteOnePPS (pCtx, iIdx, iNalLength);
@@ -3515,6 +3515,12 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t iIdx, · 208 unmodified lines
35153515 int32_t iNalSize = 0;
35163516 iCountNal = 0;
35173517
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+
35183524 iReturn = WelsWriteOneSPS (pCtx, iIdx, iNalSize);
35193525 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
35203526
@@ -3546,6 +3552,12 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t iIdx, · 25 unmodified lines
35463552 iNalSize = 0;
35473553 iCountNal = 0;
35483554
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+
35493561 iReturn = WelsWriteOnePPS (pCtx, iIdx, iNalSize);
35503562 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
35513563

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t