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 | #include "fmo.h" | 41 | #include "fmo.h" |
| 42 | #include "memory_align.h" | 42 | #include "memory_align.h" |
| 43 | #include "error_code.h" | ||
| 43 | 44 | ||
| 44 | namespace WelsDec { | 45 | namespace WelsDec { |
| 45 | 46 | ||
| @@ -56,10 +57,11 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) { · 10 unmodified lines | |||
| 56 | int32_t iMbNum = 0; | 57 | int32_t iMbNum = 0; |
| 57 | int32_t i = 0; | 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 | uiNumSliceGroups = pPps->uiNumSliceGroups; | 61 | uiNumSliceGroups = pPps->uiNumSliceGroups; |
| 61 | iMbNum = pFmo->iCountMbNum; | 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 | do { | 66 | do { |
| 65 | uint8_t uiGroup = 0; | 67 | uint8_t uiGroup = 0; |
| @@ -75,7 +77,7 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) { · 9 unmodified lines | |||
| 75 | } while (uiGroup < uiNumSliceGroups && i < iMbNum); | 77 | } while (uiGroup < uiNumSliceGroups && i < iMbNum); |
| 76 | } while (i < iMbNum); | 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 | uint32_t uiNumSliceGroups = 0; | 93 | uint32_t uiNumSliceGroups = 0; |
| 92 | int32_t iMbNum = 0; | 94 | int32_t iMbNum = 0; |
| 93 | int32_t i = 0; | 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 | uiNumSliceGroups = pPps->uiNumSliceGroups; | 97 | uiNumSliceGroups = pPps->uiNumSliceGroups; |
| 96 | iMbNum = pFmo->iCountMbNum; | 98 | iMbNum = pFmo->iCountMbNum; |
| 97 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0 | 99 | WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0 |
| 98 | || uiNumSliceGroups > MAX_SLICEGROUP_IDS)) | 100 | || uiNumSliceGroups > MAX_SLICEGROUP_IDS)) |
| 99 | 101 | ||
| 100 | do { | 102 | do { |
| 101 | pFmo->pMbAllocMap[i] = (uint8_t) (((i % kiMbWidth) + (((i / kiMbWidth) * uiNumSliceGroups) >> 1)) % uiNumSliceGroups); | 103 | pFmo->pMbAllocMap[i] = (uint8_t) (((i % kiMbWidth) + (((i / kiMbWidth) * uiNumSliceGroups) >> 1)) % uiNumSliceGroups); |
| 102 | ++ i; | 104 | ++ i; |
| 103 | } while (i < iMbNum); | 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 | bool bResolutionChanged = false; | 124 | bool bResolutionChanged = false; |
| 123 | 125 | ||
| 124 | // the cases we would not like | 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 | iNumMb = pFmo->iCountMbNum; | 129 | iNumMb = pFmo->iCountMbNum; |
| 128 | 130 | ||
| 129 | iNumMb = kiMbWidth * kiMbHeight; | 131 | iNumMb = kiMbWidth * kiMbHeight; |
| 130 | 132 | ||
| 131 | if (0 == iNumMb) | 133 | if (0 == iNumMb) |
| 132 | return 1; | 134 | return ERR_INFO_INVALID_PARAM; |
| 133 | 135 | ||
| 134 | pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap"); | 136 | pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap"); |
| 135 | pFmo->pMbAllocMap = (uint8_t*)pMa->WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap"); | 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 | pFmo->iCountMbNum = iNumMb; | 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 | pFmo->iSliceGroupCount = 1; | 145 | pFmo->iSliceGroupCount = 1; |
| 144 | 146 | ||
| 145 | return 0; | 147 | return ERR_NONE; |
| 146 | } | 148 | } |
| 147 | 149 | ||
| 148 | if (bResolutionChanged || ((int32_t)kpPps->uiSliceGroupMapType != pFmo->iSliceGroupType) | 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 | iErr = 1; | 165 | iErr = 1; |
| 164 | break; | 166 | break; |
| 165 | default: | 167 | default: |
| 166 | return 1; | 168 | return ERR_INFO_UNSUPPORTED_FMOTYPE; |
| 167 | } | 169 | } |
| 168 | } | 170 | } |
| 169 | 171 | ||