Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 4 files). Show all
Unified · Split
| @@ -661,25 +661,24 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 660 unmodified lines | |||
| 661 | 0; // set 4 reserved bytes to zero | 661 | 0; // set 4 reserved bytes to zero |
| 662 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); | 662 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); |
| 663 | if (pNalPayload) { //parse correct | 663 | if (pNalPayload) { //parse correct |
| 664 | if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) { | ||
| 665 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); | ||
| 666 | } | ||
| 667 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) { | 664 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) { |
| 668 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3); | 665 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3); |
| 669 | } | 666 | } |
| 670 | if (pCtx->bAuReadyFlag) { | 667 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); |
| 668 | if (pCtx->bAuReadyFlag && pCtx->pAccessUnitList->uiAvailUnitsNum != 0) { | ||
| 671 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 669 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |
| 670 | } | ||
| 671 | } | ||
| 672 | DecodeFinishUpdate (pCtx); | ||
| 672 | 673 | ||
| 673 | if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) { | 674 | if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) { |
| 674 | #ifdef LONG_TERM_REF | 675 | #ifdef LONG_TERM_REF |
| 675 | pCtx->bParamSetsLostFlag = true; | 676 | pCtx->bParamSetsLostFlag = true; |
| 676 | #else | 677 | #else |
| 677 | pCtx->bReferenceLostAtT0Flag = true; | 678 | pCtx->bReferenceLostAtT0Flag = true; |
| 678 | #endif | 679 | #endif |
| 679 | if (dsOutOfMemory & pCtx->iErrorCode) { | 680 | if (dsOutOfMemory & pCtx->iErrorCode) { |
| 680 | return pCtx->iErrorCode; | 681 | return pCtx->iErrorCode; |
| 681 | } | ||
| 682 | } | ||
| 683 | } | 682 | } |
| 684 | } | 683 | } |
| 685 | if (iRet) { | 684 | if (iRet) { |
| @@ -720,24 +719,23 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 34 unmodified lines | |||
| 720 | pRawData->pCurPos = pDstNal + iDstIdx + 4; //init, increase 4 reserved zero bytes, used to store the next NAL | 719 | pRawData->pCurPos = pDstNal + iDstIdx + 4; //init, increase 4 reserved zero bytes, used to store the next NAL |
| 721 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); | 720 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); |
| 722 | if (pNalPayload) { //parse correct | 721 | if (pNalPayload) { //parse correct |
| 723 | if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) { | ||
| 724 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); | ||
| 725 | } | ||
| 726 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) { | 722 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) { |
| 727 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3); | 723 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3); |
| 728 | } | 724 | } |
| 729 | if (pCtx->bAuReadyFlag) { | 725 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); |
| 726 | if (pCtx->bAuReadyFlag && pCtx->pAccessUnitList->uiAvailUnitsNum != 0) { | ||
| 730 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 727 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |
| 728 | } | ||
| 729 | } | ||
| 730 | DecodeFinishUpdate (pCtx); | ||
| 731 | 731 | ||
| 732 | if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) { | 732 | if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) { |
| 733 | #ifdef LONG_TERM_REF | 733 | #ifdef LONG_TERM_REF |
| 734 | pCtx->bParamSetsLostFlag = true; | 734 | pCtx->bParamSetsLostFlag = true; |
| 735 | #else | 735 | #else |
| 736 | pCtx->bReferenceLostAtT0Flag = true; | 736 | pCtx->bReferenceLostAtT0Flag = true; |
| 737 | #endif | 737 | #endif |
| 738 | return pCtx->iErrorCode; | 738 | return pCtx->iErrorCode; |
| 739 | } | ||
| 740 | } | ||
| 741 | } | 739 | } |
| 742 | if (iRet) { | 740 | if (iRet) { |
| 743 | iRet = 0; | 741 | iRet = 0; |
| @@ -760,15 +758,16 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 16 unmodified lines | |||
| 760 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | 758 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; |
| 761 | 759 | ||
| 762 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 760 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |
| 761 | } | ||
| 762 | DecodeFinishUpdate (pCtx); | ||
| 763 | 763 | ||
| 764 | if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) { | 764 | if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) { |
| 765 | #ifdef LONG_TERM_REF | 765 | #ifdef LONG_TERM_REF |
| 766 | pCtx->bParamSetsLostFlag = true; | 766 | pCtx->bParamSetsLostFlag = true; |
| 767 | #else | 767 | #else |
| 768 | pCtx->bReferenceLostAtT0Flag = true; | 768 | pCtx->bReferenceLostAtT0Flag = true; |
| 769 | #endif | 769 | #endif |
| 770 | return pCtx->iErrorCode; | 770 | return pCtx->iErrorCode; |
| 771 | } | ||
| 772 | } | 771 | } |
| 773 | } | 772 | } |
| 774 | 773 | ||