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