ref: 66447349f6aa352922ebf07050dc9b8de563b419
parent: a6f44f5f79661d036a654964b7497550381d668d
author: ruil2 <ruil2@cisco.com>
date: Thu Jun 19 10:46:04 EDT 2014
check the number of spatial layer for screen content
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -84,6 +84,13 @@
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d\n", pCfg->iUsageType);
return ENC_RETURN_UNSUPPORTED_PARA;
}
+ if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
+ if (pCfg->iSpatialLayerNum > 1) {
+ WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid the number of Spatial layer(%d)for screen content\n",
+ pCfg->iSpatialLayerNum);
+ return ENC_RETURN_UNSUPPORTED_PARA;
+ }
+ }
for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i];
if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn
@@ -2941,9 +2948,9 @@
//loop each layer to check if have skip frame when RC and frame skip enable
if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) {
bool bSkipMustFlag = false;
- for (int32_t i = 0; i< iSpatialNum; i++) {
- pCtx->uiDependencyId = (uint8_t)(pSpatialIndexMap+i)->iDid;
- pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge(pCtx);
+ for (int32_t i = 0; i < iSpatialNum; i++) {
+ pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid;
+ pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx);
if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) {
bSkipMustFlag = true;
}
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -457,16 +457,20 @@
SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
const int32_t kiDlayerCount = pParam->iSpatialLayerNum;
int32_t iDlayerIndex = 0;
-
- for (; iDlayerIndex < kiDlayerCount; iDlayerIndex++) {
- const int32_t kiLayerInTemporal = m_uiSpatialLayersInTemporal[iDlayerIndex];
- m_pLastSpatialPicture[iDlayerIndex][0] = m_pSpatialPic[iDlayerIndex][kiLayerInTemporal - 2];
- m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
+ if (pParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
+ for (; iDlayerIndex < MAX_DEPENDENCY_LAYER; iDlayerIndex++) {
+ m_pLastSpatialPicture[iDlayerIndex][0] = m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
+ }
+ } else {
+ for (; iDlayerIndex < kiDlayerCount; iDlayerIndex++) {
+ const int32_t kiLayerInTemporal = m_uiSpatialLayersInTemporal[iDlayerIndex];
+ m_pLastSpatialPicture[iDlayerIndex][0] = m_pSpatialPic[iDlayerIndex][kiLayerInTemporal - 2];
+ m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
+ }
+ for (; iDlayerIndex < MAX_DEPENDENCY_LAYER; iDlayerIndex++) {
+ m_pLastSpatialPicture[iDlayerIndex][0] = m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
+ }
}
- for (; iDlayerIndex < MAX_DEPENDENCY_LAYER; iDlayerIndex++) {
- m_pLastSpatialPicture[iDlayerIndex][0] = m_pLastSpatialPicture[iDlayerIndex][1] = NULL;
- }
-
return 0;
}
//*********************************************************************************************************/