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