add fix for the valgrid warning of issue#1362

This commit is contained in:
Sijia Chen 2015-01-09 16:17:51 +08:00
parent 76ef30dc82
commit a4ae5e3747
4 changed files with 11 additions and 11 deletions

View File

@ -201,7 +201,7 @@ typedef struct TagWelsEncCtx {
SSpatialPicIndex sSpatialIndexMap[MAX_DEPENDENCY_LAYER];
bool bLongTermRefFlag[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL + 1/*+LONG_TERM_REF_NUM*/];
bool bRefOfCurTidIsLtr[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL];
uint16_t uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR
int16_t iMaxSliceCount;// maximal count number of slices for all layers observation

View File

@ -3727,11 +3727,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
WelsSwapDqLayers (pCtx);
}
if (pSvcParam->bEnableLongTermReference && (pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag
&& (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DELAY_MARK))) {
pCtx->bLongTermRefFlag[iDidIdx][0] = true;
}
if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) {
ForceCodingIDR (pCtx);
WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");
@ -3742,7 +3737,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
if (pSvcParam->bEnableLongTermReference && ((pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag
&& (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) {
pCtx->bLongTermRefFlag[iDidIdx][iCurTid] = true;
pCtx->bRefOfCurTidIsLtr[iDidIdx][iCurTid] = true;
}
}

View File

@ -289,8 +289,10 @@ static inline void LTRMarkProcess (sWelsEncCtx* pCtx) {
}
}
if ((pLtr->iLTRMarkMode == LTR_DELAY_MARK && pLtr->bLTRMarkingFlag) || ((pLtr->iLTRMarkMode == LTR_DIRECT_MARK)
&& (bMoveLtrFromShortToLong))) {
if ((pLtr->iLTRMarkMode == LTR_DELAY_MARK && pLtr->bLTRMarkingFlag)
|| ((pLtr->iLTRMarkMode == LTR_DIRECT_MARK) && (bMoveLtrFromShortToLong))) {
pCtx->bRefOfCurTidIsLtr[pCtx->uiDependencyId][pCtx->uiTemporalId] = true;
if (pRefList->uiLongRefCount > 0) {
memmove (&pRefList->pLongRefList[1], &pRefList->pLongRefList[0],
pRefList->uiLongRefCount * sizeof (SPicture*)); // confirmed_safe_unsafe_usage
@ -595,6 +597,9 @@ bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t iPOC, int32_t iBestLtrRe
} else { // safe for IDR
WelsResetRefList (pCtx); //for IDR, SHOULD reset pRef list.
ResetLtrState (&pCtx->pLtr[pCtx->uiDependencyId]); //SHOULD update it when IDR.
for (int32_t k = 0; k < MAX_TEMPORAL_LEVEL; k++) {
pCtx->bRefOfCurTidIsLtr[pCtx->uiDependencyId][k] = false;
}
pCtx->pRefList0[0] = NULL;
}

View File

@ -269,11 +269,11 @@ int32_t CWelsPreProcess::UpdateSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodin
InitLastSpatialPictures (pCtx);
return 1;
}
if (pParam->bEnableLongTermReference && pCtx->bLongTermRefFlag[kiDidx][iCurTid]) {
if (pCtx->bRefOfCurTidIsLtr[kiDidx][iCurTid]) {
const int32_t kiAvailableLtrPos = m_uiSpatialLayersInTemporal[kiDidx] + pCtx->pVaa->uiMarkLongTermPicIdx;
WelsExchangeSpatialPictures (&m_pSpatialPic[kiDidx][kiAvailableLtrPos],
&m_pSpatialPic[kiDidx][iCurTid]);
pCtx->bLongTermRefFlag[kiDidx][iCurTid] = false;
pCtx->bRefOfCurTidIsLtr[kiDidx][iCurTid] = false;
}
WelsExchangeSpatialPictures (&m_pSpatialPic[kiDidx][kiCurPos],
&m_pSpatialPic[kiDidx][iCurTid]);