Showing the changes to codec/decoder/core/src/fmo.cpp (1 of 225 files). Show all
Unified · Split
| @@ -39,7 +39,7 @@ · 38 unmodified lines | |||
| 39 | */ | 39 | */ |
| 40 | #include <string.h> | 40 | #include <string.h> |
| 41 | 41 | ||
| 42 | #include "fmo.h" | 42 | #include "fmo.h" |
| 43 | #include "macros.h" | 43 | #include "macros.h" |
| 44 | #include "utils.h" | 44 | #include "utils.h" |
| 45 | #include "mem_align.h" | 45 | #include "mem_align.h" |
| @@ -50,41 +50,39 @@ namespace WelsDec { · 4 unmodified lines | |||
| 50 | * \brief Generate MB allocated map for interleaved slice group (TYPE 0) | 50 | * \brief Generate MB allocated map for interleaved slice group (TYPE 0) |
| 51 | * | 51 | * |
| 52 | * \param pFmo fmo context | 52 | * \param pFmo fmo context |
| 53 | * \param pPps pps context | 53 | * \param pPps pps context |
| 54 | * | 54 | * |
| 55 | * \return 0 - successful; none 0 - failed | 55 | * \return 0 - successful; none 0 - failed |
| 56 | */ | 56 | */ |
| 57 | static inline int32_t FmoGenerateMbAllocMapType0( PFmo pFmo, PPps pPps ) | 57 | static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) { |
| 58 | { | 58 | uint32_t uiNumSliceGroups = 0; |
| 59 | uint32_t uiNumSliceGroups = 0; | 59 | int32_t iMbNum = 0; |
| 60 | int32_t iMbNum = 0; | 60 | int32_t i = 0; |
| 61 | int32_t i = 0; | 61 | |
| 62 | 62 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps)) | |
| 63 | WELS_VERIFY_RETURN_IF( 1, ( NULL == pFmo || NULL == pPps ) ) | 63 | uiNumSliceGroups = pPps->uiNumSliceGroups; |
| 64 | uiNumSliceGroups = pPps->uiNumSliceGroups; | 64 | iMbNum = pFmo->iCountMbNum; |
| 65 | iMbNum = pFmo->iCountMbNum; | 65 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || uiNumSliceGroups >= MAX_SLICEGROUP_IDS)) |
| 66 | WELS_VERIFY_RETURN_IF( 1, ( NULL == pFmo->pMbAllocMap || iMbNum <= 0 || uiNumSliceGroups >= MAX_SLICEGROUP_IDS ) ) | 66 | |
| 67 | 67 | do { | |
| 68 | do | 68 | uint8_t uiGroup = 0; |
| 69 | { | 69 | do { |
| 70 | uint8_t uiGroup = 0; | 70 | const int32_t kiRunIdx = pPps->uiRunLength[uiGroup]; |
| 71 | do { | 71 | int32_t j = 0; |
| 72 | const int32_t kiRunIdx = pPps->uiRunLength[uiGroup]; | 72 | do { |
| 73 | int32_t j = 0; | 73 | pFmo->pMbAllocMap[i + j] = uiGroup; |
| 74 | do { | 74 | ++ j; |
| 75 | pFmo->pMbAllocMap[i+j] = uiGroup; | 75 | } while (j < kiRunIdx && i + j < iMbNum); |
| 76 | ++ j; | 76 | i += kiRunIdx; |
| 77 | } while(j < kiRunIdx && i + j < iMbNum); | 77 | ++ uiGroup; |
| 78 | i += kiRunIdx; | 78 | } while (uiGroup < uiNumSliceGroups && i < iMbNum); |
| 79 | ++ uiGroup; | 79 | } while (i < iMbNum); |
| 80 | } while(uiGroup < uiNumSliceGroups && i < iMbNum); | 80 | |
| 81 | }while(i < iMbNum); | 81 | return 0; // well here |
| 82 | |||
| 83 | return 0; // well here | ||
| 84 | } | 82 | } |
| 85 | 83 | ||
| 86 | /*! | 84 | /*! |
| 87 | * \brief Generate MB allocated map for dispersed slice group (TYPE 1) | 85 | * \brief Generate MB allocated map for dispersed slice group (TYPE 1) |
| 88 | * | 86 | * |
| 89 | * \param pFmo fmo context | 87 | * \param pFmo fmo context |
| 90 | * \param pPps pps context | 88 | * \param pPps pps context |
| @@ -92,98 +90,93 @@ static inline int32_t FmoGenerateMbAllocMapType0( PFmo pFmo, PPps pPps ) · 1 unmodified line | |||
| 92 | * | 90 | * |
| 93 | * \return 0 - successful; none 0 - failed | 91 | * \return 0 - successful; none 0 - failed |
| 94 | */ | 92 | */ |
| 95 | static inline int32_t FmoGenerateMbAllocMapType1( PFmo pFmo, PPps pPps, const int32_t kiMbWidth ) | 93 | static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const int32_t kiMbWidth) { |
| 96 | { | 94 | uint32_t uiNumSliceGroups = 0; |
| 97 | uint32_t uiNumSliceGroups = 0; | 95 | int32_t iMbNum = 0; |
| 98 | int32_t iMbNum = 0; | 96 | int16_t i = 0; |
| 99 | int16_t i = 0; | 97 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps)) |
| 100 | WELS_VERIFY_RETURN_IF( 1, ( NULL == pFmo || NULL == pPps ) ) | 98 | uiNumSliceGroups = pPps->uiNumSliceGroups; |
| 101 | uiNumSliceGroups = pPps->uiNumSliceGroups; | 99 | iMbNum = pFmo->iCountMbNum; |
| 102 | iMbNum = pFmo->iCountMbNum; | 100 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0 |
| 103 | WELS_VERIFY_RETURN_IF( 1, ( NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0 || uiNumSliceGroups >= MAX_SLICEGROUP_IDS ) ) | 101 | || uiNumSliceGroups >= MAX_SLICEGROUP_IDS)) |
| 104 | 102 | ||
| 105 | do | 103 | do { |
| 106 | { | 104 | pFmo->pMbAllocMap[i] = (uint8_t) (((i % kiMbWidth) + (((i / kiMbWidth) * uiNumSliceGroups) >> 1)) % uiNumSliceGroups); |
| 107 | pFmo->pMbAllocMap[i] = (uint8_t)(((i % kiMbWidth)+(((i / kiMbWidth)*uiNumSliceGroups)>>1)) % uiNumSliceGroups); | 105 | ++ i; |
| 108 | ++ i; | 106 | } while (i < iMbNum); |
| 109 | }while (i < iMbNum); | 107 | |
| 110 | 108 | return 0; // well here | |
| 111 | return 0; // well here | ||
| 112 | } | 109 | } |
| 113 | 110 | ||
| 114 | /*! | 111 | /*! |
| 115 | * \brief Generate MB allocated map for various type of slice group cases (TYPE 0, .., 6) | 112 | * \brief Generate MB allocated map for various type of slice group cases (TYPE 0, .., 6) |
| 116 | * | 113 | * |
| 117 | * \param pFmo fmo context | 114 | * \param pFmo fmo context |
| 118 | * \param pPps pps context | 115 | * \param pPps pps context |
| 119 | * \param kiMbWidth MB width | 116 | * \param kiMbWidth MB width |
| 120 | * \param kiMbHeight MB height | 117 | * \param kiMbHeight MB height |
| 121 | * | 118 | * |
| 122 | * \return 0 - successful; none 0 - failed | 119 | * \return 0 - successful; none 0 - failed |
| 123 | */ | 120 | */ |
| 124 | static inline int32_t FmoGenerateSliceGroup( PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth, const int32_t kiMbHeight ) | 121 | static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const int32_t kiMbWidth, |
| 125 | { | 122 | const int32_t kiMbHeight) { |
| 126 | int32_t iNumMb = 0; | 123 | int32_t iNumMb = 0; |
| 127 | int32_t iErr = 0; | 124 | int32_t iErr = 0; |
| 128 | bool_t bResolutionChanged = false; | 125 | bool_t bResolutionChanged = false; |
| 129 | 126 | ||
| 130 | // the cases we would not like | 127 | // the cases we would not like |
| 131 | WELS_VERIFY_RETURN_IF( 1, ( NULL == pFmo || NULL == kpPps ) ) | 128 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == kpPps)) |
| 132 | 129 | ||
| 133 | iNumMb = pFmo->iCountMbNum; | 130 | iNumMb = pFmo->iCountMbNum; |
| 134 | 131 | ||
| 135 | iNumMb = kiMbWidth * kiMbHeight; | 132 | iNumMb = kiMbWidth * kiMbHeight; |
| 136 | 133 | ||
| 137 | if ( 0 == iNumMb ) | 134 | if (0 == iNumMb) |
| 138 | return 1; | 135 | return 1; |
| 139 | 136 | ||
| 140 | 137 | ||
| 141 | WelsFree(pFmo->pMbAllocMap, "_fmo->pMbAllocMap"); | 138 | WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap"); |
| 142 | pFmo->pMbAllocMap = (uint8_t *)WelsMalloc( iNumMb * sizeof(uint8_t), "_fmo->pMbAllocMap" ); | 139 | pFmo->pMbAllocMap = (uint8_t*)WelsMalloc (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap"); |
| 143 | WELS_VERIFY_RETURN_IF( 1, (NULL == pFmo->pMbAllocMap) ) // out of memory | 140 | WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory |
| 144 | 141 | ||
| 145 | pFmo->iCountMbNum = iNumMb; | 142 | pFmo->iCountMbNum = iNumMb; |
| 146 | 143 | ||
| 147 | if ( kpPps->uiNumSliceGroups < 2 && iNumMb > 0) // only one slice group, exactly it is single slice based | 144 | if (kpPps->uiNumSliceGroups < 2 && iNumMb > 0) { // only one slice group, exactly it is single slice based |
| 148 | { | 145 | memset (pFmo->pMbAllocMap, 0, iNumMb * sizeof (int8_t)); // for safe |
| 149 | memset ( pFmo->pMbAllocMap, 0, iNumMb * sizeof(int8_t)); // for safe | 146 | |
| 150 | 147 | pFmo->iSliceGroupCount = 1; | |
| 151 | pFmo->iSliceGroupCount = 1; | 148 | |
| 152 | 149 | return 0; | |
| 153 | return 0; | 150 | } |
| 154 | } | 151 | |
| 155 | 152 | if (bResolutionChanged || ((int32_t)kpPps->uiSliceGroupMapType != pFmo->iSliceGroupType) | |
| 156 | if ( bResolutionChanged || ((int32_t)kpPps->uiSliceGroupMapType != pFmo->iSliceGroupType) | 153 | || ((int32_t)kpPps->uiNumSliceGroups != pFmo->iSliceGroupCount)) { |
| 157 | || ((int32_t)kpPps->uiNumSliceGroups != pFmo->iSliceGroupCount) ) | 154 | switch (kpPps->uiSliceGroupMapType) { |
| 158 | { | 155 | case 0: |
| 159 | switch ( kpPps->uiSliceGroupMapType ) | 156 | iErr = FmoGenerateMbAllocMapType0 (pFmo, kpPps); |
| 160 | { | 157 | break; |
| 161 | case 0: | 158 | case 1: |
| 162 | iErr = FmoGenerateMbAllocMapType0( pFmo, kpPps ); | 159 | iErr = FmoGenerateMbAllocMapType1 (pFmo, kpPps, kiMbWidth); |
| 163 | break; | 160 | break; |
| 164 | case 1: | 161 | case 2: |
| 165 | iErr = FmoGenerateMbAllocMapType1( pFmo, kpPps, kiMbWidth ); | 162 | case 3: |
| 166 | break; | 163 | case 4: |
| 167 | case 2: | 164 | case 5: |
| 168 | case 3: | 165 | case 6: |
| 169 | case 4: | 166 | // Reserve for others slice group type |
| 170 | case 5: | 167 | iErr = 1; |
| 171 | case 6: | 168 | break; |
| 172 | // Reserve for others slice group type | 169 | default: |
| 173 | iErr = 1; | 170 | return 1; |
| 174 | break; | 171 | } |
| 175 | default: | 172 | } |
| 176 | return 1; | 173 | |
| 177 | } | 174 | if (0 == iErr) { // well now |
| 178 | } | 175 | pFmo->iSliceGroupCount = kpPps->uiNumSliceGroups; |
| 179 | 176 | pFmo->iSliceGroupType = kpPps->uiSliceGroupMapType; | |
| 180 | if ( 0 == iErr ) // well now | 177 | } |
| 181 | { | 178 | |
| 182 | pFmo->iSliceGroupCount = kpPps->uiNumSliceGroups; | 179 | return iErr; |
| 183 | pFmo->iSliceGroupType = kpPps->uiSliceGroupMapType; | ||
| 184 | } | ||
| 185 | |||
| 186 | return iErr; | ||
| 187 | } | 180 | } |
| 188 | 181 | ||
| 189 | /*! | 182 | /*! |
| @@ -196,9 +189,8 @@ static inline int32_t FmoGenerateSliceGroup( PFmo pFmo, const PPps kpPps, const · 6 unmodified lines | |||
| 196 | * | 189 | * |
| 197 | * \return 0 - successful; none 0 - failed; | 190 | * \return 0 - successful; none 0 - failed; |
| 198 | */ | 191 | */ |
| 199 | int32_t InitFmo( PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight ) | 192 | int32_t InitFmo (PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t kiMbHeight) { |
| 200 | { | 193 | return FmoGenerateSliceGroup (pFmo, pPps, kiMbWidth, kiMbHeight); |
| 201 | return FmoGenerateSliceGroup( pFmo, pPps, kiMbWidth, kiMbHeight ); | ||
| 202 | } | 194 | } |
| 203 | 195 | ||
| 204 | 196 | ||
| @@ -211,35 +203,32 @@ int32_t InitFmo( PFmo pFmo, PPps pPps, const int32_t kiMbWidth, const int32_t ki · 6 unmodified lines | |||
| 211 | * | 203 | * |
| 212 | * \return NONE | 204 | * \return NONE |
| 213 | */ | 205 | */ |
| 214 | void_t UninitFmoList( PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail ) | 206 | void_t UninitFmoList (PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail) { |
| 215 | { | 207 | PFmo pIter = pFmo; |
| 216 | PFmo pIter = pFmo; | 208 | int32_t i = 0; |
| 217 | int32_t i = 0; | 209 | int32_t iFreeNodes = 0; |
| 218 | int32_t iFreeNodes = 0; | 210 | |
| 219 | 211 | if (NULL == pIter || kiAvail <= 0 || kiCnt < kiAvail) | |
| 220 | if ( NULL == pIter || kiAvail <= 0 || kiCnt < kiAvail ) | 212 | return; |
| 221 | return; | 213 | |
| 222 | 214 | while (i < kiCnt) { | |
| 223 | while ( i < kiCnt ) { | 215 | if (pIter != NULL && pIter->bActiveFlag) { |
| 224 | if ( pIter != NULL && pIter->bActiveFlag ) | 216 | if (NULL != pIter->pMbAllocMap) { |
| 225 | { | 217 | WelsFree (pIter->pMbAllocMap, "pIter->pMbAllocMap"); |
| 226 | if ( NULL != pIter->pMbAllocMap ) | 218 | |
| 227 | { | 219 | pIter->pMbAllocMap = NULL; |
| 228 | WelsFree( pIter->pMbAllocMap, "pIter->pMbAllocMap" ); | 220 | } |
| 229 | 221 | pIter->iSliceGroupCount = 0; | |
| 230 | pIter->pMbAllocMap = NULL; | 222 | pIter->iSliceGroupType = -1; |
| 231 | } | 223 | pIter->iCountMbNum = 0; |
| 232 | pIter->iSliceGroupCount = 0; | 224 | pIter->bActiveFlag = false; |
| 233 | pIter->iSliceGroupType = -1; | 225 | ++ iFreeNodes; |
| 234 | pIter->iCountMbNum = 0; | 226 | if (iFreeNodes >= kiAvail) |
| 235 | pIter->bActiveFlag = false; | 227 | break; |
| 236 | ++ iFreeNodes; | 228 | } |
| 237 | if ( iFreeNodes >= kiAvail ) | 229 | ++ pIter; |
| 238 | break; | 230 | ++ i; |
| 239 | } | 231 | } |
| 240 | ++ pIter; | ||
| 241 | ++ i; | ||
| 242 | } | ||
| 243 | } | 232 | } |
| 244 | 233 | ||
| 245 | /*! | 234 | /*! |
| @@ -252,14 +241,14 @@ void_t UninitFmoList( PFmo pFmo, const int32_t kiCnt, const int32_t kiAvail ) · 6 unmodified lines | |||
| 252 | * | 241 | * |
| 253 | * \return true - changed or not initialized yet; false - not change at all | 242 | * \return true - changed or not initialized yet; false - not change at all |
| 254 | */ | 243 | */ |
| 255 | bool_t FmoParamSetsChanged( PFmo pFmo, const int32_t kiCountNumMb, const int32_t kiSliceGroupType, const int32_t kiSliceGroupCount ) | 244 | bool_t FmoParamSetsChanged (PFmo pFmo, const int32_t kiCountNumMb, const int32_t kiSliceGroupType, |
| 256 | { | 245 | const int32_t kiSliceGroupCount) { |
| 257 | WELS_VERIFY_RETURN_IF( false, (NULL == pFmo) ) | 246 | WELS_VERIFY_RETURN_IF (false, (NULL == pFmo)) |
| 258 | 247 | ||
| 259 | return ( (!pFmo->bActiveFlag) | 248 | return ((!pFmo->bActiveFlag) |
| 260 | || (kiCountNumMb != pFmo->iCountMbNum) | 249 | || (kiCountNumMb != pFmo->iCountMbNum) |
| 261 | || (kiSliceGroupType != pFmo->iSliceGroupType) | 250 | || (kiSliceGroupType != pFmo->iSliceGroupType) |
| 262 | || (kiSliceGroupCount != pFmo->iSliceGroupCount) ); | 251 | || (kiSliceGroupCount != pFmo->iSliceGroupCount)); |
| 263 | } | 252 | } |
| 264 | 253 | ||
| 265 | /*! | 254 | /*! |
| @@ -272,51 +261,44 @@ bool_t FmoParamSetsChanged( PFmo pFmo, const int32_t kiCountNumMb, const int32_t · 6 unmodified lines | |||
| 272 | * | 261 | * |
| 273 | * \return true - update/insert successfully; false - failed; | 262 | * \return true - update/insert successfully; false - failed; |
| 274 | */ | 263 | */ |
| 275 | bool_t FmoParamUpdate( PFmo pFmo, PSps pSps, PPps pPps, int32_t *pActiveFmoNum ) | 264 | bool_t FmoParamUpdate (PFmo pFmo, PSps pSps, PPps pPps, int32_t* pActiveFmoNum) { |
| 276 | { | 265 | const uint32_t kuiMbWidth = pSps->iMbWidth; |
| 277 | const uint32_t kuiMbWidth = pSps->iMbWidth; | 266 | const uint32_t kuiMbHeight = pSps->iMbHeight; |
| 278 | const uint32_t kuiMbHeight= pSps->iMbHeight; | 267 | |
| 279 | 268 | if (FmoParamSetsChanged (pFmo, | |
| 280 | if ( FmoParamSetsChanged( pFmo, | 269 | kuiMbWidth * kuiMbHeight, |
| 281 | kuiMbWidth * kuiMbHeight, | 270 | pPps->uiSliceGroupMapType, |
| 282 | pPps->uiSliceGroupMapType, | 271 | pPps->uiNumSliceGroups)) { |
| 283 | pPps->uiNumSliceGroups ) ) | 272 | |
| 284 | { | 273 | if (InitFmo (pFmo, pPps, kuiMbWidth, kuiMbHeight)) { |
| 285 | 274 | return false; | |
| 286 | if ( InitFmo( pFmo, pPps, kuiMbWidth, kuiMbHeight ) ) | 275 | } else { |
| 287 | { | 276 | if (!pFmo->bActiveFlag && *pActiveFmoNum < MAX_PPS_COUNT) { |
| 288 | return false; | 277 | ++ (*pActiveFmoNum); |
| 289 | } | 278 | pFmo->bActiveFlag = true; |
| 290 | else | 279 | } |
| 291 | { | 280 | } |
| 292 | if ( !pFmo->bActiveFlag && *pActiveFmoNum < MAX_PPS_COUNT ) | 281 | } |
| 293 | { | 282 | |
| 294 | ++ (*pActiveFmoNum); | 283 | return true; |
| 295 | pFmo->bActiveFlag = true; | ||
| 296 | } | ||
| 297 | } | ||
| 298 | } | ||
| 299 | |||
| 300 | return true; | ||
| 301 | } | 284 | } |
| 302 | 285 | ||
| 303 | /*! | 286 | /*! |
| 304 | * \brief Convert kMbXy to slice group idc correspondingly | 287 | * \brief Convert kMbXy to slice group idc correspondingly |
| 305 | * | 288 | * |
| 306 | * \param pFmo Wels fmo context | 289 | * \param pFmo Wels fmo context |
| 307 | * \param kMbXy kMbXy to be converted | 290 | * \param kMbXy kMbXy to be converted |
| 308 | * | 291 | * |
| 309 | * \return slice group idc - successful; -1 - failed; | 292 | * \return slice group idc - successful; -1 - failed; |
| 310 | */ | 293 | */ |
| 311 | int32_t FmoMbToSliceGroup( PFmo pFmo, const MB_XY_T kiMbXy ) | 294 | int32_t FmoMbToSliceGroup (PFmo pFmo, const MB_XY_T kiMbXy) { |
| 312 | { | 295 | const int32_t kiMbNum = pFmo->iCountMbNum; |
| 313 | const int32_t kiMbNum = pFmo->iCountMbNum; | 296 | const uint8_t* kpMbMap = pFmo->pMbAllocMap; |
| 314 | const uint8_t* kpMbMap = pFmo->pMbAllocMap; | 297 | |
| 315 | 298 | if (kiMbXy < 0 || kiMbXy >= kiMbNum || kpMbMap == NULL) | |
| 316 | if ( kiMbXy < 0 || kiMbXy >= kiMbNum || kpMbMap == NULL) | 299 | return -1; |
| 317 | return -1; | 300 | |
| 318 | 301 | return kpMbMap[ kiMbXy ]; | |
| 319 | return kpMbMap[ kiMbXy ]; | ||
| 320 | } | 302 | } |
| 321 | 303 | ||
| 322 | /*! | 304 | /*! |
| @@ -327,29 +309,28 @@ int32_t FmoMbToSliceGroup( PFmo pFmo, const MB_XY_T kiMbXy ) · 4 unmodified lines | |||
| 327 | * | 309 | * |
| 328 | * \return iNextMb - successful; -1 - failed; | 310 | * \return iNextMb - successful; -1 - failed; |
| 329 | */ | 311 | */ |
| 330 | MB_XY_T FmoNextMb( PFmo pFmo, const MB_XY_T kiMbXy ) | 312 | MB_XY_T FmoNextMb (PFmo pFmo, const MB_XY_T kiMbXy) { |
| 331 | { | 313 | const int32_t kiTotalMb = pFmo->iCountMbNum; |
| 332 | const int32_t kiTotalMb = pFmo->iCountMbNum; | 314 | const uint8_t* kpMbMap = pFmo->pMbAllocMap; |
| 333 | const uint8_t* kpMbMap = pFmo->pMbAllocMap; | 315 | MB_XY_T iNextMb = kiMbXy; |
| 334 | MB_XY_T iNextMb = kiMbXy; | 316 | const uint8_t kuiSliceGroupIdc = (uint8_t)FmoMbToSliceGroup (pFmo, kiMbXy); |
| 335 | const uint8_t kuiSliceGroupIdc = (uint8_t)FmoMbToSliceGroup( pFmo, kiMbXy ); | 317 | |
| 336 | 318 | if (kuiSliceGroupIdc == (uint8_t) (-1)) | |
| 337 | if (kuiSliceGroupIdc == (uint8_t)(-1)) | 319 | return -1; |
| 338 | return -1; | 320 | |
| 339 | 321 | do { | |
| 340 | do { | 322 | ++ iNextMb; |
| 341 | ++ iNextMb; | 323 | if (iNextMb >= kiTotalMb) { |
| 342 | if (iNextMb >= kiTotalMb){ | 324 | iNextMb = -1; |
| 343 | iNextMb = -1; | 325 | break; |
| 344 | break; | 326 | } |
| 345 | } | 327 | if (kpMbMap[iNextMb] == kuiSliceGroupIdc) { |
| 346 | if (kpMbMap[iNextMb] == kuiSliceGroupIdc){ | 328 | break; |
| 347 | break; | 329 | } |
| 348 | } | 330 | } while (1); |
| 349 | } while( 1 ); | 331 | |
| 350 | 332 | // -1: No further MB in this slice (could be end of picture) | |
| 351 | // -1: No further MB in this slice (could be end of picture) | 333 | return iNextMb; |
| 352 | return iNextMb; | ||
| 353 | } | 334 | } |
| 354 | 335 | ||
| 355 | } // namespace WelsDec | 336 | } // namespace WelsDec |