]> git.sesse.net Git - vlc/blob - include/undec_picture.h
Un bon morceau du parseur.
[vlc] / include / undec_picture.h
1 /*******************************************************************************
2  * undec_picture.h: undecoded pictures type
3  * (c)1999 VideoLAN
4  *******************************************************************************
5  * This header is required by all modules which have to handle pictures. It
6  * includes all common video types and constants.
7  *******************************************************************************
8  * Requires:
9  *  "config.h"
10  *  "common.h"
11  *  "video.h"
12  *******************************************************************************/
13
14 /*******************************************************************************
15  * macroblock_info_t : information on a macroblock
16  *******************************************************************************/
17 typedef struct
18 {
19     int                     i_mb_type;
20     int                     i_motion_type;
21     int                     i_dct_type;
22     (void *)                p_idct_function[12](coeff_t * p_block);
23     
24     int                     ppp_motion_vectors[2][2][2];
25     int                     pi_field_select[2][2];
26 } macroblock_info_t;
27
28 /* Macroblock types */
29 #define MB_INTRA                        1
30 #define MB_PATTERN                      2
31 #define MB_MOTION_BACKWARD              4
32 #define MB_MOTION_FORWARD               8
33 #define MB_QUANT                        16
34
35 /* Motion types */
36 #define MOTION_FIELD                    1
37 #define MOTION_FRAME                    2
38 #define MOTION_16X8                     2
39 #define MOTION_DMV                      3
40
41 /*******************************************************************************
42  * undec_link_t : link to an undecoded picture
43  *******************************************************************************/
44 typedef struct undec_link_s
45 {
46     struct undec_picture_s *    p_undec;
47     picture_t **                pp_frame;
48 } undec_link_t
49
50 /*******************************************************************************
51  * undec_picture_t: undecoded picture
52  *******************************************************************************
53  * Any picture destined to be decoded by a video decoder thread should be 
54  * stored in this structure from it's creation to it's effective display.
55  *******************************************************************************/
56 typedef struct undec_picture_s
57 {
58         /* Picture data */
59     picture_t *                 p_picture;
60
61     int                         i_coding_type;
62     boolean_t                   b_mpeg2;
63     int                         i_mb_height, i_mb_width;
64     int                         i_structure;
65     mtime_t                     i_pts;
66
67     macroblock_info_t *         p_mb_info;
68
69     picture_t *                 p_backward_ref;
70     picture_t *                 p_forward_ref;
71     
72     undec_link_t                pp_referencing_undec[MAX_REFERENCING_UNDEC];
73 } undec_picture_t;
74
75
76 /* Pictures types */
77 #define I_CODING_TYPE           1
78 #define P_CODING_TYPE           2
79 #define B_CODING_TYPE           3
80 #define D_CODING_TYPE           4 /* MPEG-1 ONLY */
81 /* other values are reserved */
82
83 /* Structures */
84 #define TOP_FIRST               1
85 #define BOTTOM_FIRST            2
86 #define FRAME_STRUCTURE         3
87
88 /*******************************************************************************
89  * pel_lookup_table_t : lookup table for pixels
90  *******************************************************************************/
91 #ifdef BIG_PICTURES
92 #   define PEL_P                u32
93 #else
94 #   define PEL_P                u16
95 #endif
96
97 typedef struct pel_lookup_table_s {
98     PEL_P *                     pi_pel;
99
100     /* When the size of the picture changes, this structure is freed, so we
101      * keep a reference count. */
102     int                         i_refcount;
103     vlc_mutex_t                 lock;
104 } pel_lookup_table_t;
105
106 #define LINK_LOOKUP(p_l) \
107     vlc_mutex_lock( (p_l)->lock ); \
108     (p_l)->i_refcount++; \
109     vlc_mutex_unlock( (p_l)->lock );
110
111 #define UNLINK_LOOKUP(p_l) \
112     vlc_mutex_lock( (p_l)->lock ); \
113     (p_l)->i_refcount--; \
114     if( (p_l)->i_refcount <= 0 ) \
115     { \
116         vlc_mutex_unlock( (p_l)->lock ); \
117         free( p_l ); \
118     } \
119     vlc_mutex_unlock( (p_l)->lock );