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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 191 - (hide annotations) (download)
Mon Sep 20 05:35:51 2010 UTC (10 years ago) by william
File MIME type: text/plain
File size: 25930 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.3795 local: v0.9.7.186-latest) in ./trunk
1 william 31 /*
2     * vlc.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 william 62
25     // WARNING! This file should only be included into Mpeg.cpp AND NOWHERE ELSE.
26     // All contents of this file are used only by Mpeg.cpp, and including it elsewhere will
27     // just result in the linker having to remove a whole lot of redundant/unused decoder
28     // tables and static functions. -- air
29 william 31
30     #ifndef __VLC_H__
31     #define __VLC_H__
32    
33 william 62 static __fi int GETWORD()
34     {
35 william 191 return g_BP.FillBuffer(16);
36 william 31 }
37    
38 william 191 // Removes bits from the bitstream. This is done independently of UBITS/SBITS because a
39     // lot of mpeg streams have to read ahead and rewind bits and re-read them at different
40     // bit depths or sign'age.
41     static __fi void DUMPBITS(uint num)
42 william 62 {
43 william 191 g_BP.Advance(num);
44     //pxAssume(g_BP.FP != 0);
45 william 31 }
46    
47 william 191 static __fi u32 GETBITS(uint num)
48 william 62 {
49 william 191 uint retVal = UBITS(num);
50     g_BP.Advance(num);
51 william 31
52 william 62 return retVal;
53     }
54    
55 william 31 struct MBtab {
56     u8 modes;
57     u8 len;
58     };
59    
60     struct MVtab {
61     u8 delta;
62     u8 len;
63     };
64    
65     struct DMVtab {
66     s8 dmv;
67     u8 len;
68     };
69    
70     struct CBPtab {
71     u8 cbp;
72     u8 len;
73     };
74    
75     struct DCtab {
76     u8 size;
77     u8 len;
78     };
79    
80     struct DCTtab {
81     u8 run;
82     u8 level;
83     u8 len;
84     };
85    
86     struct MBAtab {
87     u8 mba;
88     u8 len;
89     };
90    
91    
92     #define INTRA MACROBLOCK_INTRA
93     #define QUANT MACROBLOCK_QUANT
94    
95     static const MBtab MB_I [] = {
96     {INTRA|QUANT, 2}, {INTRA, 1}
97     };
98    
99     #define MC MACROBLOCK_MOTION_FORWARD
100     #define CODED MACROBLOCK_PATTERN
101    
102 william 62 static const __aligned16 MBtab MB_P [] = {
103 william 31 {INTRA|QUANT, 6}, {CODED|QUANT, 5}, {MC|CODED|QUANT, 5}, {INTRA, 5},
104     {MC, 3}, {MC, 3}, {MC, 3}, {MC, 3},
105     {CODED, 2}, {CODED, 2}, {CODED, 2}, {CODED, 2},
106     {CODED, 2}, {CODED, 2}, {CODED, 2}, {CODED, 2},
107     {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
108     {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
109     {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
110     {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}
111     };
112    
113     #define FWD MACROBLOCK_MOTION_FORWARD
114     #define BWD MACROBLOCK_MOTION_BACKWARD
115     #define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD
116    
117 william 62 static const __aligned16 MBtab MB_B [] = {
118 william 31 {0, 0}, {INTRA|QUANT, 6},
119     {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6},
120     {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5},
121     {INTRA, 5}, {INTRA, 5},
122     {FWD, 4}, {FWD, 4}, {FWD, 4}, {FWD, 4},
123     {FWD|CODED, 4}, {FWD|CODED, 4}, {FWD|CODED, 4}, {FWD|CODED, 4},
124     {BWD, 3}, {BWD, 3}, {BWD, 3}, {BWD, 3},
125     {BWD, 3}, {BWD, 3}, {BWD, 3}, {BWD, 3},
126     {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3},
127     {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3},
128     {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
129     {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
130     {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
131     {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
132     {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
133     {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
134     {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
135     {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}
136     };
137    
138     #undef INTRA
139     #undef QUANT
140     #undef MC
141     #undef CODED
142     #undef FWD
143     #undef BWD
144     #undef INTER
145    
146    
147     static const MVtab MV_4 [] = {
148     { 3, 6}, { 2, 4}, { 1, 3}, { 1, 3}, { 0, 2}, { 0, 2}, { 0, 2}, { 0, 2}
149     };
150    
151 william 62 static const __aligned16 MVtab MV_10 [] = {
152 william 31 { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10},
153     { 0,10}, { 0,10}, { 0,10}, { 0,10}, {15,10}, {14,10}, {13,10}, {12,10},
154     {11,10}, {10,10}, { 9, 9}, { 9, 9}, { 8, 9}, { 8, 9}, { 7, 9}, { 7, 9},
155     { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7},
156     { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7},
157     { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}
158     };
159    
160    
161     static const DMVtab DMV_2 [] = {
162     { 0, 1}, { 0, 1}, { 1, 2}, {-1, 2}
163     };
164    
165    
166 william 62 static const __aligned16 CBPtab CBP_7 [] = {
167 william 31 {0x22, 7}, {0x12, 7}, {0x0a, 7}, {0x06, 7},
168     {0x21, 7}, {0x11, 7}, {0x09, 7}, {0x05, 7},
169     {0x3f, 6}, {0x3f, 6}, {0x03, 6}, {0x03, 6},
170     {0x24, 6}, {0x24, 6}, {0x18, 6}, {0x18, 6},
171     {0x3e, 5}, {0x3e, 5}, {0x3e, 5}, {0x3e, 5},
172     {0x02, 5}, {0x02, 5}, {0x02, 5}, {0x02, 5},
173     {0x3d, 5}, {0x3d, 5}, {0x3d, 5}, {0x3d, 5},
174     {0x01, 5}, {0x01, 5}, {0x01, 5}, {0x01, 5},
175     {0x38, 5}, {0x38, 5}, {0x38, 5}, {0x38, 5},
176     {0x34, 5}, {0x34, 5}, {0x34, 5}, {0x34, 5},
177     {0x2c, 5}, {0x2c, 5}, {0x2c, 5}, {0x2c, 5},
178     {0x1c, 5}, {0x1c, 5}, {0x1c, 5}, {0x1c, 5},
179     {0x28, 5}, {0x28, 5}, {0x28, 5}, {0x28, 5},
180     {0x14, 5}, {0x14, 5}, {0x14, 5}, {0x14, 5},
181     {0x30, 5}, {0x30, 5}, {0x30, 5}, {0x30, 5},
182     {0x0c, 5}, {0x0c, 5}, {0x0c, 5}, {0x0c, 5},
183     {0x20, 4}, {0x20, 4}, {0x20, 4}, {0x20, 4},
184     {0x20, 4}, {0x20, 4}, {0x20, 4}, {0x20, 4},
185     {0x10, 4}, {0x10, 4}, {0x10, 4}, {0x10, 4},
186     {0x10, 4}, {0x10, 4}, {0x10, 4}, {0x10, 4},
187     {0x08, 4}, {0x08, 4}, {0x08, 4}, {0x08, 4},
188     {0x08, 4}, {0x08, 4}, {0x08, 4}, {0x08, 4},
189     {0x04, 4}, {0x04, 4}, {0x04, 4}, {0x04, 4},
190     {0x04, 4}, {0x04, 4}, {0x04, 4}, {0x04, 4},
191     {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3},
192     {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3},
193     {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3},
194     {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3}
195     };
196    
197 william 62 static const __aligned16 CBPtab CBP_9 [] = {
198 william 31 {0, 0}, {0x00, 9}, {0x27, 9}, {0x1b, 9},
199     {0x3b, 9}, {0x37, 9}, {0x2f, 9}, {0x1f, 9},
200     {0x3a, 8}, {0x3a, 8}, {0x36, 8}, {0x36, 8},
201     {0x2e, 8}, {0x2e, 8}, {0x1e, 8}, {0x1e, 8},
202     {0x39, 8}, {0x39, 8}, {0x35, 8}, {0x35, 8},
203     {0x2d, 8}, {0x2d, 8}, {0x1d, 8}, {0x1d, 8},
204     {0x26, 8}, {0x26, 8}, {0x1a, 8}, {0x1a, 8},
205     {0x25, 8}, {0x25, 8}, {0x19, 8}, {0x19, 8},
206     {0x2b, 8}, {0x2b, 8}, {0x17, 8}, {0x17, 8},
207     {0x33, 8}, {0x33, 8}, {0x0f, 8}, {0x0f, 8},
208     {0x2a, 8}, {0x2a, 8}, {0x16, 8}, {0x16, 8},
209     {0x32, 8}, {0x32, 8}, {0x0e, 8}, {0x0e, 8},
210     {0x29, 8}, {0x29, 8}, {0x15, 8}, {0x15, 8},
211     {0x31, 8}, {0x31, 8}, {0x0d, 8}, {0x0d, 8},
212     {0x23, 8}, {0x23, 8}, {0x13, 8}, {0x13, 8},
213     {0x0b, 8}, {0x0b, 8}, {0x07, 8}, {0x07, 8}
214     };
215    
216 william 62 #if 0 // following tables are unused by PCSX2
217    
218 william 31 static const DCtab DC_lum_5 [] = {
219     {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
220     {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
221     {0, 3}, {0, 3}, {0, 3}, {0, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
222     {4, 3}, {4, 3}, {4, 3}, {4, 3}, {5, 4}, {5, 4}, {6, 5}
223     };
224    
225     static const DCtab DC_chrom_5 [] = {
226     {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
227     {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
228     {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
229     {3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 4}, {4, 4}, {5, 5}
230     };
231    
232     static const DCtab DC_long [] = {
233     {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, { 6, 5}, { 6, 5},
234     {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, { 6, 5}, { 6, 5},
235     {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, { 7, 6}, { 7, 6},
236     {8, 7}, {8, 7}, {8, 7}, {8, 7}, {9, 8}, {9, 8}, {10, 9}, {11, 9}
237     };
238    
239     static const DCTtab DCT_16 [] = {
240     {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
241     {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
242     {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
243     {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
244     { 2,18, 0}, { 2,17, 0}, { 2,16, 0}, { 2,15, 0},
245     { 7, 3, 0}, { 17, 2, 0}, { 16, 2, 0}, { 15, 2, 0},
246     { 14, 2, 0}, { 13, 2, 0}, { 12, 2, 0}, { 32, 1, 0},
247     { 31, 1, 0}, { 30, 1, 0}, { 29, 1, 0}, { 28, 1, 0}
248     };
249    
250     static const DCTtab DCT_15 [] = {
251     { 1,40,15}, { 1,39,15}, { 1,38,15}, { 1,37,15},
252     { 1,36,15}, { 1,35,15}, { 1,34,15}, { 1,33,15},
253     { 1,32,15}, { 2,14,15}, { 2,13,15}, { 2,12,15},
254     { 2,11,15}, { 2,10,15}, { 2, 9,15}, { 2, 8,15},
255     { 1,31,14}, { 1,31,14}, { 1,30,14}, { 1,30,14},
256     { 1,29,14}, { 1,29,14}, { 1,28,14}, { 1,28,14},
257     { 1,27,14}, { 1,27,14}, { 1,26,14}, { 1,26,14},
258     { 1,25,14}, { 1,25,14}, { 1,24,14}, { 1,24,14},
259     { 1,23,14}, { 1,23,14}, { 1,22,14}, { 1,22,14},
260     { 1,21,14}, { 1,21,14}, { 1,20,14}, { 1,20,14},
261     { 1,19,14}, { 1,19,14}, { 1,18,14}, { 1,18,14},
262     { 1,17,14}, { 1,17,14}, { 1,16,14}, { 1,16,14}
263     };
264    
265     static const DCTtab DCT_13 [] = {
266     { 11, 2,13}, { 10, 2,13}, { 6, 3,13}, { 4, 4,13},
267     { 3, 5,13}, { 2, 7,13}, { 2, 6,13}, { 1,15,13},
268     { 1,14,13}, { 1,13,13}, { 1,12,13}, { 27, 1,13},
269     { 26, 1,13}, { 25, 1,13}, { 24, 1,13}, { 23, 1,13},
270     { 1,11,12}, { 1,11,12}, { 9, 2,12}, { 9, 2,12},
271     { 5, 3,12}, { 5, 3,12}, { 1,10,12}, { 1,10,12},
272     { 3, 4,12}, { 3, 4,12}, { 8, 2,12}, { 8, 2,12},
273     { 22, 1,12}, { 22, 1,12}, { 21, 1,12}, { 21, 1,12},
274     { 1, 9,12}, { 1, 9,12}, { 20, 1,12}, { 20, 1,12},
275     { 19, 1,12}, { 19, 1,12}, { 2, 5,12}, { 2, 5,12},
276     { 4, 3,12}, { 4, 3,12}, { 1, 8,12}, { 1, 8,12},
277     { 7, 2,12}, { 7, 2,12}, { 18, 1,12}, { 18, 1,12}
278     };
279    
280     static const DCTtab DCT_B14_10 [] = {
281     { 17, 1,10}, { 6, 2,10}, { 1, 7,10}, { 3, 3,10},
282     { 2, 4,10}, { 16, 1,10}, { 15, 1,10}, { 5, 2,10}
283     };
284    
285     static const DCTtab DCT_B14_8 [] = {
286     { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
287     { 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7},
288     { 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7},
289     { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6},
290     { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6},
291     { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6},
292     { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
293     { 14, 1, 8}, { 1, 6, 8}, { 13, 1, 8}, { 12, 1, 8},
294     { 4, 2, 8}, { 2, 3, 8}, { 1, 5, 8}, { 11, 1, 8}
295     };
296    
297     static const DCTtab DCT_B14AC_5 [] = {
298     { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
299     { 1, 2, 4}, { 1, 2, 4}, { 3, 1, 4}, { 3, 1, 4},
300     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
301     {129, 0, 2}, {129, 0, 2}, {129, 0, 2}, {129, 0, 2},
302     {129, 0, 2}, {129, 0, 2}, {129, 0, 2}, {129, 0, 2},
303     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
304     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}
305     };
306    
307     static const DCTtab DCT_B14DC_5 [] = {
308     { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
309     { 1, 2, 4}, { 1, 2, 4}, { 3, 1, 4}, { 3, 1, 4},
310     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
311     { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
312     { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
313     { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
314     { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}
315     };
316    
317     static const DCTtab DCT_B15_10 [] = {
318     { 6, 2, 9}, { 6, 2, 9}, { 15, 1, 9}, { 15, 1, 9},
319     { 3, 4,10}, { 17, 1,10}, { 16, 1, 9}, { 16, 1, 9}
320     };
321    
322     static const DCTtab DCT_B15_8 [] = {
323     { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
324     { 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7},
325     { 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7},
326     { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6},
327     { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6},
328     { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6},
329     { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
330     { 2, 5, 8}, { 12, 1, 8}, { 1,11, 8}, { 1,10, 8},
331     { 14, 1, 8}, { 13, 1, 8}, { 4, 2, 8}, { 2, 4, 8},
332     { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
333     { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
334     { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5},
335     { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5},
336     { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5},
337     { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5},
338     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
339     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
340     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
341     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
342     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
343     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
344     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
345     { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
346     {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
347     {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
348     {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
349     {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
350     { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
351     { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
352     { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
353     { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
354     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
355     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
356     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
357     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
358     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
359     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
360     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
361     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
362     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
363     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
364     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
365     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
366     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
367     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
368     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
369     { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
370     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
371     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
372     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
373     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
374     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
375     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
376     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
377     { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
378     { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5},
379     { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5},
380     { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
381     { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
382     { 10, 1, 7}, { 10, 1, 7}, { 2, 3, 7}, { 2, 3, 7},
383     { 11, 1, 7}, { 11, 1, 7}, { 1, 8, 7}, { 1, 8, 7},
384     { 1, 9, 7}, { 1, 9, 7}, { 1,12, 8}, { 1,13, 8},
385     { 3, 3, 8}, { 5, 2, 8}, { 1,14, 8}, { 1,15, 8}
386     };
387 william 62 #endif
388 william 31
389 william 62 struct MBAtabSet
390     {
391     MBAtab mba5[30];
392     MBAtab mba11[26*4];
393     };
394     static const __aligned16 MBAtabSet MBA = {
395     { // mba5
396     {6, 5}, {5, 5}, {4, 4}, {4, 4}, {3, 4}, {3, 4},
397     {2, 3}, {2, 3}, {2, 3}, {2, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
398     {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1},
399     {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}
400     },
401 william 31
402 william 62 { // mba11
403     {32, 11}, {31, 11}, {30, 11}, {29, 11},
404     {28, 11}, {27, 11}, {26, 11}, {25, 11},
405     {24, 11}, {23, 11}, {22, 11}, {21, 11},
406     {20, 10}, {20, 10}, {19, 10}, {19, 10},
407     {18, 10}, {18, 10}, {17, 10}, {17, 10},
408     {16, 10}, {16, 10}, {15, 10}, {15, 10},
409     {14, 8}, {14, 8}, {14, 8}, {14, 8},
410     {14, 8}, {14, 8}, {14, 8}, {14, 8},
411     {13, 8}, {13, 8}, {13, 8}, {13, 8},
412     {13, 8}, {13, 8}, {13, 8}, {13, 8},
413     {12, 8}, {12, 8}, {12, 8}, {12, 8},
414     {12, 8}, {12, 8}, {12, 8}, {12, 8},
415     {11, 8}, {11, 8}, {11, 8}, {11, 8},
416     {11, 8}, {11, 8}, {11, 8}, {11, 8},
417     {10, 8}, {10, 8}, {10, 8}, {10, 8},
418     {10, 8}, {10, 8}, {10, 8}, {10, 8},
419     { 9, 8}, { 9, 8}, { 9, 8}, { 9, 8},
420     { 9, 8}, { 9, 8}, { 9, 8}, { 9, 8},
421     { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
422     { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
423     { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
424     { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
425     { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
426     { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
427     { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
428     { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}
429     }
430 william 31 };
431    
432 william 62 // New
433    
434     #if 0 // Not used by PCSX2
435     /* Table B-1, macroblock_address_increment, codes 00010 ... 011xx */
436     static MBAtab MBAtab1[16] =
437     { {0,0}, {0,0}, {7,5}, {6,5}, {5,4}, {5,4}, {4,4}, {4,4},
438     {3,3}, {3,3}, {3,3}, {3,3}, {2,3}, {2,3}, {2,3}, {2,3}
439 william 31 };
440 william 62
441     /* Table B-1, macroblock_address_increment, codes 00000011000 ... 0000111xxxx */
442     static MBAtab MBAtab2[104] =
443     {
444     {33,11}, {32,11}, {31,11}, {30,11}, {29,11}, {28,11}, {27,11}, {26,11},
445     {25,11}, {24,11}, {23,11}, {22,11}, {21,10}, {21,10}, {20,10}, {20,10},
446     {19,10}, {19,10}, {18,10}, {18,10}, {17,10}, {17,10}, {16,10}, {16,10},
447     {15,8}, {15,8}, {15,8}, {15,8}, {15,8}, {15,8}, {15,8}, {15,8},
448     {14,8}, {14,8}, {14,8}, {14,8}, {14,8}, {14,8}, {14,8}, {14,8},
449     {13,8}, {13,8}, {13,8}, {13,8}, {13,8}, {13,8}, {13,8}, {13,8},
450     {12,8}, {12,8}, {12,8}, {12,8}, {12,8}, {12,8}, {12,8}, {12,8},
451     {11,8}, {11,8}, {11,8}, {11,8}, {11,8}, {11,8}, {11,8}, {11,8},
452     {10,8}, {10,8}, {10,8}, {10,8}, {10,8}, {10,8}, {10,8}, {10,8},
453     {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7},
454     {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7},
455     {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7},
456     {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}
457     };
458     #endif
459    
460     struct DCtabSet
461     {
462     DCtab lum0[32]; // Table B-12, dct_dc_size_luminance, codes 00xxx ... 11110
463     DCtab lum1[16]; // Table B-12, dct_dc_size_luminance, codes 111110xxx ... 111111111
464     DCtab chrom0[32]; // Table B-13, dct_dc_size_chrominance, codes 00xxx ... 11110
465     DCtab chrom1[32]; // Table B-13, dct_dc_size_chrominance, codes 111110xxxx ... 1111111111
466     };
467    
468     static const __aligned16 DCtabSet DCtable =
469     {
470     // lum0: Table B-12, dct_dc_size_luminance, codes 00xxx ... 11110 */
471     { {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
472     {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
473     {0, 3}, {0, 3}, {0, 3}, {0, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
474     {4, 3}, {4, 3}, {4, 3}, {4, 3}, {5, 4}, {5, 4}, {6, 5}, {0, 0} },
475    
476     /* lum1: Table B-12, dct_dc_size_luminance, codes 111110xxx ... 111111111 */
477     { {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6},
478     {8, 7}, {8, 7}, {8, 7}, {8, 7}, {9, 8}, {9, 8}, {10,9}, {11,9} },
479    
480     /* chrom0: Table B-13, dct_dc_size_chrominance, codes 00xxx ... 11110 */
481     { {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
482     {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
483     {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
484     {3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 4}, {4, 4}, {5, 5}, {0, 0} },
485    
486     /* chrom1: Table B-13, dct_dc_size_chrominance, codes 111110xxxx ... 1111111111 */
487     { {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6},
488     {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6},
489     {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7},
490     {8, 8}, {8, 8}, {8, 8}, {8, 8}, {9, 9}, {9, 9}, {10,10}, {11,10} },
491     };
492    
493     struct DCTtabSet
494     {
495     DCTtab first[12];
496     DCTtab next[12];
497    
498     DCTtab tab0[60];
499     DCTtab tab0a[252];
500     DCTtab tab1[8];
501     DCTtab tab1a[8];
502    
503     DCTtab tab2[16];
504     DCTtab tab3[16];
505     DCTtab tab4[16];
506     DCTtab tab5[16];
507     DCTtab tab6[16];
508     };
509    
510     static const __aligned16 DCTtabSet DCT =
511     {
512     /* first[12]: Table B-14, DCT coefficients table zero,
513     * codes 0100 ... 1xxx (used for first (DC) coefficient)
514     */
515     { {0,2,4}, {2,1,4}, {1,1,3}, {1,1,3},
516     {0,1,1}, {0,1,1}, {0,1,1}, {0,1,1},
517     {0,1,1}, {0,1,1}, {0,1,1}, {0,1,1} },
518    
519     /* next[12]: Table B-14, DCT coefficients table zero,
520     * codes 0100 ... 1xxx (used for all other coefficients)
521     */
522     { {0,2,4}, {2,1,4}, {1,1,3}, {1,1,3},
523     {64,0,2}, {64,0,2}, {64,0,2}, {64,0,2}, /* EOB */
524     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2} },
525    
526     /* tab0[60]: Table B-14, DCT coefficients table zero,
527     * codes 000001xx ... 00111xxx
528     */
529     { {65,0,6}, {65,0,6}, {65,0,6}, {65,0,6}, /* Escape */
530     {2,2,7}, {2,2,7}, {9,1,7}, {9,1,7},
531     {0,4,7}, {0,4,7}, {8,1,7}, {8,1,7},
532     {7,1,6}, {7,1,6}, {7,1,6}, {7,1,6},
533     {6,1,6}, {6,1,6}, {6,1,6}, {6,1,6},
534     {1,2,6}, {1,2,6}, {1,2,6}, {1,2,6},
535     {5,1,6}, {5,1,6}, {5,1,6}, {5,1,6},
536     {13,1,8}, {0,6,8}, {12,1,8}, {11,1,8},
537     {3,2,8}, {1,3,8}, {0,5,8}, {10,1,8},
538     {0,3,5}, {0,3,5}, {0,3,5}, {0,3,5},
539     {0,3,5}, {0,3,5}, {0,3,5}, {0,3,5},
540     {4,1,5}, {4,1,5}, {4,1,5}, {4,1,5},
541     {4,1,5}, {4,1,5}, {4,1,5}, {4,1,5},
542     {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5},
543     {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5} },
544    
545     /* tab0a[252]: Table B-15, DCT coefficients table one,
546     * codes 000001xx ... 11111111
547     */
548     { {65,0,6}, {65,0,6}, {65,0,6}, {65,0,6}, /* Escape */
549     {7,1,7}, {7,1,7}, {8,1,7}, {8,1,7},
550     {6,1,7}, {6,1,7}, {2,2,7}, {2,2,7},
551     {0,7,6}, {0,7,6}, {0,7,6}, {0,7,6},
552     {0,6,6}, {0,6,6}, {0,6,6}, {0,6,6},
553     {4,1,6}, {4,1,6}, {4,1,6}, {4,1,6},
554     {5,1,6}, {5,1,6}, {5,1,6}, {5,1,6},
555     {1,5,8}, {11,1,8}, {0,11,8}, {0,10,8},
556     {13,1,8}, {12,1,8}, {3,2,8}, {1,4,8},
557     {2,1,5}, {2,1,5}, {2,1,5}, {2,1,5},
558     {2,1,5}, {2,1,5}, {2,1,5}, {2,1,5},
559     {1,2,5}, {1,2,5}, {1,2,5}, {1,2,5},
560     {1,2,5}, {1,2,5}, {1,2,5}, {1,2,5},
561     {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5},
562     {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5},
563     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
564     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
565     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
566     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
567     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
568     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
569     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
570     {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
571     {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4}, /* EOB */
572     {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4},
573     {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4},
574     {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4},
575     {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
576     {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
577     {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
578     {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
579     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
580     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
581     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
582     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
583     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
584     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
585     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
586     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
587     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
588     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
589     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
590     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
591     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
592     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
593     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
594     {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
595     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
596     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
597     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
598     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
599     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
600     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
601     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
602     {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
603     {0,4,5}, {0,4,5}, {0,4,5}, {0,4,5},
604     {0,4,5}, {0,4,5}, {0,4,5}, {0,4,5},
605     {0,5,5}, {0,5,5}, {0,5,5}, {0,5,5},
606     {0,5,5}, {0,5,5}, {0,5,5}, {0,5,5},
607     {9,1,7}, {9,1,7}, {1,3,7}, {1,3,7},
608     {10,1,7}, {10,1,7}, {0,8,7}, {0,8,7},
609     {0,9,7}, {0,9,7}, {0,12,8}, {0,13,8},
610     {2,3,8}, {4,2,8}, {0,14,8}, {0,15,8} },
611    
612     /* Table B-14, DCT coefficients table zero,
613     * codes 0000001000 ... 0000001111
614     */
615     { {16,1,10}, {5,2,10}, {0,7,10}, {2,3,10},
616     {1,4,10}, {15,1,10}, {14,1,10}, {4,2,10} },
617    
618     /* Table B-15, DCT coefficients table one,
619     * codes 000000100x ... 000000111x
620     */
621     { {5,2,9}, {5,2,9}, {14,1,9}, {14,1,9},
622     {2,4,10}, {16,1,10}, {15,1,9}, {15,1,9} },
623    
624     /* Table B-14/15, DCT coefficients table zero / one,
625     * codes 000000010000 ... 000000011111
626     */
627     { {0,11,12}, {8,2,12}, {4,3,12}, {0,10,12},
628     {2,4,12}, {7,2,12}, {21,1,12}, {20,1,12},
629     {0,9,12}, {19,1,12}, {18,1,12}, {1,5,12},
630     {3,3,12}, {0,8,12}, {6,2,12}, {17,1,12} },
631    
632     /* Table B-14/15, DCT coefficients table zero / one,
633     * codes 0000000010000 ... 0000000011111
634     */
635     { {10,2,13}, {9,2,13}, {5,3,13}, {3,4,13},
636     {2,5,13}, {1,7,13}, {1,6,13}, {0,15,13},
637     {0,14,13}, {0,13,13}, {0,12,13}, {26,1,13},
638     {25,1,13}, {24,1,13}, {23,1,13}, {22,1,13} },
639    
640     /* Table B-14/15, DCT coefficients table zero / one,
641     * codes 00000000010000 ... 00000000011111
642     */
643     { {0,31,14}, {0,30,14}, {0,29,14}, {0,28,14},
644     {0,27,14}, {0,26,14}, {0,25,14}, {0,24,14},
645     {0,23,14}, {0,22,14}, {0,21,14}, {0,20,14},
646     {0,19,14}, {0,18,14}, {0,17,14}, {0,16,14} },
647    
648     /* Table B-14/15, DCT coefficients table zero / one,
649     * codes 000000000010000 ... 000000000011111
650     */
651     { {0,40,15}, {0,39,15}, {0,38,15}, {0,37,15},
652     {0,36,15}, {0,35,15}, {0,34,15}, {0,33,15},
653     {0,32,15}, {1,14,15}, {1,13,15}, {1,12,15},
654     {1,11,15}, {1,10,15}, {1,9,15}, {1,8,15} },
655    
656     /* Table B-14/15, DCT coefficients table zero / one,
657     * codes 0000000000010000 ... 0000000000011111
658     */
659     { {1,18,16}, {1,17,16}, {1,16,16}, {1,15,16},
660     {6,3,16}, {16,2,16}, {15,2,16}, {14,2,16},
661     {13,2,16}, {12,2,16}, {11,2,16}, {31,1,16},
662     {30,1,16}, {29,1,16}, {28,1,16}, {27,1,16} }
663    
664     };
665    
666 william 31 #endif//__VLC_H__

  ViewVC Help
Powered by ViewVC 1.1.22