update pre-processing workflow for screen content
This commit is contained in:
@@ -188,11 +188,13 @@ private:
|
||||
CWelsLib* m_pEncLib;
|
||||
sWelsEncCtx* m_pEncCtx;
|
||||
bool m_bInitDone;
|
||||
uint8_t m_uiSpatialLayersInTemporal[MAX_DEPENDENCY_LAYER];
|
||||
uint8_t m_uiSpatialPicNum[MAX_DEPENDENCY_LAYER];
|
||||
public:
|
||||
/* For Downsampling & VAA I420 based source pictures */
|
||||
SPicture* m_pSpatialPic[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL + 1 +
|
||||
LONG_TERM_REF_NUM]; // need memory requirement with total number of (log2(uiGopSize)+1+1+long_term_ref_num)
|
||||
uint8_t m_uiSpatialLayersInTemporal[MAX_DEPENDENCY_LAYER];
|
||||
uint8_t m_uiSpatialPicNum[MAX_DEPENDENCY_LAYER];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2913,6 +2913,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou
|
||||
pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx);
|
||||
PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
|
||||
|
||||
//TODO Complexity Calculation here for screen content
|
||||
iLayerSize = 0;
|
||||
|
||||
if (SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
// ref_list_mgr_svc.c
|
||||
#include "ref_list_mgr_svc.h"
|
||||
#include "utils.h"
|
||||
#include "picture_handle.h"
|
||||
namespace WelsSVCEnc {
|
||||
/*
|
||||
* set picture as unreferenced
|
||||
@@ -664,6 +665,40 @@ void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t iPOC, const int32_t u
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t UpdateSrcPicList (sWelsEncCtx* pCtx) {
|
||||
int32_t iDIdx = pCtx->uiDependencyId;
|
||||
SPicture** pLongRefList = pCtx->ppRefPicListExt[iDIdx]->pLongRefList;
|
||||
SPicture** pLongRefSrcList = &pCtx->pVpp->m_pSpatialPic[iDIdx][0];
|
||||
for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) {
|
||||
if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef
|
||||
&& pLongRefList[i]->bIsLongRef)) {
|
||||
continue;
|
||||
} else {
|
||||
SetUnref (pLongRefSrcList[i + 1]);
|
||||
}
|
||||
}
|
||||
WelsExchangeSpatialPictures (&pCtx->pVpp->m_pSpatialPic[iDIdx][0],
|
||||
&pCtx->pVpp->m_pSpatialPic[iDIdx][1 + pCtx->pVaa->uiMarkLongTermPicIdx]);
|
||||
SetUnref (pCtx->pVpp->m_pSpatialPic[iDIdx][0]);
|
||||
|
||||
|
||||
//update info in src list
|
||||
if (pCtx->pEncPic) {
|
||||
pCtx->pEncPic->iPictureType = pCtx->pDecPic->iPictureType;
|
||||
pCtx->pEncPic->iFramePoc = pCtx->pDecPic->iFramePoc;
|
||||
pCtx->pEncPic->iFrameNum = pCtx->pDecPic->iFrameNum;
|
||||
pCtx->pEncPic->uiSpatialId = pCtx->pDecPic->uiSpatialId;
|
||||
pCtx->pEncPic->uiTemporalId = pCtx->pDecPic->uiTemporalId;
|
||||
pCtx->pEncPic->iLongTermPicNum = pCtx->pDecPic->iLongTermPicNum;
|
||||
pCtx->pEncPic->bUsedAsRef = pCtx->pDecPic->bUsedAsRef;
|
||||
pCtx->pEncPic->bIsLongRef = pCtx->pDecPic->bIsLongRef;
|
||||
pCtx->pEncPic->bIsSceneLTR = pCtx->pDecPic->bIsSceneLTR;
|
||||
pCtx->pEncPic->iFrameAverageQp = pCtx->pDecPic->iFrameAverageQp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WelsUpdateRefListScreen (void* pEncCtx) {
|
||||
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
|
||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||
@@ -708,19 +743,7 @@ bool WelsUpdateRefListScreen (void* pEncCtx) {
|
||||
pCtx->pVaa->uiValidLongTermPicIdx = 0;
|
||||
}
|
||||
|
||||
//update info in src list
|
||||
if (pCtx->pEncPic) {
|
||||
pCtx->pEncPic->iPictureType = pCtx->pDecPic->iPictureType;
|
||||
pCtx->pEncPic->iFramePoc = pCtx->pDecPic->iFramePoc;
|
||||
pCtx->pEncPic->iFrameNum = pCtx->pDecPic->iFrameNum;
|
||||
pCtx->pEncPic->uiSpatialId = pCtx->pDecPic->uiSpatialId;
|
||||
pCtx->pEncPic->uiTemporalId = pCtx->pDecPic->uiTemporalId;
|
||||
pCtx->pEncPic->iLongTermPicNum = pCtx->pDecPic->iLongTermPicNum;
|
||||
pCtx->pEncPic->bUsedAsRef = pCtx->pDecPic->bUsedAsRef;
|
||||
pCtx->pEncPic->bIsLongRef = pCtx->pDecPic->bIsLongRef;
|
||||
pCtx->pEncPic->bIsSceneLTR = pCtx->pDecPic->bIsSceneLTR;
|
||||
pCtx->pEncPic->iFrameAverageQp = pCtx->pDecPic->iFrameAverageQp;
|
||||
}
|
||||
UpdateSrcPicList (pCtx);
|
||||
return true;
|
||||
}
|
||||
bool WelsBuildRefListScreen (void* pEncCtx, const int32_t iPOC, int32_t iBestLtrRefIdx) {
|
||||
|
||||
@@ -347,14 +347,29 @@ int32_t CWelsPreProcess::AnalyzeSpatialPic (sWelsEncCtx* pCtx, const int32_t kiD
|
||||
iRefTemporalIdx = m_uiSpatialLayersInTemporal[kiDidx] + pCtx->pVaa->uiValidLongTermPicIdx;
|
||||
|
||||
SPicture* pCurPic = m_pSpatialPic[kiDidx][iCurTemporalIdx];
|
||||
bool bCalculateVar = (pSvcParam->iRCMode >= RC_BITRATE_MODE && pCtx->eSliceType == I_SLICE);
|
||||
|
||||
if(pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME){
|
||||
SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (m_pEncCtx->pVaa);
|
||||
SRefInfoParam* BestRefCandidateParam =&(pVaaExt->sVaaStrBestRefCandidate[0]);
|
||||
SPicture *pRefPic= m_pSpatialPic[0][BestRefCandidateParam->iSrcListIdx];
|
||||
|
||||
VaaCalculation (pCtx->pVaa, pCurPic, pRefPic, false, bCalculateVar, bCalculateBGD);
|
||||
|
||||
if (pSvcParam->bEnableBackgroundDetection) {
|
||||
BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
|
||||
}
|
||||
|
||||
if (bNeededMbAq) {
|
||||
AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
|
||||
}
|
||||
} else {
|
||||
SPicture* pRefPic = m_pSpatialPic[kiDidx][iRefTemporalIdx];
|
||||
{
|
||||
SPicture* pLastPic = m_pLastSpatialPicture[kiDidx][0];
|
||||
bool bCalculateSQDiff = ((pLastPic->pData[0] == pRefPic->pData[0]) && bNeededMbAq);
|
||||
bool bCalculateVar = (pSvcParam->iRCMode >= RC_BITRATE_MODE && pCtx->eSliceType == I_SLICE);
|
||||
|
||||
VaaCalculation (pCtx->pVaa, pCurPic, pRefPic, bCalculateSQDiff, bCalculateVar, bCalculateBGD);
|
||||
}
|
||||
|
||||
if (pSvcParam->bEnableBackgroundDetection) {
|
||||
BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
|
||||
@@ -373,6 +388,7 @@ int32_t CWelsPreProcess::AnalyzeSpatialPic (sWelsEncCtx* pCtx, const int32_t kiD
|
||||
}
|
||||
WelsExchangeSpatialPictures (&m_pLastSpatialPicture[kiDidx][1], &m_pLastSpatialPicture[kiDidx][0]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user