ref: 2db10df5c67c85465723954487713f321ac25692
parent: 2a83a85eb7d1cbf947a732ef901074fca40f11fa
parent: d7f3331c9dd46b547f4ba315b736e86cbefef78e
author: dongzha <dongzha@cisco.com>
date: Thu Jul 17 04:41:27 EDT 2014
Merge pull request #1180 from huili2/dpb_green_issue_master solve green issue combined with EC and multi-packet input
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -312,6 +312,9 @@
InitBits (pBs, pNal, iBitSize);
iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag);
if (iErr != ERR_NONE) {
+ if ((uiAvailNalNum == 1) && (pCurNal->sNalHeaderExt.bIdrFlag)) { //IDR parse error
+ ResetActiveSPSForEachLayer (pCtx);
+ }
//if current NAL occur error when parsing, should clean it from pNalUnitsList
//otherwise, when Next good NAL decoding, this corrupt NAL is considered as normal NAL and lead to decoder crash
ForceClearCurrentNal (pCurAu);
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -462,6 +462,9 @@
iConsumedBytes = 0;
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
+ if ((pCtx->iErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
+ CheckAndDoEC (pCtx, ppDst, pDstBufInfo);
+ }
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes);
}
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -1972,9 +1972,8 @@
return ERR_NONE;
}
- pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
-
if (uiNalRefIdc > 0) {
+ pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
iRet = WelsMarkAsRef (pCtx);
if (iRet != ERR_NONE) {
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
@@ -2009,8 +2008,10 @@
ImplementErrorCon (pCtx);
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
- pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
- MarkECFrameAsRef (pCtx);
+ if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
+ pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
+ MarkECFrameAsRef (pCtx);
+ }
pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
if (pCtx->bLastHasMmco5)
pCtx->iPrevFrameNum = 0;
--- a/codec/decoder/core/src/pic_queue.cpp
+++ b/codec/decoder/core/src/pic_queue.cpp
@@ -83,6 +83,7 @@
iChromaSize = iPicChromaWidth * iPicChromaHeight;
pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMalloc (iLumaSize /* luma */
+ (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]"));
+ memset (pPic->pBuffer[0], 128, (iLumaSize + (iChromaSize << 1)));
WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer[0], FreePicture (pPic));
pPic->iLinesize[0] = iPicWidth;