~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/codec/xvmc/mpeg2_internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id$
 
2
 * mpeg2_internal.h
 
3
 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
 
4
 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
 
5
 *
 
6
 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
 
7
 * See http://libmpeg2.sourceforge.net/ for updates.
 
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
 
22
 */
 
23
 
 
24
/* macroblock modes */
 
25
#define MACROBLOCK_INTRA 1
 
26
#define MACROBLOCK_PATTERN 2
 
27
#define MACROBLOCK_MOTION_BACKWARD 4
 
28
#define MACROBLOCK_MOTION_FORWARD 8
 
29
#define MACROBLOCK_QUANT 16
 
30
#define DCT_TYPE_INTERLACED 32
 
31
/* motion_type */
 
32
#define MOTION_TYPE_SHIFT 6
 
33
#define MC_FIELD 1
 
34
#define MC_FRAME 2
 
35
#define MC_16X8 2
 
36
#define MC_DMV 3
 
37
 
 
38
/* picture structure */
 
39
#define TOP_FIELD 1
 
40
#define BOTTOM_FIELD 2
 
41
#define FRAME_PICTURE 3
 
42
 
 
43
/* picture coding type */
 
44
#define I_TYPE 1
 
45
#define P_TYPE 2
 
46
#define B_TYPE 3
 
47
#define D_TYPE 4
 
48
 
 
49
typedef void mpeg2_mc_fct (uint8_t *, const uint8_t *, int, int);
 
50
 
 
51
typedef struct
 
52
{
 
53
    uint8_t * ref[2][3];
 
54
    uint8_t ** ref2[2];
 
55
    int pmv[2][2];
 
56
    int f_code[2];
 
57
} motion_t;
 
58
 
 
59
typedef void motion_parser_t( mpeg2_decoder_t * decoder,
 
60
                              motion_t * motion,
 
61
                             mpeg2_mc_fct * const * table );
 
62
 
 
63
struct mpeg2_decoder_s
 
64
{
 
65
    /* first, state that carries information from one macroblock to the */
 
66
    /* next inside a slice, and is never used outside of mpeg2_slice() */
 
67
 
 
68
    /* bit parsing stuff */
 
69
    uint32_t bitstream_buf;             /* current 32 bit working set */
 
70
    int bitstream_bits;                 /* used bits in working set */
 
71
    const uint8_t * bitstream_ptr;      /* buffer with stream data */
 
72
 
 
73
    uint8_t * dest[3];
 
74
 
 
75
    int offset;
 
76
    int stride;
 
77
    int uv_stride;
 
78
    int slice_stride;
 
79
    int slice_uv_stride;
 
80
    int stride_frame;
 
81
    unsigned int limit_x;
 
82
    unsigned int limit_y_16;
 
83
    unsigned int limit_y_8;
 
84
    unsigned int limit_y;
 
85
 
 
86
    /* Motion vectors */
 
87
    /* The f_ and b_ correspond to the forward and backward motion */
 
88
    /* predictors */
 
89
    motion_t b_motion;
 
90
    motion_t f_motion;
 
91
    motion_parser_t * motion_parser[5];
 
92
 
 
93
    /* predictor for DC coefficients in intra blocks */
 
94
    int16_t dc_dct_pred[3];
 
95
 
 
96
    /* DCT coefficients */
 
97
    int16_t DCTblock[64] ATTR_ALIGN(64);
 
98
 
 
99
    uint8_t * picture_dest[3];
 
100
    void (* convert) (void * convert_id, uint8_t * const * src,
 
101
                      unsigned int v_offset);
 
102
    void * convert_id;
 
103
 
 
104
    int dmv_offset;
 
105
    unsigned int v_offset;
 
106
 
 
107
    /* now non-slice-specific information */
 
108
 
 
109
    /* sequence header stuff */
 
110
    uint16_t * quantizer_matrix[4];
 
111
    uint16_t (* chroma_quantizer[2])[64];
 
112
    uint16_t quantizer_prescale[4][32][64];
 
113
    int load_intra_quantizer_matrix;
 
114
    int load_non_intra_quantizer_matrix;
 
115
 
 
116
    /* The width and height of the picture snapped to macroblock units */
 
117
    int width;
 
118
    int height;
 
119
    int vertical_position_extension;
 
120
    int chroma_format;
 
121
 
 
122
    /* picture header stuff */
 
123
 
 
124
    /* what type of picture this is (I, P, B, D) */
 
125
    int coding_type;
 
126
 
 
127
    /* picture coding extension stuff */
 
128
 
 
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
    /* bit to indicate which quantization table to use */
 
139
    int q_scale_type;
 
140
    /* bool to use different vlc tables */
 
141
    int intra_vlc_format;
 
142
    /* used for DMV MC */
 
143
    int top_field_first;
 
144
 
 
145
    /* stuff derived from bitstream */
 
146
 
 
147
    /* pointer to the zigzag scan we're supposed to be using */
 
148
    const uint8_t * scan;
 
149
 
 
150
    int second_field;
 
151
 
 
152
    int mpeg1;
 
153
 
 
154
    int aspect_ratio_information;
 
155
    int progressive_sequence;
 
156
};
 
157
 
 
158
typedef struct
 
159
{
 
160
    mpeg2_fbuf_t fbuf;
 
161
} fbuf_alloc_t;
 
162
 
 
163
struct mpeg2dec_s
 
164
{
 
165
    mpeg2_decoder_t decoder;
 
166
 
 
167
    mpeg2_info_t info;
 
168
 
 
169
    uint32_t shift;
 
170
    int is_display_initialized;
 
171
    mpeg2_state_t (* action) (struct mpeg2dec_s * mpeg2dec);
 
172
    mpeg2_state_t state;
 
173
    uint32_t ext_state;
 
174
 
 
175
    /* allocated in init - gcc has problems allocating such big structures */
 
176
    uint8_t * chunk_buffer;
 
177
    /* pointer to start of the current chunk */
 
178
    uint8_t * chunk_start;
 
179
    /* pointer to current position in chunk_buffer */
 
180
    uint8_t * chunk_ptr;
 
181
    uint32_t chunk_size;
 
182
    /* last start code ? */
 
183
    uint8_t code;
 
184
    uint8_t prev_code;
 
185
 
 
186
    /* picture tags */
 
187
    uint32_t tag_current, tag2_current, tag_previous, tag2_previous;
 
188
    int num_tags;
 
189
    int bytes_since_tag;
 
190
 
 
191
    int first;
 
192
    int alloc_index_user;
 
193
    int alloc_index;
 
194
    uint8_t first_decode_slice;
 
195
    uint8_t nb_decode_slices;
 
196
 
 
197
    unsigned int user_data_len;
 
198
 
 
199
    mpeg2_sequence_t new_sequence;
 
200
    mpeg2_sequence_t sequence;
 
201
    mpeg2_gop_t new_gop;
 
202
    mpeg2_gop_t gop;
 
203
    mpeg2_picture_t new_picture;
 
204
    mpeg2_picture_t pictures[4];
 
205
    mpeg2_picture_t * picture;
 
206
    /*const*/ mpeg2_fbuf_t * fbuf[3];   /* 0: current fbuf, 1-2: prediction fbufs */
 
207
 
 
208
    fbuf_alloc_t fbuf_alloc[3];
 
209
    int custom_fbuf;
 
210
 
 
211
    uint8_t * yuv_buf[3][3];
 
212
    int yuv_index;
 
213
    mpeg2_convert_t * convert;
 
214
    void * convert_arg;
 
215
    unsigned int convert_id_size;
 
216
    int convert_stride;
 
217
    void (* convert_start) (void * id, const mpeg2_fbuf_t * fbuf,
 
218
                            const mpeg2_picture_t * picture,
 
219
                            const mpeg2_gop_t * gop);
 
220
 
 
221
    uint8_t * buf_start;
 
222
    uint8_t * buf_end;
 
223
 
 
224
    int16_t display_offset_x, display_offset_y;
 
225
 
 
226
    int copy_matrix;
 
227
    int8_t q_scale_type, scaled[4];
 
228
    uint8_t quantizer_matrix[4][64];
 
229
    uint8_t new_quantizer_matrix[4][64];
 
230
 
 
231
    /* a spu decoder for possible closed captions */
 
232
    //spu_decoder_t *cc_dec;
 
233
    int xvmc_last_slice_code;
 
234
    unsigned xxmc_mb_pic_height;
 
235
 
 
236
    void *ptr_forward_ref_picture;
 
237
    void *ptr_backward_ref_picture;
 
238
};
 
239
 
 
240
typedef struct
 
241
{
 
242
#ifdef ARCH_PPC
 
243
    uint8_t regv[12*16];
 
244
#endif
 
245
    int dummy;
 
246
} cpu_state_t;
 
247
 
 
248
/* cpu_accel.c */
 
249
uint32_t mpeg2_detect_accel (void);
 
250
 
 
251
/* cpu_state.c */
 
252
void mpeg2_cpu_state_init (uint32_t accel);
 
253
 
 
254
/* decode.c */
 
255
mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec);
 
256
mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec);
 
257
 
 
258
/* header.c */
 
259
extern uint8_t mpeg2_scan_norm[64];
 
260
extern uint8_t mpeg2_scan_alt[64];
 
261
void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec);
 
262
void mpeg2_reset_info (mpeg2_info_t * info);
 
263
int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec);
 
264
int mpeg2_header_gop (mpeg2dec_t * mpeg2dec);
 
265
mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec);
 
266
int mpeg2_header_picture (mpeg2dec_t * mpeg2dec);
 
267
int mpeg2_header_extension (mpeg2dec_t * mpeg2dec);
 
268
int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);
 
269
void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec);
 
270
void mpeg2_header_gop_finalize (mpeg2dec_t * mpeg2dec);
 
271
void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels);
 
272
mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec);
 
273
mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec);
 
274
void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type);
 
275
 
 
276
/* motion_comp.c */
 
277
void mpeg2_mc_init (uint32_t accel);
 
278
 
 
279
typedef struct {
 
280
    mpeg2_mc_fct * put [8];
 
281
    mpeg2_mc_fct * avg [8];
 
282
} mpeg2_mc_t;
 
283
 
 
284
#define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = {                    \
 
285
    {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \
 
286
     MC_put_o_8_##x,  MC_put_x_8_##x,  MC_put_y_8_##x,  MC_put_xy_8_##x}, \
 
287
    {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \
 
288
     MC_avg_o_8_##x,  MC_avg_x_8_##x,  MC_avg_y_8_##x,  MC_avg_xy_8_##x}  \
 
289
};
 
290
 
 
291
extern mpeg2_mc_t mpeg2_mc_c;
 
292
extern mpeg2_mc_t mpeg2_mc_mmx;
 
293
extern mpeg2_mc_t mpeg2_mc_mmxext;
 
294
extern mpeg2_mc_t mpeg2_mc_3dnow;
 
295
extern mpeg2_mc_t mpeg2_mc_altivec;
 
296
extern mpeg2_mc_t mpeg2_mc_alpha;
 
297
extern mpeg2_mc_t mpeg2_mc_vis;