
/*!
 ***************************************************************************
 *
 * \file fmo.h
 *
 * \brief
 *    Support for Flexible Macroblock Ordering
 *
 * \date
 *    16 June 2002
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 **************************************************************************/

#ifndef _FMO_H_
#define _FMO_H_

#define MAXSLICEGROUPIDS 8


extern byte *MBAmap; 



class FMO
{
public:

//interface
 int FmoInit(ImageParameters * img, pic_parameter_set_rbsp_t * pps, seq_parameter_set_rbsp_t * sps);
 void FmoUninit ();
 int FmoFinit (seq_parameter_set_rbsp_t * sps);
 int FmoMB2SliceGroup (int mb);
 int FmoGetFirstMBOfSliceGroup (int SliceGroupID);
 int FmoGetFirstMacroblockInSlice (int SliceGroup);
 int FmoGetNextMBNr (int CurrentMbNr);
 int FmoGetLastCodedMBOfSliceGroup (int SliceGroupID);
 int FmoStartPicture ();
 int FmoEndPicture();
 int FmoSliceGroupCompletelyCoded(int SliceGroupID);
 void FmoSetLastMacroblockInSlice (int mb);
 
 int FmoGetPreviousMBNr (int CurrentMbNr);

//process
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);

	
}

#endif

