/* * free memory dynamically allocated during decoder */ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { int32_t iListIdx = 0; CMemoryAlign* pMa = pCtx->pMemAlign; //free dq layer memory UninitialDqLayersContext (pCtx); //free FMO memory ResetFmoList (pCtx); //free ref-pic list & picture memory WelsResetRefPic (pCtx); for (iListIdx = LIST_0; iListIdx < LIST_A; ++ iListIdx) { PPicBuff* pPicBuff = &pCtx->pPicBuff[iListIdx]; if (NULL != pPicBuff && NULL != *pPicBuff) { DestroyPicBuff (pPicBuff, pMa); } } // added for safe memory pCtx->iImgWidthInPixel = 0; pCtx->iImgHeightInPixel = 0; pCtx->iLastImgWidthInPixel = 0; pCtx->iLastImgHeightInPixel = 0; pCtx->bFreezeOutput = true; pCtx->bHaveGotMemory = false; //free CABAC memory pMa->WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine"); }
/*! * \brief Close decoder */ void_t WelsCloseDecoder (PWelsDecoderContext pCtx) { WelsFreeMem (pCtx); WelsFreeMemory (pCtx); UninitialDqLayersContext (pCtx); #ifdef LONG_TERM_REF pCtx->bParamSetsLostFlag = false; #else pCtx->bReferenceLostAtT0Flag = false; #endif }
/*! * \brief Close decoder */ void WelsCloseDecoder (PWelsDecoderContext pCtx) { WelsFreeMem (pCtx); WelsFreeMemory (pCtx); UninitialDqLayersContext (pCtx); #ifdef LONG_TERM_REF pCtx->bParamSetsLostFlag = false; #else pCtx->bReferenceLostAtT0Flag = false; #endif pCtx->bNewSeqBegin = false; pCtx->bPrintFrameErrorTraceFlag = false; }