Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 2 files). Show all
Unified · Split
| @@ -45,6 +45,8 @@ · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | namespace WelsDec { |
| 47 | 47 | static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) { |
| 48 | + if (pDstInfo == NULL) //parse only usage | |
| 49 | + return -1; | |
| 48 | 50 | PDqLayer pCurDq = pCtx->pCurDqLayer; |
| 49 | 51 | PPicture pPic = pCtx->pDec; |
| 50 | 52 | |
| @@ -1760,7 +1762,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1709 unmodified lines | ||
| 1760 | 1762 | iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo); |
| 1761 | 1763 | |
| 1762 | 1764 | if (pCtx->bParseOnly) { |
| 1763 | − if (dsErrorFree == pCtx->iErrorCode) { | |
| 1765 | + if ((dsErrorFree == pCtx->iErrorCode) && (pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) { | |
| 1764 | 1766 | SParserBsInfo* pParser = pCtx->pParserBsInfo; |
| 1765 | 1767 | uint8_t* pDstBuf = pParser->pDstBuff; |
| 1766 | 1768 | SNalUnit* pCurNal = NULL; |
| @@ -1804,6 +1806,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 37 unmodified lines | ||
| 1804 | 1806 | pCtx->pParserBsInfo->iNalNum = 0; |
| 1805 | 1807 | pCtx->pParserBsInfo->iSpsWidthInPixel = 0; |
| 1806 | 1808 | pCtx->pParserBsInfo->iSpsHeightInPixel = 0; |
| 1809 | + if (dsErrorFree == pCtx->iErrorCode) { //frame not complete | |
| 1810 | + pCtx->iTotalNumMbRec = 0; | |
| 1811 | + pCtx->iErrorCode |= dsFramePending; | |
| 1812 | + } | |
| 1807 | 1813 | } |
| 1808 | 1814 | } |
| 1809 | 1815 | |
| @@ -2082,12 +2088,10 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 272 unmodified lines | ||
| 2082 | 2088 | } |
| 2083 | 2089 | } |
| 2084 | 2090 | |
| 2085 | − if (!pCtx->bParseOnly) { | |
| 2086 | − if (bReconstructSlice) { | |
| 2087 | − if (WelsDecodeConstructSlice (pCtx, pNalCur)) { | |
| 2088 | − pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false | |
| 2089 | − return -1; | |
| 2090 | − } | |
| 2091 | + if (bReconstructSlice) { | |
| 2092 | + if (WelsDecodeConstructSlice (pCtx, pNalCur)) { | |
| 2093 | + pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false | |
| 2094 | + return -1; | |
| 2091 | 2095 | } |
| 2092 | 2096 | } |
| 2093 | 2097 | if (bAllRefComplete && pCtx->eSliceType != I_SLICE) { |
| @@ -2158,7 +2162,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 64 unmodified lines | ||
| 2158 | 2162 | return iRet; |
| 2159 | 2163 | } |
| 2160 | 2164 | } |
| 2161 | − ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel, | |
| 2165 | + if (!pCtx->bParseOnly) | |
| 2166 | + ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel, | |
| 2162 | 2167 | pCtx->pDec->iLinesize, |
| 2163 | 2168 | pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture); |
| 2164 | 2169 | } |