]> git.sesse.net Git - vlc/blob - include/vpar_blocks.h
Encore un commit venu tout droit des abysses de l'enfer, d�sol� pour
[vlc] / include / vpar_blocks.h
1 /*****************************************************************************
2  * vpar_blocks.h : video parser blocks management
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  *
6  * Authors:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with this program; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Requires:
26  *  "config.h"
27  *  "common.h"
28  *  "mtime.h"
29  *  "threads.h"
30  *  "input.h"
31  *  "video.h"
32  *  "video_output.h"
33  *  "decoder_fifo.h"
34  *  "video_fifo.h"
35  *****************************************************************************/
36
37 /*****************************************************************************
38  * macroblock_t : information on a macroblock passed to the video_decoder
39  *                thread
40  *****************************************************************************/
41 typedef struct macroblock_s
42 {
43     picture_t *             p_picture;          /* current frame in progress */
44
45     int                     i_mb_type;                    /* macroblock type */
46     int                     i_coded_block_pattern;
47                                                  /* which blocks are coded ? */
48     int                     i_chroma_nb_blocks;         /* number of blocks for
49                                                          * chroma components */
50
51     /* IDCT information */
52     dctelem_t               ppi_blocks[12][64];                    /* blocks */
53     f_idct_t                pf_idct[12];             /* sparse IDCT or not ? */
54     int                     pi_sparse_pos[12];             /* position of the
55                                                             * non-NULL coeff */
56
57     /* Motion compensation information */
58     f_motion_t              pf_motion;    /* function to use for motion comp */
59     picture_t *             p_backward;          /* backward reference frame */
60     picture_t *             p_forward;            /* forward reference frame */
61     int                     ppi_field_select[2][2];      /* field to use to
62                                                           * form predictions */
63     int                     pppi_motion_vectors[2][2][2];  /* motion vectors */
64     int                     ppi_dmv[2][2];    /* differential motion vectors */
65                             /* coordinates of the block in the picture */
66     int                     i_l_x, i_c_x;
67     int                     i_motion_l_y;
68     int                     i_motion_c_y;
69     int                     i_l_stride;         /* number of yuv_data_t to
70                                                  * ignore when changing line */
71     int                     i_c_stride;                  /* idem, for chroma */
72     boolean_t               b_P_second;  /* Second field of a P picture ?
73                                           * (used to determine the predicting
74                                           * frame)                           */
75     boolean_t               b_motion_field;  /* Field we are predicting
76                                               * (top field or bottom field) */
77
78     /* AddBlock information */
79     yuv_data_t *            p_data[12];              /* pointer to the position
80                                                       * in the final picture */
81     int                     i_addb_l_stride, i_addb_c_stride;
82                                  /* nb of coeffs to jump when changing lines */
83 } macroblock_t;
84
85 /*****************************************************************************
86  * macroblock_parsing_t : macroblock context & predictors
87  *****************************************************************************/
88 typedef struct
89 {
90     unsigned char       i_quantizer_scale;        /* scale of the quantization
91                                                    * matrices                */
92     int                 pi_dc_dct_pred[3];          /* ISO/IEC 13818-2 7.2.1 */
93     int                 pppi_pmv[2][2][2];  /* Motion vect predictors, 7.6.3 */
94
95     /* Context used to optimize block parsing */
96     int                 i_motion_type, i_mv_count, i_mv_format;
97     boolean_t           b_dmv, b_dct_type;
98
99     /* Coordinates of the upper-left pixel of the macroblock, in lum and
100      * chroma */
101     int                 i_l_x, i_l_y, i_c_x, i_c_y;
102 } macroblock_parsing_t;
103
104 /*****************************************************************************
105  * lookup_t : entry type for lookup tables                                   *
106  *****************************************************************************/
107 typedef struct lookup_s
108 {
109     int    i_value;
110     int    i_length;
111 } lookup_t;
112
113 /*****************************************************************************
114  * ac_lookup_t : special entry type for lookup tables about ac coefficients
115  *****************************************************************************/
116 typedef struct dct_lookup_s
117 {
118     char   i_run;
119     char   i_level;
120     char   i_length;
121 } dct_lookup_t;
122
123 /*****************************************************************************
124  * Standard codes
125  *****************************************************************************/
126 /* Macroblock types */
127 #define MB_INTRA                        1
128 #define MB_PATTERN                      2
129 #define MB_MOTION_BACKWARD              4
130 #define MB_MOTION_FORWARD               8
131 #define MB_QUANT                        16
132
133 /* Motion types */
134 #define MOTION_FIELD                    1
135 #define MOTION_FRAME                    2
136 #define MOTION_16X8                     2
137 #define MOTION_DMV                      3
138
139 /* Macroblock Address Increment types */
140 #define MB_ADDRINC_ESCAPE               8
141 #define MB_ADDRINC_STUFFING             15
142
143 /* Error constant for lookup tables */
144 #define MB_ERROR                        (-1)
145
146 /* Scan */
147 #define SCAN_ZIGZAG                     0
148 #define SCAN_ALT                        1
149
150 /* Constant for block decoding */
151 #define DCT_EOB                         64
152 #define DCT_ESCAPE                      65
153
154 /*****************************************************************************
155  * Constants
156  *****************************************************************************/
157 extern int      pi_default_intra_quant[];
158 extern int      pi_default_nonintra_quant[];
159 extern u8       pi_scan[2][64];
160
161 /*****************************************************************************
162  * Prototypes
163  *****************************************************************************/
164 void vpar_InitCrop( struct vpar_thread_s* p_vpar );
165 void vpar_InitMbAddrInc( struct vpar_thread_s * p_vpar );
166 void vpar_InitPMBType( struct vpar_thread_s * p_vpar );
167 void vpar_InitBMBType( struct vpar_thread_s * p_vpar );
168 void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar );
169 void vpar_InitDCTTables( struct vpar_thread_s * p_vpar );
170 void vpar_PictureDataGENERIC( struct vpar_thread_s * p_vpar, int i_mb_base );
171 #if (VPAR_OPTIM_LEVEL > 0)
172 void vpar_PictureData2I420F0( struct vpar_thread_s * p_vpar, int i_mb_base );
173 void vpar_PictureData2P420F0( struct vpar_thread_s * p_vpar, int i_mb_base );
174 void vpar_PictureData2B420F0( struct vpar_thread_s * p_vpar, int i_mb_base );
175 #endif
176 #if (VPAR_OPTIM_LEVEL > 1)
177 void vpar_PictureData2I420TZ( struct vpar_thread_s * p_vpar, int i_mb_base );
178 void vpar_PictureData2P420TZ( struct vpar_thread_s * p_vpar, int i_mb_base );
179 void vpar_PictureData2B420TZ( struct vpar_thread_s * p_vpar, int i_mb_base );
180 void vpar_PictureData2I420BZ( struct vpar_thread_s * p_vpar, int i_mb_base );
181 void vpar_PictureData2P420BZ( struct vpar_thread_s * p_vpar, int i_mb_base );
182 void vpar_PictureData2B420BZ( struct vpar_thread_s * p_vpar, int i_mb_base );
183 #endif