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
57}57}
58 58
59CBackgroundDetection::~CBackgroundDetection() {59CBackgroundDetection::~CBackgroundDetection() {
60 FreeOUArrayMemory();60 WelsFree (m_BgdParam.pOU_array);
61}61}
62 62
63EResult CBackgroundDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) {63EResult 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
80 80
81 int32_t iCurFrameSize = m_BgdParam.iBgdWidth * m_BgdParam.iBgdHeight;81 int32_t iCurFrameSize = m_BgdParam.iBgdWidth * m_BgdParam.iBgdHeight;
82 if (m_BgdParam.pOU_array == NULL || iCurFrameSize > m_iLargestFrameSize) {82 if (m_BgdParam.pOU_array == NULL || iCurFrameSize > m_iLargestFrameSize) {
83 FreeOUArrayMemory();83 WelsFree (m_BgdParam.pOU_array);
84 m_BgdParam.pOU_array = AllocateOUArrayMemory (m_BgdParam.iBgdWidth, m_BgdParam.iBgdHeight);84 m_BgdParam.pOU_array = AllocateOUArrayMemory (m_BgdParam.iBgdWidth, m_BgdParam.iBgdHeight);
85 m_iLargestFrameSize = iCurFrameSize;85 m_iLargestFrameSize = iCurFrameSize;
86 }86 }
@@ -112,10 +112,6 @@ inline SBackgroundOU* CBackgroundDetection::AllocateOUArrayMemory (int32_t iWidt · 25 unmodified lines
112 return (SBackgroundOU*)WelsMalloc (iMaxOUWidth * iMaxOUHeight * sizeof (SBackgroundOU));112 return (SBackgroundOU*)WelsMalloc (iMaxOUWidth * iMaxOUHeight * sizeof (SBackgroundOU));
113}113}
114 114
115inline void CBackgroundDetection::FreeOUArrayMemory() {
116 _SafeFree (m_BgdParam.pOU_array);
117}
118
119void CBackgroundDetection::GetOUParameters (SVAACalcResult* sVaaCalcInfo, int32_t iMbIndex, int32_t iMbWidth,115void CBackgroundDetection::GetOUParameters (SVAACalcResult* sVaaCalcInfo, int32_t iMbIndex, int32_t iMbWidth,
120 SBackgroundOU* pBgdOU) {116 SBackgroundOU* pBgdOU) {
121 int32_t iSubSD[4];117 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