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

Unified · Split

9 files
  1. codec/decoder/core/inc/decoder.h +4 −21
  2. codec/decoder/core/inc/decoder_context.h +1 −0
  3. codec/decoder/core/inc/decoder_core.h +6 −6
  4. codec/decoder/core/src/au_parser.cpp +4 −4
  5. codec/decoder/core/src/decode_slice.cpp +2 −2
  6. codec/decoder/core/src/decoder.cpp +36 −34
  7. codec/decoder/core/src/decoder_core.cpp +20 −21
  8. codec/decoder/core/src/pic_queue.cpp +1 −1
  9. codec/decoder/plus/src/welsDecoderExt.cpp +4 −8
codec/decoder/core/inc/decoder.h+4−21
@@ -54,11 +54,6 @@ extern "C" { · 53 unmodified lines
5454 */
5555 int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam);
5656
57−/*!
58− * \brief fill in default values of decoder context
59− */
60−void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx);
61−
6257 /*!
6358 *************************************************************************************
6459 * \brief Initialize Wels decoder parameters and memory
@@ -73,7 +68,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx); · 8 unmodified lines
7368 * \note N/A
7469 *************************************************************************************
7570 */
76−int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx);
71+int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx);
7772
7873 /*!
7974 *************************************************************************************
@@ -115,9 +110,9 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const · 35 unmodified lines
115110
116111
117112 /*
118− * free memory dynamically allocated during decoder
113+ * free memory blocks in avc
119114 */
120− void WelsFreeDynamicMemory (PWelsDecoderContext pCtx);
115+void WelsFreeMem (PWelsDecoderContext pCtx);
121116
122117 /*
123118 * set colorspace format in decoder
@@ -135,19 +130,7 @@ int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat); · 11 unmodified lines
135130 */
136131 int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
137132
138−/*!
139− * \brief init decoder predictive function pointers including ASM functions during MB reconstruction
140− * \param pCtx Wels decoder context
141− * \param uiCpuFlag cpu assembly indication
142− */
143−void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag);
144−
145−/*!
146− * \brief init decoder internal function pointers including ASM functions
147− * \param pCtx Wels decoder context
148− * \param uiCpuFlag cpu assembly indication
149− */
150−void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag);
133+void AssignFuncPointerForRec (PWelsDecoderContext pCtx);
151134
152135 void GetVclNalTemporalId (PWelsDecoderContext pCtx); //get the info that whether or not have VCL NAL in current AU,
153136 //and if YES, get the temporal ID
codec/decoder/core/inc/decoder_context.h+1−0
@@ -376,6 +376,7 @@ typedef struct TagWelsDecoderContext { · 375 unmodified lines
376376 ERROR_CON_IDC eErrorConMethod; //
377377
378378 //for Parse only
379+ bool bParseOnly;
379380 bool bFramePending;
380381 bool bFrameFinish;
381382 int32_t iNalNum;
codec/decoder/core/inc/decoder_core.h+6−6
@@ -72,21 +72,21 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen); · 71 unmodified lines
7272 int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen);
7373
7474 /*
75− * WelsInitStaticMemory
76− * Memory request for introduced data at decoder start
75+ * WelsInitMemory
76+ * Memory request for introduced data
7777 * Especially for:
7878 * rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
7979 * return:
8080 * 0 - success; otherwise returned error_no defined in error_no.h.
8181 */
82−int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx);
82+int32_t WelsInitMemory (PWelsDecoderContext pCtx);
8383
8484 /*
85− * WelsFreeStaticMemory
86− * Free memory introduced in WelsInitStaticMemory at destruction of decoder.
85+ * WelsFreeMemory
86+ * Free memory introduced in WelsInitMemory at destruction of decoder.
8787 *
8888 */
89−void WelsFreeStaticMemory (PWelsDecoderContext pCtx);
89+void WelsFreeMemory (PWelsDecoderContext pCtx);
9090
9191 /*!
9292 * \brief request memory when maximal picture width and height are available
codec/decoder/core/src/au_parser.cpp+4−4
@@ -317,7 +317,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 316 unmodified lines
317317 iNalSize -= NAL_UNIT_HEADER_EXT_SIZE;
318318 *pConsumedBytes += NAL_UNIT_HEADER_EXT_SIZE;
319319
320− if (pCtx->pParam->bParseOnly) {
320+ if (pCtx->bParseOnly) {
321321 pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;
322322 int32_t iTrailingZeroByte = 0;
323323 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
346346 pSavedData->pCurPos += iActualLen - iOffset;
347347 }
348348 } else {
349− if (pCtx->pParam->bParseOnly) {
349+ if (pCtx->bParseOnly) {
350350 pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;
351351 int32_t iTrailingZeroByte = 0;
352352 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
11131113 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag
11141114 pSps->bVuiParamPresentFlag = !!uiCode;
11151115
1116− if (pCtx->pParam->bParseOnly) {
1116+ if (pCtx->bParseOnly) {
11171117 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds!
11181118 pCtx->iErrorCode |= dsOutOfMemory;
11191119 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
14161416 memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps));
14171417 pCtx->bPpsAvailFlags[uiPpsId] = true;
14181418 }
1419− if (pCtx->pParam->bParseOnly) {
1419+ if (pCtx->bParseOnly) {
14201420 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds
14211421 pCtx->iErrorCode |= dsOutOfMemory;
14221422 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
9090 break;
9191 }
9292
93− if (!pCtx->pParam->bParseOnly) { //for parse only, actual recon MB unnecessary
93+ if (!pCtx->bParseOnly) { //for parse only, actual recon MB unnecessary
9494 if (WelsTargetMbConstruction (pCtx)) {
9595 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
9696 "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d",
@@ -134,7 +134,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 37 unmodified lines
134134 if ((pCurSlice->eSliceType != I_SLICE) && (pCurSlice->eSliceType != P_SLICE))
135135 return 0;
136136
137− if (pCtx->pParam->bParseOnly) //for parse only, deblocking should not go on
137+ if (pCtx->bParseOnly) //for parse only, deblocking should not go on
138138 return 0;
139139
140140 pDeblockMb = WelsDeblockingMb;
codec/decoder/core/src/decoder.cpp+36−34
@@ -272,13 +272,14 @@ void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) { · 271 unmodified lines
272272 pPicBuf = NULL;
273273 *ppPicBuf = NULL;
274274 }
275−
276275 /*
277276 * fill data fields in default for decoder context
278277 */
279−void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
278+void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx, CMemoryAlign* pMa) {
280279 int32_t iCpuCores = 1;
280+ memset (pCtx, 0, sizeof (SWelsDecoderContext)); // fill zero first
281281 pCtx->sLogCtx = *pLogCtx;
282+ pCtx->pMemAlign = pMa;
282283
283284 pCtx->pArgDec = NULL;
284285
@@ -441,20 +442,18 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const · 156 unmodified lines
441442 }
442443
443444 /*
444− * free memory dynamically allocated during decoder
445+ * free memory blocks in avc
445446 */
446−void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) {
447+void WelsFreeMem (PWelsDecoderContext pCtx) {
447448 int32_t iListIdx = 0;
448449 CMemoryAlign* pMa = pCtx->pMemAlign;
449450
450− //free dq layer memory
451− UninitialDqLayersContext (pCtx);
452−
453− //free FMO memory
451+ /* TODO: free memory blocks introduced in avc */
454452 ResetFmoList (pCtx);
455453
456− //free ref-pic list & picture memory
457454 WelsResetRefPic (pCtx);
455+
456+ // for sPicBuff
458457 for (iListIdx = LIST_0; iListIdx < LIST_A; ++ iListIdx) {
459458 PPicBuff* pPicBuff = &pCtx->pPicBuff[iListIdx];
460459 if (NULL != pPicBuff && NULL != *pPicBuff) {
@@ -469,8 +468,6 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 8 unmodified lines
469468 pCtx->iLastImgHeightInPixel = 0;
470469 pCtx->bFreezeOutput = true;
471470 pCtx->bHaveGotMemory = false;
472−
473− //free CABAC memory
474471 pMa->WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine");
475472 }
476473
@@ -478,15 +475,19 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 1 unmodified line
478475 * \brief Open decoder
479476 */
480477 int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
481− int iRet = ERR_NONE;
482478 // 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);
484485
485486 // vlc tables
486487 InitVlcTable (&pCtx->sVlcTable);
487488
488− // static memory
489− iRet = WelsInitStaticMemory (pCtx);
489+ // startup memory
490+ iRet = WelsInitMemory (pCtx);
490491 if (ERR_NONE != iRet)
491492 return iRet;
492493
@@ -506,9 +507,11 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { · 13 unmodified lines
506507 * \brief Close decoder
507508 */
508509 void WelsCloseDecoder (PWelsDecoderContext pCtx) {
509− WelsFreeDynamicMemory (pCtx);
510+ WelsFreeMem (pCtx);
511+
512+ WelsFreeMemory (pCtx);
510513
511− WelsFreeStaticMemory (pCtx);
514+ UninitialDqLayersContext (pCtx);
512515
513516 #ifdef LONG_TERM_REF
514517 pCtx->bParamSetsLostFlag = false;
@@ -528,7 +531,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 13 unmodified lines
528531
529532 memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
530533 pCtx->eOutputColorFormat = pCtx->pParam->eOutputColorFormat;
531− if (!pCtx->pParam->bParseOnly) {
534+ if (!pCtx->bParseOnly) {
532535 int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);
533536 if (iRet)
534537 return iRet;
@@ -543,7 +546,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 8 unmodified lines
543546 }
544547 pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
545548
546− if (pCtx->pParam->bParseOnly) //parse only, disable EC method
549+ if (pCtx->bParseOnly) //parse only, disable EC method
547550 pCtx->eErrorConMethod = ERROR_CON_DISABLE;
548551 InitErrorCon (pCtx);
549552
@@ -571,11 +574,15 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 21 unmodified lines
571574 * \note N/A
572575 *************************************************************************************
573576 */
574−int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
577+int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
575578 if (pCtx == NULL) {
576579 return ERR_INFO_INVALID_PTR;
577580 }
578581
582+ // default
583+ WelsDecoderDefaults (pCtx, pLogCtx, pCtx->pMemAlign);
584+
585+ pCtx->bParseOnly = bParseOnly;
579586 // open decoder
580587 return WelsOpenDecoder (pCtx);
581588 }
@@ -652,7 +659,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 70 unmodified lines
652659 pRawData->pCurPos = pRawData->pHead;
653660 }
654661
655− if (pCtx->pParam->bParseOnly) {
662+ if (pCtx->bParseOnly) {
656663 pSavedData = &pCtx->sSavedData;
657664 if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) {
658665 pSavedData->pCurPos = pSavedData->pHead;
@@ -857,15 +864,7 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi · 198 unmodified lines
857864 return iErr;
858865 }
859866
860−void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
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−
868−void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
867+void AssignFuncPointerForRec (PWelsDecoderContext pCtx) {
869868 pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c;
870869 pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c;
871870 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC ] = WelsI16x16LumaPredDc_c;
@@ -917,7 +916,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 45 unmodified lines
917916 pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c;
918917
919918 #if defined(HAVE_NEON)
920− if (uiCpuFlag & WELS_CPU_NEON) {
919+ if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
921920 pCtx->pIdctResAddPredFunc = IdctResAddPred_neon;
922921
923922 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon;
@@ -942,7 +941,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 18 unmodified lines
942941 #endif//HAVE_NEON
943942
944943 #if defined(HAVE_NEON_AARCH64)
945− if (uiCpuFlag & WELS_CPU_NEON) {
944+ if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
946945 pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon;
947946
948947 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon;
@@ -972,7 +971,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 23 unmodified lines
972971 #endif//HAVE_NEON_AARCH64
973972
974973 #if defined(X86_ASM)
975− if (uiCpuFlag & WELS_CPU_MMXEXT) {
974+ if (pCtx->uiCpuFlag & WELS_CPU_MMXEXT) {
976975 pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx;
977976
978977 ///////mmx code opt---
@@ -987,7 +986,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 8 unmodified lines
987986 pCtx->pGetI4x4LumaPredFunc[I4_PRED_DDL] = WelsDecoderI4x4LumaPredDDL_mmx;
988987 pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx;
989988 }
990− if (uiCpuFlag & WELS_CPU_SSE2) {
989+ if (pCtx->uiCpuFlag & WELS_CPU_SSE2) {
991990 /////////sse2 code opt---
992991 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2;
993992 pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2;
@@ -1001,6 +1000,9 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 7 unmodified lines
10011000 pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2;
10021001 }
10031002 #endif
1003+ DeblockingInit (&pCtx->sDeblockingFunc, pCtx->uiCpuFlag);
1004+
1005+ WelsBlockFuncInit (&pCtx->sBlockFunc, pCtx->uiCpuFlag);
10041006 }
10051007
10061008 //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
7272 }
7373 }
7474
75− if (pCtx->pParam->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
75+ if (pCtx->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->pParam->bParseOnly) {
470+ if (pCtx->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− * WelsInitStaticMemory
541+ * WelsInitMemory
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 WelsInitStaticMemory (PWelsDecoderContext pCtx) {
548+int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
549549 if (pCtx == NULL) {
550550 return ERR_INFO_INVALID_PTR;
551551 }
@@ -563,16 +563,22 @@ int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx) { · 11 unmodified lines
563563 }
564564
565565 /*
566− * WelsFreeStaticMemory
567− * Free memory introduced in WelsInitStaticMemory at destruction of decoder.
566+ * WelsFreeMemory
567+ * Free memory introduced in WelsInitMemory at destruction of decoder.
568568 *
569569 */
570−void WelsFreeStaticMemory (PWelsDecoderContext pCtx) {
570+void WelsFreeMemory (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+
576582 MemFreeNalList (&pCtx->pAccessUnitList, pMa);
577583
578584 if (pCtx->sRawData.pHead) {
@@ -582,7 +588,7 @@ void WelsFreeStaticMemory (PWelsDecoderContext pCtx) { · 3 unmodified lines
582588 pCtx->sRawData.pEnd = NULL;
583589 pCtx->sRawData.pStartPos = NULL;
584590 pCtx->sRawData.pCurPos = NULL;
585− if (pCtx->pParam->bParseOnly) {
591+ if (pCtx->bParseOnly) {
586592 if (pCtx->sSavedData.pHead) {
587593 pMa->WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead");
588594 }
@@ -599,12 +605,6 @@ void WelsFreeStaticMemory (PWelsDecoderContext pCtx) { · 10 unmodified lines
599605 pCtx->pParserBsInfo = NULL;
600606 }
601607 }
602−
603− if (NULL != pCtx->pParam) {
604− pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
605−
606− pCtx->pParam = NULL;
607− }
608608 }
609609 /*
610610 * DecodeNalHeaderExt
@@ -723,9 +723,8 @@ 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",
727− GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
728− ERR_INFO_PPS_ID_OVERFLOW));
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));
729728 iPpsId = uiCode;
730729
731730 //add check PPS available here
@@ -1975,7 +1974,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1243 unmodified lines
19751974
19761975 if (ERR_NONE != iErr) {
19771976 ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);
1978− if (!pCtx->pParam->bParseOnly)
1977+ if (!pCtx->bParseOnly)
19791978 pDstInfo->iBufferStatus = 0;
19801979 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
19811980 pCtx->bNextNewSeqBegin = false; // reset it
@@ -2340,7 +2339,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 358 unmodified lines
23402339
23412340 if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
23422341 if (!pCtx->bInstantDecFlag) {
2343− if (!pCtx->pParam->bParseOnly) {
2342+ if (!pCtx->bParseOnly) {
23442343 //Do error concealment here
23452344 if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
23462345 ImplementErrorCon (pCtx);
@@ -2366,7 +2365,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 19 unmodified lines
23662365 return iRet;
23672366 }
23682367 }
2369− if (!pCtx->pParam->bParseOnly)
2368+ if (!pCtx->bParseOnly)
23702369 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
23712370 pCtx->pDec->iLinesize,
23722371 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
@@ -2422,7 +2421,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 49 unmodified lines
24222421 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
24232422 MarkECFrameAsRef (pCtx);
24242423 }
2425− } else if (pCtx->pParam->bParseOnly) { //clear parse only internal data status
2424+ } else if (pCtx->bParseOnly) { //clear parse only internal data status
24262425 pCtx->pParserBsInfo->iNalNum = 0;
24272426 pCtx->bFrameFinish = true; //clear frame pending status here!
24282427 } 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
8383 iLumaSize = iPicWidth * iPicHeight;
8484 iChromaSize = iPicChromaWidth * iPicChromaHeight;
8585
86− if (pCtx->pParam->bParseOnly) {
86+ if (pCtx->bParseOnly) {
8787 pPic->pBuffer[0] = pPic->pBuffer[1] = pPic->pBuffer[2] = NULL;
8888 pPic->pData[0] = pPic->pData[1] = pPic->pData[2] = NULL;
8989 pPic->iLinesize[0] = iPicWidth;
codec/decoder/plus/src/welsDecoderExt.cpp+4−8
@@ -243,7 +243,6 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 242 unmodified lines
243243 "CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d",
244244 VERSION_NUMBER, (int32_t)pParam->bParseOnly);
245245
246− //reset decoder context
247246 if (m_pDecContext) //free
248247 UninitDecoder();
249248 m_pDecContext = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext");
@@ -253,8 +252,8 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 3 unmodified lines
253252 m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize);
254253 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder())
255254
256− //fill in default value into context
257− WelsDecoderDefaults (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
255+ WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, pParam->bParseOnly,
256+ &m_pWelsTrace->m_sLogCtx), UninitDecoder())
258257
259258 //check param and update decoder context
260259 m_pDecContext->pParam = (SDecodingParam*) m_pDecContext->pMemAlign->WelsMallocz (sizeof (SDecodingParam),
@@ -263,9 +262,6 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 2 unmodified lines
263262 int32_t iRet = DecoderConfigParam (m_pDecContext, pParam);
264263 WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess);
265264
266− //init decoder
267− WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx), UninitDecoder())
268−
269265 return cmResultSuccess;
270266 }
271267
@@ -295,7 +291,7 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 23 unmodified lines
295291 return dsInitialOptExpected;
296292
297293 if (eOptID == DECODER_OPTION_DATAFORMAT) { // Set color space of decoding output frame
298− if (m_pDecContext->pParam->bParseOnly) {
294+ if (m_pDecContext->bParseOnly) {
299295 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
300296 "CWelsDecoder::SetOption for data format meaningless for parseonly.");
301297 return cmResultSuccess;
@@ -322,7 +318,7 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 20 unmodified lines
322318 iVal = * ((int*)pOption); // int value for error concealment idc
323319 iVal = WELS_CLIP3 (iVal, (int32_t) ERROR_CON_DISABLE, (int32_t) ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE);
324320 m_pDecContext->pParam->eEcActiveIdc = m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal;
325− if ((m_pDecContext->pParam->bParseOnly) && (m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE)) {
321+ if ((m_pDecContext->bParseOnly) && (m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE)) {
326322 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
327323 "CWelsDecoder::SetOption for ERROR_CON_IDC = %d not allowd for parse only!.", iVal);
328324 return cmInitParaError;

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