Merge pull request #399 from volvet/refine-multi-layer-process
refine-multi-layer-process
This commit is contained in:
commit
ced9e41b5d
@ -121,7 +121,7 @@ class CWelsPreProcess {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t SingleLayerPreprocess (sWelsEncCtx* pEncCtx, const SSourcePicture* kpSrc, Scaled_Picture* m_sScaledPicture);
|
int32_t SingleLayerPreprocess (sWelsEncCtx* pEncCtx, const SSourcePicture* kpSrc, Scaled_Picture* m_sScaledPicture);
|
||||||
int32_t MultiLayerPreprocess (sWelsEncCtx* pEncCtx, const SSourcePicture** kppSrcPicList, const int32_t kiSpatialNum);
|
int32_t MultiLayerPreprocess (sWelsEncCtx* pEncCtx, const SSourcePicture* kpSrcPic);
|
||||||
|
|
||||||
void BilateralDenoising (SPicture* pSrc, const int32_t iWidth, const int32_t iHeight);
|
void BilateralDenoising (SPicture* pSrc, const int32_t iWidth, const int32_t iHeight);
|
||||||
bool DetectSceneChange (SPicture* pCurPicture, SPicture* pRefPicture);
|
bool DetectSceneChange (SPicture* pCurPicture, SPicture* pRefPicture);
|
||||||
|
@ -337,7 +337,7 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi
|
|||||||
iSpatialNum = SingleLayerPreprocess (pCtx, kpSrcPic, &m_sScaledPicture);
|
iSpatialNum = SingleLayerPreprocess (pCtx, kpSrcPic, &m_sScaledPicture);
|
||||||
} else { // for console each spatial pictures are available there
|
} else { // for console each spatial pictures are available there
|
||||||
iSpatialNum = 1;
|
iSpatialNum = 1;
|
||||||
MultiLayerPreprocess (pCtx, &kpSrcPic, iSpatialNum);
|
MultiLayerPreprocess (pCtx, kpSrcPic);
|
||||||
}
|
}
|
||||||
|
|
||||||
return iSpatialNum;
|
return iSpatialNum;
|
||||||
@ -518,43 +518,36 @@ int32_t CWelsPreProcess::SingleLayerPreprocess (sWelsEncCtx* pCtx, const SSource
|
|||||||
return iSpatialNum;
|
return iSpatialNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CWelsPreProcess::MultiLayerPreprocess (sWelsEncCtx* pCtx, const SSourcePicture** kppSrcPicList,
|
int32_t CWelsPreProcess::MultiLayerPreprocess (sWelsEncCtx* pCtx, const SSourcePicture* kpSrcPic) {
|
||||||
const int32_t kiSpatialNum) {
|
|
||||||
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
||||||
const SSourcePicture* pSrc = NULL;
|
const SSourcePicture* pSrc = NULL;
|
||||||
SPicture* pDstPic = NULL;
|
SPicture* pDstPic = NULL;
|
||||||
const int32_t iSpatialLayersCfgCount =
|
const int32_t iSpatialLayersCfgCount =
|
||||||
pSvcParam->iSpatialLayerNum; // count number of spatial layers to be encoded in cfg
|
pSvcParam->iSpatialLayerNum; // count number of spatial layers to be encoded in cfg
|
||||||
int32_t i = 0;
|
|
||||||
int32_t j = -1;
|
int32_t j = -1;
|
||||||
|
|
||||||
|
// do not clear j, just let it continue to save complexity
|
||||||
do {
|
do {
|
||||||
pSrc = kppSrcPicList[i];
|
++ j;
|
||||||
|
if (pSvcParam->sDependencyLayers[j].iFrameWidth == kpSrcPic->iPicWidth &&
|
||||||
|
pSvcParam->sDependencyLayers[j].iFrameHeight == kpSrcPic->iPicHeight) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (j < iSpatialLayersCfgCount);
|
||||||
|
|
||||||
// do not clear j, just let it continue to save complexity
|
assert (j < iSpatialLayersCfgCount);
|
||||||
do {
|
pDstPic = m_pSpatialPic[j][m_uiSpatialLayersInTemporal[j] - 1];
|
||||||
++ j;
|
|
||||||
if (pSvcParam->sDependencyLayers[j].iFrameWidth == pSrc->iPicWidth &&
|
|
||||||
pSvcParam->sDependencyLayers[j].iFrameHeight == pSrc->iPicHeight) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (j < iSpatialLayersCfgCount);
|
|
||||||
|
|
||||||
assert (j < iSpatialLayersCfgCount);
|
WelsUpdateSpatialIdxMap (pCtx, 0, pDstPic, j);
|
||||||
pDstPic = m_pSpatialPic[j][m_uiSpatialLayersInTemporal[j] - 1];
|
|
||||||
|
|
||||||
WelsUpdateSpatialIdxMap (pCtx, i, pDstPic, j);
|
WelsMoveMemoryWrapper (pSvcParam, pDstPic, kpSrcPic, kpSrcPic->iPicWidth, kpSrcPic->iPicHeight);
|
||||||
|
|
||||||
WelsMoveMemoryWrapper (pSvcParam, pDstPic, pSrc, pSrc->iPicWidth, pSrc->iPicHeight);
|
if (pSvcParam->bEnableDenoise)
|
||||||
|
BilateralDenoising (pDstPic, kpSrcPic->iPicWidth, kpSrcPic->iPicHeight);
|
||||||
|
|
||||||
if (pSvcParam->bEnableDenoise)
|
m_pLastSpatialPicture[j][1] = pDstPic;
|
||||||
BilateralDenoising (pDstPic, pSrc->iPicWidth, pSrc->iPicHeight);
|
|
||||||
|
|
||||||
m_pLastSpatialPicture[j][1] = pDstPic;
|
if (pSvcParam->bEnableSceneChangeDetect && (1 == pSvcParam->iSpatialLayerNum)
|
||||||
++ i;
|
|
||||||
} while (i < kiSpatialNum);
|
|
||||||
|
|
||||||
if (pSvcParam->bEnableSceneChangeDetect && (kiSpatialNum == pSvcParam->iSpatialLayerNum)
|
|
||||||
&& !pCtx->pVaa->bIdrPeriodFlag && !pCtx->bEncCurFrmAsIdrFlag) {
|
&& !pCtx->pVaa->bIdrPeriodFlag && !pCtx->bEncCurFrmAsIdrFlag) {
|
||||||
SPicture* pRef = pCtx->pLtr[0].bReceivedT0LostFlag ?
|
SPicture* pRef = pCtx->pLtr[0].bReceivedT0LostFlag ?
|
||||||
m_pSpatialPic[0][m_uiSpatialLayersInTemporal[0] + pCtx->pVaa->uiValidLongTermPicIdx] :
|
m_pSpatialPic[0][m_uiSpatialLayersInTemporal[0] + pCtx->pVaa->uiValidLongTermPicIdx] :
|
||||||
|
Loading…
Reference in New Issue
Block a user