ref: 5cbe4a40d3e2b9f4d6eb399f87af59e9a1d1222b
parent: b6ed8cc76771949c0b583ddc9e37c0fb9f11b993
parent: 74df3e955334caeb2b92c68721575dc7db6b72e5
author: sijchen <[email protected]>
date: Mon Jun 9 06:17:13 EDT 2014
Merge pull request #926 from ruil2/enc_reforg add ref-original frame assigment
--- a/codec/encoder/core/inc/svc_enc_frame.h
+++ b/codec/encoder/core/inc/svc_enc_frame.h
@@ -103,7 +103,7 @@
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
--- a/codec/encoder/core/inc/wels_preprocess.h
+++ b/codec/encoder/core/inc/wels_preprocess.h
@@ -126,7 +126,7 @@
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);
--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -763,12 +763,14 @@
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 @@
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",
--- a/codec/encoder/core/src/svc_mode_decision.cpp
+++ b/codec/encoder/core/src/svc_mode_decision.cpp
@@ -194,7 +194,7 @@
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 @@
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;
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -1078,11 +1078,12 @@
return static_cast<ESceneChangeIdc> (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<SVAAFrameInfoExt*> (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,