Simplify code by calling WelsFree directly instead of using a helper function

This makes the code simpler and clearer. It's not necessary to use the
_SafeFree helper macro in neither of the case - in one case the
pointer is overwritten immediately, in the other case it's witihin
the destructor where the pointer won't ever be read again.
This commit is contained in:
Martin Storsjö
2014-09-16 11:07:47 +03:00
parent 37ae6505d4
commit 958113073f
2 changed files with 2 additions and 7 deletions

View File

@@ -57,7 +57,7 @@ CBackgroundDetection::CBackgroundDetection (int32_t iCpuFlag) {
}
CBackgroundDetection::~CBackgroundDetection() {
FreeOUArrayMemory();
WelsFree (m_BgdParam.pOU_array);
}
EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {
@@ -80,7 +80,7 @@ EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixM
int32_t iCurFrameSize = m_BgdParam.iBgdWidth * m_BgdParam.iBgdHeight;
if (m_BgdParam.pOU_array == NULL || iCurFrameSize > m_iLargestFrameSize) {
FreeOUArrayMemory();
WelsFree (m_BgdParam.pOU_array);
m_BgdParam.pOU_array = AllocateOUArrayMemory (m_BgdParam.iBgdWidth, m_BgdParam.iBgdHeight);
m_iLargestFrameSize = iCurFrameSize;
}
@@ -112,10 +112,6 @@ inline SBackgroundOU* CBackgroundDetection::AllocateOUArrayMemory (int32_t iWidt
return (SBackgroundOU*)WelsMalloc (iMaxOUWidth * iMaxOUHeight * sizeof (SBackgroundOU));
}
inline void CBackgroundDetection::FreeOUArrayMemory() {
_SafeFree (m_BgdParam.pOU_array);
}
void CBackgroundDetection::GetOUParameters (SVAACalcResult* sVaaCalcInfo, int32_t iMbIndex, int32_t iMbWidth,
SBackgroundOU* pBgdOU) {
int32_t iSubSD[4];