Showing the changes to codec/decoder/core/src/fmo.cpp (1 of 11 files). Show all
Unified · Split
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | #include "fmo.h" |
| 42 | 42 | #include "memory_align.h" |
| 43 | +#include "error_code.h" | |
| 43 | 44 | |
| 44 | 45 | namespace WelsDec { |
| 45 | 46 | |
| @@ -56,10 +57,11 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) { · 10 unmodified lines | ||
| 56 | 57 | int32_t iMbNum = 0; |
| 57 | 58 | int32_t i = 0; |
| 58 | 59 | |
| 59 | − WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps)) | |
| 60 | + WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == pPps)) | |
| 60 | 61 | uiNumSliceGroups = pPps->uiNumSliceGroups; |
| 61 | 62 | iMbNum = pFmo->iCountMbNum; |
| 62 | − WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || uiNumSliceGroups > MAX_SLICEGROUP_IDS)) | |
| 63 | + WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 | |
| 64 | + || uiNumSliceGroups > MAX_SLICEGROUP_IDS)) | |
| 63 | 65 | |
| 64 | 66 | do { |
| 65 | 67 | uint8_t uiGroup = 0; |
| @@ -75,7 +77,7 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) { · 9 unmodified lines | ||
| 75 | 77 | } while (uiGroup < uiNumSliceGroups && i < iMbNum); |
| 76 | 78 | } while (i < iMbNum); |
| 77 | 79 | |
| 78 | − return 0; // well here | |
| 80 | + return ERR_NONE; // well here | |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | 83 | /*! |
| @@ -91,18 +93,18 @@ static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const in · 9 unmodified lines | ||
| 91 | 93 | uint32_t uiNumSliceGroups = 0; |
| 92 | 94 | int32_t iMbNum = 0; |
| 93 | 95 | int32_t i = 0; |
| 94 | − WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps)) | |
| 96 | + WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == pPps)) | |
| 95 | 97 | uiNumSliceGroups = pPps->uiNumSliceGroups; |
| 96 | 98 | iMbNum = pFmo->iCountMbNum; |
| 97 | − WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0 | |
| 98 | − || uiNumSliceGroups > MAX_SLICEGROUP_IDS)) | |
| 99 | + WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0 | |
| 100 | + || uiNumSliceGroups > MAX_SLICEGROUP_IDS)) | |
| 99 | 101 | |
| 100 | 102 | do { |
| 101 | 103 | pFmo->pMbAllocMap[i] = (uint8_t) (((i % kiMbWidth) + (((i / kiMbWidth) * uiNumSliceGroups) >> 1)) % uiNumSliceGroups); |
| 102 | 104 | ++ i; |
| 103 | 105 | } while (i < iMbNum); |
| 104 | 106 | |
| 105 | − return 0; // well here | |
| 107 | + return ERR_NONE; // well here | |
| 106 | 108 | } |
| 107 | 109 | |
| 108 | 110 | /*! |
| @@ -122,18 +124,18 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 13 unmodified lines | ||
| 122 | 124 | bool bResolutionChanged = false; |
| 123 | 125 | |
| 124 | 126 | // the cases we would not like |
| 125 | − WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == kpPps)) | |
| 127 | + WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == kpPps)) | |
| 126 | 128 | |
| 127 | 129 | iNumMb = pFmo->iCountMbNum; |
| 128 | 130 | |
| 129 | 131 | iNumMb = kiMbWidth * kiMbHeight; |
| 130 | 132 | |
| 131 | 133 | if (0 == iNumMb) |
| 132 | − return 1; | |
| 134 | + return ERR_INFO_INVALID_PARAM; | |
| 133 | 135 | |
| 134 | 136 | pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap"); |
| 135 | 137 | pFmo->pMbAllocMap = (uint8_t*)pMa->WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap"); |
| 136 | − WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory | |
| 138 | + WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pFmo->pMbAllocMap)) // out of memory | |
| 137 | 139 | |
| 138 | 140 | pFmo->iCountMbNum = iNumMb; |
| 139 | 141 | |
| @@ -142,7 +144,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 2 unmodified lines | ||
| 142 | 144 | |
| 143 | 145 | pFmo->iSliceGroupCount = 1; |
| 144 | 146 | |
| 145 | − return 0; | |
| 147 | + return ERR_NONE; | |
| 146 | 148 | } |
| 147 | 149 | |
| 148 | 150 | if (bResolutionChanged || ((int32_t)kpPps->uiSliceGroupMapType != pFmo->iSliceGroupType) |
| @@ -163,7 +165,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const · 14 unmodified lines | ||
| 163 | 165 | iErr = 1; |
| 164 | 166 | break; |
| 165 | 167 | default: |
| 166 | − return 1; | |
| 168 | + return ERR_INFO_UNSUPPORTED_FMOTYPE; | |
| 167 | 169 | } |
| 168 | 170 | } |
| 169 | 171 | |