ref: 7c15d68e24721388b8f604016b3a04aacc3da6db
parent: d7570bfa52f9ea383680ea9eb7b4d864ecd15e4f
author: Karina <ruil2@cisco.com>
date: Fri Mar 18 12:43:11 EDT 2016
fix preprocessing initialization logic
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -4627,9 +4627,6 @@
/* Update new parameters */
if (WelsInitEncoderExt (ppCtx, pNewParam, &sLogCtx, pExistingParasetList))
return 1;
-
- // reset the scaled spatial picture size
- (*ppCtx)->pVpp->WelsPreprocessReset (*ppCtx);
//if WelsInitEncoderExt succeed
//for LTR
(*ppCtx)->uiIdrPicId = uiTmpIdrPicId ;//this is for LTR!; //this is for LTR!
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -196,6 +196,23 @@
m_iAvaliableRefInSpatialPicList = pSvcParam->iNumRefFrame;
m_bInitDone = true;
+ } else {
+ int32_t iWidth = ((kpSrcPic->iPicWidth >> 1) << 1);
+ int32_t iHeight = ((kpSrcPic->iPicHeight >> 1) << 1);
+ if ((iWidth != pSvcParam->SUsedPicRect.iWidth) || (iHeight != pSvcParam->SUsedPicRect.iHeight)) {
+ pSvcParam->SUsedPicRect.iLeft = 0;
+ pSvcParam->SUsedPicRect.iTop = 0;
+ pSvcParam->SUsedPicRect.iWidth = iWidth;
+ pSvcParam->SUsedPicRect.iHeight = iHeight;
+ if ((pSvcParam->SUsedPicRect.iWidth < 16) || ((pSvcParam->SUsedPicRect.iHeight < 16))) {
+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "Don't support width(%d) or height(%d) which is less than 16 ",
+ pSvcParam->SUsedPicRect.iWidth, pSvcParam->SUsedPicRect.iHeight);
+ return -1;
+ }
+ if (WelsPreprocessReset (pCtx) != 0)
+ return -1;
+ }
+
}
if (m_pInterfaceVp == NULL)
@@ -322,7 +339,7 @@
iSrcHeight = pSvcParam->SUsedPicRect.iHeight;
if (pSvcParam->uiIntraPeriod)
pCtx->pVaa->bIdrPeriodFlag = (1 + pDlayerParamInternal->iFrameIndex >= (int32_t)pSvcParam->uiIntraPeriod) ? true :
- false;
+ false;
pSrcPic = pScaledPicture->pScaledInputPicture ? pScaledPicture->pScaledInputPicture :
m_pSpatialPic[iDependencyId][iPicturePos];