ref: 84b441d4e44eb3beb5ee1fd32d82b8e06142c1af
parent: 32d1510d296d0dd5189b5432bbc0edd83cfb49b9
author: Sijia Chen <sijchen@cisco.com>
date: Wed Jun 10 06:49:39 EDT 2015
move the post-encoding exchanging in preprocessing to more reasonable function
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -252,12 +252,11 @@
AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
}
- WelsExchangeSpatialPictures (&m_pLastSpatialPicture[kiDidx][1], &m_pLastSpatialPicture[kiDidx][0]);
}
return 0;
}
-int32_t CWelsPreProcess::GetCurPicPosition(const int32_t kiDidx) {
+int32_t CWelsPreProcess::GetCurPicPosition (const int32_t kiDidx) {
return (m_uiSpatialLayersInTemporal[kiDidx] - 1);
}
@@ -265,7 +264,10 @@
const int8_t iCurTid, const int32_t kiDidx) {
if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)
return 0;
- const int32_t kiCurPos = GetCurPicPosition(kiDidx);
+
+ WelsExchangeSpatialPictures (&m_pLastSpatialPicture[kiDidx][1], &m_pLastSpatialPicture[kiDidx][0]);
+
+ const int32_t kiCurPos = GetCurPicPosition (kiDidx);
if (iCurTid < kiCurPos || pParam->iDecompStages == 0) {
if ((iCurTid >= MAX_TEMPORAL_LEVEL) || (kiCurPos > MAX_TEMPORAL_LEVEL)) {
InitLastSpatialPictures (pCtx);
@@ -278,7 +280,7 @@
pCtx->bRefOfCurTidIsLtr[kiDidx][iCurTid] = false;
}
WelsExchangeSpatialPictures (&m_pSpatialPic[kiDidx][kiCurPos],
- &m_pSpatialPic[kiDidx][iCurTid]);
+ &m_pSpatialPic[kiDidx][iCurTid]);
}
return 0;
}
@@ -332,7 +334,8 @@
iShrinkWidth = pScaledPicture->iScaledWidth[iDependencyId];
iShrinkHeight = pScaledPicture->iScaledHeight[iDependencyId];
}
- DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight, false);
+ DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight,
+ false);
if (pSvcParam->bEnableSceneChangeDetect && !pCtx->pVaa->bIdrPeriodFlag) {
if (pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
@@ -387,7 +390,8 @@
pDstPic = m_pSpatialPic[iDependencyId][iPicturePos]; // small
iShrinkWidth = pScaledPicture->iScaledWidth[iDependencyId];
iShrinkHeight = pScaledPicture->iScaledHeight[iDependencyId];
- DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight, true);
+ DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight,
+ true);
WelsUpdateSpatialIdxMap (pCtx, iActualSpatialLayerNum - 1, pDstPic, iDependencyId);