ref: 8538b22f23b9c3e47548d841b8d6e94ccf7fb2cc
parent: 399ca332841b98c14cfba4bb65550e8b0c9206cc
parent: 9d9c609aab3f193fb354c9e824cc8b2a7cabb5d4
author: dongzha <[email protected]>
date: Wed Sep 17 04:49:24 EDT 2014
Merge pull request #1359 from mstorsjo/cleanup-simplification Simplify code by getting rid of unnecesary SafeDelete/SafeFree macros
--- a/codec/processing/src/backgrounddetection/BackgroundDetection.cpp
+++ b/codec/processing/src/backgrounddetection/BackgroundDetection.cpp
@@ -57,7 +57,7 @@
}
CBackgroundDetection::~CBackgroundDetection() {
- FreeOUArrayMemory();
+ WelsFree (m_BgdParam.pOU_array);
}
EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {
@@ -80,7 +80,7 @@
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;
}
@@ -110,10 +110,6 @@
int32_t iMaxOUWidth = (BGD_OU_SIZE - 1 + iWidth) >> LOG2_BGD_OU_SIZE;
int32_t iMaxOUHeight = (BGD_OU_SIZE - 1 + iHeight) >> LOG2_BGD_OU_SIZE;
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,
--- a/codec/processing/src/backgrounddetection/BackgroundDetection.h
+++ b/codec/processing/src/backgrounddetection/BackgroundDetection.h
@@ -81,7 +81,6 @@
private:
inline SBackgroundOU* AllocateOUArrayMemory (int32_t iWidth, int32_t iHeight);
- inline void FreeOUArrayMemory();
inline int32_t CalculateAsdChromaEdge (uint8_t* pOriRef, uint8_t* pOriCur, int32_t iStride);
inline bool ForegroundDilation23Luma (SBackgroundOU* pBackgroundOU,
SBackgroundOU* pOUNeighbours[]); //Foreground_Dilation_2_3_Luma
--- a/codec/processing/src/common/WelsFrameWork.cpp
+++ b/codec/processing/src/common/WelsFrameWork.cpp
@@ -79,7 +79,7 @@
}
EResult DestroySpecificVpInterface (IWelsVP* pCtx) {
- _SafeDelete (pCtx);
+ delete pCtx;
return RET_SUCCESS;
}
@@ -105,7 +105,7 @@
for (int32_t i = 0; i < MAX_STRATEGY_NUM; i++) {
if (m_pStgChain[i]) {
Uninit (m_pStgChain[i]->m_eMethod);
- _SafeDelete (m_pStgChain[i]);
+ delete m_pStgChain[i];
}
}
--- a/codec/processing/src/common/WelsFrameWorkEx.cpp
+++ b/codec/processing/src/common/WelsFrameWorkEx.cpp
@@ -87,7 +87,7 @@
EResult DestroySpecificVpInterface (IWelsVPc* pCtx) {
if (pCtx) {
DestroySpecificVpInterface (WelsStaticCast (IWelsVP*, pCtx->pCtx));
- _SafeDelete (pCtx);
+ delete pCtx;
}
return RET_SUCCESS;
--- a/codec/processing/src/common/util.h
+++ b/codec/processing/src/common/util.h
@@ -102,9 +102,6 @@
}
-#define _SafeFree(p) if (p) { WelsFree(p); (p) = NULL; }
-#define _SafeDelete(p) if (p) { delete (p); (p) = NULL; }
-
WELSVP_NAMESPACE_END