nitToSliceGroupMap to the macroblock to slice group map MbToSliceGroupMap. After derivation of the macroblock to slice group map as specified in clause 8.2.2.8, the function NextMbAddress n) is defined as the value of the variable nextMbAddress derived as specified by the following pseudo-code: i=n+1 while( PicSizeInMbs && MbToSliceGroupMap[ i ] 1= MbToSliceGroupMap[n]) nextMbAddress = i (8-16) 8.2.2.1 Specification for interleaved slice group map type The specifications in this clause apply when slice_group_map_type is equal to 0. The map unit to slice group map is generated as specified by the following pseudo-code: for( iGroup = iGroup<=num_slice_groups_minus1&&i<PicSizeInMapUnits; Frun_length_minus1[iGroup++]+1 (j=0;j <=run_length_minus1[iGroup <PicSizeInMapUnits;_ j++) mapUnitToSliceGroupMap[i+j]=iGroup (8-17) while(i<PicSizeInMapUnits) 8.2.2.2 Specification for dispersed slice group map type The specifications in this clause apply when slice_group_map_type is equal to 1. The map unit to slice group map is generated as specified by the following pseudo-code: for( i=0; < PicSizeInMapUnits; i++) mapUnitToSliceGroupMap[ ]=((i% PicWidthInMbs ) + (i/PicWidthInMbs) * (num_slice_groups_minus1+1))/2)) % num_slice_groups_minus1+1) (8-18) 8.2.2.3 Specification for foreground with left-over slice group map type The specifications in this clause apply when slice_group_map_type is equal to 2. The map unit to slice group map is generated as specified by the following pseudo-code: for( i=0; i < PicSizeInMapUnits; i++) mapUnitToSliceGroupMap[i]=num_slice_groups_minus1 = for( iGroup=num_slice_groups_minus1-1;iGroup >=0;iGroup-- = ) { yTopLeft = =top_left[iGroup]/PicWidthInMbs xTopLeft = top_left[ iGroup 1% PicWidthInMbs yBottomRight = =bottom_right[iGroup]/PicWidthInMbs xBottomRight = bottom_right[ iGroup PicWidthInMbs for( y=yTopLeft; y yBottomRight;y++) r(x = xTopLeft; X <= xBottomRight; x++ mapUnitToSliceGroupMap[ PicWidthInMbs+x = iGroup (8-19) NOTE - The rectangles may overlap. Slice group 0 contains the macroblocks tha