History

rename the strategy to enum

Sijia Chen committed 11 years ago

Commit d9502aa1 parent 7d1d2d69 files · +166 −74Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+36−36
@@ -323,10 +323,10 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 322 unmodified lines
323323 pCodingParam->bDeblockingParallelFlag = true;
324324 }
325325
326− if (pCodingParam->iSpatialLayerNum > 1 && (SPS_LISTING & pCodingParam->iSpsPpsIdStrategy)) {
326+ if (pCodingParam->iSpatialLayerNum > 1 && (SPS_LISTING & pCodingParam->eSpsPpsIdStrategy)) {
327327 WelsLog (pLogCtx, WELS_LOG_INFO,
328− "ParamValidationExt(), iSpsPpsIdStrategy adjusted to CONSTANT_ID");
329− pCodingParam->iSpsPpsIdStrategy = CONSTANT_ID;
328+ "ParamValidationExt(), eSpsPpsIdStrategy adjusted to CONSTANT_ID");
329+ pCodingParam->eSpsPpsIdStrategy = CONSTANT_ID;
330330 }
331331
332332 for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) {
@@ -674,9 +674,9 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 341 unmodified lines
674674 // count parasets
675675 iCountNumNals += 1 + iNumDependencyLayers + (iCountNumLayers << 1) +
676676 iCountNumLayers // plus iCountNumLayers for reserved application
677− + ((SPS_LISTING & pParam->iSpsPpsIdStrategy) ? MAX_SPS_COUNT : 0) //for Sps
678− + (((SPS_LISTING & pParam->iSpsPpsIdStrategy) && (iNumDependencyLayers > 1)) ? MAX_SPS_COUNT : 0) //for SubsetSps
679− + ((SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy) ? MAX_PPS_COUNT : 0);
677+ + ((SPS_LISTING & pParam->eSpsPpsIdStrategy) ? MAX_SPS_COUNT : 0) //for Sps
678+ + (((SPS_LISTING & pParam->eSpsPpsIdStrategy) && (iNumDependencyLayers > 1)) ? MAX_SPS_COUNT : 0) //for SubsetSps
679+ + ((SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy) ? MAX_PPS_COUNT : 0);
680680
681681 // to check number of layers / nals / slices dependencies, 12/8/2010
682682 if (iCountNumLayers > MAX_LAYER_NUM_OF_FRAME) {
@@ -1172,7 +1172,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 489 unmodified lines
11721172
11731173 // for dynamically malloc for parameter sets memory instead of maximal items for standard to reduce size, 3/18/2010
11741174 // SPS
1175− if (! (SPS_LISTING & pParam->iSpsPpsIdStrategy)) {
1175+ if (! (SPS_LISTING & pParam->eSpsPpsIdStrategy)) {
11761176 (*ppCtx)->pSpsArray = (SWelsSPS*)pMa->WelsMalloc (sizeof (SWelsSPS), "pSpsArray");
11771177 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSpsArray), FreeMemorySvc (ppCtx))
11781178 if (iDlayerCount > 1) {
@@ -1180,7 +1180,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 1 unmodified line
11801180 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSubsetArray), FreeMemorySvc (ppCtx))
11811181 }
11821182 } else {
1183− // pParam->iSpsPpsIdStrategy == SPS_LISTING_AND_PPS_INCREASING
1183+ // pParam->eSpsPpsIdStrategy == SPS_LISTING_AND_PPS_INCREASING
11841184 // new memory
11851185 (*ppCtx)->pSpsArray = (SWelsSPS*)pMa->WelsMalloc (MAX_SPS_COUNT * sizeof (SWelsSPS), "pSpsArray");
11861186 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSpsArray), FreeMemorySvc (ppCtx))
@@ -1197,7 +1197,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 10 unmodified lines
11971197 }
11981198 }
11991199 // PPS
1200− if (! (SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy)) {
1200+ if (! (SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy)) {
12011201 (*ppCtx)->pPPSArray = (SWelsPPS*)pMa->WelsMalloc (iDlayerCount * sizeof (SWelsPPS), "pPPSArray");
12021202 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pPPSArray), FreeMemorySvc (ppCtx))
12031203 } else {
@@ -1212,7 +1212,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 8 unmodified lines
12121212 }
12131213 }
12141214
1215− if (INCREASING_ID & pParam->iSpsPpsIdStrategy) {
1215+ if (INCREASING_ID & pParam->eSpsPpsIdStrategy) {
12161216 (*ppCtx)->pPSOVector = & ((*ppCtx)->sPSOVector);
12171217 } else {
12181218 (*ppCtx)->pPSOVector = NULL;
@@ -1229,11 +1229,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 10 unmodified lines
12291229
12301230 pDqIdc->uiSpatialId = iDlayerIndex;
12311231
1232− if (! (SPS_LISTING & pParam->iSpsPpsIdStrategy)) {
1232+ if (! (SPS_LISTING & pParam->eSpsPpsIdStrategy)) {
12331233 WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex,
12341234 iDlayerCount, iSpsId, pSps, pSubsetSps);
12351235 } else {
1236− //SPS_LISTING_AND_PPS_INCREASING == pParam->iSpsPpsIdStrategy
1236+ //SPS_LISTING_AND_PPS_INCREASING == pParam->eSpsPpsIdStrategy
12371237 //check if the current param can fit in an existing SPS
12381238 const int32_t kiFoundSpsId = FindExistingSps ((*ppCtx)->pSvcParam, bUseSubsetSps, iDlayerIndex, iDlayerCount,
12391239 bUseSubsetSps ? ((*ppCtx)->sPSOVector.uiInUseSubsetSpsNum) : ((*ppCtx)->sPSOVector.uiInUseSpsNum),
@@ -1251,7 +1251,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 11 unmodified lines
12511251 }
12521252 } else {
12531253 //if no, generate a new SPS as usual
1254− if ((SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy) && (MAX_PPS_COUNT <= (*ppCtx)->sPSOVector.uiInUsePpsNum)) {
1254+ if ((SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy) && (MAX_PPS_COUNT <= (*ppCtx)->sPSOVector.uiInUsePpsNum)) {
12551255 //check if we can generate new SPS or not
12561256 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR,
12571257 "InitDqLayers(), cannot generate new SPS under the SPS_PPS_LISTING mode!");
@@ -1260,7 +1260,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 2 unmodified lines
12601260
12611261 iSpsId = (!bUseSubsetSps) ? ((*ppCtx)->sPSOVector.uiInUseSpsNum++) : ((*ppCtx)->sPSOVector.uiInUseSubsetSpsNum++);
12621262 if (iSpsId >= MAX_SPS_COUNT) {
1263− if (SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy) {
1263+ if (SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy) {
12641264 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR,
12651265 "InitDqLayers(), cannot generate new SPS under the SPS_PPS_LISTING mode!");
12661266 return ENC_RETURN_UNSUPPORTED_PARA;
@@ -1281,7 +1281,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 14 unmodified lines
12811281 }
12821282 }
12831283
1284− if (! (SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy)) {
1284+ if (! (SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy)) {
12851285 pPps = & (*ppCtx)->pPPSArray[iPpsId];
12861286 // initialize pPps
12871287 WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps, pParam->iEntropyCodingModeFlag != 0);
@@ -1336,11 +1336,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 48 unmodified lines
13361336
13371337 ++ iDlayerIndex;
13381338 }
1339− if (SPS_LISTING & pParam->iSpsPpsIdStrategy) {
1339+ if (SPS_LISTING & pParam->eSpsPpsIdStrategy) {
13401340 (*ppCtx)->iSpsNum = (*ppCtx)->sPSOVector.uiInUseSpsNum;
13411341 (*ppCtx)->iSubsetSpsNum = (*ppCtx)->sPSOVector.uiInUseSubsetSpsNum;
13421342 }
1343− if (SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy) {
1343+ if (SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy) {
13441344 (*ppCtx)->iPpsNum = (*ppCtx)->sPSOVector.uiInUsePpsNum;
13451345 }
13461346 return ENC_RETURN_SUCCESS;
@@ -2798,7 +2798,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 1451 unmodified lines
27982798 int32_t iCurPpsId = pDqIdc->iPpsId;
27992799 int32_t iCurSpsId = pDqIdc->iSpsId;
28002800
2801− if (SPS_PPS_LISTING == pParam->iSpsPpsIdStrategy) {
2801+ if (SPS_PPS_LISTING == pParam->eSpsPpsIdStrategy) {
28022802 iCurPpsId = pCtx->sPSOVector.iPpsIdList[pDqIdc->iPpsId][WELS_ABS (pCtx->uiIdrPicId - 1) % MAX_PPS_COUNT];
28032803 }
28042804
@@ -3117,21 +3117,21 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 312 unmodified lines
31173117 while (iIdx < pCtx->iSpsNum) {
31183118 iNal = pCtx->pOut->iNalIndex;
31193119
3120− if (INCREASING_ID == pCtx->pSvcParam->iSpsPpsIdStrategy) {
3120+ if (INCREASING_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) {
31213121 #if _DEBUG
3122− pCtx->sPSOVector.iSpsPpsIdStrategy = INCREASING_ID;
3122+ pCtx->sPSOVector.eSpsPpsIdStrategy = INCREASING_ID;
31233123 assert (iIdx < MAX_DQ_LAYER_NUM);
31243124 #endif
31253125
31263126 ParasetIdAdditionIdAdjust (& (pCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_AVCSPS]),
31273127 pCtx->pSpsArray[0].uiSpsId,
31283128 MAX_SPS_COUNT);
3129− } else if (CONSTANT_ID == pCtx->pSvcParam->iSpsPpsIdStrategy) {
3129+ } else if (CONSTANT_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) {
31303130 memset (& (pCtx->sPSOVector), 0, sizeof (pCtx->sPSOVector));
31313131 }
31323132
31333133 /* generate sequence parameters set */
3134− iId = (SPS_LISTING & pCtx->pSvcParam->iSpsPpsIdStrategy) ? iIdx : 0;
3134+ iId = (SPS_LISTING & pCtx->pSvcParam->eSpsPpsIdStrategy) ? iIdx : 0;
31353135
31363136 WelsLoadNal (pCtx->pOut, NAL_UNIT_SPS, NRI_PRI_HIGHEST);
31373137 WelsWriteSpsNal (&pCtx->pSpsArray[iId], &pCtx->pOut->sBsWrite,
@@ -3157,9 +3157,9 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 19 unmodified lines
31573157 while (iIdx < pCtx->iSubsetSpsNum) {
31583158 iNal = pCtx->pOut->iNalIndex;
31593159
3160− if (INCREASING_ID == pCtx->pSvcParam->iSpsPpsIdStrategy) {
3160+ if (INCREASING_ID == pCtx->pSvcParam->eSpsPpsIdStrategy) {
31613161 #if _DEBUG
3162− pCtx->sPSOVector.iSpsPpsIdStrategy = INCREASING_ID;
3162+ pCtx->sPSOVector.eSpsPpsIdStrategy = INCREASING_ID;
31633163 assert (iIdx < MAX_DQ_LAYER_NUM);
31643164 #endif
31653165
@@ -3193,7 +3193,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 27 unmodified lines
31933193
31943194 /* write all PPS */
31953195 iIdx = 0;
3196− if ((SPS_PPS_LISTING == pCtx->pSvcParam->iSpsPpsIdStrategy) && (pCtx->iPpsNum < MAX_PPS_COUNT)) {
3196+ if ((SPS_PPS_LISTING == pCtx->pSvcParam->eSpsPpsIdStrategy) && (pCtx->iPpsNum < MAX_PPS_COUNT)) {
31973197 assert (pCtx->iPpsNum <= MAX_DQ_LAYER_NUM);
31983198
31993199 //Generate PPS LIST
@@ -3216,7 +3216,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 16 unmodified lines
32163216 }
32173217
32183218 while (iIdx < pCtx->iPpsNum) {
3219− if ((INCREASING_ID & pCtx->pSvcParam->iSpsPpsIdStrategy)) {
3219+ if ((INCREASING_ID & pCtx->pSvcParam->eSpsPpsIdStrategy)) {
32203220 //para_set_type = 2: PPS, use MAX_PPS_COUNT
32213221 ParasetIdAdditionIdAdjust (&pCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_PPS], pCtx->pPPSArray[iIdx].iPpsId,
32223222 MAX_PPS_COUNT);
@@ -3226,7 +3226,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 3 unmodified lines
32263226 /* generate picture parameter set */
32273227 WelsLoadNal (pCtx->pOut, NAL_UNIT_PPS, NRI_PRI_HIGHEST);
32283228 WelsWritePpsSyntax (&pCtx->pPPSArray[iIdx], &pCtx->pOut->sBsWrite,
3229− ((SPS_PPS_LISTING != pCtx->pSvcParam->iSpsPpsIdStrategy)) ? (& (pCtx->sPSOVector)) : NULL);
3229+ ((SPS_PPS_LISTING != pCtx->pSvcParam->eSpsPpsIdStrategy)) ? (& (pCtx->sPSOVector)) : NULL);
32303230 WelsUnloadNal (pCtx->pOut);
32313231
32323232 iReturn = WelsEncodeNal (&pCtx->pOut->sNalList[iNal], NULL,
@@ -4124,7 +4124,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 891 unmodified lines
41244124 (pOldParam->iMultipleThreadIdc != pNewParam->iMultipleThreadIdc) ||
41254125 (pOldParam->bEnableBackgroundDetection != pNewParam->bEnableBackgroundDetection) ||
41264126 (pOldParam->bEnableAdaptiveQuant != pNewParam->bEnableAdaptiveQuant) ||
4127− (pOldParam->iSpsPpsIdStrategy != pNewParam->iSpsPpsIdStrategy);
4127+ (pOldParam->eSpsPpsIdStrategy != pNewParam->eSpsPpsIdStrategy);
41284128 if (pNewParam->iMaxNumRefFrame > pOldParam->iMaxNumRefFrame) {
41294129 bNeedReset = true;
41304130 }
@@ -4173,7 +4173,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 42 unmodified lines
41734173 if (bNeedReset) {
41744174 SLogContext sLogCtx = (*ppCtx)->sLogCtx;
41754175
4176− int32_t iOldSpsPpsIdStrategy = pOldParam->iSpsPpsIdStrategy;
4176+ int32_t iOldSpsPpsIdStrategy = pOldParam->eSpsPpsIdStrategy;
41774177 SParaSetOffsetVariable sTmpPsoVariable[PARA_SET_TYPE];
41784178 int32_t iTmpPpsIdList[MAX_DQ_LAYER_NUM * MAX_PPS_COUNT];
41794179 uint16_t uiTmpIdrPicId = (*ppCtx)->uiIdrPicId;//this is for LTR!
@@ -4183,7 +4183,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 3 unmodified lines
41834183 SExistingParasetList sExistingParasetList;
41844184 SExistingParasetList* pExistingParasetList = NULL;
41854185
4186− if ((CONSTANT_ID != iOldSpsPpsIdStrategy) && (CONSTANT_ID != pNewParam->iSpsPpsIdStrategy)) {
4186+ if ((CONSTANT_ID != iOldSpsPpsIdStrategy) && (CONSTANT_ID != pNewParam->eSpsPpsIdStrategy)) {
41874187 for (int32_t k = 0; k < PARA_SET_TYPE; k++) {
41884188 memset (((*ppCtx)->sPSOVector.sParaSetOffsetVariable[k].bUsedParaSetIdInBs), 0, MAX_PPS_COUNT * sizeof (bool));
41894189 }
@@ -4191,7 +4191,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 1 unmodified line
41914191 (PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
41924192
41934193 if ((SPS_LISTING & iOldSpsPpsIdStrategy)
4194− && (SPS_LISTING & pNewParam->iSpsPpsIdStrategy)) {
4194+ && (SPS_LISTING & pNewParam->eSpsPpsIdStrategy)) {
41954195 pExistingParasetList = &sExistingParasetList;
41964196 sExistingParasetList.uiInUseSpsNum = (*ppCtx)->sPSOVector.uiInUseSpsNum;
41974197 sExistingParasetList.uiInUseSubsetSpsNum = (*ppCtx)->sPSOVector.uiInUseSubsetSpsNum;
@@ -4200,7 +4200,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 2 unmodified lines
42004200 }
42014201
42024202 if ((SPS_PPS_LISTING == iOldSpsPpsIdStrategy)
4203− && (SPS_PPS_LISTING == pNewParam->iSpsPpsIdStrategy)) {
4203+ && (SPS_PPS_LISTING == pNewParam->eSpsPpsIdStrategy)) {
42044204 pExistingParasetList = &sExistingParasetList;
42054205 sExistingParasetList.uiInUseSpsNum = (*ppCtx)->sPSOVector.uiInUseSpsNum;
42064206 sExistingParasetList.uiInUseSubsetSpsNum = (*ppCtx)->sPSOVector.uiInUseSubsetSpsNum;
@@ -4230,14 +4230,14 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 23 unmodified lines
42304230 //for sEncoderStatistics
42314231 (*ppCtx)->sEncoderStatistics = sTempEncoderStatistics;
42324232
4233− //load back the needed structure for iSpsPpsIdStrategy
4234− if ((CONSTANT_ID != iOldSpsPpsIdStrategy) && (CONSTANT_ID != pNewParam->iSpsPpsIdStrategy)) {
4233+ //load back the needed structure for eSpsPpsIdStrategy
4234+ if ((CONSTANT_ID != iOldSpsPpsIdStrategy) && (CONSTANT_ID != pNewParam->eSpsPpsIdStrategy)) {
42354235 memcpy ((*ppCtx)->sPSOVector.sParaSetOffsetVariable, sTmpPsoVariable,
42364236 (PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
42374237 }
42384238
42394239 if ((SPS_PPS_LISTING == iOldSpsPpsIdStrategy)
4240− && (SPS_PPS_LISTING == pNewParam->iSpsPpsIdStrategy)) {
4240+ && (SPS_PPS_LISTING == pNewParam->eSpsPpsIdStrategy)) {
42414241 memcpy (((*ppCtx)->sPSOVector.iPpsIdList), iTmpPpsIdList, MAX_DQ_LAYER_NUM * MAX_PPS_COUNT * sizeof (int32_t));
42424242 }
42434243 } else {
@@ -4254,7 +4254,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 10 unmodified lines
42544254 pOldParam->fMaxFrameRate = pNewParam->fMaxFrameRate; // maximal frame rate [Hz / fps]
42554255 pOldParam->iComplexityMode = pNewParam->iComplexityMode; // color space of input sequence
42564256 pOldParam->uiIntraPeriod = pNewParam->uiIntraPeriod; // intra period (multiple of GOP size as desired)
4257− pOldParam->iSpsPpsIdStrategy = pNewParam->iSpsPpsIdStrategy;
4257+ pOldParam->eSpsPpsIdStrategy = pNewParam->eSpsPpsIdStrategy;
42584258 pOldParam->bPrefixNalAddingCtrl = pNewParam->bPrefixNalAddingCtrl;
42594259 pOldParam->iNumRefFrame = pNewParam->iNumRefFrame; // number of reference frame used
42604260 pOldParam->uiGopSize = pNewParam->uiGopSize;

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