ref: a2158aca4d5a08843e8ce3cda091b7348a384535
parent: eb2541979b8991b97c8f05777992a15e2f557ca0
parent: 1bf04b1f97fa91a0517184aaeaf8de8423bdbb55
author: huili2 <huili2@cisco.com>
date: Tue Mar 19 10:07:13 EDT 2019
Merge pull request #3115 from xiaotiansf/LastFixes Use error conditions to determine how to continue decode instead of trying to locate deleted references. Prevent decoded pictures of Scalable Baseline Profile (83)
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -165,27 +165,6 @@
return ERR_NONE;
}
-static void ResetRefPicReferences (const PWelsDecoderContext& pCtx, const PPicture& inPPic) {
- //seach and reset the references of deleted references.
- int32_t list_count = pCtx->eSliceType == B_SLICE ? 2 : 1;
- for (int32_t list = LIST_0; list < list_count; ++list) {
- int32_t refIdx = 0;
- PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx];
- while (refIdx < MAX_DPB_COUNT && pPic != NULL) {
- ++refIdx;
- for (int32_t i = LIST_0; i < LIST_A; ++i) {
- int32_t ref = 0;
- while (ref < MAX_DPB_COUNT && pPic->pRefPic[i][ref] != NULL) {
- if (pPic->pRefPic[i][ref] == inPPic) {
- pPic->pRefPic[i][ref] = NULL;
- }
- ++ref;
- }
- }
- }
- }
-}
-
static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
const int32_t kiPicWidth, const int32_t kiPicHeight, const int32_t kiNewSize) {
PPicBuff pPicOldBuf = *ppPicBuf;
@@ -233,7 +212,6 @@
for (iPicIdx = iDelIdx; iPicIdx < kiOldSize; iPicIdx++) {
if (iPrevPicIdx != iPicIdx) {
if (pPicOldBuf->ppPic[iPicIdx] != NULL) {
- ResetRefPicReferences (pCtx, pPicOldBuf->ppPic[iPicIdx]);
FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa);
pPicOldBuf->ppPic[iPicIdx] = NULL;
}
--- a/codec/decoder/core/src/mv_pred.cpp
+++ b/codec/decoder/core/src/mv_pred.cpp
@@ -1104,6 +1104,10 @@
}
int8_t MapColToList0 (PWelsDecoderContext& pCtx, const int8_t& colocRefIndexL0,
const int32_t& ref0Count) { //ISO/IEC 14496-10:2009(E) (8-193)
+ //When reference is lost, this function must be skipped.
+ if ((pCtx->iErrorCode & dsRefLost) == dsRefLost) {
+ return 0;
+ }
PPicture pic1 = pCtx->sRefPic.pRefList[LIST_1][0];
if (pic1 && pic1->pRefPic[LIST_0][colocRefIndexL0]) {
const int32_t iFramePoc = pic1->pRefPic[LIST_0][colocRefIndexL0]->iFramePoc;
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -754,14 +754,23 @@
DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SBufferInfo* pDstInfo) {
DECODING_STATE iRet = dsErrorFree;
- if (pDstInfo->iBufferStatus == 1 && m_pDecContext->pSps->uiProfileIdc != 66) {
- if (m_pDecContext->pSliceHeader->iPicOrderCntLsb == 0) {
- if (m_iNumOfPicts > 0) {
- m_iLastGOPRemainPicts = m_iNumOfPicts;
- for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) {
- if (m_sPictInfoList[i].iPOC > sIMinInt32) {
- m_sPictInfoList[i].bLastGOP = true;
- }
+ if (pDstInfo->iBufferStatus == 1 && m_pDecContext->pSps->uiProfileIdc != 66
+ && m_pDecContext->pSps->uiProfileIdc != 83) {
+ /*if (m_pDecContext->pSliceHeader->iPicOrderCntLsb == 0) {
+ m_LastWrittenPOC = 0;
+ return dsErrorFree;
+ }
+ if (m_iNumOfPicts == 0 && m_pDecContext->pPreviousDecodedPictureInDpb->bNewSeqBegin
+ && m_pDecContext->eSliceType != I_SLICE) {
+ m_LastWrittenPOC = m_pDecContext->pSliceHeader->iPicOrderCntLsb;
+ return dsErrorFree;
+ }*/
+ if (m_iNumOfPicts && m_pDecContext->pPreviousDecodedPictureInDpb
+ && m_pDecContext->pPreviousDecodedPictureInDpb->bNewSeqBegin) {
+ m_iLastGOPRemainPicts = m_iNumOfPicts;
+ for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) {
+ if (m_sPictInfoList[i].iPOC > sIMinInt32) {
+ m_sPictInfoList[i].bLastGOP = true;
}
}
} else {