History

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.

Martin Storsjö committed 12 years ago

Commit 95811301 parent 37ae6502 files · +2 −7Browse files

Showing the changes to codec/processing/src/backgrounddetection/BackgroundDetection.cpp (1 of 2 files). Show all

Unified · Split

codec/processing/src/backgrounddetection/BackgroundDetection.cpp+2−6
@@ -57,7 +57,7 @@ CBackgroundDetection::CBackgroundDetection (int32_t iCpuFlag) { · 56 unmodified lines
5757 }
5858
5959 CBackgroundDetection::~CBackgroundDetection() {
60− FreeOUArrayMemory();
60+ WelsFree (m_BgdParam.pOU_array);
6161 }
6262
6363 EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {
@@ -80,7 +80,7 @@ EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixM · 16 unmodified lines
8080
8181 int32_t iCurFrameSize = m_BgdParam.iBgdWidth * m_BgdParam.iBgdHeight;
8282 if (m_BgdParam.pOU_array == NULL || iCurFrameSize > m_iLargestFrameSize) {
83− FreeOUArrayMemory();
83+ WelsFree (m_BgdParam.pOU_array);
8484 m_BgdParam.pOU_array = AllocateOUArrayMemory (m_BgdParam.iBgdWidth, m_BgdParam.iBgdHeight);
8585 m_iLargestFrameSize = iCurFrameSize;
8686 }
@@ -112,10 +112,6 @@ inline SBackgroundOU* CBackgroundDetection::AllocateOUArrayMemory (int32_t iWidt · 25 unmodified lines
112112 return (SBackgroundOU*)WelsMalloc (iMaxOUWidth * iMaxOUHeight * sizeof (SBackgroundOU));
113113 }
114114
115−inline void CBackgroundDetection::FreeOUArrayMemory() {
116− _SafeFree (m_BgdParam.pOU_array);
117−}
118−
119115 void CBackgroundDetection::GetOUParameters (SVAACalcResult* sVaaCalcInfo, int32_t iMbIndex, int32_t iMbWidth,
120116 SBackgroundOU* pBgdOU) {
121117 int32_t iSubSD[4];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t