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 (5 of 11 files). Show all

Unified · Split

5 files
  1. codec/decoder/core/src/au_parser.cpp +4 −4
  2. codec/decoder/core/src/decode_slice.cpp +2 −2
  3. codec/decoder/core/src/decoder.cpp +36 −34
  4. codec/decoder/core/src/decoder_core.cpp +20 −21
  5. codec/decoder/core/src/pic_queue.cpp +1 −1
codec/decoder/core/src/au_parser.cpp+4−4
@@ -317,7 +317,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 316 unmodified lines
317 iNalSize -= NAL_UNIT_HEADER_EXT_SIZE;317 iNalSize -= NAL_UNIT_HEADER_EXT_SIZE;
318 *pConsumedBytes += NAL_UNIT_HEADER_EXT_SIZE;318 *pConsumedBytes += NAL_UNIT_HEADER_EXT_SIZE;
319 319
320 if (pCtx->pParam->bParseOnly) {320 if (pCtx->bParseOnly) {
321 pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;321 pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;
322 int32_t iTrailingZeroByte = 0;322 int32_t iTrailingZeroByte = 0;
323 while (pSrcNal[iSrcNalLen - iTrailingZeroByte - 1] == 0x0) //remove final trailing 0 bytes323 while (pSrcNal[iSrcNalLen - iTrailingZeroByte - 1] == 0x0) //remove final trailing 0 bytes
@@ -346,7 +346,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 22 unmodified lines
346 pSavedData->pCurPos += iActualLen - iOffset;346 pSavedData->pCurPos += iActualLen - iOffset;
347 }347 }
348 } else {348 } else {
349 if (pCtx->pParam->bParseOnly) {349 if (pCtx->bParseOnly) {
350 pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;350 pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;
351 int32_t iTrailingZeroByte = 0;351 int32_t iTrailingZeroByte = 0;
352 while (pSrcNal[iSrcNalLen - iTrailingZeroByte - 1] == 0x0) //remove final trailing 0 bytes352 while (pSrcNal[iSrcNalLen - iTrailingZeroByte - 1] == 0x0) //remove final trailing 0 bytes
@@ -1113,7 +1113,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 760 unmodified lines
1113 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag1113 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag
1114 pSps->bVuiParamPresentFlag = !!uiCode;1114 pSps->bVuiParamPresentFlag = !!uiCode;
1115 1115
1116 if (pCtx->pParam->bParseOnly) {1116 if (pCtx->bParseOnly) {
1117 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds!1117 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds!
1118 pCtx->iErrorCode |= dsOutOfMemory;1118 pCtx->iErrorCode |= dsOutOfMemory;
1119 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);1119 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);
@@ -1416,7 +1416,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 296 unmodified lines
1416 memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps));1416 memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps));
1417 pCtx->bPpsAvailFlags[uiPpsId] = true;1417 pCtx->bPpsAvailFlags[uiPpsId] = true;
1418 }1418 }
1419 if (pCtx->pParam->bParseOnly) {1419 if (pCtx->bParseOnly) {
1420 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds1420 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds
1421 pCtx->iErrorCode |= dsOutOfMemory;1421 pCtx->iErrorCode |= dsOutOfMemory;
1422 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);1422 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);
codec/decoder/core/src/decode_slice.cpp+2−2
@@ -90,7 +90,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 89 unmodified lines
90 break;90 break;
91 }91 }
92 92
93 if (!pCtx->pParam->bParseOnly) { //for parse only, actual recon MB unnecessary93 if (!pCtx->bParseOnly) { //for parse only, actual recon MB unnecessary
94 if (WelsTargetMbConstruction (pCtx)) {94 if (WelsTargetMbConstruction (pCtx)) {
95 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,95 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
96 "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d",96 "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d",
@@ -134,7 +134,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 37 unmodified lines
134 if ((pCurSlice->eSliceType != I_SLICE) && (pCurSlice->eSliceType != P_SLICE))134 if ((pCurSlice->eSliceType != I_SLICE) && (pCurSlice->eSliceType != P_SLICE))
135 return 0;135 return 0;
136 136
137 if (pCtx->pParam->bParseOnly) //for parse only, deblocking should not go on137 if (pCtx->bParseOnly) //for parse only, deblocking should not go on
138 return 0;138 return 0;
139 139
140 pDeblockMb = WelsDeblockingMb;140 pDeblockMb = WelsDeblockingMb;
codec/decoder/core/src/decoder.cpp+36−34
@@ -272,13 +272,14 @@ void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) { · 271 unmodified lines
272 pPicBuf = NULL;272 pPicBuf = NULL;
273 *ppPicBuf = NULL;273 *ppPicBuf = NULL;
274}274}
275
276/*275/*
277 * fill data fields in default for decoder context276 * fill data fields in default for decoder context
278 */277 */
279void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {278void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx, CMemoryAlign* pMa) {
280 int32_t iCpuCores = 1;279 int32_t iCpuCores = 1;
280 memset (pCtx, 0, sizeof (SWelsDecoderContext)); // fill zero first
281 pCtx->sLogCtx = *pLogCtx;281 pCtx->sLogCtx = *pLogCtx;
282 pCtx->pMemAlign = pMa;
282 283
283 pCtx->pArgDec = NULL;284 pCtx->pArgDec = NULL;
284 285
@@ -441,20 +442,18 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const · 156 unmodified lines
441}442}
442 443
443/*444/*
444 * free memory dynamically allocated during decoder445 * free memory blocks in avc
445 */446 */
446void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) {447void WelsFreeMem (PWelsDecoderContext pCtx) {
447 int32_t iListIdx = 0;448 int32_t iListIdx = 0;
448 CMemoryAlign* pMa = pCtx->pMemAlign;449 CMemoryAlign* pMa = pCtx->pMemAlign;
449 450
450 //free dq layer memory451 /* TODO: free memory blocks introduced in avc */
451 UninitialDqLayersContext (pCtx);
452
453 //free FMO memory
454 ResetFmoList (pCtx);452 ResetFmoList (pCtx);
455 453
456 //free ref-pic list & picture memory
457 WelsResetRefPic (pCtx);454 WelsResetRefPic (pCtx);
455
456 // for sPicBuff
458 for (iListIdx = LIST_0; iListIdx < LIST_A; ++ iListIdx) {457 for (iListIdx = LIST_0; iListIdx < LIST_A; ++ iListIdx) {
459 PPicBuff* pPicBuff = &pCtx->pPicBuff[iListIdx];458 PPicBuff* pPicBuff = &pCtx->pPicBuff[iListIdx];
460 if (NULL != pPicBuff && NULL != *pPicBuff) {459 if (NULL != pPicBuff && NULL != *pPicBuff) {
@@ -469,8 +468,6 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 8 unmodified lines
469 pCtx->iLastImgHeightInPixel = 0;468 pCtx->iLastImgHeightInPixel = 0;
470 pCtx->bFreezeOutput = true;469 pCtx->bFreezeOutput = true;
471 pCtx->bHaveGotMemory = false;470 pCtx->bHaveGotMemory = false;
472
473 //free CABAC memory
474 pMa->WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine");471 pMa->WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine");
475}472}
476 473
@@ -478,15 +475,19 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 1 unmodified line
478 * \brief Open decoder475 * \brief Open decoder
479 */476 */
480int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {477int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
481 int iRet = ERR_NONE;
482 // function pointers478 // function pointers
483 InitDecFuncs (pCtx, pCtx->uiCpuFlag);479 //initial MC function pointer--
480 int iRet = ERR_NONE;
481 InitMcFunc (& (pCtx->sMcFunc), pCtx->uiCpuFlag);
482
483 InitExpandPictureFunc (& (pCtx->sExpandPicFunc), pCtx->uiCpuFlag);
484 AssignFuncPointerForRec (pCtx);
484 485
485 // vlc tables486 // vlc tables
486 InitVlcTable (&pCtx->sVlcTable);487 InitVlcTable (&pCtx->sVlcTable);
487 488
488 // static memory489 // startup memory
489 iRet = WelsInitStaticMemory (pCtx);490 iRet = WelsInitMemory (pCtx);
490 if (ERR_NONE != iRet)491 if (ERR_NONE != iRet)
491 return iRet;492 return iRet;
492 493
@@ -506,9 +507,11 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { · 13 unmodified lines
506 * \brief Close decoder507 * \brief Close decoder
507 */508 */
508void WelsCloseDecoder (PWelsDecoderContext pCtx) {509void WelsCloseDecoder (PWelsDecoderContext pCtx) {
509 WelsFreeDynamicMemory (pCtx);510 WelsFreeMem (pCtx);
511
512 WelsFreeMemory (pCtx);
510 513
511 WelsFreeStaticMemory (pCtx);514 UninitialDqLayersContext (pCtx);
512 515
513#ifdef LONG_TERM_REF516#ifdef LONG_TERM_REF
514 pCtx->bParamSetsLostFlag = false;517 pCtx->bParamSetsLostFlag = false;
@@ -528,7 +531,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 13 unmodified lines
528 531
529 memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));532 memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
530 pCtx->eOutputColorFormat = pCtx->pParam->eOutputColorFormat;533 pCtx->eOutputColorFormat = pCtx->pParam->eOutputColorFormat;
531 if (!pCtx->pParam->bParseOnly) {534 if (!pCtx->bParseOnly) {
532 int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);535 int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);
533 if (iRet)536 if (iRet)
534 return iRet;537 return iRet;
@@ -543,7 +546,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 8 unmodified lines
543 }546 }
544 pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;547 pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
545 548
546 if (pCtx->pParam->bParseOnly) //parse only, disable EC method549 if (pCtx->bParseOnly) //parse only, disable EC method
547 pCtx->eErrorConMethod = ERROR_CON_DISABLE;550 pCtx->eErrorConMethod = ERROR_CON_DISABLE;
548 InitErrorCon (pCtx);551 InitErrorCon (pCtx);
549 552
@@ -571,11 +574,15 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 21 unmodified lines
571 * \note N/A574 * \note N/A
572 *************************************************************************************575 *************************************************************************************
573 */576 */
574int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {577int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
575 if (pCtx == NULL) {578 if (pCtx == NULL) {
576 return ERR_INFO_INVALID_PTR;579 return ERR_INFO_INVALID_PTR;
577 }580 }
578 581
582 // default
583 WelsDecoderDefaults (pCtx, pLogCtx, pCtx->pMemAlign);
584
585 pCtx->bParseOnly = bParseOnly;
579 // open decoder586 // open decoder
580 return WelsOpenDecoder (pCtx);587 return WelsOpenDecoder (pCtx);
581}588}
@@ -652,7 +659,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 70 unmodified lines
652 pRawData->pCurPos = pRawData->pHead;659 pRawData->pCurPos = pRawData->pHead;
653 }660 }
654 661
655 if (pCtx->pParam->bParseOnly) {662 if (pCtx->bParseOnly) {
656 pSavedData = &pCtx->sSavedData;663 pSavedData = &pCtx->sSavedData;
657 if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) {664 if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) {
658 pSavedData->pCurPos = pSavedData->pHead;665 pSavedData->pCurPos = pSavedData->pHead;
@@ -857,15 +864,7 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi · 198 unmodified lines
857 return iErr;864 return iErr;
858}865}
859 866
860void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {867void AssignFuncPointerForRec (PWelsDecoderContext pCtx) {
861 WelsBlockFuncInit (&pCtx->sBlockFunc, uiCpuFlag);
862 InitPredFunc (pCtx, uiCpuFlag);
863 InitMcFunc (& (pCtx->sMcFunc), uiCpuFlag);
864 InitExpandPictureFunc (& (pCtx->sExpandPicFunc), uiCpuFlag);
865 DeblockingInit (&pCtx->sDeblockingFunc, uiCpuFlag);
866}
867
868void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
869 pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c;868 pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c;
870 pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c;869 pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c;
871 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC ] = WelsI16x16LumaPredDc_c;870 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC ] = WelsI16x16LumaPredDc_c;
@@ -917,7 +916,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 45 unmodified lines
917 pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c;916 pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c;
918 917
919#if defined(HAVE_NEON)918#if defined(HAVE_NEON)
920 if (uiCpuFlag & WELS_CPU_NEON) {919 if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
921 pCtx->pIdctResAddPredFunc = IdctResAddPred_neon;920 pCtx->pIdctResAddPredFunc = IdctResAddPred_neon;
922 921
923 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon;922 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon;
@@ -942,7 +941,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 18 unmodified lines
942#endif//HAVE_NEON941#endif//HAVE_NEON
943 942
944#if defined(HAVE_NEON_AARCH64)943#if defined(HAVE_NEON_AARCH64)
945 if (uiCpuFlag & WELS_CPU_NEON) {944 if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
946 pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon;945 pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon;
947 946
948 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon;947 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon;
@@ -972,7 +971,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 23 unmodified lines
972#endif//HAVE_NEON_AARCH64971#endif//HAVE_NEON_AARCH64
973 972
974#if defined(X86_ASM)973#if defined(X86_ASM)
975 if (uiCpuFlag & WELS_CPU_MMXEXT) {974 if (pCtx->uiCpuFlag & WELS_CPU_MMXEXT) {
976 pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx;975 pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx;
977 976
978 ///////mmx code opt---977 ///////mmx code opt---
@@ -987,7 +986,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 8 unmodified lines
987 pCtx->pGetI4x4LumaPredFunc[I4_PRED_DDL] = WelsDecoderI4x4LumaPredDDL_mmx;986 pCtx->pGetI4x4LumaPredFunc[I4_PRED_DDL] = WelsDecoderI4x4LumaPredDDL_mmx;
988 pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx;987 pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx;
989 }988 }
990 if (uiCpuFlag & WELS_CPU_SSE2) {989 if (pCtx->uiCpuFlag & WELS_CPU_SSE2) {
991 /////////sse2 code opt---990 /////////sse2 code opt---
992 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2;991 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2;
993 pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2;992 pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2;
@@ -1001,6 +1000,9 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 7 unmodified lines
1001 pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2;1000 pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2;
1002 }1001 }
1003#endif1002#endif
1003 DeblockingInit (&pCtx->sDeblockingFunc, pCtx->uiCpuFlag);
1004
1005 WelsBlockFuncInit (&pCtx->sBlockFunc, pCtx->uiCpuFlag);
1004}1006}
1005 1007
1006//reset decoder number related statistics info1008//reset decoder number related statistics info
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 {
codec/decoder/core/src/pic_queue.cpp+1−1
@@ -83,7 +83,7 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 82 unmodified lines
83 iLumaSize = iPicWidth * iPicHeight;83 iLumaSize = iPicWidth * iPicHeight;
84 iChromaSize = iPicChromaWidth * iPicChromaHeight;84 iChromaSize = iPicChromaWidth * iPicChromaHeight;
85 85
86 if (pCtx->pParam->bParseOnly) {86 if (pCtx->bParseOnly) {
87 pPic->pBuffer[0] = pPic->pBuffer[1] = pPic->pBuffer[2] = NULL;87 pPic->pBuffer[0] = pPic->pBuffer[1] = pPic->pBuffer[2] = NULL;
88 pPic->pData[0] = pPic->pData[1] = pPic->pData[2] = NULL;88 pPic->pData[0] = pPic->pData[1] = pPic->pData[2] = NULL;
89 pPic->iLinesize[0] = iPicWidth;89 pPic->iLinesize[0] = iPicWidth;

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