ref: 8bacc3d4d066d8453e4169171289b0a14828b7fd
parent: f6b6a0f6aaec95152f1bee5ff09434fb00542ed2
author: [email protected] <[email protected]>
date: Wed Jun 1 17:26:24 EDT 2016
Preprocess: refactor to improve code readability
--- a/codec/encoder/core/inc/wels_preprocess.h
+++ b/codec/encoder/core/inc/wels_preprocess.h
@@ -178,7 +178,6 @@
void WelsMoveMemoryWrapper (SWelsSvcCodingParam* pSvcParam, SPicture* pDstPic, const SSourcePicture* kpSrc,
const int32_t kiWidth, const int32_t kiHeight);
-
/*!
* \brief exchange two picture pData planes
* \param ppPic1 picture pointer to picture 1
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -929,9 +929,10 @@
pPixMap->eFormat = VIDEO_FORMAT_I420;
}
-void CWelsPreProcessScreen::GetAvailableRefListLosslessScreenRefSelection (SPicture** pSrcPicList, uint8_t iCurTid,
+
+void CWelsPreProcessScreen::GetAvailableRefListLosslessScreenRefSelection (SPicture** pRefPicList, uint8_t iCurTid,
const int32_t iClosestLtrFrameNum,
- SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum) {
+ SRefInfoParam* pAvailableRefParam, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum) {
const int32_t iSourcePicNum = m_iAvaliableRefInSpatialPicList;
if (0 >= iSourcePicNum) {
iAvailableRefNum = 0;
@@ -949,7 +950,7 @@
//the saving order will be depend on pSrcPicList
//TODO: use a frame_idx to find the closer ref in time distance, and correctly sort the ref list
for (int32_t i = iSourcePicNum - 1; i >= 0; --i) {
- pRefPic = pSrcPicList[i];
+ pRefPic = pRefPicList[i];
if (NULL == pRefPic || !pRefPic->bUsedAsRef || !pRefPic->bIsLongRef || (bCurFrameMarkedAsSceneLtr
&& (!pRefPic->bIsSceneLTR))) {
continue;
@@ -959,26 +960,25 @@
if (bRefRealLtr || (0 == iCurTid && 0 == uiRefTid) || (uiRefTid < iCurTid)) {
int32_t idx = (pRefPic->iLongTermPicNum == iClosestLtrFrameNum) ? (0) : (iAvailableRefNum++);
- pAvailableRefList[idx].pRefPicture = pRefPic;
- pAvailableRefList[idx].iSrcListIdx = i + 1; //in SrcList, the idx 0 is reserved for CurPic
+ pAvailableRefParam[idx].pRefPicture = pRefPic;
+ pAvailableRefParam[idx].iSrcListIdx = i + 1; //in SrcList, the idx 0 is reserved for CurPic
iAvailableSceneRefNum += bRefRealLtr;
}
}
- if (pAvailableRefList[0].pRefPicture == NULL) {
+ if (pAvailableRefParam[0].pRefPicture == NULL) {
for (int32_t i = 1; i < iAvailableRefNum ; ++i) {
- pAvailableRefList[i - 1].pRefPicture = pAvailableRefList[i].pRefPicture;
- pAvailableRefList[i - 1].iSrcListIdx = pAvailableRefList[i].iSrcListIdx;
+ pAvailableRefParam[i - 1].pRefPicture = pAvailableRefParam[i].pRefPicture;
+ pAvailableRefParam[i - 1].iSrcListIdx = pAvailableRefParam[i].iSrcListIdx;
}
- pAvailableRefList[iAvailableRefNum - 1].pRefPicture = NULL;
- pAvailableRefList[iAvailableRefNum - 1].iSrcListIdx = 0;
+ pAvailableRefParam[iAvailableRefNum - 1].pRefPicture = NULL;
+ pAvailableRefParam[iAvailableRefNum - 1].iSrcListIdx = 0;
--iAvailableRefNum;
}
}
-
void CWelsPreProcessScreen::GetAvailableRefList (SPicture** pSrcPicList, uint8_t iCurTid,
const int32_t iClosestLtrFrameNum,
SRefInfoParam* pAvailableRefList, int32_t& iAvailableRefNum, int32_t& iAvailableSceneRefNum) {
@@ -1064,12 +1064,12 @@
}
ESceneChangeIdc iVaaFrameSceneChangeIdc = LARGE_CHANGED_SCENE;
- SPicture** pSrcPicList = &m_pSpatialPic[iTargetDid][1];
- if (NULL == pSrcPicList) {
+ SPicture** pRefPicList = &m_pSpatialPic[iTargetDid][1];
+ if (NULL == pRefPicList) {
return LARGE_CHANGED_SCENE;
}
- SRefInfoParam sAvailableRefList[MAX_REF_PIC_COUNT] = { { 0 } };
+ SRefInfoParam sAvailableRefParam[MAX_REF_PIC_COUNT] = { { 0 } };
int32_t iAvailableRefNum = 0;
int32_t iAvailableSceneRefNum = 0;
@@ -1101,11 +1101,11 @@
}
const int32_t iClosestLtrFrameNum = pCtx->pLtr[iTargetDid].iLastLtrIdx[iCurTid];
if (pSvcParam->bEnableLongTermReference) {
- GetAvailableRefListLosslessScreenRefSelection (pSrcPicList, iCurTid, iClosestLtrFrameNum, &sAvailableRefList[0],
+ GetAvailableRefListLosslessScreenRefSelection (pRefPicList, iCurTid, iClosestLtrFrameNum, &sAvailableRefParam[0],
iAvailableRefNum,
iAvailableSceneRefNum);
} else {
- GetAvailableRefList (pSrcPicList, iCurTid, iClosestLtrFrameNum, &sAvailableRefList[0], iAvailableRefNum,
+ GetAvailableRefList (pRefPicList, iCurTid, iClosestLtrFrameNum, &sAvailableRefParam[0], iAvailableRefNum,
iAvailableSceneRefNum);
}
//after this build, pAvailableRefList[idx].iSrcListIdx is the idx of the ref in h->spatial_pic
@@ -1124,7 +1124,7 @@
sSceneChangeResult.pStaticBlockIdc = pCurBlockStaticPointer;
sSceneChangeResult.sScrollResult.bScrollDetectFlag = false;
- pRefPicInfo = & (sAvailableRefList[iScdIdx]);
+ pRefPicInfo = & (sAvailableRefParam[iScdIdx]);
assert (NULL != pRefPicInfo);
pRefPic = pRefPicInfo->pRefPicture;
InitPixMap (pRefPic, &sRefMap);