From 0cd3f9d9527f7c943a9f4947055460c09c5e8e36 Mon Sep 17 00:00:00 2001 From: huili2 Date: Mon, 28 Apr 2014 00:48:38 -0700 Subject: [PATCH] fix some bugs of EC --- codec/decoder/core/src/decoder_core.cpp | 9 ++------- codec/decoder/core/src/manage_dec_ref.cpp | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp index f1d9621f..566c31dd 100644 --- a/codec/decoder/core/src/decoder_core.cpp +++ b/codec/decoder/core/src/decoder_core.cpp @@ -1493,6 +1493,8 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) { for(unsigned int i = pCurAu->uiStartPos; i <= pCurAu->uiEndPos; i++) { uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId; pTmpLayerSps[uiDid] = pCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; + if ((pCurAu->pNalUnitsList[i]->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR) || (pCurAu->pNalUnitsList[i]->sNalHeaderExt.bIdrFlag)) + bNewSeq = true; } int iMaxActiveLayer = 0, iMaxCurrentLayer = 0; for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) { @@ -1642,19 +1644,12 @@ static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PN } void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pSps, PPps pPps) { - SNalUnitHeader* pNalHdr = &pCurNal->sNalHeaderExt.sNalUnitHeader; PSliceHeader pSh = &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; pCtx->eSliceType = pSh->eSliceType; pCtx->pSliceHeader = pSh; pCtx->iFrameNum = pSh->iFrameNum; - - if ((pNalHdr->eNalUnitType == NAL_UNIT_CODED_SLICE_IDR || - (pCurNal->sNalHeaderExt.uiQualityId == BASE_QUALITY_ID && pCurNal->sNalHeaderExt.bIdrFlag)) && - pSh->iFrameNum == 0) { //pSh->iFrameNum == 0 this condition can deleted?????? - WelsResetRefPic (pCtx); // Reset decoded picture buffer lists due to an IDR frame incomes - } } int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, const bool kbFirstSlice, int32_t iPoc) { diff --git a/codec/decoder/core/src/manage_dec_ref.cpp b/codec/decoder/core/src/manage_dec_ref.cpp index 805afb71..6edcc5f1 100644 --- a/codec/decoder/core/src/manage_dec_ref.cpp +++ b/codec/decoder/core/src/manage_dec_ref.cpp @@ -110,7 +110,7 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) { int32_t WelsInitRefList (PWelsDecoderContext pCtx, int32_t iPoc) { int32_t i, iCount = 0; - if ((pCtx->bNewSeqBegin) && (pCtx->sRefPic.uiRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE && pCtx->eSliceType != SI_SLICE)) { + if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE && pCtx->eSliceType != SI_SLICE)) { if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0 PPicture pRef = PrefetchPic (pCtx->pPicBuff[0]); if (pRef != NULL) {