xine-lib 1.2.11
mpeg2_internal.h
Go to the documentation of this file.
1/*
2 * mpeg2_internal.h
3 * Copyright (C) 2000-2002 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23
24#ifndef MPEG2_INTERNAL_H
25#define MPEG2_INTERNAL_H
26
27#include <xine/video_out.h>
28#include "accel_xvmc.h"
29
30#ifdef ENABLE_ALTIVEC
31#include <altivec.h>
32#endif
33
34/* macroblock modes */
35#define MACROBLOCK_INTRA XINE_MACROBLOCK_INTRA
36#define MACROBLOCK_PATTERN XINE_MACROBLOCK_PATTERN
37#define MACROBLOCK_MOTION_BACKWARD XINE_MACROBLOCK_MOTION_BACKWARD
38#define MACROBLOCK_MOTION_FORWARD XINE_MACROBLOCK_MOTION_FORWARD
39#define MACROBLOCK_QUANT XINE_MACROBLOCK_QUANT
40#define DCT_TYPE_INTERLACED XINE_MACROBLOCK_DCT_TYPE_INTERLACED
41
42/* motion_type */
43#define MOTION_TYPE_MASK (3*64)
44#define MOTION_TYPE_BASE 64
45#define MC_FIELD (1*64)
46#define MC_FRAME (2*64)
47#define MC_16X8 (2*64)
48#define MC_DMV (3*64)
49
50/* picture structure */
51#define TOP_FIELD VO_TOP_FIELD
52#define BOTTOM_FIELD VO_BOTTOM_FIELD
53#define FRAME_PICTURE VO_BOTH_FIELDS
54
55/* picture coding type (mpeg2 header) */
56#define I_TYPE 1
57#define P_TYPE 2
58#define B_TYPE 3
59#define D_TYPE 4
60
61typedef struct motion_s {
62 uint8_t * ref[2][3];
63 uint8_t ** ref2[2];
64 int pmv[2][2];
65 int f_code[2];
67
68typedef struct picture_s {
69 /* first, state that carries information from one macroblock to the */
70 /* next inside a slice, and is never used outside of mpeg2_slice() */
71
72 /* DCT coefficients - should be kept aligned ! */
73 int16_t DCTblock[64];
74
75 /* XvMC DCT block and macroblock data for XvMC acceleration */
79 int XvMC_x;
80 int XvMC_y;
85
86 /* bit parsing stuff */
87 uint32_t bitstream_buf; /* current 32 bit working set of buffer */
88 int bitstream_bits; /* used bits in working set */
89 uint8_t * bitstream_ptr; /* buffer with stream data */
90
91 uint8_t * dest[3];
92 int pitches[3];
93 int offset;
94 unsigned int limit_x;
95 unsigned int limit_y_16;
96 unsigned int limit_y_8;
97 unsigned int limit_y;
98
99 /* Motion vectors */
100 /* The f_ and b_ correspond to the forward and backward motion */
101 /* predictors */
104
105 /* predictor for DC coefficients in intra blocks */
106 int16_t dc_dct_pred[3];
107
108 int quantizer_scale; /* remove */
109 int current_field; /* remove */
110 int dmv_offset; /* remove */
111 unsigned int v_offset; /* remove */
112
113
114 /* now non-slice-specific information */
115
116 /* sequence header stuff */
121
122 /* The width and height of the picture snapped to macroblock units */
125
126 /* The width and height as it appears on header sequence */
128
129 /* picture header stuff */
130
131 /* what type of picture this is (I, P, B, D) */
133
136
137 /* picture coding extension stuff */
138
139 /* quantization factor for intra dc coefficients */
141 /* top/bottom/both fields */
143 /* bool to indicate all predictions are frame based */
145 /* bool to indicate whether intra blocks have motion vectors */
146 /* (for concealment) */
148 /* bit to indicate which quantization table to use */
150 /* bool to use different vlc tables */
152 /* used for DMV MC */
154
155 /* stuff derived from bitstream */
156
157 /* pointer to the zigzag scan we're supposed to be using */
158 uint8_t * scan;
159
163
165
167
168 int mpeg1;
169
171
172 /* these things are not needed by the decoder */
173 /* this is a temporary interface, we will build a better one later. */
182 uint32_t video_format;
194 uint32_t closed_gop;
195 uint32_t broken_link;
196
200
202
203typedef struct cpu_state_s {
204#ifdef ARCH_PPC
205 uint8_t regv[12*16];
206#endif
207 int dummy;
209
210/* cpu_state.c */
211extern void (* mpeg2_cpu_state_save) (cpu_state_t * state);
212extern void (* mpeg2_cpu_state_restore) (cpu_state_t * state);
213void mpeg2_cpu_state_init (uint32_t mm_accel);
214
215/* header.c */
216extern uint8_t mpeg2_scan_norm[64];
217extern uint8_t mpeg2_scan_alt[64];
218void mpeg2_header_state_init (picture_t * picture);
219int mpeg2_header_picture (picture_t * picture, uint8_t * buffer);
220int mpeg2_header_sequence (picture_t * picture, uint8_t * buffer);
221int mpeg2_header_extension (picture_t * picture, uint8_t * buffer);
222int mpeg2_header_group_of_pictures (picture_t * picture, uint8_t * buffer);
223
224/* idct.c */
225extern void (* mpeg2_idct_copy) (int16_t * block, uint8_t * dest, int stride);
226extern void (* mpeg2_idct_add) (int16_t * block, uint8_t * dest, int stride);
227extern void (* mpeg2_idct) (int16_t * block);
228extern void (* mpeg2_zero_block) (int16_t * block);
229void mpeg2_idct_init (uint32_t mm_accel);
230
231/* idct_mlib.c */
232void mpeg2_idct_add_mlib (int16_t * block, uint8_t * dest, int stride);
233void mpeg2_idct_copy_mlib_non_ieee (int16_t * block, uint8_t * dest,
234 int stride);
235void mpeg2_idct_add_mlib_non_ieee (int16_t * block, uint8_t * dest,
236 int stride);
237void mpeg2_idct_mlib (int16_t * block);
238
239/* idct_mmx.c */
240void mpeg2_idct_copy_mmxext (int16_t * block, uint8_t * dest, int stride);
241void mpeg2_idct_add_mmxext (int16_t * block, uint8_t * dest, int stride);
242void mpeg2_idct_mmxext (int16_t * block);
243void mpeg2_idct_copy_mmx (int16_t * block, uint8_t * dest, int stride);
244void mpeg2_idct_add_mmx (int16_t * block, uint8_t * dest, int stride);
245void mpeg2_idct_mmx (int16_t * block);
246void mpeg2_zero_block_mmx (int16_t * block);
248
249/* idct_altivec.c */
250# ifdef ENABLE_ALTIVEC
251void mpeg2_idct_copy_altivec (vector signed short * block, unsigned char * dest,
252 int stride);
253void mpeg2_idct_add_altivec (vector signed short * block, unsigned char * dest,
254 int stride);
255# else /* ! ENABLE_ALTIVEC */
256void mpeg2_idct_copy_altivec (signed short * block, unsigned char * dest,
257 int stride);
258void mpeg2_idct_add_altivec (signed short * block, unsigned char * dest,
259 int stride);
260# endif /* ENABLE_ALTIVEC */
262
263/* motion_comp.c */
264void mpeg2_mc_init (uint32_t mm_accel);
265
266typedef struct mpeg2_mc_s {
267 void (* put [8]) (uint8_t * dst, uint8_t *, int32_t, int32_t);
268 void (* avg [8]) (uint8_t * dst, uint8_t *, int32_t, int32_t);
270
271#define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \
272 {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \
273 MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \
274 {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \
275 MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \
276};
277
278extern mpeg2_mc_t mpeg2_mc;
286
287/* slice.c */
288void mpeg2_slice (picture_t * picture, int code, uint8_t * buffer);
289
290/* stats.c */
291void mpeg2_stats (int code, uint8_t * buffer);
292
293
294#endif
void mpeg2_idct_mmxext(int16_t *block)
void mpeg2_idct_add_altivec(signed short *block, unsigned char *dest, int stride)
void mpeg2_cpu_state_init(uint32_t mm_accel)
Definition: cpu_state.c:171
mpeg2_mc_t mpeg2_mc_mmx
void mpeg2_idct_mlib(int16_t *block)
struct mpeg2_mc_s mpeg2_mc_t
mpeg2_mc_t mpeg2_mc_mmxext
void(* mpeg2_idct_add)(int16_t *block, uint8_t *dest, int stride)
Definition: idct.c:60
mpeg2_mc_t mpeg2_mc_mlib
void mpeg2_idct_add_mmx(int16_t *block, uint8_t *dest, int stride)
mpeg2_mc_t mpeg2_mc_altivec
mpeg2_mc_t mpeg2_mc_vis
void mpeg2_idct_altivec_init(void)
void(* mpeg2_cpu_state_restore)(cpu_state_t *state)
Definition: cpu_state.c:34
void(* mpeg2_cpu_state_save)(cpu_state_t *state)
Definition: cpu_state.c:33
struct picture_s picture_t
void mpeg2_zero_block_mmx(int16_t *block)
void mpeg2_slice(picture_t *picture, int code, uint8_t *buffer)
Definition: slice.c:1623
uint8_t mpeg2_scan_alt[64]
Definition: header.c:68
void(* mpeg2_idct_copy)(int16_t *block, uint8_t *dest, int stride)
Definition: idct.c:59
int mpeg2_header_picture(picture_t *picture, uint8_t *buffer)
Definition: header.c:400
void mpeg2_mc_init(uint32_t mm_accel)
Definition: motion_comp.c:34
void(* mpeg2_zero_block)(int16_t *block)
Definition: idct.c:62
void mpeg2_header_state_init(picture_t *picture)
Definition: header.c:112
int mpeg2_header_sequence(picture_t *picture, uint8_t *buffer)
Definition: header.c:119
void mpeg2_stats(int code, uint8_t *buffer)
Definition: stats.c:270
void mpeg2_idct_add_mmxext(int16_t *block, uint8_t *dest, int stride)
void mpeg2_idct_add_mlib_non_ieee(int16_t *block, uint8_t *dest, int stride)
mpeg2_mc_t mpeg2_mc
Definition: motion_comp.c:32
void mpeg2_idct_mmx(int16_t *block)
void mpeg2_idct_copy_altivec(signed short *block, unsigned char *dest, int stride)
int mpeg2_header_group_of_pictures(picture_t *picture, uint8_t *buffer)
Definition: header.c:371
int mpeg2_header_extension(picture_t *picture, uint8_t *buffer)
Definition: header.c:316
void mpeg2_idct_add_mlib(int16_t *block, uint8_t *dest, int stride)
void mpeg2_idct_copy_mmx(int16_t *block, uint8_t *dest, int stride)
uint8_t mpeg2_scan_norm[64]
Definition: header.c:55
void mpeg2_idct_copy_mmxext(int16_t *block, uint8_t *dest, int stride)
struct motion_s motion_t
void(* mpeg2_idct)(int16_t *block)
Definition: idct.c:61
void mpeg2_idct_init(uint32_t mm_accel)
Definition: idct.c:281
void mpeg2_idct_copy_mlib_non_ieee(int16_t *block, uint8_t *dest, int stride)
mpeg2_mc_t mpeg2_mc_c
Definition: motion_comp.c:145
mpeg2_mc_t mpeg2_mc_3dnow
void mpeg2_idct_mmx_init(void)
struct cpu_state_s cpu_state_t
Definition: mpeg2_internal.h:203
int dummy
Definition: mpeg2_internal.h:207
Definition: mpeg2_internal.h:221
Definition: mpeg2_internal.h:61
uint8_t * ref[2][3]
Definition: mpeg2_internal.h:62
uint8_t ** ref2[2]
Definition: mpeg2_internal.h:63
int f_code[2]
Definition: mpeg2_internal.h:65
int pmv[2][2]
Definition: mpeg2_internal.h:64
Definition: mpeg2_internal.h:53
Definition: mpeg2_internal.h:266
void(* avg[8])(uint8_t *dst, uint8_t *, int32_t, int32_t)
Definition: mpeg2_internal.h:268
void(* put[8])(uint8_t *dst, uint8_t *, int32_t, int32_t)
Definition: mpeg2_internal.h:267
Definition: mpeg2_internal.h:284
Definition: mpeg2_internal.h:68
int16_t dc_dct_pred[3]
Definition: mpeg2_internal.h:106
int quantizer_scale
Definition: mpeg2_internal.h:108
uint32_t time_code_seconds
Definition: mpeg2_internal.h:192
unsigned int v_offset
Definition: mpeg2_internal.h:111
int vbv_delay
Definition: mpeg2_internal.h:134
int XvMC_mb_type
Definition: mpeg2_internal.h:77
uint32_t colour_primatives
Definition: mpeg2_internal.h:184
int low_delay
Definition: mpeg2_internal.h:135
motion_t f_motion
Definition: mpeg2_internal.h:103
int XvMC_mv_field_sel[2][2]
Definition: mpeg2_internal.h:78
uint8_t * dest[3]
Definition: mpeg2_internal.h:91
int bitstream_bits
Definition: mpeg2_internal.h:88
uint32_t time_code_hours
Definition: mpeg2_internal.h:190
int second_field
Definition: mpeg2_internal.h:166
uint32_t transfer_characteristics
Definition: mpeg2_internal.h:185
unsigned int limit_y
Definition: mpeg2_internal.h:97
uint32_t time_code_pictures
Definition: mpeg2_internal.h:193
int frame_rate_ext_n
Definition: mpeg2_internal.h:198
int frame_rate_ext_d
Definition: mpeg2_internal.h:199
int concealment_motion_vectors
Definition: mpeg2_internal.h:147
uint32_t colour_description
Definition: mpeg2_internal.h:183
uint32_t video_format
Definition: mpeg2_internal.h:182
unsigned int display_height
Definition: mpeg2_internal.h:127
int intra_vlc_format
Definition: mpeg2_internal.h:151
int XvMC_dmvector[2]
Definition: mpeg2_internal.h:82
int frame_rate_code
Definition: mpeg2_internal.h:176
uint8_t * bitstream_ptr
Definition: mpeg2_internal.h:89
uint32_t display_vertical_size
Definition: mpeg2_internal.h:188
uint8_t non_intra_quantizer_matrix[64]
Definition: mpeg2_internal.h:118
uint8_t * scan
Definition: mpeg2_internal.h:158
uint32_t matrix_coefficients
Definition: mpeg2_internal.h:186
motion_t b_motion
Definition: mpeg2_internal.h:102
int coded_picture_height
Definition: mpeg2_internal.h:124
int aspect_ratio_information
Definition: mpeg2_internal.h:174
uint32_t closed_gop
Definition: mpeg2_internal.h:194
int frame_height
Definition: mpeg2_internal.h:164
int bitrate
Definition: mpeg2_internal.h:197
int pitches[3]
Definition: mpeg2_internal.h:92
int progressive_frame
Definition: mpeg2_internal.h:179
unsigned int limit_x
Definition: mpeg2_internal.h:94
int progressive_sequence
Definition: mpeg2_internal.h:177
int XvMC_cbp
Definition: mpeg2_internal.h:83
uint32_t broken_link
Definition: mpeg2_internal.h:195
uint8_t intra_quantizer_matrix[64]
Definition: mpeg2_internal.h:117
int XvMC_dct_type
Definition: mpeg2_internal.h:84
int intra_dc_precision
Definition: mpeg2_internal.h:140
int q_scale_type
Definition: mpeg2_internal.h:149
int mpeg1
Definition: mpeg2_internal.h:168
int load_non_intra_quantizer_matrix
Definition: mpeg2_internal.h:120
int repeat_first_field
Definition: mpeg2_internal.h:178
int32_t frame_centre_vertical_offset
Definition: mpeg2_internal.h:181
int skip_non_intra_dct
Definition: mpeg2_internal.h:170
int picture_structure
Definition: mpeg2_internal.h:142
int XvMC_x
Definition: mpeg2_internal.h:79
uint32_t drop_frame_flag
Definition: mpeg2_internal.h:189
uint32_t time_code_minutes
Definition: mpeg2_internal.h:191
int current_field
Definition: mpeg2_internal.h:109
unsigned int limit_y_8
Definition: mpeg2_internal.h:96
unsigned int limit_y_16
Definition: mpeg2_internal.h:95
xine_macroblocks_t * mc
Definition: mpeg2_internal.h:76
struct vo_frame_s * backward_reference_frame
Definition: mpeg2_internal.h:162
int picture_coding_type
Definition: mpeg2_internal.h:132
int coded_picture_width
Definition: mpeg2_internal.h:123
uint32_t display_horizontal_size
Definition: mpeg2_internal.h:187
int frame_pred_frame_dct
Definition: mpeg2_internal.h:144
int frame_width
Definition: mpeg2_internal.h:164
int offset
Definition: mpeg2_internal.h:93
int32_t frame_centre_horizontal_offset
Definition: mpeg2_internal.h:180
int saved_aspect_ratio
Definition: mpeg2_internal.h:175
struct vo_frame_s * current_frame
Definition: mpeg2_internal.h:160
int16_t DCTblock[64]
Definition: mpeg2_internal.h:73
uint32_t bitstream_buf
Definition: mpeg2_internal.h:87
int XvMC_y
Definition: mpeg2_internal.h:80
int dmv_offset
Definition: mpeg2_internal.h:110
int XvMC_motion_type
Definition: mpeg2_internal.h:81
struct vo_frame_s * forward_reference_frame
Definition: mpeg2_internal.h:161
int load_intra_quantizer_matrix
Definition: mpeg2_internal.h:119
int top_field_first
Definition: mpeg2_internal.h:153
unsigned int display_width
Definition: mpeg2_internal.h:127
Definition: vdpau_mpeg12.c:113
Definition: video_out.h:59
Definition: accel_xvmc.h:34
char code
Definition: xmllexer.c:606