/[pcsx2_0.9.7]/trunk/pcsx2/IPU/mpeg2lib/Mpeg.h
ViewVC logotype

Annotation of /trunk/pcsx2/IPU/mpeg2lib/Mpeg.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (10 years ago) by william
File MIME type: text/plain
File size: 5122 byte(s)
committing r3113 initial commit again...
1 william 31 /*
2     * Mpeg.h
3     * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
4     * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
5     * Modified by Florin for PCSX2 emu
6     *
7     * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
8     * See http://libmpeg2.sourceforge.net/ for updates.
9     *
10     * mpeg2dec is free software; you can redistribute it and/or modify
11     * it under the terms of the GNU General Public License as published by
12     * the Free Software Foundation; either version 2 of the License, or
13     * (at your option) any later version.
14     *
15     * mpeg2dec is distributed in the hope that it will be useful,
16     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18     * GNU General Public License for more details.
19     *
20     * You should have received a copy of the GNU General Public License
21     * along with this program; if not, write to the Free Software
22     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23     */
24    
25     #ifndef __MPEG_H__
26     #define __MPEG_H__
27    
28     enum macroblock_modes
29     {
30     MACROBLOCK_INTRA = 1,
31     MACROBLOCK_PATTERN = 2,
32     MACROBLOCK_MOTION_BACKWARD = 4,
33     MACROBLOCK_MOTION_FORWARD = 8,
34     MACROBLOCK_QUANT = 16,
35     DCT_TYPE_INTERLACED = 32
36     };
37    
38     enum motion_type
39     {
40     MOTION_TYPE_SHIFT = 6,
41     MOTION_TYPE_MASK = (3*64),
42     MOTION_TYPE_BASE = 64,
43     MC_FIELD = (1*64),
44     MC_FRAME = (2*64),
45     MC_16X8 = (2*64),
46     MC_DMV = (3*64)
47     };
48    
49     /* picture structure */
50     enum picture_structure
51     {
52     TOP_FIELD = 1,
53     BOTTOM_FIELD = 2,
54     FRAME_PICTURE = 3
55     };
56    
57     /* picture coding type */
58     enum picture_coding_type
59     {
60     I_TYPE =1,
61     P_TYPE = 2,
62     B_TYPE = 3,
63     D_TYPE = 4
64     };
65    
66     struct macroblock_8{
67     unsigned char Y[16][16]; //0
68     unsigned char Cb[8][8]; //1
69     unsigned char Cr[8][8]; //2
70     };
71    
72     struct macroblock_16{
73     short Y[16][16]; //0
74     short Cb[8][8]; //1
75     short Cr[8][8]; //2
76     };
77    
78     struct macroblock_rgb32{
79     struct {
80     unsigned char r, g, b, a;
81     } c[16][16];
82     };
83    
84     struct rgb16{
85     unsigned short r:5, g:5, b:5, a:1;
86     };
87    
88     struct macroblock_rgb16{
89     struct rgb16 c[16][16];
90     };
91    
92     struct decoder_t {
93     /* first, state that carries information from one macroblock to the */
94     /* next inside a slice, and is never used outside of mpeg2_slice() */
95    
96     /* DCT coefficients - should be kept aligned ! */
97     s16 DCTblock[64];
98    
99     /* bit parsing stuff */
100     u32 bitstream_buf; /* current 32 bit working set */
101     int bitstream_bits; /* used bits in working set */
102     u8 * bitstream_ptr; /* buffer with stream data; 128 bits buffer */
103    
104     struct macroblock_8 *mb8;
105     struct macroblock_16 *mb16;
106     struct macroblock_rgb32 *rgb32;
107     struct macroblock_rgb16 *rgb16;
108    
109     int stride;
110    
111     /* predictor for DC coefficients in intra blocks */
112     s16 dc_dct_pred[3];
113    
114     int quantizer_scale; /* remove */
115     int dmv_offset; /* remove */
116    
117     /* now non-slice-specific information */
118    
119     /* sequence header stuff */
120     u8 *intra_quantizer_matrix;
121     u8 *non_intra_quantizer_matrix;
122    
123     /* picture header stuff */
124    
125     /* what type of picture this is (I, P, B, D) */
126     int coding_type;
127    
128     /* picture coding extension stuff */
129    
130     /* quantization factor for intra dc coefficients */
131     int intra_dc_precision;
132     /* top/bottom/both fields */
133     int picture_structure;
134     /* bool to indicate all predictions are frame based */
135     int frame_pred_frame_dct;
136     /* bool to indicate whether intra blocks have motion vectors */
137     /* (for concealment) */
138     int concealment_motion_vectors;
139     /* bit to indicate which quantization table to use */
140     int q_scale_type;
141     /* bool to use different vlc tables */
142     int intra_vlc_format;
143     /* used for DMV MC */
144     int top_field_first;
145     // Pseudo Sign Offset
146     int sgn;
147     // Dither Enable
148     int dte;
149     // Output Format
150     int ofm;
151     // Macroblock count
152     int mbc;
153     // Macroblock type
154     int macroblock_modes;
155     // DC Reset
156     int dcr;
157     // Coded block pattern
158     int coded_block_pattern;
159    
160     /* stuff derived from bitstream */
161    
162     /* pointer to the zigzag scan we're supposed to be using */
163     const u8 * scan;
164    
165     int second_field;
166    
167     int mpeg1;
168     };
169    
170     extern void (__fastcall *mpeg2_idct_copy) (s16 * block, u8* dest, int stride);
171     extern void (__fastcall *mpeg2_idct_add) (int last, s16 * block, s16* dest, int stride);
172    
173     #define IDEC 0
174     #define BDEC 1
175    
176     void mpeg2sliceIDEC(void* pdone);
177     void mpeg2_slice(void* pdone);
178     int get_macroblock_address_increment(decoder_t * const decoder);
179     int get_macroblock_modes (decoder_t * const decoder);
180    
181     extern int get_motion_delta (decoder_t * const decoder, const int f_code);
182     extern int get_dmv (decoder_t * const decoder);
183    
184     extern int non_linear_quantizer_scale[];
185     extern decoder_t g_decoder;
186    
187     void __fastcall ipu_csc(macroblock_8 *mb8, macroblock_rgb32 *rgb32, int sgn);
188     void __fastcall ipu_dither(const macroblock_rgb32* rgb32, macroblock_rgb16 *rgb16, int dte);
189     void __fastcall ipu_vq(macroblock_rgb16 *rgb16, u8* indx4);
190     void __fastcall ipu_copy(const macroblock_8 *mb8, macroblock_16 *mb16);
191    
192     int slice (decoder_t * const decoder, u8 * buffer);
193     /* idct.c */
194     void mpeg2_idct_init ();
195    
196     #ifdef _MSC_VER
197     #define BigEndian(out, in) out = _byteswap_ulong(in)
198     #else
199     #define BigEndian(out, in) out = __builtin_bswap32(in) // or we could use the asm function bswap...
200     #endif
201    
202     #endif//__MPEG_H__

  ViewVC Help
Powered by ViewVC 1.1.22