solve green issue combined with EC and multi-packet input

This commit is contained in:
huili2 2014-07-14 22:03:36 -07:00
parent 4a518655a6
commit d7f3331c9d
4 changed files with 12 additions and 4 deletions

View File

@ -312,6 +312,9 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
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);

View File

@ -462,6 +462,9 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
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);
}

View File

@ -1973,9 +1973,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
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) {
@ -2010,8 +2009,10 @@ bool CheckAndDoEC (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstI
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;

View File

@ -83,6 +83,7 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const
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;