diff --git a/codec/encoder/core/inc/svc_enc_frame.h b/codec/encoder/core/inc/svc_enc_frame.h index 7234fc19..b0221769 100644 --- a/codec/encoder/core/inc/svc_enc_frame.h +++ b/codec/encoder/core/inc/svc_enc_frame.h @@ -103,7 +103,7 @@ struct TagDqLayer { SPicture* pRefPic; // reference picture pointer SPicture* pDecPic; // reconstruction picture pointer for layer - SPicture* pRefOri; + SPicture* pRefOri[MAX_REF_PIC_COUNT]; SSliceCtx* pSliceEncCtx; // current slice context diff --git a/codec/encoder/core/inc/wels_preprocess.h b/codec/encoder/core/inc/wels_preprocess.h index 9390fd9e..68e4ca85 100644 --- a/codec/encoder/core/inc/wels_preprocess.h +++ b/codec/encoder/core/inc/wels_preprocess.h @@ -126,7 +126,7 @@ class CWelsPreProcess { 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 GetRefCandidateLtrIndex (int32_t iRefIdx); + int32_t GetRefFrameInfo (int32_t iRefIdx,SPicture *&pRefOri); void AnalyzePictureComplexity (sWelsEncCtx* pCtx, SPicture* pCurPicture, SPicture* pRefPicture, const int32_t kiDependencyId, const bool kbCalculateBGD); diff --git a/codec/encoder/core/src/ref_list_mgr_svc.cpp b/codec/encoder/core/src/ref_list_mgr_svc.cpp index 04c2a209..192cea2f 100644 --- a/codec/encoder/core/src/ref_list_mgr_svc.cpp +++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp @@ -763,12 +763,14 @@ bool WelsBuildRefListScreen (void* pEncCtx, const int32_t iPOC, int32_t iBestLtr if (pCtx->eSliceType != I_SLICE) { int iLtrRefIdx = 0; + SPicture *pRefOri = NULL; for (int idx = 0; idx < pVaaExt->iNumOfAvailableRef; idx++) { - iLtrRefIdx = pCtx->pVpp->GetRefCandidateLtrIndex (idx); + iLtrRefIdx = pCtx->pVpp->GetRefFrameInfo(idx,pRefOri); if (iLtrRefIdx >= 0 && iLtrRefIdx <= pParam->iLTRRefNum) { SPicture* pRefPic = pRefList->pLongRefList[iLtrRefIdx]; if (pRefPic != NULL && pRefPic->bUsedAsRef && pRefPic->bIsLongRef) { if (pRefPic->uiTemporalId <= pCtx->uiTemporalId && (!pCtx->bCurFrameMarkedAsSceneLtr || pRefPic->bIsSceneLTR)) { + pCtx->pCurDqLayer->pRefOri[pCtx->iNumRef0] = pRefOri; pCtx->pRefList0[pCtx->iNumRef0++] = pRefPic; WelsLog (pCtx, WELS_LOG_INFO, "WelsBuildRefListScreen(), ref !current iFrameNum = %d, ref iFrameNum = %d,LTR number = %d,iNumRef = %d ref is Scene LTR = %d\n", @@ -785,6 +787,7 @@ bool WelsBuildRefListScreen (void* pEncCtx, const int32_t iPOC, int32_t iBestLtr continue; } else if (pRefList->pLongRefList[i]->uiTemporalId == 0 || pRefList->pLongRefList[i]->uiTemporalId < pCtx->uiTemporalId) { + pCtx->pCurDqLayer->pRefOri[pCtx->iNumRef0] = pRefOri; pCtx->pRefList0[pCtx->iNumRef0++] = pRefList->pLongRefList[i]; WelsLog (pCtx, WELS_LOG_INFO, "WelsBuildRefListScreen(), ref !current iFrameNum = %d, ref iFrameNum = %d,LTR number = %d\n", diff --git a/codec/encoder/core/src/svc_mode_decision.cpp b/codec/encoder/core/src/svc_mode_decision.cpp index 5cf4de84..ee99b621 100644 --- a/codec/encoder/core/src/svc_mode_decision.cpp +++ b/codec/encoder/core/src/svc_mode_decision.cpp @@ -194,7 +194,7 @@ bool JudgeStaticSkip (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache, SWe if (bTryStaticSkip) { int32_t iStrideUV, iOffsetUV; SWelsFuncPtrList* pFunc = pEncCtx->pFuncList; - SPicture* pRefOri = pCurDqLayer->pRefOri; + SPicture* pRefOri = pCurDqLayer->pRefOri[0]; if (pRefOri != NULL) { iStrideUV = pCurDqLayer->iEncStride[1]; iOffsetUV = (kiMbX + kiMbY * iStrideUV) << 3; @@ -229,7 +229,7 @@ bool JudgeScrollSkip (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache, SWe if (bTryScrollSkip) { int32_t iStrideUV, iOffsetUV; SWelsFuncPtrList* pFunc = pEncCtx->pFuncList; - SPicture* pRefOri = pCurDqLayer->pRefOri; + SPicture* pRefOri = pCurDqLayer->pRefOri[0]; if (pRefOri != NULL) { int32_t iScrollMvX = pVaaExt->sScrollDetectInfo.iScrollMvX; int32_t iScrollMvY = pVaaExt->sScrollDetectInfo.iScrollMvY; diff --git a/codec/encoder/core/src/wels_preprocess.cpp b/codec/encoder/core/src/wels_preprocess.cpp index d9f2f0ae..1d3e01bb 100644 --- a/codec/encoder/core/src/wels_preprocess.cpp +++ b/codec/encoder/core/src/wels_preprocess.cpp @@ -1078,11 +1078,12 @@ ESceneChangeIdc CWelsPreProcess::DetectSceneChangeScreen (sWelsEncCtx* pCtx, SPi return static_cast (iVaaFrameSceneChangeIdc); } -int32_t CWelsPreProcess::GetRefCandidateLtrIndex (int32_t iRefIdx) { +int32_t CWelsPreProcess::GetRefFrameInfo(int32_t iRefIdx,SPicture *&pRefOri) { const int32_t iTargetDid = m_pEncCtx->pSvcParam->iSpatialLayerNum - 1; SVAAFrameInfoExt* pVaaExt = static_cast (m_pEncCtx->pVaa); SRefInfoParam* BestRefCandidateParam = & (pVaaExt->sVaaStrBestRefCandidate[iRefIdx]); int32_t iLtrRefIdx = m_pSpatialPic[iTargetDid][BestRefCandidateParam->iSrcListIdx]->iLongTermPicNum; + pRefOri = m_pSpatialPic[iTargetDid][BestRefCandidateParam->iSrcListIdx]; return iLtrRefIdx; } void CWelsPreProcess::Padding (uint8_t* pSrcY, uint8_t* pSrcU, uint8_t* pSrcV, int32_t iStrideY, int32_t iStrideUV,