]> git.sesse.net Git - vlc/blob - include/vpar_headers.h
i_aspect_ratio et i_matrix_coefficients pour Ptyx.
[vlc] / include / vpar_headers.h
1 /*****************************************************************************
2  * vpar_headers.h : video parser : headers parsing
3  * (c)1999 VideoLAN
4  *****************************************************************************
5  *****************************************************************************
6  * Requires:
7  *  "config.h"
8  *  "common.h"
9  *  "mtime.h"
10  *  "vlc_thread.h"
11  *  "input.h"
12  *  "video.h"
13  *  "video_output.h"
14  *  "decoder_fifo.h"
15  *  "video_fifo.h"
16  *****************************************************************************/
17  
18 /*****************************************************************************
19  * Function pointers
20  *****************************************************************************/
21 struct vpar_thread_s;
22 struct macroblock_s;
23
24 typedef void    (*f_slice_header_t)( struct vpar_thread_s*, int*, int, u32);
25 typedef int     (*f_chroma_pattern_t)( struct vpar_thread_s* );
26 typedef int     (*f_macroblock_type_t)( struct vpar_thread_s* );
27
28 /*****************************************************************************
29  * quant_matrix_t : Quantization Matrix
30  *****************************************************************************/
31 typedef struct quant_matrix_s
32 {
33     int *       pi_matrix;
34     boolean_t   b_allocated;
35                           /* Has the matrix been allocated by vpar_headers ? */
36 } quant_matrix_t;
37
38 /*****************************************************************************
39  * sequence_t : sequence descriptor
40  *****************************************************************************/
41 typedef struct sequence_s
42 {
43     u32                 i_height, i_width, i_size;
44     u32                 i_mb_height, i_mb_width, i_mb_size;
45     unsigned int        i_aspect_ratio, i_matrix_coefficients;
46     float               r_frame_rate;
47     boolean_t           b_mpeg2;
48     boolean_t           b_progressive;
49     unsigned int        i_scalable_mode;
50     f_slice_header_t    pf_slice_header;
51     quant_matrix_t      intra_quant, nonintra_quant;
52     quant_matrix_t      chroma_intra_quant, chroma_nonintra_quant;
53     void                (*pf_decode_mv)( struct vpar_thread_s *, struct macroblock_s *, int );
54     f_chroma_pattern_t  pf_decode_pattern;
55
56     /* Chromatic information */
57     unsigned int        i_chroma_format;
58     int                 i_chroma_nb_blocks;
59     u32                 i_chroma_width;
60     u32                 i_chroma_mb_width, i_chroma_mb_height;
61
62     /* Parser context */
63     picture_t *         p_forward;
64     picture_t *         p_backward;
65
66     /* Copyright extension */
67     boolean_t               b_copyright_flag;     /* Whether the following
68                                                      information is significant
69                                                      or not. */
70     u8                      i_copyright_id;
71     boolean_t               b_original;
72     u64                     i_copyright_nb;
73 } sequence_t;
74
75 /*****************************************************************************
76  * picture_parsing_t : parser context descriptor
77  *****************************************************************************/
78 typedef struct picture_parsing_s
79 {
80     boolean_t           pb_full_pel_vector[2];
81     int                 i_forward_f_code, i_backward_f_code;
82
83     int                 ppi_f_code[2][2];
84     int                 i_intra_dc_precision;
85     boolean_t           b_frame_pred_frame_dct, b_q_scale_type;
86     boolean_t           b_intra_vlc_format;
87     boolean_t           b_alternate_scan, b_progressive_frame;
88     boolean_t           b_top_field_first, b_concealment_mv;
89     boolean_t           b_repeat_first_field;
90     int                 i_l_stride, i_c_stride;
91
92     /* Used for second field management */
93     int                 i_current_structure;
94
95     picture_t *         p_picture;
96     macroblock_t *      pp_mb[MAX_MB];
97
98     /* Relative to the current field */
99     int                 i_coding_type, i_structure;
100     boolean_t           b_frame_structure;
101     f_macroblock_type_t pf_macroblock_type;
102
103     boolean_t           b_error;
104 } picture_parsing_t;
105
106 /*****************************************************************************
107  * slice_parsing_t : parser context descriptor #2
108  *****************************************************************************/
109 typedef struct slice_parsing_s
110 {
111     unsigned char       i_quantizer_scale;
112     int                 pi_dc_dct_pred[3];          /* ISO/IEC 13818-2 7.2.1 */
113     int                 pppi_pmv[2][2][2];  /* Motion vect predictors, 7.6.3 */
114 } slice_parsing_t;
115
116 /*****************************************************************************
117  * Standard codes
118  *****************************************************************************/
119 #define PICTURE_START_CODE      0x100L
120 #define SLICE_START_CODE_MIN    0x101L
121 #define SLICE_START_CODE_MAX    0x1AFL
122 #define USER_DATA_START_CODE    0x1B2L
123 #define SEQUENCE_HEADER_CODE    0x1B3L
124 #define SEQUENCE_ERROR_CODE     0x1B4L
125 #define EXTENSION_START_CODE    0x1B5L
126 #define SEQUENCE_END_CODE       0x1B7L
127 #define GROUP_START_CODE        0x1B8L
128
129 /* extension start code IDs */
130 #define SEQUENCE_EXTENSION_ID                    1
131 #define SEQUENCE_DISPLAY_EXTENSION_ID            2
132 #define QUANT_MATRIX_EXTENSION_ID                3
133 #define COPYRIGHT_EXTENSION_ID                   4
134 #define SEQUENCE_SCALABLE_EXTENSION_ID           5
135 #define PICTURE_DISPLAY_EXTENSION_ID             7
136 #define PICTURE_CODING_EXTENSION_ID              8
137 #define PICTURE_SPATIAL_SCALABLE_EXTENSION_ID    9
138 #define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID  10
139
140 /* scalable modes */
141 #define SC_NONE     0
142 #define SC_DP       1
143 #define SC_SPAT     2
144 #define SC_SNR      3
145 #define SC_TEMP     4
146
147 /* Pictures types */
148 #define I_CODING_TYPE           1
149 #define P_CODING_TYPE           2
150 #define B_CODING_TYPE           3
151 #define D_CODING_TYPE           4 /* MPEG-1 ONLY */
152 /* other values are reserved */
153
154 /* Structures */
155 #define TOP_FIELD               1
156 #define BOTTOM_FIELD            2
157 #define FRAME_STRUCTURE         3
158
159
160 /*****************************************************************************
161  * Prototypes
162  *****************************************************************************/
163 int vpar_NextSequenceHeader( struct vpar_thread_s * p_vpar );
164 int vpar_ParseHeader( struct vpar_thread_s * p_vpar );