2 * Indeo Video Interactive 4 compatible decoder
3 * Copyright (c) 2009-2010 Maxim Poliakovski
5 * This file is part of FFmpeg.
7 * FFmpeg 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 * FFmpeg 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 FFmpeg; 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"
36 * standard picture dimensions
38 static const uint16_t ivi4_common_pic_sizes[14] = {
39 640, 480, 320, 240, 160, 120, 704, 480, 352, 240, 352, 288, 176, 144
43 * Indeo 4 8x8 scan (zigzag) patterns
45 static const uint8_t ivi4_alternate_scan_8x8[64] = {
46 0, 8, 1, 9, 16, 24, 2, 3, 17, 25, 10, 11, 32, 40, 48, 56,
47 4, 5, 6, 7, 33, 41, 49, 57, 18, 19, 26, 27, 12, 13, 14, 15,
48 34, 35, 43, 42, 50, 51, 59, 58, 20, 21, 22, 23, 31, 30, 29, 28,
49 36, 37, 38, 39, 47, 46, 45, 44, 52, 53, 54, 55, 63, 62, 61, 60
52 static const uint8_t ivi4_alternate_scan_4x4[16] = {
53 0, 1, 4, 5, 8, 12, 2, 3, 9, 13, 6, 7, 10, 11, 14, 15
56 static const uint8_t ivi4_vertical_scan_4x4[16] = {
57 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
60 static const uint8_t ivi4_horizontal_scan_4x4[16] = {
61 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
64 static const uint8_t * const scan_index_to_tab[15] = {
67 ivi4_alternate_scan_8x8,
68 ff_ivi_horizontal_scan_8x8,
69 ff_ivi_vertical_scan_8x8,
73 ff_ivi_direct_scan_4x4,
74 ivi4_alternate_scan_4x4,
75 ivi4_vertical_scan_4x4,
76 ivi4_horizontal_scan_4x4,
77 ff_ivi_direct_scan_4x4,
79 // TODO: check if those are needed
80 ff_ivi_horizontal_scan_8x8,
81 ff_ivi_horizontal_scan_8x8,
82 ff_ivi_horizontal_scan_8x8,
83 ff_ivi_horizontal_scan_8x8,
84 ff_ivi_horizontal_scan_8x8
88 * Indeo 4 dequant tables
90 static const uint16_t ivi4_quant_8x8_intra[9][64] = {
92 43, 342, 385, 470, 555, 555, 598, 726,
93 342, 342, 470, 513, 555, 598, 726, 769,
94 385, 470, 555, 555, 598, 726, 726, 811,
95 470, 470, 555, 555, 598, 726, 769, 854,
96 470, 555, 555, 598, 683, 726, 854, 1025,
97 555, 555, 598, 683, 726, 854, 1025, 1153,
98 555, 555, 598, 726, 811, 982, 1195, 1451,
99 555, 598, 726, 811, 982, 1195, 1451, 1793
102 86, 1195, 2390, 2390, 4865, 4865, 4865, 4865,
103 1195, 1195, 2390, 2390, 4865, 4865, 4865, 4865,
104 2390, 2390, 4865, 4865, 6827, 6827, 6827, 6827,
105 2390, 2390, 4865, 4865, 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,
109 4865, 4865, 6827, 6827, 6827, 6827, 6827, 6827
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,
119 235, 1067, 1195, 1323, 1451, 1579, 1707, 1835
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,
129 1707, 1707, 3414, 3414, 3414, 3414, 3414, 3414
132 897, 897, 897, 897, 897, 897, 897, 897,
133 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067,
134 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
135 1409, 1409, 1409, 1409, 1409, 1409, 1409, 1409,
136 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579,
137 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750,
138 1921, 1921, 1921, 1921, 1921, 1921, 1921, 1921,
139 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091
142 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
143 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
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,
149 3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414
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,
159 2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390
162 22, 171, 214, 257, 257, 299, 299, 342,
163 171, 171, 257, 257, 299, 299, 342, 385,
164 214, 257, 257, 299, 299, 342, 342, 385,
165 257, 257, 257, 299, 299, 342, 385, 427,
166 257, 257, 299, 299, 342, 385, 427, 513,
167 257, 299, 299, 342, 385, 427, 513, 598,
168 299, 299, 299, 385, 385, 470, 598, 726,
169 299, 299, 385, 385, 470, 598, 726, 897
172 86, 598, 1195, 1195, 2390, 2390, 2390, 2390,
173 598, 598, 1195, 1195, 2390, 2390, 2390, 2390,
174 1195, 1195, 2390, 2390, 3414, 3414, 3414, 3414,
175 1195, 1195, 2390, 2390, 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,
179 2390, 2390, 3414, 3414, 3414, 3414, 3414, 3414
183 static const uint16_t ivi4_quant_8x8_inter[9][64] = {
185 427, 427, 470, 427, 427, 427, 470, 470,
186 427, 427, 470, 427, 427, 427, 470, 470,
187 470, 470, 470, 470, 470, 470, 470, 470,
188 427, 427, 470, 470, 427, 427, 470, 470,
189 427, 427, 470, 427, 427, 427, 470, 470,
190 427, 427, 470, 427, 427, 427, 470, 470,
191 470, 470, 470, 470, 470, 470, 470, 470,
192 470, 470, 470, 470, 470, 470, 470, 470
195 1707, 1707, 2433, 2433, 3414, 3414, 3414, 3414,
196 1707, 1707, 2433, 2433, 3414, 3414, 3414, 3414,
197 2433, 2433, 3414, 3414, 4822, 4822, 4822, 4822,
198 2433, 2433, 3414, 3414, 4822, 4822, 4822, 4822,
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,
202 3414, 3414, 4822, 4822, 3414, 3414, 3414, 3414
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,
212 1195, 1195, 1281, 1238, 1195, 1195, 1281, 1281
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,
222 2433, 2433, 3414, 3414, 2433, 2433, 2433, 2433
225 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
226 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
227 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
228 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
229 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
230 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
231 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
232 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281
235 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
236 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433,
237 3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
238 3414, 3414, 3414, 3414, 3414, 3414, 3414, 3414,
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,
242 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433
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,
252 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707
255 86, 171, 171, 214, 214, 214, 214, 257,
256 171, 171, 214, 214, 214, 214, 257, 257,
257 171, 214, 214, 214, 214, 257, 257, 257,
258 214, 214, 214, 214, 257, 257, 257, 299,
259 214, 214, 214, 257, 257, 257, 299, 299,
260 214, 214, 257, 257, 257, 299, 299, 299,
261 214, 257, 257, 257, 299, 299, 299, 342,
262 257, 257, 257, 299, 299, 299, 342, 342
265 854, 854, 1195, 1195, 1707, 1707, 1707, 1707,
266 854, 854, 1195, 1195, 1707, 1707, 1707, 1707,
267 1195, 1195, 1707, 1707, 2390, 2390, 2390, 2390,
268 1195, 1195, 1707, 1707, 2390, 2390, 2390, 2390,
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,
272 1707, 1707, 2390, 2390, 1707, 1707, 1707, 1707
276 static const uint16_t ivi4_quant_4x4_intra[5][16] = {
284 129, 1025, 1451, 1451,
285 1025, 1025, 1451, 1451,
286 1451, 1451, 2049, 2049,
287 1451, 1451, 2049, 2049
309 static const uint16_t ivi4_quant_4x4_inter[5][16] = {
317 513, 1025, 1238, 1238,
318 1025, 1025, 1238, 1238,
319 1238, 1238, 1451, 1451,
320 1238, 1238, 1451, 1451
343 * Table for mapping quant matrix index from the bitstream
344 * into internal quant table number.
346 static const uint8_t quant_index_to_tab[22] = {
347 0, 1, 0, 2, 1, 3, 0, 4, 1, 5, 0, 1, 6, 7, 8, // for 8x8 quant matrixes
348 0, 1, 2, 2, 3, 3, 4 // for 4x4 quant matrixes
351 #endif /* AVCODEC_INDEO4DATA_H */