History

parse only add and UT

huili2 committed 11 years ago

Commit b231e3f1 parent 53c14dc13 files · +607 −60Browse files

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

Unified · Split

codec/decoder/core/src/decoder.cpp+15−5
@@ -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/A377 * \note N/A
375 *************************************************************************************378 *************************************************************************************
376 */379 */
377int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {380int32_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 // default385 // default
383 WelsDecoderDefaults (pCtx, pLogCtx);386 WelsDecoderDefaults (pCtx, pLogCtx);
384 387
388 pCtx->bParseOnly = bParseOnly;
385 // open decoder389 // 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 */
429int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const int32_t kiBsLen,433int32_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 NALs439 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 bs440 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 data472 //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);

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