2
* Indeo Video Interactive 4 compatible decoder
3
* Copyright (c) 2009-2010 Maxim Poliakovski
5
* This file is part of Libav.
7
* Libav is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* Libav 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 GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with Libav; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
* This file contains data needed for the Indeo 4 decoder.
27
#ifndef AVCODEC_INDEO4DATA_H
28
#define AVCODEC_INDEO4DATA_H
32
#include "ivi_common.h"
35
* standard picture dimensions
37
static const uint16_t ivi4_common_pic_sizes[14] = {
38
640, 480, 320, 240, 160, 120, 704, 480, 352, 240, 352, 288, 176, 144
42
* Indeo 4 8x8 scan (zigzag) patterns
44
static const uint8_t ivi4_alternate_scan_8x8[64] = {
45
0, 8, 1, 9, 16, 24, 2, 3, 17, 25, 10, 11, 32, 40, 48, 56,
46
4, 5, 6, 7, 33, 41, 49, 57, 18, 19, 26, 27, 12, 13, 14, 15,
47
34, 35, 43, 42, 50, 51, 59, 58, 20, 21, 22, 23, 31, 30, 29, 28,
48
36, 37, 38, 39, 47, 46, 45, 44, 52, 53, 54, 55, 63, 62, 61, 60
51
static const uint8_t ivi4_alternate_scan_4x4[16] = {
52
0, 1, 4, 5, 8, 12, 2, 3, 9, 13, 6, 7, 10, 11, 14, 15
55
static const uint8_t ivi4_vertical_scan_4x4[16] = {
56
0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
59
static const uint8_t ivi4_horizontal_scan_4x4[16] = {
60
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
63
static const uint8_t *scan_index_to_tab[15] = {
66
ivi4_alternate_scan_8x8,
67
ff_ivi_horizontal_scan_8x8,
68
ff_ivi_vertical_scan_8x8,
72
ff_ivi_direct_scan_4x4,
73
ivi4_alternate_scan_4x4,
74
ivi4_vertical_scan_4x4,
75
ivi4_horizontal_scan_4x4,
76
ff_ivi_direct_scan_4x4,
78
// TODO: check if those are needed
79
ff_ivi_horizontal_scan_8x8,
80
ff_ivi_horizontal_scan_8x8,
81
ff_ivi_horizontal_scan_8x8,
82
ff_ivi_horizontal_scan_8x8,
83
ff_ivi_horizontal_scan_8x8
87
* Indeo 4 dequant tables
89
static uint16_t ivi4_quant_8x8_intra[9][64] = {
91
43, 342, 385, 470, 555, 555, 598, 726,
92
342, 342, 470, 513, 555, 598, 726, 769,
93
385, 470, 555, 555, 598, 726, 726, 811,
94
470, 470, 555, 555, 598, 726, 769, 854,
95
470, 555, 555, 598, 683, 726, 854, 1025,
96
555, 555, 598, 683, 726, 854, 1025, 1153,
97
555, 555, 598, 726, 811, 982, 1195, 1451,
98
555, 598, 726, 811, 982, 1195, 1451, 1793
101
86, 1195, 2390, 2390, 4865, 4865, 4865, 4865,
102
1195, 1195, 2390, 2390, 4865, 4865, 4865, 4865,
103
2390, 2390, 4865, 4865, 6827, 6827, 6827, 6827,
104
2390, 2390, 4865, 4865, 6827, 6827, 6827, 6827,
105
4865, 4865, 6827, 6827, 6827, 6827, 6827, 6827,
106
4865, 4865, 6827, 6827, 6827, 6827, 6827, 6827,
107
4865, 4865, 6827, 6827, 6827, 6827, 6827, 6827,
108
4865, 4865, 6827, 6827, 6827, 6827, 6827, 6827
111
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
112
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
113
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
114
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
115
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
116
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
117
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835,
118
235, 1067, 1195, 1323, 1451, 1579, 1707, 1835
121
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
122
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
123
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
124
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
125
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
126
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
127
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414,
128
1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414
131
897, 897, 897, 897, 897, 897, 897, 897,
132
1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067,
133
1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
134
1409, 1409, 1409, 1409, 1409, 1409, 1409, 1409,
135
1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579,
136
1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750,
137
1921, 1921, 1921, 1921, 1921, 1921, 1921, 1921,
138
2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091
141
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
142
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
143
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
144
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
145
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
146
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
147
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
148
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414
151
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
152
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
153
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
154
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
155
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
156
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
157
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390,
158
2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390
161
22, 171, 214, 257, 257, 299, 299, 342,
162
171, 171, 257, 257, 299, 299, 342, 385,
163
214, 257, 257, 299, 299, 342, 342, 385,
164
257, 257, 257, 299, 299, 342, 385, 427,
165
257, 257, 299, 299, 342, 385, 427, 513,
166
257, 299, 299, 342, 385, 427, 513, 598,
167
299, 299, 299, 385, 385, 470, 598, 726,
168
299, 299, 385, 385, 470, 598, 726, 897
171
86, 598, 1195, 1195, 2390, 2390, 2390, 2390,
172
598, 598, 1195, 1195, 2390, 2390, 2390, 2390,
173
1195, 1195, 2390, 2390, 3414, 3414, 3414, 3414,
174
1195, 1195, 2390, 2390, 3414, 3414, 3414, 3414,
175
2390, 2390, 3414, 3414, 3414, 3414, 3414, 3414,
176
2390, 2390, 3414, 3414, 3414, 3414, 3414, 3414,
177
2390, 2390, 3414, 3414, 3414, 3414, 3414, 3414,
178
2390, 2390, 3414, 3414, 3414, 3414, 3414, 3414
182
static uint16_t ivi4_quant_8x8_inter[9][64] = {
184
427, 427, 470, 427, 427, 427, 470, 470,
185
427, 427, 470, 427, 427, 427, 470, 470,
186
470, 470, 470, 470, 470, 470, 470, 470,
187
427, 427, 470, 470, 427, 427, 470, 470,
188
427, 427, 470, 427, 427, 427, 470, 470,
189
427, 427, 470, 427, 427, 427, 470, 470,
190
470, 470, 470, 470, 470, 470, 470, 470,
191
470, 470, 470, 470, 470, 470, 470, 470
194
1707, 1707, 2433, 2433, 3414, 3414, 3414, 3414,
195
1707, 1707, 2433, 2433, 3414, 3414, 3414, 3414,
196
2433, 2433, 3414, 3414, 4822, 4822, 4822, 4822,
197
2433, 2433, 3414, 3414, 4822, 4822, 4822, 4822,
198
3414, 3414, 4822, 4822, 3414, 3414, 3414, 3414,
199
3414, 3414, 4822, 4822, 3414, 3414, 3414, 3414,
200
3414, 3414, 4822, 4822, 3414, 3414, 3414, 3414,
201
3414, 3414, 4822, 4822, 3414, 3414, 3414, 3414
204
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
205
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
206
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
207
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
208
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
209
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
210
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281,
211
1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281
214
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
215
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
216
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
217
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
218
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
219
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
220
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433,
221
2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433
224
1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
225
1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
226
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
227
1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
228
1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
229
1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
230
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
231
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281
234
2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
235
2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
236
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
237
3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
238
2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
239
2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
240
2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
241
2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433
244
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
245
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
246
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
247
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
248
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
249
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
250
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
251
1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707
254
86, 171, 171, 214, 214, 214, 214, 257,
255
171, 171, 214, 214, 214, 214, 257, 257,
256
171, 214, 214, 214, 214, 257, 257, 257,
257
214, 214, 214, 214, 257, 257, 257, 299,
258
214, 214, 214, 257, 257, 257, 299, 299,
259
214, 214, 257, 257, 257, 299, 299, 299,
260
214, 257, 257, 257, 299, 299, 299, 342,
261
257, 257, 257, 299, 299, 299, 342, 342
264
854, 854, 1195, 1195, 1707, 1707, 1707, 1707,
265
854, 854, 1195, 1195, 1707, 1707, 1707, 1707,
266
1195, 1195, 1707, 1707, 2390, 2390, 2390, 2390,
267
1195, 1195, 1707, 1707, 2390, 2390, 2390, 2390,
268
1707, 1707, 2390, 2390, 1707, 1707, 1707, 1707,
269
1707, 1707, 2390, 2390, 1707, 1707, 1707, 1707,
270
1707, 1707, 2390, 2390, 1707, 1707, 1707, 1707,
271
1707, 1707, 2390, 2390, 1707, 1707, 1707, 1707
275
static uint16_t ivi4_quant_4x4_intra[5][16] = {
283
129, 1025, 1451, 1451,
284
1025, 1025, 1451, 1451,
285
1451, 1451, 2049, 2049,
286
1451, 1451, 2049, 2049
308
static uint16_t ivi4_quant_4x4_inter[5][16] = {
316
513, 1025, 1238, 1238,
317
1025, 1025, 1238, 1238,
318
1238, 1238, 1451, 1451,
319
1238, 1238, 1451, 1451
342
* Table for mapping quant matrix index from the bitstream
343
* into internal quant table number.
345
static uint8_t quant_index_to_tab[22] = {
346
0, 1, 0, 2, 1, 3, 0, 4, 1, 5, 0, 1, 6, 7, 8, // for 8x8 quant matrixes
347
0, 1, 2, 2, 3, 3, 4 // for 4x4 quant matrixes
350
#endif /* AVCODEC_INDEO4DATA_H */