History

modify parse only flowchart to use DecodeFrameConstruction()

huili2 committed 11 years ago

Commit 8e352241 parent 04cb9f31 file · +21 −17Browse files

Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 1 file). Show all

Unified · Split

codec/decoder/core/src/decoder_core.cpp+21−17
@@ -45,8 +45,6 @@ · 44 unmodified lines
45 45
46namespace WelsDec {46namespace WelsDec {
47static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {47static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
48 if (pDstInfo == NULL) //parse only usage
49 return -1;
50 PDqLayer pCurDq = pCtx->pCurDqLayer;48 PDqLayer pCurDq = pCtx->pCurDqLayer;
51 PPicture pPic = pCtx->pDec;49 PPicture pPic = pCtx->pDec;
52 50
@@ -89,6 +87,15 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 36 unmodified lines
89 87
90 pCtx->iTotalNumMbRec = 0;88 pCtx->iTotalNumMbRec = 0;
91 89
90 if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
91 if (bFrameCompleteFlag)
92 return 0;
93 else { //incomplete frame
94 pCtx->pDec->bIsComplete = false;
95 return -1;
96 }
97 }
98
92 //////output:::normal path99 //////output:::normal path
93 pDstInfo->uiOutYuvTimeStamp = pPic->uiTimeStamp;100 pDstInfo->uiOutYuvTimeStamp = pPic->uiTimeStamp;
94 ppDst[0] = pPic->pData[0];101 ppDst[0] = pPic->pData[0];
@@ -1741,6 +1748,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1646 unmodified lines
1741 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);1748 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);
1742 if (!pCtx->bParseOnly)1749 if (!pCtx->bParseOnly)
1743 pDstInfo->iBufferStatus = 0;1750 pDstInfo->iBufferStatus = 0;
1751 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
1752 pCtx->bNextNewSeqBegin = false; // reset it
1753 if (pCtx->bNewSeqBegin)
1754 ResetActiveSPSForEachLayer (pCtx);
1744 return iErr;1755 return iErr;
1745 }1756 }
1746 1757
@@ -1758,12 +1769,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 11 unmodified lines
1758 }1769 }
1759 }1770 }
1760 1771
1761
1762 iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo);1772 iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo);
1763 1773
1764 if (pCtx->bParseOnly) {1774 if (pCtx->bParseOnly) {
1765 if ((dsErrorFree == pCtx->iErrorCode)1775 if ((dsErrorFree == pCtx->iErrorCode) && (iErr == 0)) { //frame complete, output
1766 && ((uint32_t) pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) {
1767 SParserBsInfo* pParser = pCtx->pParserBsInfo;1776 SParserBsInfo* pParser = pCtx->pParserBsInfo;
1768 uint8_t* pDstBuf = pParser->pDstBuff;1777 uint8_t* pDstBuf = pParser->pDstBuff;
1769 SNalUnit* pCurNal = NULL;1778 SNalUnit* pCurNal = NULL;
@@ -1802,14 +1811,12 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 32 unmodified lines
1802 memcpy (pDstBuf, pNalBs, iNalLen);1811 memcpy (pDstBuf, pNalBs, iNalLen);
1803 pDstBuf += iNalLen;1812 pDstBuf += iNalLen;
1804 }1813 }
1805 pCtx->iTotalNumMbRec = 0;
1806 } else { //error1814 } else { //error
1807 pCtx->pParserBsInfo->uiOutBsTimeStamp = 0;1815 pCtx->pParserBsInfo->uiOutBsTimeStamp = 0;
1808 pCtx->pParserBsInfo->iNalNum = 0;1816 pCtx->pParserBsInfo->iNalNum = 0;
1809 pCtx->pParserBsInfo->iSpsWidthInPixel = 0;1817 pCtx->pParserBsInfo->iSpsWidthInPixel = 0;
1810 pCtx->pParserBsInfo->iSpsHeightInPixel = 0;1818 pCtx->pParserBsInfo->iSpsHeightInPixel = 0;
1811 if (dsErrorFree == pCtx->iErrorCode) { //frame not complete1819 if (dsErrorFree == pCtx->iErrorCode) { //frame not complete
1812 pCtx->iTotalNumMbRec = 0;
1813 pCtx->iErrorCode |= dsFramePending;1820 pCtx->iErrorCode |= dsFramePending;
1814 }1821 }
1815 }1822 }
@@ -2129,10 +2136,6 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 313 unmodified lines
2129 pCtx->pDec->bIsComplete = bAllRefComplete;2136 pCtx->pDec->bIsComplete = bAllRefComplete;
2130 if (!pCtx->pDec->bIsComplete) { // Ref pictures ECed, result in ECed2137 if (!pCtx->pDec->bIsComplete) { // Ref pictures ECed, result in ECed
2131 pCtx->iErrorCode |= dsDataErrorConcealed;2138 pCtx->iErrorCode |= dsDataErrorConcealed;
2132 } else if (pCtx->bParseOnly) {
2133 pCtx->pDec->bIsComplete = (pCtx->iTotalNumMbRec == pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight);
2134 if (!pCtx->pDec->bIsComplete)
2135 return -1;
2136 }2139 }
2137 2140
2138 // A dq layer decoded here2141 // A dq layer decoded here
@@ -2144,8 +2147,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 5 unmodified lines
2144#endif//#if !CODEC_FOR_TESTBED2147#endif//#if !CODEC_FOR_TESTBED
2145 2148
2146 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {2149 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
2147 if (!pCtx->bParseOnly) {2150 if (!pCtx->bInstantDecFlag) {
2148 if (!pCtx->bInstantDecFlag) {2151 if (!pCtx->bParseOnly) {
2149 //Do error concealment here2152 //Do error concealment here
2150 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {2153 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
2151 ImplementErrorCon (pCtx);2154 ImplementErrorCon (pCtx);
@@ -2154,11 +2157,12 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 2 unmodified lines
2154 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;2157 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;
2155 }2158 }
2156 }2159 }
2157
2158 if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
2159 return ERR_NONE;
2160 }
2161 }2160 }
2161
2162 iRet = DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
2163 if (iRet)
2164 return iRet;
2165
2162 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC2166 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
2163 if (uiNalRefIdc > 0) {2167 if (uiNalRefIdc > 0) {
2164 iRet = WelsMarkAsRef (pCtx);2168 iRet = WelsMarkAsRef (pCtx);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t