Check the duplicate frame_num in short ref list
Add more judgement for return value in WelsMarkAsRef()
This commit is contained in:
parent
5c301defba
commit
868c8e45a1
@ -184,6 +184,7 @@ ERR_INFO_NO_IDR_PIC = ERR_INFO_LOGIC_BASE, // NO IDR picture availa
|
||||
ERR_INFO_EC_NO_NEIGHBOUR_MBS,
|
||||
ERR_INFO_EC_UNEXPECTED_MB_TYPE,
|
||||
ERR_INFO_EC_NO_ENOUGH_NEIGHBOUR_MBS,
|
||||
ERR_INFO_DUPLICATE_FRAME_NUM,
|
||||
//for LTR
|
||||
ERR_INFO_INVALID_MMCO_OPCODE_BASE,
|
||||
ERR_INFO_INVALID_MMCO_SHORT2UNUSED,
|
||||
|
@ -2360,6 +2360,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
||||
if (uiNalRefIdc > 0) {
|
||||
iRet = WelsMarkAsRef (pCtx);
|
||||
if (iRet != ERR_NONE) {
|
||||
if (iRet == ERR_INFO_DUPLICATE_FRAME_NUM)
|
||||
pCtx->iErrorCode |= dsBitstreamError;
|
||||
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
|
||||
pCtx->pDec = NULL;
|
||||
return iRet;
|
||||
|
@ -431,6 +431,7 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) {
|
||||
//Mark erroneous frame as Ref Pic into DPB
|
||||
int32_t MarkECFrameAsRef (PWelsDecoderContext pCtx) {
|
||||
int32_t iRet = WelsMarkAsRef (pCtx);
|
||||
// Under EC mode, the ERR_INFO_DUPLICATE_FRAME_NUM does not need to be process
|
||||
if (iRet != ERR_NONE) {
|
||||
return iRet;
|
||||
}
|
||||
|
@ -294,6 +294,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
|
||||
if (iRet != ERR_NONE) {
|
||||
if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
|
||||
iRet = RemainOneBufferInDpbForEC (pCtx);
|
||||
WELS_VERIFY_RETURN_IF (iRet, iRet);
|
||||
} else {
|
||||
return iRet;
|
||||
}
|
||||
@ -309,6 +310,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
|
||||
if (iRet != ERR_NONE) {
|
||||
if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
|
||||
iRet = RemainOneBufferInDpbForEC (pCtx);
|
||||
WELS_VERIFY_RETURN_IF (iRet, iRet);
|
||||
} else {
|
||||
return iRet;
|
||||
}
|
||||
@ -320,11 +322,12 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
|
||||
if (pRefPic->uiLongRefCount[LIST_0] + pRefPic->uiShortRefCount[LIST_0] >= WELS_MAX (1, pCtx->pSps->iNumRefFrames)) {
|
||||
if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
|
||||
iRet = RemainOneBufferInDpbForEC (pCtx);
|
||||
WELS_VERIFY_RETURN_IF (iRet, iRet);
|
||||
} else {
|
||||
return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW;
|
||||
}
|
||||
}
|
||||
AddShortTermToList (pRefPic, pCtx->pDec);
|
||||
iRet = AddShortTermToList (pRefPic, pCtx->pDec);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
@ -515,6 +518,15 @@ static int32_t AddShortTermToList (PRefPic pRefPic, PPicture pPic) {
|
||||
pPic->bIsLongRef = false;
|
||||
pPic->iLongTermFrameIdx = -1;
|
||||
if (pRefPic->uiShortRefCount[LIST_0] > 0) {
|
||||
// Check the duplicate frame_num in short ref list
|
||||
for (int32_t iPos = 0; iPos < pRefPic->uiShortRefCount[LIST_0]; iPos++) {
|
||||
if (pPic->iFrameNum == pRefPic->pShortRefList[LIST_0][iPos]->iFrameNum) {
|
||||
// Replace the previous ref pic with the new one with the same frame_num
|
||||
pRefPic->pShortRefList[LIST_0][iPos] = pPic;
|
||||
return ERR_INFO_DUPLICATE_FRAME_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
memmove (&pRefPic->pShortRefList[LIST_0][1], &pRefPic->pShortRefList[LIST_0][0],
|
||||
pRefPic->uiShortRefCount[LIST_0]*sizeof (PPicture));//confirmed_safe_unsafe_usage
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user