History

remove parseonly in decoder ctx

huili2 committed 10 years ago

Commit 926fc671 parent 60aaf4811 files · +128 −86Browse 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+21−20
@@ -72,7 +72,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 71 unmodified lines
7272 }
7373 }
7474
75− if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
75+ if (pCtx->pParam->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
7676 PAccessUnit pCurAu = pCtx->pAccessUnitList;
7777 if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer
7878 SParserBsInfo* pParser = pCtx->pParserBsInfo;
@@ -467,7 +467,7 @@ int32_t InitBsBuffer (PWelsDecoderContext pCtx) { · 388 unmodified lines
467467 }
468468 pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;
469469 pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;
470− if (pCtx->bParseOnly) {
470+ if (pCtx->pParam->bParseOnly) {
471471 pCtx->pParserBsInfo = static_cast<SParserBsInfo*> (pMa->WelsMallocz (sizeof (SParserBsInfo), "pCtx->pParserBsInfo"));
472472 if (pCtx->pParserBsInfo == NULL) {
473473 return ERR_INFO_OUT_OF_MEMORY;
@@ -538,14 +538,14 @@ int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) { · 64 unmodified lines
538538 }
539539
540540 /*
541− * WelsInitMemory
541+ * WelsInitStaticMemory
542542 * Memory request for new introduced data
543543 * Especially for:
544544 * rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
545545 * return:
546546 * 0 - success; otherwise returned error_no defined in error_no.h.
547547 */
548−int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
548+int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx) {
549549 if (pCtx == NULL) {
550550 return ERR_INFO_INVALID_PTR;
551551 }
@@ -563,22 +563,16 @@ int32_t WelsInitMemory (PWelsDecoderContext pCtx) { · 11 unmodified lines
563563 }
564564
565565 /*
566− * WelsFreeMemory
567− * Free memory introduced in WelsInitMemory at destruction of decoder.
566+ * WelsFreeStaticMemory
567+ * Free memory introduced in WelsInitStaticMemory at destruction of decoder.
568568 *
569569 */
570−void WelsFreeMemory (PWelsDecoderContext pCtx) {
570+void WelsFreeStaticMemory (PWelsDecoderContext pCtx) {
571571 if (pCtx == NULL)
572572 return;
573573
574574 CMemoryAlign* pMa = pCtx->pMemAlign;
575575
576− if (NULL != pCtx->pParam) {
577− pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
578−
579− pCtx->pParam = NULL;
580− }
581−
582576 MemFreeNalList (&pCtx->pAccessUnitList, pMa);
583577
584578 if (pCtx->sRawData.pHead) {
@@ -588,7 +582,7 @@ void WelsFreeMemory (PWelsDecoderContext pCtx) { · 3 unmodified lines
588582 pCtx->sRawData.pEnd = NULL;
589583 pCtx->sRawData.pStartPos = NULL;
590584 pCtx->sRawData.pCurPos = NULL;
591− if (pCtx->bParseOnly) {
585+ if (pCtx->pParam->bParseOnly) {
592586 if (pCtx->sSavedData.pHead) {
593587 pMa->WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead");
594588 }
@@ -605,6 +599,12 @@ void WelsFreeMemory (PWelsDecoderContext pCtx) { · 10 unmodified lines
605599 pCtx->pParserBsInfo = NULL;
606600 }
607601 }
602+
603+ if (NULL != pCtx->pParam) {
604+ pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
605+
606+ pCtx->pParam = NULL;
607+ }
608608 }
609609 /*
610610 * DecodeNalHeaderExt
@@ -723,8 +723,9 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 112 unmodified lines
723723 pSliceHead->eSliceType = static_cast <EWelsSliceType> (uiSliceType);
724724
725725 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", GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
727− ERR_INFO_PPS_ID_OVERFLOW));
726+ WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range",
727+ GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
728+ ERR_INFO_PPS_ID_OVERFLOW));
728729 iPpsId = uiCode;
729730
730731 //add check PPS available here
@@ -1974,7 +1975,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1243 unmodified lines
19741975
19751976 if (ERR_NONE != iErr) {
19761977 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);
1977− if (!pCtx->bParseOnly)
1978+ if (!pCtx->pParam->bParseOnly)
19781979 pDstInfo->iBufferStatus = 0;
19791980 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
19801981 pCtx->bNextNewSeqBegin = false; // reset it
@@ -2339,7 +2340,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 358 unmodified lines
23392340
23402341 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
23412342 if (!pCtx->bInstantDecFlag) {
2342− if (!pCtx->bParseOnly) {
2343+ if (!pCtx->pParam->bParseOnly) {
23432344 //Do error concealment here
23442345 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
23452346 ImplementErrorCon (pCtx);
@@ -2365,7 +2366,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 19 unmodified lines
23652366 return iRet;
23662367 }
23672368 }
2368− if (!pCtx->bParseOnly)
2369+ if (!pCtx->pParam->bParseOnly)
23692370 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
23702371 pCtx->pDec->iLinesize,
23712372 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
@@ -2421,7 +2422,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 49 unmodified lines
24212422 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
24222423 MarkECFrameAsRef (pCtx);
24232424 }
2424− } else if (pCtx->bParseOnly) { //clear parse only internal data status
2425+ } else if (pCtx->pParam->bParseOnly) { //clear parse only internal data status
24252426 pCtx->pParserBsInfo->iNalNum = 0;
24262427 pCtx->bFrameFinish = true; //clear frame pending status here!
24272428 } 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