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
4545
4646 namespace WelsDec {
4747 static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
48− if (pDstInfo == NULL) //parse only usage
49− return -1;
5048 PDqLayer pCurDq = pCtx->pCurDqLayer;
5149 PPicture pPic = pCtx->pDec;
5250
@@ -89,6 +87,15 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 36 unmodified lines
8987
9088 pCtx->iTotalNumMbRec = 0;
9189
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+
9299 //////output:::normal path
93100 pDstInfo->uiOutYuvTimeStamp = pPic->uiTimeStamp;
94101 ppDst[0] = pPic->pData[0];
@@ -1741,6 +1748,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1646 unmodified lines
17411748 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);
17421749 if (!pCtx->bParseOnly)
17431750 pDstInfo->iBufferStatus = 0;
1751+ pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
1752+ pCtx->bNextNewSeqBegin = false; // reset it
1753+ if (pCtx->bNewSeqBegin)
1754+ ResetActiveSPSForEachLayer (pCtx);
17441755 return iErr;
17451756 }
17461757
@@ -1758,12 +1769,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 11 unmodified lines
17581769 }
17591770 }
17601771
1761−
17621772 iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo);
17631773
17641774 if (pCtx->bParseOnly) {
1765− if ((dsErrorFree == pCtx->iErrorCode)
1766− && ((uint32_t) pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) {
1775+ if ((dsErrorFree == pCtx->iErrorCode) && (iErr == 0)) { //frame complete, output
17671776 SParserBsInfo* pParser = pCtx->pParserBsInfo;
17681777 uint8_t* pDstBuf = pParser->pDstBuff;
17691778 SNalUnit* pCurNal = NULL;
@@ -1802,14 +1811,12 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 32 unmodified lines
18021811 memcpy (pDstBuf, pNalBs, iNalLen);
18031812 pDstBuf += iNalLen;
18041813 }
1805− pCtx->iTotalNumMbRec = 0;
18061814 } else { //error
18071815 pCtx->pParserBsInfo->uiOutBsTimeStamp = 0;
18081816 pCtx->pParserBsInfo->iNalNum = 0;
18091817 pCtx->pParserBsInfo->iSpsWidthInPixel = 0;
18101818 pCtx->pParserBsInfo->iSpsHeightInPixel = 0;
18111819 if (dsErrorFree == pCtx->iErrorCode) { //frame not complete
1812− pCtx->iTotalNumMbRec = 0;
18131820 pCtx->iErrorCode |= dsFramePending;
18141821 }
18151822 }
@@ -2129,10 +2136,6 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 313 unmodified lines
21292136 pCtx->pDec->bIsComplete = bAllRefComplete;
21302137 if (!pCtx->pDec->bIsComplete) { // Ref pictures ECed, result in ECed
21312138 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;
21362139 }
21372140
21382141 // A dq layer decoded here
@@ -2144,8 +2147,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 5 unmodified lines
21442147 #endif//#if !CODEC_FOR_TESTBED
21452148
21462149 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
2147− if (!pCtx->bParseOnly) {
2148− if (!pCtx->bInstantDecFlag) {
2150+ if (!pCtx->bInstantDecFlag) {
2151+ if (!pCtx->bParseOnly) {
21492152 //Do error concealment here
21502153 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
21512154 ImplementErrorCon (pCtx);
@@ -2154,11 +2157,12 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 2 unmodified lines
21542157 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;
21552158 }
21562159 }
2157−
2158− if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
2159− return ERR_NONE;
2160− }
21612160 }
2161+
2162+ iRet = DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
2163+ if (iRet)
2164+ return iRet;
2165+
21622166 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
21632167 if (uiNalRefIdc > 0) {
21642168 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