]> git.sesse.net Git - vlc/blob - include/vpar_headers.h
fb15c3930f9eff70babcbe6d64b3100d8e39d0ed
[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 #ifdef VDEC_SMP
97     macroblock_t *      pp_mb[MAX_MB];
98 #endif
99
100     /* Relative to the current field */
101     int                 i_coding_type, i_structure;
102     boolean_t           b_frame_structure;
103     boolean_t           b_motion_field;
104     f_macroblock_type_t pf_macroblock_type;
105
106     boolean_t           b_error;
107 } picture_parsing_t;
108
109 /*****************************************************************************
110  * slice_parsing_t : parser context descriptor #2
111  *****************************************************************************/
112 typedef struct slice_parsing_s
113 {
114     unsigned char       i_quantizer_scale;
115     int                 pi_dc_dct_pred[3];          /* ISO/IEC 13818-2 7.2.1 */
116     int                 pppi_pmv[2][2][2];  /* Motion vect predictors, 7.6.3 */
117 } slice_parsing_t;
118
119 /*****************************************************************************
120  * Standard codes
121  *****************************************************************************/
122 #define PICTURE_START_CODE      0x100L
123 #define SLICE_START_CODE_MIN    0x101L
124 #define SLICE_START_CODE_MAX    0x1AFL
125 #define USER_DATA_START_CODE    0x1B2L
126 #define SEQUENCE_HEADER_CODE    0x1B3L
127 #define SEQUENCE_ERROR_CODE     0x1B4L
128 #define EXTENSION_START_CODE    0x1B5L
129 #define SEQUENCE_END_CODE       0x1B7L
130 #define GROUP_START_CODE        0x1B8L
131
132 /* extension start code IDs */
133 #define SEQUENCE_EXTENSION_ID                    1
134 #define SEQUENCE_DISPLAY_EXTENSION_ID            2
135 #define QUANT_MATRIX_EXTENSION_ID                3
136 #define COPYRIGHT_EXTENSION_ID                   4
137 #define SEQUENCE_SCALABLE_EXTENSION_ID           5
138 #define PICTURE_DISPLAY_EXTENSION_ID             7
139 #define PICTURE_CODING_EXTENSION_ID              8
140 #define PICTURE_SPATIAL_SCALABLE_EXTENSION_ID    9
141 #define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID  10
142
143 /* scalable modes */
144 #define SC_NONE     0
145 #define SC_DP       1
146 #define SC_SPAT     2
147 #define SC_SNR      3
148 #define SC_TEMP     4
149
150 /* Pictures types */
151 #define I_CODING_TYPE           1
152 #define P_CODING_TYPE           2
153 #define B_CODING_TYPE           3
154 #define D_CODING_TYPE           4 /* MPEG-1 ONLY */
155 /* other values are reserved */
156
157 /* Structures */
158 #define TOP_FIELD               1
159 #define BOTTOM_FIELD            2
160 #define FRAME_STRUCTURE         3
161
162
163 /*****************************************************************************
164  * Prototypes
165  *****************************************************************************/
166 int vpar_NextSequenceHeader( struct vpar_thread_s * p_vpar );
167 int vpar_ParseHeader( struct vpar_thread_s * p_vpar );