Улучшение отношения сигнал/шум при микшировании видео изображения, сжатого по стандарту MPEG2, страница 20

#define SYSTEM_START_CODE                     0xBB

#define VIDEO_ELEMENTARY_STREAM               0xe0

#define SYSTEM_START_CODE_MAX                 0xFF

/// Extension start code IDs

#define SEQUENCE_EXTENSION_ID                    1

#define SEQUENCE_DISPLAY_EXTENSION_ID            2

#define QUANT_MATRIX_EXTENSION_ID                3

#define COPYRIGHT_EXTENSION_ID                   4

#define SEQUENCE_SCALABLE_EXTENSION_ID           5

#define PICTURE_DISPLAY_EXTENSION_ID             7

#define PICTURE_CODING_EXTENSION_ID              8

#define PICTURE_SPATIAL_SCALABLE_EXTENSION_ID    9

#define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID  10

/// CHROMA FORMAT

#define CHROMA420                                1  /// 420 (4Y, 1U, 1V)

#define CHROMA422                                2  /// 422 (4Y, 2U, 2V)

#define CHROMA444                                3  /// 444 (4Y, 4U, 4V)

/// SCALABLE MODE

#define SC_NONE                                  0

#define SC_DP                                    1

#define SC_SPAT                                  2

#define SC_SNR                                   3

#define SC_TEMP                                  4

/// PICTURE CODING TYPE

#define I_TYPE                                   1

#define P_TYPE                                   2

#define B_TYPE                                   3

#define D_TYPE                                   4

/// PICTURE STRUCTURE

#define TOP_FIELD                                1

#define BOTTOM_FIELD                             2

#define FRAME_PICTURE                            3

/// MACROBLOCK TYPE

#define SKIPPED_MACROBLOCK                       0

#define MACROBLOCK_INTRA                         1

#define MACROBLOCK_PATTERN                       2

#define MACROBLOCK_MOTION_BACKWARD               4

#define MACROBLOCK_MOTION_FORWARD                8

#define MACROBLOCK_QUANT                        16

#define SPATIAL_TEMPORAL_WEIGHT_CODE_FLAG       32

#define PERMITTED_SPATIAL_TEMPORAL_WEIGHT_CLASS 64

#define MACROBLOCK_WITHOUT_ERRORS              128

/// MOTION TYPE

#define MC_FIELD                                 1

#define MC_FRAME                                 2

#define MC_16X8                                  2

#define MC_DMV                                   3

/// MV FIELD

#define MV_FIELD                                 0

#define MV_FRAME                                 1

//////////////////////////// MPEG2 Video Stream Structures ////////////////////////////

/// Sequence header structure

typedef struct sequence_header_t

{

t_bool is_present;

t_ui16 horizontal_size;

t_ui16 vertical_size;

t_ui8 aspect_ratio_information;

t_ui8 frame_rate_code;

t_ui32 bit_rate_value;

t_ui16 vbv_buffer_size;

t_bool default_intra_matrix;

t_bool default_non_intra_matrix;

t_ui8 intra_quant_matrix[64];

t_ui8 non_intra_quant_matrix[64];

} sequence_header_t;

/// Group of picture header structure structure

typedef struct group_of_pictures_header_t

{

t_ui32 drop_frame_flag;

t_ui8 time_code_hours;

t_ui8 time_code_minutes;

t_ui8 time_code_seconds;

t_ui8 time_code_pictures;

t_bool closed_gop;

t_bool broken_link;

} group_of_pictures_header_t;

/// Picture header structure

typedef struct picture_header_t

{

t_ui16 temporal_reference;

t_ui16 non_temporal_reference;                  /// Not Standart member. Coded number of picture in current GOP

t_ui8 picture_coding_type;

t_ui16 vbv_delay;

t_bool full_pel_forward_vector;

t_ui8 forward_f_code;

t_bool full_pel_backward_vector;

t_ui8 backward_f_code;

} picture_header_t;

/// Slice header structure

typedef struct slice_header_t

{

t_ui8 slice_vertical_pos_ext;

t_bool intra_slice_flag;

t_bool intra_slice;    

} slice_header_t;

/// Sequence extension structure

typedef struct sequence_ext_t

{

t_bool is_present;

t_ui8 profile_and_level_indication;

t_bool progressive_sequence;

t_ui8 chroma_format;

t_ui8 horizontal_size_extension;

t_ui8 vertical_size_extension;

t_ui16 bit_rate_extension;

t_ui8 vbv_buffer_size_extension;

t_bool low_delay;

t_ui8 frame_rate_extension_n;

t_ui8 frame_rate_extension_d;

} sequence_ext_t;