annotate libmpeg2/mpeg2_internal.h @ 10187:f4e0b637ffc5

/usr/local/lib/codecs is now the default codecs directory.
author diego
date Sun, 25 May 2003 19:31:21 +0000
parents 15fe3fba5b1d
children d0a8810e155c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * mpeg2_internal.h
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
3 * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
7 * See http://libmpeg2.sourceforge.net/ for updates.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * (at your option) any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
24 /* macroblock modes */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #define MACROBLOCK_INTRA 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #define MACROBLOCK_PATTERN 2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 #define MACROBLOCK_MOTION_BACKWARD 4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #define MACROBLOCK_MOTION_FORWARD 8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #define MACROBLOCK_QUANT 16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #define DCT_TYPE_INTERLACED 32
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
31 /* motion_type */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #define MOTION_TYPE_MASK (3*64)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #define MOTION_TYPE_BASE 64
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 #define MC_FIELD (1*64)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #define MC_FRAME (2*64)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 #define MC_16X8 (2*64)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #define MC_DMV (3*64)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
39 /* picture structure */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #define TOP_FIELD 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 #define BOTTOM_FIELD 2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 #define FRAME_PICTURE 3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
44 /* picture coding type */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #define I_TYPE 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 #define P_TYPE 2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 #define B_TYPE 3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 #define D_TYPE 4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
50 typedef struct {
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 uint8_t * ref[2][3];
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
52 uint8_t ** ref2[2];
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 int pmv[2][2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 int f_code[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 } motion_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
57 struct decoder_s {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
58 /* first, state that carries information from one macroblock to the */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
59 /* next inside a slice, and is never used outside of mpeg2_slice() */
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
60
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
61 /* DCT coefficients - should be kept aligned ! */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
62 int16_t DCTblock[64];
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
63
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
64 /* bit parsing stuff */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
65 uint32_t bitstream_buf; /* current 32 bit working set */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
66 int bitstream_bits; /* used bits in working set */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
67 const uint8_t * bitstream_ptr; /* buffer with stream data */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
68
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
69 uint8_t * dest[3];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
70 uint8_t * picture_dest[3];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
71 void (* convert) (void * fbuf_id, uint8_t * const * src,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
72 unsigned int v_offset);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
73 void * fbuf_id;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
74
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
75 int offset;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
76 int stride;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
77 int uv_stride;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
78 unsigned int limit_x;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
79 unsigned int limit_y_16;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
80 unsigned int limit_y_8;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
81 unsigned int limit_y;
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
82
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
83 /* Motion vectors */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
84 /* The f_ and b_ correspond to the forward and backward motion */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
85 /* predictors */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 motion_t b_motion;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 motion_t f_motion;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
89 /* predictor for DC coefficients in intra blocks */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 int16_t dc_dct_pred[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
92 int quantizer_scale; /* remove */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
93 int dmv_offset; /* remove */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
94 unsigned int v_offset; /* remove */
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
95
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
96 /* now non-slice-specific information */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
97
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
98 /* sequence header stuff */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
99 uint8_t intra_quantizer_matrix [64];
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
100 uint8_t non_intra_quantizer_matrix [64];
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
101
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
102 /* The width and height of the picture snapped to macroblock units */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
103 int width;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
104 int height;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
105 int vertical_position_extension;
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
106
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
107 /* picture header stuff */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
108
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
109 /* what type of picture this is (I, P, B, D) */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
110 int coding_type;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
111
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
112 /* picture coding extension stuff */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
113
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
114 /* quantization factor for intra dc coefficients */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
115 int intra_dc_precision;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
116 /* top/bottom/both fields */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
117 int picture_structure;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
118 /* bool to indicate all predictions are frame based */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
119 int frame_pred_frame_dct;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
120 /* bool to indicate whether intra blocks have motion vectors */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
121 /* (for concealment) */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
122 int concealment_motion_vectors;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
123 /* bit to indicate which quantization table to use */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
124 int q_scale_type;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
125 /* bool to use different vlc tables */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
126 int intra_vlc_format;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
127 /* used for DMV MC */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
128 int top_field_first;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
129
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
130 /* stuff derived from bitstream */
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
131
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
132 /* pointer to the zigzag scan we're supposed to be using */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
133 const uint8_t * scan;
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
134
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
135 int second_field;
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
136
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
137 int mpeg1;
9855
15fe3fba5b1d qscale exporting for postprocess
arpi
parents: 9852
diff changeset
138
15fe3fba5b1d qscale exporting for postprocess
arpi
parents: 9852
diff changeset
139 /* for MPlayer: */
15fe3fba5b1d qscale exporting for postprocess
arpi
parents: 9852
diff changeset
140 char* quant_store;
15fe3fba5b1d qscale exporting for postprocess
arpi
parents: 9852
diff changeset
141 int quant_stride;
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
142 };
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
143
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
144 typedef struct {
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
145 fbuf_t fbuf;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
146 } fbuf_alloc_t;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
147
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
148 struct mpeg2dec_s {
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
149 decoder_t decoder;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
150
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
151 mpeg2_info_t info;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
152
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
153 uint32_t shift;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
154 int is_display_initialized;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
155 int (* action) (struct mpeg2dec_s * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
156 int state;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
157 uint32_t ext_state;
79
b7b038ee3fde backward-frame rendering by slices
arpi_esp
parents: 49
diff changeset
158
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
159 /* allocated in init - gcc has problems allocating such big structures */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
160 uint8_t * chunk_buffer;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
161 /* pointer to start of the current chunk */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
162 uint8_t * chunk_start;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
163 /* pointer to current position in chunk_buffer */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
164 uint8_t * chunk_ptr;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
165 /* last start code ? */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
166 uint8_t code;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
167
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
168 /* PTS */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
169 uint32_t pts_current, pts_previous;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
170 int num_pts;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
171 int bytes_since_pts;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
172
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
173 int first;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
174 int alloc_index_user;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
175 int alloc_index;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
176 uint8_t first_decode_slice;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
177 uint8_t nb_decode_slices;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
178
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
179 sequence_t new_sequence;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
180 sequence_t sequence;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
181 picture_t pictures[4];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
182 picture_t * picture;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
183 /*const*/ fbuf_t * fbuf[3]; /* 0: current fbuf, 1-2: prediction fbufs */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
184
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
185 fbuf_alloc_t fbuf_alloc[3];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
186 int custom_fbuf;
79
b7b038ee3fde backward-frame rendering by slices
arpi_esp
parents: 49
diff changeset
187
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
188 uint8_t * yuv_buf[3][3];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
189 int yuv_index;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
190 void * convert_id;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
191 int convert_size[3];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
192 void (* convert_start) (void * id, uint8_t * const * dest, int flags);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
193 void (* convert_copy) (void * id, uint8_t * const * src,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
194 unsigned int v_offset);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
196 uint8_t * buf_start;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
197 uint8_t * buf_end;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
198
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
199 int16_t display_offset_x, display_offset_y;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
200 };
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
201
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
202 typedef struct {
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
203 #ifdef ARCH_PPC
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
204 uint8_t regv[12*16];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
205 #endif
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
206 int dummy;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
207 } cpu_state_t;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
209 /* alloc.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
210 #define ALLOC_MPEG2DEC 0
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
211 #define ALLOC_CHUNK 1
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
212 #define ALLOC_YUV 2
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
213 #define ALLOC_CONVERT_ID 3
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
214 #define ALLOC_CONVERTED 4
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
215 void * mpeg2_malloc (int size, int reason);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
216 void mpeg2_free (void * buf);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
218 /* cpu_accel.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
219 uint32_t mpeg2_detect_accel (void);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
221 /* cpu_state.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
222 void mpeg2_cpu_state_init (uint32_t accel);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
224 /* decode.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
225 int mpeg2_seek_sequence (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
226 int mpeg2_seek_header (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
227 int mpeg2_parse_header (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
228
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
229 /* header.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
230 void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
231 int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
232 int mpeg2_header_gop (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
233 int mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
234 int mpeg2_header_picture (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
235 int mpeg2_header_extension (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
236 int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
237 void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
238 int mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
239 int mpeg2_header_end (mpeg2dec_t * mpeg2dec);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
240 void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int coding_type);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
242 /* idct.c */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
243 void mpeg2_idct_init (uint32_t accel);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
245 /* idct_mlib.c */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
246 void mpeg2_idct_add_mlib (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
247 uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
248 void mpeg2_idct_copy_mlib_non_ieee (int16_t * block, uint8_t * dest,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
249 int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
250 void mpeg2_idct_add_mlib_non_ieee (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
251 uint8_t * dest, int stride);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
253 /* idct_mmx.c */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
254 void mpeg2_idct_copy_mmxext (int16_t * block, uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
255 void mpeg2_idct_add_mmxext (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
256 uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
257 void mpeg2_idct_copy_mmx (int16_t * block, uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
258 void mpeg2_idct_add_mmx (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
259 uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
260 void mpeg2_idct_mmx_init (void);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
261
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
262 /* idct_altivec.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
263 void mpeg2_idct_copy_altivec (int16_t * block, uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
264 void mpeg2_idct_add_altivec (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
265 uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
266 void mpeg2_idct_altivec_init (void);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
267
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
268 /* idct_alpha.c */
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
269 void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
270 void mpeg2_idct_add_mvi (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
271 uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
272 void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
273 void mpeg2_idct_add_alpha (int last, int16_t * block,
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
274 uint8_t * dest, int stride);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
275 void mpeg2_idct_alpha_init(int no_mvi);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
277 /* motion_comp.c */
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
278 void mpeg2_mc_init (uint32_t accel);
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
279
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
280 typedef void mpeg2_mc_fct (uint8_t *, const uint8_t *, int, int);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
282 typedef struct {
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
283 mpeg2_mc_fct * put [8];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
284 mpeg2_mc_fct * avg [8];
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
285 } mpeg2_mc_t;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
287 #define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
288 {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
289 MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
290 {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
291 MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293
9852
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
294 extern mpeg2_mc_t mpeg2_mc_c;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
295 extern mpeg2_mc_t mpeg2_mc_mmx;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
296 extern mpeg2_mc_t mpeg2_mc_mmxext;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
297 extern mpeg2_mc_t mpeg2_mc_3dnow;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
298 extern mpeg2_mc_t mpeg2_mc_altivec;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
299 extern mpeg2_mc_t mpeg2_mc_alpha;
47984e3f54ce Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents: 7984
diff changeset
300 extern mpeg2_mc_t mpeg2_mc_mlib;