Merge pull request #1359 from mstorsjo/cleanup-simplification
Simplify code by getting rid of unnecesary SafeDelete/SafeFree macros
This commit is contained in:
commit
8538b22f23
@ -57,7 +57,7 @@ CBackgroundDetection::CBackgroundDetection (int32_t iCpuFlag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBackgroundDetection::~CBackgroundDetection() {
|
CBackgroundDetection::~CBackgroundDetection() {
|
||||||
FreeOUArrayMemory();
|
WelsFree (m_BgdParam.pOU_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {
|
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;
|
int32_t iCurFrameSize = m_BgdParam.iBgdWidth * m_BgdParam.iBgdHeight;
|
||||||
if (m_BgdParam.pOU_array == NULL || iCurFrameSize > m_iLargestFrameSize) {
|
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_BgdParam.pOU_array = AllocateOUArrayMemory (m_BgdParam.iBgdWidth, m_BgdParam.iBgdHeight);
|
||||||
m_iLargestFrameSize = iCurFrameSize;
|
m_iLargestFrameSize = iCurFrameSize;
|
||||||
}
|
}
|
||||||
@ -112,10 +112,6 @@ inline SBackgroundOU* CBackgroundDetection::AllocateOUArrayMemory (int32_t iWidt
|
|||||||
return (SBackgroundOU*)WelsMalloc (iMaxOUWidth * iMaxOUHeight * sizeof (SBackgroundOU));
|
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,
|
void CBackgroundDetection::GetOUParameters (SVAACalcResult* sVaaCalcInfo, int32_t iMbIndex, int32_t iMbWidth,
|
||||||
SBackgroundOU* pBgdOU) {
|
SBackgroundOU* pBgdOU) {
|
||||||
int32_t iSubSD[4];
|
int32_t iSubSD[4];
|
||||||
|
@ -81,7 +81,6 @@ class CBackgroundDetection : public IStrategy {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
inline SBackgroundOU* AllocateOUArrayMemory (int32_t iWidth, int32_t iHeight);
|
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 int32_t CalculateAsdChromaEdge (uint8_t* pOriRef, uint8_t* pOriCur, int32_t iStride);
|
||||||
inline bool ForegroundDilation23Luma (SBackgroundOU* pBackgroundOU,
|
inline bool ForegroundDilation23Luma (SBackgroundOU* pBackgroundOU,
|
||||||
SBackgroundOU* pOUNeighbours[]); //Foreground_Dilation_2_3_Luma
|
SBackgroundOU* pOUNeighbours[]); //Foreground_Dilation_2_3_Luma
|
||||||
|
@ -79,7 +79,7 @@ EResult CreateSpecificVpInterface (IWelsVP** ppCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EResult DestroySpecificVpInterface (IWelsVP* pCtx) {
|
EResult DestroySpecificVpInterface (IWelsVP* pCtx) {
|
||||||
_SafeDelete (pCtx);
|
delete pCtx;
|
||||||
|
|
||||||
return RET_SUCCESS;
|
return RET_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ CVpFrameWork::~CVpFrameWork() {
|
|||||||
for (int32_t i = 0; i < MAX_STRATEGY_NUM; i++) {
|
for (int32_t i = 0; i < MAX_STRATEGY_NUM; i++) {
|
||||||
if (m_pStgChain[i]) {
|
if (m_pStgChain[i]) {
|
||||||
Uninit (m_pStgChain[i]->m_eMethod);
|
Uninit (m_pStgChain[i]->m_eMethod);
|
||||||
_SafeDelete (m_pStgChain[i]);
|
delete m_pStgChain[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ EResult CreateSpecificVpInterface (IWelsVPc** pCtx) {
|
|||||||
EResult DestroySpecificVpInterface (IWelsVPc* pCtx) {
|
EResult DestroySpecificVpInterface (IWelsVPc* pCtx) {
|
||||||
if (pCtx) {
|
if (pCtx) {
|
||||||
DestroySpecificVpInterface (WelsStaticCast (IWelsVP*, pCtx->pCtx));
|
DestroySpecificVpInterface (WelsStaticCast (IWelsVP*, pCtx->pCtx));
|
||||||
_SafeDelete (pCtx);
|
delete pCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RET_SUCCESS;
|
return RET_SUCCESS;
|
||||||
|
@ -102,9 +102,6 @@ inline EMethods WelsVpGetValidMethod (int32_t a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define _SafeFree(p) if (p) { WelsFree(p); (p) = NULL; }
|
|
||||||
#define _SafeDelete(p) if (p) { delete (p); (p) = NULL; }
|
|
||||||
|
|
||||||
|
|
||||||
WELSVP_NAMESPACE_END
|
WELSVP_NAMESPACE_END
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user