History

add dec memory check

huili2 committed 11 years ago

Commit 3cb417f1 parent 9ecc67112 files · +196 −141Browse files

Showing the changes to codec/decoder/core/src/fmo.cpp (1 of 12 files). Show all

Unified · Split

codec/decoder/core/src/fmo.cpp+9−10
@@ -116,7 +116,7 @@ static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const in · 115 unmodified lines
116116 * \return 0 - successful; none 0 - failed
117117 */
118118 static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth,
119− const int32_t kiMbHeight) {
119+ const int32_t kiMbHeight, CMemoryAlign* pMa) {
120120 int32_t iNumMb = 0;
121121 int32_t iErr = 0;
122122 bool bResolutionChanged = false;
@@ -131,9 +131,8 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 8 unmodified lines
131131 if (0 == iNumMb)
132132 return 1;
133133
134−
135− WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap");
136− pFmo->pMbAllocMap = (uint8_t*)WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap");
134+ pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap");
135+ pFmo->pMbAllocMap = (uint8_t*)pMa->WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap");
137136 WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory
138137
139138 pFmo->iCountMbNum = iNumMb;
@@ -186,8 +185,8 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 46 unmodified lines
186185 *
187186 * \return 0 - successful; none 0 - failed;
188187 */
189−int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight) {
190− return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight);
188+int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight, CMemoryAlign* pMa) {
189+ return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight, pMa);
191190 }
192191
193192
@@ -200,7 +199,7 @@ int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t ki · 6 unmodified lines
200199 *
201200 * \return NONE
202201 */
203−void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) {
202+void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail, CMemoryAlign* pMa) {
204203 PFmo pIter = pFmo;
205204 int32_t i = 0;
206205 int32_t iFreeNodes = 0;
@@ -211,7 +210,7 @@ void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) { · 4 unmodified lines
211210 while (i < kiCnt) {
212211 if (pIter != NULL && pIter->bActiveFlag) {
213212 if (NULL != pIter->pMbAllocMap) {
214− WelsFree (pIter->pMbAllocMap, "pIter->pMbAllocMap");
213+ pMa->WelsFree (pIter->pMbAllocMap, "pIter->pMbAllocMap");
215214
216215 pIter->pMbAllocMap = NULL;
217216 }
@@ -258,7 +257,7 @@ bool FmoParamSetsChanged (PFmo pFmo, const int32_t kiCountNumMb, const int32_t k · 40 unmodified lines
258257 *
259258 * \return true - update/insert successfully; false - failed;
260259 */
261−bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) {
260+bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum, CMemoryAlign* pMa) {
262261 const uint32_t kuiMbWidth = pSps->iMbWidth;
263262 const uint32_t kuiMbHeight = pSps->iMbHeight;
264263
@@ -267,7 +266,7 @@ bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) { · 2 unmodified lines
267266 pPps->uiSliceGroupMapType,
268267 pPps->uiNumSliceGroups)) {
269268
270− if (InitFmo (pFmo, pPps, kuiMbWidth, kuiMbHeight)) {
269+ if (InitFmo (pFmo, pPps, kuiMbWidth, kuiMbHeight, pMa)) {
271270 return false;
272271 } else {
273272 if (!pFmo->bActiveFlag && *pActiveFmoNum < MAX_PPS_COUNT) {

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