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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user