fmo.c File Reference

Support for Flexible Macroblock Ordering for different Slice Group Modes: MBAmap handling. More...

#include "global.h"
#include "fmo.h"

Include dependency graph for fmo.c:

Go to the source code of this file.

Functions

static void FmoGenerateType0MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static void FmoGenerateType1MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static void FmoGenerateType2MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static void FmoGenerateType3MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static void FmoGenerateType4MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static void FmoGenerateType5MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static void FmoGenerateType6MapUnitMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static int FmoGenerateMapUnitToSliceGroupMap (ImageParameters *img, pic_parameter_set_rbsp_t *pps)
static int FmoGenerateMBAmap (ImageParameters *img, seq_parameter_set_rbsp_t *sps)
int FmoInit (ImageParameters *img, pic_parameter_set_rbsp_t *pps, seq_parameter_set_rbsp_t *sps)
void FmoUninit ()
int FmoStartPicture ()
int FmoEndPicture ()
int FmoMB2SliceGroup (int mb)
int FmoGetNextMBNr (int CurrentMbNr)
int FmoGetPreviousMBNr (int CurrentMbNr)
int FmoGetFirstMBOfSliceGroup (int SliceGroupID)
int FmoGetLastCodedMBOfSliceGroup (int SliceGroupID)
void FmoSetLastMacroblockInSlice (int mb)
int FmoGetFirstMacroblockInSlice (int SliceGroup)
int FmoSliceGroupCompletelyCoded (int SliceGroupID)

Variables

static int FirstMBInSlice [MAXSLICEGROUPIDS]
byte * MBAmap = NULL
byte * MapUnitToSliceGroupMap = NULL
unsigned int PicSizeInMapUnits


Detailed Description

Support for Flexible Macroblock Ordering for different Slice Group Modes: MBAmap handling.

Date:
16 June, 2002 Modified April 25, 2004
Author:
Stephan Wenger stewe@cs.tu-berlin.de Dong Wang Dong.Wang@bristol.ac.uk

Definition in file fmo.c.


Function Documentation

int FmoEndPicture ( void   ) 

FmoEndPicture: Ends the Scattered Slices Module (called once per picture).

Input:
None

Definition at line 575 of file fmo.c.

Referenced by code_a_plane().

static int FmoGenerateMapUnitToSliceGroupMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generates MapUnitToSliceGroupMap.

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 90 of file fmo.c.

References error(), FmoGenerateType0MapUnitMap(), FmoGenerateType1MapUnitMap(), FmoGenerateType2MapUnitMap(), FmoGenerateType3MapUnitMap(), FmoGenerateType4MapUnitMap(), FmoGenerateType5MapUnitMap(), FmoGenerateType6MapUnitMap(), ImageParameters::PicHeightInMapUnits, and ImageParameters::PicWidthInMbs.

Referenced by FmoInit().

Here is the call graph for this function:

static int FmoGenerateMBAmap ( ImageParameters *  img,
seq_parameter_set_rbsp_t *  sps 
) [static]

Generates MBAmap from MapUnitToSliceGroupMap.

Parameters:
img Image Parameter to be used for map generation
sps Sequence Parameter set to be used for map generation

Definition at line 162 of file fmo.c.

References ImageParameters::field_picture, ImageParameters::PicSizeInMbs, and ImageParameters::PicWidthInMbs.

Referenced by FmoInit().

static void FmoGenerateType0MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate interleaved slice group map type MapUnit map (type 0).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 316 of file fmo.c.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

static void FmoGenerateType1MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate dispersed slice group map type MapUnit map (type 1).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 345 of file fmo.c.

References ImageParameters::PicWidthInMbs.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

static void FmoGenerateType2MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate foreground with left-over slice group map type MapUnit map (type 2).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 366 of file fmo.c.

References ImageParameters::PicWidthInMbs.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

static void FmoGenerateType3MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate box-out slice group map type MapUnit map (type 3).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 399 of file fmo.c.

References ImageParameters::PicHeightInMapUnits, ImageParameters::PicWidthInMbs, and ImageParameters::slice_group_change_cycle.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

static void FmoGenerateType4MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate raster scan slice group map type MapUnit map (type 4).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 479 of file fmo.c.

References ImageParameters::slice_group_change_cycle.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

static void FmoGenerateType5MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate wipe slice group map type MapUnit map (type 5).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 506 of file fmo.c.

References ImageParameters::PicHeightInMapUnits, ImageParameters::PicWidthInMbs, and ImageParameters::slice_group_change_cycle.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

static void FmoGenerateType6MapUnitMap ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps 
) [static]

Generate explicit slice group map type MapUnit map (type 6).

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation

Definition at line 534 of file fmo.c.

Referenced by FmoGenerateMapUnitToSliceGroupMap().

int FmoGetFirstMBOfSliceGroup ( int  SliceGroupID  ) 

FmoGetFirstMBOfSliceGroup: Returns the MB-Nr (in scan order) of the next first MB of the Slice group, -1 if no such MB exists.

Input:
SliceGroupID: Id of SliceGroup

Definition at line 658 of file fmo.c.

References FmoMB2SliceGroup(), and ImageParameters::PicSizeInMbs.

Referenced by FmoStartPicture().

Here is the call graph for this function:

int FmoGetLastCodedMBOfSliceGroup ( int  SliceGroupID  ) 

FmoGetLastCodedMBOfSlice: Returns the MB-Nr (in scan order) of the last MB of the slice group.

Input:
SliceGroupID
Return
MB Nr in case of success (is always >= 0) -1 if the SliceGroup doesn't exist

Definition at line 684 of file fmo.c.

References FmoMB2SliceGroup(), and ImageParameters::PicSizeInMbs.

Referenced by encode_one_slice_MBAFF(), and end_macroblock().

Here is the call graph for this function:

int FmoGetNextMBNr ( int  CurrentMbNr  ) 

FmoGetNextMBBr: Returns the MB-Nr (in scan order) of the next MB in the (FMO) Slice, -1 if the SliceGroup is finished.

Input:
CurrentMbNr

Definition at line 608 of file fmo.c.

References FmoMB2SliceGroup(), and ImageParameters::PicSizeInMbs.

Referenced by encode_one_slice(), encode_one_slice_MBAFF(), and writeMBLayer().

Here is the call graph for this function:

int FmoGetPreviousMBNr ( int  CurrentMbNr  ) 

FmoGetNextMBBr: Returns the MB-Nr (in scan order) of the next MB in the (FMO) Slice, -1 if the SliceGroup is finished.

Input:
CurrentMbNr

Definition at line 633 of file fmo.c.

References FmoMB2SliceGroup().

Referenced by encode_one_slice(), encode_one_slice_MBAFF(), start_macroblock(), and writeMBLayer().

Here is the call graph for this function:

int FmoInit ( ImageParameters *  img,
pic_parameter_set_rbsp_t *  pps,
seq_parameter_set_rbsp_t *  sps 
)

FMO initialization: Generates MapUnitToSliceGroupMap and MBAmap.

Parameters:
img Image Parameter to be used for map generation
pps Picture Parameter set to be used for map generation
sps Sequence Parameter set to be used for map generation

Definition at line 216 of file fmo.c.

References FirstMBInSlice, FmoGenerateMapUnitToSliceGroupMap(), FmoGenerateMBAmap(), ImageParameters::PicHeightInMapUnits, ImageParameters::PicSizeInMbs, and ImageParameters::PicWidthInMbs.

Referenced by code_a_plane().

Here is the call graph for this function:

int FmoMB2SliceGroup ( int  mb  ) 

FmoMB2Slice: Returns SliceID for a given MB.

Input:
Macroblock Nr (in scan order)

Definition at line 591 of file fmo.c.

References ImageParameters::PicSizeInMbs.

Referenced by encode_one_slice_MBAFF(), end_macroblock(), FmoGetFirstMBOfSliceGroup(), FmoGetLastCodedMBOfSliceGroup(), FmoGetNextMBNr(), and FmoGetPreviousMBNr().

int FmoStartPicture ( void   ) 

FmoStartPicture: initializes FMO at the begin of each new picture.

Input:
None

Definition at line 552 of file fmo.c.

References FirstMBInSlice, and FmoGetFirstMBOfSliceGroup().

Referenced by code_a_plane().

Here is the call graph for this function:

void FmoUninit ( void   ) 

Free memory if allocated by FMO functions.

Definition at line 289 of file fmo.c.

Referenced by free_encoder_memory().


Variable Documentation

int FirstMBInSlice[MAXSLICEGROUPIDS] [static]

Notes by Dong Wang (April 25 2004)

Source codes are modified to support 7 slice group types (fmo modes). The functions for generating map are very similar to that in decoder, but have a little difference.

The MB map is calculated at the beginning of coding of each picture (frame or field).

'slice_group_change_cycle' in structure 'ImageParameters' is the syntax in the slice header. It's set to be 1 before the initialization of FMO in function code_a_picture(). It can be changed every time if needed.

How does a MBAmap look like?

An MBAmap is a one-diemnsional array of ints. Each int represents an MB in scan order. A zero or positive value represents a slice group ID. Negative values are reserved for future extensions. The numbering range for the SliceGroupIDs is 0..7 as per JVT-C167.

This module contains a static variable MBAmap. This is the MBAmap of the picture currently coded. It can be accessed only through the access functions.

Definition at line 58 of file fmo.c.

Referenced by FmoInit(), and FmoStartPicture().


Documentation generated with DoxyGen