Mercurial > mplayer.hg
annotate libmpeg2/mpeg2_internal.h @ 31313:b080b729c958
Indentation fix.
author | reimar |
---|---|
date | Sun, 13 Jun 2010 11:38:18 +0000 |
parents | f378c41da83d |
children | 60709ef498be |
rev | line source |
---|---|
1 | 1 /* |
2 * mpeg2_internal.h | |
12932 | 3 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> |
9852 | 4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> |
1 | 5 * |
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | |
9852 | 7 * See http://libmpeg2.sourceforge.net/ for updates. |
1 | 8 * |
9 * mpeg2dec is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * mpeg2dec is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
14732
1385ec491ffb
Mark locally modified files as such to comply more closely with GPL 2a.
diego
parents:
13123
diff
changeset
|
22 * |
27571
fd18fa10de53
libmpeg-0.4.1.diff was renamed to libmpeg2_changes.diff.
diego
parents:
26393
diff
changeset
|
23 * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes. |
18783 | 24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
14732
1385ec491ffb
Mark locally modified files as such to comply more closely with GPL 2a.
diego
parents:
13123
diff
changeset
|
25 * $Id$ |
1 | 26 */ |
27 | |
27572 | 28 #ifndef LIBMPEG2_MPEG2_INTERNAL_H |
29 #define LIBMPEG2_MPEG2_INTERNAL_H | |
30 | |
31 #define STATE_INTERNAL_NORETURN ((mpeg2_state_t)-1) | |
32 | |
36 | 33 /* macroblock modes */ |
1 | 34 #define MACROBLOCK_INTRA 1 |
35 #define MACROBLOCK_PATTERN 2 | |
36 #define MACROBLOCK_MOTION_BACKWARD 4 | |
37 #define MACROBLOCK_MOTION_FORWARD 8 | |
38 #define MACROBLOCK_QUANT 16 | |
39 #define DCT_TYPE_INTERLACED 32 | |
36 | 40 /* motion_type */ |
12932 | 41 #define MOTION_TYPE_SHIFT 6 |
42 #define MC_FIELD 1 | |
43 #define MC_FRAME 2 | |
44 #define MC_16X8 2 | |
45 #define MC_DMV 3 | |
1 | 46 |
36 | 47 /* picture structure */ |
1 | 48 #define TOP_FIELD 1 |
49 #define BOTTOM_FIELD 2 | |
50 #define FRAME_PICTURE 3 | |
51 | |
36 | 52 /* picture coding type */ |
1 | 53 #define I_TYPE 1 |
54 #define P_TYPE 2 | |
55 #define B_TYPE 3 | |
56 #define D_TYPE 4 | |
57 | |
12932 | 58 typedef void mpeg2_mc_fct (uint8_t *, const uint8_t *, int, int); |
59 | |
9852 | 60 typedef struct { |
1 | 61 uint8_t * ref[2][3]; |
9852 | 62 uint8_t ** ref2[2]; |
1 | 63 int pmv[2][2]; |
64 int f_code[2]; | |
65 } motion_t; | |
66 | |
12932 | 67 typedef void motion_parser_t (mpeg2_decoder_t * decoder, |
68 motion_t * motion, | |
69 mpeg2_mc_fct * const * table); | |
70 | |
71 struct mpeg2_decoder_s { | |
36 | 72 /* first, state that carries information from one macroblock to the */ |
9852 | 73 /* next inside a slice, and is never used outside of mpeg2_slice() */ |
36 | 74 |
75 /* bit parsing stuff */ | |
9852 | 76 uint32_t bitstream_buf; /* current 32 bit working set */ |
77 int bitstream_bits; /* used bits in working set */ | |
78 const uint8_t * bitstream_ptr; /* buffer with stream data */ | |
79 | |
80 uint8_t * dest[3]; | |
81 | |
82 int offset; | |
83 int stride; | |
84 int uv_stride; | |
12932 | 85 int slice_stride; |
86 int slice_uv_stride; | |
87 int stride_frame; | |
9852 | 88 unsigned int limit_x; |
89 unsigned int limit_y_16; | |
90 unsigned int limit_y_8; | |
91 unsigned int limit_y; | |
36 | 92 |
93 /* Motion vectors */ | |
94 /* The f_ and b_ correspond to the forward and backward motion */ | |
95 /* predictors */ | |
1 | 96 motion_t b_motion; |
97 motion_t f_motion; | |
12932 | 98 motion_parser_t * motion_parser[5]; |
1 | 99 |
36 | 100 /* predictor for DC coefficients in intra blocks */ |
1 | 101 int16_t dc_dct_pred[3]; |
102 | |
12932 | 103 /* DCT coefficients */ |
104 int16_t DCTblock[64] ATTR_ALIGN(64); | |
105 | |
106 uint8_t * picture_dest[3]; | |
107 void (* convert) (void * convert_id, uint8_t * const * src, | |
108 unsigned int v_offset); | |
109 void * convert_id; | |
110 | |
111 int dmv_offset; | |
112 unsigned int v_offset; | |
36 | 113 |
114 /* now non-slice-specific information */ | |
115 | |
116 /* sequence header stuff */ | |
12932 | 117 uint16_t * quantizer_matrix[4]; |
118 uint16_t (* chroma_quantizer[2])[64]; | |
119 uint16_t quantizer_prescale[4][32][64]; | |
36 | 120 |
121 /* The width and height of the picture snapped to macroblock units */ | |
9852 | 122 int width; |
123 int height; | |
124 int vertical_position_extension; | |
12932 | 125 int chroma_format; |
36 | 126 |
127 /* picture header stuff */ | |
128 | |
129 /* what type of picture this is (I, P, B, D) */ | |
9852 | 130 int coding_type; |
131 | |
36 | 132 /* picture coding extension stuff */ |
9852 | 133 |
36 | 134 /* quantization factor for intra dc coefficients */ |
135 int intra_dc_precision; | |
136 /* top/bottom/both fields */ | |
137 int picture_structure; | |
138 /* bool to indicate all predictions are frame based */ | |
139 int frame_pred_frame_dct; | |
140 /* bool to indicate whether intra blocks have motion vectors */ | |
141 /* (for concealment) */ | |
142 int concealment_motion_vectors; | |
143 /* bool to use different vlc tables */ | |
144 int intra_vlc_format; | |
145 /* used for DMV MC */ | |
146 int top_field_first; | |
147 | |
148 /* stuff derived from bitstream */ | |
149 | |
150 /* pointer to the zigzag scan we're supposed to be using */ | |
9852 | 151 const uint8_t * scan; |
36 | 152 |
153 int second_field; | |
154 | |
155 int mpeg1; | |
12935 | 156 |
27572 | 157 /* XXX: stuff due to xine shit */ |
158 int8_t q_scale_type; | |
9852 | 159 }; |
36 | 160 |
9852 | 161 typedef struct { |
12932 | 162 mpeg2_fbuf_t fbuf; |
9852 | 163 } fbuf_alloc_t; |
164 | |
165 struct mpeg2dec_s { | |
12932 | 166 mpeg2_decoder_t decoder; |
9852 | 167 |
168 mpeg2_info_t info; | |
169 | |
170 uint32_t shift; | |
171 int is_display_initialized; | |
12932 | 172 mpeg2_state_t (* action) (struct mpeg2dec_s * mpeg2dec); |
173 mpeg2_state_t state; | |
9852 | 174 uint32_t ext_state; |
79 | 175 |
9852 | 176 /* allocated in init - gcc has problems allocating such big structures */ |
177 uint8_t * chunk_buffer; | |
178 /* pointer to start of the current chunk */ | |
179 uint8_t * chunk_start; | |
180 /* pointer to current position in chunk_buffer */ | |
181 uint8_t * chunk_ptr; | |
182 /* last start code ? */ | |
183 uint8_t code; | |
184 | |
12932 | 185 /* picture tags */ |
186 uint32_t tag_current, tag2_current, tag_previous, tag2_previous; | |
187 int num_tags; | |
188 int bytes_since_tag; | |
9852 | 189 |
190 int first; | |
191 int alloc_index_user; | |
192 int alloc_index; | |
193 uint8_t first_decode_slice; | |
194 uint8_t nb_decode_slices; | |
195 | |
12932 | 196 unsigned int user_data_len; |
197 | |
198 mpeg2_sequence_t new_sequence; | |
199 mpeg2_sequence_t sequence; | |
200 mpeg2_gop_t new_gop; | |
201 mpeg2_gop_t gop; | |
202 mpeg2_picture_t new_picture; | |
203 mpeg2_picture_t pictures[4]; | |
204 mpeg2_picture_t * picture; | |
205 /*const*/ mpeg2_fbuf_t * fbuf[3]; /* 0: current fbuf, 1-2: prediction fbufs */ | |
9852 | 206 |
207 fbuf_alloc_t fbuf_alloc[3]; | |
208 int custom_fbuf; | |
79 | 209 |
9852 | 210 uint8_t * yuv_buf[3][3]; |
211 int yuv_index; | |
12932 | 212 mpeg2_convert_t * convert; |
213 void * convert_arg; | |
214 unsigned int convert_id_size; | |
215 int convert_stride; | |
216 void (* convert_start) (void * id, const mpeg2_fbuf_t * fbuf, | |
217 const mpeg2_picture_t * picture, | |
218 const mpeg2_gop_t * gop); | |
1 | 219 |
9852 | 220 uint8_t * buf_start; |
221 uint8_t * buf_end; | |
222 | |
223 int16_t display_offset_x, display_offset_y; | |
12932 | 224 |
225 int copy_matrix; | |
27572 | 226 int8_t scaled[4]; /* XXX: MOVED */ |
227 //int8_t q_scale_type, scaled[4]; | |
12932 | 228 uint8_t quantizer_matrix[4][64]; |
229 uint8_t new_quantizer_matrix[4][64]; | |
9852 | 230 }; |
231 | |
232 typedef struct { | |
28290 | 233 #if ARCH_PPC |
9852 | 234 uint8_t regv[12*16]; |
235 #endif | |
236 int dummy; | |
237 } cpu_state_t; | |
1 | 238 |
9852 | 239 /* cpu_accel.c */ |
27572 | 240 uint32_t mpeg2_detect_accel (uint32_t accel); |
1 | 241 |
9852 | 242 /* cpu_state.c */ |
243 void mpeg2_cpu_state_init (uint32_t accel); | |
1 | 244 |
9852 | 245 /* decode.c */ |
12932 | 246 mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec); |
247 mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec); | |
9852 | 248 |
249 /* header.c */ | |
250 void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec); | |
12932 | 251 void mpeg2_reset_info (mpeg2_info_t * info); |
9852 | 252 int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec); |
253 int mpeg2_header_gop (mpeg2dec_t * mpeg2dec); | |
12932 | 254 mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec); |
9852 | 255 int mpeg2_header_picture (mpeg2dec_t * mpeg2dec); |
256 int mpeg2_header_extension (mpeg2dec_t * mpeg2dec); | |
257 int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec); | |
258 void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec); | |
12932 | 259 void mpeg2_header_gop_finalize (mpeg2dec_t * mpeg2dec); |
260 void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels); | |
261 mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec); | |
262 mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec); | |
263 void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type); | |
1 | 264 |
36 | 265 /* idct.c */ |
27572 | 266 extern void mpeg2_idct_init (uint32_t accel); |
267 extern uint8_t mpeg2_scan_norm[64]; | |
268 extern uint8_t mpeg2_scan_alt[64]; | |
1 | 269 |
36 | 270 /* idct_mmx.c */ |
26393
2506f1b0bdbe
Backport SSE2-optimized IDCT routines from upstream libmpeg2.
diego
parents:
26284
diff
changeset
|
271 void mpeg2_idct_copy_sse2 (int16_t * block, uint8_t * dest, int stride); |
2506f1b0bdbe
Backport SSE2-optimized IDCT routines from upstream libmpeg2.
diego
parents:
26284
diff
changeset
|
272 void mpeg2_idct_add_sse2 (int last, int16_t * block, |
2506f1b0bdbe
Backport SSE2-optimized IDCT routines from upstream libmpeg2.
diego
parents:
26284
diff
changeset
|
273 uint8_t * dest, int stride); |
9852 | 274 void mpeg2_idct_copy_mmxext (int16_t * block, uint8_t * dest, int stride); |
275 void mpeg2_idct_add_mmxext (int last, int16_t * block, | |
276 uint8_t * dest, int stride); | |
277 void mpeg2_idct_copy_mmx (int16_t * block, uint8_t * dest, int stride); | |
278 void mpeg2_idct_add_mmx (int last, int16_t * block, | |
279 uint8_t * dest, int stride); | |
280 void mpeg2_idct_mmx_init (void); | |
281 | |
282 /* idct_altivec.c */ | |
283 void mpeg2_idct_copy_altivec (int16_t * block, uint8_t * dest, int stride); | |
284 void mpeg2_idct_add_altivec (int last, int16_t * block, | |
285 uint8_t * dest, int stride); | |
286 void mpeg2_idct_altivec_init (void); | |
287 | |
288 /* idct_alpha.c */ | |
289 void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, int stride); | |
290 void mpeg2_idct_add_mvi (int last, int16_t * block, | |
291 uint8_t * dest, int stride); | |
292 void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, int stride); | |
293 void mpeg2_idct_add_alpha (int last, int16_t * block, | |
294 uint8_t * dest, int stride); | |
12932 | 295 void mpeg2_idct_alpha_init (void); |
1 | 296 |
36 | 297 /* motion_comp.c */ |
9852 | 298 void mpeg2_mc_init (uint32_t accel); |
299 | |
300 typedef struct { | |
301 mpeg2_mc_fct * put [8]; | |
302 mpeg2_mc_fct * avg [8]; | |
303 } mpeg2_mc_t; | |
1 | 304 |
9852 | 305 #define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \ |
306 {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \ | |
307 MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \ | |
308 {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \ | |
309 MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \ | |
1 | 310 }; |
311 | |
9852 | 312 extern mpeg2_mc_t mpeg2_mc_c; |
313 extern mpeg2_mc_t mpeg2_mc_mmx; | |
314 extern mpeg2_mc_t mpeg2_mc_mmxext; | |
315 extern mpeg2_mc_t mpeg2_mc_3dnow; | |
316 extern mpeg2_mc_t mpeg2_mc_altivec; | |
317 extern mpeg2_mc_t mpeg2_mc_alpha; | |
12932 | 318 extern mpeg2_mc_t mpeg2_mc_vis; |
23236
f0ddd02aec27
iWMMXt-accelerated DCT and motion compensation for ARM processors
gpoirier
parents:
21526
diff
changeset
|
319 extern mpeg2_mc_t mpeg2_mc_arm; |
27572 | 320 |
321 #endif /* LIBMPEG2_MPEG2_INTERNAL_H */ |