Mercurial > mplayer.hg
annotate libmpeg2/mpeg2_internal.h @ 27292:80ee781f6528
Remove unnecessary and troublesome inline
author | zuxy |
---|---|
date | Fri, 18 Jul 2008 08:26:26 +0000 |
parents | 2506f1b0bdbe |
children | fd18fa10de53 |
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 * |
21526 | 23 * Modified for use with MPlayer, see libmpeg-0.4.1.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 | |
36 | 28 /* macroblock modes */ |
1 | 29 #define MACROBLOCK_INTRA 1 |
30 #define MACROBLOCK_PATTERN 2 | |
31 #define MACROBLOCK_MOTION_BACKWARD 4 | |
32 #define MACROBLOCK_MOTION_FORWARD 8 | |
33 #define MACROBLOCK_QUANT 16 | |
34 #define DCT_TYPE_INTERLACED 32 | |
36 | 35 /* motion_type */ |
12932 | 36 #define MOTION_TYPE_SHIFT 6 |
37 #define MC_FIELD 1 | |
38 #define MC_FRAME 2 | |
39 #define MC_16X8 2 | |
40 #define MC_DMV 3 | |
1 | 41 |
36 | 42 /* picture structure */ |
1 | 43 #define TOP_FIELD 1 |
44 #define BOTTOM_FIELD 2 | |
45 #define FRAME_PICTURE 3 | |
46 | |
36 | 47 /* picture coding type */ |
1 | 48 #define I_TYPE 1 |
49 #define P_TYPE 2 | |
50 #define B_TYPE 3 | |
51 #define D_TYPE 4 | |
52 | |
12932 | 53 typedef void mpeg2_mc_fct (uint8_t *, const uint8_t *, int, int); |
54 | |
9852 | 55 typedef struct { |
1 | 56 uint8_t * ref[2][3]; |
9852 | 57 uint8_t ** ref2[2]; |
1 | 58 int pmv[2][2]; |
59 int f_code[2]; | |
60 } motion_t; | |
61 | |
12932 | 62 typedef void motion_parser_t (mpeg2_decoder_t * decoder, |
63 motion_t * motion, | |
64 mpeg2_mc_fct * const * table); | |
65 | |
66 struct mpeg2_decoder_s { | |
36 | 67 /* first, state that carries information from one macroblock to the */ |
9852 | 68 /* next inside a slice, and is never used outside of mpeg2_slice() */ |
36 | 69 |
70 /* bit parsing stuff */ | |
9852 | 71 uint32_t bitstream_buf; /* current 32 bit working set */ |
72 int bitstream_bits; /* used bits in working set */ | |
73 const uint8_t * bitstream_ptr; /* buffer with stream data */ | |
74 | |
75 uint8_t * dest[3]; | |
76 | |
77 int offset; | |
78 int stride; | |
79 int uv_stride; | |
12932 | 80 int slice_stride; |
81 int slice_uv_stride; | |
82 int stride_frame; | |
9852 | 83 unsigned int limit_x; |
84 unsigned int limit_y_16; | |
85 unsigned int limit_y_8; | |
86 unsigned int limit_y; | |
36 | 87 |
88 /* Motion vectors */ | |
89 /* The f_ and b_ correspond to the forward and backward motion */ | |
90 /* predictors */ | |
1 | 91 motion_t b_motion; |
92 motion_t f_motion; | |
12932 | 93 motion_parser_t * motion_parser[5]; |
1 | 94 |
36 | 95 /* predictor for DC coefficients in intra blocks */ |
1 | 96 int16_t dc_dct_pred[3]; |
97 | |
12932 | 98 /* DCT coefficients */ |
99 int16_t DCTblock[64] ATTR_ALIGN(64); | |
100 | |
101 uint8_t * picture_dest[3]; | |
102 void (* convert) (void * convert_id, uint8_t * const * src, | |
103 unsigned int v_offset); | |
104 void * convert_id; | |
105 | |
106 int dmv_offset; | |
107 unsigned int v_offset; | |
36 | 108 |
109 /* now non-slice-specific information */ | |
110 | |
111 /* sequence header stuff */ | |
12932 | 112 uint16_t * quantizer_matrix[4]; |
113 uint16_t (* chroma_quantizer[2])[64]; | |
114 uint16_t quantizer_prescale[4][32][64]; | |
36 | 115 |
116 /* The width and height of the picture snapped to macroblock units */ | |
9852 | 117 int width; |
118 int height; | |
119 int vertical_position_extension; | |
12932 | 120 int chroma_format; |
36 | 121 |
122 /* picture header stuff */ | |
123 | |
124 /* what type of picture this is (I, P, B, D) */ | |
9852 | 125 int coding_type; |
126 | |
36 | 127 /* picture coding extension stuff */ |
9852 | 128 |
36 | 129 /* quantization factor for intra dc coefficients */ |
130 int intra_dc_precision; | |
131 /* top/bottom/both fields */ | |
132 int picture_structure; | |
133 /* bool to indicate all predictions are frame based */ | |
134 int frame_pred_frame_dct; | |
135 /* bool to indicate whether intra blocks have motion vectors */ | |
136 /* (for concealment) */ | |
137 int concealment_motion_vectors; | |
138 /* bool to use different vlc tables */ | |
139 int intra_vlc_format; | |
140 /* used for DMV MC */ | |
141 int top_field_first; | |
142 | |
143 /* stuff derived from bitstream */ | |
144 | |
145 /* pointer to the zigzag scan we're supposed to be using */ | |
9852 | 146 const uint8_t * scan; |
36 | 147 |
148 int second_field; | |
149 | |
150 int mpeg1; | |
12935 | 151 |
13123 | 152 int quantizer_scales[32]; |
12935 | 153 int quantizer_scale; |
154 char* quant_store; | |
155 int quant_stride; | |
9852 | 156 }; |
36 | 157 |
9852 | 158 typedef struct { |
12932 | 159 mpeg2_fbuf_t fbuf; |
9852 | 160 } fbuf_alloc_t; |
161 | |
162 struct mpeg2dec_s { | |
12932 | 163 mpeg2_decoder_t decoder; |
9852 | 164 |
165 mpeg2_info_t info; | |
166 | |
167 uint32_t shift; | |
168 int is_display_initialized; | |
12932 | 169 mpeg2_state_t (* action) (struct mpeg2dec_s * mpeg2dec); |
170 mpeg2_state_t state; | |
9852 | 171 uint32_t ext_state; |
79 | 172 |
9852 | 173 /* allocated in init - gcc has problems allocating such big structures */ |
174 uint8_t * chunk_buffer; | |
175 /* pointer to start of the current chunk */ | |
176 uint8_t * chunk_start; | |
177 /* pointer to current position in chunk_buffer */ | |
178 uint8_t * chunk_ptr; | |
179 /* last start code ? */ | |
180 uint8_t code; | |
181 | |
12932 | 182 /* picture tags */ |
183 uint32_t tag_current, tag2_current, tag_previous, tag2_previous; | |
184 int num_tags; | |
185 int bytes_since_tag; | |
9852 | 186 |
187 int first; | |
188 int alloc_index_user; | |
189 int alloc_index; | |
190 uint8_t first_decode_slice; | |
191 uint8_t nb_decode_slices; | |
192 | |
12932 | 193 unsigned int user_data_len; |
194 | |
195 mpeg2_sequence_t new_sequence; | |
196 mpeg2_sequence_t sequence; | |
197 mpeg2_gop_t new_gop; | |
198 mpeg2_gop_t gop; | |
199 mpeg2_picture_t new_picture; | |
200 mpeg2_picture_t pictures[4]; | |
201 mpeg2_picture_t * picture; | |
202 /*const*/ mpeg2_fbuf_t * fbuf[3]; /* 0: current fbuf, 1-2: prediction fbufs */ | |
9852 | 203 |
204 fbuf_alloc_t fbuf_alloc[3]; | |
205 int custom_fbuf; | |
79 | 206 |
9852 | 207 uint8_t * yuv_buf[3][3]; |
208 int yuv_index; | |
12932 | 209 mpeg2_convert_t * convert; |
210 void * convert_arg; | |
211 unsigned int convert_id_size; | |
212 int convert_stride; | |
213 void (* convert_start) (void * id, const mpeg2_fbuf_t * fbuf, | |
214 const mpeg2_picture_t * picture, | |
215 const mpeg2_gop_t * gop); | |
1 | 216 |
9852 | 217 uint8_t * buf_start; |
218 uint8_t * buf_end; | |
219 | |
220 int16_t display_offset_x, display_offset_y; | |
12932 | 221 |
222 int copy_matrix; | |
223 int8_t q_scale_type, scaled[4]; | |
224 uint8_t quantizer_matrix[4][64]; | |
225 uint8_t new_quantizer_matrix[4][64]; | |
13112 | 226 |
227 unsigned char *pending_buffer; | |
228 int pending_length; | |
9852 | 229 }; |
230 | |
231 typedef struct { | |
232 #ifdef ARCH_PPC | |
233 uint8_t regv[12*16]; | |
234 #endif | |
235 int dummy; | |
236 } cpu_state_t; | |
1 | 237 |
9852 | 238 /* cpu_accel.c */ |
239 uint32_t mpeg2_detect_accel (void); | |
1 | 240 |
9852 | 241 /* cpu_state.c */ |
242 void mpeg2_cpu_state_init (uint32_t accel); | |
1 | 243 |
9852 | 244 /* decode.c */ |
12932 | 245 mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec); |
246 mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec); | |
9852 | 247 |
248 /* header.c */ | |
249 void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec); | |
12932 | 250 void mpeg2_reset_info (mpeg2_info_t * info); |
9852 | 251 int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec); |
252 int mpeg2_header_gop (mpeg2dec_t * mpeg2dec); | |
12932 | 253 mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec); |
9852 | 254 int mpeg2_header_picture (mpeg2dec_t * mpeg2dec); |
255 int mpeg2_header_extension (mpeg2dec_t * mpeg2dec); | |
256 int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec); | |
257 void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec); | |
12932 | 258 void mpeg2_header_gop_finalize (mpeg2dec_t * mpeg2dec); |
259 void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels); | |
260 mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec); | |
261 mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec); | |
262 void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type); | |
1 | 263 |
36 | 264 /* idct.c */ |
9852 | 265 void mpeg2_idct_init (uint32_t accel); |
1 | 266 |
36 | 267 /* idct_mmx.c */ |
26393
2506f1b0bdbe
Backport SSE2-optimized IDCT routines from upstream libmpeg2.
diego
parents:
26284
diff
changeset
|
268 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
|
269 void mpeg2_idct_add_sse2 (int last, int16_t * block, |
2506f1b0bdbe
Backport SSE2-optimized IDCT routines from upstream libmpeg2.
diego
parents:
26284
diff
changeset
|
270 uint8_t * dest, int stride); |
9852 | 271 void mpeg2_idct_copy_mmxext (int16_t * block, uint8_t * dest, int stride); |
272 void mpeg2_idct_add_mmxext (int last, int16_t * block, | |
273 uint8_t * dest, int stride); | |
274 void mpeg2_idct_copy_mmx (int16_t * block, uint8_t * dest, int stride); | |
275 void mpeg2_idct_add_mmx (int last, int16_t * block, | |
276 uint8_t * dest, int stride); | |
277 void mpeg2_idct_mmx_init (void); | |
278 | |
279 /* idct_altivec.c */ | |
280 void mpeg2_idct_copy_altivec (int16_t * block, uint8_t * dest, int stride); | |
281 void mpeg2_idct_add_altivec (int last, int16_t * block, | |
282 uint8_t * dest, int stride); | |
283 void mpeg2_idct_altivec_init (void); | |
284 | |
285 /* idct_alpha.c */ | |
286 void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, int stride); | |
287 void mpeg2_idct_add_mvi (int last, int16_t * block, | |
288 uint8_t * dest, int stride); | |
289 void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, int stride); | |
290 void mpeg2_idct_add_alpha (int last, int16_t * block, | |
291 uint8_t * dest, int stride); | |
12932 | 292 void mpeg2_idct_alpha_init (void); |
1 | 293 |
36 | 294 /* motion_comp.c */ |
9852 | 295 void mpeg2_mc_init (uint32_t accel); |
296 | |
297 typedef struct { | |
298 mpeg2_mc_fct * put [8]; | |
299 mpeg2_mc_fct * avg [8]; | |
300 } mpeg2_mc_t; | |
1 | 301 |
9852 | 302 #define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \ |
303 {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \ | |
304 MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \ | |
305 {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \ | |
306 MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \ | |
1 | 307 }; |
308 | |
9852 | 309 extern mpeg2_mc_t mpeg2_mc_c; |
310 extern mpeg2_mc_t mpeg2_mc_mmx; | |
311 extern mpeg2_mc_t mpeg2_mc_mmxext; | |
312 extern mpeg2_mc_t mpeg2_mc_3dnow; | |
313 extern mpeg2_mc_t mpeg2_mc_altivec; | |
314 extern mpeg2_mc_t mpeg2_mc_alpha; | |
12932 | 315 extern mpeg2_mc_t mpeg2_mc_vis; |
23236
f0ddd02aec27
iWMMXt-accelerated DCT and motion compensation for ARM processors
gpoirier
parents:
21526
diff
changeset
|
316 extern mpeg2_mc_t mpeg2_mc_arm; |
f0ddd02aec27
iWMMXt-accelerated DCT and motion compensation for ARM processors
gpoirier
parents:
21526
diff
changeset
|
317 extern mpeg2_mc_t mpeg2_mc_iwmmxt; |