Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 32 files). Show all
Unified · Split
| @@ -43,7 +43,6 @@ · 42 unmodified lines | |||
| 43 | #include "error_code.h" | 43 | #include "error_code.h" |
| 44 | #include "memmgr_nal_unit.h" | 44 | #include "memmgr_nal_unit.h" |
| 45 | #include "decoder_core.h" | 45 | #include "decoder_core.h" |
| 46 | #include "decoder_core.h" | ||
| 47 | 46 | ||
| 48 | namespace WelsDec { | 47 | namespace WelsDec { |
| 49 | /*! | 48 | /*! |
| @@ -227,14 +226,18 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 177 unmodified lines | |||
| 227 | pCurNal->sNalHeaderExt.sNalUnitHeader.uiForbiddenZeroBit = pNalUnitHeader->uiForbiddenZeroBit; | 226 | pCurNal->sNalHeaderExt.sNalUnitHeader.uiForbiddenZeroBit = pNalUnitHeader->uiForbiddenZeroBit; |
| 228 | pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc = pNalUnitHeader->uiNalRefIdc; | 227 | pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc = pNalUnitHeader->uiNalRefIdc; |
| 229 | pCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType = pNalUnitHeader->eNalUnitType; | 228 | pCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType = pNalUnitHeader->eNalUnitType; |
| 230 | 229 | if (pNalUnitHeader->uiNalRefIdc != 0) { | |
| 231 | pBs = &pCtx->sBs; | 230 | pBs = &pCtx->sBs; |
| 232 | 231 | iBitSize = (iNalSize << 3) - BsGetTrailingBits (pNal + iNalSize - 1); // convert into bit | |
| 233 | iBitSize = (iNalSize << 3) - BsGetTrailingBits (pNal + iNalSize - 1); // convert into bit | 232 | |
| 234 | 233 | iErr = InitBits (pBs, pNal, iBitSize); | |
| 235 | InitBits (pBs, pNal, iBitSize); | 234 | if (iErr) { |
| 236 | 235 | WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_PREFIX: InitBits() fail due invalid access."); | |
| 237 | ParsePrefixNalUnit (pCtx, pBs); | 236 | pCtx->iErrorCode |= dsBitstreamError; |
| 237 | return NULL; | ||
| 238 | } | ||
| 239 | ParsePrefixNalUnit (pCtx, pBs); | ||
| 240 | } | ||
| 238 | pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = true; | 241 | pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = true; |
| 239 | 242 | ||
| 240 | break; | 243 | break; |
| @@ -309,7 +312,12 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 68 unmodified lines | |||
| 309 | 312 | ||
| 310 | pBs = &pCurAu->pNalUnitsList[uiAvailNalNum - 1]->sNalData.sVclNal.sSliceBitsRead; | 313 | pBs = &pCurAu->pNalUnitsList[uiAvailNalNum - 1]->sNalData.sVclNal.sSliceBitsRead; |
| 311 | iBitSize = (iNalSize << 3) - BsGetTrailingBits (pNal + iNalSize - 1); // convert into bit | 314 | iBitSize = (iNalSize << 3) - BsGetTrailingBits (pNal + iNalSize - 1); // convert into bit |
| 312 | InitBits (pBs, pNal, iBitSize); | 315 | iErr = InitBits (pBs, pNal, iBitSize); |
| 316 | if (iErr) { | ||
| 317 | WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_CODED_SLICE: InitBits() fail due invalid access."); | ||
| 318 | pCtx->iErrorCode |= dsBitstreamError; | ||
| 319 | return NULL; | ||
| 320 | } | ||
| 313 | iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag); | 321 | iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag); |
| 314 | if (iErr != ERR_NONE) { | 322 | if (iErr != ERR_NONE) { |
| 315 | if ((uiAvailNalNum == 1) && (pCurNal->sNalHeaderExt.bIdrFlag)) { //IDR parse error | 323 | if ((uiAvailNalNum == 1) && (pCurNal->sNalHeaderExt.bIdrFlag)) { //IDR parse error |
| @@ -505,8 +513,16 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 189 unmodified lines | |||
| 505 | switch (eNalType) { | 513 | switch (eNalType) { |
| 506 | case NAL_UNIT_SPS: | 514 | case NAL_UNIT_SPS: |
| 507 | case NAL_UNIT_SUBSET_SPS: | 515 | case NAL_UNIT_SUBSET_SPS: |
| 508 | if (iBitSize > 0) | 516 | if (iBitSize > 0) { |
| 509 | InitBits (pBs, pRbsp, iBitSize); | 517 | iErr = InitBits (pBs, pRbsp, iBitSize); |
| 518 | if (ERR_NONE != iErr) { | ||
| 519 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) | ||
| 520 | pCtx->iErrorCode |= dsNoParamSets; | ||
| 521 | else | ||
| 522 | pCtx->iErrorCode |= dsBitstreamError; | ||
| 523 | return iErr; | ||
| 524 | } | ||
| 525 | } | ||
| 510 | iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); | 526 | iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); |
| 511 | if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 | 527 | if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 |
| 512 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) | 528 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) |
| @@ -519,8 +535,16 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 6 unmodified lines | |||
| 519 | break; | 535 | break; |
| 520 | 536 | ||
| 521 | case NAL_UNIT_PPS: | 537 | case NAL_UNIT_PPS: |
| 522 | if (iBitSize > 0) | 538 | if (iBitSize > 0) { |
| 523 | InitBits (pBs, pRbsp, iBitSize); | 539 | iErr = InitBits (pBs, pRbsp, iBitSize); |
| 540 | if (ERR_NONE != iErr) { | ||
| 541 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) | ||
| 542 | pCtx->iErrorCode |= dsNoParamSets; | ||
| 543 | else | ||
| 544 | pCtx->iErrorCode |= dsBitstreamError; | ||
| 545 | return iErr; | ||
| 546 | } | ||
| 547 | } | ||
| 524 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); | 548 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); |
| 525 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 | 549 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 |
| 526 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) | 550 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) |