solve green issue combined with EC and multi-packet input
This commit is contained in:
@@ -312,6 +312,9 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
InitBits (pBs, pNal, iBitSize);
|
InitBits (pBs, pNal, iBitSize);
|
||||||
iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag);
|
iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag);
|
||||||
if (iErr != ERR_NONE) {
|
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
|
//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
|
//otherwise, when Next good NAL decoding, this corrupt NAL is considered as normal NAL and lead to decoder crash
|
||||||
ForceClearCurrentNal (pCurAu);
|
ForceClearCurrentNal (pCurAu);
|
||||||
|
|||||||
@@ -462,6 +462,9 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
|
|
||||||
iConsumedBytes = 0;
|
iConsumedBytes = 0;
|
||||||
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
|
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) {
|
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
|
||||||
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes);
|
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1973,9 +1973,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
|||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
|
|
||||||
|
|
||||||
if (uiNalRefIdc > 0) {
|
if (uiNalRefIdc > 0) {
|
||||||
|
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
|
||||||
iRet = WelsMarkAsRef (pCtx);
|
iRet = WelsMarkAsRef (pCtx);
|
||||||
if (iRet != ERR_NONE) {
|
if (iRet != ERR_NONE) {
|
||||||
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
|
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
@@ -2010,8 +2009,10 @@ bool CheckAndDoEC (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstI
|
|||||||
ImplementErrorCon (pCtx);
|
ImplementErrorCon (pCtx);
|
||||||
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
||||||
DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
|
DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
|
||||||
|
if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
|
||||||
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
|
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
|
||||||
MarkECFrameAsRef (pCtx);
|
MarkECFrameAsRef (pCtx);
|
||||||
|
}
|
||||||
pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
|
pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
|
||||||
if (pCtx->bLastHasMmco5)
|
if (pCtx->bLastHasMmco5)
|
||||||
pCtx->iPrevFrameNum = 0;
|
pCtx->iPrevFrameNum = 0;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const
|
|||||||
iChromaSize = iPicChromaWidth * iPicChromaHeight;
|
iChromaSize = iPicChromaWidth * iPicChromaHeight;
|
||||||
pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMalloc (iLumaSize /* luma */
|
pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMalloc (iLumaSize /* luma */
|
||||||
+ (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]"));
|
+ (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));
|
WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer[0], FreePicture (pPic));
|
||||||
pPic->iLinesize[0] = iPicWidth;
|
pPic->iLinesize[0] = iPicWidth;
|
||||||
|
|||||||
Reference in New Issue
Block a user