]> git.sesse.net Git - vlc/blob - include/vpar_blocks.h
Corrections de bugs dans le motion.
[vlc] / include / vpar_blocks.h
1 /*****************************************************************************
2  * vpar_blocks.h : video parser blocks management
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  * macroblock_t : information on a macroblock
20  *****************************************************************************/
21 typedef struct macroblock_s
22 {
23     int                     i_mb_type;                    /* macroblock type */
24     int                     i_structure;
25     int                     i_current_structure;
26     boolean_t               b_P_coding_type;        /* Is it P_CODING_TYPE ? */
27     picture_t *             p_picture;
28     int                     i_l_x, i_l_y;    /* position of macroblock (lum) */
29     int                     i_c_x, i_c_y; /* position of macroblock (chroma) */
30     int                     i_chroma_nb_blocks;  /* nb of bks for a chr comp */
31     int                     i_l_stride;       /* number of yuv_data_t to ignore
32                                                * when changing lines     */
33     int                     i_c_stride;                  /* idem, for chroma */
34     
35     /* IDCT information */
36     dctelem_t               ppi_blocks[12][64];                    /* blocks */
37     f_idct_t                pf_idct[12];             /* sparse IDCT or not ? */
38     int                     pi_sparse_pos[12];
39
40     /* Motion compensation information */
41     f_motion_t              pf_motion;    /* function to use for motion comp */
42     f_chroma_motion_t       pf_chroma_motion;
43     picture_t *             p_backward;
44     picture_t *             p_forward;
45     int                     ppi_field_select[2][2];
46     int                     pppi_motion_vectors[2][2][2];
47     int                     pi_dm_vector[2];
48     int                     i_motion_l_y;
49     int                     i_motion_c_y;
50     boolean_t               b_motion_field;
51   
52     /* AddBlock information */
53     f_addb_t                pf_addb[12];      /* pointer to the Add function */
54     yuv_data_t *            p_data[12];              /* pointer to the position
55                                                       * in the final picture */
56     int                     i_addb_l_stride, i_addb_c_stride;
57 } macroblock_t;
58
59 /*****************************************************************************
60  * macroblock_parsing_t : parser context descriptor #3
61  *****************************************************************************/
62 typedef struct
63 {
64     int                     i_mb_type, i_motion_type, i_mv_count, i_mv_format;
65     boolean_t               b_dmv;
66
67     /* Macroblock Type */
68     int                     i_coded_block_pattern;
69     boolean_t               b_dct_type;
70
71     int                     i_l_x, i_l_y, i_c_x, i_c_y;
72 } macroblock_parsing_t;
73
74 /*****************************************************************************
75  * lookup_t : entry type for lookup tables                                   *
76  *****************************************************************************/
77
78 typedef struct lookup_s
79 {
80     int    i_value;
81     int    i_length;
82 } lookup_t;
83
84 /******************************************************************************
85  * ac_lookup_t : special entry type for lookup tables about ac coefficients
86  *****************************************************************************/ 
87
88 typedef struct dct_lookup_s
89 {
90     char   i_run;
91     char   i_level;
92     char   i_length;
93 } dct_lookup_t;
94
95 /*****************************************************************************
96  * Standard codes
97  *****************************************************************************/
98 /* Macroblock types */
99 #define MB_INTRA                        1
100 #define MB_PATTERN                      2
101 #define MB_MOTION_BACKWARD              4
102 #define MB_MOTION_FORWARD               8
103 #define MB_QUANT                        16
104
105 /* Motion types */
106 #define MOTION_FIELD                    1
107 #define MOTION_FRAME                    2
108 #define MOTION_16X8                     2
109 #define MOTION_DMV                      3
110
111 /* Macroblock Address Increment types */
112 #define MB_ADDRINC_ESCAPE               8
113 #define MB_ADDRINC_STUFFING             15
114
115 /* Error constant for lookup tables */
116 #define MB_ERROR                        (-1)
117
118 /* Scan */
119 #define SCAN_ZIGZAG                         0
120 #define SCAN_ALT                            1
121
122 /* Constant for block decoding */
123 #define DCT_EOB                                 64
124 #define DCT_ESCAPE                              65
125
126 /*****************************************************************************
127  * Constants
128  *****************************************************************************/
129 extern int      pi_default_intra_quant[];
130 extern int      pi_default_nonintra_quant[];
131 extern u8       pi_scan[2][64];
132
133 /*****************************************************************************
134  * Prototypes
135  *****************************************************************************/
136 void vpar_InitCrop( struct vpar_thread_s* p_vpar );
137 void vpar_InitMbAddrInc( struct vpar_thread_s * p_vpar );
138 void vpar_InitPMBType( struct vpar_thread_s * p_vpar );
139 void vpar_InitBMBType( struct vpar_thread_s * p_vpar );
140 void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar );
141 void vpar_InitDCTTables( struct vpar_thread_s * p_vpar );
142 void vpar_ParseMacroblock( struct vpar_thread_s * p_vpar, int * pi_mb_address,
143                            int i_mb_previous, int i_mb_base );
144 int vpar_CodedPattern420( struct vpar_thread_s* p_vpar );
145 int vpar_CodedPattern422( struct vpar_thread_s* p_vpar );
146 int vpar_CodedPattern444( struct vpar_thread_s* p_vpar );
147 int vpar_IMBType( struct vpar_thread_s* p_vpar );
148 int vpar_PMBType( struct vpar_thread_s* p_vpar );
149 int vpar_BMBType( struct vpar_thread_s* p_vpar );
150 int vpar_DMBType( struct vpar_thread_s* p_vpar );