ref: 9cc395fc4ee34208971f407010d75a96dec76d09
parent: 2c99f5810e30e5401fb03f1bfe1907bd9af14c52
parent: 173ec608ff0f21f4b67c88cecf153b2df158bf43
author: sijchen <sijchen@cisco.com>
date: Tue Dec 23 05:51:53 EST 2014
Merge pull request #1632 from ruil2/encoder_refine use the same complexity computation branch for screen and camera
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3269,11 +3269,10 @@
#ifdef LONG_TERM_REF_DUMP
DumpRef (pCtx);
#endif
- if ((pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) && (pSvcParam->iRCMode != RC_OFF_MODE))
+ if ((pSvcParam->iRCMode != RC_OFF_MODE))
pCtx->pVpp->AnalyzePictureComplexity (pCtx, pCtx->pEncPic, ((pCtx->eSliceType == P_SLICE)
&& (pCtx->iNumRef0 > 0)) ? pCtx->pRefList0[0] : NULL,
- iCurDid, pSvcParam->bEnableBackgroundDetection);
-
+ iCurDid,(pCtx->eSliceType == P_SLICE)&&(pSvcParam->bEnableBackgroundDetection));
WelsUpdateRefSyntax (pCtx, pCtx->iPOC,
eFrameType); //get reordering syntax used for writing slice header and transmit to encoder.
PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -250,7 +250,6 @@
AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
}
- AnalyzePictureComplexity (pCtx, pCurPic, pRefPic, kiDidx, bCalculateBGD);
WelsExchangeSpatialPictures (&m_pLastSpatialPicture[kiDidx][1], &m_pLastSpatialPicture[kiDidx][0]);
}
return 0;
@@ -735,8 +734,6 @@
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
int32_t iComplexityAnalysisMode = 0;
- if (pSvcParam->iRCMode == RC_OFF_MODE)
- return;
if (pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa);
SComplexityAnalysisScreenParam* sComplexityAnalysisParam = &pVaaExt->sComplexityScreenParam;
@@ -806,7 +803,8 @@
sComplexityAnalysisParam->iComplexityAnalysisMode = iComplexityAnalysisMode;
sComplexityAnalysisParam->pCalcResult = & (pVaaInfo->sVaaCalcInfo);
sComplexityAnalysisParam->pBackgroundMbFlag = pVaaInfo->pVaaBackgroundMbFlag;
- SetRefMbType (pCtx, & (sComplexityAnalysisParam->uiRefMbType), pRefPicture->iPictureType);
+ if(pRefPicture)
+ SetRefMbType (pCtx, & (sComplexityAnalysisParam->uiRefMbType), pRefPicture->iPictureType);
sComplexityAnalysisParam->iCalcBgd = bCalculateBGD;
sComplexityAnalysisParam->iFrameComplexity = 0;
@@ -833,11 +831,13 @@
sSrcPixMap.sRect.iRectHeight = pCurPicture->iHeightInPixel;
sSrcPixMap.eFormat = VIDEO_FORMAT_I420;
- sRefPixMap.pPixel[0] = pRefPicture->pData[0];
- sRefPixMap.iSizeInBits = g_kiPixMapSizeInBits;
- sRefPixMap.iStride[0] = pRefPicture->iLineSize[0];
- sRefPixMap.sRect.iRectWidth = pRefPicture->iWidthInPixel;
- sRefPixMap.sRect.iRectHeight = pRefPicture->iHeightInPixel;
+ if(pRefPicture){
+ sRefPixMap.pPixel[0] = pRefPicture->pData[0];
+ sRefPixMap.iSizeInBits = g_kiPixMapSizeInBits;
+ sRefPixMap.iStride[0] = pRefPicture->iLineSize[0];
+ sRefPixMap.sRect.iRectWidth = pRefPicture->iWidthInPixel;
+ sRefPixMap.sRect.iRectHeight = pRefPicture->iHeightInPixel;
+ }
sRefPixMap.eFormat = VIDEO_FORMAT_I420;
iRet = m_pInterfaceVp->Set (iMethodIdx, (void*)sComplexityAnalysisParam);