History

modify return value check inside decoder

unknown committed 10 years ago

Commit 9cb4f4e1 parent 13586a311 files · +216 −197Browse files

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

Unified · Split

codec/decoder/core/src/decoder_core.cpp+17−13
@@ -133,7 +133,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 132 unmodified lines
133133 pCtx->pDec->bIsComplete = false;
134134 pCtx->bFrameFinish = false; //current frame not finished
135135 pCtx->iErrorCode |= dsFramePending;
136− return -1;
136+ return ERR_INFO_PARSEONLY_PENDING;
137137 //pCtx->pParserBsInfo->iNalNum = 0;
138138 }
139139 } else { //error
@@ -141,9 +141,9 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 1 unmodified line
141141 pCtx->pParserBsInfo->iNalNum = 0;
142142 pCtx->pParserBsInfo->iSpsWidthInPixel = 0;
143143 pCtx->pParserBsInfo->iSpsHeightInPixel = 0;
144− return -1;
144+ return ERR_INFO_PARSEONLY_ERROR;
145145 }
146− return 0;
146+ return ERR_NONE;
147147 }
148148
149149 if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {
@@ -152,7 +152,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 2 unmodified lines
152152 pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
153153 bFrameCompleteFlag = false; //return later after output buffer is done
154154 if (pCtx->bInstantDecFlag) //no-delay decoding, wait for new slice
155− return -1;
155+ return ERR_INFO_MB_NUM_INADEQUATE;
156156 } else if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag
157157 && (pCtx->iErrorCode == dsErrorFree)) { //complete non-ECed IDR frame done
158158 pCtx->pDec->bIsComplete = true;
@@ -193,7 +193,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 34 unmodified lines
193193 if (pDstInfo->iBufferStatus == 0) {
194194 if (!bFrameCompleteFlag)
195195 pCtx->iErrorCode |= dsBitstreamError;
196− return -1;
196+ return ERR_INFO_MB_NUM_INADEQUATE;
197197 }
198198 if (pCtx->bFreezeOutput) {
199199 pDstInfo->iBufferStatus = 0;
@@ -206,7 +206,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 6 unmodified lines
206206 pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum;
207207 UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0);
208208
209− return 0;
209+ return ERR_NONE;
210210 }
211211
212212 inline bool CheckSliceNeedReconstruct (uint8_t uiLayerDqId, uint8_t uiTargetDqId) {
@@ -971,7 +971,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 758 unmodified lines
971971 if (pSliceHead->uiDisableDeblockingFilterIdc > 6) {
972972 WelsLog (pLogCtx, WELS_LOG_WARNING, "disable_deblock_filter_idc (%d) out of range [0, 6]",
973973 pSliceHead->uiDisableDeblockingFilterIdc);
974− return ERR_INFO_INVALID_DBLOCKING_IDC;
974+ return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC);
975975 }
976976 if (pSliceHead->uiDisableDeblockingFilterIdc != 1) {
977977 WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_alpha_c0_offset_div2
@@ -1018,7 +1018,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 40 unmodified lines
10181018 if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) {
10191019 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]",
10201020 pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc);
1021− return ERR_INFO_INVALID_DBLOCKING_IDC;
1021+ return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC);
10221022 }
10231023 if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc != 1) {
10241024 WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //inter_layer_slice_alpha_c0_offset_div2
@@ -1298,7 +1298,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 273 unmodified lines
12981298 "pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010
12991299 pCtx->sMb.pResidualPredFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
13001300 "pCtx->sMb.pResidualPredFlag[]");
1301− //pCtx->sMb.pMotionPredFlag[i] = (uint8_t *) pMa->WelsMallocz(pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof(uint8_t), "pCtx->sMb.pMotionPredFlag[]");
13021301 pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
13031302 int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]");
13041303
@@ -1314,6 +1313,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 9 unmodified lines
13141313 (NULL == pCtx->sMb.pMv[i][0]) ||
13151314 (NULL == pCtx->sMb.pRefIndex[i][0]) ||
13161315 (NULL == pCtx->sMb.pLumaQp[i]) ||
1316+ (NULL == pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[i]) ||
1317+ (NULL == pCtx->sMb.pTransformSize8x8Flag[i]) ||
13171318 (NULL == pCtx->sMb.pChromaQp[i]) ||
13181319 (NULL == pCtx->sMb.pMvd[i][0]) ||
13191320 (NULL == pCtx->sMb.pCbfDc[i]) ||
@@ -1322,6 +1323,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 2 unmodified lines
13221323 (NULL == pCtx->sMb.pScaledTCoeff[i]) ||
13231324 (NULL == pCtx->sMb.pIntraPredMode[i]) ||
13241325 (NULL == pCtx->sMb.pIntra4x4FinalMode[i]) ||
1326+ (NULL == pCtx->sMb.pIntraNxNAvailFlag[i]) ||
13251327 (NULL == pCtx->sMb.pChromaPredMode[i]) ||
13261328 (NULL == pCtx->sMb.pCbp[i]) ||
13271329 (NULL == pCtx->sMb.pSubMbType[i]) ||
@@ -2007,7 +2009,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 679 unmodified lines
20072009 return iErr;
20082010 }
20092011
2010− return 0;
2012+ return ERR_NONE;
20112013 }
20122014
20132015 static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) {
@@ -2251,7 +2253,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 237 unmodified lines
22512253 #else
22522254 pCtx->bReferenceLostAtT0Flag = true;
22532255 #endif
2254− return ERR_INFO_REFERENCE_PIC_LOST;
2256+ return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_REFERENCE_PIC_LOST);
22552257 }
22562258 }
22572259 }
@@ -2290,9 +2292,9 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 32 unmodified lines
22902292 }
22912293
22922294 if (bReconstructSlice) {
2293− if (WelsDecodeConstructSlice (pCtx, pNalCur)) {
2295+ if ((iRet = WelsDecodeConstructSlice (pCtx, pNalCur)) != ERR_NONE) {
22942296 pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false
2295− return -1;
2297+ return iRet;
22962298 }
22972299 }
22982300 if (bAllRefComplete && pCtx->eSliceType != I_SLICE) {
@@ -2479,6 +2481,8 @@ bool CheckRefPicturesComplete (PWelsDecoderContext pCtx) { · 180 unmodified lines
24792481 }
24802482 iRealMbIdx = (pCtx->pPps->uiNumSliceGroups > 1) ? FmoNextMb (pCtx->pFmo, iRealMbIdx) :
24812483 (pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice + iMbIdx);
2484+ if (iRealMbIdx == -1) //caused by abnormal return of FmoNextMb()
2485+ return false;
24822486 }
24832487 return bAllRefComplete;
24842488 }

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