ref: 45e34243647c4daa7381364284426478a3989371
parent: de68ec6f45c28f2debf0f76e9ad5f5ca588e71d2
author: Sijia Chen <[email protected]>
date: Mon Jan 26 06:12:24 EST 2015
add input checking and fix a bs length under new strategy
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -336,11 +336,17 @@
pCodingParam->bDeblockingParallelFlag = true;
}
+ // eSpsPpsIdStrategy checkings
if (pCodingParam->iSpatialLayerNum > 1 && (SPS_LISTING & pCodingParam->eSpsPpsIdStrategy)) {
WelsLog (pLogCtx, WELS_LOG_INFO,
- "ParamValidationExt(), eSpsPpsIdStrategy adjusted to CONSTANT_ID");
+ "ParamValidationExt(), eSpsPpsIdStrategy setting (%d) with multiple SpatialLayers (%d) not supported! eSpsPpsIdStrategy adjusted to CONSTANT_ID", pCodingParam->eSpsPpsIdStrategy, pCodingParam->iSpatialLayerNum);
pCodingParam->eSpsPpsIdStrategy = CONSTANT_ID;
}
+ if (pCodingParam->iUsageType == SCREEN_CONTENT_REAL_TIME && (SPS_LISTING & pCodingParam->eSpsPpsIdStrategy)) {
+ WelsLog (pLogCtx, WELS_LOG_INFO,
+ "ParamValidationExt(), eSpsPpsIdStrategy setting (%d) with iUsageType (%d) not supported! eSpsPpsIdStrategy adjusted to CONSTANT_ID", pCodingParam->eSpsPpsIdStrategy, pCodingParam->iUsageType);
+ pCodingParam->eSpsPpsIdStrategy = CONSTANT_ID;
+ }
for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) {
SSpatialLayerConfig* pSpatialLayer = &pCodingParam->sSpatialLayers[i];
@@ -1710,8 +1716,9 @@
return 1;
}
- iNonVclLayersBsSizeCount = SSEI_BUFFER_SIZE + pParam->iSpatialLayerNum * SPS_BUFFER_SIZE +
- (1 + pParam->iSpatialLayerNum) * PPS_BUFFER_SIZE;
+ const int32_t kiSpsSize = (pParam->eSpsPpsIdStrategy & SPS_LISTING) ? (MAX_SPS_COUNT * SPS_BUFFER_SIZE): (pParam->iSpatialLayerNum * SPS_BUFFER_SIZE);
+ const int32_t kiPpsSize = (pParam->eSpsPpsIdStrategy & SPS_PPS_LISTING) ? (MAX_PPS_COUNT * SPS_BUFFER_SIZE) : ((1 + pParam->iSpatialLayerNum) * PPS_BUFFER_SIZE);
+ iNonVclLayersBsSizeCount = SSEI_BUFFER_SIZE + kiSpsSize + kiPpsSize;
int32_t iLayerBsSize = 0;
iIndex = 0;