add scene change detection in workflow for screen content
This commit is contained in:
@@ -161,6 +161,7 @@ class CWelsPreProcess {
|
|||||||
void WelsMoveMemoryWrapper (SWelsSvcCodingParam* pSvcParam, SPicture* pDstPic, const SSourcePicture* kpSrc,
|
void WelsMoveMemoryWrapper (SWelsSvcCodingParam* pSvcParam, SPicture* pDstPic, const SSourcePicture* kpSrc,
|
||||||
const int32_t kiWidth, const int32_t kiHeight);
|
const int32_t kiWidth, const int32_t kiHeight);
|
||||||
|
|
||||||
|
ESceneChangeIdc DetectSceneChangeScreen(sWelsEncCtx* pCtx,SPicture* pCurPicture);
|
||||||
private:
|
private:
|
||||||
Scaled_Picture m_sScaledPicture;
|
Scaled_Picture m_sScaledPicture;
|
||||||
SPicture* m_pLastSpatialPicture[MAX_DEPENDENCY_LAYER][2];
|
SPicture* m_pLastSpatialPicture[MAX_DEPENDENCY_LAYER][2];
|
||||||
|
|||||||
@@ -442,15 +442,23 @@ int32_t CWelsPreProcess::SingleLayerPreprocess (sWelsEncCtx* pCtx, const SSource
|
|||||||
}
|
}
|
||||||
DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight);
|
DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight);
|
||||||
|
|
||||||
if (pSvcParam->bEnableSceneChangeDetect && !pCtx->pVaa->bIdrPeriodFlag
|
if (pSvcParam->bEnableSceneChangeDetect && !pCtx->pVaa->bIdrPeriodFlag){
|
||||||
&& !pCtx->bEncCurFrmAsIdrFlag
|
if(pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)
|
||||||
&& ! (pCtx->iCodingIndex & (pSvcParam->uiGopSize - 1))) {
|
{
|
||||||
|
pCtx->pVaa->eSceneChangeIdc = (pCtx->bEncCurFrmAsIdrFlag ? LARGE_CHANGED_SCENE: DetectSceneChangeScreen(pCtx,pDstPic));
|
||||||
|
pCtx->pVaa->bSceneChangeFlag = ( LARGE_CHANGED_SCENE == pCtx->pVaa->eSceneChangeIdc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if((!pCtx->bEncCurFrmAsIdrFlag )&& ! (pCtx->iCodingIndex & (pSvcParam->uiGopSize - 1))) {
|
||||||
SPicture* pRefPic = pCtx->pLtr[iDependencyId].bReceivedT0LostFlag ?
|
SPicture* pRefPic = pCtx->pLtr[iDependencyId].bReceivedT0LostFlag ?
|
||||||
m_pSpatialPic[iDependencyId][m_uiSpatialLayersInTemporal[iDependencyId] +
|
m_pSpatialPic[iDependencyId][m_uiSpatialLayersInTemporal[iDependencyId] +
|
||||||
pCtx->pVaa->uiValidLongTermPicIdx] : m_pLastSpatialPicture[iDependencyId][0];
|
pCtx->pVaa->uiValidLongTermPicIdx] : m_pLastSpatialPicture[iDependencyId][0];
|
||||||
|
|
||||||
pCtx->pVaa->bSceneChangeFlag = DetectSceneChange (pDstPic, pRefPic);
|
pCtx->pVaa->bSceneChangeFlag = DetectSceneChange (pDstPic, pRefPic);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pSvcParam->iSpatialLayerNum; i++) {
|
for (int32_t i = 0; i < pSvcParam->iSpatialLayerNum; i++) {
|
||||||
if (pSvcParam->sDependencyLayers[i].uiCodingIdx2TemporalId[pCtx->iCodingIndex & (pSvcParam->uiGopSize - 1)]
|
if (pSvcParam->sDependencyLayers[i].uiCodingIdx2TemporalId[pCtx->iCodingIndex & (pSvcParam->uiGopSize - 1)]
|
||||||
@@ -893,6 +901,33 @@ void CWelsPreProcess::AnalyzePictureComplexity (sWelsEncCtx* pCtx, SPicture* pCu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ESceneChangeIdc CWelsPreProcess::DetectSceneChangeScreen(sWelsEncCtx* pCtx,SPicture* pCurPicture)
|
||||||
|
{
|
||||||
|
#define STATIC_SCENE_MOTION_RATIO 0.01f
|
||||||
|
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
||||||
|
SVAAFrameInfoExt *pVaaExt = static_cast<SVAAFrameInfoExt *>(pCtx->pVaa);
|
||||||
|
if ( NULL==pCtx || NULL == pVaaExt || NULL== pCurPicture)
|
||||||
|
{
|
||||||
|
return LARGE_CHANGED_SCENE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int32_t iTargetDid = pSvcParam->iSpatialLayerNum-1;
|
||||||
|
if ( 0!= iTargetDid )
|
||||||
|
{
|
||||||
|
return LARGE_CHANGED_SCENE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESceneChangeIdc iVaaFrameSceneChangeIdc = LARGE_CHANGED_SCENE;
|
||||||
|
|
||||||
|
SPicture **pSrcPicList = &m_pSpatialPic[iTargetDid][1];
|
||||||
|
if ( NULL==pSrcPicList )
|
||||||
|
{
|
||||||
|
return LARGE_CHANGED_SCENE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return static_cast<ESceneChangeIdc>(iVaaFrameSceneChangeIdc);
|
||||||
|
}
|
||||||
void CWelsPreProcess::Padding (uint8_t* pSrcY, uint8_t* pSrcU, uint8_t* pSrcV, int32_t iStrideY, int32_t iStrideUV,
|
void CWelsPreProcess::Padding (uint8_t* pSrcY, uint8_t* pSrcU, uint8_t* pSrcV, int32_t iStrideY, int32_t iStrideUV,
|
||||||
int32_t iActualWidth, int32_t iPaddingWidth, int32_t iActualHeight, int32_t iPaddingHeight) {
|
int32_t iActualWidth, int32_t iPaddingWidth, int32_t iActualHeight, int32_t iPaddingHeight) {
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|||||||
Reference in New Issue
Block a user