/*******************************************************************
                MPEG Video picture header interfaces
 *******************************************************************/
#ifndef PICTURE_HEADER_H
#define PICTURE_HEADER_H

#include "mpeg_io.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
	int forward_hrizontal_f_code;
	int forward_vertical_f_code;
	int backward_hrizontal_f_code;
	int backward_vertical_f_code;
	int intra_dc_precision;
	int picture_structure;
	int top_field_first;
	int frame_predictive_frame_dct;
	int concealment_motion_vectors;
	int q_scale_type;
	int intra_vlc_format;
	int alternate_scan;
	int repeat_first_field;
	int chroma_420_type;
	int progressive_frame;
	int composit_display_flag;
	int v_axis;
	int field_sequence;
	int sub_carrier;
	int burst_amplitude;
	int sub_carrier_phase;
} PICTURE_CODING_EXTENSION;

typedef struct {
	int load_intra_quantizer_matrix;
	unsigned char iqm[64];
	int load_nonintra_quantizer_matrix;
	unsigned char nqm[64];
	int load_chroma_intra_quantizer_matrix;
	unsigned char ciqm[64];
	int load_chroma_nonintra_quantizer_matrix;
	unsigned char cnqm[64];
} QUANT_MATRIX_EXTENSION;

typedef struct {
	int frame_center_horizontal_offset;
	int frame_center_vertical_offset;
} PICTURE_DISPLAY_EXTENSION;

typedef struct {
	int low_layer_temporal_reference;
	int lower_layer_horizontal_offset;
	int lower_layer_vertical_offset;
	int spatial_temporal_weight_code_table_index;
	int lower_layer_progressive_frame;
	int lower_layer_deinterlaced_field_select;
} PICTURE_SPATIAL_SCALABLE_EXTENSION;

typedef struct {
	int reference_select_code;
	int forward_temporal_reference;
	int backward_temporal_reference;
}PICTURE_TEMPORAL_SCALABLE_EXTENSION;

typedef struct {
	int temporal_reference;
	int picture_coding_type;
	int vbv_delay;
	int full_pel_forward_vector;
	int forward_f_code;
	int full_pel_backward_vector;
	int backward_f_code;

	int has_picture_coding_extension;
	PICTURE_CODING_EXTENSION pc;

	int has_quant_matrix_extension;
	QUANT_MATRIX_EXTENSION qm;

	int has_picture_display_extension;
	PICTURE_DISPLAY_EXTENSION pd;

	int has_picture_spatial_scalable_extension;
	PICTURE_SPATIAL_SCALABLE_EXTENSION pss;

	int has_temporal_scalable_extension;
	PICTURE_TEMPORAL_SCALABLE_EXTENSION pts;
} PICTURE_HEADER;

#ifndef PICTURE_HEADER_C
extern int read_picture_header(MPEG_IO *in, PICTURE_HEADER *out);
#endif

#ifdef __cplusplus
}
#endif

#endif