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
116 * \return 0 - successful; none 0 - failed116 * \return 0 - successful; none 0 - failed
117 */117 */
118static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth,118static 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) {
120 int32_t iNumMb = 0;120 int32_t iNumMb = 0;
121 int32_t iErr = 0;121 int32_t iErr = 0;
122 bool bResolutionChanged = false;122 bool bResolutionChanged = false;
@@ -131,9 +131,8 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 8 unmodified lines
131 if (0 == iNumMb)131 if (0 == iNumMb)
132 return 1;132 return 1;
133 133
134 134 pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap");
135 WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap");135 pFmo->pMbAllocMap = (uint8_t*)pMa->WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap");
136 pFmo->pMbAllocMap = (uint8_t*)WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap");
137 WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory136 WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory
138 137
139 pFmo->iCountMbNum = iNumMb;138 pFmo->iCountMbNum = iNumMb;
@@ -186,8 +185,8 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 46 unmodified lines
186 *185 *
187 * \return 0 - successful; none 0 - failed;186 * \return 0 - successful; none 0 - failed;
188 */187 */
189int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight) {188int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight, CMemoryAlign* pMa) {
190 return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight);189 return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight, pMa);
191}190}
192 191
193 192
@@ -200,7 +199,7 @@ int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t ki · 6 unmodified lines
200 *199 *
201 * \return NONE200 * \return NONE
202 */201 */
203void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) {202void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail, CMemoryAlign* pMa) {
204 PFmo pIter = pFmo;203 PFmo pIter = pFmo;
205 int32_t i = 0;204 int32_t i = 0;
206 int32_t iFreeNodes = 0;205 int32_t iFreeNodes = 0;
@@ -211,7 +210,7 @@ void UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) { · 4 unmodified lines
211 while (i < kiCnt) {210 while (i < kiCnt) {
212 if (pIter != NULL && pIter->bActiveFlag) {211 if (pIter != NULL && pIter->bActiveFlag) {
213 if (NULL != pIter->pMbAllocMap) {212 if (NULL != pIter->pMbAllocMap) {
214 WelsFree (pIter->pMbAllocMap, "pIter->pMbAllocMap");213 pMa->WelsFree (pIter->pMbAllocMap, "pIter->pMbAllocMap");
215 214
216 pIter->pMbAllocMap = NULL;215 pIter->pMbAllocMap = NULL;
217 }216 }
@@ -258,7 +257,7 @@ bool FmoParamSetsChanged (PFmo pFmo, const int32_t kiCountNumMb, const int32_t k · 40 unmodified lines
258 *257 *
259 * \return true - update/insert successfully; false - failed;258 * \return true - update/insert successfully; false - failed;
260 */259 */
261bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) {260bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum, CMemoryAlign* pMa) {
262 const uint32_t kuiMbWidth = pSps->iMbWidth;261 const uint32_t kuiMbWidth = pSps->iMbWidth;
263 const uint32_t kuiMbHeight = pSps->iMbHeight;262 const uint32_t kuiMbHeight = pSps->iMbHeight;
264 263
@@ -267,7 +266,7 @@ bool FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) { · 2 unmodified lines
267 pPps->uiSliceGroupMapType,266 pPps->uiSliceGroupMapType,
268 pPps->uiNumSliceGroups)) {267 pPps->uiNumSliceGroups)) {
269 268
270 if (InitFmo (pFmo, pPps, kuiMbWidth, kuiMbHeight)) {269 if (InitFmo (pFmo, pPps, kuiMbWidth, kuiMbHeight, pMa)) {
271 return false;270 return false;
272 } else {271 } else {
273 if (!pFmo->bActiveFlag && *pActiveFmoNum < MAX_PPS_COUNT) {272 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