Merge pull request #1391 from sijchen/modi_stra34
[Encoder] Fix a warning and refactor
This commit is contained in:
commit
72df20000b
@ -99,6 +99,27 @@ int32_t iFrameAverageQp;
|
||||
|
||||
/*******************************for screen reference frames****************************/
|
||||
SScreenBlockFeatureStorage* pScreenBlockFeatureStorage;
|
||||
|
||||
/*
|
||||
* set picture as unreferenced
|
||||
*/
|
||||
void SetUnref () {
|
||||
if (NULL != this) {
|
||||
iFramePoc = -1;
|
||||
iFrameNum = -1;
|
||||
uiTemporalId =
|
||||
uiSpatialId =
|
||||
iLongTermPicNum = -1;
|
||||
bIsLongRef = false;
|
||||
uiRecieveConfirmed = RECIEVE_FAILED;
|
||||
iMarkFrameNum = -1;
|
||||
bUsedAsRef = false;
|
||||
|
||||
if (NULL != pScreenBlockFeatureStorage)
|
||||
pScreenBlockFeatureStorage->bRefBlockFeatureCalculated = false;
|
||||
}
|
||||
}
|
||||
|
||||
} SPicture;
|
||||
|
||||
/*
|
||||
|
@ -62,12 +62,5 @@ SPicture* AllocPicture (CMemoryAlign* pMa, const int32_t kiWidth, const int32_t
|
||||
*/
|
||||
void FreePicture (CMemoryAlign* pMa, SPicture** ppPic);
|
||||
|
||||
/*!
|
||||
* \brief exchange two picture pData planes
|
||||
* \param ppPic1 picture pointer to picture 1
|
||||
* \param ppPic2 picture pointer to picture 2
|
||||
* \return none
|
||||
*/
|
||||
void WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2);
|
||||
}
|
||||
#endif//WELS_ENCODER_PICTURE_HANDLE_H__
|
||||
|
@ -47,11 +47,6 @@
|
||||
#include "codec_app_def.h"
|
||||
|
||||
namespace WelsEnc {
|
||||
typedef enum {
|
||||
RECIEVE_UNKOWN = 0,
|
||||
RECIEVE_SUCCESS = 1,
|
||||
RECIEVE_FAILED = 2,
|
||||
} LTR_MARKING_RECEIVE_STATE;
|
||||
|
||||
typedef enum {
|
||||
LTR_DIRECT_MARK = 0,
|
||||
|
@ -189,6 +189,12 @@ BLOCK_4x4 = 4,
|
||||
BLOCK_SIZE_ALL = 5
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
RECIEVE_UNKOWN = 0,
|
||||
RECIEVE_SUCCESS = 1,
|
||||
RECIEVE_FAILED = 2,
|
||||
} LTR_MARKING_RECEIVE_STATE;
|
||||
|
||||
enum {
|
||||
CUR_AU_IDX = 0, // index symbol for current access unit
|
||||
SUC_AU_IDX = 1 // index symbol for successive access unit
|
||||
|
@ -132,6 +132,14 @@ class CWelsPreProcess {
|
||||
const int32_t kiDependencyId, const bool kbCalculateBGD);
|
||||
int32_t UpdateBlockIdcForScreen (uint8_t* pCurBlockStaticPointer, const SPicture* kpRefPic, const SPicture* kpSrcPic);
|
||||
|
||||
SPicture* GetCurrentFrameFromOrigList (int32_t iDIdx) {
|
||||
return m_pSpatialPic[iDIdx][0];
|
||||
};
|
||||
void UpdateSrcList (SPicture* pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList,
|
||||
const uint32_t kuiShortRefCount);
|
||||
void UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture* pCurPicture, const int32_t kiCurDid,
|
||||
const int32_t kuiMarkLongTermPicIdx, SPicture** pLongRefList);
|
||||
|
||||
private:
|
||||
int32_t WelsPreprocessCreate();
|
||||
int32_t WelsPreprocessDestroy();
|
||||
@ -160,8 +168,9 @@ class CWelsPreProcess {
|
||||
|
||||
ESceneChangeIdc DetectSceneChangeScreen (sWelsEncCtx* pCtx, SPicture* pCurPicture);
|
||||
void InitPixMap (const SPicture* pPicture, SPixMap* pPixMap);
|
||||
void GetAvailableRefListLosslessScreenRefSelection (SPicture** pSrcPicList, uint8_t iCurTid, const int32_t iClosestLtrFrameNum,
|
||||
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum);
|
||||
void GetAvailableRefListLosslessScreenRefSelection (SPicture** pSrcPicList, uint8_t iCurTid,
|
||||
const int32_t iClosestLtrFrameNum,
|
||||
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum);
|
||||
void GetAvailableRefList (SPicture** pSrcPicList, uint8_t iCurTid, const int32_t iClosestLtrFrameNum,
|
||||
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum);
|
||||
void InitRefJudgement (SRefJudgement* pRefJudgement);
|
||||
@ -172,6 +181,14 @@ class CWelsPreProcess {
|
||||
SRefInfoParam* pRefSaved);
|
||||
void SaveBestRefToVaa (SRefInfoParam& sRefSaved, SRefInfoParam* pVaaBestRef);
|
||||
|
||||
/*!
|
||||
* \brief exchange two picture pData planes
|
||||
* \param ppPic1 picture pointer to picture 1
|
||||
* \param ppPic2 picture pointer to picture 2
|
||||
* \return none
|
||||
*/
|
||||
void WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2);
|
||||
|
||||
private:
|
||||
Scaled_Picture m_sScaledPicture;
|
||||
SPicture* m_pLastSpatialPicture[MAX_DEPENDENCY_LAYER][2];
|
||||
@ -182,8 +199,9 @@ class CWelsPreProcess {
|
||||
uint8_t m_uiSpatialPicNum[MAX_DEPENDENCY_LAYER];
|
||||
public:
|
||||
/* For Downsampling & VAA I420 based source pictures */
|
||||
SPicture* m_pSpatialPic[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL + 1 +
|
||||
LONG_TERM_REF_NUM]; // need memory requirement with total number of (log2(uiGopSize)+1+1+long_term_ref_num)
|
||||
SPicture* m_pSpatialPic[MAX_DEPENDENCY_LAYER][MAX_REF_PIC_COUNT + 1];
|
||||
// need memory requirement with total number of num_of_ref + 1, "+1" is for current frame
|
||||
int32_t m_iAvaliableRefInSpatialPicList;
|
||||
|
||||
};
|
||||
|
||||
|
@ -179,20 +179,6 @@ void FreePicture (CMemoryAlign* pMa, SPicture** ppPic) {
|
||||
*ppPic = NULL;
|
||||
}
|
||||
}
|
||||
/*!
|
||||
* \brief exchange two picture pData planes
|
||||
* \param ppPic1 picture pointer to picture 1
|
||||
* \param ppPic2 picture pointer to picture 2
|
||||
* \return none
|
||||
*/
|
||||
void WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2) {
|
||||
SPicture* tmp = *ppPic1;
|
||||
|
||||
assert (*ppPic1 != *ppPic2);
|
||||
|
||||
*ppPic1 = *ppPic2;
|
||||
*ppPic2 = tmp;
|
||||
}
|
||||
|
||||
} // namespace WelsEnc
|
||||
|
||||
|
@ -35,25 +35,6 @@
|
||||
#include "utils.h"
|
||||
#include "picture_handle.h"
|
||||
namespace WelsEnc {
|
||||
/*
|
||||
* set picture as unreferenced
|
||||
*/
|
||||
void SetUnref (SPicture* pRef) {
|
||||
if (NULL != pRef) {
|
||||
pRef->iFramePoc = -1;
|
||||
pRef->iFrameNum = -1;
|
||||
pRef->uiTemporalId =
|
||||
pRef->uiSpatialId =
|
||||
pRef->iLongTermPicNum = -1;
|
||||
pRef->bIsLongRef = false;
|
||||
pRef->uiRecieveConfirmed = RECIEVE_FAILED;
|
||||
pRef->iMarkFrameNum = -1;
|
||||
pRef->bUsedAsRef = false;
|
||||
|
||||
if (NULL != pRef->pScreenBlockFeatureStorage)
|
||||
pRef->pScreenBlockFeatureStorage->bRefBlockFeatureCalculated = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* reset LTR marking , recovery ,feedback state to default
|
||||
@ -90,7 +71,7 @@ void WelsResetRefList (sWelsEncCtx* pCtx) {
|
||||
for (i = 0; i < pCtx->pSvcParam->iLTRRefNum + 1; i++)
|
||||
pRefList->pLongRefList[i] = NULL;
|
||||
for (i = 0; i < pCtx->pSvcParam->iNumRefFrame + 1; i++)
|
||||
SetUnref (pRefList->pRef[i]);
|
||||
pRefList->pRef[i]->SetUnref ();
|
||||
|
||||
pRefList->uiLongRefCount = 0;
|
||||
pRefList->uiShortRefCount = 0;
|
||||
@ -125,7 +106,7 @@ static void DeleteNonSceneLTR (sWelsEncCtx* pCtx) {
|
||||
SPicture* pRef = pRefList->pLongRefList[i];
|
||||
if (pRef != NULL && pRef->bUsedAsRef && pRef->bIsLongRef && (!pRef->bIsSceneLTR) &&
|
||||
(pCtx->uiTemporalId < pRef->uiTemporalId || pCtx->bCurFrameMarkedAsSceneLtr)) {
|
||||
SetUnref (pRef);
|
||||
pRef->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, i);
|
||||
i--;
|
||||
}
|
||||
@ -181,7 +162,7 @@ static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
|
||||
iMaxFrameNumPlus1) & (FRAME_NUM_EQUAL | FRAME_NUM_SMALLER))) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING, "LTR ,invalid LTR delete ,long_term_idx = %d , iFrameNum =%d ",
|
||||
pLongRefList[i]->iLongTermPicNum, pLongRefList[i]->iFrameNum);
|
||||
SetUnref (pLongRefList[i]);
|
||||
pLongRefList[i]->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, i);
|
||||
pLtr->bLTRMarkEnable = true;
|
||||
if (pRefList->uiLongRefCount == 0) {
|
||||
@ -194,7 +175,7 @@ static inline void DeleteInvalidLTR (sWelsEncCtx* pCtx) {
|
||||
&& pLtr->iLTRMarkMode == LTR_DELAY_MARK) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING, "LTR ,iMarkFrameNum invalid LTR delete ,long_term_idx = %d , iFrameNum =%d ",
|
||||
pLongRefList[i]->iLongTermPicNum, pLongRefList[i]->iFrameNum);
|
||||
SetUnref (pLongRefList[i]);
|
||||
pLongRefList[i]->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, i);
|
||||
pLtr->bLTRMarkEnable = true;
|
||||
if (pRefList->uiLongRefCount == 0) {
|
||||
@ -230,7 +211,7 @@ static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
|
||||
|
||||
for (j = 0; j < pRefList->uiLongRefCount; j++) {
|
||||
if (pLongRefList[j]->iLongTermPicNum != pLtr->iCurLtrIdx) {
|
||||
SetUnref (pLongRefList[j]);
|
||||
pLongRefList[j]->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, j);
|
||||
}
|
||||
}
|
||||
@ -247,7 +228,7 @@ static inline void HandleLTRMarkFeedback (sWelsEncCtx* pCtx) {
|
||||
} else if (pLtr->uiLtrMarkState == LTR_MARKING_FAILED) {
|
||||
for (i = 0; i < pRefList->uiLongRefCount; i++) {
|
||||
if (pLongRefList[i]->iFrameNum == pLtr->iLtrMarkFbFrameNum) {
|
||||
SetUnref (pLongRefList[i]);
|
||||
pLongRefList[i]->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, i);
|
||||
break;
|
||||
}
|
||||
@ -316,7 +297,7 @@ static inline void LTRMarkProcess (sWelsEncCtx* pCtx) {
|
||||
pLongRefList[0] = pShortRefList[i];
|
||||
pRefList->uiLongRefCount++;
|
||||
if (pRefList->uiLongRefCount > pCtx->pSvcParam->iLTRRefNum) {
|
||||
SetUnref (pRefList->pLongRefList[pRefList->uiLongRefCount - 1]);
|
||||
pRefList->pLongRefList[pRefList->uiLongRefCount - 1]->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, pRefList->uiLongRefCount - 1);
|
||||
}
|
||||
DeleteSTRFromShortList (pCtx, i);
|
||||
@ -330,7 +311,7 @@ static inline void LTRMarkProcessScreen (sWelsEncCtx* pCtx) {
|
||||
pCtx->pVaa->uiMarkLongTermPicIdx = pCtx->pDecPic->iLongTermPicNum;
|
||||
|
||||
if (pLongRefList[iLtrIdx] != NULL) {
|
||||
SetUnref (pLongRefList[iLtrIdx]);
|
||||
pLongRefList[iLtrIdx]->SetUnref ();
|
||||
DeleteLTRFromLongList (pCtx, iLtrIdx);
|
||||
}
|
||||
pLongRefList[iLtrIdx] = pCtx->pDecPic;
|
||||
@ -353,7 +334,7 @@ static void PrefetchNextBuffer (void* pEncCtx) {
|
||||
|
||||
if (pRefList->pNextBuffer == NULL && pRefList->uiShortRefCount > 0) {
|
||||
pRefList->pNextBuffer = pRefList->pShortRefList[pRefList->uiShortRefCount - 1];
|
||||
SetUnref (pRefList->pNextBuffer);
|
||||
pRefList->pNextBuffer->SetUnref ();
|
||||
}
|
||||
|
||||
pCtx->pDecPic = pRefList->pNextBuffer;
|
||||
@ -417,12 +398,12 @@ bool WelsUpdateRefList (void* pEncCtx) {
|
||||
}
|
||||
|
||||
for (i = pRefList->uiShortRefCount - 1; i > 0; i--) {
|
||||
SetUnref (pRefList->pShortRefList[i]);
|
||||
pRefList->pShortRefList[i]->SetUnref ();
|
||||
DeleteSTRFromShortList (pCtx, i);
|
||||
}
|
||||
if (pRefList->uiShortRefCount > 0 && (pRefList->pShortRefList[0]->uiTemporalId > 0
|
||||
|| pRefList->pShortRefList[0]->iFrameNum != pCtx->iFrameNum)) {
|
||||
SetUnref (pRefList->pShortRefList[0]);
|
||||
pRefList->pShortRefList[0]->SetUnref ();
|
||||
DeleteSTRFromShortList (pCtx, 0);
|
||||
}
|
||||
}
|
||||
@ -711,62 +692,24 @@ static inline void UpdateOriginalPicInfo (SPicture* pOrigPic, SPicture* pReconPi
|
||||
pOrigPic->iFrameAverageQp = pReconPic->iFrameAverageQp;
|
||||
}
|
||||
|
||||
static void UpdateSrcListLosslessScreenRefSelectionWithLtr (sWelsEncCtx* pCtx) {
|
||||
int32_t iDIdx = pCtx->uiDependencyId;
|
||||
SPicture** pLongRefList = pCtx->ppRefPicListExt[iDIdx]->pLongRefList;
|
||||
SPicture** pLongRefSrcList = &pCtx->pVpp->m_pSpatialPic[iDIdx][0];
|
||||
for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) {
|
||||
if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef
|
||||
&& pLongRefList[i]->bIsLongRef)) {
|
||||
continue;
|
||||
} else {
|
||||
SetUnref (pLongRefSrcList[i + 1]);
|
||||
}
|
||||
}
|
||||
WelsExchangeSpatialPictures (&pCtx->pVpp->m_pSpatialPic[iDIdx][0],
|
||||
&pCtx->pVpp->m_pSpatialPic[iDIdx][1 + pCtx->pVaa->uiMarkLongTermPicIdx]);
|
||||
}
|
||||
|
||||
static void UpdateSrcList (sWelsEncCtx* pCtx) {
|
||||
int32_t iDIdx = pCtx->uiDependencyId;
|
||||
SPicture** pShortRefList = pCtx->ppRefPicListExt[iDIdx]->pShortRefList;
|
||||
const uint32_t kuiShortRefCount = pCtx->ppRefPicListExt[iDIdx]->uiShortRefCount;
|
||||
SPicture** pRefSrcList = &pCtx->pVpp->m_pSpatialPic[iDIdx][0];
|
||||
|
||||
//pRefSrcList[0] is for current frame
|
||||
if (pCtx->eSliceType == P_SLICE && pCtx->uiTemporalId != 0) {
|
||||
for (int iRefIdx = kuiShortRefCount - 1; iRefIdx >= 0; --iRefIdx) {
|
||||
WelsExchangeSpatialPictures (&pRefSrcList[iRefIdx + 1],
|
||||
&pRefSrcList[iRefIdx]);
|
||||
}
|
||||
} else {
|
||||
WelsExchangeSpatialPictures (&pRefSrcList[0], &pRefSrcList[1]);
|
||||
for (int32_t i = MAX_SHORT_REF_COUNT - 1; i > 0 ; --i) {
|
||||
if (pRefSrcList[i + 1] != NULL) {
|
||||
SetUnref (pRefSrcList[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void UpdateSrcPicListLosslessScreenRefSelectionWithLtr (void* pEncCtx) {
|
||||
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
|
||||
int32_t iDIdx = pCtx->uiDependencyId;
|
||||
//update info in src list
|
||||
UpdateOriginalPicInfo (pCtx->pEncPic, pCtx->pDecPic);
|
||||
PrefetchNextBuffer (pCtx);
|
||||
UpdateSrcListLosslessScreenRefSelectionWithLtr (pCtx);
|
||||
SetUnref (pCtx->pVpp->m_pSpatialPic[iDIdx][0]);
|
||||
pCtx->pVpp->UpdateSrcListLosslessScreenRefSelectionWithLtr (pCtx->pEncPic, iDIdx, pCtx->pVaa->uiMarkLongTermPicIdx, pCtx->ppRefPicListExt[iDIdx]->pLongRefList);
|
||||
}
|
||||
|
||||
|
||||
static void UpdateSrcPicList (void* pEncCtx) {
|
||||
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
|
||||
int32_t iDIdx = pCtx->uiDependencyId;
|
||||
//update info in src list
|
||||
UpdateOriginalPicInfo (pCtx->pEncPic, pCtx->pDecPic);
|
||||
PrefetchNextBuffer (pCtx);
|
||||
UpdateSrcList (pCtx);
|
||||
SetUnref (pCtx->pVpp->m_pSpatialPic[iDIdx][0]);
|
||||
pCtx->pVpp->UpdateSrcList (pCtx->pEncPic, iDIdx, pCtx->ppRefPicListExt[iDIdx]->pShortRefList, pCtx->ppRefPicListExt[iDIdx]->uiShortRefCount);
|
||||
}
|
||||
|
||||
bool WelsUpdateRefListScreen (void* pEncCtx) {
|
||||
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
|
||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||
|
@ -185,6 +185,8 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi
|
||||
if (WelsPreprocessReset (pCtx) != 0)
|
||||
return -1;
|
||||
|
||||
m_iAvaliableRefInSpatialPicList = pSvcParam->iNumRefFrame;
|
||||
|
||||
m_bInitDone = true;
|
||||
}
|
||||
|
||||
@ -861,8 +863,7 @@ void CWelsPreProcess::InitPixMap (const SPicture* pPicture, SPixMap* pPixMap) {
|
||||
void CWelsPreProcess::GetAvailableRefListLosslessScreenRefSelection (SPicture** pSrcPicList, uint8_t iCurTid,
|
||||
const int32_t iClosestLtrFrameNum,
|
||||
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum) {
|
||||
SWelsSvcCodingParam* pSvcParam = m_pEncCtx->pSvcParam;
|
||||
const int32_t iSourcePicNum = pSvcParam->iNumRefFrame;
|
||||
const int32_t iSourcePicNum = m_iAvaliableRefInSpatialPicList;
|
||||
if (0 >= iSourcePicNum) {
|
||||
iAvailableRefNum = 0;
|
||||
iAvailableSceneRefNum = 0;
|
||||
@ -911,8 +912,7 @@ void CWelsPreProcess::GetAvailableRefListLosslessScreenRefSelection (SPicture**
|
||||
|
||||
void CWelsPreProcess::GetAvailableRefList (SPicture** pSrcPicList, uint8_t iCurTid, const int32_t iClosestLtrFrameNum,
|
||||
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum) {
|
||||
SWelsSvcCodingParam* pSvcParam = m_pEncCtx->pSvcParam;
|
||||
const int32_t iSourcePicNum = pSvcParam->iNumRefFrame;
|
||||
const int32_t iSourcePicNum = m_iAvaliableRefInSpatialPicList;
|
||||
if (0 >= iSourcePicNum) {
|
||||
iAvailableRefNum = 0;
|
||||
iAvailableSceneRefNum = 0;
|
||||
@ -1180,6 +1180,60 @@ int32_t CWelsPreProcess::UpdateBlockIdcForScreen (uint8_t* pCurBlockStaticPoint
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief exchange two picture pData planes
|
||||
* \param ppPic1 picture pointer to picture 1
|
||||
* \param ppPic2 picture pointer to picture 2
|
||||
* \return none
|
||||
*/
|
||||
void CWelsPreProcess::WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** ppPic2) {
|
||||
SPicture* tmp = *ppPic1;
|
||||
|
||||
assert (*ppPic1 != *ppPic2);
|
||||
|
||||
*ppPic1 = *ppPic2;
|
||||
*ppPic2 = tmp;
|
||||
}
|
||||
|
||||
void CWelsPreProcess::UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture* pCurPicture, const int32_t kiCurDid, const int32_t kuiMarkLongTermPicIdx, SPicture** pLongRefList) {
|
||||
SPicture** pLongRefSrcList = &m_pSpatialPic[kiCurDid][0];
|
||||
for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) {
|
||||
if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef
|
||||
&& pLongRefList[i]->bIsLongRef)) {
|
||||
continue;
|
||||
} else {
|
||||
pLongRefSrcList[i + 1]->SetUnref ();
|
||||
}
|
||||
}
|
||||
WelsExchangeSpatialPictures (&m_pSpatialPic[kiCurDid][0],
|
||||
&m_pSpatialPic[kiCurDid][1 + kuiMarkLongTermPicIdx]);
|
||||
m_iAvaliableRefInSpatialPicList = MAX_REF_PIC_COUNT;
|
||||
(GetCurrentFrameFromOrigList(kiCurDid))->SetUnref ();
|
||||
}
|
||||
void CWelsPreProcess::UpdateSrcList (SPicture* pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList, const uint32_t kuiShortRefCount) {
|
||||
SPicture** pRefSrcList = &m_pSpatialPic[kiCurDid][0];
|
||||
|
||||
//pRefSrcList[0] is for current frame
|
||||
if (pCurPicture->bUsedAsRef || pCurPicture->bIsLongRef) {
|
||||
if (pCurPicture->iPictureType == P_SLICE && pCurPicture->uiTemporalId != 0 ) {
|
||||
for (int iRefIdx = kuiShortRefCount - 1; iRefIdx >= 0; --iRefIdx) {
|
||||
WelsExchangeSpatialPictures (&pRefSrcList[iRefIdx + 1],
|
||||
&pRefSrcList[iRefIdx]);
|
||||
}
|
||||
m_iAvaliableRefInSpatialPicList = kuiShortRefCount;
|
||||
} else {
|
||||
WelsExchangeSpatialPictures (&pRefSrcList[0], &pRefSrcList[1]);
|
||||
for (int32_t i = MAX_SHORT_REF_COUNT - 1; i > 0 ; --i) {
|
||||
if (pRefSrcList[i + 1] != NULL) {
|
||||
pRefSrcList[i + 1]->SetUnref ();
|
||||
}
|
||||
}
|
||||
m_iAvaliableRefInSpatialPicList = 1;
|
||||
}
|
||||
}
|
||||
(GetCurrentFrameFromOrigList(kiCurDid))->SetUnref ();
|
||||
}
|
||||
|
||||
//TODO: may opti later
|
||||
//TODO: not use this func?
|
||||
void* WelsMemcpy (void* dst, const void* kpSrc, uint32_t uiSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user