avoid using the same picture buff for prev pic and curr pic

This commit is contained in:
dongzha
2014-11-27 15:25:21 +08:00
committed by dong zhang
parent 82b70b34fe
commit d58f90947c
3 changed files with 11 additions and 2 deletions

View File

@@ -178,10 +178,11 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
*/
static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) {
int32_t iNumRefFrames = 0;
// +2 for EC MV Copy buffer exchange
if ((pCtx == NULL) || (pCtx->pSps == NULL)) {
iNumRefFrames = MAX_REF_PIC_COUNT;
iNumRefFrames = MAX_REF_PIC_COUNT + 2;
} else {
iNumRefFrames = pCtx->pSps->iNumRefFrames + 1;
iNumRefFrames = pCtx->pSps->iNumRefFrames + 2;
}
#ifdef LONG_TERM_REF

View File

@@ -2152,6 +2152,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn
} else if (pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR
|| pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE) {
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future MV Copy use
pCtx->pDec = NULL;
}
} else {
if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo))

View File

@@ -164,6 +164,9 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) {
//Do error concealment using slice MV copy method
void DoMbECMvCopy (PWelsDecoderContext pCtx, PPicture pDec, PPicture pRef, int32_t iMbXy, int32_t iMbX, int32_t iMbY,
sMCRefMember* pMCRefMem) {
if (pDec == pRef) {
return; // for protection, shall never go into this logic, error info printed outside.
}
int16_t iMVs[2];
int32_t iMbXInPix = iMbX << 4;
int32_t iMbYInPix = iMbY << 4;
@@ -381,6 +384,10 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) {
sMCRefMem.iDstLineChroma = pDstPic->iLinesize[1];
sMCRefMem.iPicWidth = pDstPic->iWidthInPixel;
sMCRefMem.iPicHeight = pDstPic->iHeightInPixel;
if (pDstPic == pSrcPic) {
// output error info, EC will be ignored in DoMbECMvCopy
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "DoErrorConSliceMVCopy()::pPreviousPic and pDec use same buffer, ignored.");
}
}
for (int32_t iMbY = 0; iMbY < iMbHeight; ++iMbY) {