ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
svq1_vlc.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 // These tables are modified versions of the FFmpeg ones so that they
23 // will work with our BitStream class directly.
24 
25 #ifndef IMAGE_CODECS_SVQ1_VLC_H
26 #define IMAGE_CODECS_SVQ1_VLC_H
27 
28 #include "common/scummsys.h"
29 
30 namespace Image {
31 
32 static const byte s_svq1BlockTypeLengths[4] = {
33  1, 2, 3, 3
34 };
35 
36 static const uint32 s_svq1BlockTypeCodes[4] = {
37  1, 1, 1, 0
38 };
39 
40 static const byte s_svq1IntraMultistageLengths0[8] = {
41  5, 1, 3, 3, 4, 4, 5, 4
42 };
43 
44 static const uint32 s_svq1IntraMultistageCodes0[8] = {
45  1, 1, 3, 2, 3, 2, 0, 1
46 };
47 
48 static const byte s_svq1IntraMultistageLengths1[8] = {
49  4, 2, 3, 3, 3, 3, 4, 3
50 };
51 
52 static const uint32 s_svq1IntraMultistageCodes1[8] = {
53  1, 3, 5, 4, 3, 2, 0, 1
54 };
55 
56 static const byte s_svq1IntraMultistageLengths2[8] = {
57  5, 1, 3, 5, 4, 3, 4, 4
58 };
59 
60 static const uint32 s_svq1IntraMultistageCodes2[8] = {
61  1, 1, 3, 0, 3, 2, 2, 1
62 };
63 
64 static const byte s_svq1IntraMultistageLengths3[8] = {
65  6, 1, 2, 6, 4, 4, 5, 4
66 };
67 
68 static const uint32 s_svq1IntraMultistageCodes3[8] = {
69  1, 1, 1, 0, 3, 2, 1, 1
70 };
71 
72 static const byte s_svq1IntraMultistageLengths4[8] = {
73  6, 1, 2, 5, 5, 6, 5, 3
74 };
75 
76 static const uint32 s_svq1IntraMultistageCodes4[8] = {
77  1, 1, 1, 3, 2, 0, 1, 1
78 };
79 
80 static const byte s_svq1IntraMultistageLengths5[8] = {
81  7, 1, 2, 3, 4, 6, 7, 5
82 };
83 
84 static const uint32 s_svq1IntraMultistageCodes5[8] = {
85  1, 1, 1, 1, 1, 1, 0, 1
86 };
87 
88 static const byte *const s_svq1IntraMultistageLengths[6] = {
89  s_svq1IntraMultistageLengths0, s_svq1IntraMultistageLengths1, s_svq1IntraMultistageLengths2,
90  s_svq1IntraMultistageLengths3, s_svq1IntraMultistageLengths4, s_svq1IntraMultistageLengths5
91 };
92 
93 static const uint32 *const s_svq1IntraMultistageCodes[6] = {
94  s_svq1IntraMultistageCodes0, s_svq1IntraMultistageCodes1, s_svq1IntraMultistageCodes2,
95  s_svq1IntraMultistageCodes3, s_svq1IntraMultistageCodes4, s_svq1IntraMultistageCodes5
96 };
97 
98 static const byte s_svq1InterMultistageLengths0[8] = {
99  2, 3, 3, 3, 3, 3, 4, 4
100 };
101 
102 static const uint32 s_svq1InterMultistageCodes0[8] = {
103  3, 5, 4, 3, 2, 1, 1, 0
104 };
105 
106 static const byte s_svq1InterMultistageLengths1[8] = {
107  2, 3, 3, 3, 3, 3, 4, 4
108 };
109 
110 static const uint32 s_svq1InterMultistageCodes1[8] = {
111  3, 5, 4, 3, 2, 1, 1, 0
112 };
113 
114 static const byte s_svq1InterMultistageLengths2[8] = {
115  1, 3, 3, 4, 4, 4, 5, 5
116 };
117 
118 static const uint32 s_svq1InterMultistageCodes2[8] = {
119  1, 3, 2, 3, 2, 1, 1, 0
120 };
121 
122 static const byte s_svq1InterMultistageLengths3[8] = {
123  1, 3, 3, 4, 4, 4, 5, 5
124 };
125 
126 static const uint32 s_svq1InterMultistageCodes3[8] = {
127  1, 3, 2, 3, 2, 1, 1, 0
128 };
129 
130 static const byte s_svq1InterMultistageLengths4[8] = {
131  1, 3, 3, 4, 4, 4, 5, 5
132 };
133 
134 static const uint32 s_svq1InterMultistageCodes4[8] = {
135  1, 3, 2, 3, 2, 1, 1, 0
136 };
137 
138 static const byte s_svq1InterMultistageLengths5[8] = {
139  1, 2, 3, 5, 5, 5, 6, 6
140 };
141 
142 static const uint32 s_svq1InterMultistageCodes5[8] = {
143  1, 1, 1, 3, 2, 1, 1, 0
144 };
145 
146 static const byte *const s_svq1InterMultistageLengths[6] = {
147  s_svq1InterMultistageLengths0, s_svq1InterMultistageLengths1, s_svq1InterMultistageLengths2,
148  s_svq1InterMultistageLengths3, s_svq1InterMultistageLengths4, s_svq1InterMultistageLengths5
149 };
150 
151 static const uint32 *const s_svq1InterMultistageCodes[6] = {
152  s_svq1InterMultistageCodes0, s_svq1InterMultistageCodes1, s_svq1InterMultistageCodes2,
153  s_svq1InterMultistageCodes3, s_svq1InterMultistageCodes4, s_svq1InterMultistageCodes5
154 };
155 
156 static const byte s_svq1IntraMeanLengths[256] = {
157  6, 7, 17, 20, 20, 20, 20, 20, 20, 19,
158  11, 9, 11, 14, 14, 15, 16, 12, 10, 11,
159  11, 9, 8, 8, 7, 4, 4, 6, 7, 8,
160  8, 9, 9, 9, 9, 9, 9, 9, 9, 9,
161  9, 9, 9, 9, 9, 9, 9, 9, 8, 8,
162  8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
163  8, 8, 8, 8, 7, 8, 8, 8, 8, 8,
164  8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
165  8, 8, 8, 8, 8, 7, 8, 8, 7, 8,
166  8, 8, 8, 8, 7, 8, 7, 7, 8, 7,
167  7, 8, 7, 8, 8, 8, 7, 7, 8, 7,
168  8, 7, 7, 7, 7, 7, 7, 7, 7, 7,
169  7, 7, 7, 7, 7, 7, 7, 8, 8, 8,
170  8, 8, 8, 8, 8, 8, 8, 7, 7, 7,
171  7, 7, 7, 7, 7, 7, 7, 7, 6, 6,
172  7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
173  8, 8, 8, 8, 8, 8, 8, 8, 8, 9,
174  9, 9, 9, 9, 8, 8, 9, 9, 9, 9,
175  9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
176  9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
177  9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
178  10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
179  10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
180  10, 10, 10, 11, 11, 11, 10, 11, 11, 11,
181  11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
182  11, 11, 11, 11, 11, 14
183 };
184 
185 static const uint32 s_svq1IntraMeanCodes[256] = {
186  55, 86, 1, 1, 2, 3, 0, 4, 5, 3,
187  21, 66, 20, 3, 2, 1, 1, 1, 43, 24,
188  12, 65, 120, 108, 85, 15, 14, 52, 81, 114,
189  110, 64, 63, 62, 61, 60, 59, 58, 57, 56,
190  55, 67, 70, 71, 69, 68, 73, 72, 74, 121,
191  118, 119, 113, 117, 116, 115, 106, 85, 112, 111,
192  82, 109, 76, 107, 64, 105, 104, 103, 102, 101,
193  100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
194  90, 89, 88, 87, 86, 61, 84, 83, 63, 81,
195  80, 79, 78, 77, 65, 75, 83, 62, 72, 79,
196  82, 69, 80, 67, 66, 65, 66, 67, 62, 68,
197  60, 69, 70, 71, 72, 73, 74, 75, 76, 77,
198  78, 88, 89, 90, 91, 92, 93, 68, 73, 41,
199  63, 61, 59, 44, 40, 37, 38, 94, 87, 84,
200  95, 98, 99, 100, 97, 101, 103, 102, 53, 54,
201  96, 57, 58, 56, 55, 54, 53, 52, 51, 50,
202  49, 48, 45, 43, 42, 39, 64, 70, 71, 38,
203  37, 36, 35, 34, 46, 47, 31, 54, 29, 33,
204  27, 28, 25, 26, 24, 23, 22, 30, 32, 39,
205  40, 41, 42, 43, 44, 45, 46, 47, 48, 53,
206  49, 50, 51, 52, 25, 42, 23, 22, 21, 40,
207  38, 37, 34, 33, 24, 20, 41, 18, 13, 14,
208  15, 16, 17, 26, 27, 28, 29, 30, 31, 32,
209  19, 35, 36, 9, 8, 7, 39, 5, 11, 6,
210  4, 3, 2, 1, 10, 22, 25, 23, 13, 14,
211  15, 16, 17, 18, 19, 1
212 };
213 
214 static const byte s_svq1InterMeanLengths[512] = {
215  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
216  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
217  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
218  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
219  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
220  22, 22, 22, 21, 22, 22, 22, 22, 22, 22,
221  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
222  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
223  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
224  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
225  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
226  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
227  22, 22, 22, 22, 22, 22, 22, 22, 22, 21,
228  22, 22, 22, 22, 22, 22, 20, 21, 22, 21,
229  22, 22, 20, 22, 22, 21, 19, 18, 20, 22,
230  22, 21, 20, 19, 20, 20, 19, 19, 19, 18,
231  19, 18, 19, 20, 19, 19, 18, 18, 18, 19,
232  18, 18, 18, 17, 19, 18, 18, 17, 18, 18,
233  18, 17, 17, 17, 17, 16, 16, 16, 16, 16,
234  16, 16, 16, 16, 15, 16, 15, 15, 15, 15,
235  15, 15, 15, 15, 14, 14, 14, 14, 14, 14,
236  14, 14, 14, 13, 13, 13, 13, 13, 13, 13,
237  13, 12, 12, 12, 12, 12, 12, 11, 11, 11,
238  11, 11, 11, 10, 10, 10, 10, 10, 10, 9,
239  9, 9, 9, 9, 8, 8, 8, 8, 7, 7,
240  7, 6, 6, 5, 5, 4, 1, 3, 5, 5,
241  6, 6, 7, 7, 7, 7, 8, 8, 8, 9,
242  9, 9, 9, 9, 10, 10, 10, 10, 11, 11,
243  11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
244  12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
245  14, 14, 14, 14, 14, 14, 14, 14, 15, 15,
246  15, 15, 15, 15, 15, 15, 15, 15, 16, 16,
247  16, 16, 16, 16, 16, 16, 16, 16, 17, 17,
248  17, 17, 17, 17, 17, 17, 18, 17, 17, 17,
249  17, 17, 17, 17, 19, 18, 18, 19, 18, 18,
250  19, 18, 18, 18, 19, 18, 19, 19, 18, 20,
251  20, 19, 19, 19, 19, 19, 19, 18, 19, 20,
252  19, 19, 21, 20, 19, 20, 19, 19, 20, 20,
253  22, 20, 22, 22, 21, 22, 22, 21, 21, 22,
254  22, 20, 22, 22, 21, 22, 22, 22, 20, 22,
255  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
256  22, 22, 22, 22, 21, 21, 22, 22, 22, 21,
257  22, 21, 22, 22, 22, 22, 22, 22, 22, 22,
258  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
259  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
260  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
261  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
262  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
263  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
264  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
265  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
266  22, 22
267 };
268 
269 static const uint32 s_svq1InterMeanCodes[512] = {
270  90, 212, 213, 214, 215, 216, 217, 218, 219, 220,
271  221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
272  232, 203, 233, 234, 231, 236, 237, 238, 239, 240,
273  241, 242, 243, 244, 245, 246, 247, 248, 258, 235,
274  249, 252, 253, 254, 256, 92, 96, 257, 113, 260,
275  261, 251, 255, 134, 250, 124, 117, 259, 120, 211,
276  123, 130, 210, 209, 208, 207, 206, 205, 204, 195,
277  202, 201, 200, 199, 198, 197, 139, 196, 194, 193,
278  192, 191, 190, 189, 188, 187, 186, 185, 97, 132,
279  133, 134, 135, 136, 137, 138, 140, 141, 142, 143,
280  144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
281  154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
282  164, 165, 166, 167, 168, 169, 170, 171, 127, 143,
283  172, 173, 174, 175, 176, 177, 83, 144, 178, 145,
284  179, 180, 84, 181, 182, 140, 52, 61, 85, 183,
285  184, 139, 86, 61, 87, 88, 64, 67, 71, 42,
286  46, 44, 70, 89, 73, 45, 56, 54, 57, 69,
287  40, 48, 53, 32, 68, 50, 49, 31, 47, 46,
288  45, 33, 34, 35, 36, 39, 35, 32, 29, 37,
289  30, 36, 42, 38, 33, 41, 34, 35, 36, 27,
290  26, 29, 31, 39, 23, 24, 25, 27, 28, 30,
291  37, 32, 33, 19, 20, 21, 22, 23, 24, 25,
292  26, 24, 23, 21, 20, 19, 18, 15, 16, 18,
293  19, 27, 26, 14, 19, 15, 16, 17, 18, 13,
294  20, 21, 12, 19, 15, 14, 16, 17, 12, 9,
295  10, 8, 9, 9, 8, 5, 1, 3, 7, 6,
296  11, 10, 14, 15, 11, 13, 11, 13, 12, 15,
297  16, 17, 14, 18, 23, 20, 22, 21, 25, 24,
298  23, 22, 21, 20, 17, 25, 26, 22, 29, 27,
299  28, 32, 28, 35, 34, 33, 31, 30, 27, 29,
300  36, 22, 26, 34, 29, 31, 21, 35, 24, 32,
301  41, 40, 38, 37, 25, 28, 30, 23, 44, 43,
302  28, 33, 45, 40, 31, 27, 26, 34, 45, 50,
303  44, 39, 49, 51, 47, 43, 55, 42, 46, 48,
304  41, 40, 38, 37, 47, 51, 52, 48, 58, 59,
305  49, 60, 43, 41, 72, 39, 66, 65, 38, 82,
306  81, 63, 62, 57, 60, 59, 58, 37, 56, 80,
307  55, 54, 135, 79, 53, 78, 51, 50, 77, 76,
308  131, 75, 129, 128, 142, 126, 125, 132, 141, 122,
309  121, 74, 119, 118, 137, 116, 115, 114, 73, 112,
310  111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
311  101, 100, 99, 98, 138, 136, 95, 94, 93, 133,
312  91, 131, 89, 88, 87, 86, 85, 84, 83, 82,
313  81, 80, 79, 78, 77, 76, 75, 74, 73, 72,
314  71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
315  61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
316  51, 50, 49, 48, 47, 46, 45, 44, 43, 42,
317  41, 40, 39, 38, 37, 36, 35, 34, 33, 32,
318  31, 30, 29, 28, 27, 26, 25, 24, 23, 22,
319  21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
320  11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
321  1, 0
322 };
323 
324 static const byte s_svq1MotionComponentLengths[33] = {
325  1, 2, 3, 4, 6, 7, 7, 7, 9, 9,
326  9, 10, 10, 10, 10, 10, 10, 10, 10, 10,
327  10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
328  11, 12, 12
329 };
330 
331 static const uint32 s_svq1MotionComponentCodes[33] = {
332  1, 1, 1, 1, 3, 5, 4, 3, 11, 10,
333  9, 17, 16, 15, 14, 13, 12, 11, 10, 9,
334  8, 7, 6, 5, 4, 7, 6, 5, 4, 3,
335  2, 3, 2
336 };
337 
338 } // End of namespace Image
339 
340 #endif
Definition: movie_decoder.h:32