refine build spatial list in processing
This commit is contained in:
parent
e3bf5ced53
commit
775eebaf36
@ -110,7 +110,7 @@ class CWelsPreProcess {
|
|||||||
int32_t WelsPreprocessReset (sWelsEncCtx* pEncCtx);
|
int32_t WelsPreprocessReset (sWelsEncCtx* pEncCtx);
|
||||||
int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam);
|
int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam);
|
||||||
void FreeSpatialPictures (sWelsEncCtx* pCtx);
|
void FreeSpatialPictures (sWelsEncCtx* pCtx);
|
||||||
int32_t BuildSpatialPicList (sWelsEncCtx* pEncCtx, const SSourcePicture** kppSrcPicList, const int32_t kiConfiguredLayerNum);
|
int32_t BuildSpatialPicList (sWelsEncCtx* pEncCtx, const SSourcePicture* kpSrcPic);
|
||||||
int32_t AnalyzeSpatialPic (sWelsEncCtx* pEncCtx, const int32_t kiDIdx);
|
int32_t AnalyzeSpatialPic (sWelsEncCtx* pEncCtx, const int32_t kiDIdx);
|
||||||
int32_t UpdateSpatialPictures(sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, const int8_t iCurTid, const int32_t d_idx);
|
int32_t UpdateSpatialPictures(sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, const int8_t iCurTid, const int32_t d_idx);
|
||||||
|
|
||||||
|
@ -3000,7 +3000,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou
|
|||||||
pFbi->iLayerNum = 0; // for initialization
|
pFbi->iLayerNum = 0; // for initialization
|
||||||
|
|
||||||
// perform csc/denoise/downsample/padding, generate spatial layers
|
// perform csc/denoise/downsample/padding, generate spatial layers
|
||||||
iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, &pSrcPic, 1);
|
iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic);
|
||||||
if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
|
if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
|
||||||
++ pCtx->iCodingIndex;
|
++ pCtx->iCodingIndex;
|
||||||
pFbi->eOutputFrameType = WELS_FRAME_TYPE_SKIP;
|
pFbi->eOutputFrameType = WELS_FRAME_TYPE_SKIP;
|
||||||
|
@ -305,8 +305,7 @@ void CWelsPreProcess::FreeSpatialPictures (sWelsEncCtx* pCtx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePicture** kppSrcPicList,
|
int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePicture* kpSrcPic) {
|
||||||
const int32_t kiConfiguredLayerNum) {
|
|
||||||
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
||||||
int32_t iNumDependencyLayer = (int32_t)pSvcParam->iSpatialLayerNum;
|
int32_t iNumDependencyLayer = (int32_t)pSvcParam->iSpatialLayerNum;
|
||||||
int32_t iSpatialNum = 0;
|
int32_t iSpatialNum = 0;
|
||||||
@ -317,17 +316,11 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi
|
|||||||
if (WelsPreprocessReset (pCtx) != 0)
|
if (WelsPreprocessReset (pCtx) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
m_bOfficialBranch = (iNumDependencyLayer != kiConfiguredLayerNum);
|
m_bOfficialBranch = (iNumDependencyLayer != 1);
|
||||||
if (!m_bOfficialBranch && (iNumDependencyLayer == 1)) {
|
if ( iNumDependencyLayer == 1 ) {
|
||||||
// check the input source uiSize to decide if need switch to official branch
|
if (pSvcParam->sDependencyLayers[0].iFrameWidth != kpSrcPic->iPicWidth ||
|
||||||
// NOTICE: the layernum=1 case is confused in official/non-official cases!
|
pSvcParam->sDependencyLayers[0].iFrameHeight != kpSrcPic->iPicHeight) {
|
||||||
SSourcePicture** pic_queue = (SSourcePicture**)kppSrcPicList;
|
|
||||||
for (int32_t i = 0; i < iNumDependencyLayer; i++) {
|
|
||||||
if (pSvcParam->sDependencyLayers[i].iFrameWidth != pic_queue[i]->iPicWidth ||
|
|
||||||
pSvcParam->sDependencyLayers[i].iFrameHeight != pic_queue[i]->iPicHeight) {
|
|
||||||
m_bOfficialBranch = true;
|
m_bOfficialBranch = true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_bInitDone = true;
|
m_bInitDone = true;
|
||||||
@ -336,19 +329,15 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi
|
|||||||
if (m_pInterfaceVp == NULL)
|
if (m_pInterfaceVp == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (kiConfiguredLayerNum <= 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
pCtx->pVaa->bSceneChangeFlag = pCtx->pVaa->bIdrPeriodFlag = false;
|
pCtx->pVaa->bSceneChangeFlag = pCtx->pVaa->bIdrPeriodFlag = false;
|
||||||
if (pSvcParam->uiIntraPeriod)
|
if (pSvcParam->uiIntraPeriod)
|
||||||
pCtx->pVaa->bIdrPeriodFlag = (1 + pCtx->iFrameIndex >= (int32_t)pSvcParam->uiIntraPeriod) ? true : false;
|
pCtx->pVaa->bIdrPeriodFlag = (1 + pCtx->iFrameIndex >= (int32_t)pSvcParam->uiIntraPeriod) ? true : false;
|
||||||
|
|
||||||
if (m_bOfficialBranch) { // Perform Down Sampling potentially due to application
|
if (m_bOfficialBranch) { // Perform Down Sampling potentially due to application
|
||||||
assert (kiConfiguredLayerNum == 1);
|
iSpatialNum = SingleLayerPreprocess (pCtx, kpSrcPic, &m_sScaledPicture);
|
||||||
iSpatialNum = SingleLayerPreprocess (pCtx, kppSrcPicList[0], &m_sScaledPicture);
|
|
||||||
} else { // for console each spatial pictures are available there
|
} else { // for console each spatial pictures are available there
|
||||||
iSpatialNum = kiConfiguredLayerNum;
|
iSpatialNum = 1;
|
||||||
MultiLayerPreprocess (pCtx, kppSrcPicList, iSpatialNum);
|
MultiLayerPreprocess (pCtx, &kpSrcPic, iSpatialNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
return iSpatialNum;
|
return iSpatialNum;
|
||||||
|
Loading…
Reference in New Issue
Block a user