/*******************************************************************
                     macroblock layer interface
 *******************************************************************/
#ifndef MACROBLOCK_H
#define MACROBLOCK_H

#include "mpeg_io.h"
#include "block.h"
#include "mc.h"

typedef struct {
	int macroblock_address_increment;
	int macroblock_quant;
	int macroblock_motion_forward;
	int macroblock_motion_backward;
	int macroblock_pattern;
	int macroblock_intra;
	int spatial_temporal_weight_code_flag;
	int spatial_temporal_weight_classes;
	int spatial_temporal_weight_code;
	int prediction_type;
	int motion_vector_count;
	int motion_vector_format;
	int dual_prime_motion_vector;
	int motion_vertical_field_select[2][2];
	int PMV[2][2][2];
	int DMV[2][2];
	int dct_type;
	int quantizer_scale_code;
	int block_count;
	int pattern_code[12];
} MACROBLOCK;

typedef struct {
	/* in sequence_header ->
	        sequence_extension */
	int chroma_format;

	/* in sequence_header -> 
	        sequence_scalable_extension */
	int scalable_mode;

	/* in picture_header */
	int picture_coding_type;

	/* in picture_header ->
	        picture_coding_extension */
	int picture_structure;
	int top_field_first;
	int frame_predictive_frame_dct;
	int concealment_motion_vectors;
	int f_code[2][2];

	/* in picture_header ->
	        picture_spatial_scalable_extension */
	int spatial_temporal_weight_code_table_index;

} READ_MACROBLOCK_OPTION;

#ifdef __cplusplus
extern "C" {
#endif

#ifndef MACROBLOCK_C
extern int read_macroblock(MPEG_IO *in, MACROBLOCK *out, READ_MACROBLOCK_OPTION *opt);
extern int get_macroblock_address_increment(MPEG_IO *in);
extern int macroblock_to_read_block_option(MACROBLOCK *in, READ_BLOCK_OPTION *out);
extern int macroblock_to_mc_parameter(MACROBLOCK *in, MC_PARAMETER *out);
extern int reset_motion_vector_predictor(MACROBLOCK *p);
#endif

#ifdef __cplusplus
}
#endif
	
#endif

