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

Unified · Split

codec/decoder/core/src/decoder.cpp+33−35
@@ -272,14 +272,13 @@ void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) { · 271 unmodified lines
272272 pPicBuf = NULL;
273273 *ppPicBuf = NULL;
274274 }
275+
275276 /*
276277 * fill data fields in default for decoder context
277278 */
278−void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx, CMemoryAlign* pMa) {
279+void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
279280 int32_t iCpuCores = 1;
280− memset (pCtx, 0, sizeof (SWelsDecoderContext)); // fill zero first
281281 pCtx->sLogCtx = *pLogCtx;
282− pCtx->pMemAlign = pMa;
283282
284283 pCtx->pArgDec = NULL;
285284
@@ -441,18 +440,20 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const · 155 unmodified lines
441440 }
442441
443442 /*
444− * free memory blocks in avc
443+ * free memory dynamically allocated during decoder
445444 */
446−void WelsFreeMem (PWelsDecoderContext pCtx) {
445+void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) {
447446 int32_t iListIdx = 0;
448447 CMemoryAlign* pMa = pCtx->pMemAlign;
449448
450− /* TODO: free memory blocks introduced in avc */
449+ //free dq layer memory
450+ UninitialDqLayersContext (pCtx);
451+
452+ //free FMO memory
451453 ResetFmoList (pCtx);
452454
455+ //free ref-pic list & picture memory
453456 WelsResetRefPic (pCtx);
454−
455− // for sPicBuff
456457 for (iListIdx = LIST_0; iListIdx < LIST_A; ++ iListIdx) {
457458 PPicBuff* pPicBuff = &pCtx->pPicBuff[iListIdx];
458459 if (NULL != pPicBuff && NULL != *pPicBuff) {
@@ -467,6 +468,8 @@ void WelsFreeMem (PWelsDecoderContext pCtx) { · 8 unmodified lines
467468 pCtx->iLastImgHeightInPixel = 0;
468469 pCtx->bFreezeOutput = true;
469470 pCtx->bHaveGotMemory = false;
471+
472+ //free CABAC memory
470473 pMa->WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine");
471474 }
472475
@@ -474,19 +477,15 @@ void WelsFreeMem (PWelsDecoderContext pCtx) { · 1 unmodified line
474477 * \brief Open decoder
475478 */
476479 int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
477− // function pointers
478− //initial MC function pointer--
479480 int iRet = ERR_NONE;
480− InitMcFunc (& (pCtx->sMcFunc), pCtx->uiCpuFlag);
481−
482− InitExpandPictureFunc (& (pCtx->sExpandPicFunc), pCtx->uiCpuFlag);
483− AssignFuncPointerForRec (pCtx);
481+ // function pointers
482+ InitDecFuncs (pCtx, pCtx->uiCpuFlag);
484483
485484 // vlc tables
486485 InitVlcTable (&pCtx->sVlcTable);
487486
488− // startup memory
489− iRet = WelsInitMemory (pCtx);
487+ // static memory
488+ iRet = WelsInitStaticMemory (pCtx);
490489 if (ERR_NONE != iRet)
491490 return iRet;
492491
@@ -506,11 +505,9 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { · 13 unmodified lines
506505 * \brief Close decoder
507506 */
508507 void WelsCloseDecoder (PWelsDecoderContext pCtx) {
509− WelsFreeMem (pCtx);
510−
511− WelsFreeMemory (pCtx);
508+ WelsFreeDynamicMemory (pCtx);
512509
513− UninitialDqLayersContext (pCtx);
510+ WelsFreeStaticMemory (pCtx);
514511
515512 #ifdef LONG_TERM_REF
516513 pCtx->bParamSetsLostFlag = false;
@@ -539,7 +536,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 22 unmodified lines
539536 }
540537 pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
541538
542− if (pCtx->bParseOnly) //parse only, disable EC method
539+ if (pCtx->pParam->bParseOnly) //parse only, disable EC method
543540 pCtx->eErrorConMethod = ERROR_CON_DISABLE;
544541 InitErrorCon (pCtx);
545542
@@ -567,15 +564,11 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 21 unmodified lines
567564 * \note N/A
568565 *************************************************************************************
569566 */
570−int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
567+int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
571568 if (pCtx == NULL) {
572569 return ERR_INFO_INVALID_PTR;
573570 }
574571
575− // default
576− WelsDecoderDefaults (pCtx, pLogCtx, pCtx->pMemAlign);
577−
578− pCtx->bParseOnly = bParseOnly;
579572 // open decoder
580573 return WelsOpenDecoder (pCtx);
581574 }
@@ -652,7 +645,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 70 unmodified lines
652645 pRawData->pCurPos = pRawData->pHead;
653646 }
654647
655− if (pCtx->bParseOnly) {
648+ if (pCtx->pParam->bParseOnly) {
656649 pSavedData = &pCtx->sSavedData;
657650 if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) {
658651 pSavedData->pCurPos = pSavedData->pHead;
@@ -847,7 +840,15 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi · 188 unmodified lines
847840 return iErr;
848841 }
849842
850−void AssignFuncPointerForRec (PWelsDecoderContext pCtx) {
843+void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
844+ WelsBlockFuncInit (&pCtx->sBlockFunc, uiCpuFlag);
845+ InitPredFunc (pCtx, uiCpuFlag);
846+ InitMcFunc (& (pCtx->sMcFunc), uiCpuFlag);
847+ InitExpandPictureFunc (& (pCtx->sExpandPicFunc), uiCpuFlag);
848+ DeblockingInit (&pCtx->sDeblockingFunc, uiCpuFlag);
849+}
850+
851+void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
851852 pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c;
852853 pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c;
853854 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC ] = WelsI16x16LumaPredDc_c;
@@ -899,7 +900,7 @@ void AssignFuncPointerForRec (PWelsDecoderContext pCtx) { · 45 unmodified lines
899900 pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c;
900901
901902 #if defined(HAVE_NEON)
902− if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
903+ if (uiCpuFlag & WELS_CPU_NEON) {
903904 pCtx->pIdctResAddPredFunc = IdctResAddPred_neon;
904905
905906 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon;
@@ -924,7 +925,7 @@ void AssignFuncPointerForRec (PWelsDecoderContext pCtx) { · 18 unmodified lines
924925 #endif//HAVE_NEON
925926
926927 #if defined(HAVE_NEON_AARCH64)
927− if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
928+ if (uiCpuFlag & WELS_CPU_NEON) {
928929 pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon;
929930
930931 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon;
@@ -954,7 +955,7 @@ void AssignFuncPointerForRec (PWelsDecoderContext pCtx) { · 23 unmodified lines
954955 #endif//HAVE_NEON_AARCH64
955956
956957 #if defined(X86_ASM)
957− if (pCtx->uiCpuFlag & WELS_CPU_MMXEXT) {
958+ if (uiCpuFlag & WELS_CPU_MMXEXT) {
958959 pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx;
959960
960961 ///////mmx code opt---
@@ -969,7 +970,7 @@ void AssignFuncPointerForRec (PWelsDecoderContext pCtx) { · 8 unmodified lines
969970 pCtx->pGetI4x4LumaPredFunc[I4_PRED_DDL] = WelsDecoderI4x4LumaPredDDL_mmx;
970971 pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx;
971972 }
972− if (pCtx->uiCpuFlag & WELS_CPU_SSE2) {
973+ if (uiCpuFlag & WELS_CPU_SSE2) {
973974 /////////sse2 code opt---
974975 pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2;
975976 pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2;
@@ -983,9 +984,6 @@ void AssignFuncPointerForRec (PWelsDecoderContext pCtx) { · 7 unmodified lines
983984 pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2;
984985 }
985986 #endif
986− DeblockingInit (&pCtx->sDeblockingFunc, pCtx->uiCpuFlag);
987−
988− WelsBlockFuncInit (&pCtx->sBlockFunc, pCtx->uiCpuFlag);
989987 }
990988
991989 //reset decoder number related statistics info

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