| @@ -141,32 +141,34 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 140 unmodified lines |
| 141 | --iNalSize; | 141 | --iNalSize; |
| 142 | ++ (*pConsumedBytes); | 142 | ++ (*pConsumedBytes); |
| 143 | | 143 | |
| 144 | #ifdef DEBUG_PARSE_INFO | | |
| 145 | WelsLog (pLogCtx, WELS_LOG_INFO, "nal type: %d \n", pNalUnitHeader->eNalUnitType); | | |
| 146 | #endif | | |
| 147 | | | |
| 148 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) | 144 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) |
| 149 | || pCtx->bSpsExistAheadFlag)) { | 145 | || pCtx->bSpsExistAheadFlag)) { |
| 150 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 146 | if (pCtx->bPrintFrameErrorTraceFlag) { |
| | 147 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 151 | "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | 148 | "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", |
| 152 | pNalUnitHeader->eNalUnitType); | 149 | pNalUnitHeader->eNalUnitType); |
| | 150 | } |
| 153 | pCtx->iErrorCode = dsNoParamSets; | 151 | pCtx->iErrorCode = dsNoParamSets; |
| 154 | return NULL; | 152 | return NULL; |
| 155 | } | 153 | } |
| 156 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) | 154 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) |
| 157 | || pCtx->bPpsExistAheadFlag)) { | 155 | || pCtx->bPpsExistAheadFlag)) { |
| 158 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 156 | if (pCtx->bPrintFrameErrorTraceFlag) { |
| | 157 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 159 | "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | 158 | "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", |
| 160 | pNalUnitHeader->eNalUnitType); | 159 | pNalUnitHeader->eNalUnitType); |
| | 160 | } |
| 161 | pCtx->iErrorCode = dsNoParamSets; | 161 | pCtx->iErrorCode = dsNoParamSets; |
| 162 | return NULL; | 162 | return NULL; |
| 163 | } | 163 | } |
| 164 | if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) || | 164 | if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) || |
| 165 | (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag | 165 | (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag |
| 166 | || pCtx->bPpsExistAheadFlag))) { | 166 | || pCtx->bPpsExistAheadFlag))) { |
| 167 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 167 | if (pCtx->bPrintFrameErrorTraceFlag) { |
| | 168 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 168 | "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", | 169 | "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", |
| 169 | pNalUnitHeader->eNalUnitType); | 170 | pNalUnitHeader->eNalUnitType); |
| | 171 | } |
| 170 | pCtx->iErrorCode |= dsNoParamSets; | 172 | pCtx->iErrorCode |= dsNoParamSets; |
| 171 | return NULL; | 173 | return NULL; |
| 172 | } | 174 | } |
| @@ -244,7 +246,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 71 unmodified lines |
| 244 | uint32_t uiAvailNalNum; | 246 | uint32_t uiAvailNalNum; |
| 245 | pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); | 247 | pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); |
| 246 | if (NULL == pCurNal) { | 248 | if (NULL == pCurNal) { |
| 247 | WelsLog (pLogCtx, WELS_LOG_WARNING, "MemGetNextNal() fail due out of memory.\n"); | 249 | WelsLog (pLogCtx, WELS_LOG_ERROR, "MemGetNextNal() fail due out of memory.\n"); |
| 248 | pCtx->iErrorCode |= dsOutOfMemory; | 250 | pCtx->iErrorCode |= dsOutOfMemory; |
| 249 | return NULL; | 251 | return NULL; |
| 250 | } | 252 | } |
| @@ -502,9 +504,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 251 unmodified lines |
| 502 | case NAL_UNIT_SUBSET_SPS: | 504 | case NAL_UNIT_SUBSET_SPS: |
| 503 | if (iBitSize > 0) | 505 | if (iBitSize > 0) |
| 504 | InitBits (pBs, pRbsp, iBitSize); | 506 | InitBits (pBs, pRbsp, iBitSize); |
| 505 | #ifdef DEBUG_PARSE_INFO | | |
| 506 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType); | | |
| 507 | #endif | | |
| 508 | iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); | 507 | iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); |
| 509 | if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 | 508 | if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 |
| 510 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) | 509 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) |
| @@ -517,9 +516,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 6 unmodified lines |
| 517 | case NAL_UNIT_PPS: | 516 | case NAL_UNIT_PPS: |
| 518 | if (iBitSize > 0) | 517 | if (iBitSize > 0) |
| 519 | InitBits (pBs, pRbsp, iBitSize); | 518 | InitBits (pBs, pRbsp, iBitSize); |
| 520 | #ifdef DEBUG_PARSE_INFO | | |
| 521 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType); | | |
| 522 | #endif | | |
| 523 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); | 519 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); |
| 524 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 | 520 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 |
| 525 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) | 521 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) |