History

Revert "Merge pull request #2217 from huili2/simply_dec_ctx"

This reverts commit 27172bafd7ff2cc80b08768a32a23470f3d6d3fd, reversing changes made to 24916a652ee5d3e36d931c222df20966f7c158fa.

Haibo Zhu committed 11 years ago

Commit 628befe1 parent 513a34011 files · +86 −133Browse files

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

Unified · Split

codec/decoder/core/src/decoder_core.cpp+20−21
@@ -72,7 +72,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 71 unmodified lines
72 }72 }
73 }73 }
74 74
75 if (pCtx->pParam->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo75 if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
76 PAccessUnit pCurAu = pCtx->pAccessUnitList;76 PAccessUnit pCurAu = pCtx->pAccessUnitList;
77 if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer77 if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer
78 SParserBsInfo* pParser = pCtx->pParserBsInfo;78 SParserBsInfo* pParser = pCtx->pParserBsInfo;
@@ -467,7 +467,7 @@ int32_t InitBsBuffer (PWelsDecoderContext pCtx) { · 388 unmodified lines
467 }467 }
468 pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;468 pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;
469 pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;469 pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;
470 if (pCtx->pParam->bParseOnly) {470 if (pCtx->bParseOnly) {
471 pCtx->pParserBsInfo = static_cast<SParserBsInfo*> (pMa->WelsMallocz (sizeof (SParserBsInfo), "pCtx->pParserBsInfo"));471 pCtx->pParserBsInfo = static_cast<SParserBsInfo*> (pMa->WelsMallocz (sizeof (SParserBsInfo), "pCtx->pParserBsInfo"));
472 if (pCtx->pParserBsInfo == NULL) {472 if (pCtx->pParserBsInfo == NULL) {
473 return ERR_INFO_OUT_OF_MEMORY;473 return ERR_INFO_OUT_OF_MEMORY;
@@ -538,14 +538,14 @@ int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) { · 64 unmodified lines
538}538}
539 539
540/*540/*
541 * WelsInitStaticMemory541 * WelsInitMemory
542 * Memory request for new introduced data542 * Memory request for new introduced data
543 * Especially for:543 * Especially for:
544 * rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.544 * rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
545 * return:545 * return:
546 * 0 - success; otherwise returned error_no defined in error_no.h.546 * 0 - success; otherwise returned error_no defined in error_no.h.
547*/547*/
548int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx) {548int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
549 if (pCtx == NULL) {549 if (pCtx == NULL) {
550 return ERR_INFO_INVALID_PTR;550 return ERR_INFO_INVALID_PTR;
551 }551 }
@@ -563,16 +563,22 @@ int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx) { · 11 unmodified lines
563}563}
564 564
565/*565/*
566 * WelsFreeStaticMemory566 * WelsFreeMemory
567 * Free memory introduced in WelsInitStaticMemory at destruction of decoder.567 * Free memory introduced in WelsInitMemory at destruction of decoder.
568 *568 *
569 */569 */
570void WelsFreeStaticMemory (PWelsDecoderContext pCtx) {570void WelsFreeMemory (PWelsDecoderContext pCtx) {
571 if (pCtx == NULL)571 if (pCtx == NULL)
572 return;572 return;
573 573
574 CMemoryAlign* pMa = pCtx->pMemAlign;574 CMemoryAlign* pMa = pCtx->pMemAlign;
575 575
576 if (NULL != pCtx->pParam) {
577 pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
578
579 pCtx->pParam = NULL;
580 }
581
576 MemFreeNalList (&pCtx->pAccessUnitList, pMa);582 MemFreeNalList (&pCtx->pAccessUnitList, pMa);
577 583
578 if (pCtx->sRawData.pHead) {584 if (pCtx->sRawData.pHead) {
@@ -582,7 +588,7 @@ void WelsFreeStaticMemory (PWelsDecoderContext pCtx) { · 3 unmodified lines
582 pCtx->sRawData.pEnd = NULL;588 pCtx->sRawData.pEnd = NULL;
583 pCtx->sRawData.pStartPos = NULL;589 pCtx->sRawData.pStartPos = NULL;
584 pCtx->sRawData.pCurPos = NULL;590 pCtx->sRawData.pCurPos = NULL;
585 if (pCtx->pParam->bParseOnly) {591 if (pCtx->bParseOnly) {
586 if (pCtx->sSavedData.pHead) {592 if (pCtx->sSavedData.pHead) {
587 pMa->WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead");593 pMa->WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead");
588 }594 }
@@ -599,12 +605,6 @@ void WelsFreeStaticMemory (PWelsDecoderContext pCtx) { · 10 unmodified lines
599 pCtx->pParserBsInfo = NULL;605 pCtx->pParserBsInfo = NULL;
600 }606 }
601 }607 }
602
603 if (NULL != pCtx->pParam) {
604 pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
605
606 pCtx->pParam = NULL;
607 }
608}608}
609/*609/*
610 * DecodeNalHeaderExt610 * DecodeNalHeaderExt
@@ -723,9 +723,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 112 unmodified lines
723 pSliceHead->eSliceType = static_cast <EWelsSliceType> (uiSliceType);723 pSliceHead->eSliceType = static_cast <EWelsSliceType> (uiSliceType);
724 724
725 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_parameter_set_id725 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_parameter_set_id
726 WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range",726 WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range", GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
727 GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,727 ERR_INFO_PPS_ID_OVERFLOW));
728 ERR_INFO_PPS_ID_OVERFLOW));
729 iPpsId = uiCode;728 iPpsId = uiCode;
730 729
731 //add check PPS available here730 //add check PPS available here
@@ -1975,7 +1974,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1243 unmodified lines
1975 1974
1976 if (ERR_NONE != iErr) {1975 if (ERR_NONE != iErr) {
1977 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);1976 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);
1978 if (!pCtx->pParam->bParseOnly)1977 if (!pCtx->bParseOnly)
1979 pDstInfo->iBufferStatus = 0;1978 pDstInfo->iBufferStatus = 0;
1980 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;1979 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
1981 pCtx->bNextNewSeqBegin = false; // reset it1980 pCtx->bNextNewSeqBegin = false; // reset it
@@ -2340,7 +2339,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 358 unmodified lines
2340 2339
2341 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {2340 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
2342 if (!pCtx->bInstantDecFlag) {2341 if (!pCtx->bInstantDecFlag) {
2343 if (!pCtx->pParam->bParseOnly) {2342 if (!pCtx->bParseOnly) {
2344 //Do error concealment here2343 //Do error concealment here
2345 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {2344 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
2346 ImplementErrorCon (pCtx);2345 ImplementErrorCon (pCtx);
@@ -2366,7 +2365,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 19 unmodified lines
2366 return iRet;2365 return iRet;
2367 }2366 }
2368 }2367 }
2369 if (!pCtx->pParam->bParseOnly)2368 if (!pCtx->bParseOnly)
2370 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,2369 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
2371 pCtx->pDec->iLinesize,2370 pCtx->pDec->iLinesize,
2372 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);2371 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
@@ -2422,7 +2421,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 49 unmodified lines
2422 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {2421 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
2423 MarkECFrameAsRef (pCtx);2422 MarkECFrameAsRef (pCtx);
2424 }2423 }
2425 } else if (pCtx->pParam->bParseOnly) { //clear parse only internal data status2424 } else if (pCtx->bParseOnly) { //clear parse only internal data status
2426 pCtx->pParserBsInfo->iNalNum = 0;2425 pCtx->pParserBsInfo->iNalNum = 0;
2427 pCtx->bFrameFinish = true; //clear frame pending status here!2426 pCtx->bFrameFinish = true; //clear frame pending status here!
2428 } else {2427 } else {

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