Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 13 files). Show all
Unified · Split
| @@ -350,6 +350,9 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 349 unmodified lines | |||
| 350 | return iRet; | 350 | return iRet; |
| 351 | pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc; | 351 | pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc; |
| 352 | 352 | ||
| 353 | if (pCtx->bParseOnly) //parse only, disable EC method | ||
| 354 | pCtx->eErrorConMethod = ERROR_CON_DISABLE; | ||
| 355 | |||
| 353 | if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType || | 356 | if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType || |
| 354 | VIDEO_BITSTREAM_AVC == pCtx->pParam->sVideoProperty.eVideoBsType) { | 357 | VIDEO_BITSTREAM_AVC == pCtx->pParam->sVideoProperty.eVideoBsType) { |
| 355 | pCtx->eVideoType = pCtx->pParam->sVideoProperty.eVideoBsType; | 358 | pCtx->eVideoType = pCtx->pParam->sVideoProperty.eVideoBsType; |
| @@ -374,7 +377,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 18 unmodified lines | |||
| 374 | * \note N/A | 377 | * \note N/A |
| 375 | ************************************************************************************* | 378 | ************************************************************************************* |
| 376 | */ | 379 | */ |
| 377 | int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { | 380 | int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) { |
| 378 | if (pCtx == NULL) { | 381 | if (pCtx == NULL) { |
| 379 | return ERR_INFO_INVALID_PTR; | 382 | return ERR_INFO_INVALID_PTR; |
| 380 | } | 383 | } |
| @@ -382,6 +385,7 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 1 unmodified line | |||
| 382 | // default | 385 | // default |
| 383 | WelsDecoderDefaults (pCtx, pLogCtx); | 386 | WelsDecoderDefaults (pCtx, pLogCtx); |
| 384 | 387 | ||
| 388 | pCtx->bParseOnly = bParseOnly; | ||
| 385 | // open decoder | 389 | // open decoder |
| 386 | return WelsOpenDecoder (pCtx); | 390 | return WelsOpenDecoder (pCtx); |
| 387 | } | 391 | } |
| @@ -427,9 +431,10 @@ void GetVclNalTemporalId (PWelsDecoderContext pCtx) { · 39 unmodified lines | |||
| 427 | ************************************************************************************* | 431 | ************************************************************************************* |
| 428 | */ | 432 | */ |
| 429 | int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const int32_t kiBsLen, | 433 | int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const int32_t kiBsLen, |
| 430 | uint8_t** ppDst, SBufferInfo* pDstBufInfo) { | 434 | uint8_t** ppDst, SBufferInfo* pDstBufInfo, SParserBsInfo* pDstBsInfo) { |
| 431 | if (!pCtx->bEndOfStreamFlag) { | 435 | if (!pCtx->bEndOfStreamFlag) { |
| 432 | SDataBuffer* pRawData = &pCtx->sRawData; | 436 | SDataBuffer* pRawData = &pCtx->sRawData; |
| 437 | SDataBuffer* pSavedData = NULL; | ||
| 433 | 438 | ||
| 434 | int32_t iSrcIdx = 0; //the index of source bit-stream till now after parsing one or more NALs | 439 | int32_t iSrcIdx = 0; //the index of source bit-stream till now after parsing one or more NALs |
| 435 | int32_t iSrcConsumed = 0; // consumed bit count of source bs | 440 | int32_t iSrcConsumed = 0; // consumed bit count of source bs |
| @@ -457,7 +462,12 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 21 unmodified lines | |||
| 457 | pRawData->pCurPos = pRawData->pHead; | 462 | pRawData->pCurPos = pRawData->pHead; |
| 458 | } | 463 | } |
| 459 | 464 | ||
| 460 | 465 | if (pCtx->bParseOnly) { | |
| 466 | pSavedData = &pCtx->sSavedData; | ||
| 467 | if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) { | ||
| 468 | pSavedData->pCurPos = pSavedData->pHead; | ||
| 469 | } | ||
| 470 | } | ||
| 461 | //copy raw data from source buffer (application) to raw data buffer (codec inside) | 471 | //copy raw data from source buffer (application) to raw data buffer (codec inside) |
| 462 | //0x03 removal and extract all of NAL Unit from current raw data | 472 | //0x03 removal and extract all of NAL Unit from current raw data |
| 463 | pDstNal = pRawData->pCurPos; | 473 | pDstNal = pRawData->pCurPos; |
| @@ -481,7 +491,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 17 unmodified lines | |||
| 481 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); | 491 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); |
| 482 | } | 492 | } |
| 483 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { | 493 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { |
| 484 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes); | 494 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3); |
| 485 | } | 495 | } |
| 486 | if (pCtx->bAuReadyFlag) { | 496 | if (pCtx->bAuReadyFlag) { |
| 487 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 497 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |
| @@ -542,7 +552,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 54 unmodified lines | |||
| 542 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); | 552 | CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo); |
| 543 | } | 553 | } |
| 544 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { | 554 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { |
| 545 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes); | 555 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3); |
| 546 | } | 556 | } |
| 547 | if (pCtx->bAuReadyFlag) { | 557 | if (pCtx->bAuReadyFlag) { |
| 548 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 558 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |