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
350350 return iRet;
351351 pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
352352
353+ if (pCtx->bParseOnly) //parse only, disable EC method
354+ pCtx->eErrorConMethod = ERROR_CON_DISABLE;
355+
353356 if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType ||
354357 VIDEO_BITSTREAM_AVC == pCtx->pParam->sVideoProperty.eVideoBsType) {
355358 pCtx->eVideoType = pCtx->pParam->sVideoProperty.eVideoBsType;
@@ -374,7 +377,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 18 unmodified lines
374377 * \note N/A
375378 *************************************************************************************
376379 */
377−int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
380+int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
378381 if (pCtx == NULL) {
379382 return ERR_INFO_INVALID_PTR;
380383 }
@@ -382,6 +385,7 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 1 unmodified line
382385 // default
383386 WelsDecoderDefaults (pCtx, pLogCtx);
384387
388+ pCtx->bParseOnly = bParseOnly;
385389 // open decoder
386390 return WelsOpenDecoder (pCtx);
387391 }
@@ -427,9 +431,10 @@ void GetVclNalTemporalId (PWelsDecoderContext pCtx) { · 39 unmodified lines
427431 *************************************************************************************
428432 */
429433 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) {
431435 if (!pCtx->bEndOfStreamFlag) {
432436 SDataBuffer* pRawData = &pCtx->sRawData;
437+ SDataBuffer* pSavedData = NULL;
433438
434439 int32_t iSrcIdx = 0; //the index of source bit-stream till now after parsing one or more NALs
435440 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
457462 pRawData->pCurPos = pRawData->pHead;
458463 }
459464
460−
465+ if (pCtx->bParseOnly) {
466+ pSavedData = &pCtx->sSavedData;
467+ if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) {
468+ pSavedData->pCurPos = pSavedData->pHead;
469+ }
470+ }
461471 //copy raw data from source buffer (application) to raw data buffer (codec inside)
462472 //0x03 removal and extract all of NAL Unit from current raw data
463473 pDstNal = pRawData->pCurPos;
@@ -481,7 +491,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 17 unmodified lines
481491 CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
482492 }
483493 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);
485495 }
486496 if (pCtx->bAuReadyFlag) {
487497 ConstructAccessUnit (pCtx, ppDst, pDstBufInfo);
@@ -542,7 +552,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 54 unmodified lines
542552 CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
543553 }
544554 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);
546556 }
547557 if (pCtx->bAuReadyFlag) {
548558 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